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