@burojs/ui-shadcn 0.7.0 → 0.9.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/dist/{bulk-summary-CrEij5vq.cjs → bulk-summary-2HLgz7Il.cjs} +31 -5
- package/dist/bulk-summary-2HLgz7Il.cjs.map +1 -0
- package/dist/{bulk-summary-BWSAS7k2.js → bulk-summary-D6A0ua21.js} +32 -6
- package/dist/bulk-summary-D6A0ua21.js.map +1 -0
- package/dist/{candidates-relation-picker-CS_JZ4Fd.js → candidates-relation-picker-QvoY2bOQ.js} +3 -3
- package/dist/{candidates-relation-picker-CS_JZ4Fd.js.map → candidates-relation-picker-QvoY2bOQ.js.map} +1 -1
- package/dist/{candidates-relation-picker-y5M6_oe4.cjs → candidates-relation-picker-pEAWKQEY.cjs} +3 -3
- package/dist/{candidates-relation-picker-y5M6_oe4.cjs.map → candidates-relation-picker-pEAWKQEY.cjs.map} +1 -1
- package/dist/{check-confirm-dialog-2j0gOd7x.js → check-confirm-dialog-B-CbJTln.js} +68 -8
- package/dist/{check-confirm-dialog-2j0gOd7x.js.map → check-confirm-dialog-B-CbJTln.js.map} +1 -1
- package/dist/{check-confirm-dialog-C-NHgMST.cjs → check-confirm-dialog-W-8WOmGh.cjs} +72 -6
- package/dist/check-confirm-dialog-W-8WOmGh.cjs.map +1 -0
- package/dist/{filter-builder-DaWHUZuV.js → filter-builder-04nas3eq.js} +127 -61
- package/dist/filter-builder-04nas3eq.js.map +1 -0
- package/dist/{filter-builder-DFu0JP-1.cjs → filter-builder-DQX-TMFh.cjs} +140 -68
- package/dist/filter-builder-DQX-TMFh.cjs.map +1 -0
- package/dist/{flow-runtime-DyqTmK3H.js → flow-runtime-BEIyym7d.js} +7 -4
- package/dist/{flow-runtime-DyqTmK3H.js.map → flow-runtime-BEIyym7d.js.map} +1 -1
- package/dist/{flow-runtime-BpmrIUb6.cjs → flow-runtime-DyNIYfUP.cjs} +7 -4
- package/dist/{flow-runtime-BpmrIUb6.cjs.map → flow-runtime-DyNIYfUP.cjs.map} +1 -1
- package/dist/{flow-screen-DCdli6Ha.js → flow-screen-DY1Z9PbG.js} +56 -15
- package/dist/flow-screen-DY1Z9PbG.js.map +1 -0
- package/dist/{flow-screen-Bcz9NF2V.cjs → flow-screen-FE5Xhb3t.cjs} +54 -13
- package/dist/flow-screen-FE5Xhb3t.cjs.map +1 -0
- package/dist/index.cjs +564 -170
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +235 -95
- package/dist/index.d.ts +235 -95
- package/dist/index.js +562 -169
- package/dist/index.js.map +1 -1
- package/dist/{inline-flow-host-C0rI9B7f.js → inline-flow-host-D6u-RlsV.js} +3 -3
- package/dist/{inline-flow-host-C0rI9B7f.js.map → inline-flow-host-D6u-RlsV.js.map} +1 -1
- package/dist/{inline-flow-host-3vw7LzzD.cjs → inline-flow-host-yVLo6-sM.cjs} +3 -3
- package/dist/{inline-flow-host-3vw7LzzD.cjs.map → inline-flow-host-yVLo6-sM.cjs.map} +1 -1
- package/dist/{lazy-relation-picker-dialog-CAScLPb2.js → lazy-relation-picker-dialog-BaORufxQ.js} +2 -2
- package/dist/{lazy-relation-picker-dialog-CAScLPb2.js.map → lazy-relation-picker-dialog-BaORufxQ.js.map} +1 -1
- package/dist/{lazy-relation-picker-dialog-Bt8lrEIu.cjs → lazy-relation-picker-dialog-C_VlGlDz.cjs} +2 -2
- package/dist/{lazy-relation-picker-dialog-Bt8lrEIu.cjs.map → lazy-relation-picker-dialog-C_VlGlDz.cjs.map} +1 -1
- package/dist/{page-flow-route-BHUEpn0I.js → page-flow-route-CyMzUidK.js} +8 -9
- package/dist/page-flow-route-CyMzUidK.js.map +1 -0
- package/dist/{page-flow-route-DS8IVTVH.cjs → page-flow-route-OFx7h7Ja.cjs} +8 -9
- package/dist/page-flow-route-OFx7h7Ja.cjs.map +1 -0
- package/dist/{place-node-CNb3w-c7.cjs → place-node-BZF5Af6x.cjs} +224 -151
- package/dist/place-node-BZF5Af6x.cjs.map +1 -0
- package/dist/{place-node-CfzQvh4Y.js → place-node-DRjmJGQ_.js} +210 -125
- package/dist/place-node-DRjmJGQ_.js.map +1 -0
- package/dist/{related-list-cards-BIqqY69Y.js → related-list-cards-2hLitVkg.js} +3 -3
- package/dist/{related-list-cards-BIqqY69Y.js.map → related-list-cards-2hLitVkg.js.map} +1 -1
- package/dist/{related-list-cards-CelMxl4q.cjs → related-list-cards-xVvgSlu-.cjs} +3 -3
- package/dist/{related-list-cards-CelMxl4q.cjs.map → related-list-cards-xVvgSlu-.cjs.map} +1 -1
- package/dist/related-list-timeline-CxJqe6eK.js +167 -0
- package/dist/related-list-timeline-CxJqe6eK.js.map +1 -0
- package/dist/related-list-timeline-Dsf5WewG.cjs +167 -0
- package/dist/related-list-timeline-Dsf5WewG.cjs.map +1 -0
- package/dist/{related-rows-MPnLCmPF.cjs → related-rows-DDhp9axl.cjs} +4 -4
- package/dist/{related-rows-MPnLCmPF.cjs.map → related-rows-DDhp9axl.cjs.map} +1 -1
- package/dist/{related-rows--uP2iKQC.js → related-rows-DL6CWsrj.js} +4 -4
- package/dist/{related-rows--uP2iKQC.js.map → related-rows-DL6CWsrj.js.map} +1 -1
- package/dist/{relation-create-C43cdPQt.js → relation-create-6WicROWA.js} +33 -5
- package/dist/relation-create-6WicROWA.js.map +1 -0
- package/dist/{relation-create-DDEYcKfw.cjs → relation-create-_SFuPQGM.cjs} +37 -3
- package/dist/relation-create-_SFuPQGM.cjs.map +1 -0
- package/dist/{relation-many-picker-DzuGJpEl.cjs → relation-many-picker-BBNsmkaX.cjs} +18 -11
- package/dist/relation-many-picker-BBNsmkaX.cjs.map +1 -0
- package/dist/{relation-many-picker-BJhaEqxz.js → relation-many-picker-mGEQDWo2.js} +18 -11
- package/dist/relation-many-picker-mGEQDWo2.js.map +1 -0
- package/dist/{relation-picker-D-tBBZW_.js → relation-picker-BbO41cFV.js} +19 -11
- package/dist/relation-picker-BbO41cFV.js.map +1 -0
- package/dist/{relation-picker-dialog-DoEY8EkH.js → relation-picker-dialog-BgSG_8bU.js} +5 -5
- package/dist/relation-picker-dialog-BgSG_8bU.js.map +1 -0
- package/dist/{relation-picker-dialog-9Vg5vvR1.cjs → relation-picker-dialog-Duqy2r0n.cjs} +5 -5
- package/dist/relation-picker-dialog-Duqy2r0n.cjs.map +1 -0
- package/dist/{relation-picker-DaIMzf2H.cjs → relation-picker-jk9D_uwn.cjs} +19 -11
- package/dist/relation-picker-jk9D_uwn.cjs.map +1 -0
- package/dist/{relation-select-Cr3CfNLy.cjs → relation-select-C3aV18kT.cjs} +2 -2
- package/dist/{relation-select-Cr3CfNLy.cjs.map → relation-select-C3aV18kT.cjs.map} +1 -1
- package/dist/{relation-select-B8Fq4o-t.js → relation-select-CjQT9LpS.js} +2 -2
- package/dist/{relation-select-B8Fq4o-t.js.map → relation-select-CjQT9LpS.js.map} +1 -1
- package/dist/{resource-page-router-Diw6S6TK.js → resource-page-router-CzaNATSp.js} +209 -30
- package/dist/resource-page-router-CzaNATSp.js.map +1 -0
- package/dist/{resource-page-router-C_kGW2o_.cjs → resource-page-router-dmVIeu5s.cjs} +235 -32
- package/dist/resource-page-router-dmVIeu5s.cjs.map +1 -0
- package/dist/{success-notices-Dl3M1fZP.cjs → success-notices-Cl4b6MLQ.cjs} +3 -2
- package/dist/success-notices-Cl4b6MLQ.cjs.map +1 -0
- package/dist/{success-notices-LDEgEkc4.js → success-notices-CrcWOGSo.js} +3 -2
- package/dist/success-notices-CrcWOGSo.js.map +1 -0
- package/dist/{use-dialog-filter-state-B_MqzHaT.js → use-dialog-filter-state-CJoeY-1j.js} +2 -2
- package/dist/{use-dialog-filter-state-B_MqzHaT.js.map → use-dialog-filter-state-CJoeY-1j.js.map} +1 -1
- package/dist/{use-dialog-filter-state-tNvqAAjh.cjs → use-dialog-filter-state-lsTJxrB4.cjs} +2 -2
- package/dist/{use-dialog-filter-state-tNvqAAjh.cjs.map → use-dialog-filter-state-lsTJxrB4.cjs.map} +1 -1
- package/dist/use-record-subtitle-BJ9rnj6F.cjs +67 -0
- package/dist/use-record-subtitle-BJ9rnj6F.cjs.map +1 -0
- package/dist/use-record-subtitle-w3ZhXNlf.js +50 -0
- package/dist/use-record-subtitle-w3ZhXNlf.js.map +1 -0
- package/package.json +9 -9
- package/dist/bulk-summary-BWSAS7k2.js.map +0 -1
- package/dist/bulk-summary-CrEij5vq.cjs.map +0 -1
- package/dist/check-confirm-dialog-C-NHgMST.cjs.map +0 -1
- package/dist/filter-builder-DFu0JP-1.cjs.map +0 -1
- package/dist/filter-builder-DaWHUZuV.js.map +0 -1
- package/dist/flow-screen-Bcz9NF2V.cjs.map +0 -1
- package/dist/flow-screen-DCdli6Ha.js.map +0 -1
- package/dist/page-flow-route-BHUEpn0I.js.map +0 -1
- package/dist/page-flow-route-DS8IVTVH.cjs.map +0 -1
- package/dist/place-node-CNb3w-c7.cjs.map +0 -1
- package/dist/place-node-CfzQvh4Y.js.map +0 -1
- package/dist/related-list-timeline-CRh7xwLD.js +0 -141
- package/dist/related-list-timeline-CRh7xwLD.js.map +0 -1
- package/dist/related-list-timeline-DsLdi8sv.cjs +0 -141
- package/dist/related-list-timeline-DsLdi8sv.cjs.map +0 -1
- package/dist/relation-create-C43cdPQt.js.map +0 -1
- package/dist/relation-create-DDEYcKfw.cjs.map +0 -1
- package/dist/relation-many-picker-BJhaEqxz.js.map +0 -1
- package/dist/relation-many-picker-DzuGJpEl.cjs.map +0 -1
- package/dist/relation-picker-D-tBBZW_.js.map +0 -1
- package/dist/relation-picker-DaIMzf2H.cjs.map +0 -1
- package/dist/relation-picker-dialog-9Vg5vvR1.cjs.map +0 -1
- package/dist/relation-picker-dialog-DoEY8EkH.js.map +0 -1
- package/dist/resource-page-router-C_kGW2o_.cjs.map +0 -1
- package/dist/resource-page-router-Diw6S6TK.js.map +0 -1
- package/dist/success-notices-Dl3M1fZP.cjs.map +0 -1
- package/dist/success-notices-LDEgEkc4.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const require_use_theme = require("./use-theme-DFlpXils.cjs");
|
|
2
2
|
const require_toaster = require("./toaster-BbByOytP.cjs");
|
|
3
|
-
const require_check_confirm_dialog = require("./check-confirm-dialog-
|
|
3
|
+
const require_check_confirm_dialog = require("./check-confirm-dialog-W-8WOmGh.cjs");
|
|
4
4
|
const require_button = require("./button-BxnnE28H.cjs");
|
|
5
|
-
const require_relation_create = require("./relation-create-
|
|
5
|
+
const require_relation_create = require("./relation-create-_SFuPQGM.cjs");
|
|
6
6
|
const require_skeleton = require("./skeleton-_1gP7wan.cjs");
|
|
7
|
-
const require_place_node = require("./place-node-
|
|
8
|
-
const require_success_notices = require("./success-notices-
|
|
7
|
+
const require_place_node = require("./place-node-BZF5Af6x.cjs");
|
|
8
|
+
const require_success_notices = require("./success-notices-Cl4b6MLQ.cjs");
|
|
9
9
|
let _burojs_core = require("@burojs/core");
|
|
10
10
|
let _burojs_react = require("@burojs/react");
|
|
11
11
|
let react = require("react");
|
|
@@ -18,6 +18,66 @@ function canonicalResourceKey(def) {
|
|
|
18
18
|
return canonicalNavKey(def);
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
|
+
//#region src/layout/build-nav-items.ts
|
|
22
|
+
function groupNavHref(registry, group, isVisible) {
|
|
23
|
+
let href;
|
|
24
|
+
try {
|
|
25
|
+
href = (0, _burojs_core.navHrefFor)(registry, group, { isVisible });
|
|
26
|
+
} catch {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
return (0, _burojs_core.matchPath)(registry, href, { isVisible }) === null ? void 0 : href;
|
|
30
|
+
}
|
|
31
|
+
function buildNavItems(args) {
|
|
32
|
+
const { registry, caps, groupName, match, isVisible, entryFilter, icons } = args;
|
|
33
|
+
const chain = match?.groupChain ?? [];
|
|
34
|
+
const qualifiedMatch = match;
|
|
35
|
+
const activeLeaf = qualifiedMatch == null ? void 0 : qualifiedMatch.kind === "group-index" ? canonicalNavKey({
|
|
36
|
+
name: qualifiedMatch.target ?? qualifiedMatch.name,
|
|
37
|
+
ref: qualifiedMatch.targetRef
|
|
38
|
+
}) : canonicalNavKey(qualifiedMatch);
|
|
39
|
+
const isEligible = (node) => isVisible(node) && (entryFilter ? entryFilter(node) : true);
|
|
40
|
+
const out = [];
|
|
41
|
+
for (const child of registry.groups.childrenOf(groupName)) {
|
|
42
|
+
if (!isEligible(child)) continue;
|
|
43
|
+
const kind = (0, _burojs_core.nodeKind)(child);
|
|
44
|
+
const childKey = canonicalNavKey(child);
|
|
45
|
+
if (kind === "group") {
|
|
46
|
+
const href = groupNavHref(registry, childKey, isEligible);
|
|
47
|
+
if (href === void 0) continue;
|
|
48
|
+
const label = (0, _burojs_core.resolveNavLabel)(caps, `groups.${childKey}`, (0, _burojs_core.declaredText)("chrome", child, "label"));
|
|
49
|
+
const active = chain.some((g) => canonicalNavKey(g) === childKey);
|
|
50
|
+
out.push({
|
|
51
|
+
kind: "group",
|
|
52
|
+
name: childKey,
|
|
53
|
+
label,
|
|
54
|
+
href,
|
|
55
|
+
icon: icons?.group?.(childKey),
|
|
56
|
+
active
|
|
57
|
+
});
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const href = (0, _burojs_core.navHrefFor)(registry, childKey, { isVisible: isEligible });
|
|
61
|
+
if (kind === "custom-page") out.push({
|
|
62
|
+
kind: "custom-page",
|
|
63
|
+
name: childKey,
|
|
64
|
+
label: (0, _burojs_core.resolveNavLabel)(caps, `pages.${childKey}`, (0, _burojs_core.declaredText)("chrome", child, "label")),
|
|
65
|
+
href,
|
|
66
|
+
icon: icons?.page?.(childKey),
|
|
67
|
+
active: activeLeaf === childKey
|
|
68
|
+
});
|
|
69
|
+
else out.push({
|
|
70
|
+
kind: "resource",
|
|
71
|
+
name: childKey,
|
|
72
|
+
label: (0, _burojs_core.resolveResourceNavLabel)(caps, childKey, child),
|
|
73
|
+
href,
|
|
74
|
+
icon: icons?.resource?.(childKey),
|
|
75
|
+
active: activeLeaf === childKey
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
21
81
|
//#region src/layout/layouts/secondary-sidebar-layout.tsx
|
|
22
82
|
function Row({ it }) {
|
|
23
83
|
const RouterLink = require_toaster.useLinkComponent();
|
|
@@ -951,15 +1011,21 @@ function RecordFrameHost(props) {
|
|
|
951
1011
|
edited
|
|
952
1012
|
]);
|
|
953
1013
|
const notify = require_success_notices.useNoticeSink(resource);
|
|
1014
|
+
const routeScreen = require_place_node.useIsRouteScreen();
|
|
1015
|
+
const leavesOnCreate = mode === "create" && routeScreen;
|
|
1016
|
+
const [created, setCreated] = (0, react.useState)(false);
|
|
1017
|
+
const createdRef = (0, react.useRef)(false);
|
|
954
1018
|
const latest = (0, react.useRef)({
|
|
955
1019
|
controller,
|
|
956
1020
|
onSuccess: props.onSuccess,
|
|
957
|
-
notify
|
|
1021
|
+
notify,
|
|
1022
|
+
leavesOnCreate
|
|
958
1023
|
});
|
|
959
1024
|
latest.current = {
|
|
960
1025
|
controller,
|
|
961
1026
|
onSuccess: props.onSuccess,
|
|
962
|
-
notify
|
|
1027
|
+
notify,
|
|
1028
|
+
leavesOnCreate
|
|
963
1029
|
};
|
|
964
1030
|
const mounted = (0, react.useRef)(true);
|
|
965
1031
|
(0, react.useEffect)(() => {
|
|
@@ -969,6 +1035,7 @@ function RecordFrameHost(props) {
|
|
|
969
1035
|
};
|
|
970
1036
|
}, []);
|
|
971
1037
|
const submit = (0, react.useCallback)(async () => {
|
|
1038
|
+
if (createdRef.current) return;
|
|
972
1039
|
setSubmitError(void 0);
|
|
973
1040
|
setSubmitApplied(void 0);
|
|
974
1041
|
setFailed(NO_ISSUES);
|
|
@@ -976,6 +1043,10 @@ function RecordFrameHost(props) {
|
|
|
976
1043
|
atFailure.current = {};
|
|
977
1044
|
const outcome = await latest.current.controller.submit();
|
|
978
1045
|
if (!mounted.current) return;
|
|
1046
|
+
if (latest.current.leavesOnCreate && (outcome.status === "submitted" || outcome.status === "failed" && outcome.applied === "yes")) {
|
|
1047
|
+
createdRef.current = true;
|
|
1048
|
+
setCreated(true);
|
|
1049
|
+
}
|
|
979
1050
|
if (outcome.status === "submitted") {
|
|
980
1051
|
const notices = (0, _burojs_core.successNoticesOf)(outcome.result);
|
|
981
1052
|
if (notices.length > 0) latest.current.notify(notices);
|
|
@@ -1015,7 +1086,6 @@ function RecordFrameHost(props) {
|
|
|
1015
1086
|
]);
|
|
1016
1087
|
const { chooseType } = props;
|
|
1017
1088
|
const typedAndAccepted = mode === "create" && controller.typeOffer !== null && controller.failure === null;
|
|
1018
|
-
const routeScreen = require_place_node.useIsRouteScreen();
|
|
1019
1089
|
const adapter = (0, _burojs_react.useOptionalRouterAdapter)();
|
|
1020
1090
|
const hostRouter = routeScreen ? adapter : null;
|
|
1021
1091
|
const guardText = (0, _burojs_react.useNavigationGuardText)();
|
|
@@ -1057,6 +1127,7 @@ function RecordFrameHost(props) {
|
|
|
1057
1127
|
submitError,
|
|
1058
1128
|
...submitApplied === void 0 ? {} : { submitApplied },
|
|
1059
1129
|
serverIssues: shownFailed,
|
|
1130
|
+
...created ? { created: true } : {},
|
|
1060
1131
|
submit,
|
|
1061
1132
|
root
|
|
1062
1133
|
}), [
|
|
@@ -1070,6 +1141,7 @@ function RecordFrameHost(props) {
|
|
|
1070
1141
|
submitError,
|
|
1071
1142
|
submitApplied,
|
|
1072
1143
|
shownFailed,
|
|
1144
|
+
created,
|
|
1073
1145
|
submit
|
|
1074
1146
|
]);
|
|
1075
1147
|
(0, _burojs_react.usePublishDocVariant)(mode === "show" ? resource : void 0, record);
|
|
@@ -1257,6 +1329,24 @@ function usePublishedRecordTrail(key) {
|
|
|
1257
1329
|
return current !== null && current.key === key ? current : null;
|
|
1258
1330
|
}
|
|
1259
1331
|
//#endregion
|
|
1332
|
+
//#region src/layout/record-targets.ts
|
|
1333
|
+
function isShowAvailable(registry, resource) {
|
|
1334
|
+
return (0, _burojs_react.recordRouteAvailable)(registry, resource, "show");
|
|
1335
|
+
}
|
|
1336
|
+
function showTarget(resource, id) {
|
|
1337
|
+
return {
|
|
1338
|
+
resource,
|
|
1339
|
+
action: "show",
|
|
1340
|
+
params: { id }
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
function listTarget(resource) {
|
|
1344
|
+
return {
|
|
1345
|
+
resource,
|
|
1346
|
+
action: "list"
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
//#endregion
|
|
1260
1350
|
//#region src/layout/route-trail.ts
|
|
1261
1351
|
function useTrailContext() {
|
|
1262
1352
|
const app = (0, _burojs_react.useApp)();
|
|
@@ -1270,21 +1360,13 @@ function useTrailContext() {
|
|
|
1270
1360
|
t
|
|
1271
1361
|
};
|
|
1272
1362
|
}
|
|
1273
|
-
function groupCrumbHref(registry, group, isVisible) {
|
|
1274
|
-
let href;
|
|
1275
|
-
try {
|
|
1276
|
-
href = (0, _burojs_core.navHrefFor)(registry, group, { isVisible });
|
|
1277
|
-
} catch {
|
|
1278
|
-
return;
|
|
1279
|
-
}
|
|
1280
|
-
return (0, _burojs_core.matchPath)(registry, href, { isVisible }) === null ? void 0 : href;
|
|
1281
|
-
}
|
|
1282
1363
|
function groupCrumbs(ctx, chain) {
|
|
1283
1364
|
return chain.map((group) => {
|
|
1284
1365
|
const key = canonicalNavKey(group);
|
|
1285
1366
|
return {
|
|
1286
1367
|
label: (0, _burojs_core.resolveNavLabel)(ctx.caps, `groups.${key}`, (0, _burojs_core.declaredText)("chrome", group, "label")),
|
|
1287
|
-
href:
|
|
1368
|
+
href: groupNavHref(ctx.registry, key, ctx.isVisible),
|
|
1369
|
+
jump: true
|
|
1288
1370
|
};
|
|
1289
1371
|
});
|
|
1290
1372
|
}
|
|
@@ -1300,17 +1382,77 @@ function recordActionOf(match) {
|
|
|
1300
1382
|
default: return;
|
|
1301
1383
|
}
|
|
1302
1384
|
}
|
|
1385
|
+
function pathOf(href) {
|
|
1386
|
+
const path = href.split(/[?#]/, 1)[0] ?? "";
|
|
1387
|
+
return path.length > 1 && path.endsWith("/") ? path.slice(0, -1) : path;
|
|
1388
|
+
}
|
|
1389
|
+
function originTrail(ctx, origin, depth = _burojs_react.ORIGIN_DEPTH) {
|
|
1390
|
+
const match = (0, _burojs_core.matchPath)(ctx.registry, pathOf(origin.href), { isVisible: ctx.isVisible });
|
|
1391
|
+
if (match === null) return void 0;
|
|
1392
|
+
switch (match.kind) {
|
|
1393
|
+
case "resource": {
|
|
1394
|
+
const key = canonicalNavKey(match);
|
|
1395
|
+
if (match.action === "list") return {
|
|
1396
|
+
leading: groupCrumbs(ctx, match.groupChain),
|
|
1397
|
+
resource: key,
|
|
1398
|
+
resourceHref: origin.href,
|
|
1399
|
+
segments: []
|
|
1400
|
+
};
|
|
1401
|
+
const def = ctx.registry.get(key);
|
|
1402
|
+
const crumb = {
|
|
1403
|
+
label: match.action === "create" ? ctx.t("breadcrumbs.create") : origin.title || (match.id === void 0 ? "" : `#${match.id}`),
|
|
1404
|
+
href: origin.href
|
|
1405
|
+
};
|
|
1406
|
+
const parent = depth > 1 && origin.origin !== void 0 ? originTrail(ctx, origin.origin, depth - 1) : void 0;
|
|
1407
|
+
if (parent !== void 0) return {
|
|
1408
|
+
...parent,
|
|
1409
|
+
segments: [...parent.segments, crumb]
|
|
1410
|
+
};
|
|
1411
|
+
return {
|
|
1412
|
+
leading: groupCrumbs(ctx, match.groupChain),
|
|
1413
|
+
resource: key,
|
|
1414
|
+
...def !== void 0 && (0, _burojs_core.hasListPage)(def) ? { resourceHref: (0, _burojs_core.hrefFor)(ctx.registry, key) } : {},
|
|
1415
|
+
segments: [crumb]
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
case "custom-page": {
|
|
1419
|
+
const trail = headerTrail(ctx, match);
|
|
1420
|
+
if (trail === null || trail.pageLabel === void 0) return void 0;
|
|
1421
|
+
return {
|
|
1422
|
+
leading: trail.leadingSegments ?? [],
|
|
1423
|
+
segments: [{
|
|
1424
|
+
label: trail.pageLabel,
|
|
1425
|
+
href: origin.href
|
|
1426
|
+
}]
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
case "group-index": {
|
|
1430
|
+
const crumbs = groupCrumbs(ctx, match.groupChain);
|
|
1431
|
+
const own = crumbs[crumbs.length - 1];
|
|
1432
|
+
if (own === void 0) return void 0;
|
|
1433
|
+
return {
|
|
1434
|
+
leading: crumbs.slice(0, -1),
|
|
1435
|
+
segments: [{
|
|
1436
|
+
label: own.label,
|
|
1437
|
+
href: origin.href
|
|
1438
|
+
}]
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
default: return;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1303
1444
|
function recordTrail(ctx, input) {
|
|
1304
|
-
const { resource, action, id } = input;
|
|
1445
|
+
const { resource, action, id, origin } = input;
|
|
1446
|
+
if (origin !== void 0 && (action === "create" || id !== "")) return originRooted(ctx, input, origin);
|
|
1305
1447
|
const leadingSegments = nonEmpty(groupCrumbs(ctx, input.groupChain));
|
|
1306
1448
|
if (action !== "create" && id === "") return {
|
|
1307
1449
|
resource,
|
|
1308
1450
|
leadingSegments
|
|
1309
1451
|
};
|
|
1310
1452
|
const recordLabel = input.title || id;
|
|
1311
|
-
const middleSegments = action === "edit" ? [
|
|
1453
|
+
const middleSegments = action === "edit" ? [isShowAvailable(ctx.registry, resource) ? {
|
|
1312
1454
|
label: recordLabel,
|
|
1313
|
-
href: (0, _burojs_react.resolveRoute)(
|
|
1455
|
+
href: (0, _burojs_react.resolveRoute)(showTarget(resource, id), ctx.registry)
|
|
1314
1456
|
} : { label: recordLabel }] : void 0;
|
|
1315
1457
|
const pageLabel = action === "create" ? ctx.t("breadcrumbs.create") : action === "edit" ? ctx.t("breadcrumbs.edit") : recordLabel;
|
|
1316
1458
|
return {
|
|
@@ -1321,6 +1463,42 @@ function recordTrail(ctx, input) {
|
|
|
1321
1463
|
middleSegments
|
|
1322
1464
|
};
|
|
1323
1465
|
}
|
|
1466
|
+
function originRooted(ctx, input, origin) {
|
|
1467
|
+
const { resource, action, id } = input;
|
|
1468
|
+
const recordLabel = input.title || id;
|
|
1469
|
+
const drawn = new Set(origin.segments.flatMap((crumb) => crumb.href === void 0 ? [] : [pathOf(crumb.href)]));
|
|
1470
|
+
const own = action === "edit" ? [isShowAvailable(ctx.registry, resource) ? {
|
|
1471
|
+
label: recordLabel,
|
|
1472
|
+
href: (0, _burojs_react.resolveRoute)(showTarget(resource, id), ctx.registry)
|
|
1473
|
+
} : { label: recordLabel }].filter((crumb) => crumb.href === void 0 || !drawn.has(pathOf(crumb.href))) : [];
|
|
1474
|
+
const pageLabel = action === "create" ? ctx.t("breadcrumbs.create") : action === "edit" ? ctx.t("breadcrumbs.edit") : recordLabel;
|
|
1475
|
+
const recordId = action === "create" ? void 0 : id;
|
|
1476
|
+
const middleSegments = nonEmpty([...origin.segments, ...own]);
|
|
1477
|
+
if (origin.resource !== void 0 && ctx.registry.get(origin.resource) === ctx.registry.get(resource)) return {
|
|
1478
|
+
resource,
|
|
1479
|
+
recordId,
|
|
1480
|
+
pageLabel,
|
|
1481
|
+
leadingSegments: nonEmpty([...origin.leading]),
|
|
1482
|
+
...origin.resourceHref === void 0 ? {} : { resourceHref: origin.resourceHref },
|
|
1483
|
+
middleSegments
|
|
1484
|
+
};
|
|
1485
|
+
const def = origin.resource === void 0 ? void 0 : ctx.registry.get(origin.resource);
|
|
1486
|
+
const resourceCrumb = origin.resource === void 0 ? [] : [{
|
|
1487
|
+
label: (0, _burojs_core.resolveResourceLabel)(ctx.caps, origin.resource, "plural", def),
|
|
1488
|
+
...origin.resourceHref === void 0 ? {} : { href: origin.resourceHref }
|
|
1489
|
+
}];
|
|
1490
|
+
return {
|
|
1491
|
+
resource,
|
|
1492
|
+
recordId,
|
|
1493
|
+
pageLabel,
|
|
1494
|
+
rootSegments: [
|
|
1495
|
+
...origin.leading,
|
|
1496
|
+
...resourceCrumb,
|
|
1497
|
+
...origin.segments,
|
|
1498
|
+
...own
|
|
1499
|
+
]
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1324
1502
|
function recordTrailRoute(registry, match) {
|
|
1325
1503
|
if (match === null || match.kind !== "resource") return null;
|
|
1326
1504
|
const resource = canonicalNavKey(match);
|
|
@@ -1333,7 +1511,7 @@ function recordTrailRoute(registry, match) {
|
|
|
1333
1511
|
groupChain
|
|
1334
1512
|
};
|
|
1335
1513
|
const action = recordActionOf(match);
|
|
1336
|
-
if (action === void 0 || !
|
|
1514
|
+
if (action === void 0 || !(0, _burojs_react.recordRouteAvailable)(registry, resource, action)) return null;
|
|
1337
1515
|
return {
|
|
1338
1516
|
resource,
|
|
1339
1517
|
action,
|
|
@@ -1514,10 +1692,9 @@ function RecordShow({ resource, id, recordId, record, shown }) {
|
|
|
1514
1692
|
})] });
|
|
1515
1693
|
}
|
|
1516
1694
|
function RecordEdit({ resource, id, recordId, record, shown }) {
|
|
1517
|
-
const app = (0, _burojs_react.useApp)();
|
|
1518
1695
|
const navigate = (0, _burojs_react.useRouteNavigate)();
|
|
1519
1696
|
const mounted = useMountedRef();
|
|
1520
|
-
const back =
|
|
1697
|
+
const back = (0, _burojs_react.useReturnTarget)(resource, "edit", id);
|
|
1521
1698
|
return (0, react_jsx_runtime.jsxs)("div", { children: [(0, react_jsx_runtime.jsx)(RecordRouteHeader, {
|
|
1522
1699
|
resource,
|
|
1523
1700
|
action: "edit",
|
|
@@ -1528,9 +1705,9 @@ function RecordEdit({ resource, id, recordId, record, shown }) {
|
|
|
1528
1705
|
mode: "edit",
|
|
1529
1706
|
recordId,
|
|
1530
1707
|
record,
|
|
1531
|
-
onCancel: () => navigate(back),
|
|
1708
|
+
onCancel: () => navigate(back, { origin: "inherit" }),
|
|
1532
1709
|
onSuccess: () => {
|
|
1533
|
-
if (mounted.current) navigate(back);
|
|
1710
|
+
if (mounted.current) navigate(back, { origin: "inherit" });
|
|
1534
1711
|
}
|
|
1535
1712
|
})] });
|
|
1536
1713
|
}
|
|
@@ -1543,7 +1720,8 @@ function RecordCreate({ resource, defaults }) {
|
|
|
1543
1720
|
const navigate = (0, _burojs_react.useRouteNavigate)();
|
|
1544
1721
|
const mounted = useMountedRef();
|
|
1545
1722
|
const adapter = (0, _burojs_react.useOptionalRouterAdapter)();
|
|
1546
|
-
const list =
|
|
1723
|
+
const list = listTarget(resource);
|
|
1724
|
+
const back = (0, _burojs_react.useReturnTarget)(resource, "create");
|
|
1547
1725
|
const type = adapter?.searchParams.get("type") ?? void 0;
|
|
1548
1726
|
return (0, react_jsx_runtime.jsxs)("div", { children: [(0, react_jsx_runtime.jsx)(RecordRouteHeader, {
|
|
1549
1727
|
resource,
|
|
@@ -1556,11 +1734,11 @@ function RecordCreate({ resource, defaults }) {
|
|
|
1556
1734
|
mode: "create",
|
|
1557
1735
|
...type === void 0 ? {} : { type },
|
|
1558
1736
|
...defaults === void 0 ? {} : { defaults },
|
|
1559
|
-
onCancel: () => navigate(
|
|
1737
|
+
onCancel: () => navigate(back, { origin: "inherit" }),
|
|
1560
1738
|
onSuccess: (result) => {
|
|
1561
1739
|
if (!mounted.current) return;
|
|
1562
1740
|
const id = createdId(result);
|
|
1563
|
-
navigate(id
|
|
1741
|
+
navigate(id !== void 0 && isShowAvailable(app.registry, resource) ? showTarget(resource, id) : list, { origin: "inherit" });
|
|
1564
1742
|
}
|
|
1565
1743
|
})
|
|
1566
1744
|
})] });
|
|
@@ -1584,7 +1762,7 @@ function RecordRead({ resource, action, id, recordId }) {
|
|
|
1584
1762
|
name: "show"
|
|
1585
1763
|
});
|
|
1586
1764
|
const showHidden = showRuled && read !== null && typeof read === "object" && showAvailability("show", read).state !== "available";
|
|
1587
|
-
const showSettled = !showRuled || !query.isPlaceholderData && permissions
|
|
1765
|
+
const showSettled = !showRuled || !query.isPlaceholderData && !(0, _burojs_core.permissionsUndecided)(permissions) && permissions?.status !== "error";
|
|
1588
1766
|
useRecordVisit(resource, projected.status === "ready" && showSettled && !showHidden ? projected.value : null, { isCurrentData: !query.isPlaceholderData });
|
|
1589
1767
|
const route = (0, react.useMemo)(() => Object.freeze({ id }), [id]);
|
|
1590
1768
|
const availability = (0, _burojs_react.useAvailabilityResolver)(resource, "edit");
|
|
@@ -1593,7 +1771,7 @@ function RecordRead({ resource, action, id, recordId }) {
|
|
|
1593
1771
|
if (record === null || typeof record !== "object") return (0, react_jsx_runtime.jsx)(require_relation_create.RecordState, { state: "not-found" });
|
|
1594
1772
|
const loaded = record;
|
|
1595
1773
|
if (showRuled) {
|
|
1596
|
-
if (query.isPlaceholderData ||
|
|
1774
|
+
if (query.isPlaceholderData || (0, _burojs_core.permissionsUndecided)(permissions)) return (0, react_jsx_runtime.jsx)(require_relation_create.RecordState, { state: "loading" });
|
|
1597
1775
|
if (permissions?.status === "error") return (0, react_jsx_runtime.jsx)(require_relation_create.RecordState, { state: "not-found" });
|
|
1598
1776
|
if (showHidden) return (0, react_jsx_runtime.jsx)(require_relation_create.RecordState, { state: "not-found" });
|
|
1599
1777
|
}
|
|
@@ -1602,6 +1780,7 @@ function RecordRead({ resource, action, id, recordId }) {
|
|
|
1602
1780
|
if (action === "edit") {
|
|
1603
1781
|
const edit = availability("edit", loaded).state;
|
|
1604
1782
|
if (edit === "hidden" || edit === "absent") return (0, react_jsx_runtime.jsx)(require_relation_create.RecordState, { state: "not-found" });
|
|
1783
|
+
if (edit === "undecided") return (0, react_jsx_runtime.jsx)(require_relation_create.RecordState, { state: "loading" });
|
|
1605
1784
|
}
|
|
1606
1785
|
return (0, react_jsx_runtime.jsx)(_burojs_react.RouteSourceContext.Provider, {
|
|
1607
1786
|
value: route,
|
|
@@ -1732,7 +1911,7 @@ function ResourcePageRouter({ match }) {
|
|
|
1732
1911
|
}
|
|
1733
1912
|
if (match.action === "flow") return (0, react_jsx_runtime.jsx)(PageFlowRouteLoader, { match });
|
|
1734
1913
|
if (recordAction === void 0) return (0, react_jsx_runtime.jsx)(ResourcePageRouterEmpty, {});
|
|
1735
|
-
if (!
|
|
1914
|
+
if (!(0, _burojs_react.recordRouteAvailable)(app.registry, resource, recordAction)) return (0, react_jsx_runtime.jsx)(NavAreaNotFound, {});
|
|
1736
1915
|
return (0, react_jsx_runtime.jsx)(RecordRoute, {
|
|
1737
1916
|
resource,
|
|
1738
1917
|
action: recordAction,
|
|
@@ -1898,6 +2077,12 @@ Object.defineProperty(exports, "TabsLayout", {
|
|
|
1898
2077
|
return TabsLayout;
|
|
1899
2078
|
}
|
|
1900
2079
|
});
|
|
2080
|
+
Object.defineProperty(exports, "buildNavItems", {
|
|
2081
|
+
enumerable: true,
|
|
2082
|
+
get: function() {
|
|
2083
|
+
return buildNavItems;
|
|
2084
|
+
}
|
|
2085
|
+
});
|
|
1901
2086
|
Object.defineProperty(exports, "canonicalNavKey", {
|
|
1902
2087
|
enumerable: true,
|
|
1903
2088
|
get: function() {
|
|
@@ -1910,18 +2095,36 @@ Object.defineProperty(exports, "canonicalResourceKey", {
|
|
|
1910
2095
|
return canonicalResourceKey;
|
|
1911
2096
|
}
|
|
1912
2097
|
});
|
|
2098
|
+
Object.defineProperty(exports, "groupNavHref", {
|
|
2099
|
+
enumerable: true,
|
|
2100
|
+
get: function() {
|
|
2101
|
+
return groupNavHref;
|
|
2102
|
+
}
|
|
2103
|
+
});
|
|
1913
2104
|
Object.defineProperty(exports, "headerTrail", {
|
|
1914
2105
|
enumerable: true,
|
|
1915
2106
|
get: function() {
|
|
1916
2107
|
return headerTrail;
|
|
1917
2108
|
}
|
|
1918
2109
|
});
|
|
2110
|
+
Object.defineProperty(exports, "isShowAvailable", {
|
|
2111
|
+
enumerable: true,
|
|
2112
|
+
get: function() {
|
|
2113
|
+
return isShowAvailable;
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
1919
2116
|
Object.defineProperty(exports, "layoutSlot", {
|
|
1920
2117
|
enumerable: true,
|
|
1921
2118
|
get: function() {
|
|
1922
2119
|
return layoutSlot;
|
|
1923
2120
|
}
|
|
1924
2121
|
});
|
|
2122
|
+
Object.defineProperty(exports, "originTrail", {
|
|
2123
|
+
enumerable: true,
|
|
2124
|
+
get: function() {
|
|
2125
|
+
return originTrail;
|
|
2126
|
+
}
|
|
2127
|
+
});
|
|
1925
2128
|
Object.defineProperty(exports, "readRecentRecords", {
|
|
1926
2129
|
enumerable: true,
|
|
1927
2130
|
get: function() {
|
|
@@ -2025,4 +2228,4 @@ Object.defineProperty(exports, "useTrailContext", {
|
|
|
2025
2228
|
}
|
|
2026
2229
|
});
|
|
2027
2230
|
|
|
2028
|
-
//# sourceMappingURL=resource-page-router-
|
|
2231
|
+
//# sourceMappingURL=resource-page-router-dmVIeu5s.cjs.map
|