@burojs/ui-shadcn 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -5
- package/dist/bulk-summary-CwSd6Yjb.cjs +108 -0
- package/dist/bulk-summary-CwSd6Yjb.cjs.map +1 -0
- package/dist/bulk-summary-GxMDP4bw.js +108 -0
- package/dist/bulk-summary-GxMDP4bw.js.map +1 -0
- package/dist/button-BxnnE28H.cjs +55 -0
- package/dist/button-BxnnE28H.cjs.map +1 -0
- package/dist/button-MWVeZaqj.js +44 -0
- package/dist/button-MWVeZaqj.js.map +1 -0
- package/dist/candidates-gate-Bb70LPAy.js +135 -0
- package/dist/candidates-gate-Bb70LPAy.js.map +1 -0
- package/dist/candidates-gate-D33jXLHO.cjs +153 -0
- package/dist/candidates-gate-D33jXLHO.cjs.map +1 -0
- package/dist/candidates-relation-picker-B116Bmqi.js +31 -0
- package/dist/candidates-relation-picker-B116Bmqi.js.map +1 -0
- package/dist/candidates-relation-picker-Cy0rTxvI.cjs +31 -0
- package/dist/candidates-relation-picker-Cy0rTxvI.cjs.map +1 -0
- package/dist/check-confirm-dialog--gPFnEeg.cjs +1547 -0
- package/dist/check-confirm-dialog--gPFnEeg.cjs.map +1 -0
- package/dist/check-confirm-dialog-bRT8lt0d.js +1245 -0
- package/dist/check-confirm-dialog-bRT8lt0d.js.map +1 -0
- package/dist/dialog-B_rt9S1c.js +63 -0
- package/dist/dialog-B_rt9S1c.js.map +1 -0
- package/dist/dialog-DRNUq9EA.cjs +112 -0
- package/dist/dialog-DRNUq9EA.cjs.map +1 -0
- package/dist/filter-builder-Bhn-dhZV.js +1621 -0
- package/dist/filter-builder-Bhn-dhZV.js.map +1 -0
- package/dist/filter-builder-nXqtM_h4.cjs +1789 -0
- package/dist/filter-builder-nXqtM_h4.cjs.map +1 -0
- package/dist/flow-runtime-D3avVH0I.cjs +255 -0
- package/dist/flow-runtime-D3avVH0I.cjs.map +1 -0
- package/dist/flow-runtime-s6lkRPKF.js +252 -0
- package/dist/flow-runtime-s6lkRPKF.js.map +1 -0
- package/dist/flow-screen-CCvgDI9G.js +704 -0
- package/dist/flow-screen-CCvgDI9G.js.map +1 -0
- package/dist/flow-screen-Ci_Sik4Y.cjs +708 -0
- package/dist/flow-screen-Ci_Sik4Y.cjs.map +1 -0
- package/dist/index.cjs +3420 -11986
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1843 -2015
- package/dist/index.d.ts +1849 -2021
- package/dist/index.js +3090 -11675
- package/dist/index.js.map +1 -1
- package/dist/inline-flow-host-B6FI0ctQ.js +112 -0
- package/dist/inline-flow-host-B6FI0ctQ.js.map +1 -0
- package/dist/inline-flow-host-DV1et3c6.cjs +112 -0
- package/dist/inline-flow-host-DV1et3c6.cjs.map +1 -0
- package/dist/input-BI0czGyI.cjs +23 -0
- package/dist/input-BI0czGyI.cjs.map +1 -0
- package/dist/input-CUPStzZO.js +17 -0
- package/dist/input-CUPStzZO.js.map +1 -0
- package/dist/label-66W1qbke.js +29 -0
- package/dist/label-66W1qbke.js.map +1 -0
- package/dist/label-w6JYf2cF.cjs +36 -0
- package/dist/label-w6JYf2cF.cjs.map +1 -0
- package/dist/markdown/index.cjs +1 -1
- package/dist/markdown/index.d.cts +2 -3
- package/dist/markdown/index.d.ts +2 -3
- package/dist/markdown/index.js +1 -1
- package/dist/page-flow-route-hdnULWqd.cjs +277 -0
- package/dist/page-flow-route-hdnULWqd.cjs.map +1 -0
- package/dist/page-flow-route-i3ZfJ1sd.js +277 -0
- package/dist/page-flow-route-i3ZfJ1sd.js.map +1 -0
- package/dist/place-node-C5SmIAYU.cjs +8139 -0
- package/dist/place-node-C5SmIAYU.cjs.map +1 -0
- package/dist/place-node-NraNYKPx.js +7597 -0
- package/dist/place-node-NraNYKPx.js.map +1 -0
- package/dist/related-list-cards-BWZ9GfOG.js +42 -0
- package/dist/related-list-cards-BWZ9GfOG.js.map +1 -0
- package/dist/related-list-cards-CFq3meUn.cjs +42 -0
- package/dist/related-list-cards-CFq3meUn.cjs.map +1 -0
- package/dist/related-list-timeline-CCzl71aA.cjs +142 -0
- package/dist/related-list-timeline-CCzl71aA.cjs.map +1 -0
- package/dist/related-list-timeline-yrPsjA3F.js +142 -0
- package/dist/related-list-timeline-yrPsjA3F.js.map +1 -0
- package/dist/related-rows-ea43qhhy.cjs +208 -0
- package/dist/related-rows-ea43qhhy.cjs.map +1 -0
- package/dist/related-rows-o0_t-Yce.js +185 -0
- package/dist/related-rows-o0_t-Yce.js.map +1 -0
- package/dist/relation-create-IA40t1hi.cjs +364 -0
- package/dist/relation-create-IA40t1hi.cjs.map +1 -0
- package/dist/relation-create-h6F9B4C4.js +339 -0
- package/dist/relation-create-h6F9B4C4.js.map +1 -0
- package/dist/relation-many-picker-C8zFEjwd.cjs +467 -0
- package/dist/relation-many-picker-C8zFEjwd.cjs.map +1 -0
- package/dist/relation-many-picker-bvkjkv-k.js +466 -0
- package/dist/relation-many-picker-bvkjkv-k.js.map +1 -0
- package/dist/relation-picker-Z0ZJJ5uS.js +493 -0
- package/dist/relation-picker-Z0ZJJ5uS.js.map +1 -0
- package/dist/relation-picker-dialog-0IzkjmiA.cjs +304 -0
- package/dist/relation-picker-dialog-0IzkjmiA.cjs.map +1 -0
- package/dist/relation-picker-dialog-B6nIiJBf.js +303 -0
- package/dist/relation-picker-dialog-B6nIiJBf.js.map +1 -0
- package/dist/relation-picker-gag0qSR5.cjs +516 -0
- package/dist/relation-picker-gag0qSR5.cjs.map +1 -0
- package/dist/resource-page-router-3RUf9d1j.js +1588 -0
- package/dist/resource-page-router-3RUf9d1j.js.map +1 -0
- package/dist/resource-page-router-PXfMW9nh.cjs +1785 -0
- package/dist/resource-page-router-PXfMW9nh.cjs.map +1 -0
- package/dist/{rich-text-IDFvyvRE.js → rich-text-DFerywgz.js} +7 -4
- package/dist/{rich-text-IDFvyvRE.js.map → rich-text-DFerywgz.js.map} +1 -1
- package/dist/{rich-text-lndbYqzR.cjs → rich-text-vTyVjDoa.cjs} +25 -22
- package/dist/{rich-text-lndbYqzR.cjs.map → rich-text-vTyVjDoa.cjs.map} +1 -1
- package/dist/search-access-CPPmfuvy.js +654 -0
- package/dist/search-access-CPPmfuvy.js.map +1 -0
- package/dist/search-access-Dugvttlg.cjs +791 -0
- package/dist/search-access-Dugvttlg.cjs.map +1 -0
- package/dist/shell-BPlk8hEa.js +205 -0
- package/dist/shell-BPlk8hEa.js.map +1 -0
- package/dist/shell-DxhlsPwm.cjs +271 -0
- package/dist/shell-DxhlsPwm.cjs.map +1 -0
- package/dist/skeleton-U2noefj5.js +13 -0
- package/dist/skeleton-U2noefj5.js.map +1 -0
- package/dist/skeleton-_1gP7wan.cjs +18 -0
- package/dist/skeleton-_1gP7wan.cjs.map +1 -0
- package/dist/styles.css +241 -9
- package/dist/toaster-C02XbB9r.js +135 -0
- package/dist/toaster-C02XbB9r.js.map +1 -0
- package/dist/toaster-Cr51X7bz.cjs +195 -0
- package/dist/toaster-Cr51X7bz.cjs.map +1 -0
- package/dist/use-dialog-filter-state-C--oMAZG.js +87 -0
- package/dist/use-dialog-filter-state-C--oMAZG.js.map +1 -0
- package/dist/use-dialog-filter-state-Dhe8PcB5.cjs +92 -0
- package/dist/use-dialog-filter-state-Dhe8PcB5.cjs.map +1 -0
- package/dist/{use-theme-BwPWinB2.cjs → use-theme-DFlpXils.cjs} +12 -1
- package/dist/use-theme-DFlpXils.cjs.map +1 -0
- package/dist/{use-theme-IHmtrhEt.js → use-theme-dnE3Od3I.js} +7 -2
- package/dist/use-theme-dnE3Od3I.js.map +1 -0
- package/package.json +16 -14
- package/dist/use-theme-BwPWinB2.cjs.map +0 -1
- package/dist/use-theme-IHmtrhEt.js.map +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { lt as RELATED_GRID_CLASS } from "./place-node-NraNYKPx.js";
|
|
2
|
+
import { i as useProjectedRows, n as RowContent, r as RowOpener, t as ITEM_LAYER_CLASS } from "./related-rows-o0_t-Yce.js";
|
|
3
|
+
import { useTestIds } from "@burojs/react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/blocks/related-list-cards.tsx
|
|
6
|
+
const GRID_CLASS = RELATED_GRID_CLASS;
|
|
7
|
+
function RelatedCards({ resource, placementKey, rows, item, columns, rowQuick, rowHref }) {
|
|
8
|
+
const ids = useTestIds();
|
|
9
|
+
const { project, drawn, title } = useProjectedRows(resource, rows, item);
|
|
10
|
+
return jsx("div", {
|
|
11
|
+
className: "@container",
|
|
12
|
+
children: jsx("ul", {
|
|
13
|
+
className: GRID_CLASS,
|
|
14
|
+
children: rows.map((row) => jsx("li", {
|
|
15
|
+
className: "min-w-0",
|
|
16
|
+
children: jsxs("article", {
|
|
17
|
+
"data-testid": ids.relatedCard(placementKey, String(row.id)),
|
|
18
|
+
className: "relative h-full rounded-lg border bg-card p-3 text-card-foreground",
|
|
19
|
+
children: [jsx(RowOpener, {
|
|
20
|
+
title: title(row),
|
|
21
|
+
href: rowHref?.(row),
|
|
22
|
+
quick: rowQuick?.(row) ?? null
|
|
23
|
+
}), jsx("div", {
|
|
24
|
+
className: ITEM_LAYER_CLASS,
|
|
25
|
+
children: jsx(RowContent, {
|
|
26
|
+
resource,
|
|
27
|
+
raw: row,
|
|
28
|
+
row: project(row),
|
|
29
|
+
item,
|
|
30
|
+
drawn,
|
|
31
|
+
columns
|
|
32
|
+
})
|
|
33
|
+
})]
|
|
34
|
+
})
|
|
35
|
+
}, row.id))
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { RelatedCards };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=related-list-cards-BWZ9GfOG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-list-cards-BWZ9GfOG.js","names":[],"sources":["../src/blocks/related-list-cards.tsx"],"sourcesContent":["'use client';\nimport { useTestIds } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport {\n ITEM_LAYER_CLASS,\n type RelatedRowsProps,\n RowContent,\n RowOpener,\n useProjectedRows,\n} from './related-rows.js';\nimport { RELATED_GRID_CLASS } from './related-skeletons.js';\n\n/** The grid the cards sit in; `RelatedCardsSkeleton` shares it. */\nconst GRID_CLASS = RELATED_GRID_CLASS;\n\n/** A related list as cards (`view: 'cards'`, P6 3.13): one `<article>` per row. */\nexport function RelatedCards({\n resource,\n placementKey,\n rows,\n item,\n columns,\n rowQuick,\n rowHref,\n}: RelatedRowsProps): ReactElement {\n const ids = useTestIds();\n const { project, drawn, title } = useProjectedRows(resource, rows, item);\n return (\n <div className=\"@container\">\n <ul className={GRID_CLASS}>\n {rows.map((row) => (\n <li key={row.id} className=\"min-w-0\">\n <article\n data-testid={ids.relatedCard(placementKey, String(row.id))}\n className=\"relative h-full rounded-lg border bg-card p-3 text-card-foreground\"\n >\n <RowOpener title={title(row)} href={rowHref?.(row)} quick={rowQuick?.(row) ?? null} />\n <div className={ITEM_LAYER_CLASS}>\n <RowContent\n resource={resource}\n raw={row}\n row={project(row)}\n item={item}\n drawn={drawn}\n columns={columns}\n />\n </div>\n </article>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n"],"mappings":";;;;;AAaA,MAAM,aAAa;AAGnB,SAAgB,aAAa,EAC3B,UACA,cACA,MACA,MACA,SACA,UACA,WACiC;CACjC,MAAM,MAAM,WAAW;CACvB,MAAM,EAAE,SAAS,OAAO,UAAU,iBAAiB,UAAU,MAAM,IAAI;CACvE,OACE,IAAC,OAAD;EAAK,WAAU;EACb,UAAA,IAAC,MAAD;GAAI,WAAW;GACZ,UAAA,KAAK,KAAK,QACT,IAAC,MAAD;IAAiB,WAAU;IACzB,UAAA,KAAC,WAAD;KACE,eAAa,IAAI,YAAY,cAAc,OAAO,IAAI,EAAE,CAAC;KACzD,WAAU;KAFZ,UAAA,CAIE,IAAC,WAAD;MAAW,OAAO,MAAM,GAAG;MAAG,MAAM,UAAU,GAAG;MAAG,OAAO,WAAW,GAAG,KAAK;KAAO,CAAA,GACrF,IAAC,OAAD;MAAK,WAAW;MACd,UAAA,IAAC,YAAD;OACY;OACV,KAAK;OACL,KAAK,QAAQ,GAAG;OACV;OACC;OACE;MACV,CAAA;KACE,CAAA,CACE;;GACP,GAjBK,IAAI,EAiBT,CACL;EACC,CAAA;CACD,CAAA;AAET"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const require_place_node = require("./place-node-C5SmIAYU.cjs");
|
|
2
|
+
const require_related_rows = require("./related-rows-ea43qhhy.cjs");
|
|
3
|
+
let _burojs_react = require("@burojs/react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
//#region src/blocks/related-list-cards.tsx
|
|
6
|
+
const GRID_CLASS = require_place_node.RELATED_GRID_CLASS;
|
|
7
|
+
function RelatedCards({ resource, placementKey, rows, item, columns, rowQuick, rowHref }) {
|
|
8
|
+
const ids = (0, _burojs_react.useTestIds)();
|
|
9
|
+
const { project, drawn, title } = require_related_rows.useProjectedRows(resource, rows, item);
|
|
10
|
+
return (0, react_jsx_runtime.jsx)("div", {
|
|
11
|
+
className: "@container",
|
|
12
|
+
children: (0, react_jsx_runtime.jsx)("ul", {
|
|
13
|
+
className: GRID_CLASS,
|
|
14
|
+
children: rows.map((row) => (0, react_jsx_runtime.jsx)("li", {
|
|
15
|
+
className: "min-w-0",
|
|
16
|
+
children: (0, react_jsx_runtime.jsxs)("article", {
|
|
17
|
+
"data-testid": ids.relatedCard(placementKey, String(row.id)),
|
|
18
|
+
className: "relative h-full rounded-lg border bg-card p-3 text-card-foreground",
|
|
19
|
+
children: [(0, react_jsx_runtime.jsx)(require_related_rows.RowOpener, {
|
|
20
|
+
title: title(row),
|
|
21
|
+
href: rowHref?.(row),
|
|
22
|
+
quick: rowQuick?.(row) ?? null
|
|
23
|
+
}), (0, react_jsx_runtime.jsx)("div", {
|
|
24
|
+
className: require_related_rows.ITEM_LAYER_CLASS,
|
|
25
|
+
children: (0, react_jsx_runtime.jsx)(require_related_rows.RowContent, {
|
|
26
|
+
resource,
|
|
27
|
+
raw: row,
|
|
28
|
+
row: project(row),
|
|
29
|
+
item,
|
|
30
|
+
drawn,
|
|
31
|
+
columns
|
|
32
|
+
})
|
|
33
|
+
})]
|
|
34
|
+
})
|
|
35
|
+
}, row.id))
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.RelatedCards = RelatedCards;
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=related-list-cards-CFq3meUn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-list-cards-CFq3meUn.cjs","names":["RELATED_GRID_CLASS","useTestIds","useProjectedRows","RowOpener","ITEM_LAYER_CLASS","RowContent"],"sources":["../src/blocks/related-list-cards.tsx"],"sourcesContent":["'use client';\nimport { useTestIds } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport {\n ITEM_LAYER_CLASS,\n type RelatedRowsProps,\n RowContent,\n RowOpener,\n useProjectedRows,\n} from './related-rows.js';\nimport { RELATED_GRID_CLASS } from './related-skeletons.js';\n\n/** The grid the cards sit in; `RelatedCardsSkeleton` shares it. */\nconst GRID_CLASS = RELATED_GRID_CLASS;\n\n/** A related list as cards (`view: 'cards'`, P6 3.13): one `<article>` per row. */\nexport function RelatedCards({\n resource,\n placementKey,\n rows,\n item,\n columns,\n rowQuick,\n rowHref,\n}: RelatedRowsProps): ReactElement {\n const ids = useTestIds();\n const { project, drawn, title } = useProjectedRows(resource, rows, item);\n return (\n <div className=\"@container\">\n <ul className={GRID_CLASS}>\n {rows.map((row) => (\n <li key={row.id} className=\"min-w-0\">\n <article\n data-testid={ids.relatedCard(placementKey, String(row.id))}\n className=\"relative h-full rounded-lg border bg-card p-3 text-card-foreground\"\n >\n <RowOpener title={title(row)} href={rowHref?.(row)} quick={rowQuick?.(row) ?? null} />\n <div className={ITEM_LAYER_CLASS}>\n <RowContent\n resource={resource}\n raw={row}\n row={project(row)}\n item={item}\n drawn={drawn}\n columns={columns}\n />\n </div>\n </article>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n"],"mappings":";;;;;AAaA,MAAM,aAAaA,mBAAAA;AAGnB,SAAgB,aAAa,EAC3B,UACA,cACA,MACA,MACA,SACA,UACA,WACiC;CACjC,MAAM,OAAA,GAAMC,cAAAA,WAAAA,CAAW;CACvB,MAAM,EAAE,SAAS,OAAO,UAAUC,qBAAAA,iBAAiB,UAAU,MAAM,IAAI;CACvE,QACE,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACb,WAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;GAAI,WAAW;GACZ,UAAA,KAAK,KAAK,SACT,GAAA,kBAAA,IAAA,CAAC,MAAD;IAAiB,WAAU;IACzB,WAAA,GAAA,kBAAA,KAAA,CAAC,WAAD;KACE,eAAa,IAAI,YAAY,cAAc,OAAO,IAAI,EAAE,CAAC;KACzD,WAAU;KAFZ,UAAA,EAIE,GAAA,kBAAA,IAAA,CAACC,qBAAAA,WAAD;MAAW,OAAO,MAAM,GAAG;MAAG,MAAM,UAAU,GAAG;MAAG,OAAO,WAAW,GAAG,KAAK;KAAO,CAAA,IACrF,GAAA,kBAAA,IAAA,CAAC,OAAD;MAAK,WAAWC,qBAAAA;MACd,WAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,YAAD;OACY;OACV,KAAK;OACL,KAAK,QAAQ,GAAG;OACV;OACC;OACE;MACV,CAAA;KACE,CAAA,CACE;;GACP,GAjBK,IAAI,EAiBT,CACL;EACC,CAAA;CACD,CAAA;AAET"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const require_related_rows = require("./related-rows-ea43qhhy.cjs");
|
|
2
|
+
let _burojs_react = require("@burojs/react");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
//#region src/blocks/related-list-timeline.tsx
|
|
6
|
+
function dayOf(value) {
|
|
7
|
+
if (typeof value === "string") {
|
|
8
|
+
const only = /^(\d{4})-(\d{2})-(\d{2})$/u.exec(value);
|
|
9
|
+
if (only !== null) return {
|
|
10
|
+
date: new Date(Number(only[1]), Number(only[2]) - 1, Number(only[3])),
|
|
11
|
+
timed: false
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
if (typeof value !== "string" && typeof value !== "number" && !(value instanceof Date)) return void 0;
|
|
15
|
+
const date = new Date(value);
|
|
16
|
+
return Number.isNaN(date.getTime()) ? void 0 : {
|
|
17
|
+
date,
|
|
18
|
+
timed: true
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const dayKey = (date) => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
|
|
22
|
+
function RelatedTimeline({ resource, placementKey, rows, item, columns, rowQuick, rowHref }) {
|
|
23
|
+
const ids = (0, _burojs_react.useTestIds)();
|
|
24
|
+
const app = (0, _burojs_react.useApp)();
|
|
25
|
+
const t = (0, _burojs_react.useOptionalT)();
|
|
26
|
+
const locale = (0, _burojs_react.useOptionalLocale)();
|
|
27
|
+
const { project, drawn, title } = require_related_rows.useProjectedRows(resource, rows, item);
|
|
28
|
+
const axis = app.registry.get(resource)?.views?.list?.defaultSort?.[0]?.field;
|
|
29
|
+
const formats = (0, react.useMemo)(() => {
|
|
30
|
+
try {
|
|
31
|
+
return {
|
|
32
|
+
day: new Intl.DateTimeFormat(locale, { dateStyle: "full" }),
|
|
33
|
+
time: new Intl.DateTimeFormat(locale, { timeStyle: "short" })
|
|
34
|
+
};
|
|
35
|
+
} catch {
|
|
36
|
+
return {
|
|
37
|
+
day: new Intl.DateTimeFormat(void 0, { dateStyle: "full" }),
|
|
38
|
+
time: new Intl.DateTimeFormat(void 0, { timeStyle: "short" })
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}, [locale]);
|
|
42
|
+
const groups = (0, react.useMemo)(() => {
|
|
43
|
+
const out = [];
|
|
44
|
+
if (axis === void 0) return out;
|
|
45
|
+
const undated = [];
|
|
46
|
+
for (const row of rows) {
|
|
47
|
+
const day = dayOf(project(row)[axis]);
|
|
48
|
+
if (day === void 0) {
|
|
49
|
+
undated.push({
|
|
50
|
+
row,
|
|
51
|
+
at: void 0,
|
|
52
|
+
timed: false
|
|
53
|
+
});
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const key = dayKey(day.date);
|
|
57
|
+
let group = out.find((entry) => entry.key === key);
|
|
58
|
+
if (group === void 0) {
|
|
59
|
+
group = {
|
|
60
|
+
key,
|
|
61
|
+
heading: day.date,
|
|
62
|
+
entries: []
|
|
63
|
+
};
|
|
64
|
+
out.push(group);
|
|
65
|
+
}
|
|
66
|
+
group.entries.push({
|
|
67
|
+
row,
|
|
68
|
+
at: day.date,
|
|
69
|
+
timed: day.timed
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (undated.length > 0) out.push({
|
|
73
|
+
key: "undated",
|
|
74
|
+
heading: void 0,
|
|
75
|
+
entries: undated
|
|
76
|
+
});
|
|
77
|
+
return out;
|
|
78
|
+
}, [
|
|
79
|
+
rows,
|
|
80
|
+
axis,
|
|
81
|
+
project
|
|
82
|
+
]);
|
|
83
|
+
const headingOf = (group) => group.heading === void 0 ? t("timeline.undated", { defaultValue: "Undated" }) : formats.day.format(group.heading);
|
|
84
|
+
if (groups.length === 0) return (0, react_jsx_runtime.jsx)("p", {
|
|
85
|
+
className: "text-sm text-muted-foreground",
|
|
86
|
+
children: t("timeline.empty", { defaultValue: "No entries" })
|
|
87
|
+
});
|
|
88
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
89
|
+
className: "relative flex flex-col gap-4 pl-5",
|
|
90
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
91
|
+
"data-buro-timeline-rail": "",
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
className: "absolute top-1 bottom-1 left-2 w-px bg-border"
|
|
94
|
+
}), groups.map((group) => (0, react_jsx_runtime.jsxs)("section", {
|
|
95
|
+
"aria-label": headingOf(group),
|
|
96
|
+
className: "flex flex-col gap-1",
|
|
97
|
+
children: [(0, react_jsx_runtime.jsx)("h3", {
|
|
98
|
+
className: "text-xs text-muted-foreground",
|
|
99
|
+
children: headingOf(group)
|
|
100
|
+
}), (0, react_jsx_runtime.jsx)("ol", {
|
|
101
|
+
className: "flex flex-col",
|
|
102
|
+
children: group.entries.map(({ row, at, timed }) => (0, react_jsx_runtime.jsxs)("li", {
|
|
103
|
+
"data-testid": ids.timelineEntry(placementKey, String(row.id)),
|
|
104
|
+
className: "relative flex min-w-0 items-baseline gap-3 rounded-md py-1.5 pr-2",
|
|
105
|
+
children: [
|
|
106
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
107
|
+
"data-buro-timeline-dot": "",
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
className: "absolute top-2.5 -left-[1.1rem] size-3 rounded-full border-2 border-background bg-muted-foreground"
|
|
110
|
+
}),
|
|
111
|
+
(0, react_jsx_runtime.jsx)(require_related_rows.RowOpener, {
|
|
112
|
+
title: title(row),
|
|
113
|
+
href: rowHref?.(row),
|
|
114
|
+
quick: rowQuick?.(row) ?? null
|
|
115
|
+
}),
|
|
116
|
+
timed && at !== void 0 ? (0, react_jsx_runtime.jsx)("time", {
|
|
117
|
+
dateTime: at.toISOString(),
|
|
118
|
+
className: "w-16 shrink-0 whitespace-nowrap text-xs tabular-nums text-muted-foreground",
|
|
119
|
+
children: formats.time.format(at)
|
|
120
|
+
}) : null,
|
|
121
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
122
|
+
className: `${require_related_rows.ITEM_LAYER_CLASS} min-w-0 flex-1`,
|
|
123
|
+
children: (0, react_jsx_runtime.jsx)(require_related_rows.RowContent, {
|
|
124
|
+
resource,
|
|
125
|
+
raw: row,
|
|
126
|
+
row: project(row),
|
|
127
|
+
item,
|
|
128
|
+
drawn,
|
|
129
|
+
columns,
|
|
130
|
+
variant: "entry"
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}, row.id))
|
|
135
|
+
})]
|
|
136
|
+
}, group.key))]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
exports.RelatedTimeline = RelatedTimeline;
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=related-list-timeline-CCzl71aA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-list-timeline-CCzl71aA.cjs","names":["useTestIds","useApp","useOptionalT","useOptionalLocale","useProjectedRows","useMemo","RowOpener","ITEM_LAYER_CLASS","RowContent"],"sources":["../src/blocks/related-list-timeline.tsx"],"sourcesContent":["'use client';\nimport { useApp, useOptionalLocale, useOptionalT, useTestIds } from '@burojs/react';\nimport { type ReactElement, useMemo } from 'react';\nimport {\n ITEM_LAYER_CLASS,\n type ListRow,\n type RelatedRowsProps,\n RowContent,\n RowOpener,\n useProjectedRows,\n} from './related-rows.js';\n\n/** The date of a row's axis value, else undefined. A date-only value is the local day it names. */\nfunction dayOf(value: unknown): { readonly date: Date; readonly timed: boolean } | undefined {\n if (typeof value === 'string') {\n const only = /^(\\d{4})-(\\d{2})-(\\d{2})$/u.exec(value);\n if (only !== null)\n return {\n date: new Date(Number(only[1]), Number(only[2]) - 1, Number(only[3])),\n timed: false,\n };\n }\n if (typeof value !== 'string' && typeof value !== 'number' && !(value instanceof Date))\n return undefined;\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? undefined : { date, timed: true };\n}\n\nconst dayKey = (date: Date) => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;\n\ninterface Group {\n readonly key: string;\n /** The day the group names; undefined for the undated group. */\n readonly heading: Date | undefined;\n readonly entries: {\n readonly row: ListRow;\n readonly at: Date | undefined;\n readonly timed: boolean;\n }[];\n}\n\n/**\n * A related list as a timeline (`view: 'timeline'`, P6 3.13): one column grouped by the local\n * day of the target's `views.list.defaultSort[0].field`, headings formatted by the active locale,\n * entries in the list's own (declared) order, each the time and then the item. There is no sort\n * control: the axis is the declared sort.\n *\n * The axis is read from the projected row, as every other field is: a viewer who may not see it\n * gets no day and no time. A row whose axis reads nothing (hidden, empty or unparseable) is kept\n * in one trailing \"Undated\" group, so the entries drawn are the rows the list counts.\n */\nexport function RelatedTimeline({\n resource,\n placementKey,\n rows,\n item,\n columns,\n rowQuick,\n rowHref,\n}: RelatedRowsProps): ReactElement {\n const ids = useTestIds();\n const app = useApp();\n const t = useOptionalT();\n const locale = useOptionalLocale();\n const { project, drawn, title } = useProjectedRows(resource, rows, item);\n const axis = (\n app.registry.get(resource) as\n | {\n readonly views?: {\n readonly list?: { readonly defaultSort?: readonly { readonly field: string }[] };\n };\n }\n | undefined\n )?.views?.list?.defaultSort?.[0]?.field;\n const formats = useMemo(() => {\n try {\n return {\n day: new Intl.DateTimeFormat(locale, { dateStyle: 'full' }),\n time: new Intl.DateTimeFormat(locale, { timeStyle: 'short' }),\n };\n } catch {\n return {\n day: new Intl.DateTimeFormat(undefined, { dateStyle: 'full' }),\n time: new Intl.DateTimeFormat(undefined, { timeStyle: 'short' }),\n };\n }\n }, [locale]);\n const groups = useMemo(() => {\n const out: Group[] = [];\n if (axis === undefined) return out;\n const undated: Group['entries'] = [];\n for (const row of rows) {\n const day = dayOf(project(row)[axis]);\n if (day === undefined) {\n undated.push({ row, at: undefined, timed: false });\n continue;\n }\n const key = dayKey(day.date);\n let group = out.find((entry) => entry.key === key);\n if (group === undefined) {\n group = { key, heading: day.date, entries: [] };\n out.push(group);\n }\n group.entries.push({ row, at: day.date, timed: day.timed });\n }\n if (undated.length > 0) out.push({ key: 'undated', heading: undefined, entries: undated });\n return out;\n }, [rows, axis, project]);\n const headingOf = (group: Group): string =>\n group.heading === undefined\n ? t('timeline.undated', { defaultValue: 'Undated' })\n : formats.day.format(group.heading);\n if (groups.length === 0)\n return (\n <p className=\"text-sm text-muted-foreground\">\n {t('timeline.empty', { defaultValue: 'No entries' })}\n </p>\n );\n // One rail down the whole list (a border per day broke at every heading), a dot per entry on it;\n // the day headings are the axis' labels, small and muted, and the entries carry the weight.\n return (\n <div className=\"relative flex flex-col gap-4 pl-5\">\n <span\n data-buro-timeline-rail=\"\"\n aria-hidden=\"true\"\n className=\"absolute top-1 bottom-1 left-2 w-px bg-border\"\n />\n {groups.map((group) => (\n <section key={group.key} aria-label={headingOf(group)} className=\"flex flex-col gap-1\">\n <h3 className=\"text-xs text-muted-foreground\">{headingOf(group)}</h3>\n <ol className=\"flex flex-col\">\n {group.entries.map(({ row, at, timed }) => (\n <li\n key={row.id}\n data-testid={ids.timelineEntry(placementKey, String(row.id))}\n className=\"relative flex min-w-0 items-baseline gap-3 rounded-md py-1.5 pr-2\"\n >\n <span\n data-buro-timeline-dot=\"\"\n aria-hidden=\"true\"\n className=\"absolute top-2.5 -left-[1.1rem] size-3 rounded-full border-2 border-background bg-muted-foreground\"\n />\n <RowOpener\n title={title(row)}\n href={rowHref?.(row)}\n quick={rowQuick?.(row) ?? null}\n />\n {timed && at !== undefined ? (\n <time\n dateTime={at.toISOString()}\n className=\"w-16 shrink-0 whitespace-nowrap text-xs tabular-nums text-muted-foreground\"\n >\n {formats.time.format(at)}\n </time>\n ) : null}\n <div className={`${ITEM_LAYER_CLASS} min-w-0 flex-1`}>\n <RowContent\n resource={resource}\n raw={row}\n row={project(row)}\n item={item}\n drawn={drawn}\n columns={columns}\n variant=\"entry\"\n />\n </div>\n </li>\n ))}\n </ol>\n </section>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;AAaA,SAAS,MAAM,OAA8E;CAC3F,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,OAAO,6BAA6B,KAAK,KAAK;EACpD,IAAI,SAAS,MACX,OAAO;GACL,MAAM,IAAI,KAAK,OAAO,KAAK,EAAE,GAAG,OAAO,KAAK,EAAE,IAAI,GAAG,OAAO,KAAK,EAAE,CAAC;GACpE,OAAO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C,UAAA,UAAU,KAAK;GAAM,CAAA,IACpE,GAAA,kBAAA,IAAA,CAAC,MAAD;IAAI,WAAU;IACX,UAAA,MAAM,QAAQ,KAAK,EAAE,KAAK,IAAI,aAC7B,GAAA,kBAAA,KAAA,CAAC,MAAD;KAEE,eAAa,IAAI,cAAc,cAAc,OAAO,IAAI,EAAE,CAAC;KAC3D,WAAU;KAHZ,UAAA;OAKE,GAAA,kBAAA,IAAA,CAAC,QAAD;OACE,0BAAuB;OACvB,eAAY;OACZ,WAAU;MACX,CAAA;OACD,GAAA,kBAAA,IAAA,CAACC,qBAAAA,WAAD;OACE,OAAO,MAAM,GAAG;OAChB,MAAM,UAAU,GAAG;OACnB,OAAO,WAAW,GAAG,KAAK;MAC3B,CAAA;MACA,SAAS,OAAO,KAAA,KACf,GAAA,kBAAA,IAAA,CAAC,QAAD;OACE,UAAU,GAAG,YAAY;OACzB,WAAU;OAET,UAAA,QAAQ,KAAK,OAAO,EAAE;MACnB,CAAA,IACJ;OACJ,GAAA,kBAAA,IAAA,CAAC,OAAD;OAAK,WAAW,GAAGC,qBAAAA,iBAAiB;OAClC,WAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,YAAD;QACY;QACV,KAAK;QACL,KAAK,QAAQ,GAAG;QACV;QACC;QACE;QACT,SAAQ;OACT,CAAA;MACE,CAAA;KACH;IAjCG,GAAA,IAAI,EAiCP,CACL;GACC,CAAA,CACG;EAzCK,GAAA,MAAM,GAyCX,CACV,CACE;;AAET"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { i as useProjectedRows, n as RowContent, r as RowOpener, t as ITEM_LAYER_CLASS } from "./related-rows-o0_t-Yce.js";
|
|
2
|
+
import { useApp, useOptionalLocale, useOptionalT, useTestIds } from "@burojs/react";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/blocks/related-list-timeline.tsx
|
|
6
|
+
function dayOf(value) {
|
|
7
|
+
if (typeof value === "string") {
|
|
8
|
+
const only = /^(\d{4})-(\d{2})-(\d{2})$/u.exec(value);
|
|
9
|
+
if (only !== null) return {
|
|
10
|
+
date: new Date(Number(only[1]), Number(only[2]) - 1, Number(only[3])),
|
|
11
|
+
timed: false
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
if (typeof value !== "string" && typeof value !== "number" && !(value instanceof Date)) return void 0;
|
|
15
|
+
const date = new Date(value);
|
|
16
|
+
return Number.isNaN(date.getTime()) ? void 0 : {
|
|
17
|
+
date,
|
|
18
|
+
timed: true
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const dayKey = (date) => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
|
|
22
|
+
function RelatedTimeline({ resource, placementKey, rows, item, columns, rowQuick, rowHref }) {
|
|
23
|
+
const ids = useTestIds();
|
|
24
|
+
const app = useApp();
|
|
25
|
+
const t = useOptionalT();
|
|
26
|
+
const locale = useOptionalLocale();
|
|
27
|
+
const { project, drawn, title } = useProjectedRows(resource, rows, item);
|
|
28
|
+
const axis = app.registry.get(resource)?.views?.list?.defaultSort?.[0]?.field;
|
|
29
|
+
const formats = useMemo(() => {
|
|
30
|
+
try {
|
|
31
|
+
return {
|
|
32
|
+
day: new Intl.DateTimeFormat(locale, { dateStyle: "full" }),
|
|
33
|
+
time: new Intl.DateTimeFormat(locale, { timeStyle: "short" })
|
|
34
|
+
};
|
|
35
|
+
} catch {
|
|
36
|
+
return {
|
|
37
|
+
day: new Intl.DateTimeFormat(void 0, { dateStyle: "full" }),
|
|
38
|
+
time: new Intl.DateTimeFormat(void 0, { timeStyle: "short" })
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}, [locale]);
|
|
42
|
+
const groups = useMemo(() => {
|
|
43
|
+
const out = [];
|
|
44
|
+
if (axis === void 0) return out;
|
|
45
|
+
const undated = [];
|
|
46
|
+
for (const row of rows) {
|
|
47
|
+
const day = dayOf(project(row)[axis]);
|
|
48
|
+
if (day === void 0) {
|
|
49
|
+
undated.push({
|
|
50
|
+
row,
|
|
51
|
+
at: void 0,
|
|
52
|
+
timed: false
|
|
53
|
+
});
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const key = dayKey(day.date);
|
|
57
|
+
let group = out.find((entry) => entry.key === key);
|
|
58
|
+
if (group === void 0) {
|
|
59
|
+
group = {
|
|
60
|
+
key,
|
|
61
|
+
heading: day.date,
|
|
62
|
+
entries: []
|
|
63
|
+
};
|
|
64
|
+
out.push(group);
|
|
65
|
+
}
|
|
66
|
+
group.entries.push({
|
|
67
|
+
row,
|
|
68
|
+
at: day.date,
|
|
69
|
+
timed: day.timed
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (undated.length > 0) out.push({
|
|
73
|
+
key: "undated",
|
|
74
|
+
heading: void 0,
|
|
75
|
+
entries: undated
|
|
76
|
+
});
|
|
77
|
+
return out;
|
|
78
|
+
}, [
|
|
79
|
+
rows,
|
|
80
|
+
axis,
|
|
81
|
+
project
|
|
82
|
+
]);
|
|
83
|
+
const headingOf = (group) => group.heading === void 0 ? t("timeline.undated", { defaultValue: "Undated" }) : formats.day.format(group.heading);
|
|
84
|
+
if (groups.length === 0) return jsx("p", {
|
|
85
|
+
className: "text-sm text-muted-foreground",
|
|
86
|
+
children: t("timeline.empty", { defaultValue: "No entries" })
|
|
87
|
+
});
|
|
88
|
+
return jsxs("div", {
|
|
89
|
+
className: "relative flex flex-col gap-4 pl-5",
|
|
90
|
+
children: [jsx("span", {
|
|
91
|
+
"data-buro-timeline-rail": "",
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
className: "absolute top-1 bottom-1 left-2 w-px bg-border"
|
|
94
|
+
}), groups.map((group) => jsxs("section", {
|
|
95
|
+
"aria-label": headingOf(group),
|
|
96
|
+
className: "flex flex-col gap-1",
|
|
97
|
+
children: [jsx("h3", {
|
|
98
|
+
className: "text-xs text-muted-foreground",
|
|
99
|
+
children: headingOf(group)
|
|
100
|
+
}), jsx("ol", {
|
|
101
|
+
className: "flex flex-col",
|
|
102
|
+
children: group.entries.map(({ row, at, timed }) => jsxs("li", {
|
|
103
|
+
"data-testid": ids.timelineEntry(placementKey, String(row.id)),
|
|
104
|
+
className: "relative flex min-w-0 items-baseline gap-3 rounded-md py-1.5 pr-2",
|
|
105
|
+
children: [
|
|
106
|
+
jsx("span", {
|
|
107
|
+
"data-buro-timeline-dot": "",
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
className: "absolute top-2.5 -left-[1.1rem] size-3 rounded-full border-2 border-background bg-muted-foreground"
|
|
110
|
+
}),
|
|
111
|
+
jsx(RowOpener, {
|
|
112
|
+
title: title(row),
|
|
113
|
+
href: rowHref?.(row),
|
|
114
|
+
quick: rowQuick?.(row) ?? null
|
|
115
|
+
}),
|
|
116
|
+
timed && at !== void 0 ? jsx("time", {
|
|
117
|
+
dateTime: at.toISOString(),
|
|
118
|
+
className: "w-16 shrink-0 whitespace-nowrap text-xs tabular-nums text-muted-foreground",
|
|
119
|
+
children: formats.time.format(at)
|
|
120
|
+
}) : null,
|
|
121
|
+
jsx("div", {
|
|
122
|
+
className: `${ITEM_LAYER_CLASS} min-w-0 flex-1`,
|
|
123
|
+
children: jsx(RowContent, {
|
|
124
|
+
resource,
|
|
125
|
+
raw: row,
|
|
126
|
+
row: project(row),
|
|
127
|
+
item,
|
|
128
|
+
drawn,
|
|
129
|
+
columns,
|
|
130
|
+
variant: "entry"
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}, row.id))
|
|
135
|
+
})]
|
|
136
|
+
}, group.key))]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
export { RelatedTimeline };
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=related-list-timeline-yrPsjA3F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-list-timeline-yrPsjA3F.js","names":[],"sources":["../src/blocks/related-list-timeline.tsx"],"sourcesContent":["'use client';\nimport { useApp, useOptionalLocale, useOptionalT, useTestIds } from '@burojs/react';\nimport { type ReactElement, useMemo } from 'react';\nimport {\n ITEM_LAYER_CLASS,\n type ListRow,\n type RelatedRowsProps,\n RowContent,\n RowOpener,\n useProjectedRows,\n} from './related-rows.js';\n\n/** The date of a row's axis value, else undefined. A date-only value is the local day it names. */\nfunction dayOf(value: unknown): { readonly date: Date; readonly timed: boolean } | undefined {\n if (typeof value === 'string') {\n const only = /^(\\d{4})-(\\d{2})-(\\d{2})$/u.exec(value);\n if (only !== null)\n return {\n date: new Date(Number(only[1]), Number(only[2]) - 1, Number(only[3])),\n timed: false,\n };\n }\n if (typeof value !== 'string' && typeof value !== 'number' && !(value instanceof Date))\n return undefined;\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? undefined : { date, timed: true };\n}\n\nconst dayKey = (date: Date) => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;\n\ninterface Group {\n readonly key: string;\n /** The day the group names; undefined for the undated group. */\n readonly heading: Date | undefined;\n readonly entries: {\n readonly row: ListRow;\n readonly at: Date | undefined;\n readonly timed: boolean;\n }[];\n}\n\n/**\n * A related list as a timeline (`view: 'timeline'`, P6 3.13): one column grouped by the local\n * day of the target's `views.list.defaultSort[0].field`, headings formatted by the active locale,\n * entries in the list's own (declared) order, each the time and then the item. There is no sort\n * control: the axis is the declared sort.\n *\n * The axis is read from the projected row, as every other field is: a viewer who may not see it\n * gets no day and no time. A row whose axis reads nothing (hidden, empty or unparseable) is kept\n * in one trailing \"Undated\" group, so the entries drawn are the rows the list counts.\n */\nexport function RelatedTimeline({\n resource,\n placementKey,\n rows,\n item,\n columns,\n rowQuick,\n rowHref,\n}: RelatedRowsProps): ReactElement {\n const ids = useTestIds();\n const app = useApp();\n const t = useOptionalT();\n const locale = useOptionalLocale();\n const { project, drawn, title } = useProjectedRows(resource, rows, item);\n const axis = (\n app.registry.get(resource) as\n | {\n readonly views?: {\n readonly list?: { readonly defaultSort?: readonly { readonly field: string }[] };\n };\n }\n | undefined\n )?.views?.list?.defaultSort?.[0]?.field;\n const formats = useMemo(() => {\n try {\n return {\n day: new Intl.DateTimeFormat(locale, { dateStyle: 'full' }),\n time: new Intl.DateTimeFormat(locale, { timeStyle: 'short' }),\n };\n } catch {\n return {\n day: new Intl.DateTimeFormat(undefined, { dateStyle: 'full' }),\n time: new Intl.DateTimeFormat(undefined, { timeStyle: 'short' }),\n };\n }\n }, [locale]);\n const groups = useMemo(() => {\n const out: Group[] = [];\n if (axis === undefined) return out;\n const undated: Group['entries'] = [];\n for (const row of rows) {\n const day = dayOf(project(row)[axis]);\n if (day === undefined) {\n undated.push({ row, at: undefined, timed: false });\n continue;\n }\n const key = dayKey(day.date);\n let group = out.find((entry) => entry.key === key);\n if (group === undefined) {\n group = { key, heading: day.date, entries: [] };\n out.push(group);\n }\n group.entries.push({ row, at: day.date, timed: day.timed });\n }\n if (undated.length > 0) out.push({ key: 'undated', heading: undefined, entries: undated });\n return out;\n }, [rows, axis, project]);\n const headingOf = (group: Group): string =>\n group.heading === undefined\n ? t('timeline.undated', { defaultValue: 'Undated' })\n : formats.day.format(group.heading);\n if (groups.length === 0)\n return (\n <p className=\"text-sm text-muted-foreground\">\n {t('timeline.empty', { defaultValue: 'No entries' })}\n </p>\n );\n // One rail down the whole list (a border per day broke at every heading), a dot per entry on it;\n // the day headings are the axis' labels, small and muted, and the entries carry the weight.\n return (\n <div className=\"relative flex flex-col gap-4 pl-5\">\n <span\n data-buro-timeline-rail=\"\"\n aria-hidden=\"true\"\n className=\"absolute top-1 bottom-1 left-2 w-px bg-border\"\n />\n {groups.map((group) => (\n <section key={group.key} aria-label={headingOf(group)} className=\"flex flex-col gap-1\">\n <h3 className=\"text-xs text-muted-foreground\">{headingOf(group)}</h3>\n <ol className=\"flex flex-col\">\n {group.entries.map(({ row, at, timed }) => (\n <li\n key={row.id}\n data-testid={ids.timelineEntry(placementKey, String(row.id))}\n className=\"relative flex min-w-0 items-baseline gap-3 rounded-md py-1.5 pr-2\"\n >\n <span\n data-buro-timeline-dot=\"\"\n aria-hidden=\"true\"\n className=\"absolute top-2.5 -left-[1.1rem] size-3 rounded-full border-2 border-background bg-muted-foreground\"\n />\n <RowOpener\n title={title(row)}\n href={rowHref?.(row)}\n quick={rowQuick?.(row) ?? null}\n />\n {timed && at !== undefined ? (\n <time\n dateTime={at.toISOString()}\n className=\"w-16 shrink-0 whitespace-nowrap text-xs tabular-nums text-muted-foreground\"\n >\n {formats.time.format(at)}\n </time>\n ) : null}\n <div className={`${ITEM_LAYER_CLASS} min-w-0 flex-1`}>\n <RowContent\n resource={resource}\n raw={row}\n row={project(row)}\n item={item}\n drawn={drawn}\n columns={columns}\n variant=\"entry\"\n />\n </div>\n </li>\n ))}\n </ol>\n </section>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;AAaA,SAAS,MAAM,OAA8E;CAC3F,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,OAAO,6BAA6B,KAAK,KAAK;EACpD,IAAI,SAAS,MACX,OAAO;GACL,MAAM,IAAI,KAAK,OAAO,KAAK,EAAE,GAAG,OAAO,KAAK,EAAE,IAAI,GAAG,OAAO,KAAK,EAAE,CAAC;GACpE,OAAO;EACT;CACJ;CACA,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YAAY,EAAE,iBAAiB,OAC/E,OAAO,KAAA;CACT,MAAM,OAAO,IAAI,KAAK,KAAK;CAC3B,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,IAAI,KAAA,IAAY;EAAE;EAAM,OAAO;CAAK;AACxE;AAEA,MAAM,UAAU,SAAe,GAAG,KAAK,YAAY,EAAE,GAAG,KAAK,SAAS,EAAE,GAAG,KAAK,QAAQ;AAuBxF,SAAgB,gBAAgB,EAC9B,UACA,cACA,MACA,MACA,SACA,UACA,WACiC;CACjC,MAAM,MAAM,WAAW;CACvB,MAAM,MAAM,OAAO;CACnB,MAAM,IAA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AjCG,GAAA,IAAI,EAiCP,CACL;GACC,CAAA,CACG;EAzCK,GAAA,MAAM,GAyCX,CACV,CACE;;AAET"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
const require_toaster = require("./toaster-Cr51X7bz.cjs");
|
|
2
|
+
const require_search_access = require("./search-access-Dugvttlg.cjs");
|
|
3
|
+
const require_place_node = require("./place-node-C5SmIAYU.cjs");
|
|
4
|
+
let _burojs_core = require("@burojs/core");
|
|
5
|
+
let _burojs_react = require("@burojs/react");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
//#region src/blocks/default-item.tsx
|
|
9
|
+
const isNumeric = (field) => field?.kind === "number";
|
|
10
|
+
function DefaultItem({ resource, row, raw, columns, variant = "card" }) {
|
|
11
|
+
const def = (0, _burojs_react.useApp)().registry.get(resource);
|
|
12
|
+
const caps = (0, _burojs_react.useI18nCaps)(resource);
|
|
13
|
+
const access = useRowAccess(resource)(raw);
|
|
14
|
+
const viewVisible = useViewVisible(resource);
|
|
15
|
+
const fields = def === void 0 ? [] : (columns ?? def.views?.list?.columns ?? Object.keys(def.fields)).filter((name, index, names) => name !== def.displayField && names.indexOf(name) === index && require_place_node.peekLeafAllowed(def, name, access, viewVisible));
|
|
16
|
+
const ref = def?.ref ?? {
|
|
17
|
+
namespace: "default",
|
|
18
|
+
id: resource
|
|
19
|
+
};
|
|
20
|
+
const definition = (name) => require_place_node.peekFieldDefinition(def, name);
|
|
21
|
+
const value = (name) => (0, react_jsx_runtime.jsx)(require_place_node.ResolvedFieldDisplay, {
|
|
22
|
+
resource: ref,
|
|
23
|
+
name,
|
|
24
|
+
field: definition(name),
|
|
25
|
+
value: row[name],
|
|
26
|
+
record: row,
|
|
27
|
+
fallback: require_place_node.toDisplayText(row[name]).text
|
|
28
|
+
});
|
|
29
|
+
const title = (0, react_jsx_runtime.jsx)("p", {
|
|
30
|
+
className: "truncate text-sm font-medium",
|
|
31
|
+
children: require_search_access.recordDisplayName(row, def?.displayField)
|
|
32
|
+
});
|
|
33
|
+
if (variant === "entry") {
|
|
34
|
+
const shown = fields.filter((name) => row[name] != null && row[name] !== "");
|
|
35
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
36
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
37
|
+
"data-buro-default-item": "",
|
|
38
|
+
children: [title, shown.length === 0 ? null : (0, react_jsx_runtime.jsx)("div", {
|
|
39
|
+
"data-buro-item-meta": "",
|
|
40
|
+
className: "truncate text-xs text-muted-foreground",
|
|
41
|
+
children: shown.map((name, index) => (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [index > 0 ? " · " : null, value(name)] }, name))
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const numbers = fields.filter((name) => isNumeric(definition(name)));
|
|
46
|
+
const pairs = fields.filter((name) => !isNumeric(definition(name)));
|
|
47
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
48
|
+
className: "flex min-w-0 items-start gap-3",
|
|
49
|
+
"data-buro-default-item": "",
|
|
50
|
+
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
51
|
+
className: "flex min-w-0 flex-1 flex-col gap-2",
|
|
52
|
+
children: [title, pairs.length === 0 ? null : (0, react_jsx_runtime.jsx)("dl", {
|
|
53
|
+
className: "grid gap-1.5",
|
|
54
|
+
children: pairs.map((name) => (0, react_jsx_runtime.jsxs)("div", {
|
|
55
|
+
className: "flex min-w-0 items-baseline gap-2 text-sm",
|
|
56
|
+
children: [(0, react_jsx_runtime.jsx)("dt", {
|
|
57
|
+
className: "w-24 shrink-0 truncate text-xs text-muted-foreground",
|
|
58
|
+
children: (0, _burojs_core.resolveFieldLabel)(caps, name, (0, _burojs_core.declaredText)("field", definition(name), "label"))
|
|
59
|
+
}), (0, react_jsx_runtime.jsx)("dd", {
|
|
60
|
+
className: "min-w-0 break-words",
|
|
61
|
+
children: value(name)
|
|
62
|
+
})]
|
|
63
|
+
}, name))
|
|
64
|
+
})]
|
|
65
|
+
}), numbers.length === 0 ? null : (0, react_jsx_runtime.jsx)("div", {
|
|
66
|
+
"data-buro-item-trailing": "",
|
|
67
|
+
className: "flex shrink-0 flex-col items-end gap-1 border-l pl-3 text-sm tabular-nums",
|
|
68
|
+
children: numbers.map((name) => (0, react_jsx_runtime.jsx)("span", {
|
|
69
|
+
title: (0, _burojs_core.resolveFieldLabel)(caps, name, (0, _burojs_core.declaredText)("field", definition(name), "label")),
|
|
70
|
+
children: value(name)
|
|
71
|
+
}, name))
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/blocks/related-rows.tsx
|
|
77
|
+
function useRowAccess(resource) {
|
|
78
|
+
const app = (0, _burojs_react.useApp)();
|
|
79
|
+
const scope = (0, _burojs_react.useCtx)((c) => c.scope);
|
|
80
|
+
const user = (0, _burojs_react.useCtx)((c) => c.user);
|
|
81
|
+
const permissions = (0, _burojs_react.useCtx)((c) => c.permissions);
|
|
82
|
+
return (0, react.useCallback)((row) => (capability, target, defaultAllowed = true) => {
|
|
83
|
+
const rules = app.ruleSource.rules(resource);
|
|
84
|
+
if (rules.length === 0) return { allowed: defaultAllowed };
|
|
85
|
+
const ctx = (0, _burojs_core.ruleContextFor)({
|
|
86
|
+
user,
|
|
87
|
+
scope,
|
|
88
|
+
permissions,
|
|
89
|
+
record: row,
|
|
90
|
+
mode: "show",
|
|
91
|
+
resource
|
|
92
|
+
});
|
|
93
|
+
return (0, _burojs_core.resolveCapability)(rules, capability, target, ctx, defaultAllowed);
|
|
94
|
+
}, [
|
|
95
|
+
app.ruleSource,
|
|
96
|
+
resource,
|
|
97
|
+
scope,
|
|
98
|
+
user,
|
|
99
|
+
permissions
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
function useViewVisible(resource) {
|
|
103
|
+
const access = (0, _burojs_react.useFieldAccess)(resource, "every");
|
|
104
|
+
return (0, react.useCallback)((field) => {
|
|
105
|
+
const decision = access[field];
|
|
106
|
+
return decision === void 0 || decision.view === "visible";
|
|
107
|
+
}, [access]);
|
|
108
|
+
}
|
|
109
|
+
function useProjectedRows(resource, rows, item) {
|
|
110
|
+
const def = (0, _burojs_react.useApp)().registry.get(resource);
|
|
111
|
+
const accessOf = useRowAccess(resource);
|
|
112
|
+
const viewRow = (0, _burojs_react.useViewRow)(resource);
|
|
113
|
+
const viewVisible = useViewVisible(resource);
|
|
114
|
+
const idField = (def?.data)?.idField ?? "id";
|
|
115
|
+
const project = (0, react.useCallback)((row) => def === void 0 ? viewRow(row) : require_place_node.peekRow(def, viewRow(row), idField, accessOf(row), viewVisible), [
|
|
116
|
+
def,
|
|
117
|
+
idField,
|
|
118
|
+
accessOf,
|
|
119
|
+
viewRow,
|
|
120
|
+
viewVisible
|
|
121
|
+
]);
|
|
122
|
+
const hidden = (0, react.useCallback)((field) => field !== idField && (def === void 0 || !require_place_node.peekLeafAllowed(def, field, accessOf(_burojs_core.RECORD_PROBE), viewVisible)), [
|
|
123
|
+
def,
|
|
124
|
+
idField,
|
|
125
|
+
accessOf,
|
|
126
|
+
viewVisible
|
|
127
|
+
]);
|
|
128
|
+
const probe = (0, react.useMemo)(() => rows[0] === void 0 ? void 0 : project(rows[0]), [rows, project]);
|
|
129
|
+
return {
|
|
130
|
+
def,
|
|
131
|
+
project,
|
|
132
|
+
drawn: require_place_node.useItemDrawn(item, hidden, probe),
|
|
133
|
+
title: (0, react.useCallback)((row) => require_search_access.recordDisplayName(project(row), def?.displayField), [project, def])
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function RowContent({ resource, raw, row, item, drawn, columns, variant }) {
|
|
137
|
+
const fallback = (0, react_jsx_runtime.jsx)(DefaultItem, {
|
|
138
|
+
resource,
|
|
139
|
+
row,
|
|
140
|
+
raw,
|
|
141
|
+
columns,
|
|
142
|
+
...variant === void 0 ? {} : { variant }
|
|
143
|
+
});
|
|
144
|
+
if (item === void 0 || !drawn) return fallback;
|
|
145
|
+
return (0, react_jsx_runtime.jsx)(require_place_node.RelatedItem, {
|
|
146
|
+
handle: item,
|
|
147
|
+
row,
|
|
148
|
+
fallback
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function RowOpener({ title, href, quick }) {
|
|
152
|
+
const RouterLink = require_toaster.useLinkComponent();
|
|
153
|
+
const className = "outline-none after:absolute after:inset-0 after:rounded-[inherit] focus-visible:after:ring-2 focus-visible:after:ring-ring";
|
|
154
|
+
const name = (0, react_jsx_runtime.jsx)("span", {
|
|
155
|
+
className: "sr-only",
|
|
156
|
+
children: title
|
|
157
|
+
});
|
|
158
|
+
if (quick !== null) return href ? (0, react_jsx_runtime.jsx)(require_search_access.ClaimedQuickLink, {
|
|
159
|
+
href,
|
|
160
|
+
className,
|
|
161
|
+
onOpen: quick,
|
|
162
|
+
children: name
|
|
163
|
+
}) : (0, react_jsx_runtime.jsx)("button", {
|
|
164
|
+
type: "button",
|
|
165
|
+
role: "link",
|
|
166
|
+
[_burojs_react.QUICK_ANCHOR_ATTRIBUTE]: "",
|
|
167
|
+
className: `${className} block size-0 p-0`,
|
|
168
|
+
onClick: (event) => {
|
|
169
|
+
if (!require_search_access.isPlainLeftClick(event)) return;
|
|
170
|
+
quick();
|
|
171
|
+
},
|
|
172
|
+
children: name
|
|
173
|
+
});
|
|
174
|
+
if (href) return (0, react_jsx_runtime.jsx)(RouterLink, {
|
|
175
|
+
href,
|
|
176
|
+
className,
|
|
177
|
+
children: name
|
|
178
|
+
});
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
const ITEM_LAYER_CLASS = "relative z-[1] pointer-events-none [&_a]:pointer-events-auto [&_button]:pointer-events-auto [&_input]:pointer-events-auto [&_select]:pointer-events-auto [&_textarea]:pointer-events-auto [&_summary]:pointer-events-auto [&_[role=button]]:pointer-events-auto [&_[role=link]]:pointer-events-auto [&_[role=checkbox]]:pointer-events-auto [&_[role=switch]]:pointer-events-auto";
|
|
182
|
+
//#endregion
|
|
183
|
+
Object.defineProperty(exports, "ITEM_LAYER_CLASS", {
|
|
184
|
+
enumerable: true,
|
|
185
|
+
get: function() {
|
|
186
|
+
return ITEM_LAYER_CLASS;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
Object.defineProperty(exports, "RowContent", {
|
|
190
|
+
enumerable: true,
|
|
191
|
+
get: function() {
|
|
192
|
+
return RowContent;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
Object.defineProperty(exports, "RowOpener", {
|
|
196
|
+
enumerable: true,
|
|
197
|
+
get: function() {
|
|
198
|
+
return RowOpener;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
Object.defineProperty(exports, "useProjectedRows", {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
get: function() {
|
|
204
|
+
return useProjectedRows;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=related-rows-ea43qhhy.cjs.map
|