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