@object-ui/plugin-list 4.0.7 → 4.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
1
  import { ComponentRegistry as e, buildExpandFields as t, evaluatePlainCondition as n, normalizeQuickFilter as r, normalizeQuickFilters as i } from "@object-ui/core";
2
2
  import * as a from "react";
3
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, FilterBuilder as m, GroupingEditor as ee, Input as te, LookupValuePicker as h, NavigationOverlay as ne, Popover as g, PopoverContent as _, PopoverTrigger as v, SortBuilder as y, cn as b } from "@object-ui/components";
5
- import { Activity as x, AlignJustify as re, ArrowUpDown as ie, Calendar as S, ChevronDown as C, ChevronRight as w, Download as T, EyeOff as ae, GanttChartSquare as E, Grid as D, Group as O, Images as k, Inbox as oe, LayoutGrid as A, Map as se, Paintbrush as ce, Plus as j, Printer as le, Search as ue, Share2 as de, SlidersHorizontal as fe, X as pe, icons as me } from "lucide-react";
6
- import { Fragment as he, jsx as M, jsxs as N } from "react/jsx-runtime";
7
- import { SchemaRenderer as ge, SchemaRendererContext as _e, useDataScope as ve, useDensityMode as ye, useNavigationOverlay as be } from "@object-ui/react";
8
- import { usePullToRefresh as xe } from "@object-ui/mobile";
9
- import { useObjectLabel as Se, useObjectTranslation as P } from "@object-ui/i18n";
4
+ import { Button as d, Card as f, CardContent as p, FilterBuilder as m, GroupingEditor as h, Input as g, LookupValuePicker as _, NavigationOverlay as v, Popover as y, PopoverContent as b, PopoverTrigger as x, SortBuilder as S, cn as C } from "@object-ui/components";
5
+ import { Activity as w, ArrowUpDown as ee, Calendar as te, CheckSquare as ne, ChevronDown as T, ChevronRight as re, Download as ie, EyeOff as ae, GanttChartSquare as E, Grid as D, Group as oe, Images as O, Inbox as k, LayoutGrid as A, Map as j, Paintbrush as M, Plus as N, Printer as se, Rows2 as ce, Rows3 as le, Rows4 as ue, Search as de, Share2 as fe, SlidersHorizontal as pe, Trash2 as me, X as he, icons as ge } from "lucide-react";
6
+ import { Fragment as _e, jsx as P, jsxs as F } from "react/jsx-runtime";
7
+ import { useObjectLabel as I, useObjectTranslation as ve, useSafeFieldLabel as ye } from "@object-ui/i18n";
8
+ import { SchemaRenderer as be, SchemaRendererContext as xe, useDataScope as Se, useDensityMode as Ce, useNavigationOverlay as we, useSafeFieldLabel as Te } from "@object-ui/react";
9
+ import { usePullToRefresh as Ee } from "@object-ui/mobile";
10
10
  //#region src/ViewSwitcher.tsx
11
- var Ce = {
12
- grid: /* @__PURE__ */ M(D, { className: "h-4 w-4" }),
13
- kanban: /* @__PURE__ */ M(A, { className: "h-4 w-4" }),
14
- gallery: /* @__PURE__ */ M(k, { className: "h-4 w-4" }),
15
- calendar: /* @__PURE__ */ M(S, { className: "h-4 w-4" }),
16
- timeline: /* @__PURE__ */ M(x, { className: "h-4 w-4" }),
17
- gantt: /* @__PURE__ */ M(E, { className: "h-4 w-4" }),
18
- map: /* @__PURE__ */ M(se, { className: "h-4 w-4" })
19
- }, F = {
11
+ var De = {
12
+ grid: /* @__PURE__ */ P(D, { className: "h-4 w-4" }),
13
+ kanban: /* @__PURE__ */ P(A, { className: "h-4 w-4" }),
14
+ gallery: /* @__PURE__ */ P(O, { className: "h-4 w-4" }),
15
+ calendar: /* @__PURE__ */ P(te, { className: "h-4 w-4" }),
16
+ timeline: /* @__PURE__ */ P(w, { className: "h-4 w-4" }),
17
+ gantt: /* @__PURE__ */ P(E, { className: "h-4 w-4" }),
18
+ map: /* @__PURE__ */ P(j, { className: "h-4 w-4" })
19
+ }, L = {
20
20
  grid: "Grid",
21
21
  kanban: "Kanban",
22
22
  gallery: "Gallery",
@@ -24,7 +24,7 @@ var Ce = {
24
24
  timeline: "Timeline",
25
25
  gantt: "Gantt",
26
26
  map: "Map"
27
- }, we = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
27
+ }, Oe = ({ currentView: e, availableViews: t = ["grid", "kanban"], onViewChange: n, className: r, animated: i = !0 }) => {
28
28
  let o = a.useCallback((t) => {
29
29
  if (!i || t === e) {
30
30
  n(t);
@@ -36,21 +36,21 @@ var Ce = {
36
36
  e,
37
37
  n
38
38
  ]);
39
- return /* @__PURE__ */ M("div", {
40
- className: b("flex items-center gap-1 bg-transparent oui-view-switcher", r),
39
+ return /* @__PURE__ */ P("div", {
40
+ className: C("flex items-center gap-1 bg-transparent oui-view-switcher", r),
41
41
  children: t.map((t) => {
42
42
  let n = e === t;
43
- return /* @__PURE__ */ N("button", {
43
+ return /* @__PURE__ */ F("button", {
44
44
  type: "button",
45
45
  onClick: () => o(t),
46
- "aria-label": F[t],
47
- title: F[t],
46
+ "aria-label": L[t],
47
+ title: L[t],
48
48
  "aria-pressed": n,
49
49
  "data-state": n ? "on" : "off",
50
- className: b("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"),
51
- children: [Ce[t], /* @__PURE__ */ M("span", {
50
+ className: C("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"),
51
+ children: [De[t], /* @__PURE__ */ P("span", {
52
52
  className: "hidden sm:inline-block text-xs font-medium",
53
- children: F[t]
53
+ children: L[t]
54
54
  })]
55
55
  }, t);
56
56
  })
@@ -58,43 +58,54 @@ var Ce = {
58
58
  };
59
59
  //#endregion
60
60
  //#region src/components/TabBar.tsx
61
- function Te(e) {
62
- return e ? me[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
61
+ function ke(e) {
62
+ return e ? ge[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
63
63
  }
64
- function I(e) {
64
+ function Ae(e) {
65
65
  return e.filter((e) => e.pinned || e.visible !== "false" && e.visible !== !1).sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
66
66
  }
67
- var Ee = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
68
- let i = a.useMemo(() => I(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) => {
67
+ var je = ({ tabs: e, activeTab: t, onTabChange: n, className: r }) => {
68
+ let i = a.useMemo(() => Ae(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) => {
69
69
  c(e.name), n?.(e);
70
70
  }, [n]);
71
- return i.length === 0 ? null : /* @__PURE__ */ M("div", {
72
- className: b("border-b px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", r),
71
+ return i.length === 0 ? null : /* @__PURE__ */ P("div", {
72
+ className: C("px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background", r),
73
73
  "data-testid": "view-tabs",
74
74
  role: "tablist",
75
75
  children: i.map((e) => {
76
- let t = Te(e.icon), n = l === e.name;
77
- return /* @__PURE__ */ N(d, {
76
+ let t = ke(e.icon), n = l === e.name;
77
+ return /* @__PURE__ */ F(d, {
78
78
  variant: "ghost",
79
79
  size: "sm",
80
- className: b("h-7 px-3 py-1.5 text-xs rounded-none transition-colors duration-150", n ? "border-b-2 border-primary font-medium text-foreground" : "text-muted-foreground hover:text-foreground"),
80
+ className: C("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"),
81
81
  "data-testid": `view-tab-${e.name}`,
82
82
  role: "tab",
83
83
  "aria-selected": n,
84
84
  onClick: () => u(e),
85
- children: [t && /* @__PURE__ */ M(t, { className: "h-3 w-3 mr-1.5" }), e.label]
85
+ children: [t && /* @__PURE__ */ P(t, { className: "h-3 w-3 mr-1.5" }), e.label]
86
86
  }, e.name);
87
87
  })
88
88
  });
89
- }, De = new Set([
89
+ };
90
+ //#endregion
91
+ //#region src/UserFilters.tsx
92
+ function Me() {
93
+ try {
94
+ let { t: e } = ve(), t = e("common.more");
95
+ return !t || t === "common.more" ? "More" : t;
96
+ } catch {
97
+ return "More";
98
+ }
99
+ }
100
+ var Ne = new Set([
90
101
  "lookup",
91
102
  "master_detail",
92
103
  "user",
93
104
  "owner"
94
105
  ]);
95
- function Oe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a }) {
106
+ function Pe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisible: i, className: a }) {
96
107
  switch (e.element) {
97
- case "dropdown": return /* @__PURE__ */ M(Ae, {
108
+ case "dropdown": return /* @__PURE__ */ P(Fe, {
98
109
  fields: e.fields || [],
99
110
  objectDef: t,
100
111
  data: n,
@@ -102,14 +113,14 @@ function Oe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
102
113
  maxVisible: i,
103
114
  className: a
104
115
  });
105
- case "tabs": return /* @__PURE__ */ M(je, {
116
+ case "tabs": return /* @__PURE__ */ P(Ie, {
106
117
  tabs: e.tabs || [],
107
118
  showAllRecords: e.showAllRecords !== !1,
108
119
  allowAddTab: e.allowAddTab,
109
120
  onFilterChange: r,
110
121
  className: a
111
122
  });
112
- case "toggle": return /* @__PURE__ */ M(L, {
123
+ case "toggle": return /* @__PURE__ */ P(Le, {
113
124
  fields: e.fields || [],
114
125
  onFilterChange: r,
115
126
  className: a
@@ -117,12 +128,12 @@ function Oe({ config: e, objectDef: t, data: n = [], onFilterChange: r, maxVisib
117
128
  default: return null;
118
129
  }
119
130
  }
120
- function ke(e, t, n) {
131
+ function R(e, t, n, r) {
121
132
  return e.map((e) => {
122
- let r = e.options ? [...e.options] : [], i = e.type, a, o, s;
133
+ let i = e.options ? [...e.options] : [], a = e.type, o, s, c;
123
134
  if (t?.fields) {
124
135
  let n = Array.isArray(t.fields) ? t.fields.find((t) => t.name === e.field) : t.fields[e.field];
125
- n && (i ||= n.type, a = n.reference_to ?? n.reference, o = n.display_field ?? n.reference_field, s = n.id_field, r.length === 0 && n.options && (r = Array.isArray(n.options) ? n.options.map((e) => ({
136
+ n && (a ||= n.type, o = n.reference_to ?? n.reference, s = n.display_field ?? n.reference_field, c = n.id_field, i.length === 0 && n.options && (i = Array.isArray(n.options) ? n.options.map((e) => ({
126
137
  label: e.label ?? String(e.value ?? e),
127
138
  value: e.value ?? e,
128
139
  color: e.color
@@ -132,82 +143,92 @@ function ke(e, t, n) {
132
143
  color: t?.color
133
144
  }))));
134
145
  }
135
- return r.length === 0 && i === "boolean" && (r = [{
146
+ i.length === 0 && a === "boolean" && (i = [{
136
147
  label: "True",
137
148
  value: !0
138
149
  }, {
139
150
  label: "False",
140
151
  value: !1
141
- }]), e.showCount && n.length > 0 && (r = r.map((t) => ({
152
+ }]), e.showCount && n.length > 0 && (i = i.map((t) => ({
142
153
  ...t,
143
154
  count: n.filter((n) => n[e.field] === t.value).length
144
- }))), {
155
+ })));
156
+ let l = e.label;
157
+ return r?.objectName && (i = r.translateOptions(r.objectName, e.field, i), l = r.fieldLabel(r.objectName, e.field, e.label || e.field)), {
145
158
  ...e,
146
- type: i,
147
- options: r,
148
- referenceTo: a,
149
- displayField: o,
150
- idField: s
159
+ label: l,
160
+ type: a,
161
+ options: i,
162
+ referenceTo: o,
163
+ displayField: s,
164
+ idField: c
151
165
  };
152
166
  });
153
167
  }
154
- function Ae({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i, className: o }) {
155
- let [s, c] = a.useState(() => {
168
+ function Fe({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i, className: o }) {
169
+ let { fieldLabel: s, translateOptions: c } = ye(), l = Me(), u = t?.name, [d, f] = a.useState(() => {
156
170
  let t = {};
157
171
  return e.forEach((e) => {
158
172
  e.defaultValues && e.defaultValues.length > 0 && (t[e.field] = e.defaultValues);
159
173
  }), t;
160
- }), l = a.useMemo(() => ke(e, t, n), [
174
+ }), p = a.useMemo(() => R(e, t, n, {
175
+ objectName: u,
176
+ fieldLabel: s,
177
+ translateOptions: c
178
+ }), [
161
179
  e,
162
180
  t,
163
- n
164
- ]), u = a.useCallback((e) => {
181
+ n,
182
+ u,
183
+ s,
184
+ c
185
+ ]), m = a.useCallback((e) => {
165
186
  r(Object.entries(e).filter(([, e]) => e.length > 0).map(([e, t]) => [
166
187
  e,
167
188
  "in",
168
189
  t
169
190
  ]));
170
- }, [r]), d = (e, t) => {
191
+ }, [r]), h = (e, t) => {
171
192
  let n = {
172
- ...s,
193
+ ...d,
173
194
  [e]: t
174
195
  };
175
- c(n), u(n);
196
+ f(n), m(n);
176
197
  };
177
198
  a.useEffect(() => {
178
- Object.values(s).some((e) => e.length > 0) && u(s);
199
+ Object.values(d).some((e) => e.length > 0) && m(d);
179
200
  }, []);
180
- let f = i !== void 0 && i < l.length ? l.slice(0, i) : l, p = i !== void 0 && i < l.length ? l.slice(i) : [], m = (e) => {
181
- let t = s[e.field] || [], n = t.length > 0, r = De.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), i = r ? "w-72" : "w-56";
182
- return /* @__PURE__ */ N(g, { children: [/* @__PURE__ */ M(v, {
201
+ let g = i !== void 0 && i < p.length ? p.slice(0, i) : p, v = i !== void 0 && i < p.length ? p.slice(i) : [], S = (e) => {
202
+ let t = d[e.field] || [], n = t.length > 0, r = Ne.has(e.type || "") && e.options.length === 0 && (e.referenceTo || e.type === "user" || e.type === "owner"), i = r ? "w-72" : "w-56";
203
+ return /* @__PURE__ */ F(y, { children: [/* @__PURE__ */ P(x, {
183
204
  asChild: !0,
184
- children: /* @__PURE__ */ N("button", {
205
+ children: /* @__PURE__ */ F("button", {
185
206
  "data-testid": `filter-badge-${e.field}`,
186
- className: b("inline-flex items-center gap-1 rounded-full border h-7 px-2.5 text-xs font-medium transition-colors shrink-0", n ? "border-primary/30 bg-primary/5 text-primary" : "border-border bg-background hover:bg-accent text-foreground"),
207
+ className: C("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"),
187
208
  children: [
188
- /* @__PURE__ */ M("span", {
209
+ /* @__PURE__ */ P("span", {
189
210
  className: "truncate max-w-[100px]",
190
211
  children: e.label || e.field
191
212
  }),
192
- n && /* @__PURE__ */ M("span", {
193
- className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 text-[10px]",
213
+ n && /* @__PURE__ */ P("span", {
214
+ className: "text-[10px] text-muted-foreground/80 tabular-nums",
194
215
  children: t.length
195
216
  }),
196
- n ? /* @__PURE__ */ M(pe, {
197
- className: "h-3 w-3 opacity-60",
217
+ n ? /* @__PURE__ */ P(he, {
218
+ className: "h-3 w-3 opacity-60 hover:opacity-100",
198
219
  "data-testid": `filter-clear-${e.field}`,
199
220
  onClick: (t) => {
200
- t.stopPropagation(), d(e.field, []);
221
+ t.stopPropagation(), h(e.field, []);
201
222
  }
202
- }) : /* @__PURE__ */ M(C, { className: "h-3 w-3 opacity-60" })
223
+ }) : /* @__PURE__ */ P(T, { className: "h-3 w-3 opacity-60" })
203
224
  ]
204
225
  })
205
- }), /* @__PURE__ */ M(_, {
226
+ }), /* @__PURE__ */ P(b, {
206
227
  align: "start",
207
- className: b(i, "p-2"),
208
- children: r ? /* @__PURE__ */ M("div", {
228
+ className: C(i, "p-2"),
229
+ children: r ? /* @__PURE__ */ P("div", {
209
230
  "data-testid": `filter-lookup-${e.field}`,
210
- children: /* @__PURE__ */ M(h, {
231
+ children: /* @__PURE__ */ P(_, {
211
232
  field: {
212
233
  value: e.field,
213
234
  label: e.label || e.field,
@@ -220,36 +241,36 @@ function Ae({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
220
241
  multiple: !0,
221
242
  onChange: (t) => {
222
243
  let n = Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
223
- d(e.field, n);
244
+ h(e.field, n);
224
245
  }
225
246
  })
226
- }) : /* @__PURE__ */ M("div", {
247
+ }) : /* @__PURE__ */ P("div", {
227
248
  className: "max-h-60 overflow-y-auto space-y-0.5",
228
249
  "data-testid": `filter-options-${e.field}`,
229
- children: e.options.length === 0 ? /* @__PURE__ */ M("div", {
250
+ children: e.options.length === 0 ? /* @__PURE__ */ P("div", {
230
251
  className: "px-2 py-3 text-center text-xs text-muted-foreground",
231
252
  children: "No options"
232
- }) : e.options.map((n) => /* @__PURE__ */ N("label", {
233
- className: b("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"),
253
+ }) : e.options.map((n) => /* @__PURE__ */ F("label", {
254
+ className: C("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"),
234
255
  children: [
235
- /* @__PURE__ */ M("input", {
256
+ /* @__PURE__ */ P("input", {
236
257
  type: "checkbox",
237
258
  checked: t.includes(n.value),
238
259
  onChange: () => {
239
260
  let r = t.includes(n.value) ? t.filter((e) => e !== n.value) : [...t, n.value];
240
- d(e.field, r);
261
+ h(e.field, r);
241
262
  },
242
263
  className: "rounded border-input"
243
264
  }),
244
- n.color && /* @__PURE__ */ M("span", {
265
+ n.color && /* @__PURE__ */ P("span", {
245
266
  className: "h-2.5 w-2.5 rounded-full shrink-0",
246
267
  style: { backgroundColor: n.color }
247
268
  }),
248
- /* @__PURE__ */ M("span", {
269
+ /* @__PURE__ */ P("span", {
249
270
  className: "truncate flex-1",
250
271
  children: n.label
251
272
  }),
252
- n.count !== void 0 && /* @__PURE__ */ M("span", {
273
+ n.count !== void 0 && /* @__PURE__ */ P("span", {
253
274
  className: "text-xs text-muted-foreground",
254
275
  children: n.count
255
276
  })
@@ -258,39 +279,39 @@ function Ae({ fields: e, objectDef: t, data: n, onFilterChange: r, maxVisible: i
258
279
  })
259
280
  })] }, e.field);
260
281
  };
261
- return /* @__PURE__ */ N("div", {
262
- className: b("flex items-center gap-1 overflow-x-auto", o),
282
+ return /* @__PURE__ */ P("div", {
283
+ className: C("flex items-center gap-0.5 overflow-x-auto", o),
263
284
  "data-testid": "user-filters-dropdown",
264
- children: [/* @__PURE__ */ M(fe, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }), l.length === 0 ? /* @__PURE__ */ M("span", {
285
+ children: p.length === 0 ? /* @__PURE__ */ P("span", {
265
286
  className: "text-xs text-muted-foreground",
266
287
  "data-testid": "user-filters-empty",
267
288
  children: "No filter fields"
268
- }) : /* @__PURE__ */ N(he, { children: [f.map(m), p.length > 0 && /* @__PURE__ */ N(g, { children: [/* @__PURE__ */ M(v, {
289
+ }) : /* @__PURE__ */ F(_e, { children: [g.map(S), v.length > 0 && /* @__PURE__ */ F(y, { children: [/* @__PURE__ */ P(x, {
269
290
  asChild: !0,
270
- children: /* @__PURE__ */ N("button", {
291
+ children: /* @__PURE__ */ F("button", {
271
292
  "data-testid": "user-filters-more",
272
- className: "inline-flex items-center gap-1 rounded-full border border-border bg-background hover:bg-accent text-foreground h-7 px-2.5 text-xs font-medium transition-colors shrink-0",
293
+ 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",
273
294
  children: [
274
- /* @__PURE__ */ M("span", { children: "More" }),
275
- /* @__PURE__ */ M("span", {
276
- className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-muted text-[10px] font-medium",
277
- children: p.length
295
+ /* @__PURE__ */ P("span", { children: l }),
296
+ /* @__PURE__ */ P("span", {
297
+ className: "text-[10px] text-muted-foreground/80 tabular-nums",
298
+ children: v.length
278
299
  }),
279
- /* @__PURE__ */ M(C, { className: "h-3 w-3 opacity-60" })
300
+ /* @__PURE__ */ P(T, { className: "h-3 w-3 opacity-60" })
280
301
  ]
281
302
  })
282
- }), /* @__PURE__ */ M(_, {
303
+ }), /* @__PURE__ */ P(b, {
283
304
  align: "start",
284
305
  className: "w-64 p-2",
285
306
  "data-testid": "user-filters-more-content",
286
- children: /* @__PURE__ */ M("div", {
307
+ children: /* @__PURE__ */ P("div", {
287
308
  className: "space-y-1",
288
- children: p.map(m)
309
+ children: v.map(S)
289
310
  })
290
- })] })] })]
311
+ })] })] })
291
312
  });
292
313
  }
293
- function je({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: i }) {
314
+ function Ie({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, className: i }) {
294
315
  let [o, s] = a.useState(() => e.find((e) => e.default)?.id || (t ? "__all__" : e[0]?.id || "")), c = a.useCallback((t) => {
295
316
  s(t), r(t === "__all__" ? [] : e.find((e) => e.id === t)?.filters || []);
296
317
  }, [e, r]), l = a.useMemo(() => {
@@ -304,23 +325,23 @@ function je({ tabs: e, showAllRecords: t, allowAddTab: n, onFilterChange: r, cla
304
325
  return a.useEffect(() => {
305
326
  let t = e.find((e) => e.default);
306
327
  t && r(t.filters || []);
307
- }, []), /* @__PURE__ */ N("div", {
308
- className: b("flex items-center gap-0.5 overflow-x-auto", i),
328
+ }, []), /* @__PURE__ */ F("div", {
329
+ className: C("flex items-center gap-0.5 overflow-x-auto", i),
309
330
  "data-testid": "user-filters-tabs",
310
- children: [l.map((e) => /* @__PURE__ */ M("button", {
331
+ children: [l.map((e) => /* @__PURE__ */ P("button", {
311
332
  "data-testid": `filter-tab-${e.id}`,
312
333
  onClick: () => c(e.id),
313
- className: b("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"),
334
+ className: C("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"),
314
335
  children: e.label
315
- }, e.id)), n && /* @__PURE__ */ M("button", {
336
+ }, e.id)), n && /* @__PURE__ */ P("button", {
316
337
  className: "inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",
317
338
  "data-testid": "filter-tab-add",
318
339
  title: "Add filter tab",
319
- children: /* @__PURE__ */ M(j, { className: "h-3.5 w-3.5" })
340
+ children: /* @__PURE__ */ P(N, { className: "h-3.5 w-3.5" })
320
341
  })]
321
342
  });
322
343
  }
323
- function L({ fields: e, onFilterChange: t, className: n }) {
344
+ function Le({ fields: e, onFilterChange: t, className: n }) {
324
345
  let [r, i] = a.useState(() => {
325
346
  let t = /* @__PURE__ */ new Set();
326
347
  return e.forEach((e) => {
@@ -347,10 +368,10 @@ function L({ fields: e, onFilterChange: t, className: n }) {
347
368
  };
348
369
  return a.useEffect(() => {
349
370
  r.size > 0 && o(r);
350
- }, []), /* @__PURE__ */ M("div", {
351
- className: b("flex items-center gap-1 overflow-x-auto", n),
371
+ }, []), /* @__PURE__ */ P("div", {
372
+ className: C("flex items-center gap-1 overflow-x-auto", n),
352
373
  "data-testid": "user-filters-toggle",
353
- children: e.map((e) => /* @__PURE__ */ M(d, {
374
+ children: e.map((e) => /* @__PURE__ */ P(d, {
354
375
  variant: r.has(e.field) ? "default" : "outline",
355
376
  size: "sm",
356
377
  className: "h-7 px-3 text-xs shrink-0",
@@ -362,7 +383,7 @@ function L({ fields: e, onFilterChange: t, className: n }) {
362
383
  }
363
384
  //#endregion
364
385
  //#region src/ListView.tsx
365
- function R(e) {
386
+ function Re(e) {
366
387
  switch (e) {
367
388
  case "equals":
368
389
  case "eq": return "=";
@@ -407,15 +428,15 @@ function z(e) {
407
428
  e
408
429
  ])] : e;
409
430
  }
410
- function Me(e) {
431
+ function ze(e) {
411
432
  return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
412
433
  }
413
- function Ne(e) {
434
+ function Be(e) {
414
435
  return !Array.isArray(e) || e.length === 0 ? [] : e.map((e) => Array.isArray(e) ? z(e) : e).filter((e) => Array.isArray(e) && e.length > 0);
415
436
  }
416
- function Pe(e) {
437
+ function Ve(e) {
417
438
  if (!e || !e.conditions || e.conditions.length === 0) return [];
418
- let t = Ne(e.conditions.map((e) => e.operator === "isEmpty" ? [
439
+ let t = Be(e.conditions.map((e) => e.operator === "isEmpty" ? [
419
440
  e.field,
420
441
  "=",
421
442
  null
@@ -425,12 +446,12 @@ function Pe(e) {
425
446
  null
426
447
  ] : [
427
448
  e.field,
428
- R(e.operator),
449
+ Re(e.operator),
429
450
  e.value
430
451
  ]));
431
452
  return t.length === 0 ? [] : t.length === 1 ? t[0] : [e.logic, ...t];
432
453
  }
433
- function Fe(e, t) {
454
+ function B(e, t) {
434
455
  if (!t || t.length === 0) return {};
435
456
  for (let r of t) {
436
457
  let t = !1, i = ("condition" in r ? r.condition : void 0) || ("expression" in r ? r.expression : void 0) || void 0;
@@ -465,7 +486,7 @@ function Fe(e, t) {
465
486
  }
466
487
  return {};
467
488
  }
468
- var B = {
489
+ var V = {
469
490
  "list.recordCount": "{{count}} records",
470
491
  "list.recordCountOne": "{{count}} record",
471
492
  "list.noItems": "No items found",
@@ -494,61 +515,62 @@ var B = {
494
515
  "list.allRecords": "All Records",
495
516
  "list.share": "Share",
496
517
  "list.print": "Print",
497
- "list.hideFieldsTitle": "Hide Fields"
518
+ "list.hideFieldsTitle": "Hide Fields",
519
+ "table.rowsPerPage": "Rows per page"
498
520
  };
499
- function Ie() {
521
+ function He() {
500
522
  try {
501
- let e = P();
523
+ let e = ve();
502
524
  return e.t("list.recordCount") === "list.recordCount" ? { t: (e, t) => {
503
- let n = B[e] || e;
525
+ let n = V[e] || e;
504
526
  if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
505
527
  return n;
506
528
  } } : { t: e.t };
507
529
  } catch {
508
530
  return { t: (e, t) => {
509
- let n = B[e] || e;
531
+ let n = V[e] || e;
510
532
  if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
511
533
  return n;
512
534
  } };
513
535
  }
514
536
  }
515
- function Le() {
537
+ function Ue() {
516
538
  try {
517
- let { fieldLabel: e } = Se();
539
+ let { fieldLabel: e } = I();
518
540
  return { fieldLabel: e };
519
541
  } catch {
520
542
  return { fieldLabel: (e, t, n) => n };
521
543
  }
522
544
  }
523
- var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange: s, onSortChange: c, onSearchChange: l, onRowClick: u, showViewSwitcher: f = !1, ...p }, h) => {
524
- let { t: x } = Ie(), { fieldLabel: S } = Le(), C = a.useMemo(() => ({
545
+ var H = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange: s, onSortChange: c, onSearchChange: l, onHiddenFieldsChange: u, onColumnStateChange: f, onRowClick: p, showViewSwitcher: _ = !1, ...w }, te) => {
546
+ let { t: T } = He(), { fieldLabel: re } = Ue(), { translateOptions: E } = ye(), D = a.useMemo(() => ({
525
547
  ...e,
526
548
  viewType: e.viewType || "grid"
527
- }), [e]), w = a.useCallback((e, t) => C.objectName ? S(C.objectName, e, t) : t, [C.objectName, S]), E = a.useMemo(() => {
528
- let e = C.userActions, t = C.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
549
+ }), [e]), O = a.useCallback((e, t) => D.objectName ? re(D.objectName, e, t) : t, [D.objectName, re]), A = a.useMemo(() => {
550
+ let e = D.userActions, t = D.addRecord?.enabled === !0 && e?.addRecordForm !== !1;
529
551
  return {
530
- showSearch: e?.search === void 0 ? C.showSearch !== !1 : e.search,
531
- showSort: e?.sort === void 0 ? C.showSort !== !1 : e.sort,
532
- showFilters: e?.filter === void 0 ? C.showFilters !== !1 : e.filter,
533
- showDensity: e?.rowHeight === void 0 ? C.showDensity === !0 : e.rowHeight,
534
- showHideFields: C.showHideFields === !0,
535
- showGroup: C.showGroup !== !1,
536
- showColor: C.showColor === !0,
552
+ showSearch: e?.search === void 0 ? D.showSearch !== !1 : e.search,
553
+ showSort: e?.sort === void 0 ? D.showSort !== !1 : e.sort,
554
+ showFilters: e?.filter === void 0 ? D.showFilters !== !1 : e.filter,
555
+ showDensity: e?.rowHeight === void 0 ? D.showDensity !== !1 : e.rowHeight,
556
+ showHideFields: D.showHideFields === !0,
557
+ showGroup: D.showGroup !== !1,
558
+ showColor: D.showColor === !0,
537
559
  showAddRecord: t,
538
- addRecordPosition: C.addRecord?.position === "bottom" ? "bottom" : "top"
560
+ addRecordPosition: D.addRecord?.position === "bottom" ? "bottom" : "top"
539
561
  };
540
562
  }, [
541
- C.userActions,
542
- C.showSearch,
543
- C.showSort,
544
- C.showFilters,
545
- C.showDensity,
546
- C.showHideFields,
547
- C.showGroup,
548
- C.showColor,
549
- C.addRecord,
550
- C.userActions?.addRecordForm
551
- ]), [D, k] = a.useState(C.viewType), [A, se] = a.useState(""), [he, _e] = a.useState(!1), [ve, Se] = a.useState(!1), [P, Ce] = a.useState(() => C.sort && C.sort.length > 0 ? C.sort.map((e) => {
563
+ D.userActions,
564
+ D.showSearch,
565
+ D.showSort,
566
+ D.showFilters,
567
+ D.showDensity,
568
+ D.showHideFields,
569
+ D.showGroup,
570
+ D.showColor,
571
+ D.addRecord,
572
+ D.userActions?.addRecordForm
573
+ ]), [j, _e] = a.useState(D.viewType), [I, ve] = a.useState(""), [xe, Se] = a.useState(!1), [Te, De] = a.useState(!1), [L, ke] = a.useState(() => D.sort && D.sort.length > 0 ? D.sort.map((e) => {
552
574
  if (typeof e == "string") {
553
575
  let t = e.trim().split(/\s+/);
554
576
  return {
@@ -562,41 +584,59 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
562
584
  field: e.field,
563
585
  order: e.order || "asc"
564
586
  };
565
- }) : []), [F, Te] = a.useState(!1), [I, De] = a.useState({
587
+ }) : []), Ae = a.useMemo(() => JSON.stringify(D.sort || []), [D.sort]);
588
+ a.useEffect(() => {
589
+ D.sort && D.sort.length > 0 ? ke(D.sort.map((e) => {
590
+ if (typeof e == "string") {
591
+ let t = e.trim().split(/\s+/);
592
+ return {
593
+ id: crypto.randomUUID(),
594
+ field: t[0],
595
+ order: t[1]?.toLowerCase() === "desc" ? "desc" : "asc"
596
+ };
597
+ }
598
+ return {
599
+ id: crypto.randomUUID(),
600
+ field: e.field,
601
+ order: e.order || "asc"
602
+ };
603
+ })) : ke([]);
604
+ }, [Ae]);
605
+ let [Me, Ne] = a.useState(!1), [R, Fe] = a.useState({
566
606
  id: "root",
567
607
  logic: "and",
568
608
  conditions: []
569
- }), [ke, Ae] = a.useState(() => {
570
- if (!(!C.tabs || C.tabs.length === 0)) return C.tabs.find((e) => e.isDefault)?.name ?? C.tabs[0]?.name;
571
- }), je = a.useCallback((e) => {
572
- if (Ae(e.name), e.filter) {
609
+ }), [Ie, Le] = a.useState(() => {
610
+ if (!(!D.tabs || D.tabs.length === 0)) return D.tabs.find((e) => e.isDefault)?.name ?? D.tabs[0]?.name;
611
+ }), Re = a.useCallback((e) => {
612
+ if (Le(e.name), e.filter) {
573
613
  let t = {
574
614
  id: `tab-filter-${e.name}`,
575
615
  logic: e.filter.logic || "and",
576
616
  conditions: e.filter.conditions || []
577
617
  };
578
- De(t), s?.(t);
618
+ Fe(t), s?.(t);
579
619
  } else {
580
620
  let e = {
581
621
  id: "root",
582
622
  logic: "and",
583
623
  conditions: []
584
624
  };
585
- De(e), s?.(e);
625
+ Fe(e), s?.(e);
586
626
  }
587
- }, [s]), L = p.dataSource, [R, z] = a.useState([]), [Fe, B] = a.useState(!1), [V, Re] = a.useState(null), [ze, H] = a.useState(!1), [Be, Ve] = a.useState(0), [He, Ue] = a.useState(!1);
588
- a.useImperativeHandle(h, () => ({ refresh: () => Ve((e) => e + 1) }), []), a.useEffect(() => {
589
- if (!(!L?.onMutation || !C.objectName || C.refreshTrigger)) return L.onMutation((e) => {
590
- e.resource === C.objectName && Ve((e) => e + 1);
627
+ }, [s]), z = w.dataSource, [B, V] = a.useState([]), [H, U] = a.useState(!1), [W, We] = a.useState(null), [Ge, Ke] = a.useState(!1), [qe, Je] = a.useState(0), [Ye, Xe] = a.useState(!1);
628
+ a.useImperativeHandle(te, () => ({ refresh: () => Je((e) => e + 1) }), []), a.useEffect(() => {
629
+ if (!(!z?.onMutation || !D.objectName || D.refreshTrigger)) return z.onMutation((e) => {
630
+ e.resource === D.objectName && Je((e) => e + 1);
591
631
  });
592
632
  }, [
593
- L,
594
- C.objectName,
595
- C.refreshTrigger
633
+ z,
634
+ D.objectName,
635
+ D.refreshTrigger
596
636
  ]);
597
- let [We, Ge] = a.useState(void 0), U = We ?? C.pagination?.pageSize ?? 100, W = a.useMemo(() => {
598
- if (C.grouping?.fields?.length) return C.grouping;
599
- let e = typeof C.groupBy == "string" ? C.groupBy.trim() : "", t = typeof C.groupBy2 == "string" ? C.groupBy2.trim() : "", n = [];
637
+ let [Ze, Qe] = a.useState(void 0), G = Ze ?? D.pagination?.pageSize ?? 100, K = a.useMemo(() => {
638
+ if (D.grouping?.fields?.length) return D.grouping;
639
+ let e = typeof D.groupBy == "string" ? D.groupBy.trim() : "", t = typeof D.groupBy2 == "string" ? D.groupBy2.trim() : "", n = [];
600
640
  return e && n.push({
601
641
  field: e,
602
642
  order: "asc",
@@ -607,121 +647,164 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
607
647
  collapsed: !1
608
648
  }), n.length > 0 ? { fields: n } : void 0;
609
649
  }, [
610
- C.grouping,
611
- C.groupBy,
612
- C.groupBy2
613
- ]), [G, Ke] = a.useState(W), [qe, Je] = a.useState(!1), Ye = a.useRef(W);
650
+ D.grouping,
651
+ D.groupBy,
652
+ D.groupBy2
653
+ ]), [q, $e] = a.useState(K), [et, tt] = a.useState(!1), nt = a.useRef(K);
614
654
  a.useEffect(() => {
615
- Ye.current !== W && (Ye.current = W, Ke(W));
616
- }, [W]);
617
- let [K, Xe] = a.useState(C.rowColor), [Ze, Qe] = a.useState(!1), [$e, et] = a.useState([]), q = a.useRef(0), [J, tt] = a.useState(() => {
655
+ nt.current !== K && (nt.current = K, $e(K));
656
+ }, [K]);
657
+ let [J, rt] = a.useState(D.rowColor), [it, at] = a.useState(!1), [ot, st] = a.useState([]), ct = a.useRef(0), [lt, ut] = a.useState(() => {
618
658
  let e = /* @__PURE__ */ new Set();
619
- return C.quickFilters?.forEach((t) => {
659
+ return D.quickFilters?.forEach((t) => {
620
660
  let n = r(t);
621
661
  n.defaultActive && e.add(n.id);
622
662
  }), e;
623
- }), [nt, rt] = a.useState([]), it = a.useMemo(() => {
624
- if (C.userFilters) return C.userFilters;
625
- if (!V?.fields) return;
663
+ }), [dt, ft] = a.useState([]), pt = a.useMemo(() => {
664
+ if (D.userFilters) return D.userFilters;
665
+ if (!W?.fields) return;
626
666
  let e = new Set([
627
667
  "select",
628
668
  "multi-select",
629
669
  "boolean"
630
- ]), t = [], n = Array.isArray(V.fields) ? V.fields.map((e) => [e.name, e]) : Object.entries(V.fields);
670
+ ]), t = [], n = Array.isArray(W.fields) ? W.fields.map((e) => [e.name, e]) : Object.entries(W.fields);
631
671
  for (let [r, i] of n) (e.has(i.type) || i.options && !i.type) && t.push({
632
672
  field: r,
633
- label: w(r, i.label || r),
673
+ label: O(r, i.label || r),
634
674
  type: i.type === "boolean" ? "boolean" : i.type === "multi-select" ? "multi-select" : "select"
635
675
  });
636
676
  if (t.length !== 0) return {
637
677
  element: "dropdown",
638
678
  fields: t
639
679
  };
640
- }, [C.userFilters, V]), [Y, at] = a.useState(() => new Set(C.hiddenFields || [])), [ot, st] = a.useState(!1), [ct, lt] = a.useState(!1), X = a.useMemo(() => i(C.quickFilters), [C.quickFilters]), Z = a.useMemo(() => {
641
- if (C.exportOptions) return Array.isArray(C.exportOptions) ? { formats: C.exportOptions } : C.exportOptions;
642
- }, [C.exportOptions]), Q = ye(a.useMemo(() => C.densityMode ? C.densityMode : C.rowHeight ? {
680
+ }, [D.userFilters, W]), [Y, mt] = a.useState(() => new Set(D.hiddenFields || [])), ht = a.useMemo(() => JSON.stringify(D.hiddenFields || []), [D.hiddenFields]);
681
+ a.useEffect(() => {
682
+ mt(new Set(D.hiddenFields || []));
683
+ }, [ht]);
684
+ let gt = a.useCallback((e) => {
685
+ mt(e), u?.(Array.from(e));
686
+ }, [u]), [_t, vt] = a.useState(!1), [yt, bt] = a.useState(!1), X = a.useMemo(() => i(D.quickFilters), [D.quickFilters]), Z = a.useMemo(() => {
687
+ if (D.exportOptions) return Array.isArray(D.exportOptions) ? { formats: D.exportOptions } : D.exportOptions;
688
+ }, [D.exportOptions]), Q = Ce(a.useMemo(() => D.densityMode ? D.densityMode : D.rowHeight ? {
643
689
  compact: "compact",
644
690
  short: "compact",
645
691
  medium: "comfortable",
646
692
  tall: "spacious",
647
693
  extra_tall: "spacious"
648
- }[C.rowHeight] || "comfortable" : "compact", [C.densityMode, C.rowHeight])), { ref: ut, isRefreshing: dt, pullDistance: ft } = xe({
694
+ }[D.rowHeight] || "comfortable" : "compact", [D.densityMode, D.rowHeight]), { onChange: D.onDensityChange }), { ref: xt, isRefreshing: St, pullDistance: Ct } = Ee({
649
695
  onRefresh: a.useCallback(async () => {
650
- Ve((e) => e + 1);
696
+ Je((e) => e + 1);
651
697
  }, []),
652
- enabled: !!L && !!C.objectName
653
- }), pt = a.useMemo(() => C.id ? `listview-${C.objectName}-${C.id}-view` : `listview-${C.objectName}-view`, [C.objectName, C.id]);
698
+ enabled: !!z && !!D.objectName
699
+ }), wt = a.useMemo(() => D.id ? `listview-${D.objectName}-${D.id}-view` : `listview-${D.objectName}-view`, [D.objectName, D.id]);
654
700
  a.useEffect(() => {
655
701
  let e = !0;
656
- return H(!1), Re(null), (async () => {
657
- if (!L || !C.objectName) {
658
- H(!0);
702
+ return Ke(!1), We(null), (async () => {
703
+ if (!z || !D.objectName) {
704
+ Ke(!0);
659
705
  return;
660
706
  }
661
- if (typeof L.getObjectSchema != "function") {
662
- H(!0);
707
+ if (typeof z.getObjectSchema != "function") {
708
+ Ke(!0);
663
709
  return;
664
710
  }
665
711
  try {
666
- let t = await L.getObjectSchema(C.objectName);
667
- e && Re(t);
712
+ let t = await z.getObjectSchema(D.objectName);
713
+ e && We(t);
668
714
  } catch (e) {
669
715
  console.warn("Failed to fetch object schema for ListView:", e);
670
716
  } finally {
671
- e && H(!0);
717
+ e && Ke(!0);
672
718
  }
673
719
  })(), () => {
674
720
  e = !1;
675
721
  };
676
- }, [C.objectName, L]);
677
- let mt = a.useMemo(() => t(V?.fields, C.fields), [V?.fields, C.fields]);
722
+ }, [D.objectName, z]);
723
+ let Tt = a.useMemo(() => {
724
+ let e = Array.isArray(D.fields) ? D.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], n = new Set(e), r = (e) => {
725
+ if (!e) return;
726
+ let t = [
727
+ e.groupField,
728
+ e.groupBy,
729
+ e.titleField,
730
+ e.cardTitle,
731
+ e.startDateField,
732
+ e.endDateField,
733
+ e.dateField,
734
+ e.endField,
735
+ e.colorField,
736
+ e.allDayField,
737
+ e.coverField,
738
+ e.imageField,
739
+ e.subtitleField,
740
+ e.swimlaneField,
741
+ e.valueField,
742
+ ...Array.isArray(e.cardFields) ? e.cardFields : [],
743
+ ...Array.isArray(e.visibleFields) ? e.visibleFields : [],
744
+ ...Array.isArray(e.metaFields) ? e.metaFields : []
745
+ ];
746
+ for (let e of t) typeof e == "string" && e && n.add(e);
747
+ };
748
+ r(D.kanban), r(D.options?.kanban), r(D.calendar), r(D.options?.calendar), r(D.gallery), r(D.options?.gallery), r(D.timeline), r(D.options?.timeline), r(D.gantt), r(D.options?.gantt);
749
+ let i = n.size > 0 ? Array.from(n) : void 0;
750
+ return t(W?.fields, i);
751
+ }, [
752
+ W?.fields,
753
+ D.fields,
754
+ D.kanban,
755
+ D.calendar,
756
+ D.gallery,
757
+ D.timeline,
758
+ D.gantt,
759
+ D.options
760
+ ]);
678
761
  a.useEffect(() => {
679
- let e = !0, t = ++q.current;
680
- if (C.data && typeof C.data == "object" && !Array.isArray(C.data)) {
681
- let e = C.data;
762
+ let e = !0, t = ++ct.current;
763
+ if (D.data && typeof D.data == "object" && !Array.isArray(D.data)) {
764
+ let e = D.data;
682
765
  if (e.provider === "value" && Array.isArray(e.items)) {
683
766
  let t = e.items;
684
- if (A) {
685
- let e = A.toLowerCase();
767
+ if (I) {
768
+ let e = I.toLowerCase();
686
769
  t = t.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
687
770
  }
688
- z(t), B(!1), Ue(!1);
771
+ V(t), U(!1), Xe(!1);
689
772
  return;
690
773
  }
691
774
  }
692
- if (Array.isArray(C.data)) {
693
- let e = C.data;
694
- if (A) {
695
- let t = A.toLowerCase();
775
+ if (Array.isArray(D.data)) {
776
+ let e = D.data;
777
+ if (I) {
778
+ let t = I.toLowerCase();
696
779
  e = e.filter((e) => Object.values(e).some((e) => e != null && String(e).toLowerCase().includes(t)));
697
780
  }
698
- z(e), B(!1), Ue(!1);
781
+ V(e), U(!1), Xe(!1);
699
782
  return;
700
783
  }
701
- return ze ? ((async () => {
702
- if (!(!L || !C.objectName)) {
703
- B(!0);
784
+ return Ge ? ((async () => {
785
+ if (!(!z || !D.objectName)) {
786
+ U(!0);
704
787
  try {
705
- let n = [], r = C.filters || [], i = Pe(I), a = [];
706
- X && J.size > 0 && X.forEach((e) => {
707
- J.has(e.id) && e.filters && e.filters.length > 0 && a.push(e.filters);
788
+ let n = [], r = D.filters || [], i = Ve(R), a = [];
789
+ X && lt.size > 0 && X.forEach((e) => {
790
+ lt.has(e.id) && e.filters && e.filters.length > 0 && a.push(e.filters);
708
791
  });
709
- let o = Ne(nt), s = [
792
+ let o = Be(dt), s = [
710
793
  ...r.length > 0 ? [r] : [],
711
794
  ...i.length > 0 ? [i] : [],
712
795
  ...a,
713
796
  ...o
714
797
  ].filter((e) => Array.isArray(e) && e.length > 0);
715
798
  s.length > 1 ? n = ["and", ...s] : s.length === 1 && (n = s[0]);
716
- let c = P.length > 0 ? P.filter((e) => e.field).map((e) => ({
799
+ let c = L.length > 0 ? L.filter((e) => e.field).map((e) => ({
717
800
  field: e.field,
718
801
  order: e.order
719
802
  })) : void 0, l = (() => {
720
- let e = Array.isArray(C.fields) ? C.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [];
803
+ let e = Array.isArray(D.fields) ? D.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [];
721
804
  if (e.length === 0) return;
722
805
  let t = new Set(["id"]);
723
806
  for (let n of e) t.add(n);
724
- for (let e of mt) t.add(e);
807
+ for (let e of Tt) t.add(e);
725
808
  let n = (e) => {
726
809
  if (!e) return;
727
810
  let n = [
@@ -741,54 +824,60 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
741
824
  e.swimlaneField,
742
825
  e.valueField,
743
826
  ...Array.isArray(e.cardFields) ? e.cardFields : [],
744
- ...Array.isArray(e.visibleFields) ? e.visibleFields : []
827
+ ...Array.isArray(e.visibleFields) ? e.visibleFields : [],
828
+ ...Array.isArray(e.metaFields) ? e.metaFields : []
745
829
  ];
746
830
  for (let e of n) typeof e == "string" && e && t.add(e);
747
831
  };
748
- return n(C.kanban), n(C.options?.kanban), n(C.calendar), n(C.options?.calendar), n(C.gallery), n(C.options?.gallery), n(C.timeline), n(C.options?.timeline), n(C.gantt), n(C.options?.gantt), Array.from(t);
749
- })(), u = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, d = await L.find(C.objectName, {
832
+ n(D.kanban), n(D.options?.kanban), n(D.calendar), n(D.options?.calendar), n(D.gallery), n(D.options?.gallery), n(D.timeline), n(D.options?.timeline);
833
+ {
834
+ let e = D.timeline ?? D.options?.timeline;
835
+ e && !Array.isArray(e.metaFields) && (t.add("status"), t.add("priority"));
836
+ }
837
+ return n(D.gantt), n(D.options?.gantt), Array.from(t);
838
+ })(), u = Array.isArray(n) ? n.length > 0 : !!n && Object.keys(n).length > 0, d = await z.find(D.objectName, {
750
839
  ...u ? { $filter: n } : {},
751
840
  $orderby: c,
752
- $top: U,
841
+ $top: G,
753
842
  ...l ? { $select: l } : {},
754
- ...mt.length > 0 ? { $expand: mt } : {},
755
- ...A ? {
756
- $search: A,
757
- ...C.searchableFields && C.searchableFields.length > 0 ? { $searchFields: C.searchableFields } : {}
843
+ ...Tt.length > 0 ? { $expand: Tt } : {},
844
+ ...I ? {
845
+ $search: I,
846
+ ...D.searchableFields && D.searchableFields.length > 0 ? { $searchFields: D.searchableFields } : {}
758
847
  } : {}
759
848
  });
760
- if (!e || t !== q.current) return;
849
+ if (!e || t !== ct.current) return;
761
850
  let f = [];
762
- 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)), z(f), Ue(f.length >= U);
851
+ 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)), V(f), Xe(f.length >= G);
763
852
  } catch (e) {
764
- t === q.current && console.error("ListView data fetch error:", e);
853
+ t === ct.current && console.error("ListView data fetch error:", e);
765
854
  } finally {
766
- e && t === q.current && B(!1);
855
+ e && t === ct.current && U(!1);
767
856
  }
768
857
  }
769
858
  })(), () => {
770
859
  e = !1;
771
860
  }) : void 0;
772
861
  }, [
773
- C.objectName,
774
- C.data,
862
+ D.objectName,
863
+ D.data,
864
+ z,
865
+ D.filters,
866
+ G,
775
867
  L,
776
- C.filters,
777
- U,
778
- P,
779
- I,
780
- J,
868
+ R,
869
+ lt,
781
870
  X,
782
- nt,
783
- Be,
784
- A,
785
- C.searchableFields,
786
- mt,
787
- ze,
788
- C.refreshTrigger
871
+ dt,
872
+ qe,
873
+ I,
874
+ D.searchableFields,
875
+ Tt,
876
+ Ge,
877
+ D.refreshTrigger
789
878
  ]);
790
- let ht = a.useMemo(() => {
791
- if (C.appearance?.allowedVisualizations && C.appearance.allowedVisualizations.length > 0) return C.appearance.allowedVisualizations.filter((e) => [
879
+ let Et = a.useMemo(() => {
880
+ if (D.appearance?.allowedVisualizations && D.appearance.allowedVisualizations.length > 0) return D.appearance.allowedVisualizations.filter((e) => [
792
881
  "grid",
793
882
  "kanban",
794
883
  "gallery",
@@ -798,7 +887,7 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
798
887
  "map"
799
888
  ].includes(e));
800
889
  let e = ["grid"];
801
- return (C.kanban?.groupField || C.options?.kanban?.groupField) && e.push("kanban"), (C.gallery?.coverField || C.gallery?.imageField || C.options?.gallery?.imageField) && e.push("gallery"), (C.calendar?.startDateField || C.options?.calendar?.startDateField) && e.push("calendar"), (C.timeline?.startDateField || C.options?.timeline?.startDateField || C.options?.timeline?.dateField || C.options?.calendar?.startDateField) && e.push("timeline"), (C.gantt?.startDateField || C.options?.gantt?.startDateField) && e.push("gantt"), (C.options?.map?.locationField || C.options?.map?.latitudeField && C.options?.map?.longitudeField) && e.push("map"), C.viewType && !e.includes(C.viewType) && [
890
+ return (D.kanban?.groupField || D.options?.kanban?.groupField) && e.push("kanban"), (D.gallery?.coverField || D.gallery?.imageField || D.options?.gallery?.imageField) && e.push("gallery"), (D.calendar?.startDateField || D.options?.calendar?.startDateField) && e.push("calendar"), (D.timeline?.startDateField || D.options?.timeline?.startDateField || D.options?.timeline?.dateField || D.options?.calendar?.startDateField) && e.push("timeline"), (D.gantt?.startDateField || D.options?.gantt?.startDateField) && e.push("gantt"), (D.options?.map?.locationField || D.options?.map?.latitudeField && D.options?.map?.longitudeField) && e.push("map"), D.viewType && !e.includes(D.viewType) && [
802
891
  "grid",
803
892
  "kanban",
804
893
  "calendar",
@@ -806,42 +895,42 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
806
895
  "gantt",
807
896
  "map",
808
897
  "gallery"
809
- ].includes(C.viewType) && e.push(C.viewType), e;
898
+ ].includes(D.viewType) && e.push(D.viewType), e;
810
899
  }, [
811
- C.options,
812
- C.viewType,
813
- C.kanban,
814
- C.calendar,
815
- C.gantt,
816
- C.gallery,
817
- C.timeline,
818
- C.appearance?.allowedVisualizations
900
+ D.options,
901
+ D.viewType,
902
+ D.kanban,
903
+ D.calendar,
904
+ D.gantt,
905
+ D.gallery,
906
+ D.timeline,
907
+ D.appearance?.allowedVisualizations
819
908
  ]);
820
909
  a.useEffect(() => {
821
- C.viewType && k(C.viewType);
822
- }, [C.viewType]);
823
- let gt = a.useCallback((e) => {
824
- k(e);
910
+ D.viewType && _e(D.viewType);
911
+ }, [D.viewType]);
912
+ let Dt = a.useCallback((e) => {
913
+ _e(e);
825
914
  try {
826
- localStorage.setItem(pt, e);
915
+ localStorage.setItem(wt, e);
827
916
  } catch (e) {
828
917
  console.warn("Failed to save view preference to localStorage:", e);
829
918
  }
830
919
  o?.(e);
831
- }, [pt, o]), _t = a.useCallback((e) => {
832
- se(e), l?.(e);
833
- }, [l]), vt = be({
834
- navigation: C.navigation,
835
- objectName: C.objectName,
836
- onNavigate: C.onNavigate,
837
- onRowClick: u
920
+ }, [wt, o]), Ot = a.useCallback((e) => {
921
+ ve(e), l?.(e);
922
+ }, [l]), kt = we({
923
+ navigation: D.navigation,
924
+ objectName: D.objectName,
925
+ onNavigate: D.onNavigate,
926
+ onRowClick: p
838
927
  }), $ = a.useMemo(() => {
839
- let e = C.fields || [];
928
+ let e = D.fields || [];
840
929
  if (Array.isArray(e) || (e = []), Y.size > 0 && (e = e.filter((e) => {
841
930
  let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
842
931
  return t != null && !Y.has(t);
843
- })), C.fieldOrder && C.fieldOrder.length > 0) {
844
- let t = new Map(C.fieldOrder.map((e, t) => [e, t]));
932
+ })), D.fieldOrder && D.fieldOrder.length > 0) {
933
+ let t = new Map(D.fieldOrder.map((e, t) => [e, t]));
845
934
  e = [...e].sort((e, n) => {
846
935
  let r = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field, i = typeof n == "string" ? n : n?.name || n?.fieldName || n?.field;
847
936
  return (t.get(r) ?? Infinity) - (t.get(i) ?? Infinity);
@@ -849,161 +938,181 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
849
938
  }
850
939
  return e;
851
940
  }, [
852
- C.fields,
941
+ D.fields,
853
942
  Y,
854
- C.fieldOrder
855
- ]), yt = a.useMemo(() => {
856
- let e = {
857
- objectName: C.objectName,
943
+ D.fieldOrder
944
+ ]), At = a.useMemo(() => {
945
+ let e = Q.mode === "compact" ? "compact" : Q.mode === "spacious" ? "tall" : "medium", t = {
946
+ objectName: D.objectName,
858
947
  fields: $,
859
- filters: C.filters,
860
- sort: P,
948
+ filters: D.filters,
949
+ sort: L,
861
950
  className: "h-full w-full",
862
951
  showSearch: !1,
863
- onRowClick: vt.handleClick,
864
- ...C.striped == null ? {} : { striped: C.striped },
865
- ...C.bordered == null ? {} : { bordered: C.bordered }
952
+ onRowClick: kt.handleClick,
953
+ rowHeight: e,
954
+ hideRowHeightToggle: !0,
955
+ ...D.striped == null ? {} : { striped: D.striped },
956
+ ...D.bordered == null ? {} : { bordered: D.bordered },
957
+ ...f ? { onColumnStateChange: f } : {},
958
+ ...D.columnState ? { columnState: D.columnState } : {}
866
959
  };
867
- switch (D) {
960
+ switch (j) {
868
961
  case "grid": return {
869
962
  type: "object-grid",
870
- ...e,
963
+ ...t,
871
964
  columns: $,
872
- ...C.conditionalFormatting ? { conditionalFormatting: C.conditionalFormatting } : {},
873
- ...C.inlineEdit == null ? {} : { editable: C.inlineEdit },
874
- ...C.wrapHeaders == null ? {} : { wrapHeaders: C.wrapHeaders },
875
- ...C.virtualScroll == null ? {} : { virtualScroll: C.virtualScroll },
876
- ...C.resizable == null ? {} : { resizable: C.resizable },
877
- ...C.selection ? { selection: C.selection } : {},
878
- ...C.pagination ? { pagination: C.pagination } : {},
879
- ...G ? { grouping: G } : {},
880
- ...K ? { rowColor: K } : {},
881
- ...C.rowActions ? { rowActions: C.rowActions } : {},
882
- ...C.bulkActions ? { batchActions: C.bulkActions } : {},
883
- ...C.options?.grid || {}
965
+ ...D.conditionalFormatting ? { conditionalFormatting: D.conditionalFormatting } : {},
966
+ ...D.inlineEdit == null ? {} : { editable: D.inlineEdit },
967
+ ...D.wrapHeaders == null ? {} : { wrapHeaders: D.wrapHeaders },
968
+ ...D.virtualScroll == null ? {} : { virtualScroll: D.virtualScroll },
969
+ ...D.resizable == null ? {} : { resizable: D.resizable },
970
+ ...D.selection ? { selection: D.selection } : {},
971
+ ...D.pagination ? { pagination: D.pagination } : {},
972
+ ...q ? { grouping: q } : {},
973
+ ...J ? { rowColor: J } : {},
974
+ ...D.rowActions ? { rowActions: D.rowActions } : {},
975
+ ...D.bulkActions ? { batchActions: D.bulkActions } : {},
976
+ ...D.options?.grid || {}
884
977
  };
885
978
  case "kanban": return {
886
979
  type: "object-kanban",
887
- ...e,
888
- groupBy: C.kanban?.groupField || C.options?.kanban?.groupField || "status",
889
- groupField: C.kanban?.groupField || C.options?.kanban?.groupField || "status",
890
- ...C.kanban?.titleField || C.options?.kanban?.titleField ? { titleField: C.kanban?.titleField || C.options?.kanban?.titleField } : {},
891
- cardFields: C.kanban?.cardFields || $ || [],
892
- ...G ? { grouping: G } : {},
893
- ...C.options?.kanban || {},
894
- ...C.kanban || {}
980
+ ...t,
981
+ groupBy: D.kanban?.groupField || D.options?.kanban?.groupField || "status",
982
+ groupField: D.kanban?.groupField || D.options?.kanban?.groupField || "status",
983
+ ...D.kanban?.titleField || D.options?.kanban?.titleField ? { titleField: D.kanban?.titleField || D.options?.kanban?.titleField } : {},
984
+ cardFields: D.kanban?.cardFields || $ || [],
985
+ ...q ? { grouping: q } : {},
986
+ ...D.options?.kanban || {},
987
+ ...D.kanban || {}
895
988
  };
896
989
  case "calendar": return {
897
990
  type: "object-calendar",
898
- ...e,
899
- startDateField: C.calendar?.startDateField || C.options?.calendar?.startDateField || "start_date",
900
- endDateField: C.calendar?.endDateField || C.options?.calendar?.endDateField || "end_date",
901
- ...C.calendar?.titleField || C.options?.calendar?.titleField ? { titleField: C.calendar?.titleField || C.options?.calendar?.titleField } : {},
902
- ...C.calendar?.defaultView ? { defaultView: C.calendar.defaultView } : {},
903
- ...C.options?.calendar || {},
904
- ...C.calendar || {}
991
+ ...t,
992
+ startDateField: D.calendar?.startDateField || D.options?.calendar?.startDateField || "start_date",
993
+ endDateField: D.calendar?.endDateField || D.options?.calendar?.endDateField || "end_date",
994
+ ...D.calendar?.titleField || D.options?.calendar?.titleField ? { titleField: D.calendar?.titleField || D.options?.calendar?.titleField } : {},
995
+ ...D.calendar?.defaultView ? { defaultView: D.calendar.defaultView } : {},
996
+ ...D.options?.calendar || {},
997
+ ...D.calendar || {}
905
998
  };
906
999
  case "gallery": {
907
- let t = {
908
- ...C.options?.gallery || {},
909
- ...C.gallery || {}
1000
+ let e = {
1001
+ ...D.options?.gallery || {},
1002
+ ...D.gallery || {}
910
1003
  };
911
1004
  return {
912
1005
  type: "object-gallery",
913
- ...e,
914
- gallery: Object.keys(t).length > 0 ? t : void 0,
915
- imageField: C.gallery?.coverField || C.gallery?.imageField || C.options?.gallery?.imageField,
916
- titleField: C.gallery?.titleField || C.options?.gallery?.titleField || "name",
917
- subtitleField: C.gallery?.subtitleField || C.options?.gallery?.subtitleField,
918
- ...G ? { grouping: G } : {}
1006
+ ...t,
1007
+ gallery: Object.keys(e).length > 0 ? e : void 0,
1008
+ imageField: D.gallery?.coverField || D.gallery?.imageField || D.options?.gallery?.imageField,
1009
+ titleField: D.gallery?.titleField || D.options?.gallery?.titleField || "name",
1010
+ subtitleField: D.gallery?.subtitleField || D.options?.gallery?.subtitleField,
1011
+ ...q ? { grouping: q } : {}
919
1012
  };
920
1013
  }
921
1014
  case "timeline": {
922
- let t = {
923
- ...C.options?.timeline || {},
924
- ...C.timeline || {}
1015
+ let e = {
1016
+ ...D.options?.timeline || {},
1017
+ ...D.timeline || {}
925
1018
  };
926
1019
  return {
927
1020
  type: "object-timeline",
928
- ...e,
929
- timeline: Object.keys(t).length > 0 ? t : void 0,
930
- startDateField: C.timeline?.startDateField || C.options?.timeline?.startDateField || C.options?.timeline?.dateField || "created_at",
931
- titleField: C.timeline?.titleField || C.options?.timeline?.titleField || "name",
932
- ...C.timeline?.endDateField ? { endDateField: C.timeline.endDateField } : {},
933
- ...C.timeline?.groupByField ? { groupByField: C.timeline.groupByField } : {},
934
- ...C.timeline?.colorField ? { colorField: C.timeline.colorField } : {},
935
- ...C.timeline?.scale ? { scale: C.timeline.scale } : {}
1021
+ ...t,
1022
+ timeline: Object.keys(e).length > 0 ? e : void 0,
1023
+ startDateField: D.timeline?.startDateField || D.options?.timeline?.startDateField || D.options?.timeline?.dateField || "created_at",
1024
+ titleField: D.timeline?.titleField || D.options?.timeline?.titleField || "name",
1025
+ ...D.timeline?.endDateField ? { endDateField: D.timeline.endDateField } : {},
1026
+ ...D.timeline?.groupByField ? { groupByField: D.timeline.groupByField } : {},
1027
+ ...D.timeline?.colorField ? { colorField: D.timeline.colorField } : {},
1028
+ ...D.timeline?.scale ? { scale: D.timeline.scale } : {}
936
1029
  };
937
1030
  }
938
1031
  case "gantt": return {
939
1032
  type: "object-gantt",
940
- ...e,
941
- startDateField: C.gantt?.startDateField || C.options?.gantt?.startDateField || "start_date",
942
- endDateField: C.gantt?.endDateField || C.options?.gantt?.endDateField || "end_date",
943
- progressField: C.gantt?.progressField || C.options?.gantt?.progressField || "progress",
944
- dependenciesField: C.gantt?.dependenciesField || C.options?.gantt?.dependenciesField || "dependencies",
945
- ...C.gantt?.titleField ? { titleField: C.gantt.titleField } : {},
946
- ...C.options?.gantt || {},
947
- ...C.gantt || {}
1033
+ ...t,
1034
+ startDateField: D.gantt?.startDateField || D.options?.gantt?.startDateField || "start_date",
1035
+ endDateField: D.gantt?.endDateField || D.options?.gantt?.endDateField || "end_date",
1036
+ progressField: D.gantt?.progressField || D.options?.gantt?.progressField || "progress",
1037
+ dependenciesField: D.gantt?.dependenciesField || D.options?.gantt?.dependenciesField || "dependencies",
1038
+ ...D.gantt?.titleField ? { titleField: D.gantt.titleField } : {},
1039
+ ...D.options?.gantt || {},
1040
+ ...D.gantt || {}
948
1041
  };
949
1042
  case "map": return {
950
1043
  type: "object-map",
951
- ...e,
952
- locationField: C.options?.map?.locationField || "location",
953
- ...C.options?.map || {}
1044
+ ...t,
1045
+ locationField: D.options?.map?.locationField || "location",
1046
+ ...D.options?.map || {}
954
1047
  };
955
- default: return e;
1048
+ default: return t;
956
1049
  }
957
1050
  }, [
1051
+ j,
958
1052
  D,
959
- C,
960
- P,
1053
+ L,
961
1054
  $,
962
- G,
963
- K,
964
- vt.handleClick
965
- ]), bt = I.conditions && I.conditions.length > 0, xt = a.useMemo(() => {
966
- let e;
967
- if (e = V?.fields ? Object.entries(V.fields).map(([e, t]) => ({
1055
+ q,
1056
+ J,
1057
+ kt.handleClick,
1058
+ Q.mode
1059
+ ]), jt = R.conditions && R.conditions.length > 0, Mt = a.useMemo(() => {
1060
+ let e, t = (e, t) => {
1061
+ if (!t) return;
1062
+ let n = Array.isArray(t) ? t.map((e) => ({
1063
+ value: e?.value ?? e,
1064
+ label: e?.label ?? String(e?.value ?? e),
1065
+ ...e && typeof e == "object" ? e : {}
1066
+ })) : Object.entries(t).map(([e, t]) => ({
1067
+ value: e,
1068
+ label: t?.label || e,
1069
+ ...t
1070
+ }));
1071
+ return D.objectName ? E(D.objectName, e, n) : n;
1072
+ };
1073
+ if (e = W?.fields ? Object.entries(W.fields).map(([e, n]) => ({
968
1074
  value: e,
969
- label: w(e, t.label || e),
970
- type: t.type || "text",
971
- options: t.options,
972
- referenceTo: t.reference_to || t.reference,
973
- displayField: t.display_field || t.reference_field,
974
- idField: t.id_field
975
- })) : (C.fields || []).map((e) => {
1075
+ label: O(e, n.label || e),
1076
+ type: n.type || "text",
1077
+ options: t(e, n.options),
1078
+ referenceTo: n.reference_to || n.reference,
1079
+ displayField: n.display_field || n.reference_field,
1080
+ idField: n.id_field
1081
+ })) : (D.fields || []).map((e) => {
976
1082
  if (typeof e == "string") return {
977
1083
  value: e,
978
1084
  label: e,
979
1085
  type: "text"
980
1086
  };
981
- let t = e.name || e.fieldName;
1087
+ let n = e.name || e.fieldName;
982
1088
  return {
983
- value: t,
984
- label: w(t, e.label || e.name),
1089
+ value: n,
1090
+ label: O(n, e.label || e.name),
985
1091
  type: e.type || "text",
986
- options: e.options,
1092
+ options: t(n, e.options),
987
1093
  referenceTo: e.reference_to || e.reference,
988
1094
  displayField: e.display_field || e.reference_field,
989
1095
  idField: e.id_field
990
1096
  };
991
- }), C.filterableFields && C.filterableFields.length > 0) {
992
- let t = new Set(C.filterableFields);
1097
+ }), D.filterableFields && D.filterableFields.length > 0) {
1098
+ let t = new Set(D.filterableFields);
993
1099
  e = e.filter((e) => t.has(e.value));
994
1100
  }
995
1101
  return e;
996
1102
  }, [
997
- V,
998
- C.fields,
999
- C.filterableFields
1000
- ]), St = a.useCallback((e) => {
1001
- tt((t) => {
1103
+ W,
1104
+ D.fields,
1105
+ D.filterableFields,
1106
+ D.objectName,
1107
+ O,
1108
+ E
1109
+ ]), Nt = a.useCallback((e) => {
1110
+ ut((t) => {
1002
1111
  let n = new Set(t);
1003
1112
  return n.has(e) ? n.delete(e) : n.add(e), n;
1004
1113
  });
1005
- }, []), Ct = a.useCallback((e) => {
1006
- let t = Z, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || C.objectName || "export", a = n > 0 ? R.slice(0, n) : R;
1114
+ }, []), Pt = a.useCallback((e) => {
1115
+ let t = Z, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || D.objectName || "export", a = n > 0 ? B.slice(0, n) : B;
1007
1116
  if (e === "csv") {
1008
1117
  let e = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field), t = [];
1009
1118
  r && t.push(e.join(",")), a.forEach((n) => {
@@ -1018,125 +1127,127 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
1018
1127
  let e = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
1019
1128
  n.href = t, n.download = `${i}.json`, n.click(), URL.revokeObjectURL(t);
1020
1129
  }
1021
- lt(!1);
1130
+ bt(!1);
1022
1131
  }, [
1023
- R,
1132
+ B,
1024
1133
  $,
1025
1134
  Z,
1026
- C.objectName
1027
- ]), wt = a.useMemo(() => (C.fields || []).map((e) => {
1135
+ D.objectName
1136
+ ]), Ft = a.useMemo(() => (D.fields || []).map((e) => {
1028
1137
  if (typeof e == "string") return {
1029
1138
  name: e,
1030
- label: w(e, e)
1139
+ label: O(e, e)
1031
1140
  };
1032
1141
  let t = e.name || e.fieldName || e.field;
1033
1142
  return {
1034
1143
  name: t,
1035
- label: w(t, e.label || e.name || e.field)
1144
+ label: O(t, e.label || e.name || e.field)
1036
1145
  };
1037
- }), [C.fields, w]);
1038
- return /* @__PURE__ */ N("div", {
1039
- ref: ut,
1040
- className: b("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
1041
- ...C.aria?.label ? { "aria-label": C.aria.label } : {},
1042
- ...C.aria?.describedBy ? { "aria-describedby": C.aria.describedBy } : {},
1043
- ...C.aria?.live ? { "aria-live": C.aria.live } : {},
1146
+ }), [D.fields, O]);
1147
+ return /* @__PURE__ */ F("div", {
1148
+ ref: xt,
1149
+ className: C("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
1150
+ ...D.aria?.label ? { "aria-label": D.aria.label } : {},
1151
+ ...D.aria?.describedBy ? { "aria-describedby": D.aria.describedBy } : {},
1152
+ ...D.aria?.live ? { "aria-live": D.aria.live } : {},
1044
1153
  role: "region",
1045
1154
  children: [
1046
- ft > 0 && /* @__PURE__ */ M("div", {
1155
+ Ct > 0 && /* @__PURE__ */ P("div", {
1047
1156
  className: "flex items-center justify-center text-xs text-muted-foreground",
1048
- style: { height: ft },
1049
- children: x(dt ? "list.refreshing" : "list.pullToRefresh")
1157
+ style: { height: Ct },
1158
+ children: T(St ? "list.refreshing" : "list.pullToRefresh")
1050
1159
  }),
1051
- f && /* @__PURE__ */ M("div", {
1052
- className: "border-b px-4 py-1 flex items-center bg-background",
1053
- children: /* @__PURE__ */ M(we, {
1054
- currentView: D,
1055
- availableViews: ht,
1056
- onViewChange: gt
1160
+ _ && /* @__PURE__ */ P("div", {
1161
+ className: "px-4 py-1 flex items-center bg-background",
1162
+ children: /* @__PURE__ */ P(Oe, {
1163
+ currentView: j,
1164
+ availableViews: Et,
1165
+ onViewChange: Dt
1057
1166
  })
1058
1167
  }),
1059
- C.tabs && C.tabs.length > 0 && /* @__PURE__ */ M(Ee, {
1060
- tabs: C.tabs,
1061
- activeTab: ke,
1062
- onTabChange: je
1063
- }),
1064
- C.description && C.appearance?.showDescription !== !1 && /* @__PURE__ */ M("div", {
1065
- className: "border-b px-4 py-1.5 text-xs text-muted-foreground bg-background",
1168
+ D.description && D.appearance?.showDescription !== !1 && /* @__PURE__ */ P("div", {
1169
+ className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
1066
1170
  "data-testid": "view-description",
1067
- children: typeof C.description == "string" ? C.description : ""
1171
+ children: typeof D.description == "string" ? D.description : ""
1068
1172
  }),
1069
- /* @__PURE__ */ N("div", {
1173
+ /* @__PURE__ */ F("div", {
1070
1174
  className: "border-b px-2 sm:px-4 py-1 flex items-center justify-between gap-1 sm:gap-2 bg-background",
1071
- children: [/* @__PURE__ */ M("div", {
1072
- className: "flex items-center gap-0.5 overflow-x-auto min-w-0",
1073
- children: it && /* @__PURE__ */ M("div", {
1074
- className: "shrink-0 min-w-0",
1075
- "data-testid": "user-filters",
1076
- children: /* @__PURE__ */ M(Oe, {
1077
- config: it,
1078
- objectDef: V,
1079
- data: R,
1080
- onFilterChange: rt,
1081
- maxVisible: 3
1175
+ children: [/* @__PURE__ */ F("div", {
1176
+ className: "flex items-center gap-2 overflow-x-auto min-w-0",
1177
+ children: [
1178
+ D.tabs && D.tabs.length > 0 && /* @__PURE__ */ P(je, {
1179
+ tabs: D.tabs,
1180
+ activeTab: Ie,
1181
+ onTabChange: Re,
1182
+ className: "!px-0 !py-0 shrink-0"
1183
+ }),
1184
+ D.tabs && D.tabs.length > 0 && pt && /* @__PURE__ */ P("div", { className: "h-4 w-px bg-border/60 mx-1 shrink-0" }),
1185
+ pt && /* @__PURE__ */ P("div", {
1186
+ className: "shrink-0 min-w-0",
1187
+ "data-testid": "user-filters",
1188
+ children: /* @__PURE__ */ P(Pe, {
1189
+ config: pt,
1190
+ objectDef: W,
1191
+ data: B,
1192
+ onFilterChange: ft,
1193
+ maxVisible: 3
1194
+ })
1082
1195
  })
1083
- })
1084
- }), /* @__PURE__ */ N("div", {
1085
- className: "flex items-center gap-0.5 shrink-0",
1196
+ ]
1197
+ }), /* @__PURE__ */ F("div", {
1198
+ className: "flex items-center gap-0 shrink-0",
1086
1199
  children: [
1087
- E.showHideFields && /* @__PURE__ */ N(g, {
1088
- open: ot,
1089
- onOpenChange: st,
1090
- children: [/* @__PURE__ */ M(v, {
1200
+ A.showHideFields && /* @__PURE__ */ F(y, {
1201
+ open: _t,
1202
+ onOpenChange: vt,
1203
+ children: [/* @__PURE__ */ P(x, {
1091
1204
  asChild: !0,
1092
- children: /* @__PURE__ */ N(d, {
1205
+ children: /* @__PURE__ */ F(d, {
1093
1206
  variant: "ghost",
1094
1207
  size: "sm",
1095
- className: b("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Y.size > 0 && "text-primary"),
1208
+ className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", Y.size > 0 && "text-primary"),
1096
1209
  children: [
1097
- /* @__PURE__ */ M(ae, { className: "h-3.5 w-3.5 mr-1.5" }),
1098
- /* @__PURE__ */ M("span", {
1210
+ /* @__PURE__ */ P(ae, { className: "h-3.5 w-3.5 mr-1.5" }),
1211
+ /* @__PURE__ */ P("span", {
1099
1212
  className: "hidden sm:inline",
1100
- children: x("list.hideFields")
1213
+ children: T("list.hideFields")
1101
1214
  }),
1102
- Y.size > 0 && /* @__PURE__ */ M("span", {
1103
- className: "ml-1 flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 text-[10px] font-medium text-primary",
1215
+ Y.size > 0 && /* @__PURE__ */ P("span", {
1216
+ className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
1104
1217
  children: Y.size
1105
1218
  })
1106
1219
  ]
1107
1220
  })
1108
- }), /* @__PURE__ */ M(_, {
1221
+ }), /* @__PURE__ */ P(b, {
1109
1222
  align: "start",
1110
1223
  className: "w-64 p-3",
1111
- children: /* @__PURE__ */ N("div", {
1224
+ children: /* @__PURE__ */ F("div", {
1112
1225
  className: "space-y-2",
1113
- children: [/* @__PURE__ */ N("div", {
1226
+ children: [/* @__PURE__ */ F("div", {
1114
1227
  className: "flex items-center justify-between border-b pb-2",
1115
- children: [/* @__PURE__ */ M("h4", {
1228
+ children: [/* @__PURE__ */ P("h4", {
1116
1229
  className: "font-medium text-sm",
1117
- children: x("list.hideFieldsTitle")
1118
- }), Y.size > 0 && /* @__PURE__ */ M(d, {
1230
+ children: T("list.hideFieldsTitle")
1231
+ }), Y.size > 0 && /* @__PURE__ */ P(d, {
1119
1232
  variant: "ghost",
1120
1233
  size: "sm",
1121
1234
  className: "h-6 px-2 text-xs",
1122
- onClick: () => at(/* @__PURE__ */ new Set()),
1123
- children: x("list.showAll")
1235
+ onClick: () => gt(/* @__PURE__ */ new Set()),
1236
+ children: T("list.showAll")
1124
1237
  })]
1125
- }), /* @__PURE__ */ M("div", {
1238
+ }), /* @__PURE__ */ P("div", {
1126
1239
  className: "max-h-60 overflow-y-auto space-y-1",
1127
- children: wt.map((e) => /* @__PURE__ */ N("label", {
1240
+ children: Ft.map((e) => /* @__PURE__ */ F("label", {
1128
1241
  className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
1129
- children: [/* @__PURE__ */ M("input", {
1242
+ children: [/* @__PURE__ */ P("input", {
1130
1243
  type: "checkbox",
1131
1244
  checked: !Y.has(e.name),
1132
1245
  onChange: () => {
1133
- at((t) => {
1134
- let n = new Set(t);
1135
- return n.has(e.name) ? n.delete(e.name) : n.add(e.name), n;
1136
- });
1246
+ let t = new Set(Y);
1247
+ t.has(e.name) ? t.delete(e.name) : t.add(e.name), gt(t);
1137
1248
  },
1138
1249
  className: "rounded border-input"
1139
- }), /* @__PURE__ */ M("span", {
1250
+ }), /* @__PURE__ */ P("span", {
1140
1251
  className: "truncate",
1141
1252
  children: e.label
1142
1253
  })]
@@ -1145,204 +1256,204 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
1145
1256
  })
1146
1257
  })]
1147
1258
  }),
1148
- E.showHideFields && (E.showFilters || E.showSort || E.showGroup) && /* @__PURE__ */ M("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
1149
- E.showFilters && /* @__PURE__ */ N(g, {
1150
- open: F,
1151
- onOpenChange: Te,
1152
- children: [/* @__PURE__ */ M(v, {
1259
+ A.showHideFields && (A.showFilters || A.showSort || A.showGroup) && /* @__PURE__ */ P("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
1260
+ A.showFilters && /* @__PURE__ */ F(y, {
1261
+ open: Me,
1262
+ onOpenChange: Ne,
1263
+ children: [/* @__PURE__ */ P(x, {
1153
1264
  asChild: !0,
1154
- children: /* @__PURE__ */ N(d, {
1265
+ children: /* @__PURE__ */ F(d, {
1155
1266
  variant: "ghost",
1156
1267
  size: "sm",
1157
- className: b("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", bt && "bg-primary/10 border border-primary/20 text-primary"),
1268
+ className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", jt && "text-foreground font-medium"),
1158
1269
  children: [
1159
- /* @__PURE__ */ M(fe, { className: "h-3.5 w-3.5 mr-1.5" }),
1160
- /* @__PURE__ */ M("span", {
1270
+ /* @__PURE__ */ P(pe, { className: "h-3.5 w-3.5 mr-1.5" }),
1271
+ /* @__PURE__ */ P("span", {
1161
1272
  className: "hidden sm:inline",
1162
- children: x("list.filter")
1273
+ children: T("list.filter")
1163
1274
  }),
1164
- bt && /* @__PURE__ */ M("span", {
1165
- className: "ml-1 flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 text-[10px] font-medium text-primary",
1166
- children: I.conditions?.length || 0
1275
+ jt && /* @__PURE__ */ P("span", {
1276
+ className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
1277
+ children: R.conditions?.length || 0
1167
1278
  })
1168
1279
  ]
1169
1280
  })
1170
- }), /* @__PURE__ */ M(_, {
1281
+ }), /* @__PURE__ */ P(b, {
1171
1282
  align: "start",
1172
1283
  className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
1173
- children: /* @__PURE__ */ N("div", {
1284
+ children: /* @__PURE__ */ F("div", {
1174
1285
  className: "space-y-4",
1175
- children: [/* @__PURE__ */ M("div", {
1286
+ children: [/* @__PURE__ */ P("div", {
1176
1287
  className: "flex items-center justify-between border-b pb-2",
1177
- children: /* @__PURE__ */ M("h4", {
1288
+ children: /* @__PURE__ */ P("h4", {
1178
1289
  className: "font-medium text-sm",
1179
- children: x("list.filterRecords")
1290
+ children: T("list.filterRecords")
1180
1291
  })
1181
- }), /* @__PURE__ */ M(m, {
1182
- fields: xt,
1183
- value: I,
1292
+ }), /* @__PURE__ */ P(m, {
1293
+ fields: Mt,
1294
+ value: R,
1184
1295
  onChange: (e) => {
1185
- De(e), s && s(e);
1296
+ Fe(e), s && s(e);
1186
1297
  }
1187
1298
  })]
1188
1299
  })
1189
1300
  })]
1190
1301
  }),
1191
- E.showGroup && /* @__PURE__ */ N(g, {
1192
- open: qe,
1193
- onOpenChange: Je,
1194
- children: [/* @__PURE__ */ M(v, {
1302
+ A.showGroup && /* @__PURE__ */ F(y, {
1303
+ open: et,
1304
+ onOpenChange: tt,
1305
+ children: [/* @__PURE__ */ P(x, {
1195
1306
  asChild: !0,
1196
- children: /* @__PURE__ */ N(d, {
1307
+ children: /* @__PURE__ */ F(d, {
1197
1308
  variant: "ghost",
1198
1309
  size: "sm",
1199
- className: b("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", G && "bg-primary/10 border border-primary/20 text-primary"),
1310
+ className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", q && "text-foreground font-medium"),
1200
1311
  children: [
1201
- /* @__PURE__ */ M(O, { className: "h-3.5 w-3.5 mr-1.5" }),
1202
- /* @__PURE__ */ M("span", {
1312
+ /* @__PURE__ */ P(oe, { className: "h-3.5 w-3.5 mr-1.5" }),
1313
+ /* @__PURE__ */ P("span", {
1203
1314
  className: "hidden sm:inline",
1204
- children: x("list.group")
1315
+ children: T("list.group")
1205
1316
  }),
1206
- G && G.fields?.length > 0 && /* @__PURE__ */ M("span", {
1207
- className: "ml-1 flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 text-[10px] font-medium text-primary",
1208
- children: G.fields.length
1317
+ q && q.fields?.length > 0 && /* @__PURE__ */ P("span", {
1318
+ className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
1319
+ children: q.fields.length
1209
1320
  })
1210
1321
  ]
1211
1322
  })
1212
- }), /* @__PURE__ */ M(_, {
1323
+ }), /* @__PURE__ */ P(b, {
1213
1324
  align: "start",
1214
1325
  className: "w-72 p-3",
1215
- children: /* @__PURE__ */ N("div", {
1326
+ children: /* @__PURE__ */ F("div", {
1216
1327
  className: "space-y-2",
1217
- children: [/* @__PURE__ */ N("div", {
1328
+ children: [/* @__PURE__ */ F("div", {
1218
1329
  className: "flex items-center justify-between border-b pb-2",
1219
- children: [/* @__PURE__ */ M("h4", {
1330
+ children: [/* @__PURE__ */ P("h4", {
1220
1331
  className: "font-medium text-sm",
1221
- children: x("list.groupBy")
1222
- }), G && /* @__PURE__ */ M(d, {
1332
+ children: T("list.groupBy")
1333
+ }), q && /* @__PURE__ */ P(d, {
1223
1334
  variant: "ghost",
1224
1335
  size: "sm",
1225
1336
  className: "h-6 px-2 text-xs",
1226
- onClick: () => Ke(void 0),
1337
+ onClick: () => $e(void 0),
1227
1338
  "data-testid": "clear-grouping",
1228
- children: x("list.clear")
1339
+ children: T("list.clear")
1229
1340
  })]
1230
- }), /* @__PURE__ */ M("div", {
1341
+ }), /* @__PURE__ */ P("div", {
1231
1342
  "data-testid": "group-field-list",
1232
- children: /* @__PURE__ */ M(ee, {
1233
- value: G,
1234
- fieldOptions: wt.map((e) => ({
1343
+ children: /* @__PURE__ */ P(h, {
1344
+ value: q,
1345
+ fieldOptions: Ft.map((e) => ({
1235
1346
  value: e.name,
1236
1347
  label: e.label || e.name
1237
1348
  })),
1238
1349
  maxLevels: 3,
1239
1350
  labels: {
1240
- addGroup: x("list.addGroup", "Add group field"),
1241
- collapseTitle: x("list.collapsedByDefault", "Collapsed by default"),
1242
- removeTitle: x("list.removeGroup", "Remove")
1351
+ addGroup: T("list.addGroup", "Add group field"),
1352
+ collapseTitle: T("list.collapsedByDefault", "Collapsed by default"),
1353
+ removeTitle: T("list.removeGroup", "Remove")
1243
1354
  },
1244
- onChange: (e) => Ke(e)
1355
+ onChange: (e) => $e(e)
1245
1356
  })
1246
1357
  })]
1247
1358
  })
1248
1359
  })]
1249
1360
  }),
1250
- E.showSort && /* @__PURE__ */ N(g, {
1251
- open: ve,
1252
- onOpenChange: Se,
1253
- children: [/* @__PURE__ */ M(v, {
1361
+ A.showSort && /* @__PURE__ */ F(y, {
1362
+ open: Te,
1363
+ onOpenChange: De,
1364
+ children: [/* @__PURE__ */ P(x, {
1254
1365
  asChild: !0,
1255
- children: /* @__PURE__ */ N(d, {
1366
+ children: /* @__PURE__ */ F(d, {
1256
1367
  variant: "ghost",
1257
1368
  size: "sm",
1258
- className: b("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", P.length > 0 && "bg-primary/10 border border-primary/20 text-primary"),
1369
+ className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", L.length > 0 && "text-foreground font-medium"),
1259
1370
  children: [
1260
- /* @__PURE__ */ M(ie, { className: "h-3.5 w-3.5 mr-1.5" }),
1261
- /* @__PURE__ */ M("span", {
1371
+ /* @__PURE__ */ P(ee, { className: "h-3.5 w-3.5 mr-1.5" }),
1372
+ /* @__PURE__ */ P("span", {
1262
1373
  className: "hidden sm:inline",
1263
- children: x("list.sort")
1374
+ children: T("list.sort")
1264
1375
  }),
1265
- P.length > 0 && /* @__PURE__ */ M("span", {
1266
- className: "ml-1 flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 text-[10px] font-medium text-primary",
1267
- children: P.length
1376
+ L.length > 0 && /* @__PURE__ */ P("span", {
1377
+ className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
1378
+ children: L.length
1268
1379
  })
1269
1380
  ]
1270
1381
  })
1271
- }), /* @__PURE__ */ M(_, {
1382
+ }), /* @__PURE__ */ P(b, {
1272
1383
  align: "start",
1273
1384
  className: "w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4",
1274
- children: /* @__PURE__ */ N("div", {
1385
+ children: /* @__PURE__ */ F("div", {
1275
1386
  className: "space-y-4",
1276
- children: [/* @__PURE__ */ M("div", {
1387
+ children: [/* @__PURE__ */ P("div", {
1277
1388
  className: "flex items-center justify-between border-b pb-2",
1278
- children: /* @__PURE__ */ M("h4", {
1389
+ children: /* @__PURE__ */ P("h4", {
1279
1390
  className: "font-medium text-sm",
1280
- children: x("list.sortRecords")
1391
+ children: T("list.sortRecords")
1281
1392
  })
1282
- }), /* @__PURE__ */ M(y, {
1283
- fields: xt,
1284
- value: P,
1393
+ }), /* @__PURE__ */ P(S, {
1394
+ fields: Mt,
1395
+ value: L,
1285
1396
  onChange: (e) => {
1286
- Ce(e), c && c(e);
1397
+ ke(e), c && c(e);
1287
1398
  }
1288
1399
  })]
1289
1400
  })
1290
1401
  })]
1291
1402
  }),
1292
- (E.showFilters || E.showSort || E.showGroup) && (E.showColor || E.showDensity) && /* @__PURE__ */ M("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
1293
- E.showColor && /* @__PURE__ */ N(g, {
1294
- open: Ze,
1295
- onOpenChange: Qe,
1296
- children: [/* @__PURE__ */ M(v, {
1403
+ (A.showFilters || A.showSort || A.showGroup) && (A.showColor || A.showDensity) && /* @__PURE__ */ P("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
1404
+ A.showColor && /* @__PURE__ */ F(y, {
1405
+ open: it,
1406
+ onOpenChange: at,
1407
+ children: [/* @__PURE__ */ P(x, {
1297
1408
  asChild: !0,
1298
- children: /* @__PURE__ */ N(d, {
1409
+ children: /* @__PURE__ */ F(d, {
1299
1410
  variant: "ghost",
1300
1411
  size: "sm",
1301
- className: b("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", K && "bg-primary/10 border border-primary/20 text-primary"),
1302
- children: [/* @__PURE__ */ M(ce, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
1412
+ className: C("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", J && "text-foreground font-medium"),
1413
+ children: [/* @__PURE__ */ P(M, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
1303
1414
  className: "hidden sm:inline",
1304
- children: x("list.color")
1415
+ children: T("list.color")
1305
1416
  })]
1306
1417
  })
1307
- }), /* @__PURE__ */ M(_, {
1418
+ }), /* @__PURE__ */ P(b, {
1308
1419
  align: "start",
1309
1420
  className: "w-64 p-3",
1310
- children: /* @__PURE__ */ N("div", {
1421
+ children: /* @__PURE__ */ F("div", {
1311
1422
  className: "space-y-2",
1312
- children: [/* @__PURE__ */ N("div", {
1423
+ children: [/* @__PURE__ */ F("div", {
1313
1424
  className: "flex items-center justify-between border-b pb-2",
1314
- children: [/* @__PURE__ */ M("h4", {
1425
+ children: [/* @__PURE__ */ P("h4", {
1315
1426
  className: "font-medium text-sm",
1316
- children: x("list.rowColor")
1317
- }), K && /* @__PURE__ */ M(d, {
1427
+ children: T("list.rowColor")
1428
+ }), J && /* @__PURE__ */ P(d, {
1318
1429
  variant: "ghost",
1319
1430
  size: "sm",
1320
1431
  className: "h-6 px-2 text-xs",
1321
- onClick: () => Xe(void 0),
1432
+ onClick: () => rt(void 0),
1322
1433
  "data-testid": "clear-row-color",
1323
- children: x("list.clear")
1434
+ children: T("list.clear")
1324
1435
  })]
1325
- }), /* @__PURE__ */ N("div", {
1436
+ }), /* @__PURE__ */ F("div", {
1326
1437
  className: "space-y-2",
1327
1438
  "data-testid": "color-field-list",
1328
- children: [/* @__PURE__ */ M("label", {
1439
+ children: [/* @__PURE__ */ P("label", {
1329
1440
  className: "text-xs text-muted-foreground",
1330
- children: x("list.colorByField")
1331
- }), /* @__PURE__ */ N("select", {
1441
+ children: T("list.colorByField")
1442
+ }), /* @__PURE__ */ F("select", {
1332
1443
  className: "w-full h-8 rounded border border-input bg-background px-2 text-xs",
1333
- value: K?.field || "",
1444
+ value: J?.field || "",
1334
1445
  onChange: (e) => {
1335
1446
  let t = e.target.value;
1336
- Xe(t ? {
1447
+ rt(t ? {
1337
1448
  field: t,
1338
- colors: K?.colors || {}
1449
+ colors: J?.colors || {}
1339
1450
  } : void 0);
1340
1451
  },
1341
1452
  "data-testid": "color-field-select",
1342
- children: [/* @__PURE__ */ M("option", {
1453
+ children: [/* @__PURE__ */ P("option", {
1343
1454
  value: "",
1344
- children: x("list.none")
1345
- }), wt.map((e) => /* @__PURE__ */ M("option", {
1455
+ children: T("list.none")
1456
+ }), Ft.map((e) => /* @__PURE__ */ P("option", {
1346
1457
  value: e.name,
1347
1458
  children: e.label
1348
1459
  }, e.name))]
@@ -1351,253 +1462,271 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
1351
1462
  })
1352
1463
  })]
1353
1464
  }),
1354
- E.showDensity && /* @__PURE__ */ N(d, {
1355
- variant: "ghost",
1356
- size: "sm",
1357
- className: b("h-7 px-2 text-muted-foreground hover:text-primary text-xs hidden lg:flex transition-colors duration-150", Q.mode !== "compact" && "bg-primary/10 border border-primary/20 text-primary"),
1358
- onClick: Q.cycle,
1359
- title: `Density: ${Q.mode}`,
1360
- children: [/* @__PURE__ */ M(re, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
1361
- className: "hidden sm:inline capitalize",
1362
- children: Q.mode
1363
- })]
1364
- }),
1365
- (E.showColor || E.showDensity) && Z && C.allowExport !== !1 && /* @__PURE__ */ M("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
1366
- Z && C.allowExport !== !1 && /* @__PURE__ */ N(g, {
1367
- open: ct,
1368
- onOpenChange: lt,
1369
- children: [/* @__PURE__ */ M(v, {
1465
+ A.showDensity && (() => {
1466
+ let e = Q.mode === "compact" ? ue : Q.mode === "comfortable" ? le : ce;
1467
+ return /* @__PURE__ */ P(d, {
1468
+ variant: "ghost",
1469
+ size: "sm",
1470
+ "aria-label": `Density: ${Q.mode}`,
1471
+ className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Q.mode !== "compact" && "text-foreground font-medium"),
1472
+ onClick: Q.cycle,
1473
+ title: `Density: ${Q.mode} (click to cycle)`,
1474
+ children: /* @__PURE__ */ P(e, { className: "h-3.5 w-3.5" })
1475
+ });
1476
+ })(),
1477
+ (A.showColor || A.showDensity) && Z && D.allowExport !== !1 && /* @__PURE__ */ P("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }),
1478
+ Z && D.allowExport !== !1 && /* @__PURE__ */ F(y, {
1479
+ open: yt,
1480
+ onOpenChange: bt,
1481
+ children: [/* @__PURE__ */ P(x, {
1370
1482
  asChild: !0,
1371
- children: /* @__PURE__ */ N(d, {
1483
+ children: /* @__PURE__ */ F(d, {
1372
1484
  variant: "ghost",
1373
1485
  size: "sm",
1374
1486
  className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
1375
- children: [/* @__PURE__ */ M(T, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
1487
+ children: [/* @__PURE__ */ P(ie, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
1376
1488
  className: "hidden sm:inline",
1377
- children: x("list.export")
1489
+ children: T("list.export")
1378
1490
  })]
1379
1491
  })
1380
- }), /* @__PURE__ */ M(_, {
1492
+ }), /* @__PURE__ */ P(b, {
1381
1493
  align: "start",
1382
1494
  className: "w-48 p-2",
1383
- children: /* @__PURE__ */ M("div", {
1495
+ children: /* @__PURE__ */ P("div", {
1384
1496
  className: "space-y-1",
1385
- children: (Z.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ N(d, {
1497
+ children: (Z.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ F(d, {
1386
1498
  variant: "ghost",
1387
1499
  size: "sm",
1388
1500
  className: "w-full justify-start h-8 text-xs",
1389
- onClick: () => Ct(e),
1390
- children: [/* @__PURE__ */ M(T, { className: "h-3.5 w-3.5 mr-2" }), x("list.exportAs", { format: e.toUpperCase() })]
1501
+ onClick: () => Pt(e),
1502
+ children: [/* @__PURE__ */ P(ie, { className: "h-3.5 w-3.5 mr-2" }), T("list.exportAs", { format: e.toUpperCase() })]
1391
1503
  }, e))
1392
1504
  })
1393
1505
  })]
1394
1506
  }),
1395
- (C.sharing?.enabled || C.sharing?.type) && /* @__PURE__ */ N(d, {
1507
+ (D.sharing?.enabled || D.sharing?.type) && /* @__PURE__ */ F(d, {
1396
1508
  variant: "ghost",
1397
1509
  size: "sm",
1398
1510
  className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
1399
- title: `Sharing: ${C.sharing?.visibility || C.sharing?.type || "private"}`,
1511
+ title: `Sharing: ${D.sharing?.visibility || D.sharing?.type || "private"}`,
1400
1512
  "data-testid": "share-button",
1401
- children: [/* @__PURE__ */ M(de, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
1513
+ children: [/* @__PURE__ */ P(fe, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
1402
1514
  className: "hidden sm:inline",
1403
- children: x("list.share")
1515
+ children: T("list.share")
1404
1516
  })]
1405
1517
  }),
1406
- C.allowPrinting && /* @__PURE__ */ N(d, {
1518
+ D.allowPrinting && /* @__PURE__ */ F(d, {
1407
1519
  variant: "ghost",
1408
1520
  size: "sm",
1409
1521
  className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
1410
1522
  onClick: () => window.print(),
1411
1523
  "data-testid": "print-button",
1412
- children: [/* @__PURE__ */ M(le, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
1524
+ children: [/* @__PURE__ */ P(se, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
1413
1525
  className: "hidden sm:inline",
1414
- children: x("list.print")
1526
+ children: T("list.print")
1415
1527
  })]
1416
1528
  }),
1417
1529
  (() => {
1418
- let e = C.allowPrinting || C.sharing?.enabled || C.sharing?.type || Z && C.allowExport !== !1;
1419
- return E.showSearch && e ? /* @__PURE__ */ M("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }) : null;
1530
+ let e = D.allowPrinting || D.sharing?.enabled || D.sharing?.type || Z && D.allowExport !== !1;
1531
+ return A.showSearch && e ? /* @__PURE__ */ P("div", { className: "h-4 w-px bg-border/60 mx-0.5 shrink-0" }) : null;
1420
1532
  })(),
1421
- E.showSearch && /* @__PURE__ */ N(g, {
1422
- open: he,
1423
- onOpenChange: _e,
1424
- children: [/* @__PURE__ */ M(v, {
1533
+ A.showSearch && /* @__PURE__ */ F(y, {
1534
+ open: xe,
1535
+ onOpenChange: Se,
1536
+ children: [/* @__PURE__ */ P(x, {
1425
1537
  asChild: !0,
1426
- children: /* @__PURE__ */ M(d, {
1538
+ children: /* @__PURE__ */ P(d, {
1427
1539
  variant: "ghost",
1428
1540
  size: "sm",
1429
- className: b("h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", A && "bg-primary/10 border border-primary/20 text-primary"),
1541
+ className: C("h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", I && "text-foreground font-medium"),
1430
1542
  "data-testid": "search-icon-button",
1431
- title: x("list.search"),
1432
- children: /* @__PURE__ */ M(ue, { className: "h-3.5 w-3.5" })
1543
+ title: T("list.search"),
1544
+ children: /* @__PURE__ */ P(de, { className: "h-3.5 w-3.5" })
1433
1545
  })
1434
- }), /* @__PURE__ */ M(_, {
1546
+ }), /* @__PURE__ */ P(b, {
1435
1547
  align: "end",
1436
1548
  className: "w-[calc(100vw-2rem)] sm:w-64 p-2",
1437
1549
  "data-testid": "search-popover",
1438
- children: /* @__PURE__ */ N("div", {
1550
+ children: /* @__PURE__ */ F("div", {
1439
1551
  className: "relative",
1440
1552
  children: [
1441
- /* @__PURE__ */ M(ue, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
1442
- /* @__PURE__ */ M(te, {
1443
- placeholder: x("list.search") + "...",
1444
- value: A,
1445
- onChange: (e) => _t(e.target.value),
1553
+ /* @__PURE__ */ P(de, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
1554
+ /* @__PURE__ */ P(g, {
1555
+ placeholder: T("list.search") + "...",
1556
+ value: I,
1557
+ onChange: (e) => Ot(e.target.value),
1446
1558
  className: "pl-7 h-8 text-xs",
1447
1559
  autoFocus: !0
1448
1560
  }),
1449
- A && /* @__PURE__ */ M(d, {
1561
+ I && /* @__PURE__ */ P(d, {
1450
1562
  variant: "ghost",
1451
1563
  size: "sm",
1452
1564
  className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
1453
- onClick: () => _t(""),
1454
- children: /* @__PURE__ */ M(pe, { className: "h-3 w-3" })
1565
+ onClick: () => Ot(""),
1566
+ children: /* @__PURE__ */ P(he, { className: "h-3 w-3" })
1455
1567
  })
1456
1568
  ]
1457
1569
  })
1458
1570
  })]
1459
1571
  }),
1460
- E.showAddRecord && E.addRecordPosition === "top" && /* @__PURE__ */ N(d, {
1572
+ A.showAddRecord && A.addRecordPosition === "top" && /* @__PURE__ */ F(d, {
1461
1573
  variant: "ghost",
1462
1574
  size: "sm",
1463
1575
  className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
1464
1576
  "data-testid": "add-record-button",
1465
- onClick: () => p.onAddRecord?.(),
1466
- children: [/* @__PURE__ */ M(j, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
1577
+ onClick: () => w.onAddRecord?.(),
1578
+ children: [/* @__PURE__ */ P(N, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
1467
1579
  className: "hidden sm:inline",
1468
- children: x("list.addRecord")
1580
+ children: T("list.addRecord")
1469
1581
  })]
1470
1582
  })
1471
1583
  ]
1472
1584
  })]
1473
1585
  }),
1474
- X && X.length > 0 && /* @__PURE__ */ M("div", {
1586
+ X && X.length > 0 && /* @__PURE__ */ P("div", {
1475
1587
  className: "border-b px-2 sm:px-4 py-1 flex items-center gap-1 flex-wrap bg-background",
1476
1588
  "data-testid": "quick-filters",
1477
1589
  children: X.map((e) => {
1478
- let t = J.has(e.id), n = e.icon ? me[e.icon.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
1479
- return /* @__PURE__ */ N(d, {
1590
+ let t = lt.has(e.id), n = e.icon ? ge[e.icon.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null : null;
1591
+ return /* @__PURE__ */ F(d, {
1480
1592
  variant: t ? "default" : "outline",
1481
1593
  size: "sm",
1482
1594
  className: "h-7 px-3 text-xs",
1483
- onClick: () => St(e.id),
1484
- children: [n && /* @__PURE__ */ M(n, { className: "h-3 w-3 mr-1.5" }), e.label]
1595
+ onClick: () => Nt(e.id),
1596
+ children: [n && /* @__PURE__ */ P(n, { className: "h-3 w-3 mr-1.5" }), e.label]
1485
1597
  }, e.id);
1486
1598
  })
1487
1599
  }),
1488
- /* @__PURE__ */ M("div", {
1600
+ /* @__PURE__ */ P("div", {
1489
1601
  className: "flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200",
1490
- children: !Fe && R.length === 0 ? (() => {
1491
- let e = C.emptyState?.icon;
1492
- return /* @__PURE__ */ N("div", {
1602
+ children: !H && B.length === 0 && (j === "grid" || j === "list") ? (() => {
1603
+ let e = D.emptyState?.icon;
1604
+ return /* @__PURE__ */ F("div", {
1493
1605
  className: "flex flex-col items-center justify-center h-full min-h-[200px] text-center p-8",
1494
1606
  "data-testid": "empty-state",
1495
1607
  children: [
1496
- /* @__PURE__ */ M(e ? me[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? oe : oe, { className: "h-12 w-12 text-muted-foreground/50 mb-4" }),
1497
- /* @__PURE__ */ M("h3", {
1608
+ /* @__PURE__ */ P(e ? ge[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? k : k, { className: "h-12 w-12 text-muted-foreground/50 mb-4" }),
1609
+ /* @__PURE__ */ P("h3", {
1498
1610
  className: "text-lg font-medium text-foreground mb-1",
1499
- children: (typeof C.emptyState?.title == "string" ? C.emptyState.title : void 0) ?? "No items found"
1611
+ children: (typeof D.emptyState?.title == "string" ? D.emptyState.title : void 0) ?? "No items found"
1500
1612
  }),
1501
- /* @__PURE__ */ M("p", {
1613
+ /* @__PURE__ */ P("p", {
1502
1614
  className: "text-sm text-muted-foreground max-w-md",
1503
- children: (typeof C.emptyState?.message == "string" ? C.emptyState.message : void 0) ?? "There are no records to display. Try adjusting your filters or adding new data."
1615
+ children: (typeof D.emptyState?.message == "string" ? D.emptyState.message : void 0) ?? "There are no records to display. Try adjusting your filters or adding new data."
1504
1616
  }),
1505
- E.showAddRecord && /* @__PURE__ */ N(d, {
1617
+ A.showAddRecord && /* @__PURE__ */ F(d, {
1506
1618
  variant: "default",
1507
1619
  size: "sm",
1508
1620
  className: "mt-4",
1509
1621
  "data-testid": "empty-state-add-record",
1510
- onClick: () => p.onAddRecord?.(),
1511
- children: [/* @__PURE__ */ M(j, { className: "h-4 w-4 mr-1.5" }), x("list.addRecord")]
1622
+ onClick: () => w.onAddRecord?.(),
1623
+ children: [/* @__PURE__ */ P(N, { className: "h-4 w-4 mr-1.5" }), T("list.addRecord")]
1512
1624
  })
1513
1625
  ]
1514
1626
  });
1515
- })() : /* @__PURE__ */ M(ge, {
1516
- schema: yt,
1517
- ...p,
1518
- data: R,
1519
- loading: Fe,
1520
- onRowSelect: et
1627
+ })() : /* @__PURE__ */ P(be, {
1628
+ schema: At,
1629
+ ...w,
1630
+ data: B,
1631
+ loading: H,
1632
+ onRowSelect: st
1521
1633
  })
1522
- }, D),
1523
- E.showAddRecord && E.addRecordPosition === "bottom" && /* @__PURE__ */ M("div", {
1634
+ }, j),
1635
+ A.showAddRecord && A.addRecordPosition === "bottom" && /* @__PURE__ */ P("div", {
1524
1636
  className: "border-t px-2 sm:px-4 py-1 bg-background shrink-0",
1525
- children: /* @__PURE__ */ N(d, {
1637
+ children: /* @__PURE__ */ F(d, {
1526
1638
  variant: "ghost",
1527
1639
  size: "sm",
1528
1640
  className: "h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
1529
1641
  "data-testid": "add-record-button",
1530
- onClick: () => p.onAddRecord?.(),
1531
- children: [/* @__PURE__ */ M(j, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ M("span", {
1642
+ onClick: () => w.onAddRecord?.(),
1643
+ children: [/* @__PURE__ */ P(N, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ P("span", {
1532
1644
  className: "hidden sm:inline",
1533
- children: x("list.addRecord")
1645
+ children: T("list.addRecord")
1534
1646
  })]
1535
1647
  })
1536
1648
  }),
1537
- C.bulkActions && C.bulkActions.length > 0 && $e.length > 0 && D !== "grid" && /* @__PURE__ */ N("div", {
1538
- className: "border-t px-4 py-1.5 flex items-center gap-2 text-xs bg-primary/5 shrink-0",
1649
+ D.bulkActions && D.bulkActions.length > 0 && ot.length > 0 && j !== "grid" && /* @__PURE__ */ F("div", {
1650
+ 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",
1651
+ role: "region",
1652
+ "aria-label": "Bulk actions",
1539
1653
  "data-testid": "bulk-actions-bar",
1540
1654
  children: [
1541
- /* @__PURE__ */ N("span", {
1542
- className: "text-muted-foreground font-medium",
1543
- children: [$e.length, " selected"]
1655
+ /* @__PURE__ */ P(ne, { className: "h-3.5 w-3.5 text-primary shrink-0" }),
1656
+ /* @__PURE__ */ F("span", {
1657
+ className: "font-medium",
1658
+ children: [
1659
+ ot.length,
1660
+ " ",
1661
+ ot.length === 1 ? "item" : "items",
1662
+ " selected"
1663
+ ]
1544
1664
  }),
1545
- /* @__PURE__ */ M("div", {
1546
- className: "flex items-center gap-1 ml-2",
1547
- children: C.bulkActions.map((e) => /* @__PURE__ */ M(d, {
1548
- variant: "outline",
1549
- size: "sm",
1550
- className: "h-6 px-2 text-xs",
1551
- onClick: () => p.onBulkAction?.(e, $e),
1552
- "data-testid": `bulk-action-${e}`,
1553
- children: Me(e)
1554
- }, e))
1665
+ /* @__PURE__ */ P("div", {
1666
+ className: "flex items-center gap-1.5 ml-3",
1667
+ children: D.bulkActions.map((e) => {
1668
+ let t = String(e).toLowerCase(), n = t.includes("delete") || t.includes("remove") || t.includes("destroy"), r = n ? me : null;
1669
+ return /* @__PURE__ */ F(d, {
1670
+ variant: n ? "destructive" : "outline",
1671
+ size: "sm",
1672
+ className: "h-7 px-2.5 text-xs gap-1.5",
1673
+ onClick: () => w.onBulkAction?.(e, ot),
1674
+ "data-testid": `bulk-action-${e}`,
1675
+ children: [r && /* @__PURE__ */ P(r, { className: "h-3 w-3" }), ze(e)]
1676
+ }, e);
1677
+ })
1555
1678
  }),
1556
- /* @__PURE__ */ M(d, {
1679
+ /* @__PURE__ */ F(d, {
1557
1680
  variant: "ghost",
1558
1681
  size: "sm",
1559
- className: "h-6 px-2 text-xs ml-auto",
1560
- onClick: () => et([]),
1561
- children: "Clear"
1682
+ className: "h-7 px-2 text-xs ml-auto gap-1",
1683
+ onClick: () => st([]),
1684
+ children: [/* @__PURE__ */ P(he, { className: "h-3 w-3" }), "Clear"]
1562
1685
  })
1563
1686
  ]
1564
1687
  }),
1565
- !Fe && R.length > 0 && C.showRecordCount !== !1 && /* @__PURE__ */ N("div", {
1566
- className: "border-t px-4 py-1.5 flex items-center gap-2 text-xs text-muted-foreground bg-background shrink-0",
1688
+ !H && B.length > 0 && D.showRecordCount !== !1 && /* @__PURE__ */ F("div", {
1689
+ className: "border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0",
1567
1690
  "data-testid": "record-count-bar",
1568
1691
  children: [
1569
- /* @__PURE__ */ M("span", { children: R.length === 1 ? x("list.recordCountOne", { count: R.length }) : x("list.recordCount", { count: R.length }) }),
1570
- He && /* @__PURE__ */ M("span", {
1692
+ /* @__PURE__ */ P("span", {
1693
+ className: "font-medium text-foreground/80",
1694
+ children: B.length === 1 ? T("list.recordCountOne", { count: B.length }) : T("list.recordCount", { count: B.length })
1695
+ }),
1696
+ Ye && /* @__PURE__ */ P("span", {
1571
1697
  className: "text-amber-600",
1572
1698
  "data-testid": "data-limit-warning",
1573
- children: x("list.dataLimitReached", { limit: U })
1699
+ children: T("list.dataLimitReached", { limit: G })
1574
1700
  }),
1575
- C.pagination?.pageSizeOptions && C.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ M("select", {
1576
- className: "ml-auto h-6 rounded border border-input bg-background px-1 text-xs",
1577
- value: U,
1578
- onChange: (e) => {
1579
- let t = Number(e.target.value);
1580
- Ge(t), p.onPageSizeChange && p.onPageSizeChange(t);
1581
- },
1582
- "data-testid": "page-size-selector",
1583
- children: C.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ N("option", {
1584
- value: e,
1585
- children: [e, " / page"]
1586
- }, e))
1701
+ D.pagination?.pageSizeOptions && D.pagination.pageSizeOptions.length > 0 && /* @__PURE__ */ F("div", {
1702
+ className: "ml-auto flex items-center gap-2",
1703
+ children: [/* @__PURE__ */ P("span", { children: T("table.rowsPerPage", { defaultValue: "Rows per page" }) }), /* @__PURE__ */ P("select", {
1704
+ "data-testid": "page-size-selector",
1705
+ className: "h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background",
1706
+ value: String(G),
1707
+ onChange: (e) => {
1708
+ let t = Number(e.target.value);
1709
+ Qe(t), w.onPageSizeChange && w.onPageSizeChange(t);
1710
+ },
1711
+ children: D.pagination.pageSizeOptions.map((e) => /* @__PURE__ */ P("option", {
1712
+ value: String(e),
1713
+ children: e
1714
+ }, e))
1715
+ })]
1587
1716
  })
1588
1717
  ]
1589
1718
  }),
1590
- vt.isOverlay && /* @__PURE__ */ M(ne, {
1591
- ...vt,
1592
- title: C.label ? `${C.label} Detail` : C.objectName ? `${C.objectName.charAt(0).toUpperCase() + C.objectName.slice(1)} Detail` : "Record Detail",
1593
- children: (e) => /* @__PURE__ */ M("div", {
1719
+ kt.isOverlay && /* @__PURE__ */ P(v, {
1720
+ ...kt,
1721
+ title: D.label ? `${D.label} Detail` : D.objectName ? `${D.objectName.charAt(0).toUpperCase() + D.objectName.slice(1)} Detail` : "Record Detail",
1722
+ children: (e) => /* @__PURE__ */ P("div", {
1594
1723
  className: "space-y-3",
1595
- children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ N("div", {
1724
+ children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ F("div", {
1596
1725
  className: "flex flex-col",
1597
- children: [/* @__PURE__ */ M("span", {
1726
+ children: [/* @__PURE__ */ P("span", {
1598
1727
  className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
1599
1728
  children: e.replace(/_/g, " ")
1600
- }), /* @__PURE__ */ M("span", {
1729
+ }), /* @__PURE__ */ P("span", {
1601
1730
  className: "text-sm",
1602
1731
  children: String(t ?? "—")
1603
1732
  })]
@@ -1607,29 +1736,49 @@ var V = a.forwardRef(({ schema: e, className: n, onViewChange: o, onFilterChange
1607
1736
  ]
1608
1737
  });
1609
1738
  });
1610
- V.displayName = "ListView";
1739
+ H.displayName = "ListView";
1611
1740
  //#endregion
1612
1741
  //#region src/ObjectGallery.tsx
1613
- var Re = {
1742
+ var U = {
1614
1743
  small: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
1615
1744
  medium: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
1616
1745
  large: "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
1617
- }, ze = {
1746
+ }, W = {
1618
1747
  small: "aspect-square",
1619
1748
  medium: "aspect-[4/3]",
1620
1749
  large: "aspect-[16/10]"
1621
- }, H = (e) => {
1622
- let { schema: n } = e, r = s(_e), i = e.dataSource || r?.dataSource, a = ve(n.bind), [d, m] = u([]), [ee, te] = u(!1), [h, g] = u(null), _ = be({
1750
+ }, We = (e) => {
1751
+ let { schema: n } = e, r = s(xe), i = e.dataSource || r?.dataSource, a = Se(n.bind), [d, m] = u([]), [h, g] = u(!1), [_, y] = u(null), b = we({
1623
1752
  navigation: n.navigation,
1624
1753
  objectName: n.objectName,
1625
1754
  onRowClick: e.onRowClick ?? e.onCardClick
1626
- }), v = n.gallery, y = v?.coverField ?? n.imageField ?? "image", x = v?.coverFit ?? "cover", re = v?.cardSize ?? "medium", ie = v?.titleField ?? n.titleField ?? "name", S = v?.visibleFields;
1755
+ }), x = n.gallery, S = x?.coverField ?? n.imageField ?? "image", w = x?.coverFit ?? "cover", ee = x?.cardSize ?? "medium", te = x?.titleField ?? n.titleField ?? "name", ne = x?.visibleFields, { fieldOptionLabel: ie } = Te(), ae = o((e, t) => {
1756
+ if (t == null || t === "") return "";
1757
+ if (typeof t == "object") return t.label ?? t.name ?? t.id ?? JSON.stringify(t);
1758
+ let r = _?.fields?.[e];
1759
+ if ((r?.type === "select" || r?.type === "status" || r?.type === "multiselect") && n.objectName) {
1760
+ let i = String(t);
1761
+ if (Array.isArray(r.options)) {
1762
+ let e = r.options.find((e) => String(e?.value ?? e) === String(t));
1763
+ e && (i = e.label ?? i);
1764
+ } else if (r.options && typeof r.options == "object") {
1765
+ let e = r.options[String(t)];
1766
+ e && (i = e.label ?? i);
1767
+ }
1768
+ return ie(n.objectName, e, String(t), i);
1769
+ }
1770
+ return String(t);
1771
+ }, [
1772
+ _,
1773
+ n.objectName,
1774
+ ie
1775
+ ]);
1627
1776
  c(() => {
1628
1777
  let e = !0;
1629
1778
  return (async () => {
1630
1779
  if (!(!i || typeof i.getObjectSchema != "function" || !n.objectName)) try {
1631
1780
  let t = await i.getObjectSchema(n.objectName);
1632
- e && g(t);
1781
+ e && y(t);
1633
1782
  } catch (e) {
1634
1783
  console.warn("Failed to fetch object def for ObjectGallery", e);
1635
1784
  }
@@ -1644,9 +1793,9 @@ var Re = {
1644
1793
  }
1645
1794
  return n.objectName && !a && !n.data && !e.data && (async () => {
1646
1795
  if (!(!i || typeof i.find != "function" || !n.objectName)) {
1647
- r && te(!0);
1796
+ r && g(!0);
1648
1797
  try {
1649
- let e = t(h?.fields), a = await i.find(n.objectName, {
1798
+ let e = t(_?.fields), a = await i.find(n.objectName, {
1650
1799
  $filter: n.filter,
1651
1800
  ...e.length > 0 ? { $expand: e } : {}
1652
1801
  }), o = [];
@@ -1659,7 +1808,7 @@ var Re = {
1659
1808
  } catch (e) {
1660
1809
  console.error("[ObjectGallery] Fetch error:", e);
1661
1810
  } finally {
1662
- r && te(!1);
1811
+ r && g(!1);
1663
1812
  }
1664
1813
  }
1665
1814
  })(), () => {
@@ -1672,20 +1821,20 @@ var Re = {
1672
1821
  n.data,
1673
1822
  n.filter,
1674
1823
  e.data,
1675
- h
1824
+ _
1676
1825
  ]);
1677
- let T = e.data || a || n.data || d || [], ae = l(() => T.some((e) => typeof e[y] == "string" && !!e[y]), [T, y]), E = !!v?.coverField || ae, D = n.grouping?.fields, O = !!(D && D.length > 0), [k, oe] = u({}), A = l(() => D ? D.some((e) => e.collapsed) : !1, [D]), se = o((e) => {
1678
- oe((t) => ({
1826
+ let E = e.data || a || n.data || d || [], D = l(() => E.some((e) => typeof e[S] == "string" && !!e[S]), [E, S]), oe = !!x?.coverField || D, O = n.grouping?.fields, k = !!(O && O.length > 0), [A, j] = u({}), M = l(() => O ? O.some((e) => e.collapsed) : !1, [O]), N = o((e) => {
1827
+ j((t) => ({
1679
1828
  ...t,
1680
- [e]: t[e] === void 0 ? !A : !t[e]
1829
+ [e]: t[e] === void 0 ? !M : !t[e]
1681
1830
  }));
1682
- }, [A]), ce = l(() => {
1683
- if (!O || !D) return [];
1831
+ }, [M]), se = l(() => {
1832
+ if (!k || !O) return [];
1684
1833
  let e = /* @__PURE__ */ new Map(), t = [];
1685
- for (let n of T) {
1686
- let r = D.map((e) => String(n[e.field] ?? "")).join(" / ");
1834
+ for (let n of E) {
1835
+ let r = O.map((e) => String(n[e.field] ?? "")).join(" / ");
1687
1836
  if (!e.has(r)) {
1688
- let i = D.map((e) => {
1837
+ let i = O.map((e) => {
1689
1838
  let t = n[e.field];
1690
1839
  return t != null && t !== "" ? String(t) : "(empty)";
1691
1840
  }).join(" / ");
@@ -1696,7 +1845,7 @@ var Re = {
1696
1845
  }
1697
1846
  e.get(r).items.push(n);
1698
1847
  }
1699
- let n = D[0]?.order ?? "asc";
1848
+ let n = O[0]?.order ?? "asc";
1700
1849
  return t.sort((e, t) => {
1701
1850
  let r = e.localeCompare(t, void 0, {
1702
1851
  numeric: !0,
@@ -1704,7 +1853,7 @@ var Re = {
1704
1853
  });
1705
1854
  return n === "desc" ? -r : r;
1706
1855
  }), t.map((t) => {
1707
- let n = e.get(t), r = t in k ? k[t] : A;
1856
+ let n = e.get(t), r = t in A ? A[t] : M;
1708
1857
  return {
1709
1858
  key: t,
1710
1859
  label: n.label,
@@ -1713,92 +1862,92 @@ var Re = {
1713
1862
  };
1714
1863
  });
1715
1864
  }, [
1716
- T,
1717
- D,
1865
+ E,
1718
1866
  O,
1719
1867
  k,
1720
- A
1868
+ A,
1869
+ M
1721
1870
  ]);
1722
- if (ee && !T.length) return /* @__PURE__ */ M("div", {
1871
+ if (h && !E.length) return /* @__PURE__ */ P("div", {
1723
1872
  className: "p-4 text-sm text-muted-foreground",
1724
1873
  children: "Loading Gallery..."
1725
1874
  });
1726
- if (!T.length) return /* @__PURE__ */ M("div", {
1875
+ if (!E.length) return /* @__PURE__ */ P("div", {
1727
1876
  className: "p-4 text-sm text-muted-foreground",
1728
1877
  children: "No items to display"
1729
1878
  });
1730
- let j = (t, r) => {
1731
- let i = t.id ?? t._id ?? r, a = String(t[ie] ?? "Untitled"), o = t[y];
1732
- return /* @__PURE__ */ N(f, {
1879
+ let ce = (t, r) => {
1880
+ let i = t.id ?? t._id ?? r, a = String(t[te] ?? "Untitled"), o = t[S];
1881
+ return /* @__PURE__ */ F(f, {
1733
1882
  role: "listitem",
1734
- className: b("group overflow-hidden transition-all hover:shadow-md", (e.onCardClick || e.onRowClick || n.navigation) && "cursor-pointer"),
1735
- onClick: () => _.handleClick(t),
1736
- children: [/* @__PURE__ */ M("div", {
1737
- className: b("w-full overflow-hidden bg-muted relative", ze[re]),
1738
- hidden: !E,
1739
- children: o ? /* @__PURE__ */ M("img", {
1883
+ className: C("group overflow-hidden transition-all hover:shadow-md", (e.onCardClick || e.onRowClick || n.navigation) && "cursor-pointer"),
1884
+ onClick: () => b.handleClick(t),
1885
+ children: [/* @__PURE__ */ P("div", {
1886
+ className: C("w-full overflow-hidden bg-muted relative", W[ee]),
1887
+ hidden: !oe,
1888
+ children: o ? /* @__PURE__ */ P("img", {
1740
1889
  src: o,
1741
1890
  alt: a,
1742
- className: b("h-full w-full transition-transform group-hover:scale-105", x === "cover" && "object-cover", x === "contain" && "object-contain")
1743
- }) : /* @__PURE__ */ M("div", {
1891
+ className: C("h-full w-full transition-transform group-hover:scale-105", w === "cover" && "object-cover", w === "contain" && "object-contain")
1892
+ }) : /* @__PURE__ */ P("div", {
1744
1893
  className: "flex h-full w-full items-center justify-center bg-secondary/50 text-muted-foreground",
1745
- children: /* @__PURE__ */ M("span", {
1894
+ children: /* @__PURE__ */ P("span", {
1746
1895
  className: "text-4xl font-light opacity-20",
1747
1896
  children: a[0]?.toUpperCase()
1748
1897
  })
1749
1898
  })
1750
- }), /* @__PURE__ */ N(p, {
1751
- className: b("p-3", E && "border-t"),
1752
- children: [/* @__PURE__ */ M("h3", {
1899
+ }), /* @__PURE__ */ F(p, {
1900
+ className: C("p-3", oe && "border-t"),
1901
+ children: [/* @__PURE__ */ P("h3", {
1753
1902
  className: "font-medium truncate text-sm",
1754
1903
  title: a,
1755
1904
  children: a
1756
- }), S && S.length > 0 && /* @__PURE__ */ M("div", {
1905
+ }), ne && ne.length > 0 && /* @__PURE__ */ P("div", {
1757
1906
  className: "mt-1 space-y-0.5",
1758
- children: S.map((e) => {
1907
+ children: ne.map((e) => {
1759
1908
  let n = t[e];
1760
- return n == null || n === "" ? null : /* @__PURE__ */ M("p", {
1909
+ return n == null || n === "" ? null : /* @__PURE__ */ P("p", {
1761
1910
  className: "text-xs text-muted-foreground truncate",
1762
- children: typeof n == "object" ? n.label ?? n.name ?? n.id ?? JSON.stringify(n) : String(n)
1911
+ children: ae(e, n)
1763
1912
  }, e);
1764
1913
  })
1765
1914
  })]
1766
1915
  })]
1767
1916
  }, i);
1768
- }, le = (e) => /* @__PURE__ */ M("div", {
1769
- className: b("grid gap-4 p-4 auto-rows-min content-start", Re[re], n.className),
1917
+ }, le = (e) => /* @__PURE__ */ P("div", {
1918
+ className: C("grid gap-4 p-4 auto-rows-min content-start", U[ee], n.className),
1770
1919
  role: "list",
1771
- children: e.map((e, t) => j(e, t))
1920
+ children: e.map((e, t) => ce(e, t))
1772
1921
  });
1773
- return /* @__PURE__ */ N(he, { children: [O ? /* @__PURE__ */ M("div", {
1922
+ return /* @__PURE__ */ F(_e, { children: [k ? /* @__PURE__ */ P("div", {
1774
1923
  className: "space-y-2",
1775
- children: ce.map((e) => /* @__PURE__ */ N("div", {
1924
+ children: se.map((e) => /* @__PURE__ */ F("div", {
1776
1925
  className: "border rounded-md",
1777
- children: [/* @__PURE__ */ N("button", {
1926
+ children: [/* @__PURE__ */ F("button", {
1778
1927
  type: "button",
1779
1928
  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",
1780
- onClick: () => se(e.key),
1929
+ onClick: () => N(e.key),
1781
1930
  children: [
1782
- e.collapsed ? /* @__PURE__ */ M(w, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ M(C, { className: "h-4 w-4 shrink-0" }),
1783
- /* @__PURE__ */ M("span", { children: e.label }),
1784
- /* @__PURE__ */ M("span", {
1931
+ e.collapsed ? /* @__PURE__ */ P(re, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ P(T, { className: "h-4 w-4 shrink-0" }),
1932
+ /* @__PURE__ */ P("span", { children: e.label }),
1933
+ /* @__PURE__ */ P("span", {
1785
1934
  className: "ml-auto text-xs text-muted-foreground",
1786
1935
  children: e.items.length
1787
1936
  })
1788
1937
  ]
1789
1938
  }), !e.collapsed && le(e.items)]
1790
1939
  }, e.key))
1791
- }) : le(T), _.isOverlay && /* @__PURE__ */ M(ne, {
1792
- ..._,
1940
+ }) : le(E), b.isOverlay && /* @__PURE__ */ P(v, {
1941
+ ...b,
1793
1942
  title: "Gallery Item",
1794
- children: (e) => /* @__PURE__ */ M("div", {
1943
+ children: (e) => /* @__PURE__ */ P("div", {
1795
1944
  className: "space-y-3",
1796
- children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ N("div", {
1945
+ children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ F("div", {
1797
1946
  className: "flex flex-col",
1798
- children: [/* @__PURE__ */ M("span", {
1947
+ children: [/* @__PURE__ */ P("span", {
1799
1948
  className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
1800
1949
  children: e.replace(/_/g, " ")
1801
- }), /* @__PURE__ */ M("span", {
1950
+ }), /* @__PURE__ */ P("span", {
1802
1951
  className: "text-sm",
1803
1952
  children: String(t ?? "—")
1804
1953
  })]
@@ -1806,11 +1955,11 @@ var Re = {
1806
1955
  })
1807
1956
  })] });
1808
1957
  };
1809
- e.register("object-gallery", H, {
1958
+ e.register("object-gallery", We, {
1810
1959
  namespace: "plugin-list",
1811
1960
  label: "Gallery View",
1812
1961
  category: "view"
1813
- }), e.register("list-view", V, {
1962
+ }), e.register("list-view", H, {
1814
1963
  namespace: "plugin-list",
1815
1964
  label: "List View",
1816
1965
  category: "Views",
@@ -1887,7 +2036,7 @@ e.register("object-gallery", H, {
1887
2036
  sort: [],
1888
2037
  options: {}
1889
2038
  }
1890
- }), e.register("list", V, {
2039
+ }), e.register("list", H, {
1891
2040
  namespace: "view",
1892
2041
  category: "view",
1893
2042
  label: "List",
@@ -1958,4 +2107,4 @@ e.register("object-gallery", H, {
1958
2107
  ]
1959
2108
  });
1960
2109
  //#endregion
1961
- export { V as ListView, H as ObjectGallery, Ee as TabBar, Oe as UserFilters, we as ViewSwitcher, Fe as evaluateConditionalFormatting, z as normalizeFilterCondition, Ne as normalizeFilters };
2110
+ export { H as ListView, We as ObjectGallery, je as TabBar, Pe as UserFilters, Oe as ViewSwitcher, B as evaluateConditionalFormatting, z as normalizeFilterCondition, Be as normalizeFilters };