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