@object-ui/plugin-dashboard 5.0.1 → 5.1.1

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,32 +1,32 @@
1
1
  import { ComponentRegistry as e, computeDrillFilter as t, extractRecords as n, isDrillEnabled as r, resolveDateMacros as i, resolveDrillTitle as a } from "@object-ui/core";
2
2
  import { SchemaRenderer as o, SchemaRendererContext as s, useActionEngine as c, useDataScope as l, useDnd as u, useHasDndProvider as d, useObjectLabel as f } from "@object-ui/react";
3
- import { Button as p, Card as m, CardContent as h, CardHeader as g, CardTitle as _, Combobox as v, ConfigPanelRenderer as y, ConfigRow as b, Dialog as x, DialogContent as S, DialogHeader as C, DialogTitle as w, RefreshIndicator as T, Sheet as E, SheetContent as D, SheetHeader as O, SheetTitle as k, Skeleton as A, cn as j, getLazyIcon as M, useConfigDraft as N } from "@object-ui/components";
4
- import * as P from "react";
5
- import { Fragment as ee, forwardRef as te, useCallback as F, useContext as ne, useEffect as I, useMemo as L, useRef as re, useState as R } from "react";
6
- import { AlertCircle as z, ArrowDownIcon as B, ArrowUpIcon as V, Edit as H, GripVertical as ie, Loader2 as U, MinusIcon as ae, RefreshCw as oe, Save as se, Settings as W, X as ce } from "lucide-react";
7
- import { DndContext as G, PointerSensor as le, closestCenter as K, useSensor as ue, useSensors as de } from "@dnd-kit/core";
8
- import { SortableContext as fe, arrayMove as pe, rectSortingStrategy as me, useSortable as q, verticalListSortingStrategy as he } from "@dnd-kit/sortable";
9
- import { CSS as J } from "@dnd-kit/utilities";
10
- import { Fragment as Y, jsx as X, jsxs as Z } from "react/jsx-runtime";
11
- import { ResponsiveGridLayout as ge, useContainerWidth as _e } from "react-grid-layout";
3
+ import { createSafeTranslation as p, useObjectTranslation as m, useSafeFieldLabel as h } from "@object-ui/i18n";
4
+ import { Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Combobox as x, ConfigPanelRenderer as S, ConfigRow as C, Dialog as w, DialogContent as T, DialogHeader as E, DialogTitle as D, RefreshIndicator as O, Sheet as k, SheetContent as A, SheetHeader as j, SheetTitle as ee, Skeleton as M, cn as N, getLazyIcon as P, useConfigDraft as F } from "@object-ui/components";
5
+ import * as I from "react";
6
+ import { Fragment as L, forwardRef as te, useCallback as R, useContext as ne, useEffect as z, useMemo as B, useRef as V, useState as H } from "react";
7
+ import { AlertCircle as U, ArrowDownIcon as re, ArrowUpIcon as W, Edit as G, GripVertical as ie, Loader2 as K, MinusIcon as q, RefreshCw as ae, Save as J, Settings as oe, X as se } from "lucide-react";
8
+ import { DndContext as ce, PointerSensor as le, closestCenter as ue, useSensor as de, useSensors as fe } from "@dnd-kit/core";
9
+ import { SortableContext as pe, arrayMove as me, rectSortingStrategy as he, useSortable as ge, verticalListSortingStrategy as _e } from "@dnd-kit/sortable";
10
+ import { CSS as Y } from "@dnd-kit/utilities";
11
+ import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
12
+ import { ResponsiveGridLayout as ve, useContainerWidth as ye } from "react-grid-layout";
12
13
  import "react-grid-layout/css/styles.css";
13
- import { createSafeTranslation as ve, useObjectTranslation as ye, useSafeFieldLabel as be } from "@object-ui/i18n";
14
- import { formatCurrency as xe, formatDate as Se, formatPercent as Ce, getCellRenderer as we, resolveCellRendererType as Te } from "@object-ui/fields";
14
+ import { formatCurrency as be, formatDate as xe, formatPercent as Se, getCellRenderer as Ce, resolveCellRendererType as we } from "@object-ui/fields";
15
15
  //#region src/utils.ts
16
- function Q(e) {
16
+ function $(e) {
17
17
  return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
18
18
  }
19
19
  //#endregion
20
20
  //#region src/DashboardRenderer.tsx
21
- function Ee({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
22
- let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = q({
21
+ function Te({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
22
+ let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = ge({
23
23
  id: e,
24
24
  disabled: t
25
25
  });
26
- return /* @__PURE__ */ X("div", {
26
+ return /* @__PURE__ */ Z("div", {
27
27
  ref: s,
28
28
  style: {
29
- transform: J.Transform.toString(c),
29
+ transform: Y.Transform.toString(c),
30
30
  transition: l,
31
31
  opacity: u ? .4 : 1,
32
32
  ...n ? {
@@ -34,17 +34,17 @@ function Ee({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
34
34
  gridRow: `span ${n.h}`
35
35
  } : {}
36
36
  },
37
- className: j("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
37
+ className: N("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
38
38
  "data-sortable-widget-id": e,
39
39
  ...a,
40
40
  ...o,
41
41
  children: i
42
42
  });
43
43
  }
44
- function De(e) {
45
- return e ? M(e) : null;
44
+ function Ee(e) {
45
+ return e ? P(e) : null;
46
46
  }
47
- function $(e) {
47
+ function De(e) {
48
48
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
49
49
  }
50
50
  var Oe = [
@@ -65,8 +65,8 @@ var Oe = [
65
65
  function Ae(e) {
66
66
  return ke.has(e) ? { enabled: !0 } : void 0;
67
67
  }
68
- var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: s, selectedWidgetId: l, onWidgetClick: u, onWidgetsReorder: d, modalHandler: v, scriptHandlers: y, hideHeaderText: b, ...x }, S) => {
69
- let C = (() => {
68
+ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: s, selectedWidgetId: l, onWidgetClick: u, onWidgetsReorder: d, modalHandler: p, scriptHandlers: h, hideHeaderText: x, ...S }, C) => {
69
+ let w = (() => {
70
70
  if (e.columns != null) return e.columns;
71
71
  let t = e.widgets ?? [], n = 0;
72
72
  for (let e of t) {
@@ -74,44 +74,44 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
74
74
  t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
75
75
  }
76
76
  return n > 4 ? 12 : 4;
77
- })(), w = C, T = e.gap || 4, [E, D] = R(!1), [O, k] = R(!1), A = re(null), { executeAction: M, engine: N } = c({ actions: L(() => (e.header?.actions ?? []).map((e) => ({
77
+ })(), T = w, E = e.gap || 4, [D, O] = H(!1), [k, A] = H(!1), j = V(null), { executeAction: ee, engine: M } = c({ actions: B(() => (e.header?.actions ?? []).map((e) => ({
78
78
  name: e.actionUrl || e.label,
79
79
  type: e.actionType || "url",
80
80
  target: e.actionUrl,
81
81
  label: e.label
82
- })), [e.header?.actions]) }), { dashboardLabel: P, dashboardDescription: te, dashboardActionLabel: ne, widgetTitle: z, widgetDescription: B, fieldLabel: V } = f(), H = e.name, ie = F((e) => H ? ne(H, e.actionUrl || e.label, e.label) : e.label, [H, ne]), U = F((e) => {
83
- let t = $(e.title);
84
- return !H || !e.id || t === void 0 ? t : z(H, e.id, t);
85
- }, [H, z]), ae = F((e) => {
86
- let t = $(e.description);
87
- return !H || !e.id ? t : B(H, e.id, t);
88
- }, [H, B]);
89
- I(() => {
90
- let e = N.getRunner();
91
- if (v && e.setModalHandler(v), y) for (let [t, n] of Object.entries(y)) e.registerScript(t, n);
82
+ })), [e.header?.actions]) }), { dashboardLabel: P, dashboardDescription: F, dashboardActionLabel: I, widgetTitle: te, widgetDescription: ne, fieldLabel: U } = f(), { t: re } = m(), W = R((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? re(`report.aggregate.${n}`, { defaultValue: n }) : e ? U(e, t, t) : t, [re, U]), G = e.name, ie = R((e) => G ? I(G, e.actionUrl || e.label, e.label) : e.label, [G, I]), K = R((e) => {
83
+ let t = De(e.title);
84
+ return !G || !e.id || t === void 0 ? t : te(G, e.id, t);
85
+ }, [G, te]), q = R((e) => {
86
+ let t = De(e.description);
87
+ return !G || !e.id ? t : ne(G, e.id, t);
88
+ }, [G, ne]);
89
+ z(() => {
90
+ let e = M.getRunner();
91
+ if (p && e.setModalHandler(p), h) for (let [t, n] of Object.entries(h)) e.registerScript(t, n);
92
92
  }, [
93
- N,
94
- v,
95
- y
96
- ]), I(() => {
97
- let e = () => k(window.innerWidth < 768);
93
+ M,
94
+ p,
95
+ h
96
+ ]), z(() => {
97
+ let e = () => A(window.innerWidth < 768);
98
98
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
99
99
  }, []);
100
- let se = F(() => {
101
- r && (D(!0), r(), setTimeout(() => D(!1), 600));
100
+ let J = R(() => {
101
+ r && (O(!0), r(), setTimeout(() => O(!1), 600));
102
102
  }, [r]);
103
- I(() => {
104
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return A.current = setInterval(se, e.refreshInterval * 1e3), () => {
105
- A.current && clearInterval(A.current);
103
+ z(() => {
104
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return j.current = setInterval(J, e.refreshInterval * 1e3), () => {
105
+ j.current && clearInterval(j.current);
106
106
  };
107
107
  }, [
108
108
  e.refreshInterval,
109
109
  r,
110
- se
110
+ J
111
111
  ]);
112
- let W = F((e, t) => {
112
+ let oe = R((e, t) => {
113
113
  !s || !u || !t || (e.stopPropagation(), u(t));
114
- }, [s, u]), ce = F((t, n, r) => {
114
+ }, [s, u]), se = R((t, n, r) => {
115
115
  if (!s || !u) return;
116
116
  let i = e.widgets || [];
117
117
  if (t.key === "Enter" || t.key === " ") t.preventDefault(), u(n ?? null);
@@ -128,27 +128,27 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
128
128
  s,
129
129
  u,
130
130
  e.widgets
131
- ]), q = F((e) => {
131
+ ]), ge = R((e) => {
132
132
  !s || !u || e.target === e.currentTarget && u(null);
133
- }, [s, u]), J = !!(s && d), Y = de(ue(le, { activationConstraint: { distance: 5 } })), ge = F((t) => {
134
- if (!J) return;
133
+ }, [s, u]), Y = !!(s && d), X = fe(de(le, { activationConstraint: { distance: 5 } })), ve = R((t) => {
134
+ if (!Y) return;
135
135
  let { active: n, over: r } = t;
136
136
  if (!r || n.id === r.id) return;
137
137
  let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
138
- a < 0 || o < 0 || d?.(pe(i, a, o));
138
+ a < 0 || o < 0 || d?.(me(i, a, o));
139
139
  }, [
140
- J,
140
+ Y,
141
141
  e.widgets,
142
142
  d
143
- ]), _e = (e, t, r) => {
143
+ ]), ye = (e, t, r) => {
144
144
  let i = e.layout ? {
145
145
  ...e.layout,
146
- w: Math.min(e.layout.w, w)
146
+ w: Math.min(e.layout.w, T)
147
147
  } : void 0, a = (() => {
148
148
  if (e.component) return e.component;
149
149
  let t = e.type, n = e.options || {};
150
150
  if (t === "metric" && e.object) {
151
- let t = n.data, r = Q(t) && t.aggregate ? {
151
+ let t = n.data, r = $(t) && t.aggregate ? {
152
152
  field: e.valueField || t.aggregate.field,
153
153
  function: e.aggregate || t.aggregate.function,
154
154
  groupBy: e.categoryField ?? t.aggregate.groupBy ?? "_all"
@@ -159,10 +159,10 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
159
159
  } : void 0;
160
160
  return {
161
161
  type: "object-metric",
162
- objectName: e.object || (Q(t) ? t.object : void 0),
162
+ objectName: e.object || ($(t) ? t.object : void 0),
163
163
  aggregate: r,
164
- filter: (Q(t) ? t.filter : void 0) || e.filter,
165
- label: n.label || U(e) || "",
164
+ filter: ($(t) ? t.filter : void 0) || e.filter,
165
+ label: n.label || K(e) || "",
166
166
  fallbackValue: n.value,
167
167
  trend: n.trend,
168
168
  icon: n.icon,
@@ -173,7 +173,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
173
173
  prefix: n.prefix,
174
174
  suffix: n.suffix,
175
175
  drillDown: n.drillDown ?? { enabled: !0 },
176
- title: n.label || U(e) || ""
176
+ title: n.label || K(e) || ""
177
177
  };
178
178
  }
179
179
  if ((t === "gauge" || t === "solid-gauge") && e.object) {
@@ -187,7 +187,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
187
187
  objectName: e.object,
188
188
  aggregate: t,
189
189
  filter: e.filter,
190
- label: n.label || U(e) || "",
190
+ label: n.label || K(e) || "",
191
191
  fallbackValue: n.fallbackValue ?? n.value,
192
192
  icon: n.icon,
193
193
  description: n.description,
@@ -202,7 +202,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
202
202
  let r = t && {}[t] || t;
203
203
  if (r === "bar" || r === "horizontal-bar" || r === "line" || r === "area" || r === "pie" || r === "donut" || r === "scatter" || r === "funnel") {
204
204
  let t = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
205
- if (Q(t)) {
205
+ if ($(t)) {
206
206
  let o = t.aggregate, s = o ? {
207
207
  field: e.valueField || o.field,
208
208
  function: e.aggregate || o.function,
@@ -216,7 +216,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
216
216
  xAxisKey: i,
217
217
  series: [{
218
218
  dataKey: c,
219
- label: l ? V(l, c, c) : c
219
+ label: W(l, c, s?.function)
220
220
  }],
221
221
  colors: Oe,
222
222
  drillDown: n.drillDown ?? Ae(r),
@@ -237,7 +237,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
237
237
  xAxisKey: i,
238
238
  series: [{
239
239
  dataKey: a,
240
- label: V(e.object, a, a)
240
+ label: W(e.object, a, e.aggregate)
241
241
  }],
242
242
  colors: Oe,
243
243
  drillDown: n.drillDown ?? Ae(r),
@@ -251,7 +251,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
251
251
  xAxisKey: i,
252
252
  series: [{
253
253
  dataKey: a,
254
- label: e.object ? V(e.object, a, a) : a
254
+ label: W(e.object, a, e.aggregate)
255
255
  }],
256
256
  colors: Oe,
257
257
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
@@ -259,7 +259,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
259
259
  }
260
260
  if (t === "table") {
261
261
  let t = e.data || n.data;
262
- if (Q(t)) {
262
+ if ($(t)) {
263
263
  let { data: r, ...i } = n;
264
264
  return {
265
265
  type: "object-data-table",
@@ -298,11 +298,11 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
298
298
  showRowTotals: r.showRowTotals ?? n.showRowTotals,
299
299
  showColumnTotals: r.showColumnTotals ?? n.showColumnTotals,
300
300
  format: r.format ?? n.format
301
- }, a = (Q(t) || !t && e.object) && n.drillDown === void 0 ? {
301
+ }, a = ($(t) || !t && e.object) && n.drillDown === void 0 ? {
302
302
  ...n,
303
303
  drillDown: { enabled: !0 }
304
304
  } : n;
305
- if (Q(t)) {
305
+ if ($(t)) {
306
306
  let { data: n, ...r } = a;
307
307
  return {
308
308
  type: "object-pivot",
@@ -328,7 +328,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
328
328
  }
329
329
  if (t === "list") {
330
330
  let t = e.data || n.data;
331
- if (Q(t)) {
331
+ if ($(t)) {
332
332
  let { data: r, ...i } = n;
333
333
  return {
334
334
  type: "object-data-table",
@@ -368,94 +368,94 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
368
368
  ...e,
369
369
  ...n
370
370
  };
371
- })(), c = e.type === "metric", u = U(e), d = ae(e), f = e.id || u || `widget-${t}`, p = s && l === e.id, v = s ? {
371
+ })(), c = e.type === "metric", u = K(e), d = q(e), f = e.id || u || `widget-${t}`, p = s && l === e.id, m = s ? {
372
372
  "data-testid": `dashboard-preview-widget-${e.id}`,
373
373
  "data-widget-id": e.id,
374
374
  role: "button",
375
375
  tabIndex: 0,
376
376
  "aria-selected": p,
377
377
  "aria-label": `Widget: ${u || `Widget ${t + 1}`}`,
378
- onClick: (t) => W(t, e.id),
379
- onKeyDown: (n) => ce(n, e.id, t)
380
- } : {}, y = s ? j("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", p ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, b = !O && i && !J ? {
378
+ onClick: (t) => oe(t, e.id),
379
+ onKeyDown: (n) => se(n, e.id, t)
380
+ } : {}, h = s ? N("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", p ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, g = !k && i && !Y ? {
381
381
  gridColumn: `span ${i.w}`,
382
382
  gridRow: `span ${i.h}`
383
- } : void 0, x = c ? /* @__PURE__ */ Z("div", {
384
- className: j("h-full w-full", s && "relative", y),
385
- style: b,
386
- ...v,
387
- children: [/* @__PURE__ */ X(o, {
383
+ } : void 0, x = c ? /* @__PURE__ */ Q("div", {
384
+ className: N("h-full w-full", s && "relative", h),
385
+ style: g,
386
+ ...m,
387
+ children: [/* @__PURE__ */ Z(o, {
388
388
  schema: a,
389
- className: j("h-full w-full", s && "pointer-events-none"),
389
+ className: N("h-full w-full", s && "pointer-events-none"),
390
390
  dataSource: n
391
- }), s && /* @__PURE__ */ X("div", {
391
+ }), s && /* @__PURE__ */ Z("div", {
392
392
  className: "absolute inset-0 z-10",
393
393
  "aria-hidden": "true",
394
394
  "data-testid": "widget-click-overlay"
395
395
  })]
396
- }) : /* @__PURE__ */ Z(m, {
397
- className: j("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", s && "relative", y),
398
- style: b,
399
- ...v,
396
+ }) : /* @__PURE__ */ Q(_, {
397
+ className: N("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", s && "relative", h),
398
+ style: g,
399
+ ...m,
400
400
  children: [
401
- u && /* @__PURE__ */ Z(g, {
401
+ u && /* @__PURE__ */ Q(y, {
402
402
  className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
403
- children: [/* @__PURE__ */ X(_, {
403
+ children: [/* @__PURE__ */ Z(b, {
404
404
  className: "text-sm sm:text-base font-medium tracking-tight truncate",
405
405
  title: u,
406
406
  children: u
407
- }), d && /* @__PURE__ */ X("p", {
407
+ }), d && /* @__PURE__ */ Z("p", {
408
408
  className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
409
409
  children: d
410
410
  })]
411
411
  }),
412
- /* @__PURE__ */ X(h, {
412
+ /* @__PURE__ */ Z(v, {
413
413
  className: "p-0",
414
- children: /* @__PURE__ */ X("div", {
415
- className: j("h-full w-full", "p-3 sm:p-4 md:p-6", s && "pointer-events-none"),
416
- children: /* @__PURE__ */ X(o, {
414
+ children: /* @__PURE__ */ Z("div", {
415
+ className: N("h-full w-full", "p-3 sm:p-4 md:p-6", s && "pointer-events-none"),
416
+ children: /* @__PURE__ */ Z(o, {
417
417
  schema: a,
418
418
  dataSource: n
419
419
  })
420
420
  })
421
421
  }),
422
- s && /* @__PURE__ */ X("div", {
422
+ s && /* @__PURE__ */ Z("div", {
423
423
  className: "absolute inset-0 z-10",
424
424
  "aria-hidden": "true",
425
425
  "data-testid": "widget-click-overlay"
426
426
  })
427
427
  ]
428
428
  });
429
- return J && e.id ? /* @__PURE__ */ X(Ee, {
429
+ return Y && e.id ? /* @__PURE__ */ Z(Te, {
430
430
  id: e.id,
431
- gridSpan: !O && i ? {
431
+ gridSpan: !k && i ? {
432
432
  w: i.w,
433
433
  h: i.h
434
434
  } : void 0,
435
435
  children: x
436
- }, f) : /* @__PURE__ */ X(ee, { children: x }, f);
437
- }, ve = e.header && /* @__PURE__ */ Z("div", {
436
+ }, f) : /* @__PURE__ */ Z(L, { children: x }, f);
437
+ }, be = e.header && /* @__PURE__ */ Q("div", {
438
438
  className: "col-span-full mb-4",
439
439
  children: [
440
- !b && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ X("h2", {
440
+ !x && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Z("h2", {
441
441
  className: "text-lg font-semibold tracking-tight",
442
- children: H ? P({
443
- name: H,
444
- label: $(e.title)
445
- }) : $(e.title)
442
+ children: G ? P({
443
+ name: G,
444
+ label: De(e.title)
445
+ }) : De(e.title)
446
446
  }),
447
- !b && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ X("p", {
447
+ !x && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Z("p", {
448
448
  className: "text-sm text-muted-foreground mt-1",
449
- children: H ? te({
450
- name: H,
451
- description: $(e.description)
452
- }) : $(e.description)
449
+ children: G ? F({
450
+ name: G,
451
+ description: De(e.description)
452
+ }) : De(e.description)
453
453
  }),
454
- e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ X("div", {
454
+ e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Z("div", {
455
455
  className: "flex gap-2 mt-3",
456
456
  children: e.header.actions.map((e, t) => {
457
- let n = De(e.icon);
458
- return /* @__PURE__ */ Z(p, {
457
+ let n = Ee(e.icon);
458
+ return /* @__PURE__ */ Q(g, {
459
459
  variant: "outline",
460
460
  size: "sm",
461
461
  onClick: async () => {
@@ -469,103 +469,103 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
469
469
  return;
470
470
  }
471
471
  if (t === "modal" || t === "script") {
472
- let e = await M(n || r);
472
+ let e = await ee(n || r);
473
473
  e?.success || console.warn("[DashboardRenderer] action failed", e?.error);
474
474
  return;
475
475
  }
476
476
  console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
477
477
  },
478
- children: [n && /* @__PURE__ */ X(n, { className: "w-4 h-4 mr-1.5" }), ie(e)]
478
+ children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), ie(e)]
479
479
  }, t);
480
480
  })
481
481
  })
482
482
  ]
483
- }), ye = i !== void 0 && /* @__PURE__ */ Z("span", {
483
+ }), xe = i !== void 0 && /* @__PURE__ */ Q("span", {
484
484
  className: "text-xs text-muted-foreground",
485
485
  children: [i.toLocaleString(), " records"]
486
- }), be = a ? JSON.stringify(a) : void 0, xe = r && /* @__PURE__ */ Z("div", {
487
- className: j("flex items-center justify-end gap-3 mb-2", !O && "col-span-full"),
488
- children: [ye, /* @__PURE__ */ Z(p, {
486
+ }), Se = a ? JSON.stringify(a) : void 0, Ce = r && /* @__PURE__ */ Q("div", {
487
+ className: N("flex items-center justify-end gap-3 mb-2", !k && "col-span-full"),
488
+ children: [xe, /* @__PURE__ */ Q(g, {
489
489
  variant: "outline",
490
490
  size: "sm",
491
- onClick: se,
492
- disabled: E,
491
+ onClick: J,
492
+ disabled: D,
493
493
  "aria-label": "Refresh dashboard",
494
- children: [/* @__PURE__ */ X(oe, { className: j("h-4 w-4 mr-2", E && "animate-spin") }), E ? "Refreshing…" : "Refresh All"]
494
+ children: [/* @__PURE__ */ Z(ae, { className: N("h-4 w-4 mr-2", D && "animate-spin") }), D ? "Refreshing…" : "Refresh All"]
495
495
  })]
496
- }), Se = L(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), Ce = L(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), we = L(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
497
- if (O) {
498
- let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ Z("div", {
499
- ref: S,
500
- className: j("flex flex-col gap-4 px-4", t),
501
- "data-user-actions": be,
502
- onClick: q,
503
- ...x,
496
+ }), we = B(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), ke = B(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), je = B(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
497
+ if (k) {
498
+ let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ Q("div", {
499
+ ref: C,
500
+ className: N("flex flex-col gap-4 px-4", t),
501
+ "data-user-actions": Se,
502
+ onClick: ge,
503
+ ...S,
504
504
  children: [
505
- ve,
506
- xe,
507
- n.length > 0 && /* @__PURE__ */ X("div", {
505
+ be,
506
+ Ce,
507
+ n.length > 0 && /* @__PURE__ */ Z("div", {
508
508
  className: "grid grid-cols-2 gap-3",
509
- onClick: q,
510
- children: /* @__PURE__ */ X(fe, {
511
- items: Ce,
512
- strategy: me,
513
- disabled: !J,
514
- children: n.map((e, t) => _e(e, t))
509
+ onClick: ge,
510
+ children: /* @__PURE__ */ Z(pe, {
511
+ items: ke,
512
+ strategy: he,
513
+ disabled: !Y,
514
+ children: n.map((e, t) => ye(e, t))
515
515
  })
516
516
  }),
517
- r.length > 0 && /* @__PURE__ */ X("div", {
517
+ r.length > 0 && /* @__PURE__ */ Z("div", {
518
518
  className: "flex flex-col gap-4",
519
- onClick: q,
520
- children: /* @__PURE__ */ X(fe, {
521
- items: we,
522
- strategy: he,
523
- disabled: !J,
524
- children: r.map((e, t) => _e(e, t, !0))
519
+ onClick: ge,
520
+ children: /* @__PURE__ */ Z(pe, {
521
+ items: je,
522
+ strategy: _e,
523
+ disabled: !Y,
524
+ children: r.map((e, t) => ye(e, t, !0))
525
525
  })
526
526
  })
527
527
  ]
528
528
  });
529
- return J ? /* @__PURE__ */ X(G, {
530
- sensors: Y,
531
- collisionDetection: K,
532
- onDragEnd: ge,
529
+ return Y ? /* @__PURE__ */ Z(ce, {
530
+ sensors: X,
531
+ collisionDetection: ue,
532
+ onDragEnd: ve,
533
533
  children: i
534
534
  }) : i;
535
535
  }
536
- let Te = e.columns != null || C !== 4, ke = /* @__PURE__ */ Z("div", {
537
- ref: S,
538
- className: j("grid auto-rows-min", !Te && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
536
+ let Me = e.columns != null || w !== 4, Ne = /* @__PURE__ */ Q("div", {
537
+ ref: C,
538
+ className: N("grid auto-rows-min", !Me && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
539
539
  style: {
540
- ...Te && { gridTemplateColumns: `repeat(${w}, minmax(0, 1fr))` },
541
- gap: `${T * .25}rem`
540
+ ...Me && { gridTemplateColumns: `repeat(${T}, minmax(0, 1fr))` },
541
+ gap: `${E * .25}rem`
542
542
  },
543
- "data-user-actions": be,
544
- onClick: q,
545
- ...x,
543
+ "data-user-actions": Se,
544
+ onClick: ge,
545
+ ...S,
546
546
  children: [
547
- ve,
548
- xe,
549
- /* @__PURE__ */ X(fe, {
550
- items: Se,
551
- strategy: me,
552
- disabled: !J,
553
- children: e.widgets?.map((e, t) => _e(e, t))
547
+ be,
548
+ Ce,
549
+ /* @__PURE__ */ Z(pe, {
550
+ items: we,
551
+ strategy: he,
552
+ disabled: !Y,
553
+ children: e.widgets?.map((e, t) => ye(e, t))
554
554
  })
555
555
  ]
556
556
  });
557
- return J ? /* @__PURE__ */ X(G, {
558
- sensors: Y,
559
- collisionDetection: K,
560
- onDragEnd: ge,
561
- children: ke
562
- }) : ke;
557
+ return Y ? /* @__PURE__ */ Z(ce, {
558
+ sensors: X,
559
+ collisionDetection: ue,
560
+ onDragEnd: ve,
561
+ children: Ne
562
+ }) : Ne;
563
563
  });
564
564
  //#endregion
565
565
  //#region src/DashboardGridLayout.tsx
566
566
  function Me({ editMode: e }) {
567
567
  let t = u();
568
- return P.useEffect(() => {
568
+ return I.useEffect(() => {
569
569
  if (e) return t.startDrag({
570
570
  id: "dashboard-layout",
571
571
  type: "dashboard-widget",
@@ -612,44 +612,44 @@ function Fe(e) {
612
612
  })) || [] };
613
613
  }
614
614
  var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
615
- let { width: a, containerRef: s, mounted: c } = _e(), [l, u] = P.useState(!1), [f, v] = P.useState(!1), y = d(), b = P.useRef(null), x = P.useCallback(() => {
616
- i && (v(!0), i(), setTimeout(() => v(!1), 600));
615
+ let { width: a, containerRef: s, mounted: c } = ye(), [l, u] = I.useState(!1), [f, p] = I.useState(!1), m = d(), h = I.useRef(null), x = I.useCallback(() => {
616
+ i && (p(!0), i(), setTimeout(() => p(!1), 600));
617
617
  }, [i]);
618
- P.useEffect(() => {
619
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return b.current = setInterval(x, e.refreshInterval * 1e3), () => {
620
- b.current && clearInterval(b.current);
618
+ I.useEffect(() => {
619
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return h.current = setInterval(x, e.refreshInterval * 1e3), () => {
620
+ h.current && clearInterval(h.current);
621
621
  };
622
622
  }, [
623
623
  e.refreshInterval,
624
624
  i,
625
625
  x
626
626
  ]);
627
- let [S, C] = P.useState(() => Fe(e)), w = P.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
627
+ let [S, C] = I.useState(() => Fe(e)), w = I.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
628
628
  i: e.id || `widget-${t}`,
629
629
  x: e.layout?.x,
630
630
  y: e.layout?.y,
631
631
  w: e.layout?.w,
632
632
  h: e.layout?.h
633
633
  })) ?? []), [e.widgets]);
634
- P.useEffect(() => {
634
+ I.useEffect(() => {
635
635
  C(Fe(e));
636
636
  }, [w]);
637
- let T = P.useCallback((e, t) => {
637
+ let T = I.useCallback((e, t) => {
638
638
  C(t), n?.(e);
639
- }, [n]), E = P.useCallback(() => {
639
+ }, [n]), E = I.useCallback(() => {
640
640
  r ? r(Pe(e, S.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), u(!1);
641
641
  }, [
642
642
  r,
643
643
  e,
644
644
  S
645
- ]), D = P.useCallback(() => {
645
+ ]), D = I.useCallback(() => {
646
646
  C(Fe(e));
647
- }, [e]), O = P.useCallback((e) => {
647
+ }, [e]), O = I.useCallback((e) => {
648
648
  if (e.component) return e.component;
649
649
  let t = e.type, n = e.options || {};
650
650
  if (t === "bar" || t === "horizontal-bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter" || t === "funnel") {
651
651
  let r = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
652
- if (Q(r)) {
652
+ if ($(r)) {
653
653
  let n = r.aggregate, o = n ? {
654
654
  field: e.valueField || n.field,
655
655
  function: e.aggregate || n.function,
@@ -695,7 +695,7 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
695
695
  }
696
696
  if (t === "table") {
697
697
  let t = e.data || n.data;
698
- if (Q(t)) {
698
+ if ($(t)) {
699
699
  let { data: r, ...i } = n;
700
700
  return {
701
701
  type: "data-table",
@@ -727,7 +727,7 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
727
727
  }
728
728
  if (t === "pivot") {
729
729
  let t = e.data || n.data;
730
- if (Q(t)) {
730
+ if ($(t)) {
731
731
  let { data: r, ...i } = n;
732
732
  return {
733
733
  type: "pivot",
@@ -748,54 +748,54 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
748
748
  ...n
749
749
  };
750
750
  }, []);
751
- return /* @__PURE__ */ Z("div", {
751
+ return /* @__PURE__ */ Q("div", {
752
752
  ref: s,
753
- className: j("w-full", t),
753
+ className: N("w-full", t),
754
754
  "data-testid": "grid-layout",
755
755
  children: [
756
- y && /* @__PURE__ */ X(Me, { editMode: l }),
757
- /* @__PURE__ */ Z("div", {
756
+ m && /* @__PURE__ */ Z(Me, { editMode: l }),
757
+ /* @__PURE__ */ Q("div", {
758
758
  className: "mb-4 flex items-center justify-between",
759
- children: [/* @__PURE__ */ X("h2", {
759
+ children: [/* @__PURE__ */ Z("h2", {
760
760
  className: "text-2xl font-bold",
761
761
  children: e.title || "Dashboard"
762
- }), /* @__PURE__ */ X("div", {
762
+ }), /* @__PURE__ */ Z("div", {
763
763
  className: "flex gap-2",
764
- children: l ? /* @__PURE__ */ Z(Y, { children: [
765
- /* @__PURE__ */ Z(p, {
764
+ children: l ? /* @__PURE__ */ Q(X, { children: [
765
+ /* @__PURE__ */ Q(g, {
766
766
  onClick: E,
767
767
  size: "sm",
768
768
  variant: "default",
769
- children: [/* @__PURE__ */ X(se, { className: "h-4 w-4 mr-2" }), "Save Layout"]
769
+ children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4 mr-2" }), "Save Layout"]
770
770
  }),
771
- /* @__PURE__ */ Z(p, {
771
+ /* @__PURE__ */ Q(g, {
772
772
  onClick: D,
773
773
  size: "sm",
774
774
  variant: "outline",
775
- children: [/* @__PURE__ */ X(ce, { className: "h-4 w-4 mr-2" }), "Reset"]
775
+ children: [/* @__PURE__ */ Z(se, { className: "h-4 w-4 mr-2" }), "Reset"]
776
776
  }),
777
- /* @__PURE__ */ X(p, {
777
+ /* @__PURE__ */ Z(g, {
778
778
  onClick: () => u(!1),
779
779
  size: "sm",
780
780
  variant: "ghost",
781
781
  children: "Cancel"
782
782
  })
783
- ] }) : /* @__PURE__ */ Z(Y, { children: [i && /* @__PURE__ */ Z(p, {
783
+ ] }) : /* @__PURE__ */ Q(X, { children: [i && /* @__PURE__ */ Q(g, {
784
784
  onClick: x,
785
785
  size: "sm",
786
786
  variant: "outline",
787
787
  disabled: f,
788
788
  "aria-label": "Refresh dashboard",
789
- children: [/* @__PURE__ */ X(oe, { className: j("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
790
- }), /* @__PURE__ */ Z(p, {
789
+ children: [/* @__PURE__ */ Z(ae, { className: N("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
790
+ }), /* @__PURE__ */ Q(g, {
791
791
  onClick: () => u(!0),
792
792
  size: "sm",
793
793
  variant: "outline",
794
- children: [/* @__PURE__ */ X(H, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
794
+ children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
795
795
  })] })
796
796
  })]
797
797
  }),
798
- c && /* @__PURE__ */ X(ge, {
798
+ c && /* @__PURE__ */ Z(ve, {
799
799
  className: "layout",
800
800
  width: a,
801
801
  layouts: S,
@@ -822,34 +822,34 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
822
822
  onLayoutChange: T,
823
823
  children: e.widgets?.map((e, t) => {
824
824
  let n = e.id || `widget-${t}`, r = O(e);
825
- return /* @__PURE__ */ X("div", {
825
+ return /* @__PURE__ */ Z("div", {
826
826
  className: "h-full",
827
- children: e.type === "metric" ? /* @__PURE__ */ Z("div", {
827
+ children: e.type === "metric" ? /* @__PURE__ */ Q("div", {
828
828
  className: "h-full w-full relative",
829
- children: [l && /* @__PURE__ */ X("div", {
829
+ children: [l && /* @__PURE__ */ Z("div", {
830
830
  className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
831
- children: /* @__PURE__ */ X(ie, { className: "h-4 w-4" })
832
- }), /* @__PURE__ */ X(o, {
831
+ children: /* @__PURE__ */ Z(ie, { className: "h-4 w-4" })
832
+ }), /* @__PURE__ */ Z(o, {
833
833
  schema: r,
834
834
  className: "h-full w-full"
835
835
  })]
836
- }) : /* @__PURE__ */ Z(m, {
837
- className: j("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", l && "ring-2 ring-primary/20"),
838
- children: [e.title && /* @__PURE__ */ Z(g, {
836
+ }) : /* @__PURE__ */ Q(_, {
837
+ className: N("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", l && "ring-2 ring-primary/20"),
838
+ children: [e.title && /* @__PURE__ */ Q(y, {
839
839
  className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
840
- children: [/* @__PURE__ */ X(_, {
840
+ children: [/* @__PURE__ */ Z(b, {
841
841
  className: "text-base font-medium tracking-tight truncate",
842
842
  title: e.title,
843
843
  children: e.title
844
- }), l && /* @__PURE__ */ X("div", {
844
+ }), l && /* @__PURE__ */ Z("div", {
845
845
  className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
846
- children: /* @__PURE__ */ X(ie, { className: "h-4 w-4" })
846
+ children: /* @__PURE__ */ Z(ie, { className: "h-4 w-4" })
847
847
  })]
848
- }), /* @__PURE__ */ X(h, {
848
+ }), /* @__PURE__ */ Z(v, {
849
849
  className: "p-0 h-full",
850
- children: /* @__PURE__ */ X("div", {
851
- className: j("h-full w-full overflow-auto p-4"),
852
- children: /* @__PURE__ */ X(o, { schema: r })
850
+ children: /* @__PURE__ */ Z("div", {
851
+ className: N("h-full w-full overflow-auto p-4"),
852
+ children: /* @__PURE__ */ Z(o, { schema: r })
853
853
  })
854
854
  })]
855
855
  })
@@ -858,7 +858,7 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
858
858
  })
859
859
  ]
860
860
  });
861
- }, Le = ve({
861
+ }, Le = p({
862
862
  "dashboard.trend.vsLastQuarter": "vs last quarter",
863
863
  "dashboard.trend.vsLastMonth": "vs last month",
864
864
  "dashboard.trend.vsLastWeek": "vs last week",
@@ -925,17 +925,17 @@ var Ve = {
925
925
  success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
926
926
  warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
927
927
  danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
928
- }, He = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, ...v }) => {
929
- let y = Ve[c] || Ve.default, { t: b } = Le(), x = L(() => {
928
+ }, He = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, ...m }) => {
929
+ let h = Ve[c] || Ve.default, { t: g } = Le(), x = B(() => {
930
930
  let e = Be(a) || Be(n?.label);
931
931
  if (!e) return e;
932
932
  let t = Re(e);
933
- return t ? b(t) : e;
933
+ return t ? g(t) : e;
934
934
  }, [
935
935
  a,
936
936
  n?.label,
937
- b
938
- ]), S = L(() => {
937
+ g
938
+ ]), S = B(() => {
939
939
  let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? ze(t, l, u) : t ?? "", n = String(e);
940
940
  return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
941
941
  }, [
@@ -944,61 +944,61 @@ var Ve = {
944
944
  u,
945
945
  d,
946
946
  f
947
- ]), C = L(() => {
947
+ ]), C = B(() => {
948
948
  if (typeof r == "string") {
949
- let e = M(r);
950
- return e ? /* @__PURE__ */ X(e, { className: "h-4 w-4" }) : null;
949
+ let e = P(r);
950
+ return e ? /* @__PURE__ */ Z(e, { className: "h-4 w-4" }) : null;
951
951
  }
952
952
  return r;
953
953
  }, [r]);
954
- return /* @__PURE__ */ Z(m, {
955
- className: j("h-full overflow-hidden", p && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
954
+ return /* @__PURE__ */ Q(_, {
955
+ className: N("h-full overflow-hidden", p && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
956
956
  onClick: p,
957
957
  role: p ? "button" : void 0,
958
958
  tabIndex: p ? 0 : void 0,
959
959
  onKeyDown: p ? (e) => {
960
960
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
961
961
  } : void 0,
962
- ...v,
963
- children: [/* @__PURE__ */ Z(g, {
962
+ ...m,
963
+ children: [/* @__PURE__ */ Q(y, {
964
964
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
965
- children: [/* @__PURE__ */ X(_, {
965
+ children: [/* @__PURE__ */ Z(b, {
966
966
  className: "text-sm font-medium truncate",
967
967
  children: Be(e)
968
- }), C && /* @__PURE__ */ X("div", {
969
- className: j("flex h-8 w-8 items-center justify-center rounded-md shrink-0", y),
968
+ }), C && /* @__PURE__ */ Z("div", {
969
+ className: N("flex h-8 w-8 items-center justify-center rounded-md shrink-0", h),
970
970
  children: C
971
971
  })]
972
- }), /* @__PURE__ */ X(h, { children: o ? /* @__PURE__ */ Z("div", {
972
+ }), /* @__PURE__ */ Z(v, { children: o ? /* @__PURE__ */ Q("div", {
973
973
  className: "flex items-center gap-2 text-muted-foreground",
974
974
  "data-testid": "metric-loading",
975
- children: [/* @__PURE__ */ X(U, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ X("span", {
975
+ children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
976
976
  className: "text-sm",
977
977
  children: "Loading…"
978
978
  })]
979
- }) : s ? /* @__PURE__ */ Z("div", {
979
+ }) : s ? /* @__PURE__ */ Q("div", {
980
980
  className: "flex items-center gap-2",
981
981
  "data-testid": "metric-error",
982
982
  role: "alert",
983
- children: [/* @__PURE__ */ X(z, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ X("span", {
983
+ children: [/* @__PURE__ */ Z(U, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
984
984
  className: "text-xs text-destructive truncate",
985
985
  children: s
986
986
  })]
987
- }) : /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("div", {
987
+ }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
988
988
  className: "text-2xl font-bold truncate",
989
989
  children: S
990
- }), (n || a) && /* @__PURE__ */ Z("div", {
990
+ }), (n || a) && /* @__PURE__ */ Q("div", {
991
991
  className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
992
- children: [n && /* @__PURE__ */ Z("span", {
993
- className: j("flex items-center shrink-0 font-medium", n.direction === "up" && "text-emerald-600 dark:text-emerald-400", n.direction === "down" && "text-rose-600 dark:text-rose-400", n.direction === "neutral" && "text-muted-foreground"),
992
+ children: [n && /* @__PURE__ */ Q("span", {
993
+ className: N("flex items-center shrink-0 font-medium", n.direction === "up" && "text-emerald-600 dark:text-emerald-400", n.direction === "down" && "text-rose-600 dark:text-rose-400", n.direction === "neutral" && "text-muted-foreground"),
994
994
  children: [
995
- n.direction === "up" && /* @__PURE__ */ X(V, { className: "h-3 w-3 mr-1" }),
996
- n.direction === "down" && /* @__PURE__ */ X(B, { className: "h-3 w-3 mr-1" }),
997
- n.direction === "neutral" && /* @__PURE__ */ X(ae, { className: "h-3 w-3 mr-1" }),
995
+ n.direction === "up" && /* @__PURE__ */ Z(W, { className: "h-3 w-3 mr-1" }),
996
+ n.direction === "down" && /* @__PURE__ */ Z(re, { className: "h-3 w-3 mr-1" }),
997
+ n.direction === "neutral" && /* @__PURE__ */ Z(q, { className: "h-3 w-3 mr-1" }),
998
998
  n.value,
999
999
  "%"
1000
1000
  ]
1001
- }), /* @__PURE__ */ X("span", {
1001
+ }), /* @__PURE__ */ Z("span", {
1002
1002
  className: "truncate min-w-0",
1003
1003
  children: x
1004
1004
  })]
@@ -1011,78 +1011,78 @@ function Ue(e) {
1011
1011
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
1012
1012
  }
1013
1013
  var We = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
1014
- let u = n ? M(n) : null;
1015
- return /* @__PURE__ */ Z(m, {
1016
- className: j("h-full", o),
1014
+ let u = n ? P(n) : null;
1015
+ return /* @__PURE__ */ Q(_, {
1016
+ className: N("h-full", o),
1017
1017
  ...l,
1018
- children: [/* @__PURE__ */ Z(g, {
1018
+ children: [/* @__PURE__ */ Q(y, {
1019
1019
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
1020
- children: [/* @__PURE__ */ X(_, {
1020
+ children: [/* @__PURE__ */ Z(b, {
1021
1021
  className: "text-sm font-medium",
1022
1022
  children: Ue(e)
1023
- }), u && /* @__PURE__ */ X(u, { className: "h-4 w-4 text-muted-foreground" })]
1024
- }), /* @__PURE__ */ X(h, { children: s ? /* @__PURE__ */ Z("div", {
1023
+ }), u && /* @__PURE__ */ Z(u, { className: "h-4 w-4 text-muted-foreground" })]
1024
+ }), /* @__PURE__ */ Z(v, { children: s ? /* @__PURE__ */ Q("div", {
1025
1025
  className: "flex items-center gap-2 text-muted-foreground",
1026
1026
  "data-testid": "metric-card-loading",
1027
- children: [/* @__PURE__ */ X(U, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ X("span", {
1027
+ children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
1028
1028
  className: "text-sm",
1029
1029
  children: "Loading…"
1030
1030
  })]
1031
- }) : c ? /* @__PURE__ */ Z("div", {
1031
+ }) : c ? /* @__PURE__ */ Q("div", {
1032
1032
  className: "flex items-center gap-2",
1033
1033
  "data-testid": "metric-card-error",
1034
1034
  role: "alert",
1035
- children: [/* @__PURE__ */ X(z, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ X("span", {
1035
+ children: [/* @__PURE__ */ Z(U, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
1036
1036
  className: "text-xs text-destructive truncate",
1037
1037
  children: c
1038
1038
  })]
1039
- }) : /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("div", {
1039
+ }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
1040
1040
  className: "text-2xl font-bold",
1041
1041
  children: t
1042
- }), (r || i || a) && /* @__PURE__ */ Z("p", {
1042
+ }), (r || i || a) && /* @__PURE__ */ Q("p", {
1043
1043
  className: "text-xs text-muted-foreground flex items-center mt-1",
1044
- children: [r && i && /* @__PURE__ */ Z("span", {
1045
- className: j("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
1044
+ children: [r && i && /* @__PURE__ */ Q("span", {
1045
+ className: N("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
1046
1046
  children: [
1047
- r === "up" && /* @__PURE__ */ X(V, { className: "h-3 w-3 mr-1" }),
1048
- r === "down" && /* @__PURE__ */ X(B, { className: "h-3 w-3 mr-1" }),
1049
- r === "neutral" && /* @__PURE__ */ X(ae, { className: "h-3 w-3 mr-1" }),
1047
+ r === "up" && /* @__PURE__ */ Z(W, { className: "h-3 w-3 mr-1" }),
1048
+ r === "down" && /* @__PURE__ */ Z(re, { className: "h-3 w-3 mr-1" }),
1049
+ r === "neutral" && /* @__PURE__ */ Z(q, { className: "h-3 w-3 mr-1" }),
1050
1050
  i
1051
1051
  ]
1052
1052
  }), Ue(a)]
1053
1053
  })] }) })]
1054
1054
  });
1055
- }, Ge = ({ objectName: e, aggregate: t, filter: n, label: c, fallbackValue: l, trend: u, icon: d, className: f, description: p, dataSource: m, colorVariant: h, format: g, currency: _, prefix: v, suffix: y, invert: b, drillDown: T, title: A }) => {
1056
- let j = ne(s), M = m || j?.dataSource, [N, P] = R(!1), [ee, te] = R(null), [re, z] = R(!1), [B, V] = R(null), [H, ie] = R(null);
1057
- I(() => {
1055
+ }, Ge = ({ objectName: e, aggregate: t, filter: n, label: c, fallbackValue: l, trend: u, icon: d, className: f, description: p, dataSource: m, colorVariant: h, format: g, currency: _, prefix: v, suffix: y, invert: b, drillDown: x, title: S }) => {
1056
+ let C = ne(s), O = m || C?.dataSource, [M, N] = H(!1), [P, F] = H(null), [I, L] = H(!1), [te, V] = H(null), [U, re] = H(null);
1057
+ z(() => {
1058
1058
  let t = !0;
1059
- if (!(!M || !e || typeof M.getObjectSchema != "function")) return M.getObjectSchema(e).then((e) => {
1060
- t && ie(e);
1059
+ if (!(!O || !e || typeof O.getObjectSchema != "function")) return O.getObjectSchema(e).then((e) => {
1060
+ t && re(e);
1061
1061
  }).catch(() => {}), () => {
1062
1062
  t = !1;
1063
1063
  };
1064
- }, [M, e]);
1065
- let U = L(() => {
1064
+ }, [O, e]);
1065
+ let W = B(() => {
1066
1066
  let e = t?.field;
1067
- if (!e || !H?.fields) return null;
1068
- let n = H.fields;
1067
+ if (!e || !U?.fields) return null;
1068
+ let n = U.fields;
1069
1069
  return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
1070
- }, [H, t?.field]), ae = L(() => {
1070
+ }, [U, t?.field]), G = B(() => {
1071
1071
  if (g) return g;
1072
- if (U) {
1073
- if (U.type === "currency") {
1074
- let e = U.precision ?? U.scale ?? 0;
1072
+ if (W) {
1073
+ if (W.type === "currency") {
1074
+ let e = W.precision ?? W.scale ?? 0;
1075
1075
  return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
1076
1076
  }
1077
- if (U.type === "percent") return "0,0%";
1078
- if (U.type === "number" || U.type === "integer") return "0,0";
1077
+ if (W.type === "percent") return "0,0%";
1078
+ if (W.type === "number" || W.type === "integer") return "0,0";
1079
1079
  }
1080
- }, [g, U]), oe = L(() => {
1080
+ }, [g, W]), ie = B(() => {
1081
1081
  if (_) return _;
1082
- if (U?.type === "currency") return U.defaultCurrency || U.currency || void 0;
1083
- }, [_, U]), se = L(() => t ? JSON.stringify(t) : "", [t]), W = L(() => i(n), [n]), ce = F(async (n, r) => {
1082
+ if (W?.type === "currency") return W.defaultCurrency || W.currency || "USD";
1083
+ }, [_, W]), K = B(() => t ? JSON.stringify(t) : "", [t]), q = B(() => i(n), [n]), ae = R(async (n, r) => {
1084
1084
  if (!(!n || !e)) {
1085
- r.current && (z(!0), V(null));
1085
+ r.current && (L(!0), V(null));
1086
1086
  try {
1087
1087
  let i;
1088
1088
  if (t && typeof n.aggregate == "function") {
@@ -1090,115 +1090,115 @@ var We = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
1090
1090
  field: t.field,
1091
1091
  function: t.function,
1092
1092
  groupBy: t.groupBy || "_all",
1093
- filter: W
1093
+ filter: q
1094
1094
  }), a = Array.isArray(r) ? r : [];
1095
1095
  i = a.length === 0 ? 0 : t.function === "count" ? a.reduce((e, n) => e + (Number(n[t.field]) || Number(n.count) || 0), 0) : a[0][t.field] ?? 0;
1096
1096
  } else if (typeof n.find == "function") {
1097
- let t = await n.find(e, { $filter: W });
1097
+ let t = await n.find(e, { $filter: q });
1098
1098
  i = (Array.isArray(t) ? t : t?.data || t?.records || []).length;
1099
1099
  } else return;
1100
- r.current && te(i);
1100
+ r.current && F(i);
1101
1101
  } catch (e) {
1102
1102
  console.error("[ObjectMetricWidget] Fetch error:", e), r.current && V(e instanceof Error ? e.message : "Failed to load metric");
1103
1103
  } finally {
1104
- r.current && z(!1);
1104
+ r.current && L(!1);
1105
1105
  }
1106
1106
  }
1107
1107
  }, [
1108
1108
  e,
1109
- se,
1110
- L(() => W ? JSON.stringify(W) : "", [W])
1109
+ K,
1110
+ B(() => q ? JSON.stringify(q) : "", [q])
1111
1111
  ]);
1112
- I(() => {
1112
+ z(() => {
1113
1113
  let t = { current: !0 };
1114
- return M && e ? ce(M, t) : (te(null), V(null)), () => {
1114
+ return O && e ? ae(O, t) : (F(null), V(null)), () => {
1115
1115
  t.current = !1;
1116
1116
  };
1117
1117
  }, [
1118
- M,
1118
+ O,
1119
1119
  e,
1120
- ce
1120
+ ae
1121
1121
  ]);
1122
- let G = ee === null ? M ? "—" : l ?? "—" : ee;
1123
- b && typeof G == "number" && isFinite(G) && G >= 0 && G <= 1 && (G = 1 - G);
1124
- let le = r(T) && !!e && !!M, K = L(() => {
1122
+ let J = P === null ? O ? "—" : l ?? "—" : P;
1123
+ b && typeof J == "number" && isFinite(J) && J >= 0 && J <= 1 && (J = 1 - J);
1124
+ let oe = r(x) && !!e && !!O, se = B(() => {
1125
1125
  let e = typeof c == "string" ? c : c?.defaultValue || "";
1126
- return a(T, {}, (typeof A == "string" ? A : A?.defaultValue || "") || e || "Details");
1126
+ return a(x, {}, (typeof S == "string" ? S : S?.defaultValue || "") || e || "Details");
1127
1127
  }, [
1128
- T,
1128
+ x,
1129
1129
  c,
1130
- A
1131
- ]), ue = L(() => {
1132
- if (!le) return null;
1133
- let t = T?.target ?? "drawer", n = T?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i;
1130
+ S
1131
+ ]), ce = B(() => {
1132
+ if (!oe) return null;
1133
+ let t = x?.target ?? "drawer", n = x?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i;
1134
1134
  if (r) {
1135
- let e = n.filter, t = e ? W ? { $and: [e, W] } : e : W;
1136
- i = /* @__PURE__ */ X("div", {
1135
+ let e = n.filter, t = e ? q ? { $and: [e, q] } : e : q;
1136
+ i = /* @__PURE__ */ Z("div", {
1137
1137
  className: "h-full overflow-auto",
1138
- children: /* @__PURE__ */ X(o, { schema: {
1138
+ children: /* @__PURE__ */ Z(o, { schema: {
1139
1139
  type: "spec-report",
1140
1140
  ...n,
1141
1141
  filter: t
1142
1142
  } })
1143
1143
  });
1144
- } else i = /* @__PURE__ */ X("div", {
1144
+ } else i = /* @__PURE__ */ Z("div", {
1145
1145
  className: "h-full overflow-auto",
1146
- children: /* @__PURE__ */ X(o, { schema: {
1146
+ children: /* @__PURE__ */ Z(o, { schema: {
1147
1147
  type: "object-data-table",
1148
1148
  objectName: e,
1149
- filter: W,
1149
+ filter: q,
1150
1150
  pageSize: 25,
1151
1151
  drillDown: { enabled: !1 }
1152
1152
  } })
1153
1153
  });
1154
- return t === "dialog" ? /* @__PURE__ */ X(x, {
1154
+ return t === "dialog" ? /* @__PURE__ */ Z(w, {
1155
1155
  open: !0,
1156
- onOpenChange: (e) => !e && P(!1),
1157
- children: /* @__PURE__ */ Z(S, {
1156
+ onOpenChange: (e) => !e && N(!1),
1157
+ children: /* @__PURE__ */ Q(T, {
1158
1158
  className: "max-w-5xl",
1159
- children: [/* @__PURE__ */ X(C, { children: /* @__PURE__ */ X(w, { children: K }) }), i]
1159
+ children: [/* @__PURE__ */ Z(E, { children: /* @__PURE__ */ Z(D, { children: se }) }), i]
1160
1160
  })
1161
- }) : /* @__PURE__ */ X(E, {
1161
+ }) : /* @__PURE__ */ Z(k, {
1162
1162
  open: !0,
1163
- onOpenChange: (e) => !e && P(!1),
1164
- children: /* @__PURE__ */ Z(D, {
1163
+ onOpenChange: (e) => !e && N(!1),
1164
+ children: /* @__PURE__ */ Q(A, {
1165
1165
  side: "right",
1166
1166
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
1167
- children: [/* @__PURE__ */ X(O, { children: /* @__PURE__ */ X(k, { children: K }) }), /* @__PURE__ */ X("div", {
1167
+ children: [/* @__PURE__ */ Z(j, { children: /* @__PURE__ */ Z(ee, { children: se }) }), /* @__PURE__ */ Z("div", {
1168
1168
  className: "flex-1 overflow-hidden mt-2",
1169
1169
  children: i
1170
1170
  })]
1171
1171
  })
1172
1172
  });
1173
1173
  }, [
1174
- le,
1175
- T,
1174
+ oe,
1175
+ x,
1176
1176
  e,
1177
- W,
1178
- K
1177
+ q,
1178
+ se
1179
1179
  ]);
1180
- return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(He, {
1180
+ return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(He, {
1181
1181
  label: c,
1182
- value: G,
1182
+ value: J,
1183
1183
  trend: u,
1184
1184
  icon: d,
1185
1185
  className: f,
1186
1186
  description: p,
1187
- loading: re,
1188
- error: B,
1187
+ loading: I,
1188
+ error: te,
1189
1189
  colorVariant: h,
1190
- format: ae,
1191
- currency: oe,
1190
+ format: G,
1191
+ currency: ie,
1192
1192
  prefix: v,
1193
1193
  suffix: y,
1194
- onClick: le ? () => P(!0) : void 0
1195
- }), N && ue] });
1194
+ onClick: oe ? () => N(!0) : void 0
1195
+ }), M && ce] });
1196
1196
  };
1197
1197
  //#endregion
1198
1198
  //#region src/PivotTable.tsx
1199
1199
  function Ke() {
1200
1200
  try {
1201
- let { t: e } = ye(), t = e("dashboard.total");
1201
+ let { t: e } = m(), t = e("dashboard.total");
1202
1202
  return !t || t === "dashboard.total" ? "Total" : t;
1203
1203
  } catch {
1204
1204
  return "Total";
@@ -1206,7 +1206,7 @@ function Ke() {
1206
1206
  }
1207
1207
  function qe() {
1208
1208
  try {
1209
- let { t: e } = ye(), t = e("dashboard.noDataAvailable");
1209
+ let { t: e } = m(), t = e("dashboard.noDataAvailable");
1210
1210
  return !t || t === "dashboard.noDataAvailable" ? "No data available" : t;
1211
1211
  } catch {
1212
1212
  return "No data available";
@@ -1253,7 +1253,7 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1253
1253
  });
1254
1254
  }, S = (e) => (t) => {
1255
1255
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
1256
- }, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = L(() => {
1256
+ }, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = B(() => {
1257
1257
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
1258
1258
  for (let r of w) {
1259
1259
  let i = String(r[c] ?? ""), a = String(r[l] ?? ""), o = Number(r[u]) || 0;
@@ -1293,16 +1293,16 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1293
1293
  l,
1294
1294
  u,
1295
1295
  d
1296
- ]), M = (e) => Je(e, h);
1297
- return w.length === 0 ? /* @__PURE__ */ Z("div", {
1298
- className: j("overflow-auto", t),
1299
- children: [s && /* @__PURE__ */ X("h3", {
1296
+ ]), j = (e) => Je(e, h);
1297
+ return w.length === 0 ? /* @__PURE__ */ Q("div", {
1298
+ className: N("overflow-auto", t),
1299
+ children: [s && /* @__PURE__ */ Z("h3", {
1300
1300
  className: "text-sm font-semibold mb-2",
1301
1301
  children: s
1302
- }), /* @__PURE__ */ Z("div", {
1302
+ }), /* @__PURE__ */ Q("div", {
1303
1303
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1304
1304
  "data-testid": "pivot-empty-state",
1305
- children: [/* @__PURE__ */ Z("svg", {
1305
+ children: [/* @__PURE__ */ Q("svg", {
1306
1306
  xmlns: "http://www.w3.org/2000/svg",
1307
1307
  className: "h-8 w-8 mb-2 opacity-40",
1308
1308
  viewBox: "0 0 24 24",
@@ -1312,49 +1312,49 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1312
1312
  strokeLinecap: "round",
1313
1313
  strokeLinejoin: "round",
1314
1314
  children: [
1315
- /* @__PURE__ */ X("rect", {
1315
+ /* @__PURE__ */ Z("rect", {
1316
1316
  x: "3",
1317
1317
  y: "3",
1318
1318
  width: "7",
1319
1319
  height: "7"
1320
1320
  }),
1321
- /* @__PURE__ */ X("rect", {
1321
+ /* @__PURE__ */ Z("rect", {
1322
1322
  x: "14",
1323
1323
  y: "3",
1324
1324
  width: "7",
1325
1325
  height: "7"
1326
1326
  }),
1327
- /* @__PURE__ */ X("rect", {
1327
+ /* @__PURE__ */ Z("rect", {
1328
1328
  x: "3",
1329
1329
  y: "14",
1330
1330
  width: "7",
1331
1331
  height: "7"
1332
1332
  }),
1333
- /* @__PURE__ */ X("rect", {
1333
+ /* @__PURE__ */ Z("rect", {
1334
1334
  x: "14",
1335
1335
  y: "14",
1336
1336
  width: "7",
1337
1337
  height: "7"
1338
1338
  })
1339
1339
  ]
1340
- }), /* @__PURE__ */ X("p", {
1340
+ }), /* @__PURE__ */ Z("p", {
1341
1341
  className: "text-xs",
1342
1342
  children: y
1343
1343
  })]
1344
1344
  })]
1345
- }) : /* @__PURE__ */ Z("div", {
1346
- className: j("overflow-auto", t),
1347
- children: [s && /* @__PURE__ */ X("h3", {
1345
+ }) : /* @__PURE__ */ Q("div", {
1346
+ className: N("overflow-auto", t),
1347
+ children: [s && /* @__PURE__ */ Z("h3", {
1348
1348
  className: "text-sm font-semibold mb-2",
1349
1349
  children: s
1350
- }), /* @__PURE__ */ Z("table", {
1350
+ }), /* @__PURE__ */ Q("table", {
1351
1351
  className: "w-full text-sm border-collapse table-auto",
1352
1352
  role: "table",
1353
1353
  children: [
1354
- /* @__PURE__ */ X("thead", { children: /* @__PURE__ */ Z("tr", {
1354
+ /* @__PURE__ */ Z("thead", { children: /* @__PURE__ */ Q("tr", {
1355
1355
  className: "border-b border-border",
1356
1356
  children: [
1357
- /* @__PURE__ */ X("th", {
1357
+ /* @__PURE__ */ Z("th", {
1358
1358
  className: "text-left p-2 font-medium text-muted-foreground whitespace-nowrap",
1359
1359
  children: a || c
1360
1360
  }),
@@ -1363,8 +1363,8 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1363
1363
  scope: "column",
1364
1364
  colKey: e
1365
1365
  });
1366
- return /* @__PURE__ */ X("th", {
1367
- className: j("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
1366
+ return /* @__PURE__ */ Z("th", {
1367
+ className: N("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
1368
1368
  title: e === "" ? `${l}: (empty)` : `${l}: ${e}`,
1369
1369
  role: b ? "button" : void 0,
1370
1370
  tabIndex: b ? 0 : void 0,
@@ -1374,17 +1374,17 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1374
1374
  children: Xe(e, i)
1375
1375
  }, e);
1376
1376
  }),
1377
- p && /* @__PURE__ */ X("th", {
1377
+ p && /* @__PURE__ */ Z("th", {
1378
1378
  className: "text-right p-2 font-semibold text-muted-foreground bg-muted/20 whitespace-nowrap",
1379
1379
  children: v
1380
1380
  })
1381
1381
  ]
1382
1382
  }) }),
1383
- /* @__PURE__ */ X("tbody", { children: T.map((e) => /* @__PURE__ */ Z("tr", {
1383
+ /* @__PURE__ */ Z("tbody", { children: T.map((e) => /* @__PURE__ */ Q("tr", {
1384
1384
  className: "border-b border-border/50 hover:bg-muted/30",
1385
1385
  children: [
1386
- /* @__PURE__ */ X("td", {
1387
- className: j("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
1386
+ /* @__PURE__ */ Z("td", {
1387
+ className: N("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
1388
1388
  role: b ? "button" : void 0,
1389
1389
  tabIndex: b ? 0 : void 0,
1390
1390
  onClick: b ? () => x({
@@ -1405,18 +1405,18 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1405
1405
  colKey: t,
1406
1406
  value: n
1407
1407
  });
1408
- return /* @__PURE__ */ X("td", {
1409
- className: j("text-right p-2 tabular-nums", g?.[t], C),
1408
+ return /* @__PURE__ */ Z("td", {
1409
+ className: N("text-right p-2 tabular-nums", g?.[t], C),
1410
1410
  role: b ? "button" : void 0,
1411
1411
  tabIndex: b ? 0 : void 0,
1412
1412
  onClick: b ? r : void 0,
1413
1413
  onKeyDown: b ? S(r) : void 0,
1414
1414
  "aria-label": b ? `Drill into ${c}=${e || "(empty)"}, ${l}=${t || "(empty)"}` : void 0,
1415
- children: M(n)
1415
+ children: j(n)
1416
1416
  }, t);
1417
1417
  }),
1418
- p && /* @__PURE__ */ X("td", {
1419
- className: j("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
1418
+ p && /* @__PURE__ */ Z("td", {
1419
+ className: N("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
1420
1420
  role: b ? "button" : void 0,
1421
1421
  tabIndex: b ? 0 : void 0,
1422
1422
  onClick: b ? () => x({
@@ -1429,19 +1429,19 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1429
1429
  rowKey: e,
1430
1430
  value: O[e] ?? 0
1431
1431
  })) : void 0,
1432
- children: M(O[e] ?? 0)
1432
+ children: j(O[e] ?? 0)
1433
1433
  })
1434
1434
  ]
1435
1435
  }, e)) }),
1436
- m && /* @__PURE__ */ X("tfoot", { children: /* @__PURE__ */ Z("tr", {
1436
+ m && /* @__PURE__ */ Z("tfoot", { children: /* @__PURE__ */ Q("tr", {
1437
1437
  className: "border-t-2 border-border font-semibold bg-muted/40",
1438
1438
  children: [
1439
- /* @__PURE__ */ X("td", {
1439
+ /* @__PURE__ */ Z("td", {
1440
1440
  className: "p-2",
1441
1441
  children: v
1442
1442
  }),
1443
- E.map((e) => /* @__PURE__ */ X("td", {
1444
- className: j("text-right p-2 tabular-nums", C),
1443
+ E.map((e) => /* @__PURE__ */ Z("td", {
1444
+ className: N("text-right p-2 tabular-nums", C),
1445
1445
  role: b ? "button" : void 0,
1446
1446
  tabIndex: b ? 0 : void 0,
1447
1447
  onClick: b ? () => x({
@@ -1454,10 +1454,10 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1454
1454
  colKey: e,
1455
1455
  value: k[e] ?? 0
1456
1456
  })) : void 0,
1457
- children: M(k[e] ?? 0)
1457
+ children: j(k[e] ?? 0)
1458
1458
  }, e)),
1459
- p && /* @__PURE__ */ X("td", {
1460
- className: j("text-right p-2 tabular-nums font-bold", C),
1459
+ p && /* @__PURE__ */ Z("td", {
1460
+ className: N("text-right p-2 tabular-nums font-bold", C),
1461
1461
  role: b ? "button" : void 0,
1462
1462
  tabIndex: b ? 0 : void 0,
1463
1463
  onClick: b ? () => x({
@@ -1468,7 +1468,7 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
1468
1468
  scope: "total",
1469
1469
  value: A
1470
1470
  })) : void 0,
1471
- children: M(A)
1471
+ children: j(A)
1472
1472
  })
1473
1473
  ]
1474
1474
  }) })
@@ -1503,35 +1503,35 @@ function et(e, t) {
1503
1503
  return Array.from(a);
1504
1504
  }
1505
1505
  var tt = ({ schema: e, dataSource: t, className: r }) => {
1506
- let a = ne(s), c = t || a?.dataSource, u = l(e.bind), { fieldLabel: d, fieldOptionLabel: f } = be(), p = "No data available", m = "No data source available for";
1506
+ let a = ne(s), c = t || a?.dataSource, u = l(e.bind), { fieldLabel: d, fieldOptionLabel: f } = h(), p = "No data available", g = "No data source available for";
1507
1507
  try {
1508
- let { t: e } = ye(), t = e("dashboard.noDataAvailable");
1508
+ let { t: e } = m(), t = e("dashboard.noDataAvailable");
1509
1509
  t && t !== "dashboard.noDataAvailable" && (p = t);
1510
1510
  let n = e("dashboard.noDataSourceFor");
1511
- n && n !== "dashboard.noDataSourceFor" && (m = n);
1511
+ n && n !== "dashboard.noDataSourceFor" && (g = n);
1512
1512
  } catch {}
1513
- let [h, g] = R([]), [_, v] = R(null), [y, b] = R(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [x, S] = R(null);
1514
- I(() => {
1513
+ let [_, v] = H([]), [y, b] = H(null), [x, S] = H(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, w] = H(null);
1514
+ z(() => {
1515
1515
  let t = !0;
1516
1516
  return e.objectName && !u && (!e.data || e.data.length === 0) ? (async () => {
1517
1517
  if (!c || !e.objectName) {
1518
- t && b(!1);
1518
+ t && S(!1);
1519
1519
  return;
1520
1520
  }
1521
- t && (b(!0), S(null));
1521
+ t && (S(!0), w(null));
1522
1522
  try {
1523
1523
  let r;
1524
1524
  if (typeof c.find == "function") {
1525
- let t = et(e, _), a = { $filter: i(e.filter) };
1525
+ let t = et(e, y), a = { $filter: i(e.filter) };
1526
1526
  t.length && (a.$expand = t), r = n(await c.find(e.objectName, a));
1527
1527
  } else return;
1528
- t && g(r);
1528
+ t && v(r);
1529
1529
  } catch (e) {
1530
- console.error("[ObjectDataTable] Fetch error:", e), t && S(e instanceof Error ? e.message : "Failed to load data");
1530
+ console.error("[ObjectDataTable] Fetch error:", e), t && w(e instanceof Error ? e.message : "Failed to load data");
1531
1531
  } finally {
1532
- t && b(!1);
1532
+ t && S(!1);
1533
1533
  }
1534
- })() : t && b(!1), () => {
1534
+ })() : t && S(!1), () => {
1535
1535
  t = !1;
1536
1536
  };
1537
1537
  }, [
@@ -1540,19 +1540,19 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1540
1540
  u,
1541
1541
  e.data,
1542
1542
  e.filter,
1543
- _
1544
- ]), I(() => {
1543
+ y
1544
+ ]), z(() => {
1545
1545
  let t = !0;
1546
1546
  if (!(!c || !e.objectName || typeof c.getObjectSchema != "function")) return c.getObjectSchema(e.objectName).then((e) => {
1547
- t && v(e);
1547
+ t && b(e);
1548
1548
  }).catch(() => {}), () => {
1549
1549
  t = !1;
1550
1550
  };
1551
1551
  }, [e.objectName, c]);
1552
- let C = u || e.data || h, w = Array.isArray(C) ? C : [], E = L(() => {
1552
+ let T = u || e.data || _, E = Array.isArray(T) ? T : [], D = B(() => {
1553
1553
  let t = e.objectName, n = {};
1554
- if (_?.fields) {
1555
- let e = _.fields;
1554
+ if (y?.fields) {
1555
+ let e = y.fields;
1556
1556
  if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
1557
1557
  else for (let [t, r] of Object.entries(e)) n[t] = {
1558
1558
  name: t,
@@ -1607,13 +1607,13 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1607
1607
  "€": "EUR",
1608
1608
  "£": "GBP"
1609
1609
  }[t[0]];
1610
- return xe(e, o.currency || n);
1610
+ return be(e, o.currency || n);
1611
1611
  }
1612
1612
  if (typeof t == "string" && /%/.test(t) && typeof e == "number") {
1613
1613
  let n = (t.match(/0\.(0+)%/) || [, ""])[1].length;
1614
- return Ce((e > 1 ? e / 100 : e) * 100, n);
1614
+ return Se((e > 1 ? e / 100 : e) * 100, n);
1615
1615
  }
1616
- return typeof t == "string" && /[YMDHms]/.test(t) ? Se(e, t) : /* @__PURE__ */ X(we(Te(o)), {
1616
+ return typeof t == "string" && /[YMDHms]/.test(t) ? xe(e, t) : /* @__PURE__ */ Z(Ce(we(o)), {
1617
1617
  value: e,
1618
1618
  field: o
1619
1619
  });
@@ -1632,7 +1632,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1632
1632
  header: d(t, e.accessorKey, e.header)
1633
1633
  })) : n).map(i);
1634
1634
  }
1635
- if (w.length === 0) return [];
1635
+ if (E.length === 0) return [];
1636
1636
  let a = new Set([
1637
1637
  "id",
1638
1638
  "organization_id",
@@ -1647,54 +1647,54 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1647
1647
  "_id",
1648
1648
  "__typename"
1649
1649
  ]), o = (e, t) => t && (t.isSystem === !0 || t.system === !0) ? !0 : a.has(e);
1650
- return (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !o(e, n[e])) : Object.keys(w[0]).filter((e) => !e.startsWith("_") && !o(e))).map((e) => i({
1650
+ return (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !o(e, n[e])) : Object.keys(E[0]).filter((e) => !e.startsWith("_") && !o(e))).map((e) => i({
1651
1651
  header: r(e),
1652
1652
  accessorKey: e
1653
1653
  }));
1654
1654
  }, [
1655
1655
  e.columns,
1656
1656
  e.objectName,
1657
- w,
1658
- _,
1657
+ E,
1658
+ y,
1659
1659
  d,
1660
1660
  f
1661
1661
  ]);
1662
- if (y && w.length === 0) return /* @__PURE__ */ X("div", {
1663
- className: j("overflow-auto", r),
1662
+ if (x && E.length === 0) return /* @__PURE__ */ Z("div", {
1663
+ className: N("overflow-auto", r),
1664
1664
  "data-testid": "table-loading",
1665
- children: /* @__PURE__ */ Z("div", {
1665
+ children: /* @__PURE__ */ Q("div", {
1666
1666
  className: "space-y-2 p-2",
1667
- children: [/* @__PURE__ */ Z("div", {
1667
+ children: [/* @__PURE__ */ Q("div", {
1668
1668
  className: "flex gap-2",
1669
1669
  children: [
1670
- /* @__PURE__ */ X(A, { className: "h-6 w-1/4" }),
1671
- /* @__PURE__ */ X(A, { className: "h-6 w-1/4" }),
1672
- /* @__PURE__ */ X(A, { className: "h-6 w-1/4" }),
1673
- /* @__PURE__ */ X(A, { className: "h-6 w-1/4" })
1670
+ /* @__PURE__ */ Z(M, { className: "h-6 w-1/4" }),
1671
+ /* @__PURE__ */ Z(M, { className: "h-6 w-1/4" }),
1672
+ /* @__PURE__ */ Z(M, { className: "h-6 w-1/4" }),
1673
+ /* @__PURE__ */ Z(M, { className: "h-6 w-1/4" })
1674
1674
  ]
1675
1675
  }), [
1676
1676
  1,
1677
1677
  2,
1678
1678
  3,
1679
1679
  4
1680
- ].map((e) => /* @__PURE__ */ Z("div", {
1680
+ ].map((e) => /* @__PURE__ */ Q("div", {
1681
1681
  className: "flex gap-2",
1682
1682
  children: [
1683
- /* @__PURE__ */ X(A, { className: "h-5 w-1/4" }),
1684
- /* @__PURE__ */ X(A, { className: "h-5 w-1/4" }),
1685
- /* @__PURE__ */ X(A, { className: "h-5 w-1/4" }),
1686
- /* @__PURE__ */ X(A, { className: "h-5 w-1/4" })
1683
+ /* @__PURE__ */ Z(M, { className: "h-5 w-1/4" }),
1684
+ /* @__PURE__ */ Z(M, { className: "h-5 w-1/4" }),
1685
+ /* @__PURE__ */ Z(M, { className: "h-5 w-1/4" }),
1686
+ /* @__PURE__ */ Z(M, { className: "h-5 w-1/4" })
1687
1687
  ]
1688
1688
  }, e))]
1689
1689
  })
1690
1690
  });
1691
- if (x) return /* @__PURE__ */ X("div", {
1692
- className: j("overflow-auto", r),
1691
+ if (C) return /* @__PURE__ */ Z("div", {
1692
+ className: N("overflow-auto", r),
1693
1693
  "data-testid": "table-error",
1694
- children: /* @__PURE__ */ Z("div", {
1694
+ children: /* @__PURE__ */ Q("div", {
1695
1695
  className: "flex flex-col items-center justify-center py-8 text-destructive",
1696
1696
  "data-testid": "table-error-message",
1697
- children: [/* @__PURE__ */ Z("svg", {
1697
+ children: [/* @__PURE__ */ Q("svg", {
1698
1698
  xmlns: "http://www.w3.org/2000/svg",
1699
1699
  className: "h-8 w-8 mb-2 opacity-60",
1700
1700
  viewBox: "0 0 24 24",
@@ -1704,38 +1704,38 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1704
1704
  strokeLinecap: "round",
1705
1705
  strokeLinejoin: "round",
1706
1706
  children: [
1707
- /* @__PURE__ */ X("circle", {
1707
+ /* @__PURE__ */ Z("circle", {
1708
1708
  cx: "12",
1709
1709
  cy: "12",
1710
1710
  r: "10"
1711
1711
  }),
1712
- /* @__PURE__ */ X("line", {
1712
+ /* @__PURE__ */ Z("line", {
1713
1713
  x1: "12",
1714
1714
  y1: "8",
1715
1715
  x2: "12",
1716
1716
  y2: "12"
1717
1717
  }),
1718
- /* @__PURE__ */ X("line", {
1718
+ /* @__PURE__ */ Z("line", {
1719
1719
  x1: "12",
1720
1720
  y1: "16",
1721
1721
  x2: "12.01",
1722
1722
  y2: "16"
1723
1723
  })
1724
1724
  ]
1725
- }), /* @__PURE__ */ X("p", {
1725
+ }), /* @__PURE__ */ Z("p", {
1726
1726
  className: "text-xs",
1727
- children: x
1727
+ children: C
1728
1728
  })]
1729
1729
  })
1730
1730
  });
1731
- if (!c && e.objectName && w.length === 0) return /* @__PURE__ */ X("div", {
1732
- className: j("overflow-auto", r),
1733
- children: /* @__PURE__ */ X("div", {
1731
+ if (!c && e.objectName && E.length === 0) return /* @__PURE__ */ Z("div", {
1732
+ className: N("overflow-auto", r),
1733
+ children: /* @__PURE__ */ Z("div", {
1734
1734
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1735
- children: /* @__PURE__ */ Z("p", {
1735
+ children: /* @__PURE__ */ Q("p", {
1736
1736
  className: "text-xs",
1737
1737
  children: [
1738
- m,
1738
+ g,
1739
1739
  " “",
1740
1740
  e.objectName,
1741
1741
  "”"
@@ -1743,12 +1743,12 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1743
1743
  })
1744
1744
  })
1745
1745
  });
1746
- if (w.length === 0) return /* @__PURE__ */ X("div", {
1747
- className: j("overflow-auto", r),
1746
+ if (E.length === 0) return /* @__PURE__ */ Z("div", {
1747
+ className: N("overflow-auto", r),
1748
1748
  "data-testid": "table-empty-state",
1749
- children: /* @__PURE__ */ Z("div", {
1749
+ children: /* @__PURE__ */ Q("div", {
1750
1750
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1751
- children: [/* @__PURE__ */ Z("svg", {
1751
+ children: [/* @__PURE__ */ Q("svg", {
1752
1752
  xmlns: "http://www.w3.org/2000/svg",
1753
1753
  className: "h-8 w-8 mb-2 opacity-40",
1754
1754
  viewBox: "0 0 24 24",
@@ -1758,7 +1758,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1758
1758
  strokeLinecap: "round",
1759
1759
  strokeLinejoin: "round",
1760
1760
  children: [
1761
- /* @__PURE__ */ X("rect", {
1761
+ /* @__PURE__ */ Z("rect", {
1762
1762
  x: "3",
1763
1763
  y: "3",
1764
1764
  width: "18",
@@ -1766,45 +1766,45 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1766
1766
  rx: "2",
1767
1767
  ry: "2"
1768
1768
  }),
1769
- /* @__PURE__ */ X("line", {
1769
+ /* @__PURE__ */ Z("line", {
1770
1770
  x1: "3",
1771
1771
  y1: "9",
1772
1772
  x2: "21",
1773
1773
  y2: "9"
1774
1774
  }),
1775
- /* @__PURE__ */ X("line", {
1775
+ /* @__PURE__ */ Z("line", {
1776
1776
  x1: "9",
1777
1777
  y1: "21",
1778
1778
  x2: "9",
1779
1779
  y2: "9"
1780
1780
  })
1781
1781
  ]
1782
- }), /* @__PURE__ */ X("p", {
1782
+ }), /* @__PURE__ */ Z("p", {
1783
1783
  className: "text-xs",
1784
1784
  children: p
1785
1785
  })]
1786
1786
  })
1787
1787
  });
1788
- let D = {
1788
+ let k = {
1789
1789
  ...e,
1790
1790
  type: "data-table",
1791
- data: w,
1792
- columns: E
1791
+ data: E,
1792
+ columns: D
1793
1793
  };
1794
- return /* @__PURE__ */ Z("div", {
1795
- className: j("relative", r),
1796
- children: [/* @__PURE__ */ X(T, { active: y && w.length > 0 }), /* @__PURE__ */ X(o, {
1797
- schema: D,
1794
+ return /* @__PURE__ */ Q("div", {
1795
+ className: N("relative", r),
1796
+ children: [/* @__PURE__ */ Z(O, { active: x && E.length > 0 }), /* @__PURE__ */ Z(o, {
1797
+ schema: k,
1798
1798
  className: r
1799
1799
  })]
1800
1800
  });
1801
1801
  }, nt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: s, columns: c, maxRows: l, className: u, report: d }) => {
1802
- let f = d && typeof d == "object" && (Array.isArray(d.columns) || "objectName" in d), p = /* @__PURE__ */ X("div", {
1803
- className: j("overflow-auto", u),
1802
+ let f = d && typeof d == "object" && (Array.isArray(d.columns) || "objectName" in d), p = /* @__PURE__ */ Z("div", {
1803
+ className: N("overflow-auto", u),
1804
1804
  "data-testid": "drill-down-body",
1805
1805
  children: f ? (() => {
1806
1806
  let e = d.filter, t = e ? a ? { $and: [e, a] } : e : a;
1807
- return /* @__PURE__ */ X(o, { schema: {
1807
+ return /* @__PURE__ */ Z(o, { schema: {
1808
1808
  ...d,
1809
1809
  type: "spec-report",
1810
1810
  report: {
@@ -1813,7 +1813,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1813
1813
  },
1814
1814
  filter: t
1815
1815
  } });
1816
- })() : /* @__PURE__ */ X(tt, {
1816
+ })() : /* @__PURE__ */ Z(tt, {
1817
1817
  schema: {
1818
1818
  type: "object-data-table",
1819
1819
  objectName: i,
@@ -1829,30 +1829,30 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1829
1829
  dataSource: s
1830
1830
  })
1831
1831
  });
1832
- return r === "dialog" ? /* @__PURE__ */ X(x, {
1832
+ return r === "dialog" ? /* @__PURE__ */ Z(w, {
1833
1833
  open: e,
1834
1834
  onOpenChange: (e) => !e && t(),
1835
- children: /* @__PURE__ */ Z(S, {
1835
+ children: /* @__PURE__ */ Q(T, {
1836
1836
  className: "max-w-5xl",
1837
- children: [/* @__PURE__ */ X(C, { children: /* @__PURE__ */ X(w, { children: n }) }), p]
1837
+ children: [/* @__PURE__ */ Z(E, { children: /* @__PURE__ */ Z(D, { children: n }) }), p]
1838
1838
  })
1839
- }) : /* @__PURE__ */ X(E, {
1839
+ }) : /* @__PURE__ */ Z(k, {
1840
1840
  open: e,
1841
1841
  onOpenChange: (e) => !e && t(),
1842
- children: /* @__PURE__ */ Z(D, {
1842
+ children: /* @__PURE__ */ Q(A, {
1843
1843
  side: "right",
1844
1844
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1845
- children: [/* @__PURE__ */ X(O, { children: /* @__PURE__ */ X(k, { children: n }) }), /* @__PURE__ */ X("div", {
1845
+ children: [/* @__PURE__ */ Z(j, { children: /* @__PURE__ */ Z(ee, { children: n }) }), /* @__PURE__ */ Z("div", {
1846
1846
  className: "flex-1 overflow-hidden mt-2",
1847
1847
  children: p
1848
1848
  })]
1849
1849
  })
1850
1850
  });
1851
1851
  }, rt = ({ schema: e, dataSource: o, className: c }) => {
1852
- let u = ne(s), d = o || u?.dataSource, f = l(e.bind), [p, m] = R([]), [h, g] = R(!1), [_, v] = R(null), [y, b] = R({}), [x, S] = R({}), [C, w] = R(null), { fieldLabel: T, fieldOptionLabel: E } = be(), D = re(T), O = re(E);
1853
- I(() => {
1854
- D.current = T, O.current = E;
1855
- }, [T, E]), I(() => {
1852
+ let u = ne(s), d = o || u?.dataSource, f = l(e.bind), [p, m] = H([]), [g, _] = H(!1), [v, y] = H(null), [b, x] = H({}), [S, C] = H({}), [w, T] = H(null), { fieldLabel: E, fieldOptionLabel: D } = h(), O = V(E), k = V(D);
1853
+ z(() => {
1854
+ O.current = E, k.current = D;
1855
+ }, [E, D]), z(() => {
1856
1856
  if (!d || !e.objectName) return;
1857
1857
  let t = d.getObjectSchema;
1858
1858
  if (typeof t != "function") return;
@@ -1862,35 +1862,35 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1862
1862
  let r = e.objectName, i = {}, a = {};
1863
1863
  for (let [e, n] of Object.entries(t.fields)) {
1864
1864
  let t = n?.label ? String(n.label) : e;
1865
- a[e] = D.current(r, e, t);
1865
+ a[e] = O.current(r, e, t);
1866
1866
  let o = n?.options;
1867
1867
  if (Array.isArray(o) && o.length > 0) {
1868
1868
  let t = {};
1869
1869
  for (let n of o) if (n && n.value !== void 0 && n.label !== void 0) {
1870
1870
  let i = String(n.value), a = String(n.label);
1871
- t[i] = O.current(r, e, i, a);
1871
+ t[i] = k.current(r, e, i, a);
1872
1872
  }
1873
1873
  Object.keys(t).length > 0 && (i[e] = t);
1874
1874
  }
1875
1875
  }
1876
- b(i), S(a);
1876
+ x(i), C(a);
1877
1877
  }).catch(() => {}), () => {
1878
1878
  n = !1;
1879
1879
  };
1880
- }, [d, e.objectName]), I(() => {
1880
+ }, [d, e.objectName]), z(() => {
1881
1881
  let t = !0;
1882
1882
  return e.objectName && !f && (!e.data || e.data.length === 0) && (async () => {
1883
1883
  if (!(!d || !e.objectName)) {
1884
- t && (g(!0), v(null));
1884
+ t && (_(!0), y(null));
1885
1885
  try {
1886
1886
  let r;
1887
1887
  if (typeof d.find == "function") r = n(await d.find(e.objectName, { $filter: i(e.filter) }));
1888
1888
  else return;
1889
1889
  t && m(r);
1890
1890
  } catch (e) {
1891
- console.error("[ObjectPivotTable] Fetch error:", e), t && v(e instanceof Error ? e.message : "Failed to load data");
1891
+ console.error("[ObjectPivotTable] Fetch error:", e), t && y(e instanceof Error ? e.message : "Failed to load data");
1892
1892
  } finally {
1893
- t && g(!1);
1893
+ t && _(!1);
1894
1894
  }
1895
1895
  }
1896
1896
  })(), () => {
@@ -1903,48 +1903,48 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1903
1903
  e.data,
1904
1904
  e.filter
1905
1905
  ]);
1906
- let k = f || e.data || p, M = Array.isArray(k) ? k : [];
1907
- if (h && M.length === 0) return /* @__PURE__ */ Z("div", {
1908
- className: j("overflow-auto", c),
1906
+ let A = f || e.data || p, j = Array.isArray(A) ? A : [];
1907
+ if (g && j.length === 0) return /* @__PURE__ */ Q("div", {
1908
+ className: N("overflow-auto", c),
1909
1909
  "data-testid": "pivot-loading",
1910
- children: [e.title && /* @__PURE__ */ X("h3", {
1910
+ children: [e.title && /* @__PURE__ */ Z("h3", {
1911
1911
  className: "text-sm font-semibold mb-2",
1912
1912
  children: e.title
1913
- }), /* @__PURE__ */ Z("div", {
1913
+ }), /* @__PURE__ */ Q("div", {
1914
1914
  className: "space-y-2 p-2",
1915
- children: [/* @__PURE__ */ Z("div", {
1915
+ children: [/* @__PURE__ */ Q("div", {
1916
1916
  className: "flex gap-2",
1917
1917
  children: [
1918
- /* @__PURE__ */ X(A, { className: "h-6 w-24" }),
1919
- /* @__PURE__ */ X(A, { className: "h-6 w-20" }),
1920
- /* @__PURE__ */ X(A, { className: "h-6 w-20" }),
1921
- /* @__PURE__ */ X(A, { className: "h-6 w-20" })
1918
+ /* @__PURE__ */ Z(M, { className: "h-6 w-24" }),
1919
+ /* @__PURE__ */ Z(M, { className: "h-6 w-20" }),
1920
+ /* @__PURE__ */ Z(M, { className: "h-6 w-20" }),
1921
+ /* @__PURE__ */ Z(M, { className: "h-6 w-20" })
1922
1922
  ]
1923
1923
  }), [
1924
1924
  1,
1925
1925
  2,
1926
1926
  3
1927
- ].map((e) => /* @__PURE__ */ Z("div", {
1927
+ ].map((e) => /* @__PURE__ */ Q("div", {
1928
1928
  className: "flex gap-2",
1929
1929
  children: [
1930
- /* @__PURE__ */ X(A, { className: "h-5 w-24" }),
1931
- /* @__PURE__ */ X(A, { className: "h-5 w-20" }),
1932
- /* @__PURE__ */ X(A, { className: "h-5 w-20" }),
1933
- /* @__PURE__ */ X(A, { className: "h-5 w-20" })
1930
+ /* @__PURE__ */ Z(M, { className: "h-5 w-24" }),
1931
+ /* @__PURE__ */ Z(M, { className: "h-5 w-20" }),
1932
+ /* @__PURE__ */ Z(M, { className: "h-5 w-20" }),
1933
+ /* @__PURE__ */ Z(M, { className: "h-5 w-20" })
1934
1934
  ]
1935
1935
  }, e))]
1936
1936
  })]
1937
1937
  });
1938
- if (_) return /* @__PURE__ */ Z("div", {
1939
- className: j("overflow-auto", c),
1938
+ if (v) return /* @__PURE__ */ Q("div", {
1939
+ className: N("overflow-auto", c),
1940
1940
  "data-testid": "pivot-error",
1941
- children: [e.title && /* @__PURE__ */ X("h3", {
1941
+ children: [e.title && /* @__PURE__ */ Z("h3", {
1942
1942
  className: "text-sm font-semibold mb-2",
1943
1943
  children: e.title
1944
- }), /* @__PURE__ */ Z("div", {
1944
+ }), /* @__PURE__ */ Q("div", {
1945
1945
  className: "flex flex-col items-center justify-center py-8 text-destructive",
1946
1946
  "data-testid": "pivot-error-message",
1947
- children: [/* @__PURE__ */ Z("svg", {
1947
+ children: [/* @__PURE__ */ Q("svg", {
1948
1948
  xmlns: "http://www.w3.org/2000/svg",
1949
1949
  className: "h-8 w-8 mb-2 opacity-60",
1950
1950
  viewBox: "0 0 24 24",
@@ -1954,38 +1954,38 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1954
1954
  strokeLinecap: "round",
1955
1955
  strokeLinejoin: "round",
1956
1956
  children: [
1957
- /* @__PURE__ */ X("circle", {
1957
+ /* @__PURE__ */ Z("circle", {
1958
1958
  cx: "12",
1959
1959
  cy: "12",
1960
1960
  r: "10"
1961
1961
  }),
1962
- /* @__PURE__ */ X("line", {
1962
+ /* @__PURE__ */ Z("line", {
1963
1963
  x1: "12",
1964
1964
  y1: "8",
1965
1965
  x2: "12",
1966
1966
  y2: "12"
1967
1967
  }),
1968
- /* @__PURE__ */ X("line", {
1968
+ /* @__PURE__ */ Z("line", {
1969
1969
  x1: "12",
1970
1970
  y1: "16",
1971
1971
  x2: "12.01",
1972
1972
  y2: "16"
1973
1973
  })
1974
1974
  ]
1975
- }), /* @__PURE__ */ X("p", {
1975
+ }), /* @__PURE__ */ Z("p", {
1976
1976
  className: "text-xs",
1977
- children: _
1977
+ children: v
1978
1978
  })]
1979
1979
  })]
1980
1980
  });
1981
- if (!d && e.objectName && M.length === 0) return /* @__PURE__ */ Z("div", {
1982
- className: j("overflow-auto", c),
1983
- children: [e.title && /* @__PURE__ */ X("h3", {
1981
+ if (!d && e.objectName && j.length === 0) return /* @__PURE__ */ Q("div", {
1982
+ className: N("overflow-auto", c),
1983
+ children: [e.title && /* @__PURE__ */ Z("h3", {
1984
1984
  className: "text-sm font-semibold mb-2",
1985
1985
  children: e.title
1986
- }), /* @__PURE__ */ X("div", {
1986
+ }), /* @__PURE__ */ Z("div", {
1987
1987
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1988
- children: /* @__PURE__ */ Z("p", {
1988
+ children: /* @__PURE__ */ Q("p", {
1989
1989
  className: "text-xs",
1990
1990
  children: [
1991
1991
  "No data source available for “",
@@ -1995,37 +1995,37 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
1995
1995
  })
1996
1996
  })]
1997
1997
  });
1998
- let N = {
1998
+ let ee = {
1999
1999
  ...e,
2000
- data: M
2001
- }, P = e.rowField ? y[e.rowField] : void 0, ee = e.columnField ? y[e.columnField] : void 0, te = e.rowField ? x[e.rowField] : void 0, F = e.drillDown;
2002
- return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(Qe, {
2003
- schema: N,
2000
+ data: j
2001
+ }, P = e.rowField ? b[e.rowField] : void 0, F = e.columnField ? b[e.columnField] : void 0, I = e.rowField ? S[e.rowField] : void 0, L = e.drillDown;
2002
+ return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(Qe, {
2003
+ schema: ee,
2004
2004
  className: c,
2005
2005
  rowLabels: P,
2006
- columnLabels: ee,
2007
- rowFieldLabel: te,
2008
- onDrillDown: r(F) ? (e) => w(e) : void 0
2006
+ columnLabels: F,
2007
+ rowFieldLabel: I,
2008
+ onDrillDown: r(L) ? (e) => T(e) : void 0
2009
2009
  }), (() => {
2010
- if (!C || !e.objectName) return null;
2011
- let n = t(F, C, {
2010
+ if (!w || !e.objectName) return null;
2011
+ let n = t(L, w, {
2012
2012
  rowField: e.rowField,
2013
2013
  columnField: e.columnField
2014
2014
  }), r = {
2015
2015
  ...e.filter || {},
2016
2016
  ...n
2017
2017
  };
2018
- return /* @__PURE__ */ X(nt, {
2018
+ return /* @__PURE__ */ Z(nt, {
2019
2019
  open: !0,
2020
- onClose: () => w(null),
2021
- title: a(F, C, e.title || "Details"),
2022
- target: F?.target ?? "drawer",
2020
+ onClose: () => T(null),
2021
+ title: a(L, w, e.title || "Details"),
2022
+ target: L?.target ?? "drawer",
2023
2023
  objectName: e.objectName,
2024
2024
  filter: r,
2025
2025
  dataSource: d,
2026
- columns: F?.columns,
2027
- maxRows: F?.maxRows,
2028
- report: F?.report
2026
+ columns: L?.columns,
2027
+ maxRows: L?.maxRows,
2028
+ report: L?.report
2029
2029
  });
2030
2030
  })()] });
2031
2031
  }, it = {
@@ -2155,8 +2155,8 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
2155
2155
  ]
2156
2156
  };
2157
2157
  function at({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2158
- let { draft: a, isDirty: o, updateField: s, discard: c } = N(n, { onUpdate: i });
2159
- return /* @__PURE__ */ X(y, {
2158
+ let { draft: a, isDirty: o, updateField: s, discard: c } = F(n, { onUpdate: i });
2159
+ return /* @__PURE__ */ Z(S, {
2160
2160
  open: e,
2161
2161
  onClose: t,
2162
2162
  schema: it,
@@ -2337,11 +2337,11 @@ function Ct(e, t, n, r) {
2337
2337
  key: e,
2338
2338
  label: t,
2339
2339
  type: "custom",
2340
- render: (i, a, o) => /* @__PURE__ */ X(b, {
2340
+ render: (i, a, o) => /* @__PURE__ */ Z(C, {
2341
2341
  label: t,
2342
- children: /* @__PURE__ */ X("div", {
2342
+ children: /* @__PURE__ */ Z("div", {
2343
2343
  "data-testid": `config-field-${e}`,
2344
- children: /* @__PURE__ */ X(v, {
2344
+ children: /* @__PURE__ */ Z(x, {
2345
2345
  options: r ?? [],
2346
2346
  value: i ?? "",
2347
2347
  onValueChange: a,
@@ -2360,11 +2360,11 @@ function wt(e, t, n) {
2360
2360
  key: "object",
2361
2361
  label: "Data source",
2362
2362
  type: "custom",
2363
- render: (t, n) => /* @__PURE__ */ X(b, {
2363
+ render: (t, n) => /* @__PURE__ */ Z(C, {
2364
2364
  label: "Data source",
2365
- children: /* @__PURE__ */ X("div", {
2365
+ children: /* @__PURE__ */ Z("div", {
2366
2366
  "data-testid": "config-field-object",
2367
- children: /* @__PURE__ */ X(v, {
2367
+ children: /* @__PURE__ */ Z(x, {
2368
2368
  options: e,
2369
2369
  value: t ?? "",
2370
2370
  onValueChange: n,
@@ -2708,15 +2708,15 @@ function Et(e) {
2708
2708
  return _t(t) || delete n.categoryField, vt(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), gt(t) || (delete n.xAxisLabel, delete n.yAxisLabel), t === "pivot" ? (delete n.aggregate, delete n.categoryField) : (delete n.rowField, delete n.columnField, delete n.aggregation, delete n.rowSortBy, delete n.rowSortOrder, delete n.columnSortBy, delete n.columnSortOrder, delete n.showRowLabels, delete n.showRowTotals, delete n.showColumnLabels, delete n.showColumnTotals, delete n.format), t !== "table" && (delete n.searchable, delete n.pagination), yt(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
2709
2709
  }
2710
2710
  function Dt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
2711
- let { draft: c, isDirty: l, updateField: u, discard: d } = N(P.useMemo(() => ({
2711
+ let { draft: c, isDirty: l, updateField: u, discard: d } = F(I.useMemo(() => ({
2712
2712
  ...n,
2713
2713
  title: typeof n.title == "object" ? Tt(n.title) : n.title,
2714
2714
  description: typeof n.description == "object" ? Tt(n.description) : n.description
2715
2715
  }), [n]), { onUpdate: i });
2716
- return /* @__PURE__ */ X(y, {
2716
+ return /* @__PURE__ */ Z(S, {
2717
2717
  open: e,
2718
2718
  onClose: t,
2719
- schema: P.useMemo(() => wt(o, s, c.type), [
2719
+ schema: I.useMemo(() => wt(o, s, c.type), [
2720
2720
  o,
2721
2721
  s,
2722
2722
  c.type
@@ -2732,11 +2732,11 @@ function Dt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
2732
2732
  //#endregion
2733
2733
  //#region src/DashboardWithConfig.tsx
2734
2734
  function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
2735
- let [c, l] = R(o), [u, d] = R(null), [f, m] = R(e), [h, g] = R(0);
2736
- I(() => {
2737
- m(e), g((e) => e + 1);
2735
+ let [c, l] = H(o), [u, d] = H(null), [f, p] = H(e), [m, h] = H(0);
2736
+ z(() => {
2737
+ p(e), h((e) => e + 1);
2738
2738
  }, [e]);
2739
- let _ = P.useMemo(() => {
2739
+ let _ = I.useMemo(() => {
2740
2740
  if (!u || !f.widgets) return null;
2741
2741
  let e = f.widgets.find((e) => (e.id || e.title) === u);
2742
2742
  if (!e) return null;
@@ -2758,12 +2758,12 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2758
2758
  layoutW: e.layout?.w ?? 1,
2759
2759
  layoutH: e.layout?.h ?? 1
2760
2760
  };
2761
- }, [u, h]), v = F((e) => {
2761
+ }, [u, m]), v = R((e) => {
2762
2762
  d(e), l(!0);
2763
- }, []), y = F(() => {
2763
+ }, []), y = R(() => {
2764
2764
  d(null);
2765
- }, []), b = F((e, t) => {
2766
- u && m((n) => n.widgets ? {
2765
+ }, []), b = R((e, t) => {
2766
+ u && p((n) => n.widgets ? {
2767
2767
  ...n,
2768
2768
  widgets: n.widgets.map((n) => {
2769
2769
  if ((n.id || n.title) !== u) return n;
@@ -2803,7 +2803,7 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2803
2803
  };
2804
2804
  })
2805
2805
  } : n);
2806
- }, [u]), x = F((e) => {
2806
+ }, [u]), x = R((e) => {
2807
2807
  if (u && r) {
2808
2808
  let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
2809
2809
  (t || n) && (a.options = {
@@ -2815,25 +2815,25 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2815
2815
  }
2816
2816
  }), r(u, a);
2817
2817
  }
2818
- d(null), g((e) => e + 1);
2819
- }, [u, r]), S = F(() => {
2818
+ d(null), h((e) => e + 1);
2819
+ }, [u, r]), S = R(() => {
2820
2820
  l((e) => !e), d(null);
2821
2821
  }, []);
2822
- return /* @__PURE__ */ Z("div", {
2823
- className: j("flex h-full w-full", s),
2822
+ return /* @__PURE__ */ Q("div", {
2823
+ className: N("flex h-full w-full", s),
2824
2824
  "data-testid": "dashboard-with-config",
2825
- children: [/* @__PURE__ */ Z("div", {
2825
+ children: [/* @__PURE__ */ Q("div", {
2826
2826
  className: "flex-1 min-w-0 overflow-auto relative",
2827
- children: [/* @__PURE__ */ X("div", {
2827
+ children: [/* @__PURE__ */ Z("div", {
2828
2828
  className: "absolute top-2 right-2 z-10",
2829
- children: /* @__PURE__ */ Z(p, {
2829
+ children: /* @__PURE__ */ Q(g, {
2830
2830
  size: "sm",
2831
2831
  variant: c ? "default" : "outline",
2832
2832
  onClick: S,
2833
2833
  "data-testid": "dashboard-config-toggle",
2834
- children: [/* @__PURE__ */ X(W, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
2834
+ children: [/* @__PURE__ */ Z(oe, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
2835
2835
  })
2836
- }), /* @__PURE__ */ X(je, {
2836
+ }), /* @__PURE__ */ Z(je, {
2837
2837
  schema: f,
2838
2838
  onRefresh: i,
2839
2839
  recordCount: a,
@@ -2841,15 +2841,15 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2841
2841
  selectedWidgetId: u,
2842
2842
  onWidgetClick: v
2843
2843
  })]
2844
- }), c && /* @__PURE__ */ X("div", {
2844
+ }), c && /* @__PURE__ */ Z("div", {
2845
2845
  className: "relative shrink-0",
2846
- children: u && _ ? /* @__PURE__ */ X(Dt, {
2846
+ children: u && _ ? /* @__PURE__ */ Z(Dt, {
2847
2847
  open: !0,
2848
2848
  onClose: y,
2849
2849
  config: _,
2850
2850
  onSave: x,
2851
2851
  onFieldChange: b
2852
- }) : /* @__PURE__ */ X(at, {
2852
+ }) : /* @__PURE__ */ Z(at, {
2853
2853
  open: !0,
2854
2854
  onClose: () => l(!1),
2855
2855
  config: t,