@object-ui/plugin-list 4.3.0 → 4.5.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 +18 -0
- package/dist/index.js +922 -695
- package/dist/index.umd.cjs +2 -2
- package/dist/packages/plugin-list/src/ListView.d.ts.map +1 -1
- package/dist/packages/plugin-list/src/ObjectGallery.d.ts.map +1 -1
- package/dist/packages/plugin-list/src/components/ViewSettingsPopover.d.ts +54 -0
- package/dist/packages/plugin-list/src/components/ViewSettingsPopover.d.ts.map +1 -0
- package/package.json +16 -13
package/dist/index.js
CHANGED
|
@@ -2,21 +2,23 @@ import { ComponentRegistry as e, buildExpandFields as t, evaluatePlainCondition
|
|
|
2
2
|
import * as a from "react";
|
|
3
3
|
import { useCallback as o, useContext as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
4
4
|
import { Button as d, Card as f, CardContent as p, FilterBuilder as m, GroupingEditor as h, Input as g, LookupValuePicker as _, NavigationOverlay as v, Popover as y, PopoverContent as b, PopoverTrigger as x, SortBuilder as S, cn as C } from "@object-ui/components";
|
|
5
|
-
import { Activity as w, ArrowUpDown as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { useObjectLabel as
|
|
8
|
-
import { SchemaRenderer as
|
|
9
|
-
import { usePullToRefresh as
|
|
5
|
+
import { Activity as w, ArrowUpDown as T, Calendar as ee, CheckSquare as te, ChevronDown as E, ChevronRight as ne, Download as re, EyeOff as ie, GanttChartSquare as D, Grid as O, Group as ae, Images as k, Inbox as oe, LayoutGrid as A, Map as j, Paintbrush as se, Plus as M, Printer as ce, Rows2 as le, Rows3 as N, Rows4 as ue, Search as de, Settings2 as fe, Share2 as pe, SlidersHorizontal as me, Trash2 as he, X as ge, icons as _e } from "lucide-react";
|
|
6
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
7
|
+
import { useObjectLabel as ve, useObjectTranslation as ye, useSafeFieldLabel as be } from "@object-ui/i18n";
|
|
8
|
+
import { SchemaRenderer as xe, SchemaRendererContext as Se, useDataScope as Ce, useDensityMode as we, useNavigationOverlay as Te, useSafeFieldLabel as Ee } from "@object-ui/react";
|
|
9
|
+
import { usePullToRefresh as De } from "@object-ui/mobile";
|
|
10
|
+
import { usePermissions as Oe } from "@object-ui/permissions";
|
|
11
|
+
import { getCellRenderer as L, resolveCellRendererType as ke } from "@object-ui/fields";
|
|
10
12
|
//#region src/ViewSwitcher.tsx
|
|
11
|
-
var
|
|
12
|
-
grid: /* @__PURE__ */
|
|
13
|
-
kanban: /* @__PURE__ */
|
|
14
|
-
gallery: /* @__PURE__ */
|
|
15
|
-
calendar: /* @__PURE__ */
|
|
16
|
-
timeline: /* @__PURE__ */
|
|
17
|
-
gantt: /* @__PURE__ */
|
|
18
|
-
map: /* @__PURE__ */
|
|
19
|
-
},
|
|
13
|
+
var Ae = {
|
|
14
|
+
grid: /* @__PURE__ */ F(O, { className: "h-4 w-4" }),
|
|
15
|
+
kanban: /* @__PURE__ */ F(A, { className: "h-4 w-4" }),
|
|
16
|
+
gallery: /* @__PURE__ */ F(k, { className: "h-4 w-4" }),
|
|
17
|
+
calendar: /* @__PURE__ */ F(ee, { className: "h-4 w-4" }),
|
|
18
|
+
timeline: /* @__PURE__ */ F(w, { className: "h-4 w-4" }),
|
|
19
|
+
gantt: /* @__PURE__ */ F(D, { className: "h-4 w-4" }),
|
|
20
|
+
map: /* @__PURE__ */ F(j, { className: "h-4 w-4" })
|
|
21
|
+
}, je = {
|
|
20
22
|
grid: "Grid",
|
|
21
23
|
kanban: "Kanban",
|
|
22
24
|
gallery: "Gallery",
|
|
@@ -24,7 +26,7 @@ var De = {
|
|
|
24
26
|
timeline: "Timeline",
|
|
25
27
|
gantt: "Gantt",
|
|
26
28
|
map: "Map"
|
|
27
|
-
},
|
|
29
|
+
}, Me = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
|
|
28
30
|
let o = a.useCallback((t) => {
|
|
29
31
|
if (!i || t === e) {
|
|
30
32
|
n(t);
|
|
@@ -36,21 +38,21 @@ var De = {
|
|
|
36
38
|
e,
|
|
37
39
|
n
|
|
38
40
|
]);
|
|
39
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ F("div", {
|
|
40
42
|
className: C("flex items-center gap-1 bg-transparent oui-view-switcher", r),
|
|
41
43
|
children: t.map((t) => {
|
|
42
44
|
let n = e === t;
|
|
43
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ I("button", {
|
|
44
46
|
type: "button",
|
|
45
47
|
onClick: () => o(t),
|
|
46
|
-
"aria-label":
|
|
47
|
-
title:
|
|
48
|
+
"aria-label": je[t],
|
|
49
|
+
title: je[t],
|
|
48
50
|
"aria-pressed": n,
|
|
49
51
|
"data-state": n ? "on" : "off",
|
|
50
52
|
className: C("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", "hover:bg-muted hover:text-muted-foreground", "gap-2 px-3 py-2", "data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm border-transparent border data-[state=on]:border-border/50"),
|
|
51
|
-
children: [
|
|
53
|
+
children: [Ae[t], /* @__PURE__ */ F("span", {
|
|
52
54
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
53
|
-
children:
|
|
55
|
+
children: je[t]
|
|
54
56
|
})]
|
|
55
57
|
}, t);
|
|
56
58
|
})
|
|
@@ -58,23 +60,23 @@ var De = {
|
|
|
58
60
|
};
|
|
59
61
|
//#endregion
|
|
60
62
|
//#region src/components/TabBar.tsx
|
|
61
|
-
function
|
|
62
|
-
return e ?
|
|
63
|
+
function Ne(e) {
|
|
64
|
+
return e ? _e[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
63
65
|
}
|
|
64
|
-
function
|
|
66
|
+
function R(e) {
|
|
65
67
|
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
66
68
|
}
|
|
67
|
-
var
|
|
68
|
-
let i = a.useMemo(() =>
|
|
69
|
+
var Pe = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
70
|
+
let i = a.useMemo(() => R(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) => {
|
|
69
71
|
c(e.name), n?.(e);
|
|
70
72
|
}, [n]);
|
|
71
|
-
return i.length === 0 ? null : /* @__PURE__ */
|
|
73
|
+
return i.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
72
74
|
className: C("px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", r),
|
|
73
75
|
"data-testid": "view-tabs",
|
|
74
76
|
role: "tablist",
|
|
75
77
|
children: i.map((e) => {
|
|
76
|
-
let t =
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
+
let t = Ne(e.icon), n = l === e.name;
|
|
79
|
+
return /* @__PURE__ */ I(d, {
|
|
78
80
|
variant: "ghost",
|
|
79
81
|
size: "sm",
|
|
80
82
|
className: C("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"),
|
|
@@ -82,30 +84,206 @@ var je = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
82
84
|
role: "tab",
|
|
83
85
|
"aria-selected": n,
|
|
84
86
|
onClick: () => u(e),
|
|
85
|
-
children: [t && /* @__PURE__ */
|
|
87
|
+
children: [t && /* @__PURE__ */ F(t, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
86
88
|
}, e.name);
|
|
87
89
|
})
|
|
88
90
|
});
|
|
89
91
|
};
|
|
90
92
|
//#endregion
|
|
93
|
+
//#region src/components/ViewSettingsPopover.tsx
|
|
94
|
+
function z({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: i = !0, children: o }) {
|
|
95
|
+
let [s, c] = a.useState(i);
|
|
96
|
+
return /* @__PURE__ */ I("div", {
|
|
97
|
+
className: "border-b last:border-b-0",
|
|
98
|
+
children: [/* @__PURE__ */ I("div", {
|
|
99
|
+
className: "flex items-center justify-between px-3 py-2",
|
|
100
|
+
children: [/* @__PURE__ */ I("button", {
|
|
101
|
+
type: "button",
|
|
102
|
+
onClick: () => c((e) => !e),
|
|
103
|
+
className: "flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground",
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ F(E, { className: C("h-3.5 w-3.5 transition-transform", !s && "-rotate-90") }),
|
|
106
|
+
e,
|
|
107
|
+
typeof t == "number" && t > 0 && /* @__PURE__ */ F("span", {
|
|
108
|
+
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",
|
|
109
|
+
children: t
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
}), n && /* @__PURE__ */ F("button", {
|
|
113
|
+
type: "button",
|
|
114
|
+
onClick: n,
|
|
115
|
+
className: "text-[11px] text-muted-foreground hover:text-foreground",
|
|
116
|
+
children: r
|
|
117
|
+
})]
|
|
118
|
+
}), s && /* @__PURE__ */ F("div", {
|
|
119
|
+
className: "px-3 pb-3",
|
|
120
|
+
children: o
|
|
121
|
+
})]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function Fe(e) {
|
|
125
|
+
let { t, allFields: n, showGroup: r, groupingConfig: i, setGroupingConfig: o, showColor: s, rowColorConfig: c, setRowColorConfig: l, showDensity: u, density: f, showHideFields: p, hiddenFields: m, updateHiddenFields: g } = e, [_, v] = a.useState(!1), S = [
|
|
126
|
+
!!i?.fields?.length,
|
|
127
|
+
!!c?.field,
|
|
128
|
+
f && f.mode !== "compact",
|
|
129
|
+
(m?.size ?? 0) > 0
|
|
130
|
+
].filter(Boolean).length, w = f?.mode === "compact" ? ue : f?.mode === "comfortable" ? N : le, T = t("list.viewSettings", { defaultValue: "View settings" });
|
|
131
|
+
return /* @__PURE__ */ I(y, {
|
|
132
|
+
open: _,
|
|
133
|
+
onOpenChange: v,
|
|
134
|
+
children: [/* @__PURE__ */ F(x, {
|
|
135
|
+
asChild: !0,
|
|
136
|
+
children: /* @__PURE__ */ I(d, {
|
|
137
|
+
variant: "ghost",
|
|
138
|
+
size: "sm",
|
|
139
|
+
"aria-label": T,
|
|
140
|
+
title: T,
|
|
141
|
+
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", S > 0 && "text-foreground font-medium"),
|
|
142
|
+
"data-testid": "view-settings-trigger",
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ F(fe, { className: "h-3.5 w-3.5 sm:mr-1.5" }),
|
|
145
|
+
/* @__PURE__ */ F("span", {
|
|
146
|
+
className: "hidden sm:inline",
|
|
147
|
+
children: T
|
|
148
|
+
}),
|
|
149
|
+
S > 0 && /* @__PURE__ */ F("span", {
|
|
150
|
+
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
151
|
+
children: S
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
})
|
|
155
|
+
}), /* @__PURE__ */ I(b, {
|
|
156
|
+
align: "end",
|
|
157
|
+
className: "w-80 p-0",
|
|
158
|
+
"data-testid": "view-settings-content",
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ I("div", {
|
|
161
|
+
className: "px-3 py-2 border-b",
|
|
162
|
+
children: [/* @__PURE__ */ F("div", {
|
|
163
|
+
className: "text-sm font-semibold",
|
|
164
|
+
children: T
|
|
165
|
+
}), /* @__PURE__ */ F("div", {
|
|
166
|
+
className: "text-[11px] text-muted-foreground",
|
|
167
|
+
children: t("list.viewSettingsHint", { defaultValue: "Grouping, color, density, and visible fields." })
|
|
168
|
+
})]
|
|
169
|
+
}),
|
|
170
|
+
r && o && /* @__PURE__ */ F(z, {
|
|
171
|
+
title: t("list.group", { defaultValue: "Group" }),
|
|
172
|
+
badge: i?.fields?.length || 0,
|
|
173
|
+
onClear: i ? () => o(void 0) : void 0,
|
|
174
|
+
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
175
|
+
children: /* @__PURE__ */ F(h, {
|
|
176
|
+
value: i,
|
|
177
|
+
fieldOptions: n.map((e) => ({
|
|
178
|
+
value: e.name,
|
|
179
|
+
label: e.label || e.name
|
|
180
|
+
})),
|
|
181
|
+
maxLevels: 3,
|
|
182
|
+
labels: {
|
|
183
|
+
addGroup: t("list.addGroup", "Add group field"),
|
|
184
|
+
collapseTitle: t("list.collapsedByDefault", "Collapsed by default"),
|
|
185
|
+
removeTitle: t("list.removeGroup", "Remove")
|
|
186
|
+
},
|
|
187
|
+
onChange: (e) => o(e)
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
s && l && /* @__PURE__ */ I(z, {
|
|
191
|
+
title: t("list.color", { defaultValue: "Row color" }),
|
|
192
|
+
onClear: c ? () => l(void 0) : void 0,
|
|
193
|
+
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
194
|
+
defaultOpen: !!c,
|
|
195
|
+
children: [/* @__PURE__ */ F("label", {
|
|
196
|
+
className: "block text-[11px] text-muted-foreground mb-1",
|
|
197
|
+
children: t("list.colorByField", { defaultValue: "Color by field" })
|
|
198
|
+
}), /* @__PURE__ */ I("select", {
|
|
199
|
+
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
200
|
+
value: c?.field || "",
|
|
201
|
+
onChange: (e) => {
|
|
202
|
+
let t = e.target.value;
|
|
203
|
+
l(t ? {
|
|
204
|
+
field: t,
|
|
205
|
+
colors: c?.colors || {}
|
|
206
|
+
} : void 0);
|
|
207
|
+
},
|
|
208
|
+
"data-testid": "color-field-select",
|
|
209
|
+
children: [/* @__PURE__ */ F("option", {
|
|
210
|
+
value: "",
|
|
211
|
+
children: t("list.none", { defaultValue: "None" })
|
|
212
|
+
}), n.map((e) => /* @__PURE__ */ F("option", {
|
|
213
|
+
value: e.name,
|
|
214
|
+
children: e.label || e.name
|
|
215
|
+
}, e.name))]
|
|
216
|
+
})]
|
|
217
|
+
}),
|
|
218
|
+
u && f && /* @__PURE__ */ F(z, {
|
|
219
|
+
title: t("grid.toolbar.densityMode", { defaultValue: "Density" }),
|
|
220
|
+
defaultOpen: f.mode !== "compact",
|
|
221
|
+
children: /* @__PURE__ */ I("div", {
|
|
222
|
+
className: "flex items-center gap-2",
|
|
223
|
+
children: [/* @__PURE__ */ I(d, {
|
|
224
|
+
variant: "outline",
|
|
225
|
+
size: "sm",
|
|
226
|
+
className: "h-7 gap-1.5",
|
|
227
|
+
onClick: f.cycle,
|
|
228
|
+
"data-testid": "view-settings-density-cycle",
|
|
229
|
+
children: [/* @__PURE__ */ F(w, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ F("span", {
|
|
230
|
+
className: "text-xs",
|
|
231
|
+
children: f.mode === "compact" ? t("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : f.mode === "comfortable" ? t("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : t("grid.toolbar.densitySpacious", { defaultValue: "Spacious" })
|
|
232
|
+
})]
|
|
233
|
+
}), /* @__PURE__ */ F("span", {
|
|
234
|
+
className: "text-[11px] text-muted-foreground",
|
|
235
|
+
children: t("grid.toolbar.densityCycleShortHint", { defaultValue: "Click to cycle" })
|
|
236
|
+
})]
|
|
237
|
+
})
|
|
238
|
+
}),
|
|
239
|
+
p && m && g && /* @__PURE__ */ F(z, {
|
|
240
|
+
title: t("list.hideFieldsTitle", { defaultValue: "Hide fields" }),
|
|
241
|
+
badge: m.size,
|
|
242
|
+
onClear: m.size > 0 ? () => g(/* @__PURE__ */ new Set()) : void 0,
|
|
243
|
+
clearLabel: t("list.showAll", { defaultValue: "Show all" }),
|
|
244
|
+
defaultOpen: m.size > 0,
|
|
245
|
+
children: /* @__PURE__ */ F("div", {
|
|
246
|
+
className: "max-h-48 overflow-y-auto space-y-0.5",
|
|
247
|
+
children: n.map((e) => /* @__PURE__ */ I("label", {
|
|
248
|
+
className: "flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
249
|
+
children: [/* @__PURE__ */ F("input", {
|
|
250
|
+
type: "checkbox",
|
|
251
|
+
checked: !m.has(e.name),
|
|
252
|
+
onChange: () => {
|
|
253
|
+
let t = new Set(m);
|
|
254
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), g(t);
|
|
255
|
+
},
|
|
256
|
+
className: "rounded border-input"
|
|
257
|
+
}), /* @__PURE__ */ F("span", {
|
|
258
|
+
className: "truncate",
|
|
259
|
+
children: e.label || e.name
|
|
260
|
+
})]
|
|
261
|
+
}, e.name))
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
})]
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
//#endregion
|
|
91
269
|
//#region src/UserFilters.tsx
|
|
92
|
-
function
|
|
270
|
+
function Ie() {
|
|
93
271
|
try {
|
|
94
|
-
let { t: e } =
|
|
272
|
+
let { t: e } = ye(), t = e("common.more");
|
|
95
273
|
return !t || t === "common.more" ? "More" : t;
|
|
96
274
|
} catch {
|
|
97
275
|
return "More";
|
|
98
276
|
}
|
|
99
277
|
}
|
|
100
|
-
var
|
|
278
|
+
var Le = new Set([
|
|
101
279
|
"lookup",
|
|
102
280
|
"master_detail",
|
|
103
281
|
"user",
|
|
104
282
|
"owner"
|
|
105
283
|
]);
|
|
106
|
-
function
|
|
284
|
+
function Re({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a }) {
|
|
107
285
|
switch (e.element) {
|
|
108
|
-
case "dropdown": return /* @__PURE__ */
|
|
286
|
+
case "dropdown": return /* @__PURE__ */ F(B, {
|
|
109
287
|
fields: e.fields || [],
|
|
110
288
|
objectDef: t,
|
|
111
289
|
data: n,
|
|
@@ -113,14 +291,14 @@ function Pe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
113
291
|
maxVisible: i,
|
|
114
292
|
className: a
|
|
115
293
|
});
|
|
116
|
-
case "tabs": return /* @__PURE__ */
|
|
294
|
+
case "tabs": return /* @__PURE__ */ F(V, {
|
|
117
295
|
tabs: e.tabs || [],
|
|
118
296
|
showAllRecords: e.showAllRecords !== !1,
|
|
119
297
|
allowAddTab: e.allowAddTab,
|
|
120
298
|
onFilterChange: r,
|
|
121
299
|
className: a
|
|
122
300
|
});
|
|
123
|
-
case "toggle": return /* @__PURE__ */
|
|
301
|
+
case "toggle": return /* @__PURE__ */ F(Be, {
|
|
124
302
|
fields: e.fields || [],
|
|
125
303
|
onFilterChange: r,
|
|
126
304
|
className: a
|
|
@@ -128,7 +306,7 @@ function Pe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
128
306
|
default: return null;
|
|
129
307
|
}
|
|
130
308
|
}
|
|
131
|
-
function
|
|
309
|
+
function ze(e, t, n, r) {
|
|
132
310
|
return e.map((e) => {
|
|
133
311
|
let i = e.options ? [...e.options] : [], a = e.type, o, s, c;
|
|
134
312
|
if (t?.fields) {
|
|
@@ -165,13 +343,13 @@ function R(e, t, n, r) {
|
|
|
165
343
|
};
|
|
166
344
|
});
|
|
167
345
|
}
|
|
168
|
-
function
|
|
169
|
-
let { fieldLabel: s, translateOptions: c } =
|
|
346
|
+
function B({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i, className: o }) {
|
|
347
|
+
let { fieldLabel: s, translateOptions: c } = be(), l = Ie(), u = t?.name, [d, f] = a.useState(() => {
|
|
170
348
|
let t = {};
|
|
171
349
|
return e.forEach((e) => {
|
|
172
350
|
e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
|
|
173
351
|
}), t;
|
|
174
|
-
}), p = a.useMemo(() =>
|
|
352
|
+
}), p = a.useMemo(() => ze(e, t, n, {
|
|
175
353
|
objectName: u,
|
|
176
354
|
fieldLabel: s,
|
|
177
355
|
translateOptions: c
|
|
@@ -199,36 +377,36 @@ function Fe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
199
377
|
Object.values(d).some((e) => e.length > 0) && m(d);
|
|
200
378
|
}, []);
|
|
201
379
|
let g = i !== void 0 && i < p.length ? p.slice(0, i) : p, v = i !== void 0 && i < p.length ? p.slice(i) : [], S = (e) => {
|
|
202
|
-
let t = d[e.field] || [], n = t.length > 0, r =
|
|
203
|
-
return /* @__PURE__ */
|
|
380
|
+
let t = d[e.field] || [], n = t.length > 0, r = Le.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), i = r ? "w-72" : "w-56";
|
|
381
|
+
return /* @__PURE__ */ I(y, { children: [/* @__PURE__ */ F(x, {
|
|
204
382
|
asChild: !0,
|
|
205
|
-
children: /* @__PURE__ */
|
|
383
|
+
children: /* @__PURE__ */ I("button", {
|
|
206
384
|
"data-testid": `filter-badge-${e.field}`,
|
|
207
385
|
className: C("inline-flex items-center gap-1 h-7 px-2 text-xs transition-colors shrink-0 rounded-md", n ? "text-foreground font-medium" : "text-muted-foreground hover:text-foreground"),
|
|
208
386
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ F("span", {
|
|
210
388
|
className: "truncate max-w-[100px]",
|
|
211
389
|
children: e.label || e.field
|
|
212
390
|
}),
|
|
213
|
-
n && /* @__PURE__ */
|
|
391
|
+
n && /* @__PURE__ */ F("span", {
|
|
214
392
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
215
393
|
children: t.length
|
|
216
394
|
}),
|
|
217
|
-
n ? /* @__PURE__ */
|
|
395
|
+
n ? /* @__PURE__ */ F(ge, {
|
|
218
396
|
className: "h-3 w-3 opacity-60 hover:opacity-100",
|
|
219
397
|
"data-testid": `filter-clear-${e.field}`,
|
|
220
398
|
onClick: (t) => {
|
|
221
399
|
t.stopPropagation(), h(e.field, []);
|
|
222
400
|
}
|
|
223
|
-
}) : /* @__PURE__ */
|
|
401
|
+
}) : /* @__PURE__ */ F(E, { className: "h-3 w-3 opacity-60" })
|
|
224
402
|
]
|
|
225
403
|
})
|
|
226
|
-
}), /* @__PURE__ */
|
|
404
|
+
}), /* @__PURE__ */ F(b, {
|
|
227
405
|
align: "start",
|
|
228
406
|
className: C(i, "p-2"),
|
|
229
|
-
children: r ? /* @__PURE__ */
|
|
407
|
+
children: r ? /* @__PURE__ */ F("div", {
|
|
230
408
|
"data-testid": `filter-lookup-${e.field}`,
|
|
231
|
-
children: /* @__PURE__ */
|
|
409
|
+
children: /* @__PURE__ */ F(_, {
|
|
232
410
|
field: {
|
|
233
411
|
value: e.field,
|
|
234
412
|
label: e.label || e.field,
|
|
@@ -244,16 +422,16 @@ function Fe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
244
422
|
h(e.field, n);
|
|
245
423
|
}
|
|
246
424
|
})
|
|
247
|
-
}) : /* @__PURE__ */
|
|
425
|
+
}) : /* @__PURE__ */ F("div", {
|
|
248
426
|
className: "max-h-60 overflow-y-auto space-y-0.5",
|
|
249
427
|
"data-testid": `filter-options-${e.field}`,
|
|
250
|
-
children: e.options.length === 0 ? /* @__PURE__ */
|
|
428
|
+
children: e.options.length === 0 ? /* @__PURE__ */ F("div", {
|
|
251
429
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
252
430
|
children: "No options"
|
|
253
|
-
}) : e.options.map((n) => /* @__PURE__ */
|
|
431
|
+
}) : e.options.map((n) => /* @__PURE__ */ I("label", {
|
|
254
432
|
className: C("flex items-center gap-2 text-sm py-1.5 px-2 rounded cursor-pointer", t.includes(n.value) ? "bg-primary/5 text-primary" : "hover:bg-muted"),
|
|
255
433
|
children: [
|
|
256
|
-
/* @__PURE__ */
|
|
434
|
+
/* @__PURE__ */ F("input", {
|
|
257
435
|
type: "checkbox",
|
|
258
436
|
checked: t.includes(n.value),
|
|
259
437
|
onChange: () => {
|
|
@@ -262,15 +440,15 @@ function Fe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
262
440
|
},
|
|
263
441
|
className: "rounded border-input"
|
|
264
442
|
}),
|
|
265
|
-
n.color && /* @__PURE__ */
|
|
443
|
+
n.color && /* @__PURE__ */ F("span", {
|
|
266
444
|
className: "h-2.5 w-2.5 rounded-full shrink-0",
|
|
267
445
|
style: { backgroundColor: n.color }
|
|
268
446
|
}),
|
|
269
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ F("span", {
|
|
270
448
|
className: "truncate flex-1",
|
|
271
449
|
children: n.label
|
|
272
450
|
}),
|
|
273
|
-
n.count !== void 0 && /* @__PURE__ */
|
|
451
|
+
n.count !== void 0 && /* @__PURE__ */ F("span", {
|
|
274
452
|
className: "text-xs text-muted-foreground",
|
|
275
453
|
children: n.count
|
|
276
454
|
})
|
|
@@ -279,39 +457,39 @@ function Fe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
279
457
|
})
|
|
280
458
|
})] }, e.field);
|
|
281
459
|
};
|
|
282
|
-
return /* @__PURE__ */
|
|
460
|
+
return /* @__PURE__ */ F("div", {
|
|
283
461
|
className: C("flex items-center gap-0.5 overflow-x-auto", o),
|
|
284
462
|
"data-testid": "user-filters-dropdown",
|
|
285
|
-
children: p.length === 0 ? /* @__PURE__ */
|
|
463
|
+
children: p.length === 0 ? /* @__PURE__ */ F("span", {
|
|
286
464
|
className: "text-xs text-muted-foreground",
|
|
287
465
|
"data-testid": "user-filters-empty",
|
|
288
466
|
children: "No filter fields"
|
|
289
|
-
}) : /* @__PURE__ */
|
|
467
|
+
}) : /* @__PURE__ */ I(P, { children: [g.map(S), v.length > 0 && /* @__PURE__ */ I(y, { children: [/* @__PURE__ */ F(x, {
|
|
290
468
|
asChild: !0,
|
|
291
|
-
children: /* @__PURE__ */
|
|
469
|
+
children: /* @__PURE__ */ I("button", {
|
|
292
470
|
"data-testid": "user-filters-more",
|
|
293
471
|
className: "inline-flex items-center gap-1 h-7 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 rounded-md",
|
|
294
472
|
children: [
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ F("span", { children: l }),
|
|
474
|
+
/* @__PURE__ */ F("span", {
|
|
297
475
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
298
476
|
children: v.length
|
|
299
477
|
}),
|
|
300
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ F(E, { className: "h-3 w-3 opacity-60" })
|
|
301
479
|
]
|
|
302
480
|
})
|
|
303
|
-
}), /* @__PURE__ */
|
|
481
|
+
}), /* @__PURE__ */ F(b, {
|
|
304
482
|
align: "start",
|
|
305
483
|
className: "w-64 p-2",
|
|
306
484
|
"data-testid": "user-filters-more-content",
|
|
307
|
-
children: /* @__PURE__ */
|
|
485
|
+
children: /* @__PURE__ */ F("div", {
|
|
308
486
|
className: "space-y-1",
|
|
309
487
|
children: v.map(S)
|
|
310
488
|
})
|
|
311
489
|
})] })] })
|
|
312
490
|
});
|
|
313
491
|
}
|
|
314
|
-
function
|
|
492
|
+
function V({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: i }) {
|
|
315
493
|
let [o, s] = a.useState(() => e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), c = a.useCallback((t) => {
|
|
316
494
|
s(t), r(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []);
|
|
317
495
|
}, [e, r]), l = a.useMemo(() => {
|
|
@@ -325,23 +503,23 @@ function Ie({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
|
|
|
325
503
|
return a.useEffect(() => {
|
|
326
504
|
let t = e.find((e) => e.default);
|
|
327
505
|
t && r(t.filters || []);
|
|
328
|
-
}, []), /* @__PURE__ */
|
|
506
|
+
}, []), /* @__PURE__ */ I("div", {
|
|
329
507
|
className: C("flex items-center gap-0.5 overflow-x-auto", i),
|
|
330
508
|
"data-testid": "user-filters-tabs",
|
|
331
|
-
children: [l.map((e) => /* @__PURE__ */
|
|
509
|
+
children: [l.map((e) => /* @__PURE__ */ F("button", {
|
|
332
510
|
"data-testid": `filter-tab-${e.id}`,
|
|
333
511
|
onClick: () => c(e.id),
|
|
334
512
|
className: C("inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0", o === e.id ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted"),
|
|
335
513
|
children: e.label
|
|
336
|
-
}, e.id)), n && /* @__PURE__ */
|
|
514
|
+
}, e.id)), n && /* @__PURE__ */ F("button", {
|
|
337
515
|
className: "inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",
|
|
338
516
|
"data-testid": "filter-tab-add",
|
|
339
517
|
title: "Add filter tab",
|
|
340
|
-
children: /* @__PURE__ */
|
|
518
|
+
children: /* @__PURE__ */ F(M, { className: "h-3.5 w-3.5" })
|
|
341
519
|
})]
|
|
342
520
|
});
|
|
343
521
|
}
|
|
344
|
-
function
|
|
522
|
+
function Be({ fields: e, onFilterChange: t, className: n }) {
|
|
345
523
|
let [r, i] = a.useState(() => {
|
|
346
524
|
let t = /* @__PURE__ */ new Set();
|
|
347
525
|
return e.forEach((e) => {
|
|
@@ -368,10 +546,10 @@ function Le({ fields: e, onFilterChange: t, className: n }) {
|
|
|
368
546
|
};
|
|
369
547
|
return a.useEffect(() => {
|
|
370
548
|
r.size > 0 && o(r);
|
|
371
|
-
}, []), /* @__PURE__ */
|
|
549
|
+
}, []), /* @__PURE__ */ F("div", {
|
|
372
550
|
className: C("flex items-center gap-1 overflow-x-auto", n),
|
|
373
551
|
"data-testid": "user-filters-toggle",
|
|
374
|
-
children: e.map((e) => /* @__PURE__ */
|
|
552
|
+
children: e.map((e) => /* @__PURE__ */ F(d, {
|
|
375
553
|
variant: r.has(e.field) ? "default" : "outline",
|
|
376
554
|
size: "sm",
|
|
377
555
|
className: "h-7 px-3 text-xs shrink-0",
|
|
@@ -383,7 +561,7 @@ function Le({ fields: e, onFilterChange: t, className: n }) {
|
|
|
383
561
|
}
|
|
384
562
|
//#endregion
|
|
385
563
|
//#region src/ListView.tsx
|
|
386
|
-
function
|
|
564
|
+
function Ve(e) {
|
|
387
565
|
switch (e) {
|
|
388
566
|
case "equals":
|
|
389
567
|
case "eq": return "=";
|
|
@@ -407,10 +585,10 @@ function Re(e) {
|
|
|
407
585
|
default: return e;
|
|
408
586
|
}
|
|
409
587
|
}
|
|
410
|
-
function
|
|
588
|
+
function H(e) {
|
|
411
589
|
if (!Array.isArray(e) || e.length < 3) return e;
|
|
412
590
|
let [t, n, r] = e;
|
|
413
|
-
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ?
|
|
591
|
+
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ? H(e) : e)] : n === "in" && Array.isArray(r) ? r.length === 0 ? [] : r.length === 1 ? [
|
|
414
592
|
t,
|
|
415
593
|
"=",
|
|
416
594
|
r[0]
|
|
@@ -428,15 +606,15 @@ function z(e) {
|
|
|
428
606
|
e
|
|
429
607
|
])] : e;
|
|
430
608
|
}
|
|
431
|
-
function
|
|
609
|
+
function He(e) {
|
|
432
610
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
433
611
|
}
|
|
434
|
-
function
|
|
435
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ?
|
|
612
|
+
function Ue(e) {
|
|
613
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? H(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
|
|
436
614
|
}
|
|
437
|
-
function
|
|
615
|
+
function We(e) {
|
|
438
616
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
439
|
-
let t =
|
|
617
|
+
let t = Ue(e.conditions.map((e) => e.operator === "isEmpty" ? [
|
|
440
618
|
e.field,
|
|
441
619
|
"=",
|
|
442
620
|
null
|
|
@@ -446,12 +624,12 @@ function Ve(e) {
|
|
|
446
624
|
null
|
|
447
625
|
] : [
|
|
448
626
|
e.field,
|
|
449
|
-
|
|
627
|
+
Ve(e.operator),
|
|
450
628
|
e.value
|
|
451
629
|
]));
|
|
452
630
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
453
631
|
}
|
|
454
|
-
function
|
|
632
|
+
function U(e, t) {
|
|
455
633
|
if (!t || t.length === 0) return {};
|
|
456
634
|
for (let r of t) {
|
|
457
635
|
let t = !1, i = ("condition" in r ? r.condition : void 0) || ("expression" in r ? r.expression : void 0) || void 0;
|
|
@@ -486,7 +664,7 @@ function B(e, t) {
|
|
|
486
664
|
}
|
|
487
665
|
return {};
|
|
488
666
|
}
|
|
489
|
-
var
|
|
667
|
+
var Ge = {
|
|
490
668
|
"list.recordCount": "{{count}} records",
|
|
491
669
|
"list.recordCountOne": "{{count}} record",
|
|
492
670
|
"list.noItems": "No items found",
|
|
@@ -516,61 +694,67 @@ var V = {
|
|
|
516
694
|
"list.share": "Share",
|
|
517
695
|
"list.print": "Print",
|
|
518
696
|
"list.hideFieldsTitle": "Hide Fields",
|
|
519
|
-
"table.rowsPerPage": "Rows per page"
|
|
697
|
+
"table.rowsPerPage": "Rows per page",
|
|
698
|
+
"grid.toolbar.densityMode": "Density",
|
|
699
|
+
"grid.toolbar.densityCompact": "Compact",
|
|
700
|
+
"grid.toolbar.densityComfortable": "Comfortable",
|
|
701
|
+
"grid.toolbar.densitySpacious": "Spacious",
|
|
702
|
+
"grid.toolbar.densityCycleHint": "{{label}} (click to cycle)",
|
|
703
|
+
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
704
|
+
"list.viewSettings": "View settings",
|
|
705
|
+
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
706
|
+
}, Ke = (e, t, n) => n, W = (e, t) => {
|
|
707
|
+
let n = Ge[e] || e;
|
|
708
|
+
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
709
|
+
return n;
|
|
520
710
|
};
|
|
521
|
-
function
|
|
711
|
+
function qe() {
|
|
522
712
|
try {
|
|
523
|
-
let e =
|
|
524
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t:
|
|
525
|
-
let n = V[e] || e;
|
|
526
|
-
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
527
|
-
return n;
|
|
528
|
-
} } : { t: e.t };
|
|
713
|
+
let e = ye();
|
|
714
|
+
return e.t("list.recordCount") === "list.recordCount" ? { t: W } : { t: e.t };
|
|
529
715
|
} catch {
|
|
530
|
-
return { t:
|
|
531
|
-
let n = V[e] || e;
|
|
532
|
-
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
533
|
-
return n;
|
|
534
|
-
} };
|
|
716
|
+
return { t: W };
|
|
535
717
|
}
|
|
536
718
|
}
|
|
537
|
-
function
|
|
719
|
+
function Je() {
|
|
538
720
|
try {
|
|
539
|
-
let { fieldLabel: e } =
|
|
721
|
+
let { fieldLabel: e } = ve();
|
|
540
722
|
return { fieldLabel: e };
|
|
541
723
|
} catch {
|
|
542
|
-
return { fieldLabel:
|
|
724
|
+
return { fieldLabel: Ke };
|
|
543
725
|
}
|
|
544
726
|
}
|
|
545
|
-
var
|
|
546
|
-
let { t:
|
|
727
|
+
var Ye = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange: s, onSortChange: c, onSearchChange: l, onHiddenFieldsChange: u, onColumnStateChange: f, onRowClick: p, showViewSwitcher: _ = !1, ...w }, ee) => {
|
|
728
|
+
let { t: E } = qe(), { fieldLabel: ne } = Je(), { translateOptions: D } = be(), O = a.useMemo(() => e.viewType ? e : {
|
|
547
729
|
...e,
|
|
548
|
-
viewType:
|
|
549
|
-
}
|
|
550
|
-
let e =
|
|
730
|
+
viewType: "grid"
|
|
731
|
+
}, [e]), k = a.useCallback((e, t) => O.objectName ? ne(O.objectName, e, t) : t, [O.objectName, ne]), A = a.useMemo(() => {
|
|
732
|
+
let e = O.userActions, t = O.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
|
|
551
733
|
return {
|
|
552
|
-
showSearch: e?.search === void 0 ?
|
|
553
|
-
showSort: e?.sort === void 0 ?
|
|
554
|
-
showFilters: e?.filter === void 0 ?
|
|
555
|
-
showDensity: e?.rowHeight === void 0 ?
|
|
556
|
-
showHideFields:
|
|
557
|
-
showGroup:
|
|
558
|
-
showColor:
|
|
734
|
+
showSearch: e?.search === void 0 ? O.showSearch !== !1 : e.search,
|
|
735
|
+
showSort: e?.sort === void 0 ? O.showSort !== !1 : e.sort,
|
|
736
|
+
showFilters: e?.filter === void 0 ? O.showFilters !== !1 : e.filter,
|
|
737
|
+
showDensity: e?.rowHeight === void 0 ? O.showDensity !== !1 : e.rowHeight,
|
|
738
|
+
showHideFields: O.showHideFields === !0,
|
|
739
|
+
showGroup: O.showGroup !== !1,
|
|
740
|
+
showColor: O.showColor === !0,
|
|
741
|
+
compactToolbar: O.compactToolbar === !0,
|
|
559
742
|
showAddRecord: t,
|
|
560
|
-
addRecordPosition:
|
|
743
|
+
addRecordPosition: O.addRecord?.position === "bottom" ? "bottom" : "top"
|
|
561
744
|
};
|
|
562
745
|
}, [
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
746
|
+
O.userActions,
|
|
747
|
+
O.showSearch,
|
|
748
|
+
O.showSort,
|
|
749
|
+
O.showFilters,
|
|
750
|
+
O.showDensity,
|
|
751
|
+
O.showHideFields,
|
|
752
|
+
O.showGroup,
|
|
753
|
+
O.showColor,
|
|
754
|
+
O.compactToolbar,
|
|
755
|
+
O.addRecord,
|
|
756
|
+
O.userActions?.addRecordForm
|
|
757
|
+
]), [j, fe] = a.useState(O.viewType), [P, ve] = a.useState(""), [ye, Se] = a.useState(!1), [Ce, Ee] = a.useState(!1), [L, ke] = a.useState(() => O.sort && O.sort.length > 0 ? O.sort.map((e) => {
|
|
574
758
|
if (typeof e == "string") {
|
|
575
759
|
let t = e.trim().split(/\s+/);
|
|
576
760
|
return {
|
|
@@ -584,9 +768,9 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
584
768
|
field: e.field,
|
|
585
769
|
order: e.order || "asc"
|
|
586
770
|
};
|
|
587
|
-
}) : []), Ae = a.useMemo(() => JSON.stringify(
|
|
771
|
+
}) : []), Ae = a.useMemo(() => JSON.stringify(O.sort || []), [O.sort]);
|
|
588
772
|
a.useEffect(() => {
|
|
589
|
-
|
|
773
|
+
O.sort && O.sort.length > 0 ? ke(O.sort.map((e) => {
|
|
590
774
|
if (typeof e == "string") {
|
|
591
775
|
let t = e.trim().split(/\s+/);
|
|
592
776
|
return {
|
|
@@ -602,41 +786,41 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
602
786
|
};
|
|
603
787
|
})) : ke([]);
|
|
604
788
|
}, [Ae]);
|
|
605
|
-
let [
|
|
789
|
+
let [je, Ne] = a.useState(!1), [R, z] = a.useState({
|
|
606
790
|
id: "root",
|
|
607
791
|
logic: "and",
|
|
608
792
|
conditions: []
|
|
609
793
|
}), [Ie, Le] = a.useState(() => {
|
|
610
|
-
if (!(!
|
|
611
|
-
}),
|
|
794
|
+
if (!(!O.tabs || O.tabs.length === 0)) return O.tabs.find((e) => e.isDefault)?.name ?? O.tabs[0]?.name;
|
|
795
|
+
}), ze = a.useCallback((e) => {
|
|
612
796
|
if (Le(e.name), e.filter) {
|
|
613
797
|
let t = {
|
|
614
798
|
id: `tab-filter-${e.name}`,
|
|
615
799
|
logic: e.filter.logic || "and",
|
|
616
800
|
conditions: e.filter.conditions || []
|
|
617
801
|
};
|
|
618
|
-
|
|
802
|
+
z(t), s?.(t);
|
|
619
803
|
} else {
|
|
620
804
|
let e = {
|
|
621
805
|
id: "root",
|
|
622
806
|
logic: "and",
|
|
623
807
|
conditions: []
|
|
624
808
|
};
|
|
625
|
-
|
|
809
|
+
z(e), s?.(e);
|
|
626
810
|
}
|
|
627
|
-
}, [s]),
|
|
628
|
-
a.useImperativeHandle(
|
|
629
|
-
if (!(!
|
|
630
|
-
e.resource ===
|
|
811
|
+
}, [s]), B = w.dataSource, [V, Be] = a.useState([]), [Ve, H] = a.useState(!1), [U, Ge] = a.useState(null), [Ke, W] = a.useState(!1), [Ye, Xe] = a.useState(0), [Ze, Qe] = a.useState(!1);
|
|
812
|
+
a.useImperativeHandle(ee, () => ({ refresh: () => Xe((e) => e + 1) }), []), a.useEffect(() => {
|
|
813
|
+
if (!(!B?.onMutation || !O.objectName || O.refreshTrigger)) return B.onMutation((e) => {
|
|
814
|
+
e.resource === O.objectName && Xe((e) => e + 1);
|
|
631
815
|
});
|
|
632
816
|
}, [
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
817
|
+
B,
|
|
818
|
+
O.objectName,
|
|
819
|
+
O.refreshTrigger
|
|
636
820
|
]);
|
|
637
|
-
let [
|
|
638
|
-
if (
|
|
639
|
-
let e = typeof
|
|
821
|
+
let [$e, et] = a.useState(void 0), tt = $e ?? O.pagination?.pageSize ?? 100, G = a.useMemo(() => {
|
|
822
|
+
if (O.grouping?.fields?.length) return O.grouping;
|
|
823
|
+
let e = typeof O.groupBy == "string" ? O.groupBy.trim() : "", t = typeof O.groupBy2 == "string" ? O.groupBy2.trim() : "", n = [];
|
|
640
824
|
return e && n.push({
|
|
641
825
|
field: e,
|
|
642
826
|
order: "asc",
|
|
@@ -647,81 +831,96 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
647
831
|
collapsed: !1
|
|
648
832
|
}), n.length > 0 ? { fields: n } : void 0;
|
|
649
833
|
}, [
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
]), [
|
|
834
|
+
O.grouping,
|
|
835
|
+
O.groupBy,
|
|
836
|
+
O.groupBy2
|
|
837
|
+
]), [K, nt] = a.useState(G), [rt, it] = a.useState(!1), at = a.useRef(G);
|
|
654
838
|
a.useEffect(() => {
|
|
655
|
-
|
|
656
|
-
}, [
|
|
657
|
-
let [
|
|
839
|
+
at.current !== G && (at.current = G, nt(G));
|
|
840
|
+
}, [G]);
|
|
841
|
+
let [q, ot] = a.useState(O.rowColor), [st, ct] = a.useState(!1), [lt, ut] = a.useState([]), dt = a.useRef(0), [ft, pt] = a.useState(() => {
|
|
658
842
|
let e = /* @__PURE__ */ new Set();
|
|
659
|
-
return
|
|
843
|
+
return O.quickFilters?.forEach((t) => {
|
|
660
844
|
let n = r(t);
|
|
661
845
|
n.defaultActive && e.add(n.id);
|
|
662
846
|
}), e;
|
|
663
|
-
}), [
|
|
664
|
-
if (
|
|
665
|
-
if (!
|
|
847
|
+
}), [mt, ht] = a.useState([]), gt = a.useMemo(() => {
|
|
848
|
+
if (O.userFilters) return O.userFilters;
|
|
849
|
+
if (!U?.fields) return;
|
|
666
850
|
let e = new Set([
|
|
667
851
|
"select",
|
|
668
852
|
"multi-select",
|
|
669
853
|
"boolean"
|
|
670
|
-
]), t = [], n = Array.isArray(
|
|
854
|
+
]), t = [], n = Array.isArray(U.fields) ? U.fields.map((e) => [e.name, e]) : Object.entries(U.fields);
|
|
671
855
|
for (let [r, i] of n) (e.has(i.type) || i.options && !i.type) && t.push({
|
|
672
856
|
field: r,
|
|
673
|
-
label:
|
|
857
|
+
label: k(r, i.label || r),
|
|
674
858
|
type: i.type === "boolean" ? "boolean" : i.type === "multi-select" ? "multi-select" : "select"
|
|
675
859
|
});
|
|
676
860
|
if (t.length !== 0) return {
|
|
677
861
|
element: "dropdown",
|
|
678
862
|
fields: t
|
|
679
863
|
};
|
|
680
|
-
}, [
|
|
864
|
+
}, [O.userFilters, U]), [J, _t] = a.useState(() => new Set(O.hiddenFields || [])), vt = a.useMemo(() => JSON.stringify(O.hiddenFields || []), [O.hiddenFields]);
|
|
681
865
|
a.useEffect(() => {
|
|
682
|
-
|
|
683
|
-
}, [
|
|
684
|
-
let
|
|
685
|
-
|
|
686
|
-
}, [u]), [
|
|
687
|
-
if (
|
|
688
|
-
}, [
|
|
866
|
+
_t(new Set(O.hiddenFields || []));
|
|
867
|
+
}, [vt]);
|
|
868
|
+
let yt = a.useCallback((e) => {
|
|
869
|
+
_t(e), u?.(Array.from(e));
|
|
870
|
+
}, [u]), [bt, xt] = a.useState(!1), [St, Ct] = a.useState(!1), Y = a.useMemo(() => i(O.quickFilters), [O.quickFilters]), X = a.useMemo(() => {
|
|
871
|
+
if (O.exportOptions) return Array.isArray(O.exportOptions) ? { formats: O.exportOptions } : O.exportOptions;
|
|
872
|
+
}, [O.exportOptions]), Z = we(a.useMemo(() => O.densityMode ? O.densityMode : O.rowHeight ? {
|
|
689
873
|
compact: "compact",
|
|
690
874
|
short: "compact",
|
|
691
875
|
medium: "comfortable",
|
|
692
876
|
tall: "spacious",
|
|
693
877
|
extra_tall: "spacious"
|
|
694
|
-
}[
|
|
878
|
+
}[O.rowHeight] || "comfortable" : "compact", [O.densityMode, O.rowHeight]), { onChange: O.onDensityChange }), wt = a.useMemo(() => `objectui:gallery:density:${O.objectName ?? "default"}`, [O.objectName]), [Q, Tt] = a.useState(() => {
|
|
879
|
+
if (typeof window > "u") return O.gallery?.cardSize ?? "medium";
|
|
880
|
+
try {
|
|
881
|
+
let e = window.localStorage.getItem(wt);
|
|
882
|
+
if (e === "small" || e === "medium" || e === "large") return e;
|
|
883
|
+
} catch {}
|
|
884
|
+
return O.gallery?.cardSize ?? "medium";
|
|
885
|
+
}), Et = a.useCallback(() => {
|
|
886
|
+
Tt((e) => {
|
|
887
|
+
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
888
|
+
try {
|
|
889
|
+
window.localStorage.setItem(wt, t);
|
|
890
|
+
} catch {}
|
|
891
|
+
return t;
|
|
892
|
+
});
|
|
893
|
+
}, [wt]), { ref: Dt, isRefreshing: Ot, pullDistance: kt } = De({
|
|
695
894
|
onRefresh: a.useCallback(async () => {
|
|
696
|
-
|
|
895
|
+
Xe((e) => e + 1);
|
|
697
896
|
}, []),
|
|
698
|
-
enabled: !!
|
|
699
|
-
}),
|
|
897
|
+
enabled: !!B && !!O.objectName
|
|
898
|
+
}), At = a.useMemo(() => O.id ? `listview-${O.objectName}-${O.id}-view` : `listview-${O.objectName}-view`, [O.objectName, O.id]);
|
|
700
899
|
a.useEffect(() => {
|
|
701
900
|
let e = !0;
|
|
702
|
-
return
|
|
703
|
-
if (!
|
|
704
|
-
|
|
901
|
+
return W(!1), Ge(null), (async () => {
|
|
902
|
+
if (!B || !O.objectName) {
|
|
903
|
+
W(!0);
|
|
705
904
|
return;
|
|
706
905
|
}
|
|
707
|
-
if (typeof
|
|
708
|
-
|
|
906
|
+
if (typeof B.getObjectSchema != "function") {
|
|
907
|
+
W(!0);
|
|
709
908
|
return;
|
|
710
909
|
}
|
|
711
910
|
try {
|
|
712
|
-
let t = await
|
|
713
|
-
e &&
|
|
911
|
+
let t = await B.getObjectSchema(O.objectName);
|
|
912
|
+
e && Ge(t);
|
|
714
913
|
} catch (e) {
|
|
715
914
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
716
915
|
} finally {
|
|
717
|
-
e &&
|
|
916
|
+
e && W(!0);
|
|
718
917
|
}
|
|
719
918
|
})(), () => {
|
|
720
919
|
e = !1;
|
|
721
920
|
};
|
|
722
|
-
}, [
|
|
723
|
-
let
|
|
724
|
-
let e = Array.isArray(
|
|
921
|
+
}, [O.objectName, B]);
|
|
922
|
+
let jt = a.useMemo(() => {
|
|
923
|
+
let e = Array.isArray(O.fields) ? O.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], n = new Set(e), r = (e) => {
|
|
725
924
|
if (!e) return;
|
|
726
925
|
let t = [
|
|
727
926
|
e.groupField,
|
|
@@ -745,51 +944,51 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
745
944
|
];
|
|
746
945
|
for (let e of t) typeof e == "string" && e && n.add(e);
|
|
747
946
|
};
|
|
748
|
-
r(
|
|
947
|
+
r(O.kanban), r(O.options?.kanban), r(O.calendar), r(O.options?.calendar), r(O.gallery), r(O.options?.gallery), r(O.timeline), r(O.options?.timeline), r(O.gantt), r(O.options?.gantt);
|
|
749
948
|
let i = n.size > 0 ? Array.from(n) : void 0;
|
|
750
|
-
return t(
|
|
949
|
+
return t(U?.fields, i);
|
|
751
950
|
}, [
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
951
|
+
U?.fields,
|
|
952
|
+
O.fields,
|
|
953
|
+
O.kanban,
|
|
954
|
+
O.calendar,
|
|
955
|
+
O.gallery,
|
|
956
|
+
O.timeline,
|
|
957
|
+
O.gantt,
|
|
958
|
+
O.options
|
|
760
959
|
]);
|
|
761
960
|
a.useEffect(() => {
|
|
762
|
-
let e = !0, t = ++
|
|
763
|
-
if (
|
|
764
|
-
let e =
|
|
961
|
+
let e = !0, t = ++dt.current;
|
|
962
|
+
if (O.data && typeof O.data == "object" && !Array.isArray(O.data)) {
|
|
963
|
+
let e = O.data;
|
|
765
964
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
766
965
|
let t = e.items;
|
|
767
|
-
if (
|
|
768
|
-
let e =
|
|
966
|
+
if (P) {
|
|
967
|
+
let e = P.toLowerCase();
|
|
769
968
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
770
969
|
}
|
|
771
|
-
|
|
970
|
+
Be(t), H(!1), Qe(!1);
|
|
772
971
|
return;
|
|
773
972
|
}
|
|
774
973
|
}
|
|
775
|
-
if (Array.isArray(
|
|
776
|
-
let e =
|
|
777
|
-
if (
|
|
778
|
-
let t =
|
|
974
|
+
if (Array.isArray(O.data)) {
|
|
975
|
+
let e = O.data;
|
|
976
|
+
if (P) {
|
|
977
|
+
let t = P.toLowerCase();
|
|
779
978
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
780
979
|
}
|
|
781
|
-
|
|
980
|
+
Be(e), H(!1), Qe(!1);
|
|
782
981
|
return;
|
|
783
982
|
}
|
|
784
|
-
return
|
|
785
|
-
if (!(!
|
|
786
|
-
|
|
983
|
+
return Ke ? ((async () => {
|
|
984
|
+
if (!(!B || !O.objectName)) {
|
|
985
|
+
H(!0);
|
|
787
986
|
try {
|
|
788
|
-
let n = [], r =
|
|
789
|
-
|
|
790
|
-
|
|
987
|
+
let n = [], r = O.filters || [], i = We(R), a = [];
|
|
988
|
+
Y && ft.size > 0 && Y.forEach((e) => {
|
|
989
|
+
ft.has(e.id) && e.filters && e.filters.length > 0 && a.push(e.filters);
|
|
791
990
|
});
|
|
792
|
-
let o =
|
|
991
|
+
let o = Ue(mt), s = [
|
|
793
992
|
...r.length > 0 ? [r] : [],
|
|
794
993
|
...i.length > 0 ? [i] : [],
|
|
795
994
|
...a,
|
|
@@ -800,11 +999,11 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
800
999
|
field: e.field,
|
|
801
1000
|
order: e.order
|
|
802
1001
|
})) : void 0, l = (() => {
|
|
803
|
-
let e = Array.isArray(
|
|
1002
|
+
let e = Array.isArray(O.fields) ? O.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [];
|
|
804
1003
|
if (e.length === 0) return;
|
|
805
1004
|
let t = new Set(["id"]);
|
|
806
1005
|
for (let n of e) t.add(n);
|
|
807
|
-
for (let e of
|
|
1006
|
+
for (let e of jt) t.add(e);
|
|
808
1007
|
let n = (e) => {
|
|
809
1008
|
if (!e) return;
|
|
810
1009
|
let n = [
|
|
@@ -829,55 +1028,55 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
829
1028
|
];
|
|
830
1029
|
for (let e of n) typeof e == "string" && e && t.add(e);
|
|
831
1030
|
};
|
|
832
|
-
n(
|
|
1031
|
+
n(O.kanban), n(O.options?.kanban), n(O.calendar), n(O.options?.calendar), n(O.gallery), n(O.options?.gallery), n(O.timeline), n(O.options?.timeline);
|
|
833
1032
|
{
|
|
834
|
-
let e =
|
|
1033
|
+
let e = O.timeline ?? O.options?.timeline;
|
|
835
1034
|
e && !Array.isArray(e.metaFields) && (t.add("status"), t.add("priority"));
|
|
836
1035
|
}
|
|
837
|
-
return n(
|
|
838
|
-
})(), u = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, d = await
|
|
1036
|
+
return n(O.gantt), n(O.options?.gantt), Array.from(t);
|
|
1037
|
+
})(), u = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, d = await B.find(O.objectName, {
|
|
839
1038
|
...u ? { $filter: n } : {},
|
|
840
1039
|
$orderby: c,
|
|
841
|
-
$top:
|
|
1040
|
+
$top: tt,
|
|
842
1041
|
...l ? { $select: l } : {},
|
|
843
|
-
...
|
|
844
|
-
...
|
|
845
|
-
$search:
|
|
846
|
-
...
|
|
1042
|
+
...jt.length > 0 ? { $expand: jt } : {},
|
|
1043
|
+
...P ? {
|
|
1044
|
+
$search: P,
|
|
1045
|
+
...O.searchableFields && O.searchableFields.length > 0 ? { $searchFields: O.searchableFields } : {}
|
|
847
1046
|
} : {}
|
|
848
1047
|
});
|
|
849
|
-
if (!e || t !==
|
|
1048
|
+
if (!e || t !== dt.current) return;
|
|
850
1049
|
let f = [];
|
|
851
|
-
Array.isArray(d) ? f = d : d && typeof d == "object" && (Array.isArray(d.data) ? f = d.data : Array.isArray(d.records) ? f = d.records : Array.isArray(d.value) && (f = d.value)),
|
|
1050
|
+
Array.isArray(d) ? f = d : d && typeof d == "object" && (Array.isArray(d.data) ? f = d.data : Array.isArray(d.records) ? f = d.records : Array.isArray(d.value) && (f = d.value)), Be(f), Qe(f.length >= tt);
|
|
852
1051
|
} catch (e) {
|
|
853
|
-
t ===
|
|
1052
|
+
t === dt.current && console.error("ListView data fetch error:", e);
|
|
854
1053
|
} finally {
|
|
855
|
-
e && t ===
|
|
1054
|
+
e && t === dt.current && H(!1);
|
|
856
1055
|
}
|
|
857
1056
|
}
|
|
858
1057
|
})(), () => {
|
|
859
1058
|
e = !1;
|
|
860
1059
|
}) : void 0;
|
|
861
1060
|
}, [
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
1061
|
+
O.objectName,
|
|
1062
|
+
O.data,
|
|
1063
|
+
B,
|
|
1064
|
+
O.filters,
|
|
1065
|
+
tt,
|
|
867
1066
|
L,
|
|
868
1067
|
R,
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1068
|
+
ft,
|
|
1069
|
+
Y,
|
|
1070
|
+
mt,
|
|
1071
|
+
Ye,
|
|
1072
|
+
P,
|
|
1073
|
+
O.searchableFields,
|
|
1074
|
+
jt,
|
|
1075
|
+
Ke,
|
|
1076
|
+
O.refreshTrigger
|
|
878
1077
|
]);
|
|
879
|
-
let
|
|
880
|
-
if (
|
|
1078
|
+
let Mt = a.useMemo(() => {
|
|
1079
|
+
if (O.appearance?.allowedVisualizations && O.appearance.allowedVisualizations.length > 0) return O.appearance.allowedVisualizations.filter((e) => [
|
|
881
1080
|
"grid",
|
|
882
1081
|
"kanban",
|
|
883
1082
|
"gallery",
|
|
@@ -887,7 +1086,7 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
887
1086
|
"map"
|
|
888
1087
|
].includes(e));
|
|
889
1088
|
let e = ["grid"];
|
|
890
|
-
return (
|
|
1089
|
+
return (O.kanban?.groupField || O.options?.kanban?.groupField) && e.push("kanban"), (O.gallery?.coverField || O.gallery?.imageField || O.options?.gallery?.imageField) && e.push("gallery"), (O.calendar?.startDateField || O.options?.calendar?.startDateField) && e.push("calendar"), (O.timeline?.startDateField || O.options?.timeline?.startDateField || O.options?.timeline?.dateField || O.options?.calendar?.startDateField) && e.push("timeline"), (O.gantt?.startDateField || O.options?.gantt?.startDateField) && e.push("gantt"), (O.options?.map?.locationField || O.options?.map?.latitudeField && O.options?.map?.longitudeField) && e.push("map"), O.viewType && !e.includes(O.viewType) && [
|
|
891
1090
|
"grid",
|
|
892
1091
|
"kanban",
|
|
893
1092
|
"calendar",
|
|
@@ -895,42 +1094,45 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
895
1094
|
"gantt",
|
|
896
1095
|
"map",
|
|
897
1096
|
"gallery"
|
|
898
|
-
].includes(
|
|
1097
|
+
].includes(O.viewType) && e.push(O.viewType), e;
|
|
899
1098
|
}, [
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1099
|
+
O.options,
|
|
1100
|
+
O.viewType,
|
|
1101
|
+
O.kanban,
|
|
1102
|
+
O.calendar,
|
|
1103
|
+
O.gantt,
|
|
1104
|
+
O.gallery,
|
|
1105
|
+
O.timeline,
|
|
1106
|
+
O.appearance?.allowedVisualizations
|
|
908
1107
|
]);
|
|
909
1108
|
a.useEffect(() => {
|
|
910
|
-
|
|
911
|
-
}, [
|
|
912
|
-
let
|
|
913
|
-
|
|
1109
|
+
O.viewType && fe(O.viewType);
|
|
1110
|
+
}, [O.viewType]);
|
|
1111
|
+
let Nt = a.useCallback((e) => {
|
|
1112
|
+
fe(e);
|
|
914
1113
|
try {
|
|
915
|
-
localStorage.setItem(
|
|
1114
|
+
localStorage.setItem(At, e);
|
|
916
1115
|
} catch (e) {
|
|
917
1116
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
918
1117
|
}
|
|
919
1118
|
o?.(e);
|
|
920
|
-
}, [
|
|
1119
|
+
}, [At, o]), Pt = a.useCallback((e) => {
|
|
921
1120
|
ve(e), l?.(e);
|
|
922
|
-
}, [l]),
|
|
923
|
-
navigation:
|
|
924
|
-
objectName:
|
|
925
|
-
onNavigate:
|
|
1121
|
+
}, [l]), Ft = Te({
|
|
1122
|
+
navigation: O.navigation,
|
|
1123
|
+
objectName: O.objectName,
|
|
1124
|
+
onNavigate: O.onNavigate,
|
|
926
1125
|
onRowClick: p
|
|
927
|
-
}), $ = a.useMemo(() => {
|
|
928
|
-
let e =
|
|
929
|
-
if (Array.isArray(e) || (e = []),
|
|
1126
|
+
}), It = Oe(), $ = a.useMemo(() => {
|
|
1127
|
+
let e = O.fields || [];
|
|
1128
|
+
if (Array.isArray(e) || (e = []), It?.isLoaded && O.objectName && (e = e.filter((e) => {
|
|
1129
|
+
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1130
|
+
return t ? It.checkField(O.objectName, t, "read") : !0;
|
|
1131
|
+
})), J.size > 0 && (e = e.filter((e) => {
|
|
930
1132
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
931
|
-
return t != null && !
|
|
932
|
-
})),
|
|
933
|
-
let t = new Map(
|
|
1133
|
+
return t != null && !J.has(t);
|
|
1134
|
+
})), O.fieldOrder && O.fieldOrder.length > 0) {
|
|
1135
|
+
let t = new Map(O.fieldOrder.map((e, t) => [e, t]));
|
|
934
1136
|
e = [...e].sort((e, n) => {
|
|
935
1137
|
let r = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field, i = typeof n == "string" ? n : n?.name || n?.fieldName || n?.field;
|
|
936
1138
|
return (t.get(r) ?? Infinity) - (t.get(i) ?? Infinity);
|
|
@@ -938,126 +1140,131 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
938
1140
|
}
|
|
939
1141
|
return e;
|
|
940
1142
|
}, [
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1143
|
+
O.fields,
|
|
1144
|
+
O.objectName,
|
|
1145
|
+
J,
|
|
1146
|
+
O.fieldOrder,
|
|
1147
|
+
It
|
|
1148
|
+
]), Lt = a.useMemo(() => {
|
|
1149
|
+
let e = Z.mode === "compact" ? "compact" : Z.mode === "spacious" ? "tall" : "medium", t = {
|
|
1150
|
+
objectName: O.objectName,
|
|
947
1151
|
fields: $,
|
|
948
|
-
filters:
|
|
1152
|
+
filters: O.filters,
|
|
949
1153
|
sort: L,
|
|
950
1154
|
className: "h-full w-full",
|
|
951
1155
|
showSearch: !1,
|
|
952
|
-
onRowClick:
|
|
1156
|
+
onRowClick: Ft.handleClick,
|
|
953
1157
|
rowHeight: e,
|
|
954
1158
|
hideRowHeightToggle: !0,
|
|
955
|
-
...
|
|
956
|
-
...
|
|
1159
|
+
...O.striped == null ? {} : { striped: O.striped },
|
|
1160
|
+
...O.bordered == null ? {} : { bordered: O.bordered },
|
|
957
1161
|
...f ? { onColumnStateChange: f } : {},
|
|
958
|
-
...
|
|
1162
|
+
...O.columnState ? { columnState: O.columnState } : {}
|
|
959
1163
|
};
|
|
960
1164
|
switch (j) {
|
|
961
1165
|
case "grid": return {
|
|
962
1166
|
type: "object-grid",
|
|
963
1167
|
...t,
|
|
964
1168
|
columns: $,
|
|
965
|
-
...
|
|
966
|
-
...
|
|
967
|
-
...
|
|
968
|
-
...
|
|
969
|
-
...
|
|
970
|
-
...
|
|
971
|
-
...
|
|
972
|
-
...
|
|
973
|
-
...
|
|
974
|
-
...
|
|
975
|
-
...
|
|
976
|
-
...
|
|
977
|
-
...
|
|
1169
|
+
...O.conditionalFormatting ? { conditionalFormatting: O.conditionalFormatting } : {},
|
|
1170
|
+
...O.inlineEdit == null ? {} : { editable: O.inlineEdit },
|
|
1171
|
+
...O.wrapHeaders == null ? {} : { wrapHeaders: O.wrapHeaders },
|
|
1172
|
+
...O.virtualScroll == null ? {} : { virtualScroll: O.virtualScroll },
|
|
1173
|
+
...O.resizable == null ? {} : { resizable: O.resizable },
|
|
1174
|
+
...O.selection ? { selection: O.selection } : {},
|
|
1175
|
+
...O.pagination ? { pagination: O.pagination } : {},
|
|
1176
|
+
...K ? { grouping: K } : {},
|
|
1177
|
+
...q ? { rowColor: q } : {},
|
|
1178
|
+
...O.rowActions ? { rowActions: O.rowActions } : {},
|
|
1179
|
+
...O.rowActionDefs ? { rowActionDefs: O.rowActionDefs } : {},
|
|
1180
|
+
...O.bulkActions ? { batchActions: O.bulkActions } : {},
|
|
1181
|
+
...O.bulkActionDefs ? { bulkActionDefs: O.bulkActionDefs } : {},
|
|
1182
|
+
...O.options?.grid || {}
|
|
978
1183
|
};
|
|
979
1184
|
case "kanban": return {
|
|
980
1185
|
type: "object-kanban",
|
|
981
1186
|
...t,
|
|
982
|
-
groupBy:
|
|
983
|
-
groupField:
|
|
984
|
-
...
|
|
985
|
-
cardFields:
|
|
986
|
-
...
|
|
987
|
-
...
|
|
988
|
-
...
|
|
1187
|
+
groupBy: O.kanban?.groupField || O.options?.kanban?.groupField || "status",
|
|
1188
|
+
groupField: O.kanban?.groupField || O.options?.kanban?.groupField || "status",
|
|
1189
|
+
...O.kanban?.titleField || O.options?.kanban?.titleField ? { titleField: O.kanban?.titleField || O.options?.kanban?.titleField } : {},
|
|
1190
|
+
cardFields: O.kanban?.cardFields || $ || [],
|
|
1191
|
+
...K ? { grouping: K } : {},
|
|
1192
|
+
...O.options?.kanban || {},
|
|
1193
|
+
...O.kanban || {}
|
|
989
1194
|
};
|
|
990
1195
|
case "calendar": return {
|
|
991
1196
|
type: "object-calendar",
|
|
992
1197
|
...t,
|
|
993
|
-
startDateField:
|
|
994
|
-
endDateField:
|
|
995
|
-
...
|
|
996
|
-
...
|
|
997
|
-
...
|
|
998
|
-
...
|
|
1198
|
+
startDateField: O.calendar?.startDateField || O.options?.calendar?.startDateField || "start_date",
|
|
1199
|
+
endDateField: O.calendar?.endDateField || O.options?.calendar?.endDateField || "end_date",
|
|
1200
|
+
...O.calendar?.titleField || O.options?.calendar?.titleField ? { titleField: O.calendar?.titleField || O.options?.calendar?.titleField } : {},
|
|
1201
|
+
...O.calendar?.defaultView ? { defaultView: O.calendar.defaultView } : {},
|
|
1202
|
+
...O.options?.calendar || {},
|
|
1203
|
+
...O.calendar || {}
|
|
999
1204
|
};
|
|
1000
1205
|
case "gallery": {
|
|
1001
1206
|
let e = {
|
|
1002
|
-
...
|
|
1003
|
-
...
|
|
1207
|
+
...O.options?.gallery || {},
|
|
1208
|
+
...O.gallery || {},
|
|
1209
|
+
cardSize: Q
|
|
1004
1210
|
};
|
|
1005
1211
|
return {
|
|
1006
1212
|
type: "object-gallery",
|
|
1007
1213
|
...t,
|
|
1008
1214
|
gallery: Object.keys(e).length > 0 ? e : void 0,
|
|
1009
|
-
imageField:
|
|
1010
|
-
titleField:
|
|
1011
|
-
subtitleField:
|
|
1012
|
-
...
|
|
1215
|
+
imageField: O.gallery?.coverField || O.gallery?.imageField || O.options?.gallery?.imageField,
|
|
1216
|
+
titleField: O.gallery?.titleField || O.options?.gallery?.titleField || "name",
|
|
1217
|
+
subtitleField: O.gallery?.subtitleField || O.options?.gallery?.subtitleField,
|
|
1218
|
+
...K ? { grouping: K } : {}
|
|
1013
1219
|
};
|
|
1014
1220
|
}
|
|
1015
1221
|
case "timeline": {
|
|
1016
1222
|
let e = {
|
|
1017
|
-
...
|
|
1018
|
-
...
|
|
1223
|
+
...O.options?.timeline || {},
|
|
1224
|
+
...O.timeline || {}
|
|
1019
1225
|
};
|
|
1020
1226
|
return {
|
|
1021
1227
|
type: "object-timeline",
|
|
1022
1228
|
...t,
|
|
1023
1229
|
timeline: Object.keys(e).length > 0 ? e : void 0,
|
|
1024
|
-
startDateField:
|
|
1025
|
-
titleField:
|
|
1026
|
-
...
|
|
1027
|
-
...
|
|
1028
|
-
...
|
|
1029
|
-
...
|
|
1230
|
+
startDateField: O.timeline?.startDateField || O.options?.timeline?.startDateField || O.options?.timeline?.dateField || "created_at",
|
|
1231
|
+
titleField: O.timeline?.titleField || O.options?.timeline?.titleField || "name",
|
|
1232
|
+
...O.timeline?.endDateField ? { endDateField: O.timeline.endDateField } : {},
|
|
1233
|
+
...O.timeline?.groupByField ? { groupByField: O.timeline.groupByField } : {},
|
|
1234
|
+
...O.timeline?.colorField ? { colorField: O.timeline.colorField } : {},
|
|
1235
|
+
...O.timeline?.scale ? { scale: O.timeline.scale } : {}
|
|
1030
1236
|
};
|
|
1031
1237
|
}
|
|
1032
1238
|
case "gantt": return {
|
|
1033
1239
|
type: "object-gantt",
|
|
1034
1240
|
...t,
|
|
1035
|
-
startDateField:
|
|
1036
|
-
endDateField:
|
|
1037
|
-
progressField:
|
|
1038
|
-
dependenciesField:
|
|
1039
|
-
...
|
|
1040
|
-
...
|
|
1041
|
-
...
|
|
1241
|
+
startDateField: O.gantt?.startDateField || O.options?.gantt?.startDateField || "start_date",
|
|
1242
|
+
endDateField: O.gantt?.endDateField || O.options?.gantt?.endDateField || "end_date",
|
|
1243
|
+
progressField: O.gantt?.progressField || O.options?.gantt?.progressField || "progress",
|
|
1244
|
+
dependenciesField: O.gantt?.dependenciesField || O.options?.gantt?.dependenciesField || "dependencies",
|
|
1245
|
+
...O.gantt?.titleField ? { titleField: O.gantt.titleField } : {},
|
|
1246
|
+
...O.options?.gantt || {},
|
|
1247
|
+
...O.gantt || {}
|
|
1042
1248
|
};
|
|
1043
1249
|
case "map": return {
|
|
1044
1250
|
type: "object-map",
|
|
1045
1251
|
...t,
|
|
1046
|
-
locationField:
|
|
1047
|
-
...
|
|
1252
|
+
locationField: O.options?.map?.locationField || "location",
|
|
1253
|
+
...O.options?.map || {}
|
|
1048
1254
|
};
|
|
1049
1255
|
default: return t;
|
|
1050
1256
|
}
|
|
1051
1257
|
}, [
|
|
1052
1258
|
j,
|
|
1053
|
-
|
|
1259
|
+
O,
|
|
1054
1260
|
L,
|
|
1055
1261
|
$,
|
|
1262
|
+
K,
|
|
1056
1263
|
q,
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
Q
|
|
1060
|
-
]),
|
|
1264
|
+
Ft.handleClick,
|
|
1265
|
+
Z.mode,
|
|
1266
|
+
Q
|
|
1267
|
+
]), Rt = R.conditions && R.conditions.length > 0, zt = a.useMemo(() => {
|
|
1061
1268
|
let e, t = (e, t) => {
|
|
1062
1269
|
if (!t) return;
|
|
1063
1270
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1069,17 +1276,17 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1069
1276
|
label: t?.label || e,
|
|
1070
1277
|
...t
|
|
1071
1278
|
}));
|
|
1072
|
-
return
|
|
1279
|
+
return O.objectName ? D(O.objectName, e, n) : n;
|
|
1073
1280
|
};
|
|
1074
|
-
if (e =
|
|
1281
|
+
if (e = U?.fields ? Object.entries(U.fields).map(([e, n]) => ({
|
|
1075
1282
|
value: e,
|
|
1076
|
-
label:
|
|
1283
|
+
label: k(e, n.label || e),
|
|
1077
1284
|
type: n.type || "text",
|
|
1078
1285
|
options: t(e, n.options),
|
|
1079
1286
|
referenceTo: n.reference_to || n.reference,
|
|
1080
1287
|
displayField: n.display_field || n.reference_field,
|
|
1081
1288
|
idField: n.id_field
|
|
1082
|
-
})) : (
|
|
1289
|
+
})) : (O.fields || []).map((e) => {
|
|
1083
1290
|
if (typeof e == "string") return {
|
|
1084
1291
|
value: e,
|
|
1085
1292
|
label: e,
|
|
@@ -1088,32 +1295,32 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1088
1295
|
let n = e.name || e.fieldName;
|
|
1089
1296
|
return {
|
|
1090
1297
|
value: n,
|
|
1091
|
-
label:
|
|
1298
|
+
label: k(n, e.label || e.name),
|
|
1092
1299
|
type: e.type || "text",
|
|
1093
1300
|
options: t(n, e.options),
|
|
1094
1301
|
referenceTo: e.reference_to || e.reference,
|
|
1095
1302
|
displayField: e.display_field || e.reference_field,
|
|
1096
1303
|
idField: e.id_field
|
|
1097
1304
|
};
|
|
1098
|
-
}),
|
|
1099
|
-
let t = new Set(
|
|
1305
|
+
}), O.filterableFields && O.filterableFields.length > 0) {
|
|
1306
|
+
let t = new Set(O.filterableFields);
|
|
1100
1307
|
e = e.filter((e) => t.has(e.value));
|
|
1101
1308
|
}
|
|
1102
1309
|
return e;
|
|
1103
1310
|
}, [
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
]),
|
|
1111
|
-
|
|
1311
|
+
U,
|
|
1312
|
+
O.fields,
|
|
1313
|
+
O.filterableFields,
|
|
1314
|
+
O.objectName,
|
|
1315
|
+
k,
|
|
1316
|
+
D
|
|
1317
|
+
]), Bt = a.useCallback((e) => {
|
|
1318
|
+
pt((t) => {
|
|
1112
1319
|
let n = new Set(t);
|
|
1113
1320
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1114
1321
|
});
|
|
1115
|
-
}, []),
|
|
1116
|
-
let t =
|
|
1322
|
+
}, []), Vt = a.useCallback((e) => {
|
|
1323
|
+
let t = X, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || O.objectName || "export", a = n > 0 ? V.slice(0, n) : V;
|
|
1117
1324
|
if (e === "csv") {
|
|
1118
1325
|
let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
|
|
1119
1326
|
r && t.push(e.join(",")), a.forEach((n) => {
|
|
@@ -1128,127 +1335,127 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1128
1335
|
let e = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1129
1336
|
n.href = t, n.download = `${i}.json`, n.click(), URL.revokeObjectURL(t);
|
|
1130
1337
|
}
|
|
1131
|
-
|
|
1338
|
+
Ct(!1);
|
|
1132
1339
|
}, [
|
|
1133
|
-
|
|
1340
|
+
V,
|
|
1134
1341
|
$,
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
]),
|
|
1342
|
+
X,
|
|
1343
|
+
O.objectName
|
|
1344
|
+
]), Ht = a.useMemo(() => (O.fields || []).map((e) => {
|
|
1138
1345
|
if (typeof e == "string") return {
|
|
1139
1346
|
name: e,
|
|
1140
|
-
label:
|
|
1347
|
+
label: k(e, e)
|
|
1141
1348
|
};
|
|
1142
1349
|
let t = e.name || e.fieldName || e.field;
|
|
1143
1350
|
return {
|
|
1144
1351
|
name: t,
|
|
1145
|
-
label:
|
|
1352
|
+
label: k(t, e.label || e.name || e.field)
|
|
1146
1353
|
};
|
|
1147
|
-
}), [
|
|
1148
|
-
return /* @__PURE__ */
|
|
1149
|
-
ref:
|
|
1354
|
+
}), [O.fields, k]);
|
|
1355
|
+
return /* @__PURE__ */ I("div", {
|
|
1356
|
+
ref: Dt,
|
|
1150
1357
|
className: C("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1151
|
-
...
|
|
1152
|
-
...
|
|
1153
|
-
...
|
|
1358
|
+
...O.aria?.label ? { "aria-label": O.aria.label } : {},
|
|
1359
|
+
...O.aria?.describedBy ? { "aria-describedby": O.aria.describedBy } : {},
|
|
1360
|
+
...O.aria?.live ? { "aria-live": O.aria.live } : {},
|
|
1154
1361
|
role: "region",
|
|
1155
1362
|
children: [
|
|
1156
|
-
|
|
1363
|
+
kt > 0 && /* @__PURE__ */ F("div", {
|
|
1157
1364
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1158
|
-
style: { height:
|
|
1159
|
-
children:
|
|
1365
|
+
style: { height: kt },
|
|
1366
|
+
children: E(Ot ? "list.refreshing" : "list.pullToRefresh")
|
|
1160
1367
|
}),
|
|
1161
|
-
_ && /* @__PURE__ */
|
|
1368
|
+
_ && /* @__PURE__ */ F("div", {
|
|
1162
1369
|
className: "px-4 py-1 flex items-center bg-background",
|
|
1163
|
-
children: /* @__PURE__ */
|
|
1370
|
+
children: /* @__PURE__ */ F(Me, {
|
|
1164
1371
|
currentView: j,
|
|
1165
|
-
availableViews:
|
|
1166
|
-
onViewChange:
|
|
1372
|
+
availableViews: Mt,
|
|
1373
|
+
onViewChange: Nt
|
|
1167
1374
|
})
|
|
1168
1375
|
}),
|
|
1169
|
-
|
|
1376
|
+
O.description && O.appearance?.showDescription !== !1 && /* @__PURE__ */ F("div", {
|
|
1170
1377
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
1171
1378
|
"data-testid": "view-description",
|
|
1172
|
-
children: typeof
|
|
1379
|
+
children: typeof O.description == "string" ? O.description : ""
|
|
1173
1380
|
}),
|
|
1174
|
-
/* @__PURE__ */
|
|
1381
|
+
/* @__PURE__ */ I("div", {
|
|
1175
1382
|
className: "border-b px-2 sm:px-4 py-1 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1176
|
-
children: [/* @__PURE__ */
|
|
1383
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1177
1384
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1178
1385
|
children: [
|
|
1179
|
-
|
|
1180
|
-
tabs:
|
|
1386
|
+
O.tabs && O.tabs.length > 0 && /* @__PURE__ */ F(Pe, {
|
|
1387
|
+
tabs: O.tabs,
|
|
1181
1388
|
activeTab: Ie,
|
|
1182
|
-
onTabChange:
|
|
1389
|
+
onTabChange: ze,
|
|
1183
1390
|
className: "!px-0 !py-0 shrink-0"
|
|
1184
1391
|
}),
|
|
1185
|
-
|
|
1186
|
-
|
|
1392
|
+
O.tabs && O.tabs.length > 0 && gt && /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-1 shrink-0" }),
|
|
1393
|
+
gt && /* @__PURE__ */ F("div", {
|
|
1187
1394
|
className: "shrink-0 min-w-0",
|
|
1188
1395
|
"data-testid": "user-filters",
|
|
1189
|
-
children: /* @__PURE__ */
|
|
1190
|
-
config:
|
|
1191
|
-
objectDef:
|
|
1192
|
-
data:
|
|
1193
|
-
onFilterChange:
|
|
1396
|
+
children: /* @__PURE__ */ F(Re, {
|
|
1397
|
+
config: gt,
|
|
1398
|
+
objectDef: U,
|
|
1399
|
+
data: V,
|
|
1400
|
+
onFilterChange: ht,
|
|
1194
1401
|
maxVisible: 3
|
|
1195
1402
|
})
|
|
1196
1403
|
})
|
|
1197
1404
|
]
|
|
1198
|
-
}), /* @__PURE__ */
|
|
1405
|
+
}), /* @__PURE__ */ I("div", {
|
|
1199
1406
|
className: "flex items-center gap-0 shrink-0",
|
|
1200
1407
|
children: [
|
|
1201
|
-
A.showHideFields && /* @__PURE__ */
|
|
1202
|
-
open:
|
|
1203
|
-
onOpenChange:
|
|
1204
|
-
children: [/* @__PURE__ */
|
|
1408
|
+
A.showHideFields && !A.compactToolbar && /* @__PURE__ */ I(y, {
|
|
1409
|
+
open: bt,
|
|
1410
|
+
onOpenChange: xt,
|
|
1411
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1205
1412
|
asChild: !0,
|
|
1206
|
-
children: /* @__PURE__ */
|
|
1413
|
+
children: /* @__PURE__ */ I(d, {
|
|
1207
1414
|
variant: "ghost",
|
|
1208
1415
|
size: "sm",
|
|
1209
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1416
|
+
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", J.size > 0 && "text-primary"),
|
|
1210
1417
|
children: [
|
|
1211
|
-
/* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ F(ie, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1419
|
+
/* @__PURE__ */ F("span", {
|
|
1213
1420
|
className: "hidden sm:inline",
|
|
1214
|
-
children:
|
|
1421
|
+
children: E("list.hideFields")
|
|
1215
1422
|
}),
|
|
1216
|
-
|
|
1423
|
+
J.size > 0 && /* @__PURE__ */ F("span", {
|
|
1217
1424
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1218
|
-
children:
|
|
1425
|
+
children: J.size
|
|
1219
1426
|
})
|
|
1220
1427
|
]
|
|
1221
1428
|
})
|
|
1222
|
-
}), /* @__PURE__ */
|
|
1429
|
+
}), /* @__PURE__ */ F(b, {
|
|
1223
1430
|
align: "start",
|
|
1224
1431
|
className: "w-64 p-3",
|
|
1225
|
-
children: /* @__PURE__ */
|
|
1432
|
+
children: /* @__PURE__ */ I("div", {
|
|
1226
1433
|
className: "space-y-2",
|
|
1227
|
-
children: [/* @__PURE__ */
|
|
1434
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1228
1435
|
className: "flex items-center justify-between border-b pb-2",
|
|
1229
|
-
children: [/* @__PURE__ */
|
|
1436
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1230
1437
|
className: "font-medium text-sm",
|
|
1231
|
-
children:
|
|
1232
|
-
}),
|
|
1438
|
+
children: E("list.hideFieldsTitle")
|
|
1439
|
+
}), J.size > 0 && /* @__PURE__ */ F(d, {
|
|
1233
1440
|
variant: "ghost",
|
|
1234
1441
|
size: "sm",
|
|
1235
1442
|
className: "h-6 px-2 text-xs",
|
|
1236
|
-
onClick: () =>
|
|
1237
|
-
children:
|
|
1443
|
+
onClick: () => yt(/* @__PURE__ */ new Set()),
|
|
1444
|
+
children: E("list.showAll")
|
|
1238
1445
|
})]
|
|
1239
|
-
}), /* @__PURE__ */
|
|
1446
|
+
}), /* @__PURE__ */ F("div", {
|
|
1240
1447
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1241
|
-
children:
|
|
1448
|
+
children: Ht.map((e) => /* @__PURE__ */ I("label", {
|
|
1242
1449
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1243
|
-
children: [/* @__PURE__ */
|
|
1450
|
+
children: [/* @__PURE__ */ F("input", {
|
|
1244
1451
|
type: "checkbox",
|
|
1245
|
-
checked: !
|
|
1452
|
+
checked: !J.has(e.name),
|
|
1246
1453
|
onChange: () => {
|
|
1247
|
-
let t = new Set(
|
|
1248
|
-
t.has(e.name) ? t.delete(e.name) : t.add(e.name),
|
|
1454
|
+
let t = new Set(J);
|
|
1455
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), yt(t);
|
|
1249
1456
|
},
|
|
1250
1457
|
className: "rounded border-input"
|
|
1251
|
-
}), /* @__PURE__ */
|
|
1458
|
+
}), /* @__PURE__ */ F("span", {
|
|
1252
1459
|
className: "truncate",
|
|
1253
1460
|
children: e.label
|
|
1254
1461
|
})]
|
|
@@ -1257,142 +1464,142 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1257
1464
|
})
|
|
1258
1465
|
})]
|
|
1259
1466
|
}),
|
|
1260
|
-
A.showHideFields && (A.showFilters || A.showSort || A.showGroup) && /* @__PURE__ */
|
|
1261
|
-
A.showFilters && /* @__PURE__ */
|
|
1262
|
-
open:
|
|
1467
|
+
A.showHideFields && !A.compactToolbar && (A.showFilters || A.showSort || A.showGroup) && /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
|
|
1468
|
+
A.showFilters && /* @__PURE__ */ I(y, {
|
|
1469
|
+
open: je,
|
|
1263
1470
|
onOpenChange: Ne,
|
|
1264
|
-
children: [/* @__PURE__ */
|
|
1471
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1265
1472
|
asChild: !0,
|
|
1266
|
-
children: /* @__PURE__ */
|
|
1473
|
+
children: /* @__PURE__ */ I(d, {
|
|
1267
1474
|
variant: "ghost",
|
|
1268
1475
|
size: "sm",
|
|
1269
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1476
|
+
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Rt && "text-foreground font-medium"),
|
|
1270
1477
|
children: [
|
|
1271
|
-
/* @__PURE__ */
|
|
1272
|
-
/* @__PURE__ */
|
|
1478
|
+
/* @__PURE__ */ F(me, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1479
|
+
/* @__PURE__ */ F("span", {
|
|
1273
1480
|
className: "hidden sm:inline",
|
|
1274
|
-
children:
|
|
1481
|
+
children: E("list.filter")
|
|
1275
1482
|
}),
|
|
1276
|
-
|
|
1483
|
+
Rt && /* @__PURE__ */ F("span", {
|
|
1277
1484
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1278
1485
|
children: R.conditions?.length || 0
|
|
1279
1486
|
})
|
|
1280
1487
|
]
|
|
1281
1488
|
})
|
|
1282
|
-
}), /* @__PURE__ */
|
|
1489
|
+
}), /* @__PURE__ */ F(b, {
|
|
1283
1490
|
align: "start",
|
|
1284
1491
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1285
|
-
children: /* @__PURE__ */
|
|
1492
|
+
children: /* @__PURE__ */ I("div", {
|
|
1286
1493
|
className: "space-y-4",
|
|
1287
|
-
children: [/* @__PURE__ */
|
|
1494
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1288
1495
|
className: "flex items-center justify-between border-b pb-2",
|
|
1289
|
-
children: /* @__PURE__ */
|
|
1496
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1290
1497
|
className: "font-medium text-sm",
|
|
1291
|
-
children:
|
|
1498
|
+
children: E("list.filterRecords")
|
|
1292
1499
|
})
|
|
1293
|
-
}), /* @__PURE__ */
|
|
1294
|
-
fields:
|
|
1500
|
+
}), /* @__PURE__ */ F(m, {
|
|
1501
|
+
fields: zt,
|
|
1295
1502
|
value: R,
|
|
1296
1503
|
onChange: (e) => {
|
|
1297
|
-
|
|
1504
|
+
z(e), s && s(e);
|
|
1298
1505
|
}
|
|
1299
1506
|
})]
|
|
1300
1507
|
})
|
|
1301
1508
|
})]
|
|
1302
1509
|
}),
|
|
1303
|
-
A.showGroup && /* @__PURE__ */
|
|
1304
|
-
open:
|
|
1305
|
-
onOpenChange:
|
|
1306
|
-
children: [/* @__PURE__ */
|
|
1510
|
+
A.showGroup && !A.compactToolbar && /* @__PURE__ */ I(y, {
|
|
1511
|
+
open: rt,
|
|
1512
|
+
onOpenChange: it,
|
|
1513
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1307
1514
|
asChild: !0,
|
|
1308
|
-
children: /* @__PURE__ */
|
|
1515
|
+
children: /* @__PURE__ */ I(d, {
|
|
1309
1516
|
variant: "ghost",
|
|
1310
1517
|
size: "sm",
|
|
1311
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1518
|
+
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", K && "text-foreground font-medium"),
|
|
1312
1519
|
children: [
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1520
|
+
/* @__PURE__ */ F(ae, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1521
|
+
/* @__PURE__ */ F("span", {
|
|
1315
1522
|
className: "hidden sm:inline",
|
|
1316
|
-
children:
|
|
1523
|
+
children: E("list.group")
|
|
1317
1524
|
}),
|
|
1318
|
-
|
|
1525
|
+
K && K.fields?.length > 0 && /* @__PURE__ */ F("span", {
|
|
1319
1526
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1320
|
-
children:
|
|
1527
|
+
children: K.fields.length
|
|
1321
1528
|
})
|
|
1322
1529
|
]
|
|
1323
1530
|
})
|
|
1324
|
-
}), /* @__PURE__ */
|
|
1531
|
+
}), /* @__PURE__ */ F(b, {
|
|
1325
1532
|
align: "start",
|
|
1326
1533
|
className: "w-72 p-3",
|
|
1327
|
-
children: /* @__PURE__ */
|
|
1534
|
+
children: /* @__PURE__ */ I("div", {
|
|
1328
1535
|
className: "space-y-2",
|
|
1329
|
-
children: [/* @__PURE__ */
|
|
1536
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1330
1537
|
className: "flex items-center justify-between border-b pb-2",
|
|
1331
|
-
children: [/* @__PURE__ */
|
|
1538
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1332
1539
|
className: "font-medium text-sm",
|
|
1333
|
-
children:
|
|
1334
|
-
}),
|
|
1540
|
+
children: E("list.groupBy")
|
|
1541
|
+
}), K && /* @__PURE__ */ F(d, {
|
|
1335
1542
|
variant: "ghost",
|
|
1336
1543
|
size: "sm",
|
|
1337
1544
|
className: "h-6 px-2 text-xs",
|
|
1338
|
-
onClick: () =>
|
|
1545
|
+
onClick: () => nt(void 0),
|
|
1339
1546
|
"data-testid": "clear-grouping",
|
|
1340
|
-
children:
|
|
1547
|
+
children: E("list.clear")
|
|
1341
1548
|
})]
|
|
1342
|
-
}), /* @__PURE__ */
|
|
1549
|
+
}), /* @__PURE__ */ F("div", {
|
|
1343
1550
|
"data-testid": "group-field-list",
|
|
1344
|
-
children: /* @__PURE__ */
|
|
1345
|
-
value:
|
|
1346
|
-
fieldOptions:
|
|
1551
|
+
children: /* @__PURE__ */ F(h, {
|
|
1552
|
+
value: K,
|
|
1553
|
+
fieldOptions: Ht.map((e) => ({
|
|
1347
1554
|
value: e.name,
|
|
1348
1555
|
label: e.label || e.name
|
|
1349
1556
|
})),
|
|
1350
1557
|
maxLevels: 3,
|
|
1351
1558
|
labels: {
|
|
1352
|
-
addGroup:
|
|
1353
|
-
collapseTitle:
|
|
1354
|
-
removeTitle:
|
|
1559
|
+
addGroup: E("list.addGroup", { defaultValue: "Add group field" }),
|
|
1560
|
+
collapseTitle: E("list.collapsedByDefault", { defaultValue: "Collapsed by default" }),
|
|
1561
|
+
removeTitle: E("list.removeGroup", { defaultValue: "Remove" })
|
|
1355
1562
|
},
|
|
1356
|
-
onChange: (e) =>
|
|
1563
|
+
onChange: (e) => nt(e)
|
|
1357
1564
|
})
|
|
1358
1565
|
})]
|
|
1359
1566
|
})
|
|
1360
1567
|
})]
|
|
1361
1568
|
}),
|
|
1362
|
-
A.showSort && /* @__PURE__ */
|
|
1363
|
-
open:
|
|
1364
|
-
onOpenChange:
|
|
1365
|
-
children: [/* @__PURE__ */
|
|
1569
|
+
A.showSort && /* @__PURE__ */ I(y, {
|
|
1570
|
+
open: Ce,
|
|
1571
|
+
onOpenChange: Ee,
|
|
1572
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1366
1573
|
asChild: !0,
|
|
1367
|
-
children: /* @__PURE__ */
|
|
1574
|
+
children: /* @__PURE__ */ I(d, {
|
|
1368
1575
|
variant: "ghost",
|
|
1369
1576
|
size: "sm",
|
|
1370
1577
|
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", L.length > 0 && "text-foreground font-medium"),
|
|
1371
1578
|
children: [
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1579
|
+
/* @__PURE__ */ F(T, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1580
|
+
/* @__PURE__ */ F("span", {
|
|
1374
1581
|
className: "hidden sm:inline",
|
|
1375
|
-
children:
|
|
1582
|
+
children: E("list.sort")
|
|
1376
1583
|
}),
|
|
1377
|
-
L.length > 0 && /* @__PURE__ */
|
|
1584
|
+
L.length > 0 && /* @__PURE__ */ F("span", {
|
|
1378
1585
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1379
1586
|
children: L.length
|
|
1380
1587
|
})
|
|
1381
1588
|
]
|
|
1382
1589
|
})
|
|
1383
|
-
}), /* @__PURE__ */
|
|
1590
|
+
}), /* @__PURE__ */ F(b, {
|
|
1384
1591
|
align: "start",
|
|
1385
1592
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1386
|
-
children: /* @__PURE__ */
|
|
1593
|
+
children: /* @__PURE__ */ I("div", {
|
|
1387
1594
|
className: "space-y-4",
|
|
1388
|
-
children: [/* @__PURE__ */
|
|
1595
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1389
1596
|
className: "flex items-center justify-between border-b pb-2",
|
|
1390
|
-
children: /* @__PURE__ */
|
|
1597
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1391
1598
|
className: "font-medium text-sm",
|
|
1392
|
-
children:
|
|
1599
|
+
children: E("list.sortRecords")
|
|
1393
1600
|
})
|
|
1394
|
-
}), /* @__PURE__ */
|
|
1395
|
-
fields:
|
|
1601
|
+
}), /* @__PURE__ */ F(S, {
|
|
1602
|
+
fields: zt,
|
|
1396
1603
|
value: L,
|
|
1397
1604
|
onChange: (e) => {
|
|
1398
1605
|
ke(e), c && c(e);
|
|
@@ -1401,60 +1608,60 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1401
1608
|
})
|
|
1402
1609
|
})]
|
|
1403
1610
|
}),
|
|
1404
|
-
(A.showFilters || A.showSort || A.showGroup) && (A.showColor || A.showDensity) && /* @__PURE__ */
|
|
1405
|
-
A.showColor && /* @__PURE__ */
|
|
1406
|
-
open:
|
|
1407
|
-
onOpenChange:
|
|
1408
|
-
children: [/* @__PURE__ */
|
|
1611
|
+
!A.compactToolbar && (A.showFilters || A.showSort || A.showGroup) && (A.showColor || A.showDensity) && /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
|
|
1612
|
+
A.showColor && !A.compactToolbar && /* @__PURE__ */ I(y, {
|
|
1613
|
+
open: st,
|
|
1614
|
+
onOpenChange: ct,
|
|
1615
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1409
1616
|
asChild: !0,
|
|
1410
|
-
children: /* @__PURE__ */
|
|
1617
|
+
children: /* @__PURE__ */ I(d, {
|
|
1411
1618
|
variant: "ghost",
|
|
1412
1619
|
size: "sm",
|
|
1413
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1414
|
-
children: [/* @__PURE__ */
|
|
1620
|
+
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", q && "text-foreground font-medium"),
|
|
1621
|
+
children: [/* @__PURE__ */ F(se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1415
1622
|
className: "hidden sm:inline",
|
|
1416
|
-
children:
|
|
1623
|
+
children: E("list.color")
|
|
1417
1624
|
})]
|
|
1418
1625
|
})
|
|
1419
|
-
}), /* @__PURE__ */
|
|
1626
|
+
}), /* @__PURE__ */ F(b, {
|
|
1420
1627
|
align: "start",
|
|
1421
1628
|
className: "w-64 p-3",
|
|
1422
|
-
children: /* @__PURE__ */
|
|
1629
|
+
children: /* @__PURE__ */ I("div", {
|
|
1423
1630
|
className: "space-y-2",
|
|
1424
|
-
children: [/* @__PURE__ */
|
|
1631
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1425
1632
|
className: "flex items-center justify-between border-b pb-2",
|
|
1426
|
-
children: [/* @__PURE__ */
|
|
1633
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1427
1634
|
className: "font-medium text-sm",
|
|
1428
|
-
children:
|
|
1429
|
-
}),
|
|
1635
|
+
children: E("list.rowColor")
|
|
1636
|
+
}), q && /* @__PURE__ */ F(d, {
|
|
1430
1637
|
variant: "ghost",
|
|
1431
1638
|
size: "sm",
|
|
1432
1639
|
className: "h-6 px-2 text-xs",
|
|
1433
|
-
onClick: () =>
|
|
1640
|
+
onClick: () => ot(void 0),
|
|
1434
1641
|
"data-testid": "clear-row-color",
|
|
1435
|
-
children:
|
|
1642
|
+
children: E("list.clear")
|
|
1436
1643
|
})]
|
|
1437
|
-
}), /* @__PURE__ */
|
|
1644
|
+
}), /* @__PURE__ */ I("div", {
|
|
1438
1645
|
className: "space-y-2",
|
|
1439
1646
|
"data-testid": "color-field-list",
|
|
1440
|
-
children: [/* @__PURE__ */
|
|
1647
|
+
children: [/* @__PURE__ */ F("label", {
|
|
1441
1648
|
className: "text-xs text-muted-foreground",
|
|
1442
|
-
children:
|
|
1443
|
-
}), /* @__PURE__ */
|
|
1649
|
+
children: E("list.colorByField")
|
|
1650
|
+
}), /* @__PURE__ */ I("select", {
|
|
1444
1651
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1445
|
-
value:
|
|
1652
|
+
value: q?.field || "",
|
|
1446
1653
|
onChange: (e) => {
|
|
1447
1654
|
let t = e.target.value;
|
|
1448
|
-
|
|
1655
|
+
ot(t ? {
|
|
1449
1656
|
field: t,
|
|
1450
|
-
colors:
|
|
1657
|
+
colors: q?.colors || {}
|
|
1451
1658
|
} : void 0);
|
|
1452
1659
|
},
|
|
1453
1660
|
"data-testid": "color-field-select",
|
|
1454
|
-
children: [/* @__PURE__ */
|
|
1661
|
+
children: [/* @__PURE__ */ F("option", {
|
|
1455
1662
|
value: "",
|
|
1456
|
-
children:
|
|
1457
|
-
}),
|
|
1663
|
+
children: E("list.none")
|
|
1664
|
+
}), Ht.map((e) => /* @__PURE__ */ F("option", {
|
|
1458
1665
|
value: e.name,
|
|
1459
1666
|
children: e.label
|
|
1460
1667
|
}, e.name))]
|
|
@@ -1463,253 +1670,286 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1463
1670
|
})
|
|
1464
1671
|
})]
|
|
1465
1672
|
}),
|
|
1466
|
-
A.showDensity && (() => {
|
|
1467
|
-
let e =
|
|
1468
|
-
|
|
1673
|
+
A.showDensity && !A.compactToolbar && j !== "gallery" && (() => {
|
|
1674
|
+
let e = Z.mode === "compact" ? ue : Z.mode === "comfortable" ? N : le, t = Z.mode === "compact" ? E("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Z.mode === "comfortable" ? E("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : E("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${E("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = E("grid.toolbar.densityCycleHint", {
|
|
1675
|
+
defaultValue: "{{label}} (click to cycle)",
|
|
1676
|
+
label: n
|
|
1677
|
+
});
|
|
1678
|
+
return /* @__PURE__ */ F(d, {
|
|
1469
1679
|
variant: "ghost",
|
|
1470
1680
|
size: "sm",
|
|
1471
|
-
"aria-label":
|
|
1472
|
-
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1473
|
-
onClick:
|
|
1474
|
-
title:
|
|
1475
|
-
children: /* @__PURE__ */
|
|
1681
|
+
"aria-label": n,
|
|
1682
|
+
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Z.mode !== "compact" && "text-foreground font-medium"),
|
|
1683
|
+
onClick: Z.cycle,
|
|
1684
|
+
title: r,
|
|
1685
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1476
1686
|
});
|
|
1477
1687
|
})(),
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1688
|
+
A.showDensity && !A.compactToolbar && j === "gallery" && (() => {
|
|
1689
|
+
let e = Q === "small" ? ue : Q === "medium" ? N : le, t = Q === "small" ? E("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Q === "medium" ? E("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : E("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${E("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = E("grid.toolbar.densityCycleHint", {
|
|
1690
|
+
defaultValue: "{{label}} (click to cycle)",
|
|
1691
|
+
label: n
|
|
1692
|
+
});
|
|
1693
|
+
return /* @__PURE__ */ F(d, {
|
|
1694
|
+
variant: "ghost",
|
|
1695
|
+
size: "sm",
|
|
1696
|
+
"aria-label": n,
|
|
1697
|
+
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Q !== "small" && "text-foreground font-medium"),
|
|
1698
|
+
onClick: Et,
|
|
1699
|
+
title: r,
|
|
1700
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1701
|
+
});
|
|
1702
|
+
})(),
|
|
1703
|
+
A.compactToolbar && (A.showGroup || A.showColor || A.showDensity || A.showHideFields) && /* @__PURE__ */ F(Fe, {
|
|
1704
|
+
t: E,
|
|
1705
|
+
allFields: Ht,
|
|
1706
|
+
showGroup: A.showGroup,
|
|
1707
|
+
groupingConfig: K,
|
|
1708
|
+
setGroupingConfig: nt,
|
|
1709
|
+
showColor: A.showColor,
|
|
1710
|
+
rowColorConfig: q,
|
|
1711
|
+
setRowColorConfig: ot,
|
|
1712
|
+
showDensity: A.showDensity,
|
|
1713
|
+
density: Z,
|
|
1714
|
+
showHideFields: A.showHideFields,
|
|
1715
|
+
hiddenFields: J,
|
|
1716
|
+
updateHiddenFields: yt
|
|
1717
|
+
}),
|
|
1718
|
+
(A.showColor || A.showDensity || A.compactToolbar) && X && O.allowExport !== !1 && /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
|
|
1719
|
+
X && O.allowExport !== !1 && /* @__PURE__ */ I(y, {
|
|
1720
|
+
open: St,
|
|
1721
|
+
onOpenChange: Ct,
|
|
1722
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1483
1723
|
asChild: !0,
|
|
1484
|
-
children: /* @__PURE__ */
|
|
1724
|
+
children: /* @__PURE__ */ I(d, {
|
|
1485
1725
|
variant: "ghost",
|
|
1486
1726
|
size: "sm",
|
|
1487
1727
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1488
|
-
children: [/* @__PURE__ */
|
|
1728
|
+
children: [/* @__PURE__ */ F(re, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1489
1729
|
className: "hidden sm:inline",
|
|
1490
|
-
children:
|
|
1730
|
+
children: E("list.export")
|
|
1491
1731
|
})]
|
|
1492
1732
|
})
|
|
1493
|
-
}), /* @__PURE__ */
|
|
1733
|
+
}), /* @__PURE__ */ F(b, {
|
|
1494
1734
|
align: "start",
|
|
1495
1735
|
className: "w-48 p-2",
|
|
1496
|
-
children: /* @__PURE__ */
|
|
1736
|
+
children: /* @__PURE__ */ F("div", {
|
|
1497
1737
|
className: "space-y-1",
|
|
1498
|
-
children: (
|
|
1738
|
+
children: (X.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ I(d, {
|
|
1499
1739
|
variant: "ghost",
|
|
1500
1740
|
size: "sm",
|
|
1501
1741
|
className: "w-full justify-start h-8 text-xs",
|
|
1502
|
-
onClick: () =>
|
|
1503
|
-
children: [/* @__PURE__ */
|
|
1742
|
+
onClick: () => Vt(e),
|
|
1743
|
+
children: [/* @__PURE__ */ F(re, { className: "h-3.5 w-3.5 mr-2" }), E("list.exportAs", { format: e.toUpperCase() })]
|
|
1504
1744
|
}, e))
|
|
1505
1745
|
})
|
|
1506
1746
|
})]
|
|
1507
1747
|
}),
|
|
1508
|
-
(
|
|
1748
|
+
(O.sharing?.enabled || O.sharing?.type) && /* @__PURE__ */ I(d, {
|
|
1509
1749
|
variant: "ghost",
|
|
1510
1750
|
size: "sm",
|
|
1511
1751
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1512
|
-
title: `Sharing: ${
|
|
1752
|
+
title: `Sharing: ${O.sharing?.visibility || O.sharing?.type || "private"}`,
|
|
1513
1753
|
"data-testid": "share-button",
|
|
1514
|
-
children: [/* @__PURE__ */
|
|
1754
|
+
children: [/* @__PURE__ */ F(pe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1515
1755
|
className: "hidden sm:inline",
|
|
1516
|
-
children:
|
|
1756
|
+
children: E("list.share")
|
|
1517
1757
|
})]
|
|
1518
1758
|
}),
|
|
1519
|
-
|
|
1759
|
+
O.allowPrinting && /* @__PURE__ */ I(d, {
|
|
1520
1760
|
variant: "ghost",
|
|
1521
1761
|
size: "sm",
|
|
1522
1762
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1523
1763
|
onClick: () => window.print(),
|
|
1524
1764
|
"data-testid": "print-button",
|
|
1525
|
-
children: [/* @__PURE__ */
|
|
1765
|
+
children: [/* @__PURE__ */ F(ce, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1526
1766
|
className: "hidden sm:inline",
|
|
1527
|
-
children:
|
|
1767
|
+
children: E("list.print")
|
|
1528
1768
|
})]
|
|
1529
1769
|
}),
|
|
1530
1770
|
(() => {
|
|
1531
|
-
let e =
|
|
1532
|
-
return A.showSearch && e ? /* @__PURE__ */
|
|
1771
|
+
let e = O.allowPrinting || O.sharing?.enabled || O.sharing?.type || X && O.allowExport !== !1;
|
|
1772
|
+
return A.showSearch && e ? /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }) : null;
|
|
1533
1773
|
})(),
|
|
1534
|
-
A.showSearch && /* @__PURE__ */
|
|
1535
|
-
open:
|
|
1774
|
+
A.showSearch && /* @__PURE__ */ I(y, {
|
|
1775
|
+
open: ye,
|
|
1536
1776
|
onOpenChange: Se,
|
|
1537
|
-
children: [/* @__PURE__ */
|
|
1777
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1538
1778
|
asChild: !0,
|
|
1539
|
-
children: /* @__PURE__ */
|
|
1779
|
+
children: /* @__PURE__ */ F(d, {
|
|
1540
1780
|
variant: "ghost",
|
|
1541
1781
|
size: "sm",
|
|
1542
|
-
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1782
|
+
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", P && "text-foreground font-medium"),
|
|
1543
1783
|
"data-testid": "search-icon-button",
|
|
1544
|
-
title:
|
|
1545
|
-
children: /* @__PURE__ */
|
|
1784
|
+
title: E("list.search"),
|
|
1785
|
+
children: /* @__PURE__ */ F(de, { className: "h-3.5 w-3.5" })
|
|
1546
1786
|
})
|
|
1547
|
-
}), /* @__PURE__ */
|
|
1787
|
+
}), /* @__PURE__ */ F(b, {
|
|
1548
1788
|
align: "end",
|
|
1549
1789
|
className: "w-[calc(100vw-2rem)] sm:w-64 p-2",
|
|
1550
1790
|
"data-testid": "search-popover",
|
|
1551
|
-
children: /* @__PURE__ */
|
|
1791
|
+
children: /* @__PURE__ */ I("div", {
|
|
1552
1792
|
className: "relative",
|
|
1553
1793
|
children: [
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
placeholder:
|
|
1557
|
-
value:
|
|
1558
|
-
onChange: (e) =>
|
|
1794
|
+
/* @__PURE__ */ F(de, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
1795
|
+
/* @__PURE__ */ F(g, {
|
|
1796
|
+
placeholder: E("list.search") + "...",
|
|
1797
|
+
value: P,
|
|
1798
|
+
onChange: (e) => Pt(e.target.value),
|
|
1559
1799
|
className: "pl-7 h-8 text-xs",
|
|
1560
1800
|
autoFocus: !0
|
|
1561
1801
|
}),
|
|
1562
|
-
|
|
1802
|
+
P && /* @__PURE__ */ F(d, {
|
|
1563
1803
|
variant: "ghost",
|
|
1564
1804
|
size: "sm",
|
|
1565
1805
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
1566
|
-
onClick: () =>
|
|
1567
|
-
children: /* @__PURE__ */
|
|
1806
|
+
onClick: () => Pt(""),
|
|
1807
|
+
children: /* @__PURE__ */ F(ge, { className: "h-3 w-3" })
|
|
1568
1808
|
})
|
|
1569
1809
|
]
|
|
1570
1810
|
})
|
|
1571
1811
|
})]
|
|
1572
1812
|
}),
|
|
1573
|
-
A.showAddRecord && A.addRecordPosition === "top" && /* @__PURE__ */
|
|
1813
|
+
A.showAddRecord && A.addRecordPosition === "top" && /* @__PURE__ */ I(d, {
|
|
1574
1814
|
variant: "ghost",
|
|
1575
1815
|
size: "sm",
|
|
1576
1816
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1577
1817
|
"data-testid": "add-record-button",
|
|
1578
1818
|
onClick: () => w.onAddRecord?.(),
|
|
1579
|
-
children: [/* @__PURE__ */
|
|
1819
|
+
children: [/* @__PURE__ */ F(M, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1580
1820
|
className: "hidden sm:inline",
|
|
1581
|
-
children:
|
|
1821
|
+
children: E("list.addRecord")
|
|
1582
1822
|
})]
|
|
1583
1823
|
})
|
|
1584
1824
|
]
|
|
1585
1825
|
})]
|
|
1586
1826
|
}),
|
|
1587
|
-
|
|
1827
|
+
Y && Y.length > 0 && /* @__PURE__ */ F("div", {
|
|
1588
1828
|
className: "border-b px-2 sm:px-4 py-1 flex items-center gap-1 flex-wrap bg-background",
|
|
1589
1829
|
"data-testid": "quick-filters",
|
|
1590
|
-
children:
|
|
1591
|
-
let t =
|
|
1592
|
-
return /* @__PURE__ */
|
|
1830
|
+
children: Y.map((e) => {
|
|
1831
|
+
let t = ft.has(e.id), n = e.icon ? _e[e.icon.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
1832
|
+
return /* @__PURE__ */ I(d, {
|
|
1593
1833
|
variant: t ? "default" : "outline",
|
|
1594
1834
|
size: "sm",
|
|
1595
1835
|
className: "h-7 px-3 text-xs",
|
|
1596
|
-
onClick: () =>
|
|
1597
|
-
children: [n && /* @__PURE__ */
|
|
1836
|
+
onClick: () => Bt(e.id),
|
|
1837
|
+
children: [n && /* @__PURE__ */ F(n, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
1598
1838
|
}, e.id);
|
|
1599
1839
|
})
|
|
1600
1840
|
}),
|
|
1601
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ F("div", {
|
|
1602
1842
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
1603
|
-
children: !
|
|
1604
|
-
let e =
|
|
1605
|
-
return /* @__PURE__ */
|
|
1843
|
+
children: !Ve && V.length === 0 && j === "grid" ? (() => {
|
|
1844
|
+
let e = O.emptyState?.icon;
|
|
1845
|
+
return /* @__PURE__ */ I("div", {
|
|
1606
1846
|
className: "flex flex-col items-center justify-center h-full min-h-[200px] text-center p-8",
|
|
1607
1847
|
"data-testid": "empty-state",
|
|
1608
1848
|
children: [
|
|
1609
|
-
/* @__PURE__ */
|
|
1610
|
-
/* @__PURE__ */
|
|
1849
|
+
/* @__PURE__ */ F(e ? _e[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? oe : oe, { className: "h-12 w-12 text-muted-foreground/50 mb-4" }),
|
|
1850
|
+
/* @__PURE__ */ F("h3", {
|
|
1611
1851
|
className: "text-lg font-medium text-foreground mb-1",
|
|
1612
|
-
children: (typeof
|
|
1852
|
+
children: (typeof O.emptyState?.title == "string" ? O.emptyState.title : void 0) ?? E("list.noItems")
|
|
1613
1853
|
}),
|
|
1614
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ F("p", {
|
|
1615
1855
|
className: "text-sm text-muted-foreground max-w-md",
|
|
1616
|
-
children: (typeof
|
|
1856
|
+
children: (typeof O.emptyState?.message == "string" ? O.emptyState.message : void 0) ?? E("list.noItemsMessage")
|
|
1617
1857
|
}),
|
|
1618
|
-
A.showAddRecord && /* @__PURE__ */
|
|
1858
|
+
A.showAddRecord && /* @__PURE__ */ I(d, {
|
|
1619
1859
|
variant: "default",
|
|
1620
1860
|
size: "sm",
|
|
1621
1861
|
className: "mt-4",
|
|
1622
1862
|
"data-testid": "empty-state-add-record",
|
|
1623
1863
|
onClick: () => w.onAddRecord?.(),
|
|
1624
|
-
children: [/* @__PURE__ */
|
|
1864
|
+
children: [/* @__PURE__ */ F(M, { className: "h-4 w-4 mr-1.5" }), E("list.addRecord")]
|
|
1625
1865
|
})
|
|
1626
1866
|
]
|
|
1627
1867
|
});
|
|
1628
|
-
})() : /* @__PURE__ */
|
|
1629
|
-
schema:
|
|
1868
|
+
})() : /* @__PURE__ */ F(xe, {
|
|
1869
|
+
schema: Lt,
|
|
1630
1870
|
...w,
|
|
1631
|
-
data:
|
|
1632
|
-
loading:
|
|
1633
|
-
onRowSelect:
|
|
1871
|
+
data: V,
|
|
1872
|
+
loading: Ve,
|
|
1873
|
+
onRowSelect: ut
|
|
1634
1874
|
})
|
|
1635
1875
|
}, j),
|
|
1636
|
-
A.showAddRecord && A.addRecordPosition === "bottom" && /* @__PURE__ */
|
|
1876
|
+
A.showAddRecord && A.addRecordPosition === "bottom" && /* @__PURE__ */ F("div", {
|
|
1637
1877
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
1638
|
-
children: /* @__PURE__ */
|
|
1878
|
+
children: /* @__PURE__ */ I(d, {
|
|
1639
1879
|
variant: "ghost",
|
|
1640
1880
|
size: "sm",
|
|
1641
1881
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1642
1882
|
"data-testid": "add-record-button",
|
|
1643
1883
|
onClick: () => w.onAddRecord?.(),
|
|
1644
|
-
children: [/* @__PURE__ */
|
|
1884
|
+
children: [/* @__PURE__ */ F(M, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1645
1885
|
className: "hidden sm:inline",
|
|
1646
|
-
children:
|
|
1886
|
+
children: E("list.addRecord")
|
|
1647
1887
|
})]
|
|
1648
1888
|
})
|
|
1649
1889
|
}),
|
|
1650
|
-
|
|
1890
|
+
O.bulkActions && O.bulkActions.length > 0 && lt.length > 0 && j !== "grid" && /* @__PURE__ */ I("div", {
|
|
1651
1891
|
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",
|
|
1652
1892
|
role: "region",
|
|
1653
1893
|
"aria-label": "Bulk actions",
|
|
1654
1894
|
"data-testid": "bulk-actions-bar",
|
|
1655
1895
|
children: [
|
|
1656
|
-
/* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ F(te, { className: "h-3.5 w-3.5 text-primary shrink-0" }),
|
|
1897
|
+
/* @__PURE__ */ I("span", {
|
|
1658
1898
|
className: "font-medium",
|
|
1659
1899
|
children: [
|
|
1660
|
-
|
|
1900
|
+
lt.length,
|
|
1661
1901
|
" ",
|
|
1662
|
-
|
|
1902
|
+
lt.length === 1 ? "item" : "items",
|
|
1663
1903
|
" selected"
|
|
1664
1904
|
]
|
|
1665
1905
|
}),
|
|
1666
|
-
/* @__PURE__ */
|
|
1906
|
+
/* @__PURE__ */ F("div", {
|
|
1667
1907
|
className: "flex items-center gap-1.5 ml-3",
|
|
1668
|
-
children:
|
|
1669
|
-
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ?
|
|
1670
|
-
return /* @__PURE__ */
|
|
1908
|
+
children: O.bulkActions.map((e) => {
|
|
1909
|
+
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ? he : null;
|
|
1910
|
+
return /* @__PURE__ */ I(d, {
|
|
1671
1911
|
variant: n ? "destructive" : "outline",
|
|
1672
1912
|
size: "sm",
|
|
1673
1913
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
1674
|
-
onClick: () => w.onBulkAction?.(e,
|
|
1914
|
+
onClick: () => w.onBulkAction?.(e, lt),
|
|
1675
1915
|
"data-testid": `bulk-action-${e}`,
|
|
1676
|
-
children: [r && /* @__PURE__ */
|
|
1916
|
+
children: [r && /* @__PURE__ */ F(r, { className: "h-3 w-3" }), He(e)]
|
|
1677
1917
|
}, e);
|
|
1678
1918
|
})
|
|
1679
1919
|
}),
|
|
1680
|
-
/* @__PURE__ */
|
|
1920
|
+
/* @__PURE__ */ I(d, {
|
|
1681
1921
|
variant: "ghost",
|
|
1682
1922
|
size: "sm",
|
|
1683
1923
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
1684
|
-
onClick: () =>
|
|
1685
|
-
children: [/* @__PURE__ */
|
|
1924
|
+
onClick: () => ut([]),
|
|
1925
|
+
children: [/* @__PURE__ */ F(ge, { className: "h-3 w-3" }), "Clear"]
|
|
1686
1926
|
})
|
|
1687
1927
|
]
|
|
1688
1928
|
}),
|
|
1689
|
-
!
|
|
1929
|
+
!Ve && V.length > 0 && O.showRecordCount !== !1 && /* @__PURE__ */ I("div", {
|
|
1690
1930
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
1691
1931
|
"data-testid": "record-count-bar",
|
|
1692
1932
|
children: [
|
|
1693
|
-
/* @__PURE__ */
|
|
1933
|
+
/* @__PURE__ */ F("span", {
|
|
1694
1934
|
className: "font-medium text-foreground/80",
|
|
1695
|
-
children:
|
|
1935
|
+
children: V.length === 1 ? E("list.recordCountOne", { count: V.length }) : E("list.recordCount", { count: V.length })
|
|
1696
1936
|
}),
|
|
1697
|
-
|
|
1937
|
+
Ze && /* @__PURE__ */ F("span", {
|
|
1698
1938
|
className: "text-amber-600",
|
|
1699
1939
|
"data-testid": "data-limit-warning",
|
|
1700
|
-
children:
|
|
1940
|
+
children: E("list.dataLimitReached", { limit: tt })
|
|
1701
1941
|
}),
|
|
1702
|
-
|
|
1942
|
+
O.pagination?.pageSizeOptions && O.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ I("div", {
|
|
1703
1943
|
className: "ml-auto flex items-center gap-2",
|
|
1704
|
-
children: [/* @__PURE__ */
|
|
1944
|
+
children: [/* @__PURE__ */ F("span", { children: E("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ F("select", {
|
|
1705
1945
|
"data-testid": "page-size-selector",
|
|
1706
1946
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
1707
|
-
value: String(
|
|
1947
|
+
value: String(tt),
|
|
1708
1948
|
onChange: (e) => {
|
|
1709
1949
|
let t = Number(e.target.value);
|
|
1710
|
-
|
|
1950
|
+
et(t), w.onPageSizeChange && w.onPageSizeChange(t);
|
|
1711
1951
|
},
|
|
1712
|
-
children:
|
|
1952
|
+
children: O.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ F("option", {
|
|
1713
1953
|
value: String(e),
|
|
1714
1954
|
children: e
|
|
1715
1955
|
}, e))
|
|
@@ -1717,17 +1957,17 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1717
1957
|
})
|
|
1718
1958
|
]
|
|
1719
1959
|
}),
|
|
1720
|
-
|
|
1721
|
-
...
|
|
1722
|
-
title:
|
|
1723
|
-
children: (e) => /* @__PURE__ */
|
|
1960
|
+
Ft.isOverlay && /* @__PURE__ */ F(v, {
|
|
1961
|
+
...Ft,
|
|
1962
|
+
title: O.label ? `${O.label} Detail` : O.objectName ? `${O.objectName.charAt(0).toUpperCase() + O.objectName.slice(1)} Detail` : "Record Detail",
|
|
1963
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
1724
1964
|
className: "space-y-3",
|
|
1725
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
1965
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
1726
1966
|
className: "flex flex-col",
|
|
1727
|
-
children: [/* @__PURE__ */
|
|
1967
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1728
1968
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1729
1969
|
children: e.replace(/_/g, " ")
|
|
1730
|
-
}), /* @__PURE__ */
|
|
1970
|
+
}), /* @__PURE__ */ F("span", {
|
|
1731
1971
|
className: "text-sm",
|
|
1732
1972
|
children: String(t ?? "—")
|
|
1733
1973
|
})]
|
|
@@ -1737,62 +1977,41 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1737
1977
|
]
|
|
1738
1978
|
});
|
|
1739
1979
|
});
|
|
1740
|
-
|
|
1980
|
+
Ye.displayName = "ListView";
|
|
1741
1981
|
//#endregion
|
|
1742
1982
|
//#region src/ObjectGallery.tsx
|
|
1743
|
-
var
|
|
1983
|
+
var Xe = {
|
|
1744
1984
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
1745
1985
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
1746
1986
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
1747
|
-
},
|
|
1987
|
+
}, Ze = {
|
|
1748
1988
|
small: "aspect-square",
|
|
1749
1989
|
medium: "aspect-[4/3]",
|
|
1750
1990
|
large: "aspect-[16/10]"
|
|
1751
|
-
},
|
|
1752
|
-
let { schema: n } = e, r = s(
|
|
1991
|
+
}, Qe = (e) => {
|
|
1992
|
+
let { schema: n } = e, r = s(Se), i = e.dataSource || r?.dataSource, a = Ce(n.bind), [d, m] = u([]), [h, g] = u(!1), [_, y] = u(null), b = Te({
|
|
1753
1993
|
navigation: n.navigation,
|
|
1754
1994
|
objectName: n.objectName,
|
|
1755
1995
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
1756
|
-
}), x = n.gallery, S = x?.coverField ?? n.imageField ?? "image", w = x?.coverFit ?? "cover",
|
|
1757
|
-
|
|
1758
|
-
if (
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
if (Array.isArray(r.options)) {
|
|
1763
|
-
let e = r.options.find((e) => String(e?.value ?? e) === String(t));
|
|
1764
|
-
e && (i = e.label ?? i);
|
|
1765
|
-
} else if (r.options && typeof r.options == "object") {
|
|
1766
|
-
let e = r.options[String(t)];
|
|
1767
|
-
e && (i = e.label ?? i);
|
|
1768
|
-
}
|
|
1769
|
-
return ie(n.objectName, e, String(t), i);
|
|
1770
|
-
}
|
|
1771
|
-
let a = typeof t == "number" ? t : Number(t);
|
|
1772
|
-
if (Number.isFinite(a)) {
|
|
1773
|
-
if (i === "currency") {
|
|
1774
|
-
let e = r?.currency || r?.options?.currency || "USD";
|
|
1775
|
-
try {
|
|
1776
|
-
return new Intl.NumberFormat(void 0, {
|
|
1777
|
-
style: "currency",
|
|
1778
|
-
currency: e,
|
|
1779
|
-
maximumFractionDigits: 0
|
|
1780
|
-
}).format(a);
|
|
1781
|
-
} catch {
|
|
1782
|
-
return new Intl.NumberFormat().format(a);
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
if (i === "percent") return new Intl.NumberFormat(void 0, {
|
|
1786
|
-
style: "percent",
|
|
1787
|
-
maximumFractionDigits: 2
|
|
1788
|
-
}).format(a > 1 ? a / 100 : a);
|
|
1789
|
-
if (i === "number") return new Intl.NumberFormat().format(a);
|
|
1996
|
+
}), x = n.gallery, S = x?.coverField ?? n.imageField ?? "image", w = x?.coverFit ?? "cover", T = x?.cardSize ?? "medium", ee = x?.titleField ?? n.titleField ?? "name", te = x?.visibleFields, { fieldOptionLabel: re } = Ee(), ie = o((e) => {
|
|
1997
|
+
let t = _?.fields?.[e], r = { name: e };
|
|
1998
|
+
if (t) {
|
|
1999
|
+
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);
|
|
2000
|
+
let e = t.reference_to || t.reference;
|
|
2001
|
+
e && (r.reference_to = e), t.reference_field && (r.reference_field = t.reference_field);
|
|
1790
2002
|
}
|
|
1791
|
-
return
|
|
2003
|
+
return n.objectName && Array.isArray(r.options) && (r.options = r.options.map((t) => {
|
|
2004
|
+
let r = String(t?.value ?? t), i = String(t?.label ?? r);
|
|
2005
|
+
return {
|
|
2006
|
+
...t,
|
|
2007
|
+
value: r,
|
|
2008
|
+
label: re(n.objectName, e, r, i)
|
|
2009
|
+
};
|
|
2010
|
+
})), r;
|
|
1792
2011
|
}, [
|
|
1793
2012
|
_,
|
|
1794
2013
|
n.objectName,
|
|
1795
|
-
|
|
2014
|
+
re
|
|
1796
2015
|
]);
|
|
1797
2016
|
c(() => {
|
|
1798
2017
|
let e = !0;
|
|
@@ -1844,18 +2063,18 @@ var U = {
|
|
|
1844
2063
|
e.data,
|
|
1845
2064
|
_
|
|
1846
2065
|
]);
|
|
1847
|
-
let
|
|
2066
|
+
let D = e.data || a || n.data || d || [], O = l(() => D.some((e) => typeof e[S] == "string" && !!e[S]), [D, S]), ae = !!x?.coverField || O, k = n.grouping?.fields, oe = !!(k && k.length > 0), [A, j] = u({}), se = l(() => k ? k.some((e) => e.collapsed) : !1, [k]), M = o((e) => {
|
|
1848
2067
|
j((t) => ({
|
|
1849
2068
|
...t,
|
|
1850
|
-
[e]: t[e] === void 0 ? !
|
|
2069
|
+
[e]: t[e] === void 0 ? !se : !t[e]
|
|
1851
2070
|
}));
|
|
1852
|
-
}, [
|
|
1853
|
-
if (!
|
|
2071
|
+
}, [se]), ce = l(() => {
|
|
2072
|
+
if (!oe || !k) return [];
|
|
1854
2073
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
1855
|
-
for (let n of
|
|
1856
|
-
let r =
|
|
2074
|
+
for (let n of D) {
|
|
2075
|
+
let r = k.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
1857
2076
|
if (!e.has(r)) {
|
|
1858
|
-
let i =
|
|
2077
|
+
let i = k.map((e) => {
|
|
1859
2078
|
let t = n[e.field];
|
|
1860
2079
|
return t != null && t !== "" ? String(t) : "(empty)";
|
|
1861
2080
|
}).join(" / ");
|
|
@@ -1866,7 +2085,7 @@ var U = {
|
|
|
1866
2085
|
}
|
|
1867
2086
|
e.get(r).items.push(n);
|
|
1868
2087
|
}
|
|
1869
|
-
let n =
|
|
2088
|
+
let n = k[0]?.order ?? "asc";
|
|
1870
2089
|
return t.sort((e, t) => {
|
|
1871
2090
|
let r = e.localeCompare(t, void 0, {
|
|
1872
2091
|
numeric: !0,
|
|
@@ -1874,7 +2093,7 @@ var U = {
|
|
|
1874
2093
|
});
|
|
1875
2094
|
return n === "desc" ? -r : r;
|
|
1876
2095
|
}), t.map((t) => {
|
|
1877
|
-
let n = e.get(t), r = t in A ? A[t] :
|
|
2096
|
+
let n = e.get(t), r = t in A ? A[t] : se;
|
|
1878
2097
|
return {
|
|
1879
2098
|
key: t,
|
|
1880
2099
|
label: n.label,
|
|
@@ -1883,92 +2102,100 @@ var U = {
|
|
|
1883
2102
|
};
|
|
1884
2103
|
});
|
|
1885
2104
|
}, [
|
|
1886
|
-
|
|
1887
|
-
O,
|
|
2105
|
+
D,
|
|
1888
2106
|
k,
|
|
2107
|
+
oe,
|
|
1889
2108
|
A,
|
|
1890
|
-
|
|
2109
|
+
se
|
|
1891
2110
|
]);
|
|
1892
|
-
if (h && !
|
|
2111
|
+
if (h && !D.length) return /* @__PURE__ */ F("div", {
|
|
1893
2112
|
className: "p-4 text-sm text-muted-foreground",
|
|
1894
2113
|
children: "Loading Gallery..."
|
|
1895
2114
|
});
|
|
1896
|
-
if (!
|
|
2115
|
+
if (!D.length) return /* @__PURE__ */ F("div", {
|
|
1897
2116
|
className: "p-4 text-sm text-muted-foreground",
|
|
1898
2117
|
children: "No items to display"
|
|
1899
2118
|
});
|
|
1900
|
-
let
|
|
1901
|
-
let i = t.id ?? t._id ?? r, a = String(t[
|
|
1902
|
-
return /* @__PURE__ */
|
|
2119
|
+
let le = (t, r) => {
|
|
2120
|
+
let i = t.id ?? t._id ?? r, a = String(t[ee] ?? "Untitled"), o = t[S];
|
|
2121
|
+
return /* @__PURE__ */ I(f, {
|
|
1903
2122
|
role: "listitem",
|
|
1904
2123
|
className: C("group overflow-hidden transition-all hover:shadow-md", (e.onCardClick || e.onRowClick || n.navigation) && "cursor-pointer"),
|
|
1905
2124
|
onClick: () => b.handleClick(t),
|
|
1906
|
-
children: [/* @__PURE__ */
|
|
1907
|
-
className: C("w-full overflow-hidden bg-muted relative",
|
|
1908
|
-
hidden: !
|
|
1909
|
-
children: o ? /* @__PURE__ */
|
|
2125
|
+
children: [/* @__PURE__ */ F("div", {
|
|
2126
|
+
className: C("w-full overflow-hidden bg-muted relative", Ze[T]),
|
|
2127
|
+
hidden: !ae,
|
|
2128
|
+
children: o ? /* @__PURE__ */ F("img", {
|
|
1910
2129
|
src: o,
|
|
1911
2130
|
alt: a,
|
|
1912
2131
|
className: C("h-full w-full transition-transform group-hover:scale-105", w === "cover" && "object-cover", w === "contain" && "object-contain")
|
|
1913
|
-
}) : /* @__PURE__ */
|
|
2132
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1914
2133
|
className: "flex h-full w-full items-center justify-center bg-secondary/50 text-muted-foreground",
|
|
1915
|
-
children: /* @__PURE__ */
|
|
2134
|
+
children: /* @__PURE__ */ F("span", {
|
|
1916
2135
|
className: "text-4xl font-light opacity-20",
|
|
1917
2136
|
children: a[0]?.toUpperCase()
|
|
1918
2137
|
})
|
|
1919
2138
|
})
|
|
1920
|
-
}), /* @__PURE__ */
|
|
1921
|
-
className: C("p-3",
|
|
1922
|
-
children: [/* @__PURE__ */
|
|
2139
|
+
}), /* @__PURE__ */ I(p, {
|
|
2140
|
+
className: C("p-3", ae && "border-t"),
|
|
2141
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
1923
2142
|
className: "font-medium truncate text-sm",
|
|
1924
2143
|
title: a,
|
|
1925
2144
|
children: a
|
|
1926
|
-
}),
|
|
1927
|
-
className: "mt-1 space-y-
|
|
1928
|
-
children:
|
|
2145
|
+
}), te && te.length > 0 && /* @__PURE__ */ F("div", {
|
|
2146
|
+
className: "mt-1 space-y-1",
|
|
2147
|
+
children: te.map((e) => {
|
|
1929
2148
|
let n = t[e];
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
2149
|
+
if (n == null || n === "") return null;
|
|
2150
|
+
let r = ie(e);
|
|
2151
|
+
return /* @__PURE__ */ F("div", {
|
|
2152
|
+
className: "text-xs text-muted-foreground truncate [&_*]:!text-xs",
|
|
2153
|
+
onClick: (e) => {
|
|
2154
|
+
e.target.closest("a,button") && e.stopPropagation();
|
|
2155
|
+
},
|
|
2156
|
+
children: /* @__PURE__ */ F(L(ke(r) || r.type || "text"), {
|
|
2157
|
+
value: n,
|
|
2158
|
+
field: r
|
|
2159
|
+
})
|
|
1933
2160
|
}, e);
|
|
1934
2161
|
})
|
|
1935
2162
|
})]
|
|
1936
2163
|
})]
|
|
1937
2164
|
}, i);
|
|
1938
|
-
},
|
|
1939
|
-
className: C("grid gap-4 p-4 auto-rows-min content-start",
|
|
2165
|
+
}, N = (e) => /* @__PURE__ */ F("div", {
|
|
2166
|
+
className: C("grid gap-4 p-4 auto-rows-min content-start", Xe[T], n.className),
|
|
1940
2167
|
role: "list",
|
|
1941
|
-
children: e.map((e, t) =>
|
|
2168
|
+
children: e.map((e, t) => le(e, t))
|
|
1942
2169
|
});
|
|
1943
|
-
return /* @__PURE__ */
|
|
2170
|
+
return /* @__PURE__ */ I(P, { children: [oe ? /* @__PURE__ */ F("div", {
|
|
1944
2171
|
className: "space-y-2",
|
|
1945
|
-
children:
|
|
2172
|
+
children: ce.map((e) => /* @__PURE__ */ I("div", {
|
|
1946
2173
|
className: "border rounded-md",
|
|
1947
|
-
children: [/* @__PURE__ */
|
|
2174
|
+
children: [/* @__PURE__ */ I("button", {
|
|
1948
2175
|
type: "button",
|
|
1949
2176
|
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",
|
|
1950
|
-
onClick: () =>
|
|
2177
|
+
onClick: () => M(e.key),
|
|
1951
2178
|
children: [
|
|
1952
|
-
e.collapsed ? /* @__PURE__ */
|
|
1953
|
-
/* @__PURE__ */
|
|
1954
|
-
/* @__PURE__ */
|
|
2179
|
+
e.collapsed ? /* @__PURE__ */ F(ne, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ F(E, { className: "h-4 w-4 shrink-0" }),
|
|
2180
|
+
/* @__PURE__ */ F("span", { children: e.label }),
|
|
2181
|
+
/* @__PURE__ */ F("span", {
|
|
1955
2182
|
className: "ml-auto text-xs text-muted-foreground",
|
|
1956
2183
|
children: e.items.length
|
|
1957
2184
|
})
|
|
1958
2185
|
]
|
|
1959
|
-
}), !e.collapsed &&
|
|
2186
|
+
}), !e.collapsed && N(e.items)]
|
|
1960
2187
|
}, e.key))
|
|
1961
|
-
}) :
|
|
2188
|
+
}) : N(D), b.isOverlay && /* @__PURE__ */ F(v, {
|
|
1962
2189
|
...b,
|
|
1963
2190
|
title: "Gallery Item",
|
|
1964
|
-
children: (e) => /* @__PURE__ */
|
|
2191
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
1965
2192
|
className: "space-y-3",
|
|
1966
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
2193
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
1967
2194
|
className: "flex flex-col",
|
|
1968
|
-
children: [/* @__PURE__ */
|
|
2195
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1969
2196
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1970
2197
|
children: e.replace(/_/g, " ")
|
|
1971
|
-
}), /* @__PURE__ */
|
|
2198
|
+
}), /* @__PURE__ */ F("span", {
|
|
1972
2199
|
className: "text-sm",
|
|
1973
2200
|
children: String(t ?? "—")
|
|
1974
2201
|
})]
|
|
@@ -1976,11 +2203,11 @@ var U = {
|
|
|
1976
2203
|
})
|
|
1977
2204
|
})] });
|
|
1978
2205
|
};
|
|
1979
|
-
e.register("object-gallery",
|
|
2206
|
+
e.register("object-gallery", Qe, {
|
|
1980
2207
|
namespace: "plugin-list",
|
|
1981
2208
|
label: "Gallery View",
|
|
1982
2209
|
category: "view"
|
|
1983
|
-
}), e.register("list-view",
|
|
2210
|
+
}), e.register("list-view", Ye, {
|
|
1984
2211
|
namespace: "plugin-list",
|
|
1985
2212
|
label: "List View",
|
|
1986
2213
|
category: "Views",
|
|
@@ -2057,7 +2284,7 @@ e.register("object-gallery", We, {
|
|
|
2057
2284
|
sort: [],
|
|
2058
2285
|
options: {}
|
|
2059
2286
|
}
|
|
2060
|
-
}), e.register("list",
|
|
2287
|
+
}), e.register("list", Ye, {
|
|
2061
2288
|
namespace: "view",
|
|
2062
2289
|
category: "view",
|
|
2063
2290
|
label: "List",
|
|
@@ -2128,4 +2355,4 @@ e.register("object-gallery", We, {
|
|
|
2128
2355
|
]
|
|
2129
2356
|
});
|
|
2130
2357
|
//#endregion
|
|
2131
|
-
export {
|
|
2358
|
+
export { Ye as ListView, Qe as ObjectGallery, Pe as TabBar, Re as UserFilters, Me as ViewSwitcher, U as evaluateConditionalFormatting, H as normalizeFilterCondition, Ue as normalizeFilters };
|