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