@object-ui/plugin-list 7.0.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/dist/ListView.d.ts.map +1 -1
- package/dist/index.js +883 -853
- package/dist/index.umd.cjs +2 -2
- package/package.json +16 -16
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildExpandFields as t, evaluatePlainCondition as n } from "@object-ui/core";
|
|
2
2
|
import * as r from "react";
|
|
3
3
|
import { useCallback as i, useContext as a, useEffect as o, useMemo as s, useState as c } from "react";
|
|
4
|
-
import { Button as l, Card as u, CardContent as d, DataEmptyState as f, DropdownMenu as p, DropdownMenuContent as m, DropdownMenuItem as h, DropdownMenuTrigger as g, FilterBuilder as _, GroupingEditor as
|
|
5
|
-
import { Activity as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { useObjectLabel as
|
|
8
|
-
import { SchemaRenderer as
|
|
9
|
-
import { usePullToRefresh as
|
|
10
|
-
import { usePermissions as
|
|
11
|
-
import { getCellRenderer as
|
|
4
|
+
import { Button as l, Card as u, CardContent as d, DataEmptyState as f, DropdownMenu as p, DropdownMenuContent as m, DropdownMenuItem as h, DropdownMenuTrigger as g, FilterBuilder as _, GroupingEditor as v, Input as y, LookupValuePicker as b, NavigationOverlay as x, Popover as S, PopoverContent as C, PopoverTrigger as w, RefreshIndicator as ee, SortBuilder as te, cn as T } from "@object-ui/components";
|
|
5
|
+
import { Activity as ne, AlertTriangle as re, ArrowUpDown as ie, BarChart3 as E, Calendar as D, Check as O, CheckSquare as ae, ChevronDown as k, ChevronRight as A, Download as oe, EyeOff as se, GanttChartSquare as j, Grid as ce, Group as le, Images as M, Inbox as ue, LayoutGrid as N, ListTree as de, Map as P, Paintbrush as fe, Plus as pe, Printer as me, RotateCw as he, Rows2 as ge, Rows3 as _e, Rows4 as ve, Search as ye, Settings2 as be, Share2 as xe, SlidersHorizontal as Se, Trash2 as Ce, X as we, icons as Te } from "lucide-react";
|
|
6
|
+
import { Fragment as Ee, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
7
|
+
import { useObjectLabel as De, useObjectTranslation as Oe, useSafeFieldLabel as ke } from "@object-ui/i18n";
|
|
8
|
+
import { SchemaRenderer as Ae, SchemaRendererContext as je, useDataScope as Me, useDensityMode as Ne, useNavigationOverlay as Pe, useSafeFieldLabel as L } from "@object-ui/react";
|
|
9
|
+
import { usePullToRefresh as Fe } from "@object-ui/mobile";
|
|
10
|
+
import { usePermissions as Ie } from "@object-ui/permissions";
|
|
11
|
+
import { getCellRenderer as Le, resolveCellRendererType as Re } from "@object-ui/fields";
|
|
12
12
|
//#region src/ViewSwitcher.tsx
|
|
13
|
-
var
|
|
14
|
-
grid: /* @__PURE__ */
|
|
15
|
-
kanban: /* @__PURE__ */
|
|
16
|
-
gallery: /* @__PURE__ */
|
|
17
|
-
calendar: /* @__PURE__ */
|
|
18
|
-
timeline: /* @__PURE__ */
|
|
19
|
-
gantt: /* @__PURE__ */
|
|
20
|
-
map: /* @__PURE__ */ P
|
|
21
|
-
chart: /* @__PURE__ */
|
|
22
|
-
tree: /* @__PURE__ */
|
|
23
|
-
},
|
|
13
|
+
var ze = {
|
|
14
|
+
grid: /* @__PURE__ */ F(ce, { className: "h-4 w-4" }),
|
|
15
|
+
kanban: /* @__PURE__ */ F(N, { className: "h-4 w-4" }),
|
|
16
|
+
gallery: /* @__PURE__ */ F(M, { className: "h-4 w-4" }),
|
|
17
|
+
calendar: /* @__PURE__ */ F(D, { className: "h-4 w-4" }),
|
|
18
|
+
timeline: /* @__PURE__ */ F(ne, { className: "h-4 w-4" }),
|
|
19
|
+
gantt: /* @__PURE__ */ F(j, { className: "h-4 w-4" }),
|
|
20
|
+
map: /* @__PURE__ */ F(P, { className: "h-4 w-4" }),
|
|
21
|
+
chart: /* @__PURE__ */ F(E, { className: "h-4 w-4" }),
|
|
22
|
+
tree: /* @__PURE__ */ F(de, { className: "h-4 w-4" })
|
|
23
|
+
}, R = {
|
|
24
24
|
grid: "Grid",
|
|
25
25
|
kanban: "Kanban",
|
|
26
26
|
gallery: "Gallery",
|
|
@@ -30,7 +30,7 @@ var Be = {
|
|
|
30
30
|
map: "Map",
|
|
31
31
|
chart: "Chart",
|
|
32
32
|
tree: "Tree"
|
|
33
|
-
},
|
|
33
|
+
}, Be = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: i, animated: a = !0 }) => {
|
|
34
34
|
let [o, s] = r.useState(!1), c = r.useCallback((t) => {
|
|
35
35
|
s(!1), t !== e && (a && typeof document < "u" && "startViewTransition" in document ? document.startViewTransition(() => n(t)) : n(t));
|
|
36
36
|
}, [
|
|
@@ -38,66 +38,66 @@ var Be = {
|
|
|
38
38
|
e,
|
|
39
39
|
n
|
|
40
40
|
]);
|
|
41
|
-
return t.length >= 2 && t.length <= 4 ? /* @__PURE__ */
|
|
41
|
+
return t.length >= 2 && t.length <= 4 ? /* @__PURE__ */ F("div", {
|
|
42
42
|
role: "tablist",
|
|
43
43
|
"data-testid": "view-switcher-segmented",
|
|
44
|
-
className:
|
|
44
|
+
className: T("inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher", i),
|
|
45
45
|
children: t.map((t) => {
|
|
46
46
|
let n = t === e;
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ I("button", {
|
|
48
48
|
type: "button",
|
|
49
49
|
role: "tab",
|
|
50
50
|
"aria-selected": n,
|
|
51
|
-
"aria-label":
|
|
52
|
-
title:
|
|
51
|
+
"aria-label": R[t],
|
|
52
|
+
title: R[t],
|
|
53
53
|
"data-state": n ? "on" : "off",
|
|
54
54
|
onClick: () => c(t),
|
|
55
|
-
className:
|
|
56
|
-
children: [
|
|
55
|
+
className: T("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[7px] text-xs font-medium transition-all duration-150", n ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"),
|
|
56
|
+
children: [ze[t], /* @__PURE__ */ F("span", {
|
|
57
57
|
className: "hidden sm:inline-block",
|
|
58
|
-
children:
|
|
58
|
+
children: R[t]
|
|
59
59
|
})]
|
|
60
60
|
}, t);
|
|
61
61
|
})
|
|
62
|
-
}) : /* @__PURE__ */
|
|
62
|
+
}) : /* @__PURE__ */ I(S, {
|
|
63
63
|
open: o,
|
|
64
64
|
onOpenChange: s,
|
|
65
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ F(w, {
|
|
66
66
|
asChild: !0,
|
|
67
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ I("button", {
|
|
68
68
|
type: "button",
|
|
69
69
|
"data-testid": "view-switcher-dropdown",
|
|
70
|
-
"aria-label":
|
|
71
|
-
className:
|
|
70
|
+
"aria-label": R[e],
|
|
71
|
+
className: T("inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher", o ? "text-foreground bg-muted" : "text-muted-foreground hover:text-foreground", i),
|
|
72
72
|
children: [
|
|
73
|
-
|
|
74
|
-
/* @__PURE__ */
|
|
73
|
+
ze[e],
|
|
74
|
+
/* @__PURE__ */ F("span", {
|
|
75
75
|
className: "hidden sm:inline-block",
|
|
76
|
-
children:
|
|
76
|
+
children: R[e]
|
|
77
77
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ F(k, { className: "h-3 w-3 opacity-60" })
|
|
79
79
|
]
|
|
80
80
|
})
|
|
81
|
-
}), /* @__PURE__ */
|
|
81
|
+
}), /* @__PURE__ */ F(C, {
|
|
82
82
|
align: "end",
|
|
83
83
|
className: "w-44 p-1",
|
|
84
|
-
children: t.map((t) => /* @__PURE__ */
|
|
84
|
+
children: t.map((t) => /* @__PURE__ */ I("button", {
|
|
85
85
|
type: "button",
|
|
86
86
|
onClick: () => c(t),
|
|
87
87
|
"data-state": t === e ? "on" : "off",
|
|
88
|
-
className:
|
|
88
|
+
className: T("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors hover:bg-muted", t === e ? "text-foreground font-medium" : "text-muted-foreground"),
|
|
89
89
|
children: [
|
|
90
|
-
|
|
91
|
-
/* @__PURE__ */
|
|
90
|
+
ze[t],
|
|
91
|
+
/* @__PURE__ */ F("span", {
|
|
92
92
|
className: "flex-1 text-left",
|
|
93
|
-
children:
|
|
93
|
+
children: R[t]
|
|
94
94
|
}),
|
|
95
|
-
t === e && /* @__PURE__ */
|
|
95
|
+
t === e && /* @__PURE__ */ F(O, { className: "h-3.5 w-3.5" })
|
|
96
96
|
]
|
|
97
97
|
}, t))
|
|
98
98
|
})]
|
|
99
99
|
});
|
|
100
|
-
},
|
|
100
|
+
}, z = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: i, animated: a = !0 }) => {
|
|
101
101
|
let o = r.useCallback((t) => {
|
|
102
102
|
if (!a || t === e) {
|
|
103
103
|
n(t);
|
|
@@ -109,21 +109,21 @@ var Be = {
|
|
|
109
109
|
e,
|
|
110
110
|
n
|
|
111
111
|
]);
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
-
className:
|
|
112
|
+
return /* @__PURE__ */ F("div", {
|
|
113
|
+
className: T("flex items-center gap-1 bg-transparent oui-view-switcher", i),
|
|
114
114
|
children: t.map((t) => {
|
|
115
115
|
let n = e === t;
|
|
116
|
-
return /* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ I("button", {
|
|
117
117
|
type: "button",
|
|
118
118
|
onClick: () => o(t),
|
|
119
|
-
"aria-label":
|
|
120
|
-
title:
|
|
119
|
+
"aria-label": R[t],
|
|
120
|
+
title: R[t],
|
|
121
121
|
"aria-pressed": n,
|
|
122
122
|
"data-state": n ? "on" : "off",
|
|
123
|
-
className:
|
|
124
|
-
children: [
|
|
123
|
+
className: T("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", "hover:bg-muted hover:text-muted-foreground", "gap-2 px-3 py-2", "data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm border-transparent border data-[state=on]:border-border/50"),
|
|
124
|
+
children: [ze[t], /* @__PURE__ */ F("span", {
|
|
125
125
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
126
|
-
children:
|
|
126
|
+
children: R[t]
|
|
127
127
|
})]
|
|
128
128
|
}, t);
|
|
129
129
|
})
|
|
@@ -131,88 +131,88 @@ var Be = {
|
|
|
131
131
|
};
|
|
132
132
|
//#endregion
|
|
133
133
|
//#region src/components/ViewSettingsPopover.tsx
|
|
134
|
-
function
|
|
134
|
+
function Ve({ title: e, badge: t, onClear: n, clearLabel: i, defaultOpen: a = !0, children: o }) {
|
|
135
135
|
let [s, c] = r.useState(a);
|
|
136
|
-
return /* @__PURE__ */
|
|
136
|
+
return /* @__PURE__ */ I("div", {
|
|
137
137
|
className: "border-b last:border-b-0",
|
|
138
|
-
children: [/* @__PURE__ */
|
|
138
|
+
children: [/* @__PURE__ */ I("div", {
|
|
139
139
|
className: "flex items-center justify-between px-3 py-2",
|
|
140
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ I("button", {
|
|
141
141
|
type: "button",
|
|
142
142
|
onClick: () => c((e) => !e),
|
|
143
143
|
className: "flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground",
|
|
144
144
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ F(k, { className: T("h-3.5 w-3.5 transition-transform", !s && "-rotate-90") }),
|
|
146
146
|
e,
|
|
147
|
-
typeof t == "number" && t > 0 && /* @__PURE__ */
|
|
147
|
+
typeof t == "number" && t > 0 && /* @__PURE__ */ F("span", {
|
|
148
148
|
className: "ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 px-1 text-[10px] text-primary tabular-nums",
|
|
149
149
|
children: t
|
|
150
150
|
})
|
|
151
151
|
]
|
|
152
|
-
}), n && /* @__PURE__ */
|
|
152
|
+
}), n && /* @__PURE__ */ F("button", {
|
|
153
153
|
type: "button",
|
|
154
154
|
onClick: n,
|
|
155
155
|
className: "text-[11px] text-muted-foreground hover:text-foreground",
|
|
156
156
|
children: i
|
|
157
157
|
})]
|
|
158
|
-
}), s && /* @__PURE__ */
|
|
158
|
+
}), s && /* @__PURE__ */ F("div", {
|
|
159
159
|
className: "px-3 pb-3",
|
|
160
160
|
children: o
|
|
161
161
|
})]
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
let { t, allFields: n, showGroup: i, groupingConfig: a, setGroupingConfig: o, showColor: s, rowColorConfig: c, setRowColorConfig: u, showDensity: d, density: f, showHideFields: p, hiddenFields: m, updateHiddenFields: h } = e, [g, _] = r.useState(!1),
|
|
164
|
+
function He(e) {
|
|
165
|
+
let { t, allFields: n, showGroup: i, groupingConfig: a, setGroupingConfig: o, showColor: s, rowColorConfig: c, setRowColorConfig: u, showDensity: d, density: f, showHideFields: p, hiddenFields: m, updateHiddenFields: h } = e, [g, _] = r.useState(!1), y = [
|
|
166
166
|
!!a?.fields?.length,
|
|
167
167
|
!!c?.field,
|
|
168
168
|
f && f.mode !== "compact",
|
|
169
169
|
(m?.size ?? 0) > 0
|
|
170
|
-
].filter(Boolean).length,
|
|
171
|
-
return /* @__PURE__ */
|
|
170
|
+
].filter(Boolean).length, b = f?.mode === "compact" ? ve : f?.mode === "comfortable" ? _e : ge, x = t("list.viewSettings", { defaultValue: "View settings" });
|
|
171
|
+
return /* @__PURE__ */ I(S, {
|
|
172
172
|
open: g,
|
|
173
173
|
onOpenChange: _,
|
|
174
|
-
children: [/* @__PURE__ */
|
|
174
|
+
children: [/* @__PURE__ */ F(w, {
|
|
175
175
|
asChild: !0,
|
|
176
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ I(l, {
|
|
177
177
|
variant: "ghost",
|
|
178
178
|
size: "sm",
|
|
179
|
-
"aria-label":
|
|
180
|
-
title:
|
|
181
|
-
className:
|
|
179
|
+
"aria-label": x,
|
|
180
|
+
title: x,
|
|
181
|
+
className: T("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", y > 0 && "text-foreground font-medium"),
|
|
182
182
|
"data-testid": "view-settings-trigger",
|
|
183
183
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ F(be, { className: "h-3.5 w-3.5 sm:mr-1.5" }),
|
|
185
|
+
/* @__PURE__ */ F("span", {
|
|
186
186
|
className: "hidden sm:inline",
|
|
187
|
-
children:
|
|
187
|
+
children: x
|
|
188
188
|
}),
|
|
189
|
-
|
|
189
|
+
y > 0 && /* @__PURE__ */ F("span", {
|
|
190
190
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
191
|
-
children:
|
|
191
|
+
children: y
|
|
192
192
|
})
|
|
193
193
|
]
|
|
194
194
|
})
|
|
195
|
-
}), /* @__PURE__ */
|
|
195
|
+
}), /* @__PURE__ */ I(C, {
|
|
196
196
|
align: "end",
|
|
197
197
|
className: "w-80 p-0",
|
|
198
198
|
"data-testid": "view-settings-content",
|
|
199
199
|
children: [
|
|
200
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ I("div", {
|
|
201
201
|
className: "px-3 py-2 border-b",
|
|
202
|
-
children: [/* @__PURE__ */
|
|
202
|
+
children: [/* @__PURE__ */ F("div", {
|
|
203
203
|
className: "text-sm font-semibold",
|
|
204
|
-
children:
|
|
205
|
-
}), /* @__PURE__ */
|
|
204
|
+
children: x
|
|
205
|
+
}), /* @__PURE__ */ F("div", {
|
|
206
206
|
className: "text-[11px] text-muted-foreground",
|
|
207
207
|
children: t("list.viewSettingsHint", { defaultValue: "Grouping, color, density, and visible fields." })
|
|
208
208
|
})]
|
|
209
209
|
}),
|
|
210
|
-
i && o && /* @__PURE__ */
|
|
210
|
+
i && o && /* @__PURE__ */ F(Ve, {
|
|
211
211
|
title: t("list.group", { defaultValue: "Group" }),
|
|
212
212
|
badge: a?.fields?.length || 0,
|
|
213
213
|
onClear: a ? () => o(void 0) : void 0,
|
|
214
214
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
215
|
-
children: /* @__PURE__ */
|
|
215
|
+
children: /* @__PURE__ */ F(v, {
|
|
216
216
|
value: a,
|
|
217
217
|
fieldOptions: n.map((e) => ({
|
|
218
218
|
value: e.name,
|
|
@@ -227,15 +227,15 @@ function Ue(e) {
|
|
|
227
227
|
onChange: (e) => o(e)
|
|
228
228
|
})
|
|
229
229
|
}),
|
|
230
|
-
s && u && /* @__PURE__ */
|
|
230
|
+
s && u && /* @__PURE__ */ I(Ve, {
|
|
231
231
|
title: t("list.color", { defaultValue: "Row color" }),
|
|
232
232
|
onClear: c ? () => u(void 0) : void 0,
|
|
233
233
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
234
234
|
defaultOpen: !!c,
|
|
235
|
-
children: [/* @__PURE__ */
|
|
235
|
+
children: [/* @__PURE__ */ F("label", {
|
|
236
236
|
className: "block text-[11px] text-muted-foreground mb-1",
|
|
237
237
|
children: t("list.colorByField", { defaultValue: "Color by field" })
|
|
238
|
-
}), /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ I("select", {
|
|
239
239
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
240
240
|
value: c?.field || "",
|
|
241
241
|
onChange: (e) => {
|
|
@@ -246,47 +246,47 @@ function Ue(e) {
|
|
|
246
246
|
} : void 0);
|
|
247
247
|
},
|
|
248
248
|
"data-testid": "color-field-select",
|
|
249
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ F("option", {
|
|
250
250
|
value: "",
|
|
251
251
|
children: t("list.none", { defaultValue: "None" })
|
|
252
|
-
}), n.map((e) => /* @__PURE__ */
|
|
252
|
+
}), n.map((e) => /* @__PURE__ */ F("option", {
|
|
253
253
|
value: e.name,
|
|
254
254
|
children: e.label || e.name
|
|
255
255
|
}, e.name))]
|
|
256
256
|
})]
|
|
257
257
|
}),
|
|
258
|
-
d && f && /* @__PURE__ */
|
|
258
|
+
d && f && /* @__PURE__ */ F(Ve, {
|
|
259
259
|
title: t("grid.toolbar.densityMode", { defaultValue: "Density" }),
|
|
260
260
|
defaultOpen: f.mode !== "compact",
|
|
261
|
-
children: /* @__PURE__ */
|
|
261
|
+
children: /* @__PURE__ */ I("div", {
|
|
262
262
|
className: "flex items-center gap-2",
|
|
263
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ I(l, {
|
|
264
264
|
variant: "outline",
|
|
265
265
|
size: "sm",
|
|
266
266
|
className: "h-7 gap-1.5",
|
|
267
267
|
onClick: f.cycle,
|
|
268
268
|
"data-testid": "view-settings-density-cycle",
|
|
269
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ F(b, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ F("span", {
|
|
270
270
|
className: "text-xs",
|
|
271
271
|
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" })
|
|
272
272
|
})]
|
|
273
|
-
}), /* @__PURE__ */
|
|
273
|
+
}), /* @__PURE__ */ F("span", {
|
|
274
274
|
className: "text-[11px] text-muted-foreground",
|
|
275
275
|
children: t("grid.toolbar.densityCycleShortHint", { defaultValue: "Click to cycle" })
|
|
276
276
|
})]
|
|
277
277
|
})
|
|
278
278
|
}),
|
|
279
|
-
p && m && h && /* @__PURE__ */
|
|
279
|
+
p && m && h && /* @__PURE__ */ F(Ve, {
|
|
280
280
|
title: t("list.hideFieldsTitle", { defaultValue: "Hide fields" }),
|
|
281
281
|
badge: m.size,
|
|
282
282
|
onClear: m.size > 0 ? () => h(/* @__PURE__ */ new Set()) : void 0,
|
|
283
283
|
clearLabel: t("list.showAll", { defaultValue: "Show all" }),
|
|
284
284
|
defaultOpen: m.size > 0,
|
|
285
|
-
children: /* @__PURE__ */
|
|
285
|
+
children: /* @__PURE__ */ F("div", {
|
|
286
286
|
className: "max-h-48 overflow-y-auto space-y-0.5",
|
|
287
|
-
children: n.map((e) => /* @__PURE__ */
|
|
287
|
+
children: n.map((e) => /* @__PURE__ */ I("label", {
|
|
288
288
|
className: "flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
289
|
-
children: [/* @__PURE__ */
|
|
289
|
+
children: [/* @__PURE__ */ F("input", {
|
|
290
290
|
type: "checkbox",
|
|
291
291
|
checked: !m.has(e.name),
|
|
292
292
|
onChange: () => {
|
|
@@ -294,7 +294,7 @@ function Ue(e) {
|
|
|
294
294
|
t.has(e.name) ? t.delete(e.name) : t.add(e.name), h(t);
|
|
295
295
|
},
|
|
296
296
|
className: "rounded border-input"
|
|
297
|
-
}), /* @__PURE__ */
|
|
297
|
+
}), /* @__PURE__ */ F("span", {
|
|
298
298
|
className: "truncate",
|
|
299
299
|
children: e.label || e.name
|
|
300
300
|
})]
|
|
@@ -307,21 +307,21 @@ function Ue(e) {
|
|
|
307
307
|
}
|
|
308
308
|
//#endregion
|
|
309
309
|
//#region src/UserFilters.tsx
|
|
310
|
-
function
|
|
310
|
+
function B() {
|
|
311
311
|
try {
|
|
312
|
-
let { t: e } =
|
|
312
|
+
let { t: e } = Oe(), t = e("common.more");
|
|
313
313
|
return !t || t === "common.more" ? "More" : t;
|
|
314
314
|
} catch {
|
|
315
315
|
return "More";
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
var
|
|
318
|
+
var V = new Set([
|
|
319
319
|
"lookup",
|
|
320
320
|
"master_detail",
|
|
321
321
|
"user",
|
|
322
322
|
"owner"
|
|
323
323
|
]);
|
|
324
|
-
function
|
|
324
|
+
function Ue(e) {
|
|
325
325
|
switch (e) {
|
|
326
326
|
case void 0:
|
|
327
327
|
case "equals":
|
|
@@ -338,21 +338,21 @@ function We(e) {
|
|
|
338
338
|
default: return e;
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function We(e) {
|
|
342
342
|
return (e || []).filter((e) => e && (e.id || e.name)).map((e) => ({
|
|
343
343
|
id: e.id ?? e.name,
|
|
344
344
|
label: typeof e.label == "string" ? e.label : e.label?.toString?.() ?? e.id ?? e.name,
|
|
345
345
|
filters: Array.isArray(e.filters) ? e.filters : Array.isArray(e.filter) ? e.filter.filter((e) => e && typeof e.field == "string").map((e) => [
|
|
346
346
|
e.field,
|
|
347
|
-
|
|
347
|
+
Ue(e.operator),
|
|
348
348
|
e.value
|
|
349
349
|
]) : [],
|
|
350
350
|
default: e.default ?? e.isDefault
|
|
351
351
|
}));
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Ge({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a, initialSelections: o, onSelectionsChange: s }) {
|
|
354
354
|
switch (e.element) {
|
|
355
|
-
case "dropdown": return /* @__PURE__ */
|
|
355
|
+
case "dropdown": return /* @__PURE__ */ F(H, {
|
|
356
356
|
fields: e.fields || [],
|
|
357
357
|
objectDef: t,
|
|
358
358
|
data: n,
|
|
@@ -362,8 +362,8 @@ function Ke({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
362
362
|
initialSelections: o,
|
|
363
363
|
onSelectionsChange: s
|
|
364
364
|
});
|
|
365
|
-
case "tabs": return /* @__PURE__ */
|
|
366
|
-
tabs:
|
|
365
|
+
case "tabs": return /* @__PURE__ */ F(U, {
|
|
366
|
+
tabs: We(e.tabs || []),
|
|
367
367
|
showAllRecords: e.showAllRecords !== !1,
|
|
368
368
|
allowAddTab: e.allowAddTab,
|
|
369
369
|
onFilterChange: r,
|
|
@@ -374,7 +374,7 @@ function Ke({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
374
374
|
default: return null;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function Ke(e, t, n, r) {
|
|
378
378
|
return e.map((e) => {
|
|
379
379
|
let i = e.options ? [...e.options] : [], a = e.type, o, s, c;
|
|
380
380
|
if (t?.fields) {
|
|
@@ -411,15 +411,15 @@ function qe(e, t, n, r) {
|
|
|
411
411
|
};
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
|
-
function
|
|
415
|
-
let { fieldLabel: l, translateOptions: u } =
|
|
414
|
+
function H({ fields: e, objectDef: t, data: n, onFilterChange: i, maxVisible: a, className: o, initialSelections: s, onSelectionsChange: c }) {
|
|
415
|
+
let { fieldLabel: l, translateOptions: u } = ke(), d = B(), f = t?.name, [p, m] = r.useState(() => {
|
|
416
416
|
let t = {};
|
|
417
417
|
return e.forEach((e) => {
|
|
418
418
|
e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
|
|
419
419
|
let n = s?.[e.field];
|
|
420
420
|
n && n.length > 0 && (t[e.field] = n);
|
|
421
421
|
}), t;
|
|
422
|
-
}), h = r.useRef({}), g = r.useMemo(() =>
|
|
422
|
+
}), h = r.useRef({}), g = r.useMemo(() => Ke(e, t, n, {
|
|
423
423
|
objectName: f,
|
|
424
424
|
fieldLabel: l,
|
|
425
425
|
translateOptions: u
|
|
@@ -448,7 +448,7 @@ function V({ fields: e, objectDef: t, data: n, onFilterChange: i, maxVisible: a,
|
|
|
448
448
|
"in",
|
|
449
449
|
t
|
|
450
450
|
]));
|
|
451
|
-
}, [i]),
|
|
451
|
+
}, [i]), v = (e, t) => {
|
|
452
452
|
let n = {
|
|
453
453
|
...p,
|
|
454
454
|
[e]: t
|
|
@@ -467,37 +467,37 @@ function V({ fields: e, objectDef: t, data: n, onFilterChange: i, maxVisible: a,
|
|
|
467
467
|
}
|
|
468
468
|
n && (m(t), e = t), Object.values(e).some((e) => e.length > 0) && _(e);
|
|
469
469
|
}, []);
|
|
470
|
-
let
|
|
471
|
-
let t = p[e.field] || [], n = t.length > 0, r =
|
|
472
|
-
return /* @__PURE__ */
|
|
470
|
+
let y = a !== void 0 && a < g.length ? g.slice(0, a) : g, x = a !== void 0 && a < g.length ? g.slice(a) : [], ee = (e) => {
|
|
471
|
+
let t = p[e.field] || [], n = t.length > 0, r = V.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), i = r ? "w-72" : "w-56";
|
|
472
|
+
return /* @__PURE__ */ I(S, { children: [/* @__PURE__ */ F(w, {
|
|
473
473
|
asChild: !0,
|
|
474
|
-
children: /* @__PURE__ */
|
|
474
|
+
children: /* @__PURE__ */ I("button", {
|
|
475
475
|
"data-testid": `filter-badge-${e.field}`,
|
|
476
|
-
className:
|
|
476
|
+
className: T("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"),
|
|
477
477
|
children: [
|
|
478
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ F("span", {
|
|
479
479
|
className: "truncate max-w-[100px]",
|
|
480
480
|
children: e.label || e.field
|
|
481
481
|
}),
|
|
482
|
-
n && /* @__PURE__ */
|
|
482
|
+
n && /* @__PURE__ */ F("span", {
|
|
483
483
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
484
484
|
children: t.length
|
|
485
485
|
}),
|
|
486
|
-
n ? /* @__PURE__ */
|
|
486
|
+
n ? /* @__PURE__ */ F(we, {
|
|
487
487
|
className: "h-3 w-3 opacity-60 hover:opacity-100",
|
|
488
488
|
"data-testid": `filter-clear-${e.field}`,
|
|
489
489
|
onClick: (t) => {
|
|
490
|
-
t.stopPropagation(),
|
|
490
|
+
t.stopPropagation(), v(e.field, []);
|
|
491
491
|
}
|
|
492
|
-
}) : /* @__PURE__ */
|
|
492
|
+
}) : /* @__PURE__ */ F(k, { className: "h-3 w-3 opacity-60" })
|
|
493
493
|
]
|
|
494
494
|
})
|
|
495
|
-
}), /* @__PURE__ */
|
|
495
|
+
}), /* @__PURE__ */ F(C, {
|
|
496
496
|
align: "start",
|
|
497
|
-
className:
|
|
498
|
-
children: r ? /* @__PURE__ */
|
|
497
|
+
className: T(i, "p-2"),
|
|
498
|
+
children: r ? /* @__PURE__ */ F("div", {
|
|
499
499
|
"data-testid": `filter-lookup-${e.field}`,
|
|
500
|
-
children: /* @__PURE__ */
|
|
500
|
+
children: /* @__PURE__ */ F(b, {
|
|
501
501
|
field: {
|
|
502
502
|
value: e.field,
|
|
503
503
|
label: e.label || e.field,
|
|
@@ -510,36 +510,36 @@ function V({ fields: e, objectDef: t, data: n, onFilterChange: i, maxVisible: a,
|
|
|
510
510
|
multiple: !0,
|
|
511
511
|
onChange: (t) => {
|
|
512
512
|
let n = Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
|
|
513
|
-
|
|
513
|
+
v(e.field, n);
|
|
514
514
|
}
|
|
515
515
|
})
|
|
516
|
-
}) : /* @__PURE__ */
|
|
516
|
+
}) : /* @__PURE__ */ F("div", {
|
|
517
517
|
className: "max-h-60 overflow-y-auto space-y-0.5",
|
|
518
518
|
"data-testid": `filter-options-${e.field}`,
|
|
519
|
-
children: e.options.length === 0 ? /* @__PURE__ */
|
|
519
|
+
children: e.options.length === 0 ? /* @__PURE__ */ F("div", {
|
|
520
520
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
521
521
|
children: "No options"
|
|
522
|
-
}) : e.options.map((n) => /* @__PURE__ */
|
|
523
|
-
className:
|
|
522
|
+
}) : e.options.map((n) => /* @__PURE__ */ I("label", {
|
|
523
|
+
className: T("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"),
|
|
524
524
|
children: [
|
|
525
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ F("input", {
|
|
526
526
|
type: "checkbox",
|
|
527
527
|
checked: t.includes(n.value),
|
|
528
528
|
onChange: () => {
|
|
529
529
|
let r = t.includes(n.value) ? t.filter((e) => e !== n.value) : [...t, n.value];
|
|
530
|
-
|
|
530
|
+
v(e.field, r);
|
|
531
531
|
},
|
|
532
532
|
className: "rounded border-input"
|
|
533
533
|
}),
|
|
534
|
-
n.color && /* @__PURE__ */
|
|
534
|
+
n.color && /* @__PURE__ */ F("span", {
|
|
535
535
|
className: "h-2.5 w-2.5 rounded-full shrink-0",
|
|
536
536
|
style: { backgroundColor: n.color }
|
|
537
537
|
}),
|
|
538
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ F("span", {
|
|
539
539
|
className: "truncate flex-1",
|
|
540
540
|
children: n.label
|
|
541
541
|
}),
|
|
542
|
-
n.count !== void 0 && /* @__PURE__ */
|
|
542
|
+
n.count !== void 0 && /* @__PURE__ */ F("span", {
|
|
543
543
|
className: "text-xs text-muted-foreground",
|
|
544
544
|
children: n.count
|
|
545
545
|
})
|
|
@@ -548,39 +548,39 @@ function V({ fields: e, objectDef: t, data: n, onFilterChange: i, maxVisible: a,
|
|
|
548
548
|
})
|
|
549
549
|
})] }, e.field);
|
|
550
550
|
};
|
|
551
|
-
return /* @__PURE__ */
|
|
552
|
-
className:
|
|
551
|
+
return /* @__PURE__ */ F("div", {
|
|
552
|
+
className: T("flex items-center gap-0.5 overflow-x-auto", o),
|
|
553
553
|
"data-testid": "user-filters-dropdown",
|
|
554
|
-
children: g.length === 0 ? /* @__PURE__ */
|
|
554
|
+
children: g.length === 0 ? /* @__PURE__ */ F("span", {
|
|
555
555
|
className: "text-xs text-muted-foreground",
|
|
556
556
|
"data-testid": "user-filters-empty",
|
|
557
557
|
children: "No filter fields"
|
|
558
|
-
}) : /* @__PURE__ */
|
|
558
|
+
}) : /* @__PURE__ */ I(Ee, { children: [y.map(ee), x.length > 0 && /* @__PURE__ */ I(S, { children: [/* @__PURE__ */ F(w, {
|
|
559
559
|
asChild: !0,
|
|
560
|
-
children: /* @__PURE__ */
|
|
560
|
+
children: /* @__PURE__ */ I("button", {
|
|
561
561
|
"data-testid": "user-filters-more",
|
|
562
562
|
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",
|
|
563
563
|
children: [
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ F("span", { children: d }),
|
|
565
|
+
/* @__PURE__ */ F("span", {
|
|
566
566
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
567
|
-
children:
|
|
567
|
+
children: x.length
|
|
568
568
|
}),
|
|
569
|
-
/* @__PURE__ */
|
|
569
|
+
/* @__PURE__ */ F(k, { className: "h-3 w-3 opacity-60" })
|
|
570
570
|
]
|
|
571
571
|
})
|
|
572
|
-
}), /* @__PURE__ */
|
|
572
|
+
}), /* @__PURE__ */ F(C, {
|
|
573
573
|
align: "start",
|
|
574
574
|
className: "w-64 p-2",
|
|
575
575
|
"data-testid": "user-filters-more-content",
|
|
576
|
-
children: /* @__PURE__ */
|
|
576
|
+
children: /* @__PURE__ */ F("div", {
|
|
577
577
|
className: "space-y-1",
|
|
578
|
-
children:
|
|
578
|
+
children: x.map(ee)
|
|
579
579
|
})
|
|
580
580
|
})] })] })
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function U({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: i, className: a, initialTab: o, onSelectionsChange: s }) {
|
|
584
584
|
let [c, l] = r.useState(() => o && (o === "__all__" || e.some((e) => e.id === o)) ? o : e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), u = r.useCallback((t) => {
|
|
585
585
|
l(t), i(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []), s?.({ _tab: [t] });
|
|
586
586
|
}, [
|
|
@@ -600,28 +600,28 @@ function H({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: i, clas
|
|
|
600
600
|
let t = e.find((e) => e.id === c);
|
|
601
601
|
t && i(t.filters || []);
|
|
602
602
|
}
|
|
603
|
-
}, []), /* @__PURE__ */
|
|
604
|
-
className:
|
|
603
|
+
}, []), /* @__PURE__ */ I("div", {
|
|
604
|
+
className: T("flex items-center gap-0.5 overflow-x-auto", a),
|
|
605
605
|
"data-testid": "user-filters-tabs",
|
|
606
606
|
children: [d.map((e) => {
|
|
607
607
|
let t = e.id ?? e.name ?? "";
|
|
608
|
-
return /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ F("button", {
|
|
609
609
|
"data-testid": `filter-tab-${t}`,
|
|
610
610
|
onClick: () => u(t),
|
|
611
|
-
className:
|
|
611
|
+
className: T("inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0", c === t ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted"),
|
|
612
612
|
children: e.label
|
|
613
613
|
}, t);
|
|
614
|
-
}), n && /* @__PURE__ */
|
|
614
|
+
}), n && /* @__PURE__ */ F("button", {
|
|
615
615
|
className: "inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",
|
|
616
616
|
"data-testid": "filter-tab-add",
|
|
617
617
|
title: "Add filter tab",
|
|
618
|
-
children: /* @__PURE__ */
|
|
618
|
+
children: /* @__PURE__ */ F(pe, { className: "h-3.5 w-3.5" })
|
|
619
619
|
})]
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
//#endregion
|
|
623
623
|
//#region src/ListView.tsx
|
|
624
|
-
function
|
|
624
|
+
function W(e) {
|
|
625
625
|
switch (e) {
|
|
626
626
|
case "equals":
|
|
627
627
|
case "eq": return "=";
|
|
@@ -649,10 +649,10 @@ function U(e) {
|
|
|
649
649
|
default: return e;
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function qe(e) {
|
|
653
653
|
if (!Array.isArray(e) || e.length < 3) return e;
|
|
654
654
|
let [t, n, r] = e;
|
|
655
|
-
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ?
|
|
655
|
+
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ? qe(e) : e)] : n === "in" && Array.isArray(r) ? r.length === 0 ? [] : r.length === 1 ? [
|
|
656
656
|
t,
|
|
657
657
|
"=",
|
|
658
658
|
r[0]
|
|
@@ -670,15 +670,15 @@ function Je(e) {
|
|
|
670
670
|
e
|
|
671
671
|
])] : e;
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function Je(e) {
|
|
674
674
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
675
675
|
}
|
|
676
|
-
function
|
|
677
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ?
|
|
676
|
+
function Ye(e) {
|
|
677
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? qe(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function Xe(e) {
|
|
680
680
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
681
|
-
let t =
|
|
681
|
+
let t = Ye(e.conditions.map((e) => e.operator === "isEmpty" ? [
|
|
682
682
|
e.field,
|
|
683
683
|
"=",
|
|
684
684
|
null
|
|
@@ -688,12 +688,12 @@ function Ze(e) {
|
|
|
688
688
|
null
|
|
689
689
|
] : [
|
|
690
690
|
e.field,
|
|
691
|
-
|
|
691
|
+
W(e.operator),
|
|
692
692
|
e.value
|
|
693
693
|
]));
|
|
694
694
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function Ze(e, t) {
|
|
697
697
|
if (!t || t.length === 0) return {};
|
|
698
698
|
for (let r of t) {
|
|
699
699
|
let t = !1, i = ("condition" in r ? r.condition : void 0) || ("expression" in r ? r.expression : void 0) || void 0;
|
|
@@ -728,7 +728,7 @@ function Qe(e, t) {
|
|
|
728
728
|
}
|
|
729
729
|
return {};
|
|
730
730
|
}
|
|
731
|
-
var
|
|
731
|
+
var Qe = {
|
|
732
732
|
"list.recordCount": "{{count}} records",
|
|
733
733
|
"list.recordCountOne": "{{count}} record",
|
|
734
734
|
"list.noItems": "No items found",
|
|
@@ -775,67 +775,67 @@ var $e = {
|
|
|
775
775
|
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
776
776
|
"list.viewSettings": "View settings",
|
|
777
777
|
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
778
|
-
},
|
|
779
|
-
let n =
|
|
778
|
+
}, $e = (e, t, n) => n, G = (e, t) => {
|
|
779
|
+
let n = Qe[e] || e;
|
|
780
780
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
781
781
|
return n;
|
|
782
782
|
};
|
|
783
|
-
function
|
|
783
|
+
function et() {
|
|
784
784
|
try {
|
|
785
|
-
let e =
|
|
786
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t:
|
|
785
|
+
let e = Oe();
|
|
786
|
+
return e.t("list.recordCount") === "list.recordCount" ? { t: G } : { t: e.t };
|
|
787
787
|
} catch {
|
|
788
|
-
return { t:
|
|
788
|
+
return { t: G };
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function tt() {
|
|
792
792
|
try {
|
|
793
|
-
let { fieldLabel: e, actionLabel: t } =
|
|
793
|
+
let { fieldLabel: e, actionLabel: t } = De();
|
|
794
794
|
return {
|
|
795
795
|
fieldLabel: e,
|
|
796
796
|
actionLabel: t
|
|
797
797
|
};
|
|
798
798
|
} catch {
|
|
799
799
|
return {
|
|
800
|
-
fieldLabel:
|
|
800
|
+
fieldLabel: $e,
|
|
801
801
|
actionLabel: void 0
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
var
|
|
806
|
-
let
|
|
805
|
+
var nt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChange: a, onSortChange: o, onSearchChange: s, onHiddenFieldsChange: c, onColumnStateChange: u, onRowClick: d, showViewSwitcher: p, userFilterSelections: m, onUserFilterSelectionsChange: h, ...g }, b) => {
|
|
806
|
+
let ne = p ?? e?.showViewSwitcher ?? !1, { t: E } = et(), { fieldLabel: D, actionLabel: O } = tt(), { translateOptions: k } = ke(), A = r.useMemo(() => e.viewType && e.viewType !== "list" ? e : {
|
|
807
807
|
...e,
|
|
808
808
|
viewType: "grid"
|
|
809
|
-
}, [e]),
|
|
810
|
-
let t =
|
|
811
|
-
return
|
|
812
|
-
}, [
|
|
813
|
-
let e =
|
|
809
|
+
}, [e]), j = r.useCallback((e, t) => A.objectName ? D(A.objectName, e, t) : t, [A.objectName, D]), ce = r.useCallback((e) => {
|
|
810
|
+
let t = Je(e);
|
|
811
|
+
return A.objectName && typeof O == "function" ? O(A.objectName, e, t) : t;
|
|
812
|
+
}, [A.objectName, O]), M = r.useMemo(() => {
|
|
813
|
+
let e = A.userActions, t = A.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
|
|
814
814
|
return {
|
|
815
|
-
showSearch: e?.search === void 0 ?
|
|
816
|
-
showSort: e?.sort === void 0 ?
|
|
817
|
-
showFilters: e?.filter === void 0 ?
|
|
818
|
-
showDensity: e?.rowHeight === void 0 ?
|
|
819
|
-
showHideFields:
|
|
820
|
-
showGroup:
|
|
821
|
-
showColor:
|
|
822
|
-
compactToolbar:
|
|
815
|
+
showSearch: e?.search === void 0 ? A.showSearch !== !1 : e.search,
|
|
816
|
+
showSort: e?.sort === void 0 ? A.showSort !== !1 : e.sort,
|
|
817
|
+
showFilters: e?.filter === void 0 ? A.showFilters !== !1 : e.filter,
|
|
818
|
+
showDensity: e?.rowHeight === void 0 ? A.showDensity !== !1 : e.rowHeight,
|
|
819
|
+
showHideFields: A.showHideFields === !0,
|
|
820
|
+
showGroup: A.showGroup !== !1,
|
|
821
|
+
showColor: A.showColor === !0,
|
|
822
|
+
compactToolbar: A.compactToolbar === !0,
|
|
823
823
|
showAddRecord: t,
|
|
824
|
-
addRecordPosition:
|
|
824
|
+
addRecordPosition: A.addRecord?.position === "bottom" ? "bottom" : "top"
|
|
825
825
|
};
|
|
826
826
|
}, [
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
]), [
|
|
827
|
+
A.userActions,
|
|
828
|
+
A.showSearch,
|
|
829
|
+
A.showSort,
|
|
830
|
+
A.showFilters,
|
|
831
|
+
A.showDensity,
|
|
832
|
+
A.showHideFields,
|
|
833
|
+
A.showGroup,
|
|
834
|
+
A.showColor,
|
|
835
|
+
A.compactToolbar,
|
|
836
|
+
A.addRecord,
|
|
837
|
+
A.userActions?.addRecordForm
|
|
838
|
+
]), [N, de] = r.useState(A.viewType), [P, be] = r.useState(""), [De, Oe] = r.useState(!1), [je, Me] = r.useState(!1), [L, Le] = r.useState(() => A.sort && A.sort.length > 0 ? A.sort.map((e) => {
|
|
839
839
|
if (typeof e == "string") {
|
|
840
840
|
let t = e.trim().split(/\s+/);
|
|
841
841
|
return {
|
|
@@ -849,9 +849,9 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
849
849
|
field: e.field,
|
|
850
850
|
order: e.order || "asc"
|
|
851
851
|
};
|
|
852
|
-
}) : []),
|
|
852
|
+
}) : []), Re = r.useMemo(() => JSON.stringify(A.sort || []), [A.sort]);
|
|
853
853
|
r.useEffect(() => {
|
|
854
|
-
|
|
854
|
+
A.sort && A.sort.length > 0 ? Le(A.sort.map((e) => {
|
|
855
855
|
if (typeof e == "string") {
|
|
856
856
|
let t = e.trim().split(/\s+/);
|
|
857
857
|
return {
|
|
@@ -865,25 +865,25 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
865
865
|
field: e.field,
|
|
866
866
|
order: e.order || "asc"
|
|
867
867
|
};
|
|
868
|
-
})) :
|
|
869
|
-
}, [
|
|
870
|
-
let [
|
|
868
|
+
})) : Le([]);
|
|
869
|
+
}, [Re]);
|
|
870
|
+
let [ze, R] = r.useState(!1), [z, Ve] = r.useState({
|
|
871
871
|
id: "root",
|
|
872
872
|
logic: "and",
|
|
873
873
|
conditions: []
|
|
874
|
-
}),
|
|
875
|
-
r.useImperativeHandle(
|
|
876
|
-
if (!(!
|
|
877
|
-
e.resource ===
|
|
874
|
+
}), B = g.dataSource, [V, Ue] = r.useState([]), [We, Ke] = r.useState(null), [H, U] = r.useState(() => !(Array.isArray(A.data) || A.data && typeof A.data == "object" && A.data.provider === "value" && Array.isArray(A.data.items))), [W, qe] = r.useState(null), [Ze, Qe] = r.useState(!1), [$e, G] = r.useState(0), [nt, rt] = r.useState(!1);
|
|
875
|
+
r.useImperativeHandle(b, () => ({ refresh: () => G((e) => e + 1) }), []), r.useEffect(() => {
|
|
876
|
+
if (!(!B?.onMutation || !A.objectName || A.refreshTrigger)) return B.onMutation((e) => {
|
|
877
|
+
e.resource === A.objectName && G((e) => e + 1);
|
|
878
878
|
});
|
|
879
879
|
}, [
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
880
|
+
B,
|
|
881
|
+
A.objectName,
|
|
882
|
+
A.refreshTrigger
|
|
883
883
|
]);
|
|
884
|
-
let [
|
|
885
|
-
if (
|
|
886
|
-
let e = typeof
|
|
884
|
+
let [it, at] = r.useState(void 0), K = it ?? A.pagination?.pageSize ?? 100, [ot, st] = r.useState(1), [ct, lt] = r.useState(null), q = r.useMemo(() => {
|
|
885
|
+
if (A.grouping?.fields?.length) return A.grouping;
|
|
886
|
+
let e = typeof A.groupBy == "string" ? A.groupBy.trim() : "", t = typeof A.groupBy2 == "string" ? A.groupBy2.trim() : "", n = [];
|
|
887
887
|
return e && n.push({
|
|
888
888
|
field: e,
|
|
889
889
|
order: "asc",
|
|
@@ -894,25 +894,25 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
894
894
|
collapsed: !1
|
|
895
895
|
}), n.length > 0 ? { fields: n } : void 0;
|
|
896
896
|
}, [
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
]), [
|
|
897
|
+
A.grouping,
|
|
898
|
+
A.groupBy,
|
|
899
|
+
A.groupBy2
|
|
900
|
+
]), [J, ut] = r.useState(q), [dt, ft] = r.useState(!1), pt = r.useRef(q);
|
|
901
901
|
r.useEffect(() => {
|
|
902
|
-
|
|
903
|
-
}, [
|
|
904
|
-
let [
|
|
905
|
-
let e =
|
|
902
|
+
pt.current !== q && (pt.current = q, ut(q));
|
|
903
|
+
}, [q]);
|
|
904
|
+
let [Y, mt] = r.useState(A.rowColor), [ht, gt] = r.useState(!1), [_t, vt] = r.useState([]), yt = r.useRef(0), [bt, xt] = r.useState([]), St = r.useMemo(() => {
|
|
905
|
+
let e = A.userFilters;
|
|
906
906
|
if (!e) return;
|
|
907
|
-
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !
|
|
907
|
+
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !W?.fields) return e;
|
|
908
908
|
let t = new Set([
|
|
909
909
|
"select",
|
|
910
910
|
"multi-select",
|
|
911
911
|
"boolean"
|
|
912
|
-
]), n = [], r = Array.isArray(
|
|
912
|
+
]), n = [], r = Array.isArray(W.fields) ? W.fields.map((e) => [e.name, e]) : Object.entries(W.fields);
|
|
913
913
|
for (let [e, i] of r) (t.has(i.type) || i.options && !i.type) && n.push({
|
|
914
914
|
field: e,
|
|
915
|
-
label:
|
|
915
|
+
label: j(e, i.label || e),
|
|
916
916
|
type: i.type === "boolean" ? "boolean" : i.type === "multi-select" ? "multi-select" : "select"
|
|
917
917
|
});
|
|
918
918
|
return n.length === 0 ? e : {
|
|
@@ -920,69 +920,69 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
920
920
|
fields: n
|
|
921
921
|
};
|
|
922
922
|
}, [
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
]), [
|
|
923
|
+
A.userFilters,
|
|
924
|
+
W,
|
|
925
|
+
j
|
|
926
|
+
]), [X, Ct] = r.useState(() => new Set(A.hiddenFields || [])), wt = r.useMemo(() => JSON.stringify(A.hiddenFields || []), [A.hiddenFields]);
|
|
927
927
|
r.useEffect(() => {
|
|
928
|
-
|
|
929
|
-
}, [
|
|
930
|
-
let
|
|
931
|
-
|
|
932
|
-
}, [c]), [
|
|
933
|
-
if (
|
|
934
|
-
}, [
|
|
928
|
+
Ct(new Set(A.hiddenFields || []));
|
|
929
|
+
}, [wt]);
|
|
930
|
+
let Tt = r.useCallback((e) => {
|
|
931
|
+
Ct(e), c?.(Array.from(e));
|
|
932
|
+
}, [c]), [Et, Dt] = r.useState(!1), [Ot, kt] = r.useState(!1), At = r.useMemo(() => {
|
|
933
|
+
if (A.exportOptions) return Array.isArray(A.exportOptions) ? { formats: A.exportOptions } : A.exportOptions;
|
|
934
|
+
}, [A.exportOptions]), Z = Ne(r.useMemo(() => A.densityMode ? A.densityMode : A.rowHeight ? {
|
|
935
935
|
compact: "compact",
|
|
936
936
|
short: "compact",
|
|
937
937
|
medium: "comfortable",
|
|
938
938
|
tall: "spacious",
|
|
939
939
|
extra_tall: "spacious"
|
|
940
|
-
}[
|
|
941
|
-
if (typeof window > "u") return
|
|
940
|
+
}[A.rowHeight] || "comfortable" : "compact", [A.densityMode, A.rowHeight]), { onChange: A.onDensityChange }), jt = r.useMemo(() => `objectui:gallery:density:${A.objectName ?? "default"}`, [A.objectName]), [Q, Mt] = r.useState(() => {
|
|
941
|
+
if (typeof window > "u") return A.gallery?.cardSize ?? "medium";
|
|
942
942
|
try {
|
|
943
|
-
let e = window.localStorage.getItem(
|
|
943
|
+
let e = window.localStorage.getItem(jt);
|
|
944
944
|
if (e === "small" || e === "medium" || e === "large") return e;
|
|
945
945
|
} catch {}
|
|
946
|
-
return
|
|
947
|
-
}),
|
|
948
|
-
|
|
946
|
+
return A.gallery?.cardSize ?? "medium";
|
|
947
|
+
}), Nt = r.useCallback(() => {
|
|
948
|
+
Mt((e) => {
|
|
949
949
|
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
950
950
|
try {
|
|
951
|
-
window.localStorage.setItem(
|
|
951
|
+
window.localStorage.setItem(jt, t);
|
|
952
952
|
} catch {}
|
|
953
953
|
return t;
|
|
954
954
|
});
|
|
955
|
-
}, [
|
|
955
|
+
}, [jt]), { ref: Pt, isRefreshing: Ft, pullDistance: It } = Fe({
|
|
956
956
|
onRefresh: r.useCallback(async () => {
|
|
957
|
-
|
|
957
|
+
G((e) => e + 1);
|
|
958
958
|
}, []),
|
|
959
|
-
enabled: !!
|
|
960
|
-
}),
|
|
959
|
+
enabled: !!B && !!A.objectName
|
|
960
|
+
}), Lt = r.useMemo(() => A.id ? `listview-${A.objectName}-${A.id}-view` : `listview-${A.objectName}-view`, [A.objectName, A.id]);
|
|
961
961
|
r.useEffect(() => {
|
|
962
962
|
let e = !0;
|
|
963
|
-
return
|
|
964
|
-
if (!
|
|
965
|
-
|
|
963
|
+
return Qe(!1), qe(null), (async () => {
|
|
964
|
+
if (!B || !A.objectName) {
|
|
965
|
+
Qe(!0);
|
|
966
966
|
return;
|
|
967
967
|
}
|
|
968
|
-
if (typeof
|
|
969
|
-
|
|
968
|
+
if (typeof B.getObjectSchema != "function") {
|
|
969
|
+
Qe(!0);
|
|
970
970
|
return;
|
|
971
971
|
}
|
|
972
972
|
try {
|
|
973
|
-
let t = await
|
|
974
|
-
e &&
|
|
973
|
+
let t = await B.getObjectSchema(A.objectName);
|
|
974
|
+
e && qe(t);
|
|
975
975
|
} catch (e) {
|
|
976
976
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
977
977
|
} finally {
|
|
978
|
-
e &&
|
|
978
|
+
e && Qe(!0);
|
|
979
979
|
}
|
|
980
980
|
})(), () => {
|
|
981
981
|
e = !1;
|
|
982
982
|
};
|
|
983
|
-
}, [
|
|
984
|
-
let
|
|
985
|
-
let e = Array.isArray(
|
|
983
|
+
}, [A.objectName, B]);
|
|
984
|
+
let Rt = r.useMemo(() => {
|
|
985
|
+
let e = Array.isArray(A.fields) ? A.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], n = new Set(e), r = (e) => {
|
|
986
986
|
if (!e) return;
|
|
987
987
|
let t = [
|
|
988
988
|
e.groupField,
|
|
@@ -1006,66 +1006,66 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1006
1006
|
];
|
|
1007
1007
|
for (let e of t) typeof e == "string" && e && n.add(e);
|
|
1008
1008
|
};
|
|
1009
|
-
r(
|
|
1009
|
+
r(A.kanban), r(A.options?.kanban), r(A.calendar), r(A.options?.calendar), r(A.gallery), r(A.options?.gallery), r(A.timeline), r(A.options?.timeline), r(A.gantt), r(A.options?.gantt);
|
|
1010
1010
|
let i = n.size > 0 ? Array.from(n) : void 0;
|
|
1011
|
-
return t(
|
|
1011
|
+
return t(W?.fields, i);
|
|
1012
1012
|
}, [
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
]),
|
|
1013
|
+
W?.fields,
|
|
1014
|
+
A.fields,
|
|
1015
|
+
A.kanban,
|
|
1016
|
+
A.calendar,
|
|
1017
|
+
A.gallery,
|
|
1018
|
+
A.timeline,
|
|
1019
|
+
A.gantt,
|
|
1020
|
+
A.options
|
|
1021
|
+
]), zt = Ie();
|
|
1022
1022
|
r.useEffect(() => {
|
|
1023
|
-
let e = !0, t = ++
|
|
1024
|
-
if (
|
|
1025
|
-
let e =
|
|
1023
|
+
let e = !0, t = ++yt.current;
|
|
1024
|
+
if (A.data && typeof A.data == "object" && !Array.isArray(A.data)) {
|
|
1025
|
+
let e = A.data;
|
|
1026
1026
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
1027
1027
|
let t = e.items;
|
|
1028
|
-
if (
|
|
1029
|
-
let e =
|
|
1028
|
+
if (P) {
|
|
1029
|
+
let e = P.toLowerCase();
|
|
1030
1030
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
1031
1031
|
}
|
|
1032
|
-
|
|
1032
|
+
Ue(t), U(!1), rt(!1);
|
|
1033
1033
|
return;
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
if (Array.isArray(
|
|
1037
|
-
let e =
|
|
1038
|
-
if (
|
|
1039
|
-
let t =
|
|
1036
|
+
if (Array.isArray(A.data)) {
|
|
1037
|
+
let e = A.data;
|
|
1038
|
+
if (P) {
|
|
1039
|
+
let t = P.toLowerCase();
|
|
1040
1040
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
1041
1041
|
}
|
|
1042
|
-
|
|
1042
|
+
Ue(e), U(!1), rt(!1);
|
|
1043
1043
|
return;
|
|
1044
1044
|
}
|
|
1045
|
-
return
|
|
1046
|
-
if (!
|
|
1047
|
-
|
|
1045
|
+
return Ze ? ((async () => {
|
|
1046
|
+
if (!B || !A.objectName) {
|
|
1047
|
+
U(!1);
|
|
1048
1048
|
return;
|
|
1049
1049
|
}
|
|
1050
|
-
|
|
1050
|
+
U(!0), Ke(null);
|
|
1051
1051
|
try {
|
|
1052
|
-
let n = [], r =
|
|
1052
|
+
let n = [], r = A.filters || [], i = Xe(z), a = Ye(bt), o = [
|
|
1053
1053
|
...r.length > 0 ? [r] : [],
|
|
1054
1054
|
...i.length > 0 ? [i] : [],
|
|
1055
1055
|
...a
|
|
1056
1056
|
].filter((e) => Array.isArray(e) && e.length > 0);
|
|
1057
1057
|
o.length > 1 ? n = ["and", ...o] : o.length === 1 && (n = o[0]);
|
|
1058
|
-
let s =
|
|
1058
|
+
let s = L.length > 0 ? L.filter((e) => e.field).map((e) => ({
|
|
1059
1059
|
field: e.field,
|
|
1060
1060
|
order: e.order
|
|
1061
1061
|
})) : void 0, c = (() => {
|
|
1062
|
-
let e = Array.isArray(
|
|
1062
|
+
let e = Array.isArray(A.fields) ? A.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], t = zt?.isLoaded && A.objectName ? e.filter((e) => zt.checkField(A.objectName, e, "read")) : e;
|
|
1063
1063
|
if (t.length === 0) return;
|
|
1064
1064
|
let n = new Set(["id"]);
|
|
1065
1065
|
for (let e of t) n.add(e);
|
|
1066
|
-
for (let e of
|
|
1066
|
+
for (let e of Rt) n.add(e);
|
|
1067
1067
|
let r = (() => {
|
|
1068
|
-
let e =
|
|
1068
|
+
let e = W?.fields;
|
|
1069
1069
|
if (!e) return null;
|
|
1070
1070
|
let t = Array.isArray(e) ? e.map((e) => e?.name).filter((e) => typeof e == "string") : Object.keys(e), n = new Set(t);
|
|
1071
1071
|
return n.add("id"), n.add("created_at"), n.add("updated_at"), n;
|
|
@@ -1095,54 +1095,74 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1095
1095
|
];
|
|
1096
1096
|
for (let e of t) i(e);
|
|
1097
1097
|
};
|
|
1098
|
-
a(
|
|
1098
|
+
a(A.kanban), a(A.options?.kanban), a(A.calendar), a(A.options?.calendar), a(A.gallery), a(A.options?.gallery), a(A.timeline), a(A.options?.timeline);
|
|
1099
1099
|
{
|
|
1100
|
-
let e =
|
|
1100
|
+
let e = A.timeline ?? A.options?.timeline;
|
|
1101
1101
|
e && !Array.isArray(e.metaFields) && (i("status"), i("priority"));
|
|
1102
1102
|
}
|
|
1103
|
-
return a(
|
|
1104
|
-
})(), l = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, u = await
|
|
1103
|
+
return a(A.gantt), a(A.options?.gantt), Array.from(n);
|
|
1104
|
+
})(), l = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, u = N === "grid" && !J?.fields?.length, d = u ? (ot - 1) * K : 0, f = await B.find(A.objectName, {
|
|
1105
1105
|
...l ? { $filter: n } : {},
|
|
1106
1106
|
$orderby: s,
|
|
1107
|
-
$top:
|
|
1107
|
+
$top: K,
|
|
1108
|
+
...d > 0 ? { $skip: d } : {},
|
|
1108
1109
|
...c ? { $select: c } : {},
|
|
1109
|
-
...
|
|
1110
|
-
...
|
|
1111
|
-
$search:
|
|
1112
|
-
...
|
|
1110
|
+
...Rt.length > 0 ? { $expand: Rt } : {},
|
|
1111
|
+
...P ? {
|
|
1112
|
+
$search: P,
|
|
1113
|
+
...A.searchableFields && A.searchableFields.length > 0 ? { $searchFields: A.searchableFields } : {}
|
|
1113
1114
|
} : {}
|
|
1114
1115
|
});
|
|
1115
|
-
if (!e || t !==
|
|
1116
|
-
let
|
|
1117
|
-
Array.isArray(
|
|
1116
|
+
if (!e || t !== yt.current) return;
|
|
1117
|
+
let p = [];
|
|
1118
|
+
Array.isArray(f) ? p = f : f && typeof f == "object" && (Array.isArray(f.data) ? p = f.data : Array.isArray(f.records) ? p = f.records : Array.isArray(f.value) && (p = f.value)), Ue(p);
|
|
1119
|
+
let m = f && typeof f == "object" ? f.total ?? f.count : void 0, h = typeof m == "number" ? m : null;
|
|
1120
|
+
lt(u ? h : null), rt(!(u && h != null) && p.length >= K);
|
|
1118
1121
|
} catch (e) {
|
|
1119
|
-
t ===
|
|
1122
|
+
t === yt.current && (console.error("ListView data fetch error:", e), Ue([]), Ke(e?.message ? String(e.message) : String(e ?? "Unknown error")));
|
|
1120
1123
|
} finally {
|
|
1121
|
-
e && t ===
|
|
1124
|
+
e && t === yt.current && U(!1);
|
|
1122
1125
|
}
|
|
1123
1126
|
})(), () => {
|
|
1124
1127
|
e = !1;
|
|
1125
1128
|
}) : void 0;
|
|
1126
1129
|
}, [
|
|
1127
|
-
|
|
1128
|
-
|
|
1130
|
+
A.objectName,
|
|
1131
|
+
A.data,
|
|
1132
|
+
B,
|
|
1133
|
+
A.filters,
|
|
1134
|
+
K,
|
|
1135
|
+
L,
|
|
1129
1136
|
z,
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1137
|
+
bt,
|
|
1138
|
+
$e,
|
|
1139
|
+
P,
|
|
1140
|
+
A.searchableFields,
|
|
1141
|
+
Rt,
|
|
1142
|
+
Ze,
|
|
1143
|
+
A.refreshTrigger,
|
|
1144
|
+
zt,
|
|
1145
|
+
ot,
|
|
1136
1146
|
N,
|
|
1137
|
-
|
|
1138
|
-
Ft,
|
|
1139
|
-
Qe,
|
|
1140
|
-
k.refreshTrigger,
|
|
1141
|
-
Q
|
|
1147
|
+
J
|
|
1142
1148
|
]);
|
|
1143
|
-
let
|
|
1149
|
+
let Bt = JSON.stringify([
|
|
1150
|
+
A.objectName,
|
|
1151
|
+
A.filters,
|
|
1152
|
+
K,
|
|
1153
|
+
L,
|
|
1154
|
+
z,
|
|
1155
|
+
bt,
|
|
1156
|
+
P,
|
|
1157
|
+
N,
|
|
1158
|
+
J
|
|
1159
|
+
]), Vt = r.useRef(Bt);
|
|
1160
|
+
r.useEffect(() => {
|
|
1161
|
+
Vt.current !== Bt && (Vt.current = Bt, st(1));
|
|
1162
|
+
}, [Bt]);
|
|
1163
|
+
let Ht = r.useMemo(() => {
|
|
1144
1164
|
let e = ["grid"];
|
|
1145
|
-
(
|
|
1165
|
+
(A.kanban?.groupByField || A.kanban?.groupField || A.options?.kanban?.groupField) && e.push("kanban"), (A.gallery?.coverField || A.gallery?.imageField || A.options?.gallery?.imageField) && e.push("gallery"), (A.calendar?.startDateField || A.options?.calendar?.startDateField) && e.push("calendar"), (A.timeline?.startDateField || A.options?.timeline?.startDateField || A.options?.timeline?.dateField || A.options?.calendar?.startDateField) && e.push("timeline"), (A.gantt?.startDateField || A.options?.gantt?.startDateField) && e.push("gantt"), (A.options?.map?.locationField || A.options?.map?.latitudeField && A.options?.map?.longitudeField) && e.push("map"), (A.tree?.parentField || A.options?.tree?.parentField || A.viewType === "tree") && e.push("tree"), A.viewType && !e.includes(A.viewType) && [
|
|
1146
1166
|
"grid",
|
|
1147
1167
|
"kanban",
|
|
1148
1168
|
"calendar",
|
|
@@ -1152,52 +1172,52 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1152
1172
|
"gallery",
|
|
1153
1173
|
"chart",
|
|
1154
1174
|
"tree"
|
|
1155
|
-
].includes(
|
|
1156
|
-
let t =
|
|
1175
|
+
].includes(A.viewType) && e.push(A.viewType);
|
|
1176
|
+
let t = A.appearance?.allowedVisualizations;
|
|
1157
1177
|
if (Array.isArray(t) && t.length > 0) {
|
|
1158
1178
|
let n = t.filter((t) => e.includes(t));
|
|
1159
1179
|
return n.length > 0 ? n : ["grid"];
|
|
1160
1180
|
}
|
|
1161
1181
|
return e;
|
|
1162
1182
|
}, [
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1183
|
+
A.options,
|
|
1184
|
+
A.viewType,
|
|
1185
|
+
A.kanban,
|
|
1186
|
+
A.calendar,
|
|
1187
|
+
A.gantt,
|
|
1188
|
+
A.gallery,
|
|
1189
|
+
A.timeline,
|
|
1190
|
+
A.tree,
|
|
1191
|
+
A.appearance?.allowedVisualizations
|
|
1172
1192
|
]);
|
|
1173
1193
|
r.useEffect(() => {
|
|
1174
|
-
|
|
1175
|
-
}, [
|
|
1176
|
-
let
|
|
1177
|
-
|
|
1194
|
+
A.viewType && de(A.viewType);
|
|
1195
|
+
}, [A.viewType]);
|
|
1196
|
+
let Ut = r.useCallback((e) => {
|
|
1197
|
+
de(e);
|
|
1178
1198
|
try {
|
|
1179
|
-
localStorage.setItem(
|
|
1199
|
+
localStorage.setItem(Lt, e);
|
|
1180
1200
|
} catch (e) {
|
|
1181
1201
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
1182
1202
|
}
|
|
1183
1203
|
i?.(e);
|
|
1184
|
-
}, [
|
|
1185
|
-
|
|
1186
|
-
}, [s]),
|
|
1187
|
-
navigation:
|
|
1188
|
-
objectName:
|
|
1189
|
-
onNavigate:
|
|
1204
|
+
}, [Lt, i]), Wt = r.useCallback((e) => {
|
|
1205
|
+
be(e), s?.(e);
|
|
1206
|
+
}, [s]), Gt = Pe({
|
|
1207
|
+
navigation: A.navigation,
|
|
1208
|
+
objectName: A.objectName,
|
|
1209
|
+
onNavigate: A.onNavigate,
|
|
1190
1210
|
onRowClick: d
|
|
1191
1211
|
}), $ = r.useMemo(() => {
|
|
1192
|
-
let e =
|
|
1193
|
-
if (Array.isArray(e) || (e = []),
|
|
1212
|
+
let e = A.fields || [];
|
|
1213
|
+
if (Array.isArray(e) || (e = []), zt?.isLoaded && A.objectName && (e = e.filter((e) => {
|
|
1194
1214
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1195
|
-
return t ?
|
|
1196
|
-
})),
|
|
1215
|
+
return t ? zt.checkField(A.objectName, t, "read") : !0;
|
|
1216
|
+
})), X.size > 0 && (e = e.filter((e) => {
|
|
1197
1217
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1198
|
-
return t != null && !
|
|
1199
|
-
})),
|
|
1200
|
-
let t = new Map(
|
|
1218
|
+
return t != null && !X.has(t);
|
|
1219
|
+
})), A.fieldOrder && A.fieldOrder.length > 0) {
|
|
1220
|
+
let t = new Map(A.fieldOrder.map((e, t) => [e, t]));
|
|
1201
1221
|
e = [...e].sort((e, n) => {
|
|
1202
1222
|
let r = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field, i = typeof n == "string" ? n : n?.name || n?.fieldName || n?.field;
|
|
1203
1223
|
return (t.get(r) ?? Infinity) - (t.get(i) ?? Infinity);
|
|
@@ -1205,121 +1225,121 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1205
1225
|
}
|
|
1206
1226
|
return e;
|
|
1207
1227
|
}, [
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
]),
|
|
1214
|
-
let e =
|
|
1215
|
-
objectName:
|
|
1228
|
+
A.fields,
|
|
1229
|
+
A.objectName,
|
|
1230
|
+
X,
|
|
1231
|
+
A.fieldOrder,
|
|
1232
|
+
zt
|
|
1233
|
+
]), Kt = r.useMemo(() => {
|
|
1234
|
+
let e = Z.mode === "compact" ? "compact" : Z.mode === "spacious" ? "tall" : "medium", t = {
|
|
1235
|
+
objectName: A.objectName,
|
|
1216
1236
|
fields: $,
|
|
1217
|
-
filters:
|
|
1218
|
-
sort:
|
|
1237
|
+
filters: A.filters,
|
|
1238
|
+
sort: L,
|
|
1219
1239
|
className: "h-full w-full",
|
|
1220
1240
|
showSearch: !1,
|
|
1221
|
-
onRowClick:
|
|
1241
|
+
onRowClick: Gt.handleClick,
|
|
1222
1242
|
rowHeight: e,
|
|
1223
1243
|
hideRowHeightToggle: !0,
|
|
1224
|
-
...
|
|
1225
|
-
...
|
|
1244
|
+
...A.striped == null ? {} : { striped: A.striped },
|
|
1245
|
+
...A.bordered == null ? {} : { bordered: A.bordered },
|
|
1226
1246
|
...u ? { onColumnStateChange: u } : {},
|
|
1227
|
-
...
|
|
1247
|
+
...A.columnState ? { columnState: A.columnState } : {}
|
|
1228
1248
|
};
|
|
1229
|
-
switch (
|
|
1249
|
+
switch (N) {
|
|
1230
1250
|
default:
|
|
1231
1251
|
case "grid": return {
|
|
1232
1252
|
type: "object-grid",
|
|
1233
1253
|
...t,
|
|
1234
1254
|
columns: $,
|
|
1235
|
-
...
|
|
1236
|
-
...
|
|
1237
|
-
...
|
|
1238
|
-
...
|
|
1239
|
-
...
|
|
1240
|
-
...
|
|
1241
|
-
...
|
|
1242
|
-
...
|
|
1243
|
-
...
|
|
1244
|
-
...
|
|
1245
|
-
...
|
|
1246
|
-
...
|
|
1247
|
-
...
|
|
1248
|
-
...
|
|
1255
|
+
...A.conditionalFormatting ? { conditionalFormatting: A.conditionalFormatting } : {},
|
|
1256
|
+
...A.inlineEdit == null ? {} : { editable: A.inlineEdit },
|
|
1257
|
+
...A.wrapHeaders == null ? {} : { wrapHeaders: A.wrapHeaders },
|
|
1258
|
+
...A.virtualScroll == null ? {} : { virtualScroll: A.virtualScroll },
|
|
1259
|
+
...A.resizable == null ? {} : { resizable: A.resizable },
|
|
1260
|
+
...A.selection ? { selection: A.selection } : {},
|
|
1261
|
+
...A.pagination ? { pagination: A.pagination } : {},
|
|
1262
|
+
...J ? { grouping: J } : {},
|
|
1263
|
+
...Y ? { rowColor: Y } : {},
|
|
1264
|
+
...A.rowActions ? { rowActions: A.rowActions } : {},
|
|
1265
|
+
...A.rowActionDefs ? { rowActionDefs: A.rowActionDefs } : {},
|
|
1266
|
+
...A.bulkActions ? { batchActions: A.bulkActions } : {},
|
|
1267
|
+
...A.bulkActionDefs ? { bulkActionDefs: A.bulkActionDefs } : {},
|
|
1268
|
+
...A.options?.grid || {}
|
|
1249
1269
|
};
|
|
1250
1270
|
case "kanban": return {
|
|
1251
1271
|
type: "object-kanban",
|
|
1252
1272
|
...t,
|
|
1253
|
-
groupBy:
|
|
1254
|
-
groupField:
|
|
1255
|
-
...
|
|
1256
|
-
cardFields:
|
|
1257
|
-
...
|
|
1258
|
-
...
|
|
1259
|
-
...
|
|
1273
|
+
groupBy: A.kanban?.groupField || A.options?.kanban?.groupField || "status",
|
|
1274
|
+
groupField: A.kanban?.groupField || A.options?.kanban?.groupField || "status",
|
|
1275
|
+
...A.kanban?.titleField || A.options?.kanban?.titleField ? { titleField: A.kanban?.titleField || A.options?.kanban?.titleField } : {},
|
|
1276
|
+
cardFields: A.kanban?.cardFields || $ || [],
|
|
1277
|
+
...J ? { grouping: J } : {},
|
|
1278
|
+
...A.options?.kanban || {},
|
|
1279
|
+
...A.kanban || {}
|
|
1260
1280
|
};
|
|
1261
1281
|
case "calendar": return {
|
|
1262
1282
|
type: "object-calendar",
|
|
1263
1283
|
...t,
|
|
1264
|
-
startDateField:
|
|
1265
|
-
endDateField:
|
|
1266
|
-
...
|
|
1267
|
-
...
|
|
1268
|
-
...
|
|
1269
|
-
...
|
|
1284
|
+
startDateField: A.calendar?.startDateField || A.options?.calendar?.startDateField || "start_date",
|
|
1285
|
+
endDateField: A.calendar?.endDateField || A.options?.calendar?.endDateField || "end_date",
|
|
1286
|
+
...A.calendar?.titleField || A.options?.calendar?.titleField ? { titleField: A.calendar?.titleField || A.options?.calendar?.titleField } : {},
|
|
1287
|
+
...A.calendar?.defaultView ? { defaultView: A.calendar.defaultView } : {},
|
|
1288
|
+
...A.options?.calendar || {},
|
|
1289
|
+
...A.calendar || {}
|
|
1270
1290
|
};
|
|
1271
1291
|
case "gallery": {
|
|
1272
1292
|
let e = {
|
|
1273
|
-
...
|
|
1274
|
-
...
|
|
1275
|
-
cardSize:
|
|
1293
|
+
...A.options?.gallery || {},
|
|
1294
|
+
...A.gallery || {},
|
|
1295
|
+
cardSize: Q
|
|
1276
1296
|
};
|
|
1277
1297
|
return {
|
|
1278
1298
|
type: "object-gallery",
|
|
1279
1299
|
...t,
|
|
1280
1300
|
gallery: Object.keys(e).length > 0 ? e : void 0,
|
|
1281
|
-
imageField:
|
|
1282
|
-
titleField:
|
|
1283
|
-
subtitleField:
|
|
1284
|
-
...
|
|
1301
|
+
imageField: A.gallery?.coverField || A.gallery?.imageField || A.options?.gallery?.imageField,
|
|
1302
|
+
titleField: A.gallery?.titleField || A.options?.gallery?.titleField || "name",
|
|
1303
|
+
subtitleField: A.gallery?.subtitleField || A.options?.gallery?.subtitleField,
|
|
1304
|
+
...J ? { grouping: J } : {}
|
|
1285
1305
|
};
|
|
1286
1306
|
}
|
|
1287
1307
|
case "timeline": {
|
|
1288
1308
|
let e = {
|
|
1289
|
-
...
|
|
1290
|
-
...
|
|
1309
|
+
...A.options?.timeline || {},
|
|
1310
|
+
...A.timeline || {}
|
|
1291
1311
|
};
|
|
1292
1312
|
return {
|
|
1293
1313
|
type: "object-timeline",
|
|
1294
1314
|
...t,
|
|
1295
1315
|
timeline: Object.keys(e).length > 0 ? e : void 0,
|
|
1296
|
-
startDateField:
|
|
1297
|
-
titleField:
|
|
1298
|
-
...
|
|
1299
|
-
...
|
|
1300
|
-
...
|
|
1301
|
-
...
|
|
1316
|
+
startDateField: A.timeline?.startDateField || A.options?.timeline?.startDateField || A.options?.timeline?.dateField || "created_at",
|
|
1317
|
+
titleField: A.timeline?.titleField || A.options?.timeline?.titleField || "name",
|
|
1318
|
+
...A.timeline?.endDateField ? { endDateField: A.timeline.endDateField } : {},
|
|
1319
|
+
...A.timeline?.groupByField ? { groupByField: A.timeline.groupByField } : {},
|
|
1320
|
+
...A.timeline?.colorField ? { colorField: A.timeline.colorField } : {},
|
|
1321
|
+
...A.timeline?.scale ? { scale: A.timeline.scale } : {}
|
|
1302
1322
|
};
|
|
1303
1323
|
}
|
|
1304
1324
|
case "gantt": return {
|
|
1305
1325
|
type: "object-gantt",
|
|
1306
1326
|
...t,
|
|
1307
|
-
startDateField:
|
|
1308
|
-
endDateField:
|
|
1309
|
-
progressField:
|
|
1310
|
-
dependenciesField:
|
|
1311
|
-
...
|
|
1312
|
-
...
|
|
1313
|
-
...
|
|
1327
|
+
startDateField: A.gantt?.startDateField || A.options?.gantt?.startDateField || "start_date",
|
|
1328
|
+
endDateField: A.gantt?.endDateField || A.options?.gantt?.endDateField || "end_date",
|
|
1329
|
+
progressField: A.gantt?.progressField || A.options?.gantt?.progressField || "progress",
|
|
1330
|
+
dependenciesField: A.gantt?.dependenciesField || A.options?.gantt?.dependenciesField || "dependencies",
|
|
1331
|
+
...A.gantt?.titleField ? { titleField: A.gantt.titleField } : {},
|
|
1332
|
+
...A.options?.gantt || {},
|
|
1333
|
+
...A.gantt || {}
|
|
1314
1334
|
};
|
|
1315
1335
|
case "map": return {
|
|
1316
1336
|
type: "object-map",
|
|
1317
1337
|
...t,
|
|
1318
|
-
locationField:
|
|
1319
|
-
...
|
|
1338
|
+
locationField: A.options?.map?.locationField || "location",
|
|
1339
|
+
...A.options?.map || {}
|
|
1320
1340
|
};
|
|
1321
1341
|
case "tree": {
|
|
1322
|
-
let e =
|
|
1342
|
+
let e = A.tree || A.options?.tree || {};
|
|
1323
1343
|
return {
|
|
1324
1344
|
type: "object-tree",
|
|
1325
1345
|
...t,
|
|
@@ -1331,7 +1351,7 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1331
1351
|
};
|
|
1332
1352
|
}
|
|
1333
1353
|
case "chart": {
|
|
1334
|
-
let e =
|
|
1354
|
+
let e = A.chart || A.options?.chart || {};
|
|
1335
1355
|
if (e.dataset) {
|
|
1336
1356
|
let t = Array.isArray(e.dimensions) ? e.dimensions : [], n = Array.isArray(e.values) ? e.values : [];
|
|
1337
1357
|
return {
|
|
@@ -1351,9 +1371,9 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1351
1371
|
let t = Array.isArray(e.yAxisFields) && e.yAxisFields[0] || e.valueField || "value", n = e.xAxisField || e.categoryField || "name";
|
|
1352
1372
|
return {
|
|
1353
1373
|
type: "object-chart",
|
|
1354
|
-
objectName:
|
|
1374
|
+
objectName: A.objectName,
|
|
1355
1375
|
chartType: e.chartType || "bar",
|
|
1356
|
-
filters:
|
|
1376
|
+
filters: A.filters,
|
|
1357
1377
|
aggregate: {
|
|
1358
1378
|
field: t,
|
|
1359
1379
|
function: e.aggregation || "count",
|
|
@@ -1369,16 +1389,16 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1369
1389
|
}
|
|
1370
1390
|
}
|
|
1371
1391
|
}, [
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1392
|
+
N,
|
|
1393
|
+
A,
|
|
1394
|
+
L,
|
|
1375
1395
|
$,
|
|
1376
|
-
q,
|
|
1377
1396
|
J,
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
Z
|
|
1381
|
-
|
|
1397
|
+
Y,
|
|
1398
|
+
Gt.handleClick,
|
|
1399
|
+
Z.mode,
|
|
1400
|
+
Q
|
|
1401
|
+
]), qt = z.conditions && z.conditions.length > 0, Jt = r.useMemo(() => {
|
|
1382
1402
|
let e, t = (e, t) => {
|
|
1383
1403
|
if (!t) return;
|
|
1384
1404
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1390,17 +1410,17 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1390
1410
|
label: t?.label || e,
|
|
1391
1411
|
...t
|
|
1392
1412
|
}));
|
|
1393
|
-
return
|
|
1413
|
+
return A.objectName ? k(A.objectName, e, n) : n;
|
|
1394
1414
|
};
|
|
1395
|
-
if (e =
|
|
1415
|
+
if (e = W?.fields ? Object.entries(W.fields).map(([e, n]) => ({
|
|
1396
1416
|
value: e,
|
|
1397
|
-
label:
|
|
1417
|
+
label: j(e, n.label || e),
|
|
1398
1418
|
type: n.type || "text",
|
|
1399
1419
|
options: t(e, n.options),
|
|
1400
1420
|
referenceTo: n.reference_to || n.reference,
|
|
1401
1421
|
displayField: n.display_field || n.reference_field,
|
|
1402
1422
|
idField: n.id_field
|
|
1403
|
-
})) : (
|
|
1423
|
+
})) : (A.fields || []).map((e) => {
|
|
1404
1424
|
if (typeof e == "string") return {
|
|
1405
1425
|
value: e,
|
|
1406
1426
|
label: e,
|
|
@@ -1409,27 +1429,27 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1409
1429
|
let n = e.name || e.fieldName;
|
|
1410
1430
|
return {
|
|
1411
1431
|
value: n,
|
|
1412
|
-
label:
|
|
1432
|
+
label: j(n, e.label || e.name),
|
|
1413
1433
|
type: e.type || "text",
|
|
1414
1434
|
options: t(n, e.options),
|
|
1415
1435
|
referenceTo: e.reference_to || e.reference,
|
|
1416
1436
|
displayField: e.display_field || e.reference_field,
|
|
1417
1437
|
idField: e.id_field
|
|
1418
1438
|
};
|
|
1419
|
-
}),
|
|
1420
|
-
let t = new Set(
|
|
1439
|
+
}), A.filterableFields && A.filterableFields.length > 0) {
|
|
1440
|
+
let t = new Set(A.filterableFields);
|
|
1421
1441
|
e = e.filter((e) => t.has(e.value));
|
|
1422
1442
|
}
|
|
1423
1443
|
return e;
|
|
1424
1444
|
}, [
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
]),
|
|
1432
|
-
let t =
|
|
1445
|
+
W,
|
|
1446
|
+
A.fields,
|
|
1447
|
+
A.filterableFields,
|
|
1448
|
+
A.objectName,
|
|
1449
|
+
j,
|
|
1450
|
+
k
|
|
1451
|
+
]), Yt = r.useCallback((e) => {
|
|
1452
|
+
let t = At, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || A.objectName || "export", a = n > 0 ? V.slice(0, n) : V;
|
|
1433
1453
|
if (e === "csv") {
|
|
1434
1454
|
let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
|
|
1435
1455
|
r && t.push(e.join(",")), a.forEach((n) => {
|
|
@@ -1444,119 +1464,119 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1444
1464
|
let e = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1445
1465
|
n.href = t, n.download = `${i}.json`, n.click(), URL.revokeObjectURL(t);
|
|
1446
1466
|
}
|
|
1447
|
-
|
|
1467
|
+
kt(!1);
|
|
1448
1468
|
}, [
|
|
1449
|
-
|
|
1469
|
+
V,
|
|
1450
1470
|
$,
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
]),
|
|
1471
|
+
At,
|
|
1472
|
+
A.objectName
|
|
1473
|
+
]), Xt = r.useMemo(() => (A.fields || []).map((e) => {
|
|
1454
1474
|
if (typeof e == "string") return {
|
|
1455
1475
|
name: e,
|
|
1456
|
-
label:
|
|
1476
|
+
label: j(e, e)
|
|
1457
1477
|
};
|
|
1458
1478
|
let t = e.name || e.fieldName || e.field;
|
|
1459
1479
|
return {
|
|
1460
1480
|
name: t,
|
|
1461
|
-
label:
|
|
1481
|
+
label: j(t, e.label || e.name || e.field)
|
|
1462
1482
|
};
|
|
1463
|
-
}), [
|
|
1464
|
-
return /* @__PURE__ */
|
|
1465
|
-
ref:
|
|
1466
|
-
className:
|
|
1467
|
-
...
|
|
1468
|
-
...
|
|
1469
|
-
...
|
|
1483
|
+
}), [A.fields, j]);
|
|
1484
|
+
return /* @__PURE__ */ I("div", {
|
|
1485
|
+
ref: Pt,
|
|
1486
|
+
className: T("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1487
|
+
...A.aria?.label ? { "aria-label": A.aria.label } : {},
|
|
1488
|
+
...A.aria?.describedBy ? { "aria-describedby": A.aria.describedBy } : {},
|
|
1489
|
+
...A.aria?.live ? { "aria-live": A.aria.live } : {},
|
|
1470
1490
|
role: "region",
|
|
1471
|
-
"aria-busy":
|
|
1472
|
-
"data-state":
|
|
1491
|
+
"aria-busy": H || void 0,
|
|
1492
|
+
"data-state": H ? "loading" : "idle",
|
|
1473
1493
|
children: [
|
|
1474
|
-
|
|
1494
|
+
It > 0 && /* @__PURE__ */ F("div", {
|
|
1475
1495
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1476
|
-
style: { height:
|
|
1477
|
-
children:
|
|
1496
|
+
style: { height: It },
|
|
1497
|
+
children: E(Ft ? "list.refreshing" : "list.pullToRefresh")
|
|
1478
1498
|
}),
|
|
1479
|
-
|
|
1499
|
+
A.description && A.appearance?.showDescription !== !1 && /* @__PURE__ */ F("div", {
|
|
1480
1500
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
1481
1501
|
"data-testid": "view-description",
|
|
1482
|
-
children: typeof
|
|
1502
|
+
children: typeof A.description == "string" ? A.description : ""
|
|
1483
1503
|
}),
|
|
1484
|
-
/* @__PURE__ */
|
|
1504
|
+
/* @__PURE__ */ I("div", {
|
|
1485
1505
|
className: "border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1486
|
-
children: [/* @__PURE__ */
|
|
1506
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1487
1507
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1488
|
-
children:
|
|
1508
|
+
children: St && /* @__PURE__ */ F("div", {
|
|
1489
1509
|
className: "shrink-0 min-w-0 overflow-x-auto",
|
|
1490
1510
|
"data-testid": "user-filters",
|
|
1491
|
-
children: /* @__PURE__ */
|
|
1492
|
-
config:
|
|
1493
|
-
objectDef:
|
|
1494
|
-
data:
|
|
1495
|
-
onFilterChange:
|
|
1511
|
+
children: /* @__PURE__ */ F(Ge, {
|
|
1512
|
+
config: St,
|
|
1513
|
+
objectDef: W,
|
|
1514
|
+
data: V,
|
|
1515
|
+
onFilterChange: xt,
|
|
1496
1516
|
maxVisible: 3,
|
|
1497
1517
|
initialSelections: m,
|
|
1498
1518
|
onSelectionsChange: h
|
|
1499
1519
|
})
|
|
1500
1520
|
})
|
|
1501
|
-
}), /* @__PURE__ */
|
|
1521
|
+
}), /* @__PURE__ */ I("div", {
|
|
1502
1522
|
className: "flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm",
|
|
1503
1523
|
children: [
|
|
1504
|
-
|
|
1505
|
-
currentView:
|
|
1506
|
-
availableViews:
|
|
1507
|
-
onViewChange:
|
|
1508
|
-
}), /* @__PURE__ */
|
|
1509
|
-
|
|
1510
|
-
open:
|
|
1511
|
-
onOpenChange:
|
|
1512
|
-
children: [/* @__PURE__ */
|
|
1524
|
+
ne && /* @__PURE__ */ I(Ee, { children: [/* @__PURE__ */ F(Be, {
|
|
1525
|
+
currentView: N,
|
|
1526
|
+
availableViews: Ht,
|
|
1527
|
+
onViewChange: Ut
|
|
1528
|
+
}), /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-0.5" })] }),
|
|
1529
|
+
M.showHideFields && !M.compactToolbar && /* @__PURE__ */ I(S, {
|
|
1530
|
+
open: Et,
|
|
1531
|
+
onOpenChange: Dt,
|
|
1532
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1513
1533
|
asChild: !0,
|
|
1514
|
-
children: /* @__PURE__ */
|
|
1534
|
+
children: /* @__PURE__ */ I(l, {
|
|
1515
1535
|
variant: "ghost",
|
|
1516
1536
|
size: "sm",
|
|
1517
|
-
className:
|
|
1537
|
+
className: T("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", X.size > 0 && "text-primary"),
|
|
1518
1538
|
children: [
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
/* @__PURE__ */
|
|
1539
|
+
/* @__PURE__ */ F(se, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1540
|
+
/* @__PURE__ */ F("span", {
|
|
1521
1541
|
className: "hidden sm:inline",
|
|
1522
|
-
children:
|
|
1542
|
+
children: E("list.hideFields")
|
|
1523
1543
|
}),
|
|
1524
|
-
|
|
1544
|
+
X.size > 0 && /* @__PURE__ */ F("span", {
|
|
1525
1545
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1526
|
-
children:
|
|
1546
|
+
children: X.size
|
|
1527
1547
|
})
|
|
1528
1548
|
]
|
|
1529
1549
|
})
|
|
1530
|
-
}), /* @__PURE__ */
|
|
1550
|
+
}), /* @__PURE__ */ F(C, {
|
|
1531
1551
|
align: "start",
|
|
1532
1552
|
className: "w-64 p-3",
|
|
1533
|
-
children: /* @__PURE__ */
|
|
1553
|
+
children: /* @__PURE__ */ I("div", {
|
|
1534
1554
|
className: "space-y-2",
|
|
1535
|
-
children: [/* @__PURE__ */
|
|
1555
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1536
1556
|
className: "flex items-center justify-between border-b pb-2",
|
|
1537
|
-
children: [/* @__PURE__ */
|
|
1557
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1538
1558
|
className: "font-medium text-sm",
|
|
1539
|
-
children:
|
|
1540
|
-
}),
|
|
1559
|
+
children: E("list.hideFieldsTitle")
|
|
1560
|
+
}), X.size > 0 && /* @__PURE__ */ F(l, {
|
|
1541
1561
|
variant: "ghost",
|
|
1542
1562
|
size: "sm",
|
|
1543
1563
|
className: "h-6 px-2 text-xs",
|
|
1544
|
-
onClick: () =>
|
|
1545
|
-
children:
|
|
1564
|
+
onClick: () => Tt(/* @__PURE__ */ new Set()),
|
|
1565
|
+
children: E("list.showAll")
|
|
1546
1566
|
})]
|
|
1547
|
-
}), /* @__PURE__ */
|
|
1567
|
+
}), /* @__PURE__ */ F("div", {
|
|
1548
1568
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1549
|
-
children:
|
|
1569
|
+
children: Xt.map((e) => /* @__PURE__ */ I("label", {
|
|
1550
1570
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1551
|
-
children: [/* @__PURE__ */
|
|
1571
|
+
children: [/* @__PURE__ */ F("input", {
|
|
1552
1572
|
type: "checkbox",
|
|
1553
|
-
checked: !
|
|
1573
|
+
checked: !X.has(e.name),
|
|
1554
1574
|
onChange: () => {
|
|
1555
|
-
let t = new Set(
|
|
1556
|
-
t.has(e.name) ? t.delete(e.name) : t.add(e.name),
|
|
1575
|
+
let t = new Set(X);
|
|
1576
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), Tt(t);
|
|
1557
1577
|
},
|
|
1558
1578
|
className: "rounded border-input"
|
|
1559
|
-
}), /* @__PURE__ */
|
|
1579
|
+
}), /* @__PURE__ */ F("span", {
|
|
1560
1580
|
className: "truncate",
|
|
1561
1581
|
children: e.label
|
|
1562
1582
|
})]
|
|
@@ -1565,204 +1585,204 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1565
1585
|
})
|
|
1566
1586
|
})]
|
|
1567
1587
|
}),
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
open:
|
|
1571
|
-
onOpenChange:
|
|
1572
|
-
children: [/* @__PURE__ */
|
|
1588
|
+
M.showHideFields && !M.compactToolbar && (M.showFilters || M.showSort || M.showGroup) && /* @__PURE__ */ F("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1589
|
+
M.showFilters && /* @__PURE__ */ I(S, {
|
|
1590
|
+
open: ze,
|
|
1591
|
+
onOpenChange: R,
|
|
1592
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1573
1593
|
asChild: !0,
|
|
1574
|
-
children: /* @__PURE__ */
|
|
1594
|
+
children: /* @__PURE__ */ I(l, {
|
|
1575
1595
|
variant: "ghost",
|
|
1576
1596
|
size: "sm",
|
|
1577
|
-
className:
|
|
1597
|
+
className: T("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", qt && "text-foreground font-medium"),
|
|
1578
1598
|
children: [
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1599
|
+
/* @__PURE__ */ F(Se, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1600
|
+
/* @__PURE__ */ F("span", {
|
|
1581
1601
|
className: "hidden sm:inline",
|
|
1582
|
-
children:
|
|
1602
|
+
children: E("list.filter")
|
|
1583
1603
|
}),
|
|
1584
|
-
|
|
1604
|
+
qt && /* @__PURE__ */ F("span", {
|
|
1585
1605
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1586
|
-
children:
|
|
1606
|
+
children: z.conditions?.length || 0
|
|
1587
1607
|
})
|
|
1588
1608
|
]
|
|
1589
1609
|
})
|
|
1590
|
-
}), /* @__PURE__ */
|
|
1610
|
+
}), /* @__PURE__ */ F(C, {
|
|
1591
1611
|
align: "start",
|
|
1592
1612
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1593
|
-
children: /* @__PURE__ */
|
|
1613
|
+
children: /* @__PURE__ */ I("div", {
|
|
1594
1614
|
className: "space-y-4",
|
|
1595
|
-
children: [/* @__PURE__ */
|
|
1615
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1596
1616
|
className: "flex items-center justify-between border-b pb-2",
|
|
1597
|
-
children: /* @__PURE__ */
|
|
1617
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1598
1618
|
className: "font-medium text-sm",
|
|
1599
|
-
children:
|
|
1619
|
+
children: E("list.filterRecords")
|
|
1600
1620
|
})
|
|
1601
|
-
}), /* @__PURE__ */
|
|
1602
|
-
fields:
|
|
1603
|
-
value:
|
|
1621
|
+
}), /* @__PURE__ */ F(_, {
|
|
1622
|
+
fields: Jt,
|
|
1623
|
+
value: z,
|
|
1604
1624
|
onChange: (e) => {
|
|
1605
|
-
|
|
1625
|
+
Ve(e), a && a(e);
|
|
1606
1626
|
}
|
|
1607
1627
|
})]
|
|
1608
1628
|
})
|
|
1609
1629
|
})]
|
|
1610
1630
|
}),
|
|
1611
|
-
|
|
1612
|
-
open:
|
|
1613
|
-
onOpenChange:
|
|
1614
|
-
children: [/* @__PURE__ */
|
|
1631
|
+
M.showGroup && !M.compactToolbar && /* @__PURE__ */ I(S, {
|
|
1632
|
+
open: dt,
|
|
1633
|
+
onOpenChange: ft,
|
|
1634
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1615
1635
|
asChild: !0,
|
|
1616
|
-
children: /* @__PURE__ */
|
|
1636
|
+
children: /* @__PURE__ */ I(l, {
|
|
1617
1637
|
variant: "ghost",
|
|
1618
1638
|
size: "sm",
|
|
1619
|
-
className:
|
|
1639
|
+
className: T("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", J && "text-foreground font-medium"),
|
|
1620
1640
|
children: [
|
|
1621
|
-
/* @__PURE__ */
|
|
1622
|
-
/* @__PURE__ */
|
|
1641
|
+
/* @__PURE__ */ F(le, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1642
|
+
/* @__PURE__ */ F("span", {
|
|
1623
1643
|
className: "hidden sm:inline",
|
|
1624
|
-
children:
|
|
1644
|
+
children: E("list.group")
|
|
1625
1645
|
}),
|
|
1626
|
-
|
|
1646
|
+
J && J.fields?.length > 0 && /* @__PURE__ */ F("span", {
|
|
1627
1647
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1628
|
-
children:
|
|
1648
|
+
children: J.fields.length
|
|
1629
1649
|
})
|
|
1630
1650
|
]
|
|
1631
1651
|
})
|
|
1632
|
-
}), /* @__PURE__ */
|
|
1652
|
+
}), /* @__PURE__ */ F(C, {
|
|
1633
1653
|
align: "start",
|
|
1634
1654
|
className: "w-72 p-3",
|
|
1635
|
-
children: /* @__PURE__ */
|
|
1655
|
+
children: /* @__PURE__ */ I("div", {
|
|
1636
1656
|
className: "space-y-2",
|
|
1637
|
-
children: [/* @__PURE__ */
|
|
1657
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1638
1658
|
className: "flex items-center justify-between border-b pb-2",
|
|
1639
|
-
children: [/* @__PURE__ */
|
|
1659
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1640
1660
|
className: "font-medium text-sm",
|
|
1641
|
-
children:
|
|
1642
|
-
}),
|
|
1661
|
+
children: E("list.groupBy")
|
|
1662
|
+
}), J && /* @__PURE__ */ F(l, {
|
|
1643
1663
|
variant: "ghost",
|
|
1644
1664
|
size: "sm",
|
|
1645
1665
|
className: "h-6 px-2 text-xs",
|
|
1646
|
-
onClick: () =>
|
|
1666
|
+
onClick: () => ut(void 0),
|
|
1647
1667
|
"data-testid": "clear-grouping",
|
|
1648
|
-
children:
|
|
1668
|
+
children: E("list.clear")
|
|
1649
1669
|
})]
|
|
1650
|
-
}), /* @__PURE__ */
|
|
1670
|
+
}), /* @__PURE__ */ F("div", {
|
|
1651
1671
|
"data-testid": "group-field-list",
|
|
1652
|
-
children: /* @__PURE__ */
|
|
1653
|
-
value:
|
|
1654
|
-
fieldOptions:
|
|
1672
|
+
children: /* @__PURE__ */ F(v, {
|
|
1673
|
+
value: J,
|
|
1674
|
+
fieldOptions: Xt.map((e) => ({
|
|
1655
1675
|
value: e.name,
|
|
1656
1676
|
label: e.label || e.name
|
|
1657
1677
|
})),
|
|
1658
1678
|
maxLevels: 3,
|
|
1659
1679
|
labels: {
|
|
1660
|
-
addGroup:
|
|
1661
|
-
collapseTitle:
|
|
1662
|
-
removeTitle:
|
|
1680
|
+
addGroup: E("list.addGroup", { defaultValue: "Add group field" }),
|
|
1681
|
+
collapseTitle: E("list.collapsedByDefault", { defaultValue: "Collapsed by default" }),
|
|
1682
|
+
removeTitle: E("list.removeGroup", { defaultValue: "Remove" })
|
|
1663
1683
|
},
|
|
1664
|
-
onChange: (e) =>
|
|
1684
|
+
onChange: (e) => ut(e)
|
|
1665
1685
|
})
|
|
1666
1686
|
})]
|
|
1667
1687
|
})
|
|
1668
1688
|
})]
|
|
1669
1689
|
}),
|
|
1670
|
-
|
|
1671
|
-
open:
|
|
1672
|
-
onOpenChange:
|
|
1673
|
-
children: [/* @__PURE__ */
|
|
1690
|
+
M.showSort && /* @__PURE__ */ I(S, {
|
|
1691
|
+
open: je,
|
|
1692
|
+
onOpenChange: Me,
|
|
1693
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1674
1694
|
asChild: !0,
|
|
1675
|
-
children: /* @__PURE__ */
|
|
1695
|
+
children: /* @__PURE__ */ I(l, {
|
|
1676
1696
|
variant: "ghost",
|
|
1677
1697
|
size: "sm",
|
|
1678
|
-
className:
|
|
1698
|
+
className: T("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", L.length > 0 && "text-foreground font-medium"),
|
|
1679
1699
|
children: [
|
|
1680
|
-
/* @__PURE__ */
|
|
1681
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ F(ie, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1701
|
+
/* @__PURE__ */ F("span", {
|
|
1682
1702
|
className: "hidden sm:inline",
|
|
1683
|
-
children:
|
|
1703
|
+
children: E("list.sort")
|
|
1684
1704
|
}),
|
|
1685
|
-
|
|
1705
|
+
L.length > 0 && /* @__PURE__ */ F("span", {
|
|
1686
1706
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1687
|
-
children:
|
|
1707
|
+
children: L.length
|
|
1688
1708
|
})
|
|
1689
1709
|
]
|
|
1690
1710
|
})
|
|
1691
|
-
}), /* @__PURE__ */
|
|
1711
|
+
}), /* @__PURE__ */ F(C, {
|
|
1692
1712
|
align: "start",
|
|
1693
1713
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1694
|
-
children: /* @__PURE__ */
|
|
1714
|
+
children: /* @__PURE__ */ I("div", {
|
|
1695
1715
|
className: "space-y-4",
|
|
1696
|
-
children: [/* @__PURE__ */
|
|
1716
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1697
1717
|
className: "flex items-center justify-between border-b pb-2",
|
|
1698
|
-
children: /* @__PURE__ */
|
|
1718
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1699
1719
|
className: "font-medium text-sm",
|
|
1700
|
-
children:
|
|
1720
|
+
children: E("list.sortRecords")
|
|
1701
1721
|
})
|
|
1702
|
-
}), /* @__PURE__ */
|
|
1703
|
-
fields:
|
|
1704
|
-
value:
|
|
1722
|
+
}), /* @__PURE__ */ F(te, {
|
|
1723
|
+
fields: Jt,
|
|
1724
|
+
value: L,
|
|
1705
1725
|
onChange: (e) => {
|
|
1706
|
-
|
|
1726
|
+
Le(e), o && o(e);
|
|
1707
1727
|
}
|
|
1708
1728
|
})]
|
|
1709
1729
|
})
|
|
1710
1730
|
})]
|
|
1711
1731
|
}),
|
|
1712
|
-
!
|
|
1713
|
-
|
|
1714
|
-
open:
|
|
1715
|
-
onOpenChange:
|
|
1716
|
-
children: [/* @__PURE__ */
|
|
1732
|
+
!M.compactToolbar && (M.showFilters || M.showSort || M.showGroup) && (M.showColor || M.showDensity) && /* @__PURE__ */ F("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1733
|
+
M.showColor && !M.compactToolbar && /* @__PURE__ */ I(S, {
|
|
1734
|
+
open: ht,
|
|
1735
|
+
onOpenChange: gt,
|
|
1736
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1717
1737
|
asChild: !0,
|
|
1718
|
-
children: /* @__PURE__ */
|
|
1738
|
+
children: /* @__PURE__ */ I(l, {
|
|
1719
1739
|
variant: "ghost",
|
|
1720
1740
|
size: "sm",
|
|
1721
|
-
className:
|
|
1722
|
-
children: [/* @__PURE__ */
|
|
1741
|
+
className: T("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Y && "text-foreground font-medium"),
|
|
1742
|
+
children: [/* @__PURE__ */ F(fe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1723
1743
|
className: "hidden sm:inline",
|
|
1724
|
-
children:
|
|
1744
|
+
children: E("list.color")
|
|
1725
1745
|
})]
|
|
1726
1746
|
})
|
|
1727
|
-
}), /* @__PURE__ */
|
|
1747
|
+
}), /* @__PURE__ */ F(C, {
|
|
1728
1748
|
align: "start",
|
|
1729
1749
|
className: "w-64 p-3",
|
|
1730
|
-
children: /* @__PURE__ */
|
|
1750
|
+
children: /* @__PURE__ */ I("div", {
|
|
1731
1751
|
className: "space-y-2",
|
|
1732
|
-
children: [/* @__PURE__ */
|
|
1752
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1733
1753
|
className: "flex items-center justify-between border-b pb-2",
|
|
1734
|
-
children: [/* @__PURE__ */
|
|
1754
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1735
1755
|
className: "font-medium text-sm",
|
|
1736
|
-
children:
|
|
1737
|
-
}),
|
|
1756
|
+
children: E("list.rowColor")
|
|
1757
|
+
}), Y && /* @__PURE__ */ F(l, {
|
|
1738
1758
|
variant: "ghost",
|
|
1739
1759
|
size: "sm",
|
|
1740
1760
|
className: "h-6 px-2 text-xs",
|
|
1741
|
-
onClick: () =>
|
|
1761
|
+
onClick: () => mt(void 0),
|
|
1742
1762
|
"data-testid": "clear-row-color",
|
|
1743
|
-
children:
|
|
1763
|
+
children: E("list.clear")
|
|
1744
1764
|
})]
|
|
1745
|
-
}), /* @__PURE__ */
|
|
1765
|
+
}), /* @__PURE__ */ I("div", {
|
|
1746
1766
|
className: "space-y-2",
|
|
1747
1767
|
"data-testid": "color-field-list",
|
|
1748
|
-
children: [/* @__PURE__ */
|
|
1768
|
+
children: [/* @__PURE__ */ F("label", {
|
|
1749
1769
|
className: "text-xs text-muted-foreground",
|
|
1750
|
-
children:
|
|
1751
|
-
}), /* @__PURE__ */
|
|
1770
|
+
children: E("list.colorByField")
|
|
1771
|
+
}), /* @__PURE__ */ I("select", {
|
|
1752
1772
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1753
|
-
value:
|
|
1773
|
+
value: Y?.field || "",
|
|
1754
1774
|
onChange: (e) => {
|
|
1755
1775
|
let t = e.target.value;
|
|
1756
|
-
|
|
1776
|
+
mt(t ? {
|
|
1757
1777
|
field: t,
|
|
1758
|
-
colors:
|
|
1778
|
+
colors: Y?.colors || {}
|
|
1759
1779
|
} : void 0);
|
|
1760
1780
|
},
|
|
1761
1781
|
"data-testid": "color-field-select",
|
|
1762
|
-
children: [/* @__PURE__ */
|
|
1782
|
+
children: [/* @__PURE__ */ F("option", {
|
|
1763
1783
|
value: "",
|
|
1764
|
-
children:
|
|
1765
|
-
}),
|
|
1784
|
+
children: E("list.none")
|
|
1785
|
+
}), Xt.map((e) => /* @__PURE__ */ F("option", {
|
|
1766
1786
|
value: e.name,
|
|
1767
1787
|
children: e.label
|
|
1768
1788
|
}, e.name))]
|
|
@@ -1771,185 +1791,185 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1771
1791
|
})
|
|
1772
1792
|
})]
|
|
1773
1793
|
}),
|
|
1774
|
-
|
|
1775
|
-
let e =
|
|
1794
|
+
M.showDensity && !M.compactToolbar && N !== "gallery" && (() => {
|
|
1795
|
+
let e = Z.mode === "compact" ? ve : Z.mode === "comfortable" ? _e : ge, 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", {
|
|
1776
1796
|
defaultValue: "{{label}} (click to cycle)",
|
|
1777
1797
|
label: n
|
|
1778
1798
|
});
|
|
1779
|
-
return /* @__PURE__ */
|
|
1799
|
+
return /* @__PURE__ */ F(l, {
|
|
1780
1800
|
variant: "ghost",
|
|
1781
1801
|
size: "sm",
|
|
1782
1802
|
"aria-label": n,
|
|
1783
|
-
className:
|
|
1784
|
-
onClick:
|
|
1803
|
+
className: T("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Z.mode !== "compact" && "text-foreground font-medium"),
|
|
1804
|
+
onClick: Z.cycle,
|
|
1785
1805
|
title: r,
|
|
1786
|
-
children: /* @__PURE__ */
|
|
1806
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1787
1807
|
});
|
|
1788
1808
|
})(),
|
|
1789
|
-
|
|
1790
|
-
let e =
|
|
1809
|
+
M.showDensity && !M.compactToolbar && N === "gallery" && (() => {
|
|
1810
|
+
let e = Q === "small" ? ve : Q === "medium" ? _e : ge, 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", {
|
|
1791
1811
|
defaultValue: "{{label}} (click to cycle)",
|
|
1792
1812
|
label: n
|
|
1793
1813
|
});
|
|
1794
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ F(l, {
|
|
1795
1815
|
variant: "ghost",
|
|
1796
1816
|
size: "sm",
|
|
1797
1817
|
"aria-label": n,
|
|
1798
|
-
className:
|
|
1799
|
-
onClick:
|
|
1818
|
+
className: T("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Q !== "small" && "text-foreground font-medium"),
|
|
1819
|
+
onClick: Nt,
|
|
1800
1820
|
title: r,
|
|
1801
|
-
children: /* @__PURE__ */
|
|
1821
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1802
1822
|
});
|
|
1803
1823
|
})(),
|
|
1804
|
-
|
|
1805
|
-
t:
|
|
1806
|
-
allFields:
|
|
1807
|
-
showGroup:
|
|
1808
|
-
groupingConfig:
|
|
1809
|
-
setGroupingConfig:
|
|
1810
|
-
showColor:
|
|
1811
|
-
rowColorConfig:
|
|
1812
|
-
setRowColorConfig:
|
|
1813
|
-
showDensity:
|
|
1814
|
-
density:
|
|
1815
|
-
showHideFields:
|
|
1816
|
-
hiddenFields:
|
|
1817
|
-
updateHiddenFields:
|
|
1824
|
+
M.compactToolbar && (M.showGroup || M.showColor || M.showDensity || M.showHideFields) && /* @__PURE__ */ F(He, {
|
|
1825
|
+
t: E,
|
|
1826
|
+
allFields: Xt,
|
|
1827
|
+
showGroup: M.showGroup,
|
|
1828
|
+
groupingConfig: J,
|
|
1829
|
+
setGroupingConfig: ut,
|
|
1830
|
+
showColor: M.showColor,
|
|
1831
|
+
rowColorConfig: Y,
|
|
1832
|
+
setRowColorConfig: mt,
|
|
1833
|
+
showDensity: M.showDensity,
|
|
1834
|
+
density: Z,
|
|
1835
|
+
showHideFields: M.showHideFields,
|
|
1836
|
+
hiddenFields: X,
|
|
1837
|
+
updateHiddenFields: Tt
|
|
1818
1838
|
}),
|
|
1819
|
-
(
|
|
1820
|
-
|
|
1821
|
-
open:
|
|
1822
|
-
onOpenChange:
|
|
1823
|
-
children: [/* @__PURE__ */
|
|
1839
|
+
(M.showColor || M.showDensity || M.compactToolbar) && At && A.allowExport !== !1 && /* @__PURE__ */ F("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1840
|
+
At && A.allowExport !== !1 && /* @__PURE__ */ I(S, {
|
|
1841
|
+
open: Ot,
|
|
1842
|
+
onOpenChange: kt,
|
|
1843
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1824
1844
|
asChild: !0,
|
|
1825
|
-
children: /* @__PURE__ */
|
|
1845
|
+
children: /* @__PURE__ */ I(l, {
|
|
1826
1846
|
variant: "ghost",
|
|
1827
1847
|
size: "sm",
|
|
1828
1848
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1829
|
-
children: [/* @__PURE__ */
|
|
1849
|
+
children: [/* @__PURE__ */ F(oe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1830
1850
|
className: "hidden sm:inline",
|
|
1831
|
-
children:
|
|
1851
|
+
children: E("list.export")
|
|
1832
1852
|
})]
|
|
1833
1853
|
})
|
|
1834
|
-
}), /* @__PURE__ */
|
|
1854
|
+
}), /* @__PURE__ */ F(C, {
|
|
1835
1855
|
align: "start",
|
|
1836
1856
|
className: "w-48 p-2",
|
|
1837
|
-
children: /* @__PURE__ */
|
|
1857
|
+
children: /* @__PURE__ */ F("div", {
|
|
1838
1858
|
className: "space-y-1",
|
|
1839
|
-
children: (
|
|
1859
|
+
children: (At.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ I(l, {
|
|
1840
1860
|
variant: "ghost",
|
|
1841
1861
|
size: "sm",
|
|
1842
1862
|
className: "w-full justify-start h-8 text-xs",
|
|
1843
|
-
onClick: () =>
|
|
1844
|
-
children: [/* @__PURE__ */
|
|
1863
|
+
onClick: () => Yt(e),
|
|
1864
|
+
children: [/* @__PURE__ */ F(oe, { className: "h-3.5 w-3.5 mr-2" }), E("list.exportAs", { format: e.toUpperCase() })]
|
|
1845
1865
|
}, e))
|
|
1846
1866
|
})
|
|
1847
1867
|
})]
|
|
1848
1868
|
}),
|
|
1849
|
-
(
|
|
1869
|
+
(A.sharing?.enabled || A.sharing?.type) && /* @__PURE__ */ I(l, {
|
|
1850
1870
|
variant: "ghost",
|
|
1851
1871
|
size: "sm",
|
|
1852
1872
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1853
|
-
title: `Sharing: ${
|
|
1873
|
+
title: `Sharing: ${A.sharing?.visibility || A.sharing?.type || "private"}`,
|
|
1854
1874
|
"data-testid": "share-button",
|
|
1855
|
-
children: [/* @__PURE__ */
|
|
1875
|
+
children: [/* @__PURE__ */ F(xe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1856
1876
|
className: "hidden sm:inline",
|
|
1857
|
-
children:
|
|
1877
|
+
children: E("list.share")
|
|
1858
1878
|
})]
|
|
1859
1879
|
}),
|
|
1860
|
-
|
|
1880
|
+
A.allowPrinting && /* @__PURE__ */ I(l, {
|
|
1861
1881
|
variant: "ghost",
|
|
1862
1882
|
size: "sm",
|
|
1863
1883
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1864
1884
|
onClick: () => window.print(),
|
|
1865
1885
|
"data-testid": "print-button",
|
|
1866
|
-
children: [/* @__PURE__ */
|
|
1886
|
+
children: [/* @__PURE__ */ F(me, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1867
1887
|
className: "hidden sm:inline",
|
|
1868
|
-
children:
|
|
1888
|
+
children: E("list.print")
|
|
1869
1889
|
})]
|
|
1870
1890
|
}),
|
|
1871
1891
|
(() => {
|
|
1872
|
-
let e =
|
|
1873
|
-
return
|
|
1892
|
+
let e = A.allowPrinting || A.sharing?.enabled || A.sharing?.type || At && A.allowExport !== !1;
|
|
1893
|
+
return M.showSearch && e ? /* @__PURE__ */ F("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }) : null;
|
|
1874
1894
|
})(),
|
|
1875
|
-
|
|
1876
|
-
open:
|
|
1877
|
-
onOpenChange:
|
|
1878
|
-
children: [/* @__PURE__ */
|
|
1895
|
+
M.showSearch && /* @__PURE__ */ I(S, {
|
|
1896
|
+
open: De,
|
|
1897
|
+
onOpenChange: Oe,
|
|
1898
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1879
1899
|
asChild: !0,
|
|
1880
|
-
children: /* @__PURE__ */
|
|
1900
|
+
children: /* @__PURE__ */ F(l, {
|
|
1881
1901
|
variant: "ghost",
|
|
1882
1902
|
size: "sm",
|
|
1883
|
-
className:
|
|
1903
|
+
className: T("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", P && "text-foreground font-medium"),
|
|
1884
1904
|
"data-testid": "search-icon-button",
|
|
1885
|
-
title:
|
|
1886
|
-
children: /* @__PURE__ */
|
|
1905
|
+
title: E("list.search"),
|
|
1906
|
+
children: /* @__PURE__ */ F(ye, { className: "h-3.5 w-3.5" })
|
|
1887
1907
|
})
|
|
1888
|
-
}), /* @__PURE__ */
|
|
1908
|
+
}), /* @__PURE__ */ F(C, {
|
|
1889
1909
|
align: "end",
|
|
1890
1910
|
className: "w-[calc(100vw-2rem)] sm:w-64 p-2",
|
|
1891
1911
|
"data-testid": "search-popover",
|
|
1892
|
-
children: /* @__PURE__ */
|
|
1912
|
+
children: /* @__PURE__ */ I("div", {
|
|
1893
1913
|
className: "relative",
|
|
1894
1914
|
children: [
|
|
1895
|
-
/* @__PURE__ */
|
|
1896
|
-
/* @__PURE__ */
|
|
1897
|
-
placeholder:
|
|
1898
|
-
value:
|
|
1899
|
-
onChange: (e) =>
|
|
1915
|
+
/* @__PURE__ */ F(ye, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
1916
|
+
/* @__PURE__ */ F(y, {
|
|
1917
|
+
placeholder: E("list.search") + "...",
|
|
1918
|
+
value: P,
|
|
1919
|
+
onChange: (e) => Wt(e.target.value),
|
|
1900
1920
|
className: "pl-7 h-8 text-xs",
|
|
1901
1921
|
autoFocus: !0
|
|
1902
1922
|
}),
|
|
1903
|
-
|
|
1923
|
+
P && /* @__PURE__ */ F(l, {
|
|
1904
1924
|
variant: "ghost",
|
|
1905
1925
|
size: "sm",
|
|
1906
1926
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
1907
|
-
onClick: () =>
|
|
1908
|
-
children: /* @__PURE__ */
|
|
1927
|
+
onClick: () => Wt(""),
|
|
1928
|
+
children: /* @__PURE__ */ F(we, { className: "h-3 w-3" })
|
|
1909
1929
|
})
|
|
1910
1930
|
]
|
|
1911
1931
|
})
|
|
1912
1932
|
})]
|
|
1913
1933
|
}),
|
|
1914
|
-
|
|
1934
|
+
M.showAddRecord && M.addRecordPosition === "top" && /* @__PURE__ */ I(l, {
|
|
1915
1935
|
variant: "ghost",
|
|
1916
1936
|
size: "sm",
|
|
1917
1937
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1918
1938
|
"data-testid": "add-record-button",
|
|
1919
1939
|
onClick: () => g.onAddRecord?.(),
|
|
1920
|
-
children: [/* @__PURE__ */
|
|
1940
|
+
children: [/* @__PURE__ */ F(pe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1921
1941
|
className: "hidden sm:inline",
|
|
1922
|
-
children:
|
|
1942
|
+
children: E("list.addRecord")
|
|
1923
1943
|
})]
|
|
1924
1944
|
})
|
|
1925
1945
|
]
|
|
1926
1946
|
})]
|
|
1927
1947
|
}),
|
|
1928
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ I("div", {
|
|
1929
1949
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
1930
|
-
children: [/* @__PURE__ */
|
|
1950
|
+
children: [/* @__PURE__ */ F(ee, { active: H && V.length > 0 }), We && V.length === 0 ? /* @__PURE__ */ F(f, {
|
|
1931
1951
|
"data-testid": "list-error-state",
|
|
1932
1952
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
1933
|
-
icon: /* @__PURE__ */
|
|
1953
|
+
icon: /* @__PURE__ */ F(re, { className: "h-12 w-12 text-destructive/60" }),
|
|
1934
1954
|
iconWrapperClassName: "mb-3",
|
|
1935
|
-
title:
|
|
1936
|
-
description:
|
|
1937
|
-
action: /* @__PURE__ */
|
|
1955
|
+
title: E("list.loadErrorTitle"),
|
|
1956
|
+
description: E("list.loadErrorMessage"),
|
|
1957
|
+
action: /* @__PURE__ */ I(l, {
|
|
1938
1958
|
variant: "outline",
|
|
1939
1959
|
size: "sm",
|
|
1940
1960
|
"data-testid": "list-error-retry",
|
|
1941
|
-
onClick: () =>
|
|
1942
|
-
children: [/* @__PURE__ */
|
|
1961
|
+
onClick: () => G((e) => e + 1),
|
|
1962
|
+
children: [/* @__PURE__ */ F(he, { className: "h-4 w-4 mr-1.5" }), E("list.retry")]
|
|
1943
1963
|
})
|
|
1944
|
-
}) :
|
|
1964
|
+
}) : H && V.length === 0 ? /* @__PURE__ */ I("div", {
|
|
1945
1965
|
className: "flex flex-col h-full min-h-[200px] p-4 gap-2",
|
|
1946
1966
|
"data-testid": "list-loading",
|
|
1947
1967
|
role: "status",
|
|
1948
1968
|
"aria-live": "polite",
|
|
1949
1969
|
"aria-busy": "true",
|
|
1950
|
-
children: [/* @__PURE__ */
|
|
1970
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1951
1971
|
className: "sr-only",
|
|
1952
|
-
children:
|
|
1972
|
+
children: E("list.loading")
|
|
1953
1973
|
}), [
|
|
1954
1974
|
0,
|
|
1955
1975
|
1,
|
|
@@ -1957,112 +1977,122 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
1957
1977
|
3,
|
|
1958
1978
|
4,
|
|
1959
1979
|
5
|
|
1960
|
-
].map((e) => /* @__PURE__ */
|
|
1980
|
+
].map((e) => /* @__PURE__ */ F("div", {
|
|
1961
1981
|
className: "h-9 rounded bg-muted/60 animate-pulse",
|
|
1962
1982
|
style: { opacity: Math.max(.25, 1 - e * .12) }
|
|
1963
1983
|
}, e))]
|
|
1964
|
-
}) : !
|
|
1965
|
-
let e =
|
|
1966
|
-
return /* @__PURE__ */
|
|
1984
|
+
}) : !H && V.length === 0 && N === "grid" ? (() => {
|
|
1985
|
+
let e = A.emptyState?.icon, t = e ? Te[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? ue : ue, n = !!(P && P.trim()) || Array.isArray(bt) && bt.length > 0 || Array.isArray(z?.conditions) && z.conditions.length > 0, r = (typeof A.emptyState?.title == "string" ? A.emptyState.title : void 0) ?? E(n ? "list.noMatches" : "list.firstRunTitle"), i = (typeof A.emptyState?.message == "string" ? A.emptyState.message : void 0) ?? E(n ? "list.noMatchesMessage" : "list.firstRunMessage");
|
|
1986
|
+
return /* @__PURE__ */ F(f, {
|
|
1967
1987
|
"data-testid": "empty-state",
|
|
1968
1988
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
1969
|
-
icon: /* @__PURE__ */
|
|
1989
|
+
icon: /* @__PURE__ */ F(t, { className: "h-12 w-12 text-muted-foreground/50" }),
|
|
1970
1990
|
iconWrapperClassName: "mb-3",
|
|
1971
1991
|
title: r,
|
|
1972
1992
|
description: i,
|
|
1973
|
-
action:
|
|
1993
|
+
action: M.showAddRecord ? /* @__PURE__ */ I(l, {
|
|
1974
1994
|
variant: "default",
|
|
1975
1995
|
size: "sm",
|
|
1976
1996
|
"data-testid": "empty-state-add-record",
|
|
1977
1997
|
onClick: () => g.onAddRecord?.(),
|
|
1978
|
-
children: [/* @__PURE__ */
|
|
1998
|
+
children: [/* @__PURE__ */ F(pe, { className: "h-4 w-4 mr-1.5" }), E("list.addRecord")]
|
|
1979
1999
|
}) : void 0
|
|
1980
2000
|
});
|
|
1981
|
-
})() : /* @__PURE__ */
|
|
1982
|
-
schema:
|
|
2001
|
+
})() : /* @__PURE__ */ F(Ae, {
|
|
2002
|
+
schema: Kt,
|
|
1983
2003
|
...g,
|
|
1984
|
-
data:
|
|
1985
|
-
loading:
|
|
1986
|
-
onRowSelect:
|
|
2004
|
+
data: V,
|
|
2005
|
+
loading: H,
|
|
2006
|
+
onRowSelect: vt,
|
|
2007
|
+
...N === "grid" && !J?.fields?.length && ct != null ? {
|
|
2008
|
+
manualPagination: !0,
|
|
2009
|
+
rowCount: ct,
|
|
2010
|
+
page: ot,
|
|
2011
|
+
pageSize: K,
|
|
2012
|
+
onPageChange: (e) => st(e),
|
|
2013
|
+
onPageSizeChange: (e) => {
|
|
2014
|
+
at(e), st(1);
|
|
2015
|
+
}
|
|
2016
|
+
} : {}
|
|
1987
2017
|
})]
|
|
1988
|
-
},
|
|
1989
|
-
|
|
2018
|
+
}, N),
|
|
2019
|
+
M.showAddRecord && M.addRecordPosition === "bottom" && /* @__PURE__ */ F("div", {
|
|
1990
2020
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
1991
|
-
children: /* @__PURE__ */
|
|
2021
|
+
children: /* @__PURE__ */ I(l, {
|
|
1992
2022
|
variant: "ghost",
|
|
1993
2023
|
size: "sm",
|
|
1994
2024
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1995
2025
|
"data-testid": "add-record-button",
|
|
1996
2026
|
onClick: () => g.onAddRecord?.(),
|
|
1997
|
-
children: [/* @__PURE__ */
|
|
2027
|
+
children: [/* @__PURE__ */ F(pe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1998
2028
|
className: "hidden sm:inline",
|
|
1999
|
-
children:
|
|
2029
|
+
children: E("list.addRecord")
|
|
2000
2030
|
})]
|
|
2001
2031
|
})
|
|
2002
2032
|
}),
|
|
2003
|
-
|
|
2033
|
+
A.bulkActions && A.bulkActions.length > 0 && _t.length > 0 && N !== "grid" && /* @__PURE__ */ I("div", {
|
|
2004
2034
|
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",
|
|
2005
2035
|
role: "region",
|
|
2006
2036
|
"aria-label": "Bulk actions",
|
|
2007
2037
|
"data-testid": "bulk-actions-bar",
|
|
2008
2038
|
children: [
|
|
2009
|
-
/* @__PURE__ */
|
|
2010
|
-
/* @__PURE__ */
|
|
2039
|
+
/* @__PURE__ */ F(ae, { className: "h-3.5 w-3.5 text-primary shrink-0" }),
|
|
2040
|
+
/* @__PURE__ */ I("span", {
|
|
2011
2041
|
className: "font-medium",
|
|
2012
2042
|
children: [
|
|
2013
|
-
|
|
2043
|
+
_t.length,
|
|
2014
2044
|
" ",
|
|
2015
|
-
|
|
2045
|
+
_t.length === 1 ? "item" : "items",
|
|
2016
2046
|
" selected"
|
|
2017
2047
|
]
|
|
2018
2048
|
}),
|
|
2019
|
-
/* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ F("div", {
|
|
2020
2050
|
className: "flex items-center gap-1.5 ml-3",
|
|
2021
|
-
children:
|
|
2022
|
-
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ?
|
|
2023
|
-
return /* @__PURE__ */
|
|
2051
|
+
children: A.bulkActions.map((e) => {
|
|
2052
|
+
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ? Ce : null;
|
|
2053
|
+
return /* @__PURE__ */ I(l, {
|
|
2024
2054
|
variant: n ? "destructive" : "outline",
|
|
2025
2055
|
size: "sm",
|
|
2026
2056
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
2027
|
-
onClick: () => g.onBulkAction?.(e,
|
|
2057
|
+
onClick: () => g.onBulkAction?.(e, _t),
|
|
2028
2058
|
"data-testid": `bulk-action-${e}`,
|
|
2029
|
-
children: [r && /* @__PURE__ */
|
|
2059
|
+
children: [r && /* @__PURE__ */ F(r, { className: "h-3 w-3" }), ce(e)]
|
|
2030
2060
|
}, e);
|
|
2031
2061
|
})
|
|
2032
2062
|
}),
|
|
2033
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ I(l, {
|
|
2034
2064
|
variant: "ghost",
|
|
2035
2065
|
size: "sm",
|
|
2036
2066
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
2037
|
-
onClick: () =>
|
|
2038
|
-
children: [/* @__PURE__ */
|
|
2067
|
+
onClick: () => vt([]),
|
|
2068
|
+
children: [/* @__PURE__ */ F(we, { className: "h-3 w-3" }), "Clear"]
|
|
2039
2069
|
})
|
|
2040
2070
|
]
|
|
2041
2071
|
}),
|
|
2042
|
-
!
|
|
2072
|
+
!H && V.length > 0 && A.showRecordCount !== !1 && /* @__PURE__ */ I("div", {
|
|
2043
2073
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
2044
2074
|
"data-testid": "record-count-bar",
|
|
2045
2075
|
children: [
|
|
2046
|
-
/* @__PURE__ */
|
|
2076
|
+
/* @__PURE__ */ F("span", {
|
|
2047
2077
|
className: "font-medium text-foreground/80",
|
|
2048
|
-
children:
|
|
2078
|
+
children: V.length === 1 ? E("list.recordCountOne", { count: V.length }) : E("list.recordCount", { count: V.length })
|
|
2049
2079
|
}),
|
|
2050
|
-
|
|
2080
|
+
nt && /* @__PURE__ */ F("span", {
|
|
2051
2081
|
className: "text-amber-600",
|
|
2052
2082
|
"data-testid": "data-limit-warning",
|
|
2053
|
-
children:
|
|
2083
|
+
children: E("list.dataLimitReached", { limit: K })
|
|
2054
2084
|
}),
|
|
2055
|
-
|
|
2085
|
+
N !== "grid" && A.pagination?.pageSizeOptions && A.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ I("div", {
|
|
2056
2086
|
className: "ml-auto flex items-center gap-2",
|
|
2057
|
-
children: [/* @__PURE__ */
|
|
2087
|
+
children: [/* @__PURE__ */ F("span", { children: E("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ F("select", {
|
|
2058
2088
|
"data-testid": "page-size-selector",
|
|
2059
2089
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
2060
|
-
value: String(
|
|
2090
|
+
value: String(K),
|
|
2061
2091
|
onChange: (e) => {
|
|
2062
2092
|
let t = Number(e.target.value);
|
|
2063
|
-
|
|
2093
|
+
at(t), g.onPageSizeChange && g.onPageSizeChange(t);
|
|
2064
2094
|
},
|
|
2065
|
-
children:
|
|
2095
|
+
children: A.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ F("option", {
|
|
2066
2096
|
value: String(e),
|
|
2067
2097
|
children: e
|
|
2068
2098
|
}, e))
|
|
@@ -2070,17 +2100,17 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
2070
2100
|
})
|
|
2071
2101
|
]
|
|
2072
2102
|
}),
|
|
2073
|
-
|
|
2074
|
-
...
|
|
2075
|
-
title:
|
|
2076
|
-
children: (e) => /* @__PURE__ */
|
|
2103
|
+
Gt.isOverlay && /* @__PURE__ */ F(x, {
|
|
2104
|
+
...Gt,
|
|
2105
|
+
title: A.label ? `${A.label} Detail` : A.objectName ? `${A.objectName.charAt(0).toUpperCase() + A.objectName.slice(1)} Detail` : "Record Detail",
|
|
2106
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
2077
2107
|
className: "space-y-3",
|
|
2078
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
2108
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
2079
2109
|
className: "flex flex-col",
|
|
2080
|
-
children: [/* @__PURE__ */
|
|
2110
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2081
2111
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
2082
2112
|
children: e.replace(/_/g, " ")
|
|
2083
|
-
}), /* @__PURE__ */
|
|
2113
|
+
}), /* @__PURE__ */ F("span", {
|
|
2084
2114
|
className: "text-sm",
|
|
2085
2115
|
children: String(t ?? "—")
|
|
2086
2116
|
})]
|
|
@@ -2090,24 +2120,24 @@ var rt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChang
|
|
|
2090
2120
|
]
|
|
2091
2121
|
});
|
|
2092
2122
|
});
|
|
2093
|
-
|
|
2123
|
+
nt.displayName = "ListView";
|
|
2094
2124
|
//#endregion
|
|
2095
2125
|
//#region src/ObjectGallery.tsx
|
|
2096
|
-
var
|
|
2126
|
+
var rt = {
|
|
2097
2127
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
2098
2128
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
2099
2129
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
2100
|
-
},
|
|
2130
|
+
}, it = {
|
|
2101
2131
|
small: "aspect-square",
|
|
2102
2132
|
medium: "aspect-[4/3]",
|
|
2103
2133
|
large: "aspect-[16/10]"
|
|
2104
|
-
},
|
|
2134
|
+
}, at = new Set([
|
|
2105
2135
|
"number",
|
|
2106
2136
|
"currency",
|
|
2107
2137
|
"percent",
|
|
2108
2138
|
"integer",
|
|
2109
2139
|
"decimal"
|
|
2110
|
-
]),
|
|
2140
|
+
]), K = [
|
|
2111
2141
|
{
|
|
2112
2142
|
bg: "from-indigo-500/15 via-indigo-500/5 to-purple-500/10",
|
|
2113
2143
|
ring: "ring-indigo-500/15",
|
|
@@ -2139,60 +2169,60 @@ var it = {
|
|
|
2139
2169
|
text: "text-violet-600/70 dark:text-violet-300/70"
|
|
2140
2170
|
}
|
|
2141
2171
|
];
|
|
2142
|
-
function
|
|
2172
|
+
function ot(e) {
|
|
2143
2173
|
let t = 5381;
|
|
2144
2174
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n);
|
|
2145
|
-
return
|
|
2175
|
+
return K[Math.abs(t) % K.length];
|
|
2146
2176
|
}
|
|
2147
|
-
var
|
|
2177
|
+
var st = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, hidden: a }) => {
|
|
2148
2178
|
let [o, s] = c(!1), l = !!e && !o;
|
|
2149
|
-
return /* @__PURE__ */
|
|
2150
|
-
className:
|
|
2179
|
+
return /* @__PURE__ */ F("div", {
|
|
2180
|
+
className: T("w-full overflow-hidden relative", r),
|
|
2151
2181
|
hidden: a,
|
|
2152
|
-
children: l ? n === "contain" ? /* @__PURE__ */
|
|
2153
|
-
className:
|
|
2154
|
-
children: /* @__PURE__ */
|
|
2182
|
+
children: l ? n === "contain" ? /* @__PURE__ */ F("div", {
|
|
2183
|
+
className: T("flex h-full w-full items-center justify-center bg-gradient-to-br", i.bg),
|
|
2184
|
+
children: /* @__PURE__ */ F("img", {
|
|
2155
2185
|
src: e,
|
|
2156
2186
|
alt: t,
|
|
2157
2187
|
loading: "lazy",
|
|
2158
2188
|
onError: () => s(!0),
|
|
2159
2189
|
className: "h-1/2 w-1/2 max-h-24 max-w-24 object-contain transition-transform duration-300 ease-out group-hover:scale-[1.08]"
|
|
2160
2190
|
})
|
|
2161
|
-
}) : /* @__PURE__ */
|
|
2191
|
+
}) : /* @__PURE__ */ F("img", {
|
|
2162
2192
|
src: e,
|
|
2163
2193
|
alt: t,
|
|
2164
2194
|
loading: "lazy",
|
|
2165
2195
|
onError: () => s(!0),
|
|
2166
2196
|
className: "h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-[1.04]"
|
|
2167
|
-
}) : /* @__PURE__ */
|
|
2168
|
-
className:
|
|
2169
|
-
children: /* @__PURE__ */
|
|
2170
|
-
className:
|
|
2197
|
+
}) : /* @__PURE__ */ F("div", {
|
|
2198
|
+
className: T("flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset", i.bg, i.ring),
|
|
2199
|
+
children: /* @__PURE__ */ F("span", {
|
|
2200
|
+
className: T("text-5xl font-semibold tracking-tight opacity-90", i.text),
|
|
2171
2201
|
children: t[0]?.toUpperCase()
|
|
2172
2202
|
})
|
|
2173
2203
|
})
|
|
2174
2204
|
});
|
|
2175
|
-
},
|
|
2205
|
+
}, ct = ({ imageUrl: e, title: t, placeholder: n }) => {
|
|
2176
2206
|
let [r, i] = c(!1), a = !!e && !r;
|
|
2177
|
-
return /* @__PURE__ */
|
|
2178
|
-
className:
|
|
2179
|
-
children: a ? /* @__PURE__ */
|
|
2207
|
+
return /* @__PURE__ */ F("div", {
|
|
2208
|
+
className: T("flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset", n.bg, n.ring),
|
|
2209
|
+
children: a ? /* @__PURE__ */ F("img", {
|
|
2180
2210
|
src: e,
|
|
2181
2211
|
alt: t,
|
|
2182
2212
|
loading: "lazy",
|
|
2183
2213
|
onError: () => i(!0),
|
|
2184
2214
|
className: "h-6 w-6 object-contain transition-transform duration-300 ease-out group-hover:scale-110"
|
|
2185
|
-
}) : /* @__PURE__ */
|
|
2186
|
-
className:
|
|
2215
|
+
}) : /* @__PURE__ */ F("span", {
|
|
2216
|
+
className: T("text-base font-semibold", n.text),
|
|
2187
2217
|
children: t[0]?.toUpperCase()
|
|
2188
2218
|
})
|
|
2189
2219
|
});
|
|
2190
|
-
},
|
|
2191
|
-
let { schema: n } = e, r = a(
|
|
2220
|
+
}, lt = (e) => {
|
|
2221
|
+
let { schema: n } = e, r = a(je), l = e.dataSource || r?.dataSource, f = Me(n.bind), [p, m] = c([]), [h, g] = c(!1), [_, v] = c(null), y = Pe({
|
|
2192
2222
|
navigation: n.navigation,
|
|
2193
2223
|
objectName: n.objectName,
|
|
2194
2224
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
2195
|
-
}),
|
|
2225
|
+
}), b = n.gallery, S = b?.coverField ?? n.imageField ?? "image", C = b?.coverFit ?? "cover", w = b?.cardSize ?? "medium", ee = b?.titleField ?? n.titleField ?? "name", te = b?.visibleFields, { fieldLabel: ne, fieldOptionLabel: re } = L(), ie = i((e) => {
|
|
2196
2226
|
let t = _?.fields?.[e], r = { name: e };
|
|
2197
2227
|
if (t) {
|
|
2198
2228
|
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);
|
|
@@ -2201,28 +2231,28 @@ var q = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2201
2231
|
}
|
|
2202
2232
|
if (n.objectName) {
|
|
2203
2233
|
let t = String(r.label ?? e);
|
|
2204
|
-
r.label =
|
|
2234
|
+
r.label = ne(n.objectName, e, t);
|
|
2205
2235
|
}
|
|
2206
2236
|
return n.objectName && Array.isArray(r.options) && (r.options = r.options.map((t) => {
|
|
2207
2237
|
let r = String(t?.value ?? t), i = String(t?.label ?? r);
|
|
2208
2238
|
return {
|
|
2209
2239
|
...t,
|
|
2210
2240
|
value: r,
|
|
2211
|
-
label:
|
|
2241
|
+
label: re(n.objectName, e, r, i)
|
|
2212
2242
|
};
|
|
2213
2243
|
})), r;
|
|
2214
2244
|
}, [
|
|
2215
2245
|
_,
|
|
2216
2246
|
n.objectName,
|
|
2217
|
-
|
|
2218
|
-
|
|
2247
|
+
ne,
|
|
2248
|
+
re
|
|
2219
2249
|
]);
|
|
2220
2250
|
o(() => {
|
|
2221
2251
|
let e = !0;
|
|
2222
2252
|
return (async () => {
|
|
2223
2253
|
if (!(!l || typeof l.getObjectSchema != "function" || !n.objectName)) try {
|
|
2224
2254
|
let t = await l.getObjectSchema(n.objectName);
|
|
2225
|
-
e &&
|
|
2255
|
+
e && v(t);
|
|
2226
2256
|
} catch (e) {
|
|
2227
2257
|
console.warn("Failed to fetch object def for ObjectGallery", e);
|
|
2228
2258
|
}
|
|
@@ -2267,18 +2297,18 @@ var q = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2267
2297
|
e.data,
|
|
2268
2298
|
_
|
|
2269
2299
|
]);
|
|
2270
|
-
let
|
|
2271
|
-
|
|
2300
|
+
let E = e.data || f || n.data || p || [], D = s(() => E.some((e) => typeof e[S] == "string" && !!e[S]), [E, S]), O = n.grouping?.fields, ae = !!(O && O.length > 0), [oe, se] = c({}), j = s(() => O ? O.some((e) => e.collapsed) : !1, [O]), ce = i((e) => {
|
|
2301
|
+
se((t) => ({
|
|
2272
2302
|
...t,
|
|
2273
|
-
[e]: t[e] === void 0 ? !
|
|
2303
|
+
[e]: t[e] === void 0 ? !j : !t[e]
|
|
2274
2304
|
}));
|
|
2275
|
-
}, [
|
|
2276
|
-
if (!
|
|
2305
|
+
}, [j]), le = s(() => {
|
|
2306
|
+
if (!ae || !O) return [];
|
|
2277
2307
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
2278
|
-
for (let n of
|
|
2279
|
-
let r =
|
|
2308
|
+
for (let n of E) {
|
|
2309
|
+
let r = O.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
2280
2310
|
if (!e.has(r)) {
|
|
2281
|
-
let i =
|
|
2311
|
+
let i = O.map((e) => {
|
|
2282
2312
|
let t = n[e.field];
|
|
2283
2313
|
return t != null && t !== "" ? String(t) : "(empty)";
|
|
2284
2314
|
}).join(" / ");
|
|
@@ -2289,7 +2319,7 @@ var q = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2289
2319
|
}
|
|
2290
2320
|
e.get(r).items.push(n);
|
|
2291
2321
|
}
|
|
2292
|
-
let n =
|
|
2322
|
+
let n = O[0]?.order ?? "asc";
|
|
2293
2323
|
return t.sort((e, t) => {
|
|
2294
2324
|
let r = e.localeCompare(t, void 0, {
|
|
2295
2325
|
numeric: !0,
|
|
@@ -2297,7 +2327,7 @@ var q = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2297
2327
|
});
|
|
2298
2328
|
return n === "desc" ? -r : r;
|
|
2299
2329
|
}), t.map((t) => {
|
|
2300
|
-
let n = e.get(t), r = t in
|
|
2330
|
+
let n = e.get(t), r = t in oe ? oe[t] : j;
|
|
2301
2331
|
return {
|
|
2302
2332
|
key: t,
|
|
2303
2333
|
label: n.label,
|
|
@@ -2306,128 +2336,128 @@ var q = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2306
2336
|
};
|
|
2307
2337
|
});
|
|
2308
2338
|
}, [
|
|
2309
|
-
|
|
2310
|
-
|
|
2339
|
+
E,
|
|
2340
|
+
O,
|
|
2341
|
+
ae,
|
|
2311
2342
|
oe,
|
|
2312
|
-
|
|
2313
|
-
A
|
|
2343
|
+
j
|
|
2314
2344
|
]);
|
|
2315
|
-
if (h && !
|
|
2345
|
+
if (h && !E.length) return /* @__PURE__ */ F("div", {
|
|
2316
2346
|
className: "p-4 text-sm text-muted-foreground",
|
|
2317
2347
|
children: "Loading Gallery..."
|
|
2318
2348
|
});
|
|
2319
|
-
if (!
|
|
2349
|
+
if (!E.length) return /* @__PURE__ */ F("div", {
|
|
2320
2350
|
className: "p-4 text-sm text-muted-foreground",
|
|
2321
2351
|
children: "No items to display"
|
|
2322
2352
|
});
|
|
2323
|
-
let
|
|
2353
|
+
let M = (e) => !te || te.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
2324
2354
|
className: "mt-1.5 space-y-1",
|
|
2325
|
-
children:
|
|
2355
|
+
children: te.map((t) => {
|
|
2326
2356
|
let n = e[t];
|
|
2327
2357
|
if (n == null || n === "") return null;
|
|
2328
|
-
let r =
|
|
2329
|
-
return /* @__PURE__ */
|
|
2330
|
-
className:
|
|
2358
|
+
let r = ie(t), i = Re(r) || r.type || "text", a = Le(i), o = r?.label && String(r.label).trim() ? String(r.label) : void 0, s = o != null && at.has(i);
|
|
2359
|
+
return /* @__PURE__ */ I("div", {
|
|
2360
|
+
className: T("text-xs text-muted-foreground truncate [&_*]:!text-xs", s && "flex items-baseline gap-1.5"),
|
|
2331
2361
|
onClick: (e) => {
|
|
2332
2362
|
e.target.closest("a,button") && e.stopPropagation();
|
|
2333
2363
|
},
|
|
2334
|
-
children: [s && /* @__PURE__ */
|
|
2364
|
+
children: [s && /* @__PURE__ */ F("span", {
|
|
2335
2365
|
className: "shrink-0 text-muted-foreground/70 tabular-nums",
|
|
2336
2366
|
children: o
|
|
2337
|
-
}), /* @__PURE__ */
|
|
2367
|
+
}), /* @__PURE__ */ F(a, {
|
|
2338
2368
|
value: n,
|
|
2339
2369
|
field: r
|
|
2340
2370
|
})]
|
|
2341
2371
|
}, t);
|
|
2342
2372
|
})
|
|
2343
|
-
}),
|
|
2344
|
-
let i = t.id ?? t._id ?? r, a = String(t[
|
|
2345
|
-
return
|
|
2373
|
+
}), ue = (t, r) => {
|
|
2374
|
+
let i = t.id ?? t._id ?? r, a = String(t[ee] ?? "Untitled"), o = t[S], s = ot(String(i) + "|" + a), c = T("group relative overflow-hidden border-border/60 bg-card", "transition-all duration-200 ease-out", "hover:shadow-lg hover:border-border hover:-translate-y-0.5", (e.onCardClick || e.onRowClick || n.navigation) && "cursor-pointer");
|
|
2375
|
+
return D && C === "contain" ? /* @__PURE__ */ I(u, {
|
|
2346
2376
|
role: "listitem",
|
|
2347
2377
|
className: c,
|
|
2348
|
-
onClick: (e) =>
|
|
2349
|
-
children: [/* @__PURE__ */
|
|
2378
|
+
onClick: (e) => y.handleClick(t, e),
|
|
2379
|
+
children: [/* @__PURE__ */ F("div", {
|
|
2350
2380
|
"aria-hidden": !0,
|
|
2351
|
-
className:
|
|
2352
|
-
}), /* @__PURE__ */
|
|
2381
|
+
className: T("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", s.bg)
|
|
2382
|
+
}), /* @__PURE__ */ F(d, {
|
|
2353
2383
|
className: "p-4",
|
|
2354
|
-
children: /* @__PURE__ */
|
|
2384
|
+
children: /* @__PURE__ */ I("div", {
|
|
2355
2385
|
className: "flex items-start gap-3",
|
|
2356
|
-
children: [/* @__PURE__ */
|
|
2386
|
+
children: [/* @__PURE__ */ F(ct, {
|
|
2357
2387
|
imageUrl: o,
|
|
2358
2388
|
title: a,
|
|
2359
2389
|
placeholder: s
|
|
2360
|
-
}), /* @__PURE__ */
|
|
2390
|
+
}), /* @__PURE__ */ I("div", {
|
|
2361
2391
|
className: "min-w-0 flex-1",
|
|
2362
|
-
children: [/* @__PURE__ */
|
|
2392
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
2363
2393
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2364
2394
|
title: a,
|
|
2365
2395
|
children: a
|
|
2366
|
-
}),
|
|
2396
|
+
}), M(t)]
|
|
2367
2397
|
})]
|
|
2368
2398
|
})
|
|
2369
2399
|
})]
|
|
2370
|
-
}, i) : /* @__PURE__ */
|
|
2400
|
+
}, i) : /* @__PURE__ */ I(u, {
|
|
2371
2401
|
role: "listitem",
|
|
2372
2402
|
className: c,
|
|
2373
|
-
onClick: (e) =>
|
|
2403
|
+
onClick: (e) => y.handleClick(t, e),
|
|
2374
2404
|
children: [
|
|
2375
|
-
!
|
|
2405
|
+
!D && /* @__PURE__ */ F("div", {
|
|
2376
2406
|
"aria-hidden": !0,
|
|
2377
|
-
className:
|
|
2407
|
+
className: T("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", s.bg)
|
|
2378
2408
|
}),
|
|
2379
|
-
/* @__PURE__ */
|
|
2409
|
+
/* @__PURE__ */ F(st, {
|
|
2380
2410
|
imageUrl: o,
|
|
2381
2411
|
title: a,
|
|
2382
|
-
coverFit:
|
|
2383
|
-
aspectClass:
|
|
2412
|
+
coverFit: C,
|
|
2413
|
+
aspectClass: it[w],
|
|
2384
2414
|
placeholder: s,
|
|
2385
|
-
hidden: !
|
|
2415
|
+
hidden: !D
|
|
2386
2416
|
}),
|
|
2387
|
-
/* @__PURE__ */
|
|
2388
|
-
className:
|
|
2389
|
-
children: [/* @__PURE__ */
|
|
2417
|
+
/* @__PURE__ */ I(d, {
|
|
2418
|
+
className: T("p-3", D && "border-t border-border/60"),
|
|
2419
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
2390
2420
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2391
2421
|
title: a,
|
|
2392
2422
|
children: a
|
|
2393
|
-
}),
|
|
2423
|
+
}), M(t)]
|
|
2394
2424
|
})
|
|
2395
2425
|
]
|
|
2396
2426
|
}, i);
|
|
2397
|
-
},
|
|
2398
|
-
className:
|
|
2427
|
+
}, N = (e) => /* @__PURE__ */ F("div", {
|
|
2428
|
+
className: T("grid gap-4 p-4 auto-rows-min content-start", rt[w], n.className),
|
|
2399
2429
|
role: "list",
|
|
2400
|
-
children: e.map((e, t) =>
|
|
2430
|
+
children: e.map((e, t) => ue(e, t))
|
|
2401
2431
|
});
|
|
2402
|
-
return /* @__PURE__ */
|
|
2432
|
+
return /* @__PURE__ */ I(Ee, { children: [ae ? /* @__PURE__ */ F("div", {
|
|
2403
2433
|
className: "space-y-2",
|
|
2404
|
-
children:
|
|
2434
|
+
children: le.map((e) => /* @__PURE__ */ I("div", {
|
|
2405
2435
|
className: "border rounded-md",
|
|
2406
|
-
children: [/* @__PURE__ */
|
|
2436
|
+
children: [/* @__PURE__ */ I("button", {
|
|
2407
2437
|
type: "button",
|
|
2408
2438
|
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",
|
|
2409
|
-
onClick: () =>
|
|
2439
|
+
onClick: () => ce(e.key),
|
|
2410
2440
|
children: [
|
|
2411
|
-
e.collapsed ? /* @__PURE__ */
|
|
2412
|
-
/* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2441
|
+
e.collapsed ? /* @__PURE__ */ F(A, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ F(k, { className: "h-4 w-4 shrink-0" }),
|
|
2442
|
+
/* @__PURE__ */ F("span", { children: e.label }),
|
|
2443
|
+
/* @__PURE__ */ F("span", {
|
|
2414
2444
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2415
2445
|
children: e.items.length
|
|
2416
2446
|
})
|
|
2417
2447
|
]
|
|
2418
|
-
}), !e.collapsed &&
|
|
2448
|
+
}), !e.collapsed && N(e.items)]
|
|
2419
2449
|
}, e.key))
|
|
2420
|
-
}) :
|
|
2421
|
-
...
|
|
2450
|
+
}) : N(E), y.isOverlay && /* @__PURE__ */ F(x, {
|
|
2451
|
+
...y,
|
|
2422
2452
|
title: "Gallery Item",
|
|
2423
|
-
children: (e) => /* @__PURE__ */
|
|
2453
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
2424
2454
|
className: "space-y-3",
|
|
2425
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
2455
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
2426
2456
|
className: "flex flex-col",
|
|
2427
|
-
children: [/* @__PURE__ */
|
|
2457
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2428
2458
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
2429
2459
|
children: e.replace(/_/g, " ")
|
|
2430
|
-
}), /* @__PURE__ */
|
|
2460
|
+
}), /* @__PURE__ */ F("span", {
|
|
2431
2461
|
className: "text-sm",
|
|
2432
2462
|
children: String(t ?? "—")
|
|
2433
2463
|
})]
|
|
@@ -2435,76 +2465,76 @@ var q = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, h
|
|
|
2435
2465
|
})
|
|
2436
2466
|
})] });
|
|
2437
2467
|
};
|
|
2438
|
-
e.register("object-gallery",
|
|
2468
|
+
e.register("object-gallery", lt, {
|
|
2439
2469
|
namespace: "plugin-list",
|
|
2440
2470
|
label: "Gallery View",
|
|
2441
2471
|
category: "view"
|
|
2442
2472
|
});
|
|
2443
2473
|
//#endregion
|
|
2444
2474
|
//#region src/components/TabBar.tsx
|
|
2445
|
-
function
|
|
2446
|
-
return e ?
|
|
2475
|
+
function q(e) {
|
|
2476
|
+
return e ? Te[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
2447
2477
|
}
|
|
2448
|
-
function
|
|
2478
|
+
function J(e) {
|
|
2449
2479
|
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
2450
2480
|
}
|
|
2451
|
-
var
|
|
2452
|
-
let a = r.useMemo(() =>
|
|
2481
|
+
var ut = ({ tabs: e, activeTab: t, onTabChange: n, className: i }) => {
|
|
2482
|
+
let a = r.useMemo(() => J(e), [e]), o = r.useMemo(() => a.find((e) => e.isDefault)?.name ?? a[0]?.name, [a]), [s, c] = r.useState(o), u = t ?? s, d = r.useCallback((e) => {
|
|
2453
2483
|
c(e.name), n?.(e);
|
|
2454
2484
|
}, [n]);
|
|
2455
|
-
return a.length === 0 ? null : /* @__PURE__ */
|
|
2456
|
-
className:
|
|
2485
|
+
return a.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
2486
|
+
className: T("px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", i),
|
|
2457
2487
|
"data-testid": "view-tabs",
|
|
2458
2488
|
role: "tablist",
|
|
2459
2489
|
children: a.map((e) => {
|
|
2460
|
-
let t =
|
|
2461
|
-
return /* @__PURE__ */
|
|
2490
|
+
let t = q(e.icon), n = u === e.name;
|
|
2491
|
+
return /* @__PURE__ */ I(l, {
|
|
2462
2492
|
variant: "ghost",
|
|
2463
2493
|
size: "sm",
|
|
2464
|
-
className:
|
|
2494
|
+
className: T("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"),
|
|
2465
2495
|
"data-testid": `view-tab-${e.name}`,
|
|
2466
2496
|
role: "tab",
|
|
2467
2497
|
"aria-selected": n,
|
|
2468
2498
|
onClick: () => d(e),
|
|
2469
|
-
children: [t && /* @__PURE__ */
|
|
2499
|
+
children: [t && /* @__PURE__ */ F(t, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
2470
2500
|
}, e.name);
|
|
2471
2501
|
})
|
|
2472
2502
|
});
|
|
2473
2503
|
}, dt = ({ tabs: e, activeTab: t, onTabChange: n, className: i }) => {
|
|
2474
|
-
let a = r.useMemo(() =>
|
|
2504
|
+
let a = r.useMemo(() => J(e), [e]), o = r.useMemo(() => a.find((e) => e.isDefault)?.name ?? a[0]?.name, [a]), [s, c] = r.useState(o), u = t ?? s, d = r.useMemo(() => a.find((e) => e.name === u) ?? a[0], [a, u]), f = r.useCallback((e) => {
|
|
2475
2505
|
c(e.name), n?.(e);
|
|
2476
2506
|
}, [n]);
|
|
2477
2507
|
if (a.length === 0) return null;
|
|
2478
|
-
let _ =
|
|
2479
|
-
return /* @__PURE__ */
|
|
2480
|
-
className:
|
|
2508
|
+
let _ = q(d?.icon);
|
|
2509
|
+
return /* @__PURE__ */ F("div", {
|
|
2510
|
+
className: T("px-2 py-1", i),
|
|
2481
2511
|
"data-testid": "view-tabs-select",
|
|
2482
|
-
children: /* @__PURE__ */
|
|
2512
|
+
children: /* @__PURE__ */ I(p, { children: [/* @__PURE__ */ F(g, {
|
|
2483
2513
|
asChild: !0,
|
|
2484
|
-
children: /* @__PURE__ */
|
|
2514
|
+
children: /* @__PURE__ */ I(l, {
|
|
2485
2515
|
variant: "ghost",
|
|
2486
2516
|
size: "sm",
|
|
2487
2517
|
className: "h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate",
|
|
2488
2518
|
"aria-label": "Switch view",
|
|
2489
2519
|
children: [
|
|
2490
|
-
_ && /* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */
|
|
2520
|
+
_ && /* @__PURE__ */ F(_, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2521
|
+
/* @__PURE__ */ F("span", {
|
|
2492
2522
|
className: "truncate",
|
|
2493
2523
|
children: d?.label ?? ""
|
|
2494
2524
|
}),
|
|
2495
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ F(k, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
2496
2526
|
]
|
|
2497
2527
|
})
|
|
2498
|
-
}), /* @__PURE__ */
|
|
2528
|
+
}), /* @__PURE__ */ F(m, {
|
|
2499
2529
|
align: "start",
|
|
2500
2530
|
className: "w-56 max-h-72 overflow-y-auto",
|
|
2501
2531
|
children: a.map((e) => {
|
|
2502
|
-
let t =
|
|
2503
|
-
return /* @__PURE__ */
|
|
2532
|
+
let t = q(e.icon);
|
|
2533
|
+
return /* @__PURE__ */ I(h, {
|
|
2504
2534
|
onClick: () => f(e),
|
|
2505
|
-
className:
|
|
2535
|
+
className: T("text-sm", u === e.name && "font-medium bg-muted"),
|
|
2506
2536
|
"data-testid": `view-tab-select-${e.name}`,
|
|
2507
|
-
children: [t && /* @__PURE__ */
|
|
2537
|
+
children: [t && /* @__PURE__ */ F(t, { className: "h-3.5 w-3.5 mr-2 shrink-0" }), /* @__PURE__ */ F("span", {
|
|
2508
2538
|
className: "truncate",
|
|
2509
2539
|
children: e.label
|
|
2510
2540
|
})]
|
|
@@ -2513,7 +2543,7 @@ var J = ({ tabs: e, activeTab: t, onTabChange: n, className: i }) => {
|
|
|
2513
2543
|
})] })
|
|
2514
2544
|
});
|
|
2515
2545
|
};
|
|
2516
|
-
e.register("list-view",
|
|
2546
|
+
e.register("list-view", nt, {
|
|
2517
2547
|
namespace: "plugin-list",
|
|
2518
2548
|
label: "List View",
|
|
2519
2549
|
category: "Views",
|
|
@@ -2590,7 +2620,7 @@ e.register("list-view", rt, {
|
|
|
2590
2620
|
sort: [],
|
|
2591
2621
|
options: {}
|
|
2592
2622
|
}
|
|
2593
|
-
}), e.register("list",
|
|
2623
|
+
}), e.register("list", nt, {
|
|
2594
2624
|
namespace: "view",
|
|
2595
2625
|
skipFallback: !0,
|
|
2596
2626
|
category: "view",
|
|
@@ -2662,4 +2692,4 @@ e.register("list-view", rt, {
|
|
|
2662
2692
|
]
|
|
2663
2693
|
});
|
|
2664
2694
|
//#endregion
|
|
2665
|
-
export {
|
|
2695
|
+
export { nt as ListView, lt as ObjectGallery, ut as TabBar, dt as TabBarSelect, Ge as UserFilters, z as ViewSwitcher, Be as ViewSwitcherDropdown, Ze as evaluateConditionalFormatting, qe as normalizeFilterCondition, Ye as normalizeFilters };
|