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