@object-ui/plugin-list 11.4.0 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/ListView.d.ts +11 -0
- package/dist/ListView.d.ts.map +1 -1
- package/dist/index.js +629 -625
- package/dist/index.umd.cjs +2 -2
- package/package.json +18 -18
package/dist/index.js
CHANGED
|
@@ -2,25 +2,25 @@ import { ComponentRegistry as e, buildExpandFields as t, evaluatePlainCondition
|
|
|
2
2
|
import * as i from "react";
|
|
3
3
|
import { useCallback as a, useContext as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
4
4
|
import { Button as u, Card as d, CardContent as f, DataEmptyState 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 x, Popover as S, PopoverContent as C, PopoverTrigger as w, RefreshIndicator as te, SortBuilder as T, cn as E } from "@object-ui/components";
|
|
5
|
-
import { Activity as
|
|
5
|
+
import { Activity as D, AlertTriangle as ne, ArrowUpDown as re, BarChart3 as O, Calendar as ie, Check as k, CheckSquare as ae, ChevronDown as A, ChevronRight as oe, Download as se, EyeOff as ce, GanttChartSquare as j, Grid as M, Group as le, Images as N, Inbox as ue, LayoutGrid as de, ListTree as P, Loader2 as fe, Map as F, Paintbrush as pe, Pencil as me, Plus as he, Printer as ge, RotateCw as _e, Rows2 as ve, Rows3 as ye, Rows4 as be, Search as xe, Settings2 as Se, Share2 as Ce, SlidersHorizontal as we, Trash2 as Te, X as Ee, icons as De } from "lucide-react";
|
|
6
6
|
import { Fragment as Oe, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
7
|
-
import { useObjectLabel as
|
|
8
|
-
import { SchemaRenderer as
|
|
7
|
+
import { useObjectLabel as R, useObjectTranslation as ke, useSafeFieldLabel as Ae } from "@object-ui/i18n";
|
|
8
|
+
import { SchemaRenderer as je, SchemaRendererContext as Me, useDataScope as Ne, useDensityMode as Pe, useNavigationOverlay as Fe, useSafeFieldLabel as Ie } from "@object-ui/react";
|
|
9
9
|
import { usePullToRefresh as Le } from "@object-ui/mobile";
|
|
10
10
|
import { usePermissions as Re } from "@object-ui/permissions";
|
|
11
|
-
import { getCellRenderer as ze, resolveCellRendererType as
|
|
11
|
+
import { getCellRenderer as ze, resolveCellRendererType as z } from "@object-ui/fields";
|
|
12
12
|
//#region src/ViewSwitcher.tsx
|
|
13
|
-
var
|
|
14
|
-
grid: /* @__PURE__ */ I(
|
|
15
|
-
kanban: /* @__PURE__ */ I(
|
|
13
|
+
var B = {
|
|
14
|
+
grid: /* @__PURE__ */ I(M, { className: "h-4 w-4" }),
|
|
15
|
+
kanban: /* @__PURE__ */ I(de, { className: "h-4 w-4" }),
|
|
16
16
|
gallery: /* @__PURE__ */ I(N, { className: "h-4 w-4" }),
|
|
17
|
-
calendar: /* @__PURE__ */ I(
|
|
18
|
-
timeline: /* @__PURE__ */ I(
|
|
19
|
-
gantt: /* @__PURE__ */ I(
|
|
17
|
+
calendar: /* @__PURE__ */ I(ie, { className: "h-4 w-4" }),
|
|
18
|
+
timeline: /* @__PURE__ */ I(D, { className: "h-4 w-4" }),
|
|
19
|
+
gantt: /* @__PURE__ */ I(j, { className: "h-4 w-4" }),
|
|
20
20
|
map: /* @__PURE__ */ I(F, { className: "h-4 w-4" }),
|
|
21
|
-
chart: /* @__PURE__ */ I(
|
|
22
|
-
tree: /* @__PURE__ */ I(
|
|
23
|
-
},
|
|
21
|
+
chart: /* @__PURE__ */ I(O, { className: "h-4 w-4" }),
|
|
22
|
+
tree: /* @__PURE__ */ I(P, { className: "h-4 w-4" })
|
|
23
|
+
}, V = {
|
|
24
24
|
grid: "Grid",
|
|
25
25
|
kanban: "Kanban",
|
|
26
26
|
gallery: "Gallery",
|
|
@@ -30,7 +30,7 @@ var Ve = {
|
|
|
30
30
|
map: "Map",
|
|
31
31
|
chart: "Chart",
|
|
32
32
|
tree: "Tree"
|
|
33
|
-
},
|
|
33
|
+
}, Be = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: a = !0 }) => {
|
|
34
34
|
let [o, s] = i.useState(!1), c = i.useCallback((t) => {
|
|
35
35
|
s(!1), t !== e && (a && typeof document < "u" && "startViewTransition" in document ? document.startViewTransition(() => n(t)) : n(t));
|
|
36
36
|
}, [
|
|
@@ -48,14 +48,14 @@ var Ve = {
|
|
|
48
48
|
type: "button",
|
|
49
49
|
role: "tab",
|
|
50
50
|
"aria-selected": n,
|
|
51
|
-
"aria-label":
|
|
52
|
-
title:
|
|
51
|
+
"aria-label": V[t],
|
|
52
|
+
title: V[t],
|
|
53
53
|
"data-state": n ? "on" : "off",
|
|
54
54
|
onClick: () => c(t),
|
|
55
55
|
className: E("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[7px] text-xs font-medium transition-all duration-150", n ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"),
|
|
56
|
-
children: [
|
|
56
|
+
children: [B[t], /* @__PURE__ */ I("span", {
|
|
57
57
|
className: "hidden sm:inline-block",
|
|
58
|
-
children:
|
|
58
|
+
children: V[t]
|
|
59
59
|
})]
|
|
60
60
|
}, t);
|
|
61
61
|
})
|
|
@@ -67,13 +67,13 @@ var Ve = {
|
|
|
67
67
|
children: /* @__PURE__ */ L("button", {
|
|
68
68
|
type: "button",
|
|
69
69
|
"data-testid": "view-switcher-dropdown",
|
|
70
|
-
"aria-label":
|
|
70
|
+
"aria-label": V[e],
|
|
71
71
|
className: E("inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher", o ? "text-foreground bg-muted" : "text-muted-foreground hover:text-foreground", r),
|
|
72
72
|
children: [
|
|
73
|
-
|
|
73
|
+
B[e],
|
|
74
74
|
/* @__PURE__ */ I("span", {
|
|
75
75
|
className: "hidden sm:inline-block",
|
|
76
|
-
children:
|
|
76
|
+
children: V[e]
|
|
77
77
|
}),
|
|
78
78
|
/* @__PURE__ */ I(A, { className: "h-3 w-3 opacity-60" })
|
|
79
79
|
]
|
|
@@ -87,17 +87,17 @@ var Ve = {
|
|
|
87
87
|
"data-state": t === e ? "on" : "off",
|
|
88
88
|
className: E("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors hover:bg-muted", t === e ? "text-foreground font-medium" : "text-muted-foreground"),
|
|
89
89
|
children: [
|
|
90
|
-
|
|
90
|
+
B[t],
|
|
91
91
|
/* @__PURE__ */ I("span", {
|
|
92
92
|
className: "flex-1 text-left",
|
|
93
|
-
children:
|
|
93
|
+
children: V[t]
|
|
94
94
|
}),
|
|
95
95
|
t === e && /* @__PURE__ */ I(k, { className: "h-3.5 w-3.5" })
|
|
96
96
|
]
|
|
97
97
|
}, t))
|
|
98
98
|
})]
|
|
99
99
|
});
|
|
100
|
-
},
|
|
100
|
+
}, Ve = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: a = !0 }) => {
|
|
101
101
|
let o = i.useCallback((t) => {
|
|
102
102
|
if (!a || t === e) {
|
|
103
103
|
n(t);
|
|
@@ -116,14 +116,14 @@ var Ve = {
|
|
|
116
116
|
return /* @__PURE__ */ L("button", {
|
|
117
117
|
type: "button",
|
|
118
118
|
onClick: () => o(t),
|
|
119
|
-
"aria-label":
|
|
120
|
-
title:
|
|
119
|
+
"aria-label": V[t],
|
|
120
|
+
title: V[t],
|
|
121
121
|
"aria-pressed": n,
|
|
122
122
|
"data-state": n ? "on" : "off",
|
|
123
123
|
className: E("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"),
|
|
124
|
-
children: [
|
|
124
|
+
children: [B[t], /* @__PURE__ */ I("span", {
|
|
125
125
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
126
|
-
children:
|
|
126
|
+
children: V[t]
|
|
127
127
|
})]
|
|
128
128
|
}, t);
|
|
129
129
|
})
|
|
@@ -131,7 +131,7 @@ var Ve = {
|
|
|
131
131
|
};
|
|
132
132
|
//#endregion
|
|
133
133
|
//#region src/components/ViewSettingsPopover.tsx
|
|
134
|
-
function
|
|
134
|
+
function He({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: a = !0, children: o }) {
|
|
135
135
|
let [s, c] = i.useState(a);
|
|
136
136
|
return /* @__PURE__ */ L("div", {
|
|
137
137
|
className: "border-b last:border-b-0",
|
|
@@ -161,7 +161,7 @@ function Ue({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: a = !0
|
|
|
161
161
|
})]
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Ue(e) {
|
|
165
165
|
let { t, allFields: n, showGroup: r, groupingConfig: a, setGroupingConfig: o, showColor: s, rowColorConfig: c, setRowColorConfig: l, showDensity: d, density: f, showHideFields: p, hiddenFields: m, updateHiddenFields: h, showInlineEdit: g, inlineEdit: _, setInlineEdit: v } = e, [y, b] = i.useState(!1), x = [
|
|
166
166
|
!!a?.fields?.length,
|
|
167
167
|
!!c?.field,
|
|
@@ -208,7 +208,7 @@ function We(e) {
|
|
|
208
208
|
children: t("list.viewSettingsHint", { defaultValue: "Grouping, color, density, and visible fields." })
|
|
209
209
|
})]
|
|
210
210
|
}),
|
|
211
|
-
r && o && /* @__PURE__ */ I(
|
|
211
|
+
r && o && /* @__PURE__ */ I(He, {
|
|
212
212
|
title: t("list.group", { defaultValue: "Group" }),
|
|
213
213
|
badge: a?.fields?.length || 0,
|
|
214
214
|
onClear: a ? () => o(void 0) : void 0,
|
|
@@ -228,7 +228,7 @@ function We(e) {
|
|
|
228
228
|
onChange: (e) => o(e)
|
|
229
229
|
})
|
|
230
230
|
}),
|
|
231
|
-
s && l && /* @__PURE__ */ L(
|
|
231
|
+
s && l && /* @__PURE__ */ L(He, {
|
|
232
232
|
title: t("list.color", { defaultValue: "Row color" }),
|
|
233
233
|
onClear: c ? () => l(void 0) : void 0,
|
|
234
234
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
@@ -256,7 +256,7 @@ function We(e) {
|
|
|
256
256
|
}, e.name))]
|
|
257
257
|
})]
|
|
258
258
|
}),
|
|
259
|
-
d && f && /* @__PURE__ */ I(
|
|
259
|
+
d && f && /* @__PURE__ */ I(He, {
|
|
260
260
|
title: t("grid.toolbar.densityMode", { defaultValue: "Density" }),
|
|
261
261
|
defaultOpen: f.mode !== "compact",
|
|
262
262
|
children: /* @__PURE__ */ L("div", {
|
|
@@ -277,7 +277,7 @@ function We(e) {
|
|
|
277
277
|
})]
|
|
278
278
|
})
|
|
279
279
|
}),
|
|
280
|
-
g && v && /* @__PURE__ */ I(
|
|
280
|
+
g && v && /* @__PURE__ */ I(He, {
|
|
281
281
|
title: t("list.recordEditingTitle", { defaultValue: "Record editing" }),
|
|
282
282
|
defaultOpen: !!_,
|
|
283
283
|
children: /* @__PURE__ */ L("label", {
|
|
@@ -291,7 +291,7 @@ function We(e) {
|
|
|
291
291
|
}), /* @__PURE__ */ I("span", { children: t("list.inlineEditLabel", { defaultValue: "Edit records inline (click a cell to edit)" }) })]
|
|
292
292
|
})
|
|
293
293
|
}),
|
|
294
|
-
p && m && h && /* @__PURE__ */ I(
|
|
294
|
+
p && m && h && /* @__PURE__ */ I(He, {
|
|
295
295
|
title: t("list.hideFieldsTitle", { defaultValue: "Hide fields" }),
|
|
296
296
|
badge: m.size,
|
|
297
297
|
onClear: m.size > 0 ? () => h(/* @__PURE__ */ new Set()) : void 0,
|
|
@@ -322,21 +322,21 @@ function We(e) {
|
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/UserFilters.tsx
|
|
325
|
-
function
|
|
325
|
+
function H() {
|
|
326
326
|
try {
|
|
327
|
-
let { t: e } =
|
|
327
|
+
let { t: e } = ke(), t = e("common.more");
|
|
328
328
|
return !t || t === "common.more" ? "More" : t;
|
|
329
329
|
} catch {
|
|
330
330
|
return "More";
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
var
|
|
333
|
+
var We = /* @__PURE__ */ new Set([
|
|
334
334
|
"lookup",
|
|
335
335
|
"master_detail",
|
|
336
336
|
"user",
|
|
337
337
|
"owner"
|
|
338
338
|
]);
|
|
339
|
-
function
|
|
339
|
+
function U(e) {
|
|
340
340
|
switch (e) {
|
|
341
341
|
case void 0:
|
|
342
342
|
case "equals":
|
|
@@ -353,21 +353,21 @@ function Ge(e) {
|
|
|
353
353
|
default: return e;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function W(e) {
|
|
357
357
|
return (e || []).filter((e) => e && (e.id || e.name)).map((e) => ({
|
|
358
358
|
id: e.id ?? e.name,
|
|
359
359
|
label: typeof e.label == "string" ? e.label : e.label?.toString?.() ?? e.id ?? e.name,
|
|
360
360
|
filters: Array.isArray(e.filters) ? e.filters : Array.isArray(e.filter) ? e.filter.filter((e) => e && typeof e.field == "string").map((e) => [
|
|
361
361
|
e.field,
|
|
362
|
-
|
|
362
|
+
U(e.operator),
|
|
363
363
|
e.value
|
|
364
364
|
]) : [],
|
|
365
365
|
default: e.default ?? e.isDefault
|
|
366
366
|
}));
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function Ge({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a, initialSelections: o, onSelectionsChange: s }) {
|
|
369
369
|
switch (e.element) {
|
|
370
|
-
case "dropdown": return /* @__PURE__ */ I(
|
|
370
|
+
case "dropdown": return /* @__PURE__ */ I(qe, {
|
|
371
371
|
fields: e.fields || [],
|
|
372
372
|
objectDef: t,
|
|
373
373
|
data: n,
|
|
@@ -377,8 +377,8 @@ function qe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
377
377
|
initialSelections: o,
|
|
378
378
|
onSelectionsChange: s
|
|
379
379
|
});
|
|
380
|
-
case "tabs": return /* @__PURE__ */ I(
|
|
381
|
-
tabs:
|
|
380
|
+
case "tabs": return /* @__PURE__ */ I(Je, {
|
|
381
|
+
tabs: W(e.tabs || []),
|
|
382
382
|
showAllRecords: e.showAllRecords !== !1,
|
|
383
383
|
allowAddTab: e.allowAddTab,
|
|
384
384
|
onFilterChange: r,
|
|
@@ -389,7 +389,7 @@ function qe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
389
389
|
default: return null;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Ke(e, t, n, r) {
|
|
393
393
|
return e.map((e) => {
|
|
394
394
|
let i = e.options ? [...e.options] : [], a = e.type, o, s, c;
|
|
395
395
|
if (t?.fields) {
|
|
@@ -426,15 +426,15 @@ function Je(e, t, n, r) {
|
|
|
426
426
|
};
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
let { fieldLabel: l, translateOptions: u } =
|
|
429
|
+
function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a, className: o, initialSelections: s, onSelectionsChange: c }) {
|
|
430
|
+
let { fieldLabel: l, translateOptions: u } = Ae(), d = H(), f = t?.name, [p, m] = i.useState(() => {
|
|
431
431
|
let t = {};
|
|
432
432
|
return e.forEach((e) => {
|
|
433
433
|
e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
|
|
434
434
|
let n = s?.[e.field];
|
|
435
435
|
n && n.length > 0 && (t[e.field] = n);
|
|
436
436
|
}), t;
|
|
437
|
-
}), h = i.useRef({}), g = i.useMemo(() =>
|
|
437
|
+
}), h = i.useRef({}), g = i.useMemo(() => Ke(e, t, n, {
|
|
438
438
|
objectName: f,
|
|
439
439
|
fieldLabel: l,
|
|
440
440
|
translateOptions: u
|
|
@@ -483,7 +483,7 @@ function U({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a,
|
|
|
483
483
|
n && (m(t), e = t), Object.values(e).some((e) => e.length > 0) && _(e);
|
|
484
484
|
}, []);
|
|
485
485
|
let ee = a !== void 0 && a < g.length ? g.slice(0, a) : g, y = a !== void 0 && a < g.length ? g.slice(a) : [], x = (e) => {
|
|
486
|
-
let t = p[e.field] || [], n = t.length > 0, r =
|
|
486
|
+
let t = p[e.field] || [], n = t.length > 0, r = We.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), i = r ? "w-72" : "w-56";
|
|
487
487
|
return /* @__PURE__ */ L(S, { children: [/* @__PURE__ */ I(w, {
|
|
488
488
|
asChild: !0,
|
|
489
489
|
children: /* @__PURE__ */ L("button", {
|
|
@@ -595,7 +595,7 @@ function U({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a,
|
|
|
595
595
|
})] })] })
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function Je({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: a, initialTab: o, onSelectionsChange: s }) {
|
|
599
599
|
let [c, l] = i.useState(() => o && (o === "__all__" || e.some((e) => e.id === o)) ? o : e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), u = i.useCallback((t) => {
|
|
600
600
|
l(t), r(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []), s?.({ _tab: [t] });
|
|
601
601
|
}, [
|
|
@@ -636,7 +636,7 @@ function Ye({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
|
|
|
636
636
|
}
|
|
637
637
|
//#endregion
|
|
638
638
|
//#region src/ListView.tsx
|
|
639
|
-
function
|
|
639
|
+
function G(e) {
|
|
640
640
|
switch (e) {
|
|
641
641
|
case "equals":
|
|
642
642
|
case "eq": return "=";
|
|
@@ -664,10 +664,10 @@ function W(e) {
|
|
|
664
664
|
default: return e;
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function K(e) {
|
|
668
668
|
if (!Array.isArray(e) || e.length < 3) return e;
|
|
669
669
|
let [t, n, r] = e;
|
|
670
|
-
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ?
|
|
670
|
+
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ? K(e) : e)] : n === "in" && Array.isArray(r) ? r.length === 0 ? [] : r.length === 1 ? [
|
|
671
671
|
t,
|
|
672
672
|
"=",
|
|
673
673
|
r[0]
|
|
@@ -685,15 +685,19 @@ function Xe(e) {
|
|
|
685
685
|
e
|
|
686
686
|
])] : e;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function Ye(e) {
|
|
689
689
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ?
|
|
691
|
+
function Xe(e) {
|
|
692
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? K(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function Ze(e) {
|
|
695
695
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
696
|
-
let t =
|
|
696
|
+
let t = Xe(e.conditions.filter((e) => {
|
|
697
|
+
if (e.operator === "isEmpty" || e.operator === "isNotEmpty") return !0;
|
|
698
|
+
let t = e.value;
|
|
699
|
+
return !(t == null || t === "" || Array.isArray(t) && t.length === 0);
|
|
700
|
+
}).map((e) => e.operator === "isEmpty" ? [
|
|
697
701
|
e.field,
|
|
698
702
|
"=",
|
|
699
703
|
null
|
|
@@ -703,12 +707,12 @@ function $e(e) {
|
|
|
703
707
|
null
|
|
704
708
|
] : [
|
|
705
709
|
e.field,
|
|
706
|
-
|
|
710
|
+
G(e.operator),
|
|
707
711
|
e.value
|
|
708
712
|
]));
|
|
709
713
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
710
714
|
}
|
|
711
|
-
function
|
|
715
|
+
function q(e, t) {
|
|
712
716
|
if (!t || t.length === 0) return {};
|
|
713
717
|
for (let r of t) {
|
|
714
718
|
let t = !1, i = ("condition" in r ? r.condition : void 0) || ("expression" in r ? r.expression : void 0) || void 0;
|
|
@@ -743,7 +747,7 @@ function et(e, t) {
|
|
|
743
747
|
}
|
|
744
748
|
return {};
|
|
745
749
|
}
|
|
746
|
-
var
|
|
750
|
+
var Qe = {
|
|
747
751
|
"list.recordCount": "{{count}} records",
|
|
748
752
|
"list.recordCountOne": "{{count}} record",
|
|
749
753
|
"list.noItems": "No items found",
|
|
@@ -790,67 +794,67 @@ var tt = {
|
|
|
790
794
|
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
791
795
|
"list.viewSettings": "View settings",
|
|
792
796
|
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
793
|
-
},
|
|
794
|
-
let n =
|
|
797
|
+
}, $e = (e, t, n) => n, et = (e, t) => {
|
|
798
|
+
let n = Qe[e] || e;
|
|
795
799
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
796
800
|
return n;
|
|
797
801
|
};
|
|
798
|
-
function
|
|
802
|
+
function tt() {
|
|
799
803
|
try {
|
|
800
|
-
let e =
|
|
801
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t:
|
|
804
|
+
let e = ke();
|
|
805
|
+
return e.t("list.recordCount") === "list.recordCount" ? { t: et } : { t: e.t };
|
|
802
806
|
} catch {
|
|
803
|
-
return { t:
|
|
807
|
+
return { t: et };
|
|
804
808
|
}
|
|
805
809
|
}
|
|
806
|
-
function
|
|
810
|
+
function nt() {
|
|
807
811
|
try {
|
|
808
|
-
let { fieldLabel: e, actionLabel: t } =
|
|
812
|
+
let { fieldLabel: e, actionLabel: t } = R();
|
|
809
813
|
return {
|
|
810
814
|
fieldLabel: e,
|
|
811
815
|
actionLabel: t
|
|
812
816
|
};
|
|
813
817
|
} catch {
|
|
814
818
|
return {
|
|
815
|
-
fieldLabel:
|
|
819
|
+
fieldLabel: $e,
|
|
816
820
|
actionLabel: void 0
|
|
817
821
|
};
|
|
818
822
|
}
|
|
819
823
|
}
|
|
820
|
-
var
|
|
821
|
-
let
|
|
824
|
+
var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChange: a, onSortChange: o, onSearchChange: s, onHiddenFieldsChange: c, onInlineEditChange: l, onColumnStateChange: d, onRowClick: f, showViewSwitcher: m, userFilterSelections: h, onUserFilterSelectionsChange: g, initialFilters: _, initialSearchTerm: b, ...D }, O) => {
|
|
825
|
+
let ie = m ?? e?.showViewSwitcher ?? !1, { t: k } = tt(), { fieldLabel: A, actionLabel: oe } = nt(), { translateOptions: j } = Ae(), M = i.useMemo(() => e.viewType && e.viewType !== "list" ? e : {
|
|
822
826
|
...e,
|
|
823
827
|
viewType: "grid"
|
|
824
|
-
}, [e]),
|
|
825
|
-
let t =
|
|
826
|
-
return
|
|
827
|
-
}, [
|
|
828
|
-
let e =
|
|
828
|
+
}, [e]), N = i.useCallback((e, t) => M.objectName ? A(M.objectName, e, t) : t, [M.objectName, A]), de = i.useCallback((e) => {
|
|
829
|
+
let t = Ye(e);
|
|
830
|
+
return M.objectName && typeof oe == "function" ? oe(M.objectName, e, t) : t;
|
|
831
|
+
}, [M.objectName, oe]), P = i.useMemo(() => {
|
|
832
|
+
let e = M.userActions, t = M.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
|
|
829
833
|
return {
|
|
830
|
-
showSearch: e?.search === void 0 ?
|
|
831
|
-
showSort: e?.sort === void 0 ?
|
|
832
|
-
showFilters: e?.filter === void 0 ?
|
|
833
|
-
showDensity: e?.rowHeight === void 0 ?
|
|
834
|
-
showHideFields:
|
|
835
|
-
showGroup:
|
|
836
|
-
showColor:
|
|
837
|
-
compactToolbar:
|
|
834
|
+
showSearch: e?.search === void 0 ? M.showSearch !== !1 : e.search,
|
|
835
|
+
showSort: e?.sort === void 0 ? M.showSort !== !1 : e.sort,
|
|
836
|
+
showFilters: e?.filter === void 0 ? M.showFilters !== !1 : e.filter,
|
|
837
|
+
showDensity: e?.rowHeight === void 0 ? M.showDensity !== !1 : e.rowHeight,
|
|
838
|
+
showHideFields: M.showHideFields === !0,
|
|
839
|
+
showGroup: M.showGroup !== !1,
|
|
840
|
+
showColor: M.showColor === !0,
|
|
841
|
+
compactToolbar: M.compactToolbar === !0,
|
|
838
842
|
showAddRecord: t,
|
|
839
|
-
addRecordPosition:
|
|
843
|
+
addRecordPosition: M.addRecord?.position === "bottom" ? "bottom" : "top"
|
|
840
844
|
};
|
|
841
845
|
}, [
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
]), [
|
|
846
|
+
M.userActions,
|
|
847
|
+
M.showSearch,
|
|
848
|
+
M.showSort,
|
|
849
|
+
M.showFilters,
|
|
850
|
+
M.showDensity,
|
|
851
|
+
M.showHideFields,
|
|
852
|
+
M.showGroup,
|
|
853
|
+
M.showColor,
|
|
854
|
+
M.compactToolbar,
|
|
855
|
+
M.addRecord,
|
|
856
|
+
M.userActions?.addRecordForm
|
|
857
|
+
]), [F, Se] = i.useState(M.viewType), [R, ke] = i.useState(() => b ?? ""), [Me, Ne] = i.useState(!1), [Ie, ze] = i.useState(!1), [z, B] = i.useState(() => M.sort && M.sort.length > 0 ? M.sort.map((e) => {
|
|
854
858
|
if (typeof e == "string") {
|
|
855
859
|
let t = e.trim().split(/\s+/);
|
|
856
860
|
return {
|
|
@@ -864,9 +868,9 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
864
868
|
field: e.field,
|
|
865
869
|
order: e.order || "asc"
|
|
866
870
|
};
|
|
867
|
-
}) : []),
|
|
871
|
+
}) : []), V = i.useMemo(() => JSON.stringify(M.sort || []), [M.sort]);
|
|
868
872
|
i.useEffect(() => {
|
|
869
|
-
|
|
873
|
+
M.sort && M.sort.length > 0 ? B(M.sort.map((e) => {
|
|
870
874
|
if (typeof e == "string") {
|
|
871
875
|
let t = e.trim().split(/\s+/);
|
|
872
876
|
return {
|
|
@@ -880,21 +884,21 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
880
884
|
field: e.field,
|
|
881
885
|
order: e.order || "asc"
|
|
882
886
|
};
|
|
883
|
-
})) :
|
|
884
|
-
}, [
|
|
885
|
-
let [Ve,
|
|
887
|
+
})) : B([]);
|
|
888
|
+
}, [V]);
|
|
889
|
+
let [Ve, He] = i.useState(!1), [H, We] = i.useState(() => _ && Array.isArray(_.conditions) ? _ : {
|
|
886
890
|
id: "root",
|
|
887
891
|
logic: "and",
|
|
888
892
|
conditions: []
|
|
889
|
-
}),
|
|
890
|
-
i.useImperativeHandle(
|
|
891
|
-
if (!(!
|
|
892
|
-
e.resource ===
|
|
893
|
+
}), U = D.dataSource, [W, Ke] = i.useState([]), [qe, Je] = i.useState(null), [G, K] = i.useState(() => !(Array.isArray(M.data) || M.data && typeof M.data == "object" && M.data.provider === "value" && Array.isArray(M.data.items))), [q, Qe] = i.useState(null), [$e, et] = i.useState(!1), [rt, it] = i.useState(0), [at, ot] = i.useState(!1);
|
|
894
|
+
i.useImperativeHandle(O, () => ({ refresh: () => it((e) => e + 1) }), []), i.useEffect(() => {
|
|
895
|
+
if (!(!U?.onMutation || !M.objectName)) return U.onMutation((e) => {
|
|
896
|
+
e.resource === M.objectName && it((e) => e + 1);
|
|
893
897
|
});
|
|
894
|
-
}, [
|
|
895
|
-
let [
|
|
896
|
-
if (
|
|
897
|
-
let e = typeof
|
|
898
|
+
}, [U, M.objectName]);
|
|
899
|
+
let [st, ct] = i.useState(void 0), J = st ?? M.pagination?.pageSize ?? 100, [lt, ut] = i.useState(1), [dt, ft] = i.useState(null), pt = i.useMemo(() => {
|
|
900
|
+
if (M.grouping?.fields?.length) return M.grouping;
|
|
901
|
+
let e = typeof M.groupBy == "string" ? M.groupBy.trim() : "", t = typeof M.groupBy2 == "string" ? M.groupBy2.trim() : "", n = [];
|
|
898
902
|
return e && n.push({
|
|
899
903
|
field: e,
|
|
900
904
|
order: "asc",
|
|
@@ -905,25 +909,25 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
905
909
|
collapsed: !1
|
|
906
910
|
}), n.length > 0 ? { fields: n } : void 0;
|
|
907
911
|
}, [
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
]), [
|
|
912
|
+
M.grouping,
|
|
913
|
+
M.groupBy,
|
|
914
|
+
M.groupBy2
|
|
915
|
+
]), [Y, mt] = i.useState(pt), [ht, gt] = i.useState(!1), _t = i.useRef(pt);
|
|
912
916
|
i.useEffect(() => {
|
|
913
|
-
_t.current !==
|
|
914
|
-
}, [
|
|
915
|
-
let [
|
|
916
|
-
let e =
|
|
917
|
+
_t.current !== pt && (_t.current = pt, mt(pt));
|
|
918
|
+
}, [pt]);
|
|
919
|
+
let [X, vt] = i.useState(M.rowColor), [yt, bt] = i.useState(!1), [xt, St] = i.useState([]), Ct = i.useRef(0), [wt, Tt] = i.useState([]), Et = i.useMemo(() => {
|
|
920
|
+
let e = M.userFilters;
|
|
917
921
|
if (!e) return;
|
|
918
|
-
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !
|
|
922
|
+
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !q?.fields) return e;
|
|
919
923
|
let t = /* @__PURE__ */ new Set([
|
|
920
924
|
"select",
|
|
921
925
|
"multi-select",
|
|
922
926
|
"boolean"
|
|
923
|
-
]), n = [], r = Array.isArray(
|
|
927
|
+
]), n = [], r = Array.isArray(q.fields) ? q.fields.map((e) => [e.name, e]) : Object.entries(q.fields);
|
|
924
928
|
for (let [e, i] of r) (t.has(i.type) || i.options && !i.type) && n.push({
|
|
925
929
|
field: e,
|
|
926
|
-
label:
|
|
930
|
+
label: N(e, i.label || e),
|
|
927
931
|
type: i.type === "boolean" ? "boolean" : i.type === "multi-select" ? "multi-select" : "select"
|
|
928
932
|
});
|
|
929
933
|
return n.length === 0 ? e : {
|
|
@@ -931,75 +935,75 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
931
935
|
fields: n
|
|
932
936
|
};
|
|
933
937
|
}, [
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
]), [
|
|
938
|
+
M.userFilters,
|
|
939
|
+
q,
|
|
940
|
+
N
|
|
941
|
+
]), [Z, Dt] = i.useState(() => new Set(M.hiddenFields || [])), Ot = i.useMemo(() => JSON.stringify(M.hiddenFields || []), [M.hiddenFields]);
|
|
938
942
|
i.useEffect(() => {
|
|
939
|
-
|
|
940
|
-
}, [
|
|
941
|
-
let
|
|
942
|
-
|
|
943
|
-
}, [c]), [
|
|
943
|
+
Dt(new Set(M.hiddenFields || []));
|
|
944
|
+
}, [Ot]);
|
|
945
|
+
let kt = i.useCallback((e) => {
|
|
946
|
+
Dt(e), c?.(Array.from(e));
|
|
947
|
+
}, [c]), [At, jt] = i.useState(!1), [Mt, Nt] = i.useState(() => !!M.inlineEdit);
|
|
944
948
|
i.useEffect(() => {
|
|
945
|
-
|
|
946
|
-
}, [
|
|
947
|
-
let
|
|
948
|
-
|
|
949
|
-
}, [l]), [
|
|
950
|
-
if (
|
|
951
|
-
}, [
|
|
949
|
+
Nt(!!M.inlineEdit);
|
|
950
|
+
}, [M.inlineEdit]);
|
|
951
|
+
let Pt = i.useCallback((e) => {
|
|
952
|
+
Nt(e), l?.(e);
|
|
953
|
+
}, [l]), [Ft, It] = i.useState(!1), [Lt, Rt] = i.useState(!1), [zt, Bt] = i.useState(null), Vt = M.allowExport !== !1 && M.operations?.export !== !1, Ht = i.useMemo(() => {
|
|
954
|
+
if (M.exportOptions) return Array.isArray(M.exportOptions) ? { formats: M.exportOptions } : M.exportOptions;
|
|
955
|
+
}, [M.exportOptions]), Q = Pe(i.useMemo(() => M.densityMode ? M.densityMode : M.rowHeight ? {
|
|
952
956
|
compact: "compact",
|
|
953
957
|
short: "compact",
|
|
954
958
|
medium: "comfortable",
|
|
955
959
|
tall: "spacious",
|
|
956
960
|
extra_tall: "spacious"
|
|
957
|
-
}[
|
|
958
|
-
if (typeof window > "u") return
|
|
961
|
+
}[M.rowHeight] || "comfortable" : "compact", [M.densityMode, M.rowHeight]), { onChange: M.onDensityChange }), Ut = i.useMemo(() => `objectui:gallery:density:${M.objectName ?? "default"}`, [M.objectName]), [Wt, Gt] = i.useState(() => {
|
|
962
|
+
if (typeof window > "u") return M.gallery?.cardSize ?? "medium";
|
|
959
963
|
try {
|
|
960
|
-
let e = window.localStorage.getItem(
|
|
964
|
+
let e = window.localStorage.getItem(Ut);
|
|
961
965
|
if (e === "small" || e === "medium" || e === "large") return e;
|
|
962
966
|
} catch {}
|
|
963
|
-
return
|
|
964
|
-
}),
|
|
965
|
-
|
|
967
|
+
return M.gallery?.cardSize ?? "medium";
|
|
968
|
+
}), Kt = i.useCallback(() => {
|
|
969
|
+
Gt((e) => {
|
|
966
970
|
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
967
971
|
try {
|
|
968
|
-
window.localStorage.setItem(
|
|
972
|
+
window.localStorage.setItem(Ut, t);
|
|
969
973
|
} catch {}
|
|
970
974
|
return t;
|
|
971
975
|
});
|
|
972
|
-
}, [
|
|
976
|
+
}, [Ut]), { ref: qt, isRefreshing: Jt, pullDistance: Yt } = Le({
|
|
973
977
|
onRefresh: i.useCallback(async () => {
|
|
974
|
-
|
|
978
|
+
it((e) => e + 1);
|
|
975
979
|
}, []),
|
|
976
|
-
enabled: !!
|
|
977
|
-
}),
|
|
980
|
+
enabled: !!U && !!M.objectName
|
|
981
|
+
}), Xt = i.useMemo(() => M.id ? `listview-${M.objectName}-${M.id}-view` : `listview-${M.objectName}-view`, [M.objectName, M.id]);
|
|
978
982
|
i.useEffect(() => {
|
|
979
983
|
let e = !0;
|
|
980
|
-
return
|
|
981
|
-
if (!
|
|
982
|
-
|
|
984
|
+
return et(!1), Qe(null), (async () => {
|
|
985
|
+
if (!U || !M.objectName) {
|
|
986
|
+
et(!0);
|
|
983
987
|
return;
|
|
984
988
|
}
|
|
985
|
-
if (typeof
|
|
986
|
-
|
|
989
|
+
if (typeof U.getObjectSchema != "function") {
|
|
990
|
+
et(!0);
|
|
987
991
|
return;
|
|
988
992
|
}
|
|
989
993
|
try {
|
|
990
|
-
let t = await
|
|
991
|
-
e &&
|
|
994
|
+
let t = await U.getObjectSchema(M.objectName);
|
|
995
|
+
e && Qe(t);
|
|
992
996
|
} catch (e) {
|
|
993
997
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
994
998
|
} finally {
|
|
995
|
-
e &&
|
|
999
|
+
e && et(!0);
|
|
996
1000
|
}
|
|
997
1001
|
})(), () => {
|
|
998
1002
|
e = !1;
|
|
999
1003
|
};
|
|
1000
|
-
}, [
|
|
1001
|
-
let
|
|
1002
|
-
let e = Array.isArray(
|
|
1004
|
+
}, [M.objectName, U]);
|
|
1005
|
+
let Zt = i.useMemo(() => {
|
|
1006
|
+
let e = Array.isArray(M.fields) ? M.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], n = new Set(e), r = (e) => {
|
|
1003
1007
|
if (!e) return;
|
|
1004
1008
|
let t = [
|
|
1005
1009
|
e.groupField,
|
|
@@ -1023,66 +1027,66 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1023
1027
|
];
|
|
1024
1028
|
for (let e of t) typeof e == "string" && e && n.add(e);
|
|
1025
1029
|
};
|
|
1026
|
-
r(
|
|
1030
|
+
r(M.kanban), r(M.options?.kanban), r(M.calendar), r(M.options?.calendar), r(M.gallery), r(M.options?.gallery), r(M.timeline), r(M.options?.timeline), r(M.gantt), r(M.options?.gantt);
|
|
1027
1031
|
let i = n.size > 0 ? Array.from(n) : void 0;
|
|
1028
|
-
return t(
|
|
1032
|
+
return t(q?.fields, i);
|
|
1029
1033
|
}, [
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
]),
|
|
1034
|
+
q?.fields,
|
|
1035
|
+
M.fields,
|
|
1036
|
+
M.kanban,
|
|
1037
|
+
M.calendar,
|
|
1038
|
+
M.gallery,
|
|
1039
|
+
M.timeline,
|
|
1040
|
+
M.gantt,
|
|
1041
|
+
M.options
|
|
1042
|
+
]), Qt = Re();
|
|
1039
1043
|
i.useEffect(() => {
|
|
1040
1044
|
let e = !0, t = ++Ct.current;
|
|
1041
|
-
if (
|
|
1042
|
-
let e =
|
|
1045
|
+
if (M.data && typeof M.data == "object" && !Array.isArray(M.data)) {
|
|
1046
|
+
let e = M.data;
|
|
1043
1047
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
1044
1048
|
let t = e.items;
|
|
1045
|
-
if (
|
|
1046
|
-
let e =
|
|
1049
|
+
if (R) {
|
|
1050
|
+
let e = R.toLowerCase();
|
|
1047
1051
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
1048
1052
|
}
|
|
1049
|
-
|
|
1053
|
+
Ke(t), K(!1), ot(!1);
|
|
1050
1054
|
return;
|
|
1051
1055
|
}
|
|
1052
1056
|
}
|
|
1053
|
-
if (Array.isArray(
|
|
1054
|
-
let e =
|
|
1055
|
-
if (
|
|
1056
|
-
let t =
|
|
1057
|
+
if (Array.isArray(M.data)) {
|
|
1058
|
+
let e = M.data;
|
|
1059
|
+
if (R) {
|
|
1060
|
+
let t = R.toLowerCase();
|
|
1057
1061
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
1058
1062
|
}
|
|
1059
|
-
|
|
1063
|
+
Ke(e), K(!1), ot(!1);
|
|
1060
1064
|
return;
|
|
1061
1065
|
}
|
|
1062
|
-
return
|
|
1063
|
-
if (!
|
|
1064
|
-
|
|
1066
|
+
return $e ? ((async () => {
|
|
1067
|
+
if (!U || !M.objectName) {
|
|
1068
|
+
K(!1);
|
|
1065
1069
|
return;
|
|
1066
1070
|
}
|
|
1067
|
-
|
|
1071
|
+
K(!0), Je(null);
|
|
1068
1072
|
try {
|
|
1069
|
-
let n = [], r =
|
|
1073
|
+
let n = [], r = M.filters || [], i = Ze(H), a = Xe(wt), o = [
|
|
1070
1074
|
...r.length > 0 ? [r] : [],
|
|
1071
1075
|
...i.length > 0 ? [i] : [],
|
|
1072
1076
|
...a
|
|
1073
1077
|
].filter((e) => Array.isArray(e) && e.length > 0);
|
|
1074
1078
|
o.length > 1 ? n = ["and", ...o] : o.length === 1 && (n = o[0]);
|
|
1075
|
-
let s =
|
|
1079
|
+
let s = z.length > 0 ? z.filter((e) => e.field).map((e) => ({
|
|
1076
1080
|
field: e.field,
|
|
1077
1081
|
order: e.order
|
|
1078
1082
|
})) : void 0, c = (() => {
|
|
1079
|
-
let e = Array.isArray(
|
|
1083
|
+
let e = Array.isArray(M.fields) ? M.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], t = Qt?.isLoaded && M.objectName ? e.filter((e) => Qt.checkField(M.objectName, e, "read")) : e;
|
|
1080
1084
|
if (t.length === 0) return;
|
|
1081
1085
|
let n = /* @__PURE__ */ new Set(["id"]);
|
|
1082
1086
|
for (let e of t) n.add(e);
|
|
1083
|
-
for (let e of
|
|
1087
|
+
for (let e of Zt) n.add(e);
|
|
1084
1088
|
let r = (() => {
|
|
1085
|
-
let e =
|
|
1089
|
+
let e = q?.fields;
|
|
1086
1090
|
if (!e) return null;
|
|
1087
1091
|
let t = Array.isArray(e) ? e.map((e) => e?.name).filter((e) => typeof e == "string") : Object.keys(e), n = new Set(t);
|
|
1088
1092
|
return n.add("id"), n.add("created_at"), n.add("updated_at"), n;
|
|
@@ -1112,74 +1116,74 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1112
1116
|
];
|
|
1113
1117
|
for (let e of t) i(e);
|
|
1114
1118
|
};
|
|
1115
|
-
a(
|
|
1119
|
+
a(M.kanban), a(M.options?.kanban), a(M.calendar), a(M.options?.calendar), a(M.gallery), a(M.options?.gallery), a(M.timeline), a(M.options?.timeline);
|
|
1116
1120
|
{
|
|
1117
|
-
let e =
|
|
1121
|
+
let e = M.timeline ?? M.options?.timeline;
|
|
1118
1122
|
e && !Array.isArray(e.metaFields) && (i("status"), i("priority"));
|
|
1119
1123
|
}
|
|
1120
|
-
return a(
|
|
1121
|
-
})(), l = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, u =
|
|
1124
|
+
return a(M.gantt), a(M.options?.gantt), Array.from(n);
|
|
1125
|
+
})(), l = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, u = F === "grid" && !Y?.fields?.length, d = u ? (lt - 1) * J : 0, f = await U.find(M.objectName, {
|
|
1122
1126
|
...l ? { $filter: n } : {},
|
|
1123
1127
|
$orderby: s,
|
|
1124
|
-
$top:
|
|
1128
|
+
$top: J,
|
|
1125
1129
|
...d > 0 ? { $skip: d } : {},
|
|
1126
1130
|
...c ? { $select: c } : {},
|
|
1127
|
-
...
|
|
1128
|
-
...
|
|
1129
|
-
$search:
|
|
1130
|
-
...
|
|
1131
|
+
...Zt.length > 0 ? { $expand: Zt } : {},
|
|
1132
|
+
...R ? {
|
|
1133
|
+
$search: R,
|
|
1134
|
+
...M.searchableFields && M.searchableFields.length > 0 ? { $searchFields: M.searchableFields } : {}
|
|
1131
1135
|
} : {}
|
|
1132
1136
|
});
|
|
1133
1137
|
if (!e || t !== Ct.current) return;
|
|
1134
1138
|
let p = [];
|
|
1135
|
-
Array.isArray(f) ? p = f : f && typeof f == "object" && (Array.isArray(f.data) ? p = f.data : Array.isArray(f.records) ? p = f.records : Array.isArray(f.value) && (p = f.value)),
|
|
1139
|
+
Array.isArray(f) ? p = f : f && typeof f == "object" && (Array.isArray(f.data) ? p = f.data : Array.isArray(f.records) ? p = f.records : Array.isArray(f.value) && (p = f.value)), Ke(p);
|
|
1136
1140
|
let m = f && typeof f == "object" ? f.total ?? f.count : void 0, h = typeof m == "number" ? m : null;
|
|
1137
|
-
|
|
1141
|
+
ft(u ? h : null), ot(!(u && h != null) && p.length >= J);
|
|
1138
1142
|
} catch (e) {
|
|
1139
|
-
t === Ct.current && (console.error("ListView data fetch error:", e),
|
|
1143
|
+
t === Ct.current && (console.error("ListView data fetch error:", e), Ke([]), Je(e?.message ? String(e.message) : String(e ?? "Unknown error")));
|
|
1140
1144
|
} finally {
|
|
1141
|
-
e && t === Ct.current &&
|
|
1145
|
+
e && t === Ct.current && K(!1);
|
|
1142
1146
|
}
|
|
1143
1147
|
})(), () => {
|
|
1144
1148
|
e = !1;
|
|
1145
1149
|
}) : void 0;
|
|
1146
1150
|
}, [
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1151
|
+
M.objectName,
|
|
1152
|
+
M.data,
|
|
1153
|
+
U,
|
|
1154
|
+
M.filters,
|
|
1155
|
+
J,
|
|
1156
|
+
z,
|
|
1157
|
+
H,
|
|
1158
|
+
wt,
|
|
1159
|
+
rt,
|
|
1152
1160
|
R,
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1161
|
+
M.searchableFields,
|
|
1162
|
+
Zt,
|
|
1163
|
+
$e,
|
|
1164
|
+
M.refreshTrigger,
|
|
1165
|
+
Qt,
|
|
1166
|
+
lt,
|
|
1156
1167
|
F,
|
|
1157
|
-
|
|
1158
|
-
Yt,
|
|
1159
|
-
et,
|
|
1160
|
-
j.refreshTrigger,
|
|
1161
|
-
Xt,
|
|
1162
|
-
ut,
|
|
1163
|
-
P,
|
|
1164
|
-
q
|
|
1168
|
+
Y
|
|
1165
1169
|
]);
|
|
1166
|
-
let
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
+
let $t = JSON.stringify([
|
|
1171
|
+
M.objectName,
|
|
1172
|
+
M.filters,
|
|
1173
|
+
J,
|
|
1174
|
+
z,
|
|
1175
|
+
H,
|
|
1176
|
+
wt,
|
|
1170
1177
|
R,
|
|
1171
|
-
B,
|
|
1172
|
-
Y,
|
|
1173
1178
|
F,
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
]), Qt = i.useRef(Zt);
|
|
1179
|
+
Y
|
|
1180
|
+
]), en = i.useRef($t);
|
|
1177
1181
|
i.useEffect(() => {
|
|
1178
|
-
|
|
1179
|
-
}, [
|
|
1180
|
-
let
|
|
1182
|
+
en.current !== $t && (en.current = $t, ut(1));
|
|
1183
|
+
}, [$t]);
|
|
1184
|
+
let tn = i.useMemo(() => {
|
|
1181
1185
|
let e = ["grid"];
|
|
1182
|
-
(
|
|
1186
|
+
(M.kanban?.groupByField || M.kanban?.groupField || M.options?.kanban?.groupField) && e.push("kanban"), (M.gallery?.coverField || M.gallery?.imageField || M.options?.gallery?.imageField) && e.push("gallery"), (M.calendar?.startDateField || M.options?.calendar?.startDateField) && e.push("calendar"), (M.timeline?.startDateField || M.options?.timeline?.startDateField || M.options?.timeline?.dateField || M.options?.calendar?.startDateField) && e.push("timeline"), (M.gantt?.startDateField || M.options?.gantt?.startDateField) && e.push("gantt"), (M.options?.map?.locationField || M.options?.map?.latitudeField && M.options?.map?.longitudeField) && e.push("map"), (M.tree?.parentField || M.options?.tree?.parentField || M.viewType === "tree") && e.push("tree"), M.viewType && !e.includes(M.viewType) && [
|
|
1183
1187
|
"grid",
|
|
1184
1188
|
"kanban",
|
|
1185
1189
|
"calendar",
|
|
@@ -1189,52 +1193,52 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1189
1193
|
"gallery",
|
|
1190
1194
|
"chart",
|
|
1191
1195
|
"tree"
|
|
1192
|
-
].includes(
|
|
1193
|
-
let t =
|
|
1196
|
+
].includes(M.viewType) && e.push(M.viewType);
|
|
1197
|
+
let t = M.appearance?.allowedVisualizations;
|
|
1194
1198
|
if (Array.isArray(t) && t.length > 0) {
|
|
1195
1199
|
let n = t.filter((t) => e.includes(t));
|
|
1196
1200
|
return n.length > 0 ? n : ["grid"];
|
|
1197
1201
|
}
|
|
1198
1202
|
return e;
|
|
1199
1203
|
}, [
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1204
|
+
M.options,
|
|
1205
|
+
M.viewType,
|
|
1206
|
+
M.kanban,
|
|
1207
|
+
M.calendar,
|
|
1208
|
+
M.gantt,
|
|
1209
|
+
M.gallery,
|
|
1210
|
+
M.timeline,
|
|
1211
|
+
M.tree,
|
|
1212
|
+
M.appearance?.allowedVisualizations
|
|
1209
1213
|
]);
|
|
1210
1214
|
i.useEffect(() => {
|
|
1211
|
-
|
|
1212
|
-
}, [
|
|
1213
|
-
let
|
|
1214
|
-
|
|
1215
|
+
M.viewType && Se(M.viewType);
|
|
1216
|
+
}, [M.viewType]);
|
|
1217
|
+
let nn = i.useCallback((e) => {
|
|
1218
|
+
Se(e);
|
|
1215
1219
|
try {
|
|
1216
|
-
localStorage.setItem(
|
|
1220
|
+
localStorage.setItem(Xt, e);
|
|
1217
1221
|
} catch (e) {
|
|
1218
1222
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
1219
1223
|
}
|
|
1220
1224
|
r?.(e);
|
|
1221
|
-
}, [
|
|
1222
|
-
|
|
1223
|
-
}, [s]),
|
|
1224
|
-
navigation:
|
|
1225
|
-
objectName:
|
|
1226
|
-
onNavigate:
|
|
1225
|
+
}, [Xt, r]), rn = i.useCallback((e) => {
|
|
1226
|
+
ke(e), s?.(e);
|
|
1227
|
+
}, [s]), an = Fe({
|
|
1228
|
+
navigation: M.navigation,
|
|
1229
|
+
objectName: M.objectName,
|
|
1230
|
+
onNavigate: M.onNavigate,
|
|
1227
1231
|
onRowClick: f
|
|
1228
1232
|
}), $ = i.useMemo(() => {
|
|
1229
|
-
let e =
|
|
1230
|
-
if (Array.isArray(e) || (e = []),
|
|
1233
|
+
let e = M.fields || [];
|
|
1234
|
+
if (Array.isArray(e) || (e = []), Qt?.isLoaded && M.objectName && (e = e.filter((e) => {
|
|
1231
1235
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1232
|
-
return t ?
|
|
1233
|
-
})),
|
|
1236
|
+
return t ? Qt.checkField(M.objectName, t, "read") : !0;
|
|
1237
|
+
})), Z.size > 0 && (e = e.filter((e) => {
|
|
1234
1238
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1235
|
-
return t != null && !
|
|
1236
|
-
})),
|
|
1237
|
-
let t = new Map(
|
|
1239
|
+
return t != null && !Z.has(t);
|
|
1240
|
+
})), M.fieldOrder && M.fieldOrder.length > 0) {
|
|
1241
|
+
let t = new Map(M.fieldOrder.map((e, t) => [e, t]));
|
|
1238
1242
|
e = [...e].sort((e, n) => {
|
|
1239
1243
|
let r = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field, i = typeof n == "string" ? n : n?.name || n?.fieldName || n?.field;
|
|
1240
1244
|
return (t.get(r) ?? Infinity) - (t.get(i) ?? Infinity);
|
|
@@ -1242,121 +1246,121 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1242
1246
|
}
|
|
1243
1247
|
return e;
|
|
1244
1248
|
}, [
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
]),
|
|
1251
|
-
let e =
|
|
1252
|
-
objectName:
|
|
1249
|
+
M.fields,
|
|
1250
|
+
M.objectName,
|
|
1251
|
+
Z,
|
|
1252
|
+
M.fieldOrder,
|
|
1253
|
+
Qt
|
|
1254
|
+
]), on = i.useMemo(() => {
|
|
1255
|
+
let e = Q.mode === "compact" ? "compact" : Q.mode === "spacious" ? "tall" : "medium", t = {
|
|
1256
|
+
objectName: M.objectName,
|
|
1253
1257
|
fields: $,
|
|
1254
|
-
filters:
|
|
1255
|
-
sort:
|
|
1258
|
+
filters: M.filters,
|
|
1259
|
+
sort: z,
|
|
1256
1260
|
className: "h-full w-full",
|
|
1257
1261
|
showSearch: !1,
|
|
1258
|
-
onRowClick:
|
|
1262
|
+
onRowClick: an.handleClick,
|
|
1259
1263
|
rowHeight: e,
|
|
1260
1264
|
hideRowHeightToggle: !0,
|
|
1261
|
-
...
|
|
1262
|
-
...
|
|
1265
|
+
...M.striped == null ? {} : { striped: M.striped },
|
|
1266
|
+
...M.bordered == null ? {} : { bordered: M.bordered },
|
|
1263
1267
|
...d ? { onColumnStateChange: d } : {},
|
|
1264
|
-
...
|
|
1268
|
+
...M.columnState ? { columnState: M.columnState } : {}
|
|
1265
1269
|
};
|
|
1266
|
-
switch (
|
|
1270
|
+
switch (F) {
|
|
1267
1271
|
default:
|
|
1268
1272
|
case "grid": return {
|
|
1269
1273
|
type: "object-grid",
|
|
1270
1274
|
...t,
|
|
1271
1275
|
columns: $,
|
|
1272
|
-
...
|
|
1273
|
-
editable:
|
|
1274
|
-
...
|
|
1275
|
-
...
|
|
1276
|
-
...
|
|
1277
|
-
...
|
|
1278
|
-
...
|
|
1279
|
-
...
|
|
1280
|
-
...
|
|
1281
|
-
...
|
|
1282
|
-
...
|
|
1283
|
-
...
|
|
1284
|
-
...
|
|
1285
|
-
...
|
|
1276
|
+
...M.conditionalFormatting ? { conditionalFormatting: M.conditionalFormatting } : {},
|
|
1277
|
+
editable: Mt,
|
|
1278
|
+
...M.wrapHeaders == null ? {} : { wrapHeaders: M.wrapHeaders },
|
|
1279
|
+
...M.virtualScroll == null ? {} : { virtualScroll: M.virtualScroll },
|
|
1280
|
+
...M.resizable == null ? {} : { resizable: M.resizable },
|
|
1281
|
+
...M.selection ? { selection: M.selection } : {},
|
|
1282
|
+
...M.pagination ? { pagination: M.pagination } : {},
|
|
1283
|
+
...Y ? { grouping: Y } : {},
|
|
1284
|
+
...X ? { rowColor: X } : {},
|
|
1285
|
+
...M.rowActions ? { rowActions: M.rowActions } : {},
|
|
1286
|
+
...M.rowActionDefs ? { rowActionDefs: M.rowActionDefs } : {},
|
|
1287
|
+
...M.bulkActions ? { batchActions: M.bulkActions } : {},
|
|
1288
|
+
...M.bulkActionDefs ? { bulkActionDefs: M.bulkActionDefs } : {},
|
|
1289
|
+
...M.options?.grid || {}
|
|
1286
1290
|
};
|
|
1287
1291
|
case "kanban": return {
|
|
1288
1292
|
type: "object-kanban",
|
|
1289
1293
|
...t,
|
|
1290
|
-
groupBy:
|
|
1291
|
-
groupField:
|
|
1292
|
-
...
|
|
1293
|
-
cardFields:
|
|
1294
|
-
...
|
|
1295
|
-
...
|
|
1296
|
-
...
|
|
1294
|
+
groupBy: M.kanban?.groupField || M.options?.kanban?.groupField || "status",
|
|
1295
|
+
groupField: M.kanban?.groupField || M.options?.kanban?.groupField || "status",
|
|
1296
|
+
...M.kanban?.titleField || M.options?.kanban?.titleField ? { titleField: M.kanban?.titleField || M.options?.kanban?.titleField } : {},
|
|
1297
|
+
cardFields: M.kanban?.cardFields || $ || [],
|
|
1298
|
+
...Y ? { grouping: Y } : {},
|
|
1299
|
+
...M.options?.kanban || {},
|
|
1300
|
+
...M.kanban || {}
|
|
1297
1301
|
};
|
|
1298
1302
|
case "calendar": return {
|
|
1299
1303
|
type: "object-calendar",
|
|
1300
1304
|
...t,
|
|
1301
|
-
startDateField:
|
|
1302
|
-
endDateField:
|
|
1303
|
-
...
|
|
1304
|
-
...
|
|
1305
|
-
...
|
|
1306
|
-
...
|
|
1305
|
+
startDateField: M.calendar?.startDateField || M.options?.calendar?.startDateField || "start_date",
|
|
1306
|
+
endDateField: M.calendar?.endDateField || M.options?.calendar?.endDateField || "end_date",
|
|
1307
|
+
...M.calendar?.titleField || M.options?.calendar?.titleField ? { titleField: M.calendar?.titleField || M.options?.calendar?.titleField } : {},
|
|
1308
|
+
...M.calendar?.defaultView ? { defaultView: M.calendar.defaultView } : {},
|
|
1309
|
+
...M.options?.calendar || {},
|
|
1310
|
+
...M.calendar || {}
|
|
1307
1311
|
};
|
|
1308
1312
|
case "gallery": {
|
|
1309
1313
|
let e = {
|
|
1310
|
-
...
|
|
1311
|
-
...
|
|
1312
|
-
cardSize:
|
|
1314
|
+
...M.options?.gallery || {},
|
|
1315
|
+
...M.gallery || {},
|
|
1316
|
+
cardSize: Wt
|
|
1313
1317
|
};
|
|
1314
1318
|
return {
|
|
1315
1319
|
type: "object-gallery",
|
|
1316
1320
|
...t,
|
|
1317
1321
|
gallery: Object.keys(e).length > 0 ? e : void 0,
|
|
1318
|
-
imageField:
|
|
1319
|
-
titleField:
|
|
1320
|
-
subtitleField:
|
|
1321
|
-
...
|
|
1322
|
+
imageField: M.gallery?.coverField || M.gallery?.imageField || M.options?.gallery?.imageField,
|
|
1323
|
+
titleField: M.gallery?.titleField || M.options?.gallery?.titleField || "name",
|
|
1324
|
+
subtitleField: M.gallery?.subtitleField || M.options?.gallery?.subtitleField,
|
|
1325
|
+
...Y ? { grouping: Y } : {}
|
|
1322
1326
|
};
|
|
1323
1327
|
}
|
|
1324
1328
|
case "timeline": {
|
|
1325
1329
|
let e = {
|
|
1326
|
-
...
|
|
1327
|
-
...
|
|
1330
|
+
...M.options?.timeline || {},
|
|
1331
|
+
...M.timeline || {}
|
|
1328
1332
|
};
|
|
1329
1333
|
return {
|
|
1330
1334
|
type: "object-timeline",
|
|
1331
1335
|
...t,
|
|
1332
1336
|
timeline: Object.keys(e).length > 0 ? e : void 0,
|
|
1333
|
-
startDateField:
|
|
1334
|
-
titleField:
|
|
1335
|
-
...
|
|
1336
|
-
...
|
|
1337
|
-
...
|
|
1338
|
-
...
|
|
1337
|
+
startDateField: M.timeline?.startDateField || M.options?.timeline?.startDateField || M.options?.timeline?.dateField || "created_at",
|
|
1338
|
+
titleField: M.timeline?.titleField || M.options?.timeline?.titleField || "name",
|
|
1339
|
+
...M.timeline?.endDateField ? { endDateField: M.timeline.endDateField } : {},
|
|
1340
|
+
...M.timeline?.groupByField ? { groupByField: M.timeline.groupByField } : {},
|
|
1341
|
+
...M.timeline?.colorField ? { colorField: M.timeline.colorField } : {},
|
|
1342
|
+
...M.timeline?.scale ? { scale: M.timeline.scale } : {}
|
|
1339
1343
|
};
|
|
1340
1344
|
}
|
|
1341
1345
|
case "gantt": return {
|
|
1342
1346
|
type: "object-gantt",
|
|
1343
1347
|
...t,
|
|
1344
|
-
startDateField:
|
|
1345
|
-
endDateField:
|
|
1346
|
-
progressField:
|
|
1347
|
-
dependenciesField:
|
|
1348
|
-
...
|
|
1349
|
-
...
|
|
1350
|
-
...
|
|
1348
|
+
startDateField: M.gantt?.startDateField || M.options?.gantt?.startDateField || "start_date",
|
|
1349
|
+
endDateField: M.gantt?.endDateField || M.options?.gantt?.endDateField || "end_date",
|
|
1350
|
+
progressField: M.gantt?.progressField || M.options?.gantt?.progressField || "progress",
|
|
1351
|
+
dependenciesField: M.gantt?.dependenciesField || M.options?.gantt?.dependenciesField || "dependencies",
|
|
1352
|
+
...M.gantt?.titleField ? { titleField: M.gantt.titleField } : {},
|
|
1353
|
+
...M.options?.gantt || {},
|
|
1354
|
+
...M.gantt || {}
|
|
1351
1355
|
};
|
|
1352
1356
|
case "map": return {
|
|
1353
1357
|
type: "object-map",
|
|
1354
1358
|
...t,
|
|
1355
|
-
locationField:
|
|
1356
|
-
...
|
|
1359
|
+
locationField: M.options?.map?.locationField || "location",
|
|
1360
|
+
...M.options?.map || {}
|
|
1357
1361
|
};
|
|
1358
1362
|
case "tree": {
|
|
1359
|
-
let e =
|
|
1363
|
+
let e = M.tree || M.options?.tree || {};
|
|
1360
1364
|
return {
|
|
1361
1365
|
type: "object-tree",
|
|
1362
1366
|
...t,
|
|
@@ -1368,7 +1372,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1368
1372
|
};
|
|
1369
1373
|
}
|
|
1370
1374
|
case "chart": {
|
|
1371
|
-
let e =
|
|
1375
|
+
let e = M.chart || M.options?.chart || {};
|
|
1372
1376
|
if (e.dataset) {
|
|
1373
1377
|
let t = Array.isArray(e.dimensions) ? e.dimensions : [], n = Array.isArray(e.values) ? e.values : [];
|
|
1374
1378
|
return {
|
|
@@ -1388,9 +1392,9 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1388
1392
|
let t = Array.isArray(e.yAxisFields) && e.yAxisFields[0] || e.valueField || "value", n = e.xAxisField || e.categoryField || "name";
|
|
1389
1393
|
return {
|
|
1390
1394
|
type: "object-chart",
|
|
1391
|
-
objectName:
|
|
1395
|
+
objectName: M.objectName,
|
|
1392
1396
|
chartType: e.chartType || "bar",
|
|
1393
|
-
filters:
|
|
1397
|
+
filters: M.filters,
|
|
1394
1398
|
aggregate: {
|
|
1395
1399
|
field: t,
|
|
1396
1400
|
function: e.aggregation || "count",
|
|
@@ -1406,17 +1410,17 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1406
1410
|
}
|
|
1407
1411
|
}
|
|
1408
1412
|
}, [
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1413
|
+
F,
|
|
1414
|
+
M,
|
|
1415
|
+
z,
|
|
1412
1416
|
$,
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
]),
|
|
1417
|
+
Y,
|
|
1418
|
+
X,
|
|
1419
|
+
an.handleClick,
|
|
1420
|
+
Q.mode,
|
|
1421
|
+
Wt,
|
|
1422
|
+
Mt
|
|
1423
|
+
]), sn = H.conditions && H.conditions.length > 0, cn = i.useMemo(() => {
|
|
1420
1424
|
let e, t = (e, t) => {
|
|
1421
1425
|
if (!t) return;
|
|
1422
1426
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1428,17 +1432,17 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1428
1432
|
label: t?.label || e,
|
|
1429
1433
|
...t
|
|
1430
1434
|
}));
|
|
1431
|
-
return
|
|
1435
|
+
return M.objectName ? j(M.objectName, e, n) : n;
|
|
1432
1436
|
};
|
|
1433
|
-
if (e =
|
|
1437
|
+
if (e = q?.fields ? Object.entries(q.fields).map(([e, n]) => ({
|
|
1434
1438
|
value: e,
|
|
1435
|
-
label:
|
|
1439
|
+
label: N(e, n.label || e),
|
|
1436
1440
|
type: n.type || "text",
|
|
1437
1441
|
options: t(e, n.options),
|
|
1438
1442
|
referenceTo: n.reference_to || n.reference,
|
|
1439
1443
|
displayField: n.display_field || n.reference_field,
|
|
1440
1444
|
idField: n.id_field
|
|
1441
|
-
})) : (
|
|
1445
|
+
})) : (M.fields || []).map((e) => {
|
|
1442
1446
|
if (typeof e == "string") return {
|
|
1443
1447
|
value: e,
|
|
1444
1448
|
label: e,
|
|
@@ -1447,40 +1451,40 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1447
1451
|
let n = e.name || e.fieldName;
|
|
1448
1452
|
return {
|
|
1449
1453
|
value: n,
|
|
1450
|
-
label:
|
|
1454
|
+
label: N(n, e.label || e.name),
|
|
1451
1455
|
type: e.type || "text",
|
|
1452
1456
|
options: t(n, e.options),
|
|
1453
1457
|
referenceTo: e.reference_to || e.reference,
|
|
1454
1458
|
displayField: e.display_field || e.reference_field,
|
|
1455
1459
|
idField: e.id_field
|
|
1456
1460
|
};
|
|
1457
|
-
}),
|
|
1458
|
-
let t = new Set(
|
|
1461
|
+
}), M.filterableFields && M.filterableFields.length > 0) {
|
|
1462
|
+
let t = new Set(M.filterableFields);
|
|
1459
1463
|
e = e.filter((e) => t.has(e.value));
|
|
1460
1464
|
}
|
|
1461
1465
|
return e;
|
|
1462
1466
|
}, [
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
]),
|
|
1470
|
-
if (!
|
|
1471
|
-
let t =
|
|
1472
|
-
if ((e === "csv" || e === "xlsx" || e === "json") && typeof
|
|
1473
|
-
let t = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field).filter(Boolean), a =
|
|
1467
|
+
q,
|
|
1468
|
+
M.fields,
|
|
1469
|
+
M.filterableFields,
|
|
1470
|
+
M.objectName,
|
|
1471
|
+
N,
|
|
1472
|
+
j
|
|
1473
|
+
]), ln = i.useCallback((e) => {
|
|
1474
|
+
if (!Vt) return;
|
|
1475
|
+
let t = Ht, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || M.objectName || "export";
|
|
1476
|
+
if ((e === "csv" || e === "xlsx" || e === "json") && typeof U?.exportDownload == "function" && M.objectName && t?.streaming !== !1) {
|
|
1477
|
+
let t = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field).filter(Boolean), a = M.filters || [], o = Ze(H), s = Xe(wt), c = [
|
|
1474
1478
|
...a.length > 0 ? [a] : [],
|
|
1475
1479
|
...o.length > 0 ? [o] : [],
|
|
1476
1480
|
...s
|
|
1477
|
-
].filter((e) => Array.isArray(e) && e.length > 0), l = c.length > 1 ? ["and", ...c] : c.length === 1 ? c[0] : void 0, u =
|
|
1481
|
+
].filter((e) => Array.isArray(e) && e.length > 0), l = c.length > 1 ? ["and", ...c] : c.length === 1 ? c[0] : void 0, u = z.length > 0 ? z.filter((e) => e.field).map((e) => ({
|
|
1478
1482
|
field: e.field,
|
|
1479
1483
|
direction: e.order
|
|
1480
1484
|
})) : void 0;
|
|
1481
|
-
|
|
1485
|
+
Bt(null), Rt(!0), (async () => {
|
|
1482
1486
|
try {
|
|
1483
|
-
let a = await
|
|
1487
|
+
let a = await U.exportDownload(M.objectName, {
|
|
1484
1488
|
format: e,
|
|
1485
1489
|
fields: t.length ? t : void 0,
|
|
1486
1490
|
filter: l,
|
|
@@ -1488,16 +1492,16 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1488
1492
|
includeHeaders: r,
|
|
1489
1493
|
limit: n > 0 ? n : void 0
|
|
1490
1494
|
}), o = URL.createObjectURL(a), s = document.createElement("a");
|
|
1491
|
-
s.href = o, s.download = `${i}.${e}`, s.rel = "noopener", document.body.appendChild(s), s.click(), s.remove(), URL.revokeObjectURL(o),
|
|
1495
|
+
s.href = o, s.download = `${i}.${e}`, s.rel = "noopener", document.body.appendChild(s), s.click(), s.remove(), URL.revokeObjectURL(o), It(!1);
|
|
1492
1496
|
} catch (e) {
|
|
1493
|
-
console.error("ListView export failed:", e),
|
|
1497
|
+
console.error("ListView export failed:", e), Bt(e instanceof Error ? e.message : String(e));
|
|
1494
1498
|
} finally {
|
|
1495
|
-
|
|
1499
|
+
Rt(!1);
|
|
1496
1500
|
}
|
|
1497
1501
|
})();
|
|
1498
1502
|
return;
|
|
1499
1503
|
}
|
|
1500
|
-
let a = n > 0 ?
|
|
1504
|
+
let a = n > 0 ? W.slice(0, n) : W;
|
|
1501
1505
|
if (e === "csv") {
|
|
1502
1506
|
let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
|
|
1503
1507
|
r && t.push(e.join(",")), a.forEach((n) => {
|
|
@@ -1512,61 +1516,61 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1512
1516
|
let e = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1513
1517
|
n.href = t, n.download = `${i}.json`, n.click(), URL.revokeObjectURL(t);
|
|
1514
1518
|
}
|
|
1515
|
-
|
|
1519
|
+
It(!1);
|
|
1516
1520
|
}, [
|
|
1517
|
-
|
|
1521
|
+
W,
|
|
1518
1522
|
$,
|
|
1523
|
+
Ht,
|
|
1524
|
+
M.objectName,
|
|
1525
|
+
M.filters,
|
|
1519
1526
|
Vt,
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
Y,
|
|
1526
|
-
R
|
|
1527
|
-
]), cn = i.useMemo(() => (j.fields || []).map((e) => {
|
|
1527
|
+
U,
|
|
1528
|
+
H,
|
|
1529
|
+
wt,
|
|
1530
|
+
z
|
|
1531
|
+
]), un = i.useMemo(() => (M.fields || []).map((e) => {
|
|
1528
1532
|
if (typeof e == "string") return {
|
|
1529
1533
|
name: e,
|
|
1530
|
-
label:
|
|
1534
|
+
label: N(e, e)
|
|
1531
1535
|
};
|
|
1532
|
-
let t = e.name || e.fieldName || e.field;
|
|
1536
|
+
let t = e.name || e.fieldName || e.field, n = e.label || e.name || e.field;
|
|
1533
1537
|
return {
|
|
1534
1538
|
name: t,
|
|
1535
|
-
label:
|
|
1539
|
+
label: N(t, n)
|
|
1536
1540
|
};
|
|
1537
|
-
}), [
|
|
1541
|
+
}), [M.fields, N]);
|
|
1538
1542
|
return /* @__PURE__ */ L("div", {
|
|
1539
|
-
ref:
|
|
1543
|
+
ref: qt,
|
|
1540
1544
|
className: E("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1541
|
-
...
|
|
1542
|
-
...
|
|
1543
|
-
...
|
|
1545
|
+
...M.aria?.label ? { "aria-label": M.aria.label } : {},
|
|
1546
|
+
...M.aria?.describedBy ? { "aria-describedby": M.aria.describedBy } : {},
|
|
1547
|
+
...M.aria?.live ? { "aria-live": M.aria.live } : {},
|
|
1544
1548
|
role: "region",
|
|
1545
|
-
"aria-busy":
|
|
1546
|
-
"data-state":
|
|
1549
|
+
"aria-busy": G || void 0,
|
|
1550
|
+
"data-state": G ? "loading" : "idle",
|
|
1547
1551
|
children: [
|
|
1548
|
-
|
|
1552
|
+
Yt > 0 && /* @__PURE__ */ I("div", {
|
|
1549
1553
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1550
|
-
style: { height:
|
|
1551
|
-
children:
|
|
1554
|
+
style: { height: Yt },
|
|
1555
|
+
children: k(Jt ? "list.refreshing" : "list.pullToRefresh")
|
|
1552
1556
|
}),
|
|
1553
|
-
|
|
1557
|
+
M.description && M.appearance?.showDescription !== !1 && /* @__PURE__ */ I("div", {
|
|
1554
1558
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
1555
1559
|
"data-testid": "view-description",
|
|
1556
|
-
children: typeof
|
|
1560
|
+
children: typeof M.description == "string" ? M.description : ""
|
|
1557
1561
|
}),
|
|
1558
1562
|
/* @__PURE__ */ L("div", {
|
|
1559
1563
|
className: "border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1560
1564
|
children: [/* @__PURE__ */ I("div", {
|
|
1561
1565
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1562
|
-
children:
|
|
1566
|
+
children: Et && /* @__PURE__ */ I("div", {
|
|
1563
1567
|
className: "shrink-0 min-w-0 overflow-x-auto",
|
|
1564
1568
|
"data-testid": "user-filters",
|
|
1565
|
-
children: /* @__PURE__ */ I(
|
|
1566
|
-
config:
|
|
1567
|
-
objectDef:
|
|
1568
|
-
data:
|
|
1569
|
-
onFilterChange:
|
|
1569
|
+
children: /* @__PURE__ */ I(Ge, {
|
|
1570
|
+
config: Et,
|
|
1571
|
+
objectDef: q,
|
|
1572
|
+
data: W,
|
|
1573
|
+
onFilterChange: Tt,
|
|
1570
1574
|
maxVisible: 3,
|
|
1571
1575
|
initialSelections: h,
|
|
1572
1576
|
onSelectionsChange: g
|
|
@@ -1575,41 +1579,41 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1575
1579
|
}), /* @__PURE__ */ L("div", {
|
|
1576
1580
|
className: "flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm",
|
|
1577
1581
|
children: [
|
|
1578
|
-
|
|
1579
|
-
currentView:
|
|
1580
|
-
availableViews:
|
|
1581
|
-
onViewChange:
|
|
1582
|
+
ie && /* @__PURE__ */ L(Oe, { children: [/* @__PURE__ */ I(Be, {
|
|
1583
|
+
currentView: F,
|
|
1584
|
+
availableViews: tn,
|
|
1585
|
+
onViewChange: nn
|
|
1582
1586
|
}), /* @__PURE__ */ I("div", { className: "h-4 w-px bg-border/60 mx-0.5" })] }),
|
|
1583
|
-
|
|
1587
|
+
F === "grid" && l && !P.compactToolbar && /* @__PURE__ */ L(u, {
|
|
1584
1588
|
variant: "ghost",
|
|
1585
1589
|
size: "sm",
|
|
1586
|
-
onClick: () =>
|
|
1587
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1588
|
-
title:
|
|
1590
|
+
onClick: () => Pt(!Mt),
|
|
1591
|
+
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Mt && "text-primary"),
|
|
1592
|
+
title: k("list.inlineEditLabel", { defaultValue: "Edit records inline (click a cell to edit)" }),
|
|
1589
1593
|
"data-testid": "toolbar-inline-edit-toggle",
|
|
1590
1594
|
children: [/* @__PURE__ */ I(me, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1591
1595
|
className: "hidden sm:inline",
|
|
1592
|
-
children:
|
|
1596
|
+
children: k("list.inlineEditShort", { defaultValue: "Edit inline" })
|
|
1593
1597
|
})]
|
|
1594
1598
|
}),
|
|
1595
|
-
|
|
1596
|
-
open:
|
|
1597
|
-
onOpenChange:
|
|
1599
|
+
P.showHideFields && !P.compactToolbar && /* @__PURE__ */ L(S, {
|
|
1600
|
+
open: At,
|
|
1601
|
+
onOpenChange: jt,
|
|
1598
1602
|
children: [/* @__PURE__ */ I(w, {
|
|
1599
1603
|
asChild: !0,
|
|
1600
1604
|
children: /* @__PURE__ */ L(u, {
|
|
1601
1605
|
variant: "ghost",
|
|
1602
1606
|
size: "sm",
|
|
1603
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1607
|
+
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Z.size > 0 && "text-primary"),
|
|
1604
1608
|
children: [
|
|
1605
|
-
/* @__PURE__ */ I(
|
|
1609
|
+
/* @__PURE__ */ I(ce, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1606
1610
|
/* @__PURE__ */ I("span", {
|
|
1607
1611
|
className: "hidden sm:inline",
|
|
1608
|
-
children:
|
|
1612
|
+
children: k("list.hideFields")
|
|
1609
1613
|
}),
|
|
1610
|
-
|
|
1614
|
+
Z.size > 0 && /* @__PURE__ */ I("span", {
|
|
1611
1615
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1612
|
-
children:
|
|
1616
|
+
children: Z.size
|
|
1613
1617
|
})
|
|
1614
1618
|
]
|
|
1615
1619
|
})
|
|
@@ -1622,24 +1626,24 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1622
1626
|
className: "flex items-center justify-between border-b pb-2",
|
|
1623
1627
|
children: [/* @__PURE__ */ I("h4", {
|
|
1624
1628
|
className: "font-medium text-sm",
|
|
1625
|
-
children:
|
|
1626
|
-
}),
|
|
1629
|
+
children: k("list.hideFieldsTitle")
|
|
1630
|
+
}), Z.size > 0 && /* @__PURE__ */ I(u, {
|
|
1627
1631
|
variant: "ghost",
|
|
1628
1632
|
size: "sm",
|
|
1629
1633
|
className: "h-6 px-2 text-xs",
|
|
1630
|
-
onClick: () =>
|
|
1631
|
-
children:
|
|
1634
|
+
onClick: () => kt(/* @__PURE__ */ new Set()),
|
|
1635
|
+
children: k("list.showAll")
|
|
1632
1636
|
})]
|
|
1633
1637
|
}), /* @__PURE__ */ I("div", {
|
|
1634
1638
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1635
|
-
children:
|
|
1639
|
+
children: un.map((e) => /* @__PURE__ */ L("label", {
|
|
1636
1640
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1637
1641
|
children: [/* @__PURE__ */ I("input", {
|
|
1638
1642
|
type: "checkbox",
|
|
1639
|
-
checked: !
|
|
1643
|
+
checked: !Z.has(e.name),
|
|
1640
1644
|
onChange: () => {
|
|
1641
|
-
let t = new Set(
|
|
1642
|
-
t.has(e.name) ? t.delete(e.name) : t.add(e.name),
|
|
1645
|
+
let t = new Set(Z);
|
|
1646
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), kt(t);
|
|
1643
1647
|
},
|
|
1644
1648
|
className: "rounded border-input"
|
|
1645
1649
|
}), /* @__PURE__ */ I("span", {
|
|
@@ -1651,25 +1655,25 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1651
1655
|
})
|
|
1652
1656
|
})]
|
|
1653
1657
|
}),
|
|
1654
|
-
|
|
1655
|
-
|
|
1658
|
+
P.showHideFields && !P.compactToolbar && (P.showFilters || P.showSort || P.showGroup) && /* @__PURE__ */ I("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1659
|
+
P.showFilters && /* @__PURE__ */ L(S, {
|
|
1656
1660
|
open: Ve,
|
|
1657
|
-
onOpenChange:
|
|
1661
|
+
onOpenChange: He,
|
|
1658
1662
|
children: [/* @__PURE__ */ I(w, {
|
|
1659
1663
|
asChild: !0,
|
|
1660
1664
|
children: /* @__PURE__ */ L(u, {
|
|
1661
1665
|
variant: "ghost",
|
|
1662
1666
|
size: "sm",
|
|
1663
|
-
className: E("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1667
|
+
className: E("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", sn && "text-foreground font-medium"),
|
|
1664
1668
|
children: [
|
|
1665
1669
|
/* @__PURE__ */ I(we, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1666
1670
|
/* @__PURE__ */ I("span", {
|
|
1667
1671
|
className: "hidden sm:inline",
|
|
1668
|
-
children:
|
|
1672
|
+
children: k("list.filter")
|
|
1669
1673
|
}),
|
|
1670
|
-
|
|
1674
|
+
sn && /* @__PURE__ */ I("span", {
|
|
1671
1675
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1672
|
-
children:
|
|
1676
|
+
children: H.conditions?.length || 0
|
|
1673
1677
|
})
|
|
1674
1678
|
]
|
|
1675
1679
|
})
|
|
@@ -1682,19 +1686,19 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1682
1686
|
className: "flex items-center justify-between border-b pb-2",
|
|
1683
1687
|
children: /* @__PURE__ */ I("h4", {
|
|
1684
1688
|
className: "font-medium text-sm",
|
|
1685
|
-
children:
|
|
1689
|
+
children: k("list.filterRecords")
|
|
1686
1690
|
})
|
|
1687
1691
|
}), /* @__PURE__ */ I(v, {
|
|
1688
|
-
fields:
|
|
1689
|
-
value:
|
|
1692
|
+
fields: cn,
|
|
1693
|
+
value: H,
|
|
1690
1694
|
onChange: (e) => {
|
|
1691
|
-
|
|
1695
|
+
We(e), a && a(e);
|
|
1692
1696
|
}
|
|
1693
1697
|
})]
|
|
1694
1698
|
})
|
|
1695
1699
|
})]
|
|
1696
1700
|
}),
|
|
1697
|
-
|
|
1701
|
+
P.showGroup && !P.compactToolbar && /* @__PURE__ */ L(S, {
|
|
1698
1702
|
open: ht,
|
|
1699
1703
|
onOpenChange: gt,
|
|
1700
1704
|
children: [/* @__PURE__ */ I(w, {
|
|
@@ -1702,16 +1706,16 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1702
1706
|
children: /* @__PURE__ */ L(u, {
|
|
1703
1707
|
variant: "ghost",
|
|
1704
1708
|
size: "sm",
|
|
1705
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1709
|
+
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Y && "text-foreground font-medium"),
|
|
1706
1710
|
children: [
|
|
1707
1711
|
/* @__PURE__ */ I(le, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1708
1712
|
/* @__PURE__ */ I("span", {
|
|
1709
1713
|
className: "hidden sm:inline",
|
|
1710
|
-
children:
|
|
1714
|
+
children: k("list.group")
|
|
1711
1715
|
}),
|
|
1712
|
-
|
|
1716
|
+
Y && Y.fields?.length > 0 && /* @__PURE__ */ I("span", {
|
|
1713
1717
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1714
|
-
children:
|
|
1718
|
+
children: Y.fields.length
|
|
1715
1719
|
})
|
|
1716
1720
|
]
|
|
1717
1721
|
})
|
|
@@ -1724,28 +1728,28 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1724
1728
|
className: "flex items-center justify-between border-b pb-2",
|
|
1725
1729
|
children: [/* @__PURE__ */ I("h4", {
|
|
1726
1730
|
className: "font-medium text-sm",
|
|
1727
|
-
children:
|
|
1728
|
-
}),
|
|
1731
|
+
children: k("list.groupBy")
|
|
1732
|
+
}), Y && /* @__PURE__ */ I(u, {
|
|
1729
1733
|
variant: "ghost",
|
|
1730
1734
|
size: "sm",
|
|
1731
1735
|
className: "h-6 px-2 text-xs",
|
|
1732
1736
|
onClick: () => mt(void 0),
|
|
1733
1737
|
"data-testid": "clear-grouping",
|
|
1734
|
-
children:
|
|
1738
|
+
children: k("list.clear")
|
|
1735
1739
|
})]
|
|
1736
1740
|
}), /* @__PURE__ */ I("div", {
|
|
1737
1741
|
"data-testid": "group-field-list",
|
|
1738
1742
|
children: /* @__PURE__ */ I(ee, {
|
|
1739
|
-
value:
|
|
1740
|
-
fieldOptions:
|
|
1743
|
+
value: Y,
|
|
1744
|
+
fieldOptions: un.map((e) => ({
|
|
1741
1745
|
value: e.name,
|
|
1742
1746
|
label: e.label || e.name
|
|
1743
1747
|
})),
|
|
1744
1748
|
maxLevels: 3,
|
|
1745
1749
|
labels: {
|
|
1746
|
-
addGroup:
|
|
1747
|
-
collapseTitle:
|
|
1748
|
-
removeTitle:
|
|
1750
|
+
addGroup: k("list.addGroup", { defaultValue: "Add group field" }),
|
|
1751
|
+
collapseTitle: k("list.collapsedByDefault", { defaultValue: "Collapsed by default" }),
|
|
1752
|
+
removeTitle: k("list.removeGroup", { defaultValue: "Remove" })
|
|
1749
1753
|
},
|
|
1750
1754
|
onChange: (e) => mt(e)
|
|
1751
1755
|
})
|
|
@@ -1753,24 +1757,24 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1753
1757
|
})
|
|
1754
1758
|
})]
|
|
1755
1759
|
}),
|
|
1756
|
-
|
|
1757
|
-
open:
|
|
1758
|
-
onOpenChange:
|
|
1760
|
+
P.showSort && /* @__PURE__ */ L(S, {
|
|
1761
|
+
open: Ie,
|
|
1762
|
+
onOpenChange: ze,
|
|
1759
1763
|
children: [/* @__PURE__ */ I(w, {
|
|
1760
1764
|
asChild: !0,
|
|
1761
1765
|
children: /* @__PURE__ */ L(u, {
|
|
1762
1766
|
variant: "ghost",
|
|
1763
1767
|
size: "sm",
|
|
1764
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1768
|
+
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", z.length > 0 && "text-foreground font-medium"),
|
|
1765
1769
|
children: [
|
|
1766
|
-
/* @__PURE__ */ I(
|
|
1770
|
+
/* @__PURE__ */ I(re, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1767
1771
|
/* @__PURE__ */ I("span", {
|
|
1768
1772
|
className: "hidden sm:inline",
|
|
1769
|
-
children:
|
|
1773
|
+
children: k("list.sort")
|
|
1770
1774
|
}),
|
|
1771
|
-
|
|
1775
|
+
z.length > 0 && /* @__PURE__ */ I("span", {
|
|
1772
1776
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1773
|
-
children:
|
|
1777
|
+
children: z.length
|
|
1774
1778
|
})
|
|
1775
1779
|
]
|
|
1776
1780
|
})
|
|
@@ -1783,20 +1787,20 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1783
1787
|
className: "flex items-center justify-between border-b pb-2",
|
|
1784
1788
|
children: /* @__PURE__ */ I("h4", {
|
|
1785
1789
|
className: "font-medium text-sm",
|
|
1786
|
-
children:
|
|
1790
|
+
children: k("list.sortRecords")
|
|
1787
1791
|
})
|
|
1788
1792
|
}), /* @__PURE__ */ I(T, {
|
|
1789
|
-
fields:
|
|
1790
|
-
value:
|
|
1793
|
+
fields: cn,
|
|
1794
|
+
value: z,
|
|
1791
1795
|
onChange: (e) => {
|
|
1792
|
-
|
|
1796
|
+
B(e), o && o(e);
|
|
1793
1797
|
}
|
|
1794
1798
|
})]
|
|
1795
1799
|
})
|
|
1796
1800
|
})]
|
|
1797
1801
|
}),
|
|
1798
|
-
!
|
|
1799
|
-
|
|
1802
|
+
!P.compactToolbar && (P.showFilters || P.showSort || P.showGroup) && (P.showColor || P.showDensity) && /* @__PURE__ */ I("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1803
|
+
P.showColor && !P.compactToolbar && /* @__PURE__ */ L(S, {
|
|
1800
1804
|
open: yt,
|
|
1801
1805
|
onOpenChange: bt,
|
|
1802
1806
|
children: [/* @__PURE__ */ I(w, {
|
|
@@ -1804,10 +1808,10 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1804
1808
|
children: /* @__PURE__ */ L(u, {
|
|
1805
1809
|
variant: "ghost",
|
|
1806
1810
|
size: "sm",
|
|
1807
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1811
|
+
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", X && "text-foreground font-medium"),
|
|
1808
1812
|
children: [/* @__PURE__ */ I(pe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1809
1813
|
className: "hidden sm:inline",
|
|
1810
|
-
children:
|
|
1814
|
+
children: k("list.color")
|
|
1811
1815
|
})]
|
|
1812
1816
|
})
|
|
1813
1817
|
}), /* @__PURE__ */ I(C, {
|
|
@@ -1819,36 +1823,36 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1819
1823
|
className: "flex items-center justify-between border-b pb-2",
|
|
1820
1824
|
children: [/* @__PURE__ */ I("h4", {
|
|
1821
1825
|
className: "font-medium text-sm",
|
|
1822
|
-
children:
|
|
1823
|
-
}),
|
|
1826
|
+
children: k("list.rowColor")
|
|
1827
|
+
}), X && /* @__PURE__ */ I(u, {
|
|
1824
1828
|
variant: "ghost",
|
|
1825
1829
|
size: "sm",
|
|
1826
1830
|
className: "h-6 px-2 text-xs",
|
|
1827
1831
|
onClick: () => vt(void 0),
|
|
1828
1832
|
"data-testid": "clear-row-color",
|
|
1829
|
-
children:
|
|
1833
|
+
children: k("list.clear")
|
|
1830
1834
|
})]
|
|
1831
1835
|
}), /* @__PURE__ */ L("div", {
|
|
1832
1836
|
className: "space-y-2",
|
|
1833
1837
|
"data-testid": "color-field-list",
|
|
1834
1838
|
children: [/* @__PURE__ */ I("label", {
|
|
1835
1839
|
className: "text-xs text-muted-foreground",
|
|
1836
|
-
children:
|
|
1840
|
+
children: k("list.colorByField")
|
|
1837
1841
|
}), /* @__PURE__ */ L("select", {
|
|
1838
1842
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1839
|
-
value:
|
|
1843
|
+
value: X?.field || "",
|
|
1840
1844
|
onChange: (e) => {
|
|
1841
1845
|
let t = e.target.value;
|
|
1842
1846
|
vt(t ? {
|
|
1843
1847
|
field: t,
|
|
1844
|
-
colors:
|
|
1848
|
+
colors: X?.colors || {}
|
|
1845
1849
|
} : void 0);
|
|
1846
1850
|
},
|
|
1847
1851
|
"data-testid": "color-field-select",
|
|
1848
1852
|
children: [/* @__PURE__ */ I("option", {
|
|
1849
1853
|
value: "",
|
|
1850
|
-
children:
|
|
1851
|
-
}),
|
|
1854
|
+
children: k("list.none")
|
|
1855
|
+
}), un.map((e) => /* @__PURE__ */ I("option", {
|
|
1852
1856
|
value: e.name,
|
|
1853
1857
|
children: e.label
|
|
1854
1858
|
}, e.name))]
|
|
@@ -1857,8 +1861,8 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1857
1861
|
})
|
|
1858
1862
|
})]
|
|
1859
1863
|
}),
|
|
1860
|
-
|
|
1861
|
-
let e =
|
|
1864
|
+
P.showDensity && !P.compactToolbar && F !== "gallery" && (() => {
|
|
1865
|
+
let e = Q.mode === "compact" ? be : Q.mode === "comfortable" ? ye : ve, t = Q.mode === "compact" ? k("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Q.mode === "comfortable" ? k("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : k("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${k("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = k("grid.toolbar.densityCycleHint", {
|
|
1862
1866
|
defaultValue: "{{label}} (click to cycle)",
|
|
1863
1867
|
label: n
|
|
1864
1868
|
});
|
|
@@ -1866,14 +1870,14 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1866
1870
|
variant: "ghost",
|
|
1867
1871
|
size: "sm",
|
|
1868
1872
|
"aria-label": n,
|
|
1869
|
-
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1870
|
-
onClick:
|
|
1873
|
+
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Q.mode !== "compact" && "text-foreground font-medium"),
|
|
1874
|
+
onClick: Q.cycle,
|
|
1871
1875
|
title: r,
|
|
1872
1876
|
children: /* @__PURE__ */ I(e, { className: "h-3.5 w-3.5" })
|
|
1873
1877
|
});
|
|
1874
1878
|
})(),
|
|
1875
|
-
|
|
1876
|
-
let e =
|
|
1879
|
+
P.showDensity && !P.compactToolbar && F === "gallery" && (() => {
|
|
1880
|
+
let e = Wt === "small" ? be : Wt === "medium" ? ye : ve, t = Wt === "small" ? k("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Wt === "medium" ? k("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : k("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${k("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = k("grid.toolbar.densityCycleHint", {
|
|
1877
1881
|
defaultValue: "{{label}} (click to cycle)",
|
|
1878
1882
|
label: n
|
|
1879
1883
|
});
|
|
@@ -1881,43 +1885,43 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1881
1885
|
variant: "ghost",
|
|
1882
1886
|
size: "sm",
|
|
1883
1887
|
"aria-label": n,
|
|
1884
|
-
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1885
|
-
onClick:
|
|
1888
|
+
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Wt !== "small" && "text-foreground font-medium"),
|
|
1889
|
+
onClick: Kt,
|
|
1886
1890
|
title: r,
|
|
1887
1891
|
children: /* @__PURE__ */ I(e, { className: "h-3.5 w-3.5" })
|
|
1888
1892
|
});
|
|
1889
1893
|
})(),
|
|
1890
|
-
|
|
1891
|
-
t:
|
|
1892
|
-
allFields:
|
|
1893
|
-
showGroup:
|
|
1894
|
-
groupingConfig:
|
|
1894
|
+
P.compactToolbar && (P.showGroup || P.showColor || P.showDensity || P.showHideFields) && /* @__PURE__ */ I(Ue, {
|
|
1895
|
+
t: k,
|
|
1896
|
+
allFields: un,
|
|
1897
|
+
showGroup: P.showGroup,
|
|
1898
|
+
groupingConfig: Y,
|
|
1895
1899
|
setGroupingConfig: mt,
|
|
1896
|
-
showColor:
|
|
1897
|
-
rowColorConfig:
|
|
1900
|
+
showColor: P.showColor,
|
|
1901
|
+
rowColorConfig: X,
|
|
1898
1902
|
setRowColorConfig: vt,
|
|
1899
|
-
showDensity:
|
|
1900
|
-
density:
|
|
1901
|
-
showHideFields:
|
|
1902
|
-
hiddenFields:
|
|
1903
|
-
updateHiddenFields:
|
|
1904
|
-
showInlineEdit:
|
|
1905
|
-
inlineEdit:
|
|
1906
|
-
setInlineEdit:
|
|
1903
|
+
showDensity: P.showDensity,
|
|
1904
|
+
density: Q,
|
|
1905
|
+
showHideFields: P.showHideFields,
|
|
1906
|
+
hiddenFields: Z,
|
|
1907
|
+
updateHiddenFields: kt,
|
|
1908
|
+
showInlineEdit: F === "grid",
|
|
1909
|
+
inlineEdit: Mt,
|
|
1910
|
+
setInlineEdit: Pt
|
|
1907
1911
|
}),
|
|
1908
|
-
(
|
|
1909
|
-
|
|
1910
|
-
open:
|
|
1911
|
-
onOpenChange:
|
|
1912
|
+
(P.showColor || P.showDensity || P.compactToolbar) && Ht && Vt && /* @__PURE__ */ I("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1913
|
+
Ht && Vt && /* @__PURE__ */ L(S, {
|
|
1914
|
+
open: Ft,
|
|
1915
|
+
onOpenChange: It,
|
|
1912
1916
|
children: [/* @__PURE__ */ I(w, {
|
|
1913
1917
|
asChild: !0,
|
|
1914
1918
|
children: /* @__PURE__ */ L(u, {
|
|
1915
1919
|
variant: "ghost",
|
|
1916
1920
|
size: "sm",
|
|
1917
1921
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1918
|
-
children: [/* @__PURE__ */ I(
|
|
1922
|
+
children: [/* @__PURE__ */ I(se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1919
1923
|
className: "hidden sm:inline",
|
|
1920
|
-
children:
|
|
1924
|
+
children: k("list.export")
|
|
1921
1925
|
})]
|
|
1922
1926
|
})
|
|
1923
1927
|
}), /* @__PURE__ */ I(C, {
|
|
@@ -1925,34 +1929,34 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1925
1929
|
className: "w-48 p-2",
|
|
1926
1930
|
children: /* @__PURE__ */ L("div", {
|
|
1927
1931
|
className: "space-y-1",
|
|
1928
|
-
children: [(
|
|
1932
|
+
children: [(Ht.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ L(u, {
|
|
1929
1933
|
variant: "ghost",
|
|
1930
1934
|
size: "sm",
|
|
1931
1935
|
className: "w-full justify-start h-8 text-xs",
|
|
1932
|
-
disabled:
|
|
1933
|
-
onClick: () =>
|
|
1934
|
-
children: [
|
|
1935
|
-
}, e)),
|
|
1936
|
+
disabled: Lt,
|
|
1937
|
+
onClick: () => ln(e),
|
|
1938
|
+
children: [Lt ? /* @__PURE__ */ I(fe, { className: "h-3.5 w-3.5 mr-2 animate-spin" }) : /* @__PURE__ */ I(se, { className: "h-3.5 w-3.5 mr-2" }), k("list.exportAs", { format: e.toUpperCase() })]
|
|
1939
|
+
}, e)), zt && /* @__PURE__ */ I("div", {
|
|
1936
1940
|
className: "px-2 py-1 text-xs",
|
|
1937
1941
|
style: { color: "var(--destructive, #ef4444)" },
|
|
1938
1942
|
role: "alert",
|
|
1939
|
-
children:
|
|
1943
|
+
children: zt
|
|
1940
1944
|
})]
|
|
1941
1945
|
})
|
|
1942
1946
|
})]
|
|
1943
1947
|
}),
|
|
1944
|
-
(
|
|
1948
|
+
(M.sharing?.enabled || M.sharing?.type) && /* @__PURE__ */ L(u, {
|
|
1945
1949
|
variant: "ghost",
|
|
1946
1950
|
size: "sm",
|
|
1947
1951
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1948
|
-
title: `Sharing: ${
|
|
1952
|
+
title: `Sharing: ${M.sharing?.visibility || M.sharing?.type || "private"}`,
|
|
1949
1953
|
"data-testid": "share-button",
|
|
1950
1954
|
children: [/* @__PURE__ */ I(Ce, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1951
1955
|
className: "hidden sm:inline",
|
|
1952
|
-
children:
|
|
1956
|
+
children: k("list.share")
|
|
1953
1957
|
})]
|
|
1954
1958
|
}),
|
|
1955
|
-
|
|
1959
|
+
M.allowPrinting && /* @__PURE__ */ L(u, {
|
|
1956
1960
|
variant: "ghost",
|
|
1957
1961
|
size: "sm",
|
|
1958
1962
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
@@ -1960,24 +1964,24 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1960
1964
|
"data-testid": "print-button",
|
|
1961
1965
|
children: [/* @__PURE__ */ I(ge, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1962
1966
|
className: "hidden sm:inline",
|
|
1963
|
-
children:
|
|
1967
|
+
children: k("list.print")
|
|
1964
1968
|
})]
|
|
1965
1969
|
}),
|
|
1966
1970
|
(() => {
|
|
1967
|
-
let e =
|
|
1968
|
-
return
|
|
1971
|
+
let e = M.allowPrinting || M.sharing?.enabled || M.sharing?.type || Ht && Vt;
|
|
1972
|
+
return P.showSearch && e ? /* @__PURE__ */ I("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }) : null;
|
|
1969
1973
|
})(),
|
|
1970
|
-
|
|
1971
|
-
open:
|
|
1972
|
-
onOpenChange:
|
|
1974
|
+
P.showSearch && /* @__PURE__ */ L(S, {
|
|
1975
|
+
open: Me,
|
|
1976
|
+
onOpenChange: Ne,
|
|
1973
1977
|
children: [/* @__PURE__ */ I(w, {
|
|
1974
1978
|
asChild: !0,
|
|
1975
1979
|
children: /* @__PURE__ */ I(u, {
|
|
1976
1980
|
variant: "ghost",
|
|
1977
1981
|
size: "sm",
|
|
1978
|
-
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1982
|
+
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", R && "text-foreground font-medium"),
|
|
1979
1983
|
"data-testid": "search-icon-button",
|
|
1980
|
-
title:
|
|
1984
|
+
title: k("list.search"),
|
|
1981
1985
|
children: /* @__PURE__ */ I(xe, { className: "h-3.5 w-3.5" })
|
|
1982
1986
|
})
|
|
1983
1987
|
}), /* @__PURE__ */ I(C, {
|
|
@@ -1989,32 +1993,32 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1989
1993
|
children: [
|
|
1990
1994
|
/* @__PURE__ */ I(xe, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
1991
1995
|
/* @__PURE__ */ I(y, {
|
|
1992
|
-
placeholder:
|
|
1993
|
-
value:
|
|
1994
|
-
onChange: (e) =>
|
|
1996
|
+
placeholder: k("list.search") + "...",
|
|
1997
|
+
value: R,
|
|
1998
|
+
onChange: (e) => rn(e.target.value),
|
|
1995
1999
|
className: "pl-7 h-8 text-xs",
|
|
1996
2000
|
autoFocus: !0
|
|
1997
2001
|
}),
|
|
1998
|
-
|
|
2002
|
+
R && /* @__PURE__ */ I(u, {
|
|
1999
2003
|
variant: "ghost",
|
|
2000
2004
|
size: "sm",
|
|
2001
2005
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
2002
|
-
onClick: () =>
|
|
2006
|
+
onClick: () => rn(""),
|
|
2003
2007
|
children: /* @__PURE__ */ I(Ee, { className: "h-3 w-3" })
|
|
2004
2008
|
})
|
|
2005
2009
|
]
|
|
2006
2010
|
})
|
|
2007
2011
|
})]
|
|
2008
2012
|
}),
|
|
2009
|
-
|
|
2013
|
+
P.showAddRecord && P.addRecordPosition === "top" && /* @__PURE__ */ L(u, {
|
|
2010
2014
|
variant: "ghost",
|
|
2011
2015
|
size: "sm",
|
|
2012
2016
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
2013
2017
|
"data-testid": "add-record-button",
|
|
2014
|
-
onClick: () =>
|
|
2018
|
+
onClick: () => D.onAddRecord?.(),
|
|
2015
2019
|
children: [/* @__PURE__ */ I(he, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
2016
2020
|
className: "hidden sm:inline",
|
|
2017
|
-
children:
|
|
2021
|
+
children: k("list.addRecord")
|
|
2018
2022
|
})]
|
|
2019
2023
|
})
|
|
2020
2024
|
]
|
|
@@ -2022,21 +2026,21 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2022
2026
|
}),
|
|
2023
2027
|
/* @__PURE__ */ L("div", {
|
|
2024
2028
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
2025
|
-
children: [/* @__PURE__ */ I(te, { active:
|
|
2029
|
+
children: [/* @__PURE__ */ I(te, { active: G && W.length > 0 }), qe && W.length === 0 ? /* @__PURE__ */ I(p, {
|
|
2026
2030
|
"data-testid": "list-error-state",
|
|
2027
2031
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
2028
|
-
icon: /* @__PURE__ */ I(
|
|
2032
|
+
icon: /* @__PURE__ */ I(ne, { className: "h-12 w-12 text-destructive/60" }),
|
|
2029
2033
|
iconWrapperClassName: "mb-3",
|
|
2030
|
-
title:
|
|
2031
|
-
description:
|
|
2034
|
+
title: k("list.loadErrorTitle"),
|
|
2035
|
+
description: k("list.loadErrorMessage"),
|
|
2032
2036
|
action: /* @__PURE__ */ L(u, {
|
|
2033
2037
|
variant: "outline",
|
|
2034
2038
|
size: "sm",
|
|
2035
2039
|
"data-testid": "list-error-retry",
|
|
2036
|
-
onClick: () =>
|
|
2037
|
-
children: [/* @__PURE__ */ I(_e, { className: "h-4 w-4 mr-1.5" }),
|
|
2040
|
+
onClick: () => it((e) => e + 1),
|
|
2041
|
+
children: [/* @__PURE__ */ I(_e, { className: "h-4 w-4 mr-1.5" }), k("list.retry")]
|
|
2038
2042
|
})
|
|
2039
|
-
}) :
|
|
2043
|
+
}) : G && W.length === 0 ? /* @__PURE__ */ L("div", {
|
|
2040
2044
|
className: "flex flex-col h-full min-h-[200px] p-4 gap-2",
|
|
2041
2045
|
"data-testid": "list-loading",
|
|
2042
2046
|
role: "status",
|
|
@@ -2044,7 +2048,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2044
2048
|
"aria-busy": "true",
|
|
2045
2049
|
children: [/* @__PURE__ */ I("span", {
|
|
2046
2050
|
className: "sr-only",
|
|
2047
|
-
children:
|
|
2051
|
+
children: k("list.loading")
|
|
2048
2052
|
}), [
|
|
2049
2053
|
0,
|
|
2050
2054
|
1,
|
|
@@ -2056,8 +2060,8 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2056
2060
|
className: "h-9 rounded bg-muted/60 animate-pulse",
|
|
2057
2061
|
style: { opacity: Math.max(.25, 1 - e * .12) }
|
|
2058
2062
|
}, e))]
|
|
2059
|
-
}) : !
|
|
2060
|
-
let e =
|
|
2063
|
+
}) : !G && W.length === 0 && F === "grid" ? (() => {
|
|
2064
|
+
let e = M.emptyState?.icon, t = e ? De[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? ue : ue, n = !!(R && R.trim()) || Array.isArray(wt) && wt.length > 0 || Array.isArray(H?.conditions) && H.conditions.length > 0, r = (typeof M.emptyState?.title == "string" ? M.emptyState.title : void 0) ?? k(n ? "list.noMatches" : "list.firstRunTitle"), i = (typeof M.emptyState?.message == "string" ? M.emptyState.message : void 0) ?? k(n ? "list.noMatchesMessage" : "list.firstRunMessage");
|
|
2061
2065
|
return /* @__PURE__ */ I(p, {
|
|
2062
2066
|
"data-testid": "empty-state",
|
|
2063
2067
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
@@ -2065,47 +2069,47 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2065
2069
|
iconWrapperClassName: "mb-3",
|
|
2066
2070
|
title: r,
|
|
2067
2071
|
description: i,
|
|
2068
|
-
action:
|
|
2072
|
+
action: P.showAddRecord ? /* @__PURE__ */ L(u, {
|
|
2069
2073
|
variant: "default",
|
|
2070
2074
|
size: "sm",
|
|
2071
2075
|
"data-testid": "empty-state-add-record",
|
|
2072
|
-
onClick: () =>
|
|
2073
|
-
children: [/* @__PURE__ */ I(he, { className: "h-4 w-4 mr-1.5" }),
|
|
2076
|
+
onClick: () => D.onAddRecord?.(),
|
|
2077
|
+
children: [/* @__PURE__ */ I(he, { className: "h-4 w-4 mr-1.5" }), k("list.addRecord")]
|
|
2074
2078
|
}) : void 0
|
|
2075
2079
|
});
|
|
2076
|
-
})() : /* @__PURE__ */ I(
|
|
2077
|
-
schema:
|
|
2078
|
-
...
|
|
2079
|
-
data:
|
|
2080
|
-
loading:
|
|
2080
|
+
})() : /* @__PURE__ */ I(je, {
|
|
2081
|
+
schema: on,
|
|
2082
|
+
...D,
|
|
2083
|
+
data: W,
|
|
2084
|
+
loading: G,
|
|
2081
2085
|
onRowSelect: St,
|
|
2082
|
-
...
|
|
2086
|
+
...F === "grid" && !Y?.fields?.length && dt != null ? {
|
|
2083
2087
|
manualPagination: !0,
|
|
2084
|
-
rowCount:
|
|
2085
|
-
page:
|
|
2086
|
-
pageSize:
|
|
2087
|
-
onPageChange: (e) =>
|
|
2088
|
+
rowCount: dt,
|
|
2089
|
+
page: lt,
|
|
2090
|
+
pageSize: J,
|
|
2091
|
+
onPageChange: (e) => ut(e),
|
|
2088
2092
|
onPageSizeChange: (e) => {
|
|
2089
|
-
|
|
2093
|
+
ct(e), ut(1);
|
|
2090
2094
|
}
|
|
2091
2095
|
} : {}
|
|
2092
2096
|
})]
|
|
2093
|
-
},
|
|
2094
|
-
|
|
2097
|
+
}, F),
|
|
2098
|
+
P.showAddRecord && P.addRecordPosition === "bottom" && /* @__PURE__ */ I("div", {
|
|
2095
2099
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
2096
2100
|
children: /* @__PURE__ */ L(u, {
|
|
2097
2101
|
variant: "ghost",
|
|
2098
2102
|
size: "sm",
|
|
2099
2103
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
2100
2104
|
"data-testid": "add-record-button",
|
|
2101
|
-
onClick: () =>
|
|
2105
|
+
onClick: () => D.onAddRecord?.(),
|
|
2102
2106
|
children: [/* @__PURE__ */ I(he, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
2103
2107
|
className: "hidden sm:inline",
|
|
2104
|
-
children:
|
|
2108
|
+
children: k("list.addRecord")
|
|
2105
2109
|
})]
|
|
2106
2110
|
})
|
|
2107
2111
|
}),
|
|
2108
|
-
|
|
2112
|
+
M.bulkActions && M.bulkActions.length > 0 && xt.length > 0 && F !== "grid" && /* @__PURE__ */ L("div", {
|
|
2109
2113
|
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",
|
|
2110
2114
|
role: "region",
|
|
2111
2115
|
"aria-label": "Bulk actions",
|
|
@@ -2123,15 +2127,15 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2123
2127
|
}),
|
|
2124
2128
|
/* @__PURE__ */ I("div", {
|
|
2125
2129
|
className: "flex items-center gap-1.5 ml-3",
|
|
2126
|
-
children:
|
|
2130
|
+
children: M.bulkActions.map((e) => {
|
|
2127
2131
|
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ? Te : null;
|
|
2128
2132
|
return /* @__PURE__ */ L(u, {
|
|
2129
2133
|
variant: n ? "destructive" : "outline",
|
|
2130
2134
|
size: "sm",
|
|
2131
2135
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
2132
|
-
onClick: () =>
|
|
2136
|
+
onClick: () => D.onBulkAction?.(e, xt),
|
|
2133
2137
|
"data-testid": `bulk-action-${e}`,
|
|
2134
|
-
children: [r && /* @__PURE__ */ I(r, { className: "h-3 w-3" }),
|
|
2138
|
+
children: [r && /* @__PURE__ */ I(r, { className: "h-3 w-3" }), de(e)]
|
|
2135
2139
|
}, e);
|
|
2136
2140
|
})
|
|
2137
2141
|
}),
|
|
@@ -2144,30 +2148,30 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2144
2148
|
})
|
|
2145
2149
|
]
|
|
2146
2150
|
}),
|
|
2147
|
-
!
|
|
2151
|
+
!G && W.length > 0 && M.showRecordCount !== !1 && /* @__PURE__ */ L("div", {
|
|
2148
2152
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
2149
2153
|
"data-testid": "record-count-bar",
|
|
2150
2154
|
children: [
|
|
2151
2155
|
/* @__PURE__ */ I("span", {
|
|
2152
2156
|
className: "font-medium text-foreground/80",
|
|
2153
|
-
children:
|
|
2157
|
+
children: W.length === 1 ? k("list.recordCountOne", { count: W.length }) : k("list.recordCount", { count: W.length })
|
|
2154
2158
|
}),
|
|
2155
|
-
|
|
2159
|
+
at && /* @__PURE__ */ I("span", {
|
|
2156
2160
|
className: "text-amber-600",
|
|
2157
2161
|
"data-testid": "data-limit-warning",
|
|
2158
|
-
children:
|
|
2162
|
+
children: k("list.dataLimitReached", { limit: J })
|
|
2159
2163
|
}),
|
|
2160
|
-
|
|
2164
|
+
F !== "grid" && M.pagination?.pageSizeOptions && M.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ L("div", {
|
|
2161
2165
|
className: "ml-auto flex items-center gap-2",
|
|
2162
|
-
children: [/* @__PURE__ */ I("span", { children:
|
|
2166
|
+
children: [/* @__PURE__ */ I("span", { children: k("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ I("select", {
|
|
2163
2167
|
"data-testid": "page-size-selector",
|
|
2164
2168
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
2165
|
-
value: String(
|
|
2169
|
+
value: String(J),
|
|
2166
2170
|
onChange: (e) => {
|
|
2167
2171
|
let t = Number(e.target.value);
|
|
2168
|
-
|
|
2172
|
+
ct(t), D.onPageSizeChange && D.onPageSizeChange(t);
|
|
2169
2173
|
},
|
|
2170
|
-
children:
|
|
2174
|
+
children: M.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ I("option", {
|
|
2171
2175
|
value: String(e),
|
|
2172
2176
|
children: e
|
|
2173
2177
|
}, e))
|
|
@@ -2175,9 +2179,9 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2175
2179
|
})
|
|
2176
2180
|
]
|
|
2177
2181
|
}),
|
|
2178
|
-
|
|
2179
|
-
...
|
|
2180
|
-
title:
|
|
2182
|
+
an.isOverlay && /* @__PURE__ */ I(x, {
|
|
2183
|
+
...an,
|
|
2184
|
+
title: M.label ? `${M.label} Detail` : M.objectName ? `${M.objectName.charAt(0).toUpperCase() + M.objectName.slice(1)} Detail` : "Record Detail",
|
|
2181
2185
|
children: (e) => /* @__PURE__ */ I("div", {
|
|
2182
2186
|
className: "space-y-3",
|
|
2183
2187
|
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ L("div", {
|
|
@@ -2195,24 +2199,24 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2195
2199
|
]
|
|
2196
2200
|
});
|
|
2197
2201
|
});
|
|
2198
|
-
|
|
2202
|
+
rt.displayName = "ListView";
|
|
2199
2203
|
//#endregion
|
|
2200
2204
|
//#region src/ObjectGallery.tsx
|
|
2201
|
-
var
|
|
2205
|
+
var it = {
|
|
2202
2206
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
2203
2207
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
2204
2208
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
2205
|
-
},
|
|
2209
|
+
}, at = {
|
|
2206
2210
|
small: "aspect-square",
|
|
2207
2211
|
medium: "aspect-[4/3]",
|
|
2208
2212
|
large: "aspect-[16/10]"
|
|
2209
|
-
},
|
|
2213
|
+
}, ot = /* @__PURE__ */ new Set([
|
|
2210
2214
|
"number",
|
|
2211
2215
|
"currency",
|
|
2212
2216
|
"percent",
|
|
2213
2217
|
"integer",
|
|
2214
2218
|
"decimal"
|
|
2215
|
-
]),
|
|
2219
|
+
]), st = [
|
|
2216
2220
|
{
|
|
2217
2221
|
bg: "from-indigo-500/15 via-indigo-500/5 to-purple-500/10",
|
|
2218
2222
|
ring: "ring-indigo-500/15",
|
|
@@ -2244,12 +2248,12 @@ var st = {
|
|
|
2244
2248
|
text: "text-violet-600/70 dark:text-violet-300/70"
|
|
2245
2249
|
}
|
|
2246
2250
|
];
|
|
2247
|
-
function
|
|
2251
|
+
function ct(e) {
|
|
2248
2252
|
let t = 5381;
|
|
2249
2253
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n);
|
|
2250
|
-
return
|
|
2254
|
+
return st[Math.abs(t) % st.length];
|
|
2251
2255
|
}
|
|
2252
|
-
var
|
|
2256
|
+
var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, hidden: a }) => {
|
|
2253
2257
|
let [o, s] = l(!1), c = !!e && !o;
|
|
2254
2258
|
return /* @__PURE__ */ I("div", {
|
|
2255
2259
|
className: E("w-full overflow-hidden relative", r),
|
|
@@ -2277,7 +2281,7 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2277
2281
|
})
|
|
2278
2282
|
})
|
|
2279
2283
|
});
|
|
2280
|
-
},
|
|
2284
|
+
}, lt = ({ imageUrl: e, title: t, placeholder: n }) => {
|
|
2281
2285
|
let [r, i] = l(!1), a = !!e && !r;
|
|
2282
2286
|
return /* @__PURE__ */ I("div", {
|
|
2283
2287
|
className: E("flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset", n.bg, n.ring),
|
|
@@ -2292,12 +2296,12 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2292
2296
|
children: t[0]?.toUpperCase()
|
|
2293
2297
|
})
|
|
2294
2298
|
});
|
|
2295
|
-
},
|
|
2296
|
-
let { schema: n } = e, i = o(
|
|
2299
|
+
}, ut = (e) => {
|
|
2300
|
+
let { schema: n } = e, i = o(Me), u = e.dataSource || i?.dataSource, p = Ne(n.bind), [m, h] = l([]), [g, _] = l(!1), [v, ee] = l(null), y = Fe({
|
|
2297
2301
|
navigation: n.navigation,
|
|
2298
2302
|
objectName: n.objectName,
|
|
2299
2303
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
2300
|
-
}), b = n.gallery, S = b?.coverField ?? n.imageField ?? "image", C = b?.coverFit ?? "cover", w = b?.cardSize ?? "medium", te = b?.titleField ?? n.titleField, T = b?.visibleFields, { fieldLabel:
|
|
2304
|
+
}), b = n.gallery, S = b?.coverField ?? n.imageField ?? "image", C = b?.coverFit ?? "cover", w = b?.cardSize ?? "medium", te = b?.titleField ?? n.titleField, T = b?.visibleFields, { fieldLabel: D, fieldOptionLabel: ne } = Ie(), re = a((e) => {
|
|
2301
2305
|
let t = v?.fields?.[e], r = { name: e };
|
|
2302
2306
|
if (t) {
|
|
2303
2307
|
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);
|
|
@@ -2306,21 +2310,21 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2306
2310
|
}
|
|
2307
2311
|
if (n.objectName) {
|
|
2308
2312
|
let t = String(r.label ?? e);
|
|
2309
|
-
r.label =
|
|
2313
|
+
r.label = D(n.objectName, e, t);
|
|
2310
2314
|
}
|
|
2311
2315
|
return n.objectName && Array.isArray(r.options) && (r.options = r.options.map((t) => {
|
|
2312
2316
|
let r = String(t?.value ?? t), i = String(t?.label ?? r);
|
|
2313
2317
|
return {
|
|
2314
2318
|
...t,
|
|
2315
2319
|
value: r,
|
|
2316
|
-
label:
|
|
2320
|
+
label: ne(n.objectName, e, r, i)
|
|
2317
2321
|
};
|
|
2318
2322
|
})), r;
|
|
2319
2323
|
}, [
|
|
2320
2324
|
v,
|
|
2321
2325
|
n.objectName,
|
|
2322
|
-
|
|
2323
|
-
|
|
2326
|
+
D,
|
|
2327
|
+
ne
|
|
2324
2328
|
]);
|
|
2325
2329
|
s(() => {
|
|
2326
2330
|
let e = !0;
|
|
@@ -2372,15 +2376,15 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2372
2376
|
e.data,
|
|
2373
2377
|
v
|
|
2374
2378
|
]);
|
|
2375
|
-
let
|
|
2376
|
-
|
|
2379
|
+
let O = e.data || p || n.data || m || [], ie = c(() => O.some((e) => typeof e[S] == "string" && !!e[S]), [O, S]), k = n.grouping?.fields, ae = !!(k && k.length > 0), [se, ce] = l({}), j = c(() => k ? k.some((e) => e.collapsed) : !1, [k]), M = a((e) => {
|
|
2380
|
+
ce((t) => ({
|
|
2377
2381
|
...t,
|
|
2378
|
-
[e]: t[e] === void 0 ? !
|
|
2382
|
+
[e]: t[e] === void 0 ? !j : !t[e]
|
|
2379
2383
|
}));
|
|
2380
|
-
}, [
|
|
2384
|
+
}, [j]), le = c(() => {
|
|
2381
2385
|
if (!ae || !k) return [];
|
|
2382
2386
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
2383
|
-
for (let n of
|
|
2387
|
+
for (let n of O) {
|
|
2384
2388
|
let r = k.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
2385
2389
|
if (!e.has(r)) {
|
|
2386
2390
|
let i = k.map((e) => {
|
|
@@ -2402,7 +2406,7 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2402
2406
|
});
|
|
2403
2407
|
return n === "desc" ? -r : r;
|
|
2404
2408
|
}), t.map((t) => {
|
|
2405
|
-
let n = e.get(t), r = t in
|
|
2409
|
+
let n = e.get(t), r = t in se ? se[t] : j;
|
|
2406
2410
|
return {
|
|
2407
2411
|
key: t,
|
|
2408
2412
|
label: n.label,
|
|
@@ -2411,17 +2415,17 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2411
2415
|
};
|
|
2412
2416
|
});
|
|
2413
2417
|
}, [
|
|
2414
|
-
|
|
2418
|
+
O,
|
|
2415
2419
|
k,
|
|
2416
2420
|
ae,
|
|
2417
|
-
|
|
2418
|
-
|
|
2421
|
+
se,
|
|
2422
|
+
j
|
|
2419
2423
|
]);
|
|
2420
|
-
if (g && !
|
|
2424
|
+
if (g && !O.length) return /* @__PURE__ */ I("div", {
|
|
2421
2425
|
className: "p-4 text-sm text-muted-foreground",
|
|
2422
2426
|
children: "Loading Gallery..."
|
|
2423
2427
|
});
|
|
2424
|
-
if (!
|
|
2428
|
+
if (!O.length) return /* @__PURE__ */ I("div", {
|
|
2425
2429
|
className: "p-4 text-sm text-muted-foreground",
|
|
2426
2430
|
children: "No items to display"
|
|
2427
2431
|
});
|
|
@@ -2430,7 +2434,7 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2430
2434
|
children: T.map((t) => {
|
|
2431
2435
|
let n = e[t];
|
|
2432
2436
|
if (n == null || n === "") return null;
|
|
2433
|
-
let r =
|
|
2437
|
+
let r = re(t), i = z(r) || r.type || "text", a = ze(i), o = r?.label && String(r.label).trim() ? String(r.label) : void 0, s = o != null && ot.has(i);
|
|
2434
2438
|
return /* @__PURE__ */ L("div", {
|
|
2435
2439
|
className: E("text-xs text-muted-foreground truncate [&_*]:!text-xs", s && "flex items-baseline gap-1.5"),
|
|
2436
2440
|
onClick: (e) => {
|
|
@@ -2446,8 +2450,8 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2446
2450
|
}, t);
|
|
2447
2451
|
})
|
|
2448
2452
|
}), ue = (t, i) => {
|
|
2449
|
-
let a = t.id ?? t._id ?? i, o = (te != null && t[te] != null && t[te] !== "" ? String(t[te]) : void 0) ?? r(v, t), s = t[S], c =
|
|
2450
|
-
return
|
|
2453
|
+
let a = t.id ?? t._id ?? i, o = (te != null && t[te] != null && t[te] !== "" ? String(t[te]) : void 0) ?? r(v, t), s = t[S], c = ct(String(a) + "|" + o), l = E("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");
|
|
2454
|
+
return ie && C === "contain" ? /* @__PURE__ */ L(d, {
|
|
2451
2455
|
role: "listitem",
|
|
2452
2456
|
className: l,
|
|
2453
2457
|
onClick: (e) => y.handleClick(t, e),
|
|
@@ -2458,7 +2462,7 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2458
2462
|
className: "p-4",
|
|
2459
2463
|
children: /* @__PURE__ */ L("div", {
|
|
2460
2464
|
className: "flex items-start gap-3",
|
|
2461
|
-
children: [/* @__PURE__ */ I(
|
|
2465
|
+
children: [/* @__PURE__ */ I(lt, {
|
|
2462
2466
|
imageUrl: s,
|
|
2463
2467
|
title: o,
|
|
2464
2468
|
placeholder: c
|
|
@@ -2477,20 +2481,20 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2477
2481
|
className: l,
|
|
2478
2482
|
onClick: (e) => y.handleClick(t, e),
|
|
2479
2483
|
children: [
|
|
2480
|
-
!
|
|
2484
|
+
!ie && /* @__PURE__ */ I("div", {
|
|
2481
2485
|
"aria-hidden": !0,
|
|
2482
2486
|
className: E("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", c.bg)
|
|
2483
2487
|
}),
|
|
2484
|
-
/* @__PURE__ */ I(
|
|
2488
|
+
/* @__PURE__ */ I(J, {
|
|
2485
2489
|
imageUrl: s,
|
|
2486
2490
|
title: o,
|
|
2487
2491
|
coverFit: C,
|
|
2488
|
-
aspectClass:
|
|
2492
|
+
aspectClass: at[w],
|
|
2489
2493
|
placeholder: c,
|
|
2490
|
-
hidden: !
|
|
2494
|
+
hidden: !ie
|
|
2491
2495
|
}),
|
|
2492
2496
|
/* @__PURE__ */ L(f, {
|
|
2493
|
-
className: E("p-3",
|
|
2497
|
+
className: E("p-3", ie && "border-t border-border/60"),
|
|
2494
2498
|
children: [/* @__PURE__ */ I("h3", {
|
|
2495
2499
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2496
2500
|
title: o,
|
|
@@ -2499,8 +2503,8 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2499
2503
|
})
|
|
2500
2504
|
]
|
|
2501
2505
|
}, a);
|
|
2502
|
-
},
|
|
2503
|
-
className: E("grid gap-4 p-4 auto-rows-min content-start",
|
|
2506
|
+
}, de = (e) => /* @__PURE__ */ I("div", {
|
|
2507
|
+
className: E("grid gap-4 p-4 auto-rows-min content-start", it[w], n.className),
|
|
2504
2508
|
role: "list",
|
|
2505
2509
|
children: e.map((e, t) => ue(e, t))
|
|
2506
2510
|
});
|
|
@@ -2511,18 +2515,18 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2511
2515
|
children: [/* @__PURE__ */ L("button", {
|
|
2512
2516
|
type: "button",
|
|
2513
2517
|
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",
|
|
2514
|
-
onClick: () =>
|
|
2518
|
+
onClick: () => M(e.key),
|
|
2515
2519
|
children: [
|
|
2516
|
-
e.collapsed ? /* @__PURE__ */ I(
|
|
2520
|
+
e.collapsed ? /* @__PURE__ */ I(oe, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ I(A, { className: "h-4 w-4 shrink-0" }),
|
|
2517
2521
|
/* @__PURE__ */ I("span", { children: e.label }),
|
|
2518
2522
|
/* @__PURE__ */ I("span", {
|
|
2519
2523
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2520
2524
|
children: e.items.length
|
|
2521
2525
|
})
|
|
2522
2526
|
]
|
|
2523
|
-
}), !e.collapsed &&
|
|
2527
|
+
}), !e.collapsed && de(e.items)]
|
|
2524
2528
|
}, e.key))
|
|
2525
|
-
}) :
|
|
2529
|
+
}) : de(O), y.isOverlay && /* @__PURE__ */ I(x, {
|
|
2526
2530
|
...y,
|
|
2527
2531
|
title: "Gallery Item",
|
|
2528
2532
|
children: (e) => /* @__PURE__ */ I("div", {
|
|
@@ -2540,21 +2544,21 @@ var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2540
2544
|
})
|
|
2541
2545
|
})] });
|
|
2542
2546
|
};
|
|
2543
|
-
e.register("object-gallery",
|
|
2547
|
+
e.register("object-gallery", ut, {
|
|
2544
2548
|
namespace: "plugin-list",
|
|
2545
2549
|
label: "Gallery View",
|
|
2546
2550
|
category: "view"
|
|
2547
2551
|
});
|
|
2548
2552
|
//#endregion
|
|
2549
2553
|
//#region src/components/TabBar.tsx
|
|
2550
|
-
function
|
|
2554
|
+
function dt(e) {
|
|
2551
2555
|
return e ? De[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
2552
2556
|
}
|
|
2553
|
-
function
|
|
2557
|
+
function ft(e) {
|
|
2554
2558
|
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
2555
2559
|
}
|
|
2556
|
-
var
|
|
2557
|
-
let a = i.useMemo(() =>
|
|
2560
|
+
var pt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
2561
|
+
let a = i.useMemo(() => ft(e), [e]), o = i.useMemo(() => a.find((e) => e.isDefault)?.name ?? a[0]?.name, [a]), [s, c] = i.useState(o), l = t ?? s, d = i.useCallback((e) => {
|
|
2558
2562
|
c(e.name), n?.(e);
|
|
2559
2563
|
}, [n]);
|
|
2560
2564
|
return a.length === 0 ? null : /* @__PURE__ */ I("div", {
|
|
@@ -2562,7 +2566,7 @@ var mt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
2562
2566
|
"data-testid": "view-tabs",
|
|
2563
2567
|
role: "tablist",
|
|
2564
2568
|
children: a.map((e) => {
|
|
2565
|
-
let t =
|
|
2569
|
+
let t = dt(e.icon), n = l === e.name;
|
|
2566
2570
|
return /* @__PURE__ */ L(u, {
|
|
2567
2571
|
variant: "ghost",
|
|
2568
2572
|
size: "sm",
|
|
@@ -2575,12 +2579,12 @@ var mt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
2575
2579
|
}, e.name);
|
|
2576
2580
|
})
|
|
2577
2581
|
});
|
|
2578
|
-
},
|
|
2579
|
-
let a = i.useMemo(() =>
|
|
2582
|
+
}, Y = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
2583
|
+
let a = i.useMemo(() => ft(e), [e]), o = i.useMemo(() => a.find((e) => e.isDefault)?.name ?? a[0]?.name, [a]), [s, c] = i.useState(o), l = t ?? s, d = i.useMemo(() => a.find((e) => e.name === l) ?? a[0], [a, l]), f = i.useCallback((e) => {
|
|
2580
2584
|
c(e.name), n?.(e);
|
|
2581
2585
|
}, [n]);
|
|
2582
2586
|
if (a.length === 0) return null;
|
|
2583
|
-
let p =
|
|
2587
|
+
let p = dt(d?.icon);
|
|
2584
2588
|
return /* @__PURE__ */ I("div", {
|
|
2585
2589
|
className: E("px-2 py-1", r),
|
|
2586
2590
|
"data-testid": "view-tabs-select",
|
|
@@ -2604,7 +2608,7 @@ var mt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
2604
2608
|
align: "start",
|
|
2605
2609
|
className: "w-56 max-h-72 overflow-y-auto",
|
|
2606
2610
|
children: a.map((e) => {
|
|
2607
|
-
let t =
|
|
2611
|
+
let t = dt(e.icon);
|
|
2608
2612
|
return /* @__PURE__ */ L(g, {
|
|
2609
2613
|
onClick: () => f(e),
|
|
2610
2614
|
className: E("text-sm", l === e.name && "font-medium bg-muted"),
|
|
@@ -2618,7 +2622,7 @@ var mt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
2618
2622
|
})] })
|
|
2619
2623
|
});
|
|
2620
2624
|
};
|
|
2621
|
-
e.register("list-view",
|
|
2625
|
+
e.register("list-view", rt, {
|
|
2622
2626
|
namespace: "plugin-list",
|
|
2623
2627
|
label: "List View",
|
|
2624
2628
|
category: "Views",
|
|
@@ -2695,7 +2699,7 @@ e.register("list-view", ot, {
|
|
|
2695
2699
|
sort: [],
|
|
2696
2700
|
options: {}
|
|
2697
2701
|
}
|
|
2698
|
-
}), e.register("list",
|
|
2702
|
+
}), e.register("list", rt, {
|
|
2699
2703
|
namespace: "view",
|
|
2700
2704
|
skipFallback: !0,
|
|
2701
2705
|
category: "view",
|
|
@@ -2767,4 +2771,4 @@ e.register("list-view", ot, {
|
|
|
2767
2771
|
]
|
|
2768
2772
|
});
|
|
2769
2773
|
//#endregion
|
|
2770
|
-
export {
|
|
2774
|
+
export { rt as ListView, ut as ObjectGallery, pt as TabBar, Y as TabBarSelect, Ge as UserFilters, Ve as ViewSwitcher, Be as ViewSwitcherDropdown, q as evaluateConditionalFormatting, K as normalizeFilterCondition, Xe as normalizeFilters };
|