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