@object-ui/plugin-list 4.4.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 +10 -0
- package/dist/index.js +424 -436
- package/dist/index.umd.cjs +2 -2
- package/dist/packages/plugin-list/src/ObjectGallery.d.ts.map +1 -1
- package/package.json +16 -14
package/dist/index.js
CHANGED
|
@@ -2,22 +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 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
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { useObjectLabel as
|
|
8
|
-
import { SchemaRenderer as
|
|
9
|
-
import { usePullToRefresh as
|
|
10
|
-
import { usePermissions 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";
|
|
11
12
|
//#region src/ViewSwitcher.tsx
|
|
12
|
-
var
|
|
13
|
-
grid: /* @__PURE__ */
|
|
14
|
-
kanban: /* @__PURE__ */
|
|
15
|
-
gallery: /* @__PURE__ */
|
|
16
|
-
calendar: /* @__PURE__ */
|
|
17
|
-
timeline: /* @__PURE__ */
|
|
18
|
-
gantt: /* @__PURE__ */
|
|
19
|
-
map: /* @__PURE__ */
|
|
20
|
-
},
|
|
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 = {
|
|
21
22
|
grid: "Grid",
|
|
22
23
|
kanban: "Kanban",
|
|
23
24
|
gallery: "Gallery",
|
|
@@ -25,7 +26,7 @@ var I = {
|
|
|
25
26
|
timeline: "Timeline",
|
|
26
27
|
gantt: "Gantt",
|
|
27
28
|
map: "Map"
|
|
28
|
-
},
|
|
29
|
+
}, Me = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
|
|
29
30
|
let o = a.useCallback((t) => {
|
|
30
31
|
if (!i || t === e) {
|
|
31
32
|
n(t);
|
|
@@ -37,21 +38,21 @@ var I = {
|
|
|
37
38
|
e,
|
|
38
39
|
n
|
|
39
40
|
]);
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ F("div", {
|
|
41
42
|
className: C("flex items-center gap-1 bg-transparent oui-view-switcher", r),
|
|
42
43
|
children: t.map((t) => {
|
|
43
44
|
let n = e === t;
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ I("button", {
|
|
45
46
|
type: "button",
|
|
46
47
|
onClick: () => o(t),
|
|
47
|
-
"aria-label":
|
|
48
|
-
title:
|
|
48
|
+
"aria-label": je[t],
|
|
49
|
+
title: je[t],
|
|
49
50
|
"aria-pressed": n,
|
|
50
51
|
"data-state": n ? "on" : "off",
|
|
51
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"),
|
|
52
|
-
children: [
|
|
53
|
+
children: [Ae[t], /* @__PURE__ */ F("span", {
|
|
53
54
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
54
|
-
children:
|
|
55
|
+
children: je[t]
|
|
55
56
|
})]
|
|
56
57
|
}, t);
|
|
57
58
|
})
|
|
@@ -59,23 +60,23 @@ var I = {
|
|
|
59
60
|
};
|
|
60
61
|
//#endregion
|
|
61
62
|
//#region src/components/TabBar.tsx
|
|
62
|
-
function
|
|
63
|
-
return e ?
|
|
63
|
+
function Ne(e) {
|
|
64
|
+
return e ? _e[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function R(e) {
|
|
66
67
|
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
67
68
|
}
|
|
68
|
-
var
|
|
69
|
-
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) => {
|
|
70
71
|
c(e.name), n?.(e);
|
|
71
72
|
}, [n]);
|
|
72
|
-
return i.length === 0 ? null : /* @__PURE__ */
|
|
73
|
+
return i.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
73
74
|
className: C("px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", r),
|
|
74
75
|
"data-testid": "view-tabs",
|
|
75
76
|
role: "tablist",
|
|
76
77
|
children: i.map((e) => {
|
|
77
|
-
let t =
|
|
78
|
-
return /* @__PURE__ */
|
|
78
|
+
let t = Ne(e.icon), n = l === e.name;
|
|
79
|
+
return /* @__PURE__ */ I(d, {
|
|
79
80
|
variant: "ghost",
|
|
80
81
|
size: "sm",
|
|
81
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"),
|
|
@@ -83,56 +84,56 @@ var Ne = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
83
84
|
role: "tab",
|
|
84
85
|
"aria-selected": n,
|
|
85
86
|
onClick: () => u(e),
|
|
86
|
-
children: [t && /* @__PURE__ */
|
|
87
|
+
children: [t && /* @__PURE__ */ F(t, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
87
88
|
}, e.name);
|
|
88
89
|
})
|
|
89
90
|
});
|
|
90
91
|
};
|
|
91
92
|
//#endregion
|
|
92
93
|
//#region src/components/ViewSettingsPopover.tsx
|
|
93
|
-
function
|
|
94
|
+
function z({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: i = !0, children: o }) {
|
|
94
95
|
let [s, c] = a.useState(i);
|
|
95
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ I("div", {
|
|
96
97
|
className: "border-b last:border-b-0",
|
|
97
|
-
children: [/* @__PURE__ */
|
|
98
|
+
children: [/* @__PURE__ */ I("div", {
|
|
98
99
|
className: "flex items-center justify-between px-3 py-2",
|
|
99
|
-
children: [/* @__PURE__ */
|
|
100
|
+
children: [/* @__PURE__ */ I("button", {
|
|
100
101
|
type: "button",
|
|
101
102
|
onClick: () => c((e) => !e),
|
|
102
103
|
className: "flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground",
|
|
103
104
|
children: [
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ F(E, { className: C("h-3.5 w-3.5 transition-transform", !s && "-rotate-90") }),
|
|
105
106
|
e,
|
|
106
|
-
typeof t == "number" && t > 0 && /* @__PURE__ */
|
|
107
|
+
typeof t == "number" && t > 0 && /* @__PURE__ */ F("span", {
|
|
107
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",
|
|
108
109
|
children: t
|
|
109
110
|
})
|
|
110
111
|
]
|
|
111
|
-
}), n && /* @__PURE__ */
|
|
112
|
+
}), n && /* @__PURE__ */ F("button", {
|
|
112
113
|
type: "button",
|
|
113
114
|
onClick: n,
|
|
114
115
|
className: "text-[11px] text-muted-foreground hover:text-foreground",
|
|
115
116
|
children: r
|
|
116
117
|
})]
|
|
117
|
-
}), s && /* @__PURE__ */
|
|
118
|
+
}), s && /* @__PURE__ */ F("div", {
|
|
118
119
|
className: "px-3 pb-3",
|
|
119
120
|
children: o
|
|
120
121
|
})]
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function Fe(e) {
|
|
124
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 = [
|
|
125
126
|
!!i?.fields?.length,
|
|
126
127
|
!!c?.field,
|
|
127
128
|
f && f.mode !== "compact",
|
|
128
129
|
(m?.size ?? 0) > 0
|
|
129
|
-
].filter(Boolean).length, w = f?.mode === "compact" ?
|
|
130
|
-
return /* @__PURE__ */
|
|
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, {
|
|
131
132
|
open: _,
|
|
132
133
|
onOpenChange: v,
|
|
133
|
-
children: [/* @__PURE__ */
|
|
134
|
+
children: [/* @__PURE__ */ F(x, {
|
|
134
135
|
asChild: !0,
|
|
135
|
-
children: /* @__PURE__ */
|
|
136
|
+
children: /* @__PURE__ */ I(d, {
|
|
136
137
|
variant: "ghost",
|
|
137
138
|
size: "sm",
|
|
138
139
|
"aria-label": T,
|
|
@@ -140,38 +141,38 @@ function Pe(e) {
|
|
|
140
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"),
|
|
141
142
|
"data-testid": "view-settings-trigger",
|
|
142
143
|
children: [
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ F(fe, { className: "h-3.5 w-3.5 sm:mr-1.5" }),
|
|
145
|
+
/* @__PURE__ */ F("span", {
|
|
145
146
|
className: "hidden sm:inline",
|
|
146
147
|
children: T
|
|
147
148
|
}),
|
|
148
|
-
S > 0 && /* @__PURE__ */
|
|
149
|
+
S > 0 && /* @__PURE__ */ F("span", {
|
|
149
150
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
150
151
|
children: S
|
|
151
152
|
})
|
|
152
153
|
]
|
|
153
154
|
})
|
|
154
|
-
}), /* @__PURE__ */
|
|
155
|
+
}), /* @__PURE__ */ I(b, {
|
|
155
156
|
align: "end",
|
|
156
157
|
className: "w-80 p-0",
|
|
157
158
|
"data-testid": "view-settings-content",
|
|
158
159
|
children: [
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ I("div", {
|
|
160
161
|
className: "px-3 py-2 border-b",
|
|
161
|
-
children: [/* @__PURE__ */
|
|
162
|
+
children: [/* @__PURE__ */ F("div", {
|
|
162
163
|
className: "text-sm font-semibold",
|
|
163
164
|
children: T
|
|
164
|
-
}), /* @__PURE__ */
|
|
165
|
+
}), /* @__PURE__ */ F("div", {
|
|
165
166
|
className: "text-[11px] text-muted-foreground",
|
|
166
167
|
children: t("list.viewSettingsHint", { defaultValue: "Grouping, color, density, and visible fields." })
|
|
167
168
|
})]
|
|
168
169
|
}),
|
|
169
|
-
r && o && /* @__PURE__ */
|
|
170
|
+
r && o && /* @__PURE__ */ F(z, {
|
|
170
171
|
title: t("list.group", { defaultValue: "Group" }),
|
|
171
172
|
badge: i?.fields?.length || 0,
|
|
172
173
|
onClear: i ? () => o(void 0) : void 0,
|
|
173
174
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
174
|
-
children: /* @__PURE__ */
|
|
175
|
+
children: /* @__PURE__ */ F(h, {
|
|
175
176
|
value: i,
|
|
176
177
|
fieldOptions: n.map((e) => ({
|
|
177
178
|
value: e.name,
|
|
@@ -186,15 +187,15 @@ function Pe(e) {
|
|
|
186
187
|
onChange: (e) => o(e)
|
|
187
188
|
})
|
|
188
189
|
}),
|
|
189
|
-
s && l && /* @__PURE__ */
|
|
190
|
+
s && l && /* @__PURE__ */ I(z, {
|
|
190
191
|
title: t("list.color", { defaultValue: "Row color" }),
|
|
191
192
|
onClear: c ? () => l(void 0) : void 0,
|
|
192
193
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
193
194
|
defaultOpen: !!c,
|
|
194
|
-
children: [/* @__PURE__ */
|
|
195
|
+
children: [/* @__PURE__ */ F("label", {
|
|
195
196
|
className: "block text-[11px] text-muted-foreground mb-1",
|
|
196
197
|
children: t("list.colorByField", { defaultValue: "Color by field" })
|
|
197
|
-
}), /* @__PURE__ */
|
|
198
|
+
}), /* @__PURE__ */ I("select", {
|
|
198
199
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
199
200
|
value: c?.field || "",
|
|
200
201
|
onChange: (e) => {
|
|
@@ -205,47 +206,47 @@ function Pe(e) {
|
|
|
205
206
|
} : void 0);
|
|
206
207
|
},
|
|
207
208
|
"data-testid": "color-field-select",
|
|
208
|
-
children: [/* @__PURE__ */
|
|
209
|
+
children: [/* @__PURE__ */ F("option", {
|
|
209
210
|
value: "",
|
|
210
211
|
children: t("list.none", { defaultValue: "None" })
|
|
211
|
-
}), n.map((e) => /* @__PURE__ */
|
|
212
|
+
}), n.map((e) => /* @__PURE__ */ F("option", {
|
|
212
213
|
value: e.name,
|
|
213
214
|
children: e.label || e.name
|
|
214
215
|
}, e.name))]
|
|
215
216
|
})]
|
|
216
217
|
}),
|
|
217
|
-
u && f && /* @__PURE__ */
|
|
218
|
+
u && f && /* @__PURE__ */ F(z, {
|
|
218
219
|
title: t("grid.toolbar.densityMode", { defaultValue: "Density" }),
|
|
219
220
|
defaultOpen: f.mode !== "compact",
|
|
220
|
-
children: /* @__PURE__ */
|
|
221
|
+
children: /* @__PURE__ */ I("div", {
|
|
221
222
|
className: "flex items-center gap-2",
|
|
222
|
-
children: [/* @__PURE__ */
|
|
223
|
+
children: [/* @__PURE__ */ I(d, {
|
|
223
224
|
variant: "outline",
|
|
224
225
|
size: "sm",
|
|
225
226
|
className: "h-7 gap-1.5",
|
|
226
227
|
onClick: f.cycle,
|
|
227
228
|
"data-testid": "view-settings-density-cycle",
|
|
228
|
-
children: [/* @__PURE__ */
|
|
229
|
+
children: [/* @__PURE__ */ F(w, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ F("span", {
|
|
229
230
|
className: "text-xs",
|
|
230
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" })
|
|
231
232
|
})]
|
|
232
|
-
}), /* @__PURE__ */
|
|
233
|
+
}), /* @__PURE__ */ F("span", {
|
|
233
234
|
className: "text-[11px] text-muted-foreground",
|
|
234
235
|
children: t("grid.toolbar.densityCycleShortHint", { defaultValue: "Click to cycle" })
|
|
235
236
|
})]
|
|
236
237
|
})
|
|
237
238
|
}),
|
|
238
|
-
p && m && g && /* @__PURE__ */
|
|
239
|
+
p && m && g && /* @__PURE__ */ F(z, {
|
|
239
240
|
title: t("list.hideFieldsTitle", { defaultValue: "Hide fields" }),
|
|
240
241
|
badge: m.size,
|
|
241
242
|
onClear: m.size > 0 ? () => g(/* @__PURE__ */ new Set()) : void 0,
|
|
242
243
|
clearLabel: t("list.showAll", { defaultValue: "Show all" }),
|
|
243
244
|
defaultOpen: m.size > 0,
|
|
244
|
-
children: /* @__PURE__ */
|
|
245
|
+
children: /* @__PURE__ */ F("div", {
|
|
245
246
|
className: "max-h-48 overflow-y-auto space-y-0.5",
|
|
246
|
-
children: n.map((e) => /* @__PURE__ */
|
|
247
|
+
children: n.map((e) => /* @__PURE__ */ I("label", {
|
|
247
248
|
className: "flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
248
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ F("input", {
|
|
249
250
|
type: "checkbox",
|
|
250
251
|
checked: !m.has(e.name),
|
|
251
252
|
onChange: () => {
|
|
@@ -253,7 +254,7 @@ function Pe(e) {
|
|
|
253
254
|
t.has(e.name) ? t.delete(e.name) : t.add(e.name), g(t);
|
|
254
255
|
},
|
|
255
256
|
className: "rounded border-input"
|
|
256
|
-
}), /* @__PURE__ */
|
|
257
|
+
}), /* @__PURE__ */ F("span", {
|
|
257
258
|
className: "truncate",
|
|
258
259
|
children: e.label || e.name
|
|
259
260
|
})]
|
|
@@ -266,23 +267,23 @@ function Pe(e) {
|
|
|
266
267
|
}
|
|
267
268
|
//#endregion
|
|
268
269
|
//#region src/UserFilters.tsx
|
|
269
|
-
function
|
|
270
|
+
function Ie() {
|
|
270
271
|
try {
|
|
271
|
-
let { t: e } =
|
|
272
|
+
let { t: e } = ye(), t = e("common.more");
|
|
272
273
|
return !t || t === "common.more" ? "More" : t;
|
|
273
274
|
} catch {
|
|
274
275
|
return "More";
|
|
275
276
|
}
|
|
276
277
|
}
|
|
277
|
-
var
|
|
278
|
+
var Le = new Set([
|
|
278
279
|
"lookup",
|
|
279
280
|
"master_detail",
|
|
280
281
|
"user",
|
|
281
282
|
"owner"
|
|
282
283
|
]);
|
|
283
|
-
function
|
|
284
|
+
function Re({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a }) {
|
|
284
285
|
switch (e.element) {
|
|
285
|
-
case "dropdown": return /* @__PURE__ */
|
|
286
|
+
case "dropdown": return /* @__PURE__ */ F(B, {
|
|
286
287
|
fields: e.fields || [],
|
|
287
288
|
objectDef: t,
|
|
288
289
|
data: n,
|
|
@@ -290,14 +291,14 @@ function Ie({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
290
291
|
maxVisible: i,
|
|
291
292
|
className: a
|
|
292
293
|
});
|
|
293
|
-
case "tabs": return /* @__PURE__ */
|
|
294
|
+
case "tabs": return /* @__PURE__ */ F(V, {
|
|
294
295
|
tabs: e.tabs || [],
|
|
295
296
|
showAllRecords: e.showAllRecords !== !1,
|
|
296
297
|
allowAddTab: e.allowAddTab,
|
|
297
298
|
onFilterChange: r,
|
|
298
299
|
className: a
|
|
299
300
|
});
|
|
300
|
-
case "toggle": return /* @__PURE__ */
|
|
301
|
+
case "toggle": return /* @__PURE__ */ F(Be, {
|
|
301
302
|
fields: e.fields || [],
|
|
302
303
|
onFilterChange: r,
|
|
303
304
|
className: a
|
|
@@ -305,7 +306,7 @@ function Ie({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
305
306
|
default: return null;
|
|
306
307
|
}
|
|
307
308
|
}
|
|
308
|
-
function
|
|
309
|
+
function ze(e, t, n, r) {
|
|
309
310
|
return e.map((e) => {
|
|
310
311
|
let i = e.options ? [...e.options] : [], a = e.type, o, s, c;
|
|
311
312
|
if (t?.fields) {
|
|
@@ -342,13 +343,13 @@ function Le(e, t, n, r) {
|
|
|
342
343
|
};
|
|
343
344
|
});
|
|
344
345
|
}
|
|
345
|
-
function
|
|
346
|
-
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(() => {
|
|
347
348
|
let t = {};
|
|
348
349
|
return e.forEach((e) => {
|
|
349
350
|
e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
|
|
350
351
|
}), t;
|
|
351
|
-
}), p = a.useMemo(() =>
|
|
352
|
+
}), p = a.useMemo(() => ze(e, t, n, {
|
|
352
353
|
objectName: u,
|
|
353
354
|
fieldLabel: s,
|
|
354
355
|
translateOptions: c
|
|
@@ -376,36 +377,36 @@ function Re({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
376
377
|
Object.values(d).some((e) => e.length > 0) && m(d);
|
|
377
378
|
}, []);
|
|
378
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) => {
|
|
379
|
-
let t = d[e.field] || [], n = t.length > 0, r =
|
|
380
|
-
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, {
|
|
381
382
|
asChild: !0,
|
|
382
|
-
children: /* @__PURE__ */
|
|
383
|
+
children: /* @__PURE__ */ I("button", {
|
|
383
384
|
"data-testid": `filter-badge-${e.field}`,
|
|
384
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"),
|
|
385
386
|
children: [
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ F("span", {
|
|
387
388
|
className: "truncate max-w-[100px]",
|
|
388
389
|
children: e.label || e.field
|
|
389
390
|
}),
|
|
390
|
-
n && /* @__PURE__ */
|
|
391
|
+
n && /* @__PURE__ */ F("span", {
|
|
391
392
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
392
393
|
children: t.length
|
|
393
394
|
}),
|
|
394
|
-
n ? /* @__PURE__ */
|
|
395
|
+
n ? /* @__PURE__ */ F(ge, {
|
|
395
396
|
className: "h-3 w-3 opacity-60 hover:opacity-100",
|
|
396
397
|
"data-testid": `filter-clear-${e.field}`,
|
|
397
398
|
onClick: (t) => {
|
|
398
399
|
t.stopPropagation(), h(e.field, []);
|
|
399
400
|
}
|
|
400
|
-
}) : /* @__PURE__ */
|
|
401
|
+
}) : /* @__PURE__ */ F(E, { className: "h-3 w-3 opacity-60" })
|
|
401
402
|
]
|
|
402
403
|
})
|
|
403
|
-
}), /* @__PURE__ */
|
|
404
|
+
}), /* @__PURE__ */ F(b, {
|
|
404
405
|
align: "start",
|
|
405
406
|
className: C(i, "p-2"),
|
|
406
|
-
children: r ? /* @__PURE__ */
|
|
407
|
+
children: r ? /* @__PURE__ */ F("div", {
|
|
407
408
|
"data-testid": `filter-lookup-${e.field}`,
|
|
408
|
-
children: /* @__PURE__ */
|
|
409
|
+
children: /* @__PURE__ */ F(_, {
|
|
409
410
|
field: {
|
|
410
411
|
value: e.field,
|
|
411
412
|
label: e.label || e.field,
|
|
@@ -421,16 +422,16 @@ function Re({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
421
422
|
h(e.field, n);
|
|
422
423
|
}
|
|
423
424
|
})
|
|
424
|
-
}) : /* @__PURE__ */
|
|
425
|
+
}) : /* @__PURE__ */ F("div", {
|
|
425
426
|
className: "max-h-60 overflow-y-auto space-y-0.5",
|
|
426
427
|
"data-testid": `filter-options-${e.field}`,
|
|
427
|
-
children: e.options.length === 0 ? /* @__PURE__ */
|
|
428
|
+
children: e.options.length === 0 ? /* @__PURE__ */ F("div", {
|
|
428
429
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
429
430
|
children: "No options"
|
|
430
|
-
}) : e.options.map((n) => /* @__PURE__ */
|
|
431
|
+
}) : e.options.map((n) => /* @__PURE__ */ I("label", {
|
|
431
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"),
|
|
432
433
|
children: [
|
|
433
|
-
/* @__PURE__ */
|
|
434
|
+
/* @__PURE__ */ F("input", {
|
|
434
435
|
type: "checkbox",
|
|
435
436
|
checked: t.includes(n.value),
|
|
436
437
|
onChange: () => {
|
|
@@ -439,15 +440,15 @@ function Re({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
439
440
|
},
|
|
440
441
|
className: "rounded border-input"
|
|
441
442
|
}),
|
|
442
|
-
n.color && /* @__PURE__ */
|
|
443
|
+
n.color && /* @__PURE__ */ F("span", {
|
|
443
444
|
className: "h-2.5 w-2.5 rounded-full shrink-0",
|
|
444
445
|
style: { backgroundColor: n.color }
|
|
445
446
|
}),
|
|
446
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ F("span", {
|
|
447
448
|
className: "truncate flex-1",
|
|
448
449
|
children: n.label
|
|
449
450
|
}),
|
|
450
|
-
n.count !== void 0 && /* @__PURE__ */
|
|
451
|
+
n.count !== void 0 && /* @__PURE__ */ F("span", {
|
|
451
452
|
className: "text-xs text-muted-foreground",
|
|
452
453
|
children: n.count
|
|
453
454
|
})
|
|
@@ -456,39 +457,39 @@ function Re({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
456
457
|
})
|
|
457
458
|
})] }, e.field);
|
|
458
459
|
};
|
|
459
|
-
return /* @__PURE__ */
|
|
460
|
+
return /* @__PURE__ */ F("div", {
|
|
460
461
|
className: C("flex items-center gap-0.5 overflow-x-auto", o),
|
|
461
462
|
"data-testid": "user-filters-dropdown",
|
|
462
|
-
children: p.length === 0 ? /* @__PURE__ */
|
|
463
|
+
children: p.length === 0 ? /* @__PURE__ */ F("span", {
|
|
463
464
|
className: "text-xs text-muted-foreground",
|
|
464
465
|
"data-testid": "user-filters-empty",
|
|
465
466
|
children: "No filter fields"
|
|
466
|
-
}) : /* @__PURE__ */
|
|
467
|
+
}) : /* @__PURE__ */ I(P, { children: [g.map(S), v.length > 0 && /* @__PURE__ */ I(y, { children: [/* @__PURE__ */ F(x, {
|
|
467
468
|
asChild: !0,
|
|
468
|
-
children: /* @__PURE__ */
|
|
469
|
+
children: /* @__PURE__ */ I("button", {
|
|
469
470
|
"data-testid": "user-filters-more",
|
|
470
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",
|
|
471
472
|
children: [
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ F("span", { children: l }),
|
|
474
|
+
/* @__PURE__ */ F("span", {
|
|
474
475
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
475
476
|
children: v.length
|
|
476
477
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ F(E, { className: "h-3 w-3 opacity-60" })
|
|
478
479
|
]
|
|
479
480
|
})
|
|
480
|
-
}), /* @__PURE__ */
|
|
481
|
+
}), /* @__PURE__ */ F(b, {
|
|
481
482
|
align: "start",
|
|
482
483
|
className: "w-64 p-2",
|
|
483
484
|
"data-testid": "user-filters-more-content",
|
|
484
|
-
children: /* @__PURE__ */
|
|
485
|
+
children: /* @__PURE__ */ F("div", {
|
|
485
486
|
className: "space-y-1",
|
|
486
487
|
children: v.map(S)
|
|
487
488
|
})
|
|
488
489
|
})] })] })
|
|
489
490
|
});
|
|
490
491
|
}
|
|
491
|
-
function
|
|
492
|
+
function V({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: i }) {
|
|
492
493
|
let [o, s] = a.useState(() => e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), c = a.useCallback((t) => {
|
|
493
494
|
s(t), r(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []);
|
|
494
495
|
}, [e, r]), l = a.useMemo(() => {
|
|
@@ -502,23 +503,23 @@ function ze({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
|
|
|
502
503
|
return a.useEffect(() => {
|
|
503
504
|
let t = e.find((e) => e.default);
|
|
504
505
|
t && r(t.filters || []);
|
|
505
|
-
}, []), /* @__PURE__ */
|
|
506
|
+
}, []), /* @__PURE__ */ I("div", {
|
|
506
507
|
className: C("flex items-center gap-0.5 overflow-x-auto", i),
|
|
507
508
|
"data-testid": "user-filters-tabs",
|
|
508
|
-
children: [l.map((e) => /* @__PURE__ */
|
|
509
|
+
children: [l.map((e) => /* @__PURE__ */ F("button", {
|
|
509
510
|
"data-testid": `filter-tab-${e.id}`,
|
|
510
511
|
onClick: () => c(e.id),
|
|
511
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"),
|
|
512
513
|
children: e.label
|
|
513
|
-
}, e.id)), n && /* @__PURE__ */
|
|
514
|
+
}, e.id)), n && /* @__PURE__ */ F("button", {
|
|
514
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",
|
|
515
516
|
"data-testid": "filter-tab-add",
|
|
516
517
|
title: "Add filter tab",
|
|
517
|
-
children: /* @__PURE__ */
|
|
518
|
+
children: /* @__PURE__ */ F(M, { className: "h-3.5 w-3.5" })
|
|
518
519
|
})]
|
|
519
520
|
});
|
|
520
521
|
}
|
|
521
|
-
function
|
|
522
|
+
function Be({ fields: e, onFilterChange: t, className: n }) {
|
|
522
523
|
let [r, i] = a.useState(() => {
|
|
523
524
|
let t = /* @__PURE__ */ new Set();
|
|
524
525
|
return e.forEach((e) => {
|
|
@@ -545,10 +546,10 @@ function B({ fields: e, onFilterChange: t, className: n }) {
|
|
|
545
546
|
};
|
|
546
547
|
return a.useEffect(() => {
|
|
547
548
|
r.size > 0 && o(r);
|
|
548
|
-
}, []), /* @__PURE__ */
|
|
549
|
+
}, []), /* @__PURE__ */ F("div", {
|
|
549
550
|
className: C("flex items-center gap-1 overflow-x-auto", n),
|
|
550
551
|
"data-testid": "user-filters-toggle",
|
|
551
|
-
children: e.map((e) => /* @__PURE__ */
|
|
552
|
+
children: e.map((e) => /* @__PURE__ */ F(d, {
|
|
552
553
|
variant: r.has(e.field) ? "default" : "outline",
|
|
553
554
|
size: "sm",
|
|
554
555
|
className: "h-7 px-3 text-xs shrink-0",
|
|
@@ -560,7 +561,7 @@ function B({ fields: e, onFilterChange: t, className: n }) {
|
|
|
560
561
|
}
|
|
561
562
|
//#endregion
|
|
562
563
|
//#region src/ListView.tsx
|
|
563
|
-
function
|
|
564
|
+
function Ve(e) {
|
|
564
565
|
switch (e) {
|
|
565
566
|
case "equals":
|
|
566
567
|
case "eq": return "=";
|
|
@@ -605,15 +606,15 @@ function H(e) {
|
|
|
605
606
|
e
|
|
606
607
|
])] : e;
|
|
607
608
|
}
|
|
608
|
-
function
|
|
609
|
+
function He(e) {
|
|
609
610
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
610
611
|
}
|
|
611
|
-
function
|
|
612
|
+
function Ue(e) {
|
|
612
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);
|
|
613
614
|
}
|
|
614
|
-
function
|
|
615
|
+
function We(e) {
|
|
615
616
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
616
|
-
let t =
|
|
617
|
+
let t = Ue(e.conditions.map((e) => e.operator === "isEmpty" ? [
|
|
617
618
|
e.field,
|
|
618
619
|
"=",
|
|
619
620
|
null
|
|
@@ -623,12 +624,12 @@ function He(e) {
|
|
|
623
624
|
null
|
|
624
625
|
] : [
|
|
625
626
|
e.field,
|
|
626
|
-
|
|
627
|
+
Ve(e.operator),
|
|
627
628
|
e.value
|
|
628
629
|
]));
|
|
629
630
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
630
631
|
}
|
|
631
|
-
function
|
|
632
|
+
function U(e, t) {
|
|
632
633
|
if (!t || t.length === 0) return {};
|
|
633
634
|
for (let r of t) {
|
|
634
635
|
let t = !1, i = ("condition" in r ? r.condition : void 0) || ("expression" in r ? r.expression : void 0) || void 0;
|
|
@@ -663,7 +664,7 @@ function Ue(e, t) {
|
|
|
663
664
|
}
|
|
664
665
|
return {};
|
|
665
666
|
}
|
|
666
|
-
var
|
|
667
|
+
var Ge = {
|
|
667
668
|
"list.recordCount": "{{count}} records",
|
|
668
669
|
"list.recordCountOne": "{{count}} record",
|
|
669
670
|
"list.noItems": "No items found",
|
|
@@ -702,32 +703,32 @@ var We = {
|
|
|
702
703
|
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
703
704
|
"list.viewSettings": "View settings",
|
|
704
705
|
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
705
|
-
},
|
|
706
|
-
let n =
|
|
706
|
+
}, Ke = (e, t, n) => n, W = (e, t) => {
|
|
707
|
+
let n = Ge[e] || e;
|
|
707
708
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
708
709
|
return n;
|
|
709
710
|
};
|
|
710
|
-
function
|
|
711
|
+
function qe() {
|
|
711
712
|
try {
|
|
712
|
-
let e =
|
|
713
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t:
|
|
713
|
+
let e = ye();
|
|
714
|
+
return e.t("list.recordCount") === "list.recordCount" ? { t: W } : { t: e.t };
|
|
714
715
|
} catch {
|
|
715
|
-
return { t:
|
|
716
|
+
return { t: W };
|
|
716
717
|
}
|
|
717
718
|
}
|
|
718
|
-
function
|
|
719
|
+
function Je() {
|
|
719
720
|
try {
|
|
720
|
-
let { fieldLabel: e } =
|
|
721
|
+
let { fieldLabel: e } = ve();
|
|
721
722
|
return { fieldLabel: e };
|
|
722
723
|
} catch {
|
|
723
|
-
return { fieldLabel:
|
|
724
|
+
return { fieldLabel: Ke };
|
|
724
725
|
}
|
|
725
726
|
}
|
|
726
|
-
var
|
|
727
|
-
let { t: E } =
|
|
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 : {
|
|
728
729
|
...e,
|
|
729
730
|
viewType: "grid"
|
|
730
|
-
}, [e]), k = a.useCallback((e, t) => O.objectName ? ne(O.objectName, e, t) : t, [O.objectName, ne]),
|
|
731
|
+
}, [e]), k = a.useCallback((e, t) => O.objectName ? ne(O.objectName, e, t) : t, [O.objectName, ne]), A = a.useMemo(() => {
|
|
731
732
|
let e = O.userActions, t = O.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
|
|
732
733
|
return {
|
|
733
734
|
showSearch: e?.search === void 0 ? O.showSearch !== !1 : e.search,
|
|
@@ -753,7 +754,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
753
754
|
O.compactToolbar,
|
|
754
755
|
O.addRecord,
|
|
755
756
|
O.userActions?.addRecordForm
|
|
756
|
-
]), [
|
|
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) => {
|
|
757
758
|
if (typeof e == "string") {
|
|
758
759
|
let t = e.trim().split(/\s+/);
|
|
759
760
|
return {
|
|
@@ -767,9 +768,9 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
767
768
|
field: e.field,
|
|
768
769
|
order: e.order || "asc"
|
|
769
770
|
};
|
|
770
|
-
}) : []),
|
|
771
|
+
}) : []), Ae = a.useMemo(() => JSON.stringify(O.sort || []), [O.sort]);
|
|
771
772
|
a.useEffect(() => {
|
|
772
|
-
O.sort && O.sort.length > 0 ?
|
|
773
|
+
O.sort && O.sort.length > 0 ? ke(O.sort.map((e) => {
|
|
773
774
|
if (typeof e == "string") {
|
|
774
775
|
let t = e.trim().split(/\s+/);
|
|
775
776
|
return {
|
|
@@ -783,31 +784,31 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
783
784
|
field: e.field,
|
|
784
785
|
order: e.order || "asc"
|
|
785
786
|
};
|
|
786
|
-
})) :
|
|
787
|
-
}, [
|
|
788
|
-
let [
|
|
787
|
+
})) : ke([]);
|
|
788
|
+
}, [Ae]);
|
|
789
|
+
let [je, Ne] = a.useState(!1), [R, z] = a.useState({
|
|
789
790
|
id: "root",
|
|
790
791
|
logic: "and",
|
|
791
792
|
conditions: []
|
|
792
|
-
}), [
|
|
793
|
+
}), [Ie, Le] = a.useState(() => {
|
|
793
794
|
if (!(!O.tabs || O.tabs.length === 0)) return O.tabs.find((e) => e.isDefault)?.name ?? O.tabs[0]?.name;
|
|
794
795
|
}), ze = a.useCallback((e) => {
|
|
795
|
-
if (
|
|
796
|
+
if (Le(e.name), e.filter) {
|
|
796
797
|
let t = {
|
|
797
798
|
id: `tab-filter-${e.name}`,
|
|
798
799
|
logic: e.filter.logic || "and",
|
|
799
800
|
conditions: e.filter.conditions || []
|
|
800
801
|
};
|
|
801
|
-
|
|
802
|
+
z(t), s?.(t);
|
|
802
803
|
} else {
|
|
803
804
|
let e = {
|
|
804
805
|
id: "root",
|
|
805
806
|
logic: "and",
|
|
806
807
|
conditions: []
|
|
807
808
|
};
|
|
808
|
-
|
|
809
|
+
z(e), s?.(e);
|
|
809
810
|
}
|
|
810
|
-
}, [s]), B = w.dataSource, [V,
|
|
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);
|
|
811
812
|
a.useImperativeHandle(ee, () => ({ refresh: () => Xe((e) => e + 1) }), []), a.useEffect(() => {
|
|
812
813
|
if (!(!B?.onMutation || !O.objectName || O.refreshTrigger)) return B.onMutation((e) => {
|
|
813
814
|
e.resource === O.objectName && Xe((e) => e + 1);
|
|
@@ -868,7 +869,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
868
869
|
_t(e), u?.(Array.from(e));
|
|
869
870
|
}, [u]), [bt, xt] = a.useState(!1), [St, Ct] = a.useState(!1), Y = a.useMemo(() => i(O.quickFilters), [O.quickFilters]), X = a.useMemo(() => {
|
|
870
871
|
if (O.exportOptions) return Array.isArray(O.exportOptions) ? { formats: O.exportOptions } : O.exportOptions;
|
|
871
|
-
}, [O.exportOptions]), Z =
|
|
872
|
+
}, [O.exportOptions]), Z = we(a.useMemo(() => O.densityMode ? O.densityMode : O.rowHeight ? {
|
|
872
873
|
compact: "compact",
|
|
873
874
|
short: "compact",
|
|
874
875
|
medium: "comfortable",
|
|
@@ -889,7 +890,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
889
890
|
} catch {}
|
|
890
891
|
return t;
|
|
891
892
|
});
|
|
892
|
-
}, [wt]), { ref: Dt, isRefreshing: Ot, pullDistance: kt } =
|
|
893
|
+
}, [wt]), { ref: Dt, isRefreshing: Ot, pullDistance: kt } = De({
|
|
893
894
|
onRefresh: a.useCallback(async () => {
|
|
894
895
|
Xe((e) => e + 1);
|
|
895
896
|
}, []),
|
|
@@ -897,13 +898,13 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
897
898
|
}), At = a.useMemo(() => O.id ? `listview-${O.objectName}-${O.id}-view` : `listview-${O.objectName}-view`, [O.objectName, O.id]);
|
|
898
899
|
a.useEffect(() => {
|
|
899
900
|
let e = !0;
|
|
900
|
-
return
|
|
901
|
+
return W(!1), Ge(null), (async () => {
|
|
901
902
|
if (!B || !O.objectName) {
|
|
902
|
-
|
|
903
|
+
W(!0);
|
|
903
904
|
return;
|
|
904
905
|
}
|
|
905
906
|
if (typeof B.getObjectSchema != "function") {
|
|
906
|
-
|
|
907
|
+
W(!0);
|
|
907
908
|
return;
|
|
908
909
|
}
|
|
909
910
|
try {
|
|
@@ -912,7 +913,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
912
913
|
} catch (e) {
|
|
913
914
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
914
915
|
} finally {
|
|
915
|
-
e &&
|
|
916
|
+
e && W(!0);
|
|
916
917
|
}
|
|
917
918
|
})(), () => {
|
|
918
919
|
e = !1;
|
|
@@ -962,39 +963,39 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
962
963
|
let e = O.data;
|
|
963
964
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
964
965
|
let t = e.items;
|
|
965
|
-
if (
|
|
966
|
-
let e =
|
|
966
|
+
if (P) {
|
|
967
|
+
let e = P.toLowerCase();
|
|
967
968
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
968
969
|
}
|
|
969
|
-
|
|
970
|
+
Be(t), H(!1), Qe(!1);
|
|
970
971
|
return;
|
|
971
972
|
}
|
|
972
973
|
}
|
|
973
974
|
if (Array.isArray(O.data)) {
|
|
974
975
|
let e = O.data;
|
|
975
|
-
if (
|
|
976
|
-
let t =
|
|
976
|
+
if (P) {
|
|
977
|
+
let t = P.toLowerCase();
|
|
977
978
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
978
979
|
}
|
|
979
|
-
|
|
980
|
+
Be(e), H(!1), Qe(!1);
|
|
980
981
|
return;
|
|
981
982
|
}
|
|
982
|
-
return
|
|
983
|
+
return Ke ? ((async () => {
|
|
983
984
|
if (!(!B || !O.objectName)) {
|
|
984
|
-
|
|
985
|
+
H(!0);
|
|
985
986
|
try {
|
|
986
|
-
let n = [], r = O.filters || [], i =
|
|
987
|
+
let n = [], r = O.filters || [], i = We(R), a = [];
|
|
987
988
|
Y && ft.size > 0 && Y.forEach((e) => {
|
|
988
989
|
ft.has(e.id) && e.filters && e.filters.length > 0 && a.push(e.filters);
|
|
989
990
|
});
|
|
990
|
-
let o =
|
|
991
|
+
let o = Ue(mt), s = [
|
|
991
992
|
...r.length > 0 ? [r] : [],
|
|
992
993
|
...i.length > 0 ? [i] : [],
|
|
993
994
|
...a,
|
|
994
995
|
...o
|
|
995
996
|
].filter((e) => Array.isArray(e) && e.length > 0);
|
|
996
997
|
s.length > 1 ? n = ["and", ...s] : s.length === 1 && (n = s[0]);
|
|
997
|
-
let c =
|
|
998
|
+
let c = L.length > 0 ? L.filter((e) => e.field).map((e) => ({
|
|
998
999
|
field: e.field,
|
|
999
1000
|
order: e.order
|
|
1000
1001
|
})) : void 0, l = (() => {
|
|
@@ -1039,18 +1040,18 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1039
1040
|
$top: tt,
|
|
1040
1041
|
...l ? { $select: l } : {},
|
|
1041
1042
|
...jt.length > 0 ? { $expand: jt } : {},
|
|
1042
|
-
...
|
|
1043
|
-
$search:
|
|
1043
|
+
...P ? {
|
|
1044
|
+
$search: P,
|
|
1044
1045
|
...O.searchableFields && O.searchableFields.length > 0 ? { $searchFields: O.searchableFields } : {}
|
|
1045
1046
|
} : {}
|
|
1046
1047
|
});
|
|
1047
1048
|
if (!e || t !== dt.current) return;
|
|
1048
1049
|
let f = [];
|
|
1049
|
-
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);
|
|
1050
1051
|
} catch (e) {
|
|
1051
1052
|
t === dt.current && console.error("ListView data fetch error:", e);
|
|
1052
1053
|
} finally {
|
|
1053
|
-
e && t === dt.current &&
|
|
1054
|
+
e && t === dt.current && H(!1);
|
|
1054
1055
|
}
|
|
1055
1056
|
}
|
|
1056
1057
|
})(), () => {
|
|
@@ -1062,16 +1063,16 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1062
1063
|
B,
|
|
1063
1064
|
O.filters,
|
|
1064
1065
|
tt,
|
|
1065
|
-
|
|
1066
|
-
|
|
1066
|
+
L,
|
|
1067
|
+
R,
|
|
1067
1068
|
ft,
|
|
1068
1069
|
Y,
|
|
1069
1070
|
mt,
|
|
1070
1071
|
Ye,
|
|
1071
|
-
|
|
1072
|
+
P,
|
|
1072
1073
|
O.searchableFields,
|
|
1073
1074
|
jt,
|
|
1074
|
-
|
|
1075
|
+
Ke,
|
|
1075
1076
|
O.refreshTrigger
|
|
1076
1077
|
]);
|
|
1077
1078
|
let Mt = a.useMemo(() => {
|
|
@@ -1105,10 +1106,10 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1105
1106
|
O.appearance?.allowedVisualizations
|
|
1106
1107
|
]);
|
|
1107
1108
|
a.useEffect(() => {
|
|
1108
|
-
O.viewType &&
|
|
1109
|
+
O.viewType && fe(O.viewType);
|
|
1109
1110
|
}, [O.viewType]);
|
|
1110
1111
|
let Nt = a.useCallback((e) => {
|
|
1111
|
-
|
|
1112
|
+
fe(e);
|
|
1112
1113
|
try {
|
|
1113
1114
|
localStorage.setItem(At, e);
|
|
1114
1115
|
} catch (e) {
|
|
@@ -1116,13 +1117,13 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1116
1117
|
}
|
|
1117
1118
|
o?.(e);
|
|
1118
1119
|
}, [At, o]), Pt = a.useCallback((e) => {
|
|
1119
|
-
|
|
1120
|
-
}, [l]), Ft =
|
|
1120
|
+
ve(e), l?.(e);
|
|
1121
|
+
}, [l]), Ft = Te({
|
|
1121
1122
|
navigation: O.navigation,
|
|
1122
1123
|
objectName: O.objectName,
|
|
1123
1124
|
onNavigate: O.onNavigate,
|
|
1124
1125
|
onRowClick: p
|
|
1125
|
-
}), It =
|
|
1126
|
+
}), It = Oe(), $ = a.useMemo(() => {
|
|
1126
1127
|
let e = O.fields || [];
|
|
1127
1128
|
if (Array.isArray(e) || (e = []), It?.isLoaded && O.objectName && (e = e.filter((e) => {
|
|
1128
1129
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
@@ -1149,7 +1150,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1149
1150
|
objectName: O.objectName,
|
|
1150
1151
|
fields: $,
|
|
1151
1152
|
filters: O.filters,
|
|
1152
|
-
sort:
|
|
1153
|
+
sort: L,
|
|
1153
1154
|
className: "h-full w-full",
|
|
1154
1155
|
showSearch: !1,
|
|
1155
1156
|
onRowClick: Ft.handleClick,
|
|
@@ -1160,7 +1161,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1160
1161
|
...f ? { onColumnStateChange: f } : {},
|
|
1161
1162
|
...O.columnState ? { columnState: O.columnState } : {}
|
|
1162
1163
|
};
|
|
1163
|
-
switch (
|
|
1164
|
+
switch (j) {
|
|
1164
1165
|
case "grid": return {
|
|
1165
1166
|
type: "object-grid",
|
|
1166
1167
|
...t,
|
|
@@ -1254,16 +1255,16 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1254
1255
|
default: return t;
|
|
1255
1256
|
}
|
|
1256
1257
|
}, [
|
|
1257
|
-
|
|
1258
|
+
j,
|
|
1258
1259
|
O,
|
|
1259
|
-
|
|
1260
|
+
L,
|
|
1260
1261
|
$,
|
|
1261
1262
|
K,
|
|
1262
1263
|
q,
|
|
1263
1264
|
Ft.handleClick,
|
|
1264
1265
|
Z.mode,
|
|
1265
1266
|
Q
|
|
1266
|
-
]), Rt =
|
|
1267
|
+
]), Rt = R.conditions && R.conditions.length > 0, zt = a.useMemo(() => {
|
|
1267
1268
|
let e, t = (e, t) => {
|
|
1268
1269
|
if (!t) return;
|
|
1269
1270
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1351,7 +1352,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1351
1352
|
label: k(t, e.label || e.name || e.field)
|
|
1352
1353
|
};
|
|
1353
1354
|
}), [O.fields, k]);
|
|
1354
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ I("div", {
|
|
1355
1356
|
ref: Dt,
|
|
1356
1357
|
className: C("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1357
1358
|
...O.aria?.label ? { "aria-label": O.aria.label } : {},
|
|
@@ -1359,40 +1360,40 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1359
1360
|
...O.aria?.live ? { "aria-live": O.aria.live } : {},
|
|
1360
1361
|
role: "region",
|
|
1361
1362
|
children: [
|
|
1362
|
-
kt > 0 && /* @__PURE__ */
|
|
1363
|
+
kt > 0 && /* @__PURE__ */ F("div", {
|
|
1363
1364
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1364
1365
|
style: { height: kt },
|
|
1365
1366
|
children: E(Ot ? "list.refreshing" : "list.pullToRefresh")
|
|
1366
1367
|
}),
|
|
1367
|
-
_ && /* @__PURE__ */
|
|
1368
|
+
_ && /* @__PURE__ */ F("div", {
|
|
1368
1369
|
className: "px-4 py-1 flex items-center bg-background",
|
|
1369
|
-
children: /* @__PURE__ */
|
|
1370
|
-
currentView:
|
|
1370
|
+
children: /* @__PURE__ */ F(Me, {
|
|
1371
|
+
currentView: j,
|
|
1371
1372
|
availableViews: Mt,
|
|
1372
1373
|
onViewChange: Nt
|
|
1373
1374
|
})
|
|
1374
1375
|
}),
|
|
1375
|
-
O.description && O.appearance?.showDescription !== !1 && /* @__PURE__ */
|
|
1376
|
+
O.description && O.appearance?.showDescription !== !1 && /* @__PURE__ */ F("div", {
|
|
1376
1377
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
1377
1378
|
"data-testid": "view-description",
|
|
1378
1379
|
children: typeof O.description == "string" ? O.description : ""
|
|
1379
1380
|
}),
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
+
/* @__PURE__ */ I("div", {
|
|
1381
1382
|
className: "border-b px-2 sm:px-4 py-1 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1382
|
-
children: [/* @__PURE__ */
|
|
1383
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1383
1384
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1384
1385
|
children: [
|
|
1385
|
-
O.tabs && O.tabs.length > 0 && /* @__PURE__ */
|
|
1386
|
+
O.tabs && O.tabs.length > 0 && /* @__PURE__ */ F(Pe, {
|
|
1386
1387
|
tabs: O.tabs,
|
|
1387
|
-
activeTab:
|
|
1388
|
+
activeTab: Ie,
|
|
1388
1389
|
onTabChange: ze,
|
|
1389
1390
|
className: "!px-0 !py-0 shrink-0"
|
|
1390
1391
|
}),
|
|
1391
|
-
O.tabs && O.tabs.length > 0 && gt && /* @__PURE__ */
|
|
1392
|
-
gt && /* @__PURE__ */
|
|
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", {
|
|
1393
1394
|
className: "shrink-0 min-w-0",
|
|
1394
1395
|
"data-testid": "user-filters",
|
|
1395
|
-
children: /* @__PURE__ */
|
|
1396
|
+
children: /* @__PURE__ */ F(Re, {
|
|
1396
1397
|
config: gt,
|
|
1397
1398
|
objectDef: U,
|
|
1398
1399
|
data: V,
|
|
@@ -1401,52 +1402,52 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1401
1402
|
})
|
|
1402
1403
|
})
|
|
1403
1404
|
]
|
|
1404
|
-
}), /* @__PURE__ */
|
|
1405
|
+
}), /* @__PURE__ */ I("div", {
|
|
1405
1406
|
className: "flex items-center gap-0 shrink-0",
|
|
1406
1407
|
children: [
|
|
1407
|
-
|
|
1408
|
+
A.showHideFields && !A.compactToolbar && /* @__PURE__ */ I(y, {
|
|
1408
1409
|
open: bt,
|
|
1409
1410
|
onOpenChange: xt,
|
|
1410
|
-
children: [/* @__PURE__ */
|
|
1411
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1411
1412
|
asChild: !0,
|
|
1412
|
-
children: /* @__PURE__ */
|
|
1413
|
+
children: /* @__PURE__ */ I(d, {
|
|
1413
1414
|
variant: "ghost",
|
|
1414
1415
|
size: "sm",
|
|
1415
1416
|
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", J.size > 0 && "text-primary"),
|
|
1416
1417
|
children: [
|
|
1417
|
-
/* @__PURE__ */
|
|
1418
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ F(ie, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1419
|
+
/* @__PURE__ */ F("span", {
|
|
1419
1420
|
className: "hidden sm:inline",
|
|
1420
1421
|
children: E("list.hideFields")
|
|
1421
1422
|
}),
|
|
1422
|
-
J.size > 0 && /* @__PURE__ */
|
|
1423
|
+
J.size > 0 && /* @__PURE__ */ F("span", {
|
|
1423
1424
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1424
1425
|
children: J.size
|
|
1425
1426
|
})
|
|
1426
1427
|
]
|
|
1427
1428
|
})
|
|
1428
|
-
}), /* @__PURE__ */
|
|
1429
|
+
}), /* @__PURE__ */ F(b, {
|
|
1429
1430
|
align: "start",
|
|
1430
1431
|
className: "w-64 p-3",
|
|
1431
|
-
children: /* @__PURE__ */
|
|
1432
|
+
children: /* @__PURE__ */ I("div", {
|
|
1432
1433
|
className: "space-y-2",
|
|
1433
|
-
children: [/* @__PURE__ */
|
|
1434
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1434
1435
|
className: "flex items-center justify-between border-b pb-2",
|
|
1435
|
-
children: [/* @__PURE__ */
|
|
1436
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1436
1437
|
className: "font-medium text-sm",
|
|
1437
1438
|
children: E("list.hideFieldsTitle")
|
|
1438
|
-
}), J.size > 0 && /* @__PURE__ */
|
|
1439
|
+
}), J.size > 0 && /* @__PURE__ */ F(d, {
|
|
1439
1440
|
variant: "ghost",
|
|
1440
1441
|
size: "sm",
|
|
1441
1442
|
className: "h-6 px-2 text-xs",
|
|
1442
1443
|
onClick: () => yt(/* @__PURE__ */ new Set()),
|
|
1443
1444
|
children: E("list.showAll")
|
|
1444
1445
|
})]
|
|
1445
|
-
}), /* @__PURE__ */
|
|
1446
|
+
}), /* @__PURE__ */ F("div", {
|
|
1446
1447
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1447
|
-
children: Ht.map((e) => /* @__PURE__ */
|
|
1448
|
+
children: Ht.map((e) => /* @__PURE__ */ I("label", {
|
|
1448
1449
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1449
|
-
children: [/* @__PURE__ */
|
|
1450
|
+
children: [/* @__PURE__ */ F("input", {
|
|
1450
1451
|
type: "checkbox",
|
|
1451
1452
|
checked: !J.has(e.name),
|
|
1452
1453
|
onChange: () => {
|
|
@@ -1454,7 +1455,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1454
1455
|
t.has(e.name) ? t.delete(e.name) : t.add(e.name), yt(t);
|
|
1455
1456
|
},
|
|
1456
1457
|
className: "rounded border-input"
|
|
1457
|
-
}), /* @__PURE__ */
|
|
1458
|
+
}), /* @__PURE__ */ F("span", {
|
|
1458
1459
|
className: "truncate",
|
|
1459
1460
|
children: e.label
|
|
1460
1461
|
})]
|
|
@@ -1463,81 +1464,81 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1463
1464
|
})
|
|
1464
1465
|
})]
|
|
1465
1466
|
}),
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
open:
|
|
1469
|
-
onOpenChange:
|
|
1470
|
-
children: [/* @__PURE__ */
|
|
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,
|
|
1470
|
+
onOpenChange: Ne,
|
|
1471
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1471
1472
|
asChild: !0,
|
|
1472
|
-
children: /* @__PURE__ */
|
|
1473
|
+
children: /* @__PURE__ */ I(d, {
|
|
1473
1474
|
variant: "ghost",
|
|
1474
1475
|
size: "sm",
|
|
1475
1476
|
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Rt && "text-foreground font-medium"),
|
|
1476
1477
|
children: [
|
|
1477
|
-
/* @__PURE__ */
|
|
1478
|
-
/* @__PURE__ */
|
|
1478
|
+
/* @__PURE__ */ F(me, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1479
|
+
/* @__PURE__ */ F("span", {
|
|
1479
1480
|
className: "hidden sm:inline",
|
|
1480
1481
|
children: E("list.filter")
|
|
1481
1482
|
}),
|
|
1482
|
-
Rt && /* @__PURE__ */
|
|
1483
|
+
Rt && /* @__PURE__ */ F("span", {
|
|
1483
1484
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1484
|
-
children:
|
|
1485
|
+
children: R.conditions?.length || 0
|
|
1485
1486
|
})
|
|
1486
1487
|
]
|
|
1487
1488
|
})
|
|
1488
|
-
}), /* @__PURE__ */
|
|
1489
|
+
}), /* @__PURE__ */ F(b, {
|
|
1489
1490
|
align: "start",
|
|
1490
1491
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1491
|
-
children: /* @__PURE__ */
|
|
1492
|
+
children: /* @__PURE__ */ I("div", {
|
|
1492
1493
|
className: "space-y-4",
|
|
1493
|
-
children: [/* @__PURE__ */
|
|
1494
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1494
1495
|
className: "flex items-center justify-between border-b pb-2",
|
|
1495
|
-
children: /* @__PURE__ */
|
|
1496
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1496
1497
|
className: "font-medium text-sm",
|
|
1497
1498
|
children: E("list.filterRecords")
|
|
1498
1499
|
})
|
|
1499
|
-
}), /* @__PURE__ */
|
|
1500
|
+
}), /* @__PURE__ */ F(m, {
|
|
1500
1501
|
fields: zt,
|
|
1501
|
-
value:
|
|
1502
|
+
value: R,
|
|
1502
1503
|
onChange: (e) => {
|
|
1503
|
-
|
|
1504
|
+
z(e), s && s(e);
|
|
1504
1505
|
}
|
|
1505
1506
|
})]
|
|
1506
1507
|
})
|
|
1507
1508
|
})]
|
|
1508
1509
|
}),
|
|
1509
|
-
|
|
1510
|
+
A.showGroup && !A.compactToolbar && /* @__PURE__ */ I(y, {
|
|
1510
1511
|
open: rt,
|
|
1511
1512
|
onOpenChange: it,
|
|
1512
|
-
children: [/* @__PURE__ */
|
|
1513
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1513
1514
|
asChild: !0,
|
|
1514
|
-
children: /* @__PURE__ */
|
|
1515
|
+
children: /* @__PURE__ */ I(d, {
|
|
1515
1516
|
variant: "ghost",
|
|
1516
1517
|
size: "sm",
|
|
1517
1518
|
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", K && "text-foreground font-medium"),
|
|
1518
1519
|
children: [
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
/* @__PURE__ */
|
|
1520
|
+
/* @__PURE__ */ F(ae, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1521
|
+
/* @__PURE__ */ F("span", {
|
|
1521
1522
|
className: "hidden sm:inline",
|
|
1522
1523
|
children: E("list.group")
|
|
1523
1524
|
}),
|
|
1524
|
-
K && K.fields?.length > 0 && /* @__PURE__ */
|
|
1525
|
+
K && K.fields?.length > 0 && /* @__PURE__ */ F("span", {
|
|
1525
1526
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1526
1527
|
children: K.fields.length
|
|
1527
1528
|
})
|
|
1528
1529
|
]
|
|
1529
1530
|
})
|
|
1530
|
-
}), /* @__PURE__ */
|
|
1531
|
+
}), /* @__PURE__ */ F(b, {
|
|
1531
1532
|
align: "start",
|
|
1532
1533
|
className: "w-72 p-3",
|
|
1533
|
-
children: /* @__PURE__ */
|
|
1534
|
+
children: /* @__PURE__ */ I("div", {
|
|
1534
1535
|
className: "space-y-2",
|
|
1535
|
-
children: [/* @__PURE__ */
|
|
1536
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1536
1537
|
className: "flex items-center justify-between border-b pb-2",
|
|
1537
|
-
children: [/* @__PURE__ */
|
|
1538
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1538
1539
|
className: "font-medium text-sm",
|
|
1539
1540
|
children: E("list.groupBy")
|
|
1540
|
-
}), K && /* @__PURE__ */
|
|
1541
|
+
}), K && /* @__PURE__ */ F(d, {
|
|
1541
1542
|
variant: "ghost",
|
|
1542
1543
|
size: "sm",
|
|
1543
1544
|
className: "h-6 px-2 text-xs",
|
|
@@ -1545,9 +1546,9 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1545
1546
|
"data-testid": "clear-grouping",
|
|
1546
1547
|
children: E("list.clear")
|
|
1547
1548
|
})]
|
|
1548
|
-
}), /* @__PURE__ */
|
|
1549
|
+
}), /* @__PURE__ */ F("div", {
|
|
1549
1550
|
"data-testid": "group-field-list",
|
|
1550
|
-
children: /* @__PURE__ */
|
|
1551
|
+
children: /* @__PURE__ */ F(h, {
|
|
1551
1552
|
value: K,
|
|
1552
1553
|
fieldOptions: Ht.map((e) => ({
|
|
1553
1554
|
value: e.name,
|
|
@@ -1555,9 +1556,9 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1555
1556
|
})),
|
|
1556
1557
|
maxLevels: 3,
|
|
1557
1558
|
labels: {
|
|
1558
|
-
addGroup: E("list.addGroup", "Add group field"),
|
|
1559
|
-
collapseTitle: E("list.collapsedByDefault", "Collapsed by default"),
|
|
1560
|
-
removeTitle: E("list.removeGroup", "Remove")
|
|
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" })
|
|
1561
1562
|
},
|
|
1562
1563
|
onChange: (e) => nt(e)
|
|
1563
1564
|
})
|
|
@@ -1565,74 +1566,74 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1565
1566
|
})
|
|
1566
1567
|
})]
|
|
1567
1568
|
}),
|
|
1568
|
-
|
|
1569
|
-
open:
|
|
1570
|
-
onOpenChange:
|
|
1571
|
-
children: [/* @__PURE__ */
|
|
1569
|
+
A.showSort && /* @__PURE__ */ I(y, {
|
|
1570
|
+
open: Ce,
|
|
1571
|
+
onOpenChange: Ee,
|
|
1572
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1572
1573
|
asChild: !0,
|
|
1573
|
-
children: /* @__PURE__ */
|
|
1574
|
+
children: /* @__PURE__ */ I(d, {
|
|
1574
1575
|
variant: "ghost",
|
|
1575
1576
|
size: "sm",
|
|
1576
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
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"),
|
|
1577
1578
|
children: [
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1579
|
+
/* @__PURE__ */ F(T, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1580
|
+
/* @__PURE__ */ F("span", {
|
|
1580
1581
|
className: "hidden sm:inline",
|
|
1581
1582
|
children: E("list.sort")
|
|
1582
1583
|
}),
|
|
1583
|
-
|
|
1584
|
+
L.length > 0 && /* @__PURE__ */ F("span", {
|
|
1584
1585
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1585
|
-
children:
|
|
1586
|
+
children: L.length
|
|
1586
1587
|
})
|
|
1587
1588
|
]
|
|
1588
1589
|
})
|
|
1589
|
-
}), /* @__PURE__ */
|
|
1590
|
+
}), /* @__PURE__ */ F(b, {
|
|
1590
1591
|
align: "start",
|
|
1591
1592
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1592
|
-
children: /* @__PURE__ */
|
|
1593
|
+
children: /* @__PURE__ */ I("div", {
|
|
1593
1594
|
className: "space-y-4",
|
|
1594
|
-
children: [/* @__PURE__ */
|
|
1595
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1595
1596
|
className: "flex items-center justify-between border-b pb-2",
|
|
1596
|
-
children: /* @__PURE__ */
|
|
1597
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1597
1598
|
className: "font-medium text-sm",
|
|
1598
1599
|
children: E("list.sortRecords")
|
|
1599
1600
|
})
|
|
1600
|
-
}), /* @__PURE__ */
|
|
1601
|
+
}), /* @__PURE__ */ F(S, {
|
|
1601
1602
|
fields: zt,
|
|
1602
|
-
value:
|
|
1603
|
+
value: L,
|
|
1603
1604
|
onChange: (e) => {
|
|
1604
|
-
|
|
1605
|
+
ke(e), c && c(e);
|
|
1605
1606
|
}
|
|
1606
1607
|
})]
|
|
1607
1608
|
})
|
|
1608
1609
|
})]
|
|
1609
1610
|
}),
|
|
1610
|
-
!
|
|
1611
|
-
|
|
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, {
|
|
1612
1613
|
open: st,
|
|
1613
1614
|
onOpenChange: ct,
|
|
1614
|
-
children: [/* @__PURE__ */
|
|
1615
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1615
1616
|
asChild: !0,
|
|
1616
|
-
children: /* @__PURE__ */
|
|
1617
|
+
children: /* @__PURE__ */ I(d, {
|
|
1617
1618
|
variant: "ghost",
|
|
1618
1619
|
size: "sm",
|
|
1619
1620
|
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", q && "text-foreground font-medium"),
|
|
1620
|
-
children: [/* @__PURE__ */
|
|
1621
|
+
children: [/* @__PURE__ */ F(se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1621
1622
|
className: "hidden sm:inline",
|
|
1622
1623
|
children: E("list.color")
|
|
1623
1624
|
})]
|
|
1624
1625
|
})
|
|
1625
|
-
}), /* @__PURE__ */
|
|
1626
|
+
}), /* @__PURE__ */ F(b, {
|
|
1626
1627
|
align: "start",
|
|
1627
1628
|
className: "w-64 p-3",
|
|
1628
|
-
children: /* @__PURE__ */
|
|
1629
|
+
children: /* @__PURE__ */ I("div", {
|
|
1629
1630
|
className: "space-y-2",
|
|
1630
|
-
children: [/* @__PURE__ */
|
|
1631
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1631
1632
|
className: "flex items-center justify-between border-b pb-2",
|
|
1632
|
-
children: [/* @__PURE__ */
|
|
1633
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1633
1634
|
className: "font-medium text-sm",
|
|
1634
1635
|
children: E("list.rowColor")
|
|
1635
|
-
}), q && /* @__PURE__ */
|
|
1636
|
+
}), q && /* @__PURE__ */ F(d, {
|
|
1636
1637
|
variant: "ghost",
|
|
1637
1638
|
size: "sm",
|
|
1638
1639
|
className: "h-6 px-2 text-xs",
|
|
@@ -1640,13 +1641,13 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1640
1641
|
"data-testid": "clear-row-color",
|
|
1641
1642
|
children: E("list.clear")
|
|
1642
1643
|
})]
|
|
1643
|
-
}), /* @__PURE__ */
|
|
1644
|
+
}), /* @__PURE__ */ I("div", {
|
|
1644
1645
|
className: "space-y-2",
|
|
1645
1646
|
"data-testid": "color-field-list",
|
|
1646
|
-
children: [/* @__PURE__ */
|
|
1647
|
+
children: [/* @__PURE__ */ F("label", {
|
|
1647
1648
|
className: "text-xs text-muted-foreground",
|
|
1648
1649
|
children: E("list.colorByField")
|
|
1649
|
-
}), /* @__PURE__ */
|
|
1650
|
+
}), /* @__PURE__ */ I("select", {
|
|
1650
1651
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1651
1652
|
value: q?.field || "",
|
|
1652
1653
|
onChange: (e) => {
|
|
@@ -1657,10 +1658,10 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1657
1658
|
} : void 0);
|
|
1658
1659
|
},
|
|
1659
1660
|
"data-testid": "color-field-select",
|
|
1660
|
-
children: [/* @__PURE__ */
|
|
1661
|
+
children: [/* @__PURE__ */ F("option", {
|
|
1661
1662
|
value: "",
|
|
1662
1663
|
children: E("list.none")
|
|
1663
|
-
}), Ht.map((e) => /* @__PURE__ */
|
|
1664
|
+
}), Ht.map((e) => /* @__PURE__ */ F("option", {
|
|
1664
1665
|
value: e.name,
|
|
1665
1666
|
children: e.label
|
|
1666
1667
|
}, e.name))]
|
|
@@ -1669,153 +1670,153 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1669
1670
|
})
|
|
1670
1671
|
})]
|
|
1671
1672
|
}),
|
|
1672
|
-
|
|
1673
|
-
let e = Z.mode === "compact" ?
|
|
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", {
|
|
1674
1675
|
defaultValue: "{{label}} (click to cycle)",
|
|
1675
1676
|
label: n
|
|
1676
1677
|
});
|
|
1677
|
-
return /* @__PURE__ */
|
|
1678
|
+
return /* @__PURE__ */ F(d, {
|
|
1678
1679
|
variant: "ghost",
|
|
1679
1680
|
size: "sm",
|
|
1680
1681
|
"aria-label": n,
|
|
1681
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"),
|
|
1682
1683
|
onClick: Z.cycle,
|
|
1683
1684
|
title: r,
|
|
1684
|
-
children: /* @__PURE__ */
|
|
1685
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1685
1686
|
});
|
|
1686
1687
|
})(),
|
|
1687
|
-
|
|
1688
|
-
let e = Q === "small" ?
|
|
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", {
|
|
1689
1690
|
defaultValue: "{{label}} (click to cycle)",
|
|
1690
1691
|
label: n
|
|
1691
1692
|
});
|
|
1692
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ F(d, {
|
|
1693
1694
|
variant: "ghost",
|
|
1694
1695
|
size: "sm",
|
|
1695
1696
|
"aria-label": n,
|
|
1696
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"),
|
|
1697
1698
|
onClick: Et,
|
|
1698
1699
|
title: r,
|
|
1699
|
-
children: /* @__PURE__ */
|
|
1700
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1700
1701
|
});
|
|
1701
1702
|
})(),
|
|
1702
|
-
|
|
1703
|
+
A.compactToolbar && (A.showGroup || A.showColor || A.showDensity || A.showHideFields) && /* @__PURE__ */ F(Fe, {
|
|
1703
1704
|
t: E,
|
|
1704
1705
|
allFields: Ht,
|
|
1705
|
-
showGroup:
|
|
1706
|
+
showGroup: A.showGroup,
|
|
1706
1707
|
groupingConfig: K,
|
|
1707
1708
|
setGroupingConfig: nt,
|
|
1708
|
-
showColor:
|
|
1709
|
+
showColor: A.showColor,
|
|
1709
1710
|
rowColorConfig: q,
|
|
1710
1711
|
setRowColorConfig: ot,
|
|
1711
|
-
showDensity:
|
|
1712
|
+
showDensity: A.showDensity,
|
|
1712
1713
|
density: Z,
|
|
1713
|
-
showHideFields:
|
|
1714
|
+
showHideFields: A.showHideFields,
|
|
1714
1715
|
hiddenFields: J,
|
|
1715
1716
|
updateHiddenFields: yt
|
|
1716
1717
|
}),
|
|
1717
|
-
(
|
|
1718
|
-
X && O.allowExport !== !1 && /* @__PURE__ */
|
|
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, {
|
|
1719
1720
|
open: St,
|
|
1720
1721
|
onOpenChange: Ct,
|
|
1721
|
-
children: [/* @__PURE__ */
|
|
1722
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1722
1723
|
asChild: !0,
|
|
1723
|
-
children: /* @__PURE__ */
|
|
1724
|
+
children: /* @__PURE__ */ I(d, {
|
|
1724
1725
|
variant: "ghost",
|
|
1725
1726
|
size: "sm",
|
|
1726
1727
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1727
|
-
children: [/* @__PURE__ */
|
|
1728
|
+
children: [/* @__PURE__ */ F(re, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1728
1729
|
className: "hidden sm:inline",
|
|
1729
1730
|
children: E("list.export")
|
|
1730
1731
|
})]
|
|
1731
1732
|
})
|
|
1732
|
-
}), /* @__PURE__ */
|
|
1733
|
+
}), /* @__PURE__ */ F(b, {
|
|
1733
1734
|
align: "start",
|
|
1734
1735
|
className: "w-48 p-2",
|
|
1735
|
-
children: /* @__PURE__ */
|
|
1736
|
+
children: /* @__PURE__ */ F("div", {
|
|
1736
1737
|
className: "space-y-1",
|
|
1737
|
-
children: (X.formats || ["csv", "json"]).map((e) => /* @__PURE__ */
|
|
1738
|
+
children: (X.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ I(d, {
|
|
1738
1739
|
variant: "ghost",
|
|
1739
1740
|
size: "sm",
|
|
1740
1741
|
className: "w-full justify-start h-8 text-xs",
|
|
1741
1742
|
onClick: () => Vt(e),
|
|
1742
|
-
children: [/* @__PURE__ */
|
|
1743
|
+
children: [/* @__PURE__ */ F(re, { className: "h-3.5 w-3.5 mr-2" }), E("list.exportAs", { format: e.toUpperCase() })]
|
|
1743
1744
|
}, e))
|
|
1744
1745
|
})
|
|
1745
1746
|
})]
|
|
1746
1747
|
}),
|
|
1747
|
-
(O.sharing?.enabled || O.sharing?.type) && /* @__PURE__ */
|
|
1748
|
+
(O.sharing?.enabled || O.sharing?.type) && /* @__PURE__ */ I(d, {
|
|
1748
1749
|
variant: "ghost",
|
|
1749
1750
|
size: "sm",
|
|
1750
1751
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1751
1752
|
title: `Sharing: ${O.sharing?.visibility || O.sharing?.type || "private"}`,
|
|
1752
1753
|
"data-testid": "share-button",
|
|
1753
|
-
children: [/* @__PURE__ */
|
|
1754
|
+
children: [/* @__PURE__ */ F(pe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1754
1755
|
className: "hidden sm:inline",
|
|
1755
1756
|
children: E("list.share")
|
|
1756
1757
|
})]
|
|
1757
1758
|
}),
|
|
1758
|
-
O.allowPrinting && /* @__PURE__ */
|
|
1759
|
+
O.allowPrinting && /* @__PURE__ */ I(d, {
|
|
1759
1760
|
variant: "ghost",
|
|
1760
1761
|
size: "sm",
|
|
1761
1762
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1762
1763
|
onClick: () => window.print(),
|
|
1763
1764
|
"data-testid": "print-button",
|
|
1764
|
-
children: [/* @__PURE__ */
|
|
1765
|
+
children: [/* @__PURE__ */ F(ce, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1765
1766
|
className: "hidden sm:inline",
|
|
1766
1767
|
children: E("list.print")
|
|
1767
1768
|
})]
|
|
1768
1769
|
}),
|
|
1769
1770
|
(() => {
|
|
1770
1771
|
let e = O.allowPrinting || O.sharing?.enabled || O.sharing?.type || X && O.allowExport !== !1;
|
|
1771
|
-
return
|
|
1772
|
+
return A.showSearch && e ? /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }) : null;
|
|
1772
1773
|
})(),
|
|
1773
|
-
|
|
1774
|
-
open:
|
|
1775
|
-
onOpenChange:
|
|
1776
|
-
children: [/* @__PURE__ */
|
|
1774
|
+
A.showSearch && /* @__PURE__ */ I(y, {
|
|
1775
|
+
open: ye,
|
|
1776
|
+
onOpenChange: Se,
|
|
1777
|
+
children: [/* @__PURE__ */ F(x, {
|
|
1777
1778
|
asChild: !0,
|
|
1778
|
-
children: /* @__PURE__ */
|
|
1779
|
+
children: /* @__PURE__ */ F(d, {
|
|
1779
1780
|
variant: "ghost",
|
|
1780
1781
|
size: "sm",
|
|
1781
|
-
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"),
|
|
1782
1783
|
"data-testid": "search-icon-button",
|
|
1783
1784
|
title: E("list.search"),
|
|
1784
|
-
children: /* @__PURE__ */
|
|
1785
|
+
children: /* @__PURE__ */ F(de, { className: "h-3.5 w-3.5" })
|
|
1785
1786
|
})
|
|
1786
|
-
}), /* @__PURE__ */
|
|
1787
|
+
}), /* @__PURE__ */ F(b, {
|
|
1787
1788
|
align: "end",
|
|
1788
1789
|
className: "w-[calc(100vw-2rem)] sm:w-64 p-2",
|
|
1789
1790
|
"data-testid": "search-popover",
|
|
1790
|
-
children: /* @__PURE__ */
|
|
1791
|
+
children: /* @__PURE__ */ I("div", {
|
|
1791
1792
|
className: "relative",
|
|
1792
1793
|
children: [
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
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, {
|
|
1795
1796
|
placeholder: E("list.search") + "...",
|
|
1796
|
-
value:
|
|
1797
|
+
value: P,
|
|
1797
1798
|
onChange: (e) => Pt(e.target.value),
|
|
1798
1799
|
className: "pl-7 h-8 text-xs",
|
|
1799
1800
|
autoFocus: !0
|
|
1800
1801
|
}),
|
|
1801
|
-
|
|
1802
|
+
P && /* @__PURE__ */ F(d, {
|
|
1802
1803
|
variant: "ghost",
|
|
1803
1804
|
size: "sm",
|
|
1804
1805
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
1805
1806
|
onClick: () => Pt(""),
|
|
1806
|
-
children: /* @__PURE__ */
|
|
1807
|
+
children: /* @__PURE__ */ F(ge, { className: "h-3 w-3" })
|
|
1807
1808
|
})
|
|
1808
1809
|
]
|
|
1809
1810
|
})
|
|
1810
1811
|
})]
|
|
1811
1812
|
}),
|
|
1812
|
-
|
|
1813
|
+
A.showAddRecord && A.addRecordPosition === "top" && /* @__PURE__ */ I(d, {
|
|
1813
1814
|
variant: "ghost",
|
|
1814
1815
|
size: "sm",
|
|
1815
1816
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1816
1817
|
"data-testid": "add-record-button",
|
|
1817
1818
|
onClick: () => w.onAddRecord?.(),
|
|
1818
|
-
children: [/* @__PURE__ */
|
|
1819
|
+
children: [/* @__PURE__ */ F(M, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1819
1820
|
className: "hidden sm:inline",
|
|
1820
1821
|
children: E("list.addRecord")
|
|
1821
1822
|
})]
|
|
@@ -1823,77 +1824,77 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1823
1824
|
]
|
|
1824
1825
|
})]
|
|
1825
1826
|
}),
|
|
1826
|
-
Y && Y.length > 0 && /* @__PURE__ */
|
|
1827
|
+
Y && Y.length > 0 && /* @__PURE__ */ F("div", {
|
|
1827
1828
|
className: "border-b px-2 sm:px-4 py-1 flex items-center gap-1 flex-wrap bg-background",
|
|
1828
1829
|
"data-testid": "quick-filters",
|
|
1829
1830
|
children: Y.map((e) => {
|
|
1830
|
-
let t = ft.has(e.id), n = e.icon ?
|
|
1831
|
-
return /* @__PURE__ */
|
|
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, {
|
|
1832
1833
|
variant: t ? "default" : "outline",
|
|
1833
1834
|
size: "sm",
|
|
1834
1835
|
className: "h-7 px-3 text-xs",
|
|
1835
1836
|
onClick: () => Bt(e.id),
|
|
1836
|
-
children: [n && /* @__PURE__ */
|
|
1837
|
+
children: [n && /* @__PURE__ */ F(n, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
1837
1838
|
}, e.id);
|
|
1838
1839
|
})
|
|
1839
1840
|
}),
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ F("div", {
|
|
1841
1842
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
1842
|
-
children: !
|
|
1843
|
+
children: !Ve && V.length === 0 && j === "grid" ? (() => {
|
|
1843
1844
|
let e = O.emptyState?.icon;
|
|
1844
|
-
return /* @__PURE__ */
|
|
1845
|
+
return /* @__PURE__ */ I("div", {
|
|
1845
1846
|
className: "flex flex-col items-center justify-center h-full min-h-[200px] text-center p-8",
|
|
1846
1847
|
"data-testid": "empty-state",
|
|
1847
1848
|
children: [
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__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", {
|
|
1850
1851
|
className: "text-lg font-medium text-foreground mb-1",
|
|
1851
1852
|
children: (typeof O.emptyState?.title == "string" ? O.emptyState.title : void 0) ?? E("list.noItems")
|
|
1852
1853
|
}),
|
|
1853
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ F("p", {
|
|
1854
1855
|
className: "text-sm text-muted-foreground max-w-md",
|
|
1855
1856
|
children: (typeof O.emptyState?.message == "string" ? O.emptyState.message : void 0) ?? E("list.noItemsMessage")
|
|
1856
1857
|
}),
|
|
1857
|
-
|
|
1858
|
+
A.showAddRecord && /* @__PURE__ */ I(d, {
|
|
1858
1859
|
variant: "default",
|
|
1859
1860
|
size: "sm",
|
|
1860
1861
|
className: "mt-4",
|
|
1861
1862
|
"data-testid": "empty-state-add-record",
|
|
1862
1863
|
onClick: () => w.onAddRecord?.(),
|
|
1863
|
-
children: [/* @__PURE__ */
|
|
1864
|
+
children: [/* @__PURE__ */ F(M, { className: "h-4 w-4 mr-1.5" }), E("list.addRecord")]
|
|
1864
1865
|
})
|
|
1865
1866
|
]
|
|
1866
1867
|
});
|
|
1867
|
-
})() : /* @__PURE__ */
|
|
1868
|
+
})() : /* @__PURE__ */ F(xe, {
|
|
1868
1869
|
schema: Lt,
|
|
1869
1870
|
...w,
|
|
1870
1871
|
data: V,
|
|
1871
|
-
loading:
|
|
1872
|
+
loading: Ve,
|
|
1872
1873
|
onRowSelect: ut
|
|
1873
1874
|
})
|
|
1874
|
-
},
|
|
1875
|
-
|
|
1875
|
+
}, j),
|
|
1876
|
+
A.showAddRecord && A.addRecordPosition === "bottom" && /* @__PURE__ */ F("div", {
|
|
1876
1877
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
1877
|
-
children: /* @__PURE__ */
|
|
1878
|
+
children: /* @__PURE__ */ I(d, {
|
|
1878
1879
|
variant: "ghost",
|
|
1879
1880
|
size: "sm",
|
|
1880
1881
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1881
1882
|
"data-testid": "add-record-button",
|
|
1882
1883
|
onClick: () => w.onAddRecord?.(),
|
|
1883
|
-
children: [/* @__PURE__ */
|
|
1884
|
+
children: [/* @__PURE__ */ F(M, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1884
1885
|
className: "hidden sm:inline",
|
|
1885
1886
|
children: E("list.addRecord")
|
|
1886
1887
|
})]
|
|
1887
1888
|
})
|
|
1888
1889
|
}),
|
|
1889
|
-
O.bulkActions && O.bulkActions.length > 0 && lt.length > 0 &&
|
|
1890
|
+
O.bulkActions && O.bulkActions.length > 0 && lt.length > 0 && j !== "grid" && /* @__PURE__ */ I("div", {
|
|
1890
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",
|
|
1891
1892
|
role: "region",
|
|
1892
1893
|
"aria-label": "Bulk actions",
|
|
1893
1894
|
"data-testid": "bulk-actions-bar",
|
|
1894
1895
|
children: [
|
|
1895
|
-
/* @__PURE__ */
|
|
1896
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ F(te, { className: "h-3.5 w-3.5 text-primary shrink-0" }),
|
|
1897
|
+
/* @__PURE__ */ I("span", {
|
|
1897
1898
|
className: "font-medium",
|
|
1898
1899
|
children: [
|
|
1899
1900
|
lt.length,
|
|
@@ -1902,45 +1903,45 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1902
1903
|
" selected"
|
|
1903
1904
|
]
|
|
1904
1905
|
}),
|
|
1905
|
-
/* @__PURE__ */
|
|
1906
|
+
/* @__PURE__ */ F("div", {
|
|
1906
1907
|
className: "flex items-center gap-1.5 ml-3",
|
|
1907
1908
|
children: O.bulkActions.map((e) => {
|
|
1908
|
-
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ?
|
|
1909
|
-
return /* @__PURE__ */
|
|
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, {
|
|
1910
1911
|
variant: n ? "destructive" : "outline",
|
|
1911
1912
|
size: "sm",
|
|
1912
1913
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
1913
1914
|
onClick: () => w.onBulkAction?.(e, lt),
|
|
1914
1915
|
"data-testid": `bulk-action-${e}`,
|
|
1915
|
-
children: [r && /* @__PURE__ */
|
|
1916
|
+
children: [r && /* @__PURE__ */ F(r, { className: "h-3 w-3" }), He(e)]
|
|
1916
1917
|
}, e);
|
|
1917
1918
|
})
|
|
1918
1919
|
}),
|
|
1919
|
-
/* @__PURE__ */
|
|
1920
|
+
/* @__PURE__ */ I(d, {
|
|
1920
1921
|
variant: "ghost",
|
|
1921
1922
|
size: "sm",
|
|
1922
1923
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
1923
1924
|
onClick: () => ut([]),
|
|
1924
|
-
children: [/* @__PURE__ */
|
|
1925
|
+
children: [/* @__PURE__ */ F(ge, { className: "h-3 w-3" }), "Clear"]
|
|
1925
1926
|
})
|
|
1926
1927
|
]
|
|
1927
1928
|
}),
|
|
1928
|
-
!
|
|
1929
|
+
!Ve && V.length > 0 && O.showRecordCount !== !1 && /* @__PURE__ */ I("div", {
|
|
1929
1930
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
1930
1931
|
"data-testid": "record-count-bar",
|
|
1931
1932
|
children: [
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
+
/* @__PURE__ */ F("span", {
|
|
1933
1934
|
className: "font-medium text-foreground/80",
|
|
1934
1935
|
children: V.length === 1 ? E("list.recordCountOne", { count: V.length }) : E("list.recordCount", { count: V.length })
|
|
1935
1936
|
}),
|
|
1936
|
-
Ze && /* @__PURE__ */
|
|
1937
|
+
Ze && /* @__PURE__ */ F("span", {
|
|
1937
1938
|
className: "text-amber-600",
|
|
1938
1939
|
"data-testid": "data-limit-warning",
|
|
1939
1940
|
children: E("list.dataLimitReached", { limit: tt })
|
|
1940
1941
|
}),
|
|
1941
|
-
O.pagination?.pageSizeOptions && O.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */
|
|
1942
|
+
O.pagination?.pageSizeOptions && O.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ I("div", {
|
|
1942
1943
|
className: "ml-auto flex items-center gap-2",
|
|
1943
|
-
children: [/* @__PURE__ */
|
|
1944
|
+
children: [/* @__PURE__ */ F("span", { children: E("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ F("select", {
|
|
1944
1945
|
"data-testid": "page-size-selector",
|
|
1945
1946
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
1946
1947
|
value: String(tt),
|
|
@@ -1948,7 +1949,7 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1948
1949
|
let t = Number(e.target.value);
|
|
1949
1950
|
et(t), w.onPageSizeChange && w.onPageSizeChange(t);
|
|
1950
1951
|
},
|
|
1951
|
-
children: O.pagination.pageSizeOptions.map((e) => /* @__PURE__ */
|
|
1952
|
+
children: O.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ F("option", {
|
|
1952
1953
|
value: String(e),
|
|
1953
1954
|
children: e
|
|
1954
1955
|
}, e))
|
|
@@ -1956,17 +1957,17 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1956
1957
|
})
|
|
1957
1958
|
]
|
|
1958
1959
|
}),
|
|
1959
|
-
Ft.isOverlay && /* @__PURE__ */
|
|
1960
|
+
Ft.isOverlay && /* @__PURE__ */ F(v, {
|
|
1960
1961
|
...Ft,
|
|
1961
1962
|
title: O.label ? `${O.label} Detail` : O.objectName ? `${O.objectName.charAt(0).toUpperCase() + O.objectName.slice(1)} Detail` : "Record Detail",
|
|
1962
|
-
children: (e) => /* @__PURE__ */
|
|
1963
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
1963
1964
|
className: "space-y-3",
|
|
1964
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
1965
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
1965
1966
|
className: "flex flex-col",
|
|
1966
|
-
children: [/* @__PURE__ */
|
|
1967
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1967
1968
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1968
1969
|
children: e.replace(/_/g, " ")
|
|
1969
|
-
}), /* @__PURE__ */
|
|
1970
|
+
}), /* @__PURE__ */ F("span", {
|
|
1970
1971
|
className: "text-sm",
|
|
1971
1972
|
children: String(t ?? "—")
|
|
1972
1973
|
})]
|
|
@@ -1976,58 +1977,37 @@ var W = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1976
1977
|
]
|
|
1977
1978
|
});
|
|
1978
1979
|
});
|
|
1979
|
-
|
|
1980
|
+
Ye.displayName = "ListView";
|
|
1980
1981
|
//#endregion
|
|
1981
1982
|
//#region src/ObjectGallery.tsx
|
|
1982
|
-
var
|
|
1983
|
+
var Xe = {
|
|
1983
1984
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
1984
1985
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
1985
1986
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
1986
|
-
},
|
|
1987
|
+
}, Ze = {
|
|
1987
1988
|
small: "aspect-square",
|
|
1988
1989
|
medium: "aspect-[4/3]",
|
|
1989
1990
|
large: "aspect-[16/10]"
|
|
1990
|
-
},
|
|
1991
|
-
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({
|
|
1992
1993
|
navigation: n.navigation,
|
|
1993
1994
|
objectName: n.objectName,
|
|
1994
1995
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
1995
|
-
}), 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 } =
|
|
1996
|
-
|
|
1997
|
-
if (
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
if (Array.isArray(r.options)) {
|
|
2002
|
-
let e = r.options.find((e) => String(e?.value ?? e) === String(t));
|
|
2003
|
-
e && (i = e.label ?? i);
|
|
2004
|
-
} else if (r.options && typeof r.options == "object") {
|
|
2005
|
-
let e = r.options[String(t)];
|
|
2006
|
-
e && (i = e.label ?? i);
|
|
2007
|
-
}
|
|
2008
|
-
return re(n.objectName, e, String(t), i);
|
|
2009
|
-
}
|
|
2010
|
-
let a = typeof t == "number" ? t : Number(t);
|
|
2011
|
-
if (Number.isFinite(a)) {
|
|
2012
|
-
if (i === "currency") {
|
|
2013
|
-
let e = r?.currency || r?.options?.currency || "USD";
|
|
2014
|
-
try {
|
|
2015
|
-
return new Intl.NumberFormat(void 0, {
|
|
2016
|
-
style: "currency",
|
|
2017
|
-
currency: e,
|
|
2018
|
-
maximumFractionDigits: 0
|
|
2019
|
-
}).format(a);
|
|
2020
|
-
} catch {
|
|
2021
|
-
return new Intl.NumberFormat().format(a);
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
if (i === "percent") return new Intl.NumberFormat(void 0, {
|
|
2025
|
-
style: "percent",
|
|
2026
|
-
maximumFractionDigits: 2
|
|
2027
|
-
}).format(a > 1 ? a / 100 : a);
|
|
2028
|
-
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);
|
|
2029
2002
|
}
|
|
2030
|
-
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;
|
|
2031
2011
|
}, [
|
|
2032
2012
|
_,
|
|
2033
2013
|
n.objectName,
|
|
@@ -2083,13 +2063,13 @@ var Je = {
|
|
|
2083
2063
|
e.data,
|
|
2084
2064
|
_
|
|
2085
2065
|
]);
|
|
2086
|
-
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,
|
|
2087
|
-
|
|
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) => {
|
|
2067
|
+
j((t) => ({
|
|
2088
2068
|
...t,
|
|
2089
|
-
[e]: t[e] === void 0 ? !
|
|
2069
|
+
[e]: t[e] === void 0 ? !se : !t[e]
|
|
2090
2070
|
}));
|
|
2091
|
-
}, [
|
|
2092
|
-
if (!
|
|
2071
|
+
}, [se]), ce = l(() => {
|
|
2072
|
+
if (!oe || !k) return [];
|
|
2093
2073
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
2094
2074
|
for (let n of D) {
|
|
2095
2075
|
let r = k.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
@@ -2113,7 +2093,7 @@ var Je = {
|
|
|
2113
2093
|
});
|
|
2114
2094
|
return n === "desc" ? -r : r;
|
|
2115
2095
|
}), t.map((t) => {
|
|
2116
|
-
let n = e.get(t), r = t in
|
|
2096
|
+
let n = e.get(t), r = t in A ? A[t] : se;
|
|
2117
2097
|
return {
|
|
2118
2098
|
key: t,
|
|
2119
2099
|
label: n.label,
|
|
@@ -2124,90 +2104,98 @@ var Je = {
|
|
|
2124
2104
|
}, [
|
|
2125
2105
|
D,
|
|
2126
2106
|
k,
|
|
2107
|
+
oe,
|
|
2127
2108
|
A,
|
|
2128
|
-
|
|
2129
|
-
oe
|
|
2109
|
+
se
|
|
2130
2110
|
]);
|
|
2131
|
-
if (h && !D.length) return /* @__PURE__ */
|
|
2111
|
+
if (h && !D.length) return /* @__PURE__ */ F("div", {
|
|
2132
2112
|
className: "p-4 text-sm text-muted-foreground",
|
|
2133
2113
|
children: "Loading Gallery..."
|
|
2134
2114
|
});
|
|
2135
|
-
if (!D.length) return /* @__PURE__ */
|
|
2115
|
+
if (!D.length) return /* @__PURE__ */ F("div", {
|
|
2136
2116
|
className: "p-4 text-sm text-muted-foreground",
|
|
2137
2117
|
children: "No items to display"
|
|
2138
2118
|
});
|
|
2139
2119
|
let le = (t, r) => {
|
|
2140
2120
|
let i = t.id ?? t._id ?? r, a = String(t[ee] ?? "Untitled"), o = t[S];
|
|
2141
|
-
return /* @__PURE__ */
|
|
2121
|
+
return /* @__PURE__ */ I(f, {
|
|
2142
2122
|
role: "listitem",
|
|
2143
2123
|
className: C("group overflow-hidden transition-all hover:shadow-md", (e.onCardClick || e.onRowClick || n.navigation) && "cursor-pointer"),
|
|
2144
2124
|
onClick: () => b.handleClick(t),
|
|
2145
|
-
children: [/* @__PURE__ */
|
|
2146
|
-
className: C("w-full overflow-hidden bg-muted relative",
|
|
2125
|
+
children: [/* @__PURE__ */ F("div", {
|
|
2126
|
+
className: C("w-full overflow-hidden bg-muted relative", Ze[T]),
|
|
2147
2127
|
hidden: !ae,
|
|
2148
|
-
children: o ? /* @__PURE__ */
|
|
2128
|
+
children: o ? /* @__PURE__ */ F("img", {
|
|
2149
2129
|
src: o,
|
|
2150
2130
|
alt: a,
|
|
2151
2131
|
className: C("h-full w-full transition-transform group-hover:scale-105", w === "cover" && "object-cover", w === "contain" && "object-contain")
|
|
2152
|
-
}) : /* @__PURE__ */
|
|
2132
|
+
}) : /* @__PURE__ */ F("div", {
|
|
2153
2133
|
className: "flex h-full w-full items-center justify-center bg-secondary/50 text-muted-foreground",
|
|
2154
|
-
children: /* @__PURE__ */
|
|
2134
|
+
children: /* @__PURE__ */ F("span", {
|
|
2155
2135
|
className: "text-4xl font-light opacity-20",
|
|
2156
2136
|
children: a[0]?.toUpperCase()
|
|
2157
2137
|
})
|
|
2158
2138
|
})
|
|
2159
|
-
}), /* @__PURE__ */
|
|
2139
|
+
}), /* @__PURE__ */ I(p, {
|
|
2160
2140
|
className: C("p-3", ae && "border-t"),
|
|
2161
|
-
children: [/* @__PURE__ */
|
|
2141
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
2162
2142
|
className: "font-medium truncate text-sm",
|
|
2163
2143
|
title: a,
|
|
2164
2144
|
children: a
|
|
2165
|
-
}), te && te.length > 0 && /* @__PURE__ */
|
|
2166
|
-
className: "mt-1 space-y-
|
|
2145
|
+
}), te && te.length > 0 && /* @__PURE__ */ F("div", {
|
|
2146
|
+
className: "mt-1 space-y-1",
|
|
2167
2147
|
children: te.map((e) => {
|
|
2168
2148
|
let n = t[e];
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
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
|
+
})
|
|
2172
2160
|
}, e);
|
|
2173
2161
|
})
|
|
2174
2162
|
})]
|
|
2175
2163
|
})]
|
|
2176
2164
|
}, i);
|
|
2177
|
-
},
|
|
2178
|
-
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),
|
|
2179
2167
|
role: "list",
|
|
2180
2168
|
children: e.map((e, t) => le(e, t))
|
|
2181
2169
|
});
|
|
2182
|
-
return /* @__PURE__ */
|
|
2170
|
+
return /* @__PURE__ */ I(P, { children: [oe ? /* @__PURE__ */ F("div", {
|
|
2183
2171
|
className: "space-y-2",
|
|
2184
|
-
children: ce.map((e) => /* @__PURE__ */
|
|
2172
|
+
children: ce.map((e) => /* @__PURE__ */ I("div", {
|
|
2185
2173
|
className: "border rounded-md",
|
|
2186
|
-
children: [/* @__PURE__ */
|
|
2174
|
+
children: [/* @__PURE__ */ I("button", {
|
|
2187
2175
|
type: "button",
|
|
2188
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",
|
|
2189
|
-
onClick: () =>
|
|
2177
|
+
onClick: () => M(e.key),
|
|
2190
2178
|
children: [
|
|
2191
|
-
e.collapsed ? /* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
/* @__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", {
|
|
2194
2182
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2195
2183
|
children: e.items.length
|
|
2196
2184
|
})
|
|
2197
2185
|
]
|
|
2198
|
-
}), !e.collapsed &&
|
|
2186
|
+
}), !e.collapsed && N(e.items)]
|
|
2199
2187
|
}, e.key))
|
|
2200
|
-
}) :
|
|
2188
|
+
}) : N(D), b.isOverlay && /* @__PURE__ */ F(v, {
|
|
2201
2189
|
...b,
|
|
2202
2190
|
title: "Gallery Item",
|
|
2203
|
-
children: (e) => /* @__PURE__ */
|
|
2191
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
2204
2192
|
className: "space-y-3",
|
|
2205
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
2193
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
2206
2194
|
className: "flex flex-col",
|
|
2207
|
-
children: [/* @__PURE__ */
|
|
2195
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2208
2196
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
2209
2197
|
children: e.replace(/_/g, " ")
|
|
2210
|
-
}), /* @__PURE__ */
|
|
2198
|
+
}), /* @__PURE__ */ F("span", {
|
|
2211
2199
|
className: "text-sm",
|
|
2212
2200
|
children: String(t ?? "—")
|
|
2213
2201
|
})]
|
|
@@ -2215,11 +2203,11 @@ var Je = {
|
|
|
2215
2203
|
})
|
|
2216
2204
|
})] });
|
|
2217
2205
|
};
|
|
2218
|
-
e.register("object-gallery",
|
|
2206
|
+
e.register("object-gallery", Qe, {
|
|
2219
2207
|
namespace: "plugin-list",
|
|
2220
2208
|
label: "Gallery View",
|
|
2221
2209
|
category: "view"
|
|
2222
|
-
}), e.register("list-view",
|
|
2210
|
+
}), e.register("list-view", Ye, {
|
|
2223
2211
|
namespace: "plugin-list",
|
|
2224
2212
|
label: "List View",
|
|
2225
2213
|
category: "Views",
|
|
@@ -2296,7 +2284,7 @@ e.register("object-gallery", Xe, {
|
|
|
2296
2284
|
sort: [],
|
|
2297
2285
|
options: {}
|
|
2298
2286
|
}
|
|
2299
|
-
}), e.register("list",
|
|
2287
|
+
}), e.register("list", Ye, {
|
|
2300
2288
|
namespace: "view",
|
|
2301
2289
|
category: "view",
|
|
2302
2290
|
label: "List",
|
|
@@ -2367,4 +2355,4 @@ e.register("object-gallery", Xe, {
|
|
|
2367
2355
|
]
|
|
2368
2356
|
});
|
|
2369
2357
|
//#endregion
|
|
2370
|
-
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 };
|