@object-ui/plugin-dashboard 7.3.0 → 11.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import { ComponentRegistry as e, buildChartSeries as t, buildDatasetDrillFilter as n, buildDatasetFieldHelpers as r, buildOptionColorMap as i, compareToTrendLabelKey as a, computeDrillFilter as o, extractRecords as s, findChartSeriesRow as c, formatDimensionValue as l, formatMeasure as u, isDrillEnabled as d, resolveDateMacros as f, resolveDrillTitle as p, shiftFilterByCompareTo as m } from "@object-ui/core";
2
- import { SchemaRenderer as h, SchemaRendererContext as g, useActionEngine as _, useDataScope as v, useDnd as y, useDrillNavigation as b, useHasDndProvider as x, useObjectLabel as S } from "@object-ui/react";
3
- import { createSafeTranslation as C, resolveFieldCurrency as w, useLocalization as T, useObjectTranslation as E, useSafeFieldLabel as D, useSafeTranslate as O } from "@object-ui/i18n";
4
- import { Button as k, Card as A, CardContent as j, CardHeader as M, CardTitle as N, Combobox as P, ConfigPanelRenderer as F, ConfigRow as I, DataEmptyState as ee, Dialog as te, DialogContent as L, DialogHeader as R, DialogTitle as ne, RefreshIndicator as re, Sheet as z, SheetContent as ie, SheetHeader as B, SheetTitle as ae, Skeleton as V, cn as H, getLazyIcon as oe, useConfigDraft as se } from "@object-ui/components";
5
- import * as U from "react";
6
- import W, { Fragment as ce, forwardRef as le, useCallback as G, useContext as ue, useEffect as K, useMemo as q, useRef as de, useState as J } from "react";
7
- import { AlertCircle as fe, AlertTriangle as Y, ArrowDownIcon as pe, ArrowUpIcon as me, ArrowUpRight as he, BarChart3 as ge, Download as X, Edit as _e, GripVertical as ve, Loader2 as ye, MinusIcon as be, RefreshCw as xe, Save as Se, Settings as Ce, X as we } from "lucide-react";
8
- import { DndContext as Te, PointerSensor as Ee, closestCenter as De, useSensor as Oe, useSensors as ke } from "@dnd-kit/core";
9
- import { SortableContext as Ae, arrayMove as je, rectSortingStrategy as Me, useSortable as Ne, verticalListSortingStrategy as Pe } from "@dnd-kit/sortable";
10
- import { CSS as Fe } from "@dnd-kit/utilities";
11
- import { formatCurrency as Ie, formatDate as Le, formatPercent as Re, getCellRenderer as ze, resolveCellRendererType as Be } from "@object-ui/fields";
12
- import { Fragment as Ve, jsx as Z, jsxs as Q } from "react/jsx-runtime";
13
- import { ResponsiveGridLayout as He, useContainerWidth as Ue } from "react-grid-layout";
1
+ import { ComponentRegistry as e, buildChartSeries as t, buildDatasetDrillFilter as n, buildDatasetFieldHelpers as r, buildDimensionLabelMap as i, buildOptionColorMap as a, compareToTrendLabelKey as o, computeDrillFilter as s, extractRecords as c, findChartSeriesRow as l, formatDimensionValue as u, formatMeasure as d, isDrillEnabled as f, relabelDimensions as p, resolveDateMacros as m, resolveDrillTitle as h, shiftFilterByCompareTo as g } from "@object-ui/core";
2
+ import { SchemaRenderer as _, SchemaRendererContext as v, useActionEngine as y, useDataScope as b, useDnd as x, useDrillNavigation as S, useHasDndProvider as C, useObjectLabel as w } from "@object-ui/react";
3
+ import { createSafeTranslation as T, resolveFieldCurrency as E, useLocalization as D, useObjectTranslation as O, useSafeFieldLabel as k, useSafeTranslate as A } from "@object-ui/i18n";
4
+ import { Button as j, Card as ee, CardContent as M, CardHeader as N, CardTitle as P, ChartSkeleton as F, Combobox as I, ConfigPanelRenderer as L, ConfigRow as R, DataEmptyState as te, Dialog as z, DialogContent as ne, DialogHeader as B, DialogTitle as V, GridSkeleton as re, RefreshIndicator as ie, Sheet as ae, SheetContent as oe, SheetHeader as se, SheetTitle as ce, Skeleton as H, cn as U, getLazyIcon as le, useConfigDraft as ue } from "@object-ui/components";
5
+ import * as W from "react";
6
+ import de, { Fragment as G, forwardRef as fe, useCallback as K, useContext as pe, useEffect as q, useMemo as J, useRef as me, useState as Y } from "react";
7
+ import { AlertCircle as he, AlertTriangle as ge, ArrowDownIcon as X, ArrowUpIcon as _e, ArrowUpRight as ve, BarChart3 as ye, Download as be, Edit as xe, GripVertical as Se, Loader2 as Ce, MinusIcon as we, RefreshCw as Te, Save as Ee, Settings as De, X as Oe } from "lucide-react";
8
+ import { DndContext as ke, PointerSensor as Ae, closestCenter as je, useSensor as Me, useSensors as Ne } from "@dnd-kit/core";
9
+ import { SortableContext as Pe, arrayMove as Fe, rectSortingStrategy as Ie, useSortable as Le, verticalListSortingStrategy as Re } from "@dnd-kit/sortable";
10
+ import { CSS as ze } from "@dnd-kit/utilities";
11
+ import { formatCurrency as Be, formatDate as Ve, formatPercent as He, getCellRenderer as Ue, resolveCellRendererType as We } from "@object-ui/fields";
12
+ import { Fragment as Ge, jsx as Z, jsxs as Q } from "react/jsx-runtime";
13
+ import { ResponsiveGridLayout as Ke, useContainerWidth as qe } from "react-grid-layout";
14
14
  import "react-grid-layout/css/styles.css";
15
15
  //#region src/utils.ts
16
16
  function $(e) {
17
17
  return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
18
18
  }
19
- function We(e, t) {
19
+ function Je(e, t) {
20
20
  if (t == null || e == null || typeof e != "number" || !Number.isFinite(e) || typeof t != "number" || !Number.isFinite(t)) return null;
21
21
  if (t === 0) return e === 0 ? {
22
22
  value: 0,
@@ -38,7 +38,7 @@ function We(e, t) {
38
38
  }
39
39
  //#endregion
40
40
  //#region src/recordFields.tsx
41
- var Ge = new Set([
41
+ var Ye = new Set([
42
42
  "id",
43
43
  "organization_id",
44
44
  "tenant_id",
@@ -52,15 +52,15 @@ var Ge = new Set([
52
52
  "_id",
53
53
  "__typename"
54
54
  ]);
55
- function Ke(e, t) {
56
- return t && (t.isSystem === !0 || t.system === !0) ? !0 : Ge.has(e);
55
+ function Xe(e, t) {
56
+ return t && (t.isSystem === !0 || t.system === !0) ? !0 : Ye.has(e);
57
57
  }
58
- var qe = new Set([
58
+ var Ze = new Set([
59
59
  "select",
60
60
  "picklist",
61
61
  "dropdown",
62
62
  "status"
63
- ]), Je = new Set([
63
+ ]), Qe = new Set([
64
64
  "currency",
65
65
  "money",
66
66
  "number",
@@ -70,7 +70,7 @@ var qe = new Set([
70
70
  "percent",
71
71
  "percentage"
72
72
  ]);
73
- function Ye(e) {
73
+ function $e(e) {
74
74
  let t = {}, n = e?.fields;
75
75
  if (!n) return t;
76
76
  if (Array.isArray(n)) for (let e of n) e?.name && (t[e.name] = e);
@@ -80,9 +80,9 @@ function Ye(e) {
80
80
  };
81
81
  return t;
82
82
  }
83
- function Xe(e) {
83
+ function et(e) {
84
84
  let { accessorKey: t, label: n, def: r, objectName: i, fieldOptionLabel: a, overrides: o = {} } = e, s = o.referenceTo ?? r?.referenceTo ?? (typeof r?.reference == "string" ? r.reference : r?.reference?.to) ?? r?.target, c = o.options ?? r?.options;
85
- return i && c && a && qe.has(r?.type) && (c = c.map((e) => {
85
+ return i && c && a && Ze.has(r?.type) && (c = c.map((e) => {
86
86
  if (e == null) return e;
87
87
  let n = typeof e == "object" ? e.value : e, r = typeof e == "object" && e.label || String(n);
88
88
  return {
@@ -101,10 +101,10 @@ function Xe(e) {
101
101
  decimals: o.decimals ?? r?.decimals ?? r?.precision ?? r?.scale
102
102
  };
103
103
  }
104
- function Ze(e) {
105
- return Je.has(e.type) || typeof e.format == "string" && /^[\$¥€£]|%$|0/.test(e.format);
104
+ function tt(e) {
105
+ return Qe.has(e.type) || typeof e.format == "string" && /^[\$¥€£]|%$|0/.test(e.format);
106
106
  }
107
- function Qe(e, t, n) {
107
+ function nt(e, t, n) {
108
108
  if (e == null || e === "") return "";
109
109
  let r = t.format;
110
110
  if (typeof r == "string" && /^\$|¥|€|£/.test(r) && typeof e == "number") {
@@ -114,20 +114,20 @@ function Qe(e, t, n) {
114
114
  "€": "EUR",
115
115
  "£": "GBP"
116
116
  }[r[0]];
117
- return Ie(e, t.currency || i || n);
117
+ return Be(e, t.currency || i || n);
118
118
  }
119
119
  if (typeof r == "string" && /%/.test(r) && typeof e == "number") {
120
120
  let t = (r.match(/0\.(0+)%/) || [, ""])[1].length;
121
- return Re((e > 1 ? e / 100 : e) * 100, t);
121
+ return He((e > 1 ? e / 100 : e) * 100, t);
122
122
  }
123
- return typeof r == "string" && /[YMDHms]/.test(r) ? Le(e, r) : /* @__PURE__ */ Z(ze(Be(t)), {
123
+ return typeof r == "string" && /[YMDHms]/.test(r) ? Ve(e, r) : /* @__PURE__ */ Z(Ue(We(t)), {
124
124
  value: e,
125
125
  field: t
126
126
  });
127
127
  }
128
128
  //#endregion
129
129
  //#region src/RecordDetailDrawer.tsx
130
- var $e = [
130
+ var rt = [
131
131
  "name",
132
132
  "title",
133
133
  "label",
@@ -135,21 +135,21 @@ var $e = [
135
135
  "display_name",
136
136
  "full_name"
137
137
  ];
138
- function et(e, t) {
138
+ function it(e, t) {
139
139
  if (t && t.trim()) return t;
140
- for (let t of $e) {
140
+ for (let t of rt) {
141
141
  let n = e[t];
142
142
  if (typeof n == "string" && n.trim()) return n;
143
143
  }
144
144
  let n = e.id ?? e._id;
145
145
  return n == null ? "Record" : String(n);
146
146
  }
147
- var tt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
148
- let { fieldLabel: s, fieldOptionLabel: c } = D(), { currency: l } = T(), u = q(() => {
147
+ var at = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
148
+ let { fieldLabel: s, fieldOptionLabel: c } = k(), { currency: l } = D(), u = J(() => {
149
149
  if (!e) return [];
150
- let i = Ye(n), a;
151
- return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !Ke(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !Ke(e)), a.map((n) => {
152
- let r = i[n], a = n.charAt(0).toUpperCase() + n.slice(1).replace(/([A-Z])/g, " $1").replace(/_/g, " "), o = t ? s(t, n, a) : a, u = Xe({
150
+ let i = $e(n), a;
151
+ return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !Xe(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !Xe(e)), a.map((n) => {
152
+ let r = i[n], a = n.charAt(0).toUpperCase() + n.slice(1).replace(/([A-Z])/g, " $1").replace(/_/g, " "), o = t ? s(t, n, a) : a, u = et({
153
153
  accessorKey: n,
154
154
  label: o,
155
155
  def: r,
@@ -159,8 +159,8 @@ var tt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
159
159
  return {
160
160
  key: n,
161
161
  label: o,
162
- node: Qe(e[n], u, l),
163
- numeric: Ze(u)
162
+ node: nt(e[n], u, l),
163
+ numeric: tt(u)
164
164
  };
165
165
  });
166
166
  }, [
@@ -173,7 +173,7 @@ var tt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
173
173
  l
174
174
  ]);
175
175
  if (!e) return null;
176
- let d = et(e, i), f = /* @__PURE__ */ Z("dl", {
176
+ let d = it(e, i), f = /* @__PURE__ */ Z("dl", {
177
177
  className: "divide-y divide-border/60",
178
178
  "data-testid": "record-detail-body",
179
179
  children: u.map((e) => /* @__PURE__ */ Q("div", {
@@ -190,23 +190,23 @@ var tt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
190
190
  })]
191
191
  }, e.key))
192
192
  });
193
- return a === "dialog" ? /* @__PURE__ */ Z(te, {
193
+ return a === "dialog" ? /* @__PURE__ */ Z(z, {
194
194
  open: !0,
195
195
  onOpenChange: (e) => !e && o(),
196
- children: /* @__PURE__ */ Q(L, {
196
+ children: /* @__PURE__ */ Q(ne, {
197
197
  className: "max-w-2xl",
198
- children: [/* @__PURE__ */ Z(R, { children: /* @__PURE__ */ Z(ne, { children: d }) }), /* @__PURE__ */ Z("div", {
198
+ children: [/* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Z(V, { children: d }) }), /* @__PURE__ */ Z("div", {
199
199
  className: "max-h-[70vh] overflow-auto",
200
200
  children: f
201
201
  })]
202
202
  })
203
- }) : /* @__PURE__ */ Z(z, {
203
+ }) : /* @__PURE__ */ Z(ae, {
204
204
  open: !0,
205
205
  onOpenChange: (e) => !e && o(),
206
- children: /* @__PURE__ */ Q(ie, {
206
+ children: /* @__PURE__ */ Q(oe, {
207
207
  side: "right",
208
208
  className: "w-full sm:max-w-md md:max-w-lg flex flex-col",
209
- children: [/* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Z(ae, { children: d }) }), /* @__PURE__ */ Z("div", {
209
+ children: [/* @__PURE__ */ Z(se, { children: /* @__PURE__ */ Z(ce, { children: d }) }), /* @__PURE__ */ Z("div", {
210
210
  className: "flex-1 overflow-auto mt-2 pr-1",
211
211
  children: f
212
212
  })]
@@ -215,13 +215,13 @@ var tt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
215
215
  };
216
216
  //#endregion
217
217
  //#region src/ObjectDataTable.tsx
218
- function nt(e) {
218
+ function ot(e) {
219
219
  return e.map((e) => typeof e == "string" ? {
220
220
  header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
221
221
  accessorKey: e
222
222
  } : e);
223
223
  }
224
- function rt(e, t) {
224
+ function st(e, t) {
225
225
  if (!t?.fields) return [];
226
226
  let n = {};
227
227
  if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
@@ -239,18 +239,18 @@ function rt(e, t) {
239
239
  } else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
240
240
  return Array.from(a);
241
241
  }
242
- var it = ({ schema: e, dataSource: t, className: n }) => {
243
- let { currency: r } = T(), i = ue(g), a = t || i?.dataSource, o = v(e.bind), { fieldLabel: c, fieldOptionLabel: l } = D(), u = "No data available", p = "No data source available for";
242
+ var ct = ({ schema: e, dataSource: t, className: n }) => {
243
+ let { currency: r } = D(), i = pe(v), a = t || i?.dataSource, o = b(e.bind), { fieldLabel: s, fieldOptionLabel: l } = k(), u = "No data available", d = "No data source available for";
244
244
  try {
245
- let { t: e } = E(), t = e("dashboard.noDataAvailable");
245
+ let { t: e } = O(), t = e("dashboard.noDataAvailable");
246
246
  t && t !== "dashboard.noDataAvailable" && (u = t);
247
247
  let n = e("dashboard.noDataSourceFor");
248
- n && n !== "dashboard.noDataSourceFor" && (p = n);
248
+ n && n !== "dashboard.noDataSourceFor" && (d = n);
249
249
  } catch {}
250
- let [m, _] = J([]), [y, b] = J(null), [x, S] = J(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, w] = J(null), O = e.drillDown, k = d(O) && (O?.mode ?? "record") === "record", [A, j] = J(null), M = G((e) => {
250
+ let [p, h] = Y([]), [g, y] = Y(null), [x, S] = Y(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, w] = Y(null), T = e.drillDown, E = f(T) && (T?.mode ?? "record") === "record", [A, j] = Y(null), ee = K((e) => {
251
251
  j(e ?? null);
252
252
  }, []);
253
- K(() => {
253
+ q(() => {
254
254
  let t = !0;
255
255
  return e.objectName && !o && (!e.data || e.data.length === 0) ? (async () => {
256
256
  if (!a || !e.objectName) {
@@ -261,10 +261,10 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
261
261
  try {
262
262
  let n;
263
263
  if (typeof a.find == "function") {
264
- let t = rt(e, y), r = { $filter: f(e.filter) };
265
- t.length && (r.$expand = t), n = s(await a.find(e.objectName, r));
264
+ let t = st(e, g), r = { $filter: m(e.filter) };
265
+ t.length && (r.$expand = t), n = c(await a.find(e.objectName, r));
266
266
  } else return;
267
- t && _(n);
267
+ t && h(n);
268
268
  } catch (e) {
269
269
  console.error("[ObjectDataTable] Fetch error:", e), t && w(e instanceof Error ? e.message : "Failed to load data");
270
270
  } finally {
@@ -279,19 +279,19 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
279
279
  o,
280
280
  e.data,
281
281
  e.filter,
282
- y
283
- ]), K(() => {
282
+ g
283
+ ]), q(() => {
284
284
  let t = !0;
285
285
  if (!(!a || !e.objectName || typeof a.getObjectSchema != "function")) return a.getObjectSchema(e.objectName).then((e) => {
286
- t && b(e);
286
+ t && y(e);
287
287
  }).catch(() => {}), () => {
288
288
  t = !1;
289
289
  };
290
290
  }, [e.objectName, a]);
291
- let N = o || e.data || m, P = Array.isArray(N) ? N : [], F = q(() => {
291
+ let M = o || e.data || p, N = Array.isArray(M) ? M : [], P = J(() => {
292
292
  let t = e.objectName, n = {};
293
- if (y?.fields) {
294
- let e = y.fields;
293
+ if (g?.fields) {
294
+ let e = g.fields;
295
295
  if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
296
296
  else for (let [t, r] of Object.entries(e)) n[t] = {
297
297
  name: t,
@@ -300,9 +300,9 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
300
300
  }
301
301
  let i = (e) => {
302
302
  let n = e.charAt(0).toUpperCase() + e.slice(1).replace(/([A-Z])/g, " $1");
303
- return t ? c(t, e, n) : n;
303
+ return t ? s(t, e, n) : n;
304
304
  }, a = (e) => {
305
- let i = Xe({
305
+ let i = et({
306
306
  accessorKey: e.accessorKey,
307
307
  label: e.header,
308
308
  def: n[e.accessorKey],
@@ -316,13 +316,13 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
316
316
  currency: e.currency,
317
317
  decimals: e.decimals
318
318
  }
319
- }), a = e.align ?? (Ze(i) ? "right" : void 0);
319
+ }), a = e.align ?? (tt(i) ? "right" : void 0);
320
320
  if (typeof e.cell == "function") return {
321
321
  ...e,
322
322
  ...i,
323
323
  align: a
324
324
  };
325
- let o = (e) => Qe(e, i, r);
325
+ let o = (e) => nt(e, i, r);
326
326
  return {
327
327
  ...e,
328
328
  ...i,
@@ -331,37 +331,37 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
331
331
  };
332
332
  };
333
333
  if (e.columns && e.columns.length > 0) {
334
- let n = nt(e.columns);
334
+ let n = ot(e.columns);
335
335
  return (t ? n.map((e) => ({
336
336
  ...e,
337
- header: c(t, e.accessorKey, e.header)
337
+ header: s(t, e.accessorKey, e.header)
338
338
  })) : n).map(a);
339
339
  }
340
- return P.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !Ke(e, n[e])) : Object.keys(P[0]).filter((e) => !e.startsWith("_") && !Ke(e))).map((e) => a({
340
+ return N.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !Xe(e, n[e])) : Object.keys(N[0]).filter((e) => !e.startsWith("_") && !Xe(e))).map((e) => a({
341
341
  header: i(e),
342
342
  accessorKey: e
343
343
  }));
344
344
  }, [
345
345
  e.columns,
346
346
  e.objectName,
347
- P,
348
- y,
349
- c,
347
+ N,
348
+ g,
349
+ s,
350
350
  l,
351
351
  r
352
352
  ]);
353
- if (x && P.length === 0) return /* @__PURE__ */ Z("div", {
354
- className: H("overflow-auto", n),
353
+ if (x && N.length === 0) return /* @__PURE__ */ Z("div", {
354
+ className: U("overflow-auto", n),
355
355
  "data-testid": "table-loading",
356
356
  children: /* @__PURE__ */ Q("div", {
357
357
  className: "space-y-2 p-2",
358
358
  children: [/* @__PURE__ */ Q("div", {
359
359
  className: "flex gap-2",
360
360
  children: [
361
- /* @__PURE__ */ Z(V, { className: "h-6 w-1/4" }),
362
- /* @__PURE__ */ Z(V, { className: "h-6 w-1/4" }),
363
- /* @__PURE__ */ Z(V, { className: "h-6 w-1/4" }),
364
- /* @__PURE__ */ Z(V, { className: "h-6 w-1/4" })
361
+ /* @__PURE__ */ Z(H, { className: "h-6 w-1/4" }),
362
+ /* @__PURE__ */ Z(H, { className: "h-6 w-1/4" }),
363
+ /* @__PURE__ */ Z(H, { className: "h-6 w-1/4" }),
364
+ /* @__PURE__ */ Z(H, { className: "h-6 w-1/4" })
365
365
  ]
366
366
  }), [
367
367
  1,
@@ -371,16 +371,16 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
371
371
  ].map((e) => /* @__PURE__ */ Q("div", {
372
372
  className: "flex gap-2",
373
373
  children: [
374
- /* @__PURE__ */ Z(V, { className: "h-5 w-1/4" }),
375
- /* @__PURE__ */ Z(V, { className: "h-5 w-1/4" }),
376
- /* @__PURE__ */ Z(V, { className: "h-5 w-1/4" }),
377
- /* @__PURE__ */ Z(V, { className: "h-5 w-1/4" })
374
+ /* @__PURE__ */ Z(H, { className: "h-5 w-1/4" }),
375
+ /* @__PURE__ */ Z(H, { className: "h-5 w-1/4" }),
376
+ /* @__PURE__ */ Z(H, { className: "h-5 w-1/4" }),
377
+ /* @__PURE__ */ Z(H, { className: "h-5 w-1/4" })
378
378
  ]
379
379
  }, e))]
380
380
  })
381
381
  });
382
382
  if (C) return /* @__PURE__ */ Z("div", {
383
- className: H("overflow-auto", n),
383
+ className: U("overflow-auto", n),
384
384
  "data-testid": "table-error",
385
385
  children: /* @__PURE__ */ Q("div", {
386
386
  className: "flex flex-col items-center justify-center py-8 text-destructive",
@@ -419,14 +419,14 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
419
419
  })]
420
420
  })
421
421
  });
422
- if (!a && e.objectName && P.length === 0) return /* @__PURE__ */ Z("div", {
423
- className: H("overflow-auto", n),
422
+ if (!a && e.objectName && N.length === 0) return /* @__PURE__ */ Z("div", {
423
+ className: U("overflow-auto", n),
424
424
  children: /* @__PURE__ */ Z("div", {
425
425
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
426
426
  children: /* @__PURE__ */ Q("p", {
427
427
  className: "text-xs",
428
428
  children: [
429
- p,
429
+ d,
430
430
  " “",
431
431
  e.objectName,
432
432
  "”"
@@ -434,8 +434,8 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
434
434
  })
435
435
  })
436
436
  });
437
- if (P.length === 0) return /* @__PURE__ */ Z("div", {
438
- className: H("overflow-auto", n),
437
+ if (N.length === 0) return /* @__PURE__ */ Z("div", {
438
+ className: U("overflow-auto", n),
439
439
  "data-testid": "table-empty-state",
440
440
  children: /* @__PURE__ */ Q("div", {
441
441
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
@@ -476,35 +476,35 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
476
476
  })]
477
477
  })
478
478
  });
479
- let I = {
479
+ let F = {
480
480
  ...e,
481
481
  type: "data-table",
482
- data: P,
483
- columns: F,
484
- onRowClick: e.onRowClick ?? (k ? M : void 0)
485
- }, ee = O?.title && !O.title.includes("${") ? O.title : void 0;
482
+ data: N,
483
+ columns: P,
484
+ onRowClick: e.onRowClick ?? (E ? ee : void 0)
485
+ }, I = T?.title && !T.title.includes("${") ? T.title : void 0;
486
486
  return /* @__PURE__ */ Q("div", {
487
- className: H("relative", n),
487
+ className: U("relative", n),
488
488
  children: [
489
- /* @__PURE__ */ Z(re, { active: x && P.length > 0 }),
490
- /* @__PURE__ */ Z(h, {
491
- schema: I,
489
+ /* @__PURE__ */ Z(ie, { active: x && N.length > 0 }),
490
+ /* @__PURE__ */ Z(_, {
491
+ schema: F,
492
492
  className: n
493
493
  }),
494
- k && /* @__PURE__ */ Z(tt, {
494
+ E && /* @__PURE__ */ Z(at, {
495
495
  record: A,
496
496
  objectName: e.objectName,
497
- objectSchema: y,
498
- fields: O?.columns,
499
- title: ee,
500
- target: O?.target === "dialog" ? "dialog" : "drawer",
497
+ objectSchema: g,
498
+ fields: T?.columns,
499
+ title: I,
500
+ target: T?.target === "dialog" ? "dialog" : "drawer",
501
501
  onClose: () => j(null)
502
502
  })
503
503
  ]
504
504
  });
505
- }, at = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
506
- let { openRecordList: i } = b(), a = O();
507
- return !i || !e ? null : /* @__PURE__ */ Q(k, {
505
+ }, lt = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
506
+ let { openRecordList: i } = S(), a = A();
507
+ return !i || !e ? null : /* @__PURE__ */ Q(j, {
508
508
  type: "button",
509
509
  variant: "ghost",
510
510
  size: "sm",
@@ -513,23 +513,23 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
513
513
  onClick: () => {
514
514
  i(e, t), n?.();
515
515
  },
516
- children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Z(he, { className: "ml-1 h-3.5 w-3.5" })]
516
+ children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Z(ve, { className: "ml-1 h-3.5 w-3.5" })]
517
517
  });
518
- }, ot = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
519
- let { openRecordList: d } = b(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
520
- if (W.useEffect(() => {
518
+ }, ut = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
519
+ let { openRecordList: d } = S(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
520
+ if (de.useEffect(() => {
521
521
  e && p && (d(i, a), t());
522
522
  }, [e, p]), p) return null;
523
- let m = f ? null : /* @__PURE__ */ Z(at, {
523
+ let m = f ? null : /* @__PURE__ */ Z(lt, {
524
524
  objectName: i,
525
525
  filter: a,
526
526
  onNavigate: t
527
- }), g = /* @__PURE__ */ Z("div", {
528
- className: H("overflow-auto", l),
527
+ }), h = /* @__PURE__ */ Z("div", {
528
+ className: U("overflow-auto", l),
529
529
  "data-testid": "drill-down-body",
530
530
  children: f ? (() => {
531
531
  let e = u.filter, t = e ? a ? { $and: [e, a] } : e : a;
532
- return /* @__PURE__ */ Z(h, { schema: {
532
+ return /* @__PURE__ */ Z(_, { schema: {
533
533
  ...u,
534
534
  type: "spec-report",
535
535
  report: {
@@ -538,7 +538,7 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
538
538
  },
539
539
  filter: t
540
540
  } });
541
- })() : /* @__PURE__ */ Z(it, {
541
+ })() : /* @__PURE__ */ Z(ct, {
542
542
  schema: {
543
543
  type: "object-data-table",
544
544
  objectName: i,
@@ -559,69 +559,69 @@ var it = ({ schema: e, dataSource: t, className: n }) => {
559
559
  dataSource: o
560
560
  })
561
561
  });
562
- return r === "dialog" ? /* @__PURE__ */ Z(te, {
562
+ return r === "dialog" ? /* @__PURE__ */ Z(z, {
563
563
  open: e,
564
564
  onOpenChange: (e) => !e && t(),
565
- children: /* @__PURE__ */ Q(L, {
565
+ children: /* @__PURE__ */ Q(ne, {
566
566
  className: "max-w-5xl",
567
- children: [/* @__PURE__ */ Q(R, {
567
+ children: [/* @__PURE__ */ Q(B, {
568
568
  className: "flex-row items-center justify-between gap-4 pr-8",
569
- children: [/* @__PURE__ */ Z(ne, { children: n }), m]
570
- }), g]
569
+ children: [/* @__PURE__ */ Z(V, { children: n }), m]
570
+ }), h]
571
571
  })
572
- }) : /* @__PURE__ */ Z(z, {
572
+ }) : /* @__PURE__ */ Z(ae, {
573
573
  open: e,
574
574
  onOpenChange: (e) => !e && t(),
575
- children: /* @__PURE__ */ Q(ie, {
575
+ children: /* @__PURE__ */ Q(oe, {
576
576
  side: "right",
577
577
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
578
- children: [/* @__PURE__ */ Q(B, {
578
+ children: [/* @__PURE__ */ Q(se, {
579
579
  className: "flex-row items-center justify-between gap-4 pr-8",
580
- children: [/* @__PURE__ */ Z(ae, { children: n }), m]
580
+ children: [/* @__PURE__ */ Z(ce, { children: n }), m]
581
581
  }), /* @__PURE__ */ Z("div", {
582
582
  className: "flex-1 overflow-hidden mt-2",
583
- children: g
583
+ children: h
584
584
  })]
585
585
  })
586
586
  });
587
- }, st = n;
588
- function ct(e, t, n) {
587
+ }, dt = n;
588
+ function ft(e, t, n) {
589
589
  let r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
590
590
  return e.forEach((e, c) => {
591
- let u = t.map((t) => String(e[t] ?? "∅")).join(""), d = String(e[n] ?? "∅");
592
- a.has(u) || (a.add(u), r.push({
593
- id: u,
594
- labels: t.map((t) => l(e[t]))
591
+ let l = t.map((t) => String(e[t] ?? "∅")).join(""), d = String(e[n] ?? "∅");
592
+ a.has(l) || (a.add(l), r.push({
593
+ id: l,
594
+ labels: t.map((t) => u(e[t]))
595
595
  })), o.has(d) || (o.add(d), i.push({
596
596
  id: d,
597
- label: l(e[n])
598
- })), s.set(`${u} ${d}`, c);
597
+ label: u(e[n])
598
+ })), s.set(`${l} ${d}`, c);
599
599
  }), {
600
600
  rowHeaders: r,
601
601
  colHeaders: i,
602
602
  cellIndex: s
603
603
  };
604
604
  }
605
- function lt(e) {
605
+ function pt(e) {
606
606
  if (e == null) return "";
607
607
  let t = String(e);
608
608
  return /[",\n\r]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
609
609
  }
610
- function ut(e) {
611
- return e.map((e) => e.map(lt).join(",")).join("\r\n");
610
+ function mt(e) {
611
+ return e.map((e) => e.map(pt).join(",")).join("\r\n");
612
612
  }
613
- function dt(e, t) {
613
+ function ht(e, t) {
614
614
  if (typeof document > "u") return;
615
- let n = e && e.trim() ? e.trim() : "export", r = new Blob([`${ut(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
615
+ let n = e && e.trim() ? e.trim() : "export", r = new Blob([`${mt(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
616
616
  a.href = i, a.download = n.endsWith(".csv") ? n : `${n}.csv`, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
617
617
  }
618
- var ft = new Set([
618
+ var gt = new Set([
619
619
  "metric",
620
620
  "kpi",
621
621
  "gauge",
622
622
  "solid-gauge",
623
623
  "bullet"
624
- ]), pt = {
624
+ ]), _t = {
625
625
  bar: "bar",
626
626
  column: "column",
627
627
  "horizontal-bar": "horizontal-bar",
@@ -643,44 +643,44 @@ var ft = new Set([
643
643
  treemap: "treemap",
644
644
  sankey: "sankey"
645
645
  };
646
- function mt({ widget: e, dataSource: n }) {
647
- let a = String(e?.dataset ?? ""), o = q(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), s = q(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), d = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, p = String(e?.type ?? ""), m = ft.has(p) || o.length === 0, g = p === "table" || p === "pivot", _ = p === "pivot" && o.length >= 2, v = _ ? o.slice(0, -1) : [], y = _ ? o[o.length - 1] : "", b = _ ? [
648
- v,
649
- [y],
646
+ function vt({ widget: e, dataSource: n }) {
647
+ let o = String(e?.dataset ?? ""), s = J(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), c = J(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), f = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, h = String(e?.type ?? ""), g = gt.has(h) || s.length === 0, v = h === "table" || h === "pivot", y = h === "pivot" && s.length >= 2, b = y ? s.slice(0, -1) : [], x = y ? s[s.length - 1] : "", S = y ? [
648
+ b,
649
+ [x],
650
650
  []
651
- ] : void 0, x = O(), { fieldLabel: S } = D(), C = e?.filter, w = q(() => C && typeof C == "object" && Object.keys(C).length > 0 ? f(C) : void 0, [C]), [T, E] = J({
651
+ ] : void 0, C = A(), { fieldLabel: w } = k(), T = e?.filter, E = J(() => T && typeof T == "object" && Object.keys(T).length > 0 ? m(T) : void 0, [T]), [D, O] = Y({
652
652
  status: "idle",
653
653
  rows: []
654
- }), [k, A] = J(null), [j, M] = J(null);
655
- if (K(() => {
654
+ }), [j, ee] = Y(null), [M, N] = Y(null), [P, I] = Y(null);
655
+ if (q(() => {
656
656
  let e = n;
657
657
  if (!e || typeof e.queryDataset != "function") {
658
- E({
658
+ O({
659
659
  status: "error",
660
660
  rows: [],
661
- error: x("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
661
+ error: C("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
662
662
  });
663
663
  return;
664
664
  }
665
- if (s.length === 0) {
666
- E({
665
+ if (c.length === 0) {
666
+ O({
667
667
  status: "idle",
668
668
  rows: []
669
669
  });
670
670
  return;
671
671
  }
672
672
  let t = !1;
673
- return E({
673
+ return O({
674
674
  status: "loading",
675
675
  rows: []
676
- }), e.queryDataset(a, {
677
- dimensions: o,
678
- measures: s,
679
- ...w ? { runtimeFilter: w } : {},
680
- ...d ? { compareTo: d } : {},
681
- ...b ? { totals: { groupings: b } } : {}
676
+ }), e.queryDataset(o, {
677
+ dimensions: s,
678
+ measures: c,
679
+ ...E ? { runtimeFilter: E } : {},
680
+ ...f ? { compareTo: f } : {},
681
+ ...S ? { totals: { groupings: S } } : {}
682
682
  }).then((e) => {
683
- t || E({
683
+ t || O({
684
684
  status: "ok",
685
685
  rows: Array.isArray(e?.rows) ? e.rows : [],
686
686
  fields: Array.isArray(e?.fields) ? e.fields : [],
@@ -690,7 +690,7 @@ function mt({ widget: e, dataSource: n }) {
690
690
  totals: Array.isArray(e?.totals) ? e.totals : void 0
691
691
  });
692
692
  }).catch((e) => {
693
- t || E({
693
+ t || O({
694
694
  status: "error",
695
695
  rows: [],
696
696
  error: String(e?.message ?? e)
@@ -698,105 +698,123 @@ function mt({ widget: e, dataSource: n }) {
698
698
  }), () => {
699
699
  t = !0;
700
700
  };
701
- }, [`${p}|${a}|${o.join(",")}|${s.join(",")}|${JSON.stringify(C ?? null)}|${JSON.stringify(d ?? null)}`]), K(() => {
702
- if (m || g) {
703
- M(null);
701
+ }, [`${h}|${o}|${s.join(",")}|${c.join(",")}|${JSON.stringify(T ?? null)}|${JSON.stringify(f ?? null)}`]), q(() => {
702
+ if (g || v) {
703
+ N(null), I(null);
704
704
  return;
705
705
  }
706
- let e = T.object, t = o[0], n = T.dimensionFields && T.dimensionFields[t] || t;
707
- if (!e || !n) {
708
- M(null);
706
+ let e = D.object;
707
+ if (!e || s.length === 0) {
708
+ N(null), I(null);
709
709
  return;
710
710
  }
711
- let r = !1;
711
+ let t = (e) => D.dimensionFields && D.dimensionFields[e] || e, n = !1;
712
712
  return (async () => {
713
713
  try {
714
- let t = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(e)}`, {
714
+ let r = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(e)}`, {
715
715
  headers: { accept: "application/json" },
716
716
  credentials: "include"
717
- })).json().catch(() => null), a = i((t?.item ?? t?.data ?? t)?.fields?.[n]?.options);
718
- r || M(a);
717
+ })).json().catch(() => null), o = r?.item ?? r?.data ?? r, c = a(o?.fields?.[t(s[0])]?.options), l = {};
718
+ for (let e of s) {
719
+ let n = i(o?.fields?.[t(e)]?.options);
720
+ n && (l[e] = n);
721
+ }
722
+ n || (N(c), I(Object.keys(l).length > 0 ? l : null));
719
723
  } catch {
720
- r || M(null);
724
+ n || (N(null), I(null));
721
725
  }
722
726
  })(), () => {
723
- r = !0;
727
+ n = !0;
724
728
  };
725
729
  }, [
726
- T.object,
727
- T.dimensionFields,
728
- o,
729
- m,
730
- g
731
- ]), s.length === 0) return /* @__PURE__ */ Z("div", {
730
+ D.object,
731
+ D.dimensionFields,
732
+ s,
733
+ g,
734
+ v
735
+ ]), c.length === 0) return /* @__PURE__ */ Z("div", {
732
736
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
733
- children: x("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
737
+ children: C("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
734
738
  });
735
- if (T.status === "loading" || T.status === "idle") return /* @__PURE__ */ Z("div", {
736
- className: "flex h-full w-full items-center justify-center p-4 text-muted-foreground",
737
- children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4 animate-spin" })
739
+ if (D.status === "loading" || D.status === "idle") return /* @__PURE__ */ Q("div", {
740
+ className: "h-full w-full p-2",
741
+ "data-testid": "dataset-loading",
742
+ role: "status",
743
+ "aria-busy": "true",
744
+ "aria-live": "polite",
745
+ children: [/* @__PURE__ */ Z("span", {
746
+ className: "sr-only",
747
+ children: C("dashboard.loading", "Loading…")
748
+ }), g ? /* @__PURE__ */ Q("div", {
749
+ className: "flex h-full w-full flex-col items-start justify-center gap-2 p-2",
750
+ children: [/* @__PURE__ */ Z(H, { className: "h-8 w-32 rounded" }), /* @__PURE__ */ Z(H, { className: "h-3 w-20 rounded" })]
751
+ }) : v ? /* @__PURE__ */ Z(re, {
752
+ className: "h-full",
753
+ rows: 5,
754
+ columns: Math.max(2, s.length + c.length)
755
+ }) : /* @__PURE__ */ Z(F, { className: "h-full" })]
738
756
  });
739
- if (T.status === "error") return /* @__PURE__ */ Q("div", {
757
+ if (D.status === "error") return /* @__PURE__ */ Q("div", {
740
758
  role: "alert",
741
759
  className: "flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive",
742
- children: [/* @__PURE__ */ Z(Y, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Z("span", {
760
+ children: [/* @__PURE__ */ Z(ge, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Z("span", {
743
761
  className: "break-words",
744
- children: T.error
762
+ children: D.error
745
763
  })]
746
764
  });
747
- if (T.rows.length === 0 && !m) return /* @__PURE__ */ Q("div", {
765
+ if (D.rows.length === 0 && !g) return /* @__PURE__ */ Q("div", {
748
766
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
749
- children: [/* @__PURE__ */ Z(ge, { className: "mr-2 h-4 w-4" }), x("dashboard.noRows", "No rows")]
767
+ children: [/* @__PURE__ */ Z(ye, { className: "mr-2 h-4 w-4" }), C("dashboard.noRows", "No rows")]
750
768
  });
751
- let { measureField: N, headerLabel: P } = r(T.fields, T.object, S), { object: F, dimensionFields: I, drillRawRows: ee } = T, te = I ? o.filter((e) => e in I) : [], L = !!F && te.length > 0, R = (t, n) => {
752
- !F || !I || A({
753
- filter: st(ee?.[t], te, I, w),
769
+ let { measureField: L, headerLabel: R } = r(D.fields, D.object, w), { object: te, dimensionFields: z, drillRawRows: ne } = D, B = z ? s.filter((e) => e in z) : [], V = !!te && B.length > 0, ie = (t, n) => {
770
+ !te || !z || ee({
771
+ filter: dt(ne?.[t], B, z, E),
754
772
  title: n || String(e?.title ?? "")
755
773
  });
756
- }, ne = k && F ? /* @__PURE__ */ Z(ot, {
774
+ }, ae = j && te ? /* @__PURE__ */ Z(ut, {
757
775
  open: !0,
758
- onClose: () => A(null),
759
- title: k.title || String(e?.title ?? x("dashboard.details", "Details")),
760
- objectName: F,
761
- filter: k.filter,
776
+ onClose: () => ee(null),
777
+ title: j.title || String(e?.title ?? C("dashboard.details", "Details")),
778
+ objectName: te,
779
+ filter: j.filter,
762
780
  dataSource: n
763
781
  }) : null;
764
- if (m) {
765
- let e = N(s[0]);
782
+ if (g) {
783
+ let e = L(c[0]);
766
784
  return /* @__PURE__ */ Q("div", {
767
785
  className: "flex h-full w-full flex-col items-start justify-center gap-1 p-2",
768
786
  children: [/* @__PURE__ */ Z("span", {
769
787
  className: "text-2xl font-semibold tabular-nums",
770
- children: u(T.rows[0]?.[s[0]] ?? 0, e?.format, e?.currency)
788
+ children: d(D.rows[0]?.[c[0]] ?? 0, e?.format, e?.currency)
771
789
  }), /* @__PURE__ */ Z("span", {
772
790
  className: "text-xs text-muted-foreground",
773
- children: P(s[0])
791
+ children: R(c[0])
774
792
  })]
775
793
  });
776
794
  }
777
- if (g) {
778
- let t = [...o, ...s], n = /* @__PURE__ */ Z("button", {
795
+ if (v) {
796
+ let t = [...s, ...c], n = /* @__PURE__ */ Z("button", {
779
797
  type: "button",
780
- onClick: () => dt(String(e?.title ?? a ?? "export"), [t.map((e) => P(e)), ...T.rows.map((e) => t.map((t) => {
798
+ onClick: () => ht(String(e?.title ?? o ?? "export"), [t.map((e) => R(e)), ...D.rows.map((e) => t.map((t) => {
781
799
  let n = e[t];
782
800
  return n == null ? "" : typeof n == "number" ? n : String(n);
783
801
  }))]),
784
802
  "data-testid": "dataset-export",
785
- title: x("dashboard.exportCsv", "Export CSV"),
786
- "aria-label": x("dashboard.exportCsv", "Export CSV"),
803
+ title: C("dashboard.exportCsv", "Export CSV"),
804
+ "aria-label": C("dashboard.exportCsv", "Export CSV"),
787
805
  className: "absolute right-1 top-1 z-10 rounded p-1 text-muted-foreground opacity-70 hover:bg-accent/50 hover:text-foreground hover:opacity-100",
788
- children: /* @__PURE__ */ Z(X, { className: "h-3.5 w-3.5" })
806
+ children: /* @__PURE__ */ Z(be, { className: "h-3.5 w-3.5" })
789
807
  });
790
- if (_) {
791
- let e = ct(T.rows, v, y), t = e.colHeaders.flatMap((e) => s.map((t) => ({
808
+ if (y) {
809
+ let e = ft(D.rows, b, x), t = e.colHeaders.flatMap((e) => c.map((t) => ({
792
810
  col: e,
793
811
  measure: t,
794
- header: s.length === 1 ? e.label : `${e.label} · ${P(t)}`
795
- }))), r = (e, t) => u(e, N(t)?.format, N(t)?.currency), i = (e) => T.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
796
- for (let e of i(v) ?? []) a.set(v.map((t) => String(e[t] ?? "∅")).join(""), e);
812
+ header: c.length === 1 ? e.label : `${e.label} · ${R(t)}`
813
+ }))), r = (e, t) => d(e, L(t)?.format, L(t)?.currency), i = (e) => D.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
814
+ for (let e of i(b) ?? []) a.set(b.map((t) => String(e[t] ?? "∅")).join(""), e);
797
815
  let o = /* @__PURE__ */ new Map();
798
- for (let e of i([y]) ?? []) o.set(String(e[y] ?? "∅"), e);
799
- let c = i([])?.[0], l = a.size > 0, d = o.size > 0, f = x("dashboard.total", "Total");
816
+ for (let e of i([x]) ?? []) o.set(String(e[x] ?? "∅"), e);
817
+ let s = i([])?.[0], l = a.size > 0, u = o.size > 0, f = C("dashboard.total", "Total");
800
818
  return /* @__PURE__ */ Q("div", {
801
819
  className: "relative h-full w-full overflow-auto p-1",
802
820
  "data-testid": "dataset-matrix",
@@ -807,18 +825,18 @@ function mt({ widget: e, dataSource: n }) {
807
825
  children: [/* @__PURE__ */ Z("thead", {
808
826
  className: "bg-muted/40",
809
827
  children: /* @__PURE__ */ Q("tr", { children: [
810
- v.map((e) => /* @__PURE__ */ Z("th", {
828
+ b.map((e) => /* @__PURE__ */ Z("th", {
811
829
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
812
- children: P(e)
830
+ children: R(e)
813
831
  }, e)),
814
832
  t.map((e) => /* @__PURE__ */ Z("th", {
815
833
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
816
834
  children: e.header
817
835
  }, `${e.col.id}-${e.measure}`)),
818
- l && s.map((e) => /* @__PURE__ */ Z("th", {
836
+ l && c.map((e) => /* @__PURE__ */ Z("th", {
819
837
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
820
838
  "data-testid": "matrix-total-col-header",
821
- children: s.length === 1 ? f : `${f} · ${P(e)}`
839
+ children: c.length === 1 ? f : `${f} · ${R(e)}`
822
840
  }, `total-${e}`))
823
841
  ] })
824
842
  }), /* @__PURE__ */ Q("tbody", { children: [e.rowHeaders.map((n) => /* @__PURE__ */ Q("tr", {
@@ -829,26 +847,26 @@ function mt({ widget: e, dataSource: n }) {
829
847
  children: e
830
848
  }, t)),
831
849
  t.map((t) => {
832
- let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : T.rows[i], o = L && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
850
+ let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : D.rows[i], o = V && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
833
851
  return /* @__PURE__ */ Z("td", {
834
- className: H("px-2 py-1 text-right tabular-nums whitespace-nowrap", o && "cursor-pointer hover:bg-accent/40"),
852
+ className: U("px-2 py-1 text-right tabular-nums whitespace-nowrap", o && "cursor-pointer hover:bg-accent/40"),
835
853
  "data-testid": o ? "dataset-drill-cell" : void 0,
836
- onClick: o ? () => R(i, s) : void 0,
854
+ onClick: o ? () => ie(i, s) : void 0,
837
855
  children: a ? r(a[t.measure], t.measure) : "—"
838
856
  }, `${t.col.id}-${t.measure}`);
839
857
  }),
840
- l && s.map((e) => /* @__PURE__ */ Z("td", {
858
+ l && c.map((e) => /* @__PURE__ */ Z("td", {
841
859
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium",
842
860
  "data-testid": "matrix-row-total",
843
861
  children: r(a.get(n.id)?.[e], e)
844
862
  }, `total-${e}`))
845
863
  ]
846
- }, n.id)), d && /* @__PURE__ */ Q("tr", {
864
+ }, n.id)), u && /* @__PURE__ */ Q("tr", {
847
865
  className: "border-t bg-muted/30 font-medium",
848
866
  "data-testid": "matrix-total-row",
849
867
  children: [
850
- v.length > 0 && /* @__PURE__ */ Z("td", {
851
- colSpan: v.length,
868
+ b.length > 0 && /* @__PURE__ */ Z("td", {
869
+ colSpan: b.length,
852
870
  className: "px-2 py-1 whitespace-nowrap",
853
871
  children: f
854
872
  }),
@@ -856,19 +874,19 @@ function mt({ widget: e, dataSource: n }) {
856
874
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
857
875
  children: r(o.get(e.col.id)?.[e.measure], e.measure)
858
876
  }, `${e.col.id}-${e.measure}`)),
859
- l && s.map((e) => /* @__PURE__ */ Z("td", {
877
+ l && c.map((e) => /* @__PURE__ */ Z("td", {
860
878
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
861
879
  "data-testid": "matrix-grand-total",
862
- children: r(c?.[e], e)
880
+ children: r(s?.[e], e)
863
881
  }, `grand-${e}`))
864
882
  ]
865
883
  })] })]
866
884
  }),
867
- ne
885
+ ae
868
886
  ]
869
887
  });
870
888
  }
871
- let r = [...o, ...s];
889
+ let r = [...s, ...c];
872
890
  return /* @__PURE__ */ Q("div", {
873
891
  className: "relative h-full w-full overflow-auto p-1",
874
892
  children: [
@@ -879,55 +897,55 @@ function mt({ widget: e, dataSource: n }) {
879
897
  className: "bg-muted/40",
880
898
  children: /* @__PURE__ */ Z("tr", { children: r.map((e) => /* @__PURE__ */ Z("th", {
881
899
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
882
- children: P(e)
900
+ children: R(e)
883
901
  }, e)) })
884
- }), /* @__PURE__ */ Z("tbody", { children: T.rows.map((e, t) => /* @__PURE__ */ Z("tr", {
885
- className: H("border-t", L && "cursor-pointer hover:bg-accent/40"),
886
- "data-testid": L ? "dataset-drill-row" : void 0,
887
- onClick: L ? () => R(t, te.map((t) => l(e[t])).filter(Boolean).join(" / ")) : void 0,
902
+ }), /* @__PURE__ */ Z("tbody", { children: D.rows.map((e, t) => /* @__PURE__ */ Z("tr", {
903
+ className: U("border-t", V && "cursor-pointer hover:bg-accent/40"),
904
+ "data-testid": V ? "dataset-drill-row" : void 0,
905
+ onClick: V ? () => ie(t, B.map((t) => u(e[t])).filter(Boolean).join(" / ")) : void 0,
888
906
  children: r.map((t) => /* @__PURE__ */ Z("td", {
889
907
  className: "px-2 py-1 whitespace-nowrap tabular-nums",
890
- children: s.includes(t) ? u(e[t], N(t)?.format, N(t)?.currency) : l(e[t])
908
+ children: c.includes(t) ? d(e[t], L(t)?.format, L(t)?.currency) : u(e[t])
891
909
  }, t))
892
910
  }, t)) })]
893
911
  }),
894
- ne
912
+ ae
895
913
  ]
896
914
  });
897
915
  }
898
- let re = pt[p] ?? "bar", { data: z, xAxisKey: ie, series: B } = t(T.rows, o, s, T.fields), ae = L ? (e) => {
899
- let t = c(T.rows, o, s, e?.category, e?.series);
916
+ let oe = _t[h] ?? "bar", se = p(D.rows, P), { data: ce, xAxisKey: le, series: ue } = t(se, s, c, D.fields), W = V ? (e) => {
917
+ let t = l(se, s, c, e?.category, e?.series);
900
918
  if (t < 0) return;
901
- let n = o.length >= 2 && s.length === 1;
902
- R(t, [e?.category, n ? e?.series : void 0].filter(Boolean).map(String).join(" / "));
919
+ let n = s.length >= 2 && c.length === 1;
920
+ ie(t, [e?.category, n ? e?.series : void 0].filter(Boolean).map(String).join(" / "));
903
921
  } : void 0;
904
922
  return /* @__PURE__ */ Q("div", {
905
- className: H("relative h-full w-full min-h-[220px]"),
906
- children: [/* @__PURE__ */ Z(h, {
923
+ className: U("relative h-full w-full min-h-[220px]"),
924
+ children: [/* @__PURE__ */ Z(_, {
907
925
  schema: {
908
926
  type: "chart",
909
- chartType: re,
910
- data: z,
911
- xAxisKey: ie,
912
- series: B,
913
- ...j ? { categoryColors: j } : {}
927
+ chartType: oe,
928
+ data: ce,
929
+ xAxisKey: le,
930
+ series: ue,
931
+ ...M ? { categoryColors: M } : {}
914
932
  },
915
- onChartClick: ae,
916
- onSegmentClick: ae
917
- }), ne]
933
+ onChartClick: W,
934
+ onSegmentClick: W
935
+ }), ae]
918
936
  });
919
937
  }
920
938
  //#endregion
921
939
  //#region src/DashboardRenderer.tsx
922
- function ht({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
923
- let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = Ne({
940
+ function yt({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
941
+ let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = Le({
924
942
  id: e,
925
943
  disabled: t
926
944
  });
927
945
  return /* @__PURE__ */ Z("div", {
928
946
  ref: s,
929
947
  style: {
930
- transform: Fe.Transform.toString(c),
948
+ transform: ze.Transform.toString(c),
931
949
  transition: l,
932
950
  opacity: u ? .4 : 1,
933
951
  ...n ? {
@@ -935,26 +953,26 @@ function ht({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
935
953
  gridRow: `span ${n.h}`
936
954
  } : {}
937
955
  },
938
- className: H("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
956
+ className: U("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
939
957
  "data-sortable-widget-id": e,
940
958
  ...a,
941
959
  ...o,
942
960
  children: i
943
961
  });
944
962
  }
945
- function gt(e) {
946
- return e ? oe(e) : null;
963
+ function bt(e) {
964
+ return e ? le(e) : null;
947
965
  }
948
- function _t(e) {
966
+ function xt(e) {
949
967
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
950
968
  }
951
- var vt = [
969
+ var St = [
952
970
  "hsl(var(--chart-1))",
953
971
  "hsl(var(--chart-2))",
954
972
  "hsl(var(--chart-3))",
955
973
  "hsl(var(--chart-4))",
956
974
  "hsl(var(--chart-5))"
957
- ], yt = {
975
+ ], Ct = {
958
976
  column: "bar",
959
977
  "stacked-bar": "bar",
960
978
  "grouped-bar": "bar",
@@ -964,7 +982,7 @@ var vt = [
964
982
  "stacked-area": "area",
965
983
  pyramid: "funnel",
966
984
  bubble: "scatter"
967
- }, bt = new Set([
985
+ }, wt = new Set([
968
986
  "bar",
969
987
  "horizontal-bar",
970
988
  "line",
@@ -976,12 +994,12 @@ var vt = [
976
994
  "radar",
977
995
  "treemap",
978
996
  "sankey"
979
- ]), xt = new Set([
997
+ ]), Tt = new Set([
980
998
  "gauge",
981
999
  "solid-gauge",
982
1000
  "kpi",
983
1001
  "bullet"
984
- ]), St = new Set([
1002
+ ]), Et = new Set([
985
1003
  "sunburst",
986
1004
  "word-cloud",
987
1005
  "choropleth",
@@ -993,7 +1011,7 @@ var vt = [
993
1011
  "violin",
994
1012
  "candlestick",
995
1013
  "stock"
996
- ]), Ct = new Set([
1014
+ ]), Dt = new Set([
997
1015
  "bar",
998
1016
  "horizontal-bar",
999
1017
  "line",
@@ -1005,11 +1023,11 @@ var vt = [
1005
1023
  "treemap",
1006
1024
  "sankey"
1007
1025
  ]);
1008
- function wt(e) {
1009
- return Ct.has(e) ? { enabled: !0 } : void 0;
1026
+ function Ot(e) {
1027
+ return Dt.has(e) ? { enabled: !0 } : void 0;
1010
1028
  }
1011
- var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: s, onWidgetClick: c, onWidgetsReorder: l, modalHandler: u, scriptHandlers: d, hideHeaderText: f, ...p }, m) => {
1012
- let g = (() => {
1029
+ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: s, onWidgetClick: c, onWidgetsReorder: l, modalHandler: u, scriptHandlers: d, hideHeaderText: f, ...p }, m) => {
1030
+ let h = (() => {
1013
1031
  if (e.columns != null) return e.columns;
1014
1032
  let t = e.widgets ?? [], n = 0;
1015
1033
  for (let e of t) {
@@ -1017,44 +1035,44 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1017
1035
  t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
1018
1036
  }
1019
1037
  return n > 4 ? 12 : 4;
1020
- })(), v = g, y = e.gap || 4, b = e.columns != null || g !== 4, [x, C] = J(!1), [w, T] = J(!1), D = de(null), { executeAction: O, engine: P } = _({ actions: q(() => (e.header?.actions ?? []).map((e) => ({
1038
+ })(), g = h, v = e.gap || 4, b = e.columns != null || h !== 4, [x, S] = Y(!1), [C, T] = Y(!1), E = me(null), { executeAction: D, engine: k } = y({ actions: J(() => (e.header?.actions ?? []).map((e) => ({
1021
1039
  name: e.actionUrl || e.label,
1022
1040
  type: e.actionType || "url",
1023
1041
  target: e.actionUrl,
1024
1042
  label: e.label
1025
- })), [e.header?.actions]) }), { dashboardLabel: F, dashboardDescription: I, dashboardActionLabel: ee, widgetTitle: te, widgetDescription: L, fieldLabel: R } = S(), { t: ne } = E(), re = G((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? ne(`report.aggregate.${n}`, { defaultValue: n }) : e ? R(e, t, t) : t, [ne, R]), z = e.name, ie = G((e) => z ? ee(z, e.actionUrl || e.label, e.label) : e.label, [z, ee]), B = G((e) => {
1026
- let t = _t(e.title);
1027
- return !z || !e.id || t === void 0 ? t : te(z, e.id, t);
1028
- }, [z, te]), ae = G((e) => {
1029
- let t = _t(e.description);
1030
- return !z || !e.id ? t : L(z, e.id, t);
1031
- }, [z, L]);
1032
- K(() => {
1033
- let e = P.getRunner();
1043
+ })), [e.header?.actions]) }), { dashboardLabel: A, dashboardDescription: F, dashboardActionLabel: I, widgetTitle: L, widgetDescription: R, fieldLabel: te } = w(), { t: z } = O(), ne = K((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? z(`report.aggregate.${n}`, { defaultValue: n }) : e ? te(e, t, t) : t, [z, te]), B = e.name, V = K((e) => B ? I(B, e.actionUrl || e.label, e.label) : e.label, [B, I]), re = K((e) => {
1044
+ let t = xt(e.title);
1045
+ return !B || !e.id || t === void 0 ? t : L(B, e.id, t);
1046
+ }, [B, L]), ie = K((e) => {
1047
+ let t = xt(e.description);
1048
+ return !B || !e.id ? t : R(B, e.id, t);
1049
+ }, [B, R]);
1050
+ q(() => {
1051
+ let e = k.getRunner();
1034
1052
  if (u && e.setModalHandler(u), d) for (let [t, n] of Object.entries(d)) e.registerScript(t, n);
1035
1053
  }, [
1036
- P,
1054
+ k,
1037
1055
  u,
1038
1056
  d
1039
- ]), K(() => {
1057
+ ]), q(() => {
1040
1058
  let e = () => T(window.innerWidth < 768);
1041
1059
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1042
1060
  }, []);
1043
- let V = G(() => {
1044
- r && (C(!0), r(), setTimeout(() => C(!1), 600));
1061
+ let ae = K(() => {
1062
+ r && (S(!0), r(), setTimeout(() => S(!1), 600));
1045
1063
  }, [r]);
1046
- K(() => {
1047
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return D.current = setInterval(V, e.refreshInterval * 1e3), () => {
1048
- D.current && clearInterval(D.current);
1064
+ q(() => {
1065
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return E.current = setInterval(ae, e.refreshInterval * 1e3), () => {
1066
+ E.current && clearInterval(E.current);
1049
1067
  };
1050
1068
  }, [
1051
1069
  e.refreshInterval,
1052
1070
  r,
1053
- V
1071
+ ae
1054
1072
  ]);
1055
- let oe = G((e, t) => {
1073
+ let oe = K((e, t) => {
1056
1074
  !o || !c || !t || (e.stopPropagation(), c(t));
1057
- }, [o, c]), se = G((t, n, r) => {
1075
+ }, [o, c]), se = K((t, n, r) => {
1058
1076
  if (!o || !c) return;
1059
1077
  let i = e.widgets || [];
1060
1078
  if (t.key === "Enter" || t.key === " ") t.preventDefault(), c(n ?? null);
@@ -1071,25 +1089,25 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1071
1089
  o,
1072
1090
  c,
1073
1091
  e.widgets
1074
- ]), U = G((e) => {
1092
+ ]), ce = K((e) => {
1075
1093
  !o || !c || e.target === e.currentTarget && c(null);
1076
- }, [o, c]), W = !!(o && l), le = ke(Oe(Ee, { activationConstraint: { distance: 5 } })), ue = G((t) => {
1077
- if (!W) return;
1094
+ }, [o, c]), H = !!(o && l), le = Ne(Me(Ae, { activationConstraint: { distance: 5 } })), ue = K((t) => {
1095
+ if (!H) return;
1078
1096
  let { active: n, over: r } = t;
1079
1097
  if (!r || n.id === r.id) return;
1080
1098
  let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
1081
- a < 0 || o < 0 || l?.(je(i, a, o));
1099
+ a < 0 || o < 0 || l?.(Fe(i, a, o));
1082
1100
  }, [
1083
- W,
1101
+ H,
1084
1102
  e.widgets,
1085
1103
  l
1086
- ]), fe = (e, t, r) => {
1087
- let i = e.type === "metric" || xt.has(e.type || ""), a = b ? {
1088
- w: Math.min(i ? 3 : 6, v),
1104
+ ]), W = (e, t, r) => {
1105
+ let i = e.type === "metric" || Tt.has(e.type || ""), a = b ? {
1106
+ w: Math.min(i ? 3 : 6, g),
1089
1107
  h: i ? 2 : 4
1090
1108
  } : void 0, c = e.layout ?? a, l = c ? {
1091
1109
  ...c,
1092
- w: Math.min(c.w, v)
1110
+ w: Math.min(c.w, g)
1093
1111
  } : void 0, u = !!e.dataset, d = (() => {
1094
1112
  if (e.component) return e.component;
1095
1113
  let t = e.type, n = e.options || {};
@@ -1108,7 +1126,7 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1108
1126
  objectName: e.object || ($(t) ? t.object : void 0),
1109
1127
  aggregate: r,
1110
1128
  filter: ($(t) ? t.filter : void 0) || e.filter,
1111
- label: n.label || B(e) || "",
1129
+ label: n.label || re(e) || "",
1112
1130
  fallbackValue: n.value,
1113
1131
  trend: n.trend,
1114
1132
  icon: n.icon,
@@ -1119,11 +1137,11 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1119
1137
  prefix: n.prefix,
1120
1138
  suffix: n.suffix,
1121
1139
  drillDown: n.drillDown ?? { enabled: !0 },
1122
- title: n.label || B(e) || "",
1140
+ title: n.label || re(e) || "",
1123
1141
  compareTo: e.compareTo
1124
1142
  };
1125
1143
  }
1126
- if (xt.has(t || "") && e.object) {
1144
+ if (Tt.has(t || "") && e.object) {
1127
1145
  let t = e.aggregate ? {
1128
1146
  field: e.valueField || "value",
1129
1147
  function: e.aggregate,
@@ -1134,7 +1152,7 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1134
1152
  objectName: e.object,
1135
1153
  aggregate: t,
1136
1154
  filter: e.filter,
1137
- label: n.label || B(e) || "",
1155
+ label: n.label || re(e) || "",
1138
1156
  fallbackValue: n.fallbackValue ?? n.value,
1139
1157
  icon: n.icon,
1140
1158
  description: n.description,
@@ -1147,8 +1165,8 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1147
1165
  compareTo: e.compareTo
1148
1166
  };
1149
1167
  }
1150
- let r = t && yt[t] || t;
1151
- if (r && bt.has(r)) {
1168
+ let r = t && Ct[t] || t;
1169
+ if (r && wt.has(r)) {
1152
1170
  let t = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
1153
1171
  if ($(t)) {
1154
1172
  let o = t.aggregate, s = (() => {
@@ -1171,10 +1189,10 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1171
1189
  xAxisKey: i,
1172
1190
  series: [{
1173
1191
  dataKey: l,
1174
- label: re(u, l, c?.function)
1192
+ label: ne(u, l, c?.function)
1175
1193
  }],
1176
- colors: vt,
1177
- drillDown: n.drillDown ?? wt(r),
1194
+ colors: St,
1195
+ drillDown: n.drillDown ?? Ot(r),
1178
1196
  compareTo: e.compareTo,
1179
1197
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1180
1198
  };
@@ -1197,10 +1215,10 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1197
1215
  xAxisKey: i,
1198
1216
  series: [{
1199
1217
  dataKey: s,
1200
- label: re(e.object, s, e.aggregate)
1218
+ label: ne(e.object, s, e.aggregate)
1201
1219
  }],
1202
- colors: vt,
1203
- drillDown: n.drillDown ?? wt(r),
1220
+ colors: St,
1221
+ drillDown: n.drillDown ?? Ot(r),
1204
1222
  compareTo: e.compareTo,
1205
1223
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1206
1224
  };
@@ -1212,9 +1230,9 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1212
1230
  xAxisKey: i,
1213
1231
  series: [{
1214
1232
  dataKey: a,
1215
- label: re(e.object, a, e.aggregate)
1233
+ label: ne(e.object, a, e.aggregate)
1216
1234
  }],
1217
- colors: vt,
1235
+ colors: St,
1218
1236
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1219
1237
  };
1220
1238
  }
@@ -1335,7 +1353,7 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1335
1353
  variant: "caption",
1336
1354
  align: "center",
1337
1355
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground"
1338
- } : t && St.has(t) ? {
1356
+ } : t && Et.has(t) ? {
1339
1357
  type: "text",
1340
1358
  value: `「${t}」chart type is not supported yet`,
1341
1359
  variant: "caption",
@@ -1345,45 +1363,45 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1345
1363
  ...e,
1346
1364
  ...n
1347
1365
  };
1348
- })(), f = e.type === "metric" && !u, p = B(e), m = ae(e), g = e.id || p || `widget-${t}`, _ = o && s === e.id, y = o ? {
1366
+ })(), f = e.type === "metric" && !u, p = re(e), m = ie(e), h = e.id || p || `widget-${t}`, v = o && s === e.id, y = o ? {
1349
1367
  "data-testid": `dashboard-preview-widget-${e.id}`,
1350
1368
  "data-widget-id": e.id,
1351
1369
  role: "button",
1352
1370
  tabIndex: 0,
1353
- "aria-selected": _,
1371
+ "aria-selected": v,
1354
1372
  "aria-label": `Widget: ${p || `Widget ${t + 1}`}`,
1355
1373
  onClick: (t) => oe(t, e.id),
1356
1374
  onKeyDown: (n) => se(n, e.id, t)
1357
- } : {}, x = o ? H("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", _ ? "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, S = !w && l && !W ? {
1375
+ } : {}, x = o ? U("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", v ? "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, S = !C && l && !H ? {
1358
1376
  gridColumn: `span ${l.w}`,
1359
1377
  gridRow: `span ${l.h}`
1360
- } : void 0, C = f ? /* @__PURE__ */ Q("div", {
1361
- className: H("h-full w-full", o && "relative", x),
1378
+ } : void 0, w = f ? /* @__PURE__ */ Q("div", {
1379
+ className: U("h-full w-full", o && "relative", x),
1362
1380
  style: S,
1363
1381
  ...y,
1364
1382
  children: [u ? /* @__PURE__ */ Z("div", {
1365
- className: H("h-full w-full", o && "pointer-events-none"),
1366
- children: /* @__PURE__ */ Z(mt, {
1383
+ className: U("h-full w-full", o && "pointer-events-none"),
1384
+ children: /* @__PURE__ */ Z(vt, {
1367
1385
  widget: e,
1368
1386
  dataSource: n
1369
1387
  })
1370
- }) : /* @__PURE__ */ Z(h, {
1388
+ }) : /* @__PURE__ */ Z(_, {
1371
1389
  schema: d,
1372
- className: H("h-full w-full", o && "pointer-events-none"),
1390
+ className: U("h-full w-full", o && "pointer-events-none"),
1373
1391
  dataSource: n
1374
1392
  }), o && /* @__PURE__ */ Z("div", {
1375
1393
  className: "absolute inset-0 z-10",
1376
1394
  "aria-hidden": "true",
1377
1395
  "data-testid": "widget-click-overlay"
1378
1396
  })]
1379
- }) : /* @__PURE__ */ Q(A, {
1380
- className: H("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", x),
1397
+ }) : /* @__PURE__ */ Q(ee, {
1398
+ className: U("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", x),
1381
1399
  style: S,
1382
1400
  ...y,
1383
1401
  children: [
1384
- p && /* @__PURE__ */ Q(M, {
1402
+ p && /* @__PURE__ */ Q(N, {
1385
1403
  className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
1386
- children: [/* @__PURE__ */ Z(N, {
1404
+ children: [/* @__PURE__ */ Z(P, {
1387
1405
  className: "text-sm sm:text-base font-medium tracking-tight truncate",
1388
1406
  title: p,
1389
1407
  children: p
@@ -1392,14 +1410,14 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1392
1410
  children: m
1393
1411
  })]
1394
1412
  }),
1395
- /* @__PURE__ */ Z(j, {
1413
+ /* @__PURE__ */ Z(M, {
1396
1414
  className: "p-0",
1397
1415
  children: /* @__PURE__ */ Z("div", {
1398
- className: H("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
1399
- children: u ? /* @__PURE__ */ Z(mt, {
1416
+ className: U("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
1417
+ children: u ? /* @__PURE__ */ Z(vt, {
1400
1418
  widget: e,
1401
1419
  dataSource: n
1402
- }) : /* @__PURE__ */ Z(h, {
1420
+ }) : /* @__PURE__ */ Z(_, {
1403
1421
  schema: d,
1404
1422
  dataSource: n
1405
1423
  })
@@ -1412,36 +1430,36 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1412
1430
  })
1413
1431
  ]
1414
1432
  });
1415
- return W && e.id ? /* @__PURE__ */ Z(ht, {
1433
+ return H && e.id ? /* @__PURE__ */ Z(yt, {
1416
1434
  id: e.id,
1417
- gridSpan: !w && l ? {
1435
+ gridSpan: !C && l ? {
1418
1436
  w: l.w,
1419
1437
  h: l.h
1420
1438
  } : void 0,
1421
- children: C
1422
- }, g) : /* @__PURE__ */ Z(ce, { children: C }, g);
1423
- }, Y = e.header && /* @__PURE__ */ Q("div", {
1439
+ children: w
1440
+ }, h) : /* @__PURE__ */ Z(G, { children: w }, h);
1441
+ }, de = e.header && /* @__PURE__ */ Q("div", {
1424
1442
  className: "col-span-full mb-4",
1425
1443
  children: [
1426
1444
  !f && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Z("h2", {
1427
1445
  className: "text-lg font-semibold tracking-tight",
1428
- children: z ? F({
1429
- name: z,
1430
- label: _t(e.title)
1431
- }) : _t(e.title)
1446
+ children: B ? A({
1447
+ name: B,
1448
+ label: xt(e.title)
1449
+ }) : xt(e.title)
1432
1450
  }),
1433
1451
  !f && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Z("p", {
1434
1452
  className: "text-sm text-muted-foreground mt-1",
1435
- children: z ? I({
1436
- name: z,
1437
- description: _t(e.description)
1438
- }) : _t(e.description)
1453
+ children: B ? F({
1454
+ name: B,
1455
+ description: xt(e.description)
1456
+ }) : xt(e.description)
1439
1457
  }),
1440
1458
  e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Z("div", {
1441
1459
  className: "flex gap-2 mt-3",
1442
1460
  children: e.header.actions.map((e, t) => {
1443
- let n = gt(e.icon);
1444
- return /* @__PURE__ */ Q(k, {
1461
+ let n = bt(e.icon);
1462
+ return /* @__PURE__ */ Q(j, {
1445
1463
  variant: "outline",
1446
1464
  size: "sm",
1447
1465
  onClick: async () => {
@@ -1455,106 +1473,106 @@ var Tt = le(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1455
1473
  return;
1456
1474
  }
1457
1475
  if (t === "modal" || t === "script") {
1458
- let e = await O(n || r);
1476
+ let e = await D(n || r);
1459
1477
  e?.success || console.warn("[DashboardRenderer] action failed", e?.error);
1460
1478
  return;
1461
1479
  }
1462
1480
  console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
1463
1481
  },
1464
- children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), ie(e)]
1482
+ children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), V(e)]
1465
1483
  }, t);
1466
1484
  })
1467
1485
  })
1468
1486
  ]
1469
- }), pe = i !== void 0 && /* @__PURE__ */ Q("span", {
1487
+ }), fe = i !== void 0 && /* @__PURE__ */ Q("span", {
1470
1488
  className: "text-xs text-muted-foreground",
1471
1489
  children: [i.toLocaleString(), " records"]
1472
- }), me = a ? JSON.stringify(a) : void 0, he = r && /* @__PURE__ */ Q("div", {
1473
- className: H("flex items-center justify-end gap-3 mb-2", !w && "col-span-full"),
1474
- children: [pe, /* @__PURE__ */ Q(k, {
1490
+ }), pe = a ? JSON.stringify(a) : void 0, he = r && /* @__PURE__ */ Q("div", {
1491
+ className: U("flex items-center justify-end gap-3 mb-2", !C && "col-span-full"),
1492
+ children: [fe, /* @__PURE__ */ Q(j, {
1475
1493
  variant: "outline",
1476
1494
  size: "sm",
1477
- onClick: V,
1495
+ onClick: ae,
1478
1496
  disabled: x,
1479
1497
  "aria-label": "Refresh dashboard",
1480
- children: [/* @__PURE__ */ Z(xe, { className: H("h-4 w-4 mr-2", x && "animate-spin") }), x ? "Refreshing…" : "Refresh All"]
1498
+ children: [/* @__PURE__ */ Z(Te, { className: U("h-4 w-4 mr-2", x && "animate-spin") }), x ? "Refreshing…" : "Refresh All"]
1481
1499
  })]
1482
- }), ge = q(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), X = q(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), _e = q(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1483
- if (w) {
1500
+ }), ge = J(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), X = J(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), _e = J(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1501
+ if (C) {
1484
1502
  let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ Q("div", {
1485
1503
  ref: m,
1486
- className: H("flex flex-col gap-4 px-4", t),
1487
- "data-user-actions": me,
1488
- onClick: U,
1504
+ className: U("flex flex-col gap-4 px-4", t),
1505
+ "data-user-actions": pe,
1506
+ onClick: ce,
1489
1507
  ...p,
1490
1508
  children: [
1491
- Y,
1509
+ de,
1492
1510
  he,
1493
1511
  n.length > 0 && /* @__PURE__ */ Z("div", {
1494
1512
  className: "grid grid-cols-2 gap-3",
1495
- onClick: U,
1496
- children: /* @__PURE__ */ Z(Ae, {
1513
+ onClick: ce,
1514
+ children: /* @__PURE__ */ Z(Pe, {
1497
1515
  items: X,
1498
- strategy: Me,
1499
- disabled: !W,
1500
- children: n.map((e, t) => fe(e, t))
1516
+ strategy: Ie,
1517
+ disabled: !H,
1518
+ children: n.map((e, t) => W(e, t))
1501
1519
  })
1502
1520
  }),
1503
1521
  r.length > 0 && /* @__PURE__ */ Z("div", {
1504
1522
  className: "flex flex-col gap-4",
1505
- onClick: U,
1506
- children: /* @__PURE__ */ Z(Ae, {
1523
+ onClick: ce,
1524
+ children: /* @__PURE__ */ Z(Pe, {
1507
1525
  items: _e,
1508
- strategy: Pe,
1509
- disabled: !W,
1510
- children: r.map((e, t) => fe(e, t, !0))
1526
+ strategy: Re,
1527
+ disabled: !H,
1528
+ children: r.map((e, t) => W(e, t, !0))
1511
1529
  })
1512
1530
  })
1513
1531
  ]
1514
1532
  });
1515
- return W ? /* @__PURE__ */ Z(Te, {
1533
+ return H ? /* @__PURE__ */ Z(ke, {
1516
1534
  sensors: le,
1517
- collisionDetection: De,
1535
+ collisionDetection: je,
1518
1536
  onDragEnd: ue,
1519
1537
  children: i
1520
1538
  }) : i;
1521
1539
  }
1522
1540
  let ve = /* @__PURE__ */ Q("div", {
1523
1541
  ref: m,
1524
- className: H("grid", !b && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1542
+ className: U("grid", !b && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1525
1543
  style: {
1526
1544
  ...b && {
1527
- gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))`,
1545
+ gridTemplateColumns: `repeat(${g}, minmax(0, 1fr))`,
1528
1546
  gridAutoRows: "minmax(5rem, auto)"
1529
1547
  },
1530
- gap: `${y * .25}rem`
1548
+ gap: `${v * .25}rem`
1531
1549
  },
1532
- "data-user-actions": me,
1533
- onClick: U,
1550
+ "data-user-actions": pe,
1551
+ onClick: ce,
1534
1552
  ...p,
1535
1553
  children: [
1536
- Y,
1554
+ de,
1537
1555
  he,
1538
- /* @__PURE__ */ Z(Ae, {
1556
+ /* @__PURE__ */ Z(Pe, {
1539
1557
  items: ge,
1540
- strategy: Me,
1541
- disabled: !W,
1542
- children: e.widgets?.map((e, t) => fe(e, t))
1558
+ strategy: Ie,
1559
+ disabled: !H,
1560
+ children: e.widgets?.map((e, t) => W(e, t))
1543
1561
  })
1544
1562
  ]
1545
1563
  });
1546
- return W ? /* @__PURE__ */ Z(Te, {
1564
+ return H ? /* @__PURE__ */ Z(ke, {
1547
1565
  sensors: le,
1548
- collisionDetection: De,
1566
+ collisionDetection: je,
1549
1567
  onDragEnd: ue,
1550
1568
  children: ve
1551
1569
  }) : ve;
1552
1570
  });
1553
1571
  //#endregion
1554
1572
  //#region src/DashboardGridLayout.tsx
1555
- function Et({ editMode: e }) {
1556
- let t = y();
1557
- return U.useEffect(() => {
1573
+ function At({ editMode: e }) {
1574
+ let t = x();
1575
+ return W.useEffect(() => {
1558
1576
  if (e) return t.startDrag({
1559
1577
  id: "dashboard-layout",
1560
1578
  type: "dashboard-widget",
@@ -1565,14 +1583,14 @@ function Et({ editMode: e }) {
1565
1583
  t.endDrag("dashboard");
1566
1584
  }, [e, t]), null;
1567
1585
  }
1568
- var Dt = [
1586
+ var jt = [
1569
1587
  "hsl(var(--chart-1))",
1570
1588
  "hsl(var(--chart-2))",
1571
1589
  "hsl(var(--chart-3))",
1572
1590
  "hsl(var(--chart-4))",
1573
1591
  "hsl(var(--chart-5))"
1574
1592
  ];
1575
- function Ot(e, t) {
1593
+ function Mt(e, t) {
1576
1594
  if (!e.widgets?.length) return e;
1577
1595
  let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
1578
1596
  let r = e.id || `widget-${t}`, i = n.get(r);
@@ -1591,7 +1609,7 @@ function Ot(e, t) {
1591
1609
  widgets: r
1592
1610
  };
1593
1611
  }
1594
- function kt(e) {
1612
+ function Nt(e) {
1595
1613
  return { lg: e.widgets?.map((e, t) => ({
1596
1614
  i: e.id || `widget-${t}`,
1597
1615
  x: e.layout?.x ?? t % 4 * 3,
@@ -1600,11 +1618,11 @@ function kt(e) {
1600
1618
  h: e.layout?.h ?? 4
1601
1619
  })) || [] };
1602
1620
  }
1603
- var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1604
- let { width: a, containerRef: o, mounted: s } = Ue(), [c, l] = U.useState(!1), [u, d] = U.useState(!1), f = x(), p = U.useRef(null), m = U.useCallback(() => {
1621
+ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1622
+ let { width: a, containerRef: o, mounted: s } = qe(), [c, l] = W.useState(!1), [u, d] = W.useState(!1), f = C(), p = W.useRef(null), m = W.useCallback(() => {
1605
1623
  i && (d(!0), i(), setTimeout(() => d(!1), 600));
1606
1624
  }, [i]);
1607
- U.useEffect(() => {
1625
+ W.useEffect(() => {
1608
1626
  if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return p.current = setInterval(m, e.refreshInterval * 1e3), () => {
1609
1627
  p.current && clearInterval(p.current);
1610
1628
  };
@@ -1613,27 +1631,27 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1613
1631
  i,
1614
1632
  m
1615
1633
  ]);
1616
- let [g, _] = U.useState(() => kt(e)), v = U.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1634
+ let [h, g] = W.useState(() => Nt(e)), v = W.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1617
1635
  i: e.id || `widget-${t}`,
1618
1636
  x: e.layout?.x,
1619
1637
  y: e.layout?.y,
1620
1638
  w: e.layout?.w,
1621
1639
  h: e.layout?.h
1622
1640
  })) ?? []), [e.widgets]);
1623
- U.useEffect(() => {
1624
- _(kt(e));
1641
+ W.useEffect(() => {
1642
+ g(Nt(e));
1625
1643
  }, [v]);
1626
- let y = U.useCallback((e, t) => {
1627
- _(t), n?.(e);
1628
- }, [n]), b = U.useCallback(() => {
1629
- r ? r(Ot(e, g.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), l(!1);
1644
+ let y = W.useCallback((e, t) => {
1645
+ g(t), n?.(e);
1646
+ }, [n]), b = W.useCallback(() => {
1647
+ r ? r(Mt(e, h.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), l(!1);
1630
1648
  }, [
1631
1649
  r,
1632
1650
  e,
1633
- g
1634
- ]), S = U.useCallback(() => {
1635
- _(kt(e));
1636
- }, [e]), C = U.useCallback((e) => {
1651
+ h
1652
+ ]), x = W.useCallback(() => {
1653
+ g(Nt(e));
1654
+ }, [e]), S = W.useCallback((e) => {
1637
1655
  if (e.component) return e.component;
1638
1656
  let t = e.type, n = e.options || {};
1639
1657
  if (t === "bar" || t === "horizontal-bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter" || t === "funnel") {
@@ -1651,7 +1669,7 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1651
1669
  aggregate: o,
1652
1670
  xAxisKey: i,
1653
1671
  series: [{ dataKey: s }],
1654
- colors: Dt,
1672
+ colors: jt,
1655
1673
  className: "h-full"
1656
1674
  };
1657
1675
  }
@@ -1668,7 +1686,7 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1668
1686
  aggregate: n,
1669
1687
  xAxisKey: i,
1670
1688
  series: [{ dataKey: e.valueField || "value" }],
1671
- colors: Dt,
1689
+ colors: jt,
1672
1690
  className: "h-full"
1673
1691
  };
1674
1692
  }
@@ -1678,7 +1696,7 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1678
1696
  data: Array.isArray(r) ? r : r?.items || [],
1679
1697
  xAxisKey: i,
1680
1698
  series: [{ dataKey: a }],
1681
- colors: Dt,
1699
+ colors: jt,
1682
1700
  className: "h-full"
1683
1701
  };
1684
1702
  }
@@ -1739,10 +1757,10 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1739
1757
  }, []);
1740
1758
  return /* @__PURE__ */ Q("div", {
1741
1759
  ref: o,
1742
- className: H("w-full", t),
1760
+ className: U("w-full", t),
1743
1761
  "data-testid": "grid-layout",
1744
1762
  children: [
1745
- f && /* @__PURE__ */ Z(Et, { editMode: c }),
1763
+ f && /* @__PURE__ */ Z(At, { editMode: c }),
1746
1764
  /* @__PURE__ */ Q("div", {
1747
1765
  className: "mb-4 flex items-center justify-between",
1748
1766
  children: [/* @__PURE__ */ Z("h2", {
@@ -1750,44 +1768,44 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1750
1768
  children: e.title || "Dashboard"
1751
1769
  }), /* @__PURE__ */ Z("div", {
1752
1770
  className: "flex gap-2",
1753
- children: c ? /* @__PURE__ */ Q(Ve, { children: [
1754
- /* @__PURE__ */ Q(k, {
1771
+ children: c ? /* @__PURE__ */ Q(Ge, { children: [
1772
+ /* @__PURE__ */ Q(j, {
1755
1773
  onClick: b,
1756
1774
  size: "sm",
1757
1775
  variant: "default",
1758
- children: [/* @__PURE__ */ Z(Se, { className: "h-4 w-4 mr-2" }), "Save Layout"]
1776
+ children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4 mr-2" }), "Save Layout"]
1759
1777
  }),
1760
- /* @__PURE__ */ Q(k, {
1761
- onClick: S,
1778
+ /* @__PURE__ */ Q(j, {
1779
+ onClick: x,
1762
1780
  size: "sm",
1763
1781
  variant: "outline",
1764
- children: [/* @__PURE__ */ Z(we, { className: "h-4 w-4 mr-2" }), "Reset"]
1782
+ children: [/* @__PURE__ */ Z(Oe, { className: "h-4 w-4 mr-2" }), "Reset"]
1765
1783
  }),
1766
- /* @__PURE__ */ Z(k, {
1784
+ /* @__PURE__ */ Z(j, {
1767
1785
  onClick: () => l(!1),
1768
1786
  size: "sm",
1769
1787
  variant: "ghost",
1770
1788
  children: "Cancel"
1771
1789
  })
1772
- ] }) : /* @__PURE__ */ Q(Ve, { children: [i && /* @__PURE__ */ Q(k, {
1790
+ ] }) : /* @__PURE__ */ Q(Ge, { children: [i && /* @__PURE__ */ Q(j, {
1773
1791
  onClick: m,
1774
1792
  size: "sm",
1775
1793
  variant: "outline",
1776
1794
  disabled: u,
1777
1795
  "aria-label": "Refresh dashboard",
1778
- children: [/* @__PURE__ */ Z(xe, { className: H("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
1779
- }), /* @__PURE__ */ Q(k, {
1796
+ children: [/* @__PURE__ */ Z(Te, { className: U("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
1797
+ }), /* @__PURE__ */ Q(j, {
1780
1798
  onClick: () => l(!0),
1781
1799
  size: "sm",
1782
1800
  variant: "outline",
1783
- children: [/* @__PURE__ */ Z(_e, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
1801
+ children: [/* @__PURE__ */ Z(xe, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
1784
1802
  })] })
1785
1803
  })]
1786
1804
  }),
1787
- s && /* @__PURE__ */ Z(He, {
1805
+ s && /* @__PURE__ */ Z(Ke, {
1788
1806
  className: "layout",
1789
1807
  width: a,
1790
- layouts: g,
1808
+ layouts: h,
1791
1809
  breakpoints: {
1792
1810
  lg: 1200,
1793
1811
  md: 996,
@@ -1810,35 +1828,35 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1810
1828
  resizeConfig: { enabled: c },
1811
1829
  onLayoutChange: y,
1812
1830
  children: e.widgets?.map((e, t) => {
1813
- let n = e.id || `widget-${t}`, r = C(e);
1831
+ let n = e.id || `widget-${t}`, r = S(e);
1814
1832
  return /* @__PURE__ */ Z("div", {
1815
1833
  className: "h-full",
1816
1834
  children: e.type === "metric" ? /* @__PURE__ */ Q("div", {
1817
1835
  className: "h-full w-full relative",
1818
1836
  children: [c && /* @__PURE__ */ Z("div", {
1819
1837
  className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
1820
- children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
1821
- }), /* @__PURE__ */ Z(h, {
1838
+ children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
1839
+ }), /* @__PURE__ */ Z(_, {
1822
1840
  schema: r,
1823
1841
  className: "h-full w-full"
1824
1842
  })]
1825
- }) : /* @__PURE__ */ Q(A, {
1826
- className: H("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", c && "ring-2 ring-primary/20"),
1827
- children: [e.title && /* @__PURE__ */ Q(M, {
1843
+ }) : /* @__PURE__ */ Q(ee, {
1844
+ className: U("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", c && "ring-2 ring-primary/20"),
1845
+ children: [e.title && /* @__PURE__ */ Q(N, {
1828
1846
  className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
1829
- children: [/* @__PURE__ */ Z(N, {
1847
+ children: [/* @__PURE__ */ Z(P, {
1830
1848
  className: "text-base font-medium tracking-tight truncate",
1831
1849
  title: e.title,
1832
1850
  children: e.title
1833
1851
  }), c && /* @__PURE__ */ Z("div", {
1834
1852
  className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
1835
- children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
1853
+ children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
1836
1854
  })]
1837
- }), /* @__PURE__ */ Z(j, {
1855
+ }), /* @__PURE__ */ Z(M, {
1838
1856
  className: "p-0 h-full",
1839
1857
  children: /* @__PURE__ */ Z("div", {
1840
- className: H("h-full w-full overflow-auto p-4"),
1841
- children: /* @__PURE__ */ Z(h, { schema: r })
1858
+ className: U("h-full w-full overflow-auto p-4"),
1859
+ children: /* @__PURE__ */ Z(_, { schema: r })
1842
1860
  })
1843
1861
  })]
1844
1862
  })
@@ -1847,7 +1865,7 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1847
1865
  })
1848
1866
  ]
1849
1867
  });
1850
- }, jt = C({
1868
+ }, Ft = T({
1851
1869
  "dashboard.trend.vsLastQuarter": "vs last quarter",
1852
1870
  "dashboard.trend.vsLastMonth": "vs last month",
1853
1871
  "dashboard.trend.vsLastWeek": "vs last week",
@@ -1855,7 +1873,7 @@ var At = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1855
1873
  "dashboard.trend.vsYesterday": "vs yesterday",
1856
1874
  "dashboard.trend.vsPreviousPeriod": "vs previous period"
1857
1875
  }, "dashboard.trend.vsLastQuarter");
1858
- function Mt(e) {
1876
+ function It(e) {
1859
1877
  switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
1860
1878
  case "vs last quarter":
1861
1879
  case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
@@ -1871,11 +1889,11 @@ function Mt(e) {
1871
1889
  default: return;
1872
1890
  }
1873
1891
  }
1874
- function Nt(e, t, n) {
1892
+ function Lt(e, t, n) {
1875
1893
  if (e == null) return "";
1876
1894
  if (typeof e == "string") {
1877
1895
  let r = Number(e);
1878
- return !isFinite(r) || e.trim() === "" ? e : Nt(r, t, n);
1896
+ return !isFinite(r) || e.trim() === "" ? e : Lt(r, t, n);
1879
1897
  }
1880
1898
  if (!isFinite(e)) return String(e);
1881
1899
  let r = {
@@ -1912,10 +1930,10 @@ function Nt(e, t, n) {
1912
1930
  maximumFractionDigits: c
1913
1931
  }).format(e);
1914
1932
  }
1915
- function Pt(e) {
1933
+ function Rt(e) {
1916
1934
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
1917
1935
  }
1918
- var Ft = {
1936
+ var zt = {
1919
1937
  default: "bg-muted text-muted-foreground",
1920
1938
  blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
1921
1939
  teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
@@ -1924,7 +1942,7 @@ var Ft = {
1924
1942
  success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
1925
1943
  warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
1926
1944
  danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
1927
- }, It = {
1945
+ }, Bt = {
1928
1946
  default: "text-foreground",
1929
1947
  blue: "text-blue-600 dark:text-blue-400",
1930
1948
  teal: "text-teal-600 dark:text-teal-400",
@@ -1933,18 +1951,18 @@ var Ft = {
1933
1951
  success: "text-emerald-600 dark:text-emerald-400",
1934
1952
  warning: "text-amber-600 dark:text-amber-400",
1935
1953
  danger: "text-rose-600 dark:text-rose-400"
1936
- }, Lt = ({ 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, variant: m = "card", ...h }) => {
1937
- let g = Ft[c] || Ft.default, { t: _ } = jt(), v = q(() => {
1938
- let e = Pt(a) || Pt(n?.label);
1954
+ }, Vt = ({ 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, variant: m = "card", ...h }) => {
1955
+ let g = zt[c] || zt.default, { t: _ } = Ft(), v = J(() => {
1956
+ let e = Rt(a) || Rt(n?.label);
1939
1957
  if (!e) return e;
1940
- let t = Mt(e);
1958
+ let t = It(e);
1941
1959
  return t ? _(t) : e;
1942
1960
  }, [
1943
1961
  a,
1944
1962
  n?.label,
1945
1963
  _
1946
- ]), y = q(() => {
1947
- let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Nt(t, l, u) : t ?? "", n = String(e);
1964
+ ]), y = J(() => {
1965
+ let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Lt(t, l, u) : t ?? "", n = String(e);
1948
1966
  return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
1949
1967
  }, [
1950
1968
  t,
@@ -1952,17 +1970,17 @@ var Ft = {
1952
1970
  u,
1953
1971
  d,
1954
1972
  f
1955
- ]), b = q(() => {
1973
+ ]), b = J(() => {
1956
1974
  if (typeof r == "string") {
1957
- let e = oe(r);
1975
+ let e = le(r);
1958
1976
  return e ? /* @__PURE__ */ Z(e, { className: "h-4 w-4" }) : null;
1959
1977
  }
1960
1978
  return r;
1961
1979
  }, [r]);
1962
1980
  if (m === "bare") {
1963
- let t = It[c] || It.default;
1981
+ let t = Bt[c] || Bt.default;
1964
1982
  return /* @__PURE__ */ Z("div", {
1965
- className: H("flex flex-col gap-1 min-w-0", p && "cursor-pointer", i),
1983
+ className: U("flex flex-col gap-1 min-w-0", p && "cursor-pointer", i),
1966
1984
  onClick: p,
1967
1985
  role: p ? "button" : void 0,
1968
1986
  tabIndex: p ? 0 : void 0,
@@ -1972,7 +1990,7 @@ var Ft = {
1972
1990
  children: o ? /* @__PURE__ */ Q("div", {
1973
1991
  className: "flex items-center gap-2 text-muted-foreground",
1974
1992
  "data-testid": "metric-loading",
1975
- children: [/* @__PURE__ */ Z(ye, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
1993
+ children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
1976
1994
  className: "text-sm",
1977
1995
  children: "Loading…"
1978
1996
  })]
@@ -1980,21 +1998,21 @@ var Ft = {
1980
1998
  className: "flex items-center gap-2",
1981
1999
  "data-testid": "metric-error",
1982
2000
  role: "alert",
1983
- children: [/* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2001
+ children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
1984
2002
  className: "text-xs text-destructive truncate",
1985
2003
  children: s
1986
2004
  })]
1987
- }) : /* @__PURE__ */ Q(Ve, { children: [/* @__PURE__ */ Z("div", {
1988
- className: H("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", t),
2005
+ }) : /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z("div", {
2006
+ className: U("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", t),
1989
2007
  children: y
1990
2008
  }), /* @__PURE__ */ Z("div", {
1991
2009
  className: "text-xs font-medium text-muted-foreground truncate",
1992
- children: Pt(e)
2010
+ children: Rt(e)
1993
2011
  })] })
1994
2012
  });
1995
2013
  }
1996
- return /* @__PURE__ */ Q(A, {
1997
- className: H("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),
2014
+ return /* @__PURE__ */ Q(ee, {
2015
+ className: U("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),
1998
2016
  onClick: p,
1999
2017
  role: p ? "button" : void 0,
2000
2018
  tabIndex: p ? 0 : void 0,
@@ -2002,19 +2020,19 @@ var Ft = {
2002
2020
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
2003
2021
  } : void 0,
2004
2022
  ...h,
2005
- children: [/* @__PURE__ */ Q(M, {
2023
+ children: [/* @__PURE__ */ Q(N, {
2006
2024
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
2007
- children: [/* @__PURE__ */ Z(N, {
2025
+ children: [/* @__PURE__ */ Z(P, {
2008
2026
  className: "text-sm font-medium truncate",
2009
- children: Pt(e)
2027
+ children: Rt(e)
2010
2028
  }), b && /* @__PURE__ */ Z("div", {
2011
- className: H("flex h-8 w-8 items-center justify-center rounded-md shrink-0", g),
2029
+ className: U("flex h-8 w-8 items-center justify-center rounded-md shrink-0", g),
2012
2030
  children: b
2013
2031
  })]
2014
- }), /* @__PURE__ */ Z(j, { children: o ? /* @__PURE__ */ Q("div", {
2032
+ }), /* @__PURE__ */ Z(M, { children: o ? /* @__PURE__ */ Q("div", {
2015
2033
  className: "flex items-center gap-2 text-muted-foreground",
2016
2034
  "data-testid": "metric-loading",
2017
- children: [/* @__PURE__ */ Z(ye, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2035
+ children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2018
2036
  className: "text-sm",
2019
2037
  children: "Loading…"
2020
2038
  })]
@@ -2022,21 +2040,21 @@ var Ft = {
2022
2040
  className: "flex items-center gap-2",
2023
2041
  "data-testid": "metric-error",
2024
2042
  role: "alert",
2025
- children: [/* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2043
+ children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2026
2044
  className: "text-xs text-destructive truncate",
2027
2045
  children: s
2028
2046
  })]
2029
- }) : /* @__PURE__ */ Q(Ve, { children: [/* @__PURE__ */ Z("div", {
2047
+ }) : /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z("div", {
2030
2048
  className: "text-2xl font-bold tabular-nums tracking-tight truncate",
2031
2049
  children: y
2032
2050
  }), (n || a) && /* @__PURE__ */ Q("div", {
2033
2051
  className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
2034
2052
  children: [n && /* @__PURE__ */ Q("span", {
2035
- className: H("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"),
2053
+ className: U("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"),
2036
2054
  children: [
2037
- n.direction === "up" && /* @__PURE__ */ Z(me, { className: "h-3 w-3 mr-1" }),
2038
- n.direction === "down" && /* @__PURE__ */ Z(pe, { className: "h-3 w-3 mr-1" }),
2039
- n.direction === "neutral" && /* @__PURE__ */ Z(be, { className: "h-3 w-3 mr-1" }),
2055
+ n.direction === "up" && /* @__PURE__ */ Z(_e, { className: "h-3 w-3 mr-1" }),
2056
+ n.direction === "down" && /* @__PURE__ */ Z(X, { className: "h-3 w-3 mr-1" }),
2057
+ n.direction === "neutral" && /* @__PURE__ */ Z(we, { className: "h-3 w-3 mr-1" }),
2040
2058
  n.value,
2041
2059
  "%"
2042
2060
  ]
@@ -2049,24 +2067,24 @@ var Ft = {
2049
2067
  };
2050
2068
  //#endregion
2051
2069
  //#region src/MetricCard.tsx
2052
- function Rt(e) {
2070
+ function Ht(e) {
2053
2071
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
2054
2072
  }
2055
- var zt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
2056
- let u = n ? oe(n) : null;
2057
- return /* @__PURE__ */ Q(A, {
2058
- className: H("h-full", o),
2073
+ var Ut = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
2074
+ let u = n ? le(n) : null;
2075
+ return /* @__PURE__ */ Q(ee, {
2076
+ className: U("h-full", o),
2059
2077
  ...l,
2060
- children: [/* @__PURE__ */ Q(M, {
2078
+ children: [/* @__PURE__ */ Q(N, {
2061
2079
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
2062
- children: [/* @__PURE__ */ Z(N, {
2080
+ children: [/* @__PURE__ */ Z(P, {
2063
2081
  className: "text-sm font-medium",
2064
- children: Rt(e)
2082
+ children: Ht(e)
2065
2083
  }), u && /* @__PURE__ */ Z(u, { className: "h-4 w-4 text-muted-foreground" })]
2066
- }), /* @__PURE__ */ Z(j, { children: s ? /* @__PURE__ */ Q("div", {
2084
+ }), /* @__PURE__ */ Z(M, { children: s ? /* @__PURE__ */ Q("div", {
2067
2085
  className: "flex items-center gap-2 text-muted-foreground",
2068
2086
  "data-testid": "metric-card-loading",
2069
- children: [/* @__PURE__ */ Z(ye, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2087
+ children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2070
2088
  className: "text-sm",
2071
2089
  children: "Loading…"
2072
2090
  })]
@@ -2074,59 +2092,59 @@ var zt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2074
2092
  className: "flex items-center gap-2",
2075
2093
  "data-testid": "metric-card-error",
2076
2094
  role: "alert",
2077
- children: [/* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2095
+ children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2078
2096
  className: "text-xs text-destructive truncate",
2079
2097
  children: c
2080
2098
  })]
2081
- }) : /* @__PURE__ */ Q(Ve, { children: [/* @__PURE__ */ Z("div", {
2099
+ }) : /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z("div", {
2082
2100
  className: "text-2xl font-bold",
2083
2101
  children: t
2084
2102
  }), (r || i || a) && /* @__PURE__ */ Q("p", {
2085
2103
  className: "text-xs text-muted-foreground flex items-center mt-1",
2086
2104
  children: [r && i && /* @__PURE__ */ Q("span", {
2087
- className: H("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
2105
+ className: U("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
2088
2106
  children: [
2089
- r === "up" && /* @__PURE__ */ Z(me, { className: "h-3 w-3 mr-1" }),
2090
- r === "down" && /* @__PURE__ */ Z(pe, { className: "h-3 w-3 mr-1" }),
2091
- r === "neutral" && /* @__PURE__ */ Z(be, { className: "h-3 w-3 mr-1" }),
2107
+ r === "up" && /* @__PURE__ */ Z(_e, { className: "h-3 w-3 mr-1" }),
2108
+ r === "down" && /* @__PURE__ */ Z(X, { className: "h-3 w-3 mr-1" }),
2109
+ r === "neutral" && /* @__PURE__ */ Z(we, { className: "h-3 w-3 mr-1" }),
2092
2110
  i
2093
2111
  ]
2094
- }), Rt(a)]
2112
+ }), Ht(a)]
2095
2113
  })] }) })]
2096
2114
  });
2097
- }, Bt = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: o, icon: s, className: c, description: l, dataSource: u, colorVariant: _, format: v, currency: y, prefix: b, suffix: x, invert: S, drillDown: C, title: E, compareTo: D, t: O, variant: k }) => {
2098
- let A = ue(g), j = u || A?.dataSource, [M, N] = J(!1), [P, F] = J(null), [I, ee] = J(null), [re, V] = J(!1), [H, oe] = J(null), [se, U] = J(null);
2099
- K(() => {
2115
+ }, Wt = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: a, icon: s, className: c, description: l, dataSource: u, colorVariant: d, format: p, currency: y, prefix: b, suffix: x, invert: S, drillDown: C, title: w, compareTo: T, t: O, variant: k }) => {
2116
+ let A = pe(v), j = u || A?.dataSource, [ee, M] = Y(!1), [N, P] = Y(null), [F, I] = Y(null), [L, R] = Y(!1), [te, re] = Y(null), [ie, H] = Y(null);
2117
+ q(() => {
2100
2118
  let t = !0;
2101
2119
  if (!(!j || !e || typeof j.getObjectSchema != "function")) return j.getObjectSchema(e).then((e) => {
2102
- t && U(e);
2120
+ t && H(e);
2103
2121
  }).catch(() => {}), () => {
2104
2122
  t = !1;
2105
2123
  };
2106
2124
  }, [j, e]);
2107
- let W = q(() => {
2125
+ let U = J(() => {
2108
2126
  let e = t?.field;
2109
- if (!e || !se?.fields) return null;
2110
- let n = se.fields;
2127
+ if (!e || !ie?.fields) return null;
2128
+ let n = ie.fields;
2111
2129
  return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
2112
- }, [se, t?.field]), ce = q(() => {
2113
- if (v) return v;
2114
- if (W) {
2115
- if (W.type === "currency") {
2116
- let e = W.precision ?? W.scale ?? 0;
2130
+ }, [ie, t?.field]), le = J(() => {
2131
+ if (p) return p;
2132
+ if (U) {
2133
+ if (U.type === "currency") {
2134
+ let e = U.precision ?? U.scale ?? 0;
2117
2135
  return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
2118
2136
  }
2119
- if (W.type === "percent") return "0,0%";
2120
- if (W.type === "number" || W.type === "integer") return "0,0";
2137
+ if (U.type === "percent") return "0,0%";
2138
+ if (U.type === "number" || U.type === "integer") return "0,0";
2121
2139
  }
2122
- }, [v, W]), { currency: le } = T(), de = q(() => {
2140
+ }, [p, U]), { currency: ue } = D(), W = J(() => {
2123
2141
  if (y) return y;
2124
- if (W?.type === "currency") return w(W, le);
2142
+ if (U?.type === "currency") return E(U, ue);
2125
2143
  }, [
2126
2144
  y,
2127
- W,
2128
- le
2129
- ]), fe = q(() => t ? JSON.stringify(t) : "", [t]), Y = q(() => f(n), [n]), pe = q(() => Y ? JSON.stringify(Y) : "", [Y]), me = q(() => D ? JSON.stringify(D) : "", [D]), he = G(async (n, r) => {
2145
+ U,
2146
+ ue
2147
+ ]), de = J(() => t ? JSON.stringify(t) : "", [t]), G = J(() => m(n), [n]), fe = J(() => G ? JSON.stringify(G) : "", [G]), me = J(() => T ? JSON.stringify(T) : "", [T]), he = K(async (n, r) => {
2130
2148
  if (t && typeof n.aggregate == "function") {
2131
2149
  let i = await n.aggregate(e, {
2132
2150
  field: t.field,
@@ -2147,29 +2165,29 @@ var zt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2147
2165
  return (Array.isArray(t) ? t : t?.data || t?.records || []).length;
2148
2166
  }
2149
2167
  return null;
2150
- }, [e, fe]), ge = G(async (t, r) => {
2168
+ }, [e, de]), ge = K(async (t, r) => {
2151
2169
  if (!(!t || !e)) {
2152
- r.current && (V(!0), oe(null));
2170
+ r.current && (R(!0), re(null));
2153
2171
  try {
2154
- let e = D ? m(n, D) : null, [i, a] = await Promise.all([he(t, Y), e ? he(t, e) : Promise.resolve(null)]);
2172
+ let e = T ? g(n, T) : null, [i, a] = await Promise.all([he(t, G), e ? he(t, e) : Promise.resolve(null)]);
2155
2173
  if (i === null) return;
2156
- r.current && (F(i), ee(typeof a == "number" && Number.isFinite(a) ? a : null));
2174
+ r.current && (P(i), I(typeof a == "number" && Number.isFinite(a) ? a : null));
2157
2175
  } catch (e) {
2158
- console.error("[ObjectMetricWidget] Fetch error:", e), r.current && oe(e instanceof Error ? e.message : "Failed to load metric");
2176
+ console.error("[ObjectMetricWidget] Fetch error:", e), r.current && re(e instanceof Error ? e.message : "Failed to load metric");
2159
2177
  } finally {
2160
- r.current && V(!1);
2178
+ r.current && R(!1);
2161
2179
  }
2162
2180
  }
2163
2181
  }, [
2164
2182
  e,
2183
+ de,
2165
2184
  fe,
2166
- pe,
2167
2185
  me,
2168
2186
  he
2169
2187
  ]);
2170
- K(() => {
2188
+ q(() => {
2171
2189
  let t = { current: !0 };
2172
- return j && e ? ge(j, t) : (F(null), oe(null)), () => {
2190
+ return j && e ? ge(j, t) : (P(null), re(null)), () => {
2173
2191
  t.current = !1;
2174
2192
  };
2175
2193
  }, [
@@ -2177,50 +2195,50 @@ var zt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2177
2195
  e,
2178
2196
  ge
2179
2197
  ]);
2180
- let X = P === null ? j ? "—" : i ?? "—" : P;
2198
+ let X = N === null ? j ? "—" : i ?? "—" : N;
2181
2199
  S && typeof X == "number" && isFinite(X) && X >= 0 && X <= 1 && (X = 1 - X);
2182
- let _e = q(() => {
2183
- if (!D || typeof P != "number" || !Number.isFinite(P) || I === null) return;
2184
- let e = We(P, I);
2200
+ let _e = J(() => {
2201
+ if (!T || typeof N != "number" || !Number.isFinite(N) || F === null) return;
2202
+ let e = Je(N, F);
2185
2203
  if (!e) return;
2186
- let t = a(D, n), r = `dashboard.trend.${t}`, i = {
2204
+ let t = o(T, n), r = `dashboard.trend.${t}`, i = {
2187
2205
  vsPreviousPeriod: "vs previous period",
2188
2206
  vsLastWeek: "vs last week",
2189
2207
  vsLastMonth: "vs last month",
2190
2208
  vsLastQuarter: "vs last quarter",
2191
2209
  vsLastYear: "vs last year",
2192
2210
  vsYesterday: "vs yesterday"
2193
- }, o = O ? O(r, i[t] || t) : i[t] || t;
2211
+ }, a = O ? O(r, i[t] || t) : i[t] || t;
2194
2212
  return {
2195
2213
  value: e.value,
2196
2214
  direction: e.direction,
2197
- label: o
2215
+ label: a
2198
2216
  };
2199
2217
  }, [
2200
- D,
2201
- P,
2202
- I,
2218
+ T,
2219
+ N,
2220
+ F,
2203
2221
  n,
2204
2222
  O
2205
- ]) ?? o, ve = d(C) && !!e && !!j, ye = q(() => {
2223
+ ]) ?? a, ve = f(C) && !!e && !!j, ye = J(() => {
2206
2224
  let e = typeof r == "string" ? r : r?.defaultValue || "";
2207
- return p(C, {}, (typeof E == "string" ? E : E?.defaultValue || "") || e || "Details");
2225
+ return h(C, {}, (typeof w == "string" ? w : w?.defaultValue || "") || e || "Details");
2208
2226
  }, [
2209
2227
  C,
2210
2228
  r,
2211
- E
2212
- ]), be = q(() => {
2229
+ w
2230
+ ]), be = J(() => {
2213
2231
  if (!ve) return null;
2214
- let t = C?.target ?? "drawer", n = C?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Z(at, {
2232
+ let t = C?.target ?? "drawer", n = C?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Z(lt, {
2215
2233
  objectName: e,
2216
- filter: Y,
2217
- onNavigate: () => N(!1)
2234
+ filter: G,
2235
+ onNavigate: () => M(!1)
2218
2236
  }), a;
2219
2237
  if (r) {
2220
- let e = n.filter, t = e ? Y ? { $and: [e, Y] } : e : Y;
2238
+ let e = n.filter, t = e ? G ? { $and: [e, G] } : e : G;
2221
2239
  a = /* @__PURE__ */ Z("div", {
2222
2240
  className: "h-full overflow-auto",
2223
- children: /* @__PURE__ */ Z(h, { schema: {
2241
+ children: /* @__PURE__ */ Z(_, { schema: {
2224
2242
  type: "spec-report",
2225
2243
  ...n,
2226
2244
  filter: t
@@ -2228,10 +2246,10 @@ var zt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2228
2246
  });
2229
2247
  } else a = /* @__PURE__ */ Z("div", {
2230
2248
  className: "h-full overflow-auto",
2231
- children: /* @__PURE__ */ Z(h, { schema: {
2249
+ children: /* @__PURE__ */ Z(_, { schema: {
2232
2250
  type: "object-data-table",
2233
2251
  objectName: e,
2234
- filter: Y,
2252
+ filter: G,
2235
2253
  pageSize: 25,
2236
2254
  drillDown: {
2237
2255
  enabled: !0,
@@ -2240,25 +2258,25 @@ var zt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2240
2258
  }
2241
2259
  } })
2242
2260
  });
2243
- return t === "dialog" ? /* @__PURE__ */ Z(te, {
2261
+ return t === "dialog" ? /* @__PURE__ */ Z(z, {
2244
2262
  open: !0,
2245
- onOpenChange: (e) => !e && N(!1),
2246
- children: /* @__PURE__ */ Q(L, {
2263
+ onOpenChange: (e) => !e && M(!1),
2264
+ children: /* @__PURE__ */ Q(ne, {
2247
2265
  className: "max-w-5xl",
2248
- children: [/* @__PURE__ */ Q(R, {
2266
+ children: [/* @__PURE__ */ Q(B, {
2249
2267
  className: "flex-row items-center justify-between gap-4 pr-8",
2250
- children: [/* @__PURE__ */ Z(ne, { children: ye }), i]
2268
+ children: [/* @__PURE__ */ Z(V, { children: ye }), i]
2251
2269
  }), a]
2252
2270
  })
2253
- }) : /* @__PURE__ */ Z(z, {
2271
+ }) : /* @__PURE__ */ Z(ae, {
2254
2272
  open: !0,
2255
- onOpenChange: (e) => !e && N(!1),
2256
- children: /* @__PURE__ */ Q(ie, {
2273
+ onOpenChange: (e) => !e && M(!1),
2274
+ children: /* @__PURE__ */ Q(oe, {
2257
2275
  side: "right",
2258
2276
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
2259
- children: [/* @__PURE__ */ Q(B, {
2277
+ children: [/* @__PURE__ */ Q(se, {
2260
2278
  className: "flex-row items-center justify-between gap-4 pr-8",
2261
- children: [/* @__PURE__ */ Z(ae, { children: ye }), i]
2279
+ children: [/* @__PURE__ */ Z(ce, { children: ye }), i]
2262
2280
  }), /* @__PURE__ */ Z("div", {
2263
2281
  className: "flex-1 overflow-hidden mt-2",
2264
2282
  children: a
@@ -2269,36 +2287,36 @@ var zt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2269
2287
  ve,
2270
2288
  C,
2271
2289
  e,
2272
- Y,
2290
+ G,
2273
2291
  ye
2274
2292
  ]);
2275
- return /* @__PURE__ */ Q(Ve, { children: [/* @__PURE__ */ Z(Lt, {
2293
+ return /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z(Vt, {
2276
2294
  label: r,
2277
2295
  value: X,
2278
2296
  trend: _e,
2279
2297
  icon: s,
2280
2298
  className: c,
2281
2299
  description: l,
2282
- loading: re,
2283
- error: H,
2284
- colorVariant: _,
2285
- format: ce,
2286
- currency: de,
2300
+ loading: L,
2301
+ error: te,
2302
+ colorVariant: d,
2303
+ format: le,
2304
+ currency: W,
2287
2305
  prefix: b,
2288
2306
  suffix: x,
2289
2307
  variant: k,
2290
- onClick: ve ? () => N(!0) : void 0
2291
- }), M && be] });
2308
+ onClick: ve ? () => M(!0) : void 0
2309
+ }), ee && be] });
2292
2310
  };
2293
2311
  //#endregion
2294
2312
  //#region src/PivotTable.tsx
2295
- function Vt() {
2296
- return O()("dashboard.total", "Total");
2313
+ function Gt() {
2314
+ return A()("dashboard.total", "Total");
2297
2315
  }
2298
- function Ht() {
2299
- return O()("dashboard.noDataAvailable", "No data available");
2316
+ function Kt() {
2317
+ return A()("dashboard.noDataAvailable", "No data available");
2300
2318
  }
2301
- function Ut(e, t) {
2319
+ function qt(e, t) {
2302
2320
  if (!t) return String(e);
2303
2321
  let n = "", r = "", i = !1, a, o = t, s = o.match(/^([^0-9.,#]*)/);
2304
2322
  if (s && s[1]) {
@@ -2315,11 +2333,11 @@ function Ut(e, t) {
2315
2333
  }
2316
2334
  return n + l + r;
2317
2335
  }
2318
- var Wt = "—";
2319
- function Gt(e, t) {
2320
- return e === "" ? Wt : t?.[e] ?? e;
2336
+ var Jt = "—";
2337
+ function Yt(e, t) {
2338
+ return e === "" ? Jt : t?.[e] ?? e;
2321
2339
  }
2322
- function Kt(e, t) {
2340
+ function Xt(e, t) {
2323
2341
  if (e.length === 0) return 0;
2324
2342
  switch (t) {
2325
2343
  case "sum": return e.reduce((e, t) => e + t, 0);
@@ -2330,8 +2348,8 @@ function Kt(e, t) {
2330
2348
  default: return e.reduce((e, t) => e + t, 0);
2331
2349
  }
2332
2350
  }
2333
- var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2334
- let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: f = [], showRowTotals: p = !1, showColumnTotals: m = !1, format: h, columnColors: g, drillDown: _ } = e, v = Vt(), y = Ht(), b = d(_) && typeof a == "function", x = (e) => {
2351
+ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2352
+ let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: p = !1, showColumnTotals: m = !1, format: h, columnColors: g, drillDown: _ } = e, v = Gt(), y = Kt(), b = f(_) && typeof a == "function", x = (e) => {
2335
2353
  b && a({
2336
2354
  ...e,
2337
2355
  rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
@@ -2339,7 +2357,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2339
2357
  });
2340
2358
  }, S = (e) => (t) => {
2341
2359
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
2342
- }, 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 } = q(() => {
2360
+ }, 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(d) ? d : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = J(() => {
2343
2361
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
2344
2362
  for (let r of w) {
2345
2363
  let i = String(r[s] ?? ""), a = String(r[c] ?? ""), o = Number(r[l]) || 0;
@@ -2350,10 +2368,10 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2350
2368
  a[e] = {};
2351
2369
  let t = [];
2352
2370
  for (let r of i) {
2353
- let i = n[e]?.[r] ?? [], o = Kt(i, u);
2371
+ let i = n[e]?.[r] ?? [], o = Xt(i, u);
2354
2372
  a[e][r] = o, t.push(...i), !d[r] && d[r];
2355
2373
  }
2356
- o[e] = Kt(t, u);
2374
+ o[e] = Xt(t, u);
2357
2375
  }
2358
2376
  for (let e of i) {
2359
2377
  let t = [];
@@ -2361,7 +2379,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2361
2379
  let r = n[i]?.[e] ?? [];
2362
2380
  t.push(...r);
2363
2381
  }
2364
- d[e] = Kt(t, u);
2382
+ d[e] = Xt(t, u);
2365
2383
  }
2366
2384
  let f = [];
2367
2385
  for (let e of w) f.push(Number(e[l]) || 0);
@@ -2371,7 +2389,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2371
2389
  matrix: a,
2372
2390
  rowTotals: o,
2373
2391
  colTotals: d,
2374
- grandTotal: Kt(f, u)
2392
+ grandTotal: Xt(f, u)
2375
2393
  };
2376
2394
  }, [
2377
2395
  w,
@@ -2379,13 +2397,13 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2379
2397
  c,
2380
2398
  l,
2381
2399
  u
2382
- ]), j = (e) => Ut(e, h);
2400
+ ]), j = (e) => qt(e, h);
2383
2401
  return w.length === 0 ? /* @__PURE__ */ Q("div", {
2384
- className: H("overflow-auto", t),
2402
+ className: U("overflow-auto", t),
2385
2403
  children: [o && /* @__PURE__ */ Z("h3", {
2386
2404
  className: "text-sm font-semibold mb-2",
2387
2405
  children: o
2388
- }), /* @__PURE__ */ Z(ee, {
2406
+ }), /* @__PURE__ */ Z(te, {
2389
2407
  "data-testid": "pivot-empty-state",
2390
2408
  className: "py-8 gap-2 [&>h3]:hidden",
2391
2409
  icon: /* @__PURE__ */ Q("svg", {
@@ -2429,7 +2447,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2429
2447
  description: y
2430
2448
  })]
2431
2449
  }) : /* @__PURE__ */ Q("div", {
2432
- className: H("overflow-auto", t),
2450
+ className: U("overflow-auto", t),
2433
2451
  children: [o && /* @__PURE__ */ Z("h3", {
2434
2452
  className: "text-sm font-semibold mb-2",
2435
2453
  children: o
@@ -2450,14 +2468,14 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2450
2468
  colKey: e
2451
2469
  });
2452
2470
  return /* @__PURE__ */ Z("th", {
2453
- className: H("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
2471
+ className: U("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
2454
2472
  title: e === "" ? `${c}: (empty)` : `${c}: ${e}`,
2455
2473
  role: b ? "button" : void 0,
2456
2474
  tabIndex: b ? 0 : void 0,
2457
2475
  onClick: b ? t : void 0,
2458
2476
  onKeyDown: b ? S(t) : void 0,
2459
2477
  "aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
2460
- children: Gt(e, r)
2478
+ children: Yt(e, r)
2461
2479
  }, e);
2462
2480
  }),
2463
2481
  p && /* @__PURE__ */ Z("th", {
@@ -2470,7 +2488,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2470
2488
  className: "border-b border-border/50 hover:bg-muted/30",
2471
2489
  children: [
2472
2490
  /* @__PURE__ */ Z("td", {
2473
- className: H("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
2491
+ className: U("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
2474
2492
  role: b ? "button" : void 0,
2475
2493
  tabIndex: b ? 0 : void 0,
2476
2494
  onClick: b ? () => x({
@@ -2482,7 +2500,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2482
2500
  rowKey: e
2483
2501
  })) : void 0,
2484
2502
  "aria-label": b ? `Drill into ${s}: ${e || "(empty)"}` : void 0,
2485
- children: Gt(e, n)
2503
+ children: Yt(e, n)
2486
2504
  }),
2487
2505
  E.map((t) => {
2488
2506
  let n = D[e]?.[t] ?? 0, r = () => x({
@@ -2492,7 +2510,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2492
2510
  value: n
2493
2511
  });
2494
2512
  return /* @__PURE__ */ Z("td", {
2495
- className: H("text-right p-2 tabular-nums", g?.[t], C),
2513
+ className: U("text-right p-2 tabular-nums", g?.[t], C),
2496
2514
  role: b ? "button" : void 0,
2497
2515
  tabIndex: b ? 0 : void 0,
2498
2516
  onClick: b ? r : void 0,
@@ -2502,7 +2520,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2502
2520
  }, t);
2503
2521
  }),
2504
2522
  p && /* @__PURE__ */ Z("td", {
2505
- className: H("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
2523
+ className: U("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
2506
2524
  role: b ? "button" : void 0,
2507
2525
  tabIndex: b ? 0 : void 0,
2508
2526
  onClick: b ? () => x({
@@ -2527,7 +2545,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2527
2545
  children: v
2528
2546
  }),
2529
2547
  E.map((e) => /* @__PURE__ */ Z("td", {
2530
- className: H("text-right p-2 tabular-nums", C),
2548
+ className: U("text-right p-2 tabular-nums", C),
2531
2549
  role: b ? "button" : void 0,
2532
2550
  tabIndex: b ? 0 : void 0,
2533
2551
  onClick: b ? () => x({
@@ -2543,7 +2561,7 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2543
2561
  children: j(k[e] ?? 0)
2544
2562
  }, e)),
2545
2563
  p && /* @__PURE__ */ Z("td", {
2546
- className: H("text-right p-2 tabular-nums font-bold", C),
2564
+ className: U("text-right p-2 tabular-nums font-bold", C),
2547
2565
  role: b ? "button" : void 0,
2548
2566
  tabIndex: b ? 0 : void 0,
2549
2567
  onClick: b ? () => x({
@@ -2561,11 +2579,11 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2561
2579
  ]
2562
2580
  })]
2563
2581
  });
2564
- }, Jt = ({ schema: e, dataSource: t, className: n }) => {
2565
- let r = ue(g), i = t || r?.dataSource, a = v(e.bind), [c, l] = J([]), [u, m] = J(!1), [h, _] = J(null), [y, b] = J({}), [x, S] = J({}), [C, w] = J(null), { fieldLabel: T, fieldOptionLabel: E } = D(), O = de(T), k = de(E);
2566
- K(() => {
2567
- O.current = T, k.current = E;
2568
- }, [T, E]), K(() => {
2582
+ }, Qt = ({ schema: e, dataSource: t, className: n }) => {
2583
+ let r = pe(v), i = t || r?.dataSource, a = b(e.bind), [o, l] = Y([]), [u, d] = Y(!1), [p, g] = Y(null), [_, y] = Y({}), [x, S] = Y({}), [C, w] = Y(null), { fieldLabel: T, fieldOptionLabel: E } = k(), D = me(T), O = me(E);
2584
+ q(() => {
2585
+ D.current = T, O.current = E;
2586
+ }, [T, E]), q(() => {
2569
2587
  if (!i || !e.objectName) return;
2570
2588
  let t = i.getObjectSchema;
2571
2589
  if (typeof t != "function") return;
@@ -2575,35 +2593,35 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2575
2593
  let r = e.objectName, i = {}, a = {};
2576
2594
  for (let [e, n] of Object.entries(t.fields)) {
2577
2595
  let t = n?.label ? String(n.label) : e;
2578
- a[e] = O.current(r, e, t);
2596
+ a[e] = D.current(r, e, t);
2579
2597
  let o = n?.options;
2580
2598
  if (Array.isArray(o) && o.length > 0) {
2581
2599
  let t = {};
2582
2600
  for (let n of o) if (n && n.value !== void 0 && n.label !== void 0) {
2583
2601
  let i = String(n.value), a = String(n.label);
2584
- t[i] = k.current(r, e, i, a);
2602
+ t[i] = O.current(r, e, i, a);
2585
2603
  }
2586
2604
  Object.keys(t).length > 0 && (i[e] = t);
2587
2605
  }
2588
2606
  }
2589
- b(i), S(a);
2607
+ y(i), S(a);
2590
2608
  }).catch(() => {}), () => {
2591
2609
  n = !1;
2592
2610
  };
2593
- }, [i, e.objectName]), K(() => {
2611
+ }, [i, e.objectName]), q(() => {
2594
2612
  let t = !0;
2595
2613
  return e.objectName && !a && (!e.data || e.data.length === 0) && (async () => {
2596
2614
  if (!(!i || !e.objectName)) {
2597
- t && (m(!0), _(null));
2615
+ t && (d(!0), g(null));
2598
2616
  try {
2599
2617
  let n;
2600
- if (typeof i.find == "function") n = s(await i.find(e.objectName, { $filter: f(e.filter) }));
2618
+ if (typeof i.find == "function") n = c(await i.find(e.objectName, { $filter: m(e.filter) }));
2601
2619
  else return;
2602
2620
  t && l(n);
2603
2621
  } catch (e) {
2604
- console.error("[ObjectPivotTable] Fetch error:", e), t && _(e instanceof Error ? e.message : "Failed to load data");
2622
+ console.error("[ObjectPivotTable] Fetch error:", e), t && g(e instanceof Error ? e.message : "Failed to load data");
2605
2623
  } finally {
2606
- t && m(!1);
2624
+ t && d(!1);
2607
2625
  }
2608
2626
  }
2609
2627
  })(), () => {
@@ -2616,9 +2634,9 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2616
2634
  e.data,
2617
2635
  e.filter
2618
2636
  ]);
2619
- let A = a || e.data || c, j = Array.isArray(A) ? A : [];
2637
+ let A = a || e.data || o, j = Array.isArray(A) ? A : [];
2620
2638
  if (u && j.length === 0) return /* @__PURE__ */ Q("div", {
2621
- className: H("overflow-auto", n),
2639
+ className: U("overflow-auto", n),
2622
2640
  "data-testid": "pivot-loading",
2623
2641
  children: [e.title && /* @__PURE__ */ Z("h3", {
2624
2642
  className: "text-sm font-semibold mb-2",
@@ -2628,10 +2646,10 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2628
2646
  children: [/* @__PURE__ */ Q("div", {
2629
2647
  className: "flex gap-2",
2630
2648
  children: [
2631
- /* @__PURE__ */ Z(V, { className: "h-6 w-24" }),
2632
- /* @__PURE__ */ Z(V, { className: "h-6 w-20" }),
2633
- /* @__PURE__ */ Z(V, { className: "h-6 w-20" }),
2634
- /* @__PURE__ */ Z(V, { className: "h-6 w-20" })
2649
+ /* @__PURE__ */ Z(H, { className: "h-6 w-24" }),
2650
+ /* @__PURE__ */ Z(H, { className: "h-6 w-20" }),
2651
+ /* @__PURE__ */ Z(H, { className: "h-6 w-20" }),
2652
+ /* @__PURE__ */ Z(H, { className: "h-6 w-20" })
2635
2653
  ]
2636
2654
  }), [
2637
2655
  1,
@@ -2640,16 +2658,16 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2640
2658
  ].map((e) => /* @__PURE__ */ Q("div", {
2641
2659
  className: "flex gap-2",
2642
2660
  children: [
2643
- /* @__PURE__ */ Z(V, { className: "h-5 w-24" }),
2644
- /* @__PURE__ */ Z(V, { className: "h-5 w-20" }),
2645
- /* @__PURE__ */ Z(V, { className: "h-5 w-20" }),
2646
- /* @__PURE__ */ Z(V, { className: "h-5 w-20" })
2661
+ /* @__PURE__ */ Z(H, { className: "h-5 w-24" }),
2662
+ /* @__PURE__ */ Z(H, { className: "h-5 w-20" }),
2663
+ /* @__PURE__ */ Z(H, { className: "h-5 w-20" }),
2664
+ /* @__PURE__ */ Z(H, { className: "h-5 w-20" })
2647
2665
  ]
2648
2666
  }, e))]
2649
2667
  })]
2650
2668
  });
2651
- if (h) return /* @__PURE__ */ Q("div", {
2652
- className: H("overflow-auto", n),
2669
+ if (p) return /* @__PURE__ */ Q("div", {
2670
+ className: U("overflow-auto", n),
2653
2671
  "data-testid": "pivot-error",
2654
2672
  children: [e.title && /* @__PURE__ */ Z("h3", {
2655
2673
  className: "text-sm font-semibold mb-2",
@@ -2687,12 +2705,12 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2687
2705
  ]
2688
2706
  }), /* @__PURE__ */ Z("p", {
2689
2707
  className: "text-xs",
2690
- children: h
2708
+ children: p
2691
2709
  })]
2692
2710
  })]
2693
2711
  });
2694
2712
  if (!i && e.objectName && j.length === 0) return /* @__PURE__ */ Q("div", {
2695
- className: H("overflow-auto", n),
2713
+ className: U("overflow-auto", n),
2696
2714
  children: [e.title && /* @__PURE__ */ Z("h3", {
2697
2715
  className: "text-sm font-semibold mb-2",
2698
2716
  children: e.title
@@ -2708,40 +2726,40 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2708
2726
  })
2709
2727
  })]
2710
2728
  });
2711
- let M = {
2729
+ let ee = {
2712
2730
  ...e,
2713
2731
  data: j
2714
- }, N = e.rowField ? y[e.rowField] : void 0, P = e.columnField ? y[e.columnField] : void 0, F = e.rowField ? x[e.rowField] : void 0, I = e.drillDown;
2715
- return /* @__PURE__ */ Q(Ve, { children: [/* @__PURE__ */ Z(qt, {
2716
- schema: M,
2732
+ }, M = e.rowField ? _[e.rowField] : void 0, N = e.columnField ? _[e.columnField] : void 0, P = e.rowField ? x[e.rowField] : void 0, F = e.drillDown;
2733
+ return /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z(Zt, {
2734
+ schema: ee,
2717
2735
  className: n,
2718
- rowLabels: N,
2719
- columnLabels: P,
2720
- rowFieldLabel: F,
2721
- onDrillDown: d(I) ? (e) => w(e) : void 0
2736
+ rowLabels: M,
2737
+ columnLabels: N,
2738
+ rowFieldLabel: P,
2739
+ onDrillDown: f(F) ? (e) => w(e) : void 0
2722
2740
  }), (() => {
2723
2741
  if (!C || !e.objectName) return null;
2724
- let t = o(I, C, {
2742
+ let t = s(F, C, {
2725
2743
  rowField: e.rowField,
2726
2744
  columnField: e.columnField
2727
2745
  }), n = {
2728
2746
  ...e.filter || {},
2729
2747
  ...t
2730
2748
  };
2731
- return /* @__PURE__ */ Z(ot, {
2749
+ return /* @__PURE__ */ Z(ut, {
2732
2750
  open: !0,
2733
2751
  onClose: () => w(null),
2734
- title: p(I, C, e.title || "Details"),
2735
- target: I?.target ?? "drawer",
2752
+ title: h(F, C, e.title || "Details"),
2753
+ target: F?.target ?? "drawer",
2736
2754
  objectName: e.objectName,
2737
2755
  filter: n,
2738
2756
  dataSource: i,
2739
- columns: I?.columns,
2740
- maxRows: I?.maxRows,
2741
- report: I?.report
2757
+ columns: F?.columns,
2758
+ maxRows: F?.maxRows,
2759
+ report: F?.report
2742
2760
  });
2743
2761
  })()] });
2744
- }, Yt = {
2762
+ }, $t = {
2745
2763
  breadcrumb: ["Dashboard", "Configuration"],
2746
2764
  sections: [
2747
2765
  {
@@ -2867,12 +2885,12 @@ var qt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2867
2885
  }
2868
2886
  ]
2869
2887
  };
2870
- function Xt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2871
- let { draft: a, isDirty: o, updateField: s, discard: c } = se(n, { onUpdate: i });
2872
- return /* @__PURE__ */ Z(F, {
2888
+ function en({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2889
+ let { draft: a, isDirty: o, updateField: s, discard: c } = ue(n, { onUpdate: i });
2890
+ return /* @__PURE__ */ Z(L, {
2873
2891
  open: e,
2874
2892
  onClose: t,
2875
- schema: Yt,
2893
+ schema: $t,
2876
2894
  draft: a,
2877
2895
  isDirty: o,
2878
2896
  onFieldChange: s,
@@ -2882,7 +2900,7 @@ function Xt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2882
2900
  }
2883
2901
  //#endregion
2884
2902
  //#region src/WidgetConfigPanel.tsx
2885
- var Zt = [
2903
+ var tn = [
2886
2904
  {
2887
2905
  value: "metric",
2888
2906
  label: "Metric"
@@ -2927,7 +2945,7 @@ var Zt = [
2927
2945
  value: "pivot",
2928
2946
  label: "Pivot Table"
2929
2947
  }
2930
- ], Qt = [
2948
+ ], nn = [
2931
2949
  {
2932
2950
  value: "default",
2933
2951
  label: "Default"
@@ -2960,7 +2978,7 @@ var Zt = [
2960
2978
  value: "danger",
2961
2979
  label: "Danger"
2962
2980
  }
2963
- ], $t = [
2981
+ ], rn = [
2964
2982
  {
2965
2983
  value: "count",
2966
2984
  label: "Count"
@@ -2981,7 +2999,7 @@ var Zt = [
2981
2999
  value: "max",
2982
3000
  label: "Max"
2983
3001
  }
2984
- ], en = [
3002
+ ], an = [
2985
3003
  "bar",
2986
3004
  "horizontal-bar",
2987
3005
  "line",
@@ -2990,17 +3008,17 @@ var Zt = [
2990
3008
  "donut",
2991
3009
  "scatter",
2992
3010
  "funnel"
2993
- ], tn = [
3011
+ ], on = [
2994
3012
  "bar",
2995
3013
  "horizontal-bar",
2996
3014
  "line",
2997
3015
  "area",
2998
3016
  "scatter"
2999
- ], nn = [
3017
+ ], sn = [
3000
3018
  "pie",
3001
3019
  "donut",
3002
3020
  "funnel"
3003
- ], rn = ["metric", ...en], an = [...en], on = [
3021
+ ], cn = ["metric", ...an], ln = [...an], un = [
3004
3022
  "pivot",
3005
3023
  "metric",
3006
3024
  "bar",
@@ -3016,50 +3034,50 @@ var Zt = [
3016
3034
  "table",
3017
3035
  "list"
3018
3036
  ];
3019
- function sn(e) {
3020
- return !!e && en.includes(e);
3037
+ function dn(e) {
3038
+ return !!e && an.includes(e);
3021
3039
  }
3022
- function cn(e) {
3023
- return !!e && tn.includes(e);
3040
+ function fn(e) {
3041
+ return !!e && on.includes(e);
3024
3042
  }
3025
- function ln(e) {
3026
- return !!e && an.includes(e);
3043
+ function pn(e) {
3044
+ return !!e && ln.includes(e);
3027
3045
  }
3028
- function un(e) {
3029
- return !!e && rn.includes(e);
3046
+ function mn(e) {
3047
+ return !!e && cn.includes(e);
3030
3048
  }
3031
- function dn(e) {
3032
- return !!e && on.includes(e);
3049
+ function hn(e) {
3050
+ return !!e && un.includes(e);
3033
3051
  }
3034
- var fn = [{
3052
+ var gn = [{
3035
3053
  value: "drawer",
3036
3054
  label: "Side drawer"
3037
3055
  }, {
3038
3056
  value: "dialog",
3039
3057
  label: "Center dialog"
3040
- }], pn = [{
3058
+ }], _n = [{
3041
3059
  value: "group",
3042
3060
  label: "Group"
3043
3061
  }, {
3044
3062
  value: "value",
3045
3063
  label: "Value"
3046
- }], mn = [{
3064
+ }], vn = [{
3047
3065
  value: "asc",
3048
3066
  label: "↑"
3049
3067
  }, {
3050
3068
  value: "desc",
3051
3069
  label: "↓"
3052
3070
  }];
3053
- function hn(e, t, n, r) {
3071
+ function yn(e, t, n, r) {
3054
3072
  return {
3055
3073
  key: e,
3056
3074
  label: t,
3057
3075
  type: "custom",
3058
- render: (i, a, o) => /* @__PURE__ */ Z(I, {
3076
+ render: (i, a, o) => /* @__PURE__ */ Z(R, {
3059
3077
  label: t,
3060
3078
  children: /* @__PURE__ */ Z("div", {
3061
3079
  "data-testid": `config-field-${e}`,
3062
- children: /* @__PURE__ */ Z(P, {
3080
+ children: /* @__PURE__ */ Z(I, {
3063
3081
  options: r ?? [],
3064
3082
  value: i ?? "",
3065
3083
  onValueChange: a,
@@ -3073,16 +3091,16 @@ function hn(e, t, n, r) {
3073
3091
  })
3074
3092
  };
3075
3093
  }
3076
- function gn(e, t, n) {
3094
+ function bn(e, t, n) {
3077
3095
  let r = e && e.length > 0, i = r ? {
3078
3096
  key: "object",
3079
3097
  label: "Data source",
3080
3098
  type: "custom",
3081
- render: (t, n) => /* @__PURE__ */ Z(I, {
3099
+ render: (t, n) => /* @__PURE__ */ Z(R, {
3082
3100
  label: "Data source",
3083
3101
  children: /* @__PURE__ */ Z("div", {
3084
3102
  "data-testid": "config-field-object",
3085
- children: /* @__PURE__ */ Z(P, {
3103
+ children: /* @__PURE__ */ Z(I, {
3086
3104
  options: e,
3087
3105
  value: t ?? "",
3088
3106
  onValueChange: n,
@@ -3099,38 +3117,38 @@ function gn(e, t, n) {
3099
3117
  type: "input",
3100
3118
  placeholder: "Object name"
3101
3119
  }, a = r ? {
3102
- ...hn("categoryField", "Category field", "Select field…", t),
3120
+ ...yn("categoryField", "Category field", "Select field…", t),
3103
3121
  helpText: "Group records by this field (one bar/slice/segment per value).",
3104
- visibleWhen: (e) => ln(e.type)
3122
+ visibleWhen: (e) => pn(e.type)
3105
3123
  } : {
3106
3124
  key: "categoryField",
3107
3125
  label: "Category field",
3108
3126
  type: "input",
3109
3127
  placeholder: "e.g. status",
3110
3128
  helpText: "Group records by this field (one bar/slice/segment per value).",
3111
- visibleWhen: (e) => ln(e.type)
3129
+ visibleWhen: (e) => pn(e.type)
3112
3130
  }, o = r ? {
3113
- ...hn("valueField", "Value field", "Select field…", t),
3131
+ ...yn("valueField", "Value field", "Select field…", t),
3114
3132
  helpText: "Field to aggregate (sum / average / min / max).",
3115
- visibleWhen: (e) => un(e.type) && (e.aggregate ?? "count") !== "count"
3133
+ visibleWhen: (e) => mn(e.type) && (e.aggregate ?? "count") !== "count"
3116
3134
  } : {
3117
3135
  key: "valueField",
3118
3136
  label: "Value field",
3119
3137
  type: "input",
3120
3138
  placeholder: "e.g. amount",
3121
3139
  helpText: "Field to aggregate (sum / average / min / max).",
3122
- visibleWhen: (e) => un(e.type) && (e.aggregate ?? "count") !== "count"
3123
- }, s = r ? hn("rowField", "Field", "Select row field…", t) : {
3140
+ visibleWhen: (e) => mn(e.type) && (e.aggregate ?? "count") !== "count"
3141
+ }, s = r ? yn("rowField", "Field", "Select row field…", t) : {
3124
3142
  key: "rowField",
3125
3143
  label: "Field",
3126
3144
  type: "input",
3127
3145
  placeholder: "e.g. owner"
3128
- }, c = r ? hn("columnField", "Field", "Select column field…", t) : {
3146
+ }, c = r ? yn("columnField", "Field", "Select column field…", t) : {
3129
3147
  key: "columnField",
3130
3148
  label: "Field",
3131
3149
  type: "input",
3132
3150
  placeholder: "e.g. stage"
3133
- }, l = r ? hn("valueField", "Field", "Select value field…", t) : {
3151
+ }, l = r ? yn("valueField", "Field", "Select value field…", t) : {
3134
3152
  key: "valueField",
3135
3153
  label: "Field",
3136
3154
  type: "input",
@@ -3140,7 +3158,7 @@ function gn(e, t, n) {
3140
3158
  breadcrumb: ["Dashboard", {
3141
3159
  pivot: "Pivot table",
3142
3160
  table: "Table"
3143
- }[n ?? ""] ?? (sn(n) ? "Chart" : "Widget")],
3161
+ }[n ?? ""] ?? (dn(n) ? "Chart" : "Widget")],
3144
3162
  sections: [
3145
3163
  {
3146
3164
  key: "general",
@@ -3162,7 +3180,7 @@ function gn(e, t, n) {
3162
3180
  key: "type",
3163
3181
  label: "Widget type",
3164
3182
  type: "select",
3165
- options: Zt,
3183
+ options: tn,
3166
3184
  defaultValue: "metric"
3167
3185
  }
3168
3186
  ]
@@ -3180,10 +3198,10 @@ function gn(e, t, n) {
3180
3198
  key: "aggregate",
3181
3199
  label: "Aggregation",
3182
3200
  type: "select",
3183
- options: $t,
3201
+ options: rn,
3184
3202
  defaultValue: "count",
3185
3203
  helpText: "Count ignores Value field; Sum / Avg / Min / Max require it.",
3186
- visibleWhen: (e) => un(e.type)
3204
+ visibleWhen: (e) => mn(e.type)
3187
3205
  }
3188
3206
  ]
3189
3207
  },
@@ -3205,14 +3223,14 @@ function gn(e, t, n) {
3205
3223
  key: "rowSortBy",
3206
3224
  label: "Sort by",
3207
3225
  type: "icon-group",
3208
- options: pn,
3226
+ options: _n,
3209
3227
  defaultValue: "group"
3210
3228
  },
3211
3229
  {
3212
3230
  key: "rowSortOrder",
3213
3231
  label: "Sort order",
3214
3232
  type: "icon-group",
3215
- options: mn,
3233
+ options: vn,
3216
3234
  defaultValue: "asc"
3217
3235
  },
3218
3236
  {
@@ -3240,14 +3258,14 @@ function gn(e, t, n) {
3240
3258
  key: "columnSortBy",
3241
3259
  label: "Sort by",
3242
3260
  type: "icon-group",
3243
- options: pn,
3261
+ options: _n,
3244
3262
  defaultValue: "group"
3245
3263
  },
3246
3264
  {
3247
3265
  key: "columnSortOrder",
3248
3266
  label: "Sort order",
3249
3267
  type: "icon-group",
3250
- options: mn,
3268
+ options: vn,
3251
3269
  defaultValue: "asc"
3252
3270
  },
3253
3271
  {
@@ -3275,7 +3293,7 @@ function gn(e, t, n) {
3275
3293
  key: "aggregation",
3276
3294
  label: "Aggregation",
3277
3295
  type: "select",
3278
- options: $t,
3296
+ options: rn,
3279
3297
  defaultValue: "sum"
3280
3298
  },
3281
3299
  {
@@ -3290,7 +3308,7 @@ function gn(e, t, n) {
3290
3308
  key: "chart-axis",
3291
3309
  title: "Axis & Series",
3292
3310
  collapsible: !0,
3293
- visibleWhen: (e) => cn(e.type),
3311
+ visibleWhen: (e) => fn(e.type),
3294
3312
  fields: [
3295
3313
  {
3296
3314
  key: "xAxisLabel",
@@ -3316,7 +3334,7 @@ function gn(e, t, n) {
3316
3334
  key: "chart-legend",
3317
3335
  title: "Display",
3318
3336
  collapsible: !0,
3319
- visibleWhen: (e) => !!e.type && nn.includes(e.type),
3337
+ visibleWhen: (e) => !!e.type && sn.includes(e.type),
3320
3338
  fields: [{
3321
3339
  key: "showLegend",
3322
3340
  label: "Show legend",
@@ -3368,7 +3386,7 @@ function gn(e, t, n) {
3368
3386
  title: "Drill-down",
3369
3387
  collapsible: !0,
3370
3388
  defaultCollapsed: !0,
3371
- visibleWhen: (e) => dn(e.type),
3389
+ visibleWhen: (e) => hn(e.type),
3372
3390
  fields: [{
3373
3391
  key: "drillDownEnabled",
3374
3392
  label: "Enable drill-down",
@@ -3379,7 +3397,7 @@ function gn(e, t, n) {
3379
3397
  key: "drillDownTarget",
3380
3398
  label: "Open in",
3381
3399
  type: "select",
3382
- options: fn,
3400
+ options: gn,
3383
3401
  defaultValue: "drawer",
3384
3402
  visibleWhen: (e) => !!e.drillDownEnabled
3385
3403
  }]
@@ -3405,14 +3423,14 @@ function gn(e, t, n) {
3405
3423
  key: "colorVariant",
3406
3424
  label: "Color variant",
3407
3425
  type: "select",
3408
- options: Qt,
3426
+ options: nn,
3409
3427
  defaultValue: "default"
3410
3428
  }]
3411
3429
  }
3412
3430
  ]
3413
3431
  };
3414
3432
  }
3415
- function _n(e) {
3433
+ function xn(e) {
3416
3434
  if (e == null) return "";
3417
3435
  if (typeof e == "string") return e;
3418
3436
  if (typeof e == "object") {
@@ -3421,20 +3439,20 @@ function _n(e) {
3421
3439
  }
3422
3440
  return String(e);
3423
3441
  }
3424
- function vn(e) {
3442
+ function Sn(e) {
3425
3443
  let t = e.type, n = { ...e };
3426
- return ln(t) || delete n.categoryField, un(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), cn(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), dn(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
3444
+ return pn(t) || delete n.categoryField, mn(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), fn(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), hn(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
3427
3445
  }
3428
- function yn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
3429
- let { draft: c, isDirty: l, updateField: u, discard: d } = se(U.useMemo(() => ({
3446
+ function Cn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
3447
+ let { draft: c, isDirty: l, updateField: u, discard: d } = ue(W.useMemo(() => ({
3430
3448
  ...n,
3431
- title: typeof n.title == "object" ? _n(n.title) : n.title,
3432
- description: typeof n.description == "object" ? _n(n.description) : n.description
3449
+ title: typeof n.title == "object" ? xn(n.title) : n.title,
3450
+ description: typeof n.description == "object" ? xn(n.description) : n.description
3433
3451
  }), [n]), { onUpdate: i });
3434
- return /* @__PURE__ */ Z(F, {
3452
+ return /* @__PURE__ */ Z(L, {
3435
3453
  open: e,
3436
3454
  onClose: t,
3437
- schema: U.useMemo(() => gn(o, s, c.type), [
3455
+ schema: W.useMemo(() => bn(o, s, c.type), [
3438
3456
  o,
3439
3457
  s,
3440
3458
  c.type
@@ -3442,19 +3460,19 @@ function yn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
3442
3460
  draft: c,
3443
3461
  isDirty: l,
3444
3462
  onFieldChange: u,
3445
- onSave: () => r(vn(c)),
3463
+ onSave: () => r(Sn(c)),
3446
3464
  onDiscard: d,
3447
3465
  headerExtra: a
3448
3466
  });
3449
3467
  }
3450
3468
  //#endregion
3451
3469
  //#region src/DashboardWithConfig.tsx
3452
- function bn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
3453
- let [c, l] = J(o), [u, d] = J(null), [f, p] = J(e), [m, h] = J(0);
3454
- K(() => {
3470
+ function wn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
3471
+ let [c, l] = Y(o), [u, d] = Y(null), [f, p] = Y(e), [m, h] = Y(0);
3472
+ q(() => {
3455
3473
  p(e), h((e) => e + 1);
3456
3474
  }, [e]);
3457
- let g = U.useMemo(() => {
3475
+ let g = W.useMemo(() => {
3458
3476
  if (!u || !f.widgets) return null;
3459
3477
  let e = f.widgets.find((e) => (e.id || e.title) === u);
3460
3478
  if (!e) return null;
@@ -3476,11 +3494,11 @@ function bn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3476
3494
  layoutW: e.layout?.w ?? 1,
3477
3495
  layoutH: e.layout?.h ?? 1
3478
3496
  };
3479
- }, [u, m]), _ = G((e) => {
3497
+ }, [u, m]), _ = K((e) => {
3480
3498
  d(e), l(!0);
3481
- }, []), v = G(() => {
3499
+ }, []), v = K(() => {
3482
3500
  d(null);
3483
- }, []), y = G((e, t) => {
3501
+ }, []), y = K((e, t) => {
3484
3502
  u && p((n) => n.widgets ? {
3485
3503
  ...n,
3486
3504
  widgets: n.widgets.map((n) => {
@@ -3521,7 +3539,7 @@ function bn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3521
3539
  };
3522
3540
  })
3523
3541
  } : n);
3524
- }, [u]), b = G((e) => {
3542
+ }, [u]), b = K((e) => {
3525
3543
  if (u && r) {
3526
3544
  let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
3527
3545
  (t || n) && (a.options = {
@@ -3534,24 +3552,24 @@ function bn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3534
3552
  }), r(u, a);
3535
3553
  }
3536
3554
  d(null), h((e) => e + 1);
3537
- }, [u, r]), x = G(() => {
3555
+ }, [u, r]), x = K(() => {
3538
3556
  l((e) => !e), d(null);
3539
3557
  }, []);
3540
3558
  return /* @__PURE__ */ Q("div", {
3541
- className: H("flex h-full w-full", s),
3559
+ className: U("flex h-full w-full", s),
3542
3560
  "data-testid": "dashboard-with-config",
3543
3561
  children: [/* @__PURE__ */ Q("div", {
3544
3562
  className: "flex-1 min-w-0 overflow-auto relative",
3545
3563
  children: [/* @__PURE__ */ Z("div", {
3546
3564
  className: "absolute top-2 right-2 z-10",
3547
- children: /* @__PURE__ */ Q(k, {
3565
+ children: /* @__PURE__ */ Q(j, {
3548
3566
  size: "sm",
3549
3567
  variant: c ? "default" : "outline",
3550
3568
  onClick: x,
3551
3569
  "data-testid": "dashboard-config-toggle",
3552
- children: [/* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3570
+ children: [/* @__PURE__ */ Z(De, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3553
3571
  })
3554
- }), /* @__PURE__ */ Z(Tt, {
3572
+ }), /* @__PURE__ */ Z(kt, {
3555
3573
  schema: f,
3556
3574
  onRefresh: i,
3557
3575
  recordCount: a,
@@ -3561,13 +3579,13 @@ function bn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3561
3579
  })]
3562
3580
  }), c && /* @__PURE__ */ Z("div", {
3563
3581
  className: "relative shrink-0",
3564
- children: u && g ? /* @__PURE__ */ Z(yn, {
3582
+ children: u && g ? /* @__PURE__ */ Z(Cn, {
3565
3583
  open: !0,
3566
3584
  onClose: v,
3567
3585
  config: g,
3568
3586
  onSave: b,
3569
3587
  onFieldChange: y
3570
- }) : /* @__PURE__ */ Z(Xt, {
3588
+ }) : /* @__PURE__ */ Z(en, {
3571
3589
  open: !0,
3572
3590
  onClose: () => l(!1),
3573
3591
  config: t,
@@ -3576,7 +3594,7 @@ function bn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3576
3594
  })]
3577
3595
  });
3578
3596
  }
3579
- e.register("dashboard", Tt, {
3597
+ e.register("dashboard", kt, {
3580
3598
  namespace: "view",
3581
3599
  label: "Dashboard",
3582
3600
  category: "Complex",
@@ -3604,7 +3622,7 @@ e.register("dashboard", Tt, {
3604
3622
  columns: 3,
3605
3623
  widgets: []
3606
3624
  }
3607
- }), e.register("metric", Lt, {
3625
+ }), e.register("metric", Vt, {
3608
3626
  namespace: "plugin-dashboard",
3609
3627
  label: "Metric Widget",
3610
3628
  category: "Dashboard",
@@ -3617,7 +3635,7 @@ e.register("dashboard", Tt, {
3617
3635
  type: "string",
3618
3636
  label: "Value"
3619
3637
  }]
3620
- }), e.register("metric-card", zt, {
3638
+ }), e.register("metric-card", Ut, {
3621
3639
  namespace: "plugin-dashboard",
3622
3640
  label: "Metric Card",
3623
3641
  category: "Dashboard",
@@ -3672,7 +3690,7 @@ e.register("dashboard", Tt, {
3672
3690
  title: "Metric",
3673
3691
  value: "0"
3674
3692
  }
3675
- }), e.register("object-metric", Bt, {
3693
+ }), e.register("object-metric", Wt, {
3676
3694
  namespace: "plugin-dashboard",
3677
3695
  label: "Object Metric",
3678
3696
  category: "Dashboard",
@@ -3701,7 +3719,7 @@ e.register("dashboard", Tt, {
3701
3719
  }
3702
3720
  ],
3703
3721
  defaultProps: { label: "Metric" }
3704
- }), e.register("pivot", qt, {
3722
+ }), e.register("pivot", Zt, {
3705
3723
  namespace: "plugin-dashboard",
3706
3724
  label: "Pivot Table",
3707
3725
  category: "Dashboard",
@@ -3780,7 +3798,7 @@ e.register("dashboard", Tt, {
3780
3798
  aggregation: "sum",
3781
3799
  data: []
3782
3800
  }
3783
- }), e.register("object-pivot", Jt, {
3801
+ }), e.register("object-pivot", Qt, {
3784
3802
  namespace: "plugin-dashboard",
3785
3803
  label: "Object Pivot Table",
3786
3804
  category: "Dashboard",
@@ -3869,7 +3887,7 @@ e.register("dashboard", Tt, {
3869
3887
  valueField: "",
3870
3888
  aggregation: "sum"
3871
3889
  }
3872
- }), e.register("dashboard-grid", At, {
3890
+ }), e.register("dashboard-grid", Pt, {
3873
3891
  namespace: "plugin-dashboard",
3874
3892
  label: "Dashboard Grid (Editable)",
3875
3893
  category: "Complex",
@@ -3887,7 +3905,7 @@ e.register("dashboard", Tt, {
3887
3905
  title: "Dashboard",
3888
3906
  widgets: []
3889
3907
  }
3890
- }), e.register("object-data-table", it, {
3908
+ }), e.register("object-data-table", ct, {
3891
3909
  namespace: "plugin-dashboard",
3892
3910
  label: "Object Data Table",
3893
3911
  category: "Dashboard",
@@ -3925,18 +3943,18 @@ e.register("dashboard", Tt, {
3925
3943
  pagination: !1
3926
3944
  }
3927
3945
  });
3928
- var xn = {
3929
- DashboardRenderer: Tt,
3930
- DashboardGridLayout: At,
3931
- MetricWidget: Lt,
3932
- MetricCard: zt,
3933
- ObjectMetricWidget: Bt,
3934
- PivotTable: qt,
3935
- ObjectPivotTable: Jt,
3936
- ObjectDataTable: it,
3937
- DashboardConfigPanel: Xt,
3938
- WidgetConfigPanel: yn,
3939
- DashboardWithConfig: bn
3946
+ var Tn = {
3947
+ DashboardRenderer: kt,
3948
+ DashboardGridLayout: Pt,
3949
+ MetricWidget: Vt,
3950
+ MetricCard: Ut,
3951
+ ObjectMetricWidget: Wt,
3952
+ PivotTable: Zt,
3953
+ ObjectPivotTable: Qt,
3954
+ ObjectDataTable: ct,
3955
+ DashboardConfigPanel: en,
3956
+ WidgetConfigPanel: Cn,
3957
+ DashboardWithConfig: wn
3940
3958
  };
3941
3959
  //#endregion
3942
- export { Xt as DashboardConfigPanel, At as DashboardGridLayout, Tt as DashboardRenderer, bn as DashboardWithConfig, ot as DrillDownDrawer, zt as MetricCard, Lt as MetricWidget, it as ObjectDataTable, Bt as ObjectMetricWidget, Jt as ObjectPivotTable, qt as PivotTable, yn as WidgetConfigPanel, xn as dashboardComponents };
3960
+ export { en as DashboardConfigPanel, Pt as DashboardGridLayout, kt as DashboardRenderer, wn as DashboardWithConfig, ut as DrillDownDrawer, Ut as MetricCard, Vt as MetricWidget, ct as ObjectDataTable, Wt as ObjectMetricWidget, Qt as ObjectPivotTable, Zt as PivotTable, Cn as WidgetConfigPanel, Tn as dashboardComponents };