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