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