@object-ui/plugin-list 4.4.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -2,22 +2,23 @@ import { ComponentRegistry as e, buildExpandFields as t, evaluatePlainCondition
|
|
|
2
2
|
import * as a from "react";
|
|
3
3
|
import { useCallback as o, useContext as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
4
4
|
import { Button as d, Card as f, CardContent as p, FilterBuilder as m, GroupingEditor as h, Input as g, LookupValuePicker as _, NavigationOverlay as v, Popover as y, PopoverContent as b, PopoverTrigger as x, SortBuilder as S, cn as C } from "@object-ui/components";
|
|
5
|
-
import { Activity as w, ArrowUpDown as T, Calendar as ee, CheckSquare as te, ChevronDown as E, ChevronRight as ne, Download as re, EyeOff as ie, GanttChartSquare as D, Grid as O, Group as ae, Images as k, Inbox as
|
|
5
|
+
import { Activity as w, ArrowUpDown as T, Calendar as ee, CheckSquare as te, ChevronDown as E, ChevronRight as ne, Download as re, EyeOff as ie, GanttChartSquare as D, Grid as O, Group as ae, Images as k, Inbox as oe, LayoutGrid as A, Map as j, Paintbrush as se, Plus as M, Printer as ce, Rows2 as le, Rows3 as ue, Rows4 as de, Search as fe, Settings2 as pe, Share2 as me, SlidersHorizontal as he, Trash2 as ge, X as _e, icons as ve } from "lucide-react";
|
|
6
6
|
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
7
7
|
import { useObjectLabel as ye, useObjectTranslation as be, useSafeFieldLabel as xe } from "@object-ui/i18n";
|
|
8
8
|
import { SchemaRenderer as Se, SchemaRendererContext as Ce, useDataScope as we, useDensityMode as Te, useNavigationOverlay as Ee, useSafeFieldLabel as De } from "@object-ui/react";
|
|
9
9
|
import { usePullToRefresh as Oe } from "@object-ui/mobile";
|
|
10
10
|
import { usePermissions as ke } from "@object-ui/permissions";
|
|
11
|
+
import { getCellRenderer as I, resolveCellRendererType as Ae } from "@object-ui/fields";
|
|
11
12
|
//#region src/ViewSwitcher.tsx
|
|
12
|
-
var
|
|
13
|
+
var je = {
|
|
13
14
|
grid: /* @__PURE__ */ P(O, { className: "h-4 w-4" }),
|
|
14
|
-
kanban: /* @__PURE__ */ P(
|
|
15
|
+
kanban: /* @__PURE__ */ P(A, { className: "h-4 w-4" }),
|
|
15
16
|
gallery: /* @__PURE__ */ P(k, { className: "h-4 w-4" }),
|
|
16
17
|
calendar: /* @__PURE__ */ P(ee, { className: "h-4 w-4" }),
|
|
17
18
|
timeline: /* @__PURE__ */ P(w, { className: "h-4 w-4" }),
|
|
18
19
|
gantt: /* @__PURE__ */ P(D, { className: "h-4 w-4" }),
|
|
19
|
-
map: /* @__PURE__ */ P(
|
|
20
|
-
},
|
|
20
|
+
map: /* @__PURE__ */ P(j, { className: "h-4 w-4" })
|
|
21
|
+
}, Me = {
|
|
21
22
|
grid: "Grid",
|
|
22
23
|
kanban: "Kanban",
|
|
23
24
|
gallery: "Gallery",
|
|
@@ -25,7 +26,7 @@ var I = {
|
|
|
25
26
|
timeline: "Timeline",
|
|
26
27
|
gantt: "Gantt",
|
|
27
28
|
map: "Map"
|
|
28
|
-
},
|
|
29
|
+
}, Ne = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
|
|
29
30
|
let o = a.useCallback((t) => {
|
|
30
31
|
if (!i || t === e) {
|
|
31
32
|
n(t);
|
|
@@ -44,14 +45,14 @@ var I = {
|
|
|
44
45
|
return /* @__PURE__ */ F("button", {
|
|
45
46
|
type: "button",
|
|
46
47
|
onClick: () => o(t),
|
|
47
|
-
"aria-label":
|
|
48
|
-
title:
|
|
48
|
+
"aria-label": Me[t],
|
|
49
|
+
title: Me[t],
|
|
49
50
|
"aria-pressed": n,
|
|
50
51
|
"data-state": n ? "on" : "off",
|
|
51
52
|
className: C("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", "hover:bg-muted hover:text-muted-foreground", "gap-2 px-3 py-2", "data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm border-transparent border data-[state=on]:border-border/50"),
|
|
52
|
-
children: [
|
|
53
|
+
children: [je[t], /* @__PURE__ */ P("span", {
|
|
53
54
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
54
|
-
children:
|
|
55
|
+
children: Me[t]
|
|
55
56
|
})]
|
|
56
57
|
}, t);
|
|
57
58
|
})
|
|
@@ -59,14 +60,14 @@ var I = {
|
|
|
59
60
|
};
|
|
60
61
|
//#endregion
|
|
61
62
|
//#region src/components/TabBar.tsx
|
|
62
|
-
function
|
|
63
|
+
function Pe(e) {
|
|
63
64
|
return e ? ve[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function L(e) {
|
|
66
67
|
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
67
68
|
}
|
|
68
|
-
var
|
|
69
|
-
let i = a.useMemo(() =>
|
|
69
|
+
var Fe = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
70
|
+
let i = a.useMemo(() => L(e), [e]), o = a.useMemo(() => i.find((e) => e.isDefault)?.name ?? i[0]?.name, [i]), [s, c] = a.useState(o), l = t ?? s, u = a.useCallback((e) => {
|
|
70
71
|
c(e.name), n?.(e);
|
|
71
72
|
}, [n]);
|
|
72
73
|
return i.length === 0 ? null : /* @__PURE__ */ P("div", {
|
|
@@ -74,7 +75,7 @@ var Ne = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
74
75
|
"data-testid": "view-tabs",
|
|
75
76
|
role: "tablist",
|
|
76
77
|
children: i.map((e) => {
|
|
77
|
-
let t =
|
|
78
|
+
let t = Pe(e.icon), n = l === e.name;
|
|
78
79
|
return /* @__PURE__ */ F(d, {
|
|
79
80
|
variant: "ghost",
|
|
80
81
|
size: "sm",
|
|
@@ -120,7 +121,7 @@ function R({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: i = !0,
|
|
|
120
121
|
})]
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function Ie(e) {
|
|
124
125
|
let { t, allFields: n, showGroup: r, groupingConfig: i, setGroupingConfig: o, showColor: s, rowColorConfig: c, setRowColorConfig: l, showDensity: u, density: f, showHideFields: p, hiddenFields: m, updateHiddenFields: g } = e, [_, v] = a.useState(!1), S = [
|
|
125
126
|
!!i?.fields?.length,
|
|
126
127
|
!!c?.field,
|
|
@@ -266,7 +267,7 @@ function Pe(e) {
|
|
|
266
267
|
}
|
|
267
268
|
//#endregion
|
|
268
269
|
//#region src/UserFilters.tsx
|
|
269
|
-
function
|
|
270
|
+
function Le() {
|
|
270
271
|
try {
|
|
271
272
|
let { t: e } = be(), t = e("common.more");
|
|
272
273
|
return !t || t === "common.more" ? "More" : t;
|
|
@@ -274,15 +275,15 @@ function z() {
|
|
|
274
275
|
return "More";
|
|
275
276
|
}
|
|
276
277
|
}
|
|
277
|
-
var
|
|
278
|
+
var Re = new Set([
|
|
278
279
|
"lookup",
|
|
279
280
|
"master_detail",
|
|
280
281
|
"user",
|
|
281
282
|
"owner"
|
|
282
283
|
]);
|
|
283
|
-
function
|
|
284
|
+
function ze({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a }) {
|
|
284
285
|
switch (e.element) {
|
|
285
|
-
case "dropdown": return /* @__PURE__ */ P(
|
|
286
|
+
case "dropdown": return /* @__PURE__ */ P(z, {
|
|
286
287
|
fields: e.fields || [],
|
|
287
288
|
objectDef: t,
|
|
288
289
|
data: n,
|
|
@@ -290,14 +291,14 @@ function Ie({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
290
291
|
maxVisible: i,
|
|
291
292
|
className: a
|
|
292
293
|
});
|
|
293
|
-
case "tabs": return /* @__PURE__ */ P(
|
|
294
|
+
case "tabs": return /* @__PURE__ */ P(B, {
|
|
294
295
|
tabs: e.tabs || [],
|
|
295
296
|
showAllRecords: e.showAllRecords !== !1,
|
|
296
297
|
allowAddTab: e.allowAddTab,
|
|
297
298
|
onFilterChange: r,
|
|
298
299
|
className: a
|
|
299
300
|
});
|
|
300
|
-
case "toggle": return /* @__PURE__ */ P(
|
|
301
|
+
case "toggle": return /* @__PURE__ */ P(Ve, {
|
|
301
302
|
fields: e.fields || [],
|
|
302
303
|
onFilterChange: r,
|
|
303
304
|
className: a
|
|
@@ -305,7 +306,7 @@ function Ie({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
305
306
|
default: return null;
|
|
306
307
|
}
|
|
307
308
|
}
|
|
308
|
-
function
|
|
309
|
+
function Be(e, t, n, r) {
|
|
309
310
|
return e.map((e) => {
|
|
310
311
|
let i = e.options ? [...e.options] : [], a = e.type, o, s, c;
|
|
311
312
|
if (t?.fields) {
|
|
@@ -342,13 +343,13 @@ function Le(e, t, n, r) {
|
|
|
342
343
|
};
|
|
343
344
|
});
|
|
344
345
|
}
|
|
345
|
-
function
|
|
346
|
-
let { fieldLabel: s, translateOptions: c } = xe(), l =
|
|
346
|
+
function z({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i, className: o }) {
|
|
347
|
+
let { fieldLabel: s, translateOptions: c } = xe(), l = Le(), u = t?.name, [d, f] = a.useState(() => {
|
|
347
348
|
let t = {};
|
|
348
349
|
return e.forEach((e) => {
|
|
349
350
|
e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
|
|
350
351
|
}), t;
|
|
351
|
-
}), p = a.useMemo(() =>
|
|
352
|
+
}), p = a.useMemo(() => Be(e, t, n, {
|
|
352
353
|
objectName: u,
|
|
353
354
|
fieldLabel: s,
|
|
354
355
|
translateOptions: c
|
|
@@ -376,7 +377,7 @@ function Re({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
376
377
|
Object.values(d).some((e) => e.length > 0) && m(d);
|
|
377
378
|
}, []);
|
|
378
379
|
let g = i !== void 0 && i < p.length ? p.slice(0, i) : p, v = i !== void 0 && i < p.length ? p.slice(i) : [], S = (e) => {
|
|
379
|
-
let t = d[e.field] || [], n = t.length > 0, r =
|
|
380
|
+
let t = d[e.field] || [], n = t.length > 0, r = Re.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), i = r ? "w-72" : "w-56";
|
|
380
381
|
return /* @__PURE__ */ F(y, { children: [/* @__PURE__ */ P(x, {
|
|
381
382
|
asChild: !0,
|
|
382
383
|
children: /* @__PURE__ */ F("button", {
|
|
@@ -488,7 +489,7 @@ function Re({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
488
489
|
})] })] })
|
|
489
490
|
});
|
|
490
491
|
}
|
|
491
|
-
function
|
|
492
|
+
function B({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: i }) {
|
|
492
493
|
let [o, s] = a.useState(() => e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), c = a.useCallback((t) => {
|
|
493
494
|
s(t), r(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []);
|
|
494
495
|
}, [e, r]), l = a.useMemo(() => {
|
|
@@ -514,11 +515,11 @@ function ze({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
|
|
|
514
515
|
className: "inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",
|
|
515
516
|
"data-testid": "filter-tab-add",
|
|
516
517
|
title: "Add filter tab",
|
|
517
|
-
children: /* @__PURE__ */ P(
|
|
518
|
+
children: /* @__PURE__ */ P(M, { className: "h-3.5 w-3.5" })
|
|
518
519
|
})]
|
|
519
520
|
});
|
|
520
521
|
}
|
|
521
|
-
function
|
|
522
|
+
function Ve({ fields: e, onFilterChange: t, className: n }) {
|
|
522
523
|
let [r, i] = a.useState(() => {
|
|
523
524
|
let t = /* @__PURE__ */ new Set();
|
|
524
525
|
return e.forEach((e) => {
|
|
@@ -560,7 +561,7 @@ function B({ fields: e, onFilterChange: t, className: n }) {
|
|
|
560
561
|
}
|
|
561
562
|
//#endregion
|
|
562
563
|
//#region src/ListView.tsx
|
|
563
|
-
function
|
|
564
|
+
function He(e) {
|
|
564
565
|
switch (e) {
|
|
565
566
|
case "equals":
|
|
566
567
|
case "eq": return "=";
|
|
@@ -584,10 +585,10 @@ function V(e) {
|
|
|
584
585
|
default: return e;
|
|
585
586
|
}
|
|
586
587
|
}
|
|
587
|
-
function
|
|
588
|
+
function V(e) {
|
|
588
589
|
if (!Array.isArray(e) || e.length < 3) return e;
|
|
589
590
|
let [t, n, r] = e;
|
|
590
|
-
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ?
|
|
591
|
+
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ? V(e) : e)] : n === "in" && Array.isArray(r) ? r.length === 0 ? [] : r.length === 1 ? [
|
|
591
592
|
t,
|
|
592
593
|
"=",
|
|
593
594
|
r[0]
|
|
@@ -605,15 +606,15 @@ function H(e) {
|
|
|
605
606
|
e
|
|
606
607
|
])] : e;
|
|
607
608
|
}
|
|
608
|
-
function
|
|
609
|
+
function Ue(e) {
|
|
609
610
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
610
611
|
}
|
|
611
|
-
function
|
|
612
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ?
|
|
612
|
+
function We(e) {
|
|
613
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? V(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
|
|
613
614
|
}
|
|
614
|
-
function
|
|
615
|
+
function Ge(e) {
|
|
615
616
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
616
|
-
let t =
|
|
617
|
+
let t = We(e.conditions.map((e) => e.operator === "isEmpty" ? [
|
|
617
618
|
e.field,
|
|
618
619
|
"=",
|
|
619
620
|
null
|
|
@@ -623,12 +624,12 @@ function He(e) {
|
|
|
623
624
|
null
|
|
624
625
|
] : [
|
|
625
626
|
e.field,
|
|
626
|
-
|
|
627
|
+
He(e.operator),
|
|
627
628
|
e.value
|
|
628
629
|
]));
|
|
629
630
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
630
631
|
}
|
|
631
|
-
function
|
|
632
|
+
function H(e, t) {
|
|
632
633
|
if (!t || t.length === 0) return {};
|
|
633
634
|
for (let r of t) {
|
|
634
635
|
let t = !1, i = ("condition" in r ? r.condition : void 0) || ("expression" in r ? r.expression : void 0) || void 0;
|
|
@@ -663,7 +664,7 @@ function Ue(e, t) {
|
|
|
663
664
|
}
|
|
664
665
|
return {};
|
|
665
666
|
}
|
|
666
|
-
var
|
|
667
|
+
var Ke = {
|
|
667
668
|
"list.recordCount": "{{count}} records",
|
|
668
669
|
"list.recordCountOne": "{{count}} record",
|
|
669
670
|
"list.noItems": "No items found",
|
|
@@ -702,32 +703,32 @@ var We = {
|
|
|
702
703
|
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
703
704
|
"list.viewSettings": "View settings",
|
|
704
705
|
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
705
|
-
},
|
|
706
|
-
let n =
|
|
706
|
+
}, qe = (e, t, n) => n, U = (e, t) => {
|
|
707
|
+
let n = Ke[e] || e;
|
|
707
708
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
708
709
|
return n;
|
|
709
710
|
};
|
|
710
|
-
function
|
|
711
|
+
function Je() {
|
|
711
712
|
try {
|
|
712
713
|
let e = be();
|
|
713
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t:
|
|
714
|
+
return e.t("list.recordCount") === "list.recordCount" ? { t: U } : { t: e.t };
|
|
714
715
|
} catch {
|
|
715
|
-
return { t:
|
|
716
|
+
return { t: U };
|
|
716
717
|
}
|
|
717
718
|
}
|
|
718
|
-
function
|
|
719
|
+
function Ye() {
|
|
719
720
|
try {
|
|
720
721
|
let { fieldLabel: e } = ye();
|
|
721
722
|
return { fieldLabel: e };
|
|
722
723
|
} catch {
|
|
723
|
-
return { fieldLabel:
|
|
724
|
+
return { fieldLabel: qe };
|
|
724
725
|
}
|
|
725
726
|
}
|
|
726
|
-
var
|
|
727
|
-
let { t: E } =
|
|
727
|
+
var Xe = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange: s, onSortChange: c, onSearchChange: l, onHiddenFieldsChange: u, onColumnStateChange: f, onRowClick: p, showViewSwitcher: _ = !1, ...w }, ee) => {
|
|
728
|
+
let { t: E } = Je(), { fieldLabel: ne } = Ye(), { translateOptions: D } = xe(), O = a.useMemo(() => e.viewType ? e : {
|
|
728
729
|
...e,
|
|
729
730
|
viewType: "grid"
|
|
730
|
-
}, [e]), k = a.useCallback((e, t) => O.objectName ? ne(O.objectName, e, t) : t, [O.objectName, ne]),
|
|
731
|
+
}, [e]), k = a.useCallback((e, t) => O.objectName ? ne(O.objectName, e, t) : t, [O.objectName, ne]), A = a.useMemo(() => {
|
|
731
732
|
let e = O.userActions, t = O.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
|
|
732
733
|
return {
|
|
733
734
|
showSearch: e?.search === void 0 ? O.showSearch !== !1 : e.search,
|
|
@@ -753,7 +754,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
753
754
|
O.compactToolbar,
|
|
754
755
|
O.addRecord,
|
|
755
756
|
O.userActions?.addRecordForm
|
|
756
|
-
]), [
|
|
757
|
+
]), [j, pe] = a.useState(O.viewType), [N, ye] = a.useState(""), [be, Ce] = a.useState(!1), [we, De] = a.useState(!1), [I, Ae] = a.useState(() => O.sort && O.sort.length > 0 ? O.sort.map((e) => {
|
|
757
758
|
if (typeof e == "string") {
|
|
758
759
|
let t = e.trim().split(/\s+/);
|
|
759
760
|
return {
|
|
@@ -769,7 +770,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
769
770
|
};
|
|
770
771
|
}) : []), je = a.useMemo(() => JSON.stringify(O.sort || []), [O.sort]);
|
|
771
772
|
a.useEffect(() => {
|
|
772
|
-
O.sort && O.sort.length > 0 ?
|
|
773
|
+
O.sort && O.sort.length > 0 ? Ae(O.sort.map((e) => {
|
|
773
774
|
if (typeof e == "string") {
|
|
774
775
|
let t = e.trim().split(/\s+/);
|
|
775
776
|
return {
|
|
@@ -783,41 +784,41 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
783
784
|
field: e.field,
|
|
784
785
|
order: e.order || "asc"
|
|
785
786
|
};
|
|
786
|
-
})) :
|
|
787
|
+
})) : Ae([]);
|
|
787
788
|
}, [je]);
|
|
788
|
-
let [Me,
|
|
789
|
+
let [Me, Pe] = a.useState(!1), [L, R] = a.useState({
|
|
789
790
|
id: "root",
|
|
790
791
|
logic: "and",
|
|
791
792
|
conditions: []
|
|
792
793
|
}), [Le, Re] = a.useState(() => {
|
|
793
794
|
if (!(!O.tabs || O.tabs.length === 0)) return O.tabs.find((e) => e.isDefault)?.name ?? O.tabs[0]?.name;
|
|
794
|
-
}),
|
|
795
|
+
}), Be = a.useCallback((e) => {
|
|
795
796
|
if (Re(e.name), e.filter) {
|
|
796
797
|
let t = {
|
|
797
798
|
id: `tab-filter-${e.name}`,
|
|
798
799
|
logic: e.filter.logic || "and",
|
|
799
800
|
conditions: e.filter.conditions || []
|
|
800
801
|
};
|
|
801
|
-
|
|
802
|
+
R(t), s?.(t);
|
|
802
803
|
} else {
|
|
803
804
|
let e = {
|
|
804
805
|
id: "root",
|
|
805
806
|
logic: "and",
|
|
806
807
|
conditions: []
|
|
807
808
|
};
|
|
808
|
-
|
|
809
|
+
R(e), s?.(e);
|
|
809
810
|
}
|
|
810
|
-
}, [s]),
|
|
811
|
-
a.useImperativeHandle(ee, () => ({ refresh: () =>
|
|
812
|
-
if (!(!
|
|
813
|
-
e.resource === O.objectName &&
|
|
811
|
+
}, [s]), z = w.dataSource, [B, Ve] = a.useState([]), [He, V] = a.useState(!1), [H, Ke] = a.useState(null), [qe, U] = a.useState(!1), [Xe, Ze] = a.useState(0), [Qe, $e] = a.useState(!1);
|
|
812
|
+
a.useImperativeHandle(ee, () => ({ refresh: () => Ze((e) => e + 1) }), []), a.useEffect(() => {
|
|
813
|
+
if (!(!z?.onMutation || !O.objectName || O.refreshTrigger)) return z.onMutation((e) => {
|
|
814
|
+
e.resource === O.objectName && Ze((e) => e + 1);
|
|
814
815
|
});
|
|
815
816
|
}, [
|
|
816
|
-
|
|
817
|
+
z,
|
|
817
818
|
O.objectName,
|
|
818
819
|
O.refreshTrigger
|
|
819
820
|
]);
|
|
820
|
-
let [
|
|
821
|
+
let [et, tt] = a.useState(void 0), nt = et ?? O.pagination?.pageSize ?? 100, W = a.useMemo(() => {
|
|
821
822
|
if (O.grouping?.fields?.length) return O.grouping;
|
|
822
823
|
let e = typeof O.groupBy == "string" ? O.groupBy.trim() : "", t = typeof O.groupBy2 == "string" ? O.groupBy2.trim() : "", n = [];
|
|
823
824
|
return e && n.push({
|
|
@@ -833,24 +834,24 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
833
834
|
O.grouping,
|
|
834
835
|
O.groupBy,
|
|
835
836
|
O.groupBy2
|
|
836
|
-
]), [
|
|
837
|
+
]), [G, rt] = a.useState(W), [it, at] = a.useState(!1), ot = a.useRef(W);
|
|
837
838
|
a.useEffect(() => {
|
|
838
|
-
|
|
839
|
-
}, [
|
|
840
|
-
let [
|
|
839
|
+
ot.current !== W && (ot.current = W, rt(W));
|
|
840
|
+
}, [W]);
|
|
841
|
+
let [K, st] = a.useState(O.rowColor), [ct, lt] = a.useState(!1), [ut, dt] = a.useState([]), ft = a.useRef(0), [pt, mt] = a.useState(() => {
|
|
841
842
|
let e = /* @__PURE__ */ new Set();
|
|
842
843
|
return O.quickFilters?.forEach((t) => {
|
|
843
844
|
let n = r(t);
|
|
844
845
|
n.defaultActive && e.add(n.id);
|
|
845
846
|
}), e;
|
|
846
|
-
}), [
|
|
847
|
+
}), [ht, gt] = a.useState([]), _t = a.useMemo(() => {
|
|
847
848
|
if (O.userFilters) return O.userFilters;
|
|
848
|
-
if (!
|
|
849
|
+
if (!H?.fields) return;
|
|
849
850
|
let e = new Set([
|
|
850
851
|
"select",
|
|
851
852
|
"multi-select",
|
|
852
853
|
"boolean"
|
|
853
|
-
]), t = [], n = Array.isArray(
|
|
854
|
+
]), t = [], n = Array.isArray(H.fields) ? H.fields.map((e) => [e.name, e]) : Object.entries(H.fields);
|
|
854
855
|
for (let [r, i] of n) (e.has(i.type) || i.options && !i.type) && t.push({
|
|
855
856
|
field: r,
|
|
856
857
|
label: k(r, i.label || r),
|
|
@@ -860,65 +861,65 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
860
861
|
element: "dropdown",
|
|
861
862
|
fields: t
|
|
862
863
|
};
|
|
863
|
-
}, [O.userFilters,
|
|
864
|
+
}, [O.userFilters, H]), [q, vt] = a.useState(() => new Set(O.hiddenFields || [])), yt = a.useMemo(() => JSON.stringify(O.hiddenFields || []), [O.hiddenFields]);
|
|
864
865
|
a.useEffect(() => {
|
|
865
|
-
|
|
866
|
-
}, [
|
|
867
|
-
let
|
|
868
|
-
|
|
869
|
-
}, [u]), [
|
|
866
|
+
vt(new Set(O.hiddenFields || []));
|
|
867
|
+
}, [yt]);
|
|
868
|
+
let bt = a.useCallback((e) => {
|
|
869
|
+
vt(e), u?.(Array.from(e));
|
|
870
|
+
}, [u]), [xt, St] = a.useState(!1), [Ct, wt] = a.useState(!1), J = a.useMemo(() => i(O.quickFilters), [O.quickFilters]), Y = a.useMemo(() => {
|
|
870
871
|
if (O.exportOptions) return Array.isArray(O.exportOptions) ? { formats: O.exportOptions } : O.exportOptions;
|
|
871
|
-
}, [O.exportOptions]),
|
|
872
|
+
}, [O.exportOptions]), X = Te(a.useMemo(() => O.densityMode ? O.densityMode : O.rowHeight ? {
|
|
872
873
|
compact: "compact",
|
|
873
874
|
short: "compact",
|
|
874
875
|
medium: "comfortable",
|
|
875
876
|
tall: "spacious",
|
|
876
877
|
extra_tall: "spacious"
|
|
877
|
-
}[O.rowHeight] || "comfortable" : "compact", [O.densityMode, O.rowHeight]), { onChange: O.onDensityChange }),
|
|
878
|
+
}[O.rowHeight] || "comfortable" : "compact", [O.densityMode, O.rowHeight]), { onChange: O.onDensityChange }), Tt = a.useMemo(() => `objectui:gallery:density:${O.objectName ?? "default"}`, [O.objectName]), [Z, Et] = a.useState(() => {
|
|
878
879
|
if (typeof window > "u") return O.gallery?.cardSize ?? "medium";
|
|
879
880
|
try {
|
|
880
|
-
let e = window.localStorage.getItem(
|
|
881
|
+
let e = window.localStorage.getItem(Tt);
|
|
881
882
|
if (e === "small" || e === "medium" || e === "large") return e;
|
|
882
883
|
} catch {}
|
|
883
884
|
return O.gallery?.cardSize ?? "medium";
|
|
884
|
-
}),
|
|
885
|
-
|
|
885
|
+
}), Dt = a.useCallback(() => {
|
|
886
|
+
Et((e) => {
|
|
886
887
|
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
887
888
|
try {
|
|
888
|
-
window.localStorage.setItem(
|
|
889
|
+
window.localStorage.setItem(Tt, t);
|
|
889
890
|
} catch {}
|
|
890
891
|
return t;
|
|
891
892
|
});
|
|
892
|
-
}, [
|
|
893
|
+
}, [Tt]), { ref: Ot, isRefreshing: kt, pullDistance: At } = Oe({
|
|
893
894
|
onRefresh: a.useCallback(async () => {
|
|
894
|
-
|
|
895
|
+
Ze((e) => e + 1);
|
|
895
896
|
}, []),
|
|
896
|
-
enabled: !!
|
|
897
|
-
}),
|
|
897
|
+
enabled: !!z && !!O.objectName
|
|
898
|
+
}), jt = a.useMemo(() => O.id ? `listview-${O.objectName}-${O.id}-view` : `listview-${O.objectName}-view`, [O.objectName, O.id]);
|
|
898
899
|
a.useEffect(() => {
|
|
899
900
|
let e = !0;
|
|
900
|
-
return
|
|
901
|
-
if (!
|
|
902
|
-
|
|
901
|
+
return U(!1), Ke(null), (async () => {
|
|
902
|
+
if (!z || !O.objectName) {
|
|
903
|
+
U(!0);
|
|
903
904
|
return;
|
|
904
905
|
}
|
|
905
|
-
if (typeof
|
|
906
|
-
|
|
906
|
+
if (typeof z.getObjectSchema != "function") {
|
|
907
|
+
U(!0);
|
|
907
908
|
return;
|
|
908
909
|
}
|
|
909
910
|
try {
|
|
910
|
-
let t = await
|
|
911
|
-
e &&
|
|
911
|
+
let t = await z.getObjectSchema(O.objectName);
|
|
912
|
+
e && Ke(t);
|
|
912
913
|
} catch (e) {
|
|
913
914
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
914
915
|
} finally {
|
|
915
|
-
e &&
|
|
916
|
+
e && U(!0);
|
|
916
917
|
}
|
|
917
918
|
})(), () => {
|
|
918
919
|
e = !1;
|
|
919
920
|
};
|
|
920
|
-
}, [O.objectName,
|
|
921
|
-
let
|
|
921
|
+
}, [O.objectName, z]);
|
|
922
|
+
let Mt = a.useMemo(() => {
|
|
922
923
|
let e = Array.isArray(O.fields) ? O.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], n = new Set(e), r = (e) => {
|
|
923
924
|
if (!e) return;
|
|
924
925
|
let t = [
|
|
@@ -945,9 +946,9 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
945
946
|
};
|
|
946
947
|
r(O.kanban), r(O.options?.kanban), r(O.calendar), r(O.options?.calendar), r(O.gallery), r(O.options?.gallery), r(O.timeline), r(O.options?.timeline), r(O.gantt), r(O.options?.gantt);
|
|
947
948
|
let i = n.size > 0 ? Array.from(n) : void 0;
|
|
948
|
-
return t(
|
|
949
|
+
return t(H?.fields, i);
|
|
949
950
|
}, [
|
|
950
|
-
|
|
951
|
+
H?.fields,
|
|
951
952
|
O.fields,
|
|
952
953
|
O.kanban,
|
|
953
954
|
O.calendar,
|
|
@@ -955,9 +956,9 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
955
956
|
O.timeline,
|
|
956
957
|
O.gantt,
|
|
957
958
|
O.options
|
|
958
|
-
]);
|
|
959
|
+
]), Q = ke();
|
|
959
960
|
a.useEffect(() => {
|
|
960
|
-
let e = !0, t = ++
|
|
961
|
+
let e = !0, t = ++ft.current;
|
|
961
962
|
if (O.data && typeof O.data == "object" && !Array.isArray(O.data)) {
|
|
962
963
|
let e = O.data;
|
|
963
964
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
@@ -966,7 +967,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
966
967
|
let e = N.toLowerCase();
|
|
967
968
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
968
969
|
}
|
|
969
|
-
|
|
970
|
+
Ve(t), V(!1), $e(!1);
|
|
970
971
|
return;
|
|
971
972
|
}
|
|
972
973
|
}
|
|
@@ -976,18 +977,18 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
976
977
|
let t = N.toLowerCase();
|
|
977
978
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
978
979
|
}
|
|
979
|
-
|
|
980
|
+
Ve(e), V(!1), $e(!1);
|
|
980
981
|
return;
|
|
981
982
|
}
|
|
982
|
-
return
|
|
983
|
-
if (!(!
|
|
984
|
-
|
|
983
|
+
return qe ? ((async () => {
|
|
984
|
+
if (!(!z || !O.objectName)) {
|
|
985
|
+
V(!0);
|
|
985
986
|
try {
|
|
986
|
-
let n = [], r = O.filters || [], i =
|
|
987
|
-
|
|
988
|
-
|
|
987
|
+
let n = [], r = O.filters || [], i = Ge(L), a = [];
|
|
988
|
+
J && pt.size > 0 && J.forEach((e) => {
|
|
989
|
+
pt.has(e.id) && e.filters && e.filters.length > 0 && a.push(e.filters);
|
|
989
990
|
});
|
|
990
|
-
let o =
|
|
991
|
+
let o = We(ht), s = [
|
|
991
992
|
...r.length > 0 ? [r] : [],
|
|
992
993
|
...i.length > 0 ? [i] : [],
|
|
993
994
|
...a,
|
|
@@ -998,14 +999,14 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
998
999
|
field: e.field,
|
|
999
1000
|
order: e.order
|
|
1000
1001
|
})) : void 0, l = (() => {
|
|
1001
|
-
let e = Array.isArray(O.fields) ? O.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [];
|
|
1002
|
-
if (
|
|
1003
|
-
let
|
|
1004
|
-
for (let
|
|
1005
|
-
for (let e of
|
|
1006
|
-
let
|
|
1002
|
+
let e = Array.isArray(O.fields) ? O.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], t = Q?.isLoaded && O.objectName ? e.filter((e) => Q.checkField(O.objectName, e, "read")) : e;
|
|
1003
|
+
if (t.length === 0) return;
|
|
1004
|
+
let n = new Set(["id"]);
|
|
1005
|
+
for (let e of t) n.add(e);
|
|
1006
|
+
for (let e of Mt) n.add(e);
|
|
1007
|
+
let r = (e) => {
|
|
1007
1008
|
if (!e) return;
|
|
1008
|
-
let
|
|
1009
|
+
let t = [
|
|
1009
1010
|
e.groupField,
|
|
1010
1011
|
e.groupBy,
|
|
1011
1012
|
e.titleField,
|
|
@@ -1025,32 +1026,32 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1025
1026
|
...Array.isArray(e.visibleFields) ? e.visibleFields : [],
|
|
1026
1027
|
...Array.isArray(e.metaFields) ? e.metaFields : []
|
|
1027
1028
|
];
|
|
1028
|
-
for (let e of
|
|
1029
|
+
for (let e of t) typeof e == "string" && e && n.add(e);
|
|
1029
1030
|
};
|
|
1030
|
-
|
|
1031
|
+
r(O.kanban), r(O.options?.kanban), r(O.calendar), r(O.options?.calendar), r(O.gallery), r(O.options?.gallery), r(O.timeline), r(O.options?.timeline);
|
|
1031
1032
|
{
|
|
1032
1033
|
let e = O.timeline ?? O.options?.timeline;
|
|
1033
|
-
e && !Array.isArray(e.metaFields) && (
|
|
1034
|
+
e && !Array.isArray(e.metaFields) && (n.add("status"), n.add("priority"));
|
|
1034
1035
|
}
|
|
1035
|
-
return
|
|
1036
|
-
})(), u = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, d = await
|
|
1036
|
+
return r(O.gantt), r(O.options?.gantt), Array.from(n);
|
|
1037
|
+
})(), u = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, d = await z.find(O.objectName, {
|
|
1037
1038
|
...u ? { $filter: n } : {},
|
|
1038
1039
|
$orderby: c,
|
|
1039
|
-
$top:
|
|
1040
|
+
$top: nt,
|
|
1040
1041
|
...l ? { $select: l } : {},
|
|
1041
|
-
...
|
|
1042
|
+
...Mt.length > 0 ? { $expand: Mt } : {},
|
|
1042
1043
|
...N ? {
|
|
1043
1044
|
$search: N,
|
|
1044
1045
|
...O.searchableFields && O.searchableFields.length > 0 ? { $searchFields: O.searchableFields } : {}
|
|
1045
1046
|
} : {}
|
|
1046
1047
|
});
|
|
1047
|
-
if (!e || t !==
|
|
1048
|
+
if (!e || t !== ft.current) return;
|
|
1048
1049
|
let f = [];
|
|
1049
|
-
Array.isArray(d) ? f = d : d && typeof d == "object" && (Array.isArray(d.data) ? f = d.data : Array.isArray(d.records) ? f = d.records : Array.isArray(d.value) && (f = d.value)),
|
|
1050
|
+
Array.isArray(d) ? f = d : d && typeof d == "object" && (Array.isArray(d.data) ? f = d.data : Array.isArray(d.records) ? f = d.records : Array.isArray(d.value) && (f = d.value)), Ve(f), $e(f.length >= nt);
|
|
1050
1051
|
} catch (e) {
|
|
1051
|
-
t ===
|
|
1052
|
+
t === ft.current && console.error("ListView data fetch error:", e);
|
|
1052
1053
|
} finally {
|
|
1053
|
-
e && t ===
|
|
1054
|
+
e && t === ft.current && V(!1);
|
|
1054
1055
|
}
|
|
1055
1056
|
}
|
|
1056
1057
|
})(), () => {
|
|
@@ -1059,22 +1060,23 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1059
1060
|
}, [
|
|
1060
1061
|
O.objectName,
|
|
1061
1062
|
O.data,
|
|
1062
|
-
|
|
1063
|
+
z,
|
|
1063
1064
|
O.filters,
|
|
1064
|
-
|
|
1065
|
+
nt,
|
|
1065
1066
|
I,
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1067
|
+
L,
|
|
1068
|
+
pt,
|
|
1069
|
+
J,
|
|
1070
|
+
ht,
|
|
1071
|
+
Xe,
|
|
1071
1072
|
N,
|
|
1072
1073
|
O.searchableFields,
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
O.refreshTrigger
|
|
1074
|
+
Mt,
|
|
1075
|
+
qe,
|
|
1076
|
+
O.refreshTrigger,
|
|
1077
|
+
Q
|
|
1076
1078
|
]);
|
|
1077
|
-
let
|
|
1079
|
+
let Nt = a.useMemo(() => {
|
|
1078
1080
|
if (O.appearance?.allowedVisualizations && O.appearance.allowedVisualizations.length > 0) return O.appearance.allowedVisualizations.filter((e) => [
|
|
1079
1081
|
"grid",
|
|
1080
1082
|
"kanban",
|
|
@@ -1107,29 +1109,29 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1107
1109
|
a.useEffect(() => {
|
|
1108
1110
|
O.viewType && pe(O.viewType);
|
|
1109
1111
|
}, [O.viewType]);
|
|
1110
|
-
let
|
|
1112
|
+
let Pt = a.useCallback((e) => {
|
|
1111
1113
|
pe(e);
|
|
1112
1114
|
try {
|
|
1113
|
-
localStorage.setItem(
|
|
1115
|
+
localStorage.setItem(jt, e);
|
|
1114
1116
|
} catch (e) {
|
|
1115
1117
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
1116
1118
|
}
|
|
1117
1119
|
o?.(e);
|
|
1118
|
-
}, [
|
|
1120
|
+
}, [jt, o]), Ft = a.useCallback((e) => {
|
|
1119
1121
|
ye(e), l?.(e);
|
|
1120
|
-
}, [l]),
|
|
1122
|
+
}, [l]), It = Ee({
|
|
1121
1123
|
navigation: O.navigation,
|
|
1122
1124
|
objectName: O.objectName,
|
|
1123
1125
|
onNavigate: O.onNavigate,
|
|
1124
1126
|
onRowClick: p
|
|
1125
|
-
}),
|
|
1127
|
+
}), $ = a.useMemo(() => {
|
|
1126
1128
|
let e = O.fields || [];
|
|
1127
|
-
if (Array.isArray(e) || (e = []),
|
|
1129
|
+
if (Array.isArray(e) || (e = []), Q?.isLoaded && O.objectName && (e = e.filter((e) => {
|
|
1128
1130
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1129
|
-
return t ?
|
|
1130
|
-
})),
|
|
1131
|
+
return t ? Q.checkField(O.objectName, t, "read") : !0;
|
|
1132
|
+
})), q.size > 0 && (e = e.filter((e) => {
|
|
1131
1133
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1132
|
-
return t != null && !
|
|
1134
|
+
return t != null && !q.has(t);
|
|
1133
1135
|
})), O.fieldOrder && O.fieldOrder.length > 0) {
|
|
1134
1136
|
let t = new Map(O.fieldOrder.map((e, t) => [e, t]));
|
|
1135
1137
|
e = [...e].sort((e, n) => {
|
|
@@ -1141,18 +1143,18 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1141
1143
|
}, [
|
|
1142
1144
|
O.fields,
|
|
1143
1145
|
O.objectName,
|
|
1144
|
-
|
|
1146
|
+
q,
|
|
1145
1147
|
O.fieldOrder,
|
|
1146
|
-
|
|
1148
|
+
Q
|
|
1147
1149
|
]), Lt = a.useMemo(() => {
|
|
1148
|
-
let e =
|
|
1150
|
+
let e = X.mode === "compact" ? "compact" : X.mode === "spacious" ? "tall" : "medium", t = {
|
|
1149
1151
|
objectName: O.objectName,
|
|
1150
1152
|
fields: $,
|
|
1151
1153
|
filters: O.filters,
|
|
1152
1154
|
sort: I,
|
|
1153
1155
|
className: "h-full w-full",
|
|
1154
1156
|
showSearch: !1,
|
|
1155
|
-
onRowClick:
|
|
1157
|
+
onRowClick: It.handleClick,
|
|
1156
1158
|
rowHeight: e,
|
|
1157
1159
|
hideRowHeightToggle: !0,
|
|
1158
1160
|
...O.striped == null ? {} : { striped: O.striped },
|
|
@@ -1160,7 +1162,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1160
1162
|
...f ? { onColumnStateChange: f } : {},
|
|
1161
1163
|
...O.columnState ? { columnState: O.columnState } : {}
|
|
1162
1164
|
};
|
|
1163
|
-
switch (
|
|
1165
|
+
switch (j) {
|
|
1164
1166
|
case "grid": return {
|
|
1165
1167
|
type: "object-grid",
|
|
1166
1168
|
...t,
|
|
@@ -1172,8 +1174,8 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1172
1174
|
...O.resizable == null ? {} : { resizable: O.resizable },
|
|
1173
1175
|
...O.selection ? { selection: O.selection } : {},
|
|
1174
1176
|
...O.pagination ? { pagination: O.pagination } : {},
|
|
1175
|
-
...
|
|
1176
|
-
...
|
|
1177
|
+
...G ? { grouping: G } : {},
|
|
1178
|
+
...K ? { rowColor: K } : {},
|
|
1177
1179
|
...O.rowActions ? { rowActions: O.rowActions } : {},
|
|
1178
1180
|
...O.rowActionDefs ? { rowActionDefs: O.rowActionDefs } : {},
|
|
1179
1181
|
...O.bulkActions ? { batchActions: O.bulkActions } : {},
|
|
@@ -1187,7 +1189,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1187
1189
|
groupField: O.kanban?.groupField || O.options?.kanban?.groupField || "status",
|
|
1188
1190
|
...O.kanban?.titleField || O.options?.kanban?.titleField ? { titleField: O.kanban?.titleField || O.options?.kanban?.titleField } : {},
|
|
1189
1191
|
cardFields: O.kanban?.cardFields || $ || [],
|
|
1190
|
-
...
|
|
1192
|
+
...G ? { grouping: G } : {},
|
|
1191
1193
|
...O.options?.kanban || {},
|
|
1192
1194
|
...O.kanban || {}
|
|
1193
1195
|
};
|
|
@@ -1205,7 +1207,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1205
1207
|
let e = {
|
|
1206
1208
|
...O.options?.gallery || {},
|
|
1207
1209
|
...O.gallery || {},
|
|
1208
|
-
cardSize:
|
|
1210
|
+
cardSize: Z
|
|
1209
1211
|
};
|
|
1210
1212
|
return {
|
|
1211
1213
|
type: "object-gallery",
|
|
@@ -1214,7 +1216,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1214
1216
|
imageField: O.gallery?.coverField || O.gallery?.imageField || O.options?.gallery?.imageField,
|
|
1215
1217
|
titleField: O.gallery?.titleField || O.options?.gallery?.titleField || "name",
|
|
1216
1218
|
subtitleField: O.gallery?.subtitleField || O.options?.gallery?.subtitleField,
|
|
1217
|
-
...
|
|
1219
|
+
...G ? { grouping: G } : {}
|
|
1218
1220
|
};
|
|
1219
1221
|
}
|
|
1220
1222
|
case "timeline": {
|
|
@@ -1254,16 +1256,16 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1254
1256
|
default: return t;
|
|
1255
1257
|
}
|
|
1256
1258
|
}, [
|
|
1257
|
-
|
|
1259
|
+
j,
|
|
1258
1260
|
O,
|
|
1259
1261
|
I,
|
|
1260
1262
|
$,
|
|
1263
|
+
G,
|
|
1261
1264
|
K,
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
Z
|
|
1265
|
-
|
|
1266
|
-
]), Rt = z.conditions && z.conditions.length > 0, zt = a.useMemo(() => {
|
|
1265
|
+
It.handleClick,
|
|
1266
|
+
X.mode,
|
|
1267
|
+
Z
|
|
1268
|
+
]), Rt = L.conditions && L.conditions.length > 0, zt = a.useMemo(() => {
|
|
1267
1269
|
let e, t = (e, t) => {
|
|
1268
1270
|
if (!t) return;
|
|
1269
1271
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1277,7 +1279,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1277
1279
|
}));
|
|
1278
1280
|
return O.objectName ? D(O.objectName, e, n) : n;
|
|
1279
1281
|
};
|
|
1280
|
-
if (e =
|
|
1282
|
+
if (e = H?.fields ? Object.entries(H.fields).map(([e, n]) => ({
|
|
1281
1283
|
value: e,
|
|
1282
1284
|
label: k(e, n.label || e),
|
|
1283
1285
|
type: n.type || "text",
|
|
@@ -1307,19 +1309,19 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1307
1309
|
}
|
|
1308
1310
|
return e;
|
|
1309
1311
|
}, [
|
|
1310
|
-
|
|
1312
|
+
H,
|
|
1311
1313
|
O.fields,
|
|
1312
1314
|
O.filterableFields,
|
|
1313
1315
|
O.objectName,
|
|
1314
1316
|
k,
|
|
1315
1317
|
D
|
|
1316
1318
|
]), Bt = a.useCallback((e) => {
|
|
1317
|
-
|
|
1319
|
+
mt((t) => {
|
|
1318
1320
|
let n = new Set(t);
|
|
1319
1321
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1320
1322
|
});
|
|
1321
1323
|
}, []), Vt = a.useCallback((e) => {
|
|
1322
|
-
let t =
|
|
1324
|
+
let t = Y, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || O.objectName || "export", a = n > 0 ? B.slice(0, n) : B;
|
|
1323
1325
|
if (e === "csv") {
|
|
1324
1326
|
let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
|
|
1325
1327
|
r && t.push(e.join(",")), a.forEach((n) => {
|
|
@@ -1334,11 +1336,11 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1334
1336
|
let e = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1335
1337
|
n.href = t, n.download = `${i}.json`, n.click(), URL.revokeObjectURL(t);
|
|
1336
1338
|
}
|
|
1337
|
-
|
|
1339
|
+
wt(!1);
|
|
1338
1340
|
}, [
|
|
1339
|
-
|
|
1341
|
+
B,
|
|
1340
1342
|
$,
|
|
1341
|
-
|
|
1343
|
+
Y,
|
|
1342
1344
|
O.objectName
|
|
1343
1345
|
]), Ht = a.useMemo(() => (O.fields || []).map((e) => {
|
|
1344
1346
|
if (typeof e == "string") return {
|
|
@@ -1352,24 +1354,24 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1352
1354
|
};
|
|
1353
1355
|
}), [O.fields, k]);
|
|
1354
1356
|
return /* @__PURE__ */ F("div", {
|
|
1355
|
-
ref:
|
|
1357
|
+
ref: Ot,
|
|
1356
1358
|
className: C("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1357
1359
|
...O.aria?.label ? { "aria-label": O.aria.label } : {},
|
|
1358
1360
|
...O.aria?.describedBy ? { "aria-describedby": O.aria.describedBy } : {},
|
|
1359
1361
|
...O.aria?.live ? { "aria-live": O.aria.live } : {},
|
|
1360
1362
|
role: "region",
|
|
1361
1363
|
children: [
|
|
1362
|
-
|
|
1364
|
+
At > 0 && /* @__PURE__ */ P("div", {
|
|
1363
1365
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1364
|
-
style: { height:
|
|
1365
|
-
children: E(
|
|
1366
|
+
style: { height: At },
|
|
1367
|
+
children: E(kt ? "list.refreshing" : "list.pullToRefresh")
|
|
1366
1368
|
}),
|
|
1367
1369
|
_ && /* @__PURE__ */ P("div", {
|
|
1368
1370
|
className: "px-4 py-1 flex items-center bg-background",
|
|
1369
|
-
children: /* @__PURE__ */ P(
|
|
1370
|
-
currentView:
|
|
1371
|
-
availableViews:
|
|
1372
|
-
onViewChange:
|
|
1371
|
+
children: /* @__PURE__ */ P(Ne, {
|
|
1372
|
+
currentView: j,
|
|
1373
|
+
availableViews: Nt,
|
|
1374
|
+
onViewChange: Pt
|
|
1373
1375
|
})
|
|
1374
1376
|
}),
|
|
1375
1377
|
O.description && O.appearance?.showDescription !== !1 && /* @__PURE__ */ P("div", {
|
|
@@ -1378,50 +1380,50 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1378
1380
|
children: typeof O.description == "string" ? O.description : ""
|
|
1379
1381
|
}),
|
|
1380
1382
|
/* @__PURE__ */ F("div", {
|
|
1381
|
-
className: "border-b px-2 sm:px-4 py-1 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1383
|
+
className: "border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1382
1384
|
children: [/* @__PURE__ */ F("div", {
|
|
1383
1385
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1384
1386
|
children: [
|
|
1385
|
-
O.tabs && O.tabs.length > 0 && /* @__PURE__ */ P(
|
|
1387
|
+
O.tabs && O.tabs.length > 0 && /* @__PURE__ */ P(Fe, {
|
|
1386
1388
|
tabs: O.tabs,
|
|
1387
1389
|
activeTab: Le,
|
|
1388
|
-
onTabChange:
|
|
1390
|
+
onTabChange: Be,
|
|
1389
1391
|
className: "!px-0 !py-0 shrink-0"
|
|
1390
1392
|
}),
|
|
1391
|
-
O.tabs && O.tabs.length > 0 &&
|
|
1392
|
-
|
|
1393
|
+
O.tabs && O.tabs.length > 0 && _t && /* @__PURE__ */ P("div", { className: "h-4 w-px bg-border/60 mx-1 shrink-0" }),
|
|
1394
|
+
_t && /* @__PURE__ */ P("div", {
|
|
1393
1395
|
className: "shrink-0 min-w-0",
|
|
1394
1396
|
"data-testid": "user-filters",
|
|
1395
|
-
children: /* @__PURE__ */ P(
|
|
1396
|
-
config:
|
|
1397
|
-
objectDef:
|
|
1398
|
-
data:
|
|
1399
|
-
onFilterChange:
|
|
1397
|
+
children: /* @__PURE__ */ P(ze, {
|
|
1398
|
+
config: _t,
|
|
1399
|
+
objectDef: H,
|
|
1400
|
+
data: B,
|
|
1401
|
+
onFilterChange: gt,
|
|
1400
1402
|
maxVisible: 3
|
|
1401
1403
|
})
|
|
1402
1404
|
})
|
|
1403
1405
|
]
|
|
1404
1406
|
}), /* @__PURE__ */ F("div", {
|
|
1405
|
-
className: "flex items-center gap-0 shrink-0",
|
|
1407
|
+
className: "flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm",
|
|
1406
1408
|
children: [
|
|
1407
|
-
|
|
1408
|
-
open:
|
|
1409
|
-
onOpenChange:
|
|
1409
|
+
A.showHideFields && !A.compactToolbar && /* @__PURE__ */ F(y, {
|
|
1410
|
+
open: xt,
|
|
1411
|
+
onOpenChange: St,
|
|
1410
1412
|
children: [/* @__PURE__ */ P(x, {
|
|
1411
1413
|
asChild: !0,
|
|
1412
1414
|
children: /* @__PURE__ */ F(d, {
|
|
1413
1415
|
variant: "ghost",
|
|
1414
1416
|
size: "sm",
|
|
1415
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1417
|
+
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", q.size > 0 && "text-primary"),
|
|
1416
1418
|
children: [
|
|
1417
1419
|
/* @__PURE__ */ P(ie, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1418
1420
|
/* @__PURE__ */ P("span", {
|
|
1419
1421
|
className: "hidden sm:inline",
|
|
1420
1422
|
children: E("list.hideFields")
|
|
1421
1423
|
}),
|
|
1422
|
-
|
|
1424
|
+
q.size > 0 && /* @__PURE__ */ P("span", {
|
|
1423
1425
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1424
|
-
children:
|
|
1426
|
+
children: q.size
|
|
1425
1427
|
})
|
|
1426
1428
|
]
|
|
1427
1429
|
})
|
|
@@ -1435,11 +1437,11 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1435
1437
|
children: [/* @__PURE__ */ P("h4", {
|
|
1436
1438
|
className: "font-medium text-sm",
|
|
1437
1439
|
children: E("list.hideFieldsTitle")
|
|
1438
|
-
}),
|
|
1440
|
+
}), q.size > 0 && /* @__PURE__ */ P(d, {
|
|
1439
1441
|
variant: "ghost",
|
|
1440
1442
|
size: "sm",
|
|
1441
1443
|
className: "h-6 px-2 text-xs",
|
|
1442
|
-
onClick: () =>
|
|
1444
|
+
onClick: () => bt(/* @__PURE__ */ new Set()),
|
|
1443
1445
|
children: E("list.showAll")
|
|
1444
1446
|
})]
|
|
1445
1447
|
}), /* @__PURE__ */ P("div", {
|
|
@@ -1448,10 +1450,10 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1448
1450
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1449
1451
|
children: [/* @__PURE__ */ P("input", {
|
|
1450
1452
|
type: "checkbox",
|
|
1451
|
-
checked: !
|
|
1453
|
+
checked: !q.has(e.name),
|
|
1452
1454
|
onChange: () => {
|
|
1453
|
-
let t = new Set(
|
|
1454
|
-
t.has(e.name) ? t.delete(e.name) : t.add(e.name),
|
|
1455
|
+
let t = new Set(q);
|
|
1456
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), bt(t);
|
|
1455
1457
|
},
|
|
1456
1458
|
className: "rounded border-input"
|
|
1457
1459
|
}), /* @__PURE__ */ P("span", {
|
|
@@ -1463,10 +1465,10 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1463
1465
|
})
|
|
1464
1466
|
})]
|
|
1465
1467
|
}),
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
+
A.showHideFields && !A.compactToolbar && (A.showFilters || A.showSort || A.showGroup) && /* @__PURE__ */ P("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1469
|
+
A.showFilters && /* @__PURE__ */ F(y, {
|
|
1468
1470
|
open: Me,
|
|
1469
|
-
onOpenChange:
|
|
1471
|
+
onOpenChange: Pe,
|
|
1470
1472
|
children: [/* @__PURE__ */ P(x, {
|
|
1471
1473
|
asChild: !0,
|
|
1472
1474
|
children: /* @__PURE__ */ F(d, {
|
|
@@ -1481,7 +1483,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1481
1483
|
}),
|
|
1482
1484
|
Rt && /* @__PURE__ */ P("span", {
|
|
1483
1485
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1484
|
-
children:
|
|
1486
|
+
children: L.conditions?.length || 0
|
|
1485
1487
|
})
|
|
1486
1488
|
]
|
|
1487
1489
|
})
|
|
@@ -1498,32 +1500,32 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1498
1500
|
})
|
|
1499
1501
|
}), /* @__PURE__ */ P(m, {
|
|
1500
1502
|
fields: zt,
|
|
1501
|
-
value:
|
|
1503
|
+
value: L,
|
|
1502
1504
|
onChange: (e) => {
|
|
1503
|
-
|
|
1505
|
+
R(e), s && s(e);
|
|
1504
1506
|
}
|
|
1505
1507
|
})]
|
|
1506
1508
|
})
|
|
1507
1509
|
})]
|
|
1508
1510
|
}),
|
|
1509
|
-
|
|
1510
|
-
open:
|
|
1511
|
-
onOpenChange:
|
|
1511
|
+
A.showGroup && !A.compactToolbar && /* @__PURE__ */ F(y, {
|
|
1512
|
+
open: it,
|
|
1513
|
+
onOpenChange: at,
|
|
1512
1514
|
children: [/* @__PURE__ */ P(x, {
|
|
1513
1515
|
asChild: !0,
|
|
1514
1516
|
children: /* @__PURE__ */ F(d, {
|
|
1515
1517
|
variant: "ghost",
|
|
1516
1518
|
size: "sm",
|
|
1517
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1519
|
+
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", G && "text-foreground font-medium"),
|
|
1518
1520
|
children: [
|
|
1519
1521
|
/* @__PURE__ */ P(ae, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1520
1522
|
/* @__PURE__ */ P("span", {
|
|
1521
1523
|
className: "hidden sm:inline",
|
|
1522
1524
|
children: E("list.group")
|
|
1523
1525
|
}),
|
|
1524
|
-
|
|
1526
|
+
G && G.fields?.length > 0 && /* @__PURE__ */ P("span", {
|
|
1525
1527
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1526
|
-
children:
|
|
1528
|
+
children: G.fields.length
|
|
1527
1529
|
})
|
|
1528
1530
|
]
|
|
1529
1531
|
})
|
|
@@ -1537,35 +1539,35 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1537
1539
|
children: [/* @__PURE__ */ P("h4", {
|
|
1538
1540
|
className: "font-medium text-sm",
|
|
1539
1541
|
children: E("list.groupBy")
|
|
1540
|
-
}),
|
|
1542
|
+
}), G && /* @__PURE__ */ P(d, {
|
|
1541
1543
|
variant: "ghost",
|
|
1542
1544
|
size: "sm",
|
|
1543
1545
|
className: "h-6 px-2 text-xs",
|
|
1544
|
-
onClick: () =>
|
|
1546
|
+
onClick: () => rt(void 0),
|
|
1545
1547
|
"data-testid": "clear-grouping",
|
|
1546
1548
|
children: E("list.clear")
|
|
1547
1549
|
})]
|
|
1548
1550
|
}), /* @__PURE__ */ P("div", {
|
|
1549
1551
|
"data-testid": "group-field-list",
|
|
1550
1552
|
children: /* @__PURE__ */ P(h, {
|
|
1551
|
-
value:
|
|
1553
|
+
value: G,
|
|
1552
1554
|
fieldOptions: Ht.map((e) => ({
|
|
1553
1555
|
value: e.name,
|
|
1554
1556
|
label: e.label || e.name
|
|
1555
1557
|
})),
|
|
1556
1558
|
maxLevels: 3,
|
|
1557
1559
|
labels: {
|
|
1558
|
-
addGroup: E("list.addGroup", "Add group field"),
|
|
1559
|
-
collapseTitle: E("list.collapsedByDefault", "Collapsed by default"),
|
|
1560
|
-
removeTitle: E("list.removeGroup", "Remove")
|
|
1560
|
+
addGroup: E("list.addGroup", { defaultValue: "Add group field" }),
|
|
1561
|
+
collapseTitle: E("list.collapsedByDefault", { defaultValue: "Collapsed by default" }),
|
|
1562
|
+
removeTitle: E("list.removeGroup", { defaultValue: "Remove" })
|
|
1561
1563
|
},
|
|
1562
|
-
onChange: (e) =>
|
|
1564
|
+
onChange: (e) => rt(e)
|
|
1563
1565
|
})
|
|
1564
1566
|
})]
|
|
1565
1567
|
})
|
|
1566
1568
|
})]
|
|
1567
1569
|
}),
|
|
1568
|
-
|
|
1570
|
+
A.showSort && /* @__PURE__ */ F(y, {
|
|
1569
1571
|
open: we,
|
|
1570
1572
|
onOpenChange: De,
|
|
1571
1573
|
children: [/* @__PURE__ */ P(x, {
|
|
@@ -1601,23 +1603,23 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1601
1603
|
fields: zt,
|
|
1602
1604
|
value: I,
|
|
1603
1605
|
onChange: (e) => {
|
|
1604
|
-
|
|
1606
|
+
Ae(e), c && c(e);
|
|
1605
1607
|
}
|
|
1606
1608
|
})]
|
|
1607
1609
|
})
|
|
1608
1610
|
})]
|
|
1609
1611
|
}),
|
|
1610
|
-
!
|
|
1611
|
-
|
|
1612
|
-
open:
|
|
1613
|
-
onOpenChange:
|
|
1612
|
+
!A.compactToolbar && (A.showFilters || A.showSort || A.showGroup) && (A.showColor || A.showDensity) && /* @__PURE__ */ P("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1613
|
+
A.showColor && !A.compactToolbar && /* @__PURE__ */ F(y, {
|
|
1614
|
+
open: ct,
|
|
1615
|
+
onOpenChange: lt,
|
|
1614
1616
|
children: [/* @__PURE__ */ P(x, {
|
|
1615
1617
|
asChild: !0,
|
|
1616
1618
|
children: /* @__PURE__ */ F(d, {
|
|
1617
1619
|
variant: "ghost",
|
|
1618
1620
|
size: "sm",
|
|
1619
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1620
|
-
children: [/* @__PURE__ */ P(
|
|
1621
|
+
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", K && "text-foreground font-medium"),
|
|
1622
|
+
children: [/* @__PURE__ */ P(se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
|
|
1621
1623
|
className: "hidden sm:inline",
|
|
1622
1624
|
children: E("list.color")
|
|
1623
1625
|
})]
|
|
@@ -1632,11 +1634,11 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1632
1634
|
children: [/* @__PURE__ */ P("h4", {
|
|
1633
1635
|
className: "font-medium text-sm",
|
|
1634
1636
|
children: E("list.rowColor")
|
|
1635
|
-
}),
|
|
1637
|
+
}), K && /* @__PURE__ */ P(d, {
|
|
1636
1638
|
variant: "ghost",
|
|
1637
1639
|
size: "sm",
|
|
1638
1640
|
className: "h-6 px-2 text-xs",
|
|
1639
|
-
onClick: () =>
|
|
1641
|
+
onClick: () => st(void 0),
|
|
1640
1642
|
"data-testid": "clear-row-color",
|
|
1641
1643
|
children: E("list.clear")
|
|
1642
1644
|
})]
|
|
@@ -1648,12 +1650,12 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1648
1650
|
children: E("list.colorByField")
|
|
1649
1651
|
}), /* @__PURE__ */ F("select", {
|
|
1650
1652
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1651
|
-
value:
|
|
1653
|
+
value: K?.field || "",
|
|
1652
1654
|
onChange: (e) => {
|
|
1653
1655
|
let t = e.target.value;
|
|
1654
|
-
|
|
1656
|
+
st(t ? {
|
|
1655
1657
|
field: t,
|
|
1656
|
-
colors:
|
|
1658
|
+
colors: K?.colors || {}
|
|
1657
1659
|
} : void 0);
|
|
1658
1660
|
},
|
|
1659
1661
|
"data-testid": "color-field-select",
|
|
@@ -1669,8 +1671,8 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1669
1671
|
})
|
|
1670
1672
|
})]
|
|
1671
1673
|
}),
|
|
1672
|
-
|
|
1673
|
-
let e =
|
|
1674
|
+
A.showDensity && !A.compactToolbar && j !== "gallery" && (() => {
|
|
1675
|
+
let e = X.mode === "compact" ? de : X.mode === "comfortable" ? ue : le, t = X.mode === "compact" ? E("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : X.mode === "comfortable" ? E("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : E("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${E("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = E("grid.toolbar.densityCycleHint", {
|
|
1674
1676
|
defaultValue: "{{label}} (click to cycle)",
|
|
1675
1677
|
label: n
|
|
1676
1678
|
});
|
|
@@ -1678,14 +1680,14 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1678
1680
|
variant: "ghost",
|
|
1679
1681
|
size: "sm",
|
|
1680
1682
|
"aria-label": n,
|
|
1681
|
-
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1682
|
-
onClick:
|
|
1683
|
+
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", X.mode !== "compact" && "text-foreground font-medium"),
|
|
1684
|
+
onClick: X.cycle,
|
|
1683
1685
|
title: r,
|
|
1684
1686
|
children: /* @__PURE__ */ P(e, { className: "h-3.5 w-3.5" })
|
|
1685
1687
|
});
|
|
1686
1688
|
})(),
|
|
1687
|
-
|
|
1688
|
-
let e =
|
|
1689
|
+
A.showDensity && !A.compactToolbar && j === "gallery" && (() => {
|
|
1690
|
+
let e = Z === "small" ? de : Z === "medium" ? ue : le, t = Z === "small" ? E("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Z === "medium" ? E("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : E("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${E("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = E("grid.toolbar.densityCycleHint", {
|
|
1689
1691
|
defaultValue: "{{label}} (click to cycle)",
|
|
1690
1692
|
label: n
|
|
1691
1693
|
});
|
|
@@ -1693,31 +1695,31 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1693
1695
|
variant: "ghost",
|
|
1694
1696
|
size: "sm",
|
|
1695
1697
|
"aria-label": n,
|
|
1696
|
-
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1697
|
-
onClick:
|
|
1698
|
+
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Z !== "small" && "text-foreground font-medium"),
|
|
1699
|
+
onClick: Dt,
|
|
1698
1700
|
title: r,
|
|
1699
1701
|
children: /* @__PURE__ */ P(e, { className: "h-3.5 w-3.5" })
|
|
1700
1702
|
});
|
|
1701
1703
|
})(),
|
|
1702
|
-
|
|
1704
|
+
A.compactToolbar && (A.showGroup || A.showColor || A.showDensity || A.showHideFields) && /* @__PURE__ */ P(Ie, {
|
|
1703
1705
|
t: E,
|
|
1704
1706
|
allFields: Ht,
|
|
1705
|
-
showGroup:
|
|
1706
|
-
groupingConfig:
|
|
1707
|
-
setGroupingConfig:
|
|
1708
|
-
showColor:
|
|
1709
|
-
rowColorConfig:
|
|
1710
|
-
setRowColorConfig:
|
|
1711
|
-
showDensity:
|
|
1712
|
-
density:
|
|
1713
|
-
showHideFields:
|
|
1714
|
-
hiddenFields:
|
|
1715
|
-
updateHiddenFields:
|
|
1707
|
+
showGroup: A.showGroup,
|
|
1708
|
+
groupingConfig: G,
|
|
1709
|
+
setGroupingConfig: rt,
|
|
1710
|
+
showColor: A.showColor,
|
|
1711
|
+
rowColorConfig: K,
|
|
1712
|
+
setRowColorConfig: st,
|
|
1713
|
+
showDensity: A.showDensity,
|
|
1714
|
+
density: X,
|
|
1715
|
+
showHideFields: A.showHideFields,
|
|
1716
|
+
hiddenFields: q,
|
|
1717
|
+
updateHiddenFields: bt
|
|
1716
1718
|
}),
|
|
1717
|
-
(
|
|
1718
|
-
|
|
1719
|
-
open:
|
|
1720
|
-
onOpenChange:
|
|
1719
|
+
(A.showColor || A.showDensity || A.compactToolbar) && Y && O.allowExport !== !1 && /* @__PURE__ */ P("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1720
|
+
Y && O.allowExport !== !1 && /* @__PURE__ */ F(y, {
|
|
1721
|
+
open: Ct,
|
|
1722
|
+
onOpenChange: wt,
|
|
1721
1723
|
children: [/* @__PURE__ */ P(x, {
|
|
1722
1724
|
asChild: !0,
|
|
1723
1725
|
children: /* @__PURE__ */ F(d, {
|
|
@@ -1734,7 +1736,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1734
1736
|
className: "w-48 p-2",
|
|
1735
1737
|
children: /* @__PURE__ */ P("div", {
|
|
1736
1738
|
className: "space-y-1",
|
|
1737
|
-
children: (
|
|
1739
|
+
children: (Y.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ F(d, {
|
|
1738
1740
|
variant: "ghost",
|
|
1739
1741
|
size: "sm",
|
|
1740
1742
|
className: "w-full justify-start h-8 text-xs",
|
|
@@ -1767,10 +1769,10 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1767
1769
|
})]
|
|
1768
1770
|
}),
|
|
1769
1771
|
(() => {
|
|
1770
|
-
let e = O.allowPrinting || O.sharing?.enabled || O.sharing?.type ||
|
|
1771
|
-
return
|
|
1772
|
+
let e = O.allowPrinting || O.sharing?.enabled || O.sharing?.type || Y && O.allowExport !== !1;
|
|
1773
|
+
return A.showSearch && e ? /* @__PURE__ */ P("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }) : null;
|
|
1772
1774
|
})(),
|
|
1773
|
-
|
|
1775
|
+
A.showSearch && /* @__PURE__ */ F(y, {
|
|
1774
1776
|
open: be,
|
|
1775
1777
|
onOpenChange: Ce,
|
|
1776
1778
|
children: [/* @__PURE__ */ P(x, {
|
|
@@ -1794,7 +1796,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1794
1796
|
/* @__PURE__ */ P(g, {
|
|
1795
1797
|
placeholder: E("list.search") + "...",
|
|
1796
1798
|
value: N,
|
|
1797
|
-
onChange: (e) =>
|
|
1799
|
+
onChange: (e) => Ft(e.target.value),
|
|
1798
1800
|
className: "pl-7 h-8 text-xs",
|
|
1799
1801
|
autoFocus: !0
|
|
1800
1802
|
}),
|
|
@@ -1802,20 +1804,20 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1802
1804
|
variant: "ghost",
|
|
1803
1805
|
size: "sm",
|
|
1804
1806
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
1805
|
-
onClick: () =>
|
|
1807
|
+
onClick: () => Ft(""),
|
|
1806
1808
|
children: /* @__PURE__ */ P(_e, { className: "h-3 w-3" })
|
|
1807
1809
|
})
|
|
1808
1810
|
]
|
|
1809
1811
|
})
|
|
1810
1812
|
})]
|
|
1811
1813
|
}),
|
|
1812
|
-
|
|
1814
|
+
A.showAddRecord && A.addRecordPosition === "top" && /* @__PURE__ */ F(d, {
|
|
1813
1815
|
variant: "ghost",
|
|
1814
1816
|
size: "sm",
|
|
1815
1817
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1816
1818
|
"data-testid": "add-record-button",
|
|
1817
1819
|
onClick: () => w.onAddRecord?.(),
|
|
1818
|
-
children: [/* @__PURE__ */ P(
|
|
1820
|
+
children: [/* @__PURE__ */ P(M, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
|
|
1819
1821
|
className: "hidden sm:inline",
|
|
1820
1822
|
children: E("list.addRecord")
|
|
1821
1823
|
})]
|
|
@@ -1823,11 +1825,11 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1823
1825
|
]
|
|
1824
1826
|
})]
|
|
1825
1827
|
}),
|
|
1826
|
-
|
|
1828
|
+
J && J.length > 0 && /* @__PURE__ */ P("div", {
|
|
1827
1829
|
className: "border-b px-2 sm:px-4 py-1 flex items-center gap-1 flex-wrap bg-background",
|
|
1828
1830
|
"data-testid": "quick-filters",
|
|
1829
|
-
children:
|
|
1830
|
-
let t =
|
|
1831
|
+
children: J.map((e) => {
|
|
1832
|
+
let t = pt.has(e.id), n = e.icon ? ve[e.icon.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
1831
1833
|
return /* @__PURE__ */ F(d, {
|
|
1832
1834
|
variant: t ? "default" : "outline",
|
|
1833
1835
|
size: "sm",
|
|
@@ -1839,13 +1841,13 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1839
1841
|
}),
|
|
1840
1842
|
/* @__PURE__ */ P("div", {
|
|
1841
1843
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
1842
|
-
children: !
|
|
1844
|
+
children: !He && B.length === 0 && j === "grid" ? (() => {
|
|
1843
1845
|
let e = O.emptyState?.icon;
|
|
1844
1846
|
return /* @__PURE__ */ F("div", {
|
|
1845
1847
|
className: "flex flex-col items-center justify-center h-full min-h-[200px] text-center p-8",
|
|
1846
1848
|
"data-testid": "empty-state",
|
|
1847
1849
|
children: [
|
|
1848
|
-
/* @__PURE__ */ P(e ? ve[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ??
|
|
1850
|
+
/* @__PURE__ */ P(e ? ve[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? oe : oe, { className: "h-12 w-12 text-muted-foreground/50 mb-4" }),
|
|
1849
1851
|
/* @__PURE__ */ P("h3", {
|
|
1850
1852
|
className: "text-lg font-medium text-foreground mb-1",
|
|
1851
1853
|
children: (typeof O.emptyState?.title == "string" ? O.emptyState.title : void 0) ?? E("list.noItems")
|
|
@@ -1854,25 +1856,25 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1854
1856
|
className: "text-sm text-muted-foreground max-w-md",
|
|
1855
1857
|
children: (typeof O.emptyState?.message == "string" ? O.emptyState.message : void 0) ?? E("list.noItemsMessage")
|
|
1856
1858
|
}),
|
|
1857
|
-
|
|
1859
|
+
A.showAddRecord && /* @__PURE__ */ F(d, {
|
|
1858
1860
|
variant: "default",
|
|
1859
1861
|
size: "sm",
|
|
1860
1862
|
className: "mt-4",
|
|
1861
1863
|
"data-testid": "empty-state-add-record",
|
|
1862
1864
|
onClick: () => w.onAddRecord?.(),
|
|
1863
|
-
children: [/* @__PURE__ */ P(
|
|
1865
|
+
children: [/* @__PURE__ */ P(M, { className: "h-4 w-4 mr-1.5" }), E("list.addRecord")]
|
|
1864
1866
|
})
|
|
1865
1867
|
]
|
|
1866
1868
|
});
|
|
1867
1869
|
})() : /* @__PURE__ */ P(Se, {
|
|
1868
1870
|
schema: Lt,
|
|
1869
1871
|
...w,
|
|
1870
|
-
data:
|
|
1871
|
-
loading:
|
|
1872
|
-
onRowSelect:
|
|
1872
|
+
data: B,
|
|
1873
|
+
loading: He,
|
|
1874
|
+
onRowSelect: dt
|
|
1873
1875
|
})
|
|
1874
|
-
},
|
|
1875
|
-
|
|
1876
|
+
}, j),
|
|
1877
|
+
A.showAddRecord && A.addRecordPosition === "bottom" && /* @__PURE__ */ P("div", {
|
|
1876
1878
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
1877
1879
|
children: /* @__PURE__ */ F(d, {
|
|
1878
1880
|
variant: "ghost",
|
|
@@ -1880,13 +1882,13 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1880
1882
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1881
1883
|
"data-testid": "add-record-button",
|
|
1882
1884
|
onClick: () => w.onAddRecord?.(),
|
|
1883
|
-
children: [/* @__PURE__ */ P(
|
|
1885
|
+
children: [/* @__PURE__ */ P(M, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
|
|
1884
1886
|
className: "hidden sm:inline",
|
|
1885
1887
|
children: E("list.addRecord")
|
|
1886
1888
|
})]
|
|
1887
1889
|
})
|
|
1888
1890
|
}),
|
|
1889
|
-
O.bulkActions && O.bulkActions.length > 0 &&
|
|
1891
|
+
O.bulkActions && O.bulkActions.length > 0 && ut.length > 0 && j !== "grid" && /* @__PURE__ */ F("div", {
|
|
1890
1892
|
className: "border-t border-primary/30 px-4 py-2 flex items-center gap-2 text-xs bg-primary/10 text-foreground shrink-0 shadow-sm",
|
|
1891
1893
|
role: "region",
|
|
1892
1894
|
"aria-label": "Bulk actions",
|
|
@@ -1896,9 +1898,9 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1896
1898
|
/* @__PURE__ */ F("span", {
|
|
1897
1899
|
className: "font-medium",
|
|
1898
1900
|
children: [
|
|
1899
|
-
|
|
1901
|
+
ut.length,
|
|
1900
1902
|
" ",
|
|
1901
|
-
|
|
1903
|
+
ut.length === 1 ? "item" : "items",
|
|
1902
1904
|
" selected"
|
|
1903
1905
|
]
|
|
1904
1906
|
}),
|
|
@@ -1910,9 +1912,9 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1910
1912
|
variant: n ? "destructive" : "outline",
|
|
1911
1913
|
size: "sm",
|
|
1912
1914
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
1913
|
-
onClick: () => w.onBulkAction?.(e,
|
|
1915
|
+
onClick: () => w.onBulkAction?.(e, ut),
|
|
1914
1916
|
"data-testid": `bulk-action-${e}`,
|
|
1915
|
-
children: [r && /* @__PURE__ */ P(r, { className: "h-3 w-3" }),
|
|
1917
|
+
children: [r && /* @__PURE__ */ P(r, { className: "h-3 w-3" }), Ue(e)]
|
|
1916
1918
|
}, e);
|
|
1917
1919
|
})
|
|
1918
1920
|
}),
|
|
@@ -1920,33 +1922,33 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1920
1922
|
variant: "ghost",
|
|
1921
1923
|
size: "sm",
|
|
1922
1924
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
1923
|
-
onClick: () =>
|
|
1925
|
+
onClick: () => dt([]),
|
|
1924
1926
|
children: [/* @__PURE__ */ P(_e, { className: "h-3 w-3" }), "Clear"]
|
|
1925
1927
|
})
|
|
1926
1928
|
]
|
|
1927
1929
|
}),
|
|
1928
|
-
!
|
|
1930
|
+
!He && B.length > 0 && O.showRecordCount !== !1 && /* @__PURE__ */ F("div", {
|
|
1929
1931
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
1930
1932
|
"data-testid": "record-count-bar",
|
|
1931
1933
|
children: [
|
|
1932
1934
|
/* @__PURE__ */ P("span", {
|
|
1933
1935
|
className: "font-medium text-foreground/80",
|
|
1934
|
-
children:
|
|
1936
|
+
children: B.length === 1 ? E("list.recordCountOne", { count: B.length }) : E("list.recordCount", { count: B.length })
|
|
1935
1937
|
}),
|
|
1936
|
-
|
|
1938
|
+
Qe && /* @__PURE__ */ P("span", {
|
|
1937
1939
|
className: "text-amber-600",
|
|
1938
1940
|
"data-testid": "data-limit-warning",
|
|
1939
|
-
children: E("list.dataLimitReached", { limit:
|
|
1941
|
+
children: E("list.dataLimitReached", { limit: nt })
|
|
1940
1942
|
}),
|
|
1941
1943
|
O.pagination?.pageSizeOptions && O.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ F("div", {
|
|
1942
1944
|
className: "ml-auto flex items-center gap-2",
|
|
1943
1945
|
children: [/* @__PURE__ */ P("span", { children: E("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ P("select", {
|
|
1944
1946
|
"data-testid": "page-size-selector",
|
|
1945
1947
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
1946
|
-
value: String(
|
|
1948
|
+
value: String(nt),
|
|
1947
1949
|
onChange: (e) => {
|
|
1948
1950
|
let t = Number(e.target.value);
|
|
1949
|
-
|
|
1951
|
+
tt(t), w.onPageSizeChange && w.onPageSizeChange(t);
|
|
1950
1952
|
},
|
|
1951
1953
|
children: O.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ P("option", {
|
|
1952
1954
|
value: String(e),
|
|
@@ -1956,8 +1958,8 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1956
1958
|
})
|
|
1957
1959
|
]
|
|
1958
1960
|
}),
|
|
1959
|
-
|
|
1960
|
-
...
|
|
1961
|
+
It.isOverlay && /* @__PURE__ */ P(v, {
|
|
1962
|
+
...It,
|
|
1961
1963
|
title: O.label ? `${O.label} Detail` : O.objectName ? `${O.objectName.charAt(0).toUpperCase() + O.objectName.slice(1)} Detail` : "Record Detail",
|
|
1962
1964
|
children: (e) => /* @__PURE__ */ P("div", {
|
|
1963
1965
|
className: "space-y-3",
|
|
@@ -1976,58 +1978,74 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1976
1978
|
]
|
|
1977
1979
|
});
|
|
1978
1980
|
});
|
|
1979
|
-
|
|
1981
|
+
Xe.displayName = "ListView";
|
|
1980
1982
|
//#endregion
|
|
1981
1983
|
//#region src/ObjectGallery.tsx
|
|
1982
|
-
var
|
|
1984
|
+
var Ze = {
|
|
1983
1985
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
1984
1986
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
1985
1987
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
1986
|
-
},
|
|
1988
|
+
}, Qe = {
|
|
1987
1989
|
small: "aspect-square",
|
|
1988
1990
|
medium: "aspect-[4/3]",
|
|
1989
1991
|
large: "aspect-[16/10]"
|
|
1990
|
-
},
|
|
1992
|
+
}, $e = [
|
|
1993
|
+
{
|
|
1994
|
+
bg: "from-indigo-500/15 via-indigo-500/5 to-purple-500/10",
|
|
1995
|
+
ring: "ring-indigo-500/15",
|
|
1996
|
+
text: "text-indigo-600/70 dark:text-indigo-300/70"
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
bg: "from-sky-500/15 via-sky-500/5 to-cyan-500/10",
|
|
2000
|
+
ring: "ring-sky-500/15",
|
|
2001
|
+
text: "text-sky-600/70 dark:text-sky-300/70"
|
|
2002
|
+
},
|
|
2003
|
+
{
|
|
2004
|
+
bg: "from-emerald-500/15 via-emerald-500/5 to-teal-500/10",
|
|
2005
|
+
ring: "ring-emerald-500/15",
|
|
2006
|
+
text: "text-emerald-600/70 dark:text-emerald-300/70"
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
bg: "from-amber-500/15 via-amber-500/5 to-orange-500/10",
|
|
2010
|
+
ring: "ring-amber-500/15",
|
|
2011
|
+
text: "text-amber-600/70 dark:text-amber-300/70"
|
|
2012
|
+
},
|
|
2013
|
+
{
|
|
2014
|
+
bg: "from-rose-500/15 via-rose-500/5 to-pink-500/10",
|
|
2015
|
+
ring: "ring-rose-500/15",
|
|
2016
|
+
text: "text-rose-600/70 dark:text-rose-300/70"
|
|
2017
|
+
},
|
|
2018
|
+
{
|
|
2019
|
+
bg: "from-violet-500/15 via-violet-500/5 to-fuchsia-500/10",
|
|
2020
|
+
ring: "ring-violet-500/15",
|
|
2021
|
+
text: "text-violet-600/70 dark:text-violet-300/70"
|
|
2022
|
+
}
|
|
2023
|
+
];
|
|
2024
|
+
function et(e) {
|
|
2025
|
+
let t = 5381;
|
|
2026
|
+
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n);
|
|
2027
|
+
return $e[Math.abs(t) % $e.length];
|
|
2028
|
+
}
|
|
2029
|
+
var tt = (e) => {
|
|
1991
2030
|
let { schema: n } = e, r = s(Ce), i = e.dataSource || r?.dataSource, a = we(n.bind), [d, m] = u([]), [h, g] = u(!1), [_, y] = u(null), b = Ee({
|
|
1992
2031
|
navigation: n.navigation,
|
|
1993
2032
|
objectName: n.objectName,
|
|
1994
2033
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
1995
|
-
}), x = n.gallery, S = x?.coverField ?? n.imageField ?? "image", w = x?.coverFit ?? "cover", T = x?.cardSize ?? "medium", ee = x?.titleField ?? n.titleField ?? "name", te = x?.visibleFields, { fieldOptionLabel: re } = De(), ie = o((e
|
|
1996
|
-
|
|
1997
|
-
if (
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
if (Array.isArray(r.options)) {
|
|
2002
|
-
let e = r.options.find((e) => String(e?.value ?? e) === String(t));
|
|
2003
|
-
e && (i = e.label ?? i);
|
|
2004
|
-
} else if (r.options && typeof r.options == "object") {
|
|
2005
|
-
let e = r.options[String(t)];
|
|
2006
|
-
e && (i = e.label ?? i);
|
|
2007
|
-
}
|
|
2008
|
-
return re(n.objectName, e, String(t), i);
|
|
2009
|
-
}
|
|
2010
|
-
let a = typeof t == "number" ? t : Number(t);
|
|
2011
|
-
if (Number.isFinite(a)) {
|
|
2012
|
-
if (i === "currency") {
|
|
2013
|
-
let e = r?.currency || r?.options?.currency || "USD";
|
|
2014
|
-
try {
|
|
2015
|
-
return new Intl.NumberFormat(void 0, {
|
|
2016
|
-
style: "currency",
|
|
2017
|
-
currency: e,
|
|
2018
|
-
maximumFractionDigits: 0
|
|
2019
|
-
}).format(a);
|
|
2020
|
-
} catch {
|
|
2021
|
-
return new Intl.NumberFormat().format(a);
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
if (i === "percent") return new Intl.NumberFormat(void 0, {
|
|
2025
|
-
style: "percent",
|
|
2026
|
-
maximumFractionDigits: 2
|
|
2027
|
-
}).format(a > 1 ? a / 100 : a);
|
|
2028
|
-
if (i === "number") return new Intl.NumberFormat().format(a);
|
|
2034
|
+
}), x = n.gallery, S = x?.coverField ?? n.imageField ?? "image", w = x?.coverFit ?? "cover", T = x?.cardSize ?? "medium", ee = x?.titleField ?? n.titleField ?? "name", te = x?.visibleFields, { fieldOptionLabel: re } = De(), ie = o((e) => {
|
|
2035
|
+
let t = _?.fields?.[e], r = { name: e };
|
|
2036
|
+
if (t) {
|
|
2037
|
+
t.type && (r.type = t.type), t.label && (r.label = t.label), t.options && (r.options = t.options), t.currency && (r.currency = t.currency), t.precision !== void 0 && (r.precision = t.precision), t.format && (r.format = t.format);
|
|
2038
|
+
let e = t.reference_to || t.reference;
|
|
2039
|
+
e && (r.reference_to = e), t.reference_field && (r.reference_field = t.reference_field);
|
|
2029
2040
|
}
|
|
2030
|
-
return
|
|
2041
|
+
return n.objectName && Array.isArray(r.options) && (r.options = r.options.map((t) => {
|
|
2042
|
+
let r = String(t?.value ?? t), i = String(t?.label ?? r);
|
|
2043
|
+
return {
|
|
2044
|
+
...t,
|
|
2045
|
+
value: r,
|
|
2046
|
+
label: re(n.objectName, e, r, i)
|
|
2047
|
+
};
|
|
2048
|
+
})), r;
|
|
2031
2049
|
}, [
|
|
2032
2050
|
_,
|
|
2033
2051
|
n.objectName,
|
|
@@ -2083,13 +2101,13 @@ var Je = {
|
|
|
2083
2101
|
e.data,
|
|
2084
2102
|
_
|
|
2085
2103
|
]);
|
|
2086
|
-
let D = e.data || a || n.data || d || [], O = l(() => D.some((e) => typeof e[S] == "string" && !!e[S]), [D, S]), ae = !!x?.coverField || O, k = n.grouping?.fields,
|
|
2087
|
-
|
|
2104
|
+
let D = e.data || a || n.data || d || [], O = l(() => D.some((e) => typeof e[S] == "string" && !!e[S]), [D, S]), ae = !!x?.coverField || O, k = n.grouping?.fields, oe = !!(k && k.length > 0), [A, j] = u({}), se = l(() => k ? k.some((e) => e.collapsed) : !1, [k]), M = o((e) => {
|
|
2105
|
+
j((t) => ({
|
|
2088
2106
|
...t,
|
|
2089
|
-
[e]: t[e] === void 0 ? !
|
|
2107
|
+
[e]: t[e] === void 0 ? !se : !t[e]
|
|
2090
2108
|
}));
|
|
2091
|
-
}, [
|
|
2092
|
-
if (!
|
|
2109
|
+
}, [se]), ce = l(() => {
|
|
2110
|
+
if (!oe || !k) return [];
|
|
2093
2111
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
2094
2112
|
for (let n of D) {
|
|
2095
2113
|
let r = k.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
@@ -2113,7 +2131,7 @@ var Je = {
|
|
|
2113
2131
|
});
|
|
2114
2132
|
return n === "desc" ? -r : r;
|
|
2115
2133
|
}), t.map((t) => {
|
|
2116
|
-
let n = e.get(t), r = t in
|
|
2134
|
+
let n = e.get(t), r = t in A ? A[t] : se;
|
|
2117
2135
|
return {
|
|
2118
2136
|
key: t,
|
|
2119
2137
|
label: n.label,
|
|
@@ -2124,9 +2142,9 @@ var Je = {
|
|
|
2124
2142
|
}, [
|
|
2125
2143
|
D,
|
|
2126
2144
|
k,
|
|
2145
|
+
oe,
|
|
2127
2146
|
A,
|
|
2128
|
-
|
|
2129
|
-
oe
|
|
2147
|
+
se
|
|
2130
2148
|
]);
|
|
2131
2149
|
if (h && !D.length) return /* @__PURE__ */ P("div", {
|
|
2132
2150
|
className: "p-4 text-sm text-muted-foreground",
|
|
@@ -2137,56 +2155,71 @@ var Je = {
|
|
|
2137
2155
|
children: "No items to display"
|
|
2138
2156
|
});
|
|
2139
2157
|
let le = (t, r) => {
|
|
2140
|
-
let i = t.id ?? t._id ?? r, a = String(t[ee] ?? "Untitled"), o = t[S];
|
|
2158
|
+
let i = t.id ?? t._id ?? r, a = String(t[ee] ?? "Untitled"), o = t[S], s = et(String(i) + "|" + a);
|
|
2141
2159
|
return /* @__PURE__ */ F(f, {
|
|
2142
2160
|
role: "listitem",
|
|
2143
|
-
className: C("group overflow-hidden transition-all hover:shadow-
|
|
2144
|
-
onClick: () => b.handleClick(t),
|
|
2145
|
-
children: [
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
className: C("
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2161
|
+
className: C("group relative overflow-hidden border-border/60 bg-card", "transition-all duration-200 ease-out", "hover:shadow-lg hover:border-border hover:-translate-y-0.5", (e.onCardClick || e.onRowClick || n.navigation) && "cursor-pointer"),
|
|
2162
|
+
onClick: (e) => b.handleClick(t, e),
|
|
2163
|
+
children: [
|
|
2164
|
+
!ae && /* @__PURE__ */ P("div", {
|
|
2165
|
+
"aria-hidden": !0,
|
|
2166
|
+
className: C("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", s.bg)
|
|
2167
|
+
}),
|
|
2168
|
+
/* @__PURE__ */ P("div", {
|
|
2169
|
+
className: C("w-full overflow-hidden relative", Qe[T]),
|
|
2170
|
+
hidden: !ae,
|
|
2171
|
+
children: o ? /* @__PURE__ */ P("img", {
|
|
2172
|
+
src: o,
|
|
2173
|
+
alt: a,
|
|
2174
|
+
className: C("h-full w-full transition-transform duration-300 ease-out group-hover:scale-[1.04]", w === "cover" && "object-cover", w === "contain" && "object-contain")
|
|
2175
|
+
}) : /* @__PURE__ */ P("div", {
|
|
2176
|
+
className: C("flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset", s.bg, s.ring),
|
|
2177
|
+
children: /* @__PURE__ */ P("span", {
|
|
2178
|
+
className: C("text-5xl font-semibold tracking-tight opacity-90", s.text),
|
|
2179
|
+
children: a[0]?.toUpperCase()
|
|
2180
|
+
})
|
|
2157
2181
|
})
|
|
2182
|
+
}),
|
|
2183
|
+
/* @__PURE__ */ F(p, {
|
|
2184
|
+
className: C("p-3", ae && "border-t border-border/60"),
|
|
2185
|
+
children: [/* @__PURE__ */ P("h3", {
|
|
2186
|
+
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2187
|
+
title: a,
|
|
2188
|
+
children: a
|
|
2189
|
+
}), te && te.length > 0 && /* @__PURE__ */ P("div", {
|
|
2190
|
+
className: "mt-1.5 space-y-1",
|
|
2191
|
+
children: te.map((e) => {
|
|
2192
|
+
let n = t[e];
|
|
2193
|
+
if (n == null || n === "") return null;
|
|
2194
|
+
let r = ie(e);
|
|
2195
|
+
return /* @__PURE__ */ P("div", {
|
|
2196
|
+
className: "text-xs text-muted-foreground truncate [&_*]:!text-xs",
|
|
2197
|
+
onClick: (e) => {
|
|
2198
|
+
e.target.closest("a,button") && e.stopPropagation();
|
|
2199
|
+
},
|
|
2200
|
+
children: /* @__PURE__ */ P(I(Ae(r) || r.type || "text"), {
|
|
2201
|
+
value: n,
|
|
2202
|
+
field: r
|
|
2203
|
+
})
|
|
2204
|
+
}, e);
|
|
2205
|
+
})
|
|
2206
|
+
})]
|
|
2158
2207
|
})
|
|
2159
|
-
|
|
2160
|
-
className: C("p-3", ae && "border-t"),
|
|
2161
|
-
children: [/* @__PURE__ */ P("h3", {
|
|
2162
|
-
className: "font-medium truncate text-sm",
|
|
2163
|
-
title: a,
|
|
2164
|
-
children: a
|
|
2165
|
-
}), te && te.length > 0 && /* @__PURE__ */ P("div", {
|
|
2166
|
-
className: "mt-1 space-y-0.5",
|
|
2167
|
-
children: te.map((e) => {
|
|
2168
|
-
let n = t[e];
|
|
2169
|
-
return n == null || n === "" ? null : /* @__PURE__ */ P("p", {
|
|
2170
|
-
className: "text-xs text-muted-foreground truncate",
|
|
2171
|
-
children: ie(e, n)
|
|
2172
|
-
}, e);
|
|
2173
|
-
})
|
|
2174
|
-
})]
|
|
2175
|
-
})]
|
|
2208
|
+
]
|
|
2176
2209
|
}, i);
|
|
2177
2210
|
}, ue = (e) => /* @__PURE__ */ P("div", {
|
|
2178
|
-
className: C("grid gap-4 p-4 auto-rows-min content-start",
|
|
2211
|
+
className: C("grid gap-4 p-4 auto-rows-min content-start", Ze[T], n.className),
|
|
2179
2212
|
role: "list",
|
|
2180
2213
|
children: e.map((e, t) => le(e, t))
|
|
2181
2214
|
});
|
|
2182
|
-
return /* @__PURE__ */ F(N, { children: [
|
|
2215
|
+
return /* @__PURE__ */ F(N, { children: [oe ? /* @__PURE__ */ P("div", {
|
|
2183
2216
|
className: "space-y-2",
|
|
2184
2217
|
children: ce.map((e) => /* @__PURE__ */ F("div", {
|
|
2185
2218
|
className: "border rounded-md",
|
|
2186
2219
|
children: [/* @__PURE__ */ F("button", {
|
|
2187
2220
|
type: "button",
|
|
2188
2221
|
className: "flex w-full items-center gap-2 px-3 py-2 text-sm font-medium text-left bg-muted/50 hover:bg-muted transition-colors",
|
|
2189
|
-
onClick: () =>
|
|
2222
|
+
onClick: () => M(e.key),
|
|
2190
2223
|
children: [
|
|
2191
2224
|
e.collapsed ? /* @__PURE__ */ P(ne, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ P(E, { className: "h-4 w-4 shrink-0" }),
|
|
2192
2225
|
/* @__PURE__ */ P("span", { children: e.label }),
|
|
@@ -2215,11 +2248,11 @@ var Je = {
|
|
|
2215
2248
|
})
|
|
2216
2249
|
})] });
|
|
2217
2250
|
};
|
|
2218
|
-
e.register("object-gallery",
|
|
2251
|
+
e.register("object-gallery", tt, {
|
|
2219
2252
|
namespace: "plugin-list",
|
|
2220
2253
|
label: "Gallery View",
|
|
2221
2254
|
category: "view"
|
|
2222
|
-
}), e.register("list-view",
|
|
2255
|
+
}), e.register("list-view", Xe, {
|
|
2223
2256
|
namespace: "plugin-list",
|
|
2224
2257
|
label: "List View",
|
|
2225
2258
|
category: "Views",
|
|
@@ -2296,7 +2329,7 @@ e.register("object-gallery", Xe, {
|
|
|
2296
2329
|
sort: [],
|
|
2297
2330
|
options: {}
|
|
2298
2331
|
}
|
|
2299
|
-
}), e.register("list",
|
|
2332
|
+
}), e.register("list", Xe, {
|
|
2300
2333
|
namespace: "view",
|
|
2301
2334
|
category: "view",
|
|
2302
2335
|
label: "List",
|
|
@@ -2367,4 +2400,4 @@ e.register("object-gallery", Xe, {
|
|
|
2367
2400
|
]
|
|
2368
2401
|
});
|
|
2369
2402
|
//#endregion
|
|
2370
|
-
export {
|
|
2403
|
+
export { Xe as ListView, tt as ObjectGallery, Fe as TabBar, ze as UserFilters, Ne as ViewSwitcher, H as evaluateConditionalFormatting, V as normalizeFilterCondition, We as normalizeFilters };
|