@object-ui/layout 17.5.0 → 17.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/CHANGELOG.md +259 -0
- package/README.md +128 -19
- package/dist/AppSchemaRenderer.d.ts +23 -5
- package/dist/AppShell.d.ts +0 -2
- package/dist/NavigationRenderer.d.ts +20 -17
- package/dist/PageHeader.d.ts +12 -5
- package/dist/index.d.ts +7 -7
- package/dist/index.js +400 -406
- package/dist/index.umd.cjs +1 -1
- package/package.json +10 -8
package/dist/index.js
CHANGED
|
@@ -1,190 +1,88 @@
|
|
|
1
1
|
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
|
-
import { ArrowLeft as N, ChevronRight as P, FileText as
|
|
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
|
|
12
|
-
import { resolveI18nLabel as
|
|
4
|
+
import { ArrowLeft as N, ChevronRight as P, FileText as ee, GripVertical as te, Layers as F, Pin as ne, PinOff as re, Search as ie, Star as I } from "lucide-react";
|
|
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 ce, closestCenter as W, useSensor as G, useSensors as le } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as ue, arrayMove as de, useSortable as fe, verticalListSortingStrategy as pe } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as me } from "@dnd-kit/utilities";
|
|
11
|
+
import { menuItemToNavigationItem as he } from "@object-ui/types";
|
|
12
|
+
import { resolveI18nLabel as ge } from "@objectstack/spec/ui";
|
|
13
13
|
//#region src/PageHeader.tsx
|
|
14
|
-
var
|
|
14
|
+
var _e = (e) => {
|
|
15
15
|
let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
|
|
16
16
|
return t != null && String(t).trim() ? String(t) : [
|
|
17
17
|
e?.salutation,
|
|
18
18
|
e?.first_name,
|
|
19
19
|
e?.last_name
|
|
20
20
|
].filter((e) => typeof e == "string" && e.trim()).map((e) => e.trim()).join(" ") || (typeof e?.email == "string" && e.email.trim() ? e.email.trim() : null);
|
|
21
|
-
},
|
|
21
|
+
}, ve = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
|
|
22
22
|
let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
|
|
23
|
-
return r == null ? "" : typeof r == "object" ?
|
|
23
|
+
return r == null ? "" : typeof r == "object" ? _e(r) ?? "" : String(r);
|
|
24
24
|
}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
|
|
25
|
-
function
|
|
26
|
-
let
|
|
25
|
+
function ye({ title: e, subtitle: n, icon: r, action: i, actions: a, showBack: s, schema: c, className: l, children: u, ...f }) {
|
|
26
|
+
let p = R(), m = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), h = ve(e, p?.data) || (m ? "" : e), g = n, _ = typeof g == "string" && /\{[a-zA-Z0-9_.]+\}/.test(g), v = ve(g, p?.data) || (_ ? "" : g), y = !!p?.recordId, b = !!p?.embedded, x = s ?? (y && !b), S = t.useCallback(() => {
|
|
27
27
|
if (typeof window > "u") return;
|
|
28
28
|
let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
|
|
29
29
|
t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
30
|
-
}, []),
|
|
30
|
+
}, []), C = Array.isArray(c?.children) ? c.children.filter(Boolean).map((e, t) => /* @__PURE__ */ z(L, { schema: e }, e?.id || `pgh-child-${t}`)) : null, w = Array.isArray(a) && a.length > 0 && a || Array.isArray(c?.actions) && c.actions.length > 0 && c.actions || Array.isArray(c?.properties?.actions) && c.properties.actions.length > 0 && c.properties.actions || null, T = i || u || (w ? /* @__PURE__ */ z(L, { schema: {
|
|
31
31
|
type: "record:quick_actions",
|
|
32
32
|
properties: {
|
|
33
|
-
actions:
|
|
33
|
+
actions: w,
|
|
34
34
|
location: "record_header",
|
|
35
35
|
align: "end",
|
|
36
36
|
inline: !0
|
|
37
37
|
}
|
|
38
|
-
} }) : null) ||
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
className: A("flex flex-col gap-3 pb-4 border-b",
|
|
41
|
-
...
|
|
42
|
-
children: /* @__PURE__ */
|
|
38
|
+
} }) : null) || C;
|
|
39
|
+
return /* @__PURE__ */ z("div", {
|
|
40
|
+
className: A("flex flex-col gap-3 pb-4 border-b", l),
|
|
41
|
+
...f,
|
|
42
|
+
children: /* @__PURE__ */ B("div", {
|
|
43
43
|
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
44
44
|
children: [
|
|
45
|
-
|
|
45
|
+
x && /* @__PURE__ */ z(o, {
|
|
46
46
|
type: "button",
|
|
47
47
|
variant: "ghost",
|
|
48
48
|
size: "icon",
|
|
49
|
-
onClick:
|
|
49
|
+
onClick: S,
|
|
50
50
|
"aria-label": "Back to list",
|
|
51
51
|
className: "flex-shrink-0 -ml-2",
|
|
52
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: /* @__PURE__ */ z(N, { className: "size-4" })
|
|
53
53
|
}),
|
|
54
|
-
|
|
54
|
+
r && (h || v) && /* @__PURE__ */ z("div", {
|
|
55
55
|
className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
|
|
56
|
-
children: typeof
|
|
57
|
-
name:
|
|
56
|
+
children: typeof r == "string" ? /* @__PURE__ */ z(d, {
|
|
57
|
+
name: r,
|
|
58
58
|
className: "size-5"
|
|
59
|
-
}) :
|
|
59
|
+
}) : r
|
|
60
60
|
}),
|
|
61
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ B("div", {
|
|
62
62
|
className: "flex flex-col min-w-0 flex-1",
|
|
63
|
-
children: [
|
|
63
|
+
children: [h ? /* @__PURE__ */ z("h1", {
|
|
64
64
|
className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
|
|
65
|
-
children:
|
|
66
|
-
}) : null,
|
|
65
|
+
children: h
|
|
66
|
+
}) : null, v && /* @__PURE__ */ z("p", {
|
|
67
67
|
className: "text-sm text-muted-foreground truncate",
|
|
68
|
-
children:
|
|
68
|
+
children: v
|
|
69
69
|
})]
|
|
70
70
|
}),
|
|
71
|
-
|
|
71
|
+
T && /* @__PURE__ */ z("div", {
|
|
72
72
|
className: "flex items-center gap-2 ml-auto",
|
|
73
|
-
children:
|
|
73
|
+
children: T
|
|
74
74
|
})
|
|
75
75
|
]
|
|
76
76
|
})
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
//#endregion
|
|
80
|
-
//#region src/AppShell.tsx
|
|
81
|
-
function ye(e) {
|
|
82
|
-
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
83
|
-
if (!t) return null;
|
|
84
|
-
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;
|
|
85
|
-
if (a !== o) {
|
|
86
|
-
let e = a - o;
|
|
87
|
-
switch (c = l > .5 ? e / (2 - a - o) : e / (a + o), a) {
|
|
88
|
-
case n:
|
|
89
|
-
s = ((r - i) / e + (r < i ? 6 : 0)) / 6;
|
|
90
|
-
break;
|
|
91
|
-
case r:
|
|
92
|
-
s = ((i - n) / e + 2) / 6;
|
|
93
|
-
break;
|
|
94
|
-
case i: s = ((n - r) / e + 4) / 6;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
h: s * 360,
|
|
99
|
-
s: c * 100,
|
|
100
|
-
l: l * 100
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function be(e) {
|
|
104
|
-
let t = ye(e);
|
|
105
|
-
return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
|
|
106
|
-
}
|
|
107
|
-
function xe(e) {
|
|
108
|
-
let t = ye(e);
|
|
109
|
-
if (!t) return null;
|
|
110
|
-
let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
|
|
111
|
-
return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
|
|
112
|
-
}
|
|
113
|
-
function Se(e) {
|
|
114
|
-
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
115
|
-
if (!t) return "0 0% 100%";
|
|
116
|
-
let n = (e) => {
|
|
117
|
-
let t = e / 255;
|
|
118
|
-
return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
119
|
-
}, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
|
|
120
|
-
return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
|
|
121
|
-
}
|
|
122
|
-
function Ce(e, t) {
|
|
123
|
-
n(() => {
|
|
124
|
-
let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
|
|
125
|
-
if (e?.primaryColor) {
|
|
126
|
-
let t = be(e.primaryColor), i = xe(e.primaryColor), a = r() && i || t;
|
|
127
|
-
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%" : Se(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
|
|
128
|
-
} 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");
|
|
129
|
-
if (e?.accentColor) {
|
|
130
|
-
let t = be(e.accentColor), i = xe(e.accentColor), a = r() && i || t;
|
|
131
|
-
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%" : Se(e.accentColor)));
|
|
132
|
-
} else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
|
|
133
|
-
};
|
|
134
|
-
i();
|
|
135
|
-
let a = new MutationObserver((e) => {
|
|
136
|
-
for (let t of e) if (t.type === "attributes" && t.attributeName === "class") {
|
|
137
|
-
i();
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
if (a.observe(n, {
|
|
142
|
-
attributes: !0,
|
|
143
|
-
attributeFilter: ["class"]
|
|
144
|
-
}), e?.favicon) {
|
|
145
|
-
let t = document.querySelector("#favicon") || document.querySelector("link[rel=\"icon\"]");
|
|
146
|
-
t && (t.href = e.favicon);
|
|
147
|
-
}
|
|
148
|
-
return t && (document.title = t), () => {
|
|
149
|
-
a.disconnect(), n.style.removeProperty("--brand-primary"), n.style.removeProperty("--brand-primary-hsl"), n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--primary"), n.style.removeProperty("--primary-foreground"), n.style.removeProperty("--ring"), n.style.removeProperty("--sidebar-primary"), n.style.removeProperty("--sidebar-ring"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
|
|
150
|
-
};
|
|
151
|
-
}, [
|
|
152
|
-
e?.primaryColor,
|
|
153
|
-
e?.accentColor,
|
|
154
|
-
e?.favicon,
|
|
155
|
-
t
|
|
156
|
-
]);
|
|
157
|
-
}
|
|
158
|
-
function q({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
|
|
159
|
-
return Ce(a, a?.title), /* @__PURE__ */ z(k, {
|
|
160
|
-
defaultOpen: i,
|
|
161
|
-
className: "!flex-col h-svh overflow-hidden",
|
|
162
|
-
children: [/* @__PURE__ */ R("header", {
|
|
163
|
-
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",
|
|
164
|
-
children: t
|
|
165
|
-
}), /* @__PURE__ */ z("div", {
|
|
166
|
-
className: "flex flex-1 min-h-0 w-full",
|
|
167
|
-
children: [
|
|
168
|
-
e,
|
|
169
|
-
/* @__PURE__ */ R(x, {
|
|
170
|
-
className: "min-w-0",
|
|
171
|
-
children: /* @__PURE__ */ R("main", {
|
|
172
|
-
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),
|
|
173
|
-
children: n
|
|
174
|
-
})
|
|
175
|
-
}),
|
|
176
|
-
o
|
|
177
|
-
]
|
|
178
|
-
})]
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
//#endregion
|
|
182
80
|
//#region src/PageCard.tsx
|
|
183
|
-
function
|
|
184
|
-
return /* @__PURE__ */
|
|
81
|
+
function be({ className: e, children: t, ...n }) {
|
|
82
|
+
return /* @__PURE__ */ z("div", {
|
|
185
83
|
className: A("rounded-xl border bg-card text-card-foreground shadow", e),
|
|
186
84
|
...n,
|
|
187
|
-
children: /* @__PURE__ */
|
|
85
|
+
children: /* @__PURE__ */ z("div", {
|
|
188
86
|
className: "p-6",
|
|
189
87
|
children: t
|
|
190
88
|
})
|
|
@@ -192,7 +90,7 @@ function we({ className: e, children: t, ...n }) {
|
|
|
192
90
|
}
|
|
193
91
|
//#endregion
|
|
194
92
|
//#region src/ResponsiveGrid.tsx
|
|
195
|
-
var
|
|
93
|
+
var xe = {
|
|
196
94
|
xs: {
|
|
197
95
|
1: "grid-cols-1",
|
|
198
96
|
2: "grid-cols-2",
|
|
@@ -242,11 +140,11 @@ var Te = {
|
|
|
242
140
|
12: "2xl:grid-cols-12"
|
|
243
141
|
}
|
|
244
142
|
};
|
|
245
|
-
function
|
|
143
|
+
function Se(e) {
|
|
246
144
|
if (!e) return "grid-cols-1";
|
|
247
145
|
let t = [];
|
|
248
146
|
for (let [n, r] of Object.entries(e)) {
|
|
249
|
-
let e =
|
|
147
|
+
let e = xe[n];
|
|
250
148
|
if (e && r) {
|
|
251
149
|
let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
|
|
252
150
|
t.push(e[n]);
|
|
@@ -254,7 +152,7 @@ function Ee(e) {
|
|
|
254
152
|
}
|
|
255
153
|
return t.join(" ") || "grid-cols-1";
|
|
256
154
|
}
|
|
257
|
-
var
|
|
155
|
+
var Ce = {
|
|
258
156
|
0: "gap-0",
|
|
259
157
|
1: "gap-1",
|
|
260
158
|
2: "gap-2",
|
|
@@ -263,19 +161,19 @@ var De = {
|
|
|
263
161
|
5: "gap-5",
|
|
264
162
|
6: "gap-6",
|
|
265
163
|
8: "gap-8"
|
|
266
|
-
},
|
|
267
|
-
let i =
|
|
268
|
-
return /* @__PURE__ */
|
|
164
|
+
}, we = ({ columns: e, gap: t = 4, className: n, children: r }) => {
|
|
165
|
+
let i = Se(e), a = typeof t == "number" ? Ce[t] || `gap-${t}` : "";
|
|
166
|
+
return /* @__PURE__ */ z("div", {
|
|
269
167
|
className: A("grid", i, a, n),
|
|
270
168
|
children: r
|
|
271
169
|
});
|
|
272
170
|
};
|
|
273
171
|
//#endregion
|
|
274
172
|
//#region src/NavigationRenderer.tsx
|
|
275
|
-
function
|
|
276
|
-
return e ? j(e) :
|
|
173
|
+
function K(e) {
|
|
174
|
+
return e ? j(e) : ee;
|
|
277
175
|
}
|
|
278
|
-
function
|
|
176
|
+
function q(e, t) {
|
|
279
177
|
if (typeof e == "string") return e;
|
|
280
178
|
if (t) {
|
|
281
179
|
let n = t(e.key, {
|
|
@@ -286,52 +184,53 @@ function Y(e, t) {
|
|
|
286
184
|
}
|
|
287
185
|
return e.defaultValue || e.key;
|
|
288
186
|
}
|
|
289
|
-
function
|
|
290
|
-
let
|
|
291
|
-
if (typeof e.label != "string") return
|
|
292
|
-
let
|
|
187
|
+
function Te(e, t, n, r, i) {
|
|
188
|
+
let a = q(e.label, n);
|
|
189
|
+
if (typeof e.label != "string") return a;
|
|
190
|
+
let o = (e) => !!e && a.trim().toLowerCase() !== e.trim().toLowerCase();
|
|
293
191
|
if (e.type === "object" && e.objectName) {
|
|
294
|
-
if (e.viewName) return
|
|
295
|
-
if (
|
|
296
|
-
if (t) return t(e.objectName,
|
|
192
|
+
if (e.viewName) return o(e.viewName) ? a : i ? i(e.objectName, e.viewName, a) : a;
|
|
193
|
+
if (o(e.objectName)) return a;
|
|
194
|
+
if (t) return t(e.objectName, a);
|
|
297
195
|
}
|
|
298
196
|
if (e.type === "dashboard" && e.dashboardName) {
|
|
299
|
-
if (
|
|
300
|
-
if (r) return r(e.dashboardName,
|
|
301
|
-
}
|
|
302
|
-
if (e.type === "group" && e.id) {
|
|
303
|
-
if (c(e.id)) return s;
|
|
304
|
-
if (i) return i(e.id, s);
|
|
197
|
+
if (o(e.dashboardName)) return a;
|
|
198
|
+
if (r) return r(e.dashboardName, a);
|
|
305
199
|
}
|
|
306
|
-
return
|
|
200
|
+
return a;
|
|
307
201
|
}
|
|
308
|
-
var
|
|
309
|
-
function
|
|
310
|
-
let { evaluateVisibility: n =
|
|
202
|
+
var Ee = (e) => e !== !1 && e !== "false", De = () => !0, Oe = () => !0;
|
|
203
|
+
function J(e, t = {}) {
|
|
204
|
+
let { evaluateVisibility: n = Ee, checkPermission: r = De, checkCapability: i = Oe, hasActionHandler: a = !1 } = t;
|
|
311
205
|
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") {
|
|
312
206
|
if (o.type === "group") {
|
|
313
|
-
if (
|
|
207
|
+
if (J(o.children ?? [], t)) return !0;
|
|
314
208
|
continue;
|
|
315
209
|
}
|
|
316
210
|
if (!(o.type === "action" && !a)) return !0;
|
|
317
211
|
}
|
|
318
212
|
return !1;
|
|
319
213
|
}
|
|
320
|
-
var
|
|
321
|
-
function
|
|
214
|
+
var ke = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
|
|
215
|
+
function Y(e, t) {
|
|
322
216
|
if (!e.includes("{")) return e;
|
|
323
|
-
let n = !1, r = e.replace(
|
|
217
|
+
let n = !1, r = e.replace(ke, (e, r) => {
|
|
324
218
|
let i;
|
|
325
219
|
return i = r === "current_user_id" ? t?.currentUserId : r === "current_org_id" ? t?.currentOrgId : t?.contextValues?.[r], i || (n = !0, "");
|
|
326
220
|
});
|
|
327
221
|
return n ? null : r;
|
|
328
222
|
}
|
|
329
|
-
|
|
223
|
+
var Ae = "runAction";
|
|
224
|
+
function je(e, t) {
|
|
225
|
+
let n = t.runAction;
|
|
226
|
+
return typeof n != "string" || n === "" ? e : `${e}${e.includes("?") ? "&" : "?"}${Ae}=${encodeURIComponent(n)}`;
|
|
227
|
+
}
|
|
228
|
+
function X(e, t, n) {
|
|
330
229
|
switch (e.type) {
|
|
331
230
|
case "object": {
|
|
332
231
|
let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
|
|
333
232
|
if (i) {
|
|
334
|
-
let t =
|
|
233
|
+
let t = Y(i, n);
|
|
335
234
|
if (t) {
|
|
336
235
|
let n = `${r}/record/${encodeURIComponent(t)}`;
|
|
337
236
|
return {
|
|
@@ -342,20 +241,20 @@ function Fe(e, t, n) {
|
|
|
342
241
|
}
|
|
343
242
|
let a = e.filters;
|
|
344
243
|
if (a && typeof a == "object" && !Array.isArray(a)) {
|
|
345
|
-
let
|
|
346
|
-
for (let [
|
|
347
|
-
if (r == null ||
|
|
348
|
-
let i =
|
|
349
|
-
i !== null &&
|
|
244
|
+
let t = new URLSearchParams();
|
|
245
|
+
for (let [e, r] of Object.entries(a)) {
|
|
246
|
+
if (r == null || e === "") continue;
|
|
247
|
+
let i = Y(String(r), n);
|
|
248
|
+
i !== null && t.set(`filter[${e}]`, i);
|
|
350
249
|
}
|
|
351
|
-
let
|
|
250
|
+
let i = t.toString();
|
|
352
251
|
return {
|
|
353
|
-
href:
|
|
252
|
+
href: je(i ? `${r}/data?${i}` : `${r}/data`, e),
|
|
354
253
|
external: !1
|
|
355
254
|
};
|
|
356
255
|
}
|
|
357
256
|
return {
|
|
358
|
-
href: e.viewName ? `${r}/view/${e.viewName}` : r,
|
|
257
|
+
href: je(e.viewName ? `${r}/view/${e.viewName}` : r, e),
|
|
359
258
|
external: !1
|
|
360
259
|
};
|
|
361
260
|
}
|
|
@@ -373,7 +272,7 @@ function Fe(e, t, n) {
|
|
|
373
272
|
let e = new URLSearchParams();
|
|
374
273
|
for (let [t, i] of Object.entries(r)) if (i != null) {
|
|
375
274
|
if (typeof i == "string") {
|
|
376
|
-
let r =
|
|
275
|
+
let r = Y(i, n);
|
|
377
276
|
r !== null && e.set(t, r);
|
|
378
277
|
} else e.set(t, JSON.stringify(i));
|
|
379
278
|
}
|
|
@@ -411,7 +310,7 @@ function Fe(e, t, n) {
|
|
|
411
310
|
let e = new URLSearchParams();
|
|
412
311
|
for (let [t, r] of Object.entries(a)) if (t !== "type" && t !== "name" && r != null) {
|
|
413
312
|
if (typeof r == "string") {
|
|
414
|
-
let i =
|
|
313
|
+
let i = Y(r, n);
|
|
415
314
|
i && e.set(t, i);
|
|
416
315
|
} else e.set(t, JSON.stringify(r));
|
|
417
316
|
}
|
|
@@ -447,27 +346,27 @@ function Fe(e, t, n) {
|
|
|
447
346
|
};
|
|
448
347
|
}
|
|
449
348
|
}
|
|
450
|
-
var
|
|
451
|
-
function
|
|
349
|
+
var Me = 50, Ne = 40, Pe = 30, Fe = 25, Ie = 10, Le = 5;
|
|
350
|
+
function Re(e) {
|
|
452
351
|
let t = /* @__PURE__ */ new Map();
|
|
453
352
|
return new URLSearchParams(e).forEach((e, n) => {
|
|
454
353
|
let r = /^filter\[(.+)\]$/.exec(n);
|
|
455
354
|
r && r[1] && e !== "" && t.set(r[1], e);
|
|
456
355
|
}), t;
|
|
457
356
|
}
|
|
458
|
-
function
|
|
357
|
+
function ze(e, t) {
|
|
459
358
|
return t.startsWith(`${e}.`) ? t.slice(e.length + 1) : t;
|
|
460
359
|
}
|
|
461
|
-
function
|
|
462
|
-
let { href: a, external: o } =
|
|
360
|
+
function Be(e, t, n, r, i) {
|
|
361
|
+
let { href: a, external: o } = X(e, r, i);
|
|
463
362
|
if (o || a === "#") return 0;
|
|
464
363
|
if (e.type === "object" && e.objectName) {
|
|
465
364
|
let a = `${r}/${e.objectName}`;
|
|
466
365
|
if (t !== a && !t.startsWith(`${a}/`)) return 0;
|
|
467
366
|
let o = t === a ? [] : t.slice(a.length + 1).split("/"), s = e.recordId;
|
|
468
367
|
if (s) {
|
|
469
|
-
let e =
|
|
470
|
-
if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ?
|
|
368
|
+
let e = Y(s, i);
|
|
369
|
+
if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Me : 0;
|
|
471
370
|
}
|
|
472
371
|
let c = e.filters;
|
|
473
372
|
if (c && typeof c == "object" && !Array.isArray(c)) {
|
|
@@ -475,65 +374,65 @@ function We(e, t, n, r, i) {
|
|
|
475
374
|
let e = /* @__PURE__ */ new Map();
|
|
476
375
|
for (let [t, n] of Object.entries(c)) {
|
|
477
376
|
if (n == null || t === "") continue;
|
|
478
|
-
let r =
|
|
377
|
+
let r = Y(String(n), i);
|
|
479
378
|
r !== null && e.set(t, r);
|
|
480
379
|
}
|
|
481
380
|
if (e.size !== n.size) return 0;
|
|
482
381
|
for (let [t, r] of e) if (n.get(t) !== r) return 0;
|
|
483
|
-
return
|
|
382
|
+
return Ne;
|
|
484
383
|
}
|
|
485
|
-
return e.viewName ? o[0] !== "view" || !o[1] ? 0 :
|
|
384
|
+
return e.viewName ? o[0] !== "view" || !o[1] ? 0 : ze(e.objectName, decodeURIComponent(o[1])) === ze(e.objectName, e.viewName) ? Pe : 0 : o.length === 0 ? Fe : Ie;
|
|
486
385
|
}
|
|
487
386
|
let s = a.split("?")[0];
|
|
488
|
-
if (t === s) return
|
|
387
|
+
if (t === s) return Fe;
|
|
489
388
|
let c = e.componentRef;
|
|
490
|
-
return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ?
|
|
389
|
+
return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? Le : 0;
|
|
491
390
|
}
|
|
492
|
-
function
|
|
493
|
-
let a =
|
|
391
|
+
function Ve(e, t, n, r, i) {
|
|
392
|
+
let a = Re(n), o = null, s = 0, c = (e) => {
|
|
494
393
|
if (e) for (let n of e) {
|
|
495
394
|
if (n.type === "group") {
|
|
496
395
|
c(n.children);
|
|
497
396
|
continue;
|
|
498
397
|
}
|
|
499
|
-
let e =
|
|
398
|
+
let e = Be(n, t, a, r, i);
|
|
500
399
|
e > s && (o = n, s = e);
|
|
501
400
|
}
|
|
502
401
|
};
|
|
503
402
|
return c(e), o;
|
|
504
403
|
}
|
|
505
|
-
var
|
|
506
|
-
function
|
|
404
|
+
var Z = t.createContext(null);
|
|
405
|
+
function Q(e, t) {
|
|
507
406
|
if (!t.trim()) return e;
|
|
508
407
|
let n = t.toLowerCase().trim();
|
|
509
408
|
return e.reduce((e, r) => {
|
|
510
409
|
if (r.type === "separator") return e;
|
|
511
410
|
if (r.type === "group" && r.children?.length) {
|
|
512
|
-
let n =
|
|
411
|
+
let n = Q(r.children, t);
|
|
513
412
|
return n.length > 0 && e.push({
|
|
514
413
|
...r,
|
|
515
414
|
children: n
|
|
516
415
|
}), e;
|
|
517
416
|
}
|
|
518
|
-
return
|
|
417
|
+
return q(r.label).toLowerCase().includes(n) && e.push(r), e;
|
|
519
418
|
}, []);
|
|
520
419
|
}
|
|
521
|
-
var
|
|
522
|
-
function
|
|
523
|
-
let { attributes:
|
|
420
|
+
var He = 5;
|
|
421
|
+
function Ue({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveViewLabel: d, t: f, templateContext: p }) {
|
|
422
|
+
let { attributes: m, listeners: h, setNodeRef: g, transform: _, transition: v, isDragging: y } = fe({
|
|
524
423
|
id: e.id,
|
|
525
424
|
disabled: !c
|
|
526
|
-
}),
|
|
527
|
-
transform:
|
|
528
|
-
transition:
|
|
529
|
-
opacity:
|
|
530
|
-
zIndex:
|
|
425
|
+
}), b = {
|
|
426
|
+
transform: me.Transform.toString(_),
|
|
427
|
+
transition: v,
|
|
428
|
+
opacity: y ? .5 : void 0,
|
|
429
|
+
zIndex: y ? 10 : void 0
|
|
531
430
|
};
|
|
532
|
-
return /* @__PURE__ */
|
|
533
|
-
ref:
|
|
534
|
-
style:
|
|
535
|
-
...
|
|
536
|
-
children: /* @__PURE__ */
|
|
431
|
+
return /* @__PURE__ */ z("div", {
|
|
432
|
+
ref: g,
|
|
433
|
+
style: b,
|
|
434
|
+
...m,
|
|
435
|
+
children: /* @__PURE__ */ z($, {
|
|
537
436
|
item: e,
|
|
538
437
|
basePath: t,
|
|
539
438
|
evalVis: n,
|
|
@@ -542,42 +441,40 @@ function Je({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAct
|
|
|
542
441
|
onAction: a,
|
|
543
442
|
enablePinning: o,
|
|
544
443
|
onPinToggle: s,
|
|
545
|
-
dragListeners: c ?
|
|
444
|
+
dragListeners: c ? h : void 0,
|
|
546
445
|
resolveObjectLabel: l,
|
|
547
446
|
resolveDashboardLabel: u,
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
t: m,
|
|
552
|
-
templateContext: h
|
|
447
|
+
resolveViewLabel: d,
|
|
448
|
+
t: f,
|
|
449
|
+
templateContext: p
|
|
553
450
|
})
|
|
554
451
|
});
|
|
555
452
|
}
|
|
556
|
-
function
|
|
557
|
-
let
|
|
453
|
+
function $({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onAction: d, enablePinning: p, onPinToggle: m, dragListeners: h, resolveObjectLabel: y, resolveDashboardLabel: b, resolveViewLabel: x, t: E, templateContext: D }) {
|
|
454
|
+
let O = M(), k = O ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, j = A("shrink-0", O ? "h-5 w-5" : "h-4 w-4"), N = (() => {
|
|
558
455
|
if (typeof e.expanded == "boolean") return e.expanded;
|
|
559
456
|
if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
|
|
560
|
-
})(),
|
|
561
|
-
if (e.type !== "group" || !
|
|
562
|
-
let t = (e) => !!e?.some((e) => e.id ===
|
|
457
|
+
})(), ee = e.type === "group" ? e.children?.length ?? 0 : 0, F = t.useContext(Z), ie = t.useMemo(() => {
|
|
458
|
+
if (e.type !== "group" || !F) return !1;
|
|
459
|
+
let t = (e) => !!e?.some((e) => e.id === F || e.type === "group" && t(e.children));
|
|
563
460
|
return t(e.children);
|
|
564
|
-
}, [e,
|
|
461
|
+
}, [e, F]) ? !0 : N ?? !(ee >= 8), [I, L] = i(ie);
|
|
565
462
|
if (!r(e.visible) || e.requiredPermissions?.length && !o(e.requiredPermissions)) return null;
|
|
566
|
-
let
|
|
567
|
-
if (
|
|
568
|
-
if (e.type === "separator") return /* @__PURE__ */
|
|
463
|
+
let R = e.requiresObject, V = e.requiresService;
|
|
464
|
+
if (R && !u("object", R) || V && !u("service", V)) return null;
|
|
465
|
+
if (e.type === "separator") return /* @__PURE__ */ z(f, { className: "my-2" });
|
|
569
466
|
if (e.type === "group") {
|
|
570
|
-
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i =
|
|
571
|
-
return /* @__PURE__ */
|
|
572
|
-
open:
|
|
573
|
-
onOpenChange:
|
|
574
|
-
children: /* @__PURE__ */
|
|
467
|
+
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = Te(e, y, E, b, x);
|
|
468
|
+
return /* @__PURE__ */ z(s, {
|
|
469
|
+
open: I,
|
|
470
|
+
onOpenChange: L,
|
|
471
|
+
children: /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, {
|
|
575
472
|
asChild: !0,
|
|
576
|
-
children: /* @__PURE__ */
|
|
577
|
-
className: A("flex w-full items-center justify-between",
|
|
578
|
-
children: [i, /* @__PURE__ */
|
|
473
|
+
children: /* @__PURE__ */ B(l, {
|
|
474
|
+
className: A("flex w-full items-center justify-between", O && "min-h-[44px] text-[15px] rounded-xl"),
|
|
475
|
+
children: [i, /* @__PURE__ */ z(P, { className: A("ml-auto transition-transform", O ? "h-5 w-5" : "h-4 w-4", I && "rotate-90") })]
|
|
579
476
|
})
|
|
580
|
-
}), /* @__PURE__ */
|
|
477
|
+
}), /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z($, {
|
|
581
478
|
item: e,
|
|
582
479
|
basePath: n,
|
|
583
480
|
evalVis: r,
|
|
@@ -588,107 +485,105 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
588
485
|
onPinToggle: m,
|
|
589
486
|
resolveObjectLabel: y,
|
|
590
487
|
resolveDashboardLabel: b,
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
t: O,
|
|
595
|
-
templateContext: k
|
|
488
|
+
resolveViewLabel: x,
|
|
489
|
+
t: E,
|
|
490
|
+
templateContext: D
|
|
596
491
|
}, e.id)) }) }) })] })
|
|
597
492
|
});
|
|
598
493
|
}
|
|
599
494
|
if (e.type === "action") {
|
|
600
495
|
if (!d) return null;
|
|
601
|
-
let t =
|
|
602
|
-
return /* @__PURE__ */
|
|
603
|
-
h && /* @__PURE__ */
|
|
496
|
+
let t = K(e.icon), r = q(e.label, E);
|
|
497
|
+
return /* @__PURE__ */ B(T, { children: [
|
|
498
|
+
h && /* @__PURE__ */ z("span", {
|
|
604
499
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
605
|
-
"aria-label":
|
|
500
|
+
"aria-label": E ? E("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
|
|
606
501
|
...h,
|
|
607
|
-
children: /* @__PURE__ */
|
|
502
|
+
children: /* @__PURE__ */ z(te, { className: "h-3.5 w-3.5" })
|
|
608
503
|
}),
|
|
609
|
-
/* @__PURE__ */
|
|
504
|
+
/* @__PURE__ */ B(w, {
|
|
610
505
|
tooltip: r,
|
|
611
506
|
onClick: () => d?.(e),
|
|
612
|
-
className:
|
|
507
|
+
className: k,
|
|
613
508
|
children: [
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */
|
|
616
|
-
e.badge != null && /* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ z(t, { className: j }),
|
|
510
|
+
/* @__PURE__ */ z("span", { children: r }),
|
|
511
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
617
512
|
variant: e.badgeVariant ?? "default",
|
|
618
513
|
className: "ml-auto text-[10px] px-1.5 py-0",
|
|
619
514
|
children: e.badge
|
|
620
515
|
})
|
|
621
516
|
]
|
|
622
517
|
}),
|
|
623
|
-
p && m && /* @__PURE__ */
|
|
518
|
+
p && m && /* @__PURE__ */ z(C, {
|
|
624
519
|
showOnHover: !0,
|
|
625
520
|
onClick: () => m(e.id, !e.pinned, e, n),
|
|
626
|
-
"aria-label":
|
|
521
|
+
"aria-label": E ? E(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
|
|
627
522
|
defaultValue: e.pinned ? `Unpin ${r}` : `Pin ${r}`,
|
|
628
523
|
name: r
|
|
629
524
|
}) : e.pinned ? `Unpin ${r}` : `Pin ${r}`,
|
|
630
|
-
children: e.pinned ? /* @__PURE__ */
|
|
525
|
+
children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
|
|
631
526
|
})
|
|
632
527
|
] });
|
|
633
528
|
}
|
|
634
|
-
let
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
/* @__PURE__ */
|
|
637
|
-
e.badge != null && /* @__PURE__ */
|
|
529
|
+
let H = K(e.icon), { href: U, external: se } = X(e, n, D), ce = F !== null && e.id === F, W = Te(e, y, E, b, x), G = /* @__PURE__ */ B(ae, { children: [
|
|
530
|
+
/* @__PURE__ */ z(H, { className: j }),
|
|
531
|
+
/* @__PURE__ */ z("span", { children: W }),
|
|
532
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
638
533
|
variant: e.badgeVariant ?? "default",
|
|
639
534
|
className: "ml-auto text-[10px] px-1.5 py-0",
|
|
640
535
|
children: e.badge
|
|
641
536
|
})
|
|
642
537
|
] });
|
|
643
|
-
return /* @__PURE__ */
|
|
644
|
-
h && /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ B(T, { children: [
|
|
539
|
+
h && /* @__PURE__ */ z("span", {
|
|
645
540
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
646
|
-
"aria-label":
|
|
541
|
+
"aria-label": E ? E("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
|
|
647
542
|
...h,
|
|
648
|
-
children: /* @__PURE__ */
|
|
543
|
+
children: /* @__PURE__ */ z(te, { className: "h-3.5 w-3.5" })
|
|
649
544
|
}),
|
|
650
|
-
/* @__PURE__ */
|
|
545
|
+
/* @__PURE__ */ z(w, {
|
|
651
546
|
asChild: !0,
|
|
652
|
-
isActive:
|
|
653
|
-
tooltip:
|
|
654
|
-
className:
|
|
655
|
-
children:
|
|
547
|
+
isActive: ce,
|
|
548
|
+
tooltip: W,
|
|
549
|
+
className: k,
|
|
550
|
+
children: se ? /* @__PURE__ */ z("a", {
|
|
656
551
|
href: U,
|
|
657
552
|
target: "_blank",
|
|
658
553
|
rel: "noopener noreferrer",
|
|
659
|
-
children:
|
|
660
|
-
}) : /* @__PURE__ */
|
|
554
|
+
children: G
|
|
555
|
+
}) : /* @__PURE__ */ z(oe, {
|
|
661
556
|
to: U,
|
|
662
|
-
children:
|
|
557
|
+
children: G
|
|
663
558
|
})
|
|
664
559
|
}),
|
|
665
|
-
p && m && /* @__PURE__ */
|
|
560
|
+
p && m && /* @__PURE__ */ z(C, {
|
|
666
561
|
showOnHover: !0,
|
|
667
562
|
onClick: () => m(e.id, !e.pinned, e, n),
|
|
668
|
-
"aria-label":
|
|
669
|
-
defaultValue: e.pinned ? `Unpin ${
|
|
670
|
-
name:
|
|
671
|
-
}) : e.pinned ? `Unpin ${
|
|
672
|
-
children: e.pinned ? /* @__PURE__ */
|
|
563
|
+
"aria-label": E ? E(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
|
|
564
|
+
defaultValue: e.pinned ? `Unpin ${W}` : `Pin ${W}`,
|
|
565
|
+
name: W
|
|
566
|
+
}) : e.pinned ? `Unpin ${W}` : `Pin ${W}`,
|
|
567
|
+
children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
|
|
673
568
|
})
|
|
674
569
|
] });
|
|
675
570
|
}
|
|
676
|
-
function
|
|
677
|
-
let
|
|
571
|
+
function We({ items: e, basePath: t = "", evaluateVisibility: n = Ee, checkPermission: i = De, checkCapability: a = Oe, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveViewLabel: m, t: h, templateContext: y }) {
|
|
572
|
+
let b = H(), x = r(() => Ve(e, b.pathname, b.search, t, y)?.id ?? null, [
|
|
678
573
|
e,
|
|
679
|
-
|
|
680
|
-
|
|
574
|
+
b.pathname,
|
|
575
|
+
b.search,
|
|
681
576
|
t,
|
|
682
|
-
|
|
683
|
-
]),
|
|
577
|
+
y
|
|
578
|
+
]), C = r(() => s ? Q(e, s) : e, [e, s]), w = r(() => Ge(C), [C]), T = C.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), E = le(G(ce, { activationConstraint: { distance: He } }), G(se)), D = (e) => {
|
|
684
579
|
let { active: t, over: n } = e;
|
|
685
580
|
if (!n || t.id === n.id || !d) return;
|
|
686
|
-
let r =
|
|
687
|
-
r !== -1 && i !== -1 && d(
|
|
581
|
+
let r = T.findIndex((e) => e.id === t.id), i = T.findIndex((e) => e.id === n.id);
|
|
582
|
+
r !== -1 && i !== -1 && d(de(T, r, i).map((e, t) => ({
|
|
688
583
|
...e,
|
|
689
584
|
order: t
|
|
690
585
|
})));
|
|
691
|
-
},
|
|
586
|
+
}, O = {
|
|
692
587
|
basePath: t,
|
|
693
588
|
evalVis: n,
|
|
694
589
|
checkPerm: i,
|
|
@@ -698,95 +593,195 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = Ae, checkPermis
|
|
|
698
593
|
onPinToggle: l,
|
|
699
594
|
resolveObjectLabel: f,
|
|
700
595
|
resolveDashboardLabel: p,
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
templateContext: x
|
|
706
|
-
}, j = D.some((e) => e.type === "group"), M = E.length > 0 && c ? /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
|
|
596
|
+
resolveViewLabel: m,
|
|
597
|
+
t: h,
|
|
598
|
+
templateContext: y
|
|
599
|
+
}, k = T.some((e) => e.type === "group"), A = w.length > 0 && c ? /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
|
|
707
600
|
className: "flex items-center gap-1.5",
|
|
708
|
-
children: [/* @__PURE__ */
|
|
709
|
-
}), /* @__PURE__ */
|
|
601
|
+
children: [/* @__PURE__ */ z(I, { className: "h-3.5 w-3.5" }), h ? h("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
|
|
602
|
+
}), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: w.map((e) => /* @__PURE__ */ z($, {
|
|
710
603
|
item: e,
|
|
711
|
-
...
|
|
604
|
+
...O
|
|
712
605
|
}, `fav-${e.id}`)) }) })] }) : null;
|
|
713
|
-
if (!
|
|
714
|
-
let e =
|
|
715
|
-
sensors:
|
|
716
|
-
collisionDetection:
|
|
717
|
-
onDragEnd:
|
|
718
|
-
children: /* @__PURE__ */
|
|
606
|
+
if (!k) {
|
|
607
|
+
let e = T.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ z(U, {
|
|
608
|
+
sensors: E,
|
|
609
|
+
collisionDetection: W,
|
|
610
|
+
onDragEnd: D,
|
|
611
|
+
children: /* @__PURE__ */ z(ue, {
|
|
719
612
|
items: e,
|
|
720
|
-
strategy:
|
|
721
|
-
children: /* @__PURE__ */
|
|
613
|
+
strategy: pe,
|
|
614
|
+
children: /* @__PURE__ */ z(S, { children: T.map((e) => /* @__PURE__ */ z(Ue, {
|
|
722
615
|
item: e,
|
|
723
616
|
enableReorder: u,
|
|
724
|
-
...
|
|
617
|
+
...O
|
|
725
618
|
}, e.id)) })
|
|
726
619
|
})
|
|
727
|
-
}) : /* @__PURE__ */
|
|
620
|
+
}) : /* @__PURE__ */ z(S, { children: T.map((e) => /* @__PURE__ */ z($, {
|
|
728
621
|
item: e,
|
|
729
|
-
...
|
|
622
|
+
...O
|
|
730
623
|
}, e.id)) });
|
|
731
|
-
return /* @__PURE__ */
|
|
732
|
-
value:
|
|
733
|
-
children: [
|
|
624
|
+
return /* @__PURE__ */ B(Z.Provider, {
|
|
625
|
+
value: x,
|
|
626
|
+
children: [A, /* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: t }) })]
|
|
734
627
|
});
|
|
735
628
|
}
|
|
736
|
-
let
|
|
737
|
-
if (
|
|
738
|
-
let t =
|
|
739
|
-
|
|
629
|
+
let j = [], M = [], N = (e) => {
|
|
630
|
+
if (M.length === 0) return;
|
|
631
|
+
let t = M;
|
|
632
|
+
M = [], j.push(/* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z($, {
|
|
740
633
|
item: e,
|
|
741
|
-
...
|
|
634
|
+
...O
|
|
742
635
|
}, e.id)) }) }) }, e));
|
|
743
636
|
};
|
|
744
|
-
return
|
|
745
|
-
e.type === "group" ? (
|
|
637
|
+
return T.forEach((e, t) => {
|
|
638
|
+
e.type === "group" ? (N(`leaf-${t}`), j.push(/* @__PURE__ */ z($, {
|
|
746
639
|
item: e,
|
|
747
|
-
...
|
|
748
|
-
}, e.id))) :
|
|
749
|
-
}),
|
|
750
|
-
value:
|
|
751
|
-
children: [
|
|
640
|
+
...O
|
|
641
|
+
}, e.id))) : M.push(e);
|
|
642
|
+
}), N("leaf-end"), /* @__PURE__ */ B(Z.Provider, {
|
|
643
|
+
value: x,
|
|
644
|
+
children: [A, j]
|
|
752
645
|
});
|
|
753
646
|
}
|
|
754
|
-
function
|
|
647
|
+
function Ge(e) {
|
|
755
648
|
let t = [];
|
|
756
|
-
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...
|
|
649
|
+
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Ge(n.children));
|
|
757
650
|
return t;
|
|
758
651
|
}
|
|
759
652
|
//#endregion
|
|
653
|
+
//#region src/AppShell.tsx
|
|
654
|
+
function Ke(e) {
|
|
655
|
+
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
656
|
+
if (!t) return null;
|
|
657
|
+
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;
|
|
658
|
+
if (a !== o) {
|
|
659
|
+
let e = a - o;
|
|
660
|
+
switch (c = l > .5 ? e / (2 - a - o) : e / (a + o), a) {
|
|
661
|
+
case n:
|
|
662
|
+
s = ((r - i) / e + (r < i ? 6 : 0)) / 6;
|
|
663
|
+
break;
|
|
664
|
+
case r:
|
|
665
|
+
s = ((i - n) / e + 2) / 6;
|
|
666
|
+
break;
|
|
667
|
+
case i: s = ((n - r) / e + 4) / 6;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return {
|
|
671
|
+
h: s * 360,
|
|
672
|
+
s: c * 100,
|
|
673
|
+
l: l * 100
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function qe(e) {
|
|
677
|
+
let t = Ke(e);
|
|
678
|
+
return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
|
|
679
|
+
}
|
|
680
|
+
function Je(e) {
|
|
681
|
+
let t = Ke(e);
|
|
682
|
+
if (!t) return null;
|
|
683
|
+
let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
|
|
684
|
+
return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
|
|
685
|
+
}
|
|
686
|
+
function Ye(e) {
|
|
687
|
+
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
688
|
+
if (!t) return "0 0% 100%";
|
|
689
|
+
let n = (e) => {
|
|
690
|
+
let t = e / 255;
|
|
691
|
+
return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
692
|
+
}, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
|
|
693
|
+
return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
|
|
694
|
+
}
|
|
695
|
+
function Xe(e, t) {
|
|
696
|
+
n(() => {
|
|
697
|
+
let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
|
|
698
|
+
if (e?.primaryColor) {
|
|
699
|
+
let t = qe(e.primaryColor), i = Je(e.primaryColor), a = r() && i || t;
|
|
700
|
+
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%" : Ye(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
|
|
701
|
+
} 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");
|
|
702
|
+
if (e?.accentColor) {
|
|
703
|
+
let t = qe(e.accentColor), i = Je(e.accentColor), a = r() && i || t;
|
|
704
|
+
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%" : Ye(e.accentColor)));
|
|
705
|
+
} else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
|
|
706
|
+
};
|
|
707
|
+
i();
|
|
708
|
+
let a = new MutationObserver((e) => {
|
|
709
|
+
for (let t of e) if (t.type === "attributes" && t.attributeName === "class") {
|
|
710
|
+
i();
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
if (a.observe(n, {
|
|
715
|
+
attributes: !0,
|
|
716
|
+
attributeFilter: ["class"]
|
|
717
|
+
}), e?.favicon) {
|
|
718
|
+
let t = document.querySelector("#favicon") || document.querySelector("link[rel=\"icon\"]");
|
|
719
|
+
t && (t.href = e.favicon);
|
|
720
|
+
}
|
|
721
|
+
return t && (document.title = t), () => {
|
|
722
|
+
a.disconnect(), n.style.removeProperty("--brand-primary"), n.style.removeProperty("--brand-primary-hsl"), n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--primary"), n.style.removeProperty("--primary-foreground"), n.style.removeProperty("--ring"), n.style.removeProperty("--sidebar-primary"), n.style.removeProperty("--sidebar-ring"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
|
|
723
|
+
};
|
|
724
|
+
}, [
|
|
725
|
+
e?.primaryColor,
|
|
726
|
+
e?.accentColor,
|
|
727
|
+
e?.favicon,
|
|
728
|
+
t
|
|
729
|
+
]);
|
|
730
|
+
}
|
|
731
|
+
function Ze({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
|
|
732
|
+
return Xe(a, a?.title), /* @__PURE__ */ B(k, {
|
|
733
|
+
defaultOpen: i,
|
|
734
|
+
className: "!flex-col h-svh overflow-hidden",
|
|
735
|
+
children: [/* @__PURE__ */ z("header", {
|
|
736
|
+
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",
|
|
737
|
+
children: t
|
|
738
|
+
}), /* @__PURE__ */ B("div", {
|
|
739
|
+
className: "flex flex-1 min-h-0 w-full",
|
|
740
|
+
children: [
|
|
741
|
+
e,
|
|
742
|
+
/* @__PURE__ */ z(x, {
|
|
743
|
+
className: "min-w-0",
|
|
744
|
+
children: /* @__PURE__ */ z("main", {
|
|
745
|
+
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),
|
|
746
|
+
children: n
|
|
747
|
+
})
|
|
748
|
+
}),
|
|
749
|
+
o
|
|
750
|
+
]
|
|
751
|
+
})]
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
//#endregion
|
|
760
755
|
//#region src/AppSchemaRenderer.tsx
|
|
761
|
-
function
|
|
762
|
-
return
|
|
756
|
+
function Qe(e) {
|
|
757
|
+
return ge(e, void 0) ?? "";
|
|
763
758
|
}
|
|
764
|
-
function
|
|
765
|
-
return e.length <= 1 ? null : /* @__PURE__ */
|
|
759
|
+
function $e({ areas: e, activeAreaId: t, onAreaChange: n }) {
|
|
760
|
+
return e.length <= 1 ? null : /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
|
|
766
761
|
className: "flex items-center gap-1.5",
|
|
767
|
-
children: [/* @__PURE__ */
|
|
768
|
-
}), /* @__PURE__ */
|
|
769
|
-
let r =
|
|
770
|
-
return /* @__PURE__ */
|
|
762
|
+
children: [/* @__PURE__ */ z(F, { className: "h-3.5 w-3.5" }), "Area"]
|
|
763
|
+
}), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.map((e) => {
|
|
764
|
+
let r = K(e.icon), i = Qe(e.label);
|
|
765
|
+
return /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
|
|
771
766
|
isActive: e.id === t,
|
|
772
767
|
tooltip: i,
|
|
773
768
|
onClick: () => n(e.id),
|
|
774
|
-
children: [/* @__PURE__ */
|
|
769
|
+
children: [/* @__PURE__ */ z(r, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: i })]
|
|
775
770
|
}) }, e.id);
|
|
776
771
|
}) }) })] });
|
|
777
772
|
}
|
|
778
|
-
function
|
|
779
|
-
let n =
|
|
773
|
+
function et({ items: e, basePath: t }) {
|
|
774
|
+
let n = H(), r = (e) => {
|
|
780
775
|
let t = [];
|
|
781
776
|
for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
|
|
782
777
|
return t;
|
|
783
778
|
}, i = r(e).slice(0, 5);
|
|
784
|
-
return i.length === 0 ? null : /* @__PURE__ */
|
|
779
|
+
return i.length === 0 ? null : /* @__PURE__ */ z("div", {
|
|
785
780
|
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",
|
|
786
781
|
role: "navigation",
|
|
787
782
|
"aria-label": "Mobile navigation",
|
|
788
783
|
children: i.map((e) => {
|
|
789
|
-
let r =
|
|
784
|
+
let r = K(e.icon), i = "#";
|
|
790
785
|
if (e.type === "object") i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`);
|
|
791
786
|
else if (e.type === "dashboard") i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#";
|
|
792
787
|
else if (e.type === "page") i = e.pageName ? `${t}/page/${e.pageName}` : "#";
|
|
@@ -806,55 +801,55 @@ function Qe({ items: e, basePath: t }) {
|
|
|
806
801
|
}
|
|
807
802
|
}
|
|
808
803
|
let a = i !== "#" && n.pathname.startsWith(i);
|
|
809
|
-
return /* @__PURE__ */
|
|
804
|
+
return /* @__PURE__ */ B(oe, {
|
|
810
805
|
to: i,
|
|
811
806
|
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"}`,
|
|
812
|
-
children: [/* @__PURE__ */
|
|
807
|
+
children: [/* @__PURE__ */ z(r, { className: "h-5 w-5" }), /* @__PURE__ */ z("span", {
|
|
813
808
|
className: "text-[10px] truncate max-w-[60px]",
|
|
814
|
-
children:
|
|
809
|
+
children: q(e.label)
|
|
815
810
|
})]
|
|
816
811
|
}, e.id);
|
|
817
812
|
})
|
|
818
813
|
});
|
|
819
814
|
}
|
|
820
|
-
function
|
|
821
|
-
let D =
|
|
822
|
-
return /* @__PURE__ */
|
|
815
|
+
function tt({ 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 }) {
|
|
816
|
+
let D = K(e.logo), [O, k] = i("");
|
|
817
|
+
return /* @__PURE__ */ B(p, {
|
|
823
818
|
collapsible: "icon",
|
|
824
819
|
children: [
|
|
825
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ B(y, { children: [s ?? /* @__PURE__ */ z(S, { children: /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
|
|
826
821
|
size: "lg",
|
|
827
822
|
tooltip: e.title ?? e.name,
|
|
828
|
-
children: [/* @__PURE__ */
|
|
823
|
+
children: [/* @__PURE__ */ z("div", {
|
|
829
824
|
className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
|
|
830
|
-
children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */
|
|
825
|
+
children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ z("img", {
|
|
831
826
|
src: e.logo,
|
|
832
827
|
alt: e.title ?? "",
|
|
833
828
|
className: "size-6 object-contain"
|
|
834
|
-
}) : /* @__PURE__ */
|
|
835
|
-
}), /* @__PURE__ */
|
|
829
|
+
}) : /* @__PURE__ */ z(D, { className: "size-4" })
|
|
830
|
+
}), /* @__PURE__ */ B("div", {
|
|
836
831
|
className: "grid flex-1 text-left text-sm leading-tight",
|
|
837
|
-
children: [/* @__PURE__ */
|
|
832
|
+
children: [/* @__PURE__ */ z("span", {
|
|
838
833
|
className: "truncate font-semibold",
|
|
839
834
|
children: e.title ?? e.name ?? "App"
|
|
840
|
-
}), e.description && /* @__PURE__ */
|
|
835
|
+
}), e.description && /* @__PURE__ */ z("span", {
|
|
841
836
|
className: "truncate text-xs text-muted-foreground",
|
|
842
837
|
children: e.description
|
|
843
838
|
})]
|
|
844
839
|
})]
|
|
845
|
-
}) }) }), _ && /* @__PURE__ */
|
|
840
|
+
}) }) }), _ && /* @__PURE__ */ z(b, {
|
|
846
841
|
placeholder: "Search navigation…",
|
|
847
842
|
value: O,
|
|
848
843
|
onChange: (e) => k(e.target.value),
|
|
849
844
|
"aria-label": "Search navigation"
|
|
850
845
|
})] }),
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
u.length > 1 && d && /* @__PURE__ */
|
|
846
|
+
/* @__PURE__ */ B(m, { children: [
|
|
847
|
+
u.length > 1 && d && /* @__PURE__ */ z($e, {
|
|
853
848
|
areas: u,
|
|
854
849
|
activeAreaId: d,
|
|
855
850
|
onAreaChange: f
|
|
856
851
|
}),
|
|
857
|
-
/* @__PURE__ */
|
|
852
|
+
/* @__PURE__ */ z(We, {
|
|
858
853
|
items: g,
|
|
859
854
|
basePath: t,
|
|
860
855
|
evaluateVisibility: n,
|
|
@@ -869,12 +864,12 @@ function $e({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
|
|
|
869
864
|
}),
|
|
870
865
|
l
|
|
871
866
|
] }),
|
|
872
|
-
c && /* @__PURE__ */
|
|
867
|
+
c && /* @__PURE__ */ z(h, { children: c })
|
|
873
868
|
]
|
|
874
869
|
});
|
|
875
870
|
}
|
|
876
|
-
function
|
|
877
|
-
let S = o ?? ((e) => e !== !1 && e !== "false"), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) =>
|
|
871
|
+
function nt({ 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 }) {
|
|
872
|
+
let S = o ?? ((e) => e !== !1 && e !== "false"), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => he(e, t)), [e.menu]), E = e.navigation ?? T, D = (e.areas ?? []).filter((e) => J(e.navigation, {
|
|
878
873
|
evaluateVisibility: S,
|
|
879
874
|
checkPermission: C,
|
|
880
875
|
checkCapability: w,
|
|
@@ -885,9 +880,8 @@ function et({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
885
880
|
}, [e.name, A]);
|
|
886
881
|
let j = D.find((e) => e.id === O) ?? D[0], M = j?.navigation ?? E, N = {
|
|
887
882
|
title: e.title,
|
|
888
|
-
favicon: e.favicon
|
|
889
|
-
|
|
890
|
-
}, P = /* @__PURE__ */ R($e, {
|
|
883
|
+
favicon: e.favicon
|
|
884
|
+
}, P = /* @__PURE__ */ z(tt, {
|
|
891
885
|
schema: e,
|
|
892
886
|
basePath: t,
|
|
893
887
|
evalVis: S,
|
|
@@ -907,56 +901,56 @@ function et({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
907
901
|
enableReorder: b,
|
|
908
902
|
onReorder: x
|
|
909
903
|
});
|
|
910
|
-
return /* @__PURE__ */
|
|
904
|
+
return /* @__PURE__ */ B(ae, { children: [/* @__PURE__ */ z(Ze, {
|
|
911
905
|
sidebar: P,
|
|
912
906
|
navbar: u,
|
|
913
907
|
className: h,
|
|
914
908
|
defaultOpen: g,
|
|
915
909
|
branding: N,
|
|
916
910
|
children: m
|
|
917
|
-
}), a === "bottom_nav" && /* @__PURE__ */
|
|
911
|
+
}), a === "bottom_nav" && /* @__PURE__ */ z(et, {
|
|
918
912
|
items: M,
|
|
919
913
|
basePath: t
|
|
920
914
|
})] });
|
|
921
915
|
}
|
|
922
916
|
//#endregion
|
|
923
917
|
//#region src/SidebarNav.tsx
|
|
924
|
-
function
|
|
918
|
+
function rt(e) {
|
|
925
919
|
return "items" in e && !("href" in e);
|
|
926
920
|
}
|
|
927
|
-
function
|
|
928
|
-
return e.children && e.children.length > 0 ? /* @__PURE__ */
|
|
921
|
+
function it({ item: e, pathname: t }) {
|
|
922
|
+
return e.children && e.children.length > 0 ? /* @__PURE__ */ z(s, {
|
|
929
923
|
asChild: !0,
|
|
930
924
|
defaultOpen: !0,
|
|
931
925
|
className: "group/collapsible",
|
|
932
|
-
children: /* @__PURE__ */
|
|
926
|
+
children: /* @__PURE__ */ B(T, { children: [/* @__PURE__ */ z(l, {
|
|
933
927
|
asChild: !0,
|
|
934
|
-
children: /* @__PURE__ */
|
|
928
|
+
children: /* @__PURE__ */ B(w, {
|
|
935
929
|
tooltip: e.title,
|
|
936
930
|
className: "motion-safe:transition-colors motion-safe:duration-150",
|
|
937
931
|
children: [
|
|
938
|
-
e.icon && /* @__PURE__ */
|
|
939
|
-
/* @__PURE__ */
|
|
940
|
-
e.badge != null && /* @__PURE__ */
|
|
932
|
+
e.icon && /* @__PURE__ */ z(e.icon, {}),
|
|
933
|
+
/* @__PURE__ */ z("span", { children: e.title }),
|
|
934
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
941
935
|
variant: e.badgeVariant || "default",
|
|
942
936
|
className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
|
|
943
937
|
children: e.badge
|
|
944
938
|
}),
|
|
945
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ z(P, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
946
940
|
]
|
|
947
941
|
})
|
|
948
|
-
}), /* @__PURE__ */
|
|
942
|
+
}), /* @__PURE__ */ z(c, {
|
|
949
943
|
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",
|
|
950
|
-
children: /* @__PURE__ */
|
|
944
|
+
children: /* @__PURE__ */ z(E, { children: e.children.map((e) => /* @__PURE__ */ z(O, { children: /* @__PURE__ */ z(D, {
|
|
951
945
|
asChild: !0,
|
|
952
946
|
isActive: t === e.href,
|
|
953
947
|
className: "motion-safe:transition-colors motion-safe:duration-150",
|
|
954
|
-
children: /* @__PURE__ */
|
|
948
|
+
children: /* @__PURE__ */ B(V, {
|
|
955
949
|
to: e.href,
|
|
956
950
|
children: [
|
|
957
|
-
e.icon && /* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
e.badge != null && /* @__PURE__ */
|
|
951
|
+
e.icon && /* @__PURE__ */ z(e.icon, {}),
|
|
952
|
+
/* @__PURE__ */ z("span", { children: e.title }),
|
|
953
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
960
954
|
variant: e.badgeVariant || "default",
|
|
961
955
|
className: "ml-auto h-5 min-w-5 px-1 text-xs",
|
|
962
956
|
children: e.badge
|
|
@@ -965,17 +959,17 @@ function nt({ item: e, pathname: t }) {
|
|
|
965
959
|
})
|
|
966
960
|
}) }, e.href)) })
|
|
967
961
|
})] })
|
|
968
|
-
}) : /* @__PURE__ */
|
|
962
|
+
}) : /* @__PURE__ */ z(T, { children: /* @__PURE__ */ z(w, {
|
|
969
963
|
asChild: !0,
|
|
970
964
|
isActive: t === e.href,
|
|
971
965
|
tooltip: e.title,
|
|
972
966
|
className: "motion-safe:transition-colors motion-safe:duration-150",
|
|
973
|
-
children: /* @__PURE__ */
|
|
967
|
+
children: /* @__PURE__ */ B(V, {
|
|
974
968
|
to: e.href,
|
|
975
969
|
children: [
|
|
976
|
-
e.icon && /* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
978
|
-
e.badge != null && /* @__PURE__ */
|
|
970
|
+
e.icon && /* @__PURE__ */ z(e.icon, {}),
|
|
971
|
+
/* @__PURE__ */ z("span", { children: e.title }),
|
|
972
|
+
e.badge != null && /* @__PURE__ */ z(a, {
|
|
979
973
|
variant: e.badgeVariant || "default",
|
|
980
974
|
className: "ml-auto h-5 min-w-5 px-1 text-xs",
|
|
981
975
|
children: e.badge
|
|
@@ -984,8 +978,8 @@ function nt({ item: e, pathname: t }) {
|
|
|
984
978
|
})
|
|
985
979
|
}) });
|
|
986
980
|
}
|
|
987
|
-
function
|
|
988
|
-
let s =
|
|
981
|
+
function at({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
|
|
982
|
+
let s = H(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : rt(e[0]) ? e.map((e) => ({
|
|
989
983
|
groupLabel: e.label,
|
|
990
984
|
items: e.items
|
|
991
985
|
})) : [{ items: e }], [e]), f = t.useMemo(() => {
|
|
@@ -996,14 +990,14 @@ function rt({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
996
990
|
items: t.items.filter((t) => t.title.toLowerCase().includes(e) || t.children?.some((t) => t.title.toLowerCase().includes(e)))
|
|
997
991
|
})).filter((e) => e.items.length > 0);
|
|
998
992
|
}, [d, c]);
|
|
999
|
-
return /* @__PURE__ */
|
|
993
|
+
return /* @__PURE__ */ z(p, {
|
|
1000
994
|
className: r,
|
|
1001
995
|
collapsible: i,
|
|
1002
|
-
children: /* @__PURE__ */
|
|
996
|
+
children: /* @__PURE__ */ B(m, { children: [a && /* @__PURE__ */ z("div", {
|
|
1003
997
|
className: "px-3 py-2",
|
|
1004
|
-
children: /* @__PURE__ */
|
|
998
|
+
children: /* @__PURE__ */ B("div", {
|
|
1005
999
|
className: "relative",
|
|
1006
|
-
children: [/* @__PURE__ */
|
|
1000
|
+
children: [/* @__PURE__ */ z(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ z(u, {
|
|
1007
1001
|
type: "search",
|
|
1008
1002
|
placeholder: o,
|
|
1009
1003
|
value: c,
|
|
@@ -1011,16 +1005,16 @@ function rt({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
1011
1005
|
className: "pl-8 h-9"
|
|
1012
1006
|
})]
|
|
1013
1007
|
})
|
|
1014
|
-
}), f.map((e, t) => /* @__PURE__ */
|
|
1015
|
-
t > 0 && /* @__PURE__ */
|
|
1008
|
+
}), f.map((e, t) => /* @__PURE__ */ B(g, { children: [
|
|
1009
|
+
t > 0 && /* @__PURE__ */ z("div", {
|
|
1016
1010
|
className: "mx-3 mb-1 h-px bg-sidebar-border/60",
|
|
1017
1011
|
"aria-hidden": !0
|
|
1018
1012
|
}),
|
|
1019
|
-
/* @__PURE__ */
|
|
1013
|
+
/* @__PURE__ */ z(v, {
|
|
1020
1014
|
className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
|
|
1021
1015
|
children: e.groupLabel || n
|
|
1022
1016
|
}),
|
|
1023
|
-
/* @__PURE__ */
|
|
1017
|
+
/* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.items.map((e) => /* @__PURE__ */ z(it, {
|
|
1024
1018
|
item: e,
|
|
1025
1019
|
pathname: s.pathname
|
|
1026
1020
|
}, e.href)) }) })
|
|
@@ -1029,8 +1023,8 @@ function rt({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
1029
1023
|
}
|
|
1030
1024
|
//#endregion
|
|
1031
1025
|
//#region src/index.ts
|
|
1032
|
-
function
|
|
1033
|
-
e.register("page-header",
|
|
1026
|
+
function ot() {
|
|
1027
|
+
e.register("page-header", ye, {
|
|
1034
1028
|
namespace: "layout",
|
|
1035
1029
|
label: "Page Header",
|
|
1036
1030
|
category: "Layout",
|
|
@@ -1059,17 +1053,13 @@ function it() {
|
|
|
1059
1053
|
description: "ActionDef list (or action ids) rendered through record:quick_actions"
|
|
1060
1054
|
}
|
|
1061
1055
|
]
|
|
1062
|
-
}), e.register("page:card",
|
|
1056
|
+
}), e.register("page:card", be, {
|
|
1063
1057
|
namespace: "layout",
|
|
1064
1058
|
skipFallback: !0,
|
|
1065
1059
|
label: "Page Card",
|
|
1066
1060
|
category: "Layout",
|
|
1067
1061
|
isContainer: !0
|
|
1068
|
-
}), e.register("
|
|
1069
|
-
namespace: "layout",
|
|
1070
|
-
label: "App Shell",
|
|
1071
|
-
category: "Layout"
|
|
1072
|
-
}), e.register("responsive-grid", Oe, {
|
|
1062
|
+
}), e.register("responsive-grid", we, {
|
|
1073
1063
|
namespace: "layout",
|
|
1074
1064
|
label: "Responsive Grid",
|
|
1075
1065
|
category: "Layout",
|
|
@@ -1081,7 +1071,7 @@ function it() {
|
|
|
1081
1071
|
name: "gap",
|
|
1082
1072
|
type: "number"
|
|
1083
1073
|
}]
|
|
1084
|
-
}), e.register("navigation-renderer",
|
|
1074
|
+
}), e.register("navigation-renderer", We, {
|
|
1085
1075
|
namespace: "layout",
|
|
1086
1076
|
label: "Navigation Renderer",
|
|
1087
1077
|
category: "Layout",
|
|
@@ -1093,7 +1083,7 @@ function it() {
|
|
|
1093
1083
|
name: "basePath",
|
|
1094
1084
|
type: "string"
|
|
1095
1085
|
}]
|
|
1096
|
-
}), e.register("app-schema-renderer",
|
|
1086
|
+
}), e.register("app-schema-renderer", nt, {
|
|
1097
1087
|
namespace: "layout",
|
|
1098
1088
|
label: "App Schema Renderer",
|
|
1099
1089
|
category: "Layout",
|
|
@@ -1109,13 +1099,17 @@ function it() {
|
|
|
1109
1099
|
},
|
|
1110
1100
|
{
|
|
1111
1101
|
name: "mobileNavMode",
|
|
1112
|
-
type: "
|
|
1102
|
+
type: "enum",
|
|
1103
|
+
enum: ["drawer", "bottom_nav"],
|
|
1104
|
+
defaultValue: "drawer",
|
|
1105
|
+
label: "Mobile Nav Mode",
|
|
1106
|
+
description: "Mobile navigation mode. \"drawer\" (default) puts the sidebar in the mobile sheet overlay; \"bottom_nav\" additionally renders a fixed bottom bar. These are the only two modes the renderer implements."
|
|
1113
1107
|
}
|
|
1114
1108
|
]
|
|
1115
1109
|
});
|
|
1116
1110
|
}
|
|
1117
1111
|
try {
|
|
1118
|
-
|
|
1112
|
+
ot();
|
|
1119
1113
|
} catch {}
|
|
1120
1114
|
//#endregion
|
|
1121
|
-
export {
|
|
1115
|
+
export { nt as AppSchemaRenderer, Ze as AppShell, Ae as NAV_RUN_ACTION_PARAM, We as NavigationRenderer, be as PageCard, ye as PageHeader, we as ResponsiveGrid, at as SidebarNav, Q as filterNavigationItems, J as hasVisibleNavigationItems, ot as registerLayout, Ve as resolveActiveNavItem, X as resolveHref, K as resolveIcon, q as resolveLabel, Xe as useAppShellBranding };
|