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