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