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