@object-ui/plugin-list 16.1.0 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +688 -0
- package/README.md +29 -6
- package/dist/ListView.d.ts +53 -1
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ObjectGallery.d.ts +0 -1
- package/dist/ObjectGallery.d.ts.map +1 -1
- package/dist/UserFilters.d.ts +17 -0
- package/dist/UserFilters.d.ts.map +1 -1
- package/dist/index.js +1349 -1142
- package/dist/index.umd.cjs +3 -3
- package/package.json +18 -17
package/dist/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { ComponentRegistry as e,
|
|
2
|
-
import * as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Activity as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { useObjectLabel as
|
|
8
|
-
import { SchemaRenderer as
|
|
9
|
-
import { detectStatusField as
|
|
10
|
-
import { usePullToRefresh as
|
|
11
|
-
import { usePermissions as
|
|
12
|
-
import { getCellRenderer as
|
|
1
|
+
import { ComponentRegistry as e, EXPANDABLE_FIELD_TYPES as t, buildExpandFields as n, buildExportFileName as r, columnIdentity as i, getRecordDisplayName as a, mergeFilterNodes as o, normalizeListViewSchema as s, resolveConditionalFormatting as c, resolveCrudAffordances as l, rowHeightToDensityMode as u } from "@object-ui/core";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { useCallback as f, useContext as p, useEffect as m, useMemo as h, useState as g } from "react";
|
|
4
|
+
import { Button as _, Card as ee, CardContent as v, DataEmptyState as y, DropdownMenu as b, DropdownMenuContent as x, DropdownMenuItem as S, DropdownMenuTrigger as te, FilterBuilder as ne, GroupingEditor as re, Input as ie, LookupValuePicker as C, NavigationOverlay as ae, Popover as w, PopoverContent as T, PopoverTrigger as E, RefreshIndicator as D, SortBuilder as oe, cn as O } from "@object-ui/components";
|
|
5
|
+
import { Activity as se, AlertTriangle as ce, ArrowUpDown as le, BarChart3 as ue, Calendar as k, Check as de, CheckSquare as fe, ChevronDown as A, ChevronRight as pe, Download as me, EyeOff as he, GanttChartSquare as ge, Grid as j, Group as _e, Images as M, Inbox as ve, LayoutGrid as ye, ListTree as N, Loader2 as be, Map as P, Paintbrush as xe, Pencil as Se, Plus as Ce, Printer as we, RotateCw as Te, Rows2 as Ee, Rows3 as De, Rows4 as Oe, Search as ke, Settings2 as Ae, Share2 as je, ShieldAlert as Me, SlidersHorizontal as Ne, Trash2 as Pe, X as Fe, icons as Ie } from "lucide-react";
|
|
6
|
+
import { Fragment as Le, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
7
|
+
import { createSafeTranslation as L, useObjectLabel as Re, useObjectTranslation as ze, useSafeFieldLabel as Be } from "@object-ui/i18n";
|
|
8
|
+
import { SchemaRenderer as Ve, SchemaRendererContext as He, useDataScope as Ue, useDensityMode as We, useNavigationOverlay as Ge, useSafeFieldLabel as Ke } from "@object-ui/react";
|
|
9
|
+
import { detectStatusField as qe } from "@object-ui/types";
|
|
10
|
+
import { usePullToRefresh as Je } from "@object-ui/mobile";
|
|
11
|
+
import { usePermissions as Ye } from "@object-ui/permissions";
|
|
12
|
+
import { getCellRenderer as R, resolveCellRendererType as Xe } from "@object-ui/fields";
|
|
13
13
|
//#region src/ViewSwitcher.tsx
|
|
14
|
-
var
|
|
15
|
-
grid: /* @__PURE__ */
|
|
16
|
-
kanban: /* @__PURE__ */
|
|
17
|
-
gallery: /* @__PURE__ */
|
|
18
|
-
calendar: /* @__PURE__ */
|
|
19
|
-
timeline: /* @__PURE__ */
|
|
20
|
-
gantt: /* @__PURE__ */
|
|
21
|
-
map: /* @__PURE__ */
|
|
22
|
-
chart: /* @__PURE__ */
|
|
23
|
-
tree: /* @__PURE__ */
|
|
24
|
-
},
|
|
14
|
+
var Ze = {
|
|
15
|
+
grid: /* @__PURE__ */ F(j, { className: "h-4 w-4" }),
|
|
16
|
+
kanban: /* @__PURE__ */ F(ye, { className: "h-4 w-4" }),
|
|
17
|
+
gallery: /* @__PURE__ */ F(M, { className: "h-4 w-4" }),
|
|
18
|
+
calendar: /* @__PURE__ */ F(k, { className: "h-4 w-4" }),
|
|
19
|
+
timeline: /* @__PURE__ */ F(se, { className: "h-4 w-4" }),
|
|
20
|
+
gantt: /* @__PURE__ */ F(ge, { className: "h-4 w-4" }),
|
|
21
|
+
map: /* @__PURE__ */ F(P, { className: "h-4 w-4" }),
|
|
22
|
+
chart: /* @__PURE__ */ F(ue, { className: "h-4 w-4" }),
|
|
23
|
+
tree: /* @__PURE__ */ F(N, { className: "h-4 w-4" })
|
|
24
|
+
}, z = {
|
|
25
25
|
grid: "Grid",
|
|
26
26
|
kanban: "Kanban",
|
|
27
27
|
gallery: "Gallery",
|
|
@@ -31,75 +31,75 @@ var z = {
|
|
|
31
31
|
map: "Map",
|
|
32
32
|
chart: "Chart",
|
|
33
33
|
tree: "Tree"
|
|
34
|
-
},
|
|
35
|
-
let [
|
|
36
|
-
|
|
34
|
+
}, Qe = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
|
|
35
|
+
let [a, o] = d.useState(!1), s = d.useCallback((t) => {
|
|
36
|
+
o(!1), t !== e && (i && typeof document < "u" && "startViewTransition" in document ? document.startViewTransition(() => n(t)) : n(t));
|
|
37
37
|
}, [
|
|
38
38
|
i,
|
|
39
39
|
e,
|
|
40
40
|
n
|
|
41
41
|
]);
|
|
42
|
-
return t.length >= 2 && t.length <= 4 ? /* @__PURE__ */
|
|
42
|
+
return t.length >= 2 && t.length <= 4 ? /* @__PURE__ */ F("div", {
|
|
43
43
|
role: "tablist",
|
|
44
44
|
"data-testid": "view-switcher-segmented",
|
|
45
|
-
className:
|
|
45
|
+
className: O("inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher", r),
|
|
46
46
|
children: t.map((t) => {
|
|
47
47
|
let n = t === e;
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ I("button", {
|
|
49
49
|
type: "button",
|
|
50
50
|
role: "tab",
|
|
51
51
|
"aria-selected": n,
|
|
52
|
-
"aria-label":
|
|
53
|
-
title:
|
|
52
|
+
"aria-label": z[t],
|
|
53
|
+
title: z[t],
|
|
54
54
|
"data-state": n ? "on" : "off",
|
|
55
|
-
onClick: () =>
|
|
56
|
-
className:
|
|
57
|
-
children: [
|
|
55
|
+
onClick: () => s(t),
|
|
56
|
+
className: O("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[7px] text-xs font-medium transition-all duration-150", n ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"),
|
|
57
|
+
children: [Ze[t], /* @__PURE__ */ F("span", {
|
|
58
58
|
className: "hidden sm:inline-block",
|
|
59
|
-
children:
|
|
59
|
+
children: z[t]
|
|
60
60
|
})]
|
|
61
61
|
}, t);
|
|
62
62
|
})
|
|
63
|
-
}) : /* @__PURE__ */
|
|
64
|
-
open:
|
|
65
|
-
onOpenChange:
|
|
66
|
-
children: [/* @__PURE__ */
|
|
63
|
+
}) : /* @__PURE__ */ I(w, {
|
|
64
|
+
open: a,
|
|
65
|
+
onOpenChange: o,
|
|
66
|
+
children: [/* @__PURE__ */ F(E, {
|
|
67
67
|
asChild: !0,
|
|
68
|
-
children: /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ I("button", {
|
|
69
69
|
type: "button",
|
|
70
70
|
"data-testid": "view-switcher-dropdown",
|
|
71
|
-
"aria-label":
|
|
72
|
-
className:
|
|
71
|
+
"aria-label": z[e],
|
|
72
|
+
className: O("inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher", a ? "text-foreground bg-muted" : "text-muted-foreground hover:text-foreground", r),
|
|
73
73
|
children: [
|
|
74
|
-
|
|
75
|
-
/* @__PURE__ */
|
|
74
|
+
Ze[e],
|
|
75
|
+
/* @__PURE__ */ F("span", {
|
|
76
76
|
className: "hidden sm:inline-block",
|
|
77
|
-
children:
|
|
77
|
+
children: z[e]
|
|
78
78
|
}),
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ F(A, { className: "h-3 w-3 opacity-60" })
|
|
80
80
|
]
|
|
81
81
|
})
|
|
82
|
-
}), /* @__PURE__ */
|
|
82
|
+
}), /* @__PURE__ */ F(T, {
|
|
83
83
|
align: "end",
|
|
84
84
|
className: "w-44 p-1",
|
|
85
|
-
children: t.map((t) => /* @__PURE__ */
|
|
85
|
+
children: t.map((t) => /* @__PURE__ */ I("button", {
|
|
86
86
|
type: "button",
|
|
87
|
-
onClick: () =>
|
|
87
|
+
onClick: () => s(t),
|
|
88
88
|
"data-state": t === e ? "on" : "off",
|
|
89
|
-
className:
|
|
89
|
+
className: O("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors hover:bg-muted", t === e ? "text-foreground font-medium" : "text-muted-foreground"),
|
|
90
90
|
children: [
|
|
91
|
-
|
|
92
|
-
/* @__PURE__ */
|
|
91
|
+
Ze[t],
|
|
92
|
+
/* @__PURE__ */ F("span", {
|
|
93
93
|
className: "flex-1 text-left",
|
|
94
|
-
children:
|
|
94
|
+
children: z[t]
|
|
95
95
|
}),
|
|
96
|
-
t === e && /* @__PURE__ */
|
|
96
|
+
t === e && /* @__PURE__ */ F(de, { className: "h-3.5 w-3.5" })
|
|
97
97
|
]
|
|
98
98
|
}, t))
|
|
99
99
|
})]
|
|
100
100
|
});
|
|
101
|
-
},
|
|
102
|
-
let
|
|
101
|
+
}, $e = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
|
|
102
|
+
let a = d.useCallback((t) => {
|
|
103
103
|
if (!i || t === e) {
|
|
104
104
|
n(t);
|
|
105
105
|
return;
|
|
@@ -110,21 +110,21 @@ var z = {
|
|
|
110
110
|
e,
|
|
111
111
|
n
|
|
112
112
|
]);
|
|
113
|
-
return /* @__PURE__ */
|
|
114
|
-
className:
|
|
113
|
+
return /* @__PURE__ */ F("div", {
|
|
114
|
+
className: O("flex items-center gap-1 bg-transparent oui-view-switcher", r),
|
|
115
115
|
children: t.map((t) => {
|
|
116
116
|
let n = e === t;
|
|
117
|
-
return /* @__PURE__ */
|
|
117
|
+
return /* @__PURE__ */ I("button", {
|
|
118
118
|
type: "button",
|
|
119
|
-
onClick: () =>
|
|
120
|
-
"aria-label":
|
|
121
|
-
title:
|
|
119
|
+
onClick: () => a(t),
|
|
120
|
+
"aria-label": z[t],
|
|
121
|
+
title: z[t],
|
|
122
122
|
"aria-pressed": n,
|
|
123
123
|
"data-state": n ? "on" : "off",
|
|
124
|
-
className:
|
|
125
|
-
children: [
|
|
124
|
+
className: O("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"),
|
|
125
|
+
children: [Ze[t], /* @__PURE__ */ F("span", {
|
|
126
126
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
127
|
-
children:
|
|
127
|
+
children: z[t]
|
|
128
128
|
})]
|
|
129
129
|
}, t);
|
|
130
130
|
})
|
|
@@ -132,89 +132,89 @@ var z = {
|
|
|
132
132
|
};
|
|
133
133
|
//#endregion
|
|
134
134
|
//#region src/components/ViewSettingsPopover.tsx
|
|
135
|
-
function
|
|
136
|
-
let [
|
|
137
|
-
return /* @__PURE__ */
|
|
135
|
+
function B({ title: e, badge: t, onClear: n, clearLabel: r, defaultOpen: i = !0, children: a }) {
|
|
136
|
+
let [o, s] = d.useState(i);
|
|
137
|
+
return /* @__PURE__ */ I("div", {
|
|
138
138
|
className: "border-b last:border-b-0",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ I("div", {
|
|
140
140
|
className: "flex items-center justify-between px-3 py-2",
|
|
141
|
-
children: [/* @__PURE__ */
|
|
141
|
+
children: [/* @__PURE__ */ I("button", {
|
|
142
142
|
type: "button",
|
|
143
|
-
onClick: () =>
|
|
143
|
+
onClick: () => s((e) => !e),
|
|
144
144
|
className: "flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground",
|
|
145
145
|
children: [
|
|
146
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ F(A, { className: O("h-3.5 w-3.5 transition-transform", !o && "-rotate-90") }),
|
|
147
147
|
e,
|
|
148
|
-
typeof t == "number" && t > 0 && /* @__PURE__ */
|
|
148
|
+
typeof t == "number" && t > 0 && /* @__PURE__ */ F("span", {
|
|
149
149
|
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",
|
|
150
150
|
children: t
|
|
151
151
|
})
|
|
152
152
|
]
|
|
153
|
-
}), n && /* @__PURE__ */
|
|
153
|
+
}), n && /* @__PURE__ */ F("button", {
|
|
154
154
|
type: "button",
|
|
155
155
|
onClick: n,
|
|
156
156
|
className: "text-[11px] text-muted-foreground hover:text-foreground",
|
|
157
157
|
children: r
|
|
158
158
|
})]
|
|
159
|
-
}),
|
|
159
|
+
}), o && /* @__PURE__ */ F("div", {
|
|
160
160
|
className: "px-3 pb-3",
|
|
161
|
-
children:
|
|
161
|
+
children: a
|
|
162
162
|
})]
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
let { t, allFields: n, showGroup: r, groupingConfig: i, setGroupingConfig:
|
|
165
|
+
function et(e) {
|
|
166
|
+
let { t, allFields: n, showGroup: r, groupingConfig: i, setGroupingConfig: a, showColor: o, rowColorConfig: s, setRowColorConfig: c, showDensity: l, density: u, showHideFields: f, hiddenFields: p, updateHiddenFields: m, showInlineEdit: h, inlineEdit: g, setInlineEdit: ee } = e, [v, y] = d.useState(!1), b = [
|
|
167
167
|
!!i?.fields?.length,
|
|
168
|
-
!!
|
|
169
|
-
|
|
170
|
-
(
|
|
171
|
-
!!
|
|
172
|
-
].filter(Boolean).length,
|
|
173
|
-
return /* @__PURE__ */
|
|
174
|
-
open:
|
|
175
|
-
onOpenChange:
|
|
176
|
-
children: [/* @__PURE__ */
|
|
168
|
+
!!s?.field,
|
|
169
|
+
u && u.mode !== "compact",
|
|
170
|
+
(p?.size ?? 0) > 0,
|
|
171
|
+
!!g
|
|
172
|
+
].filter(Boolean).length, x = u?.mode === "compact" ? Oe : u?.mode === "comfortable" ? De : Ee, S = t("list.viewSettings", { defaultValue: "View settings" });
|
|
173
|
+
return /* @__PURE__ */ I(w, {
|
|
174
|
+
open: v,
|
|
175
|
+
onOpenChange: y,
|
|
176
|
+
children: [/* @__PURE__ */ F(E, {
|
|
177
177
|
asChild: !0,
|
|
178
|
-
children: /* @__PURE__ */
|
|
178
|
+
children: /* @__PURE__ */ I(_, {
|
|
179
179
|
variant: "ghost",
|
|
180
180
|
size: "sm",
|
|
181
|
-
"aria-label":
|
|
182
|
-
title:
|
|
183
|
-
className:
|
|
181
|
+
"aria-label": S,
|
|
182
|
+
title: S,
|
|
183
|
+
className: O("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", b > 0 && "text-foreground font-medium"),
|
|
184
184
|
"data-testid": "view-settings-trigger",
|
|
185
185
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ F(Ae, { className: "h-3.5 w-3.5 sm:mr-1.5" }),
|
|
187
|
+
/* @__PURE__ */ F("span", {
|
|
188
188
|
className: "hidden sm:inline",
|
|
189
|
-
children:
|
|
189
|
+
children: S
|
|
190
190
|
}),
|
|
191
|
-
|
|
191
|
+
b > 0 && /* @__PURE__ */ F("span", {
|
|
192
192
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
193
|
-
children:
|
|
193
|
+
children: b
|
|
194
194
|
})
|
|
195
195
|
]
|
|
196
196
|
})
|
|
197
|
-
}), /* @__PURE__ */
|
|
197
|
+
}), /* @__PURE__ */ I(T, {
|
|
198
198
|
align: "end",
|
|
199
199
|
className: "w-80 p-0",
|
|
200
200
|
"data-testid": "view-settings-content",
|
|
201
201
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ I("div", {
|
|
203
203
|
className: "px-3 py-2 border-b",
|
|
204
|
-
children: [/* @__PURE__ */
|
|
204
|
+
children: [/* @__PURE__ */ F("div", {
|
|
205
205
|
className: "text-sm font-semibold",
|
|
206
|
-
children:
|
|
207
|
-
}), /* @__PURE__ */
|
|
206
|
+
children: S
|
|
207
|
+
}), /* @__PURE__ */ F("div", {
|
|
208
208
|
className: "text-[11px] text-muted-foreground",
|
|
209
209
|
children: t("list.viewSettingsHint", { defaultValue: "Grouping, color, density, and visible fields." })
|
|
210
210
|
})]
|
|
211
211
|
}),
|
|
212
|
-
r &&
|
|
212
|
+
r && a && /* @__PURE__ */ F(B, {
|
|
213
213
|
title: t("list.group", { defaultValue: "Group" }),
|
|
214
214
|
badge: i?.fields?.length || 0,
|
|
215
|
-
onClear: i ? () =>
|
|
215
|
+
onClear: i ? () => a(void 0) : void 0,
|
|
216
216
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
217
|
-
children: /* @__PURE__ */
|
|
217
|
+
children: /* @__PURE__ */ F(re, {
|
|
218
218
|
value: i,
|
|
219
219
|
fieldOptions: n.map((e) => ({
|
|
220
220
|
value: e.name,
|
|
@@ -226,91 +226,91 @@ function Ke(e) {
|
|
|
226
226
|
collapseTitle: t("list.collapsedByDefault", "Collapsed by default"),
|
|
227
227
|
removeTitle: t("list.removeGroup", "Remove")
|
|
228
228
|
},
|
|
229
|
-
onChange: (e) =>
|
|
229
|
+
onChange: (e) => a(e)
|
|
230
230
|
})
|
|
231
231
|
}),
|
|
232
|
-
|
|
232
|
+
o && c && /* @__PURE__ */ I(B, {
|
|
233
233
|
title: t("list.color", { defaultValue: "Row color" }),
|
|
234
|
-
onClear:
|
|
234
|
+
onClear: s ? () => c(void 0) : void 0,
|
|
235
235
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
236
|
-
defaultOpen: !!
|
|
237
|
-
children: [/* @__PURE__ */
|
|
236
|
+
defaultOpen: !!s,
|
|
237
|
+
children: [/* @__PURE__ */ F("label", {
|
|
238
238
|
className: "block text-[11px] text-muted-foreground mb-1",
|
|
239
239
|
children: t("list.colorByField", { defaultValue: "Color by field" })
|
|
240
|
-
}), /* @__PURE__ */
|
|
240
|
+
}), /* @__PURE__ */ I("select", {
|
|
241
241
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
242
|
-
value:
|
|
242
|
+
value: s?.field || "",
|
|
243
243
|
onChange: (e) => {
|
|
244
244
|
let t = e.target.value;
|
|
245
|
-
|
|
245
|
+
c(t ? {
|
|
246
246
|
field: t,
|
|
247
|
-
colors:
|
|
247
|
+
colors: s?.colors || {}
|
|
248
248
|
} : void 0);
|
|
249
249
|
},
|
|
250
250
|
"data-testid": "color-field-select",
|
|
251
|
-
children: [/* @__PURE__ */
|
|
251
|
+
children: [/* @__PURE__ */ F("option", {
|
|
252
252
|
value: "",
|
|
253
253
|
children: t("list.none", { defaultValue: "None" })
|
|
254
|
-
}), n.map((e) => /* @__PURE__ */
|
|
254
|
+
}), n.map((e) => /* @__PURE__ */ F("option", {
|
|
255
255
|
value: e.name,
|
|
256
256
|
children: e.label || e.name
|
|
257
257
|
}, e.name))]
|
|
258
258
|
})]
|
|
259
259
|
}),
|
|
260
|
-
|
|
260
|
+
l && u && /* @__PURE__ */ F(B, {
|
|
261
261
|
title: t("grid.toolbar.densityMode", { defaultValue: "Density" }),
|
|
262
|
-
defaultOpen:
|
|
263
|
-
children: /* @__PURE__ */
|
|
262
|
+
defaultOpen: u.mode !== "compact",
|
|
263
|
+
children: /* @__PURE__ */ I("div", {
|
|
264
264
|
className: "flex items-center gap-2",
|
|
265
|
-
children: [/* @__PURE__ */
|
|
265
|
+
children: [/* @__PURE__ */ I(_, {
|
|
266
266
|
variant: "outline",
|
|
267
267
|
size: "sm",
|
|
268
268
|
className: "h-7 gap-1.5",
|
|
269
|
-
onClick:
|
|
269
|
+
onClick: u.cycle,
|
|
270
270
|
"data-testid": "view-settings-density-cycle",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
271
|
+
children: [/* @__PURE__ */ F(x, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ F("span", {
|
|
272
272
|
className: "text-xs",
|
|
273
|
-
children:
|
|
273
|
+
children: u.mode === "compact" ? t("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : u.mode === "comfortable" ? t("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : t("grid.toolbar.densitySpacious", { defaultValue: "Spacious" })
|
|
274
274
|
})]
|
|
275
|
-
}), /* @__PURE__ */
|
|
275
|
+
}), /* @__PURE__ */ F("span", {
|
|
276
276
|
className: "text-[11px] text-muted-foreground",
|
|
277
277
|
children: t("grid.toolbar.densityCycleShortHint", { defaultValue: "Click to cycle" })
|
|
278
278
|
})]
|
|
279
279
|
})
|
|
280
280
|
}),
|
|
281
|
-
|
|
281
|
+
h && ee && /* @__PURE__ */ F(B, {
|
|
282
282
|
title: t("list.recordEditingTitle", { defaultValue: "Record editing" }),
|
|
283
|
-
defaultOpen: !!
|
|
284
|
-
children: /* @__PURE__ */
|
|
283
|
+
defaultOpen: !!g,
|
|
284
|
+
children: /* @__PURE__ */ I("label", {
|
|
285
285
|
className: "flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
286
|
-
children: [/* @__PURE__ */
|
|
286
|
+
children: [/* @__PURE__ */ F("input", {
|
|
287
287
|
type: "checkbox",
|
|
288
|
-
checked: !!
|
|
289
|
-
onChange: () =>
|
|
288
|
+
checked: !!g,
|
|
289
|
+
onChange: () => ee(!g),
|
|
290
290
|
className: "rounded border-input",
|
|
291
291
|
"data-testid": "view-settings-inline-edit"
|
|
292
|
-
}), /* @__PURE__ */
|
|
292
|
+
}), /* @__PURE__ */ F("span", { children: t("list.inlineEditLabel", { defaultValue: "Edit records inline (click a cell to edit)" }) })]
|
|
293
293
|
})
|
|
294
294
|
}),
|
|
295
|
-
|
|
295
|
+
f && p && m && /* @__PURE__ */ F(B, {
|
|
296
296
|
title: t("list.hideFieldsTitle", { defaultValue: "Hide fields" }),
|
|
297
|
-
badge:
|
|
298
|
-
onClear:
|
|
297
|
+
badge: p.size,
|
|
298
|
+
onClear: p.size > 0 ? () => m(/* @__PURE__ */ new Set()) : void 0,
|
|
299
299
|
clearLabel: t("list.showAll", { defaultValue: "Show all" }),
|
|
300
|
-
defaultOpen:
|
|
301
|
-
children: /* @__PURE__ */
|
|
300
|
+
defaultOpen: p.size > 0,
|
|
301
|
+
children: /* @__PURE__ */ F("div", {
|
|
302
302
|
className: "max-h-48 overflow-y-auto space-y-0.5",
|
|
303
|
-
children: n.map((e) => /* @__PURE__ */
|
|
303
|
+
children: n.map((e) => /* @__PURE__ */ I("label", {
|
|
304
304
|
className: "flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
305
|
-
children: [/* @__PURE__ */
|
|
305
|
+
children: [/* @__PURE__ */ F("input", {
|
|
306
306
|
type: "checkbox",
|
|
307
|
-
checked: !
|
|
307
|
+
checked: !p.has(e.name),
|
|
308
308
|
onChange: () => {
|
|
309
|
-
let t = new Set(
|
|
310
|
-
t.has(e.name) ? t.delete(e.name) : t.add(e.name),
|
|
309
|
+
let t = new Set(p);
|
|
310
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), m(t);
|
|
311
311
|
},
|
|
312
312
|
className: "rounded border-input"
|
|
313
|
-
}), /* @__PURE__ */
|
|
313
|
+
}), /* @__PURE__ */ F("span", {
|
|
314
314
|
className: "truncate",
|
|
315
315
|
children: e.label || e.name
|
|
316
316
|
})]
|
|
@@ -323,8 +323,8 @@ function Ke(e) {
|
|
|
323
323
|
}
|
|
324
324
|
//#endregion
|
|
325
325
|
//#region src/UserFilters.tsx
|
|
326
|
-
function
|
|
327
|
-
let { t: e } =
|
|
326
|
+
function tt() {
|
|
327
|
+
let { t: e } = ze(), t = e("common.more");
|
|
328
328
|
return !t || t === "common.more" ? "More" : t;
|
|
329
329
|
}
|
|
330
330
|
var V = /* @__PURE__ */ new Set([
|
|
@@ -332,8 +332,14 @@ var V = /* @__PURE__ */ new Set([
|
|
|
332
332
|
"master_detail",
|
|
333
333
|
"user",
|
|
334
334
|
"owner"
|
|
335
|
-
])
|
|
336
|
-
|
|
335
|
+
]), H = {
|
|
336
|
+
select: "single-choice",
|
|
337
|
+
"multi-select": "multi-choice",
|
|
338
|
+
boolean: "multi-choice",
|
|
339
|
+
"date-range": "range",
|
|
340
|
+
text: "text"
|
|
341
|
+
};
|
|
342
|
+
function nt(e) {
|
|
337
343
|
switch (e) {
|
|
338
344
|
case void 0:
|
|
339
345
|
case "equals":
|
|
@@ -358,21 +364,21 @@ function Je(e) {
|
|
|
358
364
|
default: return e;
|
|
359
365
|
}
|
|
360
366
|
}
|
|
361
|
-
function
|
|
367
|
+
function rt(e) {
|
|
362
368
|
return (e || []).filter((e) => e && (e.id || e.name)).map((e) => ({
|
|
363
369
|
id: e.id ?? e.name,
|
|
364
370
|
label: typeof e.label == "string" ? e.label : e.label?.toString?.() ?? e.id ?? e.name,
|
|
365
371
|
filters: Array.isArray(e.filters) ? e.filters : Array.isArray(e.filter) ? e.filter.filter((e) => e && typeof e.field == "string").map((e) => [
|
|
366
372
|
e.field,
|
|
367
|
-
|
|
373
|
+
nt(e.operator),
|
|
368
374
|
e.value
|
|
369
375
|
]) : [],
|
|
370
376
|
default: e.default ?? e.isDefault
|
|
371
377
|
}));
|
|
372
378
|
}
|
|
373
|
-
function
|
|
379
|
+
function it({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a, initialSelections: o, onSelectionsChange: s }) {
|
|
374
380
|
switch (e.element) {
|
|
375
|
-
case "dropdown": return /* @__PURE__ */
|
|
381
|
+
case "dropdown": return /* @__PURE__ */ F(U, {
|
|
376
382
|
fields: e.fields || [],
|
|
377
383
|
objectDef: t,
|
|
378
384
|
data: n,
|
|
@@ -382,8 +388,8 @@ function Ye({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
382
388
|
initialSelections: o,
|
|
383
389
|
onSelectionsChange: s
|
|
384
390
|
});
|
|
385
|
-
case "tabs": return /* @__PURE__ */
|
|
386
|
-
tabs:
|
|
391
|
+
case "tabs": return /* @__PURE__ */ F(ot, {
|
|
392
|
+
tabs: rt(e.tabs || []),
|
|
387
393
|
showAllRecords: e.showAllRecords !== !1,
|
|
388
394
|
allowAddTab: e.allowAddTab,
|
|
389
395
|
onFilterChange: r,
|
|
@@ -391,10 +397,15 @@ function Ye({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
|
|
|
391
397
|
initialTab: typeof o?._tab?.[0] == "string" ? o._tab[0] : void 0,
|
|
392
398
|
onSelectionsChange: s
|
|
393
399
|
});
|
|
400
|
+
case "toggle": return /* @__PURE__ */ F(W, {
|
|
401
|
+
fields: e.fields || [],
|
|
402
|
+
onFilterChange: r,
|
|
403
|
+
className: a
|
|
404
|
+
});
|
|
394
405
|
default: return null;
|
|
395
406
|
}
|
|
396
407
|
}
|
|
397
|
-
function
|
|
408
|
+
function at(e, t, n, r) {
|
|
398
409
|
return e.map((e) => {
|
|
399
410
|
let i = e.options ? [...e.options] : [], a = e.type, o, s, c, l;
|
|
400
411
|
if (t?.fields) {
|
|
@@ -436,22 +447,22 @@ function U(e, t, n, r) {
|
|
|
436
447
|
};
|
|
437
448
|
});
|
|
438
449
|
}
|
|
439
|
-
function
|
|
440
|
-
let { fieldLabel:
|
|
450
|
+
function U({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i, className: a, initialSelections: o, onSelectionsChange: s }) {
|
|
451
|
+
let { fieldLabel: c, translateOptions: l } = Be(), u = tt(), f = t?.name, p = d.useMemo(() => new Map(e.map((e) => [e.field, H[e.type ?? ""]])), [e]), [m, h] = d.useState(() => {
|
|
441
452
|
let t = {};
|
|
442
453
|
return e.forEach((e) => {
|
|
443
454
|
e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
|
|
444
|
-
let n =
|
|
445
|
-
n && n.length > 0 && (t[e.field] = n);
|
|
455
|
+
let n = o?.[e.field];
|
|
456
|
+
n && n.length > 0 && (t[e.field] = n), p.get(e.field) === "single-choice" && (t[e.field]?.length ?? 0) > 1 && (t[e.field] = t[e.field].slice(0, 1));
|
|
446
457
|
}), t;
|
|
447
|
-
}),
|
|
458
|
+
}), g = d.useRef({}), _ = d.useMemo(() => at(e, t, n, {
|
|
448
459
|
objectName: f,
|
|
449
|
-
fieldLabel:
|
|
450
|
-
translateOptions:
|
|
460
|
+
fieldLabel: c,
|
|
461
|
+
translateOptions: l
|
|
451
462
|
}).map((e) => {
|
|
452
463
|
if (!e.showCount) return e;
|
|
453
|
-
if ((
|
|
454
|
-
let t =
|
|
464
|
+
if ((m[e.field] || []).length === 0) return g.current[e.field] = new Map(e.options.map((e) => [String(e.value), e.count ?? 0])), e;
|
|
465
|
+
let t = g.current[e.field];
|
|
455
466
|
return t ? {
|
|
456
467
|
...e,
|
|
457
468
|
options: e.options.map((e) => ({
|
|
@@ -464,65 +475,90 @@ function Xe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
464
475
|
t,
|
|
465
476
|
n,
|
|
466
477
|
f,
|
|
478
|
+
c,
|
|
467
479
|
l,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
e
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
480
|
+
m
|
|
481
|
+
]), ee = d.useCallback((e) => {
|
|
482
|
+
r(Object.entries(e).flatMap(([e, t]) => {
|
|
483
|
+
if (t.length === 0) return [];
|
|
484
|
+
switch (p.get(e)) {
|
|
485
|
+
case "range": {
|
|
486
|
+
let [n, r] = t, i = [];
|
|
487
|
+
return n !== void 0 && n !== "" && i.push([
|
|
488
|
+
e,
|
|
489
|
+
">=",
|
|
490
|
+
n
|
|
491
|
+
]), r !== void 0 && r !== "" && i.push([
|
|
492
|
+
e,
|
|
493
|
+
"<=",
|
|
494
|
+
r
|
|
495
|
+
]), i;
|
|
496
|
+
}
|
|
497
|
+
case "text": {
|
|
498
|
+
let n = String(t[0] ?? "").trim();
|
|
499
|
+
return n ? [[
|
|
500
|
+
e,
|
|
501
|
+
"contains",
|
|
502
|
+
n
|
|
503
|
+
]] : [];
|
|
504
|
+
}
|
|
505
|
+
default: return [[
|
|
506
|
+
e,
|
|
507
|
+
"in",
|
|
508
|
+
t
|
|
509
|
+
]];
|
|
510
|
+
}
|
|
511
|
+
}));
|
|
512
|
+
}, [r, p]), v = (e, t) => {
|
|
477
513
|
let n = {
|
|
478
|
-
...
|
|
514
|
+
...m,
|
|
479
515
|
[e]: t
|
|
480
516
|
};
|
|
481
|
-
|
|
517
|
+
h(n), ee(n), s?.(n);
|
|
482
518
|
};
|
|
483
|
-
|
|
484
|
-
let e =
|
|
519
|
+
d.useEffect(() => {
|
|
520
|
+
let e = m, t = {}, n = !1;
|
|
485
521
|
for (let [r, i] of Object.entries(e)) {
|
|
486
|
-
let e =
|
|
522
|
+
let e = _.find((e) => e.field === r), a = i.map((t) => {
|
|
487
523
|
if (!e || typeof t != "string") return t;
|
|
488
524
|
let n = e.options.find((e) => String(e.value) === t);
|
|
489
525
|
return n && n.value !== t ? n.value : e.type === "boolean" && (t === "true" || t === "false") ? t === "true" : t;
|
|
490
526
|
});
|
|
491
527
|
t[r] = a, a.some((e, t) => e !== i[t]) && (n = !0);
|
|
492
528
|
}
|
|
493
|
-
n && (
|
|
529
|
+
n && (h(t), e = t), Object.values(e).some((e) => e.length > 0) && ee(e);
|
|
494
530
|
}, []);
|
|
495
|
-
let
|
|
496
|
-
let t =
|
|
497
|
-
return /* @__PURE__ */
|
|
531
|
+
let y = i !== void 0 && i < _.length ? _.slice(0, i) : _, b = i !== void 0 && i < _.length ? _.slice(i) : [], x = (e) => {
|
|
532
|
+
let t = m[e.field] || [], n = p.get(e.field), r = t.filter((e) => e !== "" && e != null).length, i = r > 0, a = n === "single-choice", o = V.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), s = o ? "w-72" : "w-56";
|
|
533
|
+
return /* @__PURE__ */ I(w, { children: [/* @__PURE__ */ F(E, {
|
|
498
534
|
asChild: !0,
|
|
499
|
-
children: /* @__PURE__ */
|
|
535
|
+
children: /* @__PURE__ */ I("button", {
|
|
500
536
|
"data-testid": `filter-badge-${e.field}`,
|
|
501
|
-
className:
|
|
537
|
+
className: O("inline-flex items-center gap-1 h-7 px-2 text-xs transition-colors shrink-0 rounded-md", i ? "text-foreground font-medium" : "text-muted-foreground hover:text-foreground"),
|
|
502
538
|
children: [
|
|
503
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ F("span", {
|
|
504
540
|
className: "truncate max-w-[100px]",
|
|
505
541
|
children: e.label || e.field
|
|
506
542
|
}),
|
|
507
|
-
|
|
543
|
+
i && /* @__PURE__ */ F("span", {
|
|
508
544
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
509
|
-
children:
|
|
545
|
+
children: r
|
|
510
546
|
}),
|
|
511
|
-
|
|
547
|
+
i ? /* @__PURE__ */ F(Fe, {
|
|
512
548
|
className: "h-3 w-3 opacity-60 hover:opacity-100",
|
|
513
549
|
"data-testid": `filter-clear-${e.field}`,
|
|
514
550
|
onClick: (t) => {
|
|
515
551
|
t.stopPropagation(), v(e.field, []);
|
|
516
552
|
}
|
|
517
|
-
}) : /* @__PURE__ */
|
|
553
|
+
}) : /* @__PURE__ */ F(A, { className: "h-3 w-3 opacity-60" })
|
|
518
554
|
]
|
|
519
555
|
})
|
|
520
|
-
}), /* @__PURE__ */
|
|
556
|
+
}), /* @__PURE__ */ F(T, {
|
|
521
557
|
align: "start",
|
|
522
|
-
className:
|
|
523
|
-
children:
|
|
558
|
+
className: O(s, "p-2"),
|
|
559
|
+
children: o ? /* @__PURE__ */ F("div", {
|
|
524
560
|
"data-testid": `filter-lookup-${e.field}`,
|
|
525
|
-
children: /* @__PURE__ */
|
|
561
|
+
children: /* @__PURE__ */ F(C, {
|
|
526
562
|
field: {
|
|
527
563
|
value: e.field,
|
|
528
564
|
label: e.label || e.field,
|
|
@@ -538,33 +574,69 @@ function Xe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
538
574
|
v(e.field, n);
|
|
539
575
|
}
|
|
540
576
|
})
|
|
541
|
-
}) : /* @__PURE__ */
|
|
577
|
+
}) : n === "range" ? /* @__PURE__ */ F("div", {
|
|
578
|
+
className: "space-y-2 p-1",
|
|
579
|
+
"data-testid": `filter-range-${e.field}`,
|
|
580
|
+
children: [0, 1].map((n) => /* @__PURE__ */ I("label", {
|
|
581
|
+
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
582
|
+
children: [/* @__PURE__ */ F("span", {
|
|
583
|
+
className: "w-8 shrink-0",
|
|
584
|
+
children: n === 0 ? "From" : "To"
|
|
585
|
+
}), /* @__PURE__ */ F("input", {
|
|
586
|
+
type: "date",
|
|
587
|
+
"data-testid": `filter-range-${e.field}-${n === 0 ? "from" : "to"}`,
|
|
588
|
+
value: String(t[n] ?? ""),
|
|
589
|
+
onChange: (r) => {
|
|
590
|
+
let i = [String(t[0] ?? ""), String(t[1] ?? "")];
|
|
591
|
+
i[n] = r.target.value, v(e.field, i[0] === "" && i[1] === "" ? [] : i);
|
|
592
|
+
},
|
|
593
|
+
className: "h-7 flex-1 rounded border border-input bg-background px-2 text-xs text-foreground"
|
|
594
|
+
})]
|
|
595
|
+
}, n))
|
|
596
|
+
}) : n === "text" ? /* @__PURE__ */ F("input", {
|
|
597
|
+
type: "search",
|
|
598
|
+
"data-testid": `filter-text-${e.field}`,
|
|
599
|
+
defaultValue: String(t[0] ?? ""),
|
|
600
|
+
placeholder: e.label || e.field,
|
|
601
|
+
onBlur: (t) => {
|
|
602
|
+
let n = t.target.value.trim();
|
|
603
|
+
v(e.field, n ? [n] : []);
|
|
604
|
+
},
|
|
605
|
+
onKeyDown: (t) => {
|
|
606
|
+
if (t.key === "Enter") {
|
|
607
|
+
let n = t.target.value.trim();
|
|
608
|
+
v(e.field, n ? [n] : []);
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
className: "h-8 w-full rounded border border-input bg-background px-2 text-xs text-foreground"
|
|
612
|
+
}) : /* @__PURE__ */ F("div", {
|
|
542
613
|
className: "max-h-60 overflow-y-auto space-y-0.5",
|
|
543
614
|
"data-testid": `filter-options-${e.field}`,
|
|
544
|
-
children: e.options.length === 0 ? /* @__PURE__ */
|
|
615
|
+
children: e.options.length === 0 ? /* @__PURE__ */ F("div", {
|
|
545
616
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
546
617
|
children: "No options"
|
|
547
|
-
}) : e.options.map((n) => /* @__PURE__ */
|
|
548
|
-
className:
|
|
618
|
+
}) : e.options.map((n) => /* @__PURE__ */ I("label", {
|
|
619
|
+
className: O("flex items-center gap-2 text-sm py-1.5 px-2 rounded cursor-pointer", t.includes(n.value) ? "bg-primary/5 text-primary" : "hover:bg-muted"),
|
|
549
620
|
children: [
|
|
550
|
-
/* @__PURE__ */
|
|
551
|
-
type: "checkbox",
|
|
621
|
+
/* @__PURE__ */ F("input", {
|
|
622
|
+
type: a ? "radio" : "checkbox",
|
|
623
|
+
name: a ? `user-filter-${e.field}` : void 0,
|
|
552
624
|
checked: t.includes(n.value),
|
|
553
625
|
onChange: () => {
|
|
554
|
-
let r = t.includes(n.value) ? t.filter((e) => e !== n.value) : [...t, n.value];
|
|
626
|
+
let r = a ? [n.value] : t.includes(n.value) ? t.filter((e) => e !== n.value) : [...t, n.value];
|
|
555
627
|
v(e.field, r);
|
|
556
628
|
},
|
|
557
|
-
className: "rounded border-input"
|
|
629
|
+
className: a ? "border-input" : "rounded border-input"
|
|
558
630
|
}),
|
|
559
|
-
n.color && /* @__PURE__ */
|
|
631
|
+
n.color && /* @__PURE__ */ F("span", {
|
|
560
632
|
className: "h-2.5 w-2.5 rounded-full shrink-0",
|
|
561
633
|
style: { backgroundColor: n.color }
|
|
562
634
|
}),
|
|
563
|
-
/* @__PURE__ */
|
|
635
|
+
/* @__PURE__ */ F("span", {
|
|
564
636
|
className: "truncate flex-1",
|
|
565
637
|
children: n.label
|
|
566
638
|
}),
|
|
567
|
-
n.count !== void 0 && /* @__PURE__ */
|
|
639
|
+
n.count !== void 0 && /* @__PURE__ */ F("span", {
|
|
568
640
|
className: "text-xs text-muted-foreground",
|
|
569
641
|
children: n.count
|
|
570
642
|
})
|
|
@@ -573,46 +645,46 @@ function Xe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
|
|
|
573
645
|
})
|
|
574
646
|
})] }, e.field);
|
|
575
647
|
};
|
|
576
|
-
return /* @__PURE__ */
|
|
577
|
-
className:
|
|
648
|
+
return /* @__PURE__ */ F("div", {
|
|
649
|
+
className: O("flex items-center gap-0.5 overflow-x-auto", a),
|
|
578
650
|
"data-testid": "user-filters-dropdown",
|
|
579
|
-
children:
|
|
651
|
+
children: _.length === 0 ? /* @__PURE__ */ F("span", {
|
|
580
652
|
className: "text-xs text-muted-foreground",
|
|
581
653
|
"data-testid": "user-filters-empty",
|
|
582
654
|
children: "No filter fields"
|
|
583
|
-
}) : /* @__PURE__ */
|
|
655
|
+
}) : /* @__PURE__ */ I(Le, { children: [y.map(x), b.length > 0 && /* @__PURE__ */ I(w, { children: [/* @__PURE__ */ F(E, {
|
|
584
656
|
asChild: !0,
|
|
585
|
-
children: /* @__PURE__ */
|
|
657
|
+
children: /* @__PURE__ */ I("button", {
|
|
586
658
|
"data-testid": "user-filters-more",
|
|
587
659
|
className: "inline-flex items-center gap-1 h-7 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 rounded-md",
|
|
588
660
|
children: [
|
|
589
|
-
/* @__PURE__ */
|
|
590
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ F("span", { children: u }),
|
|
662
|
+
/* @__PURE__ */ F("span", {
|
|
591
663
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
592
|
-
children:
|
|
664
|
+
children: b.length
|
|
593
665
|
}),
|
|
594
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ F(A, { className: "h-3 w-3 opacity-60" })
|
|
595
667
|
]
|
|
596
668
|
})
|
|
597
|
-
}), /* @__PURE__ */
|
|
669
|
+
}), /* @__PURE__ */ F(T, {
|
|
598
670
|
align: "start",
|
|
599
671
|
className: "w-64 p-2",
|
|
600
672
|
"data-testid": "user-filters-more-content",
|
|
601
|
-
children: /* @__PURE__ */
|
|
673
|
+
children: /* @__PURE__ */ F("div", {
|
|
602
674
|
className: "space-y-1",
|
|
603
|
-
children:
|
|
675
|
+
children: b.map(x)
|
|
604
676
|
})
|
|
605
677
|
})] })] })
|
|
606
678
|
});
|
|
607
679
|
}
|
|
608
|
-
function
|
|
609
|
-
let [
|
|
610
|
-
|
|
680
|
+
function ot({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: i, initialTab: a, onSelectionsChange: o }) {
|
|
681
|
+
let [s, c] = d.useState(() => a && (a === "__all__" || e.some((e) => e.id === a)) ? a : e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), l = d.useCallback((t) => {
|
|
682
|
+
c(t), r(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []), o?.({ _tab: [t] });
|
|
611
683
|
}, [
|
|
612
684
|
e,
|
|
613
685
|
r,
|
|
614
|
-
|
|
615
|
-
]),
|
|
686
|
+
o
|
|
687
|
+
]), u = d.useMemo(() => {
|
|
616
688
|
let n = [...e];
|
|
617
689
|
return t && n.push({
|
|
618
690
|
id: "__all__",
|
|
@@ -620,71 +692,115 @@ function Ze({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
|
|
|
620
692
|
filters: []
|
|
621
693
|
}), n;
|
|
622
694
|
}, [e, t]);
|
|
623
|
-
return
|
|
624
|
-
if (
|
|
625
|
-
let t = e.find((e) => e.id ===
|
|
695
|
+
return d.useEffect(() => {
|
|
696
|
+
if (s && s !== "__all__") {
|
|
697
|
+
let t = e.find((e) => e.id === s);
|
|
626
698
|
t && r(t.filters || []);
|
|
627
699
|
}
|
|
628
|
-
}, []), /* @__PURE__ */
|
|
629
|
-
className:
|
|
700
|
+
}, []), /* @__PURE__ */ I("div", {
|
|
701
|
+
className: O("flex items-center gap-0.5 overflow-x-auto", i),
|
|
630
702
|
"data-testid": "user-filters-tabs",
|
|
631
|
-
children: [
|
|
703
|
+
children: [u.map((e) => {
|
|
632
704
|
let t = e.id ?? e.name ?? "";
|
|
633
|
-
return /* @__PURE__ */
|
|
705
|
+
return /* @__PURE__ */ F("button", {
|
|
634
706
|
"data-testid": `filter-tab-${t}`,
|
|
635
|
-
onClick: () =>
|
|
636
|
-
className:
|
|
707
|
+
onClick: () => l(t),
|
|
708
|
+
className: O("inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0", s === t ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted"),
|
|
637
709
|
children: e.label
|
|
638
710
|
}, t);
|
|
639
|
-
}), n && /* @__PURE__ */
|
|
711
|
+
}), n && /* @__PURE__ */ F("button", {
|
|
640
712
|
className: "inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",
|
|
641
713
|
"data-testid": "filter-tab-add",
|
|
642
714
|
title: "Add filter tab",
|
|
643
|
-
children: /* @__PURE__ */
|
|
715
|
+
children: /* @__PURE__ */ F(Ce, { className: "h-3.5 w-3.5" })
|
|
644
716
|
})]
|
|
645
717
|
});
|
|
646
718
|
}
|
|
719
|
+
function W({ fields: e, onFilterChange: t, className: n }) {
|
|
720
|
+
let [r, i] = d.useState(() => {
|
|
721
|
+
let t = /* @__PURE__ */ new Set();
|
|
722
|
+
return e.forEach((e) => {
|
|
723
|
+
e.defaultValues && e.defaultValues.length > 0 && t.add(e.field);
|
|
724
|
+
}), t;
|
|
725
|
+
}), a = d.useCallback((n) => {
|
|
726
|
+
t(Array.from(n).map((t) => {
|
|
727
|
+
let n = e.find((e) => e.field === t);
|
|
728
|
+
return n?.defaultValues ? [
|
|
729
|
+
t,
|
|
730
|
+
"in",
|
|
731
|
+
n.defaultValues
|
|
732
|
+
] : [
|
|
733
|
+
t,
|
|
734
|
+
"!=",
|
|
735
|
+
null
|
|
736
|
+
];
|
|
737
|
+
}));
|
|
738
|
+
}, [e, t]), o = (e) => {
|
|
739
|
+
i((t) => {
|
|
740
|
+
let n = new Set(t);
|
|
741
|
+
return n.has(e) ? n.delete(e) : n.add(e), a(n), n;
|
|
742
|
+
});
|
|
743
|
+
};
|
|
744
|
+
return d.useEffect(() => {
|
|
745
|
+
r.size > 0 && a(r);
|
|
746
|
+
}, []), /* @__PURE__ */ F("div", {
|
|
747
|
+
className: O("flex items-center gap-1 overflow-x-auto", n),
|
|
748
|
+
"data-testid": "user-filters-toggle",
|
|
749
|
+
children: e.map((e) => /* @__PURE__ */ F(_, {
|
|
750
|
+
variant: r.has(e.field) ? "default" : "outline",
|
|
751
|
+
size: "sm",
|
|
752
|
+
className: "h-7 px-3 text-xs shrink-0",
|
|
753
|
+
"data-testid": `filter-toggle-${e.field}`,
|
|
754
|
+
onClick: () => o(e.field),
|
|
755
|
+
children: e.label || e.field
|
|
756
|
+
}, e.field))
|
|
757
|
+
});
|
|
758
|
+
}
|
|
647
759
|
//#endregion
|
|
648
760
|
//#region src/ListView.tsx
|
|
649
|
-
function
|
|
650
|
-
switch (e) {
|
|
761
|
+
function st(e) {
|
|
762
|
+
switch (e.toLowerCase().replace(/[_\s]/g, "")) {
|
|
651
763
|
case "equals":
|
|
652
764
|
case "eq": return "=";
|
|
653
|
-
case "
|
|
654
|
-
case "not_equals":
|
|
765
|
+
case "notequals":
|
|
655
766
|
case "ne":
|
|
656
767
|
case "neq": return "!=";
|
|
657
768
|
case "contains": return "contains";
|
|
658
|
-
case "notContains":
|
|
659
|
-
case "not_contains":
|
|
660
769
|
case "notcontains": return "notcontains";
|
|
661
|
-
case "
|
|
662
|
-
case "
|
|
663
|
-
case "
|
|
664
|
-
case "greater_than":
|
|
770
|
+
case "startswith": return "startswith";
|
|
771
|
+
case "endswith": return "endswith";
|
|
772
|
+
case "greaterthan":
|
|
665
773
|
case "gt": return ">";
|
|
666
|
-
case "
|
|
667
|
-
case "
|
|
774
|
+
case "greaterorequal":
|
|
775
|
+
case "greaterthanorequal":
|
|
668
776
|
case "gte": return ">=";
|
|
669
|
-
case "
|
|
670
|
-
case "less_than":
|
|
777
|
+
case "lessthan":
|
|
671
778
|
case "lt": return "<";
|
|
672
|
-
case "
|
|
673
|
-
case "
|
|
779
|
+
case "lessorequal":
|
|
780
|
+
case "lessthanorequal":
|
|
674
781
|
case "lte": return "<=";
|
|
675
782
|
case "in": return "in";
|
|
676
|
-
case "
|
|
677
|
-
case "
|
|
678
|
-
case "nin": return "not in";
|
|
783
|
+
case "notin":
|
|
784
|
+
case "nin": return "nin";
|
|
679
785
|
case "before": return "<";
|
|
680
786
|
case "after": return ">";
|
|
787
|
+
case "between": return "between";
|
|
788
|
+
case "isnull": return "isnull";
|
|
789
|
+
case "isnotnull": return "isnotnull";
|
|
681
790
|
default: return e;
|
|
682
791
|
}
|
|
683
792
|
}
|
|
684
|
-
|
|
793
|
+
var G = /* @__PURE__ */ new Set([
|
|
794
|
+
"nin",
|
|
795
|
+
"not_in",
|
|
796
|
+
"notIn",
|
|
797
|
+
"notin",
|
|
798
|
+
"not in"
|
|
799
|
+
]);
|
|
800
|
+
function ct(e) {
|
|
685
801
|
if (!Array.isArray(e) || e.length < 3) return e;
|
|
686
802
|
let [t, n, r] = e;
|
|
687
|
-
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ?
|
|
803
|
+
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ? ct(e) : e)] : n === "in" && Array.isArray(r) ? r.length === 0 ? [] : r.length === 1 ? [
|
|
688
804
|
t,
|
|
689
805
|
"=",
|
|
690
806
|
r[0]
|
|
@@ -692,7 +808,7 @@ function W(e) {
|
|
|
692
808
|
t,
|
|
693
809
|
"=",
|
|
694
810
|
e
|
|
695
|
-
])] : n
|
|
811
|
+
])] : G.has(n) && Array.isArray(r) ? r.length === 0 ? [] : r.length === 1 ? [
|
|
696
812
|
t,
|
|
697
813
|
"!=",
|
|
698
814
|
r[0]
|
|
@@ -702,7 +818,7 @@ function W(e) {
|
|
|
702
818
|
e
|
|
703
819
|
])] : e;
|
|
704
820
|
}
|
|
705
|
-
function
|
|
821
|
+
function lt(e) {
|
|
706
822
|
let t = typeof e == "string" ? [e] : Array.isArray(e) ? e : [], n = [];
|
|
707
823
|
for (let e of t) if (typeof e == "string") {
|
|
708
824
|
let t = e.trim().split(/\s+/);
|
|
@@ -719,15 +835,35 @@ function $e(e) {
|
|
|
719
835
|
});
|
|
720
836
|
return n;
|
|
721
837
|
}
|
|
722
|
-
function
|
|
838
|
+
function ut(e) {
|
|
723
839
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
724
840
|
}
|
|
725
|
-
function
|
|
726
|
-
|
|
841
|
+
function dt(e) {
|
|
842
|
+
switch (e) {
|
|
843
|
+
case "bottom": return {
|
|
844
|
+
top: !1,
|
|
845
|
+
bottom: !0
|
|
846
|
+
};
|
|
847
|
+
case "both": return {
|
|
848
|
+
top: !0,
|
|
849
|
+
bottom: !0
|
|
850
|
+
};
|
|
851
|
+
default: return {
|
|
852
|
+
top: !0,
|
|
853
|
+
bottom: !1
|
|
854
|
+
};
|
|
855
|
+
}
|
|
727
856
|
}
|
|
728
|
-
function
|
|
857
|
+
function ft(e) {
|
|
858
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? ct(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
|
|
859
|
+
}
|
|
860
|
+
function pt(e, t, n) {
|
|
861
|
+
let r = mt(t);
|
|
862
|
+
return o(e, r.length > 0 ? r : void 0, ...ft(n));
|
|
863
|
+
}
|
|
864
|
+
function mt(e) {
|
|
729
865
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
730
|
-
let t =
|
|
866
|
+
let t = ft(e.conditions.filter((e) => {
|
|
731
867
|
if (e.operator === "isEmpty" || e.operator === "isNotEmpty") return !0;
|
|
732
868
|
let t = e.value;
|
|
733
869
|
return !(t == null || t === "" || Array.isArray(t) && t.length === 0);
|
|
@@ -741,15 +877,32 @@ function nt(e) {
|
|
|
741
877
|
null
|
|
742
878
|
] : [
|
|
743
879
|
e.field,
|
|
744
|
-
|
|
880
|
+
st(e.operator),
|
|
745
881
|
e.value
|
|
746
882
|
]));
|
|
747
883
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
748
884
|
}
|
|
749
|
-
function
|
|
750
|
-
return
|
|
885
|
+
function ht(e, t, n) {
|
|
886
|
+
return c(e, t, n);
|
|
751
887
|
}
|
|
752
|
-
|
|
888
|
+
function gt(e) {
|
|
889
|
+
let t = e, n = [
|
|
890
|
+
t?.httpStatus,
|
|
891
|
+
t?.status,
|
|
892
|
+
t?.statusCode
|
|
893
|
+
].find((e) => typeof e == "number");
|
|
894
|
+
if (n === void 0) {
|
|
895
|
+
let e = /HTTP (\d{3})\b/.exec(String(t?.message ?? ""));
|
|
896
|
+
e && (n = Number(e[1]));
|
|
897
|
+
}
|
|
898
|
+
let r = typeof t?.code == "string" ? t.code.toUpperCase() : "";
|
|
899
|
+
return n === 403 || r === "PERMISSION_DENIED" || r === "FORBIDDEN" ? "forbidden" : n === 401 || r === "UNAUTHORIZED" || r === "UNAUTHENTICATED" ? "unauthorized" : n === 400 || _t.has(r) ? "rejected" : "network";
|
|
900
|
+
}
|
|
901
|
+
var _t = /* @__PURE__ */ new Set([
|
|
902
|
+
"INVALID_FILTER",
|
|
903
|
+
"UNSUPPORTED_QUERY_PARAM",
|
|
904
|
+
"INVALID_QUERY"
|
|
905
|
+
]), vt = L({
|
|
753
906
|
"list.recordCount": "{{count}} records",
|
|
754
907
|
"list.recordCountOne": "{{count}} record",
|
|
755
908
|
"list.noItems": "No items found",
|
|
@@ -761,12 +914,20 @@ var K = {
|
|
|
761
914
|
"list.loading": "Loading records…",
|
|
762
915
|
"list.loadErrorTitle": "Couldn’t load records",
|
|
763
916
|
"list.loadErrorMessage": "Something went wrong while loading this data. Check your connection and try again.",
|
|
917
|
+
"list.loadErrorForbiddenTitle": "You don’t have access",
|
|
918
|
+
"list.loadErrorForbiddenMessage": "You don’t have permission to view these records. Contact your administrator if you think you should have access.",
|
|
919
|
+
"list.loadErrorUnauthorizedTitle": "Sign in required",
|
|
920
|
+
"list.loadErrorUnauthorizedMessage": "Your session has expired or you are signed out. Sign in again to view these records.",
|
|
921
|
+
"list.loadErrorRejectedTitle": "This view’s query was rejected",
|
|
922
|
+
"list.loadErrorRejectedMessage": "The server could not process this view’s filter or query options. Clearing the filters usually fixes it; if the view is saved this way, an administrator needs to correct it.",
|
|
764
923
|
"list.retry": "Retry",
|
|
765
924
|
"list.search": "Search",
|
|
766
925
|
"list.filter": "Filter",
|
|
767
926
|
"list.filterRecords": "Filter Records",
|
|
768
927
|
"list.sort": "Sort",
|
|
769
928
|
"list.sortRecords": "Sort Records",
|
|
929
|
+
"list.sortByIdSuffix": "(by ID)",
|
|
930
|
+
"list.sortRelationalHint": "Columns that link to another record are not listed: they can only be sorted by the stored ID, not by the name shown in the cell. To sort by that name, add a formula field holding it.",
|
|
770
931
|
"list.group": "Group",
|
|
771
932
|
"list.groupBy": "Group By",
|
|
772
933
|
"list.export": "Export",
|
|
@@ -797,78 +958,56 @@ var K = {
|
|
|
797
958
|
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
798
959
|
"list.viewSettings": "View settings",
|
|
799
960
|
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
800
|
-
},
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
return n;
|
|
804
|
-
};
|
|
805
|
-
function it() {
|
|
806
|
-
try {
|
|
807
|
-
let e = R();
|
|
808
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t: rt } : { t: e.t };
|
|
809
|
-
} catch {
|
|
810
|
-
return { t: rt };
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
function at() {
|
|
814
|
-
let { fieldLabel: e, actionLabel: t, objectLabel: n } = Ae();
|
|
961
|
+
}, "list.recordCount");
|
|
962
|
+
function yt() {
|
|
963
|
+
let { fieldLabel: e, actionLabel: t, objectLabel: n } = Re();
|
|
815
964
|
return {
|
|
816
965
|
fieldLabel: e,
|
|
817
966
|
actionLabel: t,
|
|
818
967
|
objectLabel: n
|
|
819
968
|
};
|
|
820
969
|
}
|
|
821
|
-
var
|
|
822
|
-
let
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
}, [
|
|
826
|
-
let t =
|
|
827
|
-
return M.objectName && typeof oe == "function" ? oe(M.objectName, e, t) : t;
|
|
828
|
-
}, [M.objectName, oe]), P = a.useMemo(() => {
|
|
829
|
-
let e = M.userActions, t = M.addRecord?.enabled === !0 && e?.addRecordForm !== !1, n = e?.refresh;
|
|
970
|
+
var bt = d.forwardRef(({ schema: e, className: a, onViewChange: o, onFilterChange: c, onSortChange: f, onSearchChange: p, onHiddenFieldsChange: m, onInlineEditChange: h, onColumnStateChange: g, onRowClick: ee, showViewSwitcher: v, userFilterSelections: b, onUserFilterSelectionsChange: x, initialFilters: S, initialSearchTerm: te, ...C }, se) => {
|
|
971
|
+
let ue = v ?? e?.showViewSwitcher ?? !1, { t: k } = vt(), { fieldLabel: de, actionLabel: A, objectLabel: pe } = yt(), { translateOptions: ge } = Be(), j = d.useMemo(() => s(e), [e]), M = d.useCallback((e, t) => j.objectName ? de(j.objectName, e, t) : t, [j.objectName, de]), ye = d.useCallback((e) => {
|
|
972
|
+
let t = ut(e);
|
|
973
|
+
return j.objectName && typeof A == "function" ? A(j.objectName, e, t) : t;
|
|
974
|
+
}, [j.objectName, A]), N = d.useMemo(() => {
|
|
975
|
+
let e = j.userActions, t = j.addRecord?.enabled === !0 && e?.addRecordForm !== !1, n = dt(j.addRecord?.position);
|
|
830
976
|
return {
|
|
831
|
-
showSearch: e?.search
|
|
832
|
-
showSort: e?.sort
|
|
833
|
-
showFilters: e?.filter
|
|
834
|
-
showRefresh:
|
|
835
|
-
showDensity: e?.rowHeight
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
showColor:
|
|
839
|
-
compactToolbar:
|
|
977
|
+
showSearch: e?.search !== !1,
|
|
978
|
+
showSort: e?.sort !== !1,
|
|
979
|
+
showFilters: e?.filter !== !1,
|
|
980
|
+
showRefresh: e?.refresh !== !1,
|
|
981
|
+
showDensity: e?.rowHeight !== !1,
|
|
982
|
+
showGroup: e?.group !== !1,
|
|
983
|
+
showHideFields: e?.hideFields === !0,
|
|
984
|
+
showColor: e?.rowColor === !0,
|
|
985
|
+
compactToolbar: j.compactToolbar === !0,
|
|
840
986
|
showAddRecord: t,
|
|
841
|
-
|
|
987
|
+
showAddRecordTop: t && n.top,
|
|
988
|
+
showAddRecordBottom: t && n.bottom
|
|
842
989
|
};
|
|
843
990
|
}, [
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
M.compactToolbar,
|
|
853
|
-
M.addRecord,
|
|
854
|
-
M.userActions?.addRecordForm
|
|
855
|
-
]), [F, Ae] = a.useState(M.viewType), [R, Ne] = a.useState(() => x ?? ""), [Pe, Le] = a.useState(!1), [Ve, He] = a.useState(!1), [z, B] = a.useState(() => $e(M.sort)), We = a.useMemo(() => JSON.stringify(M.sort || []), [M.sort]);
|
|
856
|
-
a.useEffect(() => {
|
|
857
|
-
B($e(M.sort));
|
|
858
|
-
}, [We]);
|
|
859
|
-
let [Ge, qe] = a.useState(!1), [V, Je] = a.useState(() => v && Array.isArray(v.conditions) ? v : {
|
|
991
|
+
j.userActions,
|
|
992
|
+
j.compactToolbar,
|
|
993
|
+
j.addRecord
|
|
994
|
+
]), [P, Ae] = d.useState(j.viewType), [L, Re] = d.useState(() => te ?? ""), [ze, He] = d.useState(!1), [Ue, Ke] = d.useState(!1), [R, Xe] = d.useState(() => lt(j.sort)), Ze = d.useMemo(() => JSON.stringify(j.sort || []), [j.sort]);
|
|
995
|
+
d.useEffect(() => {
|
|
996
|
+
Xe(lt(j.sort));
|
|
997
|
+
}, [Ze]);
|
|
998
|
+
let [z, $e] = d.useState(!1), [B, tt] = d.useState(() => S && Array.isArray(S.conditions) ? S : {
|
|
860
999
|
id: "root",
|
|
861
1000
|
logic: "and",
|
|
862
1001
|
conditions: []
|
|
863
|
-
}),
|
|
864
|
-
|
|
865
|
-
if (!(!
|
|
866
|
-
e.resource ===
|
|
1002
|
+
}), V = C.dataSource, [H, nt] = d.useState([]), [rt, at] = d.useState(null), [U, ot] = d.useState("network"), [W, st] = d.useState(() => !(Array.isArray(j.data) || j.data && typeof j.data == "object" && j.data.provider === "value" && Array.isArray(j.data.items) || j.viewType === "gantt" && j.data && typeof j.data == "object" && !Array.isArray(j.data) && j.data.provider === "api")), [G, ct] = d.useState(null), [ft, mt] = d.useState(!1), [ht, _t] = d.useState(0), [bt, xt] = d.useState(!1);
|
|
1003
|
+
d.useImperativeHandle(se, () => ({ refresh: () => _t((e) => e + 1) }), []), d.useEffect(() => {
|
|
1004
|
+
if (!(!V?.onMutation || !j.objectName)) return V.onMutation((e) => {
|
|
1005
|
+
e.resource === j.objectName && _t((e) => e + 1);
|
|
867
1006
|
});
|
|
868
|
-
}, [
|
|
869
|
-
let [
|
|
870
|
-
if (
|
|
871
|
-
let e = typeof
|
|
1007
|
+
}, [V, j.objectName]);
|
|
1008
|
+
let [St, Ct] = d.useState(void 0), K = St ?? j.pagination?.pageSize ?? 100, [wt, Tt] = d.useState(1), [Et, Dt] = d.useState(null), q = d.useMemo(() => {
|
|
1009
|
+
if (j.grouping?.fields?.length) return j.grouping;
|
|
1010
|
+
let e = typeof j.groupBy == "string" ? j.groupBy.trim() : "", t = typeof j.groupBy2 == "string" ? j.groupBy2.trim() : "", n = [];
|
|
872
1011
|
return e && n.push({
|
|
873
1012
|
field: e,
|
|
874
1013
|
order: "asc",
|
|
@@ -879,25 +1018,25 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
879
1018
|
collapsed: !1
|
|
880
1019
|
}), n.length > 0 ? { fields: n } : void 0;
|
|
881
1020
|
}, [
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
]), [J,
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}, [
|
|
889
|
-
let [Y,
|
|
890
|
-
let e =
|
|
1021
|
+
j.grouping,
|
|
1022
|
+
j.groupBy,
|
|
1023
|
+
j.groupBy2
|
|
1024
|
+
]), [J, Ot] = d.useState(q), [kt, At] = d.useState(!1), jt = d.useRef(q);
|
|
1025
|
+
d.useEffect(() => {
|
|
1026
|
+
jt.current !== q && (jt.current = q, Ot(q));
|
|
1027
|
+
}, [q]);
|
|
1028
|
+
let [Y, Mt] = d.useState(j.rowColor), [Nt, Pt] = d.useState(!1), [Ft, It] = d.useState([]), Lt = d.useRef(0), [Rt, zt] = d.useState([]), Bt = d.useMemo(() => {
|
|
1029
|
+
let e = j.userFilters;
|
|
891
1030
|
if (!e) return;
|
|
892
|
-
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !
|
|
1031
|
+
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !G?.fields) return e;
|
|
893
1032
|
let t = /* @__PURE__ */ new Set([
|
|
894
1033
|
"select",
|
|
895
1034
|
"multi-select",
|
|
896
1035
|
"boolean"
|
|
897
|
-
]), n = [], r = Array.isArray(
|
|
1036
|
+
]), n = [], r = Array.isArray(G.fields) ? G.fields.map((e) => [e.name, e]) : Object.entries(G.fields);
|
|
898
1037
|
for (let [e, i] of r) (t.has(i.type) || i.options && !i.type) && n.push({
|
|
899
1038
|
field: e,
|
|
900
|
-
label:
|
|
1039
|
+
label: M(e, i.label || e),
|
|
901
1040
|
type: i.type === "boolean" ? "boolean" : i.type === "multi-select" ? "multi-select" : "select"
|
|
902
1041
|
});
|
|
903
1042
|
return n.length === 0 ? e : {
|
|
@@ -905,79 +1044,100 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
905
1044
|
fields: n
|
|
906
1045
|
};
|
|
907
1046
|
}, [
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
]), [
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
}, [
|
|
915
|
-
let
|
|
916
|
-
|
|
917
|
-
}, [
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
}, [
|
|
921
|
-
let
|
|
922
|
-
|
|
923
|
-
}, [
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1047
|
+
j.userFilters,
|
|
1048
|
+
G,
|
|
1049
|
+
M
|
|
1050
|
+
]), [X, Vt] = d.useState(() => new Set(j.hiddenFields || [])), Ht = d.useMemo(() => JSON.stringify(j.hiddenFields || []), [j.hiddenFields]);
|
|
1051
|
+
d.useEffect(() => {
|
|
1052
|
+
Vt(new Set(j.hiddenFields || []));
|
|
1053
|
+
}, [Ht]);
|
|
1054
|
+
let Ut = d.useCallback((e) => {
|
|
1055
|
+
Vt(e), m?.(Array.from(e));
|
|
1056
|
+
}, [m]), [Wt, Gt] = d.useState(!1), [Kt, qt] = d.useState(() => !!j.inlineEdit);
|
|
1057
|
+
d.useEffect(() => {
|
|
1058
|
+
qt(!!j.inlineEdit);
|
|
1059
|
+
}, [j.inlineEdit]);
|
|
1060
|
+
let Jt = d.useCallback((e) => {
|
|
1061
|
+
qt(e), h?.(e);
|
|
1062
|
+
}, [h]), [Yt, Xt] = d.useState(!1), [Zt, Qt] = d.useState(!1), [$t, en] = d.useState(null), { getObjectApiOperations: tn } = Ye(), nn = j.objectName ? tn(j.objectName) : void 0, rn = j.allowExport !== !1 && j.operations?.export !== !1 && (!nn || nn.includes("export")), an = d.useMemo(() => {
|
|
1063
|
+
let e = j.bulkActions;
|
|
1064
|
+
return !e || e.length === 0 || l(G, nn).delete ? e : e.filter((e) => String(e).toLowerCase() !== "delete");
|
|
1065
|
+
}, [
|
|
1066
|
+
j.bulkActions,
|
|
1067
|
+
G,
|
|
1068
|
+
nn
|
|
1069
|
+
]), Z = d.useMemo(() => {
|
|
1070
|
+
if (j.exportOptions) return Array.isArray(j.exportOptions) ? { formats: j.exportOptions } : j.exportOptions;
|
|
1071
|
+
}, [j.exportOptions]), on = d.useMemo(() => {
|
|
1072
|
+
let e = Z?.formats || ["csv", "json"], t = typeof V?.exportDownload == "function" && j.objectName && Z?.streaming !== !1 ? [
|
|
1073
|
+
"csv",
|
|
1074
|
+
"xlsx",
|
|
1075
|
+
"json"
|
|
1076
|
+
] : ["csv", "json"];
|
|
1077
|
+
return e.filter((e) => t.includes(e));
|
|
1078
|
+
}, [
|
|
1079
|
+
Z,
|
|
1080
|
+
V,
|
|
1081
|
+
j.objectName
|
|
1082
|
+
]);
|
|
1083
|
+
d.useEffect(() => {
|
|
1084
|
+
let e = Z?.formats;
|
|
1085
|
+
if (!e) return;
|
|
1086
|
+
let t = e.filter((e) => !on.includes(e));
|
|
1087
|
+
t.length > 0 && console.warn(`[ObjectUI] ListView export: unsupported format(s) hidden from the menu: ${t.join(", ")}`);
|
|
1088
|
+
}, [Z, on]);
|
|
1089
|
+
let Q = We(d.useMemo(() => j.rowHeight ? u(j.rowHeight) : "compact", [j.rowHeight]), { onChange: j.onDensityChange }), sn = d.useMemo(() => `objectui:gallery:density:${j.objectName ?? "default"}`, [j.objectName]), [cn, ln] = d.useState(() => {
|
|
1090
|
+
if (typeof window > "u") return j.gallery?.cardSize ?? "medium";
|
|
933
1091
|
try {
|
|
934
|
-
let e = window.localStorage.getItem(
|
|
1092
|
+
let e = window.localStorage.getItem(sn);
|
|
935
1093
|
if (e === "small" || e === "medium" || e === "large") return e;
|
|
936
1094
|
} catch {}
|
|
937
|
-
return
|
|
938
|
-
}),
|
|
939
|
-
|
|
1095
|
+
return j.gallery?.cardSize ?? "medium";
|
|
1096
|
+
}), un = d.useCallback(() => {
|
|
1097
|
+
ln((e) => {
|
|
940
1098
|
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
941
1099
|
try {
|
|
942
|
-
window.localStorage.setItem(
|
|
1100
|
+
window.localStorage.setItem(sn, t);
|
|
943
1101
|
} catch {}
|
|
944
1102
|
return t;
|
|
945
1103
|
});
|
|
946
|
-
}, [
|
|
947
|
-
onRefresh:
|
|
948
|
-
|
|
1104
|
+
}, [sn]), { ref: dn, isRefreshing: fn, pullDistance: pn } = Je({
|
|
1105
|
+
onRefresh: d.useCallback(async () => {
|
|
1106
|
+
_t((e) => e + 1);
|
|
949
1107
|
}, []),
|
|
950
|
-
enabled: !!
|
|
951
|
-
}),
|
|
952
|
-
|
|
1108
|
+
enabled: !!V && !!j.objectName
|
|
1109
|
+
}), mn = d.useMemo(() => j.id ? `listview-${j.objectName}-${j.id}-view` : `listview-${j.objectName}-view`, [j.objectName, j.id]);
|
|
1110
|
+
d.useEffect(() => {
|
|
953
1111
|
let e = !0;
|
|
954
|
-
return
|
|
955
|
-
if (!
|
|
956
|
-
|
|
1112
|
+
return mt(!1), ct(null), (async () => {
|
|
1113
|
+
if (!V || !j.objectName) {
|
|
1114
|
+
mt(!0);
|
|
957
1115
|
return;
|
|
958
1116
|
}
|
|
959
|
-
if (typeof
|
|
960
|
-
|
|
1117
|
+
if (typeof V.getObjectSchema != "function") {
|
|
1118
|
+
mt(!0);
|
|
961
1119
|
return;
|
|
962
1120
|
}
|
|
963
1121
|
try {
|
|
964
|
-
let t = await
|
|
965
|
-
e &&
|
|
1122
|
+
let t = await V.getObjectSchema(j.objectName);
|
|
1123
|
+
e && ct(t);
|
|
966
1124
|
} catch (e) {
|
|
967
1125
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
968
1126
|
} finally {
|
|
969
|
-
e &&
|
|
1127
|
+
e && mt(!0);
|
|
970
1128
|
}
|
|
971
1129
|
})(), () => {
|
|
972
1130
|
e = !1;
|
|
973
1131
|
};
|
|
974
|
-
}, [
|
|
975
|
-
let
|
|
976
|
-
let e = Array.isArray(
|
|
1132
|
+
}, [j.objectName, V]);
|
|
1133
|
+
let hn = d.useMemo(() => {
|
|
1134
|
+
let e = Array.isArray(j.columns) ? j.columns.map((e) => i(e)).filter((e) => typeof e == "string" && e.length > 0) : [], t = new Set(e), r = (e) => {
|
|
977
1135
|
if (!e) return;
|
|
978
|
-
let
|
|
1136
|
+
let n = [
|
|
1137
|
+
e.groupByField,
|
|
979
1138
|
e.groupField,
|
|
980
1139
|
e.groupBy,
|
|
1140
|
+
e.summarizeField,
|
|
981
1141
|
e.titleField,
|
|
982
1142
|
e.cardTitle,
|
|
983
1143
|
e.startDateField,
|
|
@@ -988,89 +1148,85 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
988
1148
|
e.allDayField,
|
|
989
1149
|
e.coverField,
|
|
990
1150
|
e.imageField,
|
|
991
|
-
e.subtitleField,
|
|
992
1151
|
e.swimlaneField,
|
|
993
1152
|
e.valueField,
|
|
1153
|
+
...Array.isArray(e.columns) ? e.columns : [],
|
|
994
1154
|
...Array.isArray(e.cardFields) ? e.cardFields : [],
|
|
995
1155
|
...Array.isArray(e.visibleFields) ? e.visibleFields : [],
|
|
996
1156
|
...Array.isArray(e.metaFields) ? e.metaFields : []
|
|
997
1157
|
];
|
|
998
|
-
for (let e of
|
|
1158
|
+
for (let e of n) typeof e == "string" && e && t.add(e);
|
|
999
1159
|
};
|
|
1000
|
-
r(
|
|
1001
|
-
let
|
|
1002
|
-
return
|
|
1160
|
+
r(j.kanban), r(j.options?.kanban), r(j.calendar), r(j.options?.calendar), r(j.gallery), r(j.options?.gallery), r(j.timeline), r(j.options?.timeline), r(j.gantt), r(j.options?.gantt);
|
|
1161
|
+
let a = t.size > 0 ? Array.from(t) : void 0;
|
|
1162
|
+
return n(G?.fields, a);
|
|
1003
1163
|
}, [
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
]),
|
|
1013
|
-
|
|
1014
|
-
let e = !0, t = ++
|
|
1015
|
-
if (
|
|
1016
|
-
let e =
|
|
1164
|
+
G?.fields,
|
|
1165
|
+
j.columns,
|
|
1166
|
+
j.kanban,
|
|
1167
|
+
j.calendar,
|
|
1168
|
+
j.gallery,
|
|
1169
|
+
j.timeline,
|
|
1170
|
+
j.gantt,
|
|
1171
|
+
j.options
|
|
1172
|
+
]), gn = Ye(), _n = P === "gantt" && !!j.data && typeof j.data == "object" && !Array.isArray(j.data) && j.data.provider === "api";
|
|
1173
|
+
d.useEffect(() => {
|
|
1174
|
+
let e = !0, t = ++Lt.current;
|
|
1175
|
+
if (j.data && typeof j.data == "object" && !Array.isArray(j.data)) {
|
|
1176
|
+
let e = j.data;
|
|
1017
1177
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
1018
1178
|
let t = e.items;
|
|
1019
|
-
if (
|
|
1020
|
-
let e =
|
|
1179
|
+
if (L) {
|
|
1180
|
+
let e = L.toLowerCase();
|
|
1021
1181
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
1022
1182
|
}
|
|
1023
|
-
|
|
1183
|
+
nt(t), st(!1), xt(!1);
|
|
1024
1184
|
return;
|
|
1025
1185
|
}
|
|
1026
1186
|
}
|
|
1027
|
-
if (Array.isArray(
|
|
1028
|
-
let e =
|
|
1029
|
-
if (
|
|
1030
|
-
let t =
|
|
1187
|
+
if (Array.isArray(j.data)) {
|
|
1188
|
+
let e = j.data;
|
|
1189
|
+
if (L) {
|
|
1190
|
+
let t = L.toLowerCase();
|
|
1031
1191
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
1032
1192
|
}
|
|
1033
|
-
|
|
1193
|
+
nt(e), st(!1), xt(!1);
|
|
1034
1194
|
return;
|
|
1035
1195
|
}
|
|
1036
|
-
if (
|
|
1037
|
-
|
|
1196
|
+
if (_n) {
|
|
1197
|
+
st(!1), xt(!1);
|
|
1038
1198
|
return;
|
|
1039
1199
|
}
|
|
1040
|
-
return
|
|
1041
|
-
if (!
|
|
1042
|
-
|
|
1200
|
+
return ft ? ((async () => {
|
|
1201
|
+
if (!V || !j.objectName) {
|
|
1202
|
+
st(!1);
|
|
1043
1203
|
return;
|
|
1044
1204
|
}
|
|
1045
|
-
|
|
1205
|
+
st(!0), at(null);
|
|
1046
1206
|
try {
|
|
1047
|
-
let n =
|
|
1048
|
-
...r.length > 0 ? [r] : [],
|
|
1049
|
-
...i.length > 0 ? [i] : [],
|
|
1050
|
-
...a
|
|
1051
|
-
].filter((e) => Array.isArray(e) && e.length > 0);
|
|
1052
|
-
o.length > 1 ? n = ["and", ...o] : o.length === 1 && (n = o[0]);
|
|
1053
|
-
let s = z.length > 0 ? z.filter((e) => e.field).map((e) => ({
|
|
1207
|
+
let n = pt(j.filter, B, Rt), r = R.length > 0 ? R.filter((e) => e.field).map((e) => ({
|
|
1054
1208
|
field: e.field,
|
|
1055
1209
|
order: e.order
|
|
1056
|
-
})) : void 0,
|
|
1057
|
-
let e = Array.isArray(
|
|
1210
|
+
})) : void 0, a = (() => {
|
|
1211
|
+
let e = Array.isArray(j.columns) ? j.columns.map((e) => i(e)).filter((e) => typeof e == "string" && e.length > 0) : [], t = gn?.isLoaded && j.objectName ? e.filter((e) => gn.checkField(j.objectName, e, "read")) : e;
|
|
1058
1212
|
if (t.length === 0) return;
|
|
1059
1213
|
let n = /* @__PURE__ */ new Set(["id"]);
|
|
1060
1214
|
for (let e of t) n.add(e);
|
|
1061
|
-
for (let e of
|
|
1215
|
+
for (let e of hn) n.add(e);
|
|
1062
1216
|
let r = (() => {
|
|
1063
|
-
let e =
|
|
1217
|
+
let e = G?.fields;
|
|
1064
1218
|
if (!e) return null;
|
|
1065
1219
|
let t = Array.isArray(e) ? e.map((e) => e?.name).filter((e) => typeof e == "string") : Object.keys(e), n = new Set(t);
|
|
1066
1220
|
return n.add("id"), n.add("created_at"), n.add("updated_at"), n;
|
|
1067
|
-
})(),
|
|
1221
|
+
})(), a = (e) => {
|
|
1068
1222
|
typeof e != "string" || !e || (!r || r.has(e)) && n.add(e);
|
|
1069
|
-
},
|
|
1223
|
+
}, o = (e) => {
|
|
1070
1224
|
if (!e) return;
|
|
1071
1225
|
let t = [
|
|
1226
|
+
e.groupByField,
|
|
1072
1227
|
e.groupField,
|
|
1073
1228
|
e.groupBy,
|
|
1229
|
+
e.summarizeField,
|
|
1074
1230
|
e.titleField,
|
|
1075
1231
|
e.cardTitle,
|
|
1076
1232
|
e.startDateField,
|
|
@@ -1081,84 +1237,84 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
1081
1237
|
e.allDayField,
|
|
1082
1238
|
e.coverField,
|
|
1083
1239
|
e.imageField,
|
|
1084
|
-
e.subtitleField,
|
|
1085
1240
|
e.swimlaneField,
|
|
1086
1241
|
e.valueField,
|
|
1242
|
+
...Array.isArray(e.columns) ? e.columns : [],
|
|
1087
1243
|
...Array.isArray(e.cardFields) ? e.cardFields : [],
|
|
1088
1244
|
...Array.isArray(e.visibleFields) ? e.visibleFields : [],
|
|
1089
1245
|
...Array.isArray(e.metaFields) ? e.metaFields : []
|
|
1090
1246
|
];
|
|
1091
|
-
for (let e of t)
|
|
1247
|
+
for (let e of t) a(e);
|
|
1092
1248
|
};
|
|
1093
|
-
|
|
1249
|
+
o(j.kanban), o(j.options?.kanban), o(j.calendar), o(j.options?.calendar), o(j.gallery), o(j.options?.gallery), o(j.timeline), o(j.options?.timeline);
|
|
1094
1250
|
{
|
|
1095
|
-
let e =
|
|
1096
|
-
e && !Array.isArray(e.metaFields) && (
|
|
1251
|
+
let e = j.timeline ?? j.options?.timeline;
|
|
1252
|
+
e && !Array.isArray(e.metaFields) && (a("status"), a("priority"));
|
|
1097
1253
|
}
|
|
1098
|
-
return
|
|
1099
|
-
})(),
|
|
1100
|
-
...
|
|
1101
|
-
$orderby:
|
|
1102
|
-
$top:
|
|
1103
|
-
...
|
|
1104
|
-
...
|
|
1105
|
-
...
|
|
1106
|
-
...
|
|
1107
|
-
$search:
|
|
1108
|
-
...
|
|
1254
|
+
return o(j.gantt), o(j.options?.gantt), Array.from(n);
|
|
1255
|
+
})(), o = n !== void 0, s = P === "grid" && !J?.fields?.length, c = s ? (wt - 1) * K : 0, l = await V.find(j.objectName, {
|
|
1256
|
+
...o ? { $filter: n } : {},
|
|
1257
|
+
$orderby: r,
|
|
1258
|
+
$top: K,
|
|
1259
|
+
...c > 0 ? { $skip: c } : {},
|
|
1260
|
+
...a ? { $select: a } : {},
|
|
1261
|
+
...hn.length > 0 ? { $expand: hn } : {},
|
|
1262
|
+
...L ? {
|
|
1263
|
+
$search: L,
|
|
1264
|
+
...j.searchableFields && j.searchableFields.length > 0 ? { $searchFields: j.searchableFields } : {}
|
|
1109
1265
|
} : {}
|
|
1110
1266
|
});
|
|
1111
|
-
if (!e || t !==
|
|
1112
|
-
let
|
|
1113
|
-
Array.isArray(
|
|
1114
|
-
let
|
|
1115
|
-
|
|
1267
|
+
if (!e || t !== Lt.current) return;
|
|
1268
|
+
let u = [];
|
|
1269
|
+
Array.isArray(l) ? u = l : l && typeof l == "object" && (Array.isArray(l.data) ? u = l.data : Array.isArray(l.records) ? u = l.records : Array.isArray(l.value) && (u = l.value)), nt(u);
|
|
1270
|
+
let d = l && typeof l == "object" ? l.total ?? l.count : void 0, f = typeof d == "number" ? d : null;
|
|
1271
|
+
Dt(s ? f : null), xt(!(s && f != null) && u.length >= K);
|
|
1116
1272
|
} catch (e) {
|
|
1117
|
-
t ===
|
|
1273
|
+
t === Lt.current && (console.error("ListView data fetch error:", e), nt([]), at(e?.message ? String(e.message) : String(e ?? "Unknown error")), ot(gt(e)));
|
|
1118
1274
|
} finally {
|
|
1119
|
-
e && t ===
|
|
1275
|
+
e && t === Lt.current && st(!1);
|
|
1120
1276
|
}
|
|
1121
1277
|
})(), () => {
|
|
1122
1278
|
e = !1;
|
|
1123
1279
|
}) : void 0;
|
|
1124
1280
|
}, [
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
H,
|
|
1128
|
-
M.filters,
|
|
1129
|
-
q,
|
|
1130
|
-
z,
|
|
1281
|
+
j.objectName,
|
|
1282
|
+
j.data,
|
|
1131
1283
|
V,
|
|
1132
|
-
|
|
1133
|
-
|
|
1284
|
+
j.filter,
|
|
1285
|
+
K,
|
|
1134
1286
|
R,
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1287
|
+
B,
|
|
1288
|
+
Rt,
|
|
1289
|
+
ht,
|
|
1290
|
+
L,
|
|
1291
|
+
j.searchableFields,
|
|
1292
|
+
hn,
|
|
1293
|
+
ft,
|
|
1294
|
+
j.refreshTrigger,
|
|
1295
|
+
gn,
|
|
1296
|
+
wt,
|
|
1297
|
+
P,
|
|
1142
1298
|
J,
|
|
1143
|
-
|
|
1299
|
+
_n
|
|
1144
1300
|
]);
|
|
1145
|
-
let
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
z,
|
|
1150
|
-
V,
|
|
1151
|
-
X,
|
|
1301
|
+
let vn = JSON.stringify([
|
|
1302
|
+
j.objectName,
|
|
1303
|
+
j.filter,
|
|
1304
|
+
K,
|
|
1152
1305
|
R,
|
|
1153
|
-
|
|
1306
|
+
B,
|
|
1307
|
+
Rt,
|
|
1308
|
+
L,
|
|
1309
|
+
P,
|
|
1154
1310
|
J
|
|
1155
|
-
]),
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
}, [
|
|
1159
|
-
let
|
|
1311
|
+
]), yn = d.useRef(vn);
|
|
1312
|
+
d.useEffect(() => {
|
|
1313
|
+
yn.current !== vn && (yn.current = vn, Tt(1));
|
|
1314
|
+
}, [vn]);
|
|
1315
|
+
let bn = d.useMemo(() => {
|
|
1160
1316
|
let e = ["grid"];
|
|
1161
|
-
(
|
|
1317
|
+
(j.kanban?.groupByField || j.kanban?.groupField || j.options?.kanban?.groupField) && e.push("kanban"), (j.gallery?.coverField || j.gallery?.imageField || j.options?.gallery?.imageField) && e.push("gallery"), (j.calendar?.startDateField || j.options?.calendar?.startDateField) && e.push("calendar"), (j.timeline?.startDateField || j.options?.timeline?.startDateField || j.options?.timeline?.dateField || j.options?.calendar?.startDateField) && e.push("timeline"), (j.gantt?.startDateField || j.options?.gantt?.startDateField) && e.push("gantt"), (j.options?.map?.locationField || j.options?.map?.latitudeField && j.options?.map?.longitudeField) && e.push("map"), (j.tree?.parentField || j.options?.tree?.parentField || j.viewType === "tree") && e.push("tree"), j.viewType && !e.includes(j.viewType) && [
|
|
1162
1318
|
"grid",
|
|
1163
1319
|
"kanban",
|
|
1164
1320
|
"calendar",
|
|
@@ -1168,175 +1324,176 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
1168
1324
|
"gallery",
|
|
1169
1325
|
"chart",
|
|
1170
1326
|
"tree"
|
|
1171
|
-
].includes(
|
|
1172
|
-
let t =
|
|
1327
|
+
].includes(j.viewType) && e.push(j.viewType);
|
|
1328
|
+
let t = j.appearance?.allowedVisualizations;
|
|
1173
1329
|
if (Array.isArray(t) && t.length > 0) {
|
|
1174
1330
|
let n = t.filter((t) => e.includes(t));
|
|
1175
1331
|
return n.length > 0 ? n : ["grid"];
|
|
1176
1332
|
}
|
|
1177
1333
|
return e;
|
|
1178
1334
|
}, [
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1335
|
+
j.options,
|
|
1336
|
+
j.viewType,
|
|
1337
|
+
j.kanban,
|
|
1338
|
+
j.calendar,
|
|
1339
|
+
j.gantt,
|
|
1340
|
+
j.gallery,
|
|
1341
|
+
j.timeline,
|
|
1342
|
+
j.tree,
|
|
1343
|
+
j.appearance?.allowedVisualizations
|
|
1188
1344
|
]);
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
}, [
|
|
1192
|
-
let
|
|
1345
|
+
d.useEffect(() => {
|
|
1346
|
+
j.viewType && Ae(j.viewType);
|
|
1347
|
+
}, [j.viewType]);
|
|
1348
|
+
let xn = d.useCallback((e) => {
|
|
1193
1349
|
Ae(e);
|
|
1194
1350
|
try {
|
|
1195
|
-
localStorage.setItem(
|
|
1351
|
+
localStorage.setItem(mn, e);
|
|
1196
1352
|
} catch (e) {
|
|
1197
1353
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
1198
1354
|
}
|
|
1199
|
-
|
|
1200
|
-
}, [
|
|
1201
|
-
|
|
1202
|
-
}, [
|
|
1203
|
-
navigation:
|
|
1204
|
-
objectName:
|
|
1205
|
-
onNavigate:
|
|
1206
|
-
onRowClick:
|
|
1207
|
-
}), $ =
|
|
1208
|
-
let e =
|
|
1209
|
-
if (
|
|
1210
|
-
let t =
|
|
1211
|
-
return !t ||
|
|
1212
|
-
})),
|
|
1213
|
-
let t =
|
|
1214
|
-
return t != null && !
|
|
1215
|
-
})),
|
|
1216
|
-
let t = new Map(
|
|
1217
|
-
e = [...e].sort((e, n) =>
|
|
1218
|
-
let r = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field, i = typeof n == "string" ? n : n?.name || n?.fieldName || n?.field;
|
|
1219
|
-
return (t.get(r) ?? Infinity) - (t.get(i) ?? Infinity);
|
|
1220
|
-
});
|
|
1355
|
+
o?.(e);
|
|
1356
|
+
}, [mn, o]), Sn = d.useCallback((e) => {
|
|
1357
|
+
Re(e), p?.(e);
|
|
1358
|
+
}, [p]), Cn = Ge({
|
|
1359
|
+
navigation: j.navigation,
|
|
1360
|
+
objectName: j.objectName,
|
|
1361
|
+
onNavigate: j.onNavigate,
|
|
1362
|
+
onRowClick: ee
|
|
1363
|
+
}), $ = d.useMemo(() => {
|
|
1364
|
+
let e = Array.isArray(j.columns) ? j.columns : [];
|
|
1365
|
+
if (gn?.isLoaded && j.objectName && (e = e.filter((e) => {
|
|
1366
|
+
let t = i(e);
|
|
1367
|
+
return !t || gn.checkField(j.objectName, t, "read");
|
|
1368
|
+
})), X.size > 0 && (e = e.filter((e) => {
|
|
1369
|
+
let t = i(e);
|
|
1370
|
+
return t != null && !X.has(t);
|
|
1371
|
+
})), j.fieldOrder && j.fieldOrder.length > 0) {
|
|
1372
|
+
let t = new Map(j.fieldOrder.map((e, t) => [e, t]));
|
|
1373
|
+
e = [...e].sort((e, n) => (t.get(i(e)) ?? Infinity) - (t.get(i(n)) ?? Infinity));
|
|
1221
1374
|
}
|
|
1222
1375
|
return e;
|
|
1223
1376
|
}, [
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
]),
|
|
1377
|
+
j.columns,
|
|
1378
|
+
j.objectName,
|
|
1379
|
+
X,
|
|
1380
|
+
j.fieldOrder,
|
|
1381
|
+
gn
|
|
1382
|
+
]), wn = d.useMemo(() => {
|
|
1230
1383
|
let e = Q.mode === "compact" ? "compact" : Q.mode === "spacious" ? "tall" : "medium", t = {
|
|
1231
|
-
objectName:
|
|
1384
|
+
objectName: j.objectName,
|
|
1232
1385
|
fields: $,
|
|
1233
|
-
|
|
1234
|
-
sort:
|
|
1386
|
+
filter: j.filter,
|
|
1387
|
+
sort: R,
|
|
1235
1388
|
className: "h-full w-full",
|
|
1236
1389
|
showSearch: !1,
|
|
1237
|
-
onRowClick:
|
|
1390
|
+
onRowClick: Cn.handleClick,
|
|
1238
1391
|
rowHeight: e,
|
|
1239
1392
|
hideRowHeightToggle: !0,
|
|
1240
|
-
...
|
|
1241
|
-
...
|
|
1242
|
-
...
|
|
1243
|
-
...
|
|
1393
|
+
...j.striped == null ? {} : { striped: j.striped },
|
|
1394
|
+
...j.bordered == null ? {} : { bordered: j.bordered },
|
|
1395
|
+
...g ? { onColumnStateChange: g } : {},
|
|
1396
|
+
...j.columnState ? { columnState: j.columnState } : {}
|
|
1244
1397
|
};
|
|
1245
|
-
switch (
|
|
1398
|
+
switch (P) {
|
|
1246
1399
|
default:
|
|
1247
1400
|
case "grid": return {
|
|
1248
1401
|
type: "object-grid",
|
|
1249
1402
|
...t,
|
|
1250
1403
|
columns: $,
|
|
1251
|
-
...
|
|
1252
|
-
editable:
|
|
1253
|
-
...
|
|
1254
|
-
...
|
|
1255
|
-
...
|
|
1256
|
-
...
|
|
1257
|
-
...
|
|
1404
|
+
...j.conditionalFormatting ? { conditionalFormatting: j.conditionalFormatting } : {},
|
|
1405
|
+
editable: Kt,
|
|
1406
|
+
...j.wrapHeaders == null ? {} : { wrapHeaders: j.wrapHeaders },
|
|
1407
|
+
...j.virtualScroll == null ? {} : { virtualScroll: j.virtualScroll },
|
|
1408
|
+
...j.resizable == null ? {} : { resizable: j.resizable },
|
|
1409
|
+
...j.selection ? { selection: j.selection } : {},
|
|
1410
|
+
...j.pagination ? { pagination: j.pagination } : {},
|
|
1258
1411
|
...J ? { grouping: J } : {},
|
|
1259
1412
|
...Y ? { rowColor: Y } : {},
|
|
1260
|
-
...
|
|
1261
|
-
...
|
|
1262
|
-
...
|
|
1263
|
-
...
|
|
1264
|
-
...
|
|
1265
|
-
};
|
|
1266
|
-
case "kanban": return {
|
|
1267
|
-
type: "object-kanban",
|
|
1268
|
-
...t,
|
|
1269
|
-
groupBy: M.kanban?.groupField || M.options?.kanban?.groupField || Re(K) || void 0,
|
|
1270
|
-
groupField: M.kanban?.groupField || M.options?.kanban?.groupField || Re(K) || void 0,
|
|
1271
|
-
...M.kanban?.titleField || M.options?.kanban?.titleField ? { titleField: M.kanban?.titleField || M.options?.kanban?.titleField } : {},
|
|
1272
|
-
cardFields: M.kanban?.cardFields || $ || [],
|
|
1273
|
-
...J ? { grouping: J } : {},
|
|
1274
|
-
...M.options?.kanban || {},
|
|
1275
|
-
...M.kanban || {}
|
|
1413
|
+
...j.rowActions ? { rowActions: j.rowActions } : {},
|
|
1414
|
+
...j.rowActionDefs ? { rowActionDefs: j.rowActionDefs } : {},
|
|
1415
|
+
...j.bulkActions ? { batchActions: j.bulkActions } : {},
|
|
1416
|
+
...j.bulkActionDefs ? { bulkActionDefs: j.bulkActionDefs } : {},
|
|
1417
|
+
...j.options?.grid || {}
|
|
1276
1418
|
};
|
|
1419
|
+
case "kanban": {
|
|
1420
|
+
let { columns: e, groupByField: n, groupField: r, cardFields: i, titleField: a, ...o } = {
|
|
1421
|
+
...j.options?.kanban || {},
|
|
1422
|
+
...j.kanban || {}
|
|
1423
|
+
}, s = n || r || qe(G) || void 0;
|
|
1424
|
+
return {
|
|
1425
|
+
type: "object-kanban",
|
|
1426
|
+
...t,
|
|
1427
|
+
groupBy: s,
|
|
1428
|
+
groupField: s,
|
|
1429
|
+
...a ? { titleField: a } : {},
|
|
1430
|
+
cardFields: i || e || $ || [],
|
|
1431
|
+
...J ? { grouping: J } : {},
|
|
1432
|
+
...o
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1277
1435
|
case "calendar": return {
|
|
1278
1436
|
type: "object-calendar",
|
|
1279
1437
|
...t,
|
|
1280
|
-
startDateField:
|
|
1281
|
-
endDateField:
|
|
1282
|
-
...
|
|
1283
|
-
...
|
|
1284
|
-
...
|
|
1285
|
-
...
|
|
1438
|
+
startDateField: j.calendar?.startDateField || j.options?.calendar?.startDateField || "start_date",
|
|
1439
|
+
endDateField: j.calendar?.endDateField || j.options?.calendar?.endDateField || "end_date",
|
|
1440
|
+
...j.calendar?.titleField || j.options?.calendar?.titleField ? { titleField: j.calendar?.titleField || j.options?.calendar?.titleField } : {},
|
|
1441
|
+
...j.calendar?.defaultView ? { defaultView: j.calendar.defaultView } : {},
|
|
1442
|
+
...j.options?.calendar || {},
|
|
1443
|
+
...j.calendar || {}
|
|
1286
1444
|
};
|
|
1287
1445
|
case "gallery": {
|
|
1288
1446
|
let e = {
|
|
1289
|
-
...
|
|
1290
|
-
...
|
|
1291
|
-
cardSize:
|
|
1447
|
+
...j.options?.gallery || {},
|
|
1448
|
+
...j.gallery || {},
|
|
1449
|
+
cardSize: cn
|
|
1292
1450
|
};
|
|
1293
1451
|
return {
|
|
1294
1452
|
type: "object-gallery",
|
|
1295
1453
|
...t,
|
|
1296
1454
|
gallery: Object.keys(e).length > 0 ? e : void 0,
|
|
1297
|
-
imageField:
|
|
1298
|
-
titleField:
|
|
1299
|
-
subtitleField: M.gallery?.subtitleField || M.options?.gallery?.subtitleField,
|
|
1455
|
+
imageField: j.gallery?.coverField || j.gallery?.imageField || j.options?.gallery?.imageField,
|
|
1456
|
+
titleField: j.gallery?.titleField || j.options?.gallery?.titleField || "name",
|
|
1300
1457
|
...J ? { grouping: J } : {}
|
|
1301
1458
|
};
|
|
1302
1459
|
}
|
|
1303
1460
|
case "timeline": {
|
|
1304
1461
|
let e = {
|
|
1305
|
-
...
|
|
1306
|
-
...
|
|
1462
|
+
...j.options?.timeline || {},
|
|
1463
|
+
...j.timeline || {}
|
|
1307
1464
|
};
|
|
1308
1465
|
return {
|
|
1309
1466
|
type: "object-timeline",
|
|
1310
1467
|
...t,
|
|
1311
1468
|
timeline: Object.keys(e).length > 0 ? e : void 0,
|
|
1312
|
-
startDateField:
|
|
1313
|
-
titleField:
|
|
1314
|
-
...
|
|
1315
|
-
...
|
|
1316
|
-
...
|
|
1317
|
-
...
|
|
1469
|
+
startDateField: j.timeline?.startDateField || j.options?.timeline?.startDateField || j.options?.timeline?.dateField || "created_at",
|
|
1470
|
+
titleField: j.timeline?.titleField || j.options?.timeline?.titleField || "name",
|
|
1471
|
+
...j.timeline?.endDateField ? { endDateField: j.timeline.endDateField } : {},
|
|
1472
|
+
...j.timeline?.groupByField ? { groupByField: j.timeline.groupByField } : {},
|
|
1473
|
+
...j.timeline?.colorField ? { colorField: j.timeline.colorField } : {},
|
|
1474
|
+
...j.timeline?.scale ? { scale: j.timeline.scale } : {}
|
|
1318
1475
|
};
|
|
1319
1476
|
}
|
|
1320
1477
|
case "gantt": return {
|
|
1321
1478
|
type: "object-gantt",
|
|
1322
1479
|
...t,
|
|
1323
|
-
...
|
|
1324
|
-
startDateField:
|
|
1325
|
-
endDateField:
|
|
1326
|
-
progressField:
|
|
1327
|
-
dependenciesField:
|
|
1328
|
-
...
|
|
1329
|
-
...
|
|
1330
|
-
...
|
|
1480
|
+
...j.data ? { data: j.data } : {},
|
|
1481
|
+
startDateField: j.gantt?.startDateField || j.options?.gantt?.startDateField || "start_date",
|
|
1482
|
+
endDateField: j.gantt?.endDateField || j.options?.gantt?.endDateField || "end_date",
|
|
1483
|
+
progressField: j.gantt?.progressField || j.options?.gantt?.progressField || "progress",
|
|
1484
|
+
dependenciesField: j.gantt?.dependenciesField || j.options?.gantt?.dependenciesField || "dependencies",
|
|
1485
|
+
...j.gantt?.titleField ? { titleField: j.gantt.titleField } : {},
|
|
1486
|
+
...j.options?.gantt || {},
|
|
1487
|
+
...j.gantt || {}
|
|
1331
1488
|
};
|
|
1332
1489
|
case "map": return {
|
|
1333
1490
|
type: "object-map",
|
|
1334
1491
|
...t,
|
|
1335
|
-
locationField:
|
|
1336
|
-
...
|
|
1492
|
+
locationField: j.options?.map?.locationField || "location",
|
|
1493
|
+
...j.options?.map || {}
|
|
1337
1494
|
};
|
|
1338
1495
|
case "tree": {
|
|
1339
|
-
let e =
|
|
1496
|
+
let e = j.tree || j.options?.tree || {};
|
|
1340
1497
|
return {
|
|
1341
1498
|
type: "object-tree",
|
|
1342
1499
|
...t,
|
|
@@ -1348,7 +1505,7 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
1348
1505
|
};
|
|
1349
1506
|
}
|
|
1350
1507
|
case "chart": {
|
|
1351
|
-
let e =
|
|
1508
|
+
let e = j.chart || j.options?.chart || {};
|
|
1352
1509
|
if (e.dataset) {
|
|
1353
1510
|
let t = Array.isArray(e.dimensions) ? e.dimensions : [], n = Array.isArray(e.values) ? e.values : [];
|
|
1354
1511
|
return {
|
|
@@ -1368,9 +1525,9 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
1368
1525
|
let t = Array.isArray(e.yAxisFields) && e.yAxisFields[0] || e.valueField || "value", n = e.xAxisField || e.categoryField || "name";
|
|
1369
1526
|
return {
|
|
1370
1527
|
type: "object-chart",
|
|
1371
|
-
objectName:
|
|
1528
|
+
objectName: j.objectName,
|
|
1372
1529
|
chartType: e.chartType || "bar",
|
|
1373
|
-
|
|
1530
|
+
filter: j.filter,
|
|
1374
1531
|
aggregate: {
|
|
1375
1532
|
field: t,
|
|
1376
1533
|
function: e.aggregation || "count",
|
|
@@ -1386,18 +1543,18 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
1386
1543
|
}
|
|
1387
1544
|
}
|
|
1388
1545
|
}, [
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1546
|
+
P,
|
|
1547
|
+
j,
|
|
1548
|
+
R,
|
|
1392
1549
|
$,
|
|
1393
1550
|
J,
|
|
1394
1551
|
Y,
|
|
1395
|
-
|
|
1552
|
+
Cn.handleClick,
|
|
1396
1553
|
Q.mode,
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
]),
|
|
1554
|
+
cn,
|
|
1555
|
+
Kt,
|
|
1556
|
+
G
|
|
1557
|
+
]), Tn = B.conditions && B.conditions.length > 0, En = d.useMemo(() => {
|
|
1401
1558
|
let e, t = (e, t) => {
|
|
1402
1559
|
if (!t) return;
|
|
1403
1560
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1409,228 +1566,264 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
1409
1566
|
label: t?.label || e,
|
|
1410
1567
|
...t
|
|
1411
1568
|
}));
|
|
1412
|
-
return
|
|
1569
|
+
return j.objectName ? ge(j.objectName, e, n) : n;
|
|
1413
1570
|
};
|
|
1414
|
-
if (e =
|
|
1571
|
+
if (e = G?.fields ? Object.entries(G.fields).map(([e, n]) => ({
|
|
1415
1572
|
value: e,
|
|
1416
|
-
label:
|
|
1573
|
+
label: M(e, n.label || e),
|
|
1417
1574
|
type: n.type || "text",
|
|
1418
1575
|
options: t(e, n.options),
|
|
1419
1576
|
referenceTo: n.reference_to || n.reference,
|
|
1420
1577
|
displayField: n.display_field || n.reference_field,
|
|
1421
1578
|
idField: n.id_field
|
|
1422
|
-
})) : (
|
|
1423
|
-
if (typeof e == "string") return {
|
|
1579
|
+
})) : (Array.isArray(j.columns) ? j.columns : []).flatMap((e) => {
|
|
1580
|
+
if (typeof e == "string") return [{
|
|
1424
1581
|
value: e,
|
|
1425
1582
|
label: e,
|
|
1426
1583
|
type: "text"
|
|
1427
|
-
};
|
|
1428
|
-
let n = e
|
|
1429
|
-
return {
|
|
1584
|
+
}];
|
|
1585
|
+
let n = i(e);
|
|
1586
|
+
return n ? [{
|
|
1430
1587
|
value: n,
|
|
1431
|
-
label:
|
|
1588
|
+
label: M(n, e.label || n),
|
|
1432
1589
|
type: e.type || "text",
|
|
1433
1590
|
options: t(n, e.options),
|
|
1434
1591
|
referenceTo: e.reference_to || e.reference,
|
|
1435
1592
|
displayField: e.display_field || e.reference_field,
|
|
1436
1593
|
idField: e.id_field
|
|
1437
|
-
};
|
|
1438
|
-
}),
|
|
1439
|
-
let t = new Set(
|
|
1594
|
+
}] : [];
|
|
1595
|
+
}), j.filterableFields && j.filterableFields.length > 0) {
|
|
1596
|
+
let t = new Set(j.filterableFields);
|
|
1440
1597
|
e = e.filter((e) => t.has(e.value));
|
|
1441
1598
|
}
|
|
1442
1599
|
return e;
|
|
1443
1600
|
}, [
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
]),
|
|
1451
|
-
|
|
1452
|
-
let
|
|
1601
|
+
G,
|
|
1602
|
+
j.columns,
|
|
1603
|
+
j.filterableFields,
|
|
1604
|
+
j.objectName,
|
|
1605
|
+
M,
|
|
1606
|
+
ge
|
|
1607
|
+
]), { sortFields: Dn, sortHasRelationalField: On } = d.useMemo(() => {
|
|
1608
|
+
let e = new Set(R.map((e) => e.field).filter(Boolean)), n = !1, r = [];
|
|
1609
|
+
for (let i of En) {
|
|
1610
|
+
if (!t.has(i.type)) {
|
|
1611
|
+
r.push({
|
|
1612
|
+
value: i.value,
|
|
1613
|
+
label: i.label
|
|
1614
|
+
});
|
|
1615
|
+
continue;
|
|
1616
|
+
}
|
|
1617
|
+
if (e.has(i.value)) {
|
|
1618
|
+
r.push({
|
|
1619
|
+
value: i.value,
|
|
1620
|
+
label: `${i.label} ${k("list.sortByIdSuffix")}`
|
|
1621
|
+
});
|
|
1622
|
+
continue;
|
|
1623
|
+
}
|
|
1624
|
+
n = !0;
|
|
1625
|
+
}
|
|
1626
|
+
return {
|
|
1627
|
+
sortFields: r,
|
|
1628
|
+
sortHasRelationalField: n
|
|
1629
|
+
};
|
|
1630
|
+
}, [
|
|
1631
|
+
En,
|
|
1632
|
+
R,
|
|
1633
|
+
k
|
|
1634
|
+
]), kn = d.useCallback((e) => {
|
|
1635
|
+
let t = e.map((e) => ({
|
|
1636
|
+
id: crypto.randomUUID(),
|
|
1637
|
+
field: e.field,
|
|
1638
|
+
order: e.order
|
|
1639
|
+
}));
|
|
1640
|
+
Xe(t), Tt(1), f?.(t);
|
|
1641
|
+
}, [f]), An = d.useCallback((e) => {
|
|
1642
|
+
if (!rn) return;
|
|
1643
|
+
let t = Z, n = t?.maxRecords || 0, a = t?.includeHeaders !== !1, o = G?.label && G?.name && typeof pe == "function" ? pe(G) : G?.label, s = (e) => r(e, {
|
|
1453
1644
|
prefix: t?.fileNamePrefix,
|
|
1454
|
-
label:
|
|
1455
|
-
objectName:
|
|
1456
|
-
viewLabel:
|
|
1645
|
+
label: o,
|
|
1646
|
+
objectName: j.objectName,
|
|
1647
|
+
viewLabel: j.label || j.title
|
|
1457
1648
|
});
|
|
1458
|
-
if ((e === "csv" || e === "xlsx" || e === "json") && typeof
|
|
1459
|
-
let t = $.map((e) =>
|
|
1460
|
-
...n.length > 0 ? [n] : [],
|
|
1461
|
-
...a.length > 0 ? [a] : [],
|
|
1462
|
-
...s
|
|
1463
|
-
].filter((e) => Array.isArray(e) && e.length > 0), l = c.length > 1 ? ["and", ...c] : c.length === 1 ? c[0] : void 0, u = z.length > 0 ? z.filter((e) => e.field).map((e) => ({
|
|
1649
|
+
if ((e === "csv" || e === "xlsx" || e === "json") && typeof V?.exportDownload == "function" && j.objectName && t?.streaming !== !1) {
|
|
1650
|
+
let t = $.map((e) => i(e)).filter(Boolean), r = pt(j.filter, B, Rt), o = R.length > 0 ? R.filter((e) => e.field).map((e) => ({
|
|
1464
1651
|
field: e.field,
|
|
1465
1652
|
direction: e.order
|
|
1466
1653
|
})) : void 0;
|
|
1467
|
-
|
|
1654
|
+
en(null), Qt(!0), (async () => {
|
|
1468
1655
|
try {
|
|
1469
|
-
let
|
|
1656
|
+
let i = await V.exportDownload(j.objectName, {
|
|
1470
1657
|
format: e,
|
|
1471
1658
|
fields: t.length ? t : void 0,
|
|
1472
|
-
filter:
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1659
|
+
filter: r,
|
|
1660
|
+
...L ? {
|
|
1661
|
+
search: L,
|
|
1662
|
+
...j.searchableFields && j.searchableFields.length > 0 ? { searchFields: j.searchableFields } : {}
|
|
1663
|
+
} : {},
|
|
1664
|
+
sort: o,
|
|
1665
|
+
includeHeaders: a,
|
|
1666
|
+
limit: n > 0 ? n : void 0
|
|
1667
|
+
}), c = URL.createObjectURL(i), l = document.createElement("a");
|
|
1668
|
+
l.href = c, l.download = s(e), l.rel = "noopener", document.body.appendChild(l), l.click(), l.remove(), URL.revokeObjectURL(c), Xt(!1);
|
|
1478
1669
|
} catch (e) {
|
|
1479
|
-
console.error("ListView export failed:", e),
|
|
1670
|
+
console.error("ListView export failed:", e), en(e instanceof Error ? e.message : String(e));
|
|
1480
1671
|
} finally {
|
|
1481
|
-
|
|
1672
|
+
Qt(!1);
|
|
1482
1673
|
}
|
|
1483
1674
|
})();
|
|
1484
1675
|
return;
|
|
1485
1676
|
}
|
|
1486
|
-
let
|
|
1677
|
+
let c = n > 0 ? H.slice(0, n) : H;
|
|
1487
1678
|
if (e === "csv") {
|
|
1488
|
-
let e = $.map((e) =>
|
|
1489
|
-
|
|
1679
|
+
let e = $.map((e) => i(e)).filter(Boolean), t = [];
|
|
1680
|
+
a && t.push(e.join(",")), c.forEach((n) => {
|
|
1490
1681
|
t.push(e.map((e) => {
|
|
1491
1682
|
let t = n[e], r;
|
|
1492
1683
|
return r = t == null ? "" : Array.isArray(t) ? t.map((e) => typeof e == "object" && e ? JSON.stringify(e) : String(e ?? "")).join("; ") : typeof t == "object" ? JSON.stringify(t) : String(t), r.includes(",") || r.includes("\"") || r.includes("\n") || r.includes("\r") ? `"${r.replace(/"/g, "\"\"")}"` : r;
|
|
1493
1684
|
}).join(","));
|
|
1494
1685
|
});
|
|
1495
|
-
let n = new Blob([t.join("\n")], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(n),
|
|
1496
|
-
|
|
1686
|
+
let n = new Blob([t.join("\n")], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(n), o = document.createElement("a");
|
|
1687
|
+
o.href = r, o.download = s("csv"), o.click(), URL.revokeObjectURL(r);
|
|
1497
1688
|
} else if (e === "json") {
|
|
1498
|
-
let e = new Blob([JSON.stringify(
|
|
1499
|
-
n.href = t, n.download =
|
|
1689
|
+
let e = new Blob([JSON.stringify(c, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1690
|
+
n.href = t, n.download = s("json"), n.click(), URL.revokeObjectURL(t);
|
|
1500
1691
|
}
|
|
1501
|
-
|
|
1692
|
+
Xt(!1);
|
|
1502
1693
|
}, [
|
|
1503
|
-
U,
|
|
1504
|
-
$,
|
|
1505
|
-
Kt,
|
|
1506
|
-
M.objectName,
|
|
1507
|
-
M.filters,
|
|
1508
|
-
Gt,
|
|
1509
1694
|
H,
|
|
1695
|
+
$,
|
|
1696
|
+
Z,
|
|
1697
|
+
j.objectName,
|
|
1698
|
+
j.filter,
|
|
1699
|
+
j.searchableFields,
|
|
1700
|
+
rn,
|
|
1510
1701
|
V,
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1702
|
+
B,
|
|
1703
|
+
Rt,
|
|
1704
|
+
R,
|
|
1705
|
+
L,
|
|
1706
|
+
G,
|
|
1707
|
+
pe
|
|
1708
|
+
]), jn = d.useMemo(() => (Array.isArray(j.columns) ? j.columns : []).flatMap((e) => {
|
|
1709
|
+
if (typeof e == "string") return [{
|
|
1517
1710
|
name: e,
|
|
1518
|
-
label:
|
|
1519
|
-
};
|
|
1520
|
-
let t = e
|
|
1521
|
-
return {
|
|
1711
|
+
label: M(e, e)
|
|
1712
|
+
}];
|
|
1713
|
+
let t = i(e);
|
|
1714
|
+
return t ? [{
|
|
1522
1715
|
name: t,
|
|
1523
|
-
label:
|
|
1524
|
-
};
|
|
1525
|
-
}), [
|
|
1526
|
-
return /* @__PURE__ */
|
|
1527
|
-
ref:
|
|
1528
|
-
className:
|
|
1529
|
-
...
|
|
1530
|
-
...
|
|
1531
|
-
...
|
|
1532
|
-
role: "region",
|
|
1716
|
+
label: M(t, e.label || t)
|
|
1717
|
+
}] : [];
|
|
1718
|
+
}), [j.columns, M]);
|
|
1719
|
+
return /* @__PURE__ */ I("div", {
|
|
1720
|
+
ref: dn,
|
|
1721
|
+
className: O("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", a),
|
|
1722
|
+
...j.aria?.ariaLabel ? { "aria-label": j.aria.ariaLabel } : {},
|
|
1723
|
+
...j.aria?.ariaDescribedBy ? { "aria-describedby": j.aria.ariaDescribedBy } : {},
|
|
1724
|
+
...j.aria?.live ? { "aria-live": j.aria.live } : {},
|
|
1725
|
+
role: j.aria?.role ?? "region",
|
|
1533
1726
|
"aria-busy": W || void 0,
|
|
1534
1727
|
"data-state": W ? "loading" : "idle",
|
|
1535
1728
|
children: [
|
|
1536
|
-
|
|
1729
|
+
pn > 0 && /* @__PURE__ */ F("div", {
|
|
1537
1730
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1538
|
-
style: { height:
|
|
1539
|
-
children:
|
|
1731
|
+
style: { height: pn },
|
|
1732
|
+
children: k(fn ? "list.refreshing" : "list.pullToRefresh")
|
|
1540
1733
|
}),
|
|
1541
|
-
|
|
1734
|
+
j.description && j.appearance?.showDescription !== !1 && /* @__PURE__ */ F("div", {
|
|
1542
1735
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
1543
1736
|
"data-testid": "view-description",
|
|
1544
|
-
children: typeof
|
|
1737
|
+
children: typeof j.description == "string" ? j.description : ""
|
|
1545
1738
|
}),
|
|
1546
|
-
/* @__PURE__ */
|
|
1739
|
+
/* @__PURE__ */ I("div", {
|
|
1547
1740
|
className: "border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1548
|
-
children: [/* @__PURE__ */
|
|
1741
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1549
1742
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1550
|
-
children:
|
|
1743
|
+
children: Bt && /* @__PURE__ */ F("div", {
|
|
1551
1744
|
className: "shrink-0 min-w-0 overflow-x-auto",
|
|
1552
1745
|
"data-testid": "user-filters",
|
|
1553
|
-
children: /* @__PURE__ */
|
|
1554
|
-
config:
|
|
1555
|
-
objectDef:
|
|
1556
|
-
data:
|
|
1557
|
-
onFilterChange:
|
|
1746
|
+
children: /* @__PURE__ */ F(it, {
|
|
1747
|
+
config: Bt,
|
|
1748
|
+
objectDef: G,
|
|
1749
|
+
data: H,
|
|
1750
|
+
onFilterChange: zt,
|
|
1558
1751
|
maxVisible: 3,
|
|
1559
|
-
initialSelections:
|
|
1560
|
-
onSelectionsChange:
|
|
1752
|
+
initialSelections: b,
|
|
1753
|
+
onSelectionsChange: x
|
|
1561
1754
|
})
|
|
1562
1755
|
})
|
|
1563
|
-
}), /* @__PURE__ */
|
|
1756
|
+
}), /* @__PURE__ */ I("div", {
|
|
1564
1757
|
className: "flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm",
|
|
1565
1758
|
children: [
|
|
1566
|
-
|
|
1567
|
-
currentView:
|
|
1568
|
-
availableViews:
|
|
1569
|
-
onViewChange:
|
|
1570
|
-
}), /* @__PURE__ */
|
|
1571
|
-
|
|
1759
|
+
ue && /* @__PURE__ */ I(Le, { children: [/* @__PURE__ */ F(Qe, {
|
|
1760
|
+
currentView: P,
|
|
1761
|
+
availableViews: bn,
|
|
1762
|
+
onViewChange: xn
|
|
1763
|
+
}), /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-0.5" })] }),
|
|
1764
|
+
P === "grid" && h && !N.compactToolbar && /* @__PURE__ */ I(_, {
|
|
1572
1765
|
variant: "ghost",
|
|
1573
1766
|
size: "sm",
|
|
1574
|
-
onClick: () =>
|
|
1575
|
-
className:
|
|
1576
|
-
title:
|
|
1767
|
+
onClick: () => Jt(!Kt),
|
|
1768
|
+
className: O("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Kt && "text-primary"),
|
|
1769
|
+
title: k("list.inlineEditLabel", { defaultValue: "Edit records inline (click a cell to edit)" }),
|
|
1577
1770
|
"data-testid": "toolbar-inline-edit-toggle",
|
|
1578
|
-
children: [/* @__PURE__ */
|
|
1771
|
+
children: [/* @__PURE__ */ F(Se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1579
1772
|
className: "hidden sm:inline",
|
|
1580
|
-
children:
|
|
1773
|
+
children: k("list.inlineEditShort", { defaultValue: "Edit inline" })
|
|
1581
1774
|
})]
|
|
1582
1775
|
}),
|
|
1583
|
-
|
|
1584
|
-
open:
|
|
1585
|
-
onOpenChange:
|
|
1586
|
-
children: [/* @__PURE__ */
|
|
1776
|
+
N.showHideFields && !N.compactToolbar && /* @__PURE__ */ I(w, {
|
|
1777
|
+
open: Wt,
|
|
1778
|
+
onOpenChange: Gt,
|
|
1779
|
+
children: [/* @__PURE__ */ F(E, {
|
|
1587
1780
|
asChild: !0,
|
|
1588
|
-
children: /* @__PURE__ */
|
|
1781
|
+
children: /* @__PURE__ */ I(_, {
|
|
1589
1782
|
variant: "ghost",
|
|
1590
1783
|
size: "sm",
|
|
1591
|
-
className:
|
|
1784
|
+
className: O("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", X.size > 0 && "text-primary"),
|
|
1592
1785
|
children: [
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1786
|
+
/* @__PURE__ */ F(he, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1787
|
+
/* @__PURE__ */ F("span", {
|
|
1595
1788
|
className: "hidden sm:inline",
|
|
1596
|
-
children:
|
|
1789
|
+
children: k("list.hideFields")
|
|
1597
1790
|
}),
|
|
1598
|
-
|
|
1791
|
+
X.size > 0 && /* @__PURE__ */ F("span", {
|
|
1599
1792
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1600
|
-
children:
|
|
1793
|
+
children: X.size
|
|
1601
1794
|
})
|
|
1602
1795
|
]
|
|
1603
1796
|
})
|
|
1604
|
-
}), /* @__PURE__ */
|
|
1797
|
+
}), /* @__PURE__ */ F(T, {
|
|
1605
1798
|
align: "start",
|
|
1606
1799
|
className: "w-64 p-3",
|
|
1607
|
-
children: /* @__PURE__ */
|
|
1800
|
+
children: /* @__PURE__ */ I("div", {
|
|
1608
1801
|
className: "space-y-2",
|
|
1609
|
-
children: [/* @__PURE__ */
|
|
1802
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1610
1803
|
className: "flex items-center justify-between border-b pb-2",
|
|
1611
|
-
children: [/* @__PURE__ */
|
|
1804
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1612
1805
|
className: "font-medium text-sm",
|
|
1613
|
-
children:
|
|
1614
|
-
}),
|
|
1806
|
+
children: k("list.hideFieldsTitle")
|
|
1807
|
+
}), X.size > 0 && /* @__PURE__ */ F(_, {
|
|
1615
1808
|
variant: "ghost",
|
|
1616
1809
|
size: "sm",
|
|
1617
1810
|
className: "h-6 px-2 text-xs",
|
|
1618
|
-
onClick: () =>
|
|
1619
|
-
children:
|
|
1811
|
+
onClick: () => Ut(/* @__PURE__ */ new Set()),
|
|
1812
|
+
children: k("list.showAll")
|
|
1620
1813
|
})]
|
|
1621
|
-
}), /* @__PURE__ */
|
|
1814
|
+
}), /* @__PURE__ */ F("div", {
|
|
1622
1815
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1623
|
-
children:
|
|
1816
|
+
children: jn.map((e) => /* @__PURE__ */ I("label", {
|
|
1624
1817
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1625
|
-
children: [/* @__PURE__ */
|
|
1818
|
+
children: [/* @__PURE__ */ F("input", {
|
|
1626
1819
|
type: "checkbox",
|
|
1627
|
-
checked: !
|
|
1820
|
+
checked: !X.has(e.name),
|
|
1628
1821
|
onChange: () => {
|
|
1629
|
-
let t = new Set(
|
|
1630
|
-
t.has(e.name) ? t.delete(e.name) : t.add(e.name),
|
|
1822
|
+
let t = new Set(X);
|
|
1823
|
+
t.has(e.name) ? t.delete(e.name) : t.add(e.name), Ut(t);
|
|
1631
1824
|
},
|
|
1632
1825
|
className: "rounded border-input"
|
|
1633
|
-
}), /* @__PURE__ */
|
|
1826
|
+
}), /* @__PURE__ */ F("span", {
|
|
1634
1827
|
className: "truncate",
|
|
1635
1828
|
children: e.label
|
|
1636
1829
|
})]
|
|
@@ -1639,204 +1832,212 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
1639
1832
|
})
|
|
1640
1833
|
})]
|
|
1641
1834
|
}),
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
open:
|
|
1645
|
-
onOpenChange:
|
|
1646
|
-
children: [/* @__PURE__ */
|
|
1835
|
+
N.showHideFields && !N.compactToolbar && (N.showFilters || N.showSort || N.showGroup) && /* @__PURE__ */ F("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1836
|
+
N.showFilters && /* @__PURE__ */ I(w, {
|
|
1837
|
+
open: z,
|
|
1838
|
+
onOpenChange: $e,
|
|
1839
|
+
children: [/* @__PURE__ */ F(E, {
|
|
1647
1840
|
asChild: !0,
|
|
1648
|
-
children: /* @__PURE__ */
|
|
1841
|
+
children: /* @__PURE__ */ I(_, {
|
|
1649
1842
|
variant: "ghost",
|
|
1650
1843
|
size: "sm",
|
|
1651
|
-
className:
|
|
1844
|
+
className: O("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Tn && "text-foreground font-medium"),
|
|
1652
1845
|
children: [
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ F(Ne, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1847
|
+
/* @__PURE__ */ F("span", {
|
|
1655
1848
|
className: "hidden sm:inline",
|
|
1656
|
-
children:
|
|
1849
|
+
children: k("list.filter")
|
|
1657
1850
|
}),
|
|
1658
|
-
|
|
1851
|
+
Tn && /* @__PURE__ */ F("span", {
|
|
1659
1852
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1660
|
-
children:
|
|
1853
|
+
children: B.conditions?.length || 0
|
|
1661
1854
|
})
|
|
1662
1855
|
]
|
|
1663
1856
|
})
|
|
1664
|
-
}), /* @__PURE__ */
|
|
1857
|
+
}), /* @__PURE__ */ F(T, {
|
|
1665
1858
|
align: "start",
|
|
1666
1859
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1667
|
-
children: /* @__PURE__ */
|
|
1860
|
+
children: /* @__PURE__ */ I("div", {
|
|
1668
1861
|
className: "space-y-4",
|
|
1669
|
-
children: [/* @__PURE__ */
|
|
1862
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1670
1863
|
className: "flex items-center justify-between border-b pb-2",
|
|
1671
|
-
children: /* @__PURE__ */
|
|
1864
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1672
1865
|
className: "font-medium text-sm",
|
|
1673
|
-
children:
|
|
1866
|
+
children: k("list.filterRecords")
|
|
1674
1867
|
})
|
|
1675
|
-
}), /* @__PURE__ */
|
|
1676
|
-
fields:
|
|
1677
|
-
value:
|
|
1868
|
+
}), /* @__PURE__ */ F(ne, {
|
|
1869
|
+
fields: En,
|
|
1870
|
+
value: B,
|
|
1678
1871
|
onChange: (e) => {
|
|
1679
|
-
|
|
1872
|
+
tt(e), c && c(e);
|
|
1680
1873
|
}
|
|
1681
1874
|
})]
|
|
1682
1875
|
})
|
|
1683
1876
|
})]
|
|
1684
1877
|
}),
|
|
1685
|
-
|
|
1686
|
-
open:
|
|
1687
|
-
onOpenChange:
|
|
1688
|
-
children: [/* @__PURE__ */
|
|
1878
|
+
N.showGroup && !N.compactToolbar && /* @__PURE__ */ I(w, {
|
|
1879
|
+
open: kt,
|
|
1880
|
+
onOpenChange: At,
|
|
1881
|
+
children: [/* @__PURE__ */ F(E, {
|
|
1689
1882
|
asChild: !0,
|
|
1690
|
-
children: /* @__PURE__ */
|
|
1883
|
+
children: /* @__PURE__ */ I(_, {
|
|
1691
1884
|
variant: "ghost",
|
|
1692
1885
|
size: "sm",
|
|
1693
|
-
className:
|
|
1886
|
+
className: O("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", J && "text-foreground font-medium"),
|
|
1694
1887
|
children: [
|
|
1695
|
-
/* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1888
|
+
/* @__PURE__ */ F(_e, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1889
|
+
/* @__PURE__ */ F("span", {
|
|
1697
1890
|
className: "hidden sm:inline",
|
|
1698
|
-
children:
|
|
1891
|
+
children: k("list.group")
|
|
1699
1892
|
}),
|
|
1700
|
-
J && J.fields?.length > 0 && /* @__PURE__ */
|
|
1893
|
+
J && J.fields?.length > 0 && /* @__PURE__ */ F("span", {
|
|
1701
1894
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1702
1895
|
children: J.fields.length
|
|
1703
1896
|
})
|
|
1704
1897
|
]
|
|
1705
1898
|
})
|
|
1706
|
-
}), /* @__PURE__ */
|
|
1899
|
+
}), /* @__PURE__ */ F(T, {
|
|
1707
1900
|
align: "start",
|
|
1708
1901
|
className: "w-72 p-3",
|
|
1709
|
-
children: /* @__PURE__ */
|
|
1902
|
+
children: /* @__PURE__ */ I("div", {
|
|
1710
1903
|
className: "space-y-2",
|
|
1711
|
-
children: [/* @__PURE__ */
|
|
1904
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1712
1905
|
className: "flex items-center justify-between border-b pb-2",
|
|
1713
|
-
children: [/* @__PURE__ */
|
|
1906
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1714
1907
|
className: "font-medium text-sm",
|
|
1715
|
-
children:
|
|
1716
|
-
}), J && /* @__PURE__ */
|
|
1908
|
+
children: k("list.groupBy")
|
|
1909
|
+
}), J && /* @__PURE__ */ F(_, {
|
|
1717
1910
|
variant: "ghost",
|
|
1718
1911
|
size: "sm",
|
|
1719
1912
|
className: "h-6 px-2 text-xs",
|
|
1720
|
-
onClick: () =>
|
|
1913
|
+
onClick: () => Ot(void 0),
|
|
1721
1914
|
"data-testid": "clear-grouping",
|
|
1722
|
-
children:
|
|
1915
|
+
children: k("list.clear")
|
|
1723
1916
|
})]
|
|
1724
|
-
}), /* @__PURE__ */
|
|
1917
|
+
}), /* @__PURE__ */ F("div", {
|
|
1725
1918
|
"data-testid": "group-field-list",
|
|
1726
|
-
children: /* @__PURE__ */
|
|
1919
|
+
children: /* @__PURE__ */ F(re, {
|
|
1727
1920
|
value: J,
|
|
1728
|
-
fieldOptions:
|
|
1921
|
+
fieldOptions: jn.map((e) => ({
|
|
1729
1922
|
value: e.name,
|
|
1730
1923
|
label: e.label || e.name
|
|
1731
1924
|
})),
|
|
1732
1925
|
maxLevels: 3,
|
|
1733
1926
|
labels: {
|
|
1734
|
-
addGroup:
|
|
1735
|
-
collapseTitle:
|
|
1736
|
-
removeTitle:
|
|
1927
|
+
addGroup: k("list.addGroup", { defaultValue: "Add group field" }),
|
|
1928
|
+
collapseTitle: k("list.collapsedByDefault", { defaultValue: "Collapsed by default" }),
|
|
1929
|
+
removeTitle: k("list.removeGroup", { defaultValue: "Remove" })
|
|
1737
1930
|
},
|
|
1738
|
-
onChange: (e) =>
|
|
1931
|
+
onChange: (e) => Ot(e)
|
|
1739
1932
|
})
|
|
1740
1933
|
})]
|
|
1741
1934
|
})
|
|
1742
1935
|
})]
|
|
1743
1936
|
}),
|
|
1744
|
-
|
|
1745
|
-
open:
|
|
1746
|
-
onOpenChange:
|
|
1747
|
-
children: [/* @__PURE__ */
|
|
1937
|
+
N.showSort && /* @__PURE__ */ I(w, {
|
|
1938
|
+
open: Ue,
|
|
1939
|
+
onOpenChange: Ke,
|
|
1940
|
+
children: [/* @__PURE__ */ F(E, {
|
|
1748
1941
|
asChild: !0,
|
|
1749
|
-
children: /* @__PURE__ */
|
|
1942
|
+
children: /* @__PURE__ */ I(_, {
|
|
1750
1943
|
variant: "ghost",
|
|
1751
1944
|
size: "sm",
|
|
1752
|
-
className:
|
|
1945
|
+
className: O("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", R.length > 0 && "text-foreground font-medium"),
|
|
1753
1946
|
children: [
|
|
1754
|
-
/* @__PURE__ */
|
|
1755
|
-
/* @__PURE__ */
|
|
1947
|
+
/* @__PURE__ */ F(le, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1948
|
+
/* @__PURE__ */ F("span", {
|
|
1756
1949
|
className: "hidden sm:inline",
|
|
1757
|
-
children:
|
|
1950
|
+
children: k("list.sort")
|
|
1758
1951
|
}),
|
|
1759
|
-
|
|
1952
|
+
R.length > 0 && /* @__PURE__ */ F("span", {
|
|
1760
1953
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1761
|
-
children:
|
|
1954
|
+
children: R.length
|
|
1762
1955
|
})
|
|
1763
1956
|
]
|
|
1764
1957
|
})
|
|
1765
|
-
}), /* @__PURE__ */
|
|
1958
|
+
}), /* @__PURE__ */ F(T, {
|
|
1766
1959
|
align: "start",
|
|
1767
1960
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1768
|
-
children: /* @__PURE__ */
|
|
1961
|
+
children: /* @__PURE__ */ I("div", {
|
|
1769
1962
|
className: "space-y-4",
|
|
1770
|
-
children: [
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1963
|
+
children: [
|
|
1964
|
+
/* @__PURE__ */ F("div", {
|
|
1965
|
+
className: "flex items-center justify-between border-b pb-2",
|
|
1966
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1967
|
+
className: "font-medium text-sm",
|
|
1968
|
+
children: k("list.sortRecords")
|
|
1969
|
+
})
|
|
1970
|
+
}),
|
|
1971
|
+
/* @__PURE__ */ F(oe, {
|
|
1972
|
+
fields: Dn,
|
|
1973
|
+
value: R,
|
|
1974
|
+
onChange: (e) => {
|
|
1975
|
+
Xe(e), f && f(e);
|
|
1976
|
+
}
|
|
1977
|
+
}),
|
|
1978
|
+
On && /* @__PURE__ */ F("p", {
|
|
1979
|
+
className: "text-xs text-muted-foreground",
|
|
1980
|
+
"data-testid": "sort-relational-hint",
|
|
1981
|
+
children: k("list.sortRelationalHint")
|
|
1775
1982
|
})
|
|
1776
|
-
|
|
1777
|
-
fields: pn,
|
|
1778
|
-
value: z,
|
|
1779
|
-
onChange: (e) => {
|
|
1780
|
-
B(e), s && s(e);
|
|
1781
|
-
}
|
|
1782
|
-
})]
|
|
1983
|
+
]
|
|
1783
1984
|
})
|
|
1784
1985
|
})]
|
|
1785
1986
|
}),
|
|
1786
|
-
!
|
|
1787
|
-
|
|
1788
|
-
open:
|
|
1789
|
-
onOpenChange:
|
|
1790
|
-
children: [/* @__PURE__ */
|
|
1987
|
+
!N.compactToolbar && (N.showFilters || N.showSort || N.showGroup) && (N.showColor || N.showDensity) && /* @__PURE__ */ F("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1988
|
+
N.showColor && !N.compactToolbar && /* @__PURE__ */ I(w, {
|
|
1989
|
+
open: Nt,
|
|
1990
|
+
onOpenChange: Pt,
|
|
1991
|
+
children: [/* @__PURE__ */ F(E, {
|
|
1791
1992
|
asChild: !0,
|
|
1792
|
-
children: /* @__PURE__ */
|
|
1993
|
+
children: /* @__PURE__ */ I(_, {
|
|
1793
1994
|
variant: "ghost",
|
|
1794
1995
|
size: "sm",
|
|
1795
|
-
className:
|
|
1796
|
-
children: [/* @__PURE__ */
|
|
1996
|
+
className: O("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Y && "text-foreground font-medium"),
|
|
1997
|
+
children: [/* @__PURE__ */ F(xe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1797
1998
|
className: "hidden sm:inline",
|
|
1798
|
-
children:
|
|
1999
|
+
children: k("list.color")
|
|
1799
2000
|
})]
|
|
1800
2001
|
})
|
|
1801
|
-
}), /* @__PURE__ */
|
|
2002
|
+
}), /* @__PURE__ */ F(T, {
|
|
1802
2003
|
align: "start",
|
|
1803
2004
|
className: "w-64 p-3",
|
|
1804
|
-
children: /* @__PURE__ */
|
|
2005
|
+
children: /* @__PURE__ */ I("div", {
|
|
1805
2006
|
className: "space-y-2",
|
|
1806
|
-
children: [/* @__PURE__ */
|
|
2007
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1807
2008
|
className: "flex items-center justify-between border-b pb-2",
|
|
1808
|
-
children: [/* @__PURE__ */
|
|
2009
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1809
2010
|
className: "font-medium text-sm",
|
|
1810
|
-
children:
|
|
1811
|
-
}), Y && /* @__PURE__ */
|
|
2011
|
+
children: k("list.rowColor")
|
|
2012
|
+
}), Y && /* @__PURE__ */ F(_, {
|
|
1812
2013
|
variant: "ghost",
|
|
1813
2014
|
size: "sm",
|
|
1814
2015
|
className: "h-6 px-2 text-xs",
|
|
1815
|
-
onClick: () =>
|
|
2016
|
+
onClick: () => Mt(void 0),
|
|
1816
2017
|
"data-testid": "clear-row-color",
|
|
1817
|
-
children:
|
|
2018
|
+
children: k("list.clear")
|
|
1818
2019
|
})]
|
|
1819
|
-
}), /* @__PURE__ */
|
|
2020
|
+
}), /* @__PURE__ */ I("div", {
|
|
1820
2021
|
className: "space-y-2",
|
|
1821
2022
|
"data-testid": "color-field-list",
|
|
1822
|
-
children: [/* @__PURE__ */
|
|
2023
|
+
children: [/* @__PURE__ */ F("label", {
|
|
1823
2024
|
className: "text-xs text-muted-foreground",
|
|
1824
|
-
children:
|
|
1825
|
-
}), /* @__PURE__ */
|
|
2025
|
+
children: k("list.colorByField")
|
|
2026
|
+
}), /* @__PURE__ */ I("select", {
|
|
1826
2027
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1827
2028
|
value: Y?.field || "",
|
|
1828
2029
|
onChange: (e) => {
|
|
1829
2030
|
let t = e.target.value;
|
|
1830
|
-
|
|
2031
|
+
Mt(t ? {
|
|
1831
2032
|
field: t,
|
|
1832
2033
|
colors: Y?.colors || {}
|
|
1833
2034
|
} : void 0);
|
|
1834
2035
|
},
|
|
1835
2036
|
"data-testid": "color-field-select",
|
|
1836
|
-
children: [/* @__PURE__ */
|
|
2037
|
+
children: [/* @__PURE__ */ F("option", {
|
|
1837
2038
|
value: "",
|
|
1838
|
-
children:
|
|
1839
|
-
}),
|
|
2039
|
+
children: k("list.none")
|
|
2040
|
+
}), jn.map((e) => /* @__PURE__ */ F("option", {
|
|
1840
2041
|
value: e.name,
|
|
1841
2042
|
children: e.label
|
|
1842
2043
|
}, e.name))]
|
|
@@ -1845,209 +2046,210 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
1845
2046
|
})
|
|
1846
2047
|
})]
|
|
1847
2048
|
}),
|
|
1848
|
-
|
|
1849
|
-
let e = Q.mode === "compact" ?
|
|
2049
|
+
N.showDensity && !N.compactToolbar && P !== "gallery" && (() => {
|
|
2050
|
+
let e = Q.mode === "compact" ? Oe : Q.mode === "comfortable" ? De : Ee, t = Q.mode === "compact" ? k("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Q.mode === "comfortable" ? k("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : k("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${k("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = k("grid.toolbar.densityCycleHint", {
|
|
1850
2051
|
defaultValue: "{{label}} (click to cycle)",
|
|
1851
2052
|
label: n
|
|
1852
2053
|
});
|
|
1853
|
-
return /* @__PURE__ */
|
|
2054
|
+
return /* @__PURE__ */ F(_, {
|
|
1854
2055
|
variant: "ghost",
|
|
1855
2056
|
size: "sm",
|
|
1856
2057
|
"aria-label": n,
|
|
1857
|
-
className:
|
|
2058
|
+
className: O("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Q.mode !== "compact" && "text-foreground font-medium"),
|
|
1858
2059
|
onClick: Q.cycle,
|
|
1859
2060
|
title: r,
|
|
1860
|
-
children: /* @__PURE__ */
|
|
2061
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1861
2062
|
});
|
|
1862
2063
|
})(),
|
|
1863
|
-
|
|
1864
|
-
let e =
|
|
2064
|
+
N.showDensity && !N.compactToolbar && P === "gallery" && (() => {
|
|
2065
|
+
let e = cn === "small" ? Oe : cn === "medium" ? De : Ee, t = cn === "small" ? k("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : cn === "medium" ? k("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : k("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${k("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = k("grid.toolbar.densityCycleHint", {
|
|
1865
2066
|
defaultValue: "{{label}} (click to cycle)",
|
|
1866
2067
|
label: n
|
|
1867
2068
|
});
|
|
1868
|
-
return /* @__PURE__ */
|
|
2069
|
+
return /* @__PURE__ */ F(_, {
|
|
1869
2070
|
variant: "ghost",
|
|
1870
2071
|
size: "sm",
|
|
1871
2072
|
"aria-label": n,
|
|
1872
|
-
className:
|
|
1873
|
-
onClick:
|
|
2073
|
+
className: O("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", cn !== "small" && "text-foreground font-medium"),
|
|
2074
|
+
onClick: un,
|
|
1874
2075
|
title: r,
|
|
1875
|
-
children: /* @__PURE__ */
|
|
2076
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1876
2077
|
});
|
|
1877
2078
|
})(),
|
|
1878
|
-
|
|
1879
|
-
t:
|
|
1880
|
-
allFields:
|
|
1881
|
-
showGroup:
|
|
2079
|
+
N.compactToolbar && (N.showGroup || N.showColor || N.showDensity || N.showHideFields) && /* @__PURE__ */ F(et, {
|
|
2080
|
+
t: k,
|
|
2081
|
+
allFields: jn,
|
|
2082
|
+
showGroup: N.showGroup,
|
|
1882
2083
|
groupingConfig: J,
|
|
1883
|
-
setGroupingConfig:
|
|
1884
|
-
showColor:
|
|
2084
|
+
setGroupingConfig: Ot,
|
|
2085
|
+
showColor: N.showColor,
|
|
1885
2086
|
rowColorConfig: Y,
|
|
1886
|
-
setRowColorConfig:
|
|
1887
|
-
showDensity:
|
|
2087
|
+
setRowColorConfig: Mt,
|
|
2088
|
+
showDensity: N.showDensity,
|
|
1888
2089
|
density: Q,
|
|
1889
|
-
showHideFields:
|
|
1890
|
-
hiddenFields:
|
|
1891
|
-
updateHiddenFields:
|
|
1892
|
-
showInlineEdit:
|
|
1893
|
-
inlineEdit:
|
|
1894
|
-
setInlineEdit:
|
|
2090
|
+
showHideFields: N.showHideFields,
|
|
2091
|
+
hiddenFields: X,
|
|
2092
|
+
updateHiddenFields: Ut,
|
|
2093
|
+
showInlineEdit: P === "grid",
|
|
2094
|
+
inlineEdit: Kt,
|
|
2095
|
+
setInlineEdit: Jt
|
|
1895
2096
|
}),
|
|
1896
|
-
(
|
|
1897
|
-
|
|
2097
|
+
(N.showColor || N.showDensity || N.compactToolbar) && Z && rn && on.length > 0 && /* @__PURE__ */ F("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
2098
|
+
N.showRefresh && /* @__PURE__ */ F(_, {
|
|
1898
2099
|
variant: "ghost",
|
|
1899
2100
|
size: "sm",
|
|
1900
2101
|
className: "h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150",
|
|
1901
|
-
onClick: () =>
|
|
2102
|
+
onClick: () => _t((e) => e + 1),
|
|
1902
2103
|
disabled: W,
|
|
1903
|
-
title:
|
|
1904
|
-
"aria-label":
|
|
2104
|
+
title: k("list.refresh"),
|
|
2105
|
+
"aria-label": k("list.refresh"),
|
|
1905
2106
|
"data-testid": "refresh-button",
|
|
1906
|
-
children: /* @__PURE__ */
|
|
2107
|
+
children: /* @__PURE__ */ F(Te, { className: O("h-3.5 w-3.5", W && "animate-spin") })
|
|
1907
2108
|
}),
|
|
1908
|
-
|
|
1909
|
-
open:
|
|
1910
|
-
onOpenChange:
|
|
1911
|
-
children: [/* @__PURE__ */
|
|
2109
|
+
Z && rn && on.length > 0 && /* @__PURE__ */ I(w, {
|
|
2110
|
+
open: Yt,
|
|
2111
|
+
onOpenChange: Xt,
|
|
2112
|
+
children: [/* @__PURE__ */ F(E, {
|
|
1912
2113
|
asChild: !0,
|
|
1913
|
-
children: /* @__PURE__ */
|
|
2114
|
+
children: /* @__PURE__ */ I(_, {
|
|
1914
2115
|
variant: "ghost",
|
|
1915
2116
|
size: "sm",
|
|
1916
2117
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1917
|
-
children: [/* @__PURE__ */
|
|
2118
|
+
children: [/* @__PURE__ */ F(me, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1918
2119
|
className: "hidden sm:inline",
|
|
1919
|
-
children:
|
|
2120
|
+
children: k("list.export")
|
|
1920
2121
|
})]
|
|
1921
2122
|
})
|
|
1922
|
-
}), /* @__PURE__ */
|
|
2123
|
+
}), /* @__PURE__ */ F(T, {
|
|
1923
2124
|
align: "start",
|
|
1924
2125
|
className: "w-48 p-2",
|
|
1925
|
-
children: /* @__PURE__ */
|
|
2126
|
+
children: /* @__PURE__ */ I("div", {
|
|
1926
2127
|
className: "space-y-1",
|
|
1927
|
-
children: [
|
|
2128
|
+
children: [on.map((e) => /* @__PURE__ */ I(_, {
|
|
1928
2129
|
variant: "ghost",
|
|
1929
2130
|
size: "sm",
|
|
1930
2131
|
className: "w-full justify-start h-8 text-xs",
|
|
1931
|
-
disabled:
|
|
1932
|
-
onClick: () =>
|
|
1933
|
-
children: [
|
|
1934
|
-
}, e)),
|
|
2132
|
+
disabled: Zt,
|
|
2133
|
+
onClick: () => An(e),
|
|
2134
|
+
children: [Zt ? /* @__PURE__ */ F(be, { className: "h-3.5 w-3.5 mr-2 animate-spin" }) : /* @__PURE__ */ F(me, { className: "h-3.5 w-3.5 mr-2" }), k("list.exportAs", { format: e.toUpperCase() })]
|
|
2135
|
+
}, e)), $t && /* @__PURE__ */ F("div", {
|
|
1935
2136
|
className: "px-2 py-1 text-xs",
|
|
1936
2137
|
style: { color: "var(--destructive, #ef4444)" },
|
|
1937
2138
|
role: "alert",
|
|
1938
|
-
children:
|
|
2139
|
+
children: $t
|
|
1939
2140
|
})]
|
|
1940
2141
|
})
|
|
1941
2142
|
})]
|
|
1942
2143
|
}),
|
|
1943
|
-
|
|
2144
|
+
j.sharing?.type && /* @__PURE__ */ I(_, {
|
|
1944
2145
|
variant: "ghost",
|
|
1945
2146
|
size: "sm",
|
|
1946
2147
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1947
|
-
title: `Sharing: ${
|
|
2148
|
+
title: `Sharing: ${j.sharing.type}`,
|
|
1948
2149
|
"data-testid": "share-button",
|
|
1949
|
-
children: [/* @__PURE__ */
|
|
2150
|
+
children: [/* @__PURE__ */ F(je, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1950
2151
|
className: "hidden sm:inline",
|
|
1951
|
-
children:
|
|
2152
|
+
children: k("list.share")
|
|
1952
2153
|
})]
|
|
1953
2154
|
}),
|
|
1954
|
-
|
|
2155
|
+
j.allowPrinting && /* @__PURE__ */ I(_, {
|
|
1955
2156
|
variant: "ghost",
|
|
1956
2157
|
size: "sm",
|
|
1957
2158
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1958
2159
|
onClick: () => window.print(),
|
|
1959
2160
|
"data-testid": "print-button",
|
|
1960
|
-
children: [/* @__PURE__ */
|
|
2161
|
+
children: [/* @__PURE__ */ F(we, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1961
2162
|
className: "hidden sm:inline",
|
|
1962
|
-
children:
|
|
2163
|
+
children: k("list.print")
|
|
1963
2164
|
})]
|
|
1964
2165
|
}),
|
|
1965
2166
|
(() => {
|
|
1966
|
-
let e =
|
|
1967
|
-
return
|
|
2167
|
+
let e = j.allowPrinting || !!j.sharing?.type || Z && rn && on.length > 0;
|
|
2168
|
+
return N.showSearch && e ? /* @__PURE__ */ F("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }) : null;
|
|
1968
2169
|
})(),
|
|
1969
|
-
|
|
1970
|
-
open:
|
|
1971
|
-
onOpenChange:
|
|
1972
|
-
children: [/* @__PURE__ */
|
|
2170
|
+
N.showSearch && /* @__PURE__ */ I(w, {
|
|
2171
|
+
open: ze,
|
|
2172
|
+
onOpenChange: He,
|
|
2173
|
+
children: [/* @__PURE__ */ F(E, {
|
|
1973
2174
|
asChild: !0,
|
|
1974
|
-
children: /* @__PURE__ */
|
|
2175
|
+
children: /* @__PURE__ */ I(_, {
|
|
1975
2176
|
variant: "ghost",
|
|
1976
2177
|
size: "sm",
|
|
1977
|
-
className:
|
|
2178
|
+
className: O("hidden sm:inline-flex h-7 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", L ? "px-2 text-foreground font-medium" : "w-7 p-0"),
|
|
1978
2179
|
"data-testid": "search-icon-button",
|
|
1979
|
-
title:
|
|
1980
|
-
children: [/* @__PURE__ */
|
|
2180
|
+
title: L ? `${k("list.search")}: ${L}` : k("list.search"),
|
|
2181
|
+
children: [/* @__PURE__ */ F(ke, { className: "h-3.5 w-3.5" }), L && /* @__PURE__ */ F("span", {
|
|
1981
2182
|
className: "ml-1.5 max-w-[8rem] truncate text-[11px]",
|
|
1982
2183
|
"data-testid": "search-active-keyword",
|
|
1983
|
-
children:
|
|
2184
|
+
children: L
|
|
1984
2185
|
})]
|
|
1985
2186
|
})
|
|
1986
|
-
}), /* @__PURE__ */
|
|
2187
|
+
}), /* @__PURE__ */ F(T, {
|
|
1987
2188
|
align: "end",
|
|
1988
2189
|
className: "w-[calc(100vw-2rem)] sm:w-64 p-2",
|
|
1989
2190
|
"data-testid": "search-popover",
|
|
1990
|
-
children: /* @__PURE__ */
|
|
2191
|
+
children: /* @__PURE__ */ I("div", {
|
|
1991
2192
|
className: "relative",
|
|
1992
2193
|
children: [
|
|
1993
|
-
/* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
1995
|
-
placeholder:
|
|
1996
|
-
value:
|
|
1997
|
-
onChange: (e) =>
|
|
2194
|
+
/* @__PURE__ */ F(ke, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
2195
|
+
/* @__PURE__ */ F(ie, {
|
|
2196
|
+
placeholder: k("list.search") + "...",
|
|
2197
|
+
value: L,
|
|
2198
|
+
onChange: (e) => Sn(e.target.value),
|
|
1998
2199
|
className: "pl-7 h-8 text-xs",
|
|
1999
2200
|
autoFocus: !0
|
|
2000
2201
|
}),
|
|
2001
|
-
|
|
2202
|
+
L && /* @__PURE__ */ F(_, {
|
|
2002
2203
|
variant: "ghost",
|
|
2003
2204
|
size: "sm",
|
|
2004
2205
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
2005
|
-
onClick: () =>
|
|
2006
|
-
children: /* @__PURE__ */
|
|
2206
|
+
onClick: () => Sn(""),
|
|
2207
|
+
children: /* @__PURE__ */ F(Fe, { className: "h-3 w-3" })
|
|
2007
2208
|
})
|
|
2008
2209
|
]
|
|
2009
2210
|
})
|
|
2010
2211
|
})]
|
|
2011
2212
|
}),
|
|
2012
|
-
|
|
2213
|
+
N.showAddRecordTop && /* @__PURE__ */ I(_, {
|
|
2013
2214
|
variant: "ghost",
|
|
2014
2215
|
size: "sm",
|
|
2015
2216
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
2016
2217
|
"data-testid": "add-record-button",
|
|
2017
|
-
onClick: () =>
|
|
2018
|
-
children: [/* @__PURE__ */
|
|
2218
|
+
onClick: () => C.onAddRecord?.(),
|
|
2219
|
+
children: [/* @__PURE__ */ F(Ce, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
2019
2220
|
className: "hidden sm:inline",
|
|
2020
|
-
children:
|
|
2221
|
+
children: k("list.addRecord")
|
|
2021
2222
|
})]
|
|
2022
2223
|
})
|
|
2023
2224
|
]
|
|
2024
2225
|
})]
|
|
2025
2226
|
}),
|
|
2026
|
-
/* @__PURE__ */
|
|
2227
|
+
/* @__PURE__ */ I("div", {
|
|
2027
2228
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
2028
|
-
children: [/* @__PURE__ */
|
|
2229
|
+
children: [/* @__PURE__ */ F(D, { active: W && H.length > 0 }), rt && H.length === 0 ? /* @__PURE__ */ F(y, {
|
|
2029
2230
|
"data-testid": "list-error-state",
|
|
2231
|
+
"data-error-kind": U,
|
|
2030
2232
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
2031
|
-
icon:
|
|
2233
|
+
icon: F(U === "network" ? ce : Me, { className: "h-12 w-12 text-destructive/60" }),
|
|
2032
2234
|
iconWrapperClassName: "mb-3",
|
|
2033
|
-
title:
|
|
2034
|
-
description:
|
|
2035
|
-
action: /* @__PURE__ */
|
|
2235
|
+
title: k(U === "forbidden" ? "list.loadErrorForbiddenTitle" : U === "unauthorized" ? "list.loadErrorUnauthorizedTitle" : U === "rejected" ? "list.loadErrorRejectedTitle" : "list.loadErrorTitle"),
|
|
2236
|
+
description: k(U === "forbidden" ? "list.loadErrorForbiddenMessage" : U === "unauthorized" ? "list.loadErrorUnauthorizedMessage" : U === "rejected" ? "list.loadErrorRejectedMessage" : "list.loadErrorMessage"),
|
|
2237
|
+
action: /* @__PURE__ */ I(_, {
|
|
2036
2238
|
variant: "outline",
|
|
2037
2239
|
size: "sm",
|
|
2038
2240
|
"data-testid": "list-error-retry",
|
|
2039
|
-
onClick: () =>
|
|
2040
|
-
children: [/* @__PURE__ */
|
|
2241
|
+
onClick: () => _t((e) => e + 1),
|
|
2242
|
+
children: [/* @__PURE__ */ F(Te, { className: "h-4 w-4 mr-1.5" }), k("list.retry")]
|
|
2041
2243
|
})
|
|
2042
|
-
}) : W &&
|
|
2244
|
+
}) : W && H.length === 0 ? /* @__PURE__ */ I("div", {
|
|
2043
2245
|
className: "flex flex-col h-full min-h-[200px] p-4 gap-2",
|
|
2044
2246
|
"data-testid": "list-loading",
|
|
2045
2247
|
role: "status",
|
|
2046
2248
|
"aria-live": "polite",
|
|
2047
2249
|
"aria-busy": "true",
|
|
2048
|
-
children: [/* @__PURE__ */
|
|
2250
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2049
2251
|
className: "sr-only",
|
|
2050
|
-
children:
|
|
2252
|
+
children: k("list.loading")
|
|
2051
2253
|
}), [
|
|
2052
2254
|
0,
|
|
2053
2255
|
1,
|
|
@@ -2055,122 +2257,127 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
2055
2257
|
3,
|
|
2056
2258
|
4,
|
|
2057
2259
|
5
|
|
2058
|
-
].map((e) => /* @__PURE__ */
|
|
2260
|
+
].map((e) => /* @__PURE__ */ F("div", {
|
|
2059
2261
|
className: "h-9 rounded bg-muted/60 animate-pulse",
|
|
2060
2262
|
style: { opacity: Math.max(.25, 1 - e * .12) }
|
|
2061
2263
|
}, e))]
|
|
2062
|
-
}) : !W &&
|
|
2063
|
-
let e =
|
|
2064
|
-
return /* @__PURE__ */
|
|
2264
|
+
}) : !W && H.length === 0 && P === "grid" ? (() => {
|
|
2265
|
+
let e = j.emptyState?.icon, t = e ? Ie[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? ve : ve, n = !!(L && L.trim()) || Array.isArray(Rt) && Rt.length > 0 || Array.isArray(B?.conditions) && B.conditions.length > 0, r = (typeof j.emptyState?.title == "string" ? j.emptyState.title : void 0) ?? k(n ? "list.noMatches" : "list.firstRunTitle"), i = (typeof j.emptyState?.message == "string" ? j.emptyState.message : void 0) ?? k(n ? "list.noMatchesMessage" : "list.firstRunMessage");
|
|
2266
|
+
return /* @__PURE__ */ F(y, {
|
|
2065
2267
|
"data-testid": "empty-state",
|
|
2066
2268
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
2067
|
-
icon: /* @__PURE__ */
|
|
2269
|
+
icon: /* @__PURE__ */ F(t, { className: "h-12 w-12 text-muted-foreground/50" }),
|
|
2068
2270
|
iconWrapperClassName: "mb-3",
|
|
2069
2271
|
title: r,
|
|
2070
2272
|
description: i,
|
|
2071
|
-
action:
|
|
2273
|
+
action: N.showAddRecord ? /* @__PURE__ */ I(_, {
|
|
2072
2274
|
variant: "default",
|
|
2073
2275
|
size: "sm",
|
|
2074
2276
|
"data-testid": "empty-state-add-record",
|
|
2075
|
-
onClick: () =>
|
|
2076
|
-
children: [/* @__PURE__ */
|
|
2277
|
+
onClick: () => C.onAddRecord?.(),
|
|
2278
|
+
children: [/* @__PURE__ */ F(Ce, { className: "h-4 w-4 mr-1.5" }), k("list.addRecord")]
|
|
2077
2279
|
}) : void 0
|
|
2078
2280
|
});
|
|
2079
|
-
})() : /* @__PURE__ */
|
|
2080
|
-
schema:
|
|
2081
|
-
...
|
|
2082
|
-
...
|
|
2281
|
+
})() : /* @__PURE__ */ F(Ve, {
|
|
2282
|
+
schema: wn,
|
|
2283
|
+
...C,
|
|
2284
|
+
..._n ? {} : { data: H },
|
|
2083
2285
|
loading: W,
|
|
2084
|
-
onRowSelect:
|
|
2085
|
-
...
|
|
2286
|
+
onRowSelect: It,
|
|
2287
|
+
...P === "grid" && !J?.fields?.length && Et != null ? {
|
|
2086
2288
|
manualPagination: !0,
|
|
2087
|
-
rowCount:
|
|
2088
|
-
page:
|
|
2089
|
-
pageSize:
|
|
2090
|
-
onPageChange: (e) =>
|
|
2289
|
+
rowCount: Et,
|
|
2290
|
+
page: wt,
|
|
2291
|
+
pageSize: K,
|
|
2292
|
+
onPageChange: (e) => Tt(e),
|
|
2091
2293
|
onPageSizeChange: (e) => {
|
|
2092
|
-
|
|
2093
|
-
}
|
|
2294
|
+
Ct(e), Tt(1);
|
|
2295
|
+
},
|
|
2296
|
+
sort: R,
|
|
2297
|
+
onSortChange: kn
|
|
2094
2298
|
} : {}
|
|
2095
2299
|
})]
|
|
2096
|
-
},
|
|
2097
|
-
|
|
2300
|
+
}, P),
|
|
2301
|
+
N.showAddRecordBottom && /* @__PURE__ */ F("div", {
|
|
2098
2302
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
2099
|
-
children: /* @__PURE__ */
|
|
2303
|
+
children: /* @__PURE__ */ I(_, {
|
|
2100
2304
|
variant: "ghost",
|
|
2101
2305
|
size: "sm",
|
|
2102
2306
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
2103
2307
|
"data-testid": "add-record-button",
|
|
2104
|
-
onClick: () =>
|
|
2105
|
-
children: [/* @__PURE__ */
|
|
2308
|
+
onClick: () => C.onAddRecord?.(),
|
|
2309
|
+
children: [/* @__PURE__ */ F(Ce, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
2106
2310
|
className: "hidden sm:inline",
|
|
2107
|
-
children:
|
|
2311
|
+
children: k("list.addRecord")
|
|
2108
2312
|
})]
|
|
2109
2313
|
})
|
|
2110
2314
|
}),
|
|
2111
|
-
|
|
2315
|
+
an && an.length > 0 && Ft.length > 0 && P !== "grid" && /* @__PURE__ */ I("div", {
|
|
2112
2316
|
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",
|
|
2113
2317
|
role: "region",
|
|
2114
2318
|
"aria-label": "Bulk actions",
|
|
2115
2319
|
"data-testid": "bulk-actions-bar",
|
|
2116
2320
|
children: [
|
|
2117
|
-
/* @__PURE__ */
|
|
2118
|
-
/* @__PURE__ */
|
|
2321
|
+
/* @__PURE__ */ F(fe, { className: "h-3.5 w-3.5 text-primary shrink-0" }),
|
|
2322
|
+
/* @__PURE__ */ I("span", {
|
|
2119
2323
|
className: "font-medium",
|
|
2120
2324
|
children: [
|
|
2121
|
-
|
|
2325
|
+
Ft.length,
|
|
2122
2326
|
" ",
|
|
2123
|
-
|
|
2327
|
+
Ft.length === 1 ? "item" : "items",
|
|
2124
2328
|
" selected"
|
|
2125
2329
|
]
|
|
2126
2330
|
}),
|
|
2127
|
-
/* @__PURE__ */
|
|
2331
|
+
/* @__PURE__ */ F("div", {
|
|
2128
2332
|
className: "flex items-center gap-1.5 ml-3",
|
|
2129
|
-
children:
|
|
2130
|
-
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ?
|
|
2131
|
-
return /* @__PURE__ */
|
|
2333
|
+
children: an.map((e) => {
|
|
2334
|
+
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ? Pe : null;
|
|
2335
|
+
return /* @__PURE__ */ I(_, {
|
|
2132
2336
|
variant: n ? "destructive" : "outline",
|
|
2133
2337
|
size: "sm",
|
|
2134
2338
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
2135
|
-
onClick: () =>
|
|
2339
|
+
onClick: () => C.onBulkAction?.(e, Ft),
|
|
2136
2340
|
"data-testid": `bulk-action-${e}`,
|
|
2137
|
-
children: [r && /* @__PURE__ */
|
|
2341
|
+
children: [r && /* @__PURE__ */ F(r, { className: "h-3 w-3" }), ye(e)]
|
|
2138
2342
|
}, e);
|
|
2139
2343
|
})
|
|
2140
2344
|
}),
|
|
2141
|
-
/* @__PURE__ */
|
|
2345
|
+
/* @__PURE__ */ I(_, {
|
|
2142
2346
|
variant: "ghost",
|
|
2143
2347
|
size: "sm",
|
|
2144
2348
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
2145
|
-
onClick: () =>
|
|
2146
|
-
children: [/* @__PURE__ */
|
|
2349
|
+
onClick: () => It([]),
|
|
2350
|
+
children: [/* @__PURE__ */ F(Fe, { className: "h-3 w-3" }), "Clear"]
|
|
2147
2351
|
})
|
|
2148
2352
|
]
|
|
2149
2353
|
}),
|
|
2150
|
-
!W &&
|
|
2354
|
+
!W && H.length > 0 && j.showRecordCount !== !1 && /* @__PURE__ */ I("div", {
|
|
2151
2355
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
2152
2356
|
"data-testid": "record-count-bar",
|
|
2153
2357
|
children: [
|
|
2154
|
-
/* @__PURE__ */
|
|
2358
|
+
/* @__PURE__ */ F("span", {
|
|
2155
2359
|
className: "font-medium text-foreground/80",
|
|
2156
|
-
children:
|
|
2360
|
+
children: (() => {
|
|
2361
|
+
let e = Et ?? H.length;
|
|
2362
|
+
return k(e === 1 ? "list.recordCountOne" : "list.recordCount", { count: e });
|
|
2363
|
+
})()
|
|
2157
2364
|
}),
|
|
2158
|
-
|
|
2365
|
+
bt && /* @__PURE__ */ F("span", {
|
|
2159
2366
|
className: "text-amber-600",
|
|
2160
2367
|
"data-testid": "data-limit-warning",
|
|
2161
|
-
children:
|
|
2368
|
+
children: k("list.dataLimitReached", { limit: K })
|
|
2162
2369
|
}),
|
|
2163
|
-
|
|
2370
|
+
P !== "grid" && j.pagination?.pageSizeOptions && j.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ I("div", {
|
|
2164
2371
|
className: "ml-auto flex items-center gap-2",
|
|
2165
|
-
children: [/* @__PURE__ */
|
|
2372
|
+
children: [/* @__PURE__ */ F("span", { children: k("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ F("select", {
|
|
2166
2373
|
"data-testid": "page-size-selector",
|
|
2167
2374
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
2168
|
-
value: String(
|
|
2375
|
+
value: String(K),
|
|
2169
2376
|
onChange: (e) => {
|
|
2170
2377
|
let t = Number(e.target.value);
|
|
2171
|
-
|
|
2378
|
+
Ct(t), C.onPageSizeChange && C.onPageSizeChange(t);
|
|
2172
2379
|
},
|
|
2173
|
-
children:
|
|
2380
|
+
children: j.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ F("option", {
|
|
2174
2381
|
value: String(e),
|
|
2175
2382
|
children: e
|
|
2176
2383
|
}, e))
|
|
@@ -2178,17 +2385,17 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
2178
2385
|
})
|
|
2179
2386
|
]
|
|
2180
2387
|
}),
|
|
2181
|
-
|
|
2182
|
-
...
|
|
2183
|
-
title:
|
|
2184
|
-
children: (e) => /* @__PURE__ */
|
|
2388
|
+
Cn.isOverlay && /* @__PURE__ */ F(ae, {
|
|
2389
|
+
...Cn,
|
|
2390
|
+
title: j.label ? `${j.label} Detail` : j.objectName ? `${j.objectName.charAt(0).toUpperCase() + j.objectName.slice(1)} Detail` : "Record Detail",
|
|
2391
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
2185
2392
|
className: "space-y-3",
|
|
2186
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
2393
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
2187
2394
|
className: "flex flex-col",
|
|
2188
|
-
children: [/* @__PURE__ */
|
|
2395
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2189
2396
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
2190
2397
|
children: e.replace(/_/g, " ")
|
|
2191
|
-
}), /* @__PURE__ */
|
|
2398
|
+
}), /* @__PURE__ */ F("span", {
|
|
2192
2399
|
className: "text-sm",
|
|
2193
2400
|
children: String(t ?? "—")
|
|
2194
2401
|
})]
|
|
@@ -2198,24 +2405,24 @@ var ot = a.forwardRef(({ schema: e, className: r, onViewChange: i, onFilterChang
|
|
|
2198
2405
|
]
|
|
2199
2406
|
});
|
|
2200
2407
|
});
|
|
2201
|
-
|
|
2408
|
+
bt.displayName = "ListView";
|
|
2202
2409
|
//#endregion
|
|
2203
2410
|
//#region src/ObjectGallery.tsx
|
|
2204
|
-
var
|
|
2411
|
+
var xt = {
|
|
2205
2412
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
2206
2413
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
2207
2414
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
2208
|
-
},
|
|
2415
|
+
}, St = {
|
|
2209
2416
|
small: "aspect-square",
|
|
2210
2417
|
medium: "aspect-[4/3]",
|
|
2211
2418
|
large: "aspect-[16/10]"
|
|
2212
|
-
},
|
|
2419
|
+
}, Ct = /* @__PURE__ */ new Set([
|
|
2213
2420
|
"number",
|
|
2214
2421
|
"currency",
|
|
2215
2422
|
"percent",
|
|
2216
2423
|
"integer",
|
|
2217
2424
|
"decimal"
|
|
2218
|
-
]),
|
|
2425
|
+
]), K = [
|
|
2219
2426
|
{
|
|
2220
2427
|
bg: "from-indigo-500/15 via-indigo-500/5 to-purple-500/10",
|
|
2221
2428
|
ring: "ring-indigo-500/15",
|
|
@@ -2247,146 +2454,146 @@ var st = {
|
|
|
2247
2454
|
text: "text-violet-600/70 dark:text-violet-300/70"
|
|
2248
2455
|
}
|
|
2249
2456
|
];
|
|
2250
|
-
function
|
|
2457
|
+
function wt(e) {
|
|
2251
2458
|
let t = 5381;
|
|
2252
2459
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n);
|
|
2253
|
-
return
|
|
2460
|
+
return K[Math.abs(t) % K.length];
|
|
2254
2461
|
}
|
|
2255
|
-
var
|
|
2256
|
-
let [o, s] =
|
|
2257
|
-
return /* @__PURE__ */
|
|
2258
|
-
className:
|
|
2462
|
+
var Tt = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, hidden: a }) => {
|
|
2463
|
+
let [o, s] = g(!1), c = !!e && !o;
|
|
2464
|
+
return /* @__PURE__ */ F("div", {
|
|
2465
|
+
className: O("w-full overflow-hidden relative", r),
|
|
2259
2466
|
hidden: a,
|
|
2260
|
-
children: c ? n === "contain" ? /* @__PURE__ */
|
|
2261
|
-
className:
|
|
2262
|
-
children: /* @__PURE__ */
|
|
2467
|
+
children: c ? n === "contain" ? /* @__PURE__ */ F("div", {
|
|
2468
|
+
className: O("flex h-full w-full items-center justify-center bg-gradient-to-br", i.bg),
|
|
2469
|
+
children: /* @__PURE__ */ F("img", {
|
|
2263
2470
|
src: e,
|
|
2264
2471
|
alt: t,
|
|
2265
2472
|
loading: "lazy",
|
|
2266
2473
|
onError: () => s(!0),
|
|
2267
2474
|
className: "h-1/2 w-1/2 max-h-24 max-w-24 object-contain transition-transform duration-300 ease-out group-hover:scale-[1.08]"
|
|
2268
2475
|
})
|
|
2269
|
-
}) : /* @__PURE__ */
|
|
2476
|
+
}) : /* @__PURE__ */ F("img", {
|
|
2270
2477
|
src: e,
|
|
2271
2478
|
alt: t,
|
|
2272
2479
|
loading: "lazy",
|
|
2273
2480
|
onError: () => s(!0),
|
|
2274
2481
|
className: "h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-[1.04]"
|
|
2275
|
-
}) : /* @__PURE__ */
|
|
2276
|
-
className:
|
|
2277
|
-
children: /* @__PURE__ */
|
|
2278
|
-
className:
|
|
2482
|
+
}) : /* @__PURE__ */ F("div", {
|
|
2483
|
+
className: O("flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset", i.bg, i.ring),
|
|
2484
|
+
children: /* @__PURE__ */ F("span", {
|
|
2485
|
+
className: O("text-5xl font-semibold tracking-tight opacity-90", i.text),
|
|
2279
2486
|
children: t[0]?.toUpperCase()
|
|
2280
2487
|
})
|
|
2281
2488
|
})
|
|
2282
2489
|
});
|
|
2283
|
-
},
|
|
2284
|
-
let [r, i] =
|
|
2285
|
-
return /* @__PURE__ */
|
|
2286
|
-
className:
|
|
2287
|
-
children: a ? /* @__PURE__ */
|
|
2490
|
+
}, Et = ({ imageUrl: e, title: t, placeholder: n }) => {
|
|
2491
|
+
let [r, i] = g(!1), a = !!e && !r;
|
|
2492
|
+
return /* @__PURE__ */ F("div", {
|
|
2493
|
+
className: O("flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset", n.bg, n.ring),
|
|
2494
|
+
children: a ? /* @__PURE__ */ F("img", {
|
|
2288
2495
|
src: e,
|
|
2289
2496
|
alt: t,
|
|
2290
2497
|
loading: "lazy",
|
|
2291
2498
|
onError: () => i(!0),
|
|
2292
2499
|
className: "h-6 w-6 object-contain transition-transform duration-300 ease-out group-hover:scale-110"
|
|
2293
|
-
}) : /* @__PURE__ */
|
|
2294
|
-
className:
|
|
2500
|
+
}) : /* @__PURE__ */ F("span", {
|
|
2501
|
+
className: O("text-base font-semibold", n.text),
|
|
2295
2502
|
children: t[0]?.toUpperCase()
|
|
2296
2503
|
})
|
|
2297
2504
|
});
|
|
2298
|
-
},
|
|
2299
|
-
let { schema:
|
|
2300
|
-
navigation:
|
|
2301
|
-
objectName:
|
|
2505
|
+
}, Dt = (e) => {
|
|
2506
|
+
let { schema: t } = e, r = p(He), i = e.dataSource || r?.dataSource, o = Ue(t.bind), [s, c] = g([]), [l, u] = g(!1), [d, _] = g(null), y = Ge({
|
|
2507
|
+
navigation: t.navigation,
|
|
2508
|
+
objectName: t.objectName,
|
|
2302
2509
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
2303
|
-
}), b =
|
|
2304
|
-
let
|
|
2305
|
-
if (
|
|
2306
|
-
|
|
2307
|
-
let e =
|
|
2308
|
-
e && (r.reference_to = e),
|
|
2510
|
+
}), b = t.gallery, x = b?.coverField ?? t.imageField ?? "image", S = b?.coverFit ?? "cover", te = b?.cardSize ?? "medium", ne = b?.titleField ?? t.titleField, re = b?.visibleFields, { fieldLabel: ie, fieldOptionLabel: C } = Ke(), w = f((e) => {
|
|
2511
|
+
let n = d?.fields?.[e], r = { name: e };
|
|
2512
|
+
if (n) {
|
|
2513
|
+
n.type && (r.type = n.type), n.label && (r.label = n.label), n.options && (r.options = n.options), n.currency && (r.currency = n.currency), n.precision !== void 0 && (r.precision = n.precision), n.format && (r.format = n.format);
|
|
2514
|
+
let e = n.reference_to || n.reference;
|
|
2515
|
+
e && (r.reference_to = e), n.reference_field && (r.reference_field = n.reference_field);
|
|
2309
2516
|
}
|
|
2310
|
-
if (
|
|
2311
|
-
let
|
|
2312
|
-
r.label =
|
|
2517
|
+
if (t.objectName) {
|
|
2518
|
+
let n = String(r.label ?? e);
|
|
2519
|
+
r.label = ie(t.objectName, e, n);
|
|
2313
2520
|
}
|
|
2314
|
-
return
|
|
2315
|
-
let r = String(
|
|
2521
|
+
return t.objectName && Array.isArray(r.options) && (r.options = r.options.map((n) => {
|
|
2522
|
+
let r = String(n?.value ?? n), i = String(n?.label ?? r);
|
|
2316
2523
|
return {
|
|
2317
|
-
...
|
|
2524
|
+
...n,
|
|
2318
2525
|
value: r,
|
|
2319
|
-
label:
|
|
2526
|
+
label: C(t.objectName, e, r, i)
|
|
2320
2527
|
};
|
|
2321
2528
|
})), r;
|
|
2322
2529
|
}, [
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2530
|
+
d,
|
|
2531
|
+
t.objectName,
|
|
2532
|
+
ie,
|
|
2533
|
+
C
|
|
2327
2534
|
]);
|
|
2328
|
-
|
|
2535
|
+
m(() => {
|
|
2329
2536
|
let e = !0;
|
|
2330
2537
|
return (async () => {
|
|
2331
|
-
if (!(!
|
|
2332
|
-
let
|
|
2333
|
-
e &&
|
|
2538
|
+
if (!(!i || typeof i.getObjectSchema != "function" || !t.objectName)) try {
|
|
2539
|
+
let n = await i.getObjectSchema(t.objectName);
|
|
2540
|
+
e && _(n);
|
|
2334
2541
|
} catch (e) {
|
|
2335
2542
|
console.warn("Failed to fetch object def for ObjectGallery", e);
|
|
2336
2543
|
}
|
|
2337
2544
|
})(), () => {
|
|
2338
2545
|
e = !1;
|
|
2339
2546
|
};
|
|
2340
|
-
}, [
|
|
2547
|
+
}, [t.objectName, i]), m(() => {
|
|
2341
2548
|
let r = !0;
|
|
2342
2549
|
if (e.data && Array.isArray(e.data)) {
|
|
2343
|
-
|
|
2550
|
+
c(e.data);
|
|
2344
2551
|
return;
|
|
2345
2552
|
}
|
|
2346
|
-
return
|
|
2347
|
-
if (!(!
|
|
2348
|
-
r &&
|
|
2553
|
+
return t.objectName && !o && !t.data && !e.data && (async () => {
|
|
2554
|
+
if (!(!i || typeof i.find != "function" || !t.objectName)) {
|
|
2555
|
+
r && u(!0);
|
|
2349
2556
|
try {
|
|
2350
|
-
let e =
|
|
2351
|
-
$filter:
|
|
2557
|
+
let e = n(d?.fields), a = await i.find(t.objectName, {
|
|
2558
|
+
$filter: t.filter,
|
|
2352
2559
|
...e.length > 0 ? { $expand: e } : {}
|
|
2353
2560
|
}), o = [];
|
|
2354
|
-
if (Array.isArray(
|
|
2355
|
-
else if (
|
|
2356
|
-
let e =
|
|
2561
|
+
if (Array.isArray(a)) o = a;
|
|
2562
|
+
else if (a && typeof a == "object") {
|
|
2563
|
+
let e = a;
|
|
2357
2564
|
Array.isArray(e.records) ? o = e.records : Array.isArray(e.data) && (o = e.data);
|
|
2358
2565
|
}
|
|
2359
|
-
r &&
|
|
2566
|
+
r && c(o);
|
|
2360
2567
|
} catch (e) {
|
|
2361
2568
|
console.error("[ObjectGallery] Fetch error:", e);
|
|
2362
2569
|
} finally {
|
|
2363
|
-
r &&
|
|
2570
|
+
r && u(!1);
|
|
2364
2571
|
}
|
|
2365
2572
|
}
|
|
2366
2573
|
})(), () => {
|
|
2367
2574
|
r = !1;
|
|
2368
2575
|
};
|
|
2369
2576
|
}, [
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2577
|
+
t.objectName,
|
|
2578
|
+
i,
|
|
2579
|
+
o,
|
|
2580
|
+
t.data,
|
|
2581
|
+
t.filter,
|
|
2375
2582
|
e.data,
|
|
2376
|
-
|
|
2583
|
+
d
|
|
2377
2584
|
]);
|
|
2378
|
-
let
|
|
2379
|
-
|
|
2585
|
+
let T = e.data || o || t.data || s || [], E = h(() => T.some((e) => typeof e[x] == "string" && !!e[x]), [T, x]), D = t.grouping?.fields, oe = !!(D && D.length > 0), [se, ce] = g({}), le = h(() => D ? D.some((e) => e.collapsed) : !1, [D]), ue = f((e) => {
|
|
2586
|
+
ce((t) => ({
|
|
2380
2587
|
...t,
|
|
2381
|
-
[e]: t[e] === void 0 ? !
|
|
2588
|
+
[e]: t[e] === void 0 ? !le : !t[e]
|
|
2382
2589
|
}));
|
|
2383
|
-
}, [
|
|
2384
|
-
if (!
|
|
2590
|
+
}, [le]), k = h(() => {
|
|
2591
|
+
if (!oe || !D) return [];
|
|
2385
2592
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
2386
|
-
for (let n of
|
|
2387
|
-
let r =
|
|
2593
|
+
for (let n of T) {
|
|
2594
|
+
let r = D.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
2388
2595
|
if (!e.has(r)) {
|
|
2389
|
-
let i =
|
|
2596
|
+
let i = D.map((e) => {
|
|
2390
2597
|
let t = n[e.field];
|
|
2391
2598
|
return t != null && t !== "" ? String(t) : "(empty)";
|
|
2392
2599
|
}).join(" / ");
|
|
@@ -2397,7 +2604,7 @@ var ft = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2397
2604
|
}
|
|
2398
2605
|
e.get(r).items.push(n);
|
|
2399
2606
|
}
|
|
2400
|
-
let n =
|
|
2607
|
+
let n = D[0]?.order ?? "asc";
|
|
2401
2608
|
return t.sort((e, t) => {
|
|
2402
2609
|
let r = e.localeCompare(t, void 0, {
|
|
2403
2610
|
numeric: !0,
|
|
@@ -2405,7 +2612,7 @@ var ft = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2405
2612
|
});
|
|
2406
2613
|
return n === "desc" ? -r : r;
|
|
2407
2614
|
}), t.map((t) => {
|
|
2408
|
-
let n = e.get(t), r = t in
|
|
2615
|
+
let n = e.get(t), r = t in se ? se[t] : le;
|
|
2409
2616
|
return {
|
|
2410
2617
|
key: t,
|
|
2411
2618
|
label: n.label,
|
|
@@ -2414,128 +2621,128 @@ var ft = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2414
2621
|
};
|
|
2415
2622
|
});
|
|
2416
2623
|
}, [
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2624
|
+
T,
|
|
2625
|
+
D,
|
|
2626
|
+
oe,
|
|
2627
|
+
se,
|
|
2628
|
+
le
|
|
2422
2629
|
]);
|
|
2423
|
-
if (
|
|
2630
|
+
if (l && !T.length) return /* @__PURE__ */ F("div", {
|
|
2424
2631
|
className: "p-4 text-sm text-muted-foreground",
|
|
2425
2632
|
children: "Loading Gallery..."
|
|
2426
2633
|
});
|
|
2427
|
-
if (!
|
|
2634
|
+
if (!T.length) return /* @__PURE__ */ F("div", {
|
|
2428
2635
|
className: "p-4 text-sm text-muted-foreground",
|
|
2429
2636
|
children: "No items to display"
|
|
2430
2637
|
});
|
|
2431
|
-
let de = (e) => !
|
|
2638
|
+
let de = (e) => !re || re.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
2432
2639
|
className: "mt-1.5 space-y-1",
|
|
2433
|
-
children:
|
|
2640
|
+
children: re.map((t) => {
|
|
2434
2641
|
let n = e[t];
|
|
2435
2642
|
if (n == null || n === "") return null;
|
|
2436
|
-
let r =
|
|
2437
|
-
return /* @__PURE__ */
|
|
2438
|
-
className:
|
|
2643
|
+
let r = w(t), i = Xe(r) || r.type || "text", a = R(i), o = r?.label && String(r.label).trim() ? String(r.label) : void 0, s = o != null && Ct.has(i);
|
|
2644
|
+
return /* @__PURE__ */ I("div", {
|
|
2645
|
+
className: O("text-xs text-muted-foreground truncate [&_*]:!text-xs", s && "flex items-baseline gap-1.5"),
|
|
2439
2646
|
onClick: (e) => {
|
|
2440
2647
|
e.target.closest("a,button") && e.stopPropagation();
|
|
2441
2648
|
},
|
|
2442
|
-
children: [s && /* @__PURE__ */
|
|
2649
|
+
children: [s && /* @__PURE__ */ F("span", {
|
|
2443
2650
|
className: "shrink-0 text-muted-foreground/70 tabular-nums",
|
|
2444
2651
|
children: o
|
|
2445
|
-
}), /* @__PURE__ */
|
|
2652
|
+
}), /* @__PURE__ */ F(a, {
|
|
2446
2653
|
value: n,
|
|
2447
2654
|
field: r
|
|
2448
2655
|
})]
|
|
2449
2656
|
}, t);
|
|
2450
2657
|
})
|
|
2451
|
-
}),
|
|
2452
|
-
let
|
|
2453
|
-
return
|
|
2658
|
+
}), fe = (n, r) => {
|
|
2659
|
+
let i = n.id ?? n._id ?? r, o = (ne != null && n[ne] != null && n[ne] !== "" ? String(n[ne]) : void 0) ?? a(d, n), s = n[x], c = wt(String(i) + "|" + o), l = O("group relative overflow-hidden border-border/60 bg-card", "transition-all duration-200 ease-out", "hover:shadow-lg hover:border-border hover:-translate-y-0.5", (e.onCardClick || e.onRowClick || t.navigation) && "cursor-pointer");
|
|
2660
|
+
return E && S === "contain" ? /* @__PURE__ */ I(ee, {
|
|
2454
2661
|
role: "listitem",
|
|
2455
2662
|
className: l,
|
|
2456
|
-
onClick: (e) => y.handleClick(
|
|
2457
|
-
children: [/* @__PURE__ */
|
|
2663
|
+
onClick: (e) => y.handleClick(n, e),
|
|
2664
|
+
children: [/* @__PURE__ */ F("div", {
|
|
2458
2665
|
"aria-hidden": !0,
|
|
2459
|
-
className:
|
|
2460
|
-
}), /* @__PURE__ */
|
|
2666
|
+
className: O("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", c.bg)
|
|
2667
|
+
}), /* @__PURE__ */ F(v, {
|
|
2461
2668
|
className: "p-4",
|
|
2462
|
-
children: /* @__PURE__ */
|
|
2669
|
+
children: /* @__PURE__ */ I("div", {
|
|
2463
2670
|
className: "flex items-start gap-3",
|
|
2464
|
-
children: [/* @__PURE__ */
|
|
2671
|
+
children: [/* @__PURE__ */ F(Et, {
|
|
2465
2672
|
imageUrl: s,
|
|
2466
2673
|
title: o,
|
|
2467
2674
|
placeholder: c
|
|
2468
|
-
}), /* @__PURE__ */
|
|
2675
|
+
}), /* @__PURE__ */ I("div", {
|
|
2469
2676
|
className: "min-w-0 flex-1",
|
|
2470
|
-
children: [/* @__PURE__ */
|
|
2677
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
2471
2678
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2472
2679
|
title: o,
|
|
2473
2680
|
children: o
|
|
2474
|
-
}), de(
|
|
2681
|
+
}), de(n)]
|
|
2475
2682
|
})]
|
|
2476
2683
|
})
|
|
2477
2684
|
})]
|
|
2478
|
-
},
|
|
2685
|
+
}, i) : /* @__PURE__ */ I(ee, {
|
|
2479
2686
|
role: "listitem",
|
|
2480
2687
|
className: l,
|
|
2481
|
-
onClick: (e) => y.handleClick(
|
|
2688
|
+
onClick: (e) => y.handleClick(n, e),
|
|
2482
2689
|
children: [
|
|
2483
|
-
!
|
|
2690
|
+
!E && /* @__PURE__ */ F("div", {
|
|
2484
2691
|
"aria-hidden": !0,
|
|
2485
|
-
className:
|
|
2692
|
+
className: O("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", c.bg)
|
|
2486
2693
|
}),
|
|
2487
|
-
/* @__PURE__ */
|
|
2694
|
+
/* @__PURE__ */ F(Tt, {
|
|
2488
2695
|
imageUrl: s,
|
|
2489
2696
|
title: o,
|
|
2490
2697
|
coverFit: S,
|
|
2491
|
-
aspectClass:
|
|
2698
|
+
aspectClass: St[te],
|
|
2492
2699
|
placeholder: c,
|
|
2493
|
-
hidden: !
|
|
2700
|
+
hidden: !E
|
|
2494
2701
|
}),
|
|
2495
|
-
/* @__PURE__ */
|
|
2496
|
-
className:
|
|
2497
|
-
children: [/* @__PURE__ */
|
|
2702
|
+
/* @__PURE__ */ I(v, {
|
|
2703
|
+
className: O("p-3", E && "border-t border-border/60"),
|
|
2704
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
2498
2705
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2499
2706
|
title: o,
|
|
2500
2707
|
children: o
|
|
2501
|
-
}), de(
|
|
2708
|
+
}), de(n)]
|
|
2502
2709
|
})
|
|
2503
2710
|
]
|
|
2504
|
-
},
|
|
2505
|
-
},
|
|
2506
|
-
className:
|
|
2711
|
+
}, i);
|
|
2712
|
+
}, me = (e) => /* @__PURE__ */ F("div", {
|
|
2713
|
+
className: O("grid gap-4 p-4 auto-rows-min content-start", xt[te], t.className),
|
|
2507
2714
|
role: "list",
|
|
2508
|
-
children: e.map((e, t) =>
|
|
2715
|
+
children: e.map((e, t) => fe(e, t))
|
|
2509
2716
|
});
|
|
2510
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ I(Le, { children: [oe ? /* @__PURE__ */ F("div", {
|
|
2511
2718
|
className: "space-y-2",
|
|
2512
|
-
children:
|
|
2719
|
+
children: k.map((e) => /* @__PURE__ */ I("div", {
|
|
2513
2720
|
className: "border rounded-md",
|
|
2514
|
-
children: [/* @__PURE__ */
|
|
2721
|
+
children: [/* @__PURE__ */ I("button", {
|
|
2515
2722
|
type: "button",
|
|
2516
2723
|
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",
|
|
2517
|
-
onClick: () =>
|
|
2724
|
+
onClick: () => ue(e.key),
|
|
2518
2725
|
children: [
|
|
2519
|
-
e.collapsed ? /* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2726
|
+
e.collapsed ? /* @__PURE__ */ F(pe, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ F(A, { className: "h-4 w-4 shrink-0" }),
|
|
2727
|
+
/* @__PURE__ */ F("span", { children: e.label }),
|
|
2728
|
+
/* @__PURE__ */ F("span", {
|
|
2522
2729
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2523
2730
|
children: e.items.length
|
|
2524
2731
|
})
|
|
2525
2732
|
]
|
|
2526
|
-
}), !e.collapsed &&
|
|
2733
|
+
}), !e.collapsed && me(e.items)]
|
|
2527
2734
|
}, e.key))
|
|
2528
|
-
}) :
|
|
2735
|
+
}) : me(T), y.isOverlay && /* @__PURE__ */ F(ae, {
|
|
2529
2736
|
...y,
|
|
2530
2737
|
title: "Gallery Item",
|
|
2531
|
-
children: (e) => /* @__PURE__ */
|
|
2738
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
2532
2739
|
className: "space-y-3",
|
|
2533
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
2740
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
2534
2741
|
className: "flex flex-col",
|
|
2535
|
-
children: [/* @__PURE__ */
|
|
2742
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2536
2743
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
2537
2744
|
children: e.replace(/_/g, " ")
|
|
2538
|
-
}), /* @__PURE__ */
|
|
2745
|
+
}), /* @__PURE__ */ F("span", {
|
|
2539
2746
|
className: "text-sm",
|
|
2540
2747
|
children: String(t ?? "—")
|
|
2541
2748
|
})]
|
|
@@ -2543,76 +2750,76 @@ var ft = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i,
|
|
|
2543
2750
|
})
|
|
2544
2751
|
})] });
|
|
2545
2752
|
};
|
|
2546
|
-
e.register("object-gallery",
|
|
2753
|
+
e.register("object-gallery", Dt, {
|
|
2547
2754
|
namespace: "plugin-list",
|
|
2548
2755
|
label: "Gallery View",
|
|
2549
2756
|
category: "view"
|
|
2550
2757
|
});
|
|
2551
2758
|
//#endregion
|
|
2552
2759
|
//#region src/components/TabBar.tsx
|
|
2553
|
-
function
|
|
2554
|
-
return e ?
|
|
2760
|
+
function q(e) {
|
|
2761
|
+
return e ? Ie[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
2555
2762
|
}
|
|
2556
|
-
function
|
|
2763
|
+
function J(e) {
|
|
2557
2764
|
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
2558
2765
|
}
|
|
2559
|
-
var
|
|
2560
|
-
let i =
|
|
2561
|
-
|
|
2766
|
+
var Ot = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
2767
|
+
let i = d.useMemo(() => J(e), [e]), a = d.useMemo(() => i.find((e) => e.isDefault)?.name ?? i[0]?.name, [i]), [o, s] = d.useState(a), c = t ?? o, l = d.useCallback((e) => {
|
|
2768
|
+
s(e.name), n?.(e);
|
|
2562
2769
|
}, [n]);
|
|
2563
|
-
return i.length === 0 ? null : /* @__PURE__ */
|
|
2564
|
-
className:
|
|
2770
|
+
return i.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
2771
|
+
className: O("px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", r),
|
|
2565
2772
|
"data-testid": "view-tabs",
|
|
2566
2773
|
role: "tablist",
|
|
2567
2774
|
children: i.map((e) => {
|
|
2568
|
-
let t =
|
|
2569
|
-
return /* @__PURE__ */
|
|
2775
|
+
let t = q(e.icon), n = c === e.name;
|
|
2776
|
+
return /* @__PURE__ */ I(_, {
|
|
2570
2777
|
variant: "ghost",
|
|
2571
2778
|
size: "sm",
|
|
2572
|
-
className:
|
|
2779
|
+
className: O("h-7 px-2.5 py-1 text-xs rounded-md transition-colors duration-150", n ? "font-medium text-foreground bg-muted" : "text-muted-foreground hover:text-foreground hover:bg-transparent"),
|
|
2573
2780
|
"data-testid": `view-tab-${e.name}`,
|
|
2574
2781
|
role: "tab",
|
|
2575
2782
|
"aria-selected": n,
|
|
2576
|
-
onClick: () =>
|
|
2577
|
-
children: [t && /* @__PURE__ */
|
|
2783
|
+
onClick: () => l(e),
|
|
2784
|
+
children: [t && /* @__PURE__ */ F(t, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
2578
2785
|
}, e.name);
|
|
2579
2786
|
})
|
|
2580
2787
|
});
|
|
2581
|
-
},
|
|
2582
|
-
let i =
|
|
2583
|
-
|
|
2788
|
+
}, kt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
2789
|
+
let i = d.useMemo(() => J(e), [e]), a = d.useMemo(() => i.find((e) => e.isDefault)?.name ?? i[0]?.name, [i]), [o, s] = d.useState(a), c = t ?? o, l = d.useMemo(() => i.find((e) => e.name === c) ?? i[0], [i, c]), u = d.useCallback((e) => {
|
|
2790
|
+
s(e.name), n?.(e);
|
|
2584
2791
|
}, [n]);
|
|
2585
2792
|
if (i.length === 0) return null;
|
|
2586
|
-
let
|
|
2587
|
-
return /* @__PURE__ */
|
|
2588
|
-
className:
|
|
2793
|
+
let f = q(l?.icon);
|
|
2794
|
+
return /* @__PURE__ */ F("div", {
|
|
2795
|
+
className: O("px-2 py-1", r),
|
|
2589
2796
|
"data-testid": "view-tabs-select",
|
|
2590
|
-
children: /* @__PURE__ */
|
|
2797
|
+
children: /* @__PURE__ */ I(b, { children: [/* @__PURE__ */ F(te, {
|
|
2591
2798
|
asChild: !0,
|
|
2592
|
-
children: /* @__PURE__ */
|
|
2799
|
+
children: /* @__PURE__ */ I(_, {
|
|
2593
2800
|
variant: "ghost",
|
|
2594
2801
|
size: "sm",
|
|
2595
2802
|
className: "h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate",
|
|
2596
2803
|
"aria-label": "Switch view",
|
|
2597
2804
|
children: [
|
|
2598
|
-
|
|
2599
|
-
/* @__PURE__ */
|
|
2805
|
+
f && /* @__PURE__ */ F(f, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2806
|
+
/* @__PURE__ */ F("span", {
|
|
2600
2807
|
className: "truncate",
|
|
2601
|
-
children:
|
|
2808
|
+
children: l?.label ?? ""
|
|
2602
2809
|
}),
|
|
2603
|
-
/* @__PURE__ */
|
|
2810
|
+
/* @__PURE__ */ F(A, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
2604
2811
|
]
|
|
2605
2812
|
})
|
|
2606
|
-
}), /* @__PURE__ */
|
|
2813
|
+
}), /* @__PURE__ */ F(x, {
|
|
2607
2814
|
align: "start",
|
|
2608
2815
|
className: "w-56 max-h-72 overflow-y-auto",
|
|
2609
2816
|
children: i.map((e) => {
|
|
2610
|
-
let t =
|
|
2611
|
-
return /* @__PURE__ */
|
|
2612
|
-
onClick: () =>
|
|
2613
|
-
className:
|
|
2817
|
+
let t = q(e.icon);
|
|
2818
|
+
return /* @__PURE__ */ I(S, {
|
|
2819
|
+
onClick: () => u(e),
|
|
2820
|
+
className: O("text-sm", c === e.name && "font-medium bg-muted"),
|
|
2614
2821
|
"data-testid": `view-tab-select-${e.name}`,
|
|
2615
|
-
children: [t && /* @__PURE__ */
|
|
2822
|
+
children: [t && /* @__PURE__ */ F(t, { className: "h-3.5 w-3.5 mr-2 shrink-0" }), /* @__PURE__ */ F("span", {
|
|
2616
2823
|
className: "truncate",
|
|
2617
2824
|
children: e.label
|
|
2618
2825
|
})]
|
|
@@ -2621,7 +2828,7 @@ var gt = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
|
2621
2828
|
})] })
|
|
2622
2829
|
});
|
|
2623
2830
|
};
|
|
2624
|
-
e.register("list-view",
|
|
2831
|
+
e.register("list-view", bt, {
|
|
2625
2832
|
namespace: "plugin-list",
|
|
2626
2833
|
label: "List View",
|
|
2627
2834
|
category: "Views",
|
|
@@ -2670,14 +2877,14 @@ e.register("list-view", ot, {
|
|
|
2670
2877
|
defaultValue: "grid"
|
|
2671
2878
|
},
|
|
2672
2879
|
{
|
|
2673
|
-
name: "
|
|
2880
|
+
name: "columns",
|
|
2674
2881
|
type: "array",
|
|
2675
|
-
label: "
|
|
2882
|
+
label: "Columns"
|
|
2676
2883
|
},
|
|
2677
2884
|
{
|
|
2678
|
-
name: "
|
|
2885
|
+
name: "filter",
|
|
2679
2886
|
type: "array",
|
|
2680
|
-
label: "
|
|
2887
|
+
label: "Filter"
|
|
2681
2888
|
},
|
|
2682
2889
|
{
|
|
2683
2890
|
name: "sort",
|
|
@@ -2693,12 +2900,12 @@ e.register("list-view", ot, {
|
|
|
2693
2900
|
defaultProps: {
|
|
2694
2901
|
objectName: "",
|
|
2695
2902
|
viewType: "grid",
|
|
2696
|
-
|
|
2697
|
-
|
|
2903
|
+
columns: [],
|
|
2904
|
+
filter: [],
|
|
2698
2905
|
sort: [],
|
|
2699
2906
|
options: {}
|
|
2700
2907
|
}
|
|
2701
|
-
}), e.register("list",
|
|
2908
|
+
}), e.register("list", bt, {
|
|
2702
2909
|
namespace: "view",
|
|
2703
2910
|
skipFallback: !0,
|
|
2704
2911
|
category: "view",
|
|
@@ -2748,14 +2955,14 @@ e.register("list-view", ot, {
|
|
|
2748
2955
|
defaultValue: "grid"
|
|
2749
2956
|
},
|
|
2750
2957
|
{
|
|
2751
|
-
name: "
|
|
2958
|
+
name: "columns",
|
|
2752
2959
|
type: "array",
|
|
2753
|
-
label: "
|
|
2960
|
+
label: "Columns"
|
|
2754
2961
|
},
|
|
2755
2962
|
{
|
|
2756
|
-
name: "
|
|
2963
|
+
name: "filter",
|
|
2757
2964
|
type: "array",
|
|
2758
|
-
label: "
|
|
2965
|
+
label: "Filter"
|
|
2759
2966
|
},
|
|
2760
2967
|
{
|
|
2761
2968
|
name: "sort",
|
|
@@ -2770,4 +2977,4 @@ e.register("list-view", ot, {
|
|
|
2770
2977
|
]
|
|
2771
2978
|
});
|
|
2772
2979
|
//#endregion
|
|
2773
|
-
export {
|
|
2980
|
+
export { bt as ListView, Dt as ObjectGallery, Ot as TabBar, kt as TabBarSelect, it as UserFilters, $e as ViewSwitcher, Qe as ViewSwitcherDropdown, ht as evaluateConditionalFormatting, ct as normalizeFilterCondition, ft as normalizeFilters };
|