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