@object-ui/plugin-list 13.1.0 → 14.0.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 +35 -0
- package/dist/ListView.d.ts.map +1 -1
- package/dist/index.js +586 -567
- package/dist/index.umd.cjs +2 -2
- package/package.json +18 -18
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { ComponentRegistry as e, buildExpandFields as t,
|
|
2
|
-
import * as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Activity as D, AlertTriangle as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { useObjectLabel as
|
|
8
|
-
import { SchemaRenderer as
|
|
9
|
-
import { usePullToRefresh as
|
|
10
|
-
import { usePermissions as
|
|
11
|
-
import { getCellRenderer as
|
|
1
|
+
import { ComponentRegistry as e, buildExpandFields as t, buildExportFileName as n, evaluatePlainCondition as r, getRecordDisplayName as i } from "@object-ui/core";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { useCallback as o, useContext as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
4
|
+
import { Button as d, Card as f, CardContent as p, DataEmptyState as m, DropdownMenu as h, DropdownMenuContent as g, DropdownMenuItem as _, DropdownMenuTrigger as v, FilterBuilder as ee, GroupingEditor as y, Input as b, LookupValuePicker as x, NavigationOverlay as te, Popover as S, PopoverContent as C, PopoverTrigger as w, RefreshIndicator as T, SortBuilder as ne, cn as E } from "@object-ui/components";
|
|
5
|
+
import { Activity as D, AlertTriangle as re, ArrowUpDown as O, BarChart3 as ie, Calendar as k, Check as A, CheckSquare as ae, ChevronDown as j, ChevronRight as oe, Download as se, EyeOff as ce, GanttChartSquare as le, Grid as ue, Group as de, Images as M, Inbox as fe, LayoutGrid as N, ListTree as pe, Loader2 as me, Map as P, Paintbrush as he, Pencil as ge, Plus as _e, Printer as ve, RotateCw as ye, Rows2 as be, Rows3 as xe, Rows4 as Se, Search as Ce, Settings2 as F, Share2 as we, SlidersHorizontal as Te, Trash2 as Ee, X as De, icons as Oe } from "lucide-react";
|
|
6
|
+
import { Fragment as ke, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
7
|
+
import { useObjectLabel as Ae, useObjectTranslation as R, useSafeFieldLabel as je } from "@object-ui/i18n";
|
|
8
|
+
import { SchemaRenderer as Me, SchemaRendererContext as Ne, useDataScope as Pe, useDensityMode as Fe, useNavigationOverlay as Ie, useSafeFieldLabel as Le } from "@object-ui/react";
|
|
9
|
+
import { usePullToRefresh as Re } from "@object-ui/mobile";
|
|
10
|
+
import { usePermissions as ze } from "@object-ui/permissions";
|
|
11
|
+
import { getCellRenderer as Be, resolveCellRendererType as Ve } from "@object-ui/fields";
|
|
12
12
|
//#region src/ViewSwitcher.tsx
|
|
13
|
-
var
|
|
14
|
-
grid: /* @__PURE__ */ I(
|
|
15
|
-
kanban: /* @__PURE__ */ I(
|
|
16
|
-
gallery: /* @__PURE__ */ I(
|
|
17
|
-
calendar: /* @__PURE__ */ I(
|
|
13
|
+
var z = {
|
|
14
|
+
grid: /* @__PURE__ */ I(ue, { className: "h-4 w-4" }),
|
|
15
|
+
kanban: /* @__PURE__ */ I(N, { className: "h-4 w-4" }),
|
|
16
|
+
gallery: /* @__PURE__ */ I(M, { className: "h-4 w-4" }),
|
|
17
|
+
calendar: /* @__PURE__ */ I(k, { className: "h-4 w-4" }),
|
|
18
18
|
timeline: /* @__PURE__ */ I(D, { className: "h-4 w-4" }),
|
|
19
|
-
gantt: /* @__PURE__ */ I(
|
|
20
|
-
map: /* @__PURE__ */ I(
|
|
21
|
-
chart: /* @__PURE__ */ I(
|
|
22
|
-
tree: /* @__PURE__ */ I(
|
|
23
|
-
},
|
|
19
|
+
gantt: /* @__PURE__ */ I(le, { className: "h-4 w-4" }),
|
|
20
|
+
map: /* @__PURE__ */ I(P, { className: "h-4 w-4" }),
|
|
21
|
+
chart: /* @__PURE__ */ I(ie, { className: "h-4 w-4" }),
|
|
22
|
+
tree: /* @__PURE__ */ I(pe, { className: "h-4 w-4" })
|
|
23
|
+
}, B = {
|
|
24
24
|
grid: "Grid",
|
|
25
25
|
kanban: "Kanban",
|
|
26
26
|
gallery: "Gallery",
|
|
@@ -30,11 +30,11 @@ var B = {
|
|
|
30
30
|
map: "Map",
|
|
31
31
|
chart: "Chart",
|
|
32
32
|
tree: "Tree"
|
|
33
|
-
},
|
|
34
|
-
let [o, s] =
|
|
35
|
-
s(!1), t !== e && (
|
|
33
|
+
}, He = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
|
|
34
|
+
let [o, s] = a.useState(!1), c = a.useCallback((t) => {
|
|
35
|
+
s(!1), t !== e && (i && typeof document < "u" && "startViewTransition" in document ? document.startViewTransition(() => n(t)) : n(t));
|
|
36
36
|
}, [
|
|
37
|
-
|
|
37
|
+
i,
|
|
38
38
|
e,
|
|
39
39
|
n
|
|
40
40
|
]);
|
|
@@ -48,14 +48,14 @@ var B = {
|
|
|
48
48
|
type: "button",
|
|
49
49
|
role: "tab",
|
|
50
50
|
"aria-selected": n,
|
|
51
|
-
"aria-label":
|
|
52
|
-
title:
|
|
51
|
+
"aria-label": B[t],
|
|
52
|
+
title: B[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: [z[t], /* @__PURE__ */ I("span", {
|
|
57
57
|
className: "hidden sm:inline-block",
|
|
58
|
-
children:
|
|
58
|
+
children: B[t]
|
|
59
59
|
})]
|
|
60
60
|
}, t);
|
|
61
61
|
})
|
|
@@ -67,15 +67,15 @@ var B = {
|
|
|
67
67
|
children: /* @__PURE__ */ L("button", {
|
|
68
68
|
type: "button",
|
|
69
69
|
"data-testid": "view-switcher-dropdown",
|
|
70
|
-
"aria-label":
|
|
70
|
+
"aria-label": B[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
|
+
z[e],
|
|
74
74
|
/* @__PURE__ */ I("span", {
|
|
75
75
|
className: "hidden sm:inline-block",
|
|
76
|
-
children:
|
|
76
|
+
children: B[e]
|
|
77
77
|
}),
|
|
78
|
-
/* @__PURE__ */ I(
|
|
78
|
+
/* @__PURE__ */ I(j, { className: "h-3 w-3 opacity-60" })
|
|
79
79
|
]
|
|
80
80
|
})
|
|
81
81
|
}), /* @__PURE__ */ I(C, {
|
|
@@ -87,25 +87,25 @@ var B = {
|
|
|
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
|
+
z[t],
|
|
91
91
|
/* @__PURE__ */ I("span", {
|
|
92
92
|
className: "flex-1 text-left",
|
|
93
|
-
children:
|
|
93
|
+
children: B[t]
|
|
94
94
|
}),
|
|
95
|
-
t === e && /* @__PURE__ */ I(
|
|
95
|
+
t === e && /* @__PURE__ */ I(A, { className: "h-3.5 w-3.5" })
|
|
96
96
|
]
|
|
97
97
|
}, t))
|
|
98
98
|
})]
|
|
99
99
|
});
|
|
100
|
-
},
|
|
101
|
-
let o =
|
|
102
|
-
if (!
|
|
100
|
+
}, Ue = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
|
|
101
|
+
let o = a.useCallback((t) => {
|
|
102
|
+
if (!i || t === e) {
|
|
103
103
|
n(t);
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
typeof document < "u" && "startViewTransition" in document ? document.startViewTransition(() => n(t)) : n(t);
|
|
107
107
|
}, [
|
|
108
|
-
|
|
108
|
+
i,
|
|
109
109
|
e,
|
|
110
110
|
n
|
|
111
111
|
]);
|
|
@@ -116,14 +116,14 @@ var B = {
|
|
|
116
116
|
return /* @__PURE__ */ L("button", {
|
|
117
117
|
type: "button",
|
|
118
118
|
onClick: () => o(t),
|
|
119
|
-
"aria-label":
|
|
120
|
-
title:
|
|
119
|
+
"aria-label": B[t],
|
|
120
|
+
title: B[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: [z[t], /* @__PURE__ */ I("span", {
|
|
125
125
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
126
|
-
children:
|
|
126
|
+
children: B[t]
|
|
127
127
|
})]
|
|
128
128
|
}, t);
|
|
129
129
|
})
|
|
@@ -131,8 +131,8 @@ var B = {
|
|
|
131
131
|
};
|
|
132
132
|
//#endregion
|
|
133
133
|
//#region src/components/ViewSettingsPopover.tsx
|
|
134
|
-
function
|
|
135
|
-
let [s, c] =
|
|
134
|
+
function We({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: i = !0, children: o }) {
|
|
135
|
+
let [s, c] = a.useState(i);
|
|
136
136
|
return /* @__PURE__ */ L("div", {
|
|
137
137
|
className: "border-b last:border-b-0",
|
|
138
138
|
children: [/* @__PURE__ */ L("div", {
|
|
@@ -142,7 +142,7 @@ function He({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: a = !0
|
|
|
142
142
|
onClick: () => c((e) => !e),
|
|
143
143
|
className: "flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground",
|
|
144
144
|
children: [
|
|
145
|
-
/* @__PURE__ */ I(
|
|
145
|
+
/* @__PURE__ */ I(j, { className: E("h-3.5 w-3.5 transition-transform", !s && "-rotate-90") }),
|
|
146
146
|
e,
|
|
147
147
|
typeof t == "number" && t > 0 && /* @__PURE__ */ I("span", {
|
|
148
148
|
className: "ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 px-1 text-[10px] text-primary tabular-nums",
|
|
@@ -161,20 +161,20 @@ function He({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: a = !0
|
|
|
161
161
|
})]
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
let { t, allFields: n, showGroup: r, groupingConfig:
|
|
166
|
-
!!
|
|
164
|
+
function Ge(e) {
|
|
165
|
+
let { t, allFields: n, showGroup: r, groupingConfig: i, setGroupingConfig: o, showColor: s, rowColorConfig: c, setRowColorConfig: l, showDensity: u, density: f, showHideFields: p, hiddenFields: m, updateHiddenFields: h, showInlineEdit: g, inlineEdit: _, setInlineEdit: v } = e, [ee, b] = a.useState(!1), x = [
|
|
166
|
+
!!i?.fields?.length,
|
|
167
167
|
!!c?.field,
|
|
168
168
|
f && f.mode !== "compact",
|
|
169
169
|
(m?.size ?? 0) > 0,
|
|
170
170
|
!!_
|
|
171
|
-
].filter(Boolean).length, te = f?.mode === "compact" ?
|
|
171
|
+
].filter(Boolean).length, te = f?.mode === "compact" ? Se : f?.mode === "comfortable" ? xe : be, T = t("list.viewSettings", { defaultValue: "View settings" });
|
|
172
172
|
return /* @__PURE__ */ L(S, {
|
|
173
|
-
open:
|
|
173
|
+
open: ee,
|
|
174
174
|
onOpenChange: b,
|
|
175
175
|
children: [/* @__PURE__ */ I(w, {
|
|
176
176
|
asChild: !0,
|
|
177
|
-
children: /* @__PURE__ */ L(
|
|
177
|
+
children: /* @__PURE__ */ L(d, {
|
|
178
178
|
variant: "ghost",
|
|
179
179
|
size: "sm",
|
|
180
180
|
"aria-label": T,
|
|
@@ -182,7 +182,7 @@ function Ue(e) {
|
|
|
182
182
|
className: E("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", x > 0 && "text-foreground font-medium"),
|
|
183
183
|
"data-testid": "view-settings-trigger",
|
|
184
184
|
children: [
|
|
185
|
-
/* @__PURE__ */ I(
|
|
185
|
+
/* @__PURE__ */ I(F, { className: "h-3.5 w-3.5 sm:mr-1.5" }),
|
|
186
186
|
/* @__PURE__ */ I("span", {
|
|
187
187
|
className: "hidden sm:inline",
|
|
188
188
|
children: T
|
|
@@ -208,13 +208,13 @@ function Ue(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(We, {
|
|
212
212
|
title: t("list.group", { defaultValue: "Group" }),
|
|
213
|
-
badge:
|
|
214
|
-
onClear:
|
|
213
|
+
badge: i?.fields?.length || 0,
|
|
214
|
+
onClear: i ? () => o(void 0) : void 0,
|
|
215
215
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
216
|
-
children: /* @__PURE__ */ I(
|
|
217
|
-
value:
|
|
216
|
+
children: /* @__PURE__ */ I(y, {
|
|
217
|
+
value: i,
|
|
218
218
|
fieldOptions: n.map((e) => ({
|
|
219
219
|
value: e.name,
|
|
220
220
|
label: e.label || e.name
|
|
@@ -228,7 +228,7 @@ function Ue(e) {
|
|
|
228
228
|
onChange: (e) => o(e)
|
|
229
229
|
})
|
|
230
230
|
}),
|
|
231
|
-
s && l && /* @__PURE__ */ L(
|
|
231
|
+
s && l && /* @__PURE__ */ L(We, {
|
|
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,12 +256,12 @@ function Ue(e) {
|
|
|
256
256
|
}, e.name))]
|
|
257
257
|
})]
|
|
258
258
|
}),
|
|
259
|
-
|
|
259
|
+
u && f && /* @__PURE__ */ I(We, {
|
|
260
260
|
title: t("grid.toolbar.densityMode", { defaultValue: "Density" }),
|
|
261
261
|
defaultOpen: f.mode !== "compact",
|
|
262
262
|
children: /* @__PURE__ */ L("div", {
|
|
263
263
|
className: "flex items-center gap-2",
|
|
264
|
-
children: [/* @__PURE__ */ L(
|
|
264
|
+
children: [/* @__PURE__ */ L(d, {
|
|
265
265
|
variant: "outline",
|
|
266
266
|
size: "sm",
|
|
267
267
|
className: "h-7 gap-1.5",
|
|
@@ -277,7 +277,7 @@ function Ue(e) {
|
|
|
277
277
|
})]
|
|
278
278
|
})
|
|
279
279
|
}),
|
|
280
|
-
g && v && /* @__PURE__ */ I(
|
|
280
|
+
g && v && /* @__PURE__ */ I(We, {
|
|
281
281
|
title: t("list.recordEditingTitle", { defaultValue: "Record editing" }),
|
|
282
282
|
defaultOpen: !!_,
|
|
283
283
|
children: /* @__PURE__ */ L("label", {
|
|
@@ -291,7 +291,7 @@ function Ue(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(We, {
|
|
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 Ue(e) {
|
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/UserFilters.tsx
|
|
325
|
-
function
|
|
325
|
+
function Ke() {
|
|
326
326
|
try {
|
|
327
|
-
let { t: e } =
|
|
327
|
+
let { t: e } = R(), 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 V = /* @__PURE__ */ new Set([
|
|
334
334
|
"lookup",
|
|
335
335
|
"master_detail",
|
|
336
336
|
"user",
|
|
337
337
|
"owner"
|
|
338
338
|
]);
|
|
339
|
-
function
|
|
339
|
+
function qe(e) {
|
|
340
340
|
switch (e) {
|
|
341
341
|
case void 0:
|
|
342
342
|
case "equals":
|
|
@@ -353,21 +353,21 @@ function U(e) {
|
|
|
353
353
|
default: return e;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function H(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
|
+
qe(e.operator),
|
|
363
363
|
e.value
|
|
364
364
|
]) : [],
|
|
365
365
|
default: e.default ?? e.isDefault
|
|
366
366
|
}));
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function Je({ 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(Ye, {
|
|
371
371
|
fields: e.fields || [],
|
|
372
372
|
objectDef: t,
|
|
373
373
|
data: n,
|
|
@@ -377,8 +377,8 @@ function Ge({ 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(Xe, {
|
|
381
|
+
tabs: H(e.tabs || []),
|
|
382
382
|
showAllRecords: e.showAllRecords !== !1,
|
|
383
383
|
allowAddTab: e.allowAddTab,
|
|
384
384
|
onFilterChange: r,
|
|
@@ -389,7 +389,7 @@ function Ge({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
389
389
|
default: return null;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function U(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 Ke(e, t, n, r) {
|
|
|
426
426
|
};
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
let { fieldLabel: l, translateOptions: u } =
|
|
429
|
+
function Ye({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i, className: o, initialSelections: s, onSelectionsChange: c }) {
|
|
430
|
+
let { fieldLabel: l, translateOptions: u } = je(), d = Ke(), f = t?.name, [p, m] = a.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 =
|
|
437
|
+
}), h = a.useRef({}), g = a.useMemo(() => U(e, t, n, {
|
|
438
438
|
objectName: f,
|
|
439
439
|
fieldLabel: l,
|
|
440
440
|
translateOptions: u
|
|
@@ -457,7 +457,7 @@ function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a
|
|
|
457
457
|
l,
|
|
458
458
|
u,
|
|
459
459
|
p
|
|
460
|
-
]), _ =
|
|
460
|
+
]), _ = a.useCallback((e) => {
|
|
461
461
|
r(Object.entries(e).filter(([, e]) => e.length > 0).map(([e, t]) => [
|
|
462
462
|
e,
|
|
463
463
|
"in",
|
|
@@ -470,7 +470,7 @@ function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a
|
|
|
470
470
|
};
|
|
471
471
|
m(n), _(n), c?.(n);
|
|
472
472
|
};
|
|
473
|
-
|
|
473
|
+
a.useEffect(() => {
|
|
474
474
|
let e = p, t = {}, n = !1;
|
|
475
475
|
for (let [r, i] of Object.entries(e)) {
|
|
476
476
|
let e = g.find((e) => e.field === r), a = i.map((t) => {
|
|
@@ -482,8 +482,8 @@ function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a
|
|
|
482
482
|
}
|
|
483
483
|
n && (m(t), e = t), Object.values(e).some((e) => e.length > 0) && _(e);
|
|
484
484
|
}, []);
|
|
485
|
-
let ee =
|
|
486
|
-
let t = p[e.field] || [], n = t.length > 0, r =
|
|
485
|
+
let ee = i !== void 0 && i < g.length ? g.slice(0, i) : g, y = i !== void 0 && i < g.length ? g.slice(i) : [], b = (e) => {
|
|
486
|
+
let t = p[e.field] || [], n = t.length > 0, r = V.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", {
|
|
@@ -498,13 +498,13 @@ function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a
|
|
|
498
498
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
499
499
|
children: t.length
|
|
500
500
|
}),
|
|
501
|
-
n ? /* @__PURE__ */ I(
|
|
501
|
+
n ? /* @__PURE__ */ I(De, {
|
|
502
502
|
className: "h-3 w-3 opacity-60 hover:opacity-100",
|
|
503
503
|
"data-testid": `filter-clear-${e.field}`,
|
|
504
504
|
onClick: (t) => {
|
|
505
505
|
t.stopPropagation(), v(e.field, []);
|
|
506
506
|
}
|
|
507
|
-
}) : /* @__PURE__ */ I(
|
|
507
|
+
}) : /* @__PURE__ */ I(j, { className: "h-3 w-3 opacity-60" })
|
|
508
508
|
]
|
|
509
509
|
})
|
|
510
510
|
}), /* @__PURE__ */ I(C, {
|
|
@@ -512,7 +512,7 @@ function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a
|
|
|
512
512
|
className: E(i, "p-2"),
|
|
513
513
|
children: r ? /* @__PURE__ */ I("div", {
|
|
514
514
|
"data-testid": `filter-lookup-${e.field}`,
|
|
515
|
-
children: /* @__PURE__ */ I(
|
|
515
|
+
children: /* @__PURE__ */ I(x, {
|
|
516
516
|
field: {
|
|
517
517
|
value: e.field,
|
|
518
518
|
label: e.label || e.field,
|
|
@@ -570,7 +570,7 @@ function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a
|
|
|
570
570
|
className: "text-xs text-muted-foreground",
|
|
571
571
|
"data-testid": "user-filters-empty",
|
|
572
572
|
children: "No filter fields"
|
|
573
|
-
}) : /* @__PURE__ */ L(
|
|
573
|
+
}) : /* @__PURE__ */ L(ke, { children: [ee.map(b), y.length > 0 && /* @__PURE__ */ L(S, { children: [/* @__PURE__ */ I(w, {
|
|
574
574
|
asChild: !0,
|
|
575
575
|
children: /* @__PURE__ */ L("button", {
|
|
576
576
|
"data-testid": "user-filters-more",
|
|
@@ -581,7 +581,7 @@ function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a
|
|
|
581
581
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
582
582
|
children: y.length
|
|
583
583
|
}),
|
|
584
|
-
/* @__PURE__ */ I(
|
|
584
|
+
/* @__PURE__ */ I(j, { className: "h-3 w-3 opacity-60" })
|
|
585
585
|
]
|
|
586
586
|
})
|
|
587
587
|
}), /* @__PURE__ */ I(C, {
|
|
@@ -590,19 +590,19 @@ function qe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: a
|
|
|
590
590
|
"data-testid": "user-filters-more-content",
|
|
591
591
|
children: /* @__PURE__ */ I("div", {
|
|
592
592
|
className: "space-y-1",
|
|
593
|
-
children: y.map(
|
|
593
|
+
children: y.map(b)
|
|
594
594
|
})
|
|
595
595
|
})] })] })
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
|
-
function
|
|
599
|
-
let [c, l] =
|
|
598
|
+
function Xe({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: i, initialTab: o, onSelectionsChange: s }) {
|
|
599
|
+
let [c, l] = a.useState(() => o && (o === "__all__" || e.some((e) => e.id === o)) ? o : e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), u = a.useCallback((t) => {
|
|
600
600
|
l(t), r(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []), s?.({ _tab: [t] });
|
|
601
601
|
}, [
|
|
602
602
|
e,
|
|
603
603
|
r,
|
|
604
604
|
s
|
|
605
|
-
]), d =
|
|
605
|
+
]), d = a.useMemo(() => {
|
|
606
606
|
let n = [...e];
|
|
607
607
|
return t && n.push({
|
|
608
608
|
id: "__all__",
|
|
@@ -610,13 +610,13 @@ function Je({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
|
|
|
610
610
|
filters: []
|
|
611
611
|
}), n;
|
|
612
612
|
}, [e, t]);
|
|
613
|
-
return
|
|
613
|
+
return a.useEffect(() => {
|
|
614
614
|
if (c && c !== "__all__") {
|
|
615
615
|
let t = e.find((e) => e.id === c);
|
|
616
616
|
t && r(t.filters || []);
|
|
617
617
|
}
|
|
618
618
|
}, []), /* @__PURE__ */ L("div", {
|
|
619
|
-
className: E("flex items-center gap-0.5 overflow-x-auto",
|
|
619
|
+
className: E("flex items-center gap-0.5 overflow-x-auto", i),
|
|
620
620
|
"data-testid": "user-filters-tabs",
|
|
621
621
|
children: [d.map((e) => {
|
|
622
622
|
let t = e.id ?? e.name ?? "";
|
|
@@ -630,13 +630,13 @@ function Je({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
|
|
|
630
630
|
className: "inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",
|
|
631
631
|
"data-testid": "filter-tab-add",
|
|
632
632
|
title: "Add filter tab",
|
|
633
|
-
children: /* @__PURE__ */ I(
|
|
633
|
+
children: /* @__PURE__ */ I(_e, { className: "h-3.5 w-3.5" })
|
|
634
634
|
})]
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
//#endregion
|
|
638
638
|
//#region src/ListView.tsx
|
|
639
|
-
function
|
|
639
|
+
function Ze(e) {
|
|
640
640
|
switch (e) {
|
|
641
641
|
case "equals":
|
|
642
642
|
case "eq": return "=";
|
|
@@ -664,10 +664,10 @@ function G(e) {
|
|
|
664
664
|
default: return e;
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function W(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) ? W(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,15 @@ function K(e) {
|
|
|
685
685
|
e
|
|
686
686
|
])] : e;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function Qe(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 $e(e) {
|
|
692
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? W(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function et(e) {
|
|
695
695
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
696
|
-
let t =
|
|
696
|
+
let t = $e(e.conditions.filter((e) => {
|
|
697
697
|
if (e.operator === "isEmpty" || e.operator === "isNotEmpty") return !0;
|
|
698
698
|
let t = e.value;
|
|
699
699
|
return !(t == null || t === "" || Array.isArray(t) && t.length === 0);
|
|
@@ -707,47 +707,47 @@ function Ze(e) {
|
|
|
707
707
|
null
|
|
708
708
|
] : [
|
|
709
709
|
e.field,
|
|
710
|
-
|
|
710
|
+
Ze(e.operator),
|
|
711
711
|
e.value
|
|
712
712
|
]));
|
|
713
713
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function tt(e, t) {
|
|
716
716
|
if (!t || t.length === 0) return {};
|
|
717
|
-
for (let
|
|
718
|
-
let t = !1, i = ("condition" in
|
|
719
|
-
if (i) t =
|
|
720
|
-
else if ("field" in
|
|
721
|
-
let
|
|
722
|
-
switch (
|
|
717
|
+
for (let n of t) {
|
|
718
|
+
let t = !1, i = ("condition" in n ? n.condition : void 0) || ("expression" in n ? n.expression : void 0) || void 0;
|
|
719
|
+
if (i) t = r(i, e);
|
|
720
|
+
else if ("field" in n && "operator" in n && n.field && n.operator) {
|
|
721
|
+
let r = e[n.field];
|
|
722
|
+
switch (n.operator) {
|
|
723
723
|
case "equals":
|
|
724
|
-
t =
|
|
724
|
+
t = r === n.value;
|
|
725
725
|
break;
|
|
726
726
|
case "not_equals":
|
|
727
|
-
t =
|
|
727
|
+
t = r !== n.value;
|
|
728
728
|
break;
|
|
729
729
|
case "contains":
|
|
730
|
-
t = typeof
|
|
730
|
+
t = typeof r == "string" && typeof n.value == "string" && r.includes(n.value);
|
|
731
731
|
break;
|
|
732
732
|
case "greater_than":
|
|
733
|
-
t = typeof
|
|
733
|
+
t = typeof r == "number" && typeof n.value == "number" && r > n.value;
|
|
734
734
|
break;
|
|
735
735
|
case "less_than":
|
|
736
|
-
t = typeof
|
|
736
|
+
t = typeof r == "number" && typeof n.value == "number" && r < n.value;
|
|
737
737
|
break;
|
|
738
738
|
case "in":
|
|
739
|
-
t = Array.isArray(
|
|
739
|
+
t = Array.isArray(n.value) && n.value.includes(r);
|
|
740
740
|
break;
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
743
|
if (t) {
|
|
744
744
|
let e = {};
|
|
745
|
-
return "style" in
|
|
745
|
+
return "style" in n && n.style && Object.assign(e, n.style), "backgroundColor" in n && n.backgroundColor && (e.backgroundColor = n.backgroundColor), "textColor" in n && n.textColor && (e.color = n.textColor), "borderColor" in n && n.borderColor && (e.borderColor = n.borderColor), e;
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
return {};
|
|
749
749
|
}
|
|
750
|
-
var
|
|
750
|
+
var G = {
|
|
751
751
|
"list.recordCount": "{{count}} records",
|
|
752
752
|
"list.recordCountOne": "{{count}} record",
|
|
753
753
|
"list.noItems": "No items found",
|
|
@@ -794,41 +794,43 @@ var Qe = {
|
|
|
794
794
|
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
795
795
|
"list.viewSettings": "View settings",
|
|
796
796
|
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
797
|
-
},
|
|
798
|
-
let n =
|
|
797
|
+
}, nt = (e, t, n) => n, rt = (e, t) => {
|
|
798
|
+
let n = G[e] || e;
|
|
799
799
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
800
800
|
return n;
|
|
801
801
|
};
|
|
802
|
-
function
|
|
802
|
+
function it() {
|
|
803
803
|
try {
|
|
804
|
-
let e =
|
|
805
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t:
|
|
804
|
+
let e = R();
|
|
805
|
+
return e.t("list.recordCount") === "list.recordCount" ? { t: rt } : { t: e.t };
|
|
806
806
|
} catch {
|
|
807
|
-
return { t:
|
|
807
|
+
return { t: rt };
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
|
-
function
|
|
810
|
+
function at() {
|
|
811
811
|
try {
|
|
812
|
-
let { fieldLabel: e, actionLabel: t } =
|
|
812
|
+
let { fieldLabel: e, actionLabel: t, objectLabel: n } = Ae();
|
|
813
813
|
return {
|
|
814
814
|
fieldLabel: e,
|
|
815
|
-
actionLabel: t
|
|
815
|
+
actionLabel: t,
|
|
816
|
+
objectLabel: n
|
|
816
817
|
};
|
|
817
818
|
} catch {
|
|
818
819
|
return {
|
|
819
|
-
fieldLabel:
|
|
820
|
-
actionLabel: void 0
|
|
820
|
+
fieldLabel: nt,
|
|
821
|
+
actionLabel: void 0,
|
|
822
|
+
objectLabel: void 0
|
|
821
823
|
};
|
|
822
824
|
}
|
|
823
825
|
}
|
|
824
|
-
var
|
|
825
|
-
let
|
|
826
|
+
var K = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChange: o, onSortChange: s, onSearchChange: c, onHiddenFieldsChange: l, onInlineEditChange: u, onColumnStateChange: f, onRowClick: p, showViewSwitcher: h, userFilterSelections: g, onUserFilterSelectionsChange: _, initialFilters: v, initialSearchTerm: x, ...D }, ie) => {
|
|
827
|
+
let k = h ?? e?.showViewSwitcher ?? !1, { t: A } = it(), { fieldLabel: j, actionLabel: oe, objectLabel: le } = at(), { translateOptions: ue } = je(), M = a.useMemo(() => e.viewType && e.viewType !== "list" ? e : {
|
|
826
828
|
...e,
|
|
827
829
|
viewType: "grid"
|
|
828
|
-
}, [e]), N =
|
|
829
|
-
let t =
|
|
830
|
+
}, [e]), N = a.useCallback((e, t) => M.objectName ? j(M.objectName, e, t) : t, [M.objectName, j]), pe = a.useCallback((e) => {
|
|
831
|
+
let t = Qe(e);
|
|
830
832
|
return M.objectName && typeof oe == "function" ? oe(M.objectName, e, t) : t;
|
|
831
|
-
}, [M.objectName, oe]), P =
|
|
833
|
+
}, [M.objectName, oe]), P = a.useMemo(() => {
|
|
832
834
|
let e = M.userActions, t = M.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
|
|
833
835
|
return {
|
|
834
836
|
showSearch: e?.search === void 0 ? M.showSearch !== !1 : e.search,
|
|
@@ -854,7 +856,7 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
854
856
|
M.compactToolbar,
|
|
855
857
|
M.addRecord,
|
|
856
858
|
M.userActions?.addRecordForm
|
|
857
|
-
]), [F,
|
|
859
|
+
]), [F, Ae] = a.useState(M.viewType), [R, Ne] = a.useState(() => x ?? ""), [Pe, Le] = a.useState(!1), [Be, Ve] = a.useState(!1), [z, B] = a.useState(() => M.sort && M.sort.length > 0 ? M.sort.map((e) => {
|
|
858
860
|
if (typeof e == "string") {
|
|
859
861
|
let t = e.trim().split(/\s+/);
|
|
860
862
|
return {
|
|
@@ -868,8 +870,8 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
868
870
|
field: e.field,
|
|
869
871
|
order: e.order || "asc"
|
|
870
872
|
};
|
|
871
|
-
}) : []),
|
|
872
|
-
|
|
873
|
+
}) : []), Ue = a.useMemo(() => JSON.stringify(M.sort || []), [M.sort]);
|
|
874
|
+
a.useEffect(() => {
|
|
873
875
|
M.sort && M.sort.length > 0 ? B(M.sort.map((e) => {
|
|
874
876
|
if (typeof e == "string") {
|
|
875
877
|
let t = e.trim().split(/\s+/);
|
|
@@ -885,18 +887,18 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
885
887
|
order: e.order || "asc"
|
|
886
888
|
};
|
|
887
889
|
})) : B([]);
|
|
888
|
-
}, [
|
|
889
|
-
let [
|
|
890
|
+
}, [Ue]);
|
|
891
|
+
let [We, Ke] = a.useState(!1), [V, qe] = a.useState(() => v && Array.isArray(v.conditions) ? v : {
|
|
890
892
|
id: "root",
|
|
891
893
|
logic: "and",
|
|
892
894
|
conditions: []
|
|
893
|
-
}),
|
|
894
|
-
|
|
895
|
-
if (!(!
|
|
896
|
-
e.resource === M.objectName &&
|
|
895
|
+
}), H = D.dataSource, [U, Ye] = a.useState([]), [Xe, Ze] = a.useState(null), [W, tt] = a.useState(() => !(Array.isArray(M.data) || M.data && typeof M.data == "object" && M.data.provider === "value" && Array.isArray(M.data.items) || M.viewType === "gantt" && M.data && typeof M.data == "object" && !Array.isArray(M.data) && M.data.provider === "api")), [G, nt] = a.useState(null), [rt, K] = a.useState(!1), [ot, st] = a.useState(0), [ct, lt] = a.useState(!1);
|
|
896
|
+
a.useImperativeHandle(ie, () => ({ refresh: () => st((e) => e + 1) }), []), a.useEffect(() => {
|
|
897
|
+
if (!(!H?.onMutation || !M.objectName)) return H.onMutation((e) => {
|
|
898
|
+
e.resource === M.objectName && st((e) => e + 1);
|
|
897
899
|
});
|
|
898
|
-
}, [
|
|
899
|
-
let [
|
|
900
|
+
}, [H, M.objectName]);
|
|
901
|
+
let [ut, dt] = a.useState(void 0), q = ut ?? M.pagination?.pageSize ?? 100, [ft, pt] = a.useState(1), [mt, ht] = a.useState(null), gt = a.useMemo(() => {
|
|
900
902
|
if (M.grouping?.fields?.length) return M.grouping;
|
|
901
903
|
let e = typeof M.groupBy == "string" ? M.groupBy.trim() : "", t = typeof M.groupBy2 == "string" ? M.groupBy2.trim() : "", n = [];
|
|
902
904
|
return e && n.push({
|
|
@@ -912,19 +914,19 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
912
914
|
M.grouping,
|
|
913
915
|
M.groupBy,
|
|
914
916
|
M.groupBy2
|
|
915
|
-
]), [
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
}, [
|
|
919
|
-
let [
|
|
917
|
+
]), [J, _t] = a.useState(gt), [vt, yt] = a.useState(!1), bt = a.useRef(gt);
|
|
918
|
+
a.useEffect(() => {
|
|
919
|
+
bt.current !== gt && (bt.current = gt, _t(gt));
|
|
920
|
+
}, [gt]);
|
|
921
|
+
let [Y, xt] = a.useState(M.rowColor), [St, Ct] = a.useState(!1), [wt, Tt] = a.useState([]), Et = a.useRef(0), [X, Dt] = a.useState([]), Ot = a.useMemo(() => {
|
|
920
922
|
let e = M.userFilters;
|
|
921
923
|
if (!e) return;
|
|
922
|
-
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !
|
|
924
|
+
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !G?.fields) return e;
|
|
923
925
|
let t = /* @__PURE__ */ new Set([
|
|
924
926
|
"select",
|
|
925
927
|
"multi-select",
|
|
926
928
|
"boolean"
|
|
927
|
-
]), n = [], r = Array.isArray(
|
|
929
|
+
]), n = [], r = Array.isArray(G.fields) ? G.fields.map((e) => [e.name, e]) : Object.entries(G.fields);
|
|
928
930
|
for (let [e, i] of r) (t.has(i.type) || i.options && !i.type) && n.push({
|
|
929
931
|
field: e,
|
|
930
932
|
label: N(e, i.label || e),
|
|
@@ -936,73 +938,73 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
936
938
|
};
|
|
937
939
|
}, [
|
|
938
940
|
M.userFilters,
|
|
939
|
-
|
|
941
|
+
G,
|
|
940
942
|
N
|
|
941
|
-
]), [Z,
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
}, [
|
|
945
|
-
let
|
|
946
|
-
|
|
947
|
-
}, [
|
|
948
|
-
|
|
949
|
-
|
|
943
|
+
]), [Z, kt] = a.useState(() => new Set(M.hiddenFields || [])), At = a.useMemo(() => JSON.stringify(M.hiddenFields || []), [M.hiddenFields]);
|
|
944
|
+
a.useEffect(() => {
|
|
945
|
+
kt(new Set(M.hiddenFields || []));
|
|
946
|
+
}, [At]);
|
|
947
|
+
let jt = a.useCallback((e) => {
|
|
948
|
+
kt(e), l?.(Array.from(e));
|
|
949
|
+
}, [l]), [Mt, Nt] = a.useState(!1), [Pt, Ft] = a.useState(() => !!M.inlineEdit);
|
|
950
|
+
a.useEffect(() => {
|
|
951
|
+
Ft(!!M.inlineEdit);
|
|
950
952
|
}, [M.inlineEdit]);
|
|
951
|
-
let
|
|
952
|
-
|
|
953
|
-
}, [
|
|
953
|
+
let It = a.useCallback((e) => {
|
|
954
|
+
Ft(e), u?.(e);
|
|
955
|
+
}, [u]), [Lt, Rt] = a.useState(!1), [zt, Bt] = a.useState(!1), [Vt, Ht] = a.useState(null), Ut = M.allowExport !== !1 && M.operations?.export !== !1, Wt = a.useMemo(() => {
|
|
954
956
|
if (M.exportOptions) return Array.isArray(M.exportOptions) ? { formats: M.exportOptions } : M.exportOptions;
|
|
955
|
-
}, [M.exportOptions]), Q =
|
|
957
|
+
}, [M.exportOptions]), Q = Fe(a.useMemo(() => M.densityMode ? M.densityMode : M.rowHeight ? {
|
|
956
958
|
compact: "compact",
|
|
957
959
|
short: "compact",
|
|
958
960
|
medium: "comfortable",
|
|
959
961
|
tall: "spacious",
|
|
960
962
|
extra_tall: "spacious"
|
|
961
|
-
}[M.rowHeight] || "comfortable" : "compact", [M.densityMode, M.rowHeight]), { onChange: M.onDensityChange }),
|
|
963
|
+
}[M.rowHeight] || "comfortable" : "compact", [M.densityMode, M.rowHeight]), { onChange: M.onDensityChange }), Gt = a.useMemo(() => `objectui:gallery:density:${M.objectName ?? "default"}`, [M.objectName]), [Kt, qt] = a.useState(() => {
|
|
962
964
|
if (typeof window > "u") return M.gallery?.cardSize ?? "medium";
|
|
963
965
|
try {
|
|
964
|
-
let e = window.localStorage.getItem(
|
|
966
|
+
let e = window.localStorage.getItem(Gt);
|
|
965
967
|
if (e === "small" || e === "medium" || e === "large") return e;
|
|
966
968
|
} catch {}
|
|
967
969
|
return M.gallery?.cardSize ?? "medium";
|
|
968
|
-
}),
|
|
969
|
-
|
|
970
|
+
}), Jt = a.useCallback(() => {
|
|
971
|
+
qt((e) => {
|
|
970
972
|
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
971
973
|
try {
|
|
972
|
-
window.localStorage.setItem(
|
|
974
|
+
window.localStorage.setItem(Gt, t);
|
|
973
975
|
} catch {}
|
|
974
976
|
return t;
|
|
975
977
|
});
|
|
976
|
-
}, [
|
|
977
|
-
onRefresh:
|
|
978
|
-
|
|
978
|
+
}, [Gt]), { ref: Yt, isRefreshing: Xt, pullDistance: Zt } = Re({
|
|
979
|
+
onRefresh: a.useCallback(async () => {
|
|
980
|
+
st((e) => e + 1);
|
|
979
981
|
}, []),
|
|
980
|
-
enabled: !!
|
|
981
|
-
}),
|
|
982
|
-
|
|
982
|
+
enabled: !!H && !!M.objectName
|
|
983
|
+
}), Qt = a.useMemo(() => M.id ? `listview-${M.objectName}-${M.id}-view` : `listview-${M.objectName}-view`, [M.objectName, M.id]);
|
|
984
|
+
a.useEffect(() => {
|
|
983
985
|
let e = !0;
|
|
984
|
-
return
|
|
985
|
-
if (!
|
|
986
|
-
|
|
986
|
+
return K(!1), nt(null), (async () => {
|
|
987
|
+
if (!H || !M.objectName) {
|
|
988
|
+
K(!0);
|
|
987
989
|
return;
|
|
988
990
|
}
|
|
989
|
-
if (typeof
|
|
990
|
-
|
|
991
|
+
if (typeof H.getObjectSchema != "function") {
|
|
992
|
+
K(!0);
|
|
991
993
|
return;
|
|
992
994
|
}
|
|
993
995
|
try {
|
|
994
|
-
let t = await
|
|
995
|
-
e &&
|
|
996
|
+
let t = await H.getObjectSchema(M.objectName);
|
|
997
|
+
e && nt(t);
|
|
996
998
|
} catch (e) {
|
|
997
999
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
998
1000
|
} finally {
|
|
999
|
-
e &&
|
|
1001
|
+
e && K(!0);
|
|
1000
1002
|
}
|
|
1001
1003
|
})(), () => {
|
|
1002
1004
|
e = !1;
|
|
1003
1005
|
};
|
|
1004
|
-
}, [M.objectName,
|
|
1005
|
-
let
|
|
1006
|
+
}, [M.objectName, H]);
|
|
1007
|
+
let $t = a.useMemo(() => {
|
|
1006
1008
|
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) => {
|
|
1007
1009
|
if (!e) return;
|
|
1008
1010
|
let t = [
|
|
@@ -1029,9 +1031,9 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1029
1031
|
};
|
|
1030
1032
|
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);
|
|
1031
1033
|
let i = n.size > 0 ? Array.from(n) : void 0;
|
|
1032
|
-
return t(
|
|
1034
|
+
return t(G?.fields, i);
|
|
1033
1035
|
}, [
|
|
1034
|
-
|
|
1036
|
+
G?.fields,
|
|
1035
1037
|
M.fields,
|
|
1036
1038
|
M.kanban,
|
|
1037
1039
|
M.calendar,
|
|
@@ -1039,9 +1041,9 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1039
1041
|
M.timeline,
|
|
1040
1042
|
M.gantt,
|
|
1041
1043
|
M.options
|
|
1042
|
-
]),
|
|
1043
|
-
|
|
1044
|
-
let e = !0, t = ++
|
|
1044
|
+
]), en = ze(), tn = F === "gantt" && !!M.data && typeof M.data == "object" && !Array.isArray(M.data) && M.data.provider === "api";
|
|
1045
|
+
a.useEffect(() => {
|
|
1046
|
+
let e = !0, t = ++Et.current;
|
|
1045
1047
|
if (M.data && typeof M.data == "object" && !Array.isArray(M.data)) {
|
|
1046
1048
|
let e = M.data;
|
|
1047
1049
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
@@ -1050,7 +1052,7 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1050
1052
|
let e = R.toLowerCase();
|
|
1051
1053
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
1052
1054
|
}
|
|
1053
|
-
|
|
1055
|
+
Ye(t), tt(!1), lt(!1);
|
|
1054
1056
|
return;
|
|
1055
1057
|
}
|
|
1056
1058
|
}
|
|
@@ -1060,17 +1062,21 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1060
1062
|
let t = R.toLowerCase();
|
|
1061
1063
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
1062
1064
|
}
|
|
1063
|
-
|
|
1065
|
+
Ye(e), tt(!1), lt(!1);
|
|
1064
1066
|
return;
|
|
1065
1067
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1068
|
+
if (tn) {
|
|
1069
|
+
tt(!1), lt(!1);
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
return rt ? ((async () => {
|
|
1073
|
+
if (!H || !M.objectName) {
|
|
1074
|
+
tt(!1);
|
|
1069
1075
|
return;
|
|
1070
1076
|
}
|
|
1071
|
-
|
|
1077
|
+
tt(!0), Ze(null);
|
|
1072
1078
|
try {
|
|
1073
|
-
let n = [], r = M.filters || [], i =
|
|
1079
|
+
let n = [], r = M.filters || [], i = et(V), a = $e(X), o = [
|
|
1074
1080
|
...r.length > 0 ? [r] : [],
|
|
1075
1081
|
...i.length > 0 ? [i] : [],
|
|
1076
1082
|
...a
|
|
@@ -1080,13 +1086,13 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1080
1086
|
field: e.field,
|
|
1081
1087
|
order: e.order
|
|
1082
1088
|
})) : void 0, c = (() => {
|
|
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 =
|
|
1089
|
+
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 = en?.isLoaded && M.objectName ? e.filter((e) => en.checkField(M.objectName, e, "read")) : e;
|
|
1084
1090
|
if (t.length === 0) return;
|
|
1085
1091
|
let n = /* @__PURE__ */ new Set(["id"]);
|
|
1086
1092
|
for (let e of t) n.add(e);
|
|
1087
|
-
for (let e of
|
|
1093
|
+
for (let e of $t) n.add(e);
|
|
1088
1094
|
let r = (() => {
|
|
1089
|
-
let e =
|
|
1095
|
+
let e = G?.fields;
|
|
1090
1096
|
if (!e) return null;
|
|
1091
1097
|
let t = Array.isArray(e) ? e.map((e) => e?.name).filter((e) => typeof e == "string") : Object.keys(e), n = new Set(t);
|
|
1092
1098
|
return n.add("id"), n.add("created_at"), n.add("updated_at"), n;
|
|
@@ -1122,27 +1128,27 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1122
1128
|
e && !Array.isArray(e.metaFields) && (i("status"), i("priority"));
|
|
1123
1129
|
}
|
|
1124
1130
|
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" && !
|
|
1131
|
+
})(), l = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, u = F === "grid" && !J?.fields?.length, d = u ? (ft - 1) * q : 0, f = await H.find(M.objectName, {
|
|
1126
1132
|
...l ? { $filter: n } : {},
|
|
1127
1133
|
$orderby: s,
|
|
1128
|
-
$top:
|
|
1134
|
+
$top: q,
|
|
1129
1135
|
...d > 0 ? { $skip: d } : {},
|
|
1130
1136
|
...c ? { $select: c } : {},
|
|
1131
|
-
|
|
1137
|
+
...$t.length > 0 ? { $expand: $t } : {},
|
|
1132
1138
|
...R ? {
|
|
1133
1139
|
$search: R,
|
|
1134
1140
|
...M.searchableFields && M.searchableFields.length > 0 ? { $searchFields: M.searchableFields } : {}
|
|
1135
1141
|
} : {}
|
|
1136
1142
|
});
|
|
1137
|
-
if (!e || t !==
|
|
1143
|
+
if (!e || t !== Et.current) return;
|
|
1138
1144
|
let p = [];
|
|
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)),
|
|
1145
|
+
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)), Ye(p);
|
|
1140
1146
|
let m = f && typeof f == "object" ? f.total ?? f.count : void 0, h = typeof m == "number" ? m : null;
|
|
1141
|
-
|
|
1147
|
+
ht(u ? h : null), lt(!(u && h != null) && p.length >= q);
|
|
1142
1148
|
} catch (e) {
|
|
1143
|
-
t ===
|
|
1149
|
+
t === Et.current && (console.error("ListView data fetch error:", e), Ye([]), Ze(e?.message ? String(e.message) : String(e ?? "Unknown error")));
|
|
1144
1150
|
} finally {
|
|
1145
|
-
e && t ===
|
|
1151
|
+
e && t === Et.current && tt(!1);
|
|
1146
1152
|
}
|
|
1147
1153
|
})(), () => {
|
|
1148
1154
|
e = !1;
|
|
@@ -1150,38 +1156,39 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1150
1156
|
}, [
|
|
1151
1157
|
M.objectName,
|
|
1152
1158
|
M.data,
|
|
1153
|
-
|
|
1159
|
+
H,
|
|
1154
1160
|
M.filters,
|
|
1155
|
-
|
|
1161
|
+
q,
|
|
1156
1162
|
z,
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1163
|
+
V,
|
|
1164
|
+
X,
|
|
1165
|
+
ot,
|
|
1160
1166
|
R,
|
|
1161
1167
|
M.searchableFields,
|
|
1162
|
-
|
|
1163
|
-
|
|
1168
|
+
$t,
|
|
1169
|
+
rt,
|
|
1164
1170
|
M.refreshTrigger,
|
|
1165
|
-
|
|
1166
|
-
|
|
1171
|
+
en,
|
|
1172
|
+
ft,
|
|
1167
1173
|
F,
|
|
1168
|
-
|
|
1174
|
+
J,
|
|
1175
|
+
tn
|
|
1169
1176
|
]);
|
|
1170
|
-
let
|
|
1177
|
+
let nn = JSON.stringify([
|
|
1171
1178
|
M.objectName,
|
|
1172
1179
|
M.filters,
|
|
1173
|
-
|
|
1180
|
+
q,
|
|
1174
1181
|
z,
|
|
1175
|
-
|
|
1176
|
-
|
|
1182
|
+
V,
|
|
1183
|
+
X,
|
|
1177
1184
|
R,
|
|
1178
1185
|
F,
|
|
1179
|
-
|
|
1180
|
-
]),
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
}, [
|
|
1184
|
-
let
|
|
1186
|
+
J
|
|
1187
|
+
]), rn = a.useRef(nn);
|
|
1188
|
+
a.useEffect(() => {
|
|
1189
|
+
rn.current !== nn && (rn.current = nn, pt(1));
|
|
1190
|
+
}, [nn]);
|
|
1191
|
+
let an = a.useMemo(() => {
|
|
1185
1192
|
let e = ["grid"];
|
|
1186
1193
|
(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) && [
|
|
1187
1194
|
"grid",
|
|
@@ -1211,29 +1218,29 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1211
1218
|
M.tree,
|
|
1212
1219
|
M.appearance?.allowedVisualizations
|
|
1213
1220
|
]);
|
|
1214
|
-
|
|
1215
|
-
M.viewType &&
|
|
1221
|
+
a.useEffect(() => {
|
|
1222
|
+
M.viewType && Ae(M.viewType);
|
|
1216
1223
|
}, [M.viewType]);
|
|
1217
|
-
let
|
|
1218
|
-
|
|
1224
|
+
let on = a.useCallback((e) => {
|
|
1225
|
+
Ae(e);
|
|
1219
1226
|
try {
|
|
1220
|
-
localStorage.setItem(
|
|
1227
|
+
localStorage.setItem(Qt, e);
|
|
1221
1228
|
} catch (e) {
|
|
1222
1229
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
1223
1230
|
}
|
|
1224
|
-
|
|
1225
|
-
}, [
|
|
1226
|
-
|
|
1227
|
-
}, [
|
|
1231
|
+
i?.(e);
|
|
1232
|
+
}, [Qt, i]), sn = a.useCallback((e) => {
|
|
1233
|
+
Ne(e), c?.(e);
|
|
1234
|
+
}, [c]), cn = Ie({
|
|
1228
1235
|
navigation: M.navigation,
|
|
1229
1236
|
objectName: M.objectName,
|
|
1230
1237
|
onNavigate: M.onNavigate,
|
|
1231
|
-
onRowClick:
|
|
1232
|
-
}), $ =
|
|
1238
|
+
onRowClick: p
|
|
1239
|
+
}), $ = a.useMemo(() => {
|
|
1233
1240
|
let e = M.fields || [];
|
|
1234
|
-
if (Array.isArray(e) || (e = []),
|
|
1241
|
+
if (Array.isArray(e) || (e = []), en?.isLoaded && M.objectName && (e = e.filter((e) => {
|
|
1235
1242
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1236
|
-
return t
|
|
1243
|
+
return !t || en.checkField(M.objectName, t, "read");
|
|
1237
1244
|
})), Z.size > 0 && (e = e.filter((e) => {
|
|
1238
1245
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1239
1246
|
return t != null && !Z.has(t);
|
|
@@ -1250,8 +1257,8 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1250
1257
|
M.objectName,
|
|
1251
1258
|
Z,
|
|
1252
1259
|
M.fieldOrder,
|
|
1253
|
-
|
|
1254
|
-
]),
|
|
1260
|
+
en
|
|
1261
|
+
]), ln = a.useMemo(() => {
|
|
1255
1262
|
let e = Q.mode === "compact" ? "compact" : Q.mode === "spacious" ? "tall" : "medium", t = {
|
|
1256
1263
|
objectName: M.objectName,
|
|
1257
1264
|
fields: $,
|
|
@@ -1259,12 +1266,12 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1259
1266
|
sort: z,
|
|
1260
1267
|
className: "h-full w-full",
|
|
1261
1268
|
showSearch: !1,
|
|
1262
|
-
onRowClick:
|
|
1269
|
+
onRowClick: cn.handleClick,
|
|
1263
1270
|
rowHeight: e,
|
|
1264
1271
|
hideRowHeightToggle: !0,
|
|
1265
1272
|
...M.striped == null ? {} : { striped: M.striped },
|
|
1266
1273
|
...M.bordered == null ? {} : { bordered: M.bordered },
|
|
1267
|
-
...
|
|
1274
|
+
...f ? { onColumnStateChange: f } : {},
|
|
1268
1275
|
...M.columnState ? { columnState: M.columnState } : {}
|
|
1269
1276
|
};
|
|
1270
1277
|
switch (F) {
|
|
@@ -1274,14 +1281,14 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1274
1281
|
...t,
|
|
1275
1282
|
columns: $,
|
|
1276
1283
|
...M.conditionalFormatting ? { conditionalFormatting: M.conditionalFormatting } : {},
|
|
1277
|
-
editable:
|
|
1284
|
+
editable: Pt,
|
|
1278
1285
|
...M.wrapHeaders == null ? {} : { wrapHeaders: M.wrapHeaders },
|
|
1279
1286
|
...M.virtualScroll == null ? {} : { virtualScroll: M.virtualScroll },
|
|
1280
1287
|
...M.resizable == null ? {} : { resizable: M.resizable },
|
|
1281
1288
|
...M.selection ? { selection: M.selection } : {},
|
|
1282
1289
|
...M.pagination ? { pagination: M.pagination } : {},
|
|
1283
|
-
...
|
|
1284
|
-
...
|
|
1290
|
+
...J ? { grouping: J } : {},
|
|
1291
|
+
...Y ? { rowColor: Y } : {},
|
|
1285
1292
|
...M.rowActions ? { rowActions: M.rowActions } : {},
|
|
1286
1293
|
...M.rowActionDefs ? { rowActionDefs: M.rowActionDefs } : {},
|
|
1287
1294
|
...M.bulkActions ? { batchActions: M.bulkActions } : {},
|
|
@@ -1295,7 +1302,7 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1295
1302
|
groupField: M.kanban?.groupField || M.options?.kanban?.groupField || "status",
|
|
1296
1303
|
...M.kanban?.titleField || M.options?.kanban?.titleField ? { titleField: M.kanban?.titleField || M.options?.kanban?.titleField } : {},
|
|
1297
1304
|
cardFields: M.kanban?.cardFields || $ || [],
|
|
1298
|
-
...
|
|
1305
|
+
...J ? { grouping: J } : {},
|
|
1299
1306
|
...M.options?.kanban || {},
|
|
1300
1307
|
...M.kanban || {}
|
|
1301
1308
|
};
|
|
@@ -1313,7 +1320,7 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1313
1320
|
let e = {
|
|
1314
1321
|
...M.options?.gallery || {},
|
|
1315
1322
|
...M.gallery || {},
|
|
1316
|
-
cardSize:
|
|
1323
|
+
cardSize: Kt
|
|
1317
1324
|
};
|
|
1318
1325
|
return {
|
|
1319
1326
|
type: "object-gallery",
|
|
@@ -1322,7 +1329,7 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1322
1329
|
imageField: M.gallery?.coverField || M.gallery?.imageField || M.options?.gallery?.imageField,
|
|
1323
1330
|
titleField: M.gallery?.titleField || M.options?.gallery?.titleField || "name",
|
|
1324
1331
|
subtitleField: M.gallery?.subtitleField || M.options?.gallery?.subtitleField,
|
|
1325
|
-
...
|
|
1332
|
+
...J ? { grouping: J } : {}
|
|
1326
1333
|
};
|
|
1327
1334
|
}
|
|
1328
1335
|
case "timeline": {
|
|
@@ -1345,6 +1352,7 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1345
1352
|
case "gantt": return {
|
|
1346
1353
|
type: "object-gantt",
|
|
1347
1354
|
...t,
|
|
1355
|
+
...M.data ? { data: M.data } : {},
|
|
1348
1356
|
startDateField: M.gantt?.startDateField || M.options?.gantt?.startDateField || "start_date",
|
|
1349
1357
|
endDateField: M.gantt?.endDateField || M.options?.gantt?.endDateField || "end_date",
|
|
1350
1358
|
progressField: M.gantt?.progressField || M.options?.gantt?.progressField || "progress",
|
|
@@ -1414,13 +1422,13 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1414
1422
|
M,
|
|
1415
1423
|
z,
|
|
1416
1424
|
$,
|
|
1425
|
+
J,
|
|
1417
1426
|
Y,
|
|
1418
|
-
|
|
1419
|
-
an.handleClick,
|
|
1427
|
+
cn.handleClick,
|
|
1420
1428
|
Q.mode,
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
]),
|
|
1429
|
+
Kt,
|
|
1430
|
+
Pt
|
|
1431
|
+
]), un = V.conditions && V.conditions.length > 0, dn = a.useMemo(() => {
|
|
1424
1432
|
let e, t = (e, t) => {
|
|
1425
1433
|
if (!t) return;
|
|
1426
1434
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1432,9 +1440,9 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1432
1440
|
label: t?.label || e,
|
|
1433
1441
|
...t
|
|
1434
1442
|
}));
|
|
1435
|
-
return M.objectName ?
|
|
1443
|
+
return M.objectName ? ue(M.objectName, e, n) : n;
|
|
1436
1444
|
};
|
|
1437
|
-
if (e =
|
|
1445
|
+
if (e = G?.fields ? Object.entries(G.fields).map(([e, n]) => ({
|
|
1438
1446
|
value: e,
|
|
1439
1447
|
label: N(e, n.label || e),
|
|
1440
1448
|
type: n.type || "text",
|
|
@@ -1464,71 +1472,78 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1464
1472
|
}
|
|
1465
1473
|
return e;
|
|
1466
1474
|
}, [
|
|
1467
|
-
|
|
1475
|
+
G,
|
|
1468
1476
|
M.fields,
|
|
1469
1477
|
M.filterableFields,
|
|
1470
1478
|
M.objectName,
|
|
1471
1479
|
N,
|
|
1472
|
-
|
|
1473
|
-
]),
|
|
1474
|
-
if (!
|
|
1475
|
-
let t =
|
|
1476
|
-
|
|
1477
|
-
|
|
1480
|
+
ue
|
|
1481
|
+
]), fn = a.useCallback((e) => {
|
|
1482
|
+
if (!Ut) return;
|
|
1483
|
+
let t = Wt, r = t?.maxRecords || 0, i = t?.includeHeaders !== !1, a = G?.label && G?.name && typeof le == "function" ? le(G) : G?.label, o = (e) => n(e, {
|
|
1484
|
+
prefix: t?.fileNamePrefix,
|
|
1485
|
+
label: a,
|
|
1486
|
+
objectName: M.objectName,
|
|
1487
|
+
viewLabel: M.label || M.title
|
|
1488
|
+
});
|
|
1489
|
+
if ((e === "csv" || e === "xlsx" || e === "json") && typeof H?.exportDownload == "function" && M.objectName && t?.streaming !== !1) {
|
|
1490
|
+
let t = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field).filter(Boolean), n = M.filters || [], a = et(V), s = $e(X), c = [
|
|
1491
|
+
...n.length > 0 ? [n] : [],
|
|
1478
1492
|
...a.length > 0 ? [a] : [],
|
|
1479
|
-
...o.length > 0 ? [o] : [],
|
|
1480
1493
|
...s
|
|
1481
1494
|
].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) => ({
|
|
1482
1495
|
field: e.field,
|
|
1483
1496
|
direction: e.order
|
|
1484
1497
|
})) : void 0;
|
|
1485
|
-
|
|
1498
|
+
Ht(null), Bt(!0), (async () => {
|
|
1486
1499
|
try {
|
|
1487
|
-
let
|
|
1500
|
+
let n = await H.exportDownload(M.objectName, {
|
|
1488
1501
|
format: e,
|
|
1489
1502
|
fields: t.length ? t : void 0,
|
|
1490
1503
|
filter: l,
|
|
1491
1504
|
sort: u,
|
|
1492
|
-
includeHeaders:
|
|
1493
|
-
limit:
|
|
1494
|
-
}),
|
|
1495
|
-
s.href =
|
|
1505
|
+
includeHeaders: i,
|
|
1506
|
+
limit: r > 0 ? r : void 0
|
|
1507
|
+
}), a = URL.createObjectURL(n), s = document.createElement("a");
|
|
1508
|
+
s.href = a, s.download = o(e), s.rel = "noopener", document.body.appendChild(s), s.click(), s.remove(), URL.revokeObjectURL(a), Rt(!1);
|
|
1496
1509
|
} catch (e) {
|
|
1497
|
-
console.error("ListView export failed:", e),
|
|
1510
|
+
console.error("ListView export failed:", e), Ht(e instanceof Error ? e.message : String(e));
|
|
1498
1511
|
} finally {
|
|
1499
|
-
|
|
1512
|
+
Bt(!1);
|
|
1500
1513
|
}
|
|
1501
1514
|
})();
|
|
1502
1515
|
return;
|
|
1503
1516
|
}
|
|
1504
|
-
let
|
|
1517
|
+
let s = r > 0 ? U.slice(0, r) : U;
|
|
1505
1518
|
if (e === "csv") {
|
|
1506
1519
|
let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
|
|
1507
|
-
|
|
1520
|
+
i && t.push(e.join(",")), s.forEach((n) => {
|
|
1508
1521
|
t.push(e.map((e) => {
|
|
1509
1522
|
let t = n[e], r;
|
|
1510
1523
|
return r = t == null ? "" : Array.isArray(t) ? t.map((e) => typeof e == "object" && e ? JSON.stringify(e) : String(e ?? "")).join("; ") : typeof t == "object" ? JSON.stringify(t) : String(t), r.includes(",") || r.includes("\"") || r.includes("\n") || r.includes("\r") ? `"${r.replace(/"/g, "\"\"")}"` : r;
|
|
1511
1524
|
}).join(","));
|
|
1512
1525
|
});
|
|
1513
|
-
let n = new Blob([t.join("\n")], { type: "text/csv;charset=utf-8;" }),
|
|
1514
|
-
|
|
1526
|
+
let n = new Blob([t.join("\n")], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(n), a = document.createElement("a");
|
|
1527
|
+
a.href = r, a.download = o("csv"), a.click(), URL.revokeObjectURL(r);
|
|
1515
1528
|
} else if (e === "json") {
|
|
1516
|
-
let e = new Blob([JSON.stringify(
|
|
1517
|
-
n.href = t, n.download =
|
|
1529
|
+
let e = new Blob([JSON.stringify(s, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1530
|
+
n.href = t, n.download = o("json"), n.click(), URL.revokeObjectURL(t);
|
|
1518
1531
|
}
|
|
1519
|
-
|
|
1532
|
+
Rt(!1);
|
|
1520
1533
|
}, [
|
|
1521
|
-
|
|
1534
|
+
U,
|
|
1522
1535
|
$,
|
|
1523
|
-
|
|
1536
|
+
Wt,
|
|
1524
1537
|
M.objectName,
|
|
1525
1538
|
M.filters,
|
|
1526
|
-
|
|
1527
|
-
U,
|
|
1539
|
+
Ut,
|
|
1528
1540
|
H,
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1541
|
+
V,
|
|
1542
|
+
X,
|
|
1543
|
+
z,
|
|
1544
|
+
G,
|
|
1545
|
+
le
|
|
1546
|
+
]), pn = a.useMemo(() => (M.fields || []).map((e) => {
|
|
1532
1547
|
if (typeof e == "string") return {
|
|
1533
1548
|
name: e,
|
|
1534
1549
|
label: N(e, e)
|
|
@@ -1540,19 +1555,19 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1540
1555
|
};
|
|
1541
1556
|
}), [M.fields, N]);
|
|
1542
1557
|
return /* @__PURE__ */ L("div", {
|
|
1543
|
-
ref:
|
|
1544
|
-
className: E("flex flex-col h-full bg-background relative min-w-0 overflow-hidden",
|
|
1558
|
+
ref: Yt,
|
|
1559
|
+
className: E("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", r),
|
|
1545
1560
|
...M.aria?.label ? { "aria-label": M.aria.label } : {},
|
|
1546
1561
|
...M.aria?.describedBy ? { "aria-describedby": M.aria.describedBy } : {},
|
|
1547
1562
|
...M.aria?.live ? { "aria-live": M.aria.live } : {},
|
|
1548
1563
|
role: "region",
|
|
1549
|
-
"aria-busy":
|
|
1550
|
-
"data-state":
|
|
1564
|
+
"aria-busy": W || void 0,
|
|
1565
|
+
"data-state": W ? "loading" : "idle",
|
|
1551
1566
|
children: [
|
|
1552
|
-
|
|
1567
|
+
Zt > 0 && /* @__PURE__ */ I("div", {
|
|
1553
1568
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1554
|
-
style: { height:
|
|
1555
|
-
children:
|
|
1569
|
+
style: { height: Zt },
|
|
1570
|
+
children: A(Xt ? "list.refreshing" : "list.pullToRefresh")
|
|
1556
1571
|
}),
|
|
1557
1572
|
M.description && M.appearance?.showDescription !== !1 && /* @__PURE__ */ I("div", {
|
|
1558
1573
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
@@ -1563,45 +1578,45 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1563
1578
|
className: "border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1564
1579
|
children: [/* @__PURE__ */ I("div", {
|
|
1565
1580
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1566
|
-
children:
|
|
1581
|
+
children: Ot && /* @__PURE__ */ I("div", {
|
|
1567
1582
|
className: "shrink-0 min-w-0 overflow-x-auto",
|
|
1568
1583
|
"data-testid": "user-filters",
|
|
1569
|
-
children: /* @__PURE__ */ I(
|
|
1570
|
-
config:
|
|
1571
|
-
objectDef:
|
|
1572
|
-
data:
|
|
1573
|
-
onFilterChange:
|
|
1584
|
+
children: /* @__PURE__ */ I(Je, {
|
|
1585
|
+
config: Ot,
|
|
1586
|
+
objectDef: G,
|
|
1587
|
+
data: U,
|
|
1588
|
+
onFilterChange: Dt,
|
|
1574
1589
|
maxVisible: 3,
|
|
1575
|
-
initialSelections:
|
|
1576
|
-
onSelectionsChange:
|
|
1590
|
+
initialSelections: g,
|
|
1591
|
+
onSelectionsChange: _
|
|
1577
1592
|
})
|
|
1578
1593
|
})
|
|
1579
1594
|
}), /* @__PURE__ */ L("div", {
|
|
1580
1595
|
className: "flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm",
|
|
1581
1596
|
children: [
|
|
1582
|
-
|
|
1597
|
+
k && /* @__PURE__ */ L(ke, { children: [/* @__PURE__ */ I(He, {
|
|
1583
1598
|
currentView: F,
|
|
1584
|
-
availableViews:
|
|
1585
|
-
onViewChange:
|
|
1599
|
+
availableViews: an,
|
|
1600
|
+
onViewChange: on
|
|
1586
1601
|
}), /* @__PURE__ */ I("div", { className: "h-4 w-px bg-border/60 mx-0.5" })] }),
|
|
1587
|
-
F === "grid" &&
|
|
1602
|
+
F === "grid" && u && !P.compactToolbar && /* @__PURE__ */ L(d, {
|
|
1588
1603
|
variant: "ghost",
|
|
1589
1604
|
size: "sm",
|
|
1590
|
-
onClick: () =>
|
|
1591
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1592
|
-
title:
|
|
1605
|
+
onClick: () => It(!Pt),
|
|
1606
|
+
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Pt && "text-primary"),
|
|
1607
|
+
title: A("list.inlineEditLabel", { defaultValue: "Edit records inline (click a cell to edit)" }),
|
|
1593
1608
|
"data-testid": "toolbar-inline-edit-toggle",
|
|
1594
|
-
children: [/* @__PURE__ */ I(
|
|
1609
|
+
children: [/* @__PURE__ */ I(ge, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1595
1610
|
className: "hidden sm:inline",
|
|
1596
|
-
children:
|
|
1611
|
+
children: A("list.inlineEditShort", { defaultValue: "Edit inline" })
|
|
1597
1612
|
})]
|
|
1598
1613
|
}),
|
|
1599
1614
|
P.showHideFields && !P.compactToolbar && /* @__PURE__ */ L(S, {
|
|
1600
|
-
open:
|
|
1601
|
-
onOpenChange:
|
|
1615
|
+
open: Mt,
|
|
1616
|
+
onOpenChange: Nt,
|
|
1602
1617
|
children: [/* @__PURE__ */ I(w, {
|
|
1603
1618
|
asChild: !0,
|
|
1604
|
-
children: /* @__PURE__ */ L(
|
|
1619
|
+
children: /* @__PURE__ */ L(d, {
|
|
1605
1620
|
variant: "ghost",
|
|
1606
1621
|
size: "sm",
|
|
1607
1622
|
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"),
|
|
@@ -1609,7 +1624,7 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1609
1624
|
/* @__PURE__ */ I(ce, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1610
1625
|
/* @__PURE__ */ I("span", {
|
|
1611
1626
|
className: "hidden sm:inline",
|
|
1612
|
-
children:
|
|
1627
|
+
children: A("list.hideFields")
|
|
1613
1628
|
}),
|
|
1614
1629
|
Z.size > 0 && /* @__PURE__ */ I("span", {
|
|
1615
1630
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
@@ -1626,24 +1641,24 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1626
1641
|
className: "flex items-center justify-between border-b pb-2",
|
|
1627
1642
|
children: [/* @__PURE__ */ I("h4", {
|
|
1628
1643
|
className: "font-medium text-sm",
|
|
1629
|
-
children:
|
|
1630
|
-
}), Z.size > 0 && /* @__PURE__ */ I(
|
|
1644
|
+
children: A("list.hideFieldsTitle")
|
|
1645
|
+
}), Z.size > 0 && /* @__PURE__ */ I(d, {
|
|
1631
1646
|
variant: "ghost",
|
|
1632
1647
|
size: "sm",
|
|
1633
1648
|
className: "h-6 px-2 text-xs",
|
|
1634
|
-
onClick: () =>
|
|
1635
|
-
children:
|
|
1649
|
+
onClick: () => jt(/* @__PURE__ */ new Set()),
|
|
1650
|
+
children: A("list.showAll")
|
|
1636
1651
|
})]
|
|
1637
1652
|
}), /* @__PURE__ */ I("div", {
|
|
1638
1653
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1639
|
-
children:
|
|
1654
|
+
children: pn.map((e) => /* @__PURE__ */ L("label", {
|
|
1640
1655
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1641
1656
|
children: [/* @__PURE__ */ I("input", {
|
|
1642
1657
|
type: "checkbox",
|
|
1643
1658
|
checked: !Z.has(e.name),
|
|
1644
1659
|
onChange: () => {
|
|
1645
1660
|
let t = new Set(Z);
|
|
1646
|
-
t.has(e.name) ? t.delete(e.name) : t.add(e.name),
|
|
1661
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), jt(t);
|
|
1647
1662
|
},
|
|
1648
1663
|
className: "rounded border-input"
|
|
1649
1664
|
}), /* @__PURE__ */ I("span", {
|
|
@@ -1657,23 +1672,23 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1657
1672
|
}),
|
|
1658
1673
|
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
1674
|
P.showFilters && /* @__PURE__ */ L(S, {
|
|
1660
|
-
open:
|
|
1661
|
-
onOpenChange:
|
|
1675
|
+
open: We,
|
|
1676
|
+
onOpenChange: Ke,
|
|
1662
1677
|
children: [/* @__PURE__ */ I(w, {
|
|
1663
1678
|
asChild: !0,
|
|
1664
|
-
children: /* @__PURE__ */ L(
|
|
1679
|
+
children: /* @__PURE__ */ L(d, {
|
|
1665
1680
|
variant: "ghost",
|
|
1666
1681
|
size: "sm",
|
|
1667
|
-
className: E("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1682
|
+
className: E("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", un && "text-foreground font-medium"),
|
|
1668
1683
|
children: [
|
|
1669
|
-
/* @__PURE__ */ I(
|
|
1684
|
+
/* @__PURE__ */ I(Te, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1670
1685
|
/* @__PURE__ */ I("span", {
|
|
1671
1686
|
className: "hidden sm:inline",
|
|
1672
|
-
children:
|
|
1687
|
+
children: A("list.filter")
|
|
1673
1688
|
}),
|
|
1674
|
-
|
|
1689
|
+
un && /* @__PURE__ */ I("span", {
|
|
1675
1690
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1676
|
-
children:
|
|
1691
|
+
children: V.conditions?.length || 0
|
|
1677
1692
|
})
|
|
1678
1693
|
]
|
|
1679
1694
|
})
|
|
@@ -1686,36 +1701,36 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1686
1701
|
className: "flex items-center justify-between border-b pb-2",
|
|
1687
1702
|
children: /* @__PURE__ */ I("h4", {
|
|
1688
1703
|
className: "font-medium text-sm",
|
|
1689
|
-
children:
|
|
1704
|
+
children: A("list.filterRecords")
|
|
1690
1705
|
})
|
|
1691
|
-
}), /* @__PURE__ */ I(
|
|
1692
|
-
fields:
|
|
1693
|
-
value:
|
|
1706
|
+
}), /* @__PURE__ */ I(ee, {
|
|
1707
|
+
fields: dn,
|
|
1708
|
+
value: V,
|
|
1694
1709
|
onChange: (e) => {
|
|
1695
|
-
|
|
1710
|
+
qe(e), o && o(e);
|
|
1696
1711
|
}
|
|
1697
1712
|
})]
|
|
1698
1713
|
})
|
|
1699
1714
|
})]
|
|
1700
1715
|
}),
|
|
1701
1716
|
P.showGroup && !P.compactToolbar && /* @__PURE__ */ L(S, {
|
|
1702
|
-
open:
|
|
1703
|
-
onOpenChange:
|
|
1717
|
+
open: vt,
|
|
1718
|
+
onOpenChange: yt,
|
|
1704
1719
|
children: [/* @__PURE__ */ I(w, {
|
|
1705
1720
|
asChild: !0,
|
|
1706
|
-
children: /* @__PURE__ */ L(
|
|
1721
|
+
children: /* @__PURE__ */ L(d, {
|
|
1707
1722
|
variant: "ghost",
|
|
1708
1723
|
size: "sm",
|
|
1709
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1724
|
+
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", J && "text-foreground font-medium"),
|
|
1710
1725
|
children: [
|
|
1711
|
-
/* @__PURE__ */ I(
|
|
1726
|
+
/* @__PURE__ */ I(de, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1712
1727
|
/* @__PURE__ */ I("span", {
|
|
1713
1728
|
className: "hidden sm:inline",
|
|
1714
|
-
children:
|
|
1729
|
+
children: A("list.group")
|
|
1715
1730
|
}),
|
|
1716
|
-
|
|
1731
|
+
J && J.fields?.length > 0 && /* @__PURE__ */ I("span", {
|
|
1717
1732
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1718
|
-
children:
|
|
1733
|
+
children: J.fields.length
|
|
1719
1734
|
})
|
|
1720
1735
|
]
|
|
1721
1736
|
})
|
|
@@ -1728,49 +1743,49 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1728
1743
|
className: "flex items-center justify-between border-b pb-2",
|
|
1729
1744
|
children: [/* @__PURE__ */ I("h4", {
|
|
1730
1745
|
className: "font-medium text-sm",
|
|
1731
|
-
children:
|
|
1732
|
-
}),
|
|
1746
|
+
children: A("list.groupBy")
|
|
1747
|
+
}), J && /* @__PURE__ */ I(d, {
|
|
1733
1748
|
variant: "ghost",
|
|
1734
1749
|
size: "sm",
|
|
1735
1750
|
className: "h-6 px-2 text-xs",
|
|
1736
|
-
onClick: () =>
|
|
1751
|
+
onClick: () => _t(void 0),
|
|
1737
1752
|
"data-testid": "clear-grouping",
|
|
1738
|
-
children:
|
|
1753
|
+
children: A("list.clear")
|
|
1739
1754
|
})]
|
|
1740
1755
|
}), /* @__PURE__ */ I("div", {
|
|
1741
1756
|
"data-testid": "group-field-list",
|
|
1742
|
-
children: /* @__PURE__ */ I(
|
|
1743
|
-
value:
|
|
1744
|
-
fieldOptions:
|
|
1757
|
+
children: /* @__PURE__ */ I(y, {
|
|
1758
|
+
value: J,
|
|
1759
|
+
fieldOptions: pn.map((e) => ({
|
|
1745
1760
|
value: e.name,
|
|
1746
1761
|
label: e.label || e.name
|
|
1747
1762
|
})),
|
|
1748
1763
|
maxLevels: 3,
|
|
1749
1764
|
labels: {
|
|
1750
|
-
addGroup:
|
|
1751
|
-
collapseTitle:
|
|
1752
|
-
removeTitle:
|
|
1765
|
+
addGroup: A("list.addGroup", { defaultValue: "Add group field" }),
|
|
1766
|
+
collapseTitle: A("list.collapsedByDefault", { defaultValue: "Collapsed by default" }),
|
|
1767
|
+
removeTitle: A("list.removeGroup", { defaultValue: "Remove" })
|
|
1753
1768
|
},
|
|
1754
|
-
onChange: (e) =>
|
|
1769
|
+
onChange: (e) => _t(e)
|
|
1755
1770
|
})
|
|
1756
1771
|
})]
|
|
1757
1772
|
})
|
|
1758
1773
|
})]
|
|
1759
1774
|
}),
|
|
1760
1775
|
P.showSort && /* @__PURE__ */ L(S, {
|
|
1761
|
-
open:
|
|
1762
|
-
onOpenChange:
|
|
1776
|
+
open: Be,
|
|
1777
|
+
onOpenChange: Ve,
|
|
1763
1778
|
children: [/* @__PURE__ */ I(w, {
|
|
1764
1779
|
asChild: !0,
|
|
1765
|
-
children: /* @__PURE__ */ L(
|
|
1780
|
+
children: /* @__PURE__ */ L(d, {
|
|
1766
1781
|
variant: "ghost",
|
|
1767
1782
|
size: "sm",
|
|
1768
1783
|
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"),
|
|
1769
1784
|
children: [
|
|
1770
|
-
/* @__PURE__ */ I(
|
|
1785
|
+
/* @__PURE__ */ I(O, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1771
1786
|
/* @__PURE__ */ I("span", {
|
|
1772
1787
|
className: "hidden sm:inline",
|
|
1773
|
-
children:
|
|
1788
|
+
children: A("list.sort")
|
|
1774
1789
|
}),
|
|
1775
1790
|
z.length > 0 && /* @__PURE__ */ I("span", {
|
|
1776
1791
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
@@ -1787,13 +1802,13 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1787
1802
|
className: "flex items-center justify-between border-b pb-2",
|
|
1788
1803
|
children: /* @__PURE__ */ I("h4", {
|
|
1789
1804
|
className: "font-medium text-sm",
|
|
1790
|
-
children:
|
|
1805
|
+
children: A("list.sortRecords")
|
|
1791
1806
|
})
|
|
1792
|
-
}), /* @__PURE__ */ I(
|
|
1793
|
-
fields:
|
|
1807
|
+
}), /* @__PURE__ */ I(ne, {
|
|
1808
|
+
fields: dn,
|
|
1794
1809
|
value: z,
|
|
1795
1810
|
onChange: (e) => {
|
|
1796
|
-
B(e),
|
|
1811
|
+
B(e), s && s(e);
|
|
1797
1812
|
}
|
|
1798
1813
|
})]
|
|
1799
1814
|
})
|
|
@@ -1801,17 +1816,17 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1801
1816
|
}),
|
|
1802
1817
|
!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
1818
|
P.showColor && !P.compactToolbar && /* @__PURE__ */ L(S, {
|
|
1804
|
-
open:
|
|
1805
|
-
onOpenChange:
|
|
1819
|
+
open: St,
|
|
1820
|
+
onOpenChange: Ct,
|
|
1806
1821
|
children: [/* @__PURE__ */ I(w, {
|
|
1807
1822
|
asChild: !0,
|
|
1808
|
-
children: /* @__PURE__ */ L(
|
|
1823
|
+
children: /* @__PURE__ */ L(d, {
|
|
1809
1824
|
variant: "ghost",
|
|
1810
1825
|
size: "sm",
|
|
1811
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1812
|
-
children: [/* @__PURE__ */ I(
|
|
1826
|
+
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"),
|
|
1827
|
+
children: [/* @__PURE__ */ I(he, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1813
1828
|
className: "hidden sm:inline",
|
|
1814
|
-
children:
|
|
1829
|
+
children: A("list.color")
|
|
1815
1830
|
})]
|
|
1816
1831
|
})
|
|
1817
1832
|
}), /* @__PURE__ */ I(C, {
|
|
@@ -1823,36 +1838,36 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1823
1838
|
className: "flex items-center justify-between border-b pb-2",
|
|
1824
1839
|
children: [/* @__PURE__ */ I("h4", {
|
|
1825
1840
|
className: "font-medium text-sm",
|
|
1826
|
-
children:
|
|
1827
|
-
}),
|
|
1841
|
+
children: A("list.rowColor")
|
|
1842
|
+
}), Y && /* @__PURE__ */ I(d, {
|
|
1828
1843
|
variant: "ghost",
|
|
1829
1844
|
size: "sm",
|
|
1830
1845
|
className: "h-6 px-2 text-xs",
|
|
1831
|
-
onClick: () =>
|
|
1846
|
+
onClick: () => xt(void 0),
|
|
1832
1847
|
"data-testid": "clear-row-color",
|
|
1833
|
-
children:
|
|
1848
|
+
children: A("list.clear")
|
|
1834
1849
|
})]
|
|
1835
1850
|
}), /* @__PURE__ */ L("div", {
|
|
1836
1851
|
className: "space-y-2",
|
|
1837
1852
|
"data-testid": "color-field-list",
|
|
1838
1853
|
children: [/* @__PURE__ */ I("label", {
|
|
1839
1854
|
className: "text-xs text-muted-foreground",
|
|
1840
|
-
children:
|
|
1855
|
+
children: A("list.colorByField")
|
|
1841
1856
|
}), /* @__PURE__ */ L("select", {
|
|
1842
1857
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1843
|
-
value:
|
|
1858
|
+
value: Y?.field || "",
|
|
1844
1859
|
onChange: (e) => {
|
|
1845
1860
|
let t = e.target.value;
|
|
1846
|
-
|
|
1861
|
+
xt(t ? {
|
|
1847
1862
|
field: t,
|
|
1848
|
-
colors:
|
|
1863
|
+
colors: Y?.colors || {}
|
|
1849
1864
|
} : void 0);
|
|
1850
1865
|
},
|
|
1851
1866
|
"data-testid": "color-field-select",
|
|
1852
1867
|
children: [/* @__PURE__ */ I("option", {
|
|
1853
1868
|
value: "",
|
|
1854
|
-
children:
|
|
1855
|
-
}),
|
|
1869
|
+
children: A("list.none")
|
|
1870
|
+
}), pn.map((e) => /* @__PURE__ */ I("option", {
|
|
1856
1871
|
value: e.name,
|
|
1857
1872
|
children: e.label
|
|
1858
1873
|
}, e.name))]
|
|
@@ -1862,11 +1877,11 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1862
1877
|
})]
|
|
1863
1878
|
}),
|
|
1864
1879
|
P.showDensity && !P.compactToolbar && F !== "gallery" && (() => {
|
|
1865
|
-
let e = Q.mode === "compact" ?
|
|
1880
|
+
let e = Q.mode === "compact" ? Se : Q.mode === "comfortable" ? xe : be, t = Q.mode === "compact" ? A("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Q.mode === "comfortable" ? A("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : A("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${A("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = A("grid.toolbar.densityCycleHint", {
|
|
1866
1881
|
defaultValue: "{{label}} (click to cycle)",
|
|
1867
1882
|
label: n
|
|
1868
1883
|
});
|
|
1869
|
-
return /* @__PURE__ */ I(
|
|
1884
|
+
return /* @__PURE__ */ I(d, {
|
|
1870
1885
|
variant: "ghost",
|
|
1871
1886
|
size: "sm",
|
|
1872
1887
|
"aria-label": n,
|
|
@@ -1877,51 +1892,51 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1877
1892
|
});
|
|
1878
1893
|
})(),
|
|
1879
1894
|
P.showDensity && !P.compactToolbar && F === "gallery" && (() => {
|
|
1880
|
-
let e =
|
|
1895
|
+
let e = Kt === "small" ? Se : Kt === "medium" ? xe : be, t = Kt === "small" ? A("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Kt === "medium" ? A("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : A("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${A("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = A("grid.toolbar.densityCycleHint", {
|
|
1881
1896
|
defaultValue: "{{label}} (click to cycle)",
|
|
1882
1897
|
label: n
|
|
1883
1898
|
});
|
|
1884
|
-
return /* @__PURE__ */ I(
|
|
1899
|
+
return /* @__PURE__ */ I(d, {
|
|
1885
1900
|
variant: "ghost",
|
|
1886
1901
|
size: "sm",
|
|
1887
1902
|
"aria-label": n,
|
|
1888
|
-
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1889
|
-
onClick:
|
|
1903
|
+
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Kt !== "small" && "text-foreground font-medium"),
|
|
1904
|
+
onClick: Jt,
|
|
1890
1905
|
title: r,
|
|
1891
1906
|
children: /* @__PURE__ */ I(e, { className: "h-3.5 w-3.5" })
|
|
1892
1907
|
});
|
|
1893
1908
|
})(),
|
|
1894
|
-
P.compactToolbar && (P.showGroup || P.showColor || P.showDensity || P.showHideFields) && /* @__PURE__ */ I(
|
|
1895
|
-
t:
|
|
1896
|
-
allFields:
|
|
1909
|
+
P.compactToolbar && (P.showGroup || P.showColor || P.showDensity || P.showHideFields) && /* @__PURE__ */ I(Ge, {
|
|
1910
|
+
t: A,
|
|
1911
|
+
allFields: pn,
|
|
1897
1912
|
showGroup: P.showGroup,
|
|
1898
|
-
groupingConfig:
|
|
1899
|
-
setGroupingConfig:
|
|
1913
|
+
groupingConfig: J,
|
|
1914
|
+
setGroupingConfig: _t,
|
|
1900
1915
|
showColor: P.showColor,
|
|
1901
|
-
rowColorConfig:
|
|
1902
|
-
setRowColorConfig:
|
|
1916
|
+
rowColorConfig: Y,
|
|
1917
|
+
setRowColorConfig: xt,
|
|
1903
1918
|
showDensity: P.showDensity,
|
|
1904
1919
|
density: Q,
|
|
1905
1920
|
showHideFields: P.showHideFields,
|
|
1906
1921
|
hiddenFields: Z,
|
|
1907
|
-
updateHiddenFields:
|
|
1922
|
+
updateHiddenFields: jt,
|
|
1908
1923
|
showInlineEdit: F === "grid",
|
|
1909
|
-
inlineEdit:
|
|
1910
|
-
setInlineEdit:
|
|
1924
|
+
inlineEdit: Pt,
|
|
1925
|
+
setInlineEdit: It
|
|
1911
1926
|
}),
|
|
1912
|
-
(P.showColor || P.showDensity || P.compactToolbar) &&
|
|
1913
|
-
|
|
1914
|
-
open:
|
|
1915
|
-
onOpenChange:
|
|
1927
|
+
(P.showColor || P.showDensity || P.compactToolbar) && Wt && Ut && /* @__PURE__ */ I("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1928
|
+
Wt && Ut && /* @__PURE__ */ L(S, {
|
|
1929
|
+
open: Lt,
|
|
1930
|
+
onOpenChange: Rt,
|
|
1916
1931
|
children: [/* @__PURE__ */ I(w, {
|
|
1917
1932
|
asChild: !0,
|
|
1918
|
-
children: /* @__PURE__ */ L(
|
|
1933
|
+
children: /* @__PURE__ */ L(d, {
|
|
1919
1934
|
variant: "ghost",
|
|
1920
1935
|
size: "sm",
|
|
1921
1936
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1922
1937
|
children: [/* @__PURE__ */ I(se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1923
1938
|
className: "hidden sm:inline",
|
|
1924
|
-
children:
|
|
1939
|
+
children: A("list.export")
|
|
1925
1940
|
})]
|
|
1926
1941
|
})
|
|
1927
1942
|
}), /* @__PURE__ */ I(C, {
|
|
@@ -1929,60 +1944,64 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1929
1944
|
className: "w-48 p-2",
|
|
1930
1945
|
children: /* @__PURE__ */ L("div", {
|
|
1931
1946
|
className: "space-y-1",
|
|
1932
|
-
children: [(
|
|
1947
|
+
children: [(Wt.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ L(d, {
|
|
1933
1948
|
variant: "ghost",
|
|
1934
1949
|
size: "sm",
|
|
1935
1950
|
className: "w-full justify-start h-8 text-xs",
|
|
1936
|
-
disabled:
|
|
1937
|
-
onClick: () =>
|
|
1938
|
-
children: [
|
|
1939
|
-
}, e)),
|
|
1951
|
+
disabled: zt,
|
|
1952
|
+
onClick: () => fn(e),
|
|
1953
|
+
children: [zt ? /* @__PURE__ */ I(me, { className: "h-3.5 w-3.5 mr-2 animate-spin" }) : /* @__PURE__ */ I(se, { className: "h-3.5 w-3.5 mr-2" }), A("list.exportAs", { format: e.toUpperCase() })]
|
|
1954
|
+
}, e)), Vt && /* @__PURE__ */ I("div", {
|
|
1940
1955
|
className: "px-2 py-1 text-xs",
|
|
1941
1956
|
style: { color: "var(--destructive, #ef4444)" },
|
|
1942
1957
|
role: "alert",
|
|
1943
|
-
children:
|
|
1958
|
+
children: Vt
|
|
1944
1959
|
})]
|
|
1945
1960
|
})
|
|
1946
1961
|
})]
|
|
1947
1962
|
}),
|
|
1948
|
-
(M.sharing?.enabled || M.sharing?.type) && /* @__PURE__ */ L(
|
|
1963
|
+
(M.sharing?.enabled || M.sharing?.type) && /* @__PURE__ */ L(d, {
|
|
1949
1964
|
variant: "ghost",
|
|
1950
1965
|
size: "sm",
|
|
1951
1966
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1952
1967
|
title: `Sharing: ${M.sharing?.visibility || M.sharing?.type || "private"}`,
|
|
1953
1968
|
"data-testid": "share-button",
|
|
1954
|
-
children: [/* @__PURE__ */ I(
|
|
1969
|
+
children: [/* @__PURE__ */ I(we, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1955
1970
|
className: "hidden sm:inline",
|
|
1956
|
-
children:
|
|
1971
|
+
children: A("list.share")
|
|
1957
1972
|
})]
|
|
1958
1973
|
}),
|
|
1959
|
-
M.allowPrinting && /* @__PURE__ */ L(
|
|
1974
|
+
M.allowPrinting && /* @__PURE__ */ L(d, {
|
|
1960
1975
|
variant: "ghost",
|
|
1961
1976
|
size: "sm",
|
|
1962
1977
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1963
1978
|
onClick: () => window.print(),
|
|
1964
1979
|
"data-testid": "print-button",
|
|
1965
|
-
children: [/* @__PURE__ */ I(
|
|
1980
|
+
children: [/* @__PURE__ */ I(ve, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
1966
1981
|
className: "hidden sm:inline",
|
|
1967
|
-
children:
|
|
1982
|
+
children: A("list.print")
|
|
1968
1983
|
})]
|
|
1969
1984
|
}),
|
|
1970
1985
|
(() => {
|
|
1971
|
-
let e = M.allowPrinting || M.sharing?.enabled || M.sharing?.type ||
|
|
1986
|
+
let e = M.allowPrinting || M.sharing?.enabled || M.sharing?.type || Wt && Ut;
|
|
1972
1987
|
return P.showSearch && e ? /* @__PURE__ */ I("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }) : null;
|
|
1973
1988
|
})(),
|
|
1974
1989
|
P.showSearch && /* @__PURE__ */ L(S, {
|
|
1975
|
-
open:
|
|
1976
|
-
onOpenChange:
|
|
1990
|
+
open: Pe,
|
|
1991
|
+
onOpenChange: Le,
|
|
1977
1992
|
children: [/* @__PURE__ */ I(w, {
|
|
1978
1993
|
asChild: !0,
|
|
1979
|
-
children: /* @__PURE__ */
|
|
1994
|
+
children: /* @__PURE__ */ L(d, {
|
|
1980
1995
|
variant: "ghost",
|
|
1981
1996
|
size: "sm",
|
|
1982
|
-
className: E("hidden sm:inline-flex h-7
|
|
1997
|
+
className: E("hidden sm:inline-flex h-7 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", R ? "px-2 text-foreground font-medium" : "w-7 p-0"),
|
|
1983
1998
|
"data-testid": "search-icon-button",
|
|
1984
|
-
title:
|
|
1985
|
-
children: /* @__PURE__ */ I(
|
|
1999
|
+
title: R ? `${A("list.search")}: ${R}` : A("list.search"),
|
|
2000
|
+
children: [/* @__PURE__ */ I(Ce, { className: "h-3.5 w-3.5" }), R && /* @__PURE__ */ I("span", {
|
|
2001
|
+
className: "ml-1.5 max-w-[8rem] truncate text-[11px]",
|
|
2002
|
+
"data-testid": "search-active-keyword",
|
|
2003
|
+
children: R
|
|
2004
|
+
})]
|
|
1986
2005
|
})
|
|
1987
2006
|
}), /* @__PURE__ */ I(C, {
|
|
1988
2007
|
align: "end",
|
|
@@ -1991,34 +2010,34 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1991
2010
|
children: /* @__PURE__ */ L("div", {
|
|
1992
2011
|
className: "relative",
|
|
1993
2012
|
children: [
|
|
1994
|
-
/* @__PURE__ */ I(
|
|
1995
|
-
/* @__PURE__ */ I(
|
|
1996
|
-
placeholder:
|
|
2013
|
+
/* @__PURE__ */ I(Ce, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
2014
|
+
/* @__PURE__ */ I(b, {
|
|
2015
|
+
placeholder: A("list.search") + "...",
|
|
1997
2016
|
value: R,
|
|
1998
|
-
onChange: (e) =>
|
|
2017
|
+
onChange: (e) => sn(e.target.value),
|
|
1999
2018
|
className: "pl-7 h-8 text-xs",
|
|
2000
2019
|
autoFocus: !0
|
|
2001
2020
|
}),
|
|
2002
|
-
R && /* @__PURE__ */ I(
|
|
2021
|
+
R && /* @__PURE__ */ I(d, {
|
|
2003
2022
|
variant: "ghost",
|
|
2004
2023
|
size: "sm",
|
|
2005
2024
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
2006
|
-
onClick: () =>
|
|
2007
|
-
children: /* @__PURE__ */ I(
|
|
2025
|
+
onClick: () => sn(""),
|
|
2026
|
+
children: /* @__PURE__ */ I(De, { className: "h-3 w-3" })
|
|
2008
2027
|
})
|
|
2009
2028
|
]
|
|
2010
2029
|
})
|
|
2011
2030
|
})]
|
|
2012
2031
|
}),
|
|
2013
|
-
P.showAddRecord && P.addRecordPosition === "top" && /* @__PURE__ */ L(
|
|
2032
|
+
P.showAddRecord && P.addRecordPosition === "top" && /* @__PURE__ */ L(d, {
|
|
2014
2033
|
variant: "ghost",
|
|
2015
2034
|
size: "sm",
|
|
2016
2035
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
2017
2036
|
"data-testid": "add-record-button",
|
|
2018
2037
|
onClick: () => D.onAddRecord?.(),
|
|
2019
|
-
children: [/* @__PURE__ */ I(
|
|
2038
|
+
children: [/* @__PURE__ */ I(_e, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
2020
2039
|
className: "hidden sm:inline",
|
|
2021
|
-
children:
|
|
2040
|
+
children: A("list.addRecord")
|
|
2022
2041
|
})]
|
|
2023
2042
|
})
|
|
2024
2043
|
]
|
|
@@ -2026,21 +2045,21 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2026
2045
|
}),
|
|
2027
2046
|
/* @__PURE__ */ L("div", {
|
|
2028
2047
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
2029
|
-
children: [/* @__PURE__ */ I(
|
|
2048
|
+
children: [/* @__PURE__ */ I(T, { active: W && U.length > 0 }), Xe && U.length === 0 ? /* @__PURE__ */ I(m, {
|
|
2030
2049
|
"data-testid": "list-error-state",
|
|
2031
2050
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
2032
|
-
icon: /* @__PURE__ */ I(
|
|
2051
|
+
icon: /* @__PURE__ */ I(re, { className: "h-12 w-12 text-destructive/60" }),
|
|
2033
2052
|
iconWrapperClassName: "mb-3",
|
|
2034
|
-
title:
|
|
2035
|
-
description:
|
|
2036
|
-
action: /* @__PURE__ */ L(
|
|
2053
|
+
title: A("list.loadErrorTitle"),
|
|
2054
|
+
description: A("list.loadErrorMessage"),
|
|
2055
|
+
action: /* @__PURE__ */ L(d, {
|
|
2037
2056
|
variant: "outline",
|
|
2038
2057
|
size: "sm",
|
|
2039
2058
|
"data-testid": "list-error-retry",
|
|
2040
|
-
onClick: () =>
|
|
2041
|
-
children: [/* @__PURE__ */ I(
|
|
2059
|
+
onClick: () => st((e) => e + 1),
|
|
2060
|
+
children: [/* @__PURE__ */ I(ye, { className: "h-4 w-4 mr-1.5" }), A("list.retry")]
|
|
2042
2061
|
})
|
|
2043
|
-
}) :
|
|
2062
|
+
}) : W && U.length === 0 ? /* @__PURE__ */ L("div", {
|
|
2044
2063
|
className: "flex flex-col h-full min-h-[200px] p-4 gap-2",
|
|
2045
2064
|
"data-testid": "list-loading",
|
|
2046
2065
|
role: "status",
|
|
@@ -2048,7 +2067,7 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2048
2067
|
"aria-busy": "true",
|
|
2049
2068
|
children: [/* @__PURE__ */ I("span", {
|
|
2050
2069
|
className: "sr-only",
|
|
2051
|
-
children:
|
|
2070
|
+
children: A("list.loading")
|
|
2052
2071
|
}), [
|
|
2053
2072
|
0,
|
|
2054
2073
|
1,
|
|
@@ -2060,56 +2079,56 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2060
2079
|
className: "h-9 rounded bg-muted/60 animate-pulse",
|
|
2061
2080
|
style: { opacity: Math.max(.25, 1 - e * .12) }
|
|
2062
2081
|
}, e))]
|
|
2063
|
-
}) : !
|
|
2064
|
-
let e = M.emptyState?.icon, t = e ?
|
|
2065
|
-
return /* @__PURE__ */ I(
|
|
2082
|
+
}) : !W && U.length === 0 && F === "grid" ? (() => {
|
|
2083
|
+
let e = M.emptyState?.icon, t = e ? Oe[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? fe : fe, n = !!(R && R.trim()) || Array.isArray(X) && X.length > 0 || Array.isArray(V?.conditions) && V.conditions.length > 0, r = (typeof M.emptyState?.title == "string" ? M.emptyState.title : void 0) ?? A(n ? "list.noMatches" : "list.firstRunTitle"), i = (typeof M.emptyState?.message == "string" ? M.emptyState.message : void 0) ?? A(n ? "list.noMatchesMessage" : "list.firstRunMessage");
|
|
2084
|
+
return /* @__PURE__ */ I(m, {
|
|
2066
2085
|
"data-testid": "empty-state",
|
|
2067
2086
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
2068
2087
|
icon: /* @__PURE__ */ I(t, { className: "h-12 w-12 text-muted-foreground/50" }),
|
|
2069
2088
|
iconWrapperClassName: "mb-3",
|
|
2070
2089
|
title: r,
|
|
2071
2090
|
description: i,
|
|
2072
|
-
action: P.showAddRecord ? /* @__PURE__ */ L(
|
|
2091
|
+
action: P.showAddRecord ? /* @__PURE__ */ L(d, {
|
|
2073
2092
|
variant: "default",
|
|
2074
2093
|
size: "sm",
|
|
2075
2094
|
"data-testid": "empty-state-add-record",
|
|
2076
2095
|
onClick: () => D.onAddRecord?.(),
|
|
2077
|
-
children: [/* @__PURE__ */ I(
|
|
2096
|
+
children: [/* @__PURE__ */ I(_e, { className: "h-4 w-4 mr-1.5" }), A("list.addRecord")]
|
|
2078
2097
|
}) : void 0
|
|
2079
2098
|
});
|
|
2080
|
-
})() : /* @__PURE__ */ I(
|
|
2081
|
-
schema:
|
|
2099
|
+
})() : /* @__PURE__ */ I(Me, {
|
|
2100
|
+
schema: ln,
|
|
2082
2101
|
...D,
|
|
2083
|
-
data:
|
|
2084
|
-
loading:
|
|
2085
|
-
onRowSelect:
|
|
2086
|
-
...F === "grid" && !
|
|
2102
|
+
...tn ? {} : { data: U },
|
|
2103
|
+
loading: W,
|
|
2104
|
+
onRowSelect: Tt,
|
|
2105
|
+
...F === "grid" && !J?.fields?.length && mt != null ? {
|
|
2087
2106
|
manualPagination: !0,
|
|
2088
|
-
rowCount:
|
|
2089
|
-
page:
|
|
2090
|
-
pageSize:
|
|
2091
|
-
onPageChange: (e) =>
|
|
2107
|
+
rowCount: mt,
|
|
2108
|
+
page: ft,
|
|
2109
|
+
pageSize: q,
|
|
2110
|
+
onPageChange: (e) => pt(e),
|
|
2092
2111
|
onPageSizeChange: (e) => {
|
|
2093
|
-
|
|
2112
|
+
dt(e), pt(1);
|
|
2094
2113
|
}
|
|
2095
2114
|
} : {}
|
|
2096
2115
|
})]
|
|
2097
2116
|
}, F),
|
|
2098
2117
|
P.showAddRecord && P.addRecordPosition === "bottom" && /* @__PURE__ */ I("div", {
|
|
2099
2118
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
2100
|
-
children: /* @__PURE__ */ L(
|
|
2119
|
+
children: /* @__PURE__ */ L(d, {
|
|
2101
2120
|
variant: "ghost",
|
|
2102
2121
|
size: "sm",
|
|
2103
2122
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
2104
2123
|
"data-testid": "add-record-button",
|
|
2105
2124
|
onClick: () => D.onAddRecord?.(),
|
|
2106
|
-
children: [/* @__PURE__ */ I(
|
|
2125
|
+
children: [/* @__PURE__ */ I(_e, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
2107
2126
|
className: "hidden sm:inline",
|
|
2108
|
-
children:
|
|
2127
|
+
children: A("list.addRecord")
|
|
2109
2128
|
})]
|
|
2110
2129
|
})
|
|
2111
2130
|
}),
|
|
2112
|
-
M.bulkActions && M.bulkActions.length > 0 &&
|
|
2131
|
+
M.bulkActions && M.bulkActions.length > 0 && wt.length > 0 && F !== "grid" && /* @__PURE__ */ L("div", {
|
|
2113
2132
|
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",
|
|
2114
2133
|
role: "region",
|
|
2115
2134
|
"aria-label": "Bulk actions",
|
|
@@ -2119,57 +2138,57 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2119
2138
|
/* @__PURE__ */ L("span", {
|
|
2120
2139
|
className: "font-medium",
|
|
2121
2140
|
children: [
|
|
2122
|
-
|
|
2141
|
+
wt.length,
|
|
2123
2142
|
" ",
|
|
2124
|
-
|
|
2143
|
+
wt.length === 1 ? "item" : "items",
|
|
2125
2144
|
" selected"
|
|
2126
2145
|
]
|
|
2127
2146
|
}),
|
|
2128
2147
|
/* @__PURE__ */ I("div", {
|
|
2129
2148
|
className: "flex items-center gap-1.5 ml-3",
|
|
2130
2149
|
children: M.bulkActions.map((e) => {
|
|
2131
|
-
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ?
|
|
2132
|
-
return /* @__PURE__ */ L(
|
|
2150
|
+
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ? Ee : null;
|
|
2151
|
+
return /* @__PURE__ */ L(d, {
|
|
2133
2152
|
variant: n ? "destructive" : "outline",
|
|
2134
2153
|
size: "sm",
|
|
2135
2154
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
2136
|
-
onClick: () => D.onBulkAction?.(e,
|
|
2155
|
+
onClick: () => D.onBulkAction?.(e, wt),
|
|
2137
2156
|
"data-testid": `bulk-action-${e}`,
|
|
2138
|
-
children: [r && /* @__PURE__ */ I(r, { className: "h-3 w-3" }),
|
|
2157
|
+
children: [r && /* @__PURE__ */ I(r, { className: "h-3 w-3" }), pe(e)]
|
|
2139
2158
|
}, e);
|
|
2140
2159
|
})
|
|
2141
2160
|
}),
|
|
2142
|
-
/* @__PURE__ */ L(
|
|
2161
|
+
/* @__PURE__ */ L(d, {
|
|
2143
2162
|
variant: "ghost",
|
|
2144
2163
|
size: "sm",
|
|
2145
2164
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
2146
|
-
onClick: () =>
|
|
2147
|
-
children: [/* @__PURE__ */ I(
|
|
2165
|
+
onClick: () => Tt([]),
|
|
2166
|
+
children: [/* @__PURE__ */ I(De, { className: "h-3 w-3" }), "Clear"]
|
|
2148
2167
|
})
|
|
2149
2168
|
]
|
|
2150
2169
|
}),
|
|
2151
|
-
!
|
|
2170
|
+
!W && U.length > 0 && M.showRecordCount !== !1 && /* @__PURE__ */ L("div", {
|
|
2152
2171
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
2153
2172
|
"data-testid": "record-count-bar",
|
|
2154
2173
|
children: [
|
|
2155
2174
|
/* @__PURE__ */ I("span", {
|
|
2156
2175
|
className: "font-medium text-foreground/80",
|
|
2157
|
-
children:
|
|
2176
|
+
children: U.length === 1 ? A("list.recordCountOne", { count: U.length }) : A("list.recordCount", { count: U.length })
|
|
2158
2177
|
}),
|
|
2159
|
-
|
|
2178
|
+
ct && /* @__PURE__ */ I("span", {
|
|
2160
2179
|
className: "text-amber-600",
|
|
2161
2180
|
"data-testid": "data-limit-warning",
|
|
2162
|
-
children:
|
|
2181
|
+
children: A("list.dataLimitReached", { limit: q })
|
|
2163
2182
|
}),
|
|
2164
2183
|
F !== "grid" && M.pagination?.pageSizeOptions && M.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ L("div", {
|
|
2165
2184
|
className: "ml-auto flex items-center gap-2",
|
|
2166
|
-
children: [/* @__PURE__ */ I("span", { children:
|
|
2185
|
+
children: [/* @__PURE__ */ I("span", { children: A("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ I("select", {
|
|
2167
2186
|
"data-testid": "page-size-selector",
|
|
2168
2187
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
2169
|
-
value: String(
|
|
2188
|
+
value: String(q),
|
|
2170
2189
|
onChange: (e) => {
|
|
2171
2190
|
let t = Number(e.target.value);
|
|
2172
|
-
|
|
2191
|
+
dt(t), D.onPageSizeChange && D.onPageSizeChange(t);
|
|
2173
2192
|
},
|
|
2174
2193
|
children: M.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ I("option", {
|
|
2175
2194
|
value: String(e),
|
|
@@ -2179,8 +2198,8 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2179
2198
|
})
|
|
2180
2199
|
]
|
|
2181
2200
|
}),
|
|
2182
|
-
|
|
2183
|
-
...
|
|
2201
|
+
cn.isOverlay && /* @__PURE__ */ I(te, {
|
|
2202
|
+
...cn,
|
|
2184
2203
|
title: M.label ? `${M.label} Detail` : M.objectName ? `${M.objectName.charAt(0).toUpperCase() + M.objectName.slice(1)} Detail` : "Record Detail",
|
|
2185
2204
|
children: (e) => /* @__PURE__ */ I("div", {
|
|
2186
2205
|
className: "space-y-3",
|
|
@@ -2199,24 +2218,24 @@ var rt = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2199
2218
|
]
|
|
2200
2219
|
});
|
|
2201
2220
|
});
|
|
2202
|
-
|
|
2221
|
+
K.displayName = "ListView";
|
|
2203
2222
|
//#endregion
|
|
2204
2223
|
//#region src/ObjectGallery.tsx
|
|
2205
|
-
var
|
|
2224
|
+
var ot = {
|
|
2206
2225
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
2207
2226
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
2208
2227
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
2209
|
-
},
|
|
2228
|
+
}, st = {
|
|
2210
2229
|
small: "aspect-square",
|
|
2211
2230
|
medium: "aspect-[4/3]",
|
|
2212
2231
|
large: "aspect-[16/10]"
|
|
2213
|
-
},
|
|
2232
|
+
}, ct = /* @__PURE__ */ new Set([
|
|
2214
2233
|
"number",
|
|
2215
2234
|
"currency",
|
|
2216
2235
|
"percent",
|
|
2217
2236
|
"integer",
|
|
2218
2237
|
"decimal"
|
|
2219
|
-
]),
|
|
2238
|
+
]), lt = [
|
|
2220
2239
|
{
|
|
2221
2240
|
bg: "from-indigo-500/15 via-indigo-500/5 to-purple-500/10",
|
|
2222
2241
|
ring: "ring-indigo-500/15",
|
|
@@ -2248,13 +2267,13 @@ var it = {
|
|
|
2248
2267
|
text: "text-violet-600/70 dark:text-violet-300/70"
|
|
2249
2268
|
}
|
|
2250
2269
|
];
|
|
2251
|
-
function
|
|
2270
|
+
function ut(e) {
|
|
2252
2271
|
let t = 5381;
|
|
2253
2272
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n);
|
|
2254
|
-
return
|
|
2273
|
+
return lt[Math.abs(t) % lt.length];
|
|
2255
2274
|
}
|
|
2256
|
-
var
|
|
2257
|
-
let [o, s] =
|
|
2275
|
+
var dt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, hidden: a }) => {
|
|
2276
|
+
let [o, s] = u(!1), c = !!e && !o;
|
|
2258
2277
|
return /* @__PURE__ */ I("div", {
|
|
2259
2278
|
className: E("w-full overflow-hidden relative", r),
|
|
2260
2279
|
hidden: a,
|
|
@@ -2281,8 +2300,8 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2281
2300
|
})
|
|
2282
2301
|
})
|
|
2283
2302
|
});
|
|
2284
|
-
},
|
|
2285
|
-
let [r, i] =
|
|
2303
|
+
}, q = ({ imageUrl: e, title: t, placeholder: n }) => {
|
|
2304
|
+
let [r, i] = u(!1), a = !!e && !r;
|
|
2286
2305
|
return /* @__PURE__ */ I("div", {
|
|
2287
2306
|
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),
|
|
2288
2307
|
children: a ? /* @__PURE__ */ I("img", {
|
|
@@ -2296,12 +2315,12 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2296
2315
|
children: t[0]?.toUpperCase()
|
|
2297
2316
|
})
|
|
2298
2317
|
});
|
|
2299
|
-
},
|
|
2300
|
-
let { schema: n } = e,
|
|
2318
|
+
}, ft = (e) => {
|
|
2319
|
+
let { schema: n } = e, r = s(Ne), a = e.dataSource || r?.dataSource, d = Pe(n.bind), [m, h] = u([]), [g, _] = u(!1), [v, ee] = u(null), y = Ie({
|
|
2301
2320
|
navigation: n.navigation,
|
|
2302
2321
|
objectName: n.objectName,
|
|
2303
2322
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
2304
|
-
}), b = n.gallery,
|
|
2323
|
+
}), b = n.gallery, x = b?.coverField ?? n.imageField ?? "image", S = b?.coverFit ?? "cover", C = b?.cardSize ?? "medium", w = b?.titleField ?? n.titleField, T = b?.visibleFields, { fieldLabel: ne, fieldOptionLabel: D } = Le(), re = o((e) => {
|
|
2305
2324
|
let t = v?.fields?.[e], r = { name: e };
|
|
2306
2325
|
if (t) {
|
|
2307
2326
|
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);
|
|
@@ -2310,27 +2329,27 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2310
2329
|
}
|
|
2311
2330
|
if (n.objectName) {
|
|
2312
2331
|
let t = String(r.label ?? e);
|
|
2313
|
-
r.label =
|
|
2332
|
+
r.label = ne(n.objectName, e, t);
|
|
2314
2333
|
}
|
|
2315
2334
|
return n.objectName && Array.isArray(r.options) && (r.options = r.options.map((t) => {
|
|
2316
2335
|
let r = String(t?.value ?? t), i = String(t?.label ?? r);
|
|
2317
2336
|
return {
|
|
2318
2337
|
...t,
|
|
2319
2338
|
value: r,
|
|
2320
|
-
label:
|
|
2339
|
+
label: D(n.objectName, e, r, i)
|
|
2321
2340
|
};
|
|
2322
2341
|
})), r;
|
|
2323
2342
|
}, [
|
|
2324
2343
|
v,
|
|
2325
2344
|
n.objectName,
|
|
2326
|
-
|
|
2327
|
-
|
|
2345
|
+
ne,
|
|
2346
|
+
D
|
|
2328
2347
|
]);
|
|
2329
|
-
|
|
2348
|
+
c(() => {
|
|
2330
2349
|
let e = !0;
|
|
2331
2350
|
return (async () => {
|
|
2332
|
-
if (!(!
|
|
2333
|
-
let t = await
|
|
2351
|
+
if (!(!a || typeof a.getObjectSchema != "function" || !n.objectName)) try {
|
|
2352
|
+
let t = await a.getObjectSchema(n.objectName);
|
|
2334
2353
|
e && ee(t);
|
|
2335
2354
|
} catch (e) {
|
|
2336
2355
|
console.warn("Failed to fetch object def for ObjectGallery", e);
|
|
@@ -2338,26 +2357,26 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2338
2357
|
})(), () => {
|
|
2339
2358
|
e = !1;
|
|
2340
2359
|
};
|
|
2341
|
-
}, [n.objectName,
|
|
2360
|
+
}, [n.objectName, a]), c(() => {
|
|
2342
2361
|
let r = !0;
|
|
2343
2362
|
if (e.data && Array.isArray(e.data)) {
|
|
2344
2363
|
h(e.data);
|
|
2345
2364
|
return;
|
|
2346
2365
|
}
|
|
2347
|
-
return n.objectName && !
|
|
2348
|
-
if (!(!
|
|
2366
|
+
return n.objectName && !d && !n.data && !e.data && (async () => {
|
|
2367
|
+
if (!(!a || typeof a.find != "function" || !n.objectName)) {
|
|
2349
2368
|
r && _(!0);
|
|
2350
2369
|
try {
|
|
2351
|
-
let e = t(v?.fields), i = await
|
|
2370
|
+
let e = t(v?.fields), i = await a.find(n.objectName, {
|
|
2352
2371
|
$filter: n.filter,
|
|
2353
2372
|
...e.length > 0 ? { $expand: e } : {}
|
|
2354
|
-
}),
|
|
2355
|
-
if (Array.isArray(i))
|
|
2373
|
+
}), o = [];
|
|
2374
|
+
if (Array.isArray(i)) o = i;
|
|
2356
2375
|
else if (i && typeof i == "object") {
|
|
2357
2376
|
let e = i;
|
|
2358
|
-
Array.isArray(e.records) ?
|
|
2377
|
+
Array.isArray(e.records) ? o = e.records : Array.isArray(e.data) && (o = e.data);
|
|
2359
2378
|
}
|
|
2360
|
-
r && h(
|
|
2379
|
+
r && h(o);
|
|
2361
2380
|
} catch (e) {
|
|
2362
2381
|
console.error("[ObjectGallery] Fetch error:", e);
|
|
2363
2382
|
} finally {
|
|
@@ -2369,20 +2388,20 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2369
2388
|
};
|
|
2370
2389
|
}, [
|
|
2371
2390
|
n.objectName,
|
|
2372
|
-
|
|
2373
|
-
|
|
2391
|
+
a,
|
|
2392
|
+
d,
|
|
2374
2393
|
n.data,
|
|
2375
2394
|
n.filter,
|
|
2376
2395
|
e.data,
|
|
2377
2396
|
v
|
|
2378
2397
|
]);
|
|
2379
|
-
let O = e.data ||
|
|
2380
|
-
|
|
2398
|
+
let O = e.data || d || n.data || m || [], ie = l(() => O.some((e) => typeof e[x] == "string" && !!e[x]), [O, x]), k = n.grouping?.fields, A = !!(k && k.length > 0), [ae, se] = u({}), ce = l(() => k ? k.some((e) => e.collapsed) : !1, [k]), le = o((e) => {
|
|
2399
|
+
se((t) => ({
|
|
2381
2400
|
...t,
|
|
2382
|
-
[e]: t[e] === void 0 ? !
|
|
2401
|
+
[e]: t[e] === void 0 ? !ce : !t[e]
|
|
2383
2402
|
}));
|
|
2384
|
-
}, [
|
|
2385
|
-
if (!
|
|
2403
|
+
}, [ce]), ue = l(() => {
|
|
2404
|
+
if (!A || !k) return [];
|
|
2386
2405
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
2387
2406
|
for (let n of O) {
|
|
2388
2407
|
let r = k.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
@@ -2406,7 +2425,7 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2406
2425
|
});
|
|
2407
2426
|
return n === "desc" ? -r : r;
|
|
2408
2427
|
}), t.map((t) => {
|
|
2409
|
-
let n = e.get(t), r = t in
|
|
2428
|
+
let n = e.get(t), r = t in ae ? ae[t] : ce;
|
|
2410
2429
|
return {
|
|
2411
2430
|
key: t,
|
|
2412
2431
|
label: n.label,
|
|
@@ -2417,9 +2436,9 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2417
2436
|
}, [
|
|
2418
2437
|
O,
|
|
2419
2438
|
k,
|
|
2439
|
+
A,
|
|
2420
2440
|
ae,
|
|
2421
|
-
|
|
2422
|
-
j
|
|
2441
|
+
ce
|
|
2423
2442
|
]);
|
|
2424
2443
|
if (g && !O.length) return /* @__PURE__ */ I("div", {
|
|
2425
2444
|
className: "p-4 text-sm text-muted-foreground",
|
|
@@ -2429,12 +2448,12 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2429
2448
|
className: "p-4 text-sm text-muted-foreground",
|
|
2430
2449
|
children: "No items to display"
|
|
2431
2450
|
});
|
|
2432
|
-
let
|
|
2451
|
+
let de = (e) => !T || T.length === 0 ? null : /* @__PURE__ */ I("div", {
|
|
2433
2452
|
className: "mt-1.5 space-y-1",
|
|
2434
2453
|
children: T.map((t) => {
|
|
2435
2454
|
let n = e[t];
|
|
2436
2455
|
if (n == null || n === "") return null;
|
|
2437
|
-
let r = re(t), i =
|
|
2456
|
+
let r = re(t), i = Ve(r) || r.type || "text", a = Be(i), o = r?.label && String(r.label).trim() ? String(r.label) : void 0, s = o != null && ct.has(i);
|
|
2438
2457
|
return /* @__PURE__ */ L("div", {
|
|
2439
2458
|
className: E("text-xs text-muted-foreground truncate [&_*]:!text-xs", s && "flex items-baseline gap-1.5"),
|
|
2440
2459
|
onClick: (e) => {
|
|
@@ -2449,20 +2468,20 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2449
2468
|
})]
|
|
2450
2469
|
}, t);
|
|
2451
2470
|
})
|
|
2452
|
-
}),
|
|
2453
|
-
let a = t.id ?? t._id ??
|
|
2454
|
-
return ie &&
|
|
2471
|
+
}), M = (t, r) => {
|
|
2472
|
+
let a = t.id ?? t._id ?? r, o = (w != null && t[w] != null && t[w] !== "" ? String(t[w]) : void 0) ?? i(v, t), s = t[x], c = ut(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");
|
|
2473
|
+
return ie && S === "contain" ? /* @__PURE__ */ L(f, {
|
|
2455
2474
|
role: "listitem",
|
|
2456
2475
|
className: l,
|
|
2457
2476
|
onClick: (e) => y.handleClick(t, e),
|
|
2458
2477
|
children: [/* @__PURE__ */ I("div", {
|
|
2459
2478
|
"aria-hidden": !0,
|
|
2460
2479
|
className: E("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", c.bg)
|
|
2461
|
-
}), /* @__PURE__ */ I(
|
|
2480
|
+
}), /* @__PURE__ */ I(p, {
|
|
2462
2481
|
className: "p-4",
|
|
2463
2482
|
children: /* @__PURE__ */ L("div", {
|
|
2464
2483
|
className: "flex items-start gap-3",
|
|
2465
|
-
children: [/* @__PURE__ */ I(
|
|
2484
|
+
children: [/* @__PURE__ */ I(q, {
|
|
2466
2485
|
imageUrl: s,
|
|
2467
2486
|
title: o,
|
|
2468
2487
|
placeholder: c
|
|
@@ -2472,11 +2491,11 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2472
2491
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2473
2492
|
title: o,
|
|
2474
2493
|
children: o
|
|
2475
|
-
}),
|
|
2494
|
+
}), de(t)]
|
|
2476
2495
|
})]
|
|
2477
2496
|
})
|
|
2478
2497
|
})]
|
|
2479
|
-
}, a) : /* @__PURE__ */ L(
|
|
2498
|
+
}, a) : /* @__PURE__ */ L(f, {
|
|
2480
2499
|
role: "listitem",
|
|
2481
2500
|
className: l,
|
|
2482
2501
|
onClick: (e) => y.handleClick(t, e),
|
|
@@ -2485,48 +2504,48 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2485
2504
|
"aria-hidden": !0,
|
|
2486
2505
|
className: E("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", c.bg)
|
|
2487
2506
|
}),
|
|
2488
|
-
/* @__PURE__ */ I(
|
|
2507
|
+
/* @__PURE__ */ I(dt, {
|
|
2489
2508
|
imageUrl: s,
|
|
2490
2509
|
title: o,
|
|
2491
|
-
coverFit:
|
|
2492
|
-
aspectClass:
|
|
2510
|
+
coverFit: S,
|
|
2511
|
+
aspectClass: st[C],
|
|
2493
2512
|
placeholder: c,
|
|
2494
2513
|
hidden: !ie
|
|
2495
2514
|
}),
|
|
2496
|
-
/* @__PURE__ */ L(
|
|
2515
|
+
/* @__PURE__ */ L(p, {
|
|
2497
2516
|
className: E("p-3", ie && "border-t border-border/60"),
|
|
2498
2517
|
children: [/* @__PURE__ */ I("h3", {
|
|
2499
2518
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2500
2519
|
title: o,
|
|
2501
2520
|
children: o
|
|
2502
|
-
}),
|
|
2521
|
+
}), de(t)]
|
|
2503
2522
|
})
|
|
2504
2523
|
]
|
|
2505
2524
|
}, a);
|
|
2506
|
-
},
|
|
2507
|
-
className: E("grid gap-4 p-4 auto-rows-min content-start",
|
|
2525
|
+
}, fe = (e) => /* @__PURE__ */ I("div", {
|
|
2526
|
+
className: E("grid gap-4 p-4 auto-rows-min content-start", ot[C], n.className),
|
|
2508
2527
|
role: "list",
|
|
2509
|
-
children: e.map((e, t) =>
|
|
2528
|
+
children: e.map((e, t) => M(e, t))
|
|
2510
2529
|
});
|
|
2511
|
-
return /* @__PURE__ */ L(
|
|
2530
|
+
return /* @__PURE__ */ L(ke, { children: [A ? /* @__PURE__ */ I("div", {
|
|
2512
2531
|
className: "space-y-2",
|
|
2513
|
-
children:
|
|
2532
|
+
children: ue.map((e) => /* @__PURE__ */ L("div", {
|
|
2514
2533
|
className: "border rounded-md",
|
|
2515
2534
|
children: [/* @__PURE__ */ L("button", {
|
|
2516
2535
|
type: "button",
|
|
2517
2536
|
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",
|
|
2518
|
-
onClick: () =>
|
|
2537
|
+
onClick: () => le(e.key),
|
|
2519
2538
|
children: [
|
|
2520
|
-
e.collapsed ? /* @__PURE__ */ I(oe, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ I(
|
|
2539
|
+
e.collapsed ? /* @__PURE__ */ I(oe, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ I(j, { className: "h-4 w-4 shrink-0" }),
|
|
2521
2540
|
/* @__PURE__ */ I("span", { children: e.label }),
|
|
2522
2541
|
/* @__PURE__ */ I("span", {
|
|
2523
2542
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2524
2543
|
children: e.items.length
|
|
2525
2544
|
})
|
|
2526
2545
|
]
|
|
2527
|
-
}), !e.collapsed &&
|
|
2546
|
+
}), !e.collapsed && fe(e.items)]
|
|
2528
2547
|
}, e.key))
|
|
2529
|
-
}) :
|
|
2548
|
+
}) : fe(O), y.isOverlay && /* @__PURE__ */ I(te, {
|
|
2530
2549
|
...y,
|
|
2531
2550
|
title: "Gallery Item",
|
|
2532
2551
|
children: (e) => /* @__PURE__ */ I("div", {
|
|
@@ -2544,53 +2563,53 @@ var J = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2544
2563
|
})
|
|
2545
2564
|
})] });
|
|
2546
2565
|
};
|
|
2547
|
-
e.register("object-gallery",
|
|
2566
|
+
e.register("object-gallery", ft, {
|
|
2548
2567
|
namespace: "plugin-list",
|
|
2549
2568
|
label: "Gallery View",
|
|
2550
2569
|
category: "view"
|
|
2551
2570
|
});
|
|
2552
2571
|
//#endregion
|
|
2553
2572
|
//#region src/components/TabBar.tsx
|
|
2554
|
-
function
|
|
2555
|
-
return e ?
|
|
2573
|
+
function pt(e) {
|
|
2574
|
+
return e ? Oe[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
2556
2575
|
}
|
|
2557
|
-
function
|
|
2576
|
+
function mt(e) {
|
|
2558
2577
|
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
2559
2578
|
}
|
|
2560
|
-
var
|
|
2561
|
-
let
|
|
2579
|
+
var ht = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
2580
|
+
let i = a.useMemo(() => mt(e), [e]), o = a.useMemo(() => i.find((e) => e.isDefault)?.name ?? i[0]?.name, [i]), [s, c] = a.useState(o), l = t ?? s, u = a.useCallback((e) => {
|
|
2562
2581
|
c(e.name), n?.(e);
|
|
2563
2582
|
}, [n]);
|
|
2564
|
-
return
|
|
2583
|
+
return i.length === 0 ? null : /* @__PURE__ */ I("div", {
|
|
2565
2584
|
className: E("px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", r),
|
|
2566
2585
|
"data-testid": "view-tabs",
|
|
2567
2586
|
role: "tablist",
|
|
2568
|
-
children:
|
|
2569
|
-
let t =
|
|
2570
|
-
return /* @__PURE__ */ L(
|
|
2587
|
+
children: i.map((e) => {
|
|
2588
|
+
let t = pt(e.icon), n = l === e.name;
|
|
2589
|
+
return /* @__PURE__ */ L(d, {
|
|
2571
2590
|
variant: "ghost",
|
|
2572
2591
|
size: "sm",
|
|
2573
2592
|
className: E("h-7 px-2.5 py-1 text-xs rounded-md transition-colors duration-150", n ? "font-medium text-foreground bg-muted" : "text-muted-foreground hover:text-foreground hover:bg-transparent"),
|
|
2574
2593
|
"data-testid": `view-tab-${e.name}`,
|
|
2575
2594
|
role: "tab",
|
|
2576
2595
|
"aria-selected": n,
|
|
2577
|
-
onClick: () =>
|
|
2596
|
+
onClick: () => u(e),
|
|
2578
2597
|
children: [t && /* @__PURE__ */ I(t, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
2579
2598
|
}, e.name);
|
|
2580
2599
|
})
|
|
2581
2600
|
});
|
|
2582
|
-
},
|
|
2583
|
-
let
|
|
2601
|
+
}, gt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
2602
|
+
let i = a.useMemo(() => mt(e), [e]), o = a.useMemo(() => i.find((e) => e.isDefault)?.name ?? i[0]?.name, [i]), [s, c] = a.useState(o), l = t ?? s, u = a.useMemo(() => i.find((e) => e.name === l) ?? i[0], [i, l]), f = a.useCallback((e) => {
|
|
2584
2603
|
c(e.name), n?.(e);
|
|
2585
2604
|
}, [n]);
|
|
2586
|
-
if (
|
|
2587
|
-
let p =
|
|
2605
|
+
if (i.length === 0) return null;
|
|
2606
|
+
let p = pt(u?.icon);
|
|
2588
2607
|
return /* @__PURE__ */ I("div", {
|
|
2589
2608
|
className: E("px-2 py-1", r),
|
|
2590
2609
|
"data-testid": "view-tabs-select",
|
|
2591
|
-
children: /* @__PURE__ */ L(
|
|
2610
|
+
children: /* @__PURE__ */ L(h, { children: [/* @__PURE__ */ I(v, {
|
|
2592
2611
|
asChild: !0,
|
|
2593
|
-
children: /* @__PURE__ */ L(
|
|
2612
|
+
children: /* @__PURE__ */ L(d, {
|
|
2594
2613
|
variant: "ghost",
|
|
2595
2614
|
size: "sm",
|
|
2596
2615
|
className: "h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate",
|
|
@@ -2599,17 +2618,17 @@ var pt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
2599
2618
|
p && /* @__PURE__ */ I(p, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2600
2619
|
/* @__PURE__ */ I("span", {
|
|
2601
2620
|
className: "truncate",
|
|
2602
|
-
children:
|
|
2621
|
+
children: u?.label ?? ""
|
|
2603
2622
|
}),
|
|
2604
|
-
/* @__PURE__ */ I(
|
|
2623
|
+
/* @__PURE__ */ I(j, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
2605
2624
|
]
|
|
2606
2625
|
})
|
|
2607
|
-
}), /* @__PURE__ */ I(
|
|
2626
|
+
}), /* @__PURE__ */ I(g, {
|
|
2608
2627
|
align: "start",
|
|
2609
2628
|
className: "w-56 max-h-72 overflow-y-auto",
|
|
2610
|
-
children:
|
|
2611
|
-
let t =
|
|
2612
|
-
return /* @__PURE__ */ L(
|
|
2629
|
+
children: i.map((e) => {
|
|
2630
|
+
let t = pt(e.icon);
|
|
2631
|
+
return /* @__PURE__ */ L(_, {
|
|
2613
2632
|
onClick: () => f(e),
|
|
2614
2633
|
className: E("text-sm", l === e.name && "font-medium bg-muted"),
|
|
2615
2634
|
"data-testid": `view-tab-select-${e.name}`,
|
|
@@ -2622,7 +2641,7 @@ var pt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
2622
2641
|
})] })
|
|
2623
2642
|
});
|
|
2624
2643
|
};
|
|
2625
|
-
e.register("list-view",
|
|
2644
|
+
e.register("list-view", K, {
|
|
2626
2645
|
namespace: "plugin-list",
|
|
2627
2646
|
label: "List View",
|
|
2628
2647
|
category: "Views",
|
|
@@ -2699,7 +2718,7 @@ e.register("list-view", rt, {
|
|
|
2699
2718
|
sort: [],
|
|
2700
2719
|
options: {}
|
|
2701
2720
|
}
|
|
2702
|
-
}), e.register("list",
|
|
2721
|
+
}), e.register("list", K, {
|
|
2703
2722
|
namespace: "view",
|
|
2704
2723
|
skipFallback: !0,
|
|
2705
2724
|
category: "view",
|
|
@@ -2771,4 +2790,4 @@ e.register("list-view", rt, {
|
|
|
2771
2790
|
]
|
|
2772
2791
|
});
|
|
2773
2792
|
//#endregion
|
|
2774
|
-
export {
|
|
2793
|
+
export { K as ListView, ft as ObjectGallery, ht as TabBar, gt as TabBarSelect, Je as UserFilters, Ue as ViewSwitcher, He as ViewSwitcherDropdown, tt as evaluateConditionalFormatting, W as normalizeFilterCondition, $e as normalizeFilters };
|