@object-ui/plugin-list 6.2.3 → 7.1.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 +123 -0
- package/dist/{packages/plugin-list/src/ListView.d.ts → ListView.d.ts} +5 -1
- package/dist/ListView.d.ts.map +1 -0
- package/dist/{packages/plugin-list/src/ObjectGallery.d.ts → ObjectGallery.d.ts} +1 -1
- package/dist/ObjectGallery.d.ts.map +1 -0
- package/dist/UserFilters.d.ts +43 -0
- package/dist/UserFilters.d.ts.map +1 -0
- package/dist/{packages/plugin-list/src/ViewSwitcher.d.ts → ViewSwitcher.d.ts} +8 -1
- package/dist/ViewSwitcher.d.ts.map +1 -0
- package/dist/components/TabBar.d.ts.map +1 -0
- package/dist/{packages/plugin-list/src/components → components}/ViewSettingsPopover.d.ts +2 -1
- package/dist/components/ViewSettingsPopover.d.ts.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1253 -1052
- package/dist/index.umd.cjs +2 -2
- package/package.json +21 -21
- package/dist/packages/plugin-list/src/ListView.d.ts.map +0 -1
- package/dist/packages/plugin-list/src/ListView.stories.d.ts +0 -24
- package/dist/packages/plugin-list/src/ListView.stories.d.ts.map +0 -1
- package/dist/packages/plugin-list/src/ObjectGallery.d.ts.map +0 -1
- package/dist/packages/plugin-list/src/UserFilters.d.ts +0 -23
- package/dist/packages/plugin-list/src/UserFilters.d.ts.map +0 -1
- package/dist/packages/plugin-list/src/ViewSwitcher.d.ts.map +0 -1
- package/dist/packages/plugin-list/src/components/TabBar.d.ts.map +0 -1
- package/dist/packages/plugin-list/src/components/ViewSettingsPopover.d.ts.map +0 -1
- package/dist/packages/plugin-list/src/index.d.ts +0 -13
- package/dist/packages/plugin-list/src/index.d.ts.map +0 -1
- /package/dist/{packages/plugin-list/src/components → components}/TabBar.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,221 +1,219 @@
|
|
|
1
|
-
import { ComponentRegistry as e, buildExpandFields as t, evaluatePlainCondition as n
|
|
2
|
-
import * as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Activity as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { useObjectLabel as
|
|
8
|
-
import { SchemaRenderer as
|
|
9
|
-
import { usePullToRefresh as
|
|
10
|
-
import { usePermissions as
|
|
11
|
-
import { getCellRenderer as
|
|
1
|
+
import { ComponentRegistry as e, buildExpandFields as t, evaluatePlainCondition as n } from "@object-ui/core";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { useCallback as i, useContext as a, useEffect as o, useMemo as s, useState as c } from "react";
|
|
4
|
+
import { Button as l, Card as u, CardContent as d, DataEmptyState as f, DropdownMenu as p, DropdownMenuContent as m, DropdownMenuItem as h, DropdownMenuTrigger as g, FilterBuilder as _, GroupingEditor as v, Input as y, LookupValuePicker as b, NavigationOverlay as x, Popover as S, PopoverContent as C, PopoverTrigger as w, RefreshIndicator as ee, SortBuilder as te, cn as T } from "@object-ui/components";
|
|
5
|
+
import { Activity as ne, AlertTriangle as re, ArrowUpDown as ie, BarChart3 as E, Calendar as D, Check as O, CheckSquare as ae, ChevronDown as k, ChevronRight as A, Download as oe, EyeOff as se, GanttChartSquare as j, Grid as ce, Group as le, Images as M, Inbox as ue, LayoutGrid as N, ListTree as de, Map as P, Paintbrush as fe, Plus as pe, Printer as me, RotateCw as he, Rows2 as ge, Rows3 as _e, Rows4 as ve, Search as ye, Settings2 as be, Share2 as xe, SlidersHorizontal as Se, Trash2 as Ce, X as we, icons as Te } from "lucide-react";
|
|
6
|
+
import { Fragment as Ee, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
7
|
+
import { useObjectLabel as De, useObjectTranslation as Oe, useSafeFieldLabel as ke } from "@object-ui/i18n";
|
|
8
|
+
import { SchemaRenderer as Ae, SchemaRendererContext as je, useDataScope as Me, useDensityMode as Ne, useNavigationOverlay as Pe, useSafeFieldLabel as L } from "@object-ui/react";
|
|
9
|
+
import { usePullToRefresh as Fe } from "@object-ui/mobile";
|
|
10
|
+
import { usePermissions as Ie } from "@object-ui/permissions";
|
|
11
|
+
import { getCellRenderer as Le, resolveCellRendererType as Re } from "@object-ui/fields";
|
|
12
12
|
//#region src/ViewSwitcher.tsx
|
|
13
|
-
var
|
|
14
|
-
grid: /* @__PURE__ */
|
|
15
|
-
kanban: /* @__PURE__ */ N
|
|
16
|
-
gallery: /* @__PURE__ */
|
|
17
|
-
calendar: /* @__PURE__ */
|
|
18
|
-
timeline: /* @__PURE__ */
|
|
19
|
-
gantt: /* @__PURE__ */
|
|
20
|
-
map: /* @__PURE__ */
|
|
21
|
-
|
|
13
|
+
var ze = {
|
|
14
|
+
grid: /* @__PURE__ */ F(ce, { className: "h-4 w-4" }),
|
|
15
|
+
kanban: /* @__PURE__ */ F(N, { className: "h-4 w-4" }),
|
|
16
|
+
gallery: /* @__PURE__ */ F(M, { className: "h-4 w-4" }),
|
|
17
|
+
calendar: /* @__PURE__ */ F(D, { className: "h-4 w-4" }),
|
|
18
|
+
timeline: /* @__PURE__ */ F(ne, { className: "h-4 w-4" }),
|
|
19
|
+
gantt: /* @__PURE__ */ F(j, { className: "h-4 w-4" }),
|
|
20
|
+
map: /* @__PURE__ */ F(P, { className: "h-4 w-4" }),
|
|
21
|
+
chart: /* @__PURE__ */ F(E, { className: "h-4 w-4" }),
|
|
22
|
+
tree: /* @__PURE__ */ F(de, { className: "h-4 w-4" })
|
|
23
|
+
}, R = {
|
|
22
24
|
grid: "Grid",
|
|
23
25
|
kanban: "Kanban",
|
|
24
26
|
gallery: "Gallery",
|
|
25
27
|
calendar: "Calendar",
|
|
26
28
|
timeline: "Timeline",
|
|
27
29
|
gantt: "Gantt",
|
|
28
|
-
map: "Map"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
map: "Map",
|
|
31
|
+
chart: "Chart",
|
|
32
|
+
tree: "Tree"
|
|
33
|
+
}, Be = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: i, animated: a = !0 }) => {
|
|
34
|
+
let [o, s] = r.useState(!1), c = r.useCallback((t) => {
|
|
35
|
+
s(!1), t !== e && (a && typeof document < "u" && "startViewTransition" in document ? document.startViewTransition(() => n(t)) : n(t));
|
|
36
|
+
}, [
|
|
37
|
+
a,
|
|
38
|
+
e,
|
|
39
|
+
n
|
|
40
|
+
]);
|
|
41
|
+
return t.length >= 2 && t.length <= 4 ? /* @__PURE__ */ F("div", {
|
|
42
|
+
role: "tablist",
|
|
43
|
+
"data-testid": "view-switcher-segmented",
|
|
44
|
+
className: T("inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher", i),
|
|
45
|
+
children: t.map((t) => {
|
|
46
|
+
let n = t === e;
|
|
47
|
+
return /* @__PURE__ */ I("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
role: "tab",
|
|
50
|
+
"aria-selected": n,
|
|
51
|
+
"aria-label": R[t],
|
|
52
|
+
title: R[t],
|
|
53
|
+
"data-state": n ? "on" : "off",
|
|
54
|
+
onClick: () => c(t),
|
|
55
|
+
className: T("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"),
|
|
56
|
+
children: [ze[t], /* @__PURE__ */ F("span", {
|
|
57
|
+
className: "hidden sm:inline-block",
|
|
58
|
+
children: R[t]
|
|
59
|
+
})]
|
|
60
|
+
}, t);
|
|
61
|
+
})
|
|
62
|
+
}) : /* @__PURE__ */ I(S, {
|
|
63
|
+
open: o,
|
|
64
|
+
onOpenChange: s,
|
|
65
|
+
children: [/* @__PURE__ */ F(w, {
|
|
66
|
+
asChild: !0,
|
|
67
|
+
children: /* @__PURE__ */ I("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
"data-testid": "view-switcher-dropdown",
|
|
70
|
+
"aria-label": R[e],
|
|
71
|
+
className: T("inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher", o ? "text-foreground bg-muted" : "text-muted-foreground hover:text-foreground", i),
|
|
72
|
+
children: [
|
|
73
|
+
ze[e],
|
|
74
|
+
/* @__PURE__ */ F("span", {
|
|
75
|
+
className: "hidden sm:inline-block",
|
|
76
|
+
children: R[e]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ F(k, { className: "h-3 w-3 opacity-60" })
|
|
79
|
+
]
|
|
80
|
+
})
|
|
81
|
+
}), /* @__PURE__ */ F(C, {
|
|
82
|
+
align: "end",
|
|
83
|
+
className: "w-44 p-1",
|
|
84
|
+
children: t.map((t) => /* @__PURE__ */ I("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
onClick: () => c(t),
|
|
87
|
+
"data-state": t === e ? "on" : "off",
|
|
88
|
+
className: T("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"),
|
|
89
|
+
children: [
|
|
90
|
+
ze[t],
|
|
91
|
+
/* @__PURE__ */ F("span", {
|
|
92
|
+
className: "flex-1 text-left",
|
|
93
|
+
children: R[t]
|
|
94
|
+
}),
|
|
95
|
+
t === e && /* @__PURE__ */ F(O, { className: "h-3.5 w-3.5" })
|
|
96
|
+
]
|
|
97
|
+
}, t))
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
}, z = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: i, animated: a = !0 }) => {
|
|
101
|
+
let o = r.useCallback((t) => {
|
|
102
|
+
if (!a || t === e) {
|
|
32
103
|
n(t);
|
|
33
104
|
return;
|
|
34
105
|
}
|
|
35
106
|
typeof document < "u" && "startViewTransition" in document ? document.startViewTransition(() => n(t)) : n(t);
|
|
36
107
|
}, [
|
|
37
|
-
|
|
108
|
+
a,
|
|
38
109
|
e,
|
|
39
110
|
n
|
|
40
111
|
]);
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
className:
|
|
112
|
+
return /* @__PURE__ */ F("div", {
|
|
113
|
+
className: T("flex items-center gap-1 bg-transparent oui-view-switcher", i),
|
|
43
114
|
children: t.map((t) => {
|
|
44
115
|
let n = e === t;
|
|
45
|
-
return /* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ I("button", {
|
|
46
117
|
type: "button",
|
|
47
118
|
onClick: () => o(t),
|
|
48
|
-
"aria-label":
|
|
49
|
-
title:
|
|
119
|
+
"aria-label": R[t],
|
|
120
|
+
title: R[t],
|
|
50
121
|
"aria-pressed": n,
|
|
51
122
|
"data-state": n ? "on" : "off",
|
|
52
|
-
className:
|
|
53
|
-
children: [
|
|
123
|
+
className: T("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"),
|
|
124
|
+
children: [ze[t], /* @__PURE__ */ F("span", {
|
|
54
125
|
className: "hidden sm:inline-block text-xs font-medium",
|
|
55
|
-
children:
|
|
126
|
+
children: R[t]
|
|
56
127
|
})]
|
|
57
128
|
}, t);
|
|
58
129
|
})
|
|
59
130
|
});
|
|
60
131
|
};
|
|
61
132
|
//#endregion
|
|
62
|
-
//#region src/components/TabBar.tsx
|
|
63
|
-
function I(e) {
|
|
64
|
-
return e ? we[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
65
|
-
}
|
|
66
|
-
function Ve(e) {
|
|
67
|
-
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
68
|
-
}
|
|
69
|
-
var He = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
70
|
-
let i = a.useMemo(() => Ve(e), [e]), o = a.useMemo(() => i.find((e) => e.isDefault)?.name ?? i[0]?.name, [i]), [s, c] = a.useState(o), l = t ?? s, u = a.useCallback((e) => {
|
|
71
|
-
c(e.name), n?.(e);
|
|
72
|
-
}, [n]);
|
|
73
|
-
return i.length === 0 ? null : /* @__PURE__ */ N("div", {
|
|
74
|
-
className: w("px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", r),
|
|
75
|
-
"data-testid": "view-tabs",
|
|
76
|
-
role: "tablist",
|
|
77
|
-
children: i.map((e) => {
|
|
78
|
-
let t = I(e.icon), n = l === e.name;
|
|
79
|
-
return /* @__PURE__ */ P(d, {
|
|
80
|
-
variant: "ghost",
|
|
81
|
-
size: "sm",
|
|
82
|
-
className: w("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"),
|
|
83
|
-
"data-testid": `view-tab-${e.name}`,
|
|
84
|
-
role: "tab",
|
|
85
|
-
"aria-selected": n,
|
|
86
|
-
onClick: () => u(e),
|
|
87
|
-
children: [t && /* @__PURE__ */ N(t, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
88
|
-
}, e.name);
|
|
89
|
-
})
|
|
90
|
-
});
|
|
91
|
-
}, Ue = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
|
|
92
|
-
let i = a.useMemo(() => Ve(e), [e]), o = a.useMemo(() => i.find((e) => e.isDefault)?.name ?? i[0]?.name, [i]), [s, c] = a.useState(o), l = t ?? s, u = a.useMemo(() => i.find((e) => e.name === l) ?? i[0], [i, l]), f = a.useCallback((e) => {
|
|
93
|
-
c(e.name), n?.(e);
|
|
94
|
-
}, [n]);
|
|
95
|
-
if (i.length === 0) return null;
|
|
96
|
-
let p = I(u?.icon);
|
|
97
|
-
return /* @__PURE__ */ N("div", {
|
|
98
|
-
className: w("px-2 py-1", r),
|
|
99
|
-
"data-testid": "view-tabs-select",
|
|
100
|
-
children: /* @__PURE__ */ P(h, { children: [/* @__PURE__ */ N(v, {
|
|
101
|
-
asChild: !0,
|
|
102
|
-
children: /* @__PURE__ */ P(d, {
|
|
103
|
-
variant: "ghost",
|
|
104
|
-
size: "sm",
|
|
105
|
-
className: "h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate",
|
|
106
|
-
"aria-label": "Switch view",
|
|
107
|
-
children: [
|
|
108
|
-
p && /* @__PURE__ */ N(p, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
109
|
-
/* @__PURE__ */ N("span", {
|
|
110
|
-
className: "truncate",
|
|
111
|
-
children: u?.label ?? ""
|
|
112
|
-
}),
|
|
113
|
-
/* @__PURE__ */ N(O, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
114
|
-
]
|
|
115
|
-
})
|
|
116
|
-
}), /* @__PURE__ */ N(g, {
|
|
117
|
-
align: "start",
|
|
118
|
-
className: "w-56 max-h-72 overflow-y-auto",
|
|
119
|
-
children: i.map((e) => {
|
|
120
|
-
let t = I(e.icon);
|
|
121
|
-
return /* @__PURE__ */ P(_, {
|
|
122
|
-
onClick: () => f(e),
|
|
123
|
-
className: w("text-sm", l === e.name && "font-medium bg-muted"),
|
|
124
|
-
"data-testid": `view-tab-select-${e.name}`,
|
|
125
|
-
children: [t && /* @__PURE__ */ N(t, { className: "h-3.5 w-3.5 mr-2 shrink-0" }), /* @__PURE__ */ N("span", {
|
|
126
|
-
className: "truncate",
|
|
127
|
-
children: e.label
|
|
128
|
-
})]
|
|
129
|
-
}, e.name);
|
|
130
|
-
})
|
|
131
|
-
})] })
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
//#endregion
|
|
135
133
|
//#region src/components/ViewSettingsPopover.tsx
|
|
136
|
-
function
|
|
137
|
-
let [s, c] =
|
|
138
|
-
return /* @__PURE__ */
|
|
134
|
+
function Ve({ title: e, badge: t, onClear: n, clearLabel: i, defaultOpen: a = !0, children: o }) {
|
|
135
|
+
let [s, c] = r.useState(a);
|
|
136
|
+
return /* @__PURE__ */ I("div", {
|
|
139
137
|
className: "border-b last:border-b-0",
|
|
140
|
-
children: [/* @__PURE__ */
|
|
138
|
+
children: [/* @__PURE__ */ I("div", {
|
|
141
139
|
className: "flex items-center justify-between px-3 py-2",
|
|
142
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ I("button", {
|
|
143
141
|
type: "button",
|
|
144
142
|
onClick: () => c((e) => !e),
|
|
145
143
|
className: "flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground",
|
|
146
144
|
children: [
|
|
147
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ F(k, { className: T("h-3.5 w-3.5 transition-transform", !s && "-rotate-90") }),
|
|
148
146
|
e,
|
|
149
|
-
typeof t == "number" && t > 0 && /* @__PURE__ */
|
|
147
|
+
typeof t == "number" && t > 0 && /* @__PURE__ */ F("span", {
|
|
150
148
|
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
149
|
children: t
|
|
152
150
|
})
|
|
153
151
|
]
|
|
154
|
-
}), n && /* @__PURE__ */
|
|
152
|
+
}), n && /* @__PURE__ */ F("button", {
|
|
155
153
|
type: "button",
|
|
156
154
|
onClick: n,
|
|
157
155
|
className: "text-[11px] text-muted-foreground hover:text-foreground",
|
|
158
|
-
children:
|
|
156
|
+
children: i
|
|
159
157
|
})]
|
|
160
|
-
}), s && /* @__PURE__ */
|
|
158
|
+
}), s && /* @__PURE__ */ F("div", {
|
|
161
159
|
className: "px-3 pb-3",
|
|
162
160
|
children: o
|
|
163
161
|
})]
|
|
164
162
|
});
|
|
165
163
|
}
|
|
166
|
-
function
|
|
167
|
-
let { t, allFields: n, showGroup:
|
|
168
|
-
!!
|
|
164
|
+
function He(e) {
|
|
165
|
+
let { t, allFields: n, showGroup: i, groupingConfig: a, setGroupingConfig: o, showColor: s, rowColorConfig: c, setRowColorConfig: u, showDensity: d, density: f, showHideFields: p, hiddenFields: m, updateHiddenFields: h } = e, [g, _] = r.useState(!1), y = [
|
|
166
|
+
!!a?.fields?.length,
|
|
169
167
|
!!c?.field,
|
|
170
168
|
f && f.mode !== "compact",
|
|
171
169
|
(m?.size ?? 0) > 0
|
|
172
|
-
].filter(Boolean).length,
|
|
173
|
-
return /* @__PURE__ */
|
|
170
|
+
].filter(Boolean).length, b = f?.mode === "compact" ? ve : f?.mode === "comfortable" ? _e : ge, x = t("list.viewSettings", { defaultValue: "View settings" });
|
|
171
|
+
return /* @__PURE__ */ I(S, {
|
|
174
172
|
open: g,
|
|
175
173
|
onOpenChange: _,
|
|
176
|
-
children: [/* @__PURE__ */
|
|
174
|
+
children: [/* @__PURE__ */ F(w, {
|
|
177
175
|
asChild: !0,
|
|
178
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ I(l, {
|
|
179
177
|
variant: "ghost",
|
|
180
178
|
size: "sm",
|
|
181
|
-
"aria-label":
|
|
182
|
-
title:
|
|
183
|
-
className:
|
|
179
|
+
"aria-label": x,
|
|
180
|
+
title: x,
|
|
181
|
+
className: T("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", y > 0 && "text-foreground font-medium"),
|
|
184
182
|
"data-testid": "view-settings-trigger",
|
|
185
183
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ F(be, { className: "h-3.5 w-3.5 sm:mr-1.5" }),
|
|
185
|
+
/* @__PURE__ */ F("span", {
|
|
188
186
|
className: "hidden sm:inline",
|
|
189
|
-
children:
|
|
187
|
+
children: x
|
|
190
188
|
}),
|
|
191
|
-
|
|
189
|
+
y > 0 && /* @__PURE__ */ F("span", {
|
|
192
190
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
193
|
-
children:
|
|
191
|
+
children: y
|
|
194
192
|
})
|
|
195
193
|
]
|
|
196
194
|
})
|
|
197
|
-
}), /* @__PURE__ */
|
|
195
|
+
}), /* @__PURE__ */ I(C, {
|
|
198
196
|
align: "end",
|
|
199
197
|
className: "w-80 p-0",
|
|
200
198
|
"data-testid": "view-settings-content",
|
|
201
199
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ I("div", {
|
|
203
201
|
className: "px-3 py-2 border-b",
|
|
204
|
-
children: [/* @__PURE__ */
|
|
202
|
+
children: [/* @__PURE__ */ F("div", {
|
|
205
203
|
className: "text-sm font-semibold",
|
|
206
|
-
children:
|
|
207
|
-
}), /* @__PURE__ */
|
|
204
|
+
children: x
|
|
205
|
+
}), /* @__PURE__ */ F("div", {
|
|
208
206
|
className: "text-[11px] text-muted-foreground",
|
|
209
207
|
children: t("list.viewSettingsHint", { defaultValue: "Grouping, color, density, and visible fields." })
|
|
210
208
|
})]
|
|
211
209
|
}),
|
|
212
|
-
|
|
210
|
+
i && o && /* @__PURE__ */ F(Ve, {
|
|
213
211
|
title: t("list.group", { defaultValue: "Group" }),
|
|
214
|
-
badge:
|
|
215
|
-
onClear:
|
|
212
|
+
badge: a?.fields?.length || 0,
|
|
213
|
+
onClear: a ? () => o(void 0) : void 0,
|
|
216
214
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
217
|
-
children: /* @__PURE__ */
|
|
218
|
-
value:
|
|
215
|
+
children: /* @__PURE__ */ F(v, {
|
|
216
|
+
value: a,
|
|
219
217
|
fieldOptions: n.map((e) => ({
|
|
220
218
|
value: e.name,
|
|
221
219
|
label: e.label || e.name
|
|
@@ -229,66 +227,66 @@ function We(e) {
|
|
|
229
227
|
onChange: (e) => o(e)
|
|
230
228
|
})
|
|
231
229
|
}),
|
|
232
|
-
s &&
|
|
230
|
+
s && u && /* @__PURE__ */ I(Ve, {
|
|
233
231
|
title: t("list.color", { defaultValue: "Row color" }),
|
|
234
|
-
onClear: c ? () =>
|
|
232
|
+
onClear: c ? () => u(void 0) : void 0,
|
|
235
233
|
clearLabel: t("list.clear", { defaultValue: "Clear" }),
|
|
236
234
|
defaultOpen: !!c,
|
|
237
|
-
children: [/* @__PURE__ */
|
|
235
|
+
children: [/* @__PURE__ */ F("label", {
|
|
238
236
|
className: "block text-[11px] text-muted-foreground mb-1",
|
|
239
237
|
children: t("list.colorByField", { defaultValue: "Color by field" })
|
|
240
|
-
}), /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ I("select", {
|
|
241
239
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
242
240
|
value: c?.field || "",
|
|
243
241
|
onChange: (e) => {
|
|
244
242
|
let t = e.target.value;
|
|
245
|
-
|
|
243
|
+
u(t ? {
|
|
246
244
|
field: t,
|
|
247
245
|
colors: c?.colors || {}
|
|
248
246
|
} : void 0);
|
|
249
247
|
},
|
|
250
248
|
"data-testid": "color-field-select",
|
|
251
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ F("option", {
|
|
252
250
|
value: "",
|
|
253
251
|
children: t("list.none", { defaultValue: "None" })
|
|
254
|
-
}), n.map((e) => /* @__PURE__ */
|
|
252
|
+
}), n.map((e) => /* @__PURE__ */ F("option", {
|
|
255
253
|
value: e.name,
|
|
256
254
|
children: e.label || e.name
|
|
257
255
|
}, e.name))]
|
|
258
256
|
})]
|
|
259
257
|
}),
|
|
260
|
-
|
|
258
|
+
d && f && /* @__PURE__ */ F(Ve, {
|
|
261
259
|
title: t("grid.toolbar.densityMode", { defaultValue: "Density" }),
|
|
262
260
|
defaultOpen: f.mode !== "compact",
|
|
263
|
-
children: /* @__PURE__ */
|
|
261
|
+
children: /* @__PURE__ */ I("div", {
|
|
264
262
|
className: "flex items-center gap-2",
|
|
265
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ I(l, {
|
|
266
264
|
variant: "outline",
|
|
267
265
|
size: "sm",
|
|
268
266
|
className: "h-7 gap-1.5",
|
|
269
267
|
onClick: f.cycle,
|
|
270
268
|
"data-testid": "view-settings-density-cycle",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ F(b, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ F("span", {
|
|
272
270
|
className: "text-xs",
|
|
273
271
|
children: f.mode === "compact" ? t("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : f.mode === "comfortable" ? t("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : t("grid.toolbar.densitySpacious", { defaultValue: "Spacious" })
|
|
274
272
|
})]
|
|
275
|
-
}), /* @__PURE__ */
|
|
273
|
+
}), /* @__PURE__ */ F("span", {
|
|
276
274
|
className: "text-[11px] text-muted-foreground",
|
|
277
275
|
children: t("grid.toolbar.densityCycleShortHint", { defaultValue: "Click to cycle" })
|
|
278
276
|
})]
|
|
279
277
|
})
|
|
280
278
|
}),
|
|
281
|
-
p && m && h && /* @__PURE__ */
|
|
279
|
+
p && m && h && /* @__PURE__ */ F(Ve, {
|
|
282
280
|
title: t("list.hideFieldsTitle", { defaultValue: "Hide fields" }),
|
|
283
281
|
badge: m.size,
|
|
284
282
|
onClear: m.size > 0 ? () => h(/* @__PURE__ */ new Set()) : void 0,
|
|
285
283
|
clearLabel: t("list.showAll", { defaultValue: "Show all" }),
|
|
286
284
|
defaultOpen: m.size > 0,
|
|
287
|
-
children: /* @__PURE__ */
|
|
285
|
+
children: /* @__PURE__ */ F("div", {
|
|
288
286
|
className: "max-h-48 overflow-y-auto space-y-0.5",
|
|
289
|
-
children: n.map((e) => /* @__PURE__ */
|
|
287
|
+
children: n.map((e) => /* @__PURE__ */ I("label", {
|
|
290
288
|
className: "flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
291
|
-
children: [/* @__PURE__ */
|
|
289
|
+
children: [/* @__PURE__ */ F("input", {
|
|
292
290
|
type: "checkbox",
|
|
293
291
|
checked: !m.has(e.name),
|
|
294
292
|
onChange: () => {
|
|
@@ -296,7 +294,7 @@ function We(e) {
|
|
|
296
294
|
t.has(e.name) ? t.delete(e.name) : t.add(e.name), h(t);
|
|
297
295
|
},
|
|
298
296
|
className: "rounded border-input"
|
|
299
|
-
}), /* @__PURE__ */
|
|
297
|
+
}), /* @__PURE__ */ F("span", {
|
|
300
298
|
className: "truncate",
|
|
301
299
|
children: e.label || e.name
|
|
302
300
|
})]
|
|
@@ -309,46 +307,74 @@ function We(e) {
|
|
|
309
307
|
}
|
|
310
308
|
//#endregion
|
|
311
309
|
//#region src/UserFilters.tsx
|
|
312
|
-
function
|
|
310
|
+
function B() {
|
|
313
311
|
try {
|
|
314
|
-
let { t: e } =
|
|
312
|
+
let { t: e } = Oe(), t = e("common.more");
|
|
315
313
|
return !t || t === "common.more" ? "More" : t;
|
|
316
314
|
} catch {
|
|
317
315
|
return "More";
|
|
318
316
|
}
|
|
319
317
|
}
|
|
320
|
-
var
|
|
318
|
+
var V = new Set([
|
|
321
319
|
"lookup",
|
|
322
320
|
"master_detail",
|
|
323
321
|
"user",
|
|
324
322
|
"owner"
|
|
325
323
|
]);
|
|
326
|
-
function
|
|
324
|
+
function Ue(e) {
|
|
325
|
+
switch (e) {
|
|
326
|
+
case void 0:
|
|
327
|
+
case "equals":
|
|
328
|
+
case "eq": return "=";
|
|
329
|
+
case "not_equals":
|
|
330
|
+
case "ne":
|
|
331
|
+
case "neq": return "!=";
|
|
332
|
+
case "gte": return ">=";
|
|
333
|
+
case "lte": return "<=";
|
|
334
|
+
case "gt": return ">";
|
|
335
|
+
case "lt": return "<";
|
|
336
|
+
case "not_in":
|
|
337
|
+
case "nin": return "not in";
|
|
338
|
+
default: return e;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function We(e) {
|
|
342
|
+
return (e || []).filter((e) => e && (e.id || e.name)).map((e) => ({
|
|
343
|
+
id: e.id ?? e.name,
|
|
344
|
+
label: typeof e.label == "string" ? e.label : e.label?.toString?.() ?? e.id ?? e.name,
|
|
345
|
+
filters: Array.isArray(e.filters) ? e.filters : Array.isArray(e.filter) ? e.filter.filter((e) => e && typeof e.field == "string").map((e) => [
|
|
346
|
+
e.field,
|
|
347
|
+
Ue(e.operator),
|
|
348
|
+
e.value
|
|
349
|
+
]) : [],
|
|
350
|
+
default: e.default ?? e.isDefault
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
function Ge({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a, initialSelections: o, onSelectionsChange: s }) {
|
|
327
354
|
switch (e.element) {
|
|
328
|
-
case "dropdown": return /* @__PURE__ */
|
|
355
|
+
case "dropdown": return /* @__PURE__ */ F(H, {
|
|
329
356
|
fields: e.fields || [],
|
|
330
357
|
objectDef: t,
|
|
331
358
|
data: n,
|
|
332
359
|
onFilterChange: r,
|
|
333
360
|
maxVisible: i,
|
|
334
|
-
className: a
|
|
361
|
+
className: a,
|
|
362
|
+
initialSelections: o,
|
|
363
|
+
onSelectionsChange: s
|
|
335
364
|
});
|
|
336
|
-
case "tabs": return /* @__PURE__ */
|
|
337
|
-
tabs: e.tabs || [],
|
|
365
|
+
case "tabs": return /* @__PURE__ */ F(U, {
|
|
366
|
+
tabs: We(e.tabs || []),
|
|
338
367
|
showAllRecords: e.showAllRecords !== !1,
|
|
339
368
|
allowAddTab: e.allowAddTab,
|
|
340
369
|
onFilterChange: r,
|
|
341
|
-
className: a
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
fields: e.fields || [],
|
|
345
|
-
onFilterChange: r,
|
|
346
|
-
className: a
|
|
370
|
+
className: a,
|
|
371
|
+
initialTab: typeof o?._tab?.[0] == "string" ? o._tab[0] : void 0,
|
|
372
|
+
onSelectionsChange: s
|
|
347
373
|
});
|
|
348
374
|
default: return null;
|
|
349
375
|
}
|
|
350
376
|
}
|
|
351
|
-
function
|
|
377
|
+
function Ke(e, t, n, r) {
|
|
352
378
|
return e.map((e) => {
|
|
353
379
|
let i = e.options ? [...e.options] : [], a = e.type, o, s, c;
|
|
354
380
|
if (t?.fields) {
|
|
@@ -385,70 +411,93 @@ function R(e, t, n, r) {
|
|
|
385
411
|
};
|
|
386
412
|
});
|
|
387
413
|
}
|
|
388
|
-
function
|
|
389
|
-
let { fieldLabel:
|
|
414
|
+
function H({ fields: e, objectDef: t, data: n, onFilterChange: i, maxVisible: a, className: o, initialSelections: s, onSelectionsChange: c }) {
|
|
415
|
+
let { fieldLabel: l, translateOptions: u } = ke(), d = B(), f = t?.name, [p, m] = r.useState(() => {
|
|
390
416
|
let t = {};
|
|
391
417
|
return e.forEach((e) => {
|
|
392
418
|
e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
|
|
419
|
+
let n = s?.[e.field];
|
|
420
|
+
n && n.length > 0 && (t[e.field] = n);
|
|
393
421
|
}), t;
|
|
394
|
-
}),
|
|
395
|
-
objectName:
|
|
396
|
-
fieldLabel:
|
|
397
|
-
translateOptions:
|
|
422
|
+
}), h = r.useRef({}), g = r.useMemo(() => Ke(e, t, n, {
|
|
423
|
+
objectName: f,
|
|
424
|
+
fieldLabel: l,
|
|
425
|
+
translateOptions: u
|
|
426
|
+
}).map((e) => {
|
|
427
|
+
if (!e.showCount) return e;
|
|
428
|
+
if ((p[e.field] || []).length === 0) return h.current[e.field] = new Map(e.options.map((e) => [String(e.value), e.count ?? 0])), e;
|
|
429
|
+
let t = h.current[e.field];
|
|
430
|
+
return t ? {
|
|
431
|
+
...e,
|
|
432
|
+
options: e.options.map((e) => ({
|
|
433
|
+
...e,
|
|
434
|
+
count: t.get(String(e.value)) ?? e.count
|
|
435
|
+
}))
|
|
436
|
+
} : e;
|
|
398
437
|
}), [
|
|
399
438
|
e,
|
|
400
439
|
t,
|
|
401
440
|
n,
|
|
441
|
+
f,
|
|
442
|
+
l,
|
|
402
443
|
u,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
r(Object.entries(e).filter(([, e]) => e.length > 0).map(([e, t]) => [
|
|
444
|
+
p
|
|
445
|
+
]), _ = r.useCallback((e) => {
|
|
446
|
+
i(Object.entries(e).filter(([, e]) => e.length > 0).map(([e, t]) => [
|
|
407
447
|
e,
|
|
408
448
|
"in",
|
|
409
449
|
t
|
|
410
450
|
]));
|
|
411
|
-
}, [
|
|
451
|
+
}, [i]), v = (e, t) => {
|
|
412
452
|
let n = {
|
|
413
|
-
...
|
|
453
|
+
...p,
|
|
414
454
|
[e]: t
|
|
415
455
|
};
|
|
416
|
-
|
|
456
|
+
m(n), _(n), c?.(n);
|
|
417
457
|
};
|
|
418
|
-
|
|
419
|
-
|
|
458
|
+
r.useEffect(() => {
|
|
459
|
+
let e = p, t = {}, n = !1;
|
|
460
|
+
for (let [r, i] of Object.entries(e)) {
|
|
461
|
+
let e = g.find((e) => e.field === r), a = i.map((t) => {
|
|
462
|
+
if (!e || typeof t != "string") return t;
|
|
463
|
+
let n = e.options.find((e) => String(e.value) === t);
|
|
464
|
+
return n && n.value !== t ? n.value : e.type === "boolean" && (t === "true" || t === "false") ? t === "true" : t;
|
|
465
|
+
});
|
|
466
|
+
t[r] = a, a.some((e, t) => e !== i[t]) && (n = !0);
|
|
467
|
+
}
|
|
468
|
+
n && (m(t), e = t), Object.values(e).some((e) => e.length > 0) && _(e);
|
|
420
469
|
}, []);
|
|
421
|
-
let
|
|
422
|
-
let t =
|
|
423
|
-
return /* @__PURE__ */
|
|
470
|
+
let y = a !== void 0 && a < g.length ? g.slice(0, a) : g, x = a !== void 0 && a < g.length ? g.slice(a) : [], ee = (e) => {
|
|
471
|
+
let t = p[e.field] || [], n = t.length > 0, r = V.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), i = r ? "w-72" : "w-56";
|
|
472
|
+
return /* @__PURE__ */ I(S, { children: [/* @__PURE__ */ F(w, {
|
|
424
473
|
asChild: !0,
|
|
425
|
-
children: /* @__PURE__ */
|
|
474
|
+
children: /* @__PURE__ */ I("button", {
|
|
426
475
|
"data-testid": `filter-badge-${e.field}`,
|
|
427
|
-
className:
|
|
476
|
+
className: T("inline-flex items-center gap-1 h-7 px-2 text-xs transition-colors shrink-0 rounded-md", n ? "text-foreground font-medium" : "text-muted-foreground hover:text-foreground"),
|
|
428
477
|
children: [
|
|
429
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ F("span", {
|
|
430
479
|
className: "truncate max-w-[100px]",
|
|
431
480
|
children: e.label || e.field
|
|
432
481
|
}),
|
|
433
|
-
n && /* @__PURE__ */
|
|
482
|
+
n && /* @__PURE__ */ F("span", {
|
|
434
483
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
435
484
|
children: t.length
|
|
436
485
|
}),
|
|
437
|
-
n ? /* @__PURE__ */
|
|
486
|
+
n ? /* @__PURE__ */ F(we, {
|
|
438
487
|
className: "h-3 w-3 opacity-60 hover:opacity-100",
|
|
439
488
|
"data-testid": `filter-clear-${e.field}`,
|
|
440
489
|
onClick: (t) => {
|
|
441
|
-
t.stopPropagation(),
|
|
490
|
+
t.stopPropagation(), v(e.field, []);
|
|
442
491
|
}
|
|
443
|
-
}) : /* @__PURE__ */
|
|
492
|
+
}) : /* @__PURE__ */ F(k, { className: "h-3 w-3 opacity-60" })
|
|
444
493
|
]
|
|
445
494
|
})
|
|
446
|
-
}), /* @__PURE__ */
|
|
495
|
+
}), /* @__PURE__ */ F(C, {
|
|
447
496
|
align: "start",
|
|
448
|
-
className:
|
|
449
|
-
children: r ? /* @__PURE__ */
|
|
497
|
+
className: T(i, "p-2"),
|
|
498
|
+
children: r ? /* @__PURE__ */ F("div", {
|
|
450
499
|
"data-testid": `filter-lookup-${e.field}`,
|
|
451
|
-
children: /* @__PURE__ */
|
|
500
|
+
children: /* @__PURE__ */ F(b, {
|
|
452
501
|
field: {
|
|
453
502
|
value: e.field,
|
|
454
503
|
label: e.label || e.field,
|
|
@@ -461,36 +510,36 @@ function z({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i,
|
|
|
461
510
|
multiple: !0,
|
|
462
511
|
onChange: (t) => {
|
|
463
512
|
let n = Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
|
|
464
|
-
|
|
513
|
+
v(e.field, n);
|
|
465
514
|
}
|
|
466
515
|
})
|
|
467
|
-
}) : /* @__PURE__ */
|
|
516
|
+
}) : /* @__PURE__ */ F("div", {
|
|
468
517
|
className: "max-h-60 overflow-y-auto space-y-0.5",
|
|
469
518
|
"data-testid": `filter-options-${e.field}`,
|
|
470
|
-
children: e.options.length === 0 ? /* @__PURE__ */
|
|
519
|
+
children: e.options.length === 0 ? /* @__PURE__ */ F("div", {
|
|
471
520
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
472
521
|
children: "No options"
|
|
473
|
-
}) : e.options.map((n) => /* @__PURE__ */
|
|
474
|
-
className:
|
|
522
|
+
}) : e.options.map((n) => /* @__PURE__ */ I("label", {
|
|
523
|
+
className: T("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"),
|
|
475
524
|
children: [
|
|
476
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ F("input", {
|
|
477
526
|
type: "checkbox",
|
|
478
527
|
checked: t.includes(n.value),
|
|
479
528
|
onChange: () => {
|
|
480
529
|
let r = t.includes(n.value) ? t.filter((e) => e !== n.value) : [...t, n.value];
|
|
481
|
-
|
|
530
|
+
v(e.field, r);
|
|
482
531
|
},
|
|
483
532
|
className: "rounded border-input"
|
|
484
533
|
}),
|
|
485
|
-
n.color && /* @__PURE__ */
|
|
534
|
+
n.color && /* @__PURE__ */ F("span", {
|
|
486
535
|
className: "h-2.5 w-2.5 rounded-full shrink-0",
|
|
487
536
|
style: { backgroundColor: n.color }
|
|
488
537
|
}),
|
|
489
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ F("span", {
|
|
490
539
|
className: "truncate flex-1",
|
|
491
540
|
children: n.label
|
|
492
541
|
}),
|
|
493
|
-
n.count !== void 0 && /* @__PURE__ */
|
|
542
|
+
n.count !== void 0 && /* @__PURE__ */ F("span", {
|
|
494
543
|
className: "text-xs text-muted-foreground",
|
|
495
544
|
children: n.count
|
|
496
545
|
})
|
|
@@ -499,42 +548,46 @@ function z({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i,
|
|
|
499
548
|
})
|
|
500
549
|
})] }, e.field);
|
|
501
550
|
};
|
|
502
|
-
return /* @__PURE__ */
|
|
503
|
-
className:
|
|
551
|
+
return /* @__PURE__ */ F("div", {
|
|
552
|
+
className: T("flex items-center gap-0.5 overflow-x-auto", o),
|
|
504
553
|
"data-testid": "user-filters-dropdown",
|
|
505
|
-
children:
|
|
554
|
+
children: g.length === 0 ? /* @__PURE__ */ F("span", {
|
|
506
555
|
className: "text-xs text-muted-foreground",
|
|
507
556
|
"data-testid": "user-filters-empty",
|
|
508
557
|
children: "No filter fields"
|
|
509
|
-
}) : /* @__PURE__ */
|
|
558
|
+
}) : /* @__PURE__ */ I(Ee, { children: [y.map(ee), x.length > 0 && /* @__PURE__ */ I(S, { children: [/* @__PURE__ */ F(w, {
|
|
510
559
|
asChild: !0,
|
|
511
|
-
children: /* @__PURE__ */
|
|
560
|
+
children: /* @__PURE__ */ I("button", {
|
|
512
561
|
"data-testid": "user-filters-more",
|
|
513
562
|
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",
|
|
514
563
|
children: [
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ F("span", { children: d }),
|
|
565
|
+
/* @__PURE__ */ F("span", {
|
|
517
566
|
className: "text-[10px] text-muted-foreground/80 tabular-nums",
|
|
518
|
-
children:
|
|
567
|
+
children: x.length
|
|
519
568
|
}),
|
|
520
|
-
/* @__PURE__ */
|
|
569
|
+
/* @__PURE__ */ F(k, { className: "h-3 w-3 opacity-60" })
|
|
521
570
|
]
|
|
522
571
|
})
|
|
523
|
-
}), /* @__PURE__ */
|
|
572
|
+
}), /* @__PURE__ */ F(C, {
|
|
524
573
|
align: "start",
|
|
525
574
|
className: "w-64 p-2",
|
|
526
575
|
"data-testid": "user-filters-more-content",
|
|
527
|
-
children: /* @__PURE__ */
|
|
576
|
+
children: /* @__PURE__ */ F("div", {
|
|
528
577
|
className: "space-y-1",
|
|
529
|
-
children:
|
|
578
|
+
children: x.map(ee)
|
|
530
579
|
})
|
|
531
580
|
})] })] })
|
|
532
581
|
});
|
|
533
582
|
}
|
|
534
|
-
function
|
|
535
|
-
let [
|
|
536
|
-
|
|
537
|
-
}, [
|
|
583
|
+
function U({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: i, className: a, initialTab: o, onSelectionsChange: s }) {
|
|
584
|
+
let [c, l] = r.useState(() => o && (o === "__all__" || e.some((e) => e.id === o)) ? o : e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), u = r.useCallback((t) => {
|
|
585
|
+
l(t), i(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []), s?.({ _tab: [t] });
|
|
586
|
+
}, [
|
|
587
|
+
e,
|
|
588
|
+
i,
|
|
589
|
+
s
|
|
590
|
+
]), d = r.useMemo(() => {
|
|
538
591
|
let n = [...e];
|
|
539
592
|
return t && n.push({
|
|
540
593
|
id: "__all__",
|
|
@@ -542,76 +595,43 @@ function Je({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
|
|
|
542
595
|
filters: []
|
|
543
596
|
}), n;
|
|
544
597
|
}, [e, t]);
|
|
545
|
-
return
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
598
|
+
return r.useEffect(() => {
|
|
599
|
+
if (c && c !== "__all__") {
|
|
600
|
+
let t = e.find((e) => e.id === c);
|
|
601
|
+
t && i(t.filters || []);
|
|
602
|
+
}
|
|
603
|
+
}, []), /* @__PURE__ */ I("div", {
|
|
604
|
+
className: T("flex items-center gap-0.5 overflow-x-auto", a),
|
|
550
605
|
"data-testid": "user-filters-tabs",
|
|
551
|
-
children: [
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
606
|
+
children: [d.map((e) => {
|
|
607
|
+
let t = e.id ?? e.name ?? "";
|
|
608
|
+
return /* @__PURE__ */ F("button", {
|
|
609
|
+
"data-testid": `filter-tab-${t}`,
|
|
610
|
+
onClick: () => u(t),
|
|
611
|
+
className: T("inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0", c === t ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted"),
|
|
612
|
+
children: e.label
|
|
613
|
+
}, t);
|
|
614
|
+
}), n && /* @__PURE__ */ F("button", {
|
|
557
615
|
className: "inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",
|
|
558
616
|
"data-testid": "filter-tab-add",
|
|
559
617
|
title: "Add filter tab",
|
|
560
|
-
children: /* @__PURE__ */
|
|
618
|
+
children: /* @__PURE__ */ F(pe, { className: "h-3.5 w-3.5" })
|
|
561
619
|
})]
|
|
562
620
|
});
|
|
563
621
|
}
|
|
564
|
-
function B({ fields: e, onFilterChange: t, className: n }) {
|
|
565
|
-
let [r, i] = a.useState(() => {
|
|
566
|
-
let t = /* @__PURE__ */ new Set();
|
|
567
|
-
return e.forEach((e) => {
|
|
568
|
-
e.defaultValues && e.defaultValues.length > 0 && t.add(e.field);
|
|
569
|
-
}), t;
|
|
570
|
-
}), o = a.useCallback((n) => {
|
|
571
|
-
t(Array.from(n).map((t) => {
|
|
572
|
-
let n = e.find((e) => e.field === t);
|
|
573
|
-
return n?.defaultValues ? [
|
|
574
|
-
t,
|
|
575
|
-
"in",
|
|
576
|
-
n.defaultValues
|
|
577
|
-
] : [
|
|
578
|
-
t,
|
|
579
|
-
"!=",
|
|
580
|
-
null
|
|
581
|
-
];
|
|
582
|
-
}));
|
|
583
|
-
}, [e, t]), s = (e) => {
|
|
584
|
-
i((t) => {
|
|
585
|
-
let n = new Set(t);
|
|
586
|
-
return n.has(e) ? n.delete(e) : n.add(e), o(n), n;
|
|
587
|
-
});
|
|
588
|
-
};
|
|
589
|
-
return a.useEffect(() => {
|
|
590
|
-
r.size > 0 && o(r);
|
|
591
|
-
}, []), /* @__PURE__ */ N("div", {
|
|
592
|
-
className: w("flex items-center gap-1 overflow-x-auto", n),
|
|
593
|
-
"data-testid": "user-filters-toggle",
|
|
594
|
-
children: e.map((e) => /* @__PURE__ */ N(d, {
|
|
595
|
-
variant: r.has(e.field) ? "default" : "outline",
|
|
596
|
-
size: "sm",
|
|
597
|
-
className: "h-7 px-3 text-xs shrink-0",
|
|
598
|
-
"data-testid": `filter-toggle-${e.field}`,
|
|
599
|
-
onClick: () => s(e.field),
|
|
600
|
-
children: e.label || e.field
|
|
601
|
-
}, e.field))
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
622
|
//#endregion
|
|
605
623
|
//#region src/ListView.tsx
|
|
606
|
-
function
|
|
624
|
+
function W(e) {
|
|
607
625
|
switch (e) {
|
|
608
626
|
case "equals":
|
|
609
627
|
case "eq": return "=";
|
|
610
628
|
case "notEquals":
|
|
629
|
+
case "not_equals":
|
|
611
630
|
case "ne":
|
|
612
631
|
case "neq": return "!=";
|
|
613
632
|
case "contains": return "contains";
|
|
614
|
-
case "notContains":
|
|
633
|
+
case "notContains":
|
|
634
|
+
case "notcontains": return "notcontains";
|
|
615
635
|
case "greaterThan":
|
|
616
636
|
case "gt": return ">";
|
|
617
637
|
case "greaterOrEqual":
|
|
@@ -621,16 +641,18 @@ function V(e) {
|
|
|
621
641
|
case "lessOrEqual":
|
|
622
642
|
case "lte": return "<=";
|
|
623
643
|
case "in": return "in";
|
|
624
|
-
case "notIn":
|
|
644
|
+
case "notIn":
|
|
645
|
+
case "not_in":
|
|
646
|
+
case "nin": return "not in";
|
|
625
647
|
case "before": return "<";
|
|
626
648
|
case "after": return ">";
|
|
627
649
|
default: return e;
|
|
628
650
|
}
|
|
629
651
|
}
|
|
630
|
-
function
|
|
652
|
+
function qe(e) {
|
|
631
653
|
if (!Array.isArray(e) || e.length < 3) return e;
|
|
632
654
|
let [t, n, r] = e;
|
|
633
|
-
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ?
|
|
655
|
+
return typeof t == "string" && (t === "and" || t === "or") ? [t, ...e.slice(1).map((e) => Array.isArray(e) ? qe(e) : e)] : n === "in" && Array.isArray(r) ? r.length === 0 ? [] : r.length === 1 ? [
|
|
634
656
|
t,
|
|
635
657
|
"=",
|
|
636
658
|
r[0]
|
|
@@ -648,15 +670,15 @@ function H(e) {
|
|
|
648
670
|
e
|
|
649
671
|
])] : e;
|
|
650
672
|
}
|
|
651
|
-
function
|
|
673
|
+
function Je(e) {
|
|
652
674
|
return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
653
675
|
}
|
|
654
|
-
function
|
|
655
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ?
|
|
676
|
+
function Ye(e) {
|
|
677
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? qe(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
|
|
656
678
|
}
|
|
657
|
-
function
|
|
679
|
+
function Xe(e) {
|
|
658
680
|
if (!e || !e.conditions || e.conditions.length === 0) return [];
|
|
659
|
-
let t =
|
|
681
|
+
let t = Ye(e.conditions.map((e) => e.operator === "isEmpty" ? [
|
|
660
682
|
e.field,
|
|
661
683
|
"=",
|
|
662
684
|
null
|
|
@@ -666,12 +688,12 @@ function Ze(e) {
|
|
|
666
688
|
null
|
|
667
689
|
] : [
|
|
668
690
|
e.field,
|
|
669
|
-
|
|
691
|
+
W(e.operator),
|
|
670
692
|
e.value
|
|
671
693
|
]));
|
|
672
694
|
return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
|
|
673
695
|
}
|
|
674
|
-
function
|
|
696
|
+
function Ze(e, t) {
|
|
675
697
|
if (!t || t.length === 0) return {};
|
|
676
698
|
for (let r of t) {
|
|
677
699
|
let t = !1, i = ("condition" in r ? r.condition : void 0) || ("expression" in r ? r.expression : void 0) || void 0;
|
|
@@ -706,12 +728,19 @@ function Qe(e, t) {
|
|
|
706
728
|
}
|
|
707
729
|
return {};
|
|
708
730
|
}
|
|
709
|
-
var
|
|
731
|
+
var Qe = {
|
|
710
732
|
"list.recordCount": "{{count}} records",
|
|
711
733
|
"list.recordCountOne": "{{count}} record",
|
|
712
734
|
"list.noItems": "No items found",
|
|
713
735
|
"list.noItemsMessage": "There are no records to display. Try adjusting your filters or adding new data.",
|
|
736
|
+
"list.firstRunTitle": "Nothing here yet",
|
|
737
|
+
"list.firstRunMessage": "Create your first record to get started.",
|
|
738
|
+
"list.noMatches": "No matching records",
|
|
739
|
+
"list.noMatchesMessage": "No records match your current filters or search. Try adjusting or clearing them.",
|
|
714
740
|
"list.loading": "Loading records…",
|
|
741
|
+
"list.loadErrorTitle": "Couldn’t load records",
|
|
742
|
+
"list.loadErrorMessage": "Something went wrong while loading this data. Check your connection and try again.",
|
|
743
|
+
"list.retry": "Retry",
|
|
715
744
|
"list.search": "Search",
|
|
716
745
|
"list.filter": "Filter",
|
|
717
746
|
"list.filterRecords": "Filter Records",
|
|
@@ -746,67 +775,67 @@ var $e = {
|
|
|
746
775
|
"grid.toolbar.densityCycleShortHint": "Click to cycle",
|
|
747
776
|
"list.viewSettings": "View settings",
|
|
748
777
|
"list.viewSettingsHint": "Grouping, color, density, and visible fields."
|
|
749
|
-
},
|
|
750
|
-
let n =
|
|
778
|
+
}, $e = (e, t, n) => n, G = (e, t) => {
|
|
779
|
+
let n = Qe[e] || e;
|
|
751
780
|
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
752
781
|
return n;
|
|
753
782
|
};
|
|
754
|
-
function
|
|
783
|
+
function et() {
|
|
755
784
|
try {
|
|
756
|
-
let e =
|
|
757
|
-
return e.t("list.recordCount") === "list.recordCount" ? { t:
|
|
785
|
+
let e = Oe();
|
|
786
|
+
return e.t("list.recordCount") === "list.recordCount" ? { t: G } : { t: e.t };
|
|
758
787
|
} catch {
|
|
759
|
-
return { t:
|
|
788
|
+
return { t: G };
|
|
760
789
|
}
|
|
761
790
|
}
|
|
762
|
-
function
|
|
791
|
+
function tt() {
|
|
763
792
|
try {
|
|
764
|
-
let { fieldLabel: e, actionLabel: t } =
|
|
793
|
+
let { fieldLabel: e, actionLabel: t } = De();
|
|
765
794
|
return {
|
|
766
795
|
fieldLabel: e,
|
|
767
796
|
actionLabel: t
|
|
768
797
|
};
|
|
769
798
|
} catch {
|
|
770
799
|
return {
|
|
771
|
-
fieldLabel:
|
|
800
|
+
fieldLabel: $e,
|
|
772
801
|
actionLabel: void 0
|
|
773
802
|
};
|
|
774
803
|
}
|
|
775
804
|
}
|
|
776
|
-
var
|
|
777
|
-
let { t:
|
|
805
|
+
var nt = r.forwardRef(({ schema: e, className: n, onViewChange: i, onFilterChange: a, onSortChange: o, onSearchChange: s, onHiddenFieldsChange: c, onColumnStateChange: u, onRowClick: d, showViewSwitcher: p, userFilterSelections: m, onUserFilterSelectionsChange: h, ...g }, b) => {
|
|
806
|
+
let ne = p ?? e?.showViewSwitcher ?? !1, { t: E } = et(), { fieldLabel: D, actionLabel: O } = tt(), { translateOptions: k } = ke(), A = r.useMemo(() => e.viewType && e.viewType !== "list" ? e : {
|
|
778
807
|
...e,
|
|
779
808
|
viewType: "grid"
|
|
780
|
-
}, [e]),
|
|
781
|
-
let t =
|
|
782
|
-
return
|
|
783
|
-
}, [
|
|
784
|
-
let e =
|
|
809
|
+
}, [e]), j = r.useCallback((e, t) => A.objectName ? D(A.objectName, e, t) : t, [A.objectName, D]), ce = r.useCallback((e) => {
|
|
810
|
+
let t = Je(e);
|
|
811
|
+
return A.objectName && typeof O == "function" ? O(A.objectName, e, t) : t;
|
|
812
|
+
}, [A.objectName, O]), M = r.useMemo(() => {
|
|
813
|
+
let e = A.userActions, t = A.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
|
|
785
814
|
return {
|
|
786
|
-
showSearch: e?.search === void 0 ?
|
|
787
|
-
showSort: e?.sort === void 0 ?
|
|
788
|
-
showFilters: e?.filter === void 0 ?
|
|
789
|
-
showDensity: e?.rowHeight === void 0 ?
|
|
790
|
-
showHideFields:
|
|
791
|
-
showGroup:
|
|
792
|
-
showColor:
|
|
793
|
-
compactToolbar:
|
|
815
|
+
showSearch: e?.search === void 0 ? A.showSearch !== !1 : e.search,
|
|
816
|
+
showSort: e?.sort === void 0 ? A.showSort !== !1 : e.sort,
|
|
817
|
+
showFilters: e?.filter === void 0 ? A.showFilters !== !1 : e.filter,
|
|
818
|
+
showDensity: e?.rowHeight === void 0 ? A.showDensity !== !1 : e.rowHeight,
|
|
819
|
+
showHideFields: A.showHideFields === !0,
|
|
820
|
+
showGroup: A.showGroup !== !1,
|
|
821
|
+
showColor: A.showColor === !0,
|
|
822
|
+
compactToolbar: A.compactToolbar === !0,
|
|
794
823
|
showAddRecord: t,
|
|
795
|
-
addRecordPosition:
|
|
824
|
+
addRecordPosition: A.addRecord?.position === "bottom" ? "bottom" : "top"
|
|
796
825
|
};
|
|
797
826
|
}, [
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
]), [
|
|
827
|
+
A.userActions,
|
|
828
|
+
A.showSearch,
|
|
829
|
+
A.showSort,
|
|
830
|
+
A.showFilters,
|
|
831
|
+
A.showDensity,
|
|
832
|
+
A.showHideFields,
|
|
833
|
+
A.showGroup,
|
|
834
|
+
A.showColor,
|
|
835
|
+
A.compactToolbar,
|
|
836
|
+
A.addRecord,
|
|
837
|
+
A.userActions?.addRecordForm
|
|
838
|
+
]), [N, de] = r.useState(A.viewType), [P, be] = r.useState(""), [De, Oe] = r.useState(!1), [je, Me] = r.useState(!1), [L, Le] = r.useState(() => A.sort && A.sort.length > 0 ? A.sort.map((e) => {
|
|
810
839
|
if (typeof e == "string") {
|
|
811
840
|
let t = e.trim().split(/\s+/);
|
|
812
841
|
return {
|
|
@@ -820,9 +849,9 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
820
849
|
field: e.field,
|
|
821
850
|
order: e.order || "asc"
|
|
822
851
|
};
|
|
823
|
-
}) : []),
|
|
824
|
-
|
|
825
|
-
|
|
852
|
+
}) : []), Re = r.useMemo(() => JSON.stringify(A.sort || []), [A.sort]);
|
|
853
|
+
r.useEffect(() => {
|
|
854
|
+
A.sort && A.sort.length > 0 ? Le(A.sort.map((e) => {
|
|
826
855
|
if (typeof e == "string") {
|
|
827
856
|
let t = e.trim().split(/\s+/);
|
|
828
857
|
return {
|
|
@@ -836,43 +865,25 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
836
865
|
field: e.field,
|
|
837
866
|
order: e.order || "asc"
|
|
838
867
|
};
|
|
839
|
-
})) :
|
|
840
|
-
}, [
|
|
841
|
-
let [
|
|
868
|
+
})) : Le([]);
|
|
869
|
+
}, [Re]);
|
|
870
|
+
let [ze, R] = r.useState(!1), [z, Ve] = r.useState({
|
|
842
871
|
id: "root",
|
|
843
872
|
logic: "and",
|
|
844
873
|
conditions: []
|
|
845
|
-
}), [
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
let t = {
|
|
850
|
-
id: `tab-filter-${e.name}`,
|
|
851
|
-
logic: e.filter.logic || "and",
|
|
852
|
-
conditions: e.filter.conditions || []
|
|
853
|
-
};
|
|
854
|
-
Ve(t), s?.(t);
|
|
855
|
-
} else {
|
|
856
|
-
let e = {
|
|
857
|
-
id: "root",
|
|
858
|
-
logic: "and",
|
|
859
|
-
conditions: []
|
|
860
|
-
};
|
|
861
|
-
Ve(e), s?.(e);
|
|
862
|
-
}
|
|
863
|
-
}, [s]), R = g.dataSource, [z, Je] = a.useState([]), [B, V] = a.useState(() => !(Array.isArray(O.data) || O.data && typeof O.data == "object" && O.data.provider === "value" && Array.isArray(O.data.items))), [H, Qe] = a.useState(null), [$e, et] = a.useState(!1), [tt, U] = a.useState(0), [it, at] = a.useState(!1);
|
|
864
|
-
a.useImperativeHandle(_, () => ({ refresh: () => U((e) => e + 1) }), []), a.useEffect(() => {
|
|
865
|
-
if (!(!R?.onMutation || !O.objectName || O.refreshTrigger)) return R.onMutation((e) => {
|
|
866
|
-
e.resource === O.objectName && U((e) => e + 1);
|
|
874
|
+
}), B = g.dataSource, [V, Ue] = r.useState([]), [We, Ke] = r.useState(null), [H, U] = r.useState(() => !(Array.isArray(A.data) || A.data && typeof A.data == "object" && A.data.provider === "value" && Array.isArray(A.data.items))), [W, qe] = r.useState(null), [Ze, Qe] = r.useState(!1), [$e, G] = r.useState(0), [nt, rt] = r.useState(!1);
|
|
875
|
+
r.useImperativeHandle(b, () => ({ refresh: () => G((e) => e + 1) }), []), r.useEffect(() => {
|
|
876
|
+
if (!(!B?.onMutation || !A.objectName || A.refreshTrigger)) return B.onMutation((e) => {
|
|
877
|
+
e.resource === A.objectName && G((e) => e + 1);
|
|
867
878
|
});
|
|
868
879
|
}, [
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
880
|
+
B,
|
|
881
|
+
A.objectName,
|
|
882
|
+
A.refreshTrigger
|
|
872
883
|
]);
|
|
873
|
-
let [
|
|
874
|
-
if (
|
|
875
|
-
let e = typeof
|
|
884
|
+
let [it, at] = r.useState(void 0), K = it ?? A.pagination?.pageSize ?? 100, [ot, st] = r.useState(1), [ct, lt] = r.useState(null), q = r.useMemo(() => {
|
|
885
|
+
if (A.grouping?.fields?.length) return A.grouping;
|
|
886
|
+
let e = typeof A.groupBy == "string" ? A.groupBy.trim() : "", t = typeof A.groupBy2 == "string" ? A.groupBy2.trim() : "", n = [];
|
|
876
887
|
return e && n.push({
|
|
877
888
|
field: e,
|
|
878
889
|
order: "asc",
|
|
@@ -883,96 +894,95 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
883
894
|
collapsed: !1
|
|
884
895
|
}), n.length > 0 ? { fields: n } : void 0;
|
|
885
896
|
}, [
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
]), [
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
}, [
|
|
893
|
-
let [
|
|
894
|
-
let e =
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
}), e;
|
|
899
|
-
}), [bt, xt] = a.useState([]), St = a.useMemo(() => {
|
|
900
|
-
if (O.userFilters) return O.userFilters;
|
|
901
|
-
if (!H?.fields) return;
|
|
902
|
-
let e = new Set([
|
|
897
|
+
A.grouping,
|
|
898
|
+
A.groupBy,
|
|
899
|
+
A.groupBy2
|
|
900
|
+
]), [J, ut] = r.useState(q), [dt, ft] = r.useState(!1), pt = r.useRef(q);
|
|
901
|
+
r.useEffect(() => {
|
|
902
|
+
pt.current !== q && (pt.current = q, ut(q));
|
|
903
|
+
}, [q]);
|
|
904
|
+
let [Y, mt] = r.useState(A.rowColor), [ht, gt] = r.useState(!1), [_t, vt] = r.useState([]), yt = r.useRef(0), [bt, xt] = r.useState([]), St = r.useMemo(() => {
|
|
905
|
+
let e = A.userFilters;
|
|
906
|
+
if (!e) return;
|
|
907
|
+
if (e.element === "tabs" || e.fields && e.fields.length > 0 || !W?.fields) return e;
|
|
908
|
+
let t = new Set([
|
|
903
909
|
"select",
|
|
904
910
|
"multi-select",
|
|
905
911
|
"boolean"
|
|
906
|
-
]),
|
|
907
|
-
for (let [
|
|
908
|
-
field:
|
|
909
|
-
label:
|
|
912
|
+
]), n = [], r = Array.isArray(W.fields) ? W.fields.map((e) => [e.name, e]) : Object.entries(W.fields);
|
|
913
|
+
for (let [e, i] of r) (t.has(i.type) || i.options && !i.type) && n.push({
|
|
914
|
+
field: e,
|
|
915
|
+
label: j(e, i.label || e),
|
|
910
916
|
type: i.type === "boolean" ? "boolean" : i.type === "multi-select" ? "multi-select" : "select"
|
|
911
917
|
});
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
fields:
|
|
918
|
+
return n.length === 0 ? e : {
|
|
919
|
+
...e,
|
|
920
|
+
fields: n
|
|
915
921
|
};
|
|
916
|
-
}, [
|
|
917
|
-
|
|
918
|
-
|
|
922
|
+
}, [
|
|
923
|
+
A.userFilters,
|
|
924
|
+
W,
|
|
925
|
+
j
|
|
926
|
+
]), [X, Ct] = r.useState(() => new Set(A.hiddenFields || [])), wt = r.useMemo(() => JSON.stringify(A.hiddenFields || []), [A.hiddenFields]);
|
|
927
|
+
r.useEffect(() => {
|
|
928
|
+
Ct(new Set(A.hiddenFields || []));
|
|
919
929
|
}, [wt]);
|
|
920
|
-
let Tt =
|
|
921
|
-
Ct(e),
|
|
922
|
-
}, [
|
|
923
|
-
if (
|
|
924
|
-
}, [
|
|
930
|
+
let Tt = r.useCallback((e) => {
|
|
931
|
+
Ct(e), c?.(Array.from(e));
|
|
932
|
+
}, [c]), [Et, Dt] = r.useState(!1), [Ot, kt] = r.useState(!1), At = r.useMemo(() => {
|
|
933
|
+
if (A.exportOptions) return Array.isArray(A.exportOptions) ? { formats: A.exportOptions } : A.exportOptions;
|
|
934
|
+
}, [A.exportOptions]), Z = Ne(r.useMemo(() => A.densityMode ? A.densityMode : A.rowHeight ? {
|
|
925
935
|
compact: "compact",
|
|
926
936
|
short: "compact",
|
|
927
937
|
medium: "comfortable",
|
|
928
938
|
tall: "spacious",
|
|
929
939
|
extra_tall: "spacious"
|
|
930
|
-
}[
|
|
931
|
-
if (typeof window > "u") return
|
|
940
|
+
}[A.rowHeight] || "comfortable" : "compact", [A.densityMode, A.rowHeight]), { onChange: A.onDensityChange }), jt = r.useMemo(() => `objectui:gallery:density:${A.objectName ?? "default"}`, [A.objectName]), [Q, Mt] = r.useState(() => {
|
|
941
|
+
if (typeof window > "u") return A.gallery?.cardSize ?? "medium";
|
|
932
942
|
try {
|
|
933
|
-
let e = window.localStorage.getItem(
|
|
943
|
+
let e = window.localStorage.getItem(jt);
|
|
934
944
|
if (e === "small" || e === "medium" || e === "large") return e;
|
|
935
945
|
} catch {}
|
|
936
|
-
return
|
|
937
|
-
}),
|
|
938
|
-
|
|
946
|
+
return A.gallery?.cardSize ?? "medium";
|
|
947
|
+
}), Nt = r.useCallback(() => {
|
|
948
|
+
Mt((e) => {
|
|
939
949
|
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
940
950
|
try {
|
|
941
|
-
window.localStorage.setItem(
|
|
951
|
+
window.localStorage.setItem(jt, t);
|
|
942
952
|
} catch {}
|
|
943
953
|
return t;
|
|
944
954
|
});
|
|
945
|
-
}, [
|
|
946
|
-
onRefresh:
|
|
947
|
-
|
|
955
|
+
}, [jt]), { ref: Pt, isRefreshing: Ft, pullDistance: It } = Fe({
|
|
956
|
+
onRefresh: r.useCallback(async () => {
|
|
957
|
+
G((e) => e + 1);
|
|
948
958
|
}, []),
|
|
949
|
-
enabled: !!
|
|
950
|
-
}),
|
|
951
|
-
|
|
959
|
+
enabled: !!B && !!A.objectName
|
|
960
|
+
}), Lt = r.useMemo(() => A.id ? `listview-${A.objectName}-${A.id}-view` : `listview-${A.objectName}-view`, [A.objectName, A.id]);
|
|
961
|
+
r.useEffect(() => {
|
|
952
962
|
let e = !0;
|
|
953
|
-
return
|
|
954
|
-
if (!
|
|
955
|
-
|
|
963
|
+
return Qe(!1), qe(null), (async () => {
|
|
964
|
+
if (!B || !A.objectName) {
|
|
965
|
+
Qe(!0);
|
|
956
966
|
return;
|
|
957
967
|
}
|
|
958
|
-
if (typeof
|
|
959
|
-
|
|
968
|
+
if (typeof B.getObjectSchema != "function") {
|
|
969
|
+
Qe(!0);
|
|
960
970
|
return;
|
|
961
971
|
}
|
|
962
972
|
try {
|
|
963
|
-
let t = await
|
|
964
|
-
e &&
|
|
973
|
+
let t = await B.getObjectSchema(A.objectName);
|
|
974
|
+
e && qe(t);
|
|
965
975
|
} catch (e) {
|
|
966
976
|
console.warn("Failed to fetch object schema for ListView:", e);
|
|
967
977
|
} finally {
|
|
968
|
-
e &&
|
|
978
|
+
e && Qe(!0);
|
|
969
979
|
}
|
|
970
980
|
})(), () => {
|
|
971
981
|
e = !1;
|
|
972
982
|
};
|
|
973
|
-
}, [
|
|
974
|
-
let
|
|
975
|
-
let e = Array.isArray(
|
|
983
|
+
}, [A.objectName, B]);
|
|
984
|
+
let Rt = r.useMemo(() => {
|
|
985
|
+
let e = Array.isArray(A.fields) ? A.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], n = new Set(e), r = (e) => {
|
|
976
986
|
if (!e) return;
|
|
977
987
|
let t = [
|
|
978
988
|
e.groupField,
|
|
@@ -996,70 +1006,72 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
996
1006
|
];
|
|
997
1007
|
for (let e of t) typeof e == "string" && e && n.add(e);
|
|
998
1008
|
};
|
|
999
|
-
r(
|
|
1009
|
+
r(A.kanban), r(A.options?.kanban), r(A.calendar), r(A.options?.calendar), r(A.gallery), r(A.options?.gallery), r(A.timeline), r(A.options?.timeline), r(A.gantt), r(A.options?.gantt);
|
|
1000
1010
|
let i = n.size > 0 ? Array.from(n) : void 0;
|
|
1001
|
-
return t(
|
|
1011
|
+
return t(W?.fields, i);
|
|
1002
1012
|
}, [
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
]),
|
|
1012
|
-
|
|
1013
|
-
let e = !0, t = ++
|
|
1014
|
-
if (
|
|
1015
|
-
let e =
|
|
1013
|
+
W?.fields,
|
|
1014
|
+
A.fields,
|
|
1015
|
+
A.kanban,
|
|
1016
|
+
A.calendar,
|
|
1017
|
+
A.gallery,
|
|
1018
|
+
A.timeline,
|
|
1019
|
+
A.gantt,
|
|
1020
|
+
A.options
|
|
1021
|
+
]), zt = Ie();
|
|
1022
|
+
r.useEffect(() => {
|
|
1023
|
+
let e = !0, t = ++yt.current;
|
|
1024
|
+
if (A.data && typeof A.data == "object" && !Array.isArray(A.data)) {
|
|
1025
|
+
let e = A.data;
|
|
1016
1026
|
if (e.provider === "value" && Array.isArray(e.items)) {
|
|
1017
1027
|
let t = e.items;
|
|
1018
|
-
if (
|
|
1019
|
-
let e =
|
|
1028
|
+
if (P) {
|
|
1029
|
+
let e = P.toLowerCase();
|
|
1020
1030
|
t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
1021
1031
|
}
|
|
1022
|
-
|
|
1032
|
+
Ue(t), U(!1), rt(!1);
|
|
1023
1033
|
return;
|
|
1024
1034
|
}
|
|
1025
1035
|
}
|
|
1026
|
-
if (Array.isArray(
|
|
1027
|
-
let e =
|
|
1028
|
-
if (
|
|
1029
|
-
let t =
|
|
1036
|
+
if (Array.isArray(A.data)) {
|
|
1037
|
+
let e = A.data;
|
|
1038
|
+
if (P) {
|
|
1039
|
+
let t = P.toLowerCase();
|
|
1030
1040
|
e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
|
|
1031
1041
|
}
|
|
1032
|
-
|
|
1042
|
+
Ue(e), U(!1), rt(!1);
|
|
1033
1043
|
return;
|
|
1034
1044
|
}
|
|
1035
|
-
return
|
|
1036
|
-
if (!
|
|
1037
|
-
|
|
1045
|
+
return Ze ? ((async () => {
|
|
1046
|
+
if (!B || !A.objectName) {
|
|
1047
|
+
U(!1);
|
|
1038
1048
|
return;
|
|
1039
1049
|
}
|
|
1040
|
-
|
|
1050
|
+
U(!0), Ke(null);
|
|
1041
1051
|
try {
|
|
1042
|
-
let n = [], r =
|
|
1043
|
-
Y && vt.size > 0 && Y.forEach((e) => {
|
|
1044
|
-
vt.has(e.id) && e.filters && e.filters.length > 0 && a.push(e.filters);
|
|
1045
|
-
});
|
|
1046
|
-
let o = Xe(bt), s = [
|
|
1052
|
+
let n = [], r = A.filters || [], i = Xe(z), a = Ye(bt), o = [
|
|
1047
1053
|
...r.length > 0 ? [r] : [],
|
|
1048
1054
|
...i.length > 0 ? [i] : [],
|
|
1049
|
-
...a
|
|
1050
|
-
...o
|
|
1055
|
+
...a
|
|
1051
1056
|
].filter((e) => Array.isArray(e) && e.length > 0);
|
|
1052
|
-
|
|
1053
|
-
let
|
|
1057
|
+
o.length > 1 ? n = ["and", ...o] : o.length === 1 && (n = o[0]);
|
|
1058
|
+
let s = L.length > 0 ? L.filter((e) => e.field).map((e) => ({
|
|
1054
1059
|
field: e.field,
|
|
1055
1060
|
order: e.order
|
|
1056
|
-
})) : void 0,
|
|
1057
|
-
let e = Array.isArray(
|
|
1061
|
+
})) : void 0, c = (() => {
|
|
1062
|
+
let e = Array.isArray(A.fields) ? A.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], t = zt?.isLoaded && A.objectName ? e.filter((e) => zt.checkField(A.objectName, e, "read")) : e;
|
|
1058
1063
|
if (t.length === 0) return;
|
|
1059
1064
|
let n = new Set(["id"]);
|
|
1060
1065
|
for (let e of t) n.add(e);
|
|
1061
|
-
for (let e of
|
|
1062
|
-
let r = (
|
|
1066
|
+
for (let e of Rt) n.add(e);
|
|
1067
|
+
let r = (() => {
|
|
1068
|
+
let e = W?.fields;
|
|
1069
|
+
if (!e) return null;
|
|
1070
|
+
let t = Array.isArray(e) ? e.map((e) => e?.name).filter((e) => typeof e == "string") : Object.keys(e), n = new Set(t);
|
|
1071
|
+
return n.add("id"), n.add("created_at"), n.add("updated_at"), n;
|
|
1072
|
+
})(), i = (e) => {
|
|
1073
|
+
typeof e != "string" || !e || (!r || r.has(e)) && n.add(e);
|
|
1074
|
+
}, a = (e) => {
|
|
1063
1075
|
if (!e) return;
|
|
1064
1076
|
let t = [
|
|
1065
1077
|
e.groupField,
|
|
@@ -1081,113 +1093,131 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1081
1093
|
...Array.isArray(e.visibleFields) ? e.visibleFields : [],
|
|
1082
1094
|
...Array.isArray(e.metaFields) ? e.metaFields : []
|
|
1083
1095
|
];
|
|
1084
|
-
for (let e of t)
|
|
1096
|
+
for (let e of t) i(e);
|
|
1085
1097
|
};
|
|
1086
|
-
|
|
1098
|
+
a(A.kanban), a(A.options?.kanban), a(A.calendar), a(A.options?.calendar), a(A.gallery), a(A.options?.gallery), a(A.timeline), a(A.options?.timeline);
|
|
1087
1099
|
{
|
|
1088
|
-
let e =
|
|
1089
|
-
e && !Array.isArray(e.metaFields) && (
|
|
1100
|
+
let e = A.timeline ?? A.options?.timeline;
|
|
1101
|
+
e && !Array.isArray(e.metaFields) && (i("status"), i("priority"));
|
|
1090
1102
|
}
|
|
1091
|
-
return
|
|
1092
|
-
})(),
|
|
1093
|
-
...
|
|
1094
|
-
$orderby:
|
|
1095
|
-
$top:
|
|
1096
|
-
...
|
|
1097
|
-
...
|
|
1098
|
-
...
|
|
1099
|
-
|
|
1100
|
-
|
|
1103
|
+
return a(A.gantt), a(A.options?.gantt), Array.from(n);
|
|
1104
|
+
})(), l = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, u = N === "grid" && !J?.fields?.length, d = u ? (ot - 1) * K : 0, f = await B.find(A.objectName, {
|
|
1105
|
+
...l ? { $filter: n } : {},
|
|
1106
|
+
$orderby: s,
|
|
1107
|
+
$top: K,
|
|
1108
|
+
...d > 0 ? { $skip: d } : {},
|
|
1109
|
+
...c ? { $select: c } : {},
|
|
1110
|
+
...Rt.length > 0 ? { $expand: Rt } : {},
|
|
1111
|
+
...P ? {
|
|
1112
|
+
$search: P,
|
|
1113
|
+
...A.searchableFields && A.searchableFields.length > 0 ? { $searchFields: A.searchableFields } : {}
|
|
1101
1114
|
} : {}
|
|
1102
1115
|
});
|
|
1103
|
-
if (!e || t !==
|
|
1104
|
-
let
|
|
1105
|
-
Array.isArray(
|
|
1116
|
+
if (!e || t !== yt.current) return;
|
|
1117
|
+
let p = [];
|
|
1118
|
+
Array.isArray(f) ? p = f : f && typeof f == "object" && (Array.isArray(f.data) ? p = f.data : Array.isArray(f.records) ? p = f.records : Array.isArray(f.value) && (p = f.value)), Ue(p);
|
|
1119
|
+
let m = f && typeof f == "object" ? f.total ?? f.count : void 0, h = typeof m == "number" ? m : null;
|
|
1120
|
+
lt(u ? h : null), rt(!(u && h != null) && p.length >= K);
|
|
1106
1121
|
} catch (e) {
|
|
1107
|
-
t ===
|
|
1122
|
+
t === yt.current && (console.error("ListView data fetch error:", e), Ue([]), Ke(e?.message ? String(e.message) : String(e ?? "Unknown error")));
|
|
1108
1123
|
} finally {
|
|
1109
|
-
e && t ===
|
|
1124
|
+
e && t === yt.current && U(!1);
|
|
1110
1125
|
}
|
|
1111
1126
|
})(), () => {
|
|
1112
1127
|
e = !1;
|
|
1113
1128
|
}) : void 0;
|
|
1114
1129
|
}, [
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
vt,
|
|
1123
|
-
Y,
|
|
1130
|
+
A.objectName,
|
|
1131
|
+
A.data,
|
|
1132
|
+
B,
|
|
1133
|
+
A.filters,
|
|
1134
|
+
K,
|
|
1135
|
+
L,
|
|
1136
|
+
z,
|
|
1124
1137
|
bt,
|
|
1125
|
-
tt,
|
|
1126
|
-
M,
|
|
1127
|
-
O.searchableFields,
|
|
1128
|
-
Lt,
|
|
1129
1138
|
$e,
|
|
1130
|
-
|
|
1131
|
-
|
|
1139
|
+
P,
|
|
1140
|
+
A.searchableFields,
|
|
1141
|
+
Rt,
|
|
1142
|
+
Ze,
|
|
1143
|
+
A.refreshTrigger,
|
|
1144
|
+
zt,
|
|
1145
|
+
ot,
|
|
1146
|
+
N,
|
|
1147
|
+
J
|
|
1132
1148
|
]);
|
|
1133
|
-
let
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1149
|
+
let Bt = JSON.stringify([
|
|
1150
|
+
A.objectName,
|
|
1151
|
+
A.filters,
|
|
1152
|
+
K,
|
|
1153
|
+
L,
|
|
1154
|
+
z,
|
|
1155
|
+
bt,
|
|
1156
|
+
P,
|
|
1157
|
+
N,
|
|
1158
|
+
J
|
|
1159
|
+
]), Vt = r.useRef(Bt);
|
|
1160
|
+
r.useEffect(() => {
|
|
1161
|
+
Vt.current !== Bt && (Vt.current = Bt, st(1));
|
|
1162
|
+
}, [Bt]);
|
|
1163
|
+
let Ht = r.useMemo(() => {
|
|
1143
1164
|
let e = ["grid"];
|
|
1144
|
-
|
|
1165
|
+
(A.kanban?.groupByField || A.kanban?.groupField || A.options?.kanban?.groupField) && e.push("kanban"), (A.gallery?.coverField || A.gallery?.imageField || A.options?.gallery?.imageField) && e.push("gallery"), (A.calendar?.startDateField || A.options?.calendar?.startDateField) && e.push("calendar"), (A.timeline?.startDateField || A.options?.timeline?.startDateField || A.options?.timeline?.dateField || A.options?.calendar?.startDateField) && e.push("timeline"), (A.gantt?.startDateField || A.options?.gantt?.startDateField) && e.push("gantt"), (A.options?.map?.locationField || A.options?.map?.latitudeField && A.options?.map?.longitudeField) && e.push("map"), (A.tree?.parentField || A.options?.tree?.parentField || A.viewType === "tree") && e.push("tree"), A.viewType && !e.includes(A.viewType) && [
|
|
1145
1166
|
"grid",
|
|
1146
1167
|
"kanban",
|
|
1147
1168
|
"calendar",
|
|
1148
1169
|
"timeline",
|
|
1149
1170
|
"gantt",
|
|
1150
1171
|
"map",
|
|
1151
|
-
"gallery"
|
|
1152
|
-
|
|
1172
|
+
"gallery",
|
|
1173
|
+
"chart",
|
|
1174
|
+
"tree"
|
|
1175
|
+
].includes(A.viewType) && e.push(A.viewType);
|
|
1176
|
+
let t = A.appearance?.allowedVisualizations;
|
|
1177
|
+
if (Array.isArray(t) && t.length > 0) {
|
|
1178
|
+
let n = t.filter((t) => e.includes(t));
|
|
1179
|
+
return n.length > 0 ? n : ["grid"];
|
|
1180
|
+
}
|
|
1181
|
+
return e;
|
|
1153
1182
|
}, [
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1183
|
+
A.options,
|
|
1184
|
+
A.viewType,
|
|
1185
|
+
A.kanban,
|
|
1186
|
+
A.calendar,
|
|
1187
|
+
A.gantt,
|
|
1188
|
+
A.gallery,
|
|
1189
|
+
A.timeline,
|
|
1190
|
+
A.tree,
|
|
1191
|
+
A.appearance?.allowedVisualizations
|
|
1162
1192
|
]);
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
}, [
|
|
1166
|
-
let
|
|
1193
|
+
r.useEffect(() => {
|
|
1194
|
+
A.viewType && de(A.viewType);
|
|
1195
|
+
}, [A.viewType]);
|
|
1196
|
+
let Ut = r.useCallback((e) => {
|
|
1167
1197
|
de(e);
|
|
1168
1198
|
try {
|
|
1169
|
-
localStorage.setItem(
|
|
1199
|
+
localStorage.setItem(Lt, e);
|
|
1170
1200
|
} catch (e) {
|
|
1171
1201
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
1172
1202
|
}
|
|
1173
|
-
|
|
1174
|
-
}, [
|
|
1175
|
-
|
|
1176
|
-
}, [
|
|
1177
|
-
navigation:
|
|
1178
|
-
objectName:
|
|
1179
|
-
onNavigate:
|
|
1180
|
-
onRowClick:
|
|
1181
|
-
}),
|
|
1182
|
-
let e =
|
|
1183
|
-
if (Array.isArray(e) || (e = []),
|
|
1203
|
+
i?.(e);
|
|
1204
|
+
}, [Lt, i]), Wt = r.useCallback((e) => {
|
|
1205
|
+
be(e), s?.(e);
|
|
1206
|
+
}, [s]), Gt = Pe({
|
|
1207
|
+
navigation: A.navigation,
|
|
1208
|
+
objectName: A.objectName,
|
|
1209
|
+
onNavigate: A.onNavigate,
|
|
1210
|
+
onRowClick: d
|
|
1211
|
+
}), $ = r.useMemo(() => {
|
|
1212
|
+
let e = A.fields || [];
|
|
1213
|
+
if (Array.isArray(e) || (e = []), zt?.isLoaded && A.objectName && (e = e.filter((e) => {
|
|
1184
1214
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1185
|
-
return t ?
|
|
1186
|
-
})),
|
|
1215
|
+
return t ? zt.checkField(A.objectName, t, "read") : !0;
|
|
1216
|
+
})), X.size > 0 && (e = e.filter((e) => {
|
|
1187
1217
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1188
|
-
return t != null && !
|
|
1189
|
-
})),
|
|
1190
|
-
let t = new Map(
|
|
1218
|
+
return t != null && !X.has(t);
|
|
1219
|
+
})), A.fieldOrder && A.fieldOrder.length > 0) {
|
|
1220
|
+
let t = new Map(A.fieldOrder.map((e, t) => [e, t]));
|
|
1191
1221
|
e = [...e].sort((e, n) => {
|
|
1192
1222
|
let r = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field, i = typeof n == "string" ? n : n?.name || n?.fieldName || n?.field;
|
|
1193
1223
|
return (t.get(r) ?? Infinity) - (t.get(i) ?? Infinity);
|
|
@@ -1195,131 +1225,180 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1195
1225
|
}
|
|
1196
1226
|
return e;
|
|
1197
1227
|
}, [
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
]),
|
|
1228
|
+
A.fields,
|
|
1229
|
+
A.objectName,
|
|
1230
|
+
X,
|
|
1231
|
+
A.fieldOrder,
|
|
1232
|
+
zt
|
|
1233
|
+
]), Kt = r.useMemo(() => {
|
|
1204
1234
|
let e = Z.mode === "compact" ? "compact" : Z.mode === "spacious" ? "tall" : "medium", t = {
|
|
1205
|
-
objectName:
|
|
1206
|
-
fields:
|
|
1207
|
-
filters:
|
|
1208
|
-
sort:
|
|
1235
|
+
objectName: A.objectName,
|
|
1236
|
+
fields: $,
|
|
1237
|
+
filters: A.filters,
|
|
1238
|
+
sort: L,
|
|
1209
1239
|
className: "h-full w-full",
|
|
1210
1240
|
showSearch: !1,
|
|
1211
|
-
onRowClick:
|
|
1241
|
+
onRowClick: Gt.handleClick,
|
|
1212
1242
|
rowHeight: e,
|
|
1213
1243
|
hideRowHeightToggle: !0,
|
|
1214
|
-
...
|
|
1215
|
-
...
|
|
1216
|
-
...
|
|
1217
|
-
...
|
|
1244
|
+
...A.striped == null ? {} : { striped: A.striped },
|
|
1245
|
+
...A.bordered == null ? {} : { bordered: A.bordered },
|
|
1246
|
+
...u ? { onColumnStateChange: u } : {},
|
|
1247
|
+
...A.columnState ? { columnState: A.columnState } : {}
|
|
1218
1248
|
};
|
|
1219
|
-
switch (
|
|
1249
|
+
switch (N) {
|
|
1250
|
+
default:
|
|
1220
1251
|
case "grid": return {
|
|
1221
1252
|
type: "object-grid",
|
|
1222
1253
|
...t,
|
|
1223
|
-
columns:
|
|
1224
|
-
...
|
|
1225
|
-
...
|
|
1226
|
-
...
|
|
1227
|
-
...
|
|
1228
|
-
...
|
|
1229
|
-
...
|
|
1230
|
-
...
|
|
1231
|
-
...
|
|
1232
|
-
...
|
|
1233
|
-
...
|
|
1234
|
-
...
|
|
1235
|
-
...
|
|
1236
|
-
...
|
|
1237
|
-
...
|
|
1254
|
+
columns: $,
|
|
1255
|
+
...A.conditionalFormatting ? { conditionalFormatting: A.conditionalFormatting } : {},
|
|
1256
|
+
...A.inlineEdit == null ? {} : { editable: A.inlineEdit },
|
|
1257
|
+
...A.wrapHeaders == null ? {} : { wrapHeaders: A.wrapHeaders },
|
|
1258
|
+
...A.virtualScroll == null ? {} : { virtualScroll: A.virtualScroll },
|
|
1259
|
+
...A.resizable == null ? {} : { resizable: A.resizable },
|
|
1260
|
+
...A.selection ? { selection: A.selection } : {},
|
|
1261
|
+
...A.pagination ? { pagination: A.pagination } : {},
|
|
1262
|
+
...J ? { grouping: J } : {},
|
|
1263
|
+
...Y ? { rowColor: Y } : {},
|
|
1264
|
+
...A.rowActions ? { rowActions: A.rowActions } : {},
|
|
1265
|
+
...A.rowActionDefs ? { rowActionDefs: A.rowActionDefs } : {},
|
|
1266
|
+
...A.bulkActions ? { batchActions: A.bulkActions } : {},
|
|
1267
|
+
...A.bulkActionDefs ? { bulkActionDefs: A.bulkActionDefs } : {},
|
|
1268
|
+
...A.options?.grid || {}
|
|
1238
1269
|
};
|
|
1239
1270
|
case "kanban": return {
|
|
1240
1271
|
type: "object-kanban",
|
|
1241
1272
|
...t,
|
|
1242
|
-
groupBy:
|
|
1243
|
-
groupField:
|
|
1244
|
-
...
|
|
1245
|
-
cardFields:
|
|
1246
|
-
...
|
|
1247
|
-
...
|
|
1248
|
-
...
|
|
1273
|
+
groupBy: A.kanban?.groupField || A.options?.kanban?.groupField || "status",
|
|
1274
|
+
groupField: A.kanban?.groupField || A.options?.kanban?.groupField || "status",
|
|
1275
|
+
...A.kanban?.titleField || A.options?.kanban?.titleField ? { titleField: A.kanban?.titleField || A.options?.kanban?.titleField } : {},
|
|
1276
|
+
cardFields: A.kanban?.cardFields || $ || [],
|
|
1277
|
+
...J ? { grouping: J } : {},
|
|
1278
|
+
...A.options?.kanban || {},
|
|
1279
|
+
...A.kanban || {}
|
|
1249
1280
|
};
|
|
1250
1281
|
case "calendar": return {
|
|
1251
1282
|
type: "object-calendar",
|
|
1252
1283
|
...t,
|
|
1253
|
-
startDateField:
|
|
1254
|
-
endDateField:
|
|
1255
|
-
...
|
|
1256
|
-
...
|
|
1257
|
-
...
|
|
1258
|
-
...
|
|
1284
|
+
startDateField: A.calendar?.startDateField || A.options?.calendar?.startDateField || "start_date",
|
|
1285
|
+
endDateField: A.calendar?.endDateField || A.options?.calendar?.endDateField || "end_date",
|
|
1286
|
+
...A.calendar?.titleField || A.options?.calendar?.titleField ? { titleField: A.calendar?.titleField || A.options?.calendar?.titleField } : {},
|
|
1287
|
+
...A.calendar?.defaultView ? { defaultView: A.calendar.defaultView } : {},
|
|
1288
|
+
...A.options?.calendar || {},
|
|
1289
|
+
...A.calendar || {}
|
|
1259
1290
|
};
|
|
1260
1291
|
case "gallery": {
|
|
1261
1292
|
let e = {
|
|
1262
|
-
...
|
|
1263
|
-
...
|
|
1293
|
+
...A.options?.gallery || {},
|
|
1294
|
+
...A.gallery || {},
|
|
1264
1295
|
cardSize: Q
|
|
1265
1296
|
};
|
|
1266
1297
|
return {
|
|
1267
1298
|
type: "object-gallery",
|
|
1268
1299
|
...t,
|
|
1269
1300
|
gallery: Object.keys(e).length > 0 ? e : void 0,
|
|
1270
|
-
imageField:
|
|
1271
|
-
titleField:
|
|
1272
|
-
subtitleField:
|
|
1273
|
-
...
|
|
1301
|
+
imageField: A.gallery?.coverField || A.gallery?.imageField || A.options?.gallery?.imageField,
|
|
1302
|
+
titleField: A.gallery?.titleField || A.options?.gallery?.titleField || "name",
|
|
1303
|
+
subtitleField: A.gallery?.subtitleField || A.options?.gallery?.subtitleField,
|
|
1304
|
+
...J ? { grouping: J } : {}
|
|
1274
1305
|
};
|
|
1275
1306
|
}
|
|
1276
1307
|
case "timeline": {
|
|
1277
1308
|
let e = {
|
|
1278
|
-
...
|
|
1279
|
-
...
|
|
1309
|
+
...A.options?.timeline || {},
|
|
1310
|
+
...A.timeline || {}
|
|
1280
1311
|
};
|
|
1281
1312
|
return {
|
|
1282
1313
|
type: "object-timeline",
|
|
1283
1314
|
...t,
|
|
1284
1315
|
timeline: Object.keys(e).length > 0 ? e : void 0,
|
|
1285
|
-
startDateField:
|
|
1286
|
-
titleField:
|
|
1287
|
-
...
|
|
1288
|
-
...
|
|
1289
|
-
...
|
|
1290
|
-
...
|
|
1316
|
+
startDateField: A.timeline?.startDateField || A.options?.timeline?.startDateField || A.options?.timeline?.dateField || "created_at",
|
|
1317
|
+
titleField: A.timeline?.titleField || A.options?.timeline?.titleField || "name",
|
|
1318
|
+
...A.timeline?.endDateField ? { endDateField: A.timeline.endDateField } : {},
|
|
1319
|
+
...A.timeline?.groupByField ? { groupByField: A.timeline.groupByField } : {},
|
|
1320
|
+
...A.timeline?.colorField ? { colorField: A.timeline.colorField } : {},
|
|
1321
|
+
...A.timeline?.scale ? { scale: A.timeline.scale } : {}
|
|
1291
1322
|
};
|
|
1292
1323
|
}
|
|
1293
1324
|
case "gantt": return {
|
|
1294
1325
|
type: "object-gantt",
|
|
1295
1326
|
...t,
|
|
1296
|
-
startDateField:
|
|
1297
|
-
endDateField:
|
|
1298
|
-
progressField:
|
|
1299
|
-
dependenciesField:
|
|
1300
|
-
...
|
|
1301
|
-
...
|
|
1302
|
-
...
|
|
1327
|
+
startDateField: A.gantt?.startDateField || A.options?.gantt?.startDateField || "start_date",
|
|
1328
|
+
endDateField: A.gantt?.endDateField || A.options?.gantt?.endDateField || "end_date",
|
|
1329
|
+
progressField: A.gantt?.progressField || A.options?.gantt?.progressField || "progress",
|
|
1330
|
+
dependenciesField: A.gantt?.dependenciesField || A.options?.gantt?.dependenciesField || "dependencies",
|
|
1331
|
+
...A.gantt?.titleField ? { titleField: A.gantt.titleField } : {},
|
|
1332
|
+
...A.options?.gantt || {},
|
|
1333
|
+
...A.gantt || {}
|
|
1303
1334
|
};
|
|
1304
1335
|
case "map": return {
|
|
1305
1336
|
type: "object-map",
|
|
1306
1337
|
...t,
|
|
1307
|
-
locationField:
|
|
1308
|
-
...
|
|
1338
|
+
locationField: A.options?.map?.locationField || "location",
|
|
1339
|
+
...A.options?.map || {}
|
|
1309
1340
|
};
|
|
1310
|
-
|
|
1341
|
+
case "tree": {
|
|
1342
|
+
let e = A.tree || A.options?.tree || {};
|
|
1343
|
+
return {
|
|
1344
|
+
type: "object-tree",
|
|
1345
|
+
...t,
|
|
1346
|
+
parentField: e.parentField,
|
|
1347
|
+
labelField: e.labelField || e.titleField || "name",
|
|
1348
|
+
fields: e.fields || $,
|
|
1349
|
+
defaultExpandedDepth: e.defaultExpandedDepth,
|
|
1350
|
+
...e
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
case "chart": {
|
|
1354
|
+
let e = A.chart || A.options?.chart || {};
|
|
1355
|
+
if (e.dataset) {
|
|
1356
|
+
let t = Array.isArray(e.dimensions) ? e.dimensions : [], n = Array.isArray(e.values) ? e.values : [];
|
|
1357
|
+
return {
|
|
1358
|
+
type: "object-chart",
|
|
1359
|
+
dataset: e.dataset,
|
|
1360
|
+
dimensions: t,
|
|
1361
|
+
values: n,
|
|
1362
|
+
chartType: e.chartType || "bar",
|
|
1363
|
+
xAxisKey: t[0],
|
|
1364
|
+
series: n.map((e) => ({
|
|
1365
|
+
dataKey: e,
|
|
1366
|
+
label: e
|
|
1367
|
+
})),
|
|
1368
|
+
className: "h-[400px] w-full"
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
let t = Array.isArray(e.yAxisFields) && e.yAxisFields[0] || e.valueField || "value", n = e.xAxisField || e.categoryField || "name";
|
|
1372
|
+
return {
|
|
1373
|
+
type: "object-chart",
|
|
1374
|
+
objectName: A.objectName,
|
|
1375
|
+
chartType: e.chartType || "bar",
|
|
1376
|
+
filters: A.filters,
|
|
1377
|
+
aggregate: {
|
|
1378
|
+
field: t,
|
|
1379
|
+
function: e.aggregation || "count",
|
|
1380
|
+
groupBy: n
|
|
1381
|
+
},
|
|
1382
|
+
xAxisKey: n,
|
|
1383
|
+
series: [{
|
|
1384
|
+
dataKey: t,
|
|
1385
|
+
label: t
|
|
1386
|
+
}],
|
|
1387
|
+
className: "h-[400px] w-full"
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1311
1390
|
}
|
|
1312
1391
|
}, [
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1392
|
+
N,
|
|
1393
|
+
A,
|
|
1394
|
+
L,
|
|
1395
|
+
$,
|
|
1396
|
+
J,
|
|
1397
|
+
Y,
|
|
1398
|
+
Gt.handleClick,
|
|
1320
1399
|
Z.mode,
|
|
1321
1400
|
Q
|
|
1322
|
-
]),
|
|
1401
|
+
]), qt = z.conditions && z.conditions.length > 0, Jt = r.useMemo(() => {
|
|
1323
1402
|
let e, t = (e, t) => {
|
|
1324
1403
|
if (!t) return;
|
|
1325
1404
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1331,17 +1410,17 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1331
1410
|
label: t?.label || e,
|
|
1332
1411
|
...t
|
|
1333
1412
|
}));
|
|
1334
|
-
return
|
|
1413
|
+
return A.objectName ? k(A.objectName, e, n) : n;
|
|
1335
1414
|
};
|
|
1336
|
-
if (e =
|
|
1415
|
+
if (e = W?.fields ? Object.entries(W.fields).map(([e, n]) => ({
|
|
1337
1416
|
value: e,
|
|
1338
|
-
label:
|
|
1417
|
+
label: j(e, n.label || e),
|
|
1339
1418
|
type: n.type || "text",
|
|
1340
1419
|
options: t(e, n.options),
|
|
1341
1420
|
referenceTo: n.reference_to || n.reference,
|
|
1342
1421
|
displayField: n.display_field || n.reference_field,
|
|
1343
1422
|
idField: n.id_field
|
|
1344
|
-
})) : (
|
|
1423
|
+
})) : (A.fields || []).map((e) => {
|
|
1345
1424
|
if (typeof e == "string") return {
|
|
1346
1425
|
value: e,
|
|
1347
1426
|
label: e,
|
|
@@ -1350,34 +1429,29 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1350
1429
|
let n = e.name || e.fieldName;
|
|
1351
1430
|
return {
|
|
1352
1431
|
value: n,
|
|
1353
|
-
label:
|
|
1432
|
+
label: j(n, e.label || e.name),
|
|
1354
1433
|
type: e.type || "text",
|
|
1355
1434
|
options: t(n, e.options),
|
|
1356
1435
|
referenceTo: e.reference_to || e.reference,
|
|
1357
1436
|
displayField: e.display_field || e.reference_field,
|
|
1358
1437
|
idField: e.id_field
|
|
1359
1438
|
};
|
|
1360
|
-
}),
|
|
1361
|
-
let t = new Set(
|
|
1439
|
+
}), A.filterableFields && A.filterableFields.length > 0) {
|
|
1440
|
+
let t = new Set(A.filterableFields);
|
|
1362
1441
|
e = e.filter((e) => t.has(e.value));
|
|
1363
1442
|
}
|
|
1364
1443
|
return e;
|
|
1365
1444
|
}, [
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
]),
|
|
1373
|
-
|
|
1374
|
-
let n = new Set(t);
|
|
1375
|
-
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1376
|
-
});
|
|
1377
|
-
}, []), qt = a.useCallback((e) => {
|
|
1378
|
-
let t = X, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || O.objectName || "export", a = n > 0 ? z.slice(0, n) : z;
|
|
1445
|
+
W,
|
|
1446
|
+
A.fields,
|
|
1447
|
+
A.filterableFields,
|
|
1448
|
+
A.objectName,
|
|
1449
|
+
j,
|
|
1450
|
+
k
|
|
1451
|
+
]), Yt = r.useCallback((e) => {
|
|
1452
|
+
let t = At, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || A.objectName || "export", a = n > 0 ? V.slice(0, n) : V;
|
|
1379
1453
|
if (e === "csv") {
|
|
1380
|
-
let e =
|
|
1454
|
+
let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
|
|
1381
1455
|
r && t.push(e.join(",")), a.forEach((n) => {
|
|
1382
1456
|
t.push(e.map((e) => {
|
|
1383
1457
|
let t = n[e], r;
|
|
@@ -1392,136 +1466,117 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1392
1466
|
}
|
|
1393
1467
|
kt(!1);
|
|
1394
1468
|
}, [
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
]),
|
|
1469
|
+
V,
|
|
1470
|
+
$,
|
|
1471
|
+
At,
|
|
1472
|
+
A.objectName
|
|
1473
|
+
]), Xt = r.useMemo(() => (A.fields || []).map((e) => {
|
|
1400
1474
|
if (typeof e == "string") return {
|
|
1401
1475
|
name: e,
|
|
1402
|
-
label:
|
|
1476
|
+
label: j(e, e)
|
|
1403
1477
|
};
|
|
1404
1478
|
let t = e.name || e.fieldName || e.field;
|
|
1405
1479
|
return {
|
|
1406
1480
|
name: t,
|
|
1407
|
-
label:
|
|
1481
|
+
label: j(t, e.label || e.name || e.field)
|
|
1408
1482
|
};
|
|
1409
|
-
}), [
|
|
1410
|
-
return /* @__PURE__ */
|
|
1411
|
-
ref:
|
|
1412
|
-
className:
|
|
1413
|
-
...
|
|
1414
|
-
...
|
|
1415
|
-
...
|
|
1483
|
+
}), [A.fields, j]);
|
|
1484
|
+
return /* @__PURE__ */ I("div", {
|
|
1485
|
+
ref: Pt,
|
|
1486
|
+
className: T("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1487
|
+
...A.aria?.label ? { "aria-label": A.aria.label } : {},
|
|
1488
|
+
...A.aria?.describedBy ? { "aria-describedby": A.aria.describedBy } : {},
|
|
1489
|
+
...A.aria?.live ? { "aria-live": A.aria.live } : {},
|
|
1416
1490
|
role: "region",
|
|
1491
|
+
"aria-busy": H || void 0,
|
|
1492
|
+
"data-state": H ? "loading" : "idle",
|
|
1417
1493
|
children: [
|
|
1418
|
-
|
|
1494
|
+
It > 0 && /* @__PURE__ */ F("div", {
|
|
1419
1495
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1420
|
-
style: { height:
|
|
1421
|
-
children:
|
|
1496
|
+
style: { height: It },
|
|
1497
|
+
children: E(Ft ? "list.refreshing" : "list.pullToRefresh")
|
|
1422
1498
|
}),
|
|
1423
|
-
|
|
1424
|
-
className: "px-4 py-1 flex items-center bg-background",
|
|
1425
|
-
children: /* @__PURE__ */ N(Be, {
|
|
1426
|
-
currentView: j,
|
|
1427
|
-
availableViews: Rt,
|
|
1428
|
-
onViewChange: zt
|
|
1429
|
-
})
|
|
1430
|
-
}),
|
|
1431
|
-
O.description && O.appearance?.showDescription !== !1 && /* @__PURE__ */ N("div", {
|
|
1499
|
+
A.description && A.appearance?.showDescription !== !1 && /* @__PURE__ */ F("div", {
|
|
1432
1500
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
1433
1501
|
"data-testid": "view-description",
|
|
1434
|
-
children: typeof
|
|
1502
|
+
children: typeof A.description == "string" ? A.description : ""
|
|
1435
1503
|
}),
|
|
1436
|
-
/* @__PURE__ */
|
|
1504
|
+
/* @__PURE__ */ I("div", {
|
|
1437
1505
|
className: "border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background",
|
|
1438
|
-
children: [/* @__PURE__ */
|
|
1506
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1439
1507
|
className: "flex items-center gap-2 overflow-x-auto min-w-0",
|
|
1440
|
-
children:
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
children: /* @__PURE__ */ N(Ue, {
|
|
1452
|
-
tabs: O.tabs,
|
|
1453
|
-
activeTab: L,
|
|
1454
|
-
onTabChange: Ke,
|
|
1455
|
-
className: "!px-0 !py-0"
|
|
1456
|
-
})
|
|
1457
|
-
})] }),
|
|
1458
|
-
O.tabs && O.tabs.length > 0 && St && /* @__PURE__ */ N("div", { className: "hidden sm:block h-4 w-px bg-border/60 mx-1 shrink-0" }),
|
|
1459
|
-
St && /* @__PURE__ */ N("div", {
|
|
1460
|
-
className: "shrink-0 min-w-0 overflow-x-auto",
|
|
1461
|
-
"data-testid": "user-filters",
|
|
1462
|
-
children: /* @__PURE__ */ N(qe, {
|
|
1463
|
-
config: St,
|
|
1464
|
-
objectDef: H,
|
|
1465
|
-
data: z,
|
|
1466
|
-
onFilterChange: xt,
|
|
1467
|
-
maxVisible: 3
|
|
1468
|
-
})
|
|
1508
|
+
children: St && /* @__PURE__ */ F("div", {
|
|
1509
|
+
className: "shrink-0 min-w-0 overflow-x-auto",
|
|
1510
|
+
"data-testid": "user-filters",
|
|
1511
|
+
children: /* @__PURE__ */ F(Ge, {
|
|
1512
|
+
config: St,
|
|
1513
|
+
objectDef: W,
|
|
1514
|
+
data: V,
|
|
1515
|
+
onFilterChange: xt,
|
|
1516
|
+
maxVisible: 3,
|
|
1517
|
+
initialSelections: m,
|
|
1518
|
+
onSelectionsChange: h
|
|
1469
1519
|
})
|
|
1470
|
-
|
|
1471
|
-
}), /* @__PURE__ */
|
|
1520
|
+
})
|
|
1521
|
+
}), /* @__PURE__ */ I("div", {
|
|
1472
1522
|
className: "flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm",
|
|
1473
1523
|
children: [
|
|
1474
|
-
|
|
1524
|
+
ne && /* @__PURE__ */ I(Ee, { children: [/* @__PURE__ */ F(Be, {
|
|
1525
|
+
currentView: N,
|
|
1526
|
+
availableViews: Ht,
|
|
1527
|
+
onViewChange: Ut
|
|
1528
|
+
}), /* @__PURE__ */ F("div", { className: "h-4 w-px bg-border/60 mx-0.5" })] }),
|
|
1529
|
+
M.showHideFields && !M.compactToolbar && /* @__PURE__ */ I(S, {
|
|
1475
1530
|
open: Et,
|
|
1476
1531
|
onOpenChange: Dt,
|
|
1477
|
-
children: [/* @__PURE__ */
|
|
1532
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1478
1533
|
asChild: !0,
|
|
1479
|
-
children: /* @__PURE__ */
|
|
1534
|
+
children: /* @__PURE__ */ I(l, {
|
|
1480
1535
|
variant: "ghost",
|
|
1481
1536
|
size: "sm",
|
|
1482
|
-
className:
|
|
1537
|
+
className: T("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"),
|
|
1483
1538
|
children: [
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
/* @__PURE__ */
|
|
1539
|
+
/* @__PURE__ */ F(se, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1540
|
+
/* @__PURE__ */ F("span", {
|
|
1486
1541
|
className: "hidden sm:inline",
|
|
1487
|
-
children:
|
|
1542
|
+
children: E("list.hideFields")
|
|
1488
1543
|
}),
|
|
1489
|
-
|
|
1544
|
+
X.size > 0 && /* @__PURE__ */ F("span", {
|
|
1490
1545
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1491
|
-
children:
|
|
1546
|
+
children: X.size
|
|
1492
1547
|
})
|
|
1493
1548
|
]
|
|
1494
1549
|
})
|
|
1495
|
-
}), /* @__PURE__ */
|
|
1550
|
+
}), /* @__PURE__ */ F(C, {
|
|
1496
1551
|
align: "start",
|
|
1497
1552
|
className: "w-64 p-3",
|
|
1498
|
-
children: /* @__PURE__ */
|
|
1553
|
+
children: /* @__PURE__ */ I("div", {
|
|
1499
1554
|
className: "space-y-2",
|
|
1500
|
-
children: [/* @__PURE__ */
|
|
1555
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1501
1556
|
className: "flex items-center justify-between border-b pb-2",
|
|
1502
|
-
children: [/* @__PURE__ */
|
|
1557
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1503
1558
|
className: "font-medium text-sm",
|
|
1504
|
-
children:
|
|
1505
|
-
}),
|
|
1559
|
+
children: E("list.hideFieldsTitle")
|
|
1560
|
+
}), X.size > 0 && /* @__PURE__ */ F(l, {
|
|
1506
1561
|
variant: "ghost",
|
|
1507
1562
|
size: "sm",
|
|
1508
1563
|
className: "h-6 px-2 text-xs",
|
|
1509
1564
|
onClick: () => Tt(/* @__PURE__ */ new Set()),
|
|
1510
|
-
children:
|
|
1565
|
+
children: E("list.showAll")
|
|
1511
1566
|
})]
|
|
1512
|
-
}), /* @__PURE__ */
|
|
1567
|
+
}), /* @__PURE__ */ F("div", {
|
|
1513
1568
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1514
|
-
children:
|
|
1569
|
+
children: Xt.map((e) => /* @__PURE__ */ I("label", {
|
|
1515
1570
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1516
|
-
children: [/* @__PURE__ */
|
|
1571
|
+
children: [/* @__PURE__ */ F("input", {
|
|
1517
1572
|
type: "checkbox",
|
|
1518
|
-
checked: !
|
|
1573
|
+
checked: !X.has(e.name),
|
|
1519
1574
|
onChange: () => {
|
|
1520
|
-
let t = new Set(
|
|
1575
|
+
let t = new Set(X);
|
|
1521
1576
|
t.has(e.name) ? t.delete(e.name) : t.add(e.name), Tt(t);
|
|
1522
1577
|
},
|
|
1523
1578
|
className: "rounded border-input"
|
|
1524
|
-
}), /* @__PURE__ */
|
|
1579
|
+
}), /* @__PURE__ */ F("span", {
|
|
1525
1580
|
className: "truncate",
|
|
1526
1581
|
children: e.label
|
|
1527
1582
|
})]
|
|
@@ -1530,204 +1585,204 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1530
1585
|
})
|
|
1531
1586
|
})]
|
|
1532
1587
|
}),
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
open:
|
|
1536
|
-
onOpenChange:
|
|
1537
|
-
children: [/* @__PURE__ */
|
|
1588
|
+
M.showHideFields && !M.compactToolbar && (M.showFilters || M.showSort || M.showGroup) && /* @__PURE__ */ F("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1589
|
+
M.showFilters && /* @__PURE__ */ I(S, {
|
|
1590
|
+
open: ze,
|
|
1591
|
+
onOpenChange: R,
|
|
1592
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1538
1593
|
asChild: !0,
|
|
1539
|
-
children: /* @__PURE__ */
|
|
1594
|
+
children: /* @__PURE__ */ I(l, {
|
|
1540
1595
|
variant: "ghost",
|
|
1541
1596
|
size: "sm",
|
|
1542
|
-
className:
|
|
1597
|
+
className: T("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", qt && "text-foreground font-medium"),
|
|
1543
1598
|
children: [
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1599
|
+
/* @__PURE__ */ F(Se, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1600
|
+
/* @__PURE__ */ F("span", {
|
|
1546
1601
|
className: "hidden sm:inline",
|
|
1547
|
-
children:
|
|
1602
|
+
children: E("list.filter")
|
|
1548
1603
|
}),
|
|
1549
|
-
|
|
1604
|
+
qt && /* @__PURE__ */ F("span", {
|
|
1550
1605
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1551
|
-
children:
|
|
1606
|
+
children: z.conditions?.length || 0
|
|
1552
1607
|
})
|
|
1553
1608
|
]
|
|
1554
1609
|
})
|
|
1555
|
-
}), /* @__PURE__ */
|
|
1610
|
+
}), /* @__PURE__ */ F(C, {
|
|
1556
1611
|
align: "start",
|
|
1557
1612
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1558
|
-
children: /* @__PURE__ */
|
|
1613
|
+
children: /* @__PURE__ */ I("div", {
|
|
1559
1614
|
className: "space-y-4",
|
|
1560
|
-
children: [/* @__PURE__ */
|
|
1615
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1561
1616
|
className: "flex items-center justify-between border-b pb-2",
|
|
1562
|
-
children: /* @__PURE__ */
|
|
1617
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1563
1618
|
className: "font-medium text-sm",
|
|
1564
|
-
children:
|
|
1619
|
+
children: E("list.filterRecords")
|
|
1565
1620
|
})
|
|
1566
|
-
}), /* @__PURE__ */
|
|
1567
|
-
fields:
|
|
1568
|
-
value:
|
|
1621
|
+
}), /* @__PURE__ */ F(_, {
|
|
1622
|
+
fields: Jt,
|
|
1623
|
+
value: z,
|
|
1569
1624
|
onChange: (e) => {
|
|
1570
|
-
Ve(e),
|
|
1625
|
+
Ve(e), a && a(e);
|
|
1571
1626
|
}
|
|
1572
1627
|
})]
|
|
1573
1628
|
})
|
|
1574
1629
|
})]
|
|
1575
1630
|
}),
|
|
1576
|
-
|
|
1577
|
-
open:
|
|
1578
|
-
onOpenChange:
|
|
1579
|
-
children: [/* @__PURE__ */
|
|
1631
|
+
M.showGroup && !M.compactToolbar && /* @__PURE__ */ I(S, {
|
|
1632
|
+
open: dt,
|
|
1633
|
+
onOpenChange: ft,
|
|
1634
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1580
1635
|
asChild: !0,
|
|
1581
|
-
children: /* @__PURE__ */
|
|
1636
|
+
children: /* @__PURE__ */ I(l, {
|
|
1582
1637
|
variant: "ghost",
|
|
1583
1638
|
size: "sm",
|
|
1584
|
-
className:
|
|
1639
|
+
className: T("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"),
|
|
1585
1640
|
children: [
|
|
1586
|
-
/* @__PURE__ */
|
|
1587
|
-
/* @__PURE__ */
|
|
1641
|
+
/* @__PURE__ */ F(le, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1642
|
+
/* @__PURE__ */ F("span", {
|
|
1588
1643
|
className: "hidden sm:inline",
|
|
1589
|
-
children:
|
|
1644
|
+
children: E("list.group")
|
|
1590
1645
|
}),
|
|
1591
|
-
|
|
1646
|
+
J && J.fields?.length > 0 && /* @__PURE__ */ F("span", {
|
|
1592
1647
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1593
|
-
children:
|
|
1648
|
+
children: J.fields.length
|
|
1594
1649
|
})
|
|
1595
1650
|
]
|
|
1596
1651
|
})
|
|
1597
|
-
}), /* @__PURE__ */
|
|
1652
|
+
}), /* @__PURE__ */ F(C, {
|
|
1598
1653
|
align: "start",
|
|
1599
1654
|
className: "w-72 p-3",
|
|
1600
|
-
children: /* @__PURE__ */
|
|
1655
|
+
children: /* @__PURE__ */ I("div", {
|
|
1601
1656
|
className: "space-y-2",
|
|
1602
|
-
children: [/* @__PURE__ */
|
|
1657
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1603
1658
|
className: "flex items-center justify-between border-b pb-2",
|
|
1604
|
-
children: [/* @__PURE__ */
|
|
1659
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1605
1660
|
className: "font-medium text-sm",
|
|
1606
|
-
children:
|
|
1607
|
-
}),
|
|
1661
|
+
children: E("list.groupBy")
|
|
1662
|
+
}), J && /* @__PURE__ */ F(l, {
|
|
1608
1663
|
variant: "ghost",
|
|
1609
1664
|
size: "sm",
|
|
1610
1665
|
className: "h-6 px-2 text-xs",
|
|
1611
|
-
onClick: () =>
|
|
1666
|
+
onClick: () => ut(void 0),
|
|
1612
1667
|
"data-testid": "clear-grouping",
|
|
1613
|
-
children:
|
|
1668
|
+
children: E("list.clear")
|
|
1614
1669
|
})]
|
|
1615
|
-
}), /* @__PURE__ */
|
|
1670
|
+
}), /* @__PURE__ */ F("div", {
|
|
1616
1671
|
"data-testid": "group-field-list",
|
|
1617
|
-
children: /* @__PURE__ */
|
|
1618
|
-
value:
|
|
1619
|
-
fieldOptions:
|
|
1672
|
+
children: /* @__PURE__ */ F(v, {
|
|
1673
|
+
value: J,
|
|
1674
|
+
fieldOptions: Xt.map((e) => ({
|
|
1620
1675
|
value: e.name,
|
|
1621
1676
|
label: e.label || e.name
|
|
1622
1677
|
})),
|
|
1623
1678
|
maxLevels: 3,
|
|
1624
1679
|
labels: {
|
|
1625
|
-
addGroup:
|
|
1626
|
-
collapseTitle:
|
|
1627
|
-
removeTitle:
|
|
1680
|
+
addGroup: E("list.addGroup", { defaultValue: "Add group field" }),
|
|
1681
|
+
collapseTitle: E("list.collapsedByDefault", { defaultValue: "Collapsed by default" }),
|
|
1682
|
+
removeTitle: E("list.removeGroup", { defaultValue: "Remove" })
|
|
1628
1683
|
},
|
|
1629
|
-
onChange: (e) =>
|
|
1684
|
+
onChange: (e) => ut(e)
|
|
1630
1685
|
})
|
|
1631
1686
|
})]
|
|
1632
1687
|
})
|
|
1633
1688
|
})]
|
|
1634
1689
|
}),
|
|
1635
|
-
|
|
1636
|
-
open:
|
|
1637
|
-
onOpenChange:
|
|
1638
|
-
children: [/* @__PURE__ */
|
|
1690
|
+
M.showSort && /* @__PURE__ */ I(S, {
|
|
1691
|
+
open: je,
|
|
1692
|
+
onOpenChange: Me,
|
|
1693
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1639
1694
|
asChild: !0,
|
|
1640
|
-
children: /* @__PURE__ */
|
|
1695
|
+
children: /* @__PURE__ */ I(l, {
|
|
1641
1696
|
variant: "ghost",
|
|
1642
1697
|
size: "sm",
|
|
1643
|
-
className:
|
|
1698
|
+
className: T("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", L.length > 0 && "text-foreground font-medium"),
|
|
1644
1699
|
children: [
|
|
1645
|
-
/* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ F(ie, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1701
|
+
/* @__PURE__ */ F("span", {
|
|
1647
1702
|
className: "hidden sm:inline",
|
|
1648
|
-
children:
|
|
1703
|
+
children: E("list.sort")
|
|
1649
1704
|
}),
|
|
1650
|
-
|
|
1705
|
+
L.length > 0 && /* @__PURE__ */ F("span", {
|
|
1651
1706
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1652
|
-
children:
|
|
1707
|
+
children: L.length
|
|
1653
1708
|
})
|
|
1654
1709
|
]
|
|
1655
1710
|
})
|
|
1656
|
-
}), /* @__PURE__ */
|
|
1711
|
+
}), /* @__PURE__ */ F(C, {
|
|
1657
1712
|
align: "start",
|
|
1658
1713
|
className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
|
|
1659
|
-
children: /* @__PURE__ */
|
|
1714
|
+
children: /* @__PURE__ */ I("div", {
|
|
1660
1715
|
className: "space-y-4",
|
|
1661
|
-
children: [/* @__PURE__ */
|
|
1716
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1662
1717
|
className: "flex items-center justify-between border-b pb-2",
|
|
1663
|
-
children: /* @__PURE__ */
|
|
1718
|
+
children: /* @__PURE__ */ F("h4", {
|
|
1664
1719
|
className: "font-medium text-sm",
|
|
1665
|
-
children:
|
|
1720
|
+
children: E("list.sortRecords")
|
|
1666
1721
|
})
|
|
1667
|
-
}), /* @__PURE__ */
|
|
1668
|
-
fields:
|
|
1669
|
-
value:
|
|
1722
|
+
}), /* @__PURE__ */ F(te, {
|
|
1723
|
+
fields: Jt,
|
|
1724
|
+
value: L,
|
|
1670
1725
|
onChange: (e) => {
|
|
1671
|
-
|
|
1726
|
+
Le(e), o && o(e);
|
|
1672
1727
|
}
|
|
1673
1728
|
})]
|
|
1674
1729
|
})
|
|
1675
1730
|
})]
|
|
1676
1731
|
}),
|
|
1677
|
-
!
|
|
1678
|
-
|
|
1679
|
-
open:
|
|
1680
|
-
onOpenChange:
|
|
1681
|
-
children: [/* @__PURE__ */
|
|
1732
|
+
!M.compactToolbar && (M.showFilters || M.showSort || M.showGroup) && (M.showColor || M.showDensity) && /* @__PURE__ */ F("div", { className: "hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1733
|
+
M.showColor && !M.compactToolbar && /* @__PURE__ */ I(S, {
|
|
1734
|
+
open: ht,
|
|
1735
|
+
onOpenChange: gt,
|
|
1736
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1682
1737
|
asChild: !0,
|
|
1683
|
-
children: /* @__PURE__ */
|
|
1738
|
+
children: /* @__PURE__ */ I(l, {
|
|
1684
1739
|
variant: "ghost",
|
|
1685
1740
|
size: "sm",
|
|
1686
|
-
className:
|
|
1687
|
-
children: [/* @__PURE__ */
|
|
1741
|
+
className: T("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Y && "text-foreground font-medium"),
|
|
1742
|
+
children: [/* @__PURE__ */ F(fe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1688
1743
|
className: "hidden sm:inline",
|
|
1689
|
-
children:
|
|
1744
|
+
children: E("list.color")
|
|
1690
1745
|
})]
|
|
1691
1746
|
})
|
|
1692
|
-
}), /* @__PURE__ */
|
|
1747
|
+
}), /* @__PURE__ */ F(C, {
|
|
1693
1748
|
align: "start",
|
|
1694
1749
|
className: "w-64 p-3",
|
|
1695
|
-
children: /* @__PURE__ */
|
|
1750
|
+
children: /* @__PURE__ */ I("div", {
|
|
1696
1751
|
className: "space-y-2",
|
|
1697
|
-
children: [/* @__PURE__ */
|
|
1752
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1698
1753
|
className: "flex items-center justify-between border-b pb-2",
|
|
1699
|
-
children: [/* @__PURE__ */
|
|
1754
|
+
children: [/* @__PURE__ */ F("h4", {
|
|
1700
1755
|
className: "font-medium text-sm",
|
|
1701
|
-
children:
|
|
1702
|
-
}),
|
|
1756
|
+
children: E("list.rowColor")
|
|
1757
|
+
}), Y && /* @__PURE__ */ F(l, {
|
|
1703
1758
|
variant: "ghost",
|
|
1704
1759
|
size: "sm",
|
|
1705
1760
|
className: "h-6 px-2 text-xs",
|
|
1706
|
-
onClick: () =>
|
|
1761
|
+
onClick: () => mt(void 0),
|
|
1707
1762
|
"data-testid": "clear-row-color",
|
|
1708
|
-
children:
|
|
1763
|
+
children: E("list.clear")
|
|
1709
1764
|
})]
|
|
1710
|
-
}), /* @__PURE__ */
|
|
1765
|
+
}), /* @__PURE__ */ I("div", {
|
|
1711
1766
|
className: "space-y-2",
|
|
1712
1767
|
"data-testid": "color-field-list",
|
|
1713
|
-
children: [/* @__PURE__ */
|
|
1768
|
+
children: [/* @__PURE__ */ F("label", {
|
|
1714
1769
|
className: "text-xs text-muted-foreground",
|
|
1715
|
-
children:
|
|
1716
|
-
}), /* @__PURE__ */
|
|
1770
|
+
children: E("list.colorByField")
|
|
1771
|
+
}), /* @__PURE__ */ I("select", {
|
|
1717
1772
|
className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
|
|
1718
|
-
value:
|
|
1773
|
+
value: Y?.field || "",
|
|
1719
1774
|
onChange: (e) => {
|
|
1720
1775
|
let t = e.target.value;
|
|
1721
|
-
|
|
1776
|
+
mt(t ? {
|
|
1722
1777
|
field: t,
|
|
1723
|
-
colors:
|
|
1778
|
+
colors: Y?.colors || {}
|
|
1724
1779
|
} : void 0);
|
|
1725
1780
|
},
|
|
1726
1781
|
"data-testid": "color-field-select",
|
|
1727
|
-
children: [/* @__PURE__ */
|
|
1782
|
+
children: [/* @__PURE__ */ F("option", {
|
|
1728
1783
|
value: "",
|
|
1729
|
-
children:
|
|
1730
|
-
}),
|
|
1784
|
+
children: E("list.none")
|
|
1785
|
+
}), Xt.map((e) => /* @__PURE__ */ F("option", {
|
|
1731
1786
|
value: e.name,
|
|
1732
1787
|
children: e.label
|
|
1733
1788
|
}, e.name))]
|
|
@@ -1736,185 +1791,185 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1736
1791
|
})
|
|
1737
1792
|
})]
|
|
1738
1793
|
}),
|
|
1739
|
-
|
|
1740
|
-
let e = Z.mode === "compact" ?
|
|
1794
|
+
M.showDensity && !M.compactToolbar && N !== "gallery" && (() => {
|
|
1795
|
+
let e = Z.mode === "compact" ? ve : Z.mode === "comfortable" ? _e : ge, t = Z.mode === "compact" ? E("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Z.mode === "comfortable" ? E("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : E("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${E("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = E("grid.toolbar.densityCycleHint", {
|
|
1741
1796
|
defaultValue: "{{label}} (click to cycle)",
|
|
1742
1797
|
label: n
|
|
1743
1798
|
});
|
|
1744
|
-
return /* @__PURE__ */
|
|
1799
|
+
return /* @__PURE__ */ F(l, {
|
|
1745
1800
|
variant: "ghost",
|
|
1746
1801
|
size: "sm",
|
|
1747
1802
|
"aria-label": n,
|
|
1748
|
-
className:
|
|
1803
|
+
className: T("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Z.mode !== "compact" && "text-foreground font-medium"),
|
|
1749
1804
|
onClick: Z.cycle,
|
|
1750
1805
|
title: r,
|
|
1751
|
-
children: /* @__PURE__ */
|
|
1806
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1752
1807
|
});
|
|
1753
1808
|
})(),
|
|
1754
|
-
|
|
1755
|
-
let e = Q === "small" ?
|
|
1809
|
+
M.showDensity && !M.compactToolbar && N === "gallery" && (() => {
|
|
1810
|
+
let e = Q === "small" ? ve : Q === "medium" ? _e : ge, t = Q === "small" ? E("grid.toolbar.densityCompact", { defaultValue: "Compact" }) : Q === "medium" ? E("grid.toolbar.densityComfortable", { defaultValue: "Comfortable" }) : E("grid.toolbar.densitySpacious", { defaultValue: "Spacious" }), n = `${E("grid.toolbar.densityMode", { defaultValue: "Density" })}: ${t}`, r = E("grid.toolbar.densityCycleHint", {
|
|
1756
1811
|
defaultValue: "{{label}} (click to cycle)",
|
|
1757
1812
|
label: n
|
|
1758
1813
|
});
|
|
1759
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ F(l, {
|
|
1760
1815
|
variant: "ghost",
|
|
1761
1816
|
size: "sm",
|
|
1762
1817
|
"aria-label": n,
|
|
1763
|
-
className:
|
|
1764
|
-
onClick:
|
|
1818
|
+
className: T("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Q !== "small" && "text-foreground font-medium"),
|
|
1819
|
+
onClick: Nt,
|
|
1765
1820
|
title: r,
|
|
1766
|
-
children: /* @__PURE__ */
|
|
1821
|
+
children: /* @__PURE__ */ F(e, { className: "h-3.5 w-3.5" })
|
|
1767
1822
|
});
|
|
1768
1823
|
})(),
|
|
1769
|
-
|
|
1770
|
-
t:
|
|
1771
|
-
allFields:
|
|
1772
|
-
showGroup:
|
|
1773
|
-
groupingConfig:
|
|
1774
|
-
setGroupingConfig:
|
|
1775
|
-
showColor:
|
|
1776
|
-
rowColorConfig:
|
|
1777
|
-
setRowColorConfig:
|
|
1778
|
-
showDensity:
|
|
1824
|
+
M.compactToolbar && (M.showGroup || M.showColor || M.showDensity || M.showHideFields) && /* @__PURE__ */ F(He, {
|
|
1825
|
+
t: E,
|
|
1826
|
+
allFields: Xt,
|
|
1827
|
+
showGroup: M.showGroup,
|
|
1828
|
+
groupingConfig: J,
|
|
1829
|
+
setGroupingConfig: ut,
|
|
1830
|
+
showColor: M.showColor,
|
|
1831
|
+
rowColorConfig: Y,
|
|
1832
|
+
setRowColorConfig: mt,
|
|
1833
|
+
showDensity: M.showDensity,
|
|
1779
1834
|
density: Z,
|
|
1780
|
-
showHideFields:
|
|
1781
|
-
hiddenFields:
|
|
1835
|
+
showHideFields: M.showHideFields,
|
|
1836
|
+
hiddenFields: X,
|
|
1782
1837
|
updateHiddenFields: Tt
|
|
1783
1838
|
}),
|
|
1784
|
-
(
|
|
1785
|
-
|
|
1839
|
+
(M.showColor || M.showDensity || M.compactToolbar) && At && A.allowExport !== !1 && /* @__PURE__ */ F("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1840
|
+
At && A.allowExport !== !1 && /* @__PURE__ */ I(S, {
|
|
1786
1841
|
open: Ot,
|
|
1787
1842
|
onOpenChange: kt,
|
|
1788
|
-
children: [/* @__PURE__ */
|
|
1843
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1789
1844
|
asChild: !0,
|
|
1790
|
-
children: /* @__PURE__ */
|
|
1845
|
+
children: /* @__PURE__ */ I(l, {
|
|
1791
1846
|
variant: "ghost",
|
|
1792
1847
|
size: "sm",
|
|
1793
1848
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1794
|
-
children: [/* @__PURE__ */
|
|
1849
|
+
children: [/* @__PURE__ */ F(oe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1795
1850
|
className: "hidden sm:inline",
|
|
1796
|
-
children:
|
|
1851
|
+
children: E("list.export")
|
|
1797
1852
|
})]
|
|
1798
1853
|
})
|
|
1799
|
-
}), /* @__PURE__ */
|
|
1854
|
+
}), /* @__PURE__ */ F(C, {
|
|
1800
1855
|
align: "start",
|
|
1801
1856
|
className: "w-48 p-2",
|
|
1802
|
-
children: /* @__PURE__ */
|
|
1857
|
+
children: /* @__PURE__ */ F("div", {
|
|
1803
1858
|
className: "space-y-1",
|
|
1804
|
-
children: (
|
|
1859
|
+
children: (At.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ I(l, {
|
|
1805
1860
|
variant: "ghost",
|
|
1806
1861
|
size: "sm",
|
|
1807
1862
|
className: "w-full justify-start h-8 text-xs",
|
|
1808
|
-
onClick: () =>
|
|
1809
|
-
children: [/* @__PURE__ */
|
|
1863
|
+
onClick: () => Yt(e),
|
|
1864
|
+
children: [/* @__PURE__ */ F(oe, { className: "h-3.5 w-3.5 mr-2" }), E("list.exportAs", { format: e.toUpperCase() })]
|
|
1810
1865
|
}, e))
|
|
1811
1866
|
})
|
|
1812
1867
|
})]
|
|
1813
1868
|
}),
|
|
1814
|
-
(
|
|
1869
|
+
(A.sharing?.enabled || A.sharing?.type) && /* @__PURE__ */ I(l, {
|
|
1815
1870
|
variant: "ghost",
|
|
1816
1871
|
size: "sm",
|
|
1817
1872
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1818
|
-
title: `Sharing: ${
|
|
1873
|
+
title: `Sharing: ${A.sharing?.visibility || A.sharing?.type || "private"}`,
|
|
1819
1874
|
"data-testid": "share-button",
|
|
1820
|
-
children: [/* @__PURE__ */
|
|
1875
|
+
children: [/* @__PURE__ */ F(xe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1821
1876
|
className: "hidden sm:inline",
|
|
1822
|
-
children:
|
|
1877
|
+
children: E("list.share")
|
|
1823
1878
|
})]
|
|
1824
1879
|
}),
|
|
1825
|
-
|
|
1880
|
+
A.allowPrinting && /* @__PURE__ */ I(l, {
|
|
1826
1881
|
variant: "ghost",
|
|
1827
1882
|
size: "sm",
|
|
1828
1883
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1829
1884
|
onClick: () => window.print(),
|
|
1830
1885
|
"data-testid": "print-button",
|
|
1831
|
-
children: [/* @__PURE__ */
|
|
1886
|
+
children: [/* @__PURE__ */ F(me, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1832
1887
|
className: "hidden sm:inline",
|
|
1833
|
-
children:
|
|
1888
|
+
children: E("list.print")
|
|
1834
1889
|
})]
|
|
1835
1890
|
}),
|
|
1836
1891
|
(() => {
|
|
1837
|
-
let e =
|
|
1838
|
-
return
|
|
1892
|
+
let e = A.allowPrinting || A.sharing?.enabled || A.sharing?.type || At && A.allowExport !== !1;
|
|
1893
|
+
return M.showSearch && e ? /* @__PURE__ */ F("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }) : null;
|
|
1839
1894
|
})(),
|
|
1840
|
-
|
|
1841
|
-
open:
|
|
1842
|
-
onOpenChange:
|
|
1843
|
-
children: [/* @__PURE__ */
|
|
1895
|
+
M.showSearch && /* @__PURE__ */ I(S, {
|
|
1896
|
+
open: De,
|
|
1897
|
+
onOpenChange: Oe,
|
|
1898
|
+
children: [/* @__PURE__ */ F(w, {
|
|
1844
1899
|
asChild: !0,
|
|
1845
|
-
children: /* @__PURE__ */
|
|
1900
|
+
children: /* @__PURE__ */ F(l, {
|
|
1846
1901
|
variant: "ghost",
|
|
1847
1902
|
size: "sm",
|
|
1848
|
-
className:
|
|
1903
|
+
className: T("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", P && "text-foreground font-medium"),
|
|
1849
1904
|
"data-testid": "search-icon-button",
|
|
1850
|
-
title:
|
|
1851
|
-
children: /* @__PURE__ */
|
|
1905
|
+
title: E("list.search"),
|
|
1906
|
+
children: /* @__PURE__ */ F(ye, { className: "h-3.5 w-3.5" })
|
|
1852
1907
|
})
|
|
1853
|
-
}), /* @__PURE__ */
|
|
1908
|
+
}), /* @__PURE__ */ F(C, {
|
|
1854
1909
|
align: "end",
|
|
1855
1910
|
className: "w-[calc(100vw-2rem)] sm:w-64 p-2",
|
|
1856
1911
|
"data-testid": "search-popover",
|
|
1857
|
-
children: /* @__PURE__ */
|
|
1912
|
+
children: /* @__PURE__ */ I("div", {
|
|
1858
1913
|
className: "relative",
|
|
1859
1914
|
children: [
|
|
1860
|
-
/* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
1862
|
-
placeholder:
|
|
1863
|
-
value:
|
|
1864
|
-
onChange: (e) =>
|
|
1915
|
+
/* @__PURE__ */ F(ye, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
1916
|
+
/* @__PURE__ */ F(y, {
|
|
1917
|
+
placeholder: E("list.search") + "...",
|
|
1918
|
+
value: P,
|
|
1919
|
+
onChange: (e) => Wt(e.target.value),
|
|
1865
1920
|
className: "pl-7 h-8 text-xs",
|
|
1866
1921
|
autoFocus: !0
|
|
1867
1922
|
}),
|
|
1868
|
-
|
|
1923
|
+
P && /* @__PURE__ */ F(l, {
|
|
1869
1924
|
variant: "ghost",
|
|
1870
1925
|
size: "sm",
|
|
1871
1926
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
1872
|
-
onClick: () =>
|
|
1873
|
-
children: /* @__PURE__ */
|
|
1927
|
+
onClick: () => Wt(""),
|
|
1928
|
+
children: /* @__PURE__ */ F(we, { className: "h-3 w-3" })
|
|
1874
1929
|
})
|
|
1875
1930
|
]
|
|
1876
1931
|
})
|
|
1877
1932
|
})]
|
|
1878
1933
|
}),
|
|
1879
|
-
|
|
1934
|
+
M.showAddRecord && M.addRecordPosition === "top" && /* @__PURE__ */ I(l, {
|
|
1880
1935
|
variant: "ghost",
|
|
1881
1936
|
size: "sm",
|
|
1882
1937
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1883
1938
|
"data-testid": "add-record-button",
|
|
1884
1939
|
onClick: () => g.onAddRecord?.(),
|
|
1885
|
-
children: [/* @__PURE__ */
|
|
1940
|
+
children: [/* @__PURE__ */ F(pe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1886
1941
|
className: "hidden sm:inline",
|
|
1887
|
-
children:
|
|
1942
|
+
children: E("list.addRecord")
|
|
1888
1943
|
})]
|
|
1889
1944
|
})
|
|
1890
1945
|
]
|
|
1891
1946
|
})]
|
|
1892
1947
|
}),
|
|
1893
|
-
|
|
1894
|
-
className: "hidden sm:flex border-b px-2 sm:px-4 py-1 items-center gap-1 flex-wrap bg-background",
|
|
1895
|
-
"data-testid": "quick-filters",
|
|
1896
|
-
children: Y.map((e) => {
|
|
1897
|
-
let t = vt.has(e.id), n = e.icon ? we[e.icon.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
1898
|
-
return /* @__PURE__ */ P(d, {
|
|
1899
|
-
variant: t ? "default" : "outline",
|
|
1900
|
-
size: "sm",
|
|
1901
|
-
className: "h-7 px-3 text-xs",
|
|
1902
|
-
onClick: () => Kt(e.id),
|
|
1903
|
-
children: [n && /* @__PURE__ */ N(n, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
1904
|
-
}, e.id);
|
|
1905
|
-
})
|
|
1906
|
-
}),
|
|
1907
|
-
/* @__PURE__ */ P("div", {
|
|
1948
|
+
/* @__PURE__ */ I("div", {
|
|
1908
1949
|
className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
|
|
1909
|
-
children: [/* @__PURE__ */
|
|
1950
|
+
children: [/* @__PURE__ */ F(ee, { active: H && V.length > 0 }), We && V.length === 0 ? /* @__PURE__ */ F(f, {
|
|
1951
|
+
"data-testid": "list-error-state",
|
|
1952
|
+
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
1953
|
+
icon: /* @__PURE__ */ F(re, { className: "h-12 w-12 text-destructive/60" }),
|
|
1954
|
+
iconWrapperClassName: "mb-3",
|
|
1955
|
+
title: E("list.loadErrorTitle"),
|
|
1956
|
+
description: E("list.loadErrorMessage"),
|
|
1957
|
+
action: /* @__PURE__ */ I(l, {
|
|
1958
|
+
variant: "outline",
|
|
1959
|
+
size: "sm",
|
|
1960
|
+
"data-testid": "list-error-retry",
|
|
1961
|
+
onClick: () => G((e) => e + 1),
|
|
1962
|
+
children: [/* @__PURE__ */ F(he, { className: "h-4 w-4 mr-1.5" }), E("list.retry")]
|
|
1963
|
+
})
|
|
1964
|
+
}) : H && V.length === 0 ? /* @__PURE__ */ I("div", {
|
|
1910
1965
|
className: "flex flex-col h-full min-h-[200px] p-4 gap-2",
|
|
1911
1966
|
"data-testid": "list-loading",
|
|
1912
1967
|
role: "status",
|
|
1913
1968
|
"aria-live": "polite",
|
|
1914
1969
|
"aria-busy": "true",
|
|
1915
|
-
children: [/* @__PURE__ */
|
|
1970
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1916
1971
|
className: "sr-only",
|
|
1917
|
-
children:
|
|
1972
|
+
children: E("list.loading")
|
|
1918
1973
|
}), [
|
|
1919
1974
|
0,
|
|
1920
1975
|
1,
|
|
@@ -1922,112 +1977,122 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
1922
1977
|
3,
|
|
1923
1978
|
4,
|
|
1924
1979
|
5
|
|
1925
|
-
].map((e) => /* @__PURE__ */
|
|
1980
|
+
].map((e) => /* @__PURE__ */ F("div", {
|
|
1926
1981
|
className: "h-9 rounded bg-muted/60 animate-pulse",
|
|
1927
1982
|
style: { opacity: Math.max(.25, 1 - e * .12) }
|
|
1928
1983
|
}, e))]
|
|
1929
|
-
}) : !
|
|
1930
|
-
let e =
|
|
1931
|
-
return /* @__PURE__ */
|
|
1984
|
+
}) : !H && V.length === 0 && N === "grid" ? (() => {
|
|
1985
|
+
let e = A.emptyState?.icon, t = e ? Te[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? ue : ue, n = !!(P && P.trim()) || Array.isArray(bt) && bt.length > 0 || Array.isArray(z?.conditions) && z.conditions.length > 0, r = (typeof A.emptyState?.title == "string" ? A.emptyState.title : void 0) ?? E(n ? "list.noMatches" : "list.firstRunTitle"), i = (typeof A.emptyState?.message == "string" ? A.emptyState.message : void 0) ?? E(n ? "list.noMatchesMessage" : "list.firstRunMessage");
|
|
1986
|
+
return /* @__PURE__ */ F(f, {
|
|
1932
1987
|
"data-testid": "empty-state",
|
|
1933
1988
|
className: "h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md",
|
|
1934
|
-
icon: /* @__PURE__ */
|
|
1989
|
+
icon: /* @__PURE__ */ F(t, { className: "h-12 w-12 text-muted-foreground/50" }),
|
|
1935
1990
|
iconWrapperClassName: "mb-3",
|
|
1936
|
-
title:
|
|
1937
|
-
description:
|
|
1938
|
-
action:
|
|
1991
|
+
title: r,
|
|
1992
|
+
description: i,
|
|
1993
|
+
action: M.showAddRecord ? /* @__PURE__ */ I(l, {
|
|
1939
1994
|
variant: "default",
|
|
1940
1995
|
size: "sm",
|
|
1941
1996
|
"data-testid": "empty-state-add-record",
|
|
1942
1997
|
onClick: () => g.onAddRecord?.(),
|
|
1943
|
-
children: [/* @__PURE__ */
|
|
1998
|
+
children: [/* @__PURE__ */ F(pe, { className: "h-4 w-4 mr-1.5" }), E("list.addRecord")]
|
|
1944
1999
|
}) : void 0
|
|
1945
2000
|
});
|
|
1946
|
-
})() : /* @__PURE__ */
|
|
1947
|
-
schema:
|
|
2001
|
+
})() : /* @__PURE__ */ F(Ae, {
|
|
2002
|
+
schema: Kt,
|
|
1948
2003
|
...g,
|
|
1949
|
-
data:
|
|
1950
|
-
loading:
|
|
1951
|
-
onRowSelect:
|
|
2004
|
+
data: V,
|
|
2005
|
+
loading: H,
|
|
2006
|
+
onRowSelect: vt,
|
|
2007
|
+
...N === "grid" && !J?.fields?.length && ct != null ? {
|
|
2008
|
+
manualPagination: !0,
|
|
2009
|
+
rowCount: ct,
|
|
2010
|
+
page: ot,
|
|
2011
|
+
pageSize: K,
|
|
2012
|
+
onPageChange: (e) => st(e),
|
|
2013
|
+
onPageSizeChange: (e) => {
|
|
2014
|
+
at(e), st(1);
|
|
2015
|
+
}
|
|
2016
|
+
} : {}
|
|
1952
2017
|
})]
|
|
1953
|
-
},
|
|
1954
|
-
|
|
2018
|
+
}, N),
|
|
2019
|
+
M.showAddRecord && M.addRecordPosition === "bottom" && /* @__PURE__ */ F("div", {
|
|
1955
2020
|
className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
|
|
1956
|
-
children: /* @__PURE__ */
|
|
2021
|
+
children: /* @__PURE__ */ I(l, {
|
|
1957
2022
|
variant: "ghost",
|
|
1958
2023
|
size: "sm",
|
|
1959
2024
|
className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1960
2025
|
"data-testid": "add-record-button",
|
|
1961
2026
|
onClick: () => g.onAddRecord?.(),
|
|
1962
|
-
children: [/* @__PURE__ */
|
|
2027
|
+
children: [/* @__PURE__ */ F(pe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ F("span", {
|
|
1963
2028
|
className: "hidden sm:inline",
|
|
1964
|
-
children:
|
|
2029
|
+
children: E("list.addRecord")
|
|
1965
2030
|
})]
|
|
1966
2031
|
})
|
|
1967
2032
|
}),
|
|
1968
|
-
|
|
2033
|
+
A.bulkActions && A.bulkActions.length > 0 && _t.length > 0 && N !== "grid" && /* @__PURE__ */ I("div", {
|
|
1969
2034
|
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",
|
|
1970
2035
|
role: "region",
|
|
1971
2036
|
"aria-label": "Bulk actions",
|
|
1972
2037
|
"data-testid": "bulk-actions-bar",
|
|
1973
2038
|
children: [
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
/* @__PURE__ */
|
|
2039
|
+
/* @__PURE__ */ F(ae, { className: "h-3.5 w-3.5 text-primary shrink-0" }),
|
|
2040
|
+
/* @__PURE__ */ I("span", {
|
|
1976
2041
|
className: "font-medium",
|
|
1977
2042
|
children: [
|
|
1978
|
-
|
|
2043
|
+
_t.length,
|
|
1979
2044
|
" ",
|
|
1980
|
-
|
|
2045
|
+
_t.length === 1 ? "item" : "items",
|
|
1981
2046
|
" selected"
|
|
1982
2047
|
]
|
|
1983
2048
|
}),
|
|
1984
|
-
/* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ F("div", {
|
|
1985
2050
|
className: "flex items-center gap-1.5 ml-3",
|
|
1986
|
-
children:
|
|
1987
|
-
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ?
|
|
1988
|
-
return /* @__PURE__ */
|
|
2051
|
+
children: A.bulkActions.map((e) => {
|
|
2052
|
+
let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ? Ce : null;
|
|
2053
|
+
return /* @__PURE__ */ I(l, {
|
|
1989
2054
|
variant: n ? "destructive" : "outline",
|
|
1990
2055
|
size: "sm",
|
|
1991
2056
|
className: "h-7 px-2.5 text-xs gap-1.5",
|
|
1992
|
-
onClick: () => g.onBulkAction?.(e,
|
|
2057
|
+
onClick: () => g.onBulkAction?.(e, _t),
|
|
1993
2058
|
"data-testid": `bulk-action-${e}`,
|
|
1994
|
-
children: [r && /* @__PURE__ */
|
|
2059
|
+
children: [r && /* @__PURE__ */ F(r, { className: "h-3 w-3" }), ce(e)]
|
|
1995
2060
|
}, e);
|
|
1996
2061
|
})
|
|
1997
2062
|
}),
|
|
1998
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ I(l, {
|
|
1999
2064
|
variant: "ghost",
|
|
2000
2065
|
size: "sm",
|
|
2001
2066
|
className: "h-7 px-2 text-xs ml-auto gap-1",
|
|
2002
|
-
onClick: () =>
|
|
2003
|
-
children: [/* @__PURE__ */
|
|
2067
|
+
onClick: () => vt([]),
|
|
2068
|
+
children: [/* @__PURE__ */ F(we, { className: "h-3 w-3" }), "Clear"]
|
|
2004
2069
|
})
|
|
2005
2070
|
]
|
|
2006
2071
|
}),
|
|
2007
|
-
!
|
|
2072
|
+
!H && V.length > 0 && A.showRecordCount !== !1 && /* @__PURE__ */ I("div", {
|
|
2008
2073
|
className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
|
|
2009
2074
|
"data-testid": "record-count-bar",
|
|
2010
2075
|
children: [
|
|
2011
|
-
/* @__PURE__ */
|
|
2076
|
+
/* @__PURE__ */ F("span", {
|
|
2012
2077
|
className: "font-medium text-foreground/80",
|
|
2013
|
-
children:
|
|
2078
|
+
children: V.length === 1 ? E("list.recordCountOne", { count: V.length }) : E("list.recordCount", { count: V.length })
|
|
2014
2079
|
}),
|
|
2015
|
-
|
|
2080
|
+
nt && /* @__PURE__ */ F("span", {
|
|
2016
2081
|
className: "text-amber-600",
|
|
2017
2082
|
"data-testid": "data-limit-warning",
|
|
2018
|
-
children:
|
|
2083
|
+
children: E("list.dataLimitReached", { limit: K })
|
|
2019
2084
|
}),
|
|
2020
|
-
|
|
2085
|
+
N !== "grid" && A.pagination?.pageSizeOptions && A.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ I("div", {
|
|
2021
2086
|
className: "ml-auto flex items-center gap-2",
|
|
2022
|
-
children: [/* @__PURE__ */
|
|
2087
|
+
children: [/* @__PURE__ */ F("span", { children: E("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ F("select", {
|
|
2023
2088
|
"data-testid": "page-size-selector",
|
|
2024
2089
|
className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
|
|
2025
|
-
value: String(
|
|
2090
|
+
value: String(K),
|
|
2026
2091
|
onChange: (e) => {
|
|
2027
2092
|
let t = Number(e.target.value);
|
|
2028
|
-
|
|
2093
|
+
at(t), g.onPageSizeChange && g.onPageSizeChange(t);
|
|
2029
2094
|
},
|
|
2030
|
-
children:
|
|
2095
|
+
children: A.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ F("option", {
|
|
2031
2096
|
value: String(e),
|
|
2032
2097
|
children: e
|
|
2033
2098
|
}, e))
|
|
@@ -2035,17 +2100,17 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
2035
2100
|
})
|
|
2036
2101
|
]
|
|
2037
2102
|
}),
|
|
2038
|
-
|
|
2039
|
-
...
|
|
2040
|
-
title:
|
|
2041
|
-
children: (e) => /* @__PURE__ */
|
|
2103
|
+
Gt.isOverlay && /* @__PURE__ */ F(x, {
|
|
2104
|
+
...Gt,
|
|
2105
|
+
title: A.label ? `${A.label} Detail` : A.objectName ? `${A.objectName.charAt(0).toUpperCase() + A.objectName.slice(1)} Detail` : "Record Detail",
|
|
2106
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
2042
2107
|
className: "space-y-3",
|
|
2043
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
2108
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
2044
2109
|
className: "flex flex-col",
|
|
2045
|
-
children: [/* @__PURE__ */
|
|
2110
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2046
2111
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
2047
2112
|
children: e.replace(/_/g, " ")
|
|
2048
|
-
}), /* @__PURE__ */
|
|
2113
|
+
}), /* @__PURE__ */ F("span", {
|
|
2049
2114
|
className: "text-sm",
|
|
2050
2115
|
children: String(t ?? "—")
|
|
2051
2116
|
})]
|
|
@@ -2055,24 +2120,24 @@ var U = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
|
|
|
2055
2120
|
]
|
|
2056
2121
|
});
|
|
2057
2122
|
});
|
|
2058
|
-
|
|
2123
|
+
nt.displayName = "ListView";
|
|
2059
2124
|
//#endregion
|
|
2060
2125
|
//#region src/ObjectGallery.tsx
|
|
2061
|
-
var
|
|
2126
|
+
var rt = {
|
|
2062
2127
|
small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
|
|
2063
2128
|
medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
2064
2129
|
large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
2065
|
-
},
|
|
2130
|
+
}, it = {
|
|
2066
2131
|
small: "aspect-square",
|
|
2067
2132
|
medium: "aspect-[4/3]",
|
|
2068
2133
|
large: "aspect-[16/10]"
|
|
2069
|
-
},
|
|
2134
|
+
}, at = new Set([
|
|
2070
2135
|
"number",
|
|
2071
2136
|
"currency",
|
|
2072
2137
|
"percent",
|
|
2073
2138
|
"integer",
|
|
2074
2139
|
"decimal"
|
|
2075
|
-
]),
|
|
2140
|
+
]), K = [
|
|
2076
2141
|
{
|
|
2077
2142
|
bg: "from-indigo-500/15 via-indigo-500/5 to-purple-500/10",
|
|
2078
2143
|
ring: "ring-indigo-500/15",
|
|
@@ -2104,17 +2169,60 @@ var it = {
|
|
|
2104
2169
|
text: "text-violet-600/70 dark:text-violet-300/70"
|
|
2105
2170
|
}
|
|
2106
2171
|
];
|
|
2107
|
-
function
|
|
2172
|
+
function ot(e) {
|
|
2108
2173
|
let t = 5381;
|
|
2109
2174
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n);
|
|
2110
|
-
return
|
|
2175
|
+
return K[Math.abs(t) % K.length];
|
|
2111
2176
|
}
|
|
2112
|
-
var
|
|
2113
|
-
let
|
|
2177
|
+
var st = ({ imageUrl: e, title: t, coverFit: n, aspectClass: r, placeholder: i, hidden: a }) => {
|
|
2178
|
+
let [o, s] = c(!1), l = !!e && !o;
|
|
2179
|
+
return /* @__PURE__ */ F("div", {
|
|
2180
|
+
className: T("w-full overflow-hidden relative", r),
|
|
2181
|
+
hidden: a,
|
|
2182
|
+
children: l ? n === "contain" ? /* @__PURE__ */ F("div", {
|
|
2183
|
+
className: T("flex h-full w-full items-center justify-center bg-gradient-to-br", i.bg),
|
|
2184
|
+
children: /* @__PURE__ */ F("img", {
|
|
2185
|
+
src: e,
|
|
2186
|
+
alt: t,
|
|
2187
|
+
loading: "lazy",
|
|
2188
|
+
onError: () => s(!0),
|
|
2189
|
+
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]"
|
|
2190
|
+
})
|
|
2191
|
+
}) : /* @__PURE__ */ F("img", {
|
|
2192
|
+
src: e,
|
|
2193
|
+
alt: t,
|
|
2194
|
+
loading: "lazy",
|
|
2195
|
+
onError: () => s(!0),
|
|
2196
|
+
className: "h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-[1.04]"
|
|
2197
|
+
}) : /* @__PURE__ */ F("div", {
|
|
2198
|
+
className: T("flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset", i.bg, i.ring),
|
|
2199
|
+
children: /* @__PURE__ */ F("span", {
|
|
2200
|
+
className: T("text-5xl font-semibold tracking-tight opacity-90", i.text),
|
|
2201
|
+
children: t[0]?.toUpperCase()
|
|
2202
|
+
})
|
|
2203
|
+
})
|
|
2204
|
+
});
|
|
2205
|
+
}, ct = ({ imageUrl: e, title: t, placeholder: n }) => {
|
|
2206
|
+
let [r, i] = c(!1), a = !!e && !r;
|
|
2207
|
+
return /* @__PURE__ */ F("div", {
|
|
2208
|
+
className: T("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),
|
|
2209
|
+
children: a ? /* @__PURE__ */ F("img", {
|
|
2210
|
+
src: e,
|
|
2211
|
+
alt: t,
|
|
2212
|
+
loading: "lazy",
|
|
2213
|
+
onError: () => i(!0),
|
|
2214
|
+
className: "h-6 w-6 object-contain transition-transform duration-300 ease-out group-hover:scale-110"
|
|
2215
|
+
}) : /* @__PURE__ */ F("span", {
|
|
2216
|
+
className: T("text-base font-semibold", n.text),
|
|
2217
|
+
children: t[0]?.toUpperCase()
|
|
2218
|
+
})
|
|
2219
|
+
});
|
|
2220
|
+
}, lt = (e) => {
|
|
2221
|
+
let { schema: n } = e, r = a(je), l = e.dataSource || r?.dataSource, f = Me(n.bind), [p, m] = c([]), [h, g] = c(!1), [_, v] = c(null), y = Pe({
|
|
2114
2222
|
navigation: n.navigation,
|
|
2115
2223
|
objectName: n.objectName,
|
|
2116
2224
|
onRowClick: e.onRowClick ?? e.onCardClick
|
|
2117
|
-
}),
|
|
2225
|
+
}), b = n.gallery, S = b?.coverField ?? n.imageField ?? "image", C = b?.coverFit ?? "cover", w = b?.cardSize ?? "medium", ee = b?.titleField ?? n.titleField ?? "name", te = b?.visibleFields, { fieldLabel: ne, fieldOptionLabel: re } = L(), ie = i((e) => {
|
|
2118
2226
|
let t = _?.fields?.[e], r = { name: e };
|
|
2119
2227
|
if (t) {
|
|
2120
2228
|
t.type && (r.type = t.type), t.label && (r.label = t.label), t.options && (r.options = t.options), t.currency && (r.currency = t.currency), t.precision !== void 0 && (r.precision = t.precision), t.format && (r.format = t.format);
|
|
@@ -2123,27 +2231,27 @@ var G = (e) => {
|
|
|
2123
2231
|
}
|
|
2124
2232
|
if (n.objectName) {
|
|
2125
2233
|
let t = String(r.label ?? e);
|
|
2126
|
-
r.label =
|
|
2234
|
+
r.label = ne(n.objectName, e, t);
|
|
2127
2235
|
}
|
|
2128
2236
|
return n.objectName && Array.isArray(r.options) && (r.options = r.options.map((t) => {
|
|
2129
2237
|
let r = String(t?.value ?? t), i = String(t?.label ?? r);
|
|
2130
2238
|
return {
|
|
2131
2239
|
...t,
|
|
2132
2240
|
value: r,
|
|
2133
|
-
label:
|
|
2241
|
+
label: re(n.objectName, e, r, i)
|
|
2134
2242
|
};
|
|
2135
2243
|
})), r;
|
|
2136
2244
|
}, [
|
|
2137
2245
|
_,
|
|
2138
2246
|
n.objectName,
|
|
2139
|
-
|
|
2140
|
-
|
|
2247
|
+
ne,
|
|
2248
|
+
re
|
|
2141
2249
|
]);
|
|
2142
|
-
|
|
2250
|
+
o(() => {
|
|
2143
2251
|
let e = !0;
|
|
2144
2252
|
return (async () => {
|
|
2145
|
-
if (!(!
|
|
2146
|
-
let t = await
|
|
2253
|
+
if (!(!l || typeof l.getObjectSchema != "function" || !n.objectName)) try {
|
|
2254
|
+
let t = await l.getObjectSchema(n.objectName);
|
|
2147
2255
|
e && v(t);
|
|
2148
2256
|
} catch (e) {
|
|
2149
2257
|
console.warn("Failed to fetch object def for ObjectGallery", e);
|
|
@@ -2151,26 +2259,26 @@ var G = (e) => {
|
|
|
2151
2259
|
})(), () => {
|
|
2152
2260
|
e = !1;
|
|
2153
2261
|
};
|
|
2154
|
-
}, [n.objectName,
|
|
2262
|
+
}, [n.objectName, l]), o(() => {
|
|
2155
2263
|
let r = !0;
|
|
2156
2264
|
if (e.data && Array.isArray(e.data)) {
|
|
2157
2265
|
m(e.data);
|
|
2158
2266
|
return;
|
|
2159
2267
|
}
|
|
2160
|
-
return n.objectName && !
|
|
2161
|
-
if (!(!
|
|
2268
|
+
return n.objectName && !f && !n.data && !e.data && (async () => {
|
|
2269
|
+
if (!(!l || typeof l.find != "function" || !n.objectName)) {
|
|
2162
2270
|
r && g(!0);
|
|
2163
2271
|
try {
|
|
2164
|
-
let e = t(_?.fields),
|
|
2272
|
+
let e = t(_?.fields), i = await l.find(n.objectName, {
|
|
2165
2273
|
$filter: n.filter,
|
|
2166
2274
|
...e.length > 0 ? { $expand: e } : {}
|
|
2167
|
-
}),
|
|
2168
|
-
if (Array.isArray(
|
|
2169
|
-
else if (
|
|
2170
|
-
let e =
|
|
2171
|
-
Array.isArray(e.records) ?
|
|
2275
|
+
}), a = [];
|
|
2276
|
+
if (Array.isArray(i)) a = i;
|
|
2277
|
+
else if (i && typeof i == "object") {
|
|
2278
|
+
let e = i;
|
|
2279
|
+
Array.isArray(e.records) ? a = e.records : Array.isArray(e.data) && (a = e.data);
|
|
2172
2280
|
}
|
|
2173
|
-
r && m(
|
|
2281
|
+
r && m(a);
|
|
2174
2282
|
} catch (e) {
|
|
2175
2283
|
console.error("[ObjectGallery] Fetch error:", e);
|
|
2176
2284
|
} finally {
|
|
@@ -2182,25 +2290,25 @@ var G = (e) => {
|
|
|
2182
2290
|
};
|
|
2183
2291
|
}, [
|
|
2184
2292
|
n.objectName,
|
|
2185
|
-
|
|
2186
|
-
|
|
2293
|
+
l,
|
|
2294
|
+
f,
|
|
2187
2295
|
n.data,
|
|
2188
2296
|
n.filter,
|
|
2189
2297
|
e.data,
|
|
2190
2298
|
_
|
|
2191
2299
|
]);
|
|
2192
|
-
let
|
|
2193
|
-
|
|
2300
|
+
let E = e.data || f || n.data || p || [], D = s(() => E.some((e) => typeof e[S] == "string" && !!e[S]), [E, S]), O = n.grouping?.fields, ae = !!(O && O.length > 0), [oe, se] = c({}), j = s(() => O ? O.some((e) => e.collapsed) : !1, [O]), ce = i((e) => {
|
|
2301
|
+
se((t) => ({
|
|
2194
2302
|
...t,
|
|
2195
|
-
[e]: t[e] === void 0 ? !
|
|
2303
|
+
[e]: t[e] === void 0 ? !j : !t[e]
|
|
2196
2304
|
}));
|
|
2197
|
-
}, [
|
|
2198
|
-
if (!
|
|
2305
|
+
}, [j]), le = s(() => {
|
|
2306
|
+
if (!ae || !O) return [];
|
|
2199
2307
|
let e = /* @__PURE__ */ new Map(), t = [];
|
|
2200
|
-
for (let n of
|
|
2201
|
-
let r =
|
|
2308
|
+
for (let n of E) {
|
|
2309
|
+
let r = O.map((e) => String(n[e.field] ?? "")).join(" / ");
|
|
2202
2310
|
if (!e.has(r)) {
|
|
2203
|
-
let i =
|
|
2311
|
+
let i = O.map((e) => {
|
|
2204
2312
|
let t = n[e.field];
|
|
2205
2313
|
return t != null && t !== "" ? String(t) : "(empty)";
|
|
2206
2314
|
}).join(" / ");
|
|
@@ -2211,7 +2319,7 @@ var G = (e) => {
|
|
|
2211
2319
|
}
|
|
2212
2320
|
e.get(r).items.push(n);
|
|
2213
2321
|
}
|
|
2214
|
-
let n =
|
|
2322
|
+
let n = O[0]?.order ?? "asc";
|
|
2215
2323
|
return t.sort((e, t) => {
|
|
2216
2324
|
let r = e.localeCompare(t, void 0, {
|
|
2217
2325
|
numeric: !0,
|
|
@@ -2219,7 +2327,7 @@ var G = (e) => {
|
|
|
2219
2327
|
});
|
|
2220
2328
|
return n === "desc" ? -r : r;
|
|
2221
2329
|
}), t.map((t) => {
|
|
2222
|
-
let n = e.get(t), r = t in
|
|
2330
|
+
let n = e.get(t), r = t in oe ? oe[t] : j;
|
|
2223
2331
|
return {
|
|
2224
2332
|
key: t,
|
|
2225
2333
|
label: n.label,
|
|
@@ -2228,110 +2336,128 @@ var G = (e) => {
|
|
|
2228
2336
|
};
|
|
2229
2337
|
});
|
|
2230
2338
|
}, [
|
|
2231
|
-
|
|
2232
|
-
|
|
2339
|
+
E,
|
|
2340
|
+
O,
|
|
2341
|
+
ae,
|
|
2233
2342
|
oe,
|
|
2234
|
-
|
|
2235
|
-
A
|
|
2343
|
+
j
|
|
2236
2344
|
]);
|
|
2237
|
-
if (h && !
|
|
2345
|
+
if (h && !E.length) return /* @__PURE__ */ F("div", {
|
|
2238
2346
|
className: "p-4 text-sm text-muted-foreground",
|
|
2239
2347
|
children: "Loading Gallery..."
|
|
2240
2348
|
});
|
|
2241
|
-
if (!
|
|
2349
|
+
if (!E.length) return /* @__PURE__ */ F("div", {
|
|
2242
2350
|
className: "p-4 text-sm text-muted-foreground",
|
|
2243
2351
|
children: "No items to display"
|
|
2244
2352
|
});
|
|
2245
|
-
let
|
|
2246
|
-
|
|
2247
|
-
|
|
2353
|
+
let M = (e) => !te || te.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
2354
|
+
className: "mt-1.5 space-y-1",
|
|
2355
|
+
children: te.map((t) => {
|
|
2356
|
+
let n = e[t];
|
|
2357
|
+
if (n == null || n === "") return null;
|
|
2358
|
+
let r = ie(t), i = Re(r) || r.type || "text", a = Le(i), o = r?.label && String(r.label).trim() ? String(r.label) : void 0, s = o != null && at.has(i);
|
|
2359
|
+
return /* @__PURE__ */ I("div", {
|
|
2360
|
+
className: T("text-xs text-muted-foreground truncate [&_*]:!text-xs", s && "flex items-baseline gap-1.5"),
|
|
2361
|
+
onClick: (e) => {
|
|
2362
|
+
e.target.closest("a,button") && e.stopPropagation();
|
|
2363
|
+
},
|
|
2364
|
+
children: [s && /* @__PURE__ */ F("span", {
|
|
2365
|
+
className: "shrink-0 text-muted-foreground/70 tabular-nums",
|
|
2366
|
+
children: o
|
|
2367
|
+
}), /* @__PURE__ */ F(a, {
|
|
2368
|
+
value: n,
|
|
2369
|
+
field: r
|
|
2370
|
+
})]
|
|
2371
|
+
}, t);
|
|
2372
|
+
})
|
|
2373
|
+
}), ue = (t, r) => {
|
|
2374
|
+
let i = t.id ?? t._id ?? r, a = String(t[ee] ?? "Untitled"), o = t[S], s = ot(String(i) + "|" + a), c = T("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 || n.navigation) && "cursor-pointer");
|
|
2375
|
+
return D && C === "contain" ? /* @__PURE__ */ I(u, {
|
|
2248
2376
|
role: "listitem",
|
|
2249
|
-
className:
|
|
2250
|
-
onClick: (e) =>
|
|
2377
|
+
className: c,
|
|
2378
|
+
onClick: (e) => y.handleClick(t, e),
|
|
2379
|
+
children: [/* @__PURE__ */ F("div", {
|
|
2380
|
+
"aria-hidden": !0,
|
|
2381
|
+
className: T("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", s.bg)
|
|
2382
|
+
}), /* @__PURE__ */ F(d, {
|
|
2383
|
+
className: "p-4",
|
|
2384
|
+
children: /* @__PURE__ */ I("div", {
|
|
2385
|
+
className: "flex items-start gap-3",
|
|
2386
|
+
children: [/* @__PURE__ */ F(ct, {
|
|
2387
|
+
imageUrl: o,
|
|
2388
|
+
title: a,
|
|
2389
|
+
placeholder: s
|
|
2390
|
+
}), /* @__PURE__ */ I("div", {
|
|
2391
|
+
className: "min-w-0 flex-1",
|
|
2392
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
2393
|
+
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2394
|
+
title: a,
|
|
2395
|
+
children: a
|
|
2396
|
+
}), M(t)]
|
|
2397
|
+
})]
|
|
2398
|
+
})
|
|
2399
|
+
})]
|
|
2400
|
+
}, i) : /* @__PURE__ */ I(u, {
|
|
2401
|
+
role: "listitem",
|
|
2402
|
+
className: c,
|
|
2403
|
+
onClick: (e) => y.handleClick(t, e),
|
|
2251
2404
|
children: [
|
|
2252
|
-
!
|
|
2405
|
+
!D && /* @__PURE__ */ F("div", {
|
|
2253
2406
|
"aria-hidden": !0,
|
|
2254
|
-
className:
|
|
2407
|
+
className: T("absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r", s.bg)
|
|
2255
2408
|
}),
|
|
2256
|
-
/* @__PURE__ */
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
}) : /* @__PURE__ */ N("div", {
|
|
2264
|
-
className: w("flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset", s.bg, s.ring),
|
|
2265
|
-
children: /* @__PURE__ */ N("span", {
|
|
2266
|
-
className: w("text-5xl font-semibold tracking-tight opacity-90", s.text),
|
|
2267
|
-
children: a[0]?.toUpperCase()
|
|
2268
|
-
})
|
|
2269
|
-
})
|
|
2409
|
+
/* @__PURE__ */ F(st, {
|
|
2410
|
+
imageUrl: o,
|
|
2411
|
+
title: a,
|
|
2412
|
+
coverFit: C,
|
|
2413
|
+
aspectClass: it[w],
|
|
2414
|
+
placeholder: s,
|
|
2415
|
+
hidden: !D
|
|
2270
2416
|
}),
|
|
2271
|
-
/* @__PURE__ */
|
|
2272
|
-
className:
|
|
2273
|
-
children: [/* @__PURE__ */
|
|
2417
|
+
/* @__PURE__ */ I(d, {
|
|
2418
|
+
className: T("p-3", D && "border-t border-border/60"),
|
|
2419
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
2274
2420
|
className: "font-semibold tracking-tight truncate text-sm leading-tight text-foreground",
|
|
2275
2421
|
title: a,
|
|
2276
2422
|
children: a
|
|
2277
|
-
}),
|
|
2278
|
-
className: "mt-1.5 space-y-1",
|
|
2279
|
-
children: C.map((e) => {
|
|
2280
|
-
let n = t[e];
|
|
2281
|
-
if (n == null || n === "") return null;
|
|
2282
|
-
let r = ae(e), i = Le(r) || r.type || "text", a = Ie(i), o = r?.label && String(r.label).trim() ? String(r.label) : void 0, s = o != null && ot.has(i);
|
|
2283
|
-
return /* @__PURE__ */ P("div", {
|
|
2284
|
-
className: w("text-xs text-muted-foreground truncate [&_*]:!text-xs", s && "flex items-baseline gap-1.5"),
|
|
2285
|
-
onClick: (e) => {
|
|
2286
|
-
e.target.closest("a,button") && e.stopPropagation();
|
|
2287
|
-
},
|
|
2288
|
-
children: [s && /* @__PURE__ */ N("span", {
|
|
2289
|
-
className: "shrink-0 text-muted-foreground/70 tabular-nums",
|
|
2290
|
-
children: o
|
|
2291
|
-
}), /* @__PURE__ */ N(a, {
|
|
2292
|
-
value: n,
|
|
2293
|
-
field: r
|
|
2294
|
-
})]
|
|
2295
|
-
}, e);
|
|
2296
|
-
})
|
|
2297
|
-
})]
|
|
2423
|
+
}), M(t)]
|
|
2298
2424
|
})
|
|
2299
2425
|
]
|
|
2300
2426
|
}, i);
|
|
2301
|
-
},
|
|
2302
|
-
className:
|
|
2427
|
+
}, N = (e) => /* @__PURE__ */ F("div", {
|
|
2428
|
+
className: T("grid gap-4 p-4 auto-rows-min content-start", rt[w], n.className),
|
|
2303
2429
|
role: "list",
|
|
2304
2430
|
children: e.map((e, t) => ue(e, t))
|
|
2305
2431
|
});
|
|
2306
|
-
return /* @__PURE__ */
|
|
2432
|
+
return /* @__PURE__ */ I(Ee, { children: [ae ? /* @__PURE__ */ F("div", {
|
|
2307
2433
|
className: "space-y-2",
|
|
2308
|
-
children:
|
|
2434
|
+
children: le.map((e) => /* @__PURE__ */ I("div", {
|
|
2309
2435
|
className: "border rounded-md",
|
|
2310
|
-
children: [/* @__PURE__ */
|
|
2436
|
+
children: [/* @__PURE__ */ I("button", {
|
|
2311
2437
|
type: "button",
|
|
2312
2438
|
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",
|
|
2313
|
-
onClick: () =>
|
|
2439
|
+
onClick: () => ce(e.key),
|
|
2314
2440
|
children: [
|
|
2315
|
-
e.collapsed ? /* @__PURE__ */
|
|
2316
|
-
/* @__PURE__ */
|
|
2317
|
-
/* @__PURE__ */
|
|
2441
|
+
e.collapsed ? /* @__PURE__ */ F(A, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ F(k, { className: "h-4 w-4 shrink-0" }),
|
|
2442
|
+
/* @__PURE__ */ F("span", { children: e.label }),
|
|
2443
|
+
/* @__PURE__ */ F("span", {
|
|
2318
2444
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2319
2445
|
children: e.items.length
|
|
2320
2446
|
})
|
|
2321
2447
|
]
|
|
2322
|
-
}), !e.collapsed &&
|
|
2448
|
+
}), !e.collapsed && N(e.items)]
|
|
2323
2449
|
}, e.key))
|
|
2324
|
-
}) :
|
|
2325
|
-
...
|
|
2450
|
+
}) : N(E), y.isOverlay && /* @__PURE__ */ F(x, {
|
|
2451
|
+
...y,
|
|
2326
2452
|
title: "Gallery Item",
|
|
2327
|
-
children: (e) => /* @__PURE__ */
|
|
2453
|
+
children: (e) => /* @__PURE__ */ F("div", {
|
|
2328
2454
|
className: "space-y-3",
|
|
2329
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
2455
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ I("div", {
|
|
2330
2456
|
className: "flex flex-col",
|
|
2331
|
-
children: [/* @__PURE__ */
|
|
2457
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2332
2458
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
2333
2459
|
children: e.replace(/_/g, " ")
|
|
2334
|
-
}), /* @__PURE__ */
|
|
2460
|
+
}), /* @__PURE__ */ F("span", {
|
|
2335
2461
|
className: "text-sm",
|
|
2336
2462
|
children: String(t ?? "—")
|
|
2337
2463
|
})]
|
|
@@ -2339,11 +2465,85 @@ var G = (e) => {
|
|
|
2339
2465
|
})
|
|
2340
2466
|
})] });
|
|
2341
2467
|
};
|
|
2342
|
-
e.register("object-gallery",
|
|
2468
|
+
e.register("object-gallery", lt, {
|
|
2343
2469
|
namespace: "plugin-list",
|
|
2344
2470
|
label: "Gallery View",
|
|
2345
2471
|
category: "view"
|
|
2346
|
-
})
|
|
2472
|
+
});
|
|
2473
|
+
//#endregion
|
|
2474
|
+
//#region src/components/TabBar.tsx
|
|
2475
|
+
function q(e) {
|
|
2476
|
+
return e ? Te[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
|
|
2477
|
+
}
|
|
2478
|
+
function J(e) {
|
|
2479
|
+
return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
2480
|
+
}
|
|
2481
|
+
var ut = ({ tabs: e, activeTab: t, onTabChange: n, className: i }) => {
|
|
2482
|
+
let a = r.useMemo(() => J(e), [e]), o = r.useMemo(() => a.find((e) => e.isDefault)?.name ?? a[0]?.name, [a]), [s, c] = r.useState(o), u = t ?? s, d = r.useCallback((e) => {
|
|
2483
|
+
c(e.name), n?.(e);
|
|
2484
|
+
}, [n]);
|
|
2485
|
+
return a.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
2486
|
+
className: T("px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", i),
|
|
2487
|
+
"data-testid": "view-tabs",
|
|
2488
|
+
role: "tablist",
|
|
2489
|
+
children: a.map((e) => {
|
|
2490
|
+
let t = q(e.icon), n = u === e.name;
|
|
2491
|
+
return /* @__PURE__ */ I(l, {
|
|
2492
|
+
variant: "ghost",
|
|
2493
|
+
size: "sm",
|
|
2494
|
+
className: T("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"),
|
|
2495
|
+
"data-testid": `view-tab-${e.name}`,
|
|
2496
|
+
role: "tab",
|
|
2497
|
+
"aria-selected": n,
|
|
2498
|
+
onClick: () => d(e),
|
|
2499
|
+
children: [t && /* @__PURE__ */ F(t, { className: "h-3 w-3 mr-1.5" }), e.label]
|
|
2500
|
+
}, e.name);
|
|
2501
|
+
})
|
|
2502
|
+
});
|
|
2503
|
+
}, dt = ({ tabs: e, activeTab: t, onTabChange: n, className: i }) => {
|
|
2504
|
+
let a = r.useMemo(() => J(e), [e]), o = r.useMemo(() => a.find((e) => e.isDefault)?.name ?? a[0]?.name, [a]), [s, c] = r.useState(o), u = t ?? s, d = r.useMemo(() => a.find((e) => e.name === u) ?? a[0], [a, u]), f = r.useCallback((e) => {
|
|
2505
|
+
c(e.name), n?.(e);
|
|
2506
|
+
}, [n]);
|
|
2507
|
+
if (a.length === 0) return null;
|
|
2508
|
+
let _ = q(d?.icon);
|
|
2509
|
+
return /* @__PURE__ */ F("div", {
|
|
2510
|
+
className: T("px-2 py-1", i),
|
|
2511
|
+
"data-testid": "view-tabs-select",
|
|
2512
|
+
children: /* @__PURE__ */ I(p, { children: [/* @__PURE__ */ F(g, {
|
|
2513
|
+
asChild: !0,
|
|
2514
|
+
children: /* @__PURE__ */ I(l, {
|
|
2515
|
+
variant: "ghost",
|
|
2516
|
+
size: "sm",
|
|
2517
|
+
className: "h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate",
|
|
2518
|
+
"aria-label": "Switch view",
|
|
2519
|
+
children: [
|
|
2520
|
+
_ && /* @__PURE__ */ F(_, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2521
|
+
/* @__PURE__ */ F("span", {
|
|
2522
|
+
className: "truncate",
|
|
2523
|
+
children: d?.label ?? ""
|
|
2524
|
+
}),
|
|
2525
|
+
/* @__PURE__ */ F(k, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
2526
|
+
]
|
|
2527
|
+
})
|
|
2528
|
+
}), /* @__PURE__ */ F(m, {
|
|
2529
|
+
align: "start",
|
|
2530
|
+
className: "w-56 max-h-72 overflow-y-auto",
|
|
2531
|
+
children: a.map((e) => {
|
|
2532
|
+
let t = q(e.icon);
|
|
2533
|
+
return /* @__PURE__ */ I(h, {
|
|
2534
|
+
onClick: () => f(e),
|
|
2535
|
+
className: T("text-sm", u === e.name && "font-medium bg-muted"),
|
|
2536
|
+
"data-testid": `view-tab-select-${e.name}`,
|
|
2537
|
+
children: [t && /* @__PURE__ */ F(t, { className: "h-3.5 w-3.5 mr-2 shrink-0" }), /* @__PURE__ */ F("span", {
|
|
2538
|
+
className: "truncate",
|
|
2539
|
+
children: e.label
|
|
2540
|
+
})]
|
|
2541
|
+
}, e.name);
|
|
2542
|
+
})
|
|
2543
|
+
})] })
|
|
2544
|
+
});
|
|
2545
|
+
};
|
|
2546
|
+
e.register("list-view", nt, {
|
|
2347
2547
|
namespace: "plugin-list",
|
|
2348
2548
|
label: "List View",
|
|
2349
2549
|
category: "Views",
|
|
@@ -2420,8 +2620,9 @@ e.register("object-gallery", G, {
|
|
|
2420
2620
|
sort: [],
|
|
2421
2621
|
options: {}
|
|
2422
2622
|
}
|
|
2423
|
-
}), e.register("list",
|
|
2623
|
+
}), e.register("list", nt, {
|
|
2424
2624
|
namespace: "view",
|
|
2625
|
+
skipFallback: !0,
|
|
2425
2626
|
category: "view",
|
|
2426
2627
|
label: "List",
|
|
2427
2628
|
icon: "LayoutList",
|
|
@@ -2491,4 +2692,4 @@ e.register("object-gallery", G, {
|
|
|
2491
2692
|
]
|
|
2492
2693
|
});
|
|
2493
2694
|
//#endregion
|
|
2494
|
-
export {
|
|
2695
|
+
export { nt as ListView, lt as ObjectGallery, ut as TabBar, dt as TabBarSelect, Ge as UserFilters, z as ViewSwitcher, Be as ViewSwitcherDropdown, Ze as evaluateConditionalFormatting, qe as normalizeFilterCondition, Ye as normalizeFilters };
|