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