@object-ui/layout 17.2.0 → 17.5.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 +629 -0
- package/README.md +23 -16
- package/dist/AppSchemaRenderer.d.ts +3 -1
- package/dist/NavigationRenderer.d.ts +52 -8
- package/dist/ResponsiveGrid.d.ts +19 -22
- package/dist/index.js +227 -184
- package/dist/index.umd.cjs +1 -1
- package/package.json +15 -11
package/dist/index.js
CHANGED
|
@@ -5,24 +5,25 @@ import { ArrowLeft as N, ChevronRight as P, FileText as F, GripVertical as ee, L
|
|
|
5
5
|
import { SchemaRenderer as L, useRecordContext as ae } from "@object-ui/react";
|
|
6
6
|
import { Fragment as oe, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
7
7
|
import { Link as se, NavLink as B, useLocation as V } from "react-router-dom";
|
|
8
|
-
import { DndContext as
|
|
9
|
-
import { SortableContext as
|
|
10
|
-
import { CSS as
|
|
11
|
-
import { menuItemToNavigationItem as
|
|
8
|
+
import { DndContext as H, KeyboardSensor as ce, PointerSensor as U, closestCenter as le, useSensor as W, useSensors as G } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as K, arrayMove as ue, useSortable as de, verticalListSortingStrategy as fe } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as pe } from "@dnd-kit/utilities";
|
|
11
|
+
import { menuItemToNavigationItem as me } from "@object-ui/types";
|
|
12
|
+
import { resolveI18nLabel as he } from "@objectstack/spec/ui";
|
|
12
13
|
//#region src/PageHeader.tsx
|
|
13
|
-
var
|
|
14
|
+
var ge = (e) => {
|
|
14
15
|
let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
|
|
15
16
|
return t != null && String(t).trim() ? String(t) : [
|
|
16
17
|
e?.salutation,
|
|
17
18
|
e?.first_name,
|
|
18
19
|
e?.last_name
|
|
19
20
|
].filter((e) => typeof e == "string" && e.trim()).map((e) => e.trim()).join(" ") || (typeof e?.email == "string" && e.email.trim() ? e.email.trim() : null);
|
|
20
|
-
},
|
|
21
|
+
}, _e = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
|
|
21
22
|
let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
|
|
22
|
-
return r == null ? "" : typeof r == "object" ?
|
|
23
|
+
return r == null ? "" : typeof r == "object" ? ge(r) ?? "" : String(r);
|
|
23
24
|
}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
|
|
24
|
-
function
|
|
25
|
-
let m = ae(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g =
|
|
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(() => {
|
|
26
27
|
if (typeof window > "u") return;
|
|
27
28
|
let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
|
|
28
29
|
t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
@@ -77,7 +78,7 @@ function ye({ title: e, subtitle: n, description: r, icon: i, action: a, actions
|
|
|
77
78
|
}
|
|
78
79
|
//#endregion
|
|
79
80
|
//#region src/AppShell.tsx
|
|
80
|
-
function
|
|
81
|
+
function ye(e) {
|
|
81
82
|
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
82
83
|
if (!t) return null;
|
|
83
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;
|
|
@@ -90,9 +91,7 @@ function be(e) {
|
|
|
90
91
|
case r:
|
|
91
92
|
s = ((i - n) / e + 2) / 6;
|
|
92
93
|
break;
|
|
93
|
-
case i:
|
|
94
|
-
s = ((n - r) / e + 4) / 6;
|
|
95
|
-
break;
|
|
94
|
+
case i: s = ((n - r) / e + 4) / 6;
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
97
|
return {
|
|
@@ -101,17 +100,17 @@ function be(e) {
|
|
|
101
100
|
l: l * 100
|
|
102
101
|
};
|
|
103
102
|
}
|
|
104
|
-
function
|
|
105
|
-
let t =
|
|
103
|
+
function be(e) {
|
|
104
|
+
let t = ye(e);
|
|
106
105
|
return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
|
|
107
106
|
}
|
|
108
|
-
function
|
|
109
|
-
let t =
|
|
107
|
+
function xe(e) {
|
|
108
|
+
let t = ye(e);
|
|
110
109
|
if (!t) return null;
|
|
111
110
|
let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
|
|
112
111
|
return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
|
|
113
112
|
}
|
|
114
|
-
function
|
|
113
|
+
function Se(e) {
|
|
115
114
|
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
116
115
|
if (!t) return "0 0% 100%";
|
|
117
116
|
let n = (e) => {
|
|
@@ -120,16 +119,16 @@ function Ce(e) {
|
|
|
120
119
|
}, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
|
|
121
120
|
return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
|
|
122
121
|
}
|
|
123
|
-
function
|
|
122
|
+
function Ce(e, t) {
|
|
124
123
|
n(() => {
|
|
125
124
|
let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
|
|
126
125
|
if (e?.primaryColor) {
|
|
127
|
-
let t =
|
|
128
|
-
a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" :
|
|
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));
|
|
129
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");
|
|
130
129
|
if (e?.accentColor) {
|
|
131
|
-
let t =
|
|
132
|
-
a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" :
|
|
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)));
|
|
133
132
|
} else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
|
|
134
133
|
};
|
|
135
134
|
i();
|
|
@@ -156,8 +155,8 @@ function we(e, t) {
|
|
|
156
155
|
t
|
|
157
156
|
]);
|
|
158
157
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
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, {
|
|
161
160
|
defaultOpen: i,
|
|
162
161
|
className: "!flex-col h-svh overflow-hidden",
|
|
163
162
|
children: [/* @__PURE__ */ R("header", {
|
|
@@ -181,7 +180,7 @@ function G({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
|
|
|
181
180
|
}
|
|
182
181
|
//#endregion
|
|
183
182
|
//#region src/PageCard.tsx
|
|
184
|
-
function
|
|
183
|
+
function we({ className: e, children: t, ...n }) {
|
|
185
184
|
return /* @__PURE__ */ R("div", {
|
|
186
185
|
className: A("rounded-xl border bg-card text-card-foreground shadow", e),
|
|
187
186
|
...n,
|
|
@@ -193,7 +192,7 @@ function Te({ className: e, children: t, ...n }) {
|
|
|
193
192
|
}
|
|
194
193
|
//#endregion
|
|
195
194
|
//#region src/ResponsiveGrid.tsx
|
|
196
|
-
var
|
|
195
|
+
var Te = {
|
|
197
196
|
xs: {
|
|
198
197
|
1: "grid-cols-1",
|
|
199
198
|
2: "grid-cols-2",
|
|
@@ -243,11 +242,11 @@ var Ee = {
|
|
|
243
242
|
12: "2xl:grid-cols-12"
|
|
244
243
|
}
|
|
245
244
|
};
|
|
246
|
-
function
|
|
245
|
+
function Ee(e) {
|
|
247
246
|
if (!e) return "grid-cols-1";
|
|
248
247
|
let t = [];
|
|
249
248
|
for (let [n, r] of Object.entries(e)) {
|
|
250
|
-
let e =
|
|
249
|
+
let e = Te[n];
|
|
251
250
|
if (e && r) {
|
|
252
251
|
let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
|
|
253
252
|
t.push(e[n]);
|
|
@@ -255,7 +254,7 @@ function De(e) {
|
|
|
255
254
|
}
|
|
256
255
|
return t.join(" ") || "grid-cols-1";
|
|
257
256
|
}
|
|
258
|
-
var
|
|
257
|
+
var De = {
|
|
259
258
|
0: "gap-0",
|
|
260
259
|
1: "gap-1",
|
|
261
260
|
2: "gap-2",
|
|
@@ -264,16 +263,19 @@ var Oe = {
|
|
|
264
263
|
5: "gap-5",
|
|
265
264
|
6: "gap-6",
|
|
266
265
|
8: "gap-8"
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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
|
+
};
|
|
271
273
|
//#endregion
|
|
272
274
|
//#region src/NavigationRenderer.tsx
|
|
273
|
-
function
|
|
275
|
+
function J(e) {
|
|
274
276
|
return e ? j(e) : F;
|
|
275
277
|
}
|
|
276
|
-
function
|
|
278
|
+
function Y(e, t) {
|
|
277
279
|
if (typeof e == "string") return e;
|
|
278
280
|
if (t) {
|
|
279
281
|
let n = t(e.key, {
|
|
@@ -284,8 +286,8 @@ function q(e, t) {
|
|
|
284
286
|
}
|
|
285
287
|
return e.defaultValue || e.key;
|
|
286
288
|
}
|
|
287
|
-
function
|
|
288
|
-
let s =
|
|
289
|
+
function ke(e, t, n, r, i, a, o) {
|
|
290
|
+
let s = Y(e.label, n);
|
|
289
291
|
if (typeof e.label != "string") return s;
|
|
290
292
|
let c = (e) => !!e && s.trim().toLowerCase() !== e.trim().toLowerCase();
|
|
291
293
|
if (e.type === "object" && e.objectName) {
|
|
@@ -303,8 +305,20 @@ function Ae(e, t, n, r, i, a, o) {
|
|
|
303
305
|
}
|
|
304
306
|
return o && e.id && !c(e.id) ? o(e.id, s) : s;
|
|
305
307
|
}
|
|
306
|
-
var
|
|
307
|
-
function
|
|
308
|
+
var Ae = (e) => e !== !1 && e !== "false", je = () => !0, Me = () => !0;
|
|
309
|
+
function Ne(e, t = {}) {
|
|
310
|
+
let { evaluateVisibility: n = Ae, checkPermission: r = je, checkCapability: i = Me, hasActionHandler: a = !1 } = t;
|
|
311
|
+
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
|
+
if (o.type === "group") {
|
|
313
|
+
if (Ne(o.children ?? [], t)) return !0;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
if (!(o.type === "action" && !a)) return !0;
|
|
317
|
+
}
|
|
318
|
+
return !1;
|
|
319
|
+
}
|
|
320
|
+
var Pe = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
|
|
321
|
+
function X(e, t) {
|
|
308
322
|
if (!e.includes("{")) return e;
|
|
309
323
|
let n = !1, r = e.replace(Pe, (e, r) => {
|
|
310
324
|
let i;
|
|
@@ -312,12 +326,12 @@ function J(e, t) {
|
|
|
312
326
|
});
|
|
313
327
|
return n ? null : r;
|
|
314
328
|
}
|
|
315
|
-
function
|
|
329
|
+
function Fe(e, t, n) {
|
|
316
330
|
switch (e.type) {
|
|
317
331
|
case "object": {
|
|
318
332
|
let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
|
|
319
333
|
if (i) {
|
|
320
|
-
let t =
|
|
334
|
+
let t = X(i, n);
|
|
321
335
|
if (t) {
|
|
322
336
|
let n = `${r}/record/${encodeURIComponent(t)}`;
|
|
323
337
|
return {
|
|
@@ -331,7 +345,7 @@ function Y(e, t, n) {
|
|
|
331
345
|
let e = new URLSearchParams();
|
|
332
346
|
for (let [t, r] of Object.entries(a)) {
|
|
333
347
|
if (r == null || t === "") continue;
|
|
334
|
-
let i =
|
|
348
|
+
let i = X(String(r), n);
|
|
335
349
|
i !== null && e.set(`filter[${t}]`, i);
|
|
336
350
|
}
|
|
337
351
|
let t = e.toString();
|
|
@@ -357,10 +371,12 @@ function Y(e, t, n) {
|
|
|
357
371
|
let r = e.params, i = `${t}/page/${e.pageName}`;
|
|
358
372
|
if (r && typeof r == "object") {
|
|
359
373
|
let e = new URLSearchParams();
|
|
360
|
-
for (let [t, i] of Object.entries(r)) if (i != null)
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
374
|
+
for (let [t, i] of Object.entries(r)) if (i != null) {
|
|
375
|
+
if (typeof i == "string") {
|
|
376
|
+
let r = X(i, n);
|
|
377
|
+
r !== null && e.set(t, r);
|
|
378
|
+
} else e.set(t, JSON.stringify(i));
|
|
379
|
+
}
|
|
364
380
|
let t = e.toString();
|
|
365
381
|
t && (i += `?${t}`);
|
|
366
382
|
}
|
|
@@ -393,10 +409,12 @@ function Y(e, t, n) {
|
|
|
393
409
|
let e = i[1], r = a && typeof a.type == "string" ? a.type : void 0, o = a && typeof a.name == "string" ? a.name : void 0, s = "";
|
|
394
410
|
if (a && typeof a == "object") {
|
|
395
411
|
let e = new URLSearchParams();
|
|
396
|
-
for (let [t, r] of Object.entries(a)) if (
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
412
|
+
for (let [t, r] of Object.entries(a)) if (t !== "type" && t !== "name" && r != null) {
|
|
413
|
+
if (typeof r == "string") {
|
|
414
|
+
let i = X(r, n);
|
|
415
|
+
i && e.set(t, i);
|
|
416
|
+
} else e.set(t, JSON.stringify(r));
|
|
417
|
+
}
|
|
400
418
|
let t = e.toString();
|
|
401
419
|
t && (s = `?${t}`);
|
|
402
420
|
}
|
|
@@ -429,27 +447,27 @@ function Y(e, t, n) {
|
|
|
429
447
|
};
|
|
430
448
|
}
|
|
431
449
|
}
|
|
432
|
-
var
|
|
433
|
-
function
|
|
450
|
+
var Ie = 50, Le = 40, Re = 30, ze = 25, Be = 10, Ve = 5;
|
|
451
|
+
function He(e) {
|
|
434
452
|
let t = /* @__PURE__ */ new Map();
|
|
435
453
|
return new URLSearchParams(e).forEach((e, n) => {
|
|
436
454
|
let r = /^filter\[(.+)\]$/.exec(n);
|
|
437
455
|
r && r[1] && e !== "" && t.set(r[1], e);
|
|
438
456
|
}), t;
|
|
439
457
|
}
|
|
440
|
-
function
|
|
458
|
+
function Ue(e, t) {
|
|
441
459
|
return t.startsWith(`${e}.`) ? t.slice(e.length + 1) : t;
|
|
442
460
|
}
|
|
443
|
-
function
|
|
444
|
-
let { href: a, external: o } =
|
|
461
|
+
function We(e, t, n, r, i) {
|
|
462
|
+
let { href: a, external: o } = Fe(e, r, i);
|
|
445
463
|
if (o || a === "#") return 0;
|
|
446
464
|
if (e.type === "object" && e.objectName) {
|
|
447
465
|
let a = `${r}/${e.objectName}`;
|
|
448
466
|
if (t !== a && !t.startsWith(`${a}/`)) return 0;
|
|
449
467
|
let o = t === a ? [] : t.slice(a.length + 1).split("/"), s = e.recordId;
|
|
450
468
|
if (s) {
|
|
451
|
-
let e =
|
|
452
|
-
if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ?
|
|
469
|
+
let e = X(s, i);
|
|
470
|
+
if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Ie : 0;
|
|
453
471
|
}
|
|
454
472
|
let c = e.filters;
|
|
455
473
|
if (c && typeof c == "object" && !Array.isArray(c)) {
|
|
@@ -457,34 +475,34 @@ function Ue(e, t, n, r, i) {
|
|
|
457
475
|
let e = /* @__PURE__ */ new Map();
|
|
458
476
|
for (let [t, n] of Object.entries(c)) {
|
|
459
477
|
if (n == null || t === "") continue;
|
|
460
|
-
let r =
|
|
478
|
+
let r = X(String(n), i);
|
|
461
479
|
r !== null && e.set(t, r);
|
|
462
480
|
}
|
|
463
481
|
if (e.size !== n.size) return 0;
|
|
464
482
|
for (let [t, r] of e) if (n.get(t) !== r) return 0;
|
|
465
|
-
return
|
|
483
|
+
return Le;
|
|
466
484
|
}
|
|
467
|
-
return e.viewName ? o[0] !== "view" || !o[1] ? 0 :
|
|
485
|
+
return e.viewName ? o[0] !== "view" || !o[1] ? 0 : Ue(e.objectName, decodeURIComponent(o[1])) === Ue(e.objectName, e.viewName) ? Re : 0 : o.length === 0 ? ze : Be;
|
|
468
486
|
}
|
|
469
487
|
let s = a.split("?")[0];
|
|
470
|
-
if (t === s) return
|
|
488
|
+
if (t === s) return ze;
|
|
471
489
|
let c = e.componentRef;
|
|
472
|
-
return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ?
|
|
490
|
+
return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? Ve : 0;
|
|
473
491
|
}
|
|
474
|
-
function
|
|
475
|
-
let a =
|
|
492
|
+
function Ge(e, t, n, r, i) {
|
|
493
|
+
let a = He(n), o = null, s = 0, c = (e) => {
|
|
476
494
|
if (e) for (let n of e) {
|
|
477
495
|
if (n.type === "group") {
|
|
478
496
|
c(n.children);
|
|
479
497
|
continue;
|
|
480
498
|
}
|
|
481
|
-
let e =
|
|
499
|
+
let e = We(n, t, a, r, i);
|
|
482
500
|
e > s && (o = n, s = e);
|
|
483
501
|
}
|
|
484
502
|
};
|
|
485
503
|
return c(e), o;
|
|
486
504
|
}
|
|
487
|
-
var
|
|
505
|
+
var Ke = t.createContext(null);
|
|
488
506
|
function Z(e, t) {
|
|
489
507
|
if (!t.trim()) return e;
|
|
490
508
|
let n = t.toLowerCase().trim();
|
|
@@ -497,23 +515,23 @@ function Z(e, t) {
|
|
|
497
515
|
children: n
|
|
498
516
|
}), e;
|
|
499
517
|
}
|
|
500
|
-
return
|
|
518
|
+
return Y(r.label).toLowerCase().includes(n) && e.push(r), e;
|
|
501
519
|
}, []);
|
|
502
520
|
}
|
|
503
|
-
var
|
|
504
|
-
function
|
|
505
|
-
let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } =
|
|
521
|
+
var qe = 5;
|
|
522
|
+
function Je({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, resolveViewLabel: f, resolveItemLabel: p, t: m, templateContext: h }) {
|
|
523
|
+
let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } = de({
|
|
506
524
|
id: e.id,
|
|
507
525
|
disabled: !c
|
|
508
|
-
})
|
|
526
|
+
}), S = {
|
|
527
|
+
transform: pe.Transform.toString(y),
|
|
528
|
+
transition: b,
|
|
529
|
+
opacity: x ? .5 : void 0,
|
|
530
|
+
zIndex: x ? 10 : void 0
|
|
531
|
+
};
|
|
509
532
|
return /* @__PURE__ */ R("div", {
|
|
510
533
|
ref: v,
|
|
511
|
-
style:
|
|
512
|
-
transform: he.Transform.toString(y),
|
|
513
|
-
transition: b,
|
|
514
|
-
opacity: x ? .5 : void 0,
|
|
515
|
-
zIndex: x ? 10 : void 0
|
|
516
|
-
},
|
|
534
|
+
style: S,
|
|
517
535
|
...g,
|
|
518
536
|
children: /* @__PURE__ */ R(Q, {
|
|
519
537
|
item: e,
|
|
@@ -539,25 +557,25 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
539
557
|
let j = M(), N = j ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, F = A("shrink-0", j ? "h-5 w-5" : "h-4 w-4"), te = (() => {
|
|
540
558
|
if (typeof e.expanded == "boolean") return e.expanded;
|
|
541
559
|
if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
|
|
542
|
-
})(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(
|
|
560
|
+
})(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(Ke), L = t.useMemo(() => {
|
|
543
561
|
if (e.type !== "group" || !I) return !1;
|
|
544
562
|
let t = (e) => !!e?.some((e) => e.id === I || e.type === "group" && t(e.children));
|
|
545
563
|
return t(e.children);
|
|
546
|
-
}, [e, I]) ? !0 : te ?? !(ie >= 8));
|
|
564
|
+
}, [e, I]) ? !0 : te ?? !(ie >= 8), [ae, B] = i(L);
|
|
547
565
|
if (!r(e.visible) || e.requiredPermissions?.length && !o(e.requiredPermissions)) return null;
|
|
548
|
-
let
|
|
549
|
-
if (
|
|
566
|
+
let V = e.requiresObject, H = e.requiresService;
|
|
567
|
+
if (V && !u("object", V) || H && !u("service", H)) return null;
|
|
550
568
|
if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
|
|
551
569
|
if (e.type === "group") {
|
|
552
|
-
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i =
|
|
570
|
+
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = ke(e, y, O, b, x, E, D);
|
|
553
571
|
return /* @__PURE__ */ R(s, {
|
|
554
|
-
open:
|
|
555
|
-
onOpenChange:
|
|
572
|
+
open: ae,
|
|
573
|
+
onOpenChange: B,
|
|
556
574
|
children: /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ R(v, {
|
|
557
575
|
asChild: !0,
|
|
558
576
|
children: /* @__PURE__ */ z(l, {
|
|
559
577
|
className: A("flex w-full items-center justify-between", j && "min-h-[44px] text-[15px] rounded-xl"),
|
|
560
|
-
children: [i, /* @__PURE__ */ R(P, { className: A("ml-auto transition-transform", j ? "h-5 w-5" : "h-4 w-4",
|
|
578
|
+
children: [i, /* @__PURE__ */ R(P, { className: A("ml-auto transition-transform", j ? "h-5 w-5" : "h-4 w-4", ae && "rotate-90") })]
|
|
561
579
|
})
|
|
562
580
|
}), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
|
|
563
581
|
item: e,
|
|
@@ -580,7 +598,7 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
580
598
|
}
|
|
581
599
|
if (e.type === "action") {
|
|
582
600
|
if (!d) return null;
|
|
583
|
-
let t =
|
|
601
|
+
let t = J(e.icon), r = Y(e.label, O);
|
|
584
602
|
return /* @__PURE__ */ z(T, { children: [
|
|
585
603
|
h && /* @__PURE__ */ R("span", {
|
|
586
604
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
@@ -613,9 +631,9 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
613
631
|
})
|
|
614
632
|
] });
|
|
615
633
|
}
|
|
616
|
-
let ce =
|
|
634
|
+
let ce = J(e.icon), { href: U, external: le } = Fe(e, n, k), W = I !== null && e.id === I, G = ke(e, y, O, b, x, E, D), K = /* @__PURE__ */ z(oe, { children: [
|
|
617
635
|
/* @__PURE__ */ R(ce, { className: F }),
|
|
618
|
-
/* @__PURE__ */ R("span", { children:
|
|
636
|
+
/* @__PURE__ */ R("span", { children: G }),
|
|
619
637
|
e.badge != null && /* @__PURE__ */ R(a, {
|
|
620
638
|
variant: e.badgeVariant ?? "default",
|
|
621
639
|
className: "ml-auto text-[10px] px-1.5 py-0",
|
|
@@ -631,42 +649,42 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
631
649
|
}),
|
|
632
650
|
/* @__PURE__ */ R(w, {
|
|
633
651
|
asChild: !0,
|
|
634
|
-
isActive:
|
|
635
|
-
tooltip:
|
|
652
|
+
isActive: W,
|
|
653
|
+
tooltip: G,
|
|
636
654
|
className: N,
|
|
637
655
|
children: le ? /* @__PURE__ */ R("a", {
|
|
638
|
-
href:
|
|
656
|
+
href: U,
|
|
639
657
|
target: "_blank",
|
|
640
658
|
rel: "noopener noreferrer",
|
|
641
|
-
children:
|
|
659
|
+
children: K
|
|
642
660
|
}) : /* @__PURE__ */ R(se, {
|
|
643
|
-
to:
|
|
644
|
-
children:
|
|
661
|
+
to: U,
|
|
662
|
+
children: K
|
|
645
663
|
})
|
|
646
664
|
}),
|
|
647
665
|
p && m && /* @__PURE__ */ R(C, {
|
|
648
666
|
showOnHover: !0,
|
|
649
667
|
onClick: () => m(e.id, !e.pinned, e, n),
|
|
650
668
|
"aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
|
|
651
|
-
defaultValue: e.pinned ? `Unpin ${
|
|
652
|
-
name:
|
|
653
|
-
}) : e.pinned ? `Unpin ${
|
|
669
|
+
defaultValue: e.pinned ? `Unpin ${G}` : `Pin ${G}`,
|
|
670
|
+
name: G
|
|
671
|
+
}) : e.pinned ? `Unpin ${G}` : `Pin ${G}`,
|
|
654
672
|
children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
|
|
655
673
|
})
|
|
656
674
|
] });
|
|
657
675
|
}
|
|
658
|
-
function $({ items: e, basePath: t = "", evaluateVisibility: n =
|
|
659
|
-
let C = V(), w = r(() =>
|
|
676
|
+
function $({ items: e, basePath: t = "", evaluateVisibility: n = Ae, checkPermission: i = je, checkCapability: a = Me, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, resolveItemLabel: y, t: b, templateContext: x }) {
|
|
677
|
+
let C = V(), w = r(() => Ge(e, C.pathname, C.search, t, x)?.id ?? null, [
|
|
660
678
|
e,
|
|
661
679
|
C.pathname,
|
|
662
680
|
C.search,
|
|
663
681
|
t,
|
|
664
682
|
x
|
|
665
|
-
]), T = r(() => s ? Z(e, s) : e, [e, s]), E = r(() =>
|
|
683
|
+
]), T = r(() => s ? Z(e, s) : e, [e, s]), E = r(() => Ye(T), [T]), D = T.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), O = G(W(U, { activationConstraint: { distance: qe } }), W(ce)), k = (e) => {
|
|
666
684
|
let { active: t, over: n } = e;
|
|
667
685
|
if (!n || t.id === n.id || !d) return;
|
|
668
686
|
let r = D.findIndex((e) => e.id === t.id), i = D.findIndex((e) => e.id === n.id);
|
|
669
|
-
r
|
|
687
|
+
r !== -1 && i !== -1 && d(ue(D, r, i).map((e, t) => ({
|
|
670
688
|
...e,
|
|
671
689
|
order: t
|
|
672
690
|
})));
|
|
@@ -693,14 +711,14 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = je, checkPermis
|
|
|
693
711
|
...A
|
|
694
712
|
}, `fav-${e.id}`)) }) })] }) : null;
|
|
695
713
|
if (!j) {
|
|
696
|
-
let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ R(
|
|
714
|
+
let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ R(H, {
|
|
697
715
|
sensors: O,
|
|
698
|
-
collisionDetection:
|
|
716
|
+
collisionDetection: le,
|
|
699
717
|
onDragEnd: k,
|
|
700
|
-
children: /* @__PURE__ */ R(
|
|
718
|
+
children: /* @__PURE__ */ R(K, {
|
|
701
719
|
items: e,
|
|
702
|
-
strategy:
|
|
703
|
-
children: /* @__PURE__ */ R(S, { children: D.map((e) => /* @__PURE__ */ R(
|
|
720
|
+
strategy: fe,
|
|
721
|
+
children: /* @__PURE__ */ R(S, { children: D.map((e) => /* @__PURE__ */ R(Je, {
|
|
704
722
|
item: e,
|
|
705
723
|
enableReorder: u,
|
|
706
724
|
...A
|
|
@@ -710,7 +728,7 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = je, checkPermis
|
|
|
710
728
|
item: e,
|
|
711
729
|
...A
|
|
712
730
|
}, e.id)) });
|
|
713
|
-
return /* @__PURE__ */ z(
|
|
731
|
+
return /* @__PURE__ */ z(Ke.Provider, {
|
|
714
732
|
value: w,
|
|
715
733
|
children: [M, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: t }) })]
|
|
716
734
|
});
|
|
@@ -728,34 +746,36 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = je, checkPermis
|
|
|
728
746
|
item: e,
|
|
729
747
|
...A
|
|
730
748
|
}, e.id))) : P.push(e);
|
|
731
|
-
}), F("leaf-end"), /* @__PURE__ */ z(
|
|
749
|
+
}), F("leaf-end"), /* @__PURE__ */ z(Ke.Provider, {
|
|
732
750
|
value: w,
|
|
733
751
|
children: [M, N]
|
|
734
752
|
});
|
|
735
753
|
}
|
|
736
|
-
function
|
|
754
|
+
function Ye(e) {
|
|
737
755
|
let t = [];
|
|
738
|
-
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...
|
|
756
|
+
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Ye(n.children));
|
|
739
757
|
return t;
|
|
740
758
|
}
|
|
741
759
|
//#endregion
|
|
742
760
|
//#region src/AppSchemaRenderer.tsx
|
|
743
|
-
function
|
|
744
|
-
|
|
745
|
-
|
|
761
|
+
function Xe(e) {
|
|
762
|
+
return he(e, void 0) ?? "";
|
|
763
|
+
}
|
|
764
|
+
function Ze({ areas: e, activeAreaId: t, onAreaChange: n }) {
|
|
765
|
+
return e.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
|
|
746
766
|
className: "flex items-center gap-1.5",
|
|
747
767
|
children: [/* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" }), "Area"]
|
|
748
|
-
}), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children:
|
|
749
|
-
let r =
|
|
768
|
+
}), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.map((e) => {
|
|
769
|
+
let r = J(e.icon), i = Xe(e.label);
|
|
750
770
|
return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
|
|
751
771
|
isActive: e.id === t,
|
|
752
|
-
tooltip:
|
|
772
|
+
tooltip: i,
|
|
753
773
|
onClick: () => n(e.id),
|
|
754
|
-
children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children:
|
|
774
|
+
children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: i })]
|
|
755
775
|
}) }, e.id);
|
|
756
776
|
}) }) })] });
|
|
757
777
|
}
|
|
758
|
-
function
|
|
778
|
+
function Qe({ items: e, basePath: t }) {
|
|
759
779
|
let n = V(), r = (e) => {
|
|
760
780
|
let t = [];
|
|
761
781
|
for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
|
|
@@ -766,7 +786,7 @@ function Ye({ items: e, basePath: t }) {
|
|
|
766
786
|
role: "navigation",
|
|
767
787
|
"aria-label": "Mobile navigation",
|
|
768
788
|
children: i.map((e) => {
|
|
769
|
-
let r =
|
|
789
|
+
let r = J(e.icon), i = "#";
|
|
770
790
|
if (e.type === "object") i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`);
|
|
771
791
|
else if (e.type === "dashboard") i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#";
|
|
772
792
|
else if (e.type === "page") i = e.pageName ? `${t}/page/${e.pageName}` : "#";
|
|
@@ -791,14 +811,14 @@ function Ye({ items: e, basePath: t }) {
|
|
|
791
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"}`,
|
|
792
812
|
children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
|
|
793
813
|
className: "text-[10px] truncate max-w-[60px]",
|
|
794
|
-
children:
|
|
814
|
+
children: Y(e.label)
|
|
795
815
|
})]
|
|
796
816
|
}, e.id);
|
|
797
817
|
})
|
|
798
818
|
});
|
|
799
819
|
}
|
|
800
|
-
function
|
|
801
|
-
let
|
|
820
|
+
function $e({ 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 }) {
|
|
821
|
+
let D = J(e.logo), [O, k] = i("");
|
|
802
822
|
return /* @__PURE__ */ z(p, {
|
|
803
823
|
collapsible: "icon",
|
|
804
824
|
children: [
|
|
@@ -811,7 +831,7 @@ function Xe({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
|
|
|
811
831
|
src: e.logo,
|
|
812
832
|
alt: e.title ?? "",
|
|
813
833
|
className: "size-6 object-contain"
|
|
814
|
-
}) : /* @__PURE__ */ R(
|
|
834
|
+
}) : /* @__PURE__ */ R(D, { className: "size-4" })
|
|
815
835
|
}), /* @__PURE__ */ z("div", {
|
|
816
836
|
className: "grid flex-1 text-left text-sm leading-tight",
|
|
817
837
|
children: [/* @__PURE__ */ R("span", {
|
|
@@ -822,32 +842,30 @@ function Xe({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
|
|
|
822
842
|
children: e.description
|
|
823
843
|
})]
|
|
824
844
|
})]
|
|
825
|
-
}) }) }),
|
|
845
|
+
}) }) }), _ && /* @__PURE__ */ R(b, {
|
|
826
846
|
placeholder: "Search navigation…",
|
|
827
847
|
value: O,
|
|
828
848
|
onChange: (e) => k(e.target.value),
|
|
829
849
|
"aria-label": "Search navigation"
|
|
830
850
|
})] }),
|
|
831
851
|
/* @__PURE__ */ z(m, { children: [
|
|
832
|
-
|
|
833
|
-
areas:
|
|
834
|
-
activeAreaId:
|
|
835
|
-
onAreaChange:
|
|
836
|
-
evalVis: n,
|
|
837
|
-
checkPerm: r
|
|
852
|
+
u.length > 1 && d && /* @__PURE__ */ R(Ze, {
|
|
853
|
+
areas: u,
|
|
854
|
+
activeAreaId: d,
|
|
855
|
+
onAreaChange: f
|
|
838
856
|
}),
|
|
839
857
|
/* @__PURE__ */ R($, {
|
|
840
|
-
items:
|
|
858
|
+
items: g,
|
|
841
859
|
basePath: t,
|
|
842
860
|
evaluateVisibility: n,
|
|
843
861
|
checkPermission: r,
|
|
844
862
|
checkCapability: a,
|
|
845
863
|
onAction: o,
|
|
846
864
|
searchQuery: O,
|
|
847
|
-
enablePinning:
|
|
848
|
-
onPinToggle:
|
|
849
|
-
enableReorder:
|
|
850
|
-
onReorder:
|
|
865
|
+
enablePinning: v,
|
|
866
|
+
onPinToggle: x,
|
|
867
|
+
enableReorder: C,
|
|
868
|
+
onReorder: E
|
|
851
869
|
}),
|
|
852
870
|
l
|
|
853
871
|
] }),
|
|
@@ -855,52 +873,58 @@ function Xe({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
|
|
|
855
873
|
]
|
|
856
874
|
});
|
|
857
875
|
}
|
|
858
|
-
function
|
|
859
|
-
let S = o ?? ((e) =>
|
|
876
|
+
function et({ 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 }) {
|
|
877
|
+
let S = o ?? ((e) => e !== !1 && e !== "false"), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => me(e, t)), [e.menu]), E = e.navigation ?? T, D = (e.areas ?? []).filter((e) => Ne(e.navigation, {
|
|
878
|
+
evaluateVisibility: S,
|
|
879
|
+
checkPermission: C,
|
|
880
|
+
checkCapability: w,
|
|
881
|
+
hasActionHandler: !!l
|
|
882
|
+
})), [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
|
|
860
883
|
n(() => {
|
|
861
884
|
D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
|
|
862
885
|
}, [e.name, A]);
|
|
863
|
-
let j = D.find((e) => e.id === O)?.navigation ?? E,
|
|
886
|
+
let j = D.find((e) => e.id === O) ?? D[0], M = j?.navigation ?? E, N = {
|
|
864
887
|
title: e.title,
|
|
865
888
|
favicon: e.favicon,
|
|
866
889
|
logo: e.logo
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
890
|
+
}, P = /* @__PURE__ */ R($e, {
|
|
891
|
+
schema: e,
|
|
892
|
+
basePath: t,
|
|
893
|
+
evalVis: S,
|
|
894
|
+
checkPerm: C,
|
|
895
|
+
checkCap: w,
|
|
896
|
+
onAction: l,
|
|
897
|
+
sidebarHeader: d,
|
|
898
|
+
sidebarFooter: f,
|
|
899
|
+
sidebarExtra: p,
|
|
900
|
+
visibleAreas: D,
|
|
901
|
+
activeAreaId: j?.id ?? null,
|
|
902
|
+
setActiveAreaId: k,
|
|
903
|
+
resolvedNavigation: M,
|
|
904
|
+
enableSearch: _,
|
|
905
|
+
enablePinning: v,
|
|
906
|
+
onPinToggle: y,
|
|
907
|
+
enableReorder: b,
|
|
908
|
+
onReorder: x
|
|
909
|
+
});
|
|
910
|
+
return /* @__PURE__ */ z(oe, { children: [/* @__PURE__ */ R(q, {
|
|
911
|
+
sidebar: P,
|
|
888
912
|
navbar: u,
|
|
889
913
|
className: h,
|
|
890
914
|
defaultOpen: g,
|
|
891
|
-
branding:
|
|
915
|
+
branding: N,
|
|
892
916
|
children: m
|
|
893
|
-
}), a === "bottom_nav" && /* @__PURE__ */ R(
|
|
894
|
-
items:
|
|
917
|
+
}), a === "bottom_nav" && /* @__PURE__ */ R(Qe, {
|
|
918
|
+
items: M,
|
|
895
919
|
basePath: t
|
|
896
920
|
})] });
|
|
897
921
|
}
|
|
898
922
|
//#endregion
|
|
899
923
|
//#region src/SidebarNav.tsx
|
|
900
|
-
function
|
|
924
|
+
function tt(e) {
|
|
901
925
|
return "items" in e && !("href" in e);
|
|
902
926
|
}
|
|
903
|
-
function
|
|
927
|
+
function nt({ item: e, pathname: t }) {
|
|
904
928
|
return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
|
|
905
929
|
asChild: !0,
|
|
906
930
|
defaultOpen: !0,
|
|
@@ -960,8 +984,8 @@ function $e({ item: e, pathname: t }) {
|
|
|
960
984
|
})
|
|
961
985
|
}) });
|
|
962
986
|
}
|
|
963
|
-
function
|
|
964
|
-
let s = V(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] :
|
|
987
|
+
function rt({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
|
|
988
|
+
let s = V(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : tt(e[0]) ? e.map((e) => ({
|
|
965
989
|
groupLabel: e.label,
|
|
966
990
|
items: e.items
|
|
967
991
|
})) : [{ items: e }], [e]), f = t.useMemo(() => {
|
|
@@ -996,7 +1020,7 @@ function et({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
996
1020
|
className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
|
|
997
1021
|
children: e.groupLabel || n
|
|
998
1022
|
}),
|
|
999
|
-
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(
|
|
1023
|
+
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(nt, {
|
|
1000
1024
|
item: e,
|
|
1001
1025
|
pathname: s.pathname
|
|
1002
1026
|
}, e.href)) }) })
|
|
@@ -1005,29 +1029,47 @@ function et({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
1005
1029
|
}
|
|
1006
1030
|
//#endregion
|
|
1007
1031
|
//#region src/index.ts
|
|
1008
|
-
function
|
|
1009
|
-
e.register("page-header",
|
|
1032
|
+
function it() {
|
|
1033
|
+
e.register("page-header", ve, {
|
|
1010
1034
|
namespace: "layout",
|
|
1011
1035
|
label: "Page Header",
|
|
1012
1036
|
category: "Layout",
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1037
|
+
isContainer: !0,
|
|
1038
|
+
inputs: [
|
|
1039
|
+
{
|
|
1040
|
+
name: "title",
|
|
1041
|
+
type: "string",
|
|
1042
|
+
label: "Title"
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
name: "subtitle",
|
|
1046
|
+
type: "string",
|
|
1047
|
+
label: "Subtitle"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
name: "icon",
|
|
1051
|
+
type: "string",
|
|
1052
|
+
label: "Icon",
|
|
1053
|
+
description: "Lucide icon name"
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
name: "actions",
|
|
1057
|
+
type: "array",
|
|
1058
|
+
label: "Actions",
|
|
1059
|
+
description: "ActionDef list (or action ids) rendered through record:quick_actions"
|
|
1060
|
+
}
|
|
1061
|
+
]
|
|
1062
|
+
}), e.register("page:card", we, {
|
|
1021
1063
|
namespace: "layout",
|
|
1022
1064
|
skipFallback: !0,
|
|
1023
1065
|
label: "Page Card",
|
|
1024
1066
|
category: "Layout",
|
|
1025
1067
|
isContainer: !0
|
|
1026
|
-
}), e.register("app-shell",
|
|
1068
|
+
}), e.register("app-shell", q, {
|
|
1027
1069
|
namespace: "layout",
|
|
1028
1070
|
label: "App Shell",
|
|
1029
1071
|
category: "Layout"
|
|
1030
|
-
}), e.register("responsive-grid",
|
|
1072
|
+
}), e.register("responsive-grid", Oe, {
|
|
1031
1073
|
namespace: "layout",
|
|
1032
1074
|
label: "Responsive Grid",
|
|
1033
1075
|
category: "Layout",
|
|
@@ -1045,12 +1087,13 @@ function tt() {
|
|
|
1045
1087
|
category: "Layout",
|
|
1046
1088
|
inputs: [{
|
|
1047
1089
|
name: "items",
|
|
1048
|
-
type: "
|
|
1090
|
+
type: "array",
|
|
1091
|
+
required: !0
|
|
1049
1092
|
}, {
|
|
1050
1093
|
name: "basePath",
|
|
1051
1094
|
type: "string"
|
|
1052
1095
|
}]
|
|
1053
|
-
}), e.register("app-schema-renderer",
|
|
1096
|
+
}), e.register("app-schema-renderer", et, {
|
|
1054
1097
|
namespace: "layout",
|
|
1055
1098
|
label: "App Schema Renderer",
|
|
1056
1099
|
category: "Layout",
|
|
@@ -1072,7 +1115,7 @@ function tt() {
|
|
|
1072
1115
|
});
|
|
1073
1116
|
}
|
|
1074
1117
|
try {
|
|
1075
|
-
|
|
1118
|
+
it();
|
|
1076
1119
|
} catch {}
|
|
1077
1120
|
//#endregion
|
|
1078
|
-
export {
|
|
1121
|
+
export { et as AppSchemaRenderer, q as AppShell, $ as NavigationRenderer, we as PageCard, ve as PageHeader, Oe as ResponsiveGrid, rt as SidebarNav, Z as filterNavigationItems, Ne as hasVisibleNavigationItems, it as registerLayout, Ge as resolveActiveNavItem, Fe as resolveHref, J as resolveIcon, Y as resolveLabel, Ce as useAppShellBranding };
|