@object-ui/plugin-list 5.0.2 → 5.1.1
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 +10 -0
- package/dist/index.js +382 -373
- package/dist/index.umd.cjs +2 -2
- package/dist/packages/plugin-list/src/ListView.d.ts.map +1 -1
- package/package.json +16 -16
package/dist/index.js
CHANGED
|
@@ -2,23 +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, DropdownMenu as m, DropdownMenuContent as h, DropdownMenuItem as g, DropdownMenuTrigger as _, FilterBuilder as v, GroupingEditor as ee, Input as y, LookupValuePicker as b, NavigationOverlay as te, Popover as x, PopoverContent as S, PopoverTrigger as C, RefreshIndicator as ne, SortBuilder as re, cn as w } from "@object-ui/components";
|
|
5
|
-
import { Activity as ie, ArrowUpDown as T, Calendar as
|
|
5
|
+
import { Activity as ie, ArrowUpDown as T, Calendar as ae, CheckSquare as oe, ChevronDown as E, ChevronRight as D, Download as O, EyeOff as se, GanttChartSquare as ce, Grid as k, Group as le, Images as A, Inbox as ue, LayoutGrid as de, Map as j, Paintbrush as fe, Plus as pe, Printer as me, Rows2 as he, Rows3 as ge, Rows4 as _e, Search as ve, Settings2 as ye, Share2 as be, SlidersHorizontal as xe, Trash2 as Se, X as Ce, icons as we } from "lucide-react";
|
|
6
6
|
import { Fragment as Te, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
7
7
|
import { useObjectLabel as Ee, useObjectTranslation as De, useSafeFieldLabel as Oe } from "@object-ui/i18n";
|
|
8
|
-
import { SchemaRenderer as ke, SchemaRendererContext as
|
|
8
|
+
import { SchemaRenderer as ke, SchemaRendererContext as Ae, useDataScope as je, useDensityMode as Me, useNavigationOverlay as Ne, useSafeFieldLabel as P } from "@object-ui/react";
|
|
9
9
|
import { usePullToRefresh as Pe } from "@object-ui/mobile";
|
|
10
10
|
import { usePermissions as Fe } from "@object-ui/permissions";
|
|
11
11
|
import { getCellRenderer as Ie, resolveCellRendererType as Le } from "@object-ui/fields";
|
|
12
12
|
//#region src/ViewSwitcher.tsx
|
|
13
|
-
var
|
|
14
|
-
grid: /* @__PURE__ */ M(
|
|
15
|
-
kanban: /* @__PURE__ */ M(
|
|
16
|
-
gallery: /* @__PURE__ */ M(
|
|
17
|
-
calendar: /* @__PURE__ */ M(
|
|
13
|
+
var Re = {
|
|
14
|
+
grid: /* @__PURE__ */ M(k, { className: "h-4 w-4" }),
|
|
15
|
+
kanban: /* @__PURE__ */ M(de, { className: "h-4 w-4" }),
|
|
16
|
+
gallery: /* @__PURE__ */ M(A, { className: "h-4 w-4" }),
|
|
17
|
+
calendar: /* @__PURE__ */ M(ae, { className: "h-4 w-4" }),
|
|
18
18
|
timeline: /* @__PURE__ */ M(ie, { className: "h-4 w-4" }),
|
|
19
|
-
gantt: /* @__PURE__ */ M(
|
|
20
|
-
map: /* @__PURE__ */ M(
|
|
21
|
-
},
|
|
19
|
+
gantt: /* @__PURE__ */ M(ce, { className: "h-4 w-4" }),
|
|
20
|
+
map: /* @__PURE__ */ M(j, { className: "h-4 w-4" })
|
|
21
|
+
}, ze = {
|
|
22
22
|
grid: "Grid",
|
|
23
23
|
kanban: "Kanban",
|
|
24
24
|
gallery: "Gallery",
|
|
@@ -26,7 +26,7 @@ var F = {
|
|
|
26
26
|
timeline: "Timeline",
|
|
27
27
|
gantt: "Gantt",
|
|
28
28
|
map: "Map"
|
|
29
|
-
},
|
|
29
|
+
}, Be = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
|
|
30
30
|
let o = a.useCallback((t) => {
|
|
31
31
|
if (!i || t === e) {
|
|
32
32
|
n(t);
|
|
@@ -45,14 +45,14 @@ var F = {
|
|
|
45
45
|
return /* @__PURE__ */ N("button", {
|
|
46
46
|
type: "button",
|
|
47
47
|
onClick: () => o(t),
|
|
48
|
-
"aria-label":
|
|
49
|
-
title:
|
|
48
|
+
"aria-label": ze[t],
|
|
49
|
+
title: ze[t],
|
|
50
50
|
"aria-pressed": n,
|
|
51
51
|
"data-state": n ? "on" : "off",
|
|
52
52
|
className: w("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"),
|
|
53
|
-
children: [
|
|
53
|
+
children: [Re[t], /* @__PURE__ */ M("span", {
|
|
54
54
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
55
|
-
children:
|
|
55
|
+
children: ze[t]
|
|
56
56
|
})]
|
|
57
57
|
}, t);
|
|
58
58
|
})
|
|
@@ -60,14 +60,14 @@ var F = {
|
|
|
60
60
|
};
|
|
61
61
|
//#endregion
|
|
62
62
|
//#region src/components/TabBar.tsx
|
|
63
|
-
function
|
|
63
|
+
function F(e) {
|
|
64
64
|
return e ? we[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Ve(e) {
|
|
67
67
|
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
let i = a.useMemo(() =>
|
|
69
|
+
var He = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
70
|
+
let i = a.useMemo(() => Ve(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) => {
|
|
71
71
|
c(e.name), n?.(e);
|
|
72
72
|
}, [n]);
|
|
73
73
|
return i.length === 0 ? null : /* @__PURE__ */ M("div", {
|
|
@@ -75,7 +75,7 @@ var Ve = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
75
75
|
"data-testid": "view-tabs",
|
|
76
76
|
role: "tablist",
|
|
77
77
|
children: i.map((e) => {
|
|
78
|
-
let t =
|
|
78
|
+
let t = F(e.icon), n = l === e.name;
|
|
79
79
|
return /* @__PURE__ */ N(d, {
|
|
80
80
|
variant: "ghost",
|
|
81
81
|
size: "sm",
|
|
@@ -88,12 +88,12 @@ var Ve = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
88
88
|
}, e.name);
|
|
89
89
|
})
|
|
90
90
|
});
|
|
91
|
-
},
|
|
92
|
-
let i = a.useMemo(() =>
|
|
91
|
+
}, Ue = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
92
|
+
let i = a.useMemo(() => Ve(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.useMemo(() => i.find((e) => e.name === l) ?? i[0], [i, l]), f = a.useCallback((e) => {
|
|
93
93
|
c(e.name), n?.(e);
|
|
94
94
|
}, [n]);
|
|
95
95
|
if (i.length === 0) return null;
|
|
96
|
-
let p =
|
|
96
|
+
let p = F(u?.icon);
|
|
97
97
|
return /* @__PURE__ */ M("div", {
|
|
98
98
|
className: w("px-2 py-1", r),
|
|
99
99
|
"data-testid": "view-tabs-select",
|
|
@@ -110,14 +110,14 @@ var Ve = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
110
110
|
className: "truncate",
|
|
111
111
|
children: u?.label ?? ""
|
|
112
112
|
}),
|
|
113
|
-
/* @__PURE__ */ M(
|
|
113
|
+
/* @__PURE__ */ M(E, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
114
114
|
]
|
|
115
115
|
})
|
|
116
116
|
}), /* @__PURE__ */ M(h, {
|
|
117
117
|
align: "start",
|
|
118
118
|
className: "w-56 max-h-72 overflow-y-auto",
|
|
119
119
|
children: i.map((e) => {
|
|
120
|
-
let t =
|
|
120
|
+
let t = F(e.icon);
|
|
121
121
|
return /* @__PURE__ */ N(g, {
|
|
122
122
|
onClick: () => f(e),
|
|
123
123
|
className: w("text-sm", l === e.name && "font-medium bg-muted"),
|
|
@@ -133,7 +133,7 @@ var Ve = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
133
133
|
};
|
|
134
134
|
//#endregion
|
|
135
135
|
//#region src/components/ViewSettingsPopover.tsx
|
|
136
|
-
function
|
|
136
|
+
function I({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: i = !0, children: o }) {
|
|
137
137
|
let [s, c] = a.useState(i);
|
|
138
138
|
return /* @__PURE__ */ N("div", {
|
|
139
139
|
className: "border-b last:border-b-0",
|
|
@@ -144,7 +144,7 @@ function L({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: i = !0,
|
|
|
144
144
|
onClick: () => c((e) => !e),
|
|
145
145
|
className: "flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground",
|
|
146
146
|
children: [
|
|
147
|
-
/* @__PURE__ */ M(
|
|
147
|
+
/* @__PURE__ */ M(E, { className: w("h-3.5 w-3.5 transition-transform", !s && "-rotate-90") }),
|
|
148
148
|
e,
|
|
149
149
|
typeof t == "number" && t > 0 && /* @__PURE__ */ M("span", {
|
|
150
150
|
className: "ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 px-1 text-[10px] text-primary tabular-nums",
|
|
@@ -163,7 +163,7 @@ function L({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: i = !0,
|
|
|
163
163
|
})]
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function We(e) {
|
|
167
167
|
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: h } = e, [g, _] = a.useState(!1), v = [
|
|
168
168
|
!!i?.fields?.length,
|
|
169
169
|
!!c?.field,
|
|
@@ -209,7 +209,7 @@ function Ue(e) {
|
|
|
209
209
|
children: t("list.viewSettingsHint", { defaultValue: "Grouping, color, density, and visible fields." })
|
|
210
210
|
})]
|
|
211
211
|
}),
|
|
212
|
-
r && o && /* @__PURE__ */ M(
|
|
212
|
+
r && o && /* @__PURE__ */ M(I, {
|
|
213
213
|
title: t("list.group", { defaultValue: "Group" }),
|
|
214
214
|
badge: i?.fields?.length || 0,
|
|
215
215
|
onClear: i ? () => o(void 0) : void 0,
|
|
@@ -229,7 +229,7 @@ function Ue(e) {
|
|
|
229
229
|
onChange: (e) => o(e)
|
|
230
230
|
})
|
|
231
231
|
}),
|
|
232
|
-
s && l && /* @__PURE__ */ N(
|
|
232
|
+
s && l && /* @__PURE__ */ N(I, {
|
|
233
233
|
title: t("list.color", { defaultValue: "Row color" }),
|
|
234
234
|
onClear: c ? () => l(void 0) : void 0,
|
|
235
235
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
@@ -257,7 +257,7 @@ function Ue(e) {
|
|
|
257
257
|
}, e.name))]
|
|
258
258
|
})]
|
|
259
259
|
}),
|
|
260
|
-
u && f && /* @__PURE__ */ M(
|
|
260
|
+
u && f && /* @__PURE__ */ M(I, {
|
|
261
261
|
title: t("grid.toolbar.densityMode", { defaultValue: "Density" }),
|
|
262
262
|
defaultOpen: f.mode !== "compact",
|
|
263
263
|
children: /* @__PURE__ */ N("div", {
|
|
@@ -278,7 +278,7 @@ function Ue(e) {
|
|
|
278
278
|
})]
|
|
279
279
|
})
|
|
280
280
|
}),
|
|
281
|
-
p && m && h && /* @__PURE__ */ M(
|
|
281
|
+
p && m && h && /* @__PURE__ */ M(I, {
|
|
282
282
|
title: t("list.hideFieldsTitle", { defaultValue: "Hide fields" }),
|
|
283
283
|
badge: m.size,
|
|
284
284
|
onClear: m.size > 0 ? () => h(/* @__PURE__ */ new Set()) : void 0,
|
|
@@ -309,7 +309,7 @@ function Ue(e) {
|
|
|
309
309
|
}
|
|
310
310
|
//#endregion
|
|
311
311
|
//#region src/UserFilters.tsx
|
|
312
|
-
function
|
|
312
|
+
function Ge() {
|
|
313
313
|
try {
|
|
314
314
|
let { t: e } = De(), t = e("common.more");
|
|
315
315
|
return !t || t === "common.more" ? "More" : t;
|
|
@@ -317,15 +317,15 @@ function R() {
|
|
|
317
317
|
return "More";
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
-
var
|
|
320
|
+
var Ke = new Set([
|
|
321
321
|
"lookup",
|
|
322
322
|
"master_detail",
|
|
323
323
|
"user",
|
|
324
324
|
"owner"
|
|
325
325
|
]);
|
|
326
|
-
function
|
|
326
|
+
function qe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a }) {
|
|
327
327
|
switch (e.element) {
|
|
328
|
-
case "dropdown": return /* @__PURE__ */ M(
|
|
328
|
+
case "dropdown": return /* @__PURE__ */ M(R, {
|
|
329
329
|
fields: e.fields || [],
|
|
330
330
|
objectDef: t,
|
|
331
331
|
data: n,
|
|
@@ -333,14 +333,14 @@ function We({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
333
333
|
maxVisible: i,
|
|
334
334
|
className: a
|
|
335
335
|
});
|
|
336
|
-
case "tabs": return /* @__PURE__ */ M(
|
|
336
|
+
case "tabs": return /* @__PURE__ */ M(Je, {
|
|
337
337
|
tabs: e.tabs || [],
|
|
338
338
|
showAllRecords: e.showAllRecords !== !1,
|
|
339
339
|
allowAddTab: e.allowAddTab,
|
|
340
340
|
onFilterChange: r,
|
|
341
341
|
className: a
|
|
342
342
|
});
|
|
343
|
-
case "toggle": return /* @__PURE__ */ M(
|
|
343
|
+
case "toggle": return /* @__PURE__ */ M(z, {
|
|
344
344
|
fields: e.fields || [],
|
|
345
345
|
onFilterChange: r,
|
|
346
346
|
className: a
|
|
@@ -348,7 +348,7 @@ function We({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
348
348
|
default: return null;
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function L(e, t, n, r) {
|
|
352
352
|
return e.map((e) => {
|
|
353
353
|
let i = e.options ? [...e.options] : [], a = e.type, o, s, c;
|
|
354
354
|
if (t?.fields) {
|
|
@@ -385,13 +385,13 @@ function Ge(e, t, n, r) {
|
|
|
385
385
|
};
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
-
function
|
|
389
|
-
let { fieldLabel: s, translateOptions: c } = Oe(), l =
|
|
388
|
+
function R({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i, className: o }) {
|
|
389
|
+
let { fieldLabel: s, translateOptions: c } = Oe(), l = Ge(), u = t?.name, [d, f] = a.useState(() => {
|
|
390
390
|
let t = {};
|
|
391
391
|
return e.forEach((e) => {
|
|
392
392
|
e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
|
|
393
393
|
}), t;
|
|
394
|
-
}), p = a.useMemo(() =>
|
|
394
|
+
}), p = a.useMemo(() => L(e, t, n, {
|
|
395
395
|
objectName: u,
|
|
396
396
|
fieldLabel: s,
|
|
397
397
|
translateOptions: c
|
|
@@ -419,7 +419,7 @@ function B({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i,
|
|
|
419
419
|
Object.values(d).some((e) => e.length > 0) && m(d);
|
|
420
420
|
}, []);
|
|
421
421
|
let g = i !== void 0 && i < p.length ? p.slice(0, i) : p, _ = i !== void 0 && i < p.length ? p.slice(i) : [], v = (e) => {
|
|
422
|
-
let t = d[e.field] || [], n = t.length > 0, r =
|
|
422
|
+
let t = d[e.field] || [], n = t.length > 0, r = Ke.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), i = r ? "w-72" : "w-56";
|
|
423
423
|
return /* @__PURE__ */ N(x, { children: [/* @__PURE__ */ M(C, {
|
|
424
424
|
asChild: !0,
|
|
425
425
|
children: /* @__PURE__ */ N("button", {
|
|
@@ -440,7 +440,7 @@ function B({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i,
|
|
|
440
440
|
onClick: (t) => {
|
|
441
441
|
t.stopPropagation(), h(e.field, []);
|
|
442
442
|
}
|
|
443
|
-
}) : /* @__PURE__ */ M(
|
|
443
|
+
}) : /* @__PURE__ */ M(E, { className: "h-3 w-3 opacity-60" })
|
|
444
444
|
]
|
|
445
445
|
})
|
|
446
446
|
}), /* @__PURE__ */ M(S, {
|
|
@@ -517,7 +517,7 @@ function B({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i,
|
|
|
517
517
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
518
518
|
children: _.length
|
|
519
519
|
}),
|
|
520
|
-
/* @__PURE__ */ M(
|
|
520
|
+
/* @__PURE__ */ M(E, { className: "h-3 w-3 opacity-60" })
|
|
521
521
|
]
|
|
522
522
|
})
|
|
523
523
|
}), /* @__PURE__ */ M(S, {
|
|
@@ -531,7 +531,7 @@ function B({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i,
|
|
|
531
531
|
})] })] })
|
|
532
532
|
});
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function Je({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: i }) {
|
|
535
535
|
let [o, s] = a.useState(() => e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), c = a.useCallback((t) => {
|
|
536
536
|
s(t), r(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []);
|
|
537
537
|
}, [e, r]), l = a.useMemo(() => {
|
|
@@ -561,7 +561,7 @@ function V({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, clas
|
|
|
561
561
|
})]
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function z({ fields: e, onFilterChange: t, className: n }) {
|
|
565
565
|
let [r, i] = a.useState(() => {
|
|
566
566
|
let t = /* @__PURE__ */ new Set();
|
|
567
567
|
return e.forEach((e) => {
|
|
@@ -603,7 +603,7 @@ function H({ fields: e, onFilterChange: t, className: n }) {
|
|
|
603
603
|
}
|
|
604
604
|
//#endregion
|
|
605
605
|
//#region src/ListView.tsx
|
|
606
|
-
function
|
|
606
|
+
function B(e) {
|
|
607
607
|
switch (e) {
|
|
608
608
|
case "equals":
|
|
609
609
|
case "eq": return "=";
|
|
@@ -627,10 +627,10 @@ function Ke(e) {
|
|
|
627
627
|
default: return e;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function V(e) {
|
|
631
631
|
if (!Array.isArray(e) || e.length < 3) return e;
|
|
632
632
|
let [t, n, r] = e;
|
|
633
|
-
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ?
|
|
633
|
+
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 ? [
|
|
634
634
|
t,
|
|
635
635
|
"=",
|
|
636
636
|
r[0]
|
|
@@ -648,15 +648,15 @@ function qe(e) {
|
|
|
648
648
|
e
|
|
649
649
|
])] : e;
|
|
650
650
|
}
|
|
651
|
-
function Je(e) {
|
|
652
|
-
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
653
|
-
}
|
|
654
651
|
function Ye(e) {
|
|
655
|
-
return
|
|
652
|
+
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
656
653
|
}
|
|
657
654
|
function Xe(e) {
|
|
655
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? V(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
|
|
656
|
+
}
|
|
657
|
+
function Ze(e) {
|
|
658
658
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
659
|
-
let t =
|
|
659
|
+
let t = Xe(e.conditions.map((e) => e.operator === "isEmpty" ? [
|
|
660
660
|
e.field,
|
|
661
661
|
"=",
|
|
662
662
|
null
|
|
@@ -666,12 +666,12 @@ function Xe(e) {
|
|
|
666
666
|
null
|
|
667
667
|
] : [
|
|
668
668
|
e.field,
|
|
669
|
-
|
|
669
|
+
B(e.operator),
|
|
670
670
|
e.value
|
|
671
671
|
]));
|
|
672
672
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
673
673
|
}
|
|
674
|
-
function
|
|
674
|
+
function Qe(e, t) {
|
|
675
675
|
if (!t || t.length === 0) return {};
|
|
676
676
|
for (let r of t) {
|
|
677
677
|
let t = !1, i = ("condition" in r ? r.condition : void 0) || ("expression" in r ? r.expression : void 0) || void 0;
|
|
@@ -706,7 +706,7 @@ function Ze(e, t) {
|
|
|
706
706
|
}
|
|
707
707
|
return {};
|
|
708
708
|
}
|
|
709
|
-
var
|
|
709
|
+
var $e = {
|
|
710
710
|
"list.recordCount": "{{count}} records",
|
|
711
711
|
"list.recordCountOne": "{{count}} record",
|
|
712
712
|
"list.noItems": "No items found",
|
|
@@ -746,32 +746,41 @@ var Qe = {
|
|
|
746
746
|
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
747
747
|
"list.viewSettings": "View settings",
|
|
748
748
|
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
749
|
-
},
|
|
750
|
-
let n =
|
|
749
|
+
}, et = (e, t, n) => n, tt = (e, t) => {
|
|
750
|
+
let n = $e[e] || e;
|
|
751
751
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
752
752
|
return n;
|
|
753
753
|
};
|
|
754
|
-
function
|
|
754
|
+
function nt() {
|
|
755
755
|
try {
|
|
756
756
|
let e = De();
|
|
757
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t:
|
|
757
|
+
return e.t("list.recordCount") === "list.recordCount" ? { t: tt } : { t: e.t };
|
|
758
758
|
} catch {
|
|
759
|
-
return { t:
|
|
759
|
+
return { t: tt };
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function rt() {
|
|
763
763
|
try {
|
|
764
|
-
let { fieldLabel: e } = Ee();
|
|
765
|
-
return {
|
|
764
|
+
let { fieldLabel: e, actionLabel: t } = Ee();
|
|
765
|
+
return {
|
|
766
|
+
fieldLabel: e,
|
|
767
|
+
actionLabel: t
|
|
768
|
+
};
|
|
766
769
|
} catch {
|
|
767
|
-
return {
|
|
770
|
+
return {
|
|
771
|
+
fieldLabel: et,
|
|
772
|
+
actionLabel: void 0
|
|
773
|
+
};
|
|
768
774
|
}
|
|
769
775
|
}
|
|
770
|
-
var
|
|
771
|
-
let { t: _ } =
|
|
776
|
+
var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange: s, onSortChange: c, onSearchChange: l, onHiddenFieldsChange: u, onColumnStateChange: f, onRowClick: p, showViewSwitcher: m = !1, ...h }, g) => {
|
|
777
|
+
let { t: _ } = nt(), { fieldLabel: b, actionLabel: ie } = rt(), { translateOptions: ae } = Oe(), E = a.useMemo(() => e.viewType ? e : {
|
|
772
778
|
...e,
|
|
773
779
|
viewType: "grid"
|
|
774
|
-
}, [e]), D = a.useCallback((e, t) => E.objectName ? b(E.objectName, e, t) : t, [E.objectName, b]),
|
|
780
|
+
}, [e]), D = a.useCallback((e, t) => E.objectName ? b(E.objectName, e, t) : t, [E.objectName, b]), ce = a.useCallback((e) => {
|
|
781
|
+
let t = Ye(e);
|
|
782
|
+
return E.objectName && typeof ie == "function" ? ie(E.objectName, e, t) : t;
|
|
783
|
+
}, [E.objectName, ie]), k = a.useMemo(() => {
|
|
775
784
|
let e = E.userActions, t = E.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
|
|
776
785
|
return {
|
|
777
786
|
showSearch: e?.search === void 0 ? E.showSearch !== !1 : e.search,
|
|
@@ -797,7 +806,7 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
797
806
|
E.compactToolbar,
|
|
798
807
|
E.addRecord,
|
|
799
808
|
E.userActions?.addRecordForm
|
|
800
|
-
]), [A,
|
|
809
|
+
]), [A, de] = a.useState(E.viewType), [j, ye] = a.useState(""), [Ee, De] = a.useState(!1), [Ae, je] = a.useState(!1), [P, Ie] = a.useState(() => E.sort && E.sort.length > 0 ? E.sort.map((e) => {
|
|
801
810
|
if (typeof e == "string") {
|
|
802
811
|
let t = e.trim().split(/\s+/);
|
|
803
812
|
return {
|
|
@@ -811,9 +820,9 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
811
820
|
field: e.field,
|
|
812
821
|
order: e.order || "asc"
|
|
813
822
|
};
|
|
814
|
-
}) : []),
|
|
823
|
+
}) : []), Le = a.useMemo(() => JSON.stringify(E.sort || []), [E.sort]);
|
|
815
824
|
a.useEffect(() => {
|
|
816
|
-
E.sort && E.sort.length > 0 ?
|
|
825
|
+
E.sort && E.sort.length > 0 ? Ie(E.sort.map((e) => {
|
|
817
826
|
if (typeof e == "string") {
|
|
818
827
|
let t = e.trim().split(/\s+/);
|
|
819
828
|
return {
|
|
@@ -827,41 +836,41 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
827
836
|
field: e.field,
|
|
828
837
|
order: e.order || "asc"
|
|
829
838
|
};
|
|
830
|
-
})) :
|
|
831
|
-
}, [
|
|
832
|
-
let [
|
|
839
|
+
})) : Ie([]);
|
|
840
|
+
}, [Le]);
|
|
841
|
+
let [Re, ze] = a.useState(!1), [F, Ve] = a.useState({
|
|
833
842
|
id: "root",
|
|
834
843
|
logic: "and",
|
|
835
844
|
conditions: []
|
|
836
|
-
}), [
|
|
845
|
+
}), [I, Ge] = a.useState(() => {
|
|
837
846
|
if (!(!E.tabs || E.tabs.length === 0)) return E.tabs.find((e) => e.isDefault)?.name ?? E.tabs[0]?.name;
|
|
838
|
-
}),
|
|
839
|
-
if (
|
|
847
|
+
}), Ke = a.useCallback((e) => {
|
|
848
|
+
if (Ge(e.name), e.filter) {
|
|
840
849
|
let t = {
|
|
841
850
|
id: `tab-filter-${e.name}`,
|
|
842
851
|
logic: e.filter.logic || "and",
|
|
843
852
|
conditions: e.filter.conditions || []
|
|
844
853
|
};
|
|
845
|
-
|
|
854
|
+
Ve(t), s?.(t);
|
|
846
855
|
} else {
|
|
847
856
|
let e = {
|
|
848
857
|
id: "root",
|
|
849
858
|
logic: "and",
|
|
850
859
|
conditions: []
|
|
851
860
|
};
|
|
852
|
-
|
|
861
|
+
Ve(e), s?.(e);
|
|
853
862
|
}
|
|
854
|
-
}, [s]),
|
|
855
|
-
a.useImperativeHandle(g, () => ({ refresh: () =>
|
|
856
|
-
if (!(!
|
|
857
|
-
e.resource === E.objectName &&
|
|
863
|
+
}, [s]), L = h.dataSource, [R, Je] = a.useState([]), [z, B] = a.useState(() => !(Array.isArray(E.data) || E.data && typeof E.data == "object" && E.data.provider === "value" && Array.isArray(E.data.items))), [V, Qe] = a.useState(null), [$e, et] = a.useState(!1), [tt, H] = a.useState(0), [it, at] = a.useState(!1);
|
|
864
|
+
a.useImperativeHandle(g, () => ({ refresh: () => H((e) => e + 1) }), []), a.useEffect(() => {
|
|
865
|
+
if (!(!L?.onMutation || !E.objectName || E.refreshTrigger)) return L.onMutation((e) => {
|
|
866
|
+
e.resource === E.objectName && H((e) => e + 1);
|
|
858
867
|
});
|
|
859
868
|
}, [
|
|
860
|
-
|
|
869
|
+
L,
|
|
861
870
|
E.objectName,
|
|
862
871
|
E.refreshTrigger
|
|
863
872
|
]);
|
|
864
|
-
let [
|
|
873
|
+
let [ot, st] = a.useState(void 0), U = ot ?? E.pagination?.pageSize ?? 100, W = a.useMemo(() => {
|
|
865
874
|
if (E.grouping?.fields?.length) return E.grouping;
|
|
866
875
|
let e = typeof E.groupBy == "string" ? E.groupBy.trim() : "", t = typeof E.groupBy2 == "string" ? E.groupBy2.trim() : "", n = [];
|
|
867
876
|
return e && n.push({
|
|
@@ -877,24 +886,24 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
877
886
|
E.grouping,
|
|
878
887
|
E.groupBy,
|
|
879
888
|
E.groupBy2
|
|
880
|
-
]), [
|
|
889
|
+
]), [G, ct] = a.useState(W), [lt, ut] = a.useState(!1), dt = a.useRef(W);
|
|
881
890
|
a.useEffect(() => {
|
|
882
|
-
|
|
883
|
-
}, [
|
|
884
|
-
let [
|
|
891
|
+
dt.current !== W && (dt.current = W, ct(W));
|
|
892
|
+
}, [W]);
|
|
893
|
+
let [K, ft] = a.useState(E.rowColor), [pt, mt] = a.useState(!1), [ht, gt] = a.useState([]), _t = a.useRef(0), [vt, yt] = a.useState(() => {
|
|
885
894
|
let e = /* @__PURE__ */ new Set();
|
|
886
895
|
return E.quickFilters?.forEach((t) => {
|
|
887
896
|
let n = r(t);
|
|
888
897
|
n.defaultActive && e.add(n.id);
|
|
889
898
|
}), e;
|
|
890
|
-
}), [
|
|
899
|
+
}), [bt, xt] = a.useState([]), St = a.useMemo(() => {
|
|
891
900
|
if (E.userFilters) return E.userFilters;
|
|
892
|
-
if (!
|
|
901
|
+
if (!V?.fields) return;
|
|
893
902
|
let e = new Set([
|
|
894
903
|
"select",
|
|
895
904
|
"multi-select",
|
|
896
905
|
"boolean"
|
|
897
|
-
]), t = [], n = Array.isArray(
|
|
906
|
+
]), t = [], n = Array.isArray(V.fields) ? V.fields.map((e) => [e.name, e]) : Object.entries(V.fields);
|
|
898
907
|
for (let [r, i] of n) (e.has(i.type) || i.options && !i.type) && t.push({
|
|
899
908
|
field: r,
|
|
900
909
|
label: D(r, i.label || r),
|
|
@@ -904,65 +913,65 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
904
913
|
element: "dropdown",
|
|
905
914
|
fields: t
|
|
906
915
|
};
|
|
907
|
-
}, [E.userFilters,
|
|
916
|
+
}, [E.userFilters, V]), [q, Ct] = a.useState(() => new Set(E.hiddenFields || [])), wt = a.useMemo(() => JSON.stringify(E.hiddenFields || []), [E.hiddenFields]);
|
|
908
917
|
a.useEffect(() => {
|
|
909
|
-
|
|
910
|
-
}, [
|
|
911
|
-
let
|
|
912
|
-
|
|
913
|
-
}, [u]), [
|
|
918
|
+
Ct(new Set(E.hiddenFields || []));
|
|
919
|
+
}, [wt]);
|
|
920
|
+
let Tt = a.useCallback((e) => {
|
|
921
|
+
Ct(e), u?.(Array.from(e));
|
|
922
|
+
}, [u]), [Et, Dt] = a.useState(!1), [Ot, kt] = a.useState(!1), J = a.useMemo(() => i(E.quickFilters), [E.quickFilters]), Y = a.useMemo(() => {
|
|
914
923
|
if (E.exportOptions) return Array.isArray(E.exportOptions) ? { formats: E.exportOptions } : E.exportOptions;
|
|
915
|
-
}, [E.exportOptions]),
|
|
924
|
+
}, [E.exportOptions]), X = Me(a.useMemo(() => E.densityMode ? E.densityMode : E.rowHeight ? {
|
|
916
925
|
compact: "compact",
|
|
917
926
|
short: "compact",
|
|
918
927
|
medium: "comfortable",
|
|
919
928
|
tall: "spacious",
|
|
920
929
|
extra_tall: "spacious"
|
|
921
|
-
}[E.rowHeight] || "comfortable" : "compact", [E.densityMode, E.rowHeight]), { onChange: E.onDensityChange }),
|
|
930
|
+
}[E.rowHeight] || "comfortable" : "compact", [E.densityMode, E.rowHeight]), { onChange: E.onDensityChange }), At = a.useMemo(() => `objectui:gallery:density:${E.objectName ?? "default"}`, [E.objectName]), [Z, jt] = a.useState(() => {
|
|
922
931
|
if (typeof window > "u") return E.gallery?.cardSize ?? "medium";
|
|
923
932
|
try {
|
|
924
|
-
let e = window.localStorage.getItem(
|
|
933
|
+
let e = window.localStorage.getItem(At);
|
|
925
934
|
if (e === "small" || e === "medium" || e === "large") return e;
|
|
926
935
|
} catch {}
|
|
927
936
|
return E.gallery?.cardSize ?? "medium";
|
|
928
|
-
}),
|
|
929
|
-
|
|
937
|
+
}), Mt = a.useCallback(() => {
|
|
938
|
+
jt((e) => {
|
|
930
939
|
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
931
940
|
try {
|
|
932
|
-
window.localStorage.setItem(
|
|
941
|
+
window.localStorage.setItem(At, t);
|
|
933
942
|
} catch {}
|
|
934
943
|
return t;
|
|
935
944
|
});
|
|
936
|
-
}, [
|
|
945
|
+
}, [At]), { ref: Nt, isRefreshing: Pt, pullDistance: Ft } = Pe({
|
|
937
946
|
onRefresh: a.useCallback(async () => {
|
|
938
|
-
|
|
947
|
+
H((e) => e + 1);
|
|
939
948
|
}, []),
|
|
940
|
-
enabled: !!
|
|
941
|
-
}),
|
|
949
|
+
enabled: !!L && !!E.objectName
|
|
950
|
+
}), It = a.useMemo(() => E.id ? `listview-${E.objectName}-${E.id}-view` : `listview-${E.objectName}-view`, [E.objectName, E.id]);
|
|
942
951
|
a.useEffect(() => {
|
|
943
952
|
let e = !0;
|
|
944
|
-
return
|
|
945
|
-
if (!
|
|
946
|
-
|
|
953
|
+
return et(!1), Qe(null), (async () => {
|
|
954
|
+
if (!L || !E.objectName) {
|
|
955
|
+
et(!0);
|
|
947
956
|
return;
|
|
948
957
|
}
|
|
949
|
-
if (typeof
|
|
950
|
-
|
|
958
|
+
if (typeof L.getObjectSchema != "function") {
|
|
959
|
+
et(!0);
|
|
951
960
|
return;
|
|
952
961
|
}
|
|
953
962
|
try {
|
|
954
|
-
let t = await
|
|
955
|
-
e &&
|
|
963
|
+
let t = await L.getObjectSchema(E.objectName);
|
|
964
|
+
e && Qe(t);
|
|
956
965
|
} catch (e) {
|
|
957
966
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
958
967
|
} finally {
|
|
959
|
-
e &&
|
|
968
|
+
e && et(!0);
|
|
960
969
|
}
|
|
961
970
|
})(), () => {
|
|
962
971
|
e = !1;
|
|
963
972
|
};
|
|
964
|
-
}, [E.objectName,
|
|
965
|
-
let
|
|
973
|
+
}, [E.objectName, L]);
|
|
974
|
+
let Lt = a.useMemo(() => {
|
|
966
975
|
let e = Array.isArray(E.fields) ? E.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], n = new Set(e), r = (e) => {
|
|
967
976
|
if (!e) return;
|
|
968
977
|
let t = [
|
|
@@ -989,9 +998,9 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
989
998
|
};
|
|
990
999
|
r(E.kanban), r(E.options?.kanban), r(E.calendar), r(E.options?.calendar), r(E.gallery), r(E.options?.gallery), r(E.timeline), r(E.options?.timeline), r(E.gantt), r(E.options?.gantt);
|
|
991
1000
|
let i = n.size > 0 ? Array.from(n) : void 0;
|
|
992
|
-
return t(
|
|
1001
|
+
return t(V?.fields, i);
|
|
993
1002
|
}, [
|
|
994
|
-
|
|
1003
|
+
V?.fields,
|
|
995
1004
|
E.fields,
|
|
996
1005
|
E.kanban,
|
|
997
1006
|
E.calendar,
|
|
@@ -999,9 +1008,9 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
999
1008
|
E.timeline,
|
|
1000
1009
|
E.gantt,
|
|
1001
1010
|
E.options
|
|
1002
|
-
]),
|
|
1011
|
+
]), Q = Fe();
|
|
1003
1012
|
a.useEffect(() => {
|
|
1004
|
-
let e = !0, t = ++
|
|
1013
|
+
let e = !0, t = ++_t.current;
|
|
1005
1014
|
if (E.data && typeof E.data == "object" && !Array.isArray(E.data)) {
|
|
1006
1015
|
let e = E.data;
|
|
1007
1016
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
@@ -1010,7 +1019,7 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1010
1019
|
let e = j.toLowerCase();
|
|
1011
1020
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
1012
1021
|
}
|
|
1013
|
-
|
|
1022
|
+
Je(t), B(!1), at(!1);
|
|
1014
1023
|
return;
|
|
1015
1024
|
}
|
|
1016
1025
|
}
|
|
@@ -1020,21 +1029,21 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1020
1029
|
let t = j.toLowerCase();
|
|
1021
1030
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
1022
1031
|
}
|
|
1023
|
-
|
|
1032
|
+
Je(e), B(!1), at(!1);
|
|
1024
1033
|
return;
|
|
1025
1034
|
}
|
|
1026
|
-
return
|
|
1027
|
-
if (!
|
|
1028
|
-
|
|
1035
|
+
return $e ? ((async () => {
|
|
1036
|
+
if (!L || !E.objectName) {
|
|
1037
|
+
B(!1);
|
|
1029
1038
|
return;
|
|
1030
1039
|
}
|
|
1031
|
-
|
|
1040
|
+
B(!0);
|
|
1032
1041
|
try {
|
|
1033
|
-
let n = [], r = E.filters || [], i =
|
|
1034
|
-
|
|
1035
|
-
|
|
1042
|
+
let n = [], r = E.filters || [], i = Ze(F), a = [];
|
|
1043
|
+
J && vt.size > 0 && J.forEach((e) => {
|
|
1044
|
+
vt.has(e.id) && e.filters && e.filters.length > 0 && a.push(e.filters);
|
|
1036
1045
|
});
|
|
1037
|
-
let o =
|
|
1046
|
+
let o = Xe(bt), s = [
|
|
1038
1047
|
...r.length > 0 ? [r] : [],
|
|
1039
1048
|
...i.length > 0 ? [i] : [],
|
|
1040
1049
|
...a,
|
|
@@ -1045,11 +1054,11 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1045
1054
|
field: e.field,
|
|
1046
1055
|
order: e.order
|
|
1047
1056
|
})) : void 0, l = (() => {
|
|
1048
|
-
let e = Array.isArray(E.fields) ? E.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], t =
|
|
1057
|
+
let e = Array.isArray(E.fields) ? E.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], t = Q?.isLoaded && E.objectName ? e.filter((e) => Q.checkField(E.objectName, e, "read")) : e;
|
|
1049
1058
|
if (t.length === 0) return;
|
|
1050
1059
|
let n = new Set(["id"]);
|
|
1051
1060
|
for (let e of t) n.add(e);
|
|
1052
|
-
for (let e of
|
|
1061
|
+
for (let e of Lt) n.add(e);
|
|
1053
1062
|
let r = (e) => {
|
|
1054
1063
|
if (!e) return;
|
|
1055
1064
|
let t = [
|
|
@@ -1080,24 +1089,24 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1080
1089
|
e && !Array.isArray(e.metaFields) && (n.add("status"), n.add("priority"));
|
|
1081
1090
|
}
|
|
1082
1091
|
return r(E.gantt), r(E.options?.gantt), Array.from(n);
|
|
1083
|
-
})(), u = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, d = await
|
|
1092
|
+
})(), u = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, d = await L.find(E.objectName, {
|
|
1084
1093
|
...u ? { $filter: n } : {},
|
|
1085
1094
|
$orderby: c,
|
|
1086
|
-
$top:
|
|
1095
|
+
$top: U,
|
|
1087
1096
|
...l ? { $select: l } : {},
|
|
1088
|
-
...
|
|
1097
|
+
...Lt.length > 0 ? { $expand: Lt } : {},
|
|
1089
1098
|
...j ? {
|
|
1090
1099
|
$search: j,
|
|
1091
1100
|
...E.searchableFields && E.searchableFields.length > 0 ? { $searchFields: E.searchableFields } : {}
|
|
1092
1101
|
} : {}
|
|
1093
1102
|
});
|
|
1094
|
-
if (!e || t !==
|
|
1103
|
+
if (!e || t !== _t.current) return;
|
|
1095
1104
|
let f = [];
|
|
1096
|
-
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)),
|
|
1105
|
+
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)), Je(f), at(f.length >= U);
|
|
1097
1106
|
} catch (e) {
|
|
1098
|
-
t ===
|
|
1107
|
+
t === _t.current && console.error("ListView data fetch error:", e);
|
|
1099
1108
|
} finally {
|
|
1100
|
-
e && t ===
|
|
1109
|
+
e && t === _t.current && B(!1);
|
|
1101
1110
|
}
|
|
1102
1111
|
})(), () => {
|
|
1103
1112
|
e = !1;
|
|
@@ -1105,23 +1114,23 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1105
1114
|
}, [
|
|
1106
1115
|
E.objectName,
|
|
1107
1116
|
E.data,
|
|
1108
|
-
|
|
1117
|
+
L,
|
|
1109
1118
|
E.filters,
|
|
1110
|
-
|
|
1119
|
+
U,
|
|
1111
1120
|
P,
|
|
1112
1121
|
F,
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1122
|
+
vt,
|
|
1123
|
+
J,
|
|
1124
|
+
bt,
|
|
1125
|
+
tt,
|
|
1117
1126
|
j,
|
|
1118
1127
|
E.searchableFields,
|
|
1119
|
-
|
|
1120
|
-
|
|
1128
|
+
Lt,
|
|
1129
|
+
$e,
|
|
1121
1130
|
E.refreshTrigger,
|
|
1122
|
-
|
|
1131
|
+
Q
|
|
1123
1132
|
]);
|
|
1124
|
-
let
|
|
1133
|
+
let Rt = a.useMemo(() => {
|
|
1125
1134
|
if (E.appearance?.allowedVisualizations && E.appearance.allowedVisualizations.length > 0) return E.appearance.allowedVisualizations.filter((e) => [
|
|
1126
1135
|
"grid",
|
|
1127
1136
|
"kanban",
|
|
@@ -1152,31 +1161,31 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1152
1161
|
E.appearance?.allowedVisualizations
|
|
1153
1162
|
]);
|
|
1154
1163
|
a.useEffect(() => {
|
|
1155
|
-
E.viewType &&
|
|
1164
|
+
E.viewType && de(E.viewType);
|
|
1156
1165
|
}, [E.viewType]);
|
|
1157
|
-
let
|
|
1158
|
-
|
|
1166
|
+
let zt = a.useCallback((e) => {
|
|
1167
|
+
de(e);
|
|
1159
1168
|
try {
|
|
1160
|
-
localStorage.setItem(
|
|
1169
|
+
localStorage.setItem(It, e);
|
|
1161
1170
|
} catch (e) {
|
|
1162
1171
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
1163
1172
|
}
|
|
1164
1173
|
o?.(e);
|
|
1165
|
-
}, [
|
|
1166
|
-
|
|
1167
|
-
}, [l]),
|
|
1174
|
+
}, [It, o]), Bt = a.useCallback((e) => {
|
|
1175
|
+
ye(e), l?.(e);
|
|
1176
|
+
}, [l]), Vt = Ne({
|
|
1168
1177
|
navigation: E.navigation,
|
|
1169
1178
|
objectName: E.objectName,
|
|
1170
1179
|
onNavigate: E.onNavigate,
|
|
1171
1180
|
onRowClick: p
|
|
1172
|
-
}),
|
|
1181
|
+
}), $ = a.useMemo(() => {
|
|
1173
1182
|
let e = E.fields || [];
|
|
1174
|
-
if (Array.isArray(e) || (e = []),
|
|
1183
|
+
if (Array.isArray(e) || (e = []), Q?.isLoaded && E.objectName && (e = e.filter((e) => {
|
|
1175
1184
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1176
|
-
return t ?
|
|
1177
|
-
})),
|
|
1185
|
+
return t ? Q.checkField(E.objectName, t, "read") : !0;
|
|
1186
|
+
})), q.size > 0 && (e = e.filter((e) => {
|
|
1178
1187
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1179
|
-
return t != null && !
|
|
1188
|
+
return t != null && !q.has(t);
|
|
1180
1189
|
})), E.fieldOrder && E.fieldOrder.length > 0) {
|
|
1181
1190
|
let t = new Map(E.fieldOrder.map((e, t) => [e, t]));
|
|
1182
1191
|
e = [...e].sort((e, n) => {
|
|
@@ -1188,18 +1197,18 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1188
1197
|
}, [
|
|
1189
1198
|
E.fields,
|
|
1190
1199
|
E.objectName,
|
|
1191
|
-
|
|
1200
|
+
q,
|
|
1192
1201
|
E.fieldOrder,
|
|
1193
|
-
|
|
1194
|
-
]),
|
|
1195
|
-
let e =
|
|
1202
|
+
Q
|
|
1203
|
+
]), Ht = a.useMemo(() => {
|
|
1204
|
+
let e = X.mode === "compact" ? "compact" : X.mode === "spacious" ? "tall" : "medium", t = {
|
|
1196
1205
|
objectName: E.objectName,
|
|
1197
|
-
fields:
|
|
1206
|
+
fields: $,
|
|
1198
1207
|
filters: E.filters,
|
|
1199
1208
|
sort: P,
|
|
1200
1209
|
className: "h-full w-full",
|
|
1201
1210
|
showSearch: !1,
|
|
1202
|
-
onRowClick:
|
|
1211
|
+
onRowClick: Vt.handleClick,
|
|
1203
1212
|
rowHeight: e,
|
|
1204
1213
|
hideRowHeightToggle: !0,
|
|
1205
1214
|
...E.striped == null ? {} : { striped: E.striped },
|
|
@@ -1211,7 +1220,7 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1211
1220
|
case "grid": return {
|
|
1212
1221
|
type: "object-grid",
|
|
1213
1222
|
...t,
|
|
1214
|
-
columns:
|
|
1223
|
+
columns: $,
|
|
1215
1224
|
...E.conditionalFormatting ? { conditionalFormatting: E.conditionalFormatting } : {},
|
|
1216
1225
|
...E.inlineEdit == null ? {} : { editable: E.inlineEdit },
|
|
1217
1226
|
...E.wrapHeaders == null ? {} : { wrapHeaders: E.wrapHeaders },
|
|
@@ -1219,8 +1228,8 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1219
1228
|
...E.resizable == null ? {} : { resizable: E.resizable },
|
|
1220
1229
|
...E.selection ? { selection: E.selection } : {},
|
|
1221
1230
|
...E.pagination ? { pagination: E.pagination } : {},
|
|
1222
|
-
...
|
|
1223
|
-
...
|
|
1231
|
+
...G ? { grouping: G } : {},
|
|
1232
|
+
...K ? { rowColor: K } : {},
|
|
1224
1233
|
...E.rowActions ? { rowActions: E.rowActions } : {},
|
|
1225
1234
|
...E.rowActionDefs ? { rowActionDefs: E.rowActionDefs } : {},
|
|
1226
1235
|
...E.bulkActions ? { batchActions: E.bulkActions } : {},
|
|
@@ -1233,8 +1242,8 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1233
1242
|
groupBy: E.kanban?.groupField || E.options?.kanban?.groupField || "status",
|
|
1234
1243
|
groupField: E.kanban?.groupField || E.options?.kanban?.groupField || "status",
|
|
1235
1244
|
...E.kanban?.titleField || E.options?.kanban?.titleField ? { titleField: E.kanban?.titleField || E.options?.kanban?.titleField } : {},
|
|
1236
|
-
cardFields: E.kanban?.cardFields ||
|
|
1237
|
-
...
|
|
1245
|
+
cardFields: E.kanban?.cardFields || $ || [],
|
|
1246
|
+
...G ? { grouping: G } : {},
|
|
1238
1247
|
...E.options?.kanban || {},
|
|
1239
1248
|
...E.kanban || {}
|
|
1240
1249
|
};
|
|
@@ -1252,7 +1261,7 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1252
1261
|
let e = {
|
|
1253
1262
|
...E.options?.gallery || {},
|
|
1254
1263
|
...E.gallery || {},
|
|
1255
|
-
cardSize:
|
|
1264
|
+
cardSize: Z
|
|
1256
1265
|
};
|
|
1257
1266
|
return {
|
|
1258
1267
|
type: "object-gallery",
|
|
@@ -1261,7 +1270,7 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1261
1270
|
imageField: E.gallery?.coverField || E.gallery?.imageField || E.options?.gallery?.imageField,
|
|
1262
1271
|
titleField: E.gallery?.titleField || E.options?.gallery?.titleField || "name",
|
|
1263
1272
|
subtitleField: E.gallery?.subtitleField || E.options?.gallery?.subtitleField,
|
|
1264
|
-
...
|
|
1273
|
+
...G ? { grouping: G } : {}
|
|
1265
1274
|
};
|
|
1266
1275
|
}
|
|
1267
1276
|
case "timeline": {
|
|
@@ -1304,13 +1313,13 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1304
1313
|
A,
|
|
1305
1314
|
E,
|
|
1306
1315
|
P,
|
|
1307
|
-
|
|
1316
|
+
$,
|
|
1317
|
+
G,
|
|
1308
1318
|
K,
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
Z
|
|
1312
|
-
|
|
1313
|
-
]), Vt = F.conditions && F.conditions.length > 0, Ht = a.useMemo(() => {
|
|
1319
|
+
Vt.handleClick,
|
|
1320
|
+
X.mode,
|
|
1321
|
+
Z
|
|
1322
|
+
]), Ut = F.conditions && F.conditions.length > 0, Wt = a.useMemo(() => {
|
|
1314
1323
|
let e, t = (e, t) => {
|
|
1315
1324
|
if (!t) return;
|
|
1316
1325
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1322,9 +1331,9 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1322
1331
|
label: t?.label || e,
|
|
1323
1332
|
...t
|
|
1324
1333
|
}));
|
|
1325
|
-
return E.objectName ?
|
|
1334
|
+
return E.objectName ? ae(E.objectName, e, n) : n;
|
|
1326
1335
|
};
|
|
1327
|
-
if (e =
|
|
1336
|
+
if (e = V?.fields ? Object.entries(V.fields).map(([e, n]) => ({
|
|
1328
1337
|
value: e,
|
|
1329
1338
|
label: D(e, n.label || e),
|
|
1330
1339
|
type: n.type || "text",
|
|
@@ -1354,21 +1363,21 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1354
1363
|
}
|
|
1355
1364
|
return e;
|
|
1356
1365
|
}, [
|
|
1357
|
-
|
|
1366
|
+
V,
|
|
1358
1367
|
E.fields,
|
|
1359
1368
|
E.filterableFields,
|
|
1360
1369
|
E.objectName,
|
|
1361
1370
|
D,
|
|
1362
|
-
|
|
1363
|
-
]),
|
|
1364
|
-
|
|
1371
|
+
ae
|
|
1372
|
+
]), Gt = a.useCallback((e) => {
|
|
1373
|
+
yt((t) => {
|
|
1365
1374
|
let n = new Set(t);
|
|
1366
1375
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1367
1376
|
});
|
|
1368
|
-
}, []),
|
|
1369
|
-
let t =
|
|
1377
|
+
}, []), Kt = a.useCallback((e) => {
|
|
1378
|
+
let t = Y, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || E.objectName || "export", a = n > 0 ? R.slice(0, n) : R;
|
|
1370
1379
|
if (e === "csv") {
|
|
1371
|
-
let e =
|
|
1380
|
+
let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
|
|
1372
1381
|
r && t.push(e.join(",")), a.forEach((n) => {
|
|
1373
1382
|
t.push(e.map((e) => {
|
|
1374
1383
|
let t = n[e], r;
|
|
@@ -1381,13 +1390,13 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1381
1390
|
let e = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1382
1391
|
n.href = t, n.download = `${i}.json`, n.click(), URL.revokeObjectURL(t);
|
|
1383
1392
|
}
|
|
1384
|
-
|
|
1393
|
+
kt(!1);
|
|
1385
1394
|
}, [
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1395
|
+
R,
|
|
1396
|
+
$,
|
|
1397
|
+
Y,
|
|
1389
1398
|
E.objectName
|
|
1390
|
-
]),
|
|
1399
|
+
]), qt = a.useMemo(() => (E.fields || []).map((e) => {
|
|
1391
1400
|
if (typeof e == "string") return {
|
|
1392
1401
|
name: e,
|
|
1393
1402
|
label: D(e, e)
|
|
@@ -1399,24 +1408,24 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1399
1408
|
};
|
|
1400
1409
|
}), [E.fields, D]);
|
|
1401
1410
|
return /* @__PURE__ */ N("div", {
|
|
1402
|
-
ref:
|
|
1411
|
+
ref: Nt,
|
|
1403
1412
|
className: w("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1404
1413
|
...E.aria?.label ? { "aria-label": E.aria.label } : {},
|
|
1405
1414
|
...E.aria?.describedBy ? { "aria-describedby": E.aria.describedBy } : {},
|
|
1406
1415
|
...E.aria?.live ? { "aria-live": E.aria.live } : {},
|
|
1407
1416
|
role: "region",
|
|
1408
1417
|
children: [
|
|
1409
|
-
|
|
1418
|
+
Ft > 0 && /* @__PURE__ */ M("div", {
|
|
1410
1419
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1411
|
-
style: { height:
|
|
1412
|
-
children: _(
|
|
1420
|
+
style: { height: Ft },
|
|
1421
|
+
children: _(Pt ? "list.refreshing" : "list.pullToRefresh")
|
|
1413
1422
|
}),
|
|
1414
1423
|
m && /* @__PURE__ */ M("div", {
|
|
1415
1424
|
className: "px-4 py-1 flex items-center bg-background",
|
|
1416
|
-
children: /* @__PURE__ */ M(
|
|
1425
|
+
children: /* @__PURE__ */ M(Be, {
|
|
1417
1426
|
currentView: A,
|
|
1418
|
-
availableViews:
|
|
1419
|
-
onViewChange:
|
|
1427
|
+
availableViews: Rt,
|
|
1428
|
+
onViewChange: zt
|
|
1420
1429
|
})
|
|
1421
1430
|
}),
|
|
1422
1431
|
E.description && E.appearance?.showDescription !== !1 && /* @__PURE__ */ M("div", {
|
|
@@ -1431,30 +1440,30 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1431
1440
|
children: [
|
|
1432
1441
|
E.tabs && E.tabs.length > 0 && /* @__PURE__ */ N(Te, { children: [/* @__PURE__ */ M("div", {
|
|
1433
1442
|
className: "hidden sm:block shrink-0",
|
|
1434
|
-
children: /* @__PURE__ */ M(
|
|
1443
|
+
children: /* @__PURE__ */ M(He, {
|
|
1435
1444
|
tabs: E.tabs,
|
|
1436
|
-
activeTab:
|
|
1437
|
-
onTabChange:
|
|
1445
|
+
activeTab: I,
|
|
1446
|
+
onTabChange: Ke,
|
|
1438
1447
|
className: "!px-0 !py-0"
|
|
1439
1448
|
})
|
|
1440
1449
|
}), /* @__PURE__ */ M("div", {
|
|
1441
1450
|
className: "sm:hidden shrink-0",
|
|
1442
|
-
children: /* @__PURE__ */ M(
|
|
1451
|
+
children: /* @__PURE__ */ M(Ue, {
|
|
1443
1452
|
tabs: E.tabs,
|
|
1444
|
-
activeTab:
|
|
1445
|
-
onTabChange:
|
|
1453
|
+
activeTab: I,
|
|
1454
|
+
onTabChange: Ke,
|
|
1446
1455
|
className: "!px-0 !py-0"
|
|
1447
1456
|
})
|
|
1448
1457
|
})] }),
|
|
1449
|
-
E.tabs && E.tabs.length > 0 &&
|
|
1450
|
-
|
|
1458
|
+
E.tabs && E.tabs.length > 0 && St && /* @__PURE__ */ M("div", { className: "hidden sm:block h-4 w-px bg-border/60 mx-1 shrink-0" }),
|
|
1459
|
+
St && /* @__PURE__ */ M("div", {
|
|
1451
1460
|
className: "shrink-0 min-w-0 overflow-x-auto",
|
|
1452
1461
|
"data-testid": "user-filters",
|
|
1453
|
-
children: /* @__PURE__ */ M(
|
|
1454
|
-
config:
|
|
1455
|
-
objectDef:
|
|
1456
|
-
data:
|
|
1457
|
-
onFilterChange:
|
|
1462
|
+
children: /* @__PURE__ */ M(qe, {
|
|
1463
|
+
config: St,
|
|
1464
|
+
objectDef: V,
|
|
1465
|
+
data: R,
|
|
1466
|
+
onFilterChange: xt,
|
|
1458
1467
|
maxVisible: 3
|
|
1459
1468
|
})
|
|
1460
1469
|
})
|
|
@@ -1462,24 +1471,24 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1462
1471
|
}), /* @__PURE__ */ N("div", {
|
|
1463
1472
|
className: "flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm",
|
|
1464
1473
|
children: [
|
|
1465
|
-
|
|
1466
|
-
open:
|
|
1467
|
-
onOpenChange:
|
|
1474
|
+
k.showHideFields && !k.compactToolbar && /* @__PURE__ */ N(x, {
|
|
1475
|
+
open: Et,
|
|
1476
|
+
onOpenChange: Dt,
|
|
1468
1477
|
children: [/* @__PURE__ */ M(C, {
|
|
1469
1478
|
asChild: !0,
|
|
1470
1479
|
children: /* @__PURE__ */ N(d, {
|
|
1471
1480
|
variant: "ghost",
|
|
1472
1481
|
size: "sm",
|
|
1473
|
-
className: w("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1482
|
+
className: w("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", q.size > 0 && "text-primary"),
|
|
1474
1483
|
children: [
|
|
1475
|
-
/* @__PURE__ */ M(
|
|
1484
|
+
/* @__PURE__ */ M(se, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1476
1485
|
/* @__PURE__ */ M("span", {
|
|
1477
1486
|
className: "hidden sm:inline",
|
|
1478
1487
|
children: _("list.hideFields")
|
|
1479
1488
|
}),
|
|
1480
|
-
|
|
1489
|
+
q.size > 0 && /* @__PURE__ */ M("span", {
|
|
1481
1490
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1482
|
-
children:
|
|
1491
|
+
children: q.size
|
|
1483
1492
|
})
|
|
1484
1493
|
]
|
|
1485
1494
|
})
|
|
@@ -1493,23 +1502,23 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1493
1502
|
children: [/* @__PURE__ */ M("h4", {
|
|
1494
1503
|
className: "font-medium text-sm",
|
|
1495
1504
|
children: _("list.hideFieldsTitle")
|
|
1496
|
-
}),
|
|
1505
|
+
}), q.size > 0 && /* @__PURE__ */ M(d, {
|
|
1497
1506
|
variant: "ghost",
|
|
1498
1507
|
size: "sm",
|
|
1499
1508
|
className: "h-6 px-2 text-xs",
|
|
1500
|
-
onClick: () =>
|
|
1509
|
+
onClick: () => Tt(/* @__PURE__ */ new Set()),
|
|
1501
1510
|
children: _("list.showAll")
|
|
1502
1511
|
})]
|
|
1503
1512
|
}), /* @__PURE__ */ M("div", {
|
|
1504
1513
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1505
|
-
children:
|
|
1514
|
+
children: qt.map((e) => /* @__PURE__ */ N("label", {
|
|
1506
1515
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1507
1516
|
children: [/* @__PURE__ */ M("input", {
|
|
1508
1517
|
type: "checkbox",
|
|
1509
|
-
checked: !
|
|
1518
|
+
checked: !q.has(e.name),
|
|
1510
1519
|
onChange: () => {
|
|
1511
|
-
let t = new Set(
|
|
1512
|
-
t.has(e.name) ? t.delete(e.name) : t.add(e.name),
|
|
1520
|
+
let t = new Set(q);
|
|
1521
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), Tt(t);
|
|
1513
1522
|
},
|
|
1514
1523
|
className: "rounded border-input"
|
|
1515
1524
|
}), /* @__PURE__ */ M("span", {
|
|
@@ -1521,23 +1530,23 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1521
1530
|
})
|
|
1522
1531
|
})]
|
|
1523
1532
|
}),
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
open:
|
|
1527
|
-
onOpenChange:
|
|
1533
|
+
k.showHideFields && !k.compactToolbar && (k.showFilters || k.showSort || k.showGroup) && /* @__PURE__ */ M("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1534
|
+
k.showFilters && /* @__PURE__ */ N(x, {
|
|
1535
|
+
open: Re,
|
|
1536
|
+
onOpenChange: ze,
|
|
1528
1537
|
children: [/* @__PURE__ */ M(C, {
|
|
1529
1538
|
asChild: !0,
|
|
1530
1539
|
children: /* @__PURE__ */ N(d, {
|
|
1531
1540
|
variant: "ghost",
|
|
1532
1541
|
size: "sm",
|
|
1533
|
-
className: w("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1542
|
+
className: w("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Ut && "text-foreground font-medium"),
|
|
1534
1543
|
children: [
|
|
1535
1544
|
/* @__PURE__ */ M(xe, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1536
1545
|
/* @__PURE__ */ M("span", {
|
|
1537
1546
|
className: "hidden sm:inline",
|
|
1538
1547
|
children: _("list.filter")
|
|
1539
1548
|
}),
|
|
1540
|
-
|
|
1549
|
+
Ut && /* @__PURE__ */ M("span", {
|
|
1541
1550
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1542
1551
|
children: F.conditions?.length || 0
|
|
1543
1552
|
})
|
|
@@ -1555,33 +1564,33 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1555
1564
|
children: _("list.filterRecords")
|
|
1556
1565
|
})
|
|
1557
1566
|
}), /* @__PURE__ */ M(v, {
|
|
1558
|
-
fields:
|
|
1567
|
+
fields: Wt,
|
|
1559
1568
|
value: F,
|
|
1560
1569
|
onChange: (e) => {
|
|
1561
|
-
|
|
1570
|
+
Ve(e), s && s(e);
|
|
1562
1571
|
}
|
|
1563
1572
|
})]
|
|
1564
1573
|
})
|
|
1565
1574
|
})]
|
|
1566
1575
|
}),
|
|
1567
|
-
|
|
1568
|
-
open:
|
|
1569
|
-
onOpenChange:
|
|
1576
|
+
k.showGroup && !k.compactToolbar && /* @__PURE__ */ N(x, {
|
|
1577
|
+
open: lt,
|
|
1578
|
+
onOpenChange: ut,
|
|
1570
1579
|
children: [/* @__PURE__ */ M(C, {
|
|
1571
1580
|
asChild: !0,
|
|
1572
1581
|
children: /* @__PURE__ */ N(d, {
|
|
1573
1582
|
variant: "ghost",
|
|
1574
1583
|
size: "sm",
|
|
1575
|
-
className: w("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1584
|
+
className: w("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", G && "text-foreground font-medium"),
|
|
1576
1585
|
children: [
|
|
1577
|
-
/* @__PURE__ */ M(
|
|
1586
|
+
/* @__PURE__ */ M(le, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1578
1587
|
/* @__PURE__ */ M("span", {
|
|
1579
1588
|
className: "hidden sm:inline",
|
|
1580
1589
|
children: _("list.group")
|
|
1581
1590
|
}),
|
|
1582
|
-
|
|
1591
|
+
G && G.fields?.length > 0 && /* @__PURE__ */ M("span", {
|
|
1583
1592
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1584
|
-
children:
|
|
1593
|
+
children: G.fields.length
|
|
1585
1594
|
})
|
|
1586
1595
|
]
|
|
1587
1596
|
})
|
|
@@ -1595,19 +1604,19 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1595
1604
|
children: [/* @__PURE__ */ M("h4", {
|
|
1596
1605
|
className: "font-medium text-sm",
|
|
1597
1606
|
children: _("list.groupBy")
|
|
1598
|
-
}),
|
|
1607
|
+
}), G && /* @__PURE__ */ M(d, {
|
|
1599
1608
|
variant: "ghost",
|
|
1600
1609
|
size: "sm",
|
|
1601
1610
|
className: "h-6 px-2 text-xs",
|
|
1602
|
-
onClick: () =>
|
|
1611
|
+
onClick: () => ct(void 0),
|
|
1603
1612
|
"data-testid": "clear-grouping",
|
|
1604
1613
|
children: _("list.clear")
|
|
1605
1614
|
})]
|
|
1606
1615
|
}), /* @__PURE__ */ M("div", {
|
|
1607
1616
|
"data-testid": "group-field-list",
|
|
1608
1617
|
children: /* @__PURE__ */ M(ee, {
|
|
1609
|
-
value:
|
|
1610
|
-
fieldOptions:
|
|
1618
|
+
value: G,
|
|
1619
|
+
fieldOptions: qt.map((e) => ({
|
|
1611
1620
|
value: e.name,
|
|
1612
1621
|
label: e.label || e.name
|
|
1613
1622
|
})),
|
|
@@ -1617,15 +1626,15 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1617
1626
|
collapseTitle: _("list.collapsedByDefault", { defaultValue: "Collapsed by default" }),
|
|
1618
1627
|
removeTitle: _("list.removeGroup", { defaultValue: "Remove" })
|
|
1619
1628
|
},
|
|
1620
|
-
onChange: (e) =>
|
|
1629
|
+
onChange: (e) => ct(e)
|
|
1621
1630
|
})
|
|
1622
1631
|
})]
|
|
1623
1632
|
})
|
|
1624
1633
|
})]
|
|
1625
1634
|
}),
|
|
1626
|
-
|
|
1627
|
-
open:
|
|
1628
|
-
onOpenChange:
|
|
1635
|
+
k.showSort && /* @__PURE__ */ N(x, {
|
|
1636
|
+
open: Ae,
|
|
1637
|
+
onOpenChange: je,
|
|
1629
1638
|
children: [/* @__PURE__ */ M(C, {
|
|
1630
1639
|
asChild: !0,
|
|
1631
1640
|
children: /* @__PURE__ */ N(d, {
|
|
@@ -1656,25 +1665,25 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1656
1665
|
children: _("list.sortRecords")
|
|
1657
1666
|
})
|
|
1658
1667
|
}), /* @__PURE__ */ M(re, {
|
|
1659
|
-
fields:
|
|
1668
|
+
fields: Wt,
|
|
1660
1669
|
value: P,
|
|
1661
1670
|
onChange: (e) => {
|
|
1662
|
-
|
|
1671
|
+
Ie(e), c && c(e);
|
|
1663
1672
|
}
|
|
1664
1673
|
})]
|
|
1665
1674
|
})
|
|
1666
1675
|
})]
|
|
1667
1676
|
}),
|
|
1668
|
-
!
|
|
1669
|
-
|
|
1670
|
-
open:
|
|
1671
|
-
onOpenChange:
|
|
1677
|
+
!k.compactToolbar && (k.showFilters || k.showSort || k.showGroup) && (k.showColor || k.showDensity) && /* @__PURE__ */ M("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1678
|
+
k.showColor && !k.compactToolbar && /* @__PURE__ */ N(x, {
|
|
1679
|
+
open: pt,
|
|
1680
|
+
onOpenChange: mt,
|
|
1672
1681
|
children: [/* @__PURE__ */ M(C, {
|
|
1673
1682
|
asChild: !0,
|
|
1674
1683
|
children: /* @__PURE__ */ N(d, {
|
|
1675
1684
|
variant: "ghost",
|
|
1676
1685
|
size: "sm",
|
|
1677
|
-
className: w("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1686
|
+
className: w("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", K && "text-foreground font-medium"),
|
|
1678
1687
|
children: [/* @__PURE__ */ M(fe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
|
|
1679
1688
|
className: "hidden sm:inline",
|
|
1680
1689
|
children: _("list.color")
|
|
@@ -1690,11 +1699,11 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1690
1699
|
children: [/* @__PURE__ */ M("h4", {
|
|
1691
1700
|
className: "font-medium text-sm",
|
|
1692
1701
|
children: _("list.rowColor")
|
|
1693
|
-
}),
|
|
1702
|
+
}), K && /* @__PURE__ */ M(d, {
|
|
1694
1703
|
variant: "ghost",
|
|
1695
1704
|
size: "sm",
|
|
1696
1705
|
className: "h-6 px-2 text-xs",
|
|
1697
|
-
onClick: () =>
|
|
1706
|
+
onClick: () => ft(void 0),
|
|
1698
1707
|
"data-testid": "clear-row-color",
|
|
1699
1708
|
children: _("list.clear")
|
|
1700
1709
|
})]
|
|
@@ -1706,19 +1715,19 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1706
1715
|
children: _("list.colorByField")
|
|
1707
1716
|
}), /* @__PURE__ */ N("select", {
|
|
1708
1717
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1709
|
-
value:
|
|
1718
|
+
value: K?.field || "",
|
|
1710
1719
|
onChange: (e) => {
|
|
1711
1720
|
let t = e.target.value;
|
|
1712
|
-
|
|
1721
|
+
ft(t ? {
|
|
1713
1722
|
field: t,
|
|
1714
|
-
colors:
|
|
1723
|
+
colors: K?.colors || {}
|
|
1715
1724
|
} : void 0);
|
|
1716
1725
|
},
|
|
1717
1726
|
"data-testid": "color-field-select",
|
|
1718
1727
|
children: [/* @__PURE__ */ M("option", {
|
|
1719
1728
|
value: "",
|
|
1720
1729
|
children: _("list.none")
|
|
1721
|
-
}),
|
|
1730
|
+
}), qt.map((e) => /* @__PURE__ */ M("option", {
|
|
1722
1731
|
value: e.name,
|
|
1723
1732
|
children: e.label
|
|
1724
1733
|
}, e.name))]
|
|
@@ -1727,8 +1736,8 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1727
1736
|
})
|
|
1728
1737
|
})]
|
|
1729
1738
|
}),
|
|
1730
|
-
|
|
1731
|
-
let e =
|
|
1739
|
+
k.showDensity && !k.compactToolbar && A !== "gallery" && (() => {
|
|
1740
|
+
let e = X.mode === "compact" ? _e : X.mode === "comfortable" ? ge : he, t = X.mode === "compact" ? _("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : X.mode === "comfortable" ? _("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : _("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${_("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = _("grid.toolbar.densityCycleHint", {
|
|
1732
1741
|
defaultValue: "{{label}} (click to cycle)",
|
|
1733
1742
|
label: n
|
|
1734
1743
|
});
|
|
@@ -1736,14 +1745,14 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1736
1745
|
variant: "ghost",
|
|
1737
1746
|
size: "sm",
|
|
1738
1747
|
"aria-label": n,
|
|
1739
|
-
className: w("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1740
|
-
onClick:
|
|
1748
|
+
className: w("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", X.mode !== "compact" && "text-foreground font-medium"),
|
|
1749
|
+
onClick: X.cycle,
|
|
1741
1750
|
title: r,
|
|
1742
1751
|
children: /* @__PURE__ */ M(e, { className: "h-3.5 w-3.5" })
|
|
1743
1752
|
});
|
|
1744
1753
|
})(),
|
|
1745
|
-
|
|
1746
|
-
let e =
|
|
1754
|
+
k.showDensity && !k.compactToolbar && A === "gallery" && (() => {
|
|
1755
|
+
let e = Z === "small" ? _e : Z === "medium" ? ge : he, t = Z === "small" ? _("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Z === "medium" ? _("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : _("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${_("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = _("grid.toolbar.densityCycleHint", {
|
|
1747
1756
|
defaultValue: "{{label}} (click to cycle)",
|
|
1748
1757
|
label: n
|
|
1749
1758
|
});
|
|
@@ -1751,38 +1760,38 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1751
1760
|
variant: "ghost",
|
|
1752
1761
|
size: "sm",
|
|
1753
1762
|
"aria-label": n,
|
|
1754
|
-
className: w("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1755
|
-
onClick:
|
|
1763
|
+
className: w("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Z !== "small" && "text-foreground font-medium"),
|
|
1764
|
+
onClick: Mt,
|
|
1756
1765
|
title: r,
|
|
1757
1766
|
children: /* @__PURE__ */ M(e, { className: "h-3.5 w-3.5" })
|
|
1758
1767
|
});
|
|
1759
1768
|
})(),
|
|
1760
|
-
|
|
1769
|
+
k.compactToolbar && (k.showGroup || k.showColor || k.showDensity || k.showHideFields) && /* @__PURE__ */ M(We, {
|
|
1761
1770
|
t: _,
|
|
1762
|
-
allFields:
|
|
1763
|
-
showGroup:
|
|
1764
|
-
groupingConfig:
|
|
1765
|
-
setGroupingConfig:
|
|
1766
|
-
showColor:
|
|
1767
|
-
rowColorConfig:
|
|
1768
|
-
setRowColorConfig:
|
|
1769
|
-
showDensity:
|
|
1770
|
-
density:
|
|
1771
|
-
showHideFields:
|
|
1772
|
-
hiddenFields:
|
|
1773
|
-
updateHiddenFields:
|
|
1771
|
+
allFields: qt,
|
|
1772
|
+
showGroup: k.showGroup,
|
|
1773
|
+
groupingConfig: G,
|
|
1774
|
+
setGroupingConfig: ct,
|
|
1775
|
+
showColor: k.showColor,
|
|
1776
|
+
rowColorConfig: K,
|
|
1777
|
+
setRowColorConfig: ft,
|
|
1778
|
+
showDensity: k.showDensity,
|
|
1779
|
+
density: X,
|
|
1780
|
+
showHideFields: k.showHideFields,
|
|
1781
|
+
hiddenFields: q,
|
|
1782
|
+
updateHiddenFields: Tt
|
|
1774
1783
|
}),
|
|
1775
|
-
(
|
|
1776
|
-
|
|
1777
|
-
open:
|
|
1778
|
-
onOpenChange:
|
|
1784
|
+
(k.showColor || k.showDensity || k.compactToolbar) && Y && E.allowExport !== !1 && /* @__PURE__ */ M("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1785
|
+
Y && E.allowExport !== !1 && /* @__PURE__ */ N(x, {
|
|
1786
|
+
open: Ot,
|
|
1787
|
+
onOpenChange: kt,
|
|
1779
1788
|
children: [/* @__PURE__ */ M(C, {
|
|
1780
1789
|
asChild: !0,
|
|
1781
1790
|
children: /* @__PURE__ */ N(d, {
|
|
1782
1791
|
variant: "ghost",
|
|
1783
1792
|
size: "sm",
|
|
1784
1793
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1785
|
-
children: [/* @__PURE__ */ M(
|
|
1794
|
+
children: [/* @__PURE__ */ M(O, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
|
|
1786
1795
|
className: "hidden sm:inline",
|
|
1787
1796
|
children: _("list.export")
|
|
1788
1797
|
})]
|
|
@@ -1792,12 +1801,12 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1792
1801
|
className: "w-48 p-2",
|
|
1793
1802
|
children: /* @__PURE__ */ M("div", {
|
|
1794
1803
|
className: "space-y-1",
|
|
1795
|
-
children: (
|
|
1804
|
+
children: (Y.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ N(d, {
|
|
1796
1805
|
variant: "ghost",
|
|
1797
1806
|
size: "sm",
|
|
1798
1807
|
className: "w-full justify-start h-8 text-xs",
|
|
1799
|
-
onClick: () =>
|
|
1800
|
-
children: [/* @__PURE__ */ M(
|
|
1808
|
+
onClick: () => Kt(e),
|
|
1809
|
+
children: [/* @__PURE__ */ M(O, { className: "h-3.5 w-3.5 mr-2" }), _("list.exportAs", { format: e.toUpperCase() })]
|
|
1801
1810
|
}, e))
|
|
1802
1811
|
})
|
|
1803
1812
|
})]
|
|
@@ -1825,12 +1834,12 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1825
1834
|
})]
|
|
1826
1835
|
}),
|
|
1827
1836
|
(() => {
|
|
1828
|
-
let e = E.allowPrinting || E.sharing?.enabled || E.sharing?.type ||
|
|
1829
|
-
return
|
|
1837
|
+
let e = E.allowPrinting || E.sharing?.enabled || E.sharing?.type || Y && E.allowExport !== !1;
|
|
1838
|
+
return k.showSearch && e ? /* @__PURE__ */ M("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }) : null;
|
|
1830
1839
|
})(),
|
|
1831
|
-
|
|
1832
|
-
open:
|
|
1833
|
-
onOpenChange:
|
|
1840
|
+
k.showSearch && /* @__PURE__ */ N(x, {
|
|
1841
|
+
open: Ee,
|
|
1842
|
+
onOpenChange: De,
|
|
1834
1843
|
children: [/* @__PURE__ */ M(C, {
|
|
1835
1844
|
asChild: !0,
|
|
1836
1845
|
children: /* @__PURE__ */ M(d, {
|
|
@@ -1852,7 +1861,7 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1852
1861
|
/* @__PURE__ */ M(y, {
|
|
1853
1862
|
placeholder: _("list.search") + "...",
|
|
1854
1863
|
value: j,
|
|
1855
|
-
onChange: (e) =>
|
|
1864
|
+
onChange: (e) => Bt(e.target.value),
|
|
1856
1865
|
className: "pl-7 h-8 text-xs",
|
|
1857
1866
|
autoFocus: !0
|
|
1858
1867
|
}),
|
|
@@ -1860,14 +1869,14 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1860
1869
|
variant: "ghost",
|
|
1861
1870
|
size: "sm",
|
|
1862
1871
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
1863
|
-
onClick: () =>
|
|
1872
|
+
onClick: () => Bt(""),
|
|
1864
1873
|
children: /* @__PURE__ */ M(Ce, { className: "h-3 w-3" })
|
|
1865
1874
|
})
|
|
1866
1875
|
]
|
|
1867
1876
|
})
|
|
1868
1877
|
})]
|
|
1869
1878
|
}),
|
|
1870
|
-
|
|
1879
|
+
k.showAddRecord && k.addRecordPosition === "top" && /* @__PURE__ */ N(d, {
|
|
1871
1880
|
variant: "ghost",
|
|
1872
1881
|
size: "sm",
|
|
1873
1882
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
@@ -1881,23 +1890,23 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1881
1890
|
]
|
|
1882
1891
|
})]
|
|
1883
1892
|
}),
|
|
1884
|
-
|
|
1893
|
+
J && J.length > 0 && /* @__PURE__ */ M("div", {
|
|
1885
1894
|
className: "hidden sm:flex border-b px-2 sm:px-4 py-1 items-center gap-1 flex-wrap bg-background",
|
|
1886
1895
|
"data-testid": "quick-filters",
|
|
1887
|
-
children:
|
|
1888
|
-
let t =
|
|
1896
|
+
children: J.map((e) => {
|
|
1897
|
+
let t = vt.has(e.id), n = e.icon ? we[e.icon.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
1889
1898
|
return /* @__PURE__ */ N(d, {
|
|
1890
1899
|
variant: t ? "default" : "outline",
|
|
1891
1900
|
size: "sm",
|
|
1892
1901
|
className: "h-7 px-3 text-xs",
|
|
1893
|
-
onClick: () =>
|
|
1902
|
+
onClick: () => Gt(e.id),
|
|
1894
1903
|
children: [n && /* @__PURE__ */ M(n, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
1895
1904
|
}, e.id);
|
|
1896
1905
|
})
|
|
1897
1906
|
}),
|
|
1898
1907
|
/* @__PURE__ */ N("div", {
|
|
1899
1908
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
1900
|
-
children: [/* @__PURE__ */ M(ne, { active:
|
|
1909
|
+
children: [/* @__PURE__ */ M(ne, { active: z && R.length > 0 }), z && R.length === 0 ? /* @__PURE__ */ N("div", {
|
|
1901
1910
|
className: "flex flex-col h-full min-h-[200px] p-4 gap-2",
|
|
1902
1911
|
"data-testid": "list-loading",
|
|
1903
1912
|
role: "status",
|
|
@@ -1917,13 +1926,13 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1917
1926
|
className: "h-9 rounded bg-muted/60 animate-pulse",
|
|
1918
1927
|
style: { opacity: Math.max(.25, 1 - e * .12) }
|
|
1919
1928
|
}, e))]
|
|
1920
|
-
}) : !
|
|
1929
|
+
}) : !z && R.length === 0 && A === "grid" ? (() => {
|
|
1921
1930
|
let e = E.emptyState?.icon;
|
|
1922
1931
|
return /* @__PURE__ */ N("div", {
|
|
1923
1932
|
className: "flex flex-col items-center justify-center h-full min-h-[200px] text-center p-8",
|
|
1924
1933
|
"data-testid": "empty-state",
|
|
1925
1934
|
children: [
|
|
1926
|
-
/* @__PURE__ */ M(e ? we[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ??
|
|
1935
|
+
/* @__PURE__ */ M(e ? we[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? ue : ue, { className: "h-12 w-12 text-muted-foreground/50 mb-4" }),
|
|
1927
1936
|
/* @__PURE__ */ M("h3", {
|
|
1928
1937
|
className: "text-lg font-medium text-foreground mb-1",
|
|
1929
1938
|
children: (typeof E.emptyState?.title == "string" ? E.emptyState.title : void 0) ?? _("list.noItems")
|
|
@@ -1932,7 +1941,7 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1932
1941
|
className: "text-sm text-muted-foreground max-w-md",
|
|
1933
1942
|
children: (typeof E.emptyState?.message == "string" ? E.emptyState.message : void 0) ?? _("list.noItemsMessage")
|
|
1934
1943
|
}),
|
|
1935
|
-
|
|
1944
|
+
k.showAddRecord && /* @__PURE__ */ N(d, {
|
|
1936
1945
|
variant: "default",
|
|
1937
1946
|
size: "sm",
|
|
1938
1947
|
className: "mt-4",
|
|
@@ -1943,14 +1952,14 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1943
1952
|
]
|
|
1944
1953
|
});
|
|
1945
1954
|
})() : /* @__PURE__ */ M(ke, {
|
|
1946
|
-
schema:
|
|
1955
|
+
schema: Ht,
|
|
1947
1956
|
...h,
|
|
1948
|
-
data:
|
|
1949
|
-
loading:
|
|
1950
|
-
onRowSelect:
|
|
1957
|
+
data: R,
|
|
1958
|
+
loading: z,
|
|
1959
|
+
onRowSelect: gt
|
|
1951
1960
|
})]
|
|
1952
1961
|
}, A),
|
|
1953
|
-
|
|
1962
|
+
k.showAddRecord && k.addRecordPosition === "bottom" && /* @__PURE__ */ M("div", {
|
|
1954
1963
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
1955
1964
|
children: /* @__PURE__ */ N(d, {
|
|
1956
1965
|
variant: "ghost",
|
|
@@ -1964,19 +1973,19 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1964
1973
|
})]
|
|
1965
1974
|
})
|
|
1966
1975
|
}),
|
|
1967
|
-
E.bulkActions && E.bulkActions.length > 0 &&
|
|
1976
|
+
E.bulkActions && E.bulkActions.length > 0 && ht.length > 0 && A !== "grid" && /* @__PURE__ */ N("div", {
|
|
1968
1977
|
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",
|
|
1969
1978
|
role: "region",
|
|
1970
1979
|
"aria-label": "Bulk actions",
|
|
1971
1980
|
"data-testid": "bulk-actions-bar",
|
|
1972
1981
|
children: [
|
|
1973
|
-
/* @__PURE__ */ M(
|
|
1982
|
+
/* @__PURE__ */ M(oe, { className: "h-3.5 w-3.5 text-primary shrink-0" }),
|
|
1974
1983
|
/* @__PURE__ */ N("span", {
|
|
1975
1984
|
className: "font-medium",
|
|
1976
1985
|
children: [
|
|
1977
|
-
|
|
1986
|
+
ht.length,
|
|
1978
1987
|
" ",
|
|
1979
|
-
|
|
1988
|
+
ht.length === 1 ? "item" : "items",
|
|
1980
1989
|
" selected"
|
|
1981
1990
|
]
|
|
1982
1991
|
}),
|
|
@@ -1988,9 +1997,9 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1988
1997
|
variant: n ? "destructive" : "outline",
|
|
1989
1998
|
size: "sm",
|
|
1990
1999
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
1991
|
-
onClick: () => h.onBulkAction?.(e,
|
|
2000
|
+
onClick: () => h.onBulkAction?.(e, ht),
|
|
1992
2001
|
"data-testid": `bulk-action-${e}`,
|
|
1993
|
-
children: [r && /* @__PURE__ */ M(r, { className: "h-3 w-3" }),
|
|
2002
|
+
children: [r && /* @__PURE__ */ M(r, { className: "h-3 w-3" }), ce(e)]
|
|
1994
2003
|
}, e);
|
|
1995
2004
|
})
|
|
1996
2005
|
}),
|
|
@@ -1998,33 +2007,33 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1998
2007
|
variant: "ghost",
|
|
1999
2008
|
size: "sm",
|
|
2000
2009
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
2001
|
-
onClick: () =>
|
|
2010
|
+
onClick: () => gt([]),
|
|
2002
2011
|
children: [/* @__PURE__ */ M(Ce, { className: "h-3 w-3" }), "Clear"]
|
|
2003
2012
|
})
|
|
2004
2013
|
]
|
|
2005
2014
|
}),
|
|
2006
|
-
!
|
|
2015
|
+
!z && R.length > 0 && E.showRecordCount !== !1 && /* @__PURE__ */ N("div", {
|
|
2007
2016
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
2008
2017
|
"data-testid": "record-count-bar",
|
|
2009
2018
|
children: [
|
|
2010
2019
|
/* @__PURE__ */ M("span", {
|
|
2011
2020
|
className: "font-medium text-foreground/80",
|
|
2012
|
-
children:
|
|
2021
|
+
children: R.length === 1 ? _("list.recordCountOne", { count: R.length }) : _("list.recordCount", { count: R.length })
|
|
2013
2022
|
}),
|
|
2014
|
-
|
|
2023
|
+
it && /* @__PURE__ */ M("span", {
|
|
2015
2024
|
className: "text-amber-600",
|
|
2016
2025
|
"data-testid": "data-limit-warning",
|
|
2017
|
-
children: _("list.dataLimitReached", { limit:
|
|
2026
|
+
children: _("list.dataLimitReached", { limit: U })
|
|
2018
2027
|
}),
|
|
2019
2028
|
E.pagination?.pageSizeOptions && E.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ N("div", {
|
|
2020
2029
|
className: "ml-auto flex items-center gap-2",
|
|
2021
2030
|
children: [/* @__PURE__ */ M("span", { children: _("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ M("select", {
|
|
2022
2031
|
"data-testid": "page-size-selector",
|
|
2023
2032
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
2024
|
-
value: String(
|
|
2033
|
+
value: String(U),
|
|
2025
2034
|
onChange: (e) => {
|
|
2026
2035
|
let t = Number(e.target.value);
|
|
2027
|
-
|
|
2036
|
+
st(t), h.onPageSizeChange && h.onPageSizeChange(t);
|
|
2028
2037
|
},
|
|
2029
2038
|
children: E.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ M("option", {
|
|
2030
2039
|
value: String(e),
|
|
@@ -2034,8 +2043,8 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
2034
2043
|
})
|
|
2035
2044
|
]
|
|
2036
2045
|
}),
|
|
2037
|
-
|
|
2038
|
-
...
|
|
2046
|
+
Vt.isOverlay && /* @__PURE__ */ M(te, {
|
|
2047
|
+
...Vt,
|
|
2039
2048
|
title: E.label ? `${E.label} Detail` : E.objectName ? `${E.objectName.charAt(0).toUpperCase() + E.objectName.slice(1)} Detail` : "Record Detail",
|
|
2040
2049
|
children: (e) => /* @__PURE__ */ M("div", {
|
|
2041
2050
|
className: "space-y-3",
|
|
@@ -2054,18 +2063,18 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
2054
2063
|
]
|
|
2055
2064
|
});
|
|
2056
2065
|
});
|
|
2057
|
-
|
|
2066
|
+
H.displayName = "ListView";
|
|
2058
2067
|
//#endregion
|
|
2059
2068
|
//#region src/ObjectGallery.tsx
|
|
2060
|
-
var
|
|
2069
|
+
var it = {
|
|
2061
2070
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
2062
2071
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
2063
2072
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
2064
|
-
},
|
|
2073
|
+
}, at = {
|
|
2065
2074
|
small: "aspect-square",
|
|
2066
2075
|
medium: "aspect-[4/3]",
|
|
2067
2076
|
large: "aspect-[16/10]"
|
|
2068
|
-
},
|
|
2077
|
+
}, ot = [
|
|
2069
2078
|
{
|
|
2070
2079
|
bg: "from-indigo-500/15 via-indigo-500/5 to-purple-500/10",
|
|
2071
2080
|
ring: "ring-indigo-500/15",
|
|
@@ -2097,17 +2106,17 @@ var rt = {
|
|
|
2097
2106
|
text: "text-violet-600/70 dark:text-violet-300/70"
|
|
2098
2107
|
}
|
|
2099
2108
|
];
|
|
2100
|
-
function
|
|
2109
|
+
function st(e) {
|
|
2101
2110
|
let t = 5381;
|
|
2102
2111
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n);
|
|
2103
|
-
return
|
|
2112
|
+
return ot[Math.abs(t) % ot.length];
|
|
2104
2113
|
}
|
|
2105
|
-
var
|
|
2106
|
-
let { schema: n } = e, r = s(
|
|
2114
|
+
var U = (e) => {
|
|
2115
|
+
let { schema: n } = e, r = s(Ae), i = e.dataSource || r?.dataSource, a = je(n.bind), [d, m] = u([]), [h, g] = u(!1), [_, v] = u(null), ee = Ne({
|
|
2107
2116
|
navigation: n.navigation,
|
|
2108
2117
|
objectName: n.objectName,
|
|
2109
2118
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
2110
|
-
}), y = n.gallery, b = y?.coverField ?? n.imageField ?? "image", x = y?.coverFit ?? "cover", S = y?.cardSize ?? "medium", C = y?.titleField ?? n.titleField ?? "name", ne = y?.visibleFields, { fieldOptionLabel: re } =
|
|
2119
|
+
}), y = n.gallery, b = y?.coverField ?? n.imageField ?? "image", x = y?.coverFit ?? "cover", S = y?.cardSize ?? "medium", C = y?.titleField ?? n.titleField ?? "name", ne = y?.visibleFields, { fieldOptionLabel: re } = P(), ie = o((e) => {
|
|
2111
2120
|
let t = _?.fields?.[e], r = { name: e };
|
|
2112
2121
|
if (t) {
|
|
2113
2122
|
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);
|
|
@@ -2177,18 +2186,18 @@ var K = (e) => {
|
|
|
2177
2186
|
e.data,
|
|
2178
2187
|
_
|
|
2179
2188
|
]);
|
|
2180
|
-
let T = e.data || a || n.data || d || [],
|
|
2181
|
-
|
|
2189
|
+
let T = e.data || a || n.data || d || [], ae = l(() => T.some((e) => typeof e[b] == "string" && !!e[b]), [T, b]), oe = !!y?.coverField || ae, O = n.grouping?.fields, se = !!(O && O.length > 0), [ce, k] = u({}), le = l(() => O ? O.some((e) => e.collapsed) : !1, [O]), A = o((e) => {
|
|
2190
|
+
k((t) => ({
|
|
2182
2191
|
...t,
|
|
2183
|
-
[e]: t[e] === void 0 ? !
|
|
2192
|
+
[e]: t[e] === void 0 ? !le : !t[e]
|
|
2184
2193
|
}));
|
|
2185
|
-
}, [
|
|
2186
|
-
if (!
|
|
2194
|
+
}, [le]), ue = l(() => {
|
|
2195
|
+
if (!se || !O) return [];
|
|
2187
2196
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
2188
2197
|
for (let n of T) {
|
|
2189
|
-
let r =
|
|
2198
|
+
let r = O.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
2190
2199
|
if (!e.has(r)) {
|
|
2191
|
-
let i =
|
|
2200
|
+
let i = O.map((e) => {
|
|
2192
2201
|
let t = n[e.field];
|
|
2193
2202
|
return t != null && t !== "" ? String(t) : "(empty)";
|
|
2194
2203
|
}).join(" / ");
|
|
@@ -2199,7 +2208,7 @@ var K = (e) => {
|
|
|
2199
2208
|
}
|
|
2200
2209
|
e.get(r).items.push(n);
|
|
2201
2210
|
}
|
|
2202
|
-
let n =
|
|
2211
|
+
let n = O[0]?.order ?? "asc";
|
|
2203
2212
|
return t.sort((e, t) => {
|
|
2204
2213
|
let r = e.localeCompare(t, void 0, {
|
|
2205
2214
|
numeric: !0,
|
|
@@ -2207,7 +2216,7 @@ var K = (e) => {
|
|
|
2207
2216
|
});
|
|
2208
2217
|
return n === "desc" ? -r : r;
|
|
2209
2218
|
}), t.map((t) => {
|
|
2210
|
-
let n = e.get(t), r = t in
|
|
2219
|
+
let n = e.get(t), r = t in ce ? ce[t] : le;
|
|
2211
2220
|
return {
|
|
2212
2221
|
key: t,
|
|
2213
2222
|
label: n.label,
|
|
@@ -2217,10 +2226,10 @@ var K = (e) => {
|
|
|
2217
2226
|
});
|
|
2218
2227
|
}, [
|
|
2219
2228
|
T,
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2229
|
+
O,
|
|
2230
|
+
se,
|
|
2231
|
+
ce,
|
|
2232
|
+
le
|
|
2224
2233
|
]);
|
|
2225
2234
|
if (h && !T.length) return /* @__PURE__ */ M("div", {
|
|
2226
2235
|
className: "p-4 text-sm text-muted-foreground",
|
|
@@ -2230,20 +2239,20 @@ var K = (e) => {
|
|
|
2230
2239
|
className: "p-4 text-sm text-muted-foreground",
|
|
2231
2240
|
children: "No items to display"
|
|
2232
2241
|
});
|
|
2233
|
-
let
|
|
2234
|
-
let i = t.id ?? t._id ?? r, a = String(t[C] ?? "Untitled"), o = t[b], s =
|
|
2242
|
+
let de = (t, r) => {
|
|
2243
|
+
let i = t.id ?? t._id ?? r, a = String(t[C] ?? "Untitled"), o = t[b], s = st(String(i) + "|" + a);
|
|
2235
2244
|
return /* @__PURE__ */ N(f, {
|
|
2236
2245
|
role: "listitem",
|
|
2237
2246
|
className: w("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"),
|
|
2238
2247
|
onClick: (e) => ee.handleClick(t, e),
|
|
2239
2248
|
children: [
|
|
2240
|
-
!
|
|
2249
|
+
!oe && /* @__PURE__ */ M("div", {
|
|
2241
2250
|
"aria-hidden": !0,
|
|
2242
2251
|
className: w("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", s.bg)
|
|
2243
2252
|
}),
|
|
2244
2253
|
/* @__PURE__ */ M("div", {
|
|
2245
|
-
className: w("w-full overflow-hidden relative",
|
|
2246
|
-
hidden: !
|
|
2254
|
+
className: w("w-full overflow-hidden relative", at[S]),
|
|
2255
|
+
hidden: !oe,
|
|
2247
2256
|
children: o ? /* @__PURE__ */ M("img", {
|
|
2248
2257
|
src: o,
|
|
2249
2258
|
alt: a,
|
|
@@ -2257,7 +2266,7 @@ var K = (e) => {
|
|
|
2257
2266
|
})
|
|
2258
2267
|
}),
|
|
2259
2268
|
/* @__PURE__ */ N(p, {
|
|
2260
|
-
className: w("p-3",
|
|
2269
|
+
className: w("p-3", oe && "border-t border-border/60"),
|
|
2261
2270
|
children: [/* @__PURE__ */ M("h3", {
|
|
2262
2271
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2263
2272
|
title: a,
|
|
@@ -2283,30 +2292,30 @@ var K = (e) => {
|
|
|
2283
2292
|
})
|
|
2284
2293
|
]
|
|
2285
2294
|
}, i);
|
|
2286
|
-
},
|
|
2287
|
-
className: w("grid gap-4 p-4 auto-rows-min content-start",
|
|
2295
|
+
}, j = (e) => /* @__PURE__ */ M("div", {
|
|
2296
|
+
className: w("grid gap-4 p-4 auto-rows-min content-start", it[S], n.className),
|
|
2288
2297
|
role: "list",
|
|
2289
|
-
children: e.map((e, t) =>
|
|
2298
|
+
children: e.map((e, t) => de(e, t))
|
|
2290
2299
|
});
|
|
2291
|
-
return /* @__PURE__ */ N(Te, { children: [
|
|
2300
|
+
return /* @__PURE__ */ N(Te, { children: [se ? /* @__PURE__ */ M("div", {
|
|
2292
2301
|
className: "space-y-2",
|
|
2293
|
-
children:
|
|
2302
|
+
children: ue.map((e) => /* @__PURE__ */ N("div", {
|
|
2294
2303
|
className: "border rounded-md",
|
|
2295
2304
|
children: [/* @__PURE__ */ N("button", {
|
|
2296
2305
|
type: "button",
|
|
2297
2306
|
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",
|
|
2298
|
-
onClick: () =>
|
|
2307
|
+
onClick: () => A(e.key),
|
|
2299
2308
|
children: [
|
|
2300
|
-
e.collapsed ? /* @__PURE__ */ M(
|
|
2309
|
+
e.collapsed ? /* @__PURE__ */ M(D, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ M(E, { className: "h-4 w-4 shrink-0" }),
|
|
2301
2310
|
/* @__PURE__ */ M("span", { children: e.label }),
|
|
2302
2311
|
/* @__PURE__ */ M("span", {
|
|
2303
2312
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2304
2313
|
children: e.items.length
|
|
2305
2314
|
})
|
|
2306
2315
|
]
|
|
2307
|
-
}), !e.collapsed &&
|
|
2316
|
+
}), !e.collapsed && j(e.items)]
|
|
2308
2317
|
}, e.key))
|
|
2309
|
-
}) :
|
|
2318
|
+
}) : j(T), ee.isOverlay && /* @__PURE__ */ M(te, {
|
|
2310
2319
|
...ee,
|
|
2311
2320
|
title: "Gallery Item",
|
|
2312
2321
|
children: (e) => /* @__PURE__ */ M("div", {
|
|
@@ -2324,11 +2333,11 @@ var K = (e) => {
|
|
|
2324
2333
|
})
|
|
2325
2334
|
})] });
|
|
2326
2335
|
};
|
|
2327
|
-
e.register("object-gallery",
|
|
2336
|
+
e.register("object-gallery", U, {
|
|
2328
2337
|
namespace: "plugin-list",
|
|
2329
2338
|
label: "Gallery View",
|
|
2330
2339
|
category: "view"
|
|
2331
|
-
}), e.register("list-view",
|
|
2340
|
+
}), e.register("list-view", H, {
|
|
2332
2341
|
namespace: "plugin-list",
|
|
2333
2342
|
label: "List View",
|
|
2334
2343
|
category: "Views",
|
|
@@ -2405,7 +2414,7 @@ e.register("object-gallery", K, {
|
|
|
2405
2414
|
sort: [],
|
|
2406
2415
|
options: {}
|
|
2407
2416
|
}
|
|
2408
|
-
}), e.register("list",
|
|
2417
|
+
}), e.register("list", H, {
|
|
2409
2418
|
namespace: "view",
|
|
2410
2419
|
category: "view",
|
|
2411
2420
|
label: "List",
|
|
@@ -2476,4 +2485,4 @@ e.register("object-gallery", K, {
|
|
|
2476
2485
|
]
|
|
2477
2486
|
});
|
|
2478
2487
|
//#endregion
|
|
2479
|
-
export {
|
|
2488
|
+
export { H as ListView, U as ObjectGallery, He as TabBar, Ue as TabBarSelect, qe as UserFilters, Be as ViewSwitcher, Qe as evaluateConditionalFormatting, V as normalizeFilterCondition, Xe as normalizeFilters };
|