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