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