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