@object-ui/layout 17.1.0 → 17.3.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/CHANGELOG.md +363 -0
- package/README.md +11 -7
- package/dist/AppSchemaRenderer.d.ts +3 -1
- package/dist/NavigationRenderer.d.ts +53 -1
- package/dist/PageHeader.d.ts +24 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +278 -280
- package/dist/index.umd.cjs +1 -1
- package/package.json +13 -11
- package/dist/Page.d.ts +0 -8
package/dist/index.js
CHANGED
|
@@ -2,31 +2,31 @@ import { ComponentRegistry as e } from "@object-ui/core";
|
|
|
2
2
|
import t, { useEffect as n, useMemo as r, useState as i } from "react";
|
|
3
3
|
import { Badge as a, Button as o, Collapsible as s, CollapsibleContent as c, CollapsibleTrigger as l, Input as u, LazyIcon as d, Separator as f, Sidebar as p, SidebarContent as m, SidebarFooter as h, SidebarGroup as g, SidebarGroupContent as _, SidebarGroupLabel as v, SidebarHeader as y, SidebarInput as b, SidebarInset as x, SidebarMenu as S, SidebarMenuAction as C, SidebarMenuButton as w, SidebarMenuItem as T, SidebarMenuSub as E, SidebarMenuSubButton as D, SidebarMenuSubItem as O, SidebarProvider as k, cn as A, getLazyIcon as j, useIsMobile as M } from "@object-ui/components";
|
|
4
4
|
import { ArrowLeft as N, ChevronRight as P, FileText as F, GripVertical as ee, Layers as te, Pin as ne, PinOff as re, Search as ie, Star as I } from "lucide-react";
|
|
5
|
-
import { SchemaRenderer as L, useRecordContext as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { Link as
|
|
8
|
-
import { DndContext as
|
|
9
|
-
import { SortableContext as
|
|
10
|
-
import { CSS as
|
|
11
|
-
import { menuItemToNavigationItem as
|
|
5
|
+
import { SchemaRenderer as L, useRecordContext as R } from "@object-ui/react";
|
|
6
|
+
import { Fragment as ae, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
7
|
+
import { Link as oe, NavLink as V, useLocation as H } from "react-router-dom";
|
|
8
|
+
import { DndContext as U, KeyboardSensor as se, PointerSensor as W, closestCenter as ce, useSensor as G, useSensors as K } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as q, arrayMove as le, useSortable as ue, verticalListSortingStrategy as de } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as fe } from "@dnd-kit/utilities";
|
|
11
|
+
import { menuItemToNavigationItem as pe } from "@object-ui/types";
|
|
12
12
|
//#region src/PageHeader.tsx
|
|
13
|
-
var
|
|
13
|
+
var me = (e) => {
|
|
14
14
|
let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
|
|
15
15
|
return t != null && String(t).trim() ? String(t) : [
|
|
16
16
|
e?.salutation,
|
|
17
17
|
e?.first_name,
|
|
18
18
|
e?.last_name
|
|
19
19
|
].filter((e) => typeof e == "string" && e.trim()).map((e) => e.trim()).join(" ") || (typeof e?.email == "string" && e.email.trim() ? e.email.trim() : null);
|
|
20
|
-
},
|
|
20
|
+
}, he = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
|
|
21
21
|
let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
|
|
22
|
-
return r == null ? "" : typeof r == "object" ?
|
|
22
|
+
return r == null ? "" : typeof r == "object" ? me(r) ?? "" : String(r);
|
|
23
23
|
}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
|
|
24
|
-
function
|
|
25
|
-
let m =
|
|
24
|
+
function ge({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
|
|
25
|
+
let m = R(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = he(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = he(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
|
|
26
26
|
if (typeof window > "u") return;
|
|
27
27
|
let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
|
|
28
28
|
t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
29
|
-
}, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */
|
|
29
|
+
}, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ z(L, { schema: e }, e?.id || `pgh-child-${t}`)) : null, T = Array.isArray(s) && s.length > 0 && s || Array.isArray(l?.actions) && l.actions.length > 0 && l.actions || Array.isArray(l?.properties?.actions) && l.properties.actions.length > 0 && l.properties.actions || null, E = a || f || (T ? /* @__PURE__ */ z(L, { schema: {
|
|
30
30
|
type: "record:quick_actions",
|
|
31
31
|
properties: {
|
|
32
32
|
actions: T,
|
|
@@ -35,39 +35,39 @@ function G({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
|
|
|
35
35
|
inline: !0
|
|
36
36
|
}
|
|
37
37
|
} }) : null) || w;
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ z("div", {
|
|
39
39
|
className: A("flex flex-col gap-3 pb-4 border-b", u),
|
|
40
40
|
...p,
|
|
41
|
-
children: /* @__PURE__ */
|
|
41
|
+
children: /* @__PURE__ */ B("div", {
|
|
42
42
|
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
43
43
|
children: [
|
|
44
|
-
S && /* @__PURE__ */
|
|
44
|
+
S && /* @__PURE__ */ z(o, {
|
|
45
45
|
type: "button",
|
|
46
46
|
variant: "ghost",
|
|
47
47
|
size: "icon",
|
|
48
48
|
onClick: C,
|
|
49
49
|
"aria-label": "Back to list",
|
|
50
50
|
className: "flex-shrink-0 -ml-2",
|
|
51
|
-
children: /* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ z(N, { className: "size-4" })
|
|
52
52
|
}),
|
|
53
|
-
i && (g || y) && /* @__PURE__ */
|
|
53
|
+
i && (g || y) && /* @__PURE__ */ z("div", {
|
|
54
54
|
className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
|
|
55
|
-
children: typeof i == "string" ? /* @__PURE__ */
|
|
55
|
+
children: typeof i == "string" ? /* @__PURE__ */ z(d, {
|
|
56
56
|
name: i,
|
|
57
57
|
className: "size-5"
|
|
58
58
|
}) : i
|
|
59
59
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ B("div", {
|
|
61
61
|
className: "flex flex-col min-w-0 flex-1",
|
|
62
|
-
children: [g ? /* @__PURE__ */
|
|
62
|
+
children: [g ? /* @__PURE__ */ z("h1", {
|
|
63
63
|
className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
|
|
64
64
|
children: g
|
|
65
|
-
}) : null, y && /* @__PURE__ */
|
|
65
|
+
}) : null, y && /* @__PURE__ */ z("p", {
|
|
66
66
|
className: "text-sm text-muted-foreground truncate",
|
|
67
67
|
children: y
|
|
68
68
|
})]
|
|
69
69
|
}),
|
|
70
|
-
E && /* @__PURE__ */
|
|
70
|
+
E && /* @__PURE__ */ z("div", {
|
|
71
71
|
className: "flex items-center gap-2 ml-auto",
|
|
72
72
|
children: E
|
|
73
73
|
})
|
|
@@ -77,7 +77,7 @@ function G({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
|
|
|
77
77
|
}
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/AppShell.tsx
|
|
80
|
-
function
|
|
80
|
+
function _e(e) {
|
|
81
81
|
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
82
82
|
if (!t) return null;
|
|
83
83
|
let n = parseInt(t[1], 16) / 255, r = parseInt(t[2], 16) / 255, i = parseInt(t[3], 16) / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = 0, c = 0, l = (a + o) / 2;
|
|
@@ -90,9 +90,7 @@ function ye(e) {
|
|
|
90
90
|
case r:
|
|
91
91
|
s = ((i - n) / e + 2) / 6;
|
|
92
92
|
break;
|
|
93
|
-
case i:
|
|
94
|
-
s = ((n - r) / e + 4) / 6;
|
|
95
|
-
break;
|
|
93
|
+
case i: s = ((n - r) / e + 4) / 6;
|
|
96
94
|
}
|
|
97
95
|
}
|
|
98
96
|
return {
|
|
@@ -101,17 +99,17 @@ function ye(e) {
|
|
|
101
99
|
l: l * 100
|
|
102
100
|
};
|
|
103
101
|
}
|
|
104
|
-
function
|
|
105
|
-
let t =
|
|
102
|
+
function ve(e) {
|
|
103
|
+
let t = _e(e);
|
|
106
104
|
return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
|
|
107
105
|
}
|
|
108
|
-
function
|
|
109
|
-
let t =
|
|
106
|
+
function ye(e) {
|
|
107
|
+
let t = _e(e);
|
|
110
108
|
if (!t) return null;
|
|
111
109
|
let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
|
|
112
110
|
return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
|
|
113
111
|
}
|
|
114
|
-
function
|
|
112
|
+
function be(e) {
|
|
115
113
|
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
116
114
|
if (!t) return "0 0% 100%";
|
|
117
115
|
let n = (e) => {
|
|
@@ -120,16 +118,16 @@ function Se(e) {
|
|
|
120
118
|
}, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
|
|
121
119
|
return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
|
|
122
120
|
}
|
|
123
|
-
function
|
|
121
|
+
function xe(e, t) {
|
|
124
122
|
n(() => {
|
|
125
123
|
let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
|
|
126
124
|
if (e?.primaryColor) {
|
|
127
|
-
let t =
|
|
128
|
-
a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" :
|
|
125
|
+
let t = ve(e.primaryColor), i = ye(e.primaryColor), a = r() && i || t;
|
|
126
|
+
a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : be(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
|
|
129
127
|
} else n.style.removeProperty("--brand-primary"), n.style.removeProperty("--brand-primary-hsl"), n.style.removeProperty("--primary"), n.style.removeProperty("--primary-foreground"), n.style.removeProperty("--ring"), n.style.removeProperty("--sidebar-primary"), n.style.removeProperty("--sidebar-ring");
|
|
130
128
|
if (e?.accentColor) {
|
|
131
|
-
let t =
|
|
132
|
-
a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" :
|
|
129
|
+
let t = ve(e.accentColor), i = ye(e.accentColor), a = r() && i || t;
|
|
130
|
+
a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : be(e.accentColor)));
|
|
133
131
|
} else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
|
|
134
132
|
};
|
|
135
133
|
i();
|
|
@@ -156,20 +154,20 @@ function Ce(e, t) {
|
|
|
156
154
|
t
|
|
157
155
|
]);
|
|
158
156
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
157
|
+
function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
|
|
158
|
+
return xe(a, a?.title), /* @__PURE__ */ B(k, {
|
|
161
159
|
defaultOpen: i,
|
|
162
160
|
className: "!flex-col h-svh overflow-hidden",
|
|
163
|
-
children: [/* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ z("header", {
|
|
164
162
|
className: "sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4",
|
|
165
163
|
children: t
|
|
166
|
-
}), /* @__PURE__ */
|
|
164
|
+
}), /* @__PURE__ */ B("div", {
|
|
167
165
|
className: "flex flex-1 min-h-0 w-full",
|
|
168
166
|
children: [
|
|
169
167
|
e,
|
|
170
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ z(x, {
|
|
171
169
|
className: "min-w-0",
|
|
172
|
-
children: /* @__PURE__ */
|
|
170
|
+
children: /* @__PURE__ */ z("main", {
|
|
173
171
|
className: A("flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6", r),
|
|
174
172
|
children: n
|
|
175
173
|
})
|
|
@@ -181,11 +179,11 @@ function K({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
|
|
|
181
179
|
}
|
|
182
180
|
//#endregion
|
|
183
181
|
//#region src/PageCard.tsx
|
|
184
|
-
function
|
|
185
|
-
return /* @__PURE__ */
|
|
182
|
+
function Se({ className: e, children: t, ...n }) {
|
|
183
|
+
return /* @__PURE__ */ z("div", {
|
|
186
184
|
className: A("rounded-xl border bg-card text-card-foreground shadow", e),
|
|
187
185
|
...n,
|
|
188
|
-
children: /* @__PURE__ */
|
|
186
|
+
children: /* @__PURE__ */ z("div", {
|
|
189
187
|
className: "p-6",
|
|
190
188
|
children: t
|
|
191
189
|
})
|
|
@@ -193,7 +191,7 @@ function we({ className: e, children: t, ...n }) {
|
|
|
193
191
|
}
|
|
194
192
|
//#endregion
|
|
195
193
|
//#region src/ResponsiveGrid.tsx
|
|
196
|
-
var
|
|
194
|
+
var Ce = {
|
|
197
195
|
xs: {
|
|
198
196
|
1: "grid-cols-1",
|
|
199
197
|
2: "grid-cols-2",
|
|
@@ -243,11 +241,11 @@ var Te = {
|
|
|
243
241
|
12: "2xl:grid-cols-12"
|
|
244
242
|
}
|
|
245
243
|
};
|
|
246
|
-
function
|
|
244
|
+
function we(e) {
|
|
247
245
|
if (!e) return "grid-cols-1";
|
|
248
246
|
let t = [];
|
|
249
247
|
for (let [n, r] of Object.entries(e)) {
|
|
250
|
-
let e =
|
|
248
|
+
let e = Ce[n];
|
|
251
249
|
if (e && r) {
|
|
252
250
|
let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
|
|
253
251
|
t.push(e[n]);
|
|
@@ -255,7 +253,7 @@ function Ee(e) {
|
|
|
255
253
|
}
|
|
256
254
|
return t.join(" ") || "grid-cols-1";
|
|
257
255
|
}
|
|
258
|
-
var
|
|
256
|
+
var Te = {
|
|
259
257
|
0: "gap-0",
|
|
260
258
|
1: "gap-1",
|
|
261
259
|
2: "gap-2",
|
|
@@ -264,16 +262,19 @@ var De = {
|
|
|
264
262
|
5: "gap-5",
|
|
265
263
|
6: "gap-6",
|
|
266
264
|
8: "gap-8"
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
}, Ee = ({ columns: e, gap: t = 4, className: n, children: r }) => {
|
|
266
|
+
let i = we(e), a = typeof t == "number" ? Te[t] || `gap-${t}` : "";
|
|
267
|
+
return /* @__PURE__ */ z("div", {
|
|
268
|
+
className: A("grid", i, a, n),
|
|
269
|
+
children: r
|
|
270
|
+
});
|
|
271
|
+
};
|
|
271
272
|
//#endregion
|
|
272
273
|
//#region src/NavigationRenderer.tsx
|
|
273
|
-
function
|
|
274
|
+
function Y(e) {
|
|
274
275
|
return e ? j(e) : F;
|
|
275
276
|
}
|
|
276
|
-
function
|
|
277
|
+
function X(e, t) {
|
|
277
278
|
if (typeof e == "string") return e;
|
|
278
279
|
if (t) {
|
|
279
280
|
let n = t(e.key, {
|
|
@@ -284,8 +285,8 @@ function J(e, t) {
|
|
|
284
285
|
}
|
|
285
286
|
return e.defaultValue || e.key;
|
|
286
287
|
}
|
|
287
|
-
function
|
|
288
|
-
let s =
|
|
288
|
+
function De(e, t, n, r, i, a, o) {
|
|
289
|
+
let s = X(e.label, n);
|
|
289
290
|
if (typeof e.label != "string") return s;
|
|
290
291
|
let c = (e) => !!e && s.trim().toLowerCase() !== e.trim().toLowerCase();
|
|
291
292
|
if (e.type === "object" && e.objectName) {
|
|
@@ -303,21 +304,33 @@ function ke(e, t, n, r, i, a, o) {
|
|
|
303
304
|
}
|
|
304
305
|
return o && e.id && !c(e.id) ? o(e.id, s) : s;
|
|
305
306
|
}
|
|
306
|
-
var
|
|
307
|
-
function
|
|
307
|
+
var Oe = (e) => e !== !1 && e !== "false", ke = () => !0, Ae = () => !0;
|
|
308
|
+
function je(e, t = {}) {
|
|
309
|
+
let { evaluateVisibility: n = Oe, checkPermission: r = ke, checkCapability: i = Ae, hasActionHandler: a = !1 } = t;
|
|
310
|
+
for (let o of e) if (n(o.visible) && !(o.requiredPermissions?.length && !r(o.requiredPermissions)) && !(o.requiresObject && !i("object", o.requiresObject)) && !(o.requiresService && !i("service", o.requiresService)) && o.type !== "separator") {
|
|
311
|
+
if (o.type === "group") {
|
|
312
|
+
if (je(o.children ?? [], t)) return !0;
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (!(o.type === "action" && !a)) return !0;
|
|
316
|
+
}
|
|
317
|
+
return !1;
|
|
318
|
+
}
|
|
319
|
+
var Me = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
|
|
320
|
+
function Z(e, t) {
|
|
308
321
|
if (!e.includes("{")) return e;
|
|
309
|
-
let n = !1, r = e.replace(
|
|
322
|
+
let n = !1, r = e.replace(Me, (e, r) => {
|
|
310
323
|
let i;
|
|
311
324
|
return i = r === "current_user_id" ? t?.currentUserId : r === "current_org_id" ? t?.currentOrgId : t?.contextValues?.[r], i || (n = !0, "");
|
|
312
325
|
});
|
|
313
326
|
return n ? null : r;
|
|
314
327
|
}
|
|
315
|
-
function
|
|
328
|
+
function Ne(e, t, n) {
|
|
316
329
|
switch (e.type) {
|
|
317
330
|
case "object": {
|
|
318
331
|
let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
|
|
319
332
|
if (i) {
|
|
320
|
-
let t =
|
|
333
|
+
let t = Z(i, n);
|
|
321
334
|
if (t) {
|
|
322
335
|
let n = `${r}/record/${encodeURIComponent(t)}`;
|
|
323
336
|
return {
|
|
@@ -331,7 +344,7 @@ function X(e, t, n) {
|
|
|
331
344
|
let e = new URLSearchParams();
|
|
332
345
|
for (let [t, r] of Object.entries(a)) {
|
|
333
346
|
if (r == null || t === "") continue;
|
|
334
|
-
let i =
|
|
347
|
+
let i = Z(String(r), n);
|
|
335
348
|
i !== null && e.set(`filter[${t}]`, i);
|
|
336
349
|
}
|
|
337
350
|
let t = e.toString();
|
|
@@ -358,7 +371,7 @@ function X(e, t, n) {
|
|
|
358
371
|
if (r && typeof r == "object") {
|
|
359
372
|
let e = new URLSearchParams();
|
|
360
373
|
for (let [t, i] of Object.entries(r)) if (i != null) if (typeof i == "string") {
|
|
361
|
-
let r =
|
|
374
|
+
let r = Z(i, n);
|
|
362
375
|
r !== null && e.set(t, r);
|
|
363
376
|
} else e.set(t, JSON.stringify(i));
|
|
364
377
|
let t = e.toString();
|
|
@@ -393,8 +406,8 @@ function X(e, t, n) {
|
|
|
393
406
|
let e = i[1], r = a && typeof a.type == "string" ? a.type : void 0, o = a && typeof a.name == "string" ? a.name : void 0, s = "";
|
|
394
407
|
if (a && typeof a == "object") {
|
|
395
408
|
let e = new URLSearchParams();
|
|
396
|
-
for (let [t, r] of Object.entries(a)) if (
|
|
397
|
-
let i =
|
|
409
|
+
for (let [t, r] of Object.entries(a)) if (t !== "type" && t !== "name" && r != null) if (typeof r == "string") {
|
|
410
|
+
let i = Z(r, n);
|
|
398
411
|
i && e.set(t, i);
|
|
399
412
|
} else e.set(t, JSON.stringify(r));
|
|
400
413
|
let t = e.toString();
|
|
@@ -441,14 +454,14 @@ function Ve(e, t) {
|
|
|
441
454
|
return t.startsWith(`${e}.`) ? t.slice(e.length + 1) : t;
|
|
442
455
|
}
|
|
443
456
|
function He(e, t, n, r, i) {
|
|
444
|
-
let { href: a, external: o } =
|
|
457
|
+
let { href: a, external: o } = Ne(e, r, i);
|
|
445
458
|
if (o || a === "#") return 0;
|
|
446
459
|
if (e.type === "object" && e.objectName) {
|
|
447
460
|
let a = `${r}/${e.objectName}`;
|
|
448
461
|
if (t !== a && !t.startsWith(`${a}/`)) return 0;
|
|
449
462
|
let o = t === a ? [] : t.slice(a.length + 1).split("/"), s = e.recordId;
|
|
450
463
|
if (s) {
|
|
451
|
-
let e =
|
|
464
|
+
let e = Z(s, i);
|
|
452
465
|
if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Pe : 0;
|
|
453
466
|
}
|
|
454
467
|
let c = e.filters;
|
|
@@ -457,7 +470,7 @@ function He(e, t, n, r, i) {
|
|
|
457
470
|
let e = /* @__PURE__ */ new Map();
|
|
458
471
|
for (let [t, n] of Object.entries(c)) {
|
|
459
472
|
if (n == null || t === "") continue;
|
|
460
|
-
let r =
|
|
473
|
+
let r = Z(String(n), i);
|
|
461
474
|
r !== null && e.set(t, r);
|
|
462
475
|
}
|
|
463
476
|
if (e.size !== n.size) return 0;
|
|
@@ -484,38 +497,38 @@ function Ue(e, t, n, r, i) {
|
|
|
484
497
|
};
|
|
485
498
|
return c(e), o;
|
|
486
499
|
}
|
|
487
|
-
var
|
|
488
|
-
function
|
|
500
|
+
var We = t.createContext(null);
|
|
501
|
+
function Ge(e, t) {
|
|
489
502
|
if (!t.trim()) return e;
|
|
490
503
|
let n = t.toLowerCase().trim();
|
|
491
504
|
return e.reduce((e, r) => {
|
|
492
505
|
if (r.type === "separator") return e;
|
|
493
506
|
if (r.type === "group" && r.children?.length) {
|
|
494
|
-
let n =
|
|
507
|
+
let n = Ge(r.children, t);
|
|
495
508
|
return n.length > 0 && e.push({
|
|
496
509
|
...r,
|
|
497
510
|
children: n
|
|
498
511
|
}), e;
|
|
499
512
|
}
|
|
500
|
-
return
|
|
513
|
+
return X(r.label).toLowerCase().includes(n) && e.push(r), e;
|
|
501
514
|
}, []);
|
|
502
515
|
}
|
|
503
|
-
var
|
|
504
|
-
function
|
|
505
|
-
let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } =
|
|
516
|
+
var Ke = 5;
|
|
517
|
+
function qe({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, resolveViewLabel: f, resolveItemLabel: p, t: m, templateContext: h }) {
|
|
518
|
+
let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } = ue({
|
|
506
519
|
id: e.id,
|
|
507
520
|
disabled: !c
|
|
508
|
-
})
|
|
509
|
-
|
|
521
|
+
}), S = {
|
|
522
|
+
transform: fe.Transform.toString(y),
|
|
523
|
+
transition: b,
|
|
524
|
+
opacity: x ? .5 : void 0,
|
|
525
|
+
zIndex: x ? 10 : void 0
|
|
526
|
+
};
|
|
527
|
+
return /* @__PURE__ */ z("div", {
|
|
510
528
|
ref: v,
|
|
511
|
-
style:
|
|
512
|
-
transform: he.Transform.toString(y),
|
|
513
|
-
transition: b,
|
|
514
|
-
opacity: x ? .5 : void 0,
|
|
515
|
-
zIndex: x ? 10 : void 0
|
|
516
|
-
},
|
|
529
|
+
style: S,
|
|
517
530
|
...g,
|
|
518
|
-
children: /* @__PURE__ */
|
|
531
|
+
children: /* @__PURE__ */ z(Q, {
|
|
519
532
|
item: e,
|
|
520
533
|
basePath: t,
|
|
521
534
|
evalVis: n,
|
|
@@ -539,27 +552,27 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
539
552
|
let j = M(), N = j ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, F = A("shrink-0", j ? "h-5 w-5" : "h-4 w-4"), te = (() => {
|
|
540
553
|
if (typeof e.expanded == "boolean") return e.expanded;
|
|
541
554
|
if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
|
|
542
|
-
})(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(
|
|
555
|
+
})(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(We), L = t.useMemo(() => {
|
|
543
556
|
if (e.type !== "group" || !I) return !1;
|
|
544
557
|
let t = (e) => !!e?.some((e) => e.id === I || e.type === "group" && t(e.children));
|
|
545
558
|
return t(e.children);
|
|
546
|
-
}, [e, I]) ? !0 : te ?? !(ie >= 8));
|
|
559
|
+
}, [e, I]) ? !0 : te ?? !(ie >= 8), [R, V] = i(L);
|
|
547
560
|
if (!r(e.visible) || e.requiredPermissions?.length && !o(e.requiredPermissions)) return null;
|
|
548
|
-
let
|
|
549
|
-
if (
|
|
550
|
-
if (e.type === "separator") return /* @__PURE__ */
|
|
561
|
+
let H = e.requiresObject, U = e.requiresService;
|
|
562
|
+
if (H && !u("object", H) || U && !u("service", U)) return null;
|
|
563
|
+
if (e.type === "separator") return /* @__PURE__ */ z(f, { className: "my-2" });
|
|
551
564
|
if (e.type === "group") {
|
|
552
|
-
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i =
|
|
553
|
-
return /* @__PURE__ */
|
|
554
|
-
open:
|
|
555
|
-
onOpenChange:
|
|
556
|
-
children: /* @__PURE__ */
|
|
565
|
+
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = De(e, y, O, b, x, E, D);
|
|
566
|
+
return /* @__PURE__ */ z(s, {
|
|
567
|
+
open: R,
|
|
568
|
+
onOpenChange: V,
|
|
569
|
+
children: /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, {
|
|
557
570
|
asChild: !0,
|
|
558
|
-
children: /* @__PURE__ */
|
|
571
|
+
children: /* @__PURE__ */ B(l, {
|
|
559
572
|
className: A("flex w-full items-center justify-between", j && "min-h-[44px] text-[15px] rounded-xl"),
|
|
560
|
-
children: [i, /* @__PURE__ */
|
|
573
|
+
children: [i, /* @__PURE__ */ z(P, { className: A("ml-auto transition-transform", j ? "h-5 w-5" : "h-4 w-4", R && "rotate-90") })]
|
|
561
574
|
})
|
|
562
|
-
}), /* @__PURE__ */
|
|
575
|
+
}), /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z(Q, {
|
|
563
576
|
item: e,
|
|
564
577
|
basePath: n,
|
|
565
578
|
evalVis: r,
|
|
@@ -579,93 +592,94 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
579
592
|
});
|
|
580
593
|
}
|
|
581
594
|
if (e.type === "action") {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
595
|
+
if (!d) return null;
|
|
596
|
+
let t = Y(e.icon), r = X(e.label, O);
|
|
597
|
+
return /* @__PURE__ */ B(T, { children: [
|
|
598
|
+
h && /* @__PURE__ */ z("span", {
|
|
585
599
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
586
600
|
"aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
|
|
587
601
|
...h,
|
|
588
|
-
children: /* @__PURE__ */
|
|
602
|
+
children: /* @__PURE__ */ z(ee, { className: "h-3.5 w-3.5" })
|
|
589
603
|
}),
|
|
590
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ B(w, {
|
|
591
605
|
tooltip: r,
|
|
592
606
|
onClick: () => d?.(e),
|
|
593
607
|
className: N,
|
|
594
608
|
children: [
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
e.badge != null && /* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ z(t, { className: F }),
|
|
610
|
+
/* @__PURE__ */ z("span", { children: r }),
|
|
611
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
598
612
|
variant: e.badgeVariant ?? "default",
|
|
599
613
|
className: "ml-auto text-[10px] px-1.5 py-0",
|
|
600
614
|
children: e.badge
|
|
601
615
|
})
|
|
602
616
|
]
|
|
603
617
|
}),
|
|
604
|
-
p && m && /* @__PURE__ */
|
|
618
|
+
p && m && /* @__PURE__ */ z(C, {
|
|
605
619
|
showOnHover: !0,
|
|
606
620
|
onClick: () => m(e.id, !e.pinned, e, n),
|
|
607
621
|
"aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
|
|
608
622
|
defaultValue: e.pinned ? `Unpin ${r}` : `Pin ${r}`,
|
|
609
623
|
name: r
|
|
610
624
|
}) : e.pinned ? `Unpin ${r}` : `Pin ${r}`,
|
|
611
|
-
children: e.pinned ? /* @__PURE__ */
|
|
625
|
+
children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
|
|
612
626
|
})
|
|
613
627
|
] });
|
|
614
628
|
}
|
|
615
|
-
let
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
e.badge != null && /* @__PURE__ */
|
|
629
|
+
let se = Y(e.icon), { href: W, external: ce } = Ne(e, n, k), G = I !== null && e.id === I, K = De(e, y, O, b, x, E, D), q = /* @__PURE__ */ B(ae, { children: [
|
|
630
|
+
/* @__PURE__ */ z(se, { className: F }),
|
|
631
|
+
/* @__PURE__ */ z("span", { children: K }),
|
|
632
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
619
633
|
variant: e.badgeVariant ?? "default",
|
|
620
634
|
className: "ml-auto text-[10px] px-1.5 py-0",
|
|
621
635
|
children: e.badge
|
|
622
636
|
})
|
|
623
637
|
] });
|
|
624
|
-
return /* @__PURE__ */
|
|
625
|
-
h && /* @__PURE__ */
|
|
638
|
+
return /* @__PURE__ */ B(T, { children: [
|
|
639
|
+
h && /* @__PURE__ */ z("span", {
|
|
626
640
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
627
641
|
"aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
|
|
628
642
|
...h,
|
|
629
|
-
children: /* @__PURE__ */
|
|
643
|
+
children: /* @__PURE__ */ z(ee, { className: "h-3.5 w-3.5" })
|
|
630
644
|
}),
|
|
631
|
-
/* @__PURE__ */
|
|
645
|
+
/* @__PURE__ */ z(w, {
|
|
632
646
|
asChild: !0,
|
|
633
|
-
isActive:
|
|
634
|
-
tooltip:
|
|
647
|
+
isActive: G,
|
|
648
|
+
tooltip: K,
|
|
635
649
|
className: N,
|
|
636
|
-
children:
|
|
637
|
-
href:
|
|
650
|
+
children: ce ? /* @__PURE__ */ z("a", {
|
|
651
|
+
href: W,
|
|
638
652
|
target: "_blank",
|
|
639
653
|
rel: "noopener noreferrer",
|
|
640
|
-
children:
|
|
641
|
-
}) : /* @__PURE__ */
|
|
642
|
-
to:
|
|
643
|
-
children:
|
|
654
|
+
children: q
|
|
655
|
+
}) : /* @__PURE__ */ z(oe, {
|
|
656
|
+
to: W,
|
|
657
|
+
children: q
|
|
644
658
|
})
|
|
645
659
|
}),
|
|
646
|
-
p && m && /* @__PURE__ */
|
|
660
|
+
p && m && /* @__PURE__ */ z(C, {
|
|
647
661
|
showOnHover: !0,
|
|
648
662
|
onClick: () => m(e.id, !e.pinned, e, n),
|
|
649
663
|
"aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
|
|
650
|
-
defaultValue: e.pinned ? `Unpin ${
|
|
651
|
-
name:
|
|
652
|
-
}) : e.pinned ? `Unpin ${
|
|
653
|
-
children: e.pinned ? /* @__PURE__ */
|
|
664
|
+
defaultValue: e.pinned ? `Unpin ${K}` : `Pin ${K}`,
|
|
665
|
+
name: K
|
|
666
|
+
}) : e.pinned ? `Unpin ${K}` : `Pin ${K}`,
|
|
667
|
+
children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
|
|
654
668
|
})
|
|
655
669
|
] });
|
|
656
670
|
}
|
|
657
|
-
function $({ items: e, basePath: t = "", evaluateVisibility: n =
|
|
658
|
-
let C =
|
|
671
|
+
function $({ items: e, basePath: t = "", evaluateVisibility: n = Oe, checkPermission: i = ke, checkCapability: a = Ae, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, resolveItemLabel: y, t: b, templateContext: x }) {
|
|
672
|
+
let C = H(), w = r(() => Ue(e, C.pathname, C.search, t, x)?.id ?? null, [
|
|
659
673
|
e,
|
|
660
674
|
C.pathname,
|
|
661
675
|
C.search,
|
|
662
676
|
t,
|
|
663
677
|
x
|
|
664
|
-
]), T = r(() => s ?
|
|
678
|
+
]), T = r(() => s ? Ge(e, s) : e, [e, s]), E = r(() => Je(T), [T]), D = T.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), O = K(G(W, { activationConstraint: { distance: Ke } }), G(se)), k = (e) => {
|
|
665
679
|
let { active: t, over: n } = e;
|
|
666
680
|
if (!n || t.id === n.id || !d) return;
|
|
667
681
|
let r = D.findIndex((e) => e.id === t.id), i = D.findIndex((e) => e.id === n.id);
|
|
668
|
-
r
|
|
682
|
+
r !== -1 && i !== -1 && d(le(D, r, i).map((e, t) => ({
|
|
669
683
|
...e,
|
|
670
684
|
order: t
|
|
671
685
|
})));
|
|
@@ -684,88 +698,87 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = Ae, checkPermis
|
|
|
684
698
|
resolveItemLabel: y,
|
|
685
699
|
t: b,
|
|
686
700
|
templateContext: x
|
|
687
|
-
}, j = D.some((e) => e.type === "group"), M = E.length > 0 && c ? /* @__PURE__ */
|
|
701
|
+
}, j = D.some((e) => e.type === "group"), M = E.length > 0 && c ? /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
|
|
688
702
|
className: "flex items-center gap-1.5",
|
|
689
|
-
children: [/* @__PURE__ */
|
|
690
|
-
}), /* @__PURE__ */
|
|
703
|
+
children: [/* @__PURE__ */ z(I, { className: "h-3.5 w-3.5" }), b ? b("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
|
|
704
|
+
}), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: E.map((e) => /* @__PURE__ */ z(Q, {
|
|
691
705
|
item: e,
|
|
692
706
|
...A
|
|
693
707
|
}, `fav-${e.id}`)) }) })] }) : null;
|
|
694
708
|
if (!j) {
|
|
695
|
-
let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */
|
|
709
|
+
let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ z(U, {
|
|
696
710
|
sensors: O,
|
|
697
|
-
collisionDetection:
|
|
711
|
+
collisionDetection: ce,
|
|
698
712
|
onDragEnd: k,
|
|
699
|
-
children: /* @__PURE__ */
|
|
713
|
+
children: /* @__PURE__ */ z(q, {
|
|
700
714
|
items: e,
|
|
701
|
-
strategy:
|
|
702
|
-
children: /* @__PURE__ */
|
|
715
|
+
strategy: de,
|
|
716
|
+
children: /* @__PURE__ */ z(S, { children: D.map((e) => /* @__PURE__ */ z(qe, {
|
|
703
717
|
item: e,
|
|
704
718
|
enableReorder: u,
|
|
705
719
|
...A
|
|
706
720
|
}, e.id)) })
|
|
707
721
|
})
|
|
708
|
-
}) : /* @__PURE__ */
|
|
722
|
+
}) : /* @__PURE__ */ z(S, { children: D.map((e) => /* @__PURE__ */ z(Q, {
|
|
709
723
|
item: e,
|
|
710
724
|
...A
|
|
711
725
|
}, e.id)) });
|
|
712
|
-
return /* @__PURE__ */
|
|
726
|
+
return /* @__PURE__ */ B(We.Provider, {
|
|
713
727
|
value: w,
|
|
714
|
-
children: [M, /* @__PURE__ */
|
|
728
|
+
children: [M, /* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: t }) })]
|
|
715
729
|
});
|
|
716
730
|
}
|
|
717
731
|
let N = [], P = [], F = (e) => {
|
|
718
732
|
if (P.length === 0) return;
|
|
719
733
|
let t = P;
|
|
720
|
-
P = [], N.push(/* @__PURE__ */
|
|
734
|
+
P = [], N.push(/* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z(Q, {
|
|
721
735
|
item: e,
|
|
722
736
|
...A
|
|
723
737
|
}, e.id)) }) }) }, e));
|
|
724
738
|
};
|
|
725
739
|
return D.forEach((e, t) => {
|
|
726
|
-
e.type === "group" ? (F(`leaf-${t}`), N.push(/* @__PURE__ */
|
|
740
|
+
e.type === "group" ? (F(`leaf-${t}`), N.push(/* @__PURE__ */ z(Q, {
|
|
727
741
|
item: e,
|
|
728
742
|
...A
|
|
729
743
|
}, e.id))) : P.push(e);
|
|
730
|
-
}), F("leaf-end"), /* @__PURE__ */
|
|
744
|
+
}), F("leaf-end"), /* @__PURE__ */ B(We.Provider, {
|
|
731
745
|
value: w,
|
|
732
746
|
children: [M, N]
|
|
733
747
|
});
|
|
734
748
|
}
|
|
735
|
-
function
|
|
749
|
+
function Je(e) {
|
|
736
750
|
let t = [];
|
|
737
|
-
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...
|
|
751
|
+
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Je(n.children));
|
|
738
752
|
return t;
|
|
739
753
|
}
|
|
740
754
|
//#endregion
|
|
741
755
|
//#region src/AppSchemaRenderer.tsx
|
|
742
|
-
function
|
|
743
|
-
|
|
744
|
-
return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
|
|
756
|
+
function Ye({ areas: e, activeAreaId: t, onAreaChange: n }) {
|
|
757
|
+
return e.length <= 1 ? null : /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
|
|
745
758
|
className: "flex items-center gap-1.5",
|
|
746
|
-
children: [/* @__PURE__ */
|
|
747
|
-
}), /* @__PURE__ */
|
|
748
|
-
let r =
|
|
749
|
-
return /* @__PURE__ */
|
|
759
|
+
children: [/* @__PURE__ */ z(te, { className: "h-3.5 w-3.5" }), "Area"]
|
|
760
|
+
}), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.map((e) => {
|
|
761
|
+
let r = Y(e.icon);
|
|
762
|
+
return /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
|
|
750
763
|
isActive: e.id === t,
|
|
751
|
-
tooltip:
|
|
764
|
+
tooltip: X(e.label),
|
|
752
765
|
onClick: () => n(e.id),
|
|
753
|
-
children: [/* @__PURE__ */
|
|
766
|
+
children: [/* @__PURE__ */ z(r, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: X(e.label) })]
|
|
754
767
|
}) }, e.id);
|
|
755
768
|
}) }) })] });
|
|
756
769
|
}
|
|
757
|
-
function
|
|
758
|
-
let n =
|
|
770
|
+
function Xe({ items: e, basePath: t }) {
|
|
771
|
+
let n = H(), r = (e) => {
|
|
759
772
|
let t = [];
|
|
760
773
|
for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
|
|
761
774
|
return t;
|
|
762
775
|
}, i = r(e).slice(0, 5);
|
|
763
|
-
return i.length === 0 ? null : /* @__PURE__ */
|
|
776
|
+
return i.length === 0 ? null : /* @__PURE__ */ z("div", {
|
|
764
777
|
className: "fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom",
|
|
765
778
|
role: "navigation",
|
|
766
779
|
"aria-label": "Mobile navigation",
|
|
767
780
|
children: i.map((e) => {
|
|
768
|
-
let r =
|
|
781
|
+
let r = Y(e.icon), i = "#";
|
|
769
782
|
if (e.type === "object") i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`);
|
|
770
783
|
else if (e.type === "dashboard") i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#";
|
|
771
784
|
else if (e.type === "page") i = e.pageName ? `${t}/page/${e.pageName}` : "#";
|
|
@@ -785,174 +798,157 @@ function Ye({ items: e, basePath: t }) {
|
|
|
785
798
|
}
|
|
786
799
|
}
|
|
787
800
|
let a = i !== "#" && n.pathname.startsWith(i);
|
|
788
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ B(oe, {
|
|
789
802
|
to: i,
|
|
790
803
|
className: `flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a ? "text-primary" : "text-muted-foreground hover:text-foreground"}`,
|
|
791
|
-
children: [/* @__PURE__ */
|
|
804
|
+
children: [/* @__PURE__ */ z(r, { className: "h-5 w-5" }), /* @__PURE__ */ z("span", {
|
|
792
805
|
className: "text-[10px] truncate max-w-[60px]",
|
|
793
|
-
children:
|
|
806
|
+
children: X(e.label)
|
|
794
807
|
})]
|
|
795
808
|
}, e.id);
|
|
796
809
|
})
|
|
797
810
|
});
|
|
798
811
|
}
|
|
799
|
-
function
|
|
800
|
-
let
|
|
801
|
-
return /* @__PURE__ */
|
|
812
|
+
function Ze({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, visibleAreas: u, activeAreaId: d, setActiveAreaId: f, resolvedNavigation: g, enableSearch: _, enablePinning: v, onPinToggle: x, enableReorder: C, onReorder: E }) {
|
|
813
|
+
let D = Y(e.logo), [O, k] = i("");
|
|
814
|
+
return /* @__PURE__ */ B(p, {
|
|
802
815
|
collapsible: "icon",
|
|
803
816
|
children: [
|
|
804
|
-
/* @__PURE__ */
|
|
817
|
+
/* @__PURE__ */ B(y, { children: [s ?? /* @__PURE__ */ z(S, { children: /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
|
|
805
818
|
size: "lg",
|
|
806
819
|
tooltip: e.title ?? e.name,
|
|
807
|
-
children: [/* @__PURE__ */
|
|
820
|
+
children: [/* @__PURE__ */ z("div", {
|
|
808
821
|
className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
|
|
809
|
-
children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */
|
|
822
|
+
children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ z("img", {
|
|
810
823
|
src: e.logo,
|
|
811
824
|
alt: e.title ?? "",
|
|
812
825
|
className: "size-6 object-contain"
|
|
813
|
-
}) : /* @__PURE__ */
|
|
814
|
-
}), /* @__PURE__ */
|
|
826
|
+
}) : /* @__PURE__ */ z(D, { className: "size-4" })
|
|
827
|
+
}), /* @__PURE__ */ B("div", {
|
|
815
828
|
className: "grid flex-1 text-left text-sm leading-tight",
|
|
816
|
-
children: [/* @__PURE__ */
|
|
829
|
+
children: [/* @__PURE__ */ z("span", {
|
|
817
830
|
className: "truncate font-semibold",
|
|
818
831
|
children: e.title ?? e.name ?? "App"
|
|
819
|
-
}), e.description && /* @__PURE__ */
|
|
832
|
+
}), e.description && /* @__PURE__ */ z("span", {
|
|
820
833
|
className: "truncate text-xs text-muted-foreground",
|
|
821
834
|
children: e.description
|
|
822
835
|
})]
|
|
823
836
|
})]
|
|
824
|
-
}) }) }),
|
|
837
|
+
}) }) }), _ && /* @__PURE__ */ z(b, {
|
|
825
838
|
placeholder: "Search navigation…",
|
|
826
839
|
value: O,
|
|
827
840
|
onChange: (e) => k(e.target.value),
|
|
828
841
|
"aria-label": "Search navigation"
|
|
829
842
|
})] }),
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
|
|
832
|
-
areas:
|
|
833
|
-
activeAreaId:
|
|
834
|
-
onAreaChange:
|
|
835
|
-
evalVis: n,
|
|
836
|
-
checkPerm: r
|
|
843
|
+
/* @__PURE__ */ B(m, { children: [
|
|
844
|
+
u.length > 1 && d && /* @__PURE__ */ z(Ye, {
|
|
845
|
+
areas: u,
|
|
846
|
+
activeAreaId: d,
|
|
847
|
+
onAreaChange: f
|
|
837
848
|
}),
|
|
838
|
-
/* @__PURE__ */
|
|
839
|
-
items:
|
|
849
|
+
/* @__PURE__ */ z($, {
|
|
850
|
+
items: g,
|
|
840
851
|
basePath: t,
|
|
841
852
|
evaluateVisibility: n,
|
|
842
853
|
checkPermission: r,
|
|
843
854
|
checkCapability: a,
|
|
844
855
|
onAction: o,
|
|
845
856
|
searchQuery: O,
|
|
846
|
-
enablePinning:
|
|
847
|
-
onPinToggle:
|
|
848
|
-
enableReorder:
|
|
849
|
-
onReorder:
|
|
857
|
+
enablePinning: v,
|
|
858
|
+
onPinToggle: x,
|
|
859
|
+
enableReorder: C,
|
|
860
|
+
onReorder: E
|
|
850
861
|
}),
|
|
851
862
|
l
|
|
852
863
|
] }),
|
|
853
|
-
c && /* @__PURE__ */
|
|
864
|
+
c && /* @__PURE__ */ z(h, { children: c })
|
|
854
865
|
]
|
|
855
866
|
});
|
|
856
867
|
}
|
|
857
|
-
function
|
|
858
|
-
let S = o ?? ((e) =>
|
|
868
|
+
function Qe({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluateVisibility: o, checkPermission: s, checkCapability: c, onAction: l, navbar: u, sidebarHeader: d, sidebarFooter: f, sidebarExtra: p, children: m, className: h, defaultOpen: g = !0, enableSearch: _, enablePinning: v, onPinToggle: y, enableReorder: b, onReorder: x }) {
|
|
869
|
+
let S = o ?? ((e) => e !== !1 && e !== "false"), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => pe(e, t)), [e.menu]), E = e.navigation ?? T, D = (e.areas ?? []).filter((e) => je(e.navigation, {
|
|
870
|
+
evaluateVisibility: S,
|
|
871
|
+
checkPermission: C,
|
|
872
|
+
checkCapability: w,
|
|
873
|
+
hasActionHandler: !!l
|
|
874
|
+
})), [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
|
|
859
875
|
n(() => {
|
|
860
876
|
D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
|
|
861
877
|
}, [e.name, A]);
|
|
862
|
-
let j = D.find((e) => e.id === O)?.navigation ?? E,
|
|
878
|
+
let j = D.find((e) => e.id === O) ?? D[0], M = j?.navigation ?? E, N = {
|
|
863
879
|
title: e.title,
|
|
864
880
|
favicon: e.favicon,
|
|
865
881
|
logo: e.logo
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
882
|
+
}, P = /* @__PURE__ */ z(Ze, {
|
|
883
|
+
schema: e,
|
|
884
|
+
basePath: t,
|
|
885
|
+
evalVis: S,
|
|
886
|
+
checkPerm: C,
|
|
887
|
+
checkCap: w,
|
|
888
|
+
onAction: l,
|
|
889
|
+
sidebarHeader: d,
|
|
890
|
+
sidebarFooter: f,
|
|
891
|
+
sidebarExtra: p,
|
|
892
|
+
visibleAreas: D,
|
|
893
|
+
activeAreaId: j?.id ?? null,
|
|
894
|
+
setActiveAreaId: k,
|
|
895
|
+
resolvedNavigation: M,
|
|
896
|
+
enableSearch: _,
|
|
897
|
+
enablePinning: v,
|
|
898
|
+
onPinToggle: y,
|
|
899
|
+
enableReorder: b,
|
|
900
|
+
onReorder: x
|
|
901
|
+
});
|
|
902
|
+
return /* @__PURE__ */ B(ae, { children: [/* @__PURE__ */ z(J, {
|
|
903
|
+
sidebar: P,
|
|
887
904
|
navbar: u,
|
|
888
905
|
className: h,
|
|
889
906
|
defaultOpen: g,
|
|
890
|
-
branding:
|
|
907
|
+
branding: N,
|
|
891
908
|
children: m
|
|
892
|
-
}), a === "bottom_nav" && /* @__PURE__ */
|
|
893
|
-
items:
|
|
909
|
+
}), a === "bottom_nav" && /* @__PURE__ */ z(Xe, {
|
|
910
|
+
items: M,
|
|
894
911
|
basePath: t
|
|
895
912
|
})] });
|
|
896
913
|
}
|
|
897
914
|
//#endregion
|
|
898
|
-
//#region src/Page.tsx
|
|
899
|
-
var Qe = (e) => e ? Array.isArray(e) ? e : [e] : [];
|
|
900
|
-
function $e({ schema: e, className: t, style: n, id: r, ...i }) {
|
|
901
|
-
let a = Qe(e.children);
|
|
902
|
-
return /* @__PURE__ */ z("div", {
|
|
903
|
-
id: r || e.id,
|
|
904
|
-
className: A("flex flex-col h-full space-y-4", t),
|
|
905
|
-
style: n,
|
|
906
|
-
children: [/* @__PURE__ */ R(G, {
|
|
907
|
-
title: e.title,
|
|
908
|
-
description: e.description
|
|
909
|
-
}), /* @__PURE__ */ R("div", {
|
|
910
|
-
className: "flex-1 overflow-auto",
|
|
911
|
-
children: a.map((e, t) => /* @__PURE__ */ R(L, {
|
|
912
|
-
schema: e,
|
|
913
|
-
...i
|
|
914
|
-
}, e?.id || t))
|
|
915
|
-
})]
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
//#endregion
|
|
919
915
|
//#region src/SidebarNav.tsx
|
|
920
|
-
function
|
|
916
|
+
function $e(e) {
|
|
921
917
|
return "items" in e && !("href" in e);
|
|
922
918
|
}
|
|
923
|
-
function
|
|
924
|
-
return e.children && e.children.length > 0 ? /* @__PURE__ */
|
|
919
|
+
function et({ item: e, pathname: t }) {
|
|
920
|
+
return e.children && e.children.length > 0 ? /* @__PURE__ */ z(s, {
|
|
925
921
|
asChild: !0,
|
|
926
922
|
defaultOpen: !0,
|
|
927
923
|
className: "group/collapsible",
|
|
928
|
-
children: /* @__PURE__ */
|
|
924
|
+
children: /* @__PURE__ */ B(T, { children: [/* @__PURE__ */ z(l, {
|
|
929
925
|
asChild: !0,
|
|
930
|
-
children: /* @__PURE__ */
|
|
926
|
+
children: /* @__PURE__ */ B(w, {
|
|
931
927
|
tooltip: e.title,
|
|
932
928
|
className: "motion-safe:transition-colors motion-safe:duration-150",
|
|
933
929
|
children: [
|
|
934
|
-
e.icon && /* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
936
|
-
e.badge != null && /* @__PURE__ */
|
|
930
|
+
e.icon && /* @__PURE__ */ z(e.icon, {}),
|
|
931
|
+
/* @__PURE__ */ z("span", { children: e.title }),
|
|
932
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
937
933
|
variant: e.badgeVariant || "default",
|
|
938
934
|
className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
|
|
939
935
|
children: e.badge
|
|
940
936
|
}),
|
|
941
|
-
/* @__PURE__ */
|
|
937
|
+
/* @__PURE__ */ z(P, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
942
938
|
]
|
|
943
939
|
})
|
|
944
|
-
}), /* @__PURE__ */
|
|
940
|
+
}), /* @__PURE__ */ z(c, {
|
|
945
941
|
className: "motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:slide-out-to-top-1 motion-safe:data-[state=open]:slide-in-from-top-1 motion-safe:duration-150",
|
|
946
|
-
children: /* @__PURE__ */
|
|
942
|
+
children: /* @__PURE__ */ z(E, { children: e.children.map((e) => /* @__PURE__ */ z(O, { children: /* @__PURE__ */ z(D, {
|
|
947
943
|
asChild: !0,
|
|
948
944
|
isActive: t === e.href,
|
|
949
945
|
className: "motion-safe:transition-colors motion-safe:duration-150",
|
|
950
|
-
children: /* @__PURE__ */
|
|
946
|
+
children: /* @__PURE__ */ B(V, {
|
|
951
947
|
to: e.href,
|
|
952
948
|
children: [
|
|
953
|
-
e.icon && /* @__PURE__ */
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
e.badge != null && /* @__PURE__ */
|
|
949
|
+
e.icon && /* @__PURE__ */ z(e.icon, {}),
|
|
950
|
+
/* @__PURE__ */ z("span", { children: e.title }),
|
|
951
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
956
952
|
variant: e.badgeVariant || "default",
|
|
957
953
|
className: "ml-auto h-5 min-w-5 px-1 text-xs",
|
|
958
954
|
children: e.badge
|
|
@@ -961,17 +957,17 @@ function tt({ item: e, pathname: t }) {
|
|
|
961
957
|
})
|
|
962
958
|
}) }, e.href)) })
|
|
963
959
|
})] })
|
|
964
|
-
}) : /* @__PURE__ */
|
|
960
|
+
}) : /* @__PURE__ */ z(T, { children: /* @__PURE__ */ z(w, {
|
|
965
961
|
asChild: !0,
|
|
966
962
|
isActive: t === e.href,
|
|
967
963
|
tooltip: e.title,
|
|
968
964
|
className: "motion-safe:transition-colors motion-safe:duration-150",
|
|
969
|
-
children: /* @__PURE__ */
|
|
965
|
+
children: /* @__PURE__ */ B(V, {
|
|
970
966
|
to: e.href,
|
|
971
967
|
children: [
|
|
972
|
-
e.icon && /* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
e.badge != null && /* @__PURE__ */
|
|
968
|
+
e.icon && /* @__PURE__ */ z(e.icon, {}),
|
|
969
|
+
/* @__PURE__ */ z("span", { children: e.title }),
|
|
970
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
975
971
|
variant: e.badgeVariant || "default",
|
|
976
972
|
className: "ml-auto h-5 min-w-5 px-1 text-xs",
|
|
977
973
|
children: e.badge
|
|
@@ -980,8 +976,8 @@ function tt({ item: e, pathname: t }) {
|
|
|
980
976
|
})
|
|
981
977
|
}) });
|
|
982
978
|
}
|
|
983
|
-
function
|
|
984
|
-
let s =
|
|
979
|
+
function tt({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
|
|
980
|
+
let s = H(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : $e(e[0]) ? e.map((e) => ({
|
|
985
981
|
groupLabel: e.label,
|
|
986
982
|
items: e.items
|
|
987
983
|
})) : [{ items: e }], [e]), f = t.useMemo(() => {
|
|
@@ -992,14 +988,14 @@ function nt({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
992
988
|
items: t.items.filter((t) => t.title.toLowerCase().includes(e) || t.children?.some((t) => t.title.toLowerCase().includes(e)))
|
|
993
989
|
})).filter((e) => e.items.length > 0);
|
|
994
990
|
}, [d, c]);
|
|
995
|
-
return /* @__PURE__ */
|
|
991
|
+
return /* @__PURE__ */ z(p, {
|
|
996
992
|
className: r,
|
|
997
993
|
collapsible: i,
|
|
998
|
-
children: /* @__PURE__ */
|
|
994
|
+
children: /* @__PURE__ */ B(m, { children: [a && /* @__PURE__ */ z("div", {
|
|
999
995
|
className: "px-3 py-2",
|
|
1000
|
-
children: /* @__PURE__ */
|
|
996
|
+
children: /* @__PURE__ */ B("div", {
|
|
1001
997
|
className: "relative",
|
|
1002
|
-
children: [/* @__PURE__ */
|
|
998
|
+
children: [/* @__PURE__ */ z(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ z(u, {
|
|
1003
999
|
type: "search",
|
|
1004
1000
|
placeholder: o,
|
|
1005
1001
|
value: c,
|
|
@@ -1007,16 +1003,16 @@ function nt({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
1007
1003
|
className: "pl-8 h-9"
|
|
1008
1004
|
})]
|
|
1009
1005
|
})
|
|
1010
|
-
}), f.map((e, t) => /* @__PURE__ */
|
|
1011
|
-
t > 0 && /* @__PURE__ */
|
|
1006
|
+
}), f.map((e, t) => /* @__PURE__ */ B(g, { children: [
|
|
1007
|
+
t > 0 && /* @__PURE__ */ z("div", {
|
|
1012
1008
|
className: "mx-3 mb-1 h-px bg-sidebar-border/60",
|
|
1013
1009
|
"aria-hidden": !0
|
|
1014
1010
|
}),
|
|
1015
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ z(v, {
|
|
1016
1012
|
className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
|
|
1017
1013
|
children: e.groupLabel || n
|
|
1018
1014
|
}),
|
|
1019
|
-
/* @__PURE__ */
|
|
1015
|
+
/* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.items.map((e) => /* @__PURE__ */ z(et, {
|
|
1020
1016
|
item: e,
|
|
1021
1017
|
pathname: s.pathname
|
|
1022
1018
|
}, e.href)) }) })
|
|
@@ -1025,29 +1021,31 @@ function nt({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
1025
1021
|
}
|
|
1026
1022
|
//#endregion
|
|
1027
1023
|
//#region src/index.ts
|
|
1028
|
-
function
|
|
1029
|
-
e.register("page-header",
|
|
1024
|
+
function nt() {
|
|
1025
|
+
e.register("page-header", ge, {
|
|
1030
1026
|
namespace: "layout",
|
|
1031
1027
|
label: "Page Header",
|
|
1032
1028
|
category: "Layout",
|
|
1033
1029
|
inputs: [{
|
|
1034
1030
|
name: "title",
|
|
1035
|
-
type: "string"
|
|
1031
|
+
type: "string",
|
|
1032
|
+
label: "Title"
|
|
1036
1033
|
}, {
|
|
1037
|
-
name: "
|
|
1038
|
-
type: "string"
|
|
1034
|
+
name: "subtitle",
|
|
1035
|
+
type: "string",
|
|
1036
|
+
label: "Subtitle"
|
|
1039
1037
|
}]
|
|
1040
|
-
}), e.register("page:card",
|
|
1038
|
+
}), e.register("page:card", Se, {
|
|
1041
1039
|
namespace: "layout",
|
|
1042
1040
|
skipFallback: !0,
|
|
1043
1041
|
label: "Page Card",
|
|
1044
1042
|
category: "Layout",
|
|
1045
1043
|
isContainer: !0
|
|
1046
|
-
}), e.register("app-shell",
|
|
1044
|
+
}), e.register("app-shell", J, {
|
|
1047
1045
|
namespace: "layout",
|
|
1048
1046
|
label: "App Shell",
|
|
1049
1047
|
category: "Layout"
|
|
1050
|
-
}), e.register("responsive-grid",
|
|
1048
|
+
}), e.register("responsive-grid", Ee, {
|
|
1051
1049
|
namespace: "layout",
|
|
1052
1050
|
label: "Responsive Grid",
|
|
1053
1051
|
category: "Layout",
|
|
@@ -1070,7 +1068,7 @@ function rt() {
|
|
|
1070
1068
|
name: "basePath",
|
|
1071
1069
|
type: "string"
|
|
1072
1070
|
}]
|
|
1073
|
-
}), e.register("app-schema-renderer",
|
|
1071
|
+
}), e.register("app-schema-renderer", Qe, {
|
|
1074
1072
|
namespace: "layout",
|
|
1075
1073
|
label: "App Schema Renderer",
|
|
1076
1074
|
category: "Layout",
|
|
@@ -1092,7 +1090,7 @@ function rt() {
|
|
|
1092
1090
|
});
|
|
1093
1091
|
}
|
|
1094
1092
|
try {
|
|
1095
|
-
|
|
1093
|
+
nt();
|
|
1096
1094
|
} catch {}
|
|
1097
1095
|
//#endregion
|
|
1098
|
-
export {
|
|
1096
|
+
export { Qe as AppSchemaRenderer, J as AppShell, $ as NavigationRenderer, Se as PageCard, ge as PageHeader, Ee as ResponsiveGrid, tt as SidebarNav, Ge as filterNavigationItems, je as hasVisibleNavigationItems, nt as registerLayout, Ue as resolveActiveNavItem, Ne as resolveHref, Y as resolveIcon, X as resolveLabel, xe as useAppShellBranding };
|