@object-ui/plugin-list 4.2.1 → 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 +10 -0
- package/dist/index.js +789 -549
- 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,125 +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
|
-
...
|
|
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 || {}
|
|
977
1182
|
};
|
|
978
1183
|
case "kanban": return {
|
|
979
1184
|
type: "object-kanban",
|
|
980
1185
|
...t,
|
|
981
|
-
groupBy:
|
|
982
|
-
groupField:
|
|
983
|
-
...
|
|
984
|
-
cardFields:
|
|
985
|
-
...
|
|
986
|
-
...
|
|
987
|
-
...
|
|
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 || {}
|
|
988
1193
|
};
|
|
989
1194
|
case "calendar": return {
|
|
990
1195
|
type: "object-calendar",
|
|
991
1196
|
...t,
|
|
992
|
-
startDateField:
|
|
993
|
-
endDateField:
|
|
994
|
-
...
|
|
995
|
-
...
|
|
996
|
-
...
|
|
997
|
-
...
|
|
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 || {}
|
|
998
1203
|
};
|
|
999
1204
|
case "gallery": {
|
|
1000
1205
|
let e = {
|
|
1001
|
-
...
|
|
1002
|
-
...
|
|
1206
|
+
...O.options?.gallery || {},
|
|
1207
|
+
...O.gallery || {},
|
|
1208
|
+
cardSize: Q
|
|
1003
1209
|
};
|
|
1004
1210
|
return {
|
|
1005
1211
|
type: "object-gallery",
|
|
1006
1212
|
...t,
|
|
1007
1213
|
gallery: Object.keys(e).length > 0 ? e : void 0,
|
|
1008
|
-
imageField:
|
|
1009
|
-
titleField:
|
|
1010
|
-
subtitleField:
|
|
1011
|
-
...
|
|
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 } : {}
|
|
1012
1218
|
};
|
|
1013
1219
|
}
|
|
1014
1220
|
case "timeline": {
|
|
1015
1221
|
let e = {
|
|
1016
|
-
...
|
|
1017
|
-
...
|
|
1222
|
+
...O.options?.timeline || {},
|
|
1223
|
+
...O.timeline || {}
|
|
1018
1224
|
};
|
|
1019
1225
|
return {
|
|
1020
1226
|
type: "object-timeline",
|
|
1021
1227
|
...t,
|
|
1022
1228
|
timeline: Object.keys(e).length > 0 ? e : void 0,
|
|
1023
|
-
startDateField:
|
|
1024
|
-
titleField:
|
|
1025
|
-
...
|
|
1026
|
-
...
|
|
1027
|
-
...
|
|
1028
|
-
...
|
|
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 } : {}
|
|
1029
1235
|
};
|
|
1030
1236
|
}
|
|
1031
1237
|
case "gantt": return {
|
|
1032
1238
|
type: "object-gantt",
|
|
1033
1239
|
...t,
|
|
1034
|
-
startDateField:
|
|
1035
|
-
endDateField:
|
|
1036
|
-
progressField:
|
|
1037
|
-
dependenciesField:
|
|
1038
|
-
...
|
|
1039
|
-
...
|
|
1040
|
-
...
|
|
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 || {}
|
|
1041
1247
|
};
|
|
1042
1248
|
case "map": return {
|
|
1043
1249
|
type: "object-map",
|
|
1044
1250
|
...t,
|
|
1045
|
-
locationField:
|
|
1046
|
-
...
|
|
1251
|
+
locationField: O.options?.map?.locationField || "location",
|
|
1252
|
+
...O.options?.map || {}
|
|
1047
1253
|
};
|
|
1048
1254
|
default: return t;
|
|
1049
1255
|
}
|
|
1050
1256
|
}, [
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1257
|
+
M,
|
|
1258
|
+
O,
|
|
1259
|
+
I,
|
|
1054
1260
|
$,
|
|
1261
|
+
K,
|
|
1055
1262
|
q,
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
Q
|
|
1059
|
-
]),
|
|
1263
|
+
Ft.handleClick,
|
|
1264
|
+
Z.mode,
|
|
1265
|
+
Q
|
|
1266
|
+
]), Rt = z.conditions && z.conditions.length > 0, zt = a.useMemo(() => {
|
|
1060
1267
|
let e, t = (e, t) => {
|
|
1061
1268
|
if (!t) return;
|
|
1062
1269
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1068,17 +1275,17 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1068
1275
|
label: t?.label || e,
|
|
1069
1276
|
...t
|
|
1070
1277
|
}));
|
|
1071
|
-
return
|
|
1278
|
+
return O.objectName ? D(O.objectName, e, n) : n;
|
|
1072
1279
|
};
|
|
1073
|
-
if (e =
|
|
1280
|
+
if (e = U?.fields ? Object.entries(U.fields).map(([e, n]) => ({
|
|
1074
1281
|
value: e,
|
|
1075
|
-
label:
|
|
1282
|
+
label: k(e, n.label || e),
|
|
1076
1283
|
type: n.type || "text",
|
|
1077
1284
|
options: t(e, n.options),
|
|
1078
1285
|
referenceTo: n.reference_to || n.reference,
|
|
1079
1286
|
displayField: n.display_field || n.reference_field,
|
|
1080
1287
|
idField: n.id_field
|
|
1081
|
-
})) : (
|
|
1288
|
+
})) : (O.fields || []).map((e) => {
|
|
1082
1289
|
if (typeof e == "string") return {
|
|
1083
1290
|
value: e,
|
|
1084
1291
|
label: e,
|
|
@@ -1087,32 +1294,32 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1087
1294
|
let n = e.name || e.fieldName;
|
|
1088
1295
|
return {
|
|
1089
1296
|
value: n,
|
|
1090
|
-
label:
|
|
1297
|
+
label: k(n, e.label || e.name),
|
|
1091
1298
|
type: e.type || "text",
|
|
1092
1299
|
options: t(n, e.options),
|
|
1093
1300
|
referenceTo: e.reference_to || e.reference,
|
|
1094
1301
|
displayField: e.display_field || e.reference_field,
|
|
1095
1302
|
idField: e.id_field
|
|
1096
1303
|
};
|
|
1097
|
-
}),
|
|
1098
|
-
let t = new Set(
|
|
1304
|
+
}), O.filterableFields && O.filterableFields.length > 0) {
|
|
1305
|
+
let t = new Set(O.filterableFields);
|
|
1099
1306
|
e = e.filter((e) => t.has(e.value));
|
|
1100
1307
|
}
|
|
1101
1308
|
return e;
|
|
1102
1309
|
}, [
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
]),
|
|
1110
|
-
|
|
1310
|
+
U,
|
|
1311
|
+
O.fields,
|
|
1312
|
+
O.filterableFields,
|
|
1313
|
+
O.objectName,
|
|
1314
|
+
k,
|
|
1315
|
+
D
|
|
1316
|
+
]), Bt = a.useCallback((e) => {
|
|
1317
|
+
pt((t) => {
|
|
1111
1318
|
let n = new Set(t);
|
|
1112
1319
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1113
1320
|
});
|
|
1114
|
-
}, []),
|
|
1115
|
-
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;
|
|
1116
1323
|
if (e === "csv") {
|
|
1117
1324
|
let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
|
|
1118
1325
|
r && t.push(e.join(",")), a.forEach((n) => {
|
|
@@ -1127,69 +1334,69 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1127
1334
|
let e = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1128
1335
|
n.href = t, n.download = `${i}.json`, n.click(), URL.revokeObjectURL(t);
|
|
1129
1336
|
}
|
|
1130
|
-
|
|
1337
|
+
Ct(!1);
|
|
1131
1338
|
}, [
|
|
1132
|
-
|
|
1339
|
+
V,
|
|
1133
1340
|
$,
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
]),
|
|
1341
|
+
X,
|
|
1342
|
+
O.objectName
|
|
1343
|
+
]), Ht = a.useMemo(() => (O.fields || []).map((e) => {
|
|
1137
1344
|
if (typeof e == "string") return {
|
|
1138
1345
|
name: e,
|
|
1139
|
-
label:
|
|
1346
|
+
label: k(e, e)
|
|
1140
1347
|
};
|
|
1141
1348
|
let t = e.name || e.fieldName || e.field;
|
|
1142
1349
|
return {
|
|
1143
1350
|
name: t,
|
|
1144
|
-
label:
|
|
1351
|
+
label: k(t, e.label || e.name || e.field)
|
|
1145
1352
|
};
|
|
1146
|
-
}), [
|
|
1353
|
+
}), [O.fields, k]);
|
|
1147
1354
|
return /* @__PURE__ */ F("div", {
|
|
1148
|
-
ref:
|
|
1355
|
+
ref: Dt,
|
|
1149
1356
|
className: C("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1150
|
-
...
|
|
1151
|
-
...
|
|
1152
|
-
...
|
|
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 } : {},
|
|
1153
1360
|
role: "region",
|
|
1154
1361
|
children: [
|
|
1155
|
-
|
|
1362
|
+
kt > 0 && /* @__PURE__ */ P("div", {
|
|
1156
1363
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1157
|
-
style: { height:
|
|
1158
|
-
children:
|
|
1364
|
+
style: { height: kt },
|
|
1365
|
+
children: E(Ot ? "list.refreshing" : "list.pullToRefresh")
|
|
1159
1366
|
}),
|
|
1160
1367
|
_ && /* @__PURE__ */ P("div", {
|
|
1161
1368
|
className: "px-4 py-1 flex items-center bg-background",
|
|
1162
|
-
children: /* @__PURE__ */ P(
|
|
1163
|
-
currentView:
|
|
1164
|
-
availableViews:
|
|
1165
|
-
onViewChange:
|
|
1369
|
+
children: /* @__PURE__ */ P(Ae, {
|
|
1370
|
+
currentView: M,
|
|
1371
|
+
availableViews: Mt,
|
|
1372
|
+
onViewChange: Nt
|
|
1166
1373
|
})
|
|
1167
1374
|
}),
|
|
1168
|
-
|
|
1375
|
+
O.description && O.appearance?.showDescription !== !1 && /* @__PURE__ */ P("div", {
|
|
1169
1376
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
1170
1377
|
"data-testid": "view-description",
|
|
1171
|
-
children: typeof
|
|
1378
|
+
children: typeof O.description == "string" ? O.description : ""
|
|
1172
1379
|
}),
|
|
1173
1380
|
/* @__PURE__ */ F("div", {
|
|
1174
1381
|
className: "border-b px-2 sm:px-4 py-1 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1175
1382
|
children: [/* @__PURE__ */ F("div", {
|
|
1176
1383
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1177
1384
|
children: [
|
|
1178
|
-
|
|
1179
|
-
tabs:
|
|
1180
|
-
activeTab:
|
|
1181
|
-
onTabChange:
|
|
1385
|
+
O.tabs && O.tabs.length > 0 && /* @__PURE__ */ P(Ne, {
|
|
1386
|
+
tabs: O.tabs,
|
|
1387
|
+
activeTab: Le,
|
|
1388
|
+
onTabChange: ze,
|
|
1182
1389
|
className: "!px-0 !py-0 shrink-0"
|
|
1183
1390
|
}),
|
|
1184
|
-
|
|
1185
|
-
|
|
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", {
|
|
1186
1393
|
className: "shrink-0 min-w-0",
|
|
1187
1394
|
"data-testid": "user-filters",
|
|
1188
|
-
children: /* @__PURE__ */ P(
|
|
1189
|
-
config:
|
|
1190
|
-
objectDef:
|
|
1191
|
-
data:
|
|
1192
|
-
onFilterChange:
|
|
1395
|
+
children: /* @__PURE__ */ P(Ie, {
|
|
1396
|
+
config: gt,
|
|
1397
|
+
objectDef: U,
|
|
1398
|
+
data: V,
|
|
1399
|
+
onFilterChange: ht,
|
|
1193
1400
|
maxVisible: 3
|
|
1194
1401
|
})
|
|
1195
1402
|
})
|
|
@@ -1197,24 +1404,24 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1197
1404
|
}), /* @__PURE__ */ F("div", {
|
|
1198
1405
|
className: "flex items-center gap-0 shrink-0",
|
|
1199
1406
|
children: [
|
|
1200
|
-
|
|
1201
|
-
open:
|
|
1202
|
-
onOpenChange:
|
|
1407
|
+
j.showHideFields && !j.compactToolbar && /* @__PURE__ */ F(y, {
|
|
1408
|
+
open: bt,
|
|
1409
|
+
onOpenChange: xt,
|
|
1203
1410
|
children: [/* @__PURE__ */ P(x, {
|
|
1204
1411
|
asChild: !0,
|
|
1205
1412
|
children: /* @__PURE__ */ F(d, {
|
|
1206
1413
|
variant: "ghost",
|
|
1207
1414
|
size: "sm",
|
|
1208
|
-
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"),
|
|
1209
1416
|
children: [
|
|
1210
|
-
/* @__PURE__ */ P(
|
|
1417
|
+
/* @__PURE__ */ P(ie, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1211
1418
|
/* @__PURE__ */ P("span", {
|
|
1212
1419
|
className: "hidden sm:inline",
|
|
1213
|
-
children:
|
|
1420
|
+
children: E("list.hideFields")
|
|
1214
1421
|
}),
|
|
1215
|
-
|
|
1422
|
+
J.size > 0 && /* @__PURE__ */ P("span", {
|
|
1216
1423
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1217
|
-
children:
|
|
1424
|
+
children: J.size
|
|
1218
1425
|
})
|
|
1219
1426
|
]
|
|
1220
1427
|
})
|
|
@@ -1227,24 +1434,24 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1227
1434
|
className: "flex items-center justify-between border-b pb-2",
|
|
1228
1435
|
children: [/* @__PURE__ */ P("h4", {
|
|
1229
1436
|
className: "font-medium text-sm",
|
|
1230
|
-
children:
|
|
1231
|
-
}),
|
|
1437
|
+
children: E("list.hideFieldsTitle")
|
|
1438
|
+
}), J.size > 0 && /* @__PURE__ */ P(d, {
|
|
1232
1439
|
variant: "ghost",
|
|
1233
1440
|
size: "sm",
|
|
1234
1441
|
className: "h-6 px-2 text-xs",
|
|
1235
|
-
onClick: () =>
|
|
1236
|
-
children:
|
|
1442
|
+
onClick: () => yt(/* @__PURE__ */ new Set()),
|
|
1443
|
+
children: E("list.showAll")
|
|
1237
1444
|
})]
|
|
1238
1445
|
}), /* @__PURE__ */ P("div", {
|
|
1239
1446
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1240
|
-
children:
|
|
1447
|
+
children: Ht.map((e) => /* @__PURE__ */ F("label", {
|
|
1241
1448
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1242
1449
|
children: [/* @__PURE__ */ P("input", {
|
|
1243
1450
|
type: "checkbox",
|
|
1244
|
-
checked: !
|
|
1451
|
+
checked: !J.has(e.name),
|
|
1245
1452
|
onChange: () => {
|
|
1246
|
-
let t = new Set(
|
|
1247
|
-
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);
|
|
1248
1455
|
},
|
|
1249
1456
|
className: "rounded border-input"
|
|
1250
1457
|
}), /* @__PURE__ */ P("span", {
|
|
@@ -1256,25 +1463,25 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1256
1463
|
})
|
|
1257
1464
|
})]
|
|
1258
1465
|
}),
|
|
1259
|
-
|
|
1260
|
-
|
|
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, {
|
|
1261
1468
|
open: Me,
|
|
1262
|
-
onOpenChange:
|
|
1469
|
+
onOpenChange: R,
|
|
1263
1470
|
children: [/* @__PURE__ */ P(x, {
|
|
1264
1471
|
asChild: !0,
|
|
1265
1472
|
children: /* @__PURE__ */ F(d, {
|
|
1266
1473
|
variant: "ghost",
|
|
1267
1474
|
size: "sm",
|
|
1268
|
-
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"),
|
|
1269
1476
|
children: [
|
|
1270
|
-
/* @__PURE__ */ P(
|
|
1477
|
+
/* @__PURE__ */ P(he, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1271
1478
|
/* @__PURE__ */ P("span", {
|
|
1272
1479
|
className: "hidden sm:inline",
|
|
1273
|
-
children:
|
|
1480
|
+
children: E("list.filter")
|
|
1274
1481
|
}),
|
|
1275
|
-
|
|
1482
|
+
Rt && /* @__PURE__ */ P("span", {
|
|
1276
1483
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1277
|
-
children:
|
|
1484
|
+
children: z.conditions?.length || 0
|
|
1278
1485
|
})
|
|
1279
1486
|
]
|
|
1280
1487
|
})
|
|
@@ -1287,11 +1494,11 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1287
1494
|
className: "flex items-center justify-between border-b pb-2",
|
|
1288
1495
|
children: /* @__PURE__ */ P("h4", {
|
|
1289
1496
|
className: "font-medium text-sm",
|
|
1290
|
-
children:
|
|
1497
|
+
children: E("list.filterRecords")
|
|
1291
1498
|
})
|
|
1292
1499
|
}), /* @__PURE__ */ P(m, {
|
|
1293
|
-
fields:
|
|
1294
|
-
value:
|
|
1500
|
+
fields: zt,
|
|
1501
|
+
value: z,
|
|
1295
1502
|
onChange: (e) => {
|
|
1296
1503
|
Fe(e), s && s(e);
|
|
1297
1504
|
}
|
|
@@ -1299,24 +1506,24 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1299
1506
|
})
|
|
1300
1507
|
})]
|
|
1301
1508
|
}),
|
|
1302
|
-
|
|
1303
|
-
open:
|
|
1304
|
-
onOpenChange:
|
|
1509
|
+
j.showGroup && !j.compactToolbar && /* @__PURE__ */ F(y, {
|
|
1510
|
+
open: rt,
|
|
1511
|
+
onOpenChange: it,
|
|
1305
1512
|
children: [/* @__PURE__ */ P(x, {
|
|
1306
1513
|
asChild: !0,
|
|
1307
1514
|
children: /* @__PURE__ */ F(d, {
|
|
1308
1515
|
variant: "ghost",
|
|
1309
1516
|
size: "sm",
|
|
1310
|
-
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"),
|
|
1311
1518
|
children: [
|
|
1312
|
-
/* @__PURE__ */ P(
|
|
1519
|
+
/* @__PURE__ */ P(ae, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1313
1520
|
/* @__PURE__ */ P("span", {
|
|
1314
1521
|
className: "hidden sm:inline",
|
|
1315
|
-
children:
|
|
1522
|
+
children: E("list.group")
|
|
1316
1523
|
}),
|
|
1317
|
-
|
|
1524
|
+
K && K.fields?.length > 0 && /* @__PURE__ */ P("span", {
|
|
1318
1525
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1319
|
-
children:
|
|
1526
|
+
children: K.fields.length
|
|
1320
1527
|
})
|
|
1321
1528
|
]
|
|
1322
1529
|
})
|
|
@@ -1329,53 +1536,53 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1329
1536
|
className: "flex items-center justify-between border-b pb-2",
|
|
1330
1537
|
children: [/* @__PURE__ */ P("h4", {
|
|
1331
1538
|
className: "font-medium text-sm",
|
|
1332
|
-
children:
|
|
1333
|
-
}),
|
|
1539
|
+
children: E("list.groupBy")
|
|
1540
|
+
}), K && /* @__PURE__ */ P(d, {
|
|
1334
1541
|
variant: "ghost",
|
|
1335
1542
|
size: "sm",
|
|
1336
1543
|
className: "h-6 px-2 text-xs",
|
|
1337
|
-
onClick: () =>
|
|
1544
|
+
onClick: () => nt(void 0),
|
|
1338
1545
|
"data-testid": "clear-grouping",
|
|
1339
|
-
children:
|
|
1546
|
+
children: E("list.clear")
|
|
1340
1547
|
})]
|
|
1341
1548
|
}), /* @__PURE__ */ P("div", {
|
|
1342
1549
|
"data-testid": "group-field-list",
|
|
1343
1550
|
children: /* @__PURE__ */ P(h, {
|
|
1344
|
-
value:
|
|
1345
|
-
fieldOptions:
|
|
1551
|
+
value: K,
|
|
1552
|
+
fieldOptions: Ht.map((e) => ({
|
|
1346
1553
|
value: e.name,
|
|
1347
1554
|
label: e.label || e.name
|
|
1348
1555
|
})),
|
|
1349
1556
|
maxLevels: 3,
|
|
1350
1557
|
labels: {
|
|
1351
|
-
addGroup:
|
|
1352
|
-
collapseTitle:
|
|
1353
|
-
removeTitle:
|
|
1558
|
+
addGroup: E("list.addGroup", "Add group field"),
|
|
1559
|
+
collapseTitle: E("list.collapsedByDefault", "Collapsed by default"),
|
|
1560
|
+
removeTitle: E("list.removeGroup", "Remove")
|
|
1354
1561
|
},
|
|
1355
|
-
onChange: (e) =>
|
|
1562
|
+
onChange: (e) => nt(e)
|
|
1356
1563
|
})
|
|
1357
1564
|
})]
|
|
1358
1565
|
})
|
|
1359
1566
|
})]
|
|
1360
1567
|
}),
|
|
1361
|
-
|
|
1362
|
-
open:
|
|
1568
|
+
j.showSort && /* @__PURE__ */ F(y, {
|
|
1569
|
+
open: we,
|
|
1363
1570
|
onOpenChange: De,
|
|
1364
1571
|
children: [/* @__PURE__ */ P(x, {
|
|
1365
1572
|
asChild: !0,
|
|
1366
1573
|
children: /* @__PURE__ */ F(d, {
|
|
1367
1574
|
variant: "ghost",
|
|
1368
1575
|
size: "sm",
|
|
1369
|
-
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"),
|
|
1370
1577
|
children: [
|
|
1371
|
-
/* @__PURE__ */ P(
|
|
1578
|
+
/* @__PURE__ */ P(T, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1372
1579
|
/* @__PURE__ */ P("span", {
|
|
1373
1580
|
className: "hidden sm:inline",
|
|
1374
|
-
children:
|
|
1581
|
+
children: E("list.sort")
|
|
1375
1582
|
}),
|
|
1376
|
-
|
|
1583
|
+
I.length > 0 && /* @__PURE__ */ P("span", {
|
|
1377
1584
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1378
|
-
children:
|
|
1585
|
+
children: I.length
|
|
1379
1586
|
})
|
|
1380
1587
|
]
|
|
1381
1588
|
})
|
|
@@ -1388,31 +1595,31 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1388
1595
|
className: "flex items-center justify-between border-b pb-2",
|
|
1389
1596
|
children: /* @__PURE__ */ P("h4", {
|
|
1390
1597
|
className: "font-medium text-sm",
|
|
1391
|
-
children:
|
|
1598
|
+
children: E("list.sortRecords")
|
|
1392
1599
|
})
|
|
1393
1600
|
}), /* @__PURE__ */ P(S, {
|
|
1394
|
-
fields:
|
|
1395
|
-
value:
|
|
1601
|
+
fields: zt,
|
|
1602
|
+
value: I,
|
|
1396
1603
|
onChange: (e) => {
|
|
1397
|
-
|
|
1604
|
+
L(e), c && c(e);
|
|
1398
1605
|
}
|
|
1399
1606
|
})]
|
|
1400
1607
|
})
|
|
1401
1608
|
})]
|
|
1402
1609
|
}),
|
|
1403
|
-
(
|
|
1404
|
-
|
|
1405
|
-
open:
|
|
1406
|
-
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,
|
|
1407
1614
|
children: [/* @__PURE__ */ P(x, {
|
|
1408
1615
|
asChild: !0,
|
|
1409
1616
|
children: /* @__PURE__ */ F(d, {
|
|
1410
1617
|
variant: "ghost",
|
|
1411
1618
|
size: "sm",
|
|
1412
|
-
className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1413
|
-
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", {
|
|
1414
1621
|
className: "hidden sm:inline",
|
|
1415
|
-
children:
|
|
1622
|
+
children: E("list.color")
|
|
1416
1623
|
})]
|
|
1417
1624
|
})
|
|
1418
1625
|
}), /* @__PURE__ */ P(b, {
|
|
@@ -1424,36 +1631,36 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1424
1631
|
className: "flex items-center justify-between border-b pb-2",
|
|
1425
1632
|
children: [/* @__PURE__ */ P("h4", {
|
|
1426
1633
|
className: "font-medium text-sm",
|
|
1427
|
-
children:
|
|
1428
|
-
}),
|
|
1634
|
+
children: E("list.rowColor")
|
|
1635
|
+
}), q && /* @__PURE__ */ P(d, {
|
|
1429
1636
|
variant: "ghost",
|
|
1430
1637
|
size: "sm",
|
|
1431
1638
|
className: "h-6 px-2 text-xs",
|
|
1432
|
-
onClick: () =>
|
|
1639
|
+
onClick: () => ot(void 0),
|
|
1433
1640
|
"data-testid": "clear-row-color",
|
|
1434
|
-
children:
|
|
1641
|
+
children: E("list.clear")
|
|
1435
1642
|
})]
|
|
1436
1643
|
}), /* @__PURE__ */ F("div", {
|
|
1437
1644
|
className: "space-y-2",
|
|
1438
1645
|
"data-testid": "color-field-list",
|
|
1439
1646
|
children: [/* @__PURE__ */ P("label", {
|
|
1440
1647
|
className: "text-xs text-muted-foreground",
|
|
1441
|
-
children:
|
|
1648
|
+
children: E("list.colorByField")
|
|
1442
1649
|
}), /* @__PURE__ */ F("select", {
|
|
1443
1650
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1444
|
-
value:
|
|
1651
|
+
value: q?.field || "",
|
|
1445
1652
|
onChange: (e) => {
|
|
1446
1653
|
let t = e.target.value;
|
|
1447
|
-
|
|
1654
|
+
ot(t ? {
|
|
1448
1655
|
field: t,
|
|
1449
|
-
colors:
|
|
1656
|
+
colors: q?.colors || {}
|
|
1450
1657
|
} : void 0);
|
|
1451
1658
|
},
|
|
1452
1659
|
"data-testid": "color-field-select",
|
|
1453
1660
|
children: [/* @__PURE__ */ P("option", {
|
|
1454
1661
|
value: "",
|
|
1455
|
-
children:
|
|
1456
|
-
}),
|
|
1662
|
+
children: E("list.none")
|
|
1663
|
+
}), Ht.map((e) => /* @__PURE__ */ P("option", {
|
|
1457
1664
|
value: e.name,
|
|
1458
1665
|
children: e.label
|
|
1459
1666
|
}, e.name))]
|
|
@@ -1462,31 +1669,64 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1462
1669
|
})
|
|
1463
1670
|
})]
|
|
1464
1671
|
}),
|
|
1465
|
-
|
|
1466
|
-
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
|
+
});
|
|
1467
1677
|
return /* @__PURE__ */ P(d, {
|
|
1468
1678
|
variant: "ghost",
|
|
1469
1679
|
size: "sm",
|
|
1470
|
-
"aria-label":
|
|
1471
|
-
className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1472
|
-
onClick:
|
|
1473
|
-
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,
|
|
1474
1684
|
children: /* @__PURE__ */ P(e, { className: "h-3.5 w-3.5" })
|
|
1475
1685
|
});
|
|
1476
1686
|
})(),
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
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,
|
|
1481
1721
|
children: [/* @__PURE__ */ P(x, {
|
|
1482
1722
|
asChild: !0,
|
|
1483
1723
|
children: /* @__PURE__ */ F(d, {
|
|
1484
1724
|
variant: "ghost",
|
|
1485
1725
|
size: "sm",
|
|
1486
1726
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1487
|
-
children: [/* @__PURE__ */ P(
|
|
1727
|
+
children: [/* @__PURE__ */ P(re, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
|
|
1488
1728
|
className: "hidden sm:inline",
|
|
1489
|
-
children:
|
|
1729
|
+
children: E("list.export")
|
|
1490
1730
|
})]
|
|
1491
1731
|
})
|
|
1492
1732
|
}), /* @__PURE__ */ P(b, {
|
|
@@ -1494,54 +1734,54 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1494
1734
|
className: "w-48 p-2",
|
|
1495
1735
|
children: /* @__PURE__ */ P("div", {
|
|
1496
1736
|
className: "space-y-1",
|
|
1497
|
-
children: (
|
|
1737
|
+
children: (X.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ F(d, {
|
|
1498
1738
|
variant: "ghost",
|
|
1499
1739
|
size: "sm",
|
|
1500
1740
|
className: "w-full justify-start h-8 text-xs",
|
|
1501
|
-
onClick: () =>
|
|
1502
|
-
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() })]
|
|
1503
1743
|
}, e))
|
|
1504
1744
|
})
|
|
1505
1745
|
})]
|
|
1506
1746
|
}),
|
|
1507
|
-
(
|
|
1747
|
+
(O.sharing?.enabled || O.sharing?.type) && /* @__PURE__ */ F(d, {
|
|
1508
1748
|
variant: "ghost",
|
|
1509
1749
|
size: "sm",
|
|
1510
1750
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1511
|
-
title: `Sharing: ${
|
|
1751
|
+
title: `Sharing: ${O.sharing?.visibility || O.sharing?.type || "private"}`,
|
|
1512
1752
|
"data-testid": "share-button",
|
|
1513
|
-
children: [/* @__PURE__ */ P(
|
|
1753
|
+
children: [/* @__PURE__ */ P(me, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
|
|
1514
1754
|
className: "hidden sm:inline",
|
|
1515
|
-
children:
|
|
1755
|
+
children: E("list.share")
|
|
1516
1756
|
})]
|
|
1517
1757
|
}),
|
|
1518
|
-
|
|
1758
|
+
O.allowPrinting && /* @__PURE__ */ F(d, {
|
|
1519
1759
|
variant: "ghost",
|
|
1520
1760
|
size: "sm",
|
|
1521
1761
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1522
1762
|
onClick: () => window.print(),
|
|
1523
1763
|
"data-testid": "print-button",
|
|
1524
|
-
children: [/* @__PURE__ */ P(
|
|
1764
|
+
children: [/* @__PURE__ */ P(ce, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
|
|
1525
1765
|
className: "hidden sm:inline",
|
|
1526
|
-
children:
|
|
1766
|
+
children: E("list.print")
|
|
1527
1767
|
})]
|
|
1528
1768
|
}),
|
|
1529
1769
|
(() => {
|
|
1530
|
-
let e =
|
|
1531
|
-
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;
|
|
1532
1772
|
})(),
|
|
1533
|
-
|
|
1534
|
-
open:
|
|
1535
|
-
onOpenChange:
|
|
1773
|
+
j.showSearch && /* @__PURE__ */ F(y, {
|
|
1774
|
+
open: be,
|
|
1775
|
+
onOpenChange: Ce,
|
|
1536
1776
|
children: [/* @__PURE__ */ P(x, {
|
|
1537
1777
|
asChild: !0,
|
|
1538
1778
|
children: /* @__PURE__ */ P(d, {
|
|
1539
1779
|
variant: "ghost",
|
|
1540
1780
|
size: "sm",
|
|
1541
|
-
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"),
|
|
1542
1782
|
"data-testid": "search-icon-button",
|
|
1543
|
-
title:
|
|
1544
|
-
children: /* @__PURE__ */ P(
|
|
1783
|
+
title: E("list.search"),
|
|
1784
|
+
children: /* @__PURE__ */ P(fe, { className: "h-3.5 w-3.5" })
|
|
1545
1785
|
})
|
|
1546
1786
|
}), /* @__PURE__ */ P(b, {
|
|
1547
1787
|
align: "end",
|
|
@@ -1550,89 +1790,89 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1550
1790
|
children: /* @__PURE__ */ F("div", {
|
|
1551
1791
|
className: "relative",
|
|
1552
1792
|
children: [
|
|
1553
|
-
/* @__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" }),
|
|
1554
1794
|
/* @__PURE__ */ P(g, {
|
|
1555
|
-
placeholder:
|
|
1556
|
-
value:
|
|
1557
|
-
onChange: (e) =>
|
|
1795
|
+
placeholder: E("list.search") + "...",
|
|
1796
|
+
value: N,
|
|
1797
|
+
onChange: (e) => Pt(e.target.value),
|
|
1558
1798
|
className: "pl-7 h-8 text-xs",
|
|
1559
1799
|
autoFocus: !0
|
|
1560
1800
|
}),
|
|
1561
|
-
|
|
1801
|
+
N && /* @__PURE__ */ P(d, {
|
|
1562
1802
|
variant: "ghost",
|
|
1563
1803
|
size: "sm",
|
|
1564
1804
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
1565
|
-
onClick: () =>
|
|
1566
|
-
children: /* @__PURE__ */ P(
|
|
1805
|
+
onClick: () => Pt(""),
|
|
1806
|
+
children: /* @__PURE__ */ P(_e, { className: "h-3 w-3" })
|
|
1567
1807
|
})
|
|
1568
1808
|
]
|
|
1569
1809
|
})
|
|
1570
1810
|
})]
|
|
1571
1811
|
}),
|
|
1572
|
-
|
|
1812
|
+
j.showAddRecord && j.addRecordPosition === "top" && /* @__PURE__ */ F(d, {
|
|
1573
1813
|
variant: "ghost",
|
|
1574
1814
|
size: "sm",
|
|
1575
1815
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1576
1816
|
"data-testid": "add-record-button",
|
|
1577
1817
|
onClick: () => w.onAddRecord?.(),
|
|
1578
|
-
children: [/* @__PURE__ */ P(
|
|
1818
|
+
children: [/* @__PURE__ */ P(se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
|
|
1579
1819
|
className: "hidden sm:inline",
|
|
1580
|
-
children:
|
|
1820
|
+
children: E("list.addRecord")
|
|
1581
1821
|
})]
|
|
1582
1822
|
})
|
|
1583
1823
|
]
|
|
1584
1824
|
})]
|
|
1585
1825
|
}),
|
|
1586
|
-
|
|
1826
|
+
Y && Y.length > 0 && /* @__PURE__ */ P("div", {
|
|
1587
1827
|
className: "border-b px-2 sm:px-4 py-1 flex items-center gap-1 flex-wrap bg-background",
|
|
1588
1828
|
"data-testid": "quick-filters",
|
|
1589
|
-
children:
|
|
1590
|
-
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;
|
|
1591
1831
|
return /* @__PURE__ */ F(d, {
|
|
1592
1832
|
variant: t ? "default" : "outline",
|
|
1593
1833
|
size: "sm",
|
|
1594
1834
|
className: "h-7 px-3 text-xs",
|
|
1595
|
-
onClick: () =>
|
|
1835
|
+
onClick: () => Bt(e.id),
|
|
1596
1836
|
children: [n && /* @__PURE__ */ P(n, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
1597
1837
|
}, e.id);
|
|
1598
1838
|
})
|
|
1599
1839
|
}),
|
|
1600
1840
|
/* @__PURE__ */ P("div", {
|
|
1601
1841
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
1602
|
-
children: !
|
|
1603
|
-
let e =
|
|
1842
|
+
children: !Ue && V.length === 0 && (M === "grid" || M === "list") ? (() => {
|
|
1843
|
+
let e = O.emptyState?.icon;
|
|
1604
1844
|
return /* @__PURE__ */ F("div", {
|
|
1605
1845
|
className: "flex flex-col items-center justify-center h-full min-h-[200px] text-center p-8",
|
|
1606
1846
|
"data-testid": "empty-state",
|
|
1607
1847
|
children: [
|
|
1608
|
-
/* @__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" }),
|
|
1609
1849
|
/* @__PURE__ */ P("h3", {
|
|
1610
1850
|
className: "text-lg font-medium text-foreground mb-1",
|
|
1611
|
-
children: (typeof
|
|
1851
|
+
children: (typeof O.emptyState?.title == "string" ? O.emptyState.title : void 0) ?? E("list.noItems")
|
|
1612
1852
|
}),
|
|
1613
1853
|
/* @__PURE__ */ P("p", {
|
|
1614
1854
|
className: "text-sm text-muted-foreground max-w-md",
|
|
1615
|
-
children: (typeof
|
|
1855
|
+
children: (typeof O.emptyState?.message == "string" ? O.emptyState.message : void 0) ?? E("list.noItemsMessage")
|
|
1616
1856
|
}),
|
|
1617
|
-
|
|
1857
|
+
j.showAddRecord && /* @__PURE__ */ F(d, {
|
|
1618
1858
|
variant: "default",
|
|
1619
1859
|
size: "sm",
|
|
1620
1860
|
className: "mt-4",
|
|
1621
1861
|
"data-testid": "empty-state-add-record",
|
|
1622
1862
|
onClick: () => w.onAddRecord?.(),
|
|
1623
|
-
children: [/* @__PURE__ */ P(
|
|
1863
|
+
children: [/* @__PURE__ */ P(se, { className: "h-4 w-4 mr-1.5" }), E("list.addRecord")]
|
|
1624
1864
|
})
|
|
1625
1865
|
]
|
|
1626
1866
|
});
|
|
1627
|
-
})() : /* @__PURE__ */ P(
|
|
1628
|
-
schema:
|
|
1867
|
+
})() : /* @__PURE__ */ P(Se, {
|
|
1868
|
+
schema: Lt,
|
|
1629
1869
|
...w,
|
|
1630
|
-
data:
|
|
1631
|
-
loading:
|
|
1632
|
-
onRowSelect:
|
|
1870
|
+
data: V,
|
|
1871
|
+
loading: Ue,
|
|
1872
|
+
onRowSelect: ut
|
|
1633
1873
|
})
|
|
1634
|
-
},
|
|
1635
|
-
|
|
1874
|
+
}, M),
|
|
1875
|
+
j.showAddRecord && j.addRecordPosition === "bottom" && /* @__PURE__ */ P("div", {
|
|
1636
1876
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
1637
1877
|
children: /* @__PURE__ */ F(d, {
|
|
1638
1878
|
variant: "ghost",
|
|
@@ -1640,39 +1880,39 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1640
1880
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1641
1881
|
"data-testid": "add-record-button",
|
|
1642
1882
|
onClick: () => w.onAddRecord?.(),
|
|
1643
|
-
children: [/* @__PURE__ */ P(
|
|
1883
|
+
children: [/* @__PURE__ */ P(se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
|
|
1644
1884
|
className: "hidden sm:inline",
|
|
1645
|
-
children:
|
|
1885
|
+
children: E("list.addRecord")
|
|
1646
1886
|
})]
|
|
1647
1887
|
})
|
|
1648
1888
|
}),
|
|
1649
|
-
|
|
1889
|
+
O.bulkActions && O.bulkActions.length > 0 && lt.length > 0 && M !== "grid" && /* @__PURE__ */ F("div", {
|
|
1650
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",
|
|
1651
1891
|
role: "region",
|
|
1652
1892
|
"aria-label": "Bulk actions",
|
|
1653
1893
|
"data-testid": "bulk-actions-bar",
|
|
1654
1894
|
children: [
|
|
1655
|
-
/* @__PURE__ */ P(
|
|
1895
|
+
/* @__PURE__ */ P(te, { className: "h-3.5 w-3.5 text-primary shrink-0" }),
|
|
1656
1896
|
/* @__PURE__ */ F("span", {
|
|
1657
1897
|
className: "font-medium",
|
|
1658
1898
|
children: [
|
|
1659
|
-
|
|
1899
|
+
lt.length,
|
|
1660
1900
|
" ",
|
|
1661
|
-
|
|
1901
|
+
lt.length === 1 ? "item" : "items",
|
|
1662
1902
|
" selected"
|
|
1663
1903
|
]
|
|
1664
1904
|
}),
|
|
1665
1905
|
/* @__PURE__ */ P("div", {
|
|
1666
1906
|
className: "flex items-center gap-1.5 ml-3",
|
|
1667
|
-
children:
|
|
1668
|
-
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;
|
|
1669
1909
|
return /* @__PURE__ */ F(d, {
|
|
1670
1910
|
variant: n ? "destructive" : "outline",
|
|
1671
1911
|
size: "sm",
|
|
1672
1912
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
1673
|
-
onClick: () => w.onBulkAction?.(e,
|
|
1913
|
+
onClick: () => w.onBulkAction?.(e, lt),
|
|
1674
1914
|
"data-testid": `bulk-action-${e}`,
|
|
1675
|
-
children: [r && /* @__PURE__ */ P(r, { className: "h-3 w-3" }),
|
|
1915
|
+
children: [r && /* @__PURE__ */ P(r, { className: "h-3 w-3" }), Be(e)]
|
|
1676
1916
|
}, e);
|
|
1677
1917
|
})
|
|
1678
1918
|
}),
|
|
@@ -1680,35 +1920,35 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1680
1920
|
variant: "ghost",
|
|
1681
1921
|
size: "sm",
|
|
1682
1922
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
1683
|
-
onClick: () =>
|
|
1684
|
-
children: [/* @__PURE__ */ P(
|
|
1923
|
+
onClick: () => ut([]),
|
|
1924
|
+
children: [/* @__PURE__ */ P(_e, { className: "h-3 w-3" }), "Clear"]
|
|
1685
1925
|
})
|
|
1686
1926
|
]
|
|
1687
1927
|
}),
|
|
1688
|
-
!
|
|
1928
|
+
!Ue && V.length > 0 && O.showRecordCount !== !1 && /* @__PURE__ */ F("div", {
|
|
1689
1929
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
1690
1930
|
"data-testid": "record-count-bar",
|
|
1691
1931
|
children: [
|
|
1692
1932
|
/* @__PURE__ */ P("span", {
|
|
1693
1933
|
className: "font-medium text-foreground/80",
|
|
1694
|
-
children:
|
|
1934
|
+
children: V.length === 1 ? E("list.recordCountOne", { count: V.length }) : E("list.recordCount", { count: V.length })
|
|
1695
1935
|
}),
|
|
1696
|
-
|
|
1936
|
+
Ze && /* @__PURE__ */ P("span", {
|
|
1697
1937
|
className: "text-amber-600",
|
|
1698
1938
|
"data-testid": "data-limit-warning",
|
|
1699
|
-
children:
|
|
1939
|
+
children: E("list.dataLimitReached", { limit: tt })
|
|
1700
1940
|
}),
|
|
1701
|
-
|
|
1941
|
+
O.pagination?.pageSizeOptions && O.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ F("div", {
|
|
1702
1942
|
className: "ml-auto flex items-center gap-2",
|
|
1703
|
-
children: [/* @__PURE__ */ P("span", { children:
|
|
1943
|
+
children: [/* @__PURE__ */ P("span", { children: E("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ P("select", {
|
|
1704
1944
|
"data-testid": "page-size-selector",
|
|
1705
1945
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
1706
|
-
value: String(
|
|
1946
|
+
value: String(tt),
|
|
1707
1947
|
onChange: (e) => {
|
|
1708
1948
|
let t = Number(e.target.value);
|
|
1709
|
-
|
|
1949
|
+
et(t), w.onPageSizeChange && w.onPageSizeChange(t);
|
|
1710
1950
|
},
|
|
1711
|
-
children:
|
|
1951
|
+
children: O.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ P("option", {
|
|
1712
1952
|
value: String(e),
|
|
1713
1953
|
children: e
|
|
1714
1954
|
}, e))
|
|
@@ -1716,9 +1956,9 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1716
1956
|
})
|
|
1717
1957
|
]
|
|
1718
1958
|
}),
|
|
1719
|
-
|
|
1720
|
-
...
|
|
1721
|
-
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",
|
|
1722
1962
|
children: (e) => /* @__PURE__ */ P("div", {
|
|
1723
1963
|
className: "space-y-3",
|
|
1724
1964
|
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ F("div", {
|
|
@@ -1736,23 +1976,23 @@ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1736
1976
|
]
|
|
1737
1977
|
});
|
|
1738
1978
|
});
|
|
1739
|
-
|
|
1979
|
+
W.displayName = "ListView";
|
|
1740
1980
|
//#endregion
|
|
1741
1981
|
//#region src/ObjectGallery.tsx
|
|
1742
|
-
var
|
|
1982
|
+
var Je = {
|
|
1743
1983
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
1744
1984
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
1745
1985
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
1746
|
-
},
|
|
1986
|
+
}, Ye = {
|
|
1747
1987
|
small: "aspect-square",
|
|
1748
1988
|
medium: "aspect-[4/3]",
|
|
1749
1989
|
large: "aspect-[16/10]"
|
|
1750
|
-
},
|
|
1751
|
-
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({
|
|
1752
1992
|
navigation: n.navigation,
|
|
1753
1993
|
objectName: n.objectName,
|
|
1754
1994
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
1755
|
-
}), 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) => {
|
|
1756
1996
|
if (t == null || t === "") return "";
|
|
1757
1997
|
if (typeof t == "object") return t.label ?? t.name ?? t.id ?? JSON.stringify(t);
|
|
1758
1998
|
let r = _?.fields?.[e], i = r?.type;
|
|
@@ -1765,7 +2005,7 @@ var U = {
|
|
|
1765
2005
|
let e = r.options[String(t)];
|
|
1766
2006
|
e && (i = e.label ?? i);
|
|
1767
2007
|
}
|
|
1768
|
-
return
|
|
2008
|
+
return re(n.objectName, e, String(t), i);
|
|
1769
2009
|
}
|
|
1770
2010
|
let a = typeof t == "number" ? t : Number(t);
|
|
1771
2011
|
if (Number.isFinite(a)) {
|
|
@@ -1791,7 +2031,7 @@ var U = {
|
|
|
1791
2031
|
}, [
|
|
1792
2032
|
_,
|
|
1793
2033
|
n.objectName,
|
|
1794
|
-
|
|
2034
|
+
re
|
|
1795
2035
|
]);
|
|
1796
2036
|
c(() => {
|
|
1797
2037
|
let e = !0;
|
|
@@ -1843,18 +2083,18 @@ var U = {
|
|
|
1843
2083
|
e.data,
|
|
1844
2084
|
_
|
|
1845
2085
|
]);
|
|
1846
|
-
let
|
|
1847
|
-
|
|
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) => ({
|
|
1848
2088
|
...t,
|
|
1849
|
-
[e]: t[e] === void 0 ? !
|
|
2089
|
+
[e]: t[e] === void 0 ? !oe : !t[e]
|
|
1850
2090
|
}));
|
|
1851
|
-
}, [
|
|
1852
|
-
if (!
|
|
2091
|
+
}, [oe]), ce = l(() => {
|
|
2092
|
+
if (!A || !k) return [];
|
|
1853
2093
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
1854
|
-
for (let n of
|
|
1855
|
-
let r =
|
|
2094
|
+
for (let n of D) {
|
|
2095
|
+
let r = k.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
1856
2096
|
if (!e.has(r)) {
|
|
1857
|
-
let i =
|
|
2097
|
+
let i = k.map((e) => {
|
|
1858
2098
|
let t = n[e.field];
|
|
1859
2099
|
return t != null && t !== "" ? String(t) : "(empty)";
|
|
1860
2100
|
}).join(" / ");
|
|
@@ -1865,7 +2105,7 @@ var U = {
|
|
|
1865
2105
|
}
|
|
1866
2106
|
e.get(r).items.push(n);
|
|
1867
2107
|
}
|
|
1868
|
-
let n =
|
|
2108
|
+
let n = k[0]?.order ?? "asc";
|
|
1869
2109
|
return t.sort((e, t) => {
|
|
1870
2110
|
let r = e.localeCompare(t, void 0, {
|
|
1871
2111
|
numeric: !0,
|
|
@@ -1873,7 +2113,7 @@ var U = {
|
|
|
1873
2113
|
});
|
|
1874
2114
|
return n === "desc" ? -r : r;
|
|
1875
2115
|
}), t.map((t) => {
|
|
1876
|
-
let n = e.get(t), r = t in
|
|
2116
|
+
let n = e.get(t), r = t in j ? j[t] : oe;
|
|
1877
2117
|
return {
|
|
1878
2118
|
key: t,
|
|
1879
2119
|
label: n.label,
|
|
@@ -1882,29 +2122,29 @@ var U = {
|
|
|
1882
2122
|
};
|
|
1883
2123
|
});
|
|
1884
2124
|
}, [
|
|
1885
|
-
|
|
1886
|
-
O,
|
|
2125
|
+
D,
|
|
1887
2126
|
k,
|
|
1888
2127
|
A,
|
|
1889
|
-
|
|
2128
|
+
j,
|
|
2129
|
+
oe
|
|
1890
2130
|
]);
|
|
1891
|
-
if (h && !
|
|
2131
|
+
if (h && !D.length) return /* @__PURE__ */ P("div", {
|
|
1892
2132
|
className: "p-4 text-sm text-muted-foreground",
|
|
1893
2133
|
children: "Loading Gallery..."
|
|
1894
2134
|
});
|
|
1895
|
-
if (!
|
|
2135
|
+
if (!D.length) return /* @__PURE__ */ P("div", {
|
|
1896
2136
|
className: "p-4 text-sm text-muted-foreground",
|
|
1897
2137
|
children: "No items to display"
|
|
1898
2138
|
});
|
|
1899
|
-
let
|
|
1900
|
-
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];
|
|
1901
2141
|
return /* @__PURE__ */ F(f, {
|
|
1902
2142
|
role: "listitem",
|
|
1903
2143
|
className: C("group overflow-hidden transition-all hover:shadow-md", (e.onCardClick || e.onRowClick || n.navigation) && "cursor-pointer"),
|
|
1904
2144
|
onClick: () => b.handleClick(t),
|
|
1905
2145
|
children: [/* @__PURE__ */ P("div", {
|
|
1906
|
-
className: C("w-full overflow-hidden bg-muted relative",
|
|
1907
|
-
hidden: !
|
|
2146
|
+
className: C("w-full overflow-hidden bg-muted relative", Ye[T]),
|
|
2147
|
+
hidden: !ae,
|
|
1908
2148
|
children: o ? /* @__PURE__ */ P("img", {
|
|
1909
2149
|
src: o,
|
|
1910
2150
|
alt: a,
|
|
@@ -1917,47 +2157,47 @@ var U = {
|
|
|
1917
2157
|
})
|
|
1918
2158
|
})
|
|
1919
2159
|
}), /* @__PURE__ */ F(p, {
|
|
1920
|
-
className: C("p-3",
|
|
2160
|
+
className: C("p-3", ae && "border-t"),
|
|
1921
2161
|
children: [/* @__PURE__ */ P("h3", {
|
|
1922
2162
|
className: "font-medium truncate text-sm",
|
|
1923
2163
|
title: a,
|
|
1924
2164
|
children: a
|
|
1925
|
-
}),
|
|
2165
|
+
}), te && te.length > 0 && /* @__PURE__ */ P("div", {
|
|
1926
2166
|
className: "mt-1 space-y-0.5",
|
|
1927
|
-
children:
|
|
2167
|
+
children: te.map((e) => {
|
|
1928
2168
|
let n = t[e];
|
|
1929
2169
|
return n == null || n === "" ? null : /* @__PURE__ */ P("p", {
|
|
1930
2170
|
className: "text-xs text-muted-foreground truncate",
|
|
1931
|
-
children:
|
|
2171
|
+
children: ie(e, n)
|
|
1932
2172
|
}, e);
|
|
1933
2173
|
})
|
|
1934
2174
|
})]
|
|
1935
2175
|
})]
|
|
1936
2176
|
}, i);
|
|
1937
|
-
},
|
|
1938
|
-
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),
|
|
1939
2179
|
role: "list",
|
|
1940
|
-
children: e.map((e, t) =>
|
|
2180
|
+
children: e.map((e, t) => le(e, t))
|
|
1941
2181
|
});
|
|
1942
|
-
return /* @__PURE__ */ F(
|
|
2182
|
+
return /* @__PURE__ */ F(N, { children: [A ? /* @__PURE__ */ P("div", {
|
|
1943
2183
|
className: "space-y-2",
|
|
1944
|
-
children:
|
|
2184
|
+
children: ce.map((e) => /* @__PURE__ */ F("div", {
|
|
1945
2185
|
className: "border rounded-md",
|
|
1946
2186
|
children: [/* @__PURE__ */ F("button", {
|
|
1947
2187
|
type: "button",
|
|
1948
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",
|
|
1949
|
-
onClick: () =>
|
|
2189
|
+
onClick: () => se(e.key),
|
|
1950
2190
|
children: [
|
|
1951
|
-
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" }),
|
|
1952
2192
|
/* @__PURE__ */ P("span", { children: e.label }),
|
|
1953
2193
|
/* @__PURE__ */ P("span", {
|
|
1954
2194
|
className: "ml-auto text-xs text-muted-foreground",
|
|
1955
2195
|
children: e.items.length
|
|
1956
2196
|
})
|
|
1957
2197
|
]
|
|
1958
|
-
}), !e.collapsed &&
|
|
2198
|
+
}), !e.collapsed && ue(e.items)]
|
|
1959
2199
|
}, e.key))
|
|
1960
|
-
}) :
|
|
2200
|
+
}) : ue(D), b.isOverlay && /* @__PURE__ */ P(v, {
|
|
1961
2201
|
...b,
|
|
1962
2202
|
title: "Gallery Item",
|
|
1963
2203
|
children: (e) => /* @__PURE__ */ P("div", {
|
|
@@ -1975,11 +2215,11 @@ var U = {
|
|
|
1975
2215
|
})
|
|
1976
2216
|
})] });
|
|
1977
2217
|
};
|
|
1978
|
-
e.register("object-gallery",
|
|
2218
|
+
e.register("object-gallery", Xe, {
|
|
1979
2219
|
namespace: "plugin-list",
|
|
1980
2220
|
label: "Gallery View",
|
|
1981
2221
|
category: "view"
|
|
1982
|
-
}), e.register("list-view",
|
|
2222
|
+
}), e.register("list-view", W, {
|
|
1983
2223
|
namespace: "plugin-list",
|
|
1984
2224
|
label: "List View",
|
|
1985
2225
|
category: "Views",
|
|
@@ -2056,7 +2296,7 @@ e.register("object-gallery", We, {
|
|
|
2056
2296
|
sort: [],
|
|
2057
2297
|
options: {}
|
|
2058
2298
|
}
|
|
2059
|
-
}), e.register("list",
|
|
2299
|
+
}), e.register("list", W, {
|
|
2060
2300
|
namespace: "view",
|
|
2061
2301
|
category: "view",
|
|
2062
2302
|
label: "List",
|
|
@@ -2127,4 +2367,4 @@ e.register("object-gallery", We, {
|
|
|
2127
2367
|
]
|
|
2128
2368
|
});
|
|
2129
2369
|
//#endregion
|
|
2130
|
-
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 };
|