@object-ui/plugin-dashboard 6.2.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/dist/{packages/plugin-dashboard/src/DashboardConfigPanel.d.ts → DashboardConfigPanel.d.ts} +2 -1
  3. package/dist/DashboardConfigPanel.d.ts.map +1 -0
  4. package/dist/{packages/plugin-dashboard/src/DashboardGridLayout.d.ts → DashboardGridLayout.d.ts} +1 -1
  5. package/dist/DashboardGridLayout.d.ts.map +1 -0
  6. package/dist/{packages/plugin-dashboard/src/DashboardRenderer.d.ts → DashboardRenderer.d.ts} +2 -2
  7. package/dist/DashboardRenderer.d.ts.map +1 -0
  8. package/dist/{packages/plugin-dashboard/src/DashboardWithConfig.d.ts → DashboardWithConfig.d.ts} +10 -2
  9. package/dist/DashboardWithConfig.d.ts.map +1 -0
  10. package/dist/DatasetWidget.d.ts +33 -0
  11. package/dist/DatasetWidget.d.ts.map +1 -0
  12. package/dist/{packages/plugin-dashboard/src/DrillDownDrawer.d.ts → DrillDownDrawer.d.ts} +7 -2
  13. package/dist/DrillDownDrawer.d.ts.map +1 -0
  14. package/dist/MetricCard.d.ts.map +1 -0
  15. package/dist/{packages/plugin-dashboard/src/MetricWidget.d.ts → MetricWidget.d.ts} +1 -1
  16. package/dist/MetricWidget.d.ts.map +1 -0
  17. package/dist/ObjectDataTable.d.ts.map +1 -0
  18. package/dist/{packages/plugin-dashboard/src/ObjectMetricWidget.d.ts → ObjectMetricWidget.d.ts} +1 -1
  19. package/dist/ObjectMetricWidget.d.ts.map +1 -0
  20. package/dist/{packages/plugin-dashboard/src/ObjectPivotTable.d.ts → ObjectPivotTable.d.ts} +1 -1
  21. package/dist/ObjectPivotTable.d.ts.map +1 -0
  22. package/dist/OpenInListButton.d.ts +12 -0
  23. package/dist/OpenInListButton.d.ts.map +1 -0
  24. package/dist/{packages/plugin-dashboard/src/PivotTable.d.ts → PivotTable.d.ts} +2 -2
  25. package/dist/PivotTable.d.ts.map +1 -0
  26. package/dist/RecordDetailDrawer.d.ts +23 -0
  27. package/dist/RecordDetailDrawer.d.ts.map +1 -0
  28. package/dist/{packages/plugin-dashboard/src/WidgetConfigPanel.d.ts → WidgetConfigPanel.d.ts} +1 -1
  29. package/dist/WidgetConfigPanel.d.ts.map +1 -0
  30. package/dist/index.d.ts +27 -2
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +1552 -992
  33. package/dist/index.umd.cjs +2 -1
  34. package/dist/recordFields.d.ts +70 -0
  35. package/dist/recordFields.d.ts.map +1 -0
  36. package/dist/{packages/plugin-dashboard/src/utils.d.ts → utils.d.ts} +2 -2
  37. package/dist/utils.d.ts.map +1 -0
  38. package/package.json +12 -12
  39. package/dist/packages/plugin-dashboard/src/DashboardConfigPanel.d.ts.map +0 -1
  40. package/dist/packages/plugin-dashboard/src/DashboardConfigPanel.stories.d.ts +0 -14
  41. package/dist/packages/plugin-dashboard/src/DashboardConfigPanel.stories.d.ts.map +0 -1
  42. package/dist/packages/plugin-dashboard/src/DashboardGridLayout.d.ts.map +0 -1
  43. package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts.map +0 -1
  44. package/dist/packages/plugin-dashboard/src/DashboardRenderer.stories.d.ts +0 -24
  45. package/dist/packages/plugin-dashboard/src/DashboardRenderer.stories.d.ts.map +0 -1
  46. package/dist/packages/plugin-dashboard/src/DashboardWithConfig.d.ts.map +0 -1
  47. package/dist/packages/plugin-dashboard/src/DrillDownDrawer.d.ts.map +0 -1
  48. package/dist/packages/plugin-dashboard/src/MetricCard.d.ts.map +0 -1
  49. package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts.map +0 -1
  50. package/dist/packages/plugin-dashboard/src/ObjectDataTable.d.ts.map +0 -1
  51. package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts.map +0 -1
  52. package/dist/packages/plugin-dashboard/src/ObjectPivotTable.d.ts.map +0 -1
  53. package/dist/packages/plugin-dashboard/src/PivotTable.d.ts.map +0 -1
  54. package/dist/packages/plugin-dashboard/src/WidgetConfigPanel.d.ts.map +0 -1
  55. package/dist/packages/plugin-dashboard/src/index.d.ts +0 -27
  56. package/dist/packages/plugin-dashboard/src/index.d.ts.map +0 -1
  57. package/dist/packages/plugin-dashboard/src/utils.d.ts.map +0 -1
  58. /package/dist/{packages/plugin-dashboard/src/MetricCard.d.ts → MetricCard.d.ts} +0 -0
  59. /package/dist/{packages/plugin-dashboard/src/ObjectDataTable.d.ts → ObjectDataTable.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import { ComponentRegistry as e, compareToTrendLabelKey as t, computeDrillFilter as n, extractRecords as r, isDrillEnabled as i, resolveDateMacros as a, resolveDrillTitle as o, shiftFilterByCompareTo as s } from "@object-ui/core";
2
- import { SchemaRenderer as c, SchemaRendererContext as l, useActionEngine as u, useDataScope as d, useDnd as f, useHasDndProvider as p, useObjectLabel as m } from "@object-ui/react";
3
- import { createSafeTranslation as h, useObjectTranslation as g, useSafeFieldLabel as _ } from "@object-ui/i18n";
4
- import { Button as v, Card as y, CardContent as b, CardHeader as x, CardTitle as S, Combobox as C, ConfigPanelRenderer as w, ConfigRow as T, DataEmptyState as E, Dialog as D, DialogContent as O, DialogHeader as k, DialogTitle as A, RefreshIndicator as j, Sheet as M, SheetContent as ee, SheetHeader as te, SheetTitle as ne, Skeleton as N, cn as P, getLazyIcon as F, useConfigDraft as I } from "@object-ui/components";
5
- import * as L from "react";
6
- import { Fragment as re, forwardRef as ie, useCallback as R, useContext as z, useEffect as B, useMemo as V, useRef as ae, useState as H } from "react";
7
- import { AlertCircle as U, ArrowDownIcon as oe, ArrowUpIcon as W, Edit as se, GripVertical as ce, Loader2 as G, MinusIcon as le, RefreshCw as ue, Save as K, Settings as q, X as de } from "lucide-react";
8
- import { DndContext as fe, PointerSensor as pe, closestCenter as me, useSensor as J, useSensors as he } from "@dnd-kit/core";
9
- import { SortableContext as Y, arrayMove as ge, rectSortingStrategy as _e, useSortable as ve, verticalListSortingStrategy as ye } from "@dnd-kit/sortable";
10
- import { CSS as be } from "@dnd-kit/utilities";
11
- import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
12
- import { ResponsiveGridLayout as xe, useContainerWidth as Se } from "react-grid-layout";
1
+ import { ComponentRegistry as e, buildChartSeries as t, buildDatasetDrillFilter as n, buildDatasetFieldHelpers as r, compareToTrendLabelKey as i, computeDrillFilter as a, extractRecords as o, findChartSeriesRow as s, formatDimensionValue as c, formatMeasure as l, isDrillEnabled as u, resolveDateMacros as d, resolveDrillTitle as f, shiftFilterByCompareTo as p } from "@object-ui/core";
2
+ import { SchemaRenderer as m, SchemaRendererContext as h, useActionEngine as g, useDataScope as _, useDnd as v, useDrillNavigation as y, useHasDndProvider as b, useObjectLabel as x } from "@object-ui/react";
3
+ import { createSafeTranslation as S, resolveFieldCurrency as C, useLocalization as w, useObjectTranslation as T, useSafeFieldLabel as E, useSafeTranslate as D } from "@object-ui/i18n";
4
+ import { Button as O, Card as k, CardContent as A, CardHeader as j, CardTitle as M, Combobox as N, ConfigPanelRenderer as P, ConfigRow as F, DataEmptyState as I, Dialog as L, DialogContent as R, DialogHeader as ee, DialogTitle as te, RefreshIndicator as ne, Sheet as z, SheetContent as re, SheetHeader as ie, SheetTitle as ae, Skeleton as B, cn as V, getLazyIcon as oe, useConfigDraft as se } from "@object-ui/components";
5
+ import * as H from "react";
6
+ import U, { Fragment as ce, forwardRef as le, useCallback as W, useContext as ue, useEffect as G, useMemo as K, useRef as de, useState as q } from "react";
7
+ import { AlertCircle as fe, AlertTriangle as J, ArrowDownIcon as pe, ArrowUpIcon as me, ArrowUpRight as he, BarChart3 as ge, Download as Y, Edit as _e, GripVertical as ve, Loader2 as X, MinusIcon as ye, RefreshCw as be, Save as xe, Settings as Se, X as Ce } from "lucide-react";
8
+ import { DndContext as we, PointerSensor as Te, closestCenter as Ee, useSensor as De, useSensors as Oe } from "@dnd-kit/core";
9
+ import { SortableContext as ke, arrayMove as Ae, rectSortingStrategy as je, useSortable as Me, verticalListSortingStrategy as Ne } from "@dnd-kit/sortable";
10
+ import { CSS as Pe } from "@dnd-kit/utilities";
11
+ import { formatCurrency as Fe, formatDate as Ie, formatPercent as Le, getCellRenderer as Re, resolveCellRendererType as ze } from "@object-ui/fields";
12
+ import { Fragment as Be, jsx as Z, jsxs as Q } from "react/jsx-runtime";
13
+ import { ResponsiveGridLayout as Ve, useContainerWidth as He } from "react-grid-layout";
13
14
  import "react-grid-layout/css/styles.css";
14
- import { formatCurrency as Ce, formatDate as we, formatPercent as Te, getCellRenderer as Ee, resolveCellRendererType as De } from "@object-ui/fields";
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 Oe(e, t) {
19
+ function Ue(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,
@@ -37,16 +37,866 @@ function Oe(e, t) {
37
37
  };
38
38
  }
39
39
  //#endregion
40
+ //#region src/recordFields.tsx
41
+ var We = new Set([
42
+ "id",
43
+ "organization_id",
44
+ "tenant_id",
45
+ "created_at",
46
+ "updated_at",
47
+ "created_by",
48
+ "updated_by",
49
+ "deleted_at",
50
+ "deleted_by",
51
+ "version",
52
+ "_id",
53
+ "__typename"
54
+ ]);
55
+ function Ge(e, t) {
56
+ return t && (t.isSystem === !0 || t.system === !0) ? !0 : We.has(e);
57
+ }
58
+ var Ke = new Set([
59
+ "select",
60
+ "picklist",
61
+ "dropdown",
62
+ "status"
63
+ ]), qe = new Set([
64
+ "currency",
65
+ "money",
66
+ "number",
67
+ "integer",
68
+ "decimal",
69
+ "float",
70
+ "percent",
71
+ "percentage"
72
+ ]);
73
+ function Je(e) {
74
+ let t = {}, n = e?.fields;
75
+ if (!n) return t;
76
+ if (Array.isArray(n)) for (let e of n) e?.name && (t[e.name] = e);
77
+ else for (let [e, r] of Object.entries(n)) t[e] = {
78
+ name: e,
79
+ ...r
80
+ };
81
+ return t;
82
+ }
83
+ function Ye(e) {
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 && Ke.has(r?.type) && (c = c.map((e) => {
86
+ if (e == null) return e;
87
+ let n = typeof e == "object" ? e.value : e, r = typeof e == "object" && e.label || String(n);
88
+ return {
89
+ value: n,
90
+ label: a(i, t, String(n), r),
91
+ color: typeof e == "object" ? e.color : void 0
92
+ };
93
+ })), {
94
+ name: t,
95
+ label: n,
96
+ type: o.type ?? r?.type,
97
+ options: c,
98
+ referenceTo: s,
99
+ format: o.format ?? r?.format,
100
+ currency: o.currency ?? r?.currency ?? r?.defaultCurrency,
101
+ decimals: o.decimals ?? r?.decimals ?? r?.precision ?? r?.scale
102
+ };
103
+ }
104
+ function Xe(e) {
105
+ return qe.has(e.type) || typeof e.format == "string" && /^[\$¥€£]|%$|0/.test(e.format);
106
+ }
107
+ function Ze(e, t, n) {
108
+ if (e == null || e === "") return "";
109
+ let r = t.format;
110
+ if (typeof r == "string" && /^\$|¥|€|£/.test(r) && typeof e == "number") {
111
+ let i = {
112
+ $: "USD",
113
+ "¥": "JPY",
114
+ "€": "EUR",
115
+ "£": "GBP"
116
+ }[r[0]];
117
+ return Fe(e, t.currency || i || n);
118
+ }
119
+ if (typeof r == "string" && /%/.test(r) && typeof e == "number") {
120
+ let t = (r.match(/0\.(0+)%/) || [, ""])[1].length;
121
+ return Le((e > 1 ? e / 100 : e) * 100, t);
122
+ }
123
+ return typeof r == "string" && /[YMDHms]/.test(r) ? Ie(e, r) : /* @__PURE__ */ Z(Re(ze(t)), {
124
+ value: e,
125
+ field: t
126
+ });
127
+ }
128
+ //#endregion
129
+ //#region src/RecordDetailDrawer.tsx
130
+ var Qe = [
131
+ "name",
132
+ "title",
133
+ "label",
134
+ "subject",
135
+ "display_name",
136
+ "full_name"
137
+ ];
138
+ function $e(e, t) {
139
+ if (t && t.trim()) return t;
140
+ for (let t of Qe) {
141
+ let n = e[t];
142
+ if (typeof n == "string" && n.trim()) return n;
143
+ }
144
+ let n = e.id ?? e._id;
145
+ return n == null ? "Record" : String(n);
146
+ }
147
+ var et = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
148
+ let { fieldLabel: s, fieldOptionLabel: c } = E(), { currency: l } = w(), u = K(() => {
149
+ if (!e) return [];
150
+ let i = Je(n), a;
151
+ return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !Ge(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !Ge(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 = Ye({
153
+ accessorKey: n,
154
+ label: o,
155
+ def: r,
156
+ objectName: t,
157
+ fieldOptionLabel: c
158
+ });
159
+ return {
160
+ key: n,
161
+ label: o,
162
+ node: Ze(e[n], u, l),
163
+ numeric: Xe(u)
164
+ };
165
+ });
166
+ }, [
167
+ e,
168
+ n,
169
+ t,
170
+ r,
171
+ s,
172
+ c,
173
+ l
174
+ ]);
175
+ if (!e) return null;
176
+ let d = $e(e, i), f = /* @__PURE__ */ Z("dl", {
177
+ className: "divide-y divide-border/60",
178
+ "data-testid": "record-detail-body",
179
+ children: u.map((e) => /* @__PURE__ */ Q("div", {
180
+ className: "grid grid-cols-3 gap-3 py-2.5",
181
+ children: [/* @__PURE__ */ Z("dt", {
182
+ className: "text-xs font-medium text-muted-foreground self-center",
183
+ children: e.label
184
+ }), /* @__PURE__ */ Z("dd", {
185
+ className: `col-span-2 text-sm break-words ${e.numeric ? "tabular-nums" : ""}`,
186
+ children: e.node === "" || e.node == null ? /* @__PURE__ */ Z("span", {
187
+ className: "text-muted-foreground/60",
188
+ children: "—"
189
+ }) : e.node
190
+ })]
191
+ }, e.key))
192
+ });
193
+ return a === "dialog" ? /* @__PURE__ */ Z(L, {
194
+ open: !0,
195
+ onOpenChange: (e) => !e && o(),
196
+ children: /* @__PURE__ */ Q(R, {
197
+ className: "max-w-2xl",
198
+ children: [/* @__PURE__ */ Z(ee, { children: /* @__PURE__ */ Z(te, { children: d }) }), /* @__PURE__ */ Z("div", {
199
+ className: "max-h-[70vh] overflow-auto",
200
+ children: f
201
+ })]
202
+ })
203
+ }) : /* @__PURE__ */ Z(z, {
204
+ open: !0,
205
+ onOpenChange: (e) => !e && o(),
206
+ children: /* @__PURE__ */ Q(re, {
207
+ side: "right",
208
+ className: "w-full sm:max-w-md md:max-w-lg flex flex-col",
209
+ children: [/* @__PURE__ */ Z(ie, { children: /* @__PURE__ */ Z(ae, { children: d }) }), /* @__PURE__ */ Z("div", {
210
+ className: "flex-1 overflow-auto mt-2 pr-1",
211
+ children: f
212
+ })]
213
+ })
214
+ });
215
+ };
216
+ //#endregion
217
+ //#region src/ObjectDataTable.tsx
218
+ function tt(e) {
219
+ return e.map((e) => typeof e == "string" ? {
220
+ header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
221
+ accessorKey: e
222
+ } : e);
223
+ }
224
+ function nt(e, t) {
225
+ if (!t?.fields) return [];
226
+ let n = {};
227
+ if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
228
+ else for (let [e, r] of Object.entries(t.fields)) n[e] = {
229
+ name: e,
230
+ ...r
231
+ };
232
+ let r = (e) => e === "lookup" || e === "reference" || e === "master_detail" || e === "user" || e === "owner", i = Array.isArray(e.columns) ? e.columns : [], a = /* @__PURE__ */ new Set();
233
+ if (i.length > 0) {
234
+ let e = i.map((e) => typeof e == "string" ? e : e.accessorKey || e.name).filter(Boolean);
235
+ for (let t of e) {
236
+ let e = n[t];
237
+ e && r(e.type) && a.add(t);
238
+ }
239
+ } else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
240
+ return Array.from(a);
241
+ }
242
+ var rt = ({ schema: e, dataSource: t, className: n }) => {
243
+ let { currency: r } = w(), i = ue(h), a = t || i?.dataSource, s = _(e.bind), { fieldLabel: c, fieldOptionLabel: l } = E(), f = "No data available", p = "No data source available for";
244
+ try {
245
+ let { t: e } = T(), t = e("dashboard.noDataAvailable");
246
+ t && t !== "dashboard.noDataAvailable" && (f = t);
247
+ let n = e("dashboard.noDataSourceFor");
248
+ n && n !== "dashboard.noDataSourceFor" && (p = n);
249
+ } catch {}
250
+ let [g, v] = q([]), [y, b] = q(null), [x, S] = q(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, D] = q(null), O = e.drillDown, k = u(O) && (O?.mode ?? "record") === "record", [A, j] = q(null), M = W((e) => {
251
+ j(e ?? null);
252
+ }, []);
253
+ G(() => {
254
+ let t = !0;
255
+ return e.objectName && !s && (!e.data || e.data.length === 0) ? (async () => {
256
+ if (!a || !e.objectName) {
257
+ t && S(!1);
258
+ return;
259
+ }
260
+ t && (S(!0), D(null));
261
+ try {
262
+ let n;
263
+ if (typeof a.find == "function") {
264
+ let t = nt(e, y), r = { $filter: d(e.filter) };
265
+ t.length && (r.$expand = t), n = o(await a.find(e.objectName, r));
266
+ } else return;
267
+ t && v(n);
268
+ } catch (e) {
269
+ console.error("[ObjectDataTable] Fetch error:", e), t && D(e instanceof Error ? e.message : "Failed to load data");
270
+ } finally {
271
+ t && S(!1);
272
+ }
273
+ })() : t && S(!1), () => {
274
+ t = !1;
275
+ };
276
+ }, [
277
+ e.objectName,
278
+ a,
279
+ s,
280
+ e.data,
281
+ e.filter,
282
+ y
283
+ ]), G(() => {
284
+ let t = !0;
285
+ if (!(!a || !e.objectName || typeof a.getObjectSchema != "function")) return a.getObjectSchema(e.objectName).then((e) => {
286
+ t && b(e);
287
+ }).catch(() => {}), () => {
288
+ t = !1;
289
+ };
290
+ }, [e.objectName, a]);
291
+ let N = s || e.data || g, P = Array.isArray(N) ? N : [], F = K(() => {
292
+ let t = e.objectName, n = {};
293
+ if (y?.fields) {
294
+ let e = y.fields;
295
+ if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
296
+ else for (let [t, r] of Object.entries(e)) n[t] = {
297
+ name: t,
298
+ ...r
299
+ };
300
+ }
301
+ let i = (e) => {
302
+ let n = e.charAt(0).toUpperCase() + e.slice(1).replace(/([A-Z])/g, " $1");
303
+ return t ? c(t, e, n) : n;
304
+ }, a = (e) => {
305
+ let i = Ye({
306
+ accessorKey: e.accessorKey,
307
+ label: e.header,
308
+ def: n[e.accessorKey],
309
+ objectName: t,
310
+ fieldOptionLabel: l,
311
+ overrides: {
312
+ type: e.type,
313
+ format: e.format,
314
+ options: e.options,
315
+ referenceTo: e.referenceTo,
316
+ currency: e.currency,
317
+ decimals: e.decimals
318
+ }
319
+ }), a = e.align ?? (Xe(i) ? "right" : void 0);
320
+ if (typeof e.cell == "function") return {
321
+ ...e,
322
+ ...i,
323
+ align: a
324
+ };
325
+ let o = (e) => Ze(e, i, r);
326
+ return {
327
+ ...e,
328
+ ...i,
329
+ align: a,
330
+ cell: o
331
+ };
332
+ };
333
+ if (e.columns && e.columns.length > 0) {
334
+ let n = tt(e.columns);
335
+ return (t ? n.map((e) => ({
336
+ ...e,
337
+ header: c(t, e.accessorKey, e.header)
338
+ })) : n).map(a);
339
+ }
340
+ return P.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !Ge(e, n[e])) : Object.keys(P[0]).filter((e) => !e.startsWith("_") && !Ge(e))).map((e) => a({
341
+ header: i(e),
342
+ accessorKey: e
343
+ }));
344
+ }, [
345
+ e.columns,
346
+ e.objectName,
347
+ P,
348
+ y,
349
+ c,
350
+ l,
351
+ r
352
+ ]);
353
+ if (x && P.length === 0) return /* @__PURE__ */ Z("div", {
354
+ className: V("overflow-auto", n),
355
+ "data-testid": "table-loading",
356
+ children: /* @__PURE__ */ Q("div", {
357
+ className: "space-y-2 p-2",
358
+ children: [/* @__PURE__ */ Q("div", {
359
+ className: "flex gap-2",
360
+ children: [
361
+ /* @__PURE__ */ Z(B, { className: "h-6 w-1/4" }),
362
+ /* @__PURE__ */ Z(B, { className: "h-6 w-1/4" }),
363
+ /* @__PURE__ */ Z(B, { className: "h-6 w-1/4" }),
364
+ /* @__PURE__ */ Z(B, { className: "h-6 w-1/4" })
365
+ ]
366
+ }), [
367
+ 1,
368
+ 2,
369
+ 3,
370
+ 4
371
+ ].map((e) => /* @__PURE__ */ Q("div", {
372
+ className: "flex gap-2",
373
+ children: [
374
+ /* @__PURE__ */ Z(B, { className: "h-5 w-1/4" }),
375
+ /* @__PURE__ */ Z(B, { className: "h-5 w-1/4" }),
376
+ /* @__PURE__ */ Z(B, { className: "h-5 w-1/4" }),
377
+ /* @__PURE__ */ Z(B, { className: "h-5 w-1/4" })
378
+ ]
379
+ }, e))]
380
+ })
381
+ });
382
+ if (C) return /* @__PURE__ */ Z("div", {
383
+ className: V("overflow-auto", n),
384
+ "data-testid": "table-error",
385
+ children: /* @__PURE__ */ Q("div", {
386
+ className: "flex flex-col items-center justify-center py-8 text-destructive",
387
+ "data-testid": "table-error-message",
388
+ children: [/* @__PURE__ */ Q("svg", {
389
+ xmlns: "http://www.w3.org/2000/svg",
390
+ className: "h-8 w-8 mb-2 opacity-60",
391
+ viewBox: "0 0 24 24",
392
+ fill: "none",
393
+ stroke: "currentColor",
394
+ strokeWidth: "1.5",
395
+ strokeLinecap: "round",
396
+ strokeLinejoin: "round",
397
+ children: [
398
+ /* @__PURE__ */ Z("circle", {
399
+ cx: "12",
400
+ cy: "12",
401
+ r: "10"
402
+ }),
403
+ /* @__PURE__ */ Z("line", {
404
+ x1: "12",
405
+ y1: "8",
406
+ x2: "12",
407
+ y2: "12"
408
+ }),
409
+ /* @__PURE__ */ Z("line", {
410
+ x1: "12",
411
+ y1: "16",
412
+ x2: "12.01",
413
+ y2: "16"
414
+ })
415
+ ]
416
+ }), /* @__PURE__ */ Z("p", {
417
+ className: "text-xs",
418
+ children: C
419
+ })]
420
+ })
421
+ });
422
+ if (!a && e.objectName && P.length === 0) return /* @__PURE__ */ Z("div", {
423
+ className: V("overflow-auto", n),
424
+ children: /* @__PURE__ */ Z("div", {
425
+ className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
426
+ children: /* @__PURE__ */ Q("p", {
427
+ className: "text-xs",
428
+ children: [
429
+ p,
430
+ " “",
431
+ e.objectName,
432
+ "”"
433
+ ]
434
+ })
435
+ })
436
+ });
437
+ if (P.length === 0) return /* @__PURE__ */ Z("div", {
438
+ className: V("overflow-auto", n),
439
+ "data-testid": "table-empty-state",
440
+ children: /* @__PURE__ */ Q("div", {
441
+ className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
442
+ children: [/* @__PURE__ */ Q("svg", {
443
+ xmlns: "http://www.w3.org/2000/svg",
444
+ className: "h-8 w-8 mb-2 opacity-40",
445
+ viewBox: "0 0 24 24",
446
+ fill: "none",
447
+ stroke: "currentColor",
448
+ strokeWidth: "1.5",
449
+ strokeLinecap: "round",
450
+ strokeLinejoin: "round",
451
+ children: [
452
+ /* @__PURE__ */ Z("rect", {
453
+ x: "3",
454
+ y: "3",
455
+ width: "18",
456
+ height: "18",
457
+ rx: "2",
458
+ ry: "2"
459
+ }),
460
+ /* @__PURE__ */ Z("line", {
461
+ x1: "3",
462
+ y1: "9",
463
+ x2: "21",
464
+ y2: "9"
465
+ }),
466
+ /* @__PURE__ */ Z("line", {
467
+ x1: "9",
468
+ y1: "21",
469
+ x2: "9",
470
+ y2: "9"
471
+ })
472
+ ]
473
+ }), /* @__PURE__ */ Z("p", {
474
+ className: "text-xs",
475
+ children: f
476
+ })]
477
+ })
478
+ });
479
+ let I = {
480
+ ...e,
481
+ type: "data-table",
482
+ data: P,
483
+ columns: F,
484
+ onRowClick: e.onRowClick ?? (k ? M : void 0)
485
+ }, L = O?.title && !O.title.includes("${") ? O.title : void 0;
486
+ return /* @__PURE__ */ Q("div", {
487
+ className: V("relative", n),
488
+ children: [
489
+ /* @__PURE__ */ Z(ne, { active: x && P.length > 0 }),
490
+ /* @__PURE__ */ Z(m, {
491
+ schema: I,
492
+ className: n
493
+ }),
494
+ k && /* @__PURE__ */ Z(et, {
495
+ record: A,
496
+ objectName: e.objectName,
497
+ objectSchema: y,
498
+ fields: O?.columns,
499
+ title: L,
500
+ target: O?.target === "dialog" ? "dialog" : "drawer",
501
+ onClose: () => j(null)
502
+ })
503
+ ]
504
+ });
505
+ }, it = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
506
+ let { openRecordList: i } = y(), a = D();
507
+ return !i || !e ? null : /* @__PURE__ */ Q(O, {
508
+ type: "button",
509
+ variant: "ghost",
510
+ size: "sm",
511
+ className: r,
512
+ "data-testid": "drill-open-in-list",
513
+ onClick: () => {
514
+ i(e, t), n?.();
515
+ },
516
+ children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Z(he, { className: "ml-1 h-3.5 w-3.5" })]
517
+ });
518
+ }, at = ({ 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 } = y(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
520
+ if (U.useEffect(() => {
521
+ e && p && (d(i, a), t());
522
+ }, [e, p]), p) return null;
523
+ let h = f ? null : /* @__PURE__ */ Z(it, {
524
+ objectName: i,
525
+ filter: a,
526
+ onNavigate: t
527
+ }), g = /* @__PURE__ */ Z("div", {
528
+ className: V("overflow-auto", l),
529
+ "data-testid": "drill-down-body",
530
+ children: f ? (() => {
531
+ let e = u.filter, t = e ? a ? { $and: [e, a] } : e : a;
532
+ return /* @__PURE__ */ Z(m, { schema: {
533
+ ...u,
534
+ type: "spec-report",
535
+ report: {
536
+ ...u,
537
+ filter: t
538
+ },
539
+ filter: t
540
+ } });
541
+ })() : /* @__PURE__ */ Z(rt, {
542
+ schema: {
543
+ type: "object-data-table",
544
+ objectName: i,
545
+ filter: a,
546
+ columns: s?.map((e) => ({
547
+ accessorKey: e,
548
+ header: e
549
+ })),
550
+ pagination: !0,
551
+ searchable: !1,
552
+ pageSize: c,
553
+ drillDown: {
554
+ enabled: !0,
555
+ mode: "record",
556
+ target: "dialog"
557
+ }
558
+ },
559
+ dataSource: o
560
+ })
561
+ });
562
+ return r === "dialog" ? /* @__PURE__ */ Z(L, {
563
+ open: e,
564
+ onOpenChange: (e) => !e && t(),
565
+ children: /* @__PURE__ */ Q(R, {
566
+ className: "max-w-5xl",
567
+ children: [/* @__PURE__ */ Q(ee, {
568
+ className: "flex-row items-center justify-between gap-4 pr-8",
569
+ children: [/* @__PURE__ */ Z(te, { children: n }), h]
570
+ }), g]
571
+ })
572
+ }) : /* @__PURE__ */ Z(z, {
573
+ open: e,
574
+ onOpenChange: (e) => !e && t(),
575
+ children: /* @__PURE__ */ Q(re, {
576
+ side: "right",
577
+ className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
578
+ children: [/* @__PURE__ */ Q(ie, {
579
+ className: "flex-row items-center justify-between gap-4 pr-8",
580
+ children: [/* @__PURE__ */ Z(ae, { children: n }), h]
581
+ }), /* @__PURE__ */ Z("div", {
582
+ className: "flex-1 overflow-hidden mt-2",
583
+ children: g
584
+ })]
585
+ })
586
+ });
587
+ }, ot = n;
588
+ function st(e, t, n) {
589
+ let r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
590
+ return e.forEach((e, l) => {
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) => c(e[t]))
595
+ })), o.has(d) || (o.add(d), i.push({
596
+ id: d,
597
+ label: c(e[n])
598
+ })), s.set(`${u} ${d}`, l);
599
+ }), {
600
+ rowHeaders: r,
601
+ colHeaders: i,
602
+ cellIndex: s
603
+ };
604
+ }
605
+ function ct(e) {
606
+ if (e == null) return "";
607
+ let t = String(e);
608
+ return /[",\n\r]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
609
+ }
610
+ function lt(e) {
611
+ return e.map((e) => e.map(ct).join(",")).join("\r\n");
612
+ }
613
+ function ut(e, t) {
614
+ if (typeof document > "u") return;
615
+ let n = e && e.trim() ? e.trim() : "export", r = new Blob([`${lt(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
616
+ a.href = i, a.download = n.endsWith(".csv") ? n : `${n}.csv`, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
617
+ }
618
+ var dt = new Set([
619
+ "metric",
620
+ "kpi",
621
+ "gauge",
622
+ "solid-gauge",
623
+ "bullet"
624
+ ]), ft = {
625
+ bar: "bar",
626
+ column: "column",
627
+ "horizontal-bar": "horizontal-bar",
628
+ "grouped-bar": "bar",
629
+ "stacked-bar": "bar",
630
+ "bi-polar-bar": "bar",
631
+ line: "line",
632
+ spline: "line",
633
+ "step-line": "line",
634
+ area: "area",
635
+ "stacked-area": "area",
636
+ pie: "pie",
637
+ donut: "donut",
638
+ funnel: "funnel",
639
+ pyramid: "funnel",
640
+ scatter: "scatter",
641
+ bubble: "scatter",
642
+ radar: "radar",
643
+ treemap: "treemap",
644
+ sankey: "sankey"
645
+ };
646
+ function pt({ widget: e, dataSource: n }) {
647
+ let i = String(e?.dataset ?? ""), a = K(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), o = K(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), u = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, f = String(e?.type ?? ""), p = dt.has(f) || a.length === 0, h = f === "table" || f === "pivot", g = f === "pivot" && a.length >= 2, _ = g ? a.slice(0, -1) : [], v = g ? a[a.length - 1] : "", y = g ? [
648
+ _,
649
+ [v],
650
+ []
651
+ ] : void 0, b = D(), { fieldLabel: x } = E(), S = e?.filter, C = K(() => S && typeof S == "object" && Object.keys(S).length > 0 ? d(S) : void 0, [S]), [w, T] = q({
652
+ status: "idle",
653
+ rows: []
654
+ }), [O, k] = q(null);
655
+ if (G(() => {
656
+ let e = n;
657
+ if (!e || typeof e.queryDataset != "function") {
658
+ T({
659
+ status: "error",
660
+ rows: [],
661
+ error: b("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
662
+ });
663
+ return;
664
+ }
665
+ if (o.length === 0) {
666
+ T({
667
+ status: "idle",
668
+ rows: []
669
+ });
670
+ return;
671
+ }
672
+ let t = !1;
673
+ return T({
674
+ status: "loading",
675
+ rows: []
676
+ }), e.queryDataset(i, {
677
+ dimensions: a,
678
+ measures: o,
679
+ ...C ? { runtimeFilter: C } : {},
680
+ ...u ? { compareTo: u } : {},
681
+ ...y ? { totals: { groupings: y } } : {}
682
+ }).then((e) => {
683
+ t || T({
684
+ status: "ok",
685
+ rows: Array.isArray(e?.rows) ? e.rows : [],
686
+ fields: Array.isArray(e?.fields) ? e.fields : [],
687
+ object: e?.object,
688
+ dimensionFields: e?.dimensionFields,
689
+ drillRawRows: Array.isArray(e?.drillRawRows) ? e.drillRawRows : void 0,
690
+ totals: Array.isArray(e?.totals) ? e.totals : void 0
691
+ });
692
+ }).catch((e) => {
693
+ t || T({
694
+ status: "error",
695
+ rows: [],
696
+ error: String(e?.message ?? e)
697
+ });
698
+ }), () => {
699
+ t = !0;
700
+ };
701
+ }, [`${f}|${i}|${a.join(",")}|${o.join(",")}|${JSON.stringify(S ?? null)}|${JSON.stringify(u ?? null)}`]), o.length === 0) return /* @__PURE__ */ Z("div", {
702
+ className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
703
+ children: b("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
704
+ });
705
+ if (w.status === "loading" || w.status === "idle") return /* @__PURE__ */ Z("div", {
706
+ className: "flex h-full w-full items-center justify-center p-4 text-muted-foreground",
707
+ children: /* @__PURE__ */ Z(X, { className: "h-4 w-4 animate-spin" })
708
+ });
709
+ if (w.status === "error") return /* @__PURE__ */ Q("div", {
710
+ role: "alert",
711
+ className: "flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive",
712
+ children: [/* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Z("span", {
713
+ className: "break-words",
714
+ children: w.error
715
+ })]
716
+ });
717
+ if (w.rows.length === 0 && !p) return /* @__PURE__ */ Q("div", {
718
+ className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
719
+ children: [/* @__PURE__ */ Z(ge, { className: "mr-2 h-4 w-4" }), b("dashboard.noRows", "No rows")]
720
+ });
721
+ let { measureField: A, headerLabel: j } = r(w.fields, w.object, x), { object: M, dimensionFields: N, drillRawRows: P } = w, F = N ? a.filter((e) => e in N) : [], I = !!M && F.length > 0, L = (t, n) => {
722
+ !M || !N || k({
723
+ filter: ot(P?.[t], F, N, C),
724
+ title: n || String(e?.title ?? "")
725
+ });
726
+ }, R = O && M ? /* @__PURE__ */ Z(at, {
727
+ open: !0,
728
+ onClose: () => k(null),
729
+ title: O.title || String(e?.title ?? b("dashboard.details", "Details")),
730
+ objectName: M,
731
+ filter: O.filter,
732
+ dataSource: n
733
+ }) : null;
734
+ if (p) {
735
+ let e = A(o[0]);
736
+ return /* @__PURE__ */ Q("div", {
737
+ className: "flex h-full w-full flex-col items-start justify-center gap-1 p-2",
738
+ children: [/* @__PURE__ */ Z("span", {
739
+ className: "text-2xl font-semibold tabular-nums",
740
+ children: l(w.rows[0]?.[o[0]] ?? 0, e?.format, e?.currency)
741
+ }), /* @__PURE__ */ Z("span", {
742
+ className: "text-xs text-muted-foreground",
743
+ children: j(o[0])
744
+ })]
745
+ });
746
+ }
747
+ if (h) {
748
+ let t = [...a, ...o], n = /* @__PURE__ */ Z("button", {
749
+ type: "button",
750
+ onClick: () => ut(String(e?.title ?? i ?? "export"), [t.map((e) => j(e)), ...w.rows.map((e) => t.map((t) => {
751
+ let n = e[t];
752
+ return n == null ? "" : typeof n == "number" ? n : String(n);
753
+ }))]),
754
+ "data-testid": "dataset-export",
755
+ title: b("dashboard.exportCsv", "Export CSV"),
756
+ "aria-label": b("dashboard.exportCsv", "Export CSV"),
757
+ 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",
758
+ children: /* @__PURE__ */ Z(Y, { className: "h-3.5 w-3.5" })
759
+ });
760
+ if (g) {
761
+ let e = st(w.rows, _, v), t = e.colHeaders.flatMap((e) => o.map((t) => ({
762
+ col: e,
763
+ measure: t,
764
+ header: o.length === 1 ? e.label : `${e.label} · ${j(t)}`
765
+ }))), r = (e, t) => l(e, A(t)?.format, A(t)?.currency), i = (e) => w.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
766
+ for (let e of i(_) ?? []) a.set(_.map((t) => String(e[t] ?? "∅")).join(""), e);
767
+ let s = /* @__PURE__ */ new Map();
768
+ for (let e of i([v]) ?? []) s.set(String(e[v] ?? "∅"), e);
769
+ let c = i([])?.[0], u = a.size > 0, d = s.size > 0, f = b("dashboard.total", "Total");
770
+ return /* @__PURE__ */ Q("div", {
771
+ className: "relative h-full w-full overflow-auto p-1",
772
+ "data-testid": "dataset-matrix",
773
+ children: [
774
+ n,
775
+ /* @__PURE__ */ Q("table", {
776
+ className: "w-full text-xs",
777
+ children: [/* @__PURE__ */ Z("thead", {
778
+ className: "bg-muted/40",
779
+ children: /* @__PURE__ */ Q("tr", { children: [
780
+ _.map((e) => /* @__PURE__ */ Z("th", {
781
+ className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
782
+ children: j(e)
783
+ }, e)),
784
+ t.map((e) => /* @__PURE__ */ Z("th", {
785
+ className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
786
+ children: e.header
787
+ }, `${e.col.id}-${e.measure}`)),
788
+ u && o.map((e) => /* @__PURE__ */ Z("th", {
789
+ className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
790
+ "data-testid": "matrix-total-col-header",
791
+ children: o.length === 1 ? f : `${f} · ${j(e)}`
792
+ }, `total-${e}`))
793
+ ] })
794
+ }), /* @__PURE__ */ Q("tbody", { children: [e.rowHeaders.map((n) => /* @__PURE__ */ Q("tr", {
795
+ className: "border-t",
796
+ children: [
797
+ n.labels.map((e, t) => /* @__PURE__ */ Z("td", {
798
+ className: "px-2 py-1 whitespace-nowrap font-medium",
799
+ children: e
800
+ }, t)),
801
+ t.map((t) => {
802
+ let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : w.rows[i], o = I && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
803
+ return /* @__PURE__ */ Z("td", {
804
+ className: V("px-2 py-1 text-right tabular-nums whitespace-nowrap", o && "cursor-pointer hover:bg-accent/40"),
805
+ "data-testid": o ? "dataset-drill-cell" : void 0,
806
+ onClick: o ? () => L(i, s) : void 0,
807
+ children: a ? r(a[t.measure], t.measure) : "—"
808
+ }, `${t.col.id}-${t.measure}`);
809
+ }),
810
+ u && o.map((e) => /* @__PURE__ */ Z("td", {
811
+ className: "px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium",
812
+ "data-testid": "matrix-row-total",
813
+ children: r(a.get(n.id)?.[e], e)
814
+ }, `total-${e}`))
815
+ ]
816
+ }, n.id)), d && /* @__PURE__ */ Q("tr", {
817
+ className: "border-t bg-muted/30 font-medium",
818
+ "data-testid": "matrix-total-row",
819
+ children: [
820
+ _.length > 0 && /* @__PURE__ */ Z("td", {
821
+ colSpan: _.length,
822
+ className: "px-2 py-1 whitespace-nowrap",
823
+ children: f
824
+ }),
825
+ t.map((e) => /* @__PURE__ */ Z("td", {
826
+ className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
827
+ children: r(s.get(e.col.id)?.[e.measure], e.measure)
828
+ }, `${e.col.id}-${e.measure}`)),
829
+ u && o.map((e) => /* @__PURE__ */ Z("td", {
830
+ className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
831
+ "data-testid": "matrix-grand-total",
832
+ children: r(c?.[e], e)
833
+ }, `grand-${e}`))
834
+ ]
835
+ })] })]
836
+ }),
837
+ R
838
+ ]
839
+ });
840
+ }
841
+ let r = [...a, ...o];
842
+ return /* @__PURE__ */ Q("div", {
843
+ className: "relative h-full w-full overflow-auto p-1",
844
+ children: [
845
+ n,
846
+ /* @__PURE__ */ Q("table", {
847
+ className: "w-full text-xs",
848
+ children: [/* @__PURE__ */ Z("thead", {
849
+ className: "bg-muted/40",
850
+ children: /* @__PURE__ */ Z("tr", { children: r.map((e) => /* @__PURE__ */ Z("th", {
851
+ className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
852
+ children: j(e)
853
+ }, e)) })
854
+ }), /* @__PURE__ */ Z("tbody", { children: w.rows.map((e, t) => /* @__PURE__ */ Z("tr", {
855
+ className: V("border-t", I && "cursor-pointer hover:bg-accent/40"),
856
+ "data-testid": I ? "dataset-drill-row" : void 0,
857
+ onClick: I ? () => L(t, F.map((t) => c(e[t])).filter(Boolean).join(" / ")) : void 0,
858
+ children: r.map((t) => /* @__PURE__ */ Z("td", {
859
+ className: "px-2 py-1 whitespace-nowrap tabular-nums",
860
+ children: o.includes(t) ? l(e[t], A(t)?.format, A(t)?.currency) : c(e[t])
861
+ }, t))
862
+ }, t)) })]
863
+ }),
864
+ R
865
+ ]
866
+ });
867
+ }
868
+ let ee = ft[f] ?? "bar", { data: te, xAxisKey: ne, series: z } = t(w.rows, a, o, w.fields), re = I ? (e) => {
869
+ let t = s(w.rows, a, o, e?.category, e?.series);
870
+ if (t < 0) return;
871
+ let n = a.length >= 2 && o.length === 1;
872
+ L(t, [e?.category, n ? e?.series : void 0].filter(Boolean).map(String).join(" / "));
873
+ } : void 0;
874
+ return /* @__PURE__ */ Q("div", {
875
+ className: V("relative h-full w-full min-h-[220px]"),
876
+ children: [/* @__PURE__ */ Z(m, {
877
+ schema: {
878
+ type: "chart",
879
+ chartType: ee,
880
+ data: te,
881
+ xAxisKey: ne,
882
+ series: z
883
+ },
884
+ onChartClick: re,
885
+ onSegmentClick: re
886
+ }), R]
887
+ });
888
+ }
889
+ //#endregion
40
890
  //#region src/DashboardRenderer.tsx
41
- function ke({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
42
- let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = ve({
891
+ function mt({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
892
+ let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = Me({
43
893
  id: e,
44
894
  disabled: t
45
895
  });
46
896
  return /* @__PURE__ */ Z("div", {
47
897
  ref: s,
48
898
  style: {
49
- transform: be.Transform.toString(c),
899
+ transform: Pe.Transform.toString(c),
50
900
  transition: l,
51
901
  opacity: u ? .4 : 1,
52
902
  ...n ? {
@@ -54,39 +904,81 @@ function ke({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
54
904
  gridRow: `span ${n.h}`
55
905
  } : {}
56
906
  },
57
- className: P("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
907
+ className: V("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
58
908
  "data-sortable-widget-id": e,
59
909
  ...a,
60
910
  ...o,
61
911
  children: i
62
912
  });
63
913
  }
64
- function Ae(e) {
65
- return e ? F(e) : null;
914
+ function ht(e) {
915
+ return e ? oe(e) : null;
66
916
  }
67
- function je(e) {
917
+ function gt(e) {
68
918
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
69
919
  }
70
- var Me = [
920
+ var _t = [
71
921
  "hsl(var(--chart-1))",
72
922
  "hsl(var(--chart-2))",
73
923
  "hsl(var(--chart-3))",
74
924
  "hsl(var(--chart-4))",
75
925
  "hsl(var(--chart-5))"
76
- ], Ne = new Set([
926
+ ], vt = {
927
+ column: "bar",
928
+ "stacked-bar": "bar",
929
+ "grouped-bar": "bar",
930
+ "bi-polar-bar": "bar",
931
+ spline: "line",
932
+ "step-line": "line",
933
+ "stacked-area": "area",
934
+ pyramid: "funnel",
935
+ bubble: "scatter"
936
+ }, yt = new Set([
77
937
  "bar",
78
938
  "horizontal-bar",
79
939
  "line",
80
940
  "area",
81
941
  "pie",
82
942
  "donut",
83
- "funnel"
943
+ "scatter",
944
+ "funnel",
945
+ "radar",
946
+ "treemap",
947
+ "sankey"
948
+ ]), bt = new Set([
949
+ "gauge",
950
+ "solid-gauge",
951
+ "kpi",
952
+ "bullet"
953
+ ]), xt = new Set([
954
+ "sunburst",
955
+ "word-cloud",
956
+ "choropleth",
957
+ "bubble-map",
958
+ "gl-map",
959
+ "heatmap",
960
+ "waterfall",
961
+ "box-plot",
962
+ "violin",
963
+ "candlestick",
964
+ "stock"
965
+ ]), St = new Set([
966
+ "bar",
967
+ "horizontal-bar",
968
+ "line",
969
+ "area",
970
+ "pie",
971
+ "donut",
972
+ "funnel",
973
+ "scatter",
974
+ "treemap",
975
+ "sankey"
84
976
  ]);
85
- function Pe(e) {
86
- return Ne.has(e) ? { enabled: !0 } : void 0;
977
+ function Ct(e) {
978
+ return St.has(e) ? { enabled: !0 } : void 0;
87
979
  }
88
- var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: s, onWidgetClick: l, onWidgetsReorder: d, modalHandler: f, scriptHandlers: p, hideHeaderText: h, ..._ }, C) => {
89
- let w = (() => {
980
+ var wt = 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 }, h) => {
981
+ let _ = (() => {
90
982
  if (e.columns != null) return e.columns;
91
983
  let t = e.widgets ?? [], n = 0;
92
984
  for (let e of t) {
@@ -94,77 +986,77 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
94
986
  t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
95
987
  }
96
988
  return n > 4 ? 12 : 4;
97
- })(), T = w, E = e.gap || 4, [D, O] = H(!1), [k, A] = H(!1), j = ae(null), { executeAction: M, engine: ee } = u({ actions: V(() => (e.header?.actions ?? []).map((e) => ({
989
+ })(), v = _, y = e.gap || 4, [b, S] = q(!1), [C, w] = q(!1), E = de(null), { executeAction: D, engine: N } = g({ actions: K(() => (e.header?.actions ?? []).map((e) => ({
98
990
  name: e.actionUrl || e.label,
99
991
  type: e.actionType || "url",
100
992
  target: e.actionUrl,
101
993
  label: e.label
102
- })), [e.header?.actions]) }), { dashboardLabel: te, dashboardDescription: ne, dashboardActionLabel: N, widgetTitle: F, widgetDescription: I, fieldLabel: L } = m(), { t: ie } = g(), z = R((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? ie(`report.aggregate.${n}`, { defaultValue: n }) : e ? L(e, t, t) : t, [ie, L]), U = e.name, oe = R((e) => U ? N(U, e.actionUrl || e.label, e.label) : e.label, [U, N]), W = R((e) => {
103
- let t = je(e.title);
104
- return !U || !e.id || t === void 0 ? t : F(U, e.id, t);
105
- }, [U, F]), se = R((e) => {
106
- let t = je(e.description);
107
- return !U || !e.id ? t : I(U, e.id, t);
108
- }, [U, I]);
109
- B(() => {
110
- let e = ee.getRunner();
111
- if (f && e.setModalHandler(f), p) for (let [t, n] of Object.entries(p)) e.registerScript(t, n);
994
+ })), [e.header?.actions]) }), { dashboardLabel: P, dashboardDescription: F, dashboardActionLabel: I, widgetTitle: L, widgetDescription: R, fieldLabel: ee } = x(), { t: te } = T(), ne = W((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? te(`report.aggregate.${n}`, { defaultValue: n }) : e ? ee(e, t, t) : t, [te, ee]), z = e.name, re = W((e) => z ? I(z, e.actionUrl || e.label, e.label) : e.label, [z, I]), ie = W((e) => {
995
+ let t = gt(e.title);
996
+ return !z || !e.id || t === void 0 ? t : L(z, e.id, t);
997
+ }, [z, L]), ae = W((e) => {
998
+ let t = gt(e.description);
999
+ return !z || !e.id ? t : R(z, e.id, t);
1000
+ }, [z, R]);
1001
+ G(() => {
1002
+ let e = N.getRunner();
1003
+ if (u && e.setModalHandler(u), d) for (let [t, n] of Object.entries(d)) e.registerScript(t, n);
112
1004
  }, [
113
- ee,
114
- f,
115
- p
116
- ]), B(() => {
117
- let e = () => A(window.innerWidth < 768);
1005
+ N,
1006
+ u,
1007
+ d
1008
+ ]), G(() => {
1009
+ let e = () => w(window.innerWidth < 768);
118
1010
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
119
1011
  }, []);
120
- let ce = R(() => {
121
- r && (O(!0), r(), setTimeout(() => O(!1), 600));
1012
+ let B = W(() => {
1013
+ r && (S(!0), r(), setTimeout(() => S(!1), 600));
122
1014
  }, [r]);
123
- B(() => {
124
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return j.current = setInterval(ce, e.refreshInterval * 1e3), () => {
125
- j.current && clearInterval(j.current);
1015
+ G(() => {
1016
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return E.current = setInterval(B, e.refreshInterval * 1e3), () => {
1017
+ E.current && clearInterval(E.current);
126
1018
  };
127
1019
  }, [
128
1020
  e.refreshInterval,
129
1021
  r,
130
- ce
1022
+ B
131
1023
  ]);
132
- let G = R((e, t) => {
133
- !o || !l || !t || (e.stopPropagation(), l(t));
134
- }, [o, l]), le = R((t, n, r) => {
135
- if (!o || !l) return;
1024
+ let oe = W((e, t) => {
1025
+ !o || !c || !t || (e.stopPropagation(), c(t));
1026
+ }, [o, c]), se = W((t, n, r) => {
1027
+ if (!o || !c) return;
136
1028
  let i = e.widgets || [];
137
- if (t.key === "Enter" || t.key === " ") t.preventDefault(), l(n ?? null);
1029
+ if (t.key === "Enter" || t.key === " ") t.preventDefault(), c(n ?? null);
138
1030
  else if (t.key === "ArrowRight" || t.key === "ArrowDown") {
139
1031
  t.preventDefault();
140
1032
  let e = r + 1 < i.length ? i[r + 1] : null;
141
- e?.id && l(e.id);
1033
+ e?.id && c(e.id);
142
1034
  } else if (t.key === "ArrowLeft" || t.key === "ArrowUp") {
143
1035
  t.preventDefault();
144
1036
  let e = r - 1 >= 0 ? i[r - 1] : null;
145
- e?.id && l(e.id);
146
- } else t.key === "Escape" && (t.preventDefault(), l(null));
1037
+ e?.id && c(e.id);
1038
+ } else t.key === "Escape" && (t.preventDefault(), c(null));
147
1039
  }, [
148
1040
  o,
149
- l,
1041
+ c,
150
1042
  e.widgets
151
- ]), K = R((e) => {
152
- !o || !l || e.target === e.currentTarget && l(null);
153
- }, [o, l]), q = !!(o && d), de = he(J(pe, { activationConstraint: { distance: 5 } })), ve = R((t) => {
154
- if (!q) return;
1043
+ ]), H = W((e) => {
1044
+ !o || !c || e.target === e.currentTarget && c(null);
1045
+ }, [o, c]), U = !!(o && l), le = Oe(De(Te, { activationConstraint: { distance: 5 } })), ue = W((t) => {
1046
+ if (!U) return;
155
1047
  let { active: n, over: r } = t;
156
1048
  if (!r || n.id === r.id) return;
157
1049
  let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
158
- a < 0 || o < 0 || d?.(ge(i, a, o));
1050
+ a < 0 || o < 0 || l?.(Ae(i, a, o));
159
1051
  }, [
160
- q,
1052
+ U,
161
1053
  e.widgets,
162
- d
163
- ]), be = (e, t, r) => {
1054
+ l
1055
+ ]), fe = (e, t, r) => {
164
1056
  let i = e.layout ? {
165
1057
  ...e.layout,
166
- w: Math.min(e.layout.w, T)
167
- } : void 0, a = (() => {
1058
+ w: Math.min(e.layout.w, v)
1059
+ } : void 0, a = !!e.dataset, c = (() => {
168
1060
  if (e.component) return e.component;
169
1061
  let t = e.type, n = e.options || {};
170
1062
  if (t === "metric" && e.object) {
@@ -182,7 +1074,7 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
182
1074
  objectName: e.object || ($(t) ? t.object : void 0),
183
1075
  aggregate: r,
184
1076
  filter: ($(t) ? t.filter : void 0) || e.filter,
185
- label: n.label || W(e) || "",
1077
+ label: n.label || ie(e) || "",
186
1078
  fallbackValue: n.value,
187
1079
  trend: n.trend,
188
1080
  icon: n.icon,
@@ -193,11 +1085,11 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
193
1085
  prefix: n.prefix,
194
1086
  suffix: n.suffix,
195
1087
  drillDown: n.drillDown ?? { enabled: !0 },
196
- title: n.label || W(e) || "",
1088
+ title: n.label || ie(e) || "",
197
1089
  compareTo: e.compareTo
198
1090
  };
199
1091
  }
200
- if ((t === "gauge" || t === "solid-gauge") && e.object) {
1092
+ if (bt.has(t || "") && e.object) {
201
1093
  let t = e.aggregate ? {
202
1094
  field: e.valueField || "value",
203
1095
  function: e.aggregate,
@@ -208,7 +1100,7 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
208
1100
  objectName: e.object,
209
1101
  aggregate: t,
210
1102
  filter: e.filter,
211
- label: n.label || W(e) || "",
1103
+ label: n.label || ie(e) || "",
212
1104
  fallbackValue: n.fallbackValue ?? n.value,
213
1105
  icon: n.icon,
214
1106
  description: n.description,
@@ -221,8 +1113,8 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
221
1113
  compareTo: e.compareTo
222
1114
  };
223
1115
  }
224
- let r = t && {}[t] || t;
225
- if (r === "bar" || r === "horizontal-bar" || r === "line" || r === "area" || r === "pie" || r === "donut" || r === "scatter" || r === "funnel") {
1116
+ let r = t && vt[t] || t;
1117
+ if (r && yt.has(r)) {
226
1118
  let t = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
227
1119
  if ($(t)) {
228
1120
  let o = t.aggregate, s = (() => {
@@ -245,10 +1137,10 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
245
1137
  xAxisKey: i,
246
1138
  series: [{
247
1139
  dataKey: l,
248
- label: z(u, l, c?.function)
1140
+ label: ne(u, l, c?.function)
249
1141
  }],
250
- colors: Me,
251
- drillDown: n.drillDown ?? Pe(r),
1142
+ colors: _t,
1143
+ drillDown: n.drillDown ?? Ct(r),
252
1144
  compareTo: e.compareTo,
253
1145
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
254
1146
  };
@@ -271,10 +1163,10 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
271
1163
  xAxisKey: i,
272
1164
  series: [{
273
1165
  dataKey: s,
274
- label: z(e.object, s, e.aggregate)
1166
+ label: ne(e.object, s, e.aggregate)
275
1167
  }],
276
- colors: Me,
277
- drillDown: n.drillDown ?? Pe(r),
1168
+ colors: _t,
1169
+ drillDown: n.drillDown ?? Ct(r),
278
1170
  compareTo: e.compareTo,
279
1171
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
280
1172
  };
@@ -286,24 +1178,28 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
286
1178
  xAxisKey: i,
287
1179
  series: [{
288
1180
  dataKey: a,
289
- label: z(e.object, a, e.aggregate)
1181
+ label: ne(e.object, a, e.aggregate)
290
1182
  }],
291
- colors: Me,
1183
+ colors: _t,
292
1184
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
293
1185
  };
294
1186
  }
295
1187
  if (t === "table") {
296
- let t = e.data || n.data;
1188
+ let t = e.data || n.data, r = $(t) || !t && e.object ? n.drillDown ?? {
1189
+ enabled: !0,
1190
+ mode: "record"
1191
+ } : void 0;
297
1192
  if ($(t)) {
298
- let { data: r, ...i } = n;
1193
+ let { data: i, ...a } = n;
299
1194
  return {
300
1195
  type: "object-data-table",
301
- ...i,
1196
+ ...a,
302
1197
  objectName: e.object || t.object,
303
1198
  dataProvider: t,
304
1199
  filter: t.filter || e.filter,
305
1200
  searchable: e.searchable ?? !1,
306
1201
  pagination: e.pagination ?? !1,
1202
+ drillDown: r,
307
1203
  className: "border-0"
308
1204
  };
309
1205
  }
@@ -314,6 +1210,7 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
314
1210
  filter: e.filter,
315
1211
  searchable: e.searchable ?? !1,
316
1212
  pagination: e.pagination ?? !1,
1213
+ drillDown: r,
317
1214
  className: "border-0"
318
1215
  } : {
319
1216
  type: "data-table",
@@ -362,17 +1259,21 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
362
1259
  };
363
1260
  }
364
1261
  if (t === "list") {
365
- let t = e.data || n.data;
1262
+ let t = e.data || n.data, r = $(t) || !t && e.object ? n.drillDown ?? {
1263
+ enabled: !0,
1264
+ mode: "record"
1265
+ } : void 0;
366
1266
  if ($(t)) {
367
- let { data: r, ...i } = n;
1267
+ let { data: i, ...a } = n;
368
1268
  return {
369
1269
  type: "object-data-table",
370
- ...i,
1270
+ ...a,
371
1271
  objectName: e.object || t.object,
372
1272
  dataProvider: t,
373
1273
  filter: t.filter || e.filter,
374
1274
  searchable: !1,
375
1275
  pagination: !1,
1276
+ drillDown: r,
376
1277
  className: "border-0"
377
1278
  };
378
1279
  }
@@ -383,6 +1284,7 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
383
1284
  filter: e.filter,
384
1285
  searchable: !1,
385
1286
  pagination: !1,
1287
+ drillDown: r,
386
1288
  className: "border-0"
387
1289
  } : {
388
1290
  type: "data-table",
@@ -399,43 +1301,55 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
399
1301
  variant: "caption",
400
1302
  align: "center",
401
1303
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground"
1304
+ } : t && xt.has(t) ? {
1305
+ type: "text",
1306
+ value: `「${t}」chart type is not supported yet`,
1307
+ variant: "caption",
1308
+ align: "center",
1309
+ className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground"
402
1310
  } : {
403
1311
  ...e,
404
1312
  ...n
405
1313
  };
406
- })(), l = e.type === "metric", u = W(e), d = se(e), f = e.id || u || `widget-${t}`, p = o && s === e.id, m = o ? {
1314
+ })(), l = e.type === "metric" && !a, u = ie(e), d = ae(e), f = e.id || u || `widget-${t}`, p = o && s === e.id, h = o ? {
407
1315
  "data-testid": `dashboard-preview-widget-${e.id}`,
408
1316
  "data-widget-id": e.id,
409
1317
  role: "button",
410
1318
  tabIndex: 0,
411
1319
  "aria-selected": p,
412
1320
  "aria-label": `Widget: ${u || `Widget ${t + 1}`}`,
413
- onClick: (t) => G(t, e.id),
414
- onKeyDown: (n) => le(n, e.id, t)
415
- } : {}, h = o ? P("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", p ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, g = !k && i && !q ? {
1321
+ onClick: (t) => oe(t, e.id),
1322
+ onKeyDown: (n) => se(n, e.id, t)
1323
+ } : {}, g = o ? V("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", p ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, _ = !C && i && !U ? {
416
1324
  gridColumn: `span ${i.w}`,
417
1325
  gridRow: `span ${i.h}`
418
- } : void 0, _ = l ? /* @__PURE__ */ Q("div", {
419
- className: P("h-full w-full", o && "relative", h),
420
- style: g,
421
- ...m,
422
- children: [/* @__PURE__ */ Z(c, {
423
- schema: a,
424
- className: P("h-full w-full", o && "pointer-events-none"),
1326
+ } : void 0, y = l ? /* @__PURE__ */ Q("div", {
1327
+ className: V("h-full w-full", o && "relative", g),
1328
+ style: _,
1329
+ ...h,
1330
+ children: [a ? /* @__PURE__ */ Z("div", {
1331
+ className: V("h-full w-full", o && "pointer-events-none"),
1332
+ children: /* @__PURE__ */ Z(pt, {
1333
+ widget: e,
1334
+ dataSource: n
1335
+ })
1336
+ }) : /* @__PURE__ */ Z(m, {
1337
+ schema: c,
1338
+ className: V("h-full w-full", o && "pointer-events-none"),
425
1339
  dataSource: n
426
1340
  }), o && /* @__PURE__ */ Z("div", {
427
1341
  className: "absolute inset-0 z-10",
428
1342
  "aria-hidden": "true",
429
1343
  "data-testid": "widget-click-overlay"
430
1344
  })]
431
- }) : /* @__PURE__ */ Q(y, {
432
- className: P("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", h),
433
- style: g,
434
- ...m,
1345
+ }) : /* @__PURE__ */ Q(k, {
1346
+ className: V("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", g),
1347
+ style: _,
1348
+ ...h,
435
1349
  children: [
436
- u && /* @__PURE__ */ Q(x, {
1350
+ u && /* @__PURE__ */ Q(j, {
437
1351
  className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
438
- children: [/* @__PURE__ */ Z(S, {
1352
+ children: [/* @__PURE__ */ Z(M, {
439
1353
  className: "text-sm sm:text-base font-medium tracking-tight truncate",
440
1354
  title: u,
441
1355
  children: u
@@ -444,12 +1358,15 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
444
1358
  children: d
445
1359
  })]
446
1360
  }),
447
- /* @__PURE__ */ Z(b, {
1361
+ /* @__PURE__ */ Z(A, {
448
1362
  className: "p-0",
449
1363
  children: /* @__PURE__ */ Z("div", {
450
- className: P("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
451
- children: /* @__PURE__ */ Z(c, {
452
- schema: a,
1364
+ className: V("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
1365
+ children: a ? /* @__PURE__ */ Z(pt, {
1366
+ widget: e,
1367
+ dataSource: n
1368
+ }) : /* @__PURE__ */ Z(m, {
1369
+ schema: c,
453
1370
  dataSource: n
454
1371
  })
455
1372
  })
@@ -461,36 +1378,36 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
461
1378
  })
462
1379
  ]
463
1380
  });
464
- return q && e.id ? /* @__PURE__ */ Z(ke, {
1381
+ return U && e.id ? /* @__PURE__ */ Z(mt, {
465
1382
  id: e.id,
466
- gridSpan: !k && i ? {
1383
+ gridSpan: !C && i ? {
467
1384
  w: i.w,
468
1385
  h: i.h
469
1386
  } : void 0,
470
- children: _
471
- }, f) : /* @__PURE__ */ Z(re, { children: _ }, f);
472
- }, X = e.header && /* @__PURE__ */ Q("div", {
1387
+ children: y
1388
+ }, f) : /* @__PURE__ */ Z(ce, { children: y }, f);
1389
+ }, J = e.header && /* @__PURE__ */ Q("div", {
473
1390
  className: "col-span-full mb-4",
474
1391
  children: [
475
- !h && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Z("h2", {
1392
+ !f && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Z("h2", {
476
1393
  className: "text-lg font-semibold tracking-tight",
477
- children: U ? te({
478
- name: U,
479
- label: je(e.title)
480
- }) : je(e.title)
1394
+ children: z ? P({
1395
+ name: z,
1396
+ label: gt(e.title)
1397
+ }) : gt(e.title)
481
1398
  }),
482
- !h && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Z("p", {
1399
+ !f && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Z("p", {
483
1400
  className: "text-sm text-muted-foreground mt-1",
484
- children: U ? ne({
485
- name: U,
486
- description: je(e.description)
487
- }) : je(e.description)
1401
+ children: z ? F({
1402
+ name: z,
1403
+ description: gt(e.description)
1404
+ }) : gt(e.description)
488
1405
  }),
489
1406
  e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Z("div", {
490
1407
  className: "flex gap-2 mt-3",
491
1408
  children: e.header.actions.map((e, t) => {
492
- let n = Ae(e.icon);
493
- return /* @__PURE__ */ Q(v, {
1409
+ let n = ht(e.icon);
1410
+ return /* @__PURE__ */ Q(O, {
494
1411
  variant: "outline",
495
1412
  size: "sm",
496
1413
  onClick: async () => {
@@ -504,103 +1421,106 @@ var Fe = ie(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
504
1421
  return;
505
1422
  }
506
1423
  if (t === "modal" || t === "script") {
507
- let e = await M(n || r);
1424
+ let e = await D(n || r);
508
1425
  e?.success || console.warn("[DashboardRenderer] action failed", e?.error);
509
1426
  return;
510
1427
  }
511
1428
  console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
512
1429
  },
513
- children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), oe(e)]
1430
+ children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), re(e)]
514
1431
  }, t);
515
1432
  })
516
1433
  })
517
1434
  ]
518
- }), xe = i !== void 0 && /* @__PURE__ */ Q("span", {
1435
+ }), pe = i !== void 0 && /* @__PURE__ */ Q("span", {
519
1436
  className: "text-xs text-muted-foreground",
520
1437
  children: [i.toLocaleString(), " records"]
521
- }), Se = a ? JSON.stringify(a) : void 0, Ce = r && /* @__PURE__ */ Q("div", {
522
- className: P("flex items-center justify-end gap-3 mb-2", !k && "col-span-full"),
523
- children: [xe, /* @__PURE__ */ Q(v, {
1438
+ }), me = a ? JSON.stringify(a) : void 0, he = r && /* @__PURE__ */ Q("div", {
1439
+ className: V("flex items-center justify-end gap-3 mb-2", !C && "col-span-full"),
1440
+ children: [pe, /* @__PURE__ */ Q(O, {
524
1441
  variant: "outline",
525
1442
  size: "sm",
526
- onClick: ce,
527
- disabled: D,
1443
+ onClick: B,
1444
+ disabled: b,
528
1445
  "aria-label": "Refresh dashboard",
529
- children: [/* @__PURE__ */ Z(ue, { className: P("h-4 w-4 mr-2", D && "animate-spin") }), D ? "Refreshing…" : "Refresh All"]
1446
+ children: [/* @__PURE__ */ Z(be, { className: V("h-4 w-4 mr-2", b && "animate-spin") }), b ? "Refreshing…" : "Refresh All"]
530
1447
  })]
531
- }), we = V(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), Te = V(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), Ee = V(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
532
- if (k) {
1448
+ }), ge = K(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), Y = K(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), _e = K(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1449
+ if (C) {
533
1450
  let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ Q("div", {
534
- ref: C,
535
- className: P("flex flex-col gap-4 px-4", t),
536
- "data-user-actions": Se,
537
- onClick: K,
538
- ..._,
1451
+ ref: h,
1452
+ className: V("flex flex-col gap-4 px-4", t),
1453
+ "data-user-actions": me,
1454
+ onClick: H,
1455
+ ...p,
539
1456
  children: [
540
- X,
541
- Ce,
1457
+ J,
1458
+ he,
542
1459
  n.length > 0 && /* @__PURE__ */ Z("div", {
543
1460
  className: "grid grid-cols-2 gap-3",
544
- onClick: K,
545
- children: /* @__PURE__ */ Z(Y, {
546
- items: Te,
547
- strategy: _e,
548
- disabled: !q,
549
- children: n.map((e, t) => be(e, t))
1461
+ onClick: H,
1462
+ children: /* @__PURE__ */ Z(ke, {
1463
+ items: Y,
1464
+ strategy: je,
1465
+ disabled: !U,
1466
+ children: n.map((e, t) => fe(e, t))
550
1467
  })
551
1468
  }),
552
1469
  r.length > 0 && /* @__PURE__ */ Z("div", {
553
1470
  className: "flex flex-col gap-4",
554
- onClick: K,
555
- children: /* @__PURE__ */ Z(Y, {
556
- items: Ee,
557
- strategy: ye,
558
- disabled: !q,
559
- children: r.map((e, t) => be(e, t, !0))
1471
+ onClick: H,
1472
+ children: /* @__PURE__ */ Z(ke, {
1473
+ items: _e,
1474
+ strategy: Ne,
1475
+ disabled: !U,
1476
+ children: r.map((e, t) => fe(e, t, !0))
560
1477
  })
561
1478
  })
562
1479
  ]
563
1480
  });
564
- return q ? /* @__PURE__ */ Z(fe, {
565
- sensors: de,
566
- collisionDetection: me,
567
- onDragEnd: ve,
1481
+ return U ? /* @__PURE__ */ Z(we, {
1482
+ sensors: le,
1483
+ collisionDetection: Ee,
1484
+ onDragEnd: ue,
568
1485
  children: i
569
1486
  }) : i;
570
1487
  }
571
- let De = e.columns != null || w !== 4, Oe = /* @__PURE__ */ Q("div", {
572
- ref: C,
573
- className: P("grid auto-rows-min", !De && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1488
+ let ve = e.columns != null || _ !== 4, X = /* @__PURE__ */ Q("div", {
1489
+ ref: h,
1490
+ className: V("grid", !ve && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
574
1491
  style: {
575
- ...De && { gridTemplateColumns: `repeat(${T}, minmax(0, 1fr))` },
576
- gap: `${E * .25}rem`
1492
+ ...ve && {
1493
+ gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))`,
1494
+ gridAutoRows: "minmax(5rem, auto)"
1495
+ },
1496
+ gap: `${y * .25}rem`
577
1497
  },
578
- "data-user-actions": Se,
579
- onClick: K,
580
- ..._,
1498
+ "data-user-actions": me,
1499
+ onClick: H,
1500
+ ...p,
581
1501
  children: [
582
- X,
583
- Ce,
584
- /* @__PURE__ */ Z(Y, {
585
- items: we,
586
- strategy: _e,
587
- disabled: !q,
588
- children: e.widgets?.map((e, t) => be(e, t))
1502
+ J,
1503
+ he,
1504
+ /* @__PURE__ */ Z(ke, {
1505
+ items: ge,
1506
+ strategy: je,
1507
+ disabled: !U,
1508
+ children: e.widgets?.map((e, t) => fe(e, t))
589
1509
  })
590
1510
  ]
591
1511
  });
592
- return q ? /* @__PURE__ */ Z(fe, {
593
- sensors: de,
594
- collisionDetection: me,
595
- onDragEnd: ve,
596
- children: Oe
597
- }) : Oe;
1512
+ return U ? /* @__PURE__ */ Z(we, {
1513
+ sensors: le,
1514
+ collisionDetection: Ee,
1515
+ onDragEnd: ue,
1516
+ children: X
1517
+ }) : X;
598
1518
  });
599
1519
  //#endregion
600
1520
  //#region src/DashboardGridLayout.tsx
601
- function Ie({ editMode: e }) {
602
- let t = f();
603
- return L.useEffect(() => {
1521
+ function Tt({ editMode: e }) {
1522
+ let t = v();
1523
+ return H.useEffect(() => {
604
1524
  if (e) return t.startDrag({
605
1525
  id: "dashboard-layout",
606
1526
  type: "dashboard-widget",
@@ -611,14 +1531,14 @@ function Ie({ editMode: e }) {
611
1531
  t.endDrag("dashboard");
612
1532
  }, [e, t]), null;
613
1533
  }
614
- var Le = [
1534
+ var Et = [
615
1535
  "hsl(var(--chart-1))",
616
1536
  "hsl(var(--chart-2))",
617
1537
  "hsl(var(--chart-3))",
618
1538
  "hsl(var(--chart-4))",
619
1539
  "hsl(var(--chart-5))"
620
1540
  ];
621
- function Re(e, t) {
1541
+ function Dt(e, t) {
622
1542
  if (!e.widgets?.length) return e;
623
1543
  let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
624
1544
  let r = e.id || `widget-${t}`, i = n.get(r);
@@ -637,7 +1557,7 @@ function Re(e, t) {
637
1557
  widgets: r
638
1558
  };
639
1559
  }
640
- function ze(e) {
1560
+ function Ot(e) {
641
1561
  return { lg: e.widgets?.map((e, t) => ({
642
1562
  i: e.id || `widget-${t}`,
643
1563
  x: e.layout?.x ?? t % 4 * 3,
@@ -646,40 +1566,40 @@ function ze(e) {
646
1566
  h: e.layout?.h ?? 4
647
1567
  })) || [] };
648
1568
  }
649
- var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
650
- let { width: a, containerRef: o, mounted: s } = Se(), [l, u] = L.useState(!1), [d, f] = L.useState(!1), m = p(), h = L.useRef(null), g = L.useCallback(() => {
651
- i && (f(!0), i(), setTimeout(() => f(!1), 600));
1569
+ var kt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1570
+ let { width: a, containerRef: o, mounted: s } = He(), [c, l] = H.useState(!1), [u, d] = H.useState(!1), f = b(), p = H.useRef(null), h = H.useCallback(() => {
1571
+ i && (d(!0), i(), setTimeout(() => d(!1), 600));
652
1572
  }, [i]);
653
- L.useEffect(() => {
654
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return h.current = setInterval(g, e.refreshInterval * 1e3), () => {
655
- h.current && clearInterval(h.current);
1573
+ H.useEffect(() => {
1574
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return p.current = setInterval(h, e.refreshInterval * 1e3), () => {
1575
+ p.current && clearInterval(p.current);
656
1576
  };
657
1577
  }, [
658
1578
  e.refreshInterval,
659
1579
  i,
660
- g
1580
+ h
661
1581
  ]);
662
- let [_, C] = L.useState(() => ze(e)), w = L.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1582
+ let [g, _] = H.useState(() => Ot(e)), v = H.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
663
1583
  i: e.id || `widget-${t}`,
664
1584
  x: e.layout?.x,
665
1585
  y: e.layout?.y,
666
1586
  w: e.layout?.w,
667
1587
  h: e.layout?.h
668
1588
  })) ?? []), [e.widgets]);
669
- L.useEffect(() => {
670
- C(ze(e));
671
- }, [w]);
672
- let T = L.useCallback((e, t) => {
673
- C(t), n?.(e);
674
- }, [n]), E = L.useCallback(() => {
675
- r ? r(Re(e, _.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), u(!1);
1589
+ H.useEffect(() => {
1590
+ _(Ot(e));
1591
+ }, [v]);
1592
+ let y = H.useCallback((e, t) => {
1593
+ _(t), n?.(e);
1594
+ }, [n]), x = H.useCallback(() => {
1595
+ r ? r(Dt(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);
676
1596
  }, [
677
1597
  r,
678
1598
  e,
679
- _
680
- ]), D = L.useCallback(() => {
681
- C(ze(e));
682
- }, [e]), O = L.useCallback((e) => {
1599
+ g
1600
+ ]), S = H.useCallback(() => {
1601
+ _(Ot(e));
1602
+ }, [e]), C = H.useCallback((e) => {
683
1603
  if (e.component) return e.component;
684
1604
  let t = e.type, n = e.options || {};
685
1605
  if (t === "bar" || t === "horizontal-bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter" || t === "funnel") {
@@ -697,7 +1617,7 @@ var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
697
1617
  aggregate: o,
698
1618
  xAxisKey: i,
699
1619
  series: [{ dataKey: s }],
700
- colors: Le,
1620
+ colors: Et,
701
1621
  className: "h-full"
702
1622
  };
703
1623
  }
@@ -714,7 +1634,7 @@ var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
714
1634
  aggregate: n,
715
1635
  xAxisKey: i,
716
1636
  series: [{ dataKey: e.valueField || "value" }],
717
- colors: Le,
1637
+ colors: Et,
718
1638
  className: "h-full"
719
1639
  };
720
1640
  }
@@ -724,7 +1644,7 @@ var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
724
1644
  data: Array.isArray(r) ? r : r?.items || [],
725
1645
  xAxisKey: i,
726
1646
  series: [{ dataKey: a }],
727
- colors: Le,
1647
+ colors: Et,
728
1648
  className: "h-full"
729
1649
  };
730
1650
  }
@@ -785,10 +1705,10 @@ var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
785
1705
  }, []);
786
1706
  return /* @__PURE__ */ Q("div", {
787
1707
  ref: o,
788
- className: P("w-full", t),
1708
+ className: V("w-full", t),
789
1709
  "data-testid": "grid-layout",
790
1710
  children: [
791
- m && /* @__PURE__ */ Z(Ie, { editMode: l }),
1711
+ f && /* @__PURE__ */ Z(Tt, { editMode: c }),
792
1712
  /* @__PURE__ */ Q("div", {
793
1713
  className: "mb-4 flex items-center justify-between",
794
1714
  children: [/* @__PURE__ */ Z("h2", {
@@ -796,44 +1716,44 @@ var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
796
1716
  children: e.title || "Dashboard"
797
1717
  }), /* @__PURE__ */ Z("div", {
798
1718
  className: "flex gap-2",
799
- children: l ? /* @__PURE__ */ Q(X, { children: [
800
- /* @__PURE__ */ Q(v, {
801
- onClick: E,
1719
+ children: c ? /* @__PURE__ */ Q(Be, { children: [
1720
+ /* @__PURE__ */ Q(O, {
1721
+ onClick: x,
802
1722
  size: "sm",
803
1723
  variant: "default",
804
- children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4 mr-2" }), "Save Layout"]
1724
+ children: [/* @__PURE__ */ Z(xe, { className: "h-4 w-4 mr-2" }), "Save Layout"]
805
1725
  }),
806
- /* @__PURE__ */ Q(v, {
807
- onClick: D,
1726
+ /* @__PURE__ */ Q(O, {
1727
+ onClick: S,
808
1728
  size: "sm",
809
1729
  variant: "outline",
810
- children: [/* @__PURE__ */ Z(de, { className: "h-4 w-4 mr-2" }), "Reset"]
1730
+ children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4 mr-2" }), "Reset"]
811
1731
  }),
812
- /* @__PURE__ */ Z(v, {
813
- onClick: () => u(!1),
1732
+ /* @__PURE__ */ Z(O, {
1733
+ onClick: () => l(!1),
814
1734
  size: "sm",
815
1735
  variant: "ghost",
816
1736
  children: "Cancel"
817
1737
  })
818
- ] }) : /* @__PURE__ */ Q(X, { children: [i && /* @__PURE__ */ Q(v, {
819
- onClick: g,
1738
+ ] }) : /* @__PURE__ */ Q(Be, { children: [i && /* @__PURE__ */ Q(O, {
1739
+ onClick: h,
820
1740
  size: "sm",
821
1741
  variant: "outline",
822
- disabled: d,
1742
+ disabled: u,
823
1743
  "aria-label": "Refresh dashboard",
824
- children: [/* @__PURE__ */ Z(ue, { className: P("h-4 w-4 mr-2", d && "animate-spin") }), d ? "Refreshing…" : "Refresh All"]
825
- }), /* @__PURE__ */ Q(v, {
826
- onClick: () => u(!0),
1744
+ children: [/* @__PURE__ */ Z(be, { className: V("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
1745
+ }), /* @__PURE__ */ Q(O, {
1746
+ onClick: () => l(!0),
827
1747
  size: "sm",
828
1748
  variant: "outline",
829
- children: [/* @__PURE__ */ Z(se, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
1749
+ children: [/* @__PURE__ */ Z(_e, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
830
1750
  })] })
831
1751
  })]
832
1752
  }),
833
- s && /* @__PURE__ */ Z(xe, {
1753
+ s && /* @__PURE__ */ Z(Ve, {
834
1754
  className: "layout",
835
1755
  width: a,
836
- layouts: _,
1756
+ layouts: g,
837
1757
  breakpoints: {
838
1758
  lg: 1200,
839
1759
  md: 996,
@@ -850,41 +1770,41 @@ var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
850
1770
  },
851
1771
  rowHeight: 60,
852
1772
  dragConfig: {
853
- enabled: l,
1773
+ enabled: c,
854
1774
  handle: ".drag-handle"
855
1775
  },
856
- resizeConfig: { enabled: l },
857
- onLayoutChange: T,
1776
+ resizeConfig: { enabled: c },
1777
+ onLayoutChange: y,
858
1778
  children: e.widgets?.map((e, t) => {
859
- let n = e.id || `widget-${t}`, r = O(e);
1779
+ let n = e.id || `widget-${t}`, r = C(e);
860
1780
  return /* @__PURE__ */ Z("div", {
861
1781
  className: "h-full",
862
1782
  children: e.type === "metric" ? /* @__PURE__ */ Q("div", {
863
1783
  className: "h-full w-full relative",
864
- children: [l && /* @__PURE__ */ Z("div", {
1784
+ children: [c && /* @__PURE__ */ Z("div", {
865
1785
  className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
866
- children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
867
- }), /* @__PURE__ */ Z(c, {
1786
+ children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
1787
+ }), /* @__PURE__ */ Z(m, {
868
1788
  schema: r,
869
1789
  className: "h-full w-full"
870
1790
  })]
871
- }) : /* @__PURE__ */ Q(y, {
872
- className: P("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", l && "ring-2 ring-primary/20"),
873
- children: [e.title && /* @__PURE__ */ Q(x, {
1791
+ }) : /* @__PURE__ */ Q(k, {
1792
+ className: V("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", c && "ring-2 ring-primary/20"),
1793
+ children: [e.title && /* @__PURE__ */ Q(j, {
874
1794
  className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
875
- children: [/* @__PURE__ */ Z(S, {
1795
+ children: [/* @__PURE__ */ Z(M, {
876
1796
  className: "text-base font-medium tracking-tight truncate",
877
1797
  title: e.title,
878
1798
  children: e.title
879
- }), l && /* @__PURE__ */ Z("div", {
1799
+ }), c && /* @__PURE__ */ Z("div", {
880
1800
  className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
881
- children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
1801
+ children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
882
1802
  })]
883
- }), /* @__PURE__ */ Z(b, {
1803
+ }), /* @__PURE__ */ Z(A, {
884
1804
  className: "p-0 h-full",
885
1805
  children: /* @__PURE__ */ Z("div", {
886
- className: P("h-full w-full overflow-auto p-4"),
887
- children: /* @__PURE__ */ Z(c, { schema: r })
1806
+ className: V("h-full w-full overflow-auto p-4"),
1807
+ children: /* @__PURE__ */ Z(m, { schema: r })
888
1808
  })
889
1809
  })]
890
1810
  })
@@ -893,7 +1813,7 @@ var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
893
1813
  })
894
1814
  ]
895
1815
  });
896
- }, Ve = h({
1816
+ }, At = S({
897
1817
  "dashboard.trend.vsLastQuarter": "vs last quarter",
898
1818
  "dashboard.trend.vsLastMonth": "vs last month",
899
1819
  "dashboard.trend.vsLastWeek": "vs last week",
@@ -901,7 +1821,7 @@ var Be = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
901
1821
  "dashboard.trend.vsYesterday": "vs yesterday",
902
1822
  "dashboard.trend.vsPreviousPeriod": "vs previous period"
903
1823
  }, "dashboard.trend.vsLastQuarter");
904
- function He(e) {
1824
+ function jt(e) {
905
1825
  switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
906
1826
  case "vs last quarter":
907
1827
  case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
@@ -917,11 +1837,11 @@ function He(e) {
917
1837
  default: return;
918
1838
  }
919
1839
  }
920
- function Ue(e, t, n) {
1840
+ function Mt(e, t, n) {
921
1841
  if (e == null) return "";
922
1842
  if (typeof e == "string") {
923
1843
  let r = Number(e);
924
- return !isFinite(r) || e.trim() === "" ? e : Ue(r, t, n);
1844
+ return !isFinite(r) || e.trim() === "" ? e : Mt(r, t, n);
925
1845
  }
926
1846
  if (!isFinite(e)) return String(e);
927
1847
  let r = {
@@ -948,10 +1868,10 @@ function Ue(e, t, n) {
948
1868
  maximumFractionDigits: c
949
1869
  }).format(e);
950
1870
  }
951
- function We(e) {
1871
+ function Nt(e) {
952
1872
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
953
1873
  }
954
- var Ge = {
1874
+ var Pt = {
955
1875
  default: "bg-muted text-muted-foreground",
956
1876
  blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
957
1877
  teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
@@ -960,18 +1880,18 @@ var Ge = {
960
1880
  success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
961
1881
  warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
962
1882
  danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
963
- }, Ke = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, ...m }) => {
964
- let h = Ge[c] || Ge.default, { t: g } = Ve(), _ = V(() => {
965
- let e = We(a) || We(n?.label);
1883
+ }, Ft = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, ...m }) => {
1884
+ let h = Pt[c] || Pt.default, { t: g } = At(), _ = K(() => {
1885
+ let e = Nt(a) || Nt(n?.label);
966
1886
  if (!e) return e;
967
- let t = He(e);
1887
+ let t = jt(e);
968
1888
  return t ? g(t) : e;
969
1889
  }, [
970
1890
  a,
971
1891
  n?.label,
972
1892
  g
973
- ]), v = V(() => {
974
- let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Ue(t, l, u) : t ?? "", n = String(e);
1893
+ ]), v = K(() => {
1894
+ let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Mt(t, l, u) : t ?? "", n = String(e);
975
1895
  return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
976
1896
  }, [
977
1897
  t,
@@ -979,15 +1899,15 @@ var Ge = {
979
1899
  u,
980
1900
  d,
981
1901
  f
982
- ]), C = V(() => {
1902
+ ]), y = K(() => {
983
1903
  if (typeof r == "string") {
984
- let e = F(r);
1904
+ let e = oe(r);
985
1905
  return e ? /* @__PURE__ */ Z(e, { className: "h-4 w-4" }) : null;
986
1906
  }
987
1907
  return r;
988
1908
  }, [r]);
989
- return /* @__PURE__ */ Q(y, {
990
- className: P("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),
1909
+ return /* @__PURE__ */ Q(k, {
1910
+ className: V("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),
991
1911
  onClick: p,
992
1912
  role: p ? "button" : void 0,
993
1913
  tabIndex: p ? 0 : void 0,
@@ -995,19 +1915,19 @@ var Ge = {
995
1915
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
996
1916
  } : void 0,
997
1917
  ...m,
998
- children: [/* @__PURE__ */ Q(x, {
1918
+ children: [/* @__PURE__ */ Q(j, {
999
1919
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
1000
- children: [/* @__PURE__ */ Z(S, {
1920
+ children: [/* @__PURE__ */ Z(M, {
1001
1921
  className: "text-sm font-medium truncate",
1002
- children: We(e)
1003
- }), C && /* @__PURE__ */ Z("div", {
1004
- className: P("flex h-8 w-8 items-center justify-center rounded-md shrink-0", h),
1005
- children: C
1922
+ children: Nt(e)
1923
+ }), y && /* @__PURE__ */ Z("div", {
1924
+ className: V("flex h-8 w-8 items-center justify-center rounded-md shrink-0", h),
1925
+ children: y
1006
1926
  })]
1007
- }), /* @__PURE__ */ Z(b, { children: o ? /* @__PURE__ */ Q("div", {
1927
+ }), /* @__PURE__ */ Z(A, { children: o ? /* @__PURE__ */ Q("div", {
1008
1928
  className: "flex items-center gap-2 text-muted-foreground",
1009
1929
  "data-testid": "metric-loading",
1010
- children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
1930
+ children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
1011
1931
  className: "text-sm",
1012
1932
  children: "Loading…"
1013
1933
  })]
@@ -1015,21 +1935,21 @@ var Ge = {
1015
1935
  className: "flex items-center gap-2",
1016
1936
  "data-testid": "metric-error",
1017
1937
  role: "alert",
1018
- children: [/* @__PURE__ */ Z(U, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
1938
+ children: [/* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
1019
1939
  className: "text-xs text-destructive truncate",
1020
1940
  children: s
1021
1941
  })]
1022
- }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
1023
- className: "text-2xl font-bold truncate",
1942
+ }) : /* @__PURE__ */ Q(Be, { children: [/* @__PURE__ */ Z("div", {
1943
+ className: "text-2xl font-bold tabular-nums tracking-tight truncate",
1024
1944
  children: v
1025
1945
  }), (n || a) && /* @__PURE__ */ Q("div", {
1026
1946
  className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
1027
1947
  children: [n && /* @__PURE__ */ Q("span", {
1028
- className: P("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"),
1948
+ className: V("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"),
1029
1949
  children: [
1030
- n.direction === "up" && /* @__PURE__ */ Z(W, { className: "h-3 w-3 mr-1" }),
1031
- n.direction === "down" && /* @__PURE__ */ Z(oe, { className: "h-3 w-3 mr-1" }),
1032
- n.direction === "neutral" && /* @__PURE__ */ Z(le, { className: "h-3 w-3 mr-1" }),
1950
+ n.direction === "up" && /* @__PURE__ */ Z(me, { className: "h-3 w-3 mr-1" }),
1951
+ n.direction === "down" && /* @__PURE__ */ Z(pe, { className: "h-3 w-3 mr-1" }),
1952
+ n.direction === "neutral" && /* @__PURE__ */ Z(ye, { className: "h-3 w-3 mr-1" }),
1033
1953
  n.value,
1034
1954
  "%"
1035
1955
  ]
@@ -1042,24 +1962,24 @@ var Ge = {
1042
1962
  };
1043
1963
  //#endregion
1044
1964
  //#region src/MetricCard.tsx
1045
- function qe(e) {
1965
+ function It(e) {
1046
1966
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
1047
1967
  }
1048
- var Je = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
1049
- let u = n ? F(n) : null;
1050
- return /* @__PURE__ */ Q(y, {
1051
- className: P("h-full", o),
1968
+ var Lt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
1969
+ let u = n ? oe(n) : null;
1970
+ return /* @__PURE__ */ Q(k, {
1971
+ className: V("h-full", o),
1052
1972
  ...l,
1053
- children: [/* @__PURE__ */ Q(x, {
1973
+ children: [/* @__PURE__ */ Q(j, {
1054
1974
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
1055
- children: [/* @__PURE__ */ Z(S, {
1975
+ children: [/* @__PURE__ */ Z(M, {
1056
1976
  className: "text-sm font-medium",
1057
- children: qe(e)
1977
+ children: It(e)
1058
1978
  }), u && /* @__PURE__ */ Z(u, { className: "h-4 w-4 text-muted-foreground" })]
1059
- }), /* @__PURE__ */ Z(b, { children: s ? /* @__PURE__ */ Q("div", {
1979
+ }), /* @__PURE__ */ Z(A, { children: s ? /* @__PURE__ */ Q("div", {
1060
1980
  className: "flex items-center gap-2 text-muted-foreground",
1061
1981
  "data-testid": "metric-card-loading",
1062
- children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
1982
+ children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
1063
1983
  className: "text-sm",
1064
1984
  children: "Loading…"
1065
1985
  })]
@@ -1067,222 +1987,230 @@ var Je = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
1067
1987
  className: "flex items-center gap-2",
1068
1988
  "data-testid": "metric-card-error",
1069
1989
  role: "alert",
1070
- children: [/* @__PURE__ */ Z(U, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
1990
+ children: [/* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
1071
1991
  className: "text-xs text-destructive truncate",
1072
1992
  children: c
1073
1993
  })]
1074
- }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
1994
+ }) : /* @__PURE__ */ Q(Be, { children: [/* @__PURE__ */ Z("div", {
1075
1995
  className: "text-2xl font-bold",
1076
1996
  children: t
1077
1997
  }), (r || i || a) && /* @__PURE__ */ Q("p", {
1078
1998
  className: "text-xs text-muted-foreground flex items-center mt-1",
1079
1999
  children: [r && i && /* @__PURE__ */ Q("span", {
1080
- className: P("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
2000
+ className: V("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
1081
2001
  children: [
1082
- r === "up" && /* @__PURE__ */ Z(W, { className: "h-3 w-3 mr-1" }),
1083
- r === "down" && /* @__PURE__ */ Z(oe, { className: "h-3 w-3 mr-1" }),
1084
- r === "neutral" && /* @__PURE__ */ Z(le, { className: "h-3 w-3 mr-1" }),
2002
+ r === "up" && /* @__PURE__ */ Z(me, { className: "h-3 w-3 mr-1" }),
2003
+ r === "down" && /* @__PURE__ */ Z(pe, { className: "h-3 w-3 mr-1" }),
2004
+ r === "neutral" && /* @__PURE__ */ Z(ye, { className: "h-3 w-3 mr-1" }),
1085
2005
  i
1086
2006
  ]
1087
- }), qe(a)]
2007
+ }), It(a)]
1088
2008
  })] }) })]
1089
2009
  });
1090
- }, Ye = ({ objectName: e, aggregate: n, filter: r, label: u, fallbackValue: d, trend: f, icon: p, className: m, description: h, dataSource: g, colorVariant: _, format: v, currency: y, prefix: b, suffix: x, invert: S, drillDown: C, title: w, compareTo: T, t: E }) => {
1091
- let j = z(l), N = g || j?.dataSource, [P, F] = H(!1), [I, L] = H(null), [re, ie] = H(null), [ae, U] = H(!1), [oe, W] = H(null), [se, ce] = H(null);
1092
- B(() => {
2010
+ }, Rt = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: a, trend: o, icon: s, className: c, description: l, dataSource: g, colorVariant: _, format: v, currency: y, prefix: b, suffix: x, invert: S, drillDown: T, title: E, compareTo: D, t: O }) => {
2011
+ let k = ue(h), A = g || k?.dataSource, [j, M] = q(!1), [N, P] = q(null), [F, I] = q(null), [ne, B] = q(!1), [V, oe] = q(null), [se, H] = q(null);
2012
+ G(() => {
1093
2013
  let t = !0;
1094
- if (!(!N || !e || typeof N.getObjectSchema != "function")) return N.getObjectSchema(e).then((e) => {
1095
- t && ce(e);
2014
+ if (!(!A || !e || typeof A.getObjectSchema != "function")) return A.getObjectSchema(e).then((e) => {
2015
+ t && H(e);
1096
2016
  }).catch(() => {}), () => {
1097
2017
  t = !1;
1098
2018
  };
1099
- }, [N, e]);
1100
- let G = V(() => {
1101
- let e = n?.field;
2019
+ }, [A, e]);
2020
+ let U = K(() => {
2021
+ let e = t?.field;
1102
2022
  if (!e || !se?.fields) return null;
1103
- let t = se.fields;
1104
- return Array.isArray(t) ? t.find((t) => t?.name === e) || null : t[e] || null;
1105
- }, [se, n?.field]), le = V(() => {
2023
+ let n = se.fields;
2024
+ return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
2025
+ }, [se, t?.field]), ce = K(() => {
1106
2026
  if (v) return v;
1107
- if (G) {
1108
- if (G.type === "currency") {
1109
- let e = G.precision ?? G.scale ?? 0;
2027
+ if (U) {
2028
+ if (U.type === "currency") {
2029
+ let e = U.precision ?? U.scale ?? 0;
1110
2030
  return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
1111
2031
  }
1112
- if (G.type === "percent") return "0,0%";
1113
- if (G.type === "number" || G.type === "integer") return "0,0";
2032
+ if (U.type === "percent") return "0,0%";
2033
+ if (U.type === "number" || U.type === "integer") return "0,0";
1114
2034
  }
1115
- }, [v, G]), ue = V(() => {
2035
+ }, [v, U]), { currency: le } = w(), de = K(() => {
1116
2036
  if (y) return y;
1117
- if (G?.type === "currency") return G.defaultCurrency || G.currency || void 0;
1118
- }, [y, G]), K = V(() => n ? JSON.stringify(n) : "", [n]), q = V(() => a(r), [r]), de = V(() => q ? JSON.stringify(q) : "", [q]), fe = V(() => T ? JSON.stringify(T) : "", [T]), pe = R(async (t, r) => {
1119
- if (n && typeof t.aggregate == "function") {
1120
- let i = await t.aggregate(e, {
1121
- field: n.field,
1122
- function: n.function,
1123
- groupBy: n.groupBy || "_all",
2037
+ if (U?.type === "currency") return C(U, le);
2038
+ }, [
2039
+ y,
2040
+ U,
2041
+ le
2042
+ ]), fe = K(() => t ? JSON.stringify(t) : "", [t]), J = K(() => d(n), [n]), pe = K(() => J ? JSON.stringify(J) : "", [J]), me = K(() => D ? JSON.stringify(D) : "", [D]), he = W(async (n, r) => {
2043
+ if (t && typeof n.aggregate == "function") {
2044
+ let i = await n.aggregate(e, {
2045
+ field: t.field,
2046
+ function: t.function,
2047
+ groupBy: t.groupBy || "_all",
1124
2048
  filter: r
1125
2049
  }), a = Array.isArray(i) ? i : [];
1126
2050
  if (a.length === 0) return 0;
1127
- if (n.function === "count") {
1128
- let e = `${n.field}_count`;
1129
- return a.reduce((t, r) => t + (Number(r[e]) || Number(r[n.field]) || Number(r.count) || 0), 0);
2051
+ if (t.function === "count") {
2052
+ let e = `${t.field}_count`;
2053
+ return a.reduce((n, r) => n + (Number(r[e]) || Number(r[t.field]) || Number(r.count) || 0), 0);
1130
2054
  }
1131
2055
  let o = a[0];
1132
- return o[`${n.field}_${n.function}`] ?? o[n.field] ?? o.value ?? 0;
2056
+ return o[`${t.field}_${t.function}`] ?? o[t.field] ?? o.value ?? 0;
1133
2057
  }
1134
- if (typeof t.find == "function") {
1135
- let n = await t.find(e, { $filter: r });
1136
- return (Array.isArray(n) ? n : n?.data || n?.records || []).length;
2058
+ if (typeof n.find == "function") {
2059
+ let t = await n.find(e, { $filter: r });
2060
+ return (Array.isArray(t) ? t : t?.data || t?.records || []).length;
1137
2061
  }
1138
2062
  return null;
1139
- }, [e, K]), me = R(async (t, n) => {
2063
+ }, [e, fe]), ge = W(async (t, r) => {
1140
2064
  if (!(!t || !e)) {
1141
- n.current && (U(!0), W(null));
2065
+ r.current && (B(!0), oe(null));
1142
2066
  try {
1143
- let e = T ? s(r, T) : null, [i, a] = await Promise.all([pe(t, q), e ? pe(t, e) : Promise.resolve(null)]);
2067
+ let e = D ? p(n, D) : null, [i, a] = await Promise.all([he(t, J), e ? he(t, e) : Promise.resolve(null)]);
1144
2068
  if (i === null) return;
1145
- n.current && (L(i), ie(typeof a == "number" && Number.isFinite(a) ? a : null));
2069
+ r.current && (P(i), I(typeof a == "number" && Number.isFinite(a) ? a : null));
1146
2070
  } catch (e) {
1147
- console.error("[ObjectMetricWidget] Fetch error:", e), n.current && W(e instanceof Error ? e.message : "Failed to load metric");
2071
+ console.error("[ObjectMetricWidget] Fetch error:", e), r.current && oe(e instanceof Error ? e.message : "Failed to load metric");
1148
2072
  } finally {
1149
- n.current && U(!1);
2073
+ r.current && B(!1);
1150
2074
  }
1151
2075
  }
1152
2076
  }, [
1153
2077
  e,
1154
- K,
1155
- de,
1156
2078
  fe,
1157
- pe
2079
+ pe,
2080
+ me,
2081
+ he
1158
2082
  ]);
1159
- B(() => {
2083
+ G(() => {
1160
2084
  let t = { current: !0 };
1161
- return N && e ? me(N, t) : (L(null), W(null)), () => {
2085
+ return A && e ? ge(A, t) : (P(null), oe(null)), () => {
1162
2086
  t.current = !1;
1163
2087
  };
1164
2088
  }, [
1165
- N,
2089
+ A,
1166
2090
  e,
1167
- me
2091
+ ge
1168
2092
  ]);
1169
- let J = I === null ? N ? "—" : d ?? "—" : I;
1170
- S && typeof J == "number" && isFinite(J) && J >= 0 && J <= 1 && (J = 1 - J);
1171
- let he = V(() => {
1172
- if (!T || typeof I != "number" || !Number.isFinite(I) || re === null) return;
1173
- let e = Oe(I, re);
2093
+ let Y = N === null ? A ? "—" : a ?? "—" : N;
2094
+ S && typeof Y == "number" && isFinite(Y) && Y >= 0 && Y <= 1 && (Y = 1 - Y);
2095
+ let _e = K(() => {
2096
+ if (!D || typeof N != "number" || !Number.isFinite(N) || F === null) return;
2097
+ let e = Ue(N, F);
1174
2098
  if (!e) return;
1175
- let n = t(T, r), i = `dashboard.trend.${n}`, a = {
2099
+ let t = i(D, n), r = `dashboard.trend.${t}`, a = {
1176
2100
  vsPreviousPeriod: "vs previous period",
1177
2101
  vsLastWeek: "vs last week",
1178
2102
  vsLastMonth: "vs last month",
1179
2103
  vsLastQuarter: "vs last quarter",
1180
2104
  vsLastYear: "vs last year",
1181
2105
  vsYesterday: "vs yesterday"
1182
- }, o = E ? E(i, a[n] || n) : a[n] || n;
2106
+ }, o = O ? O(r, a[t] || t) : a[t] || t;
1183
2107
  return {
1184
2108
  value: e.value,
1185
2109
  direction: e.direction,
1186
2110
  label: o
1187
2111
  };
2112
+ }, [
2113
+ D,
2114
+ N,
2115
+ F,
2116
+ n,
2117
+ O
2118
+ ]) ?? o, ve = u(T) && !!e && !!A, X = K(() => {
2119
+ let e = typeof r == "string" ? r : r?.defaultValue || "";
2120
+ return f(T, {}, (typeof E == "string" ? E : E?.defaultValue || "") || e || "Details");
1188
2121
  }, [
1189
2122
  T,
1190
- I,
1191
- re,
1192
2123
  r,
1193
2124
  E
1194
- ]) ?? f, Y = i(C) && !!e && !!N, ge = V(() => {
1195
- let e = typeof u == "string" ? u : u?.defaultValue || "";
1196
- return o(C, {}, (typeof w == "string" ? w : w?.defaultValue || "") || e || "Details");
1197
- }, [
1198
- C,
1199
- u,
1200
- w
1201
- ]), _e = V(() => {
1202
- if (!Y) return null;
1203
- let t = C?.target ?? "drawer", n = C?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i;
2125
+ ]), ye = K(() => {
2126
+ if (!ve) return null;
2127
+ let t = T?.target ?? "drawer", n = T?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Z(it, {
2128
+ objectName: e,
2129
+ filter: J,
2130
+ onNavigate: () => M(!1)
2131
+ }), a;
1204
2132
  if (r) {
1205
- let e = n.filter, t = e ? q ? { $and: [e, q] } : e : q;
1206
- i = /* @__PURE__ */ Z("div", {
2133
+ let e = n.filter, t = e ? J ? { $and: [e, J] } : e : J;
2134
+ a = /* @__PURE__ */ Z("div", {
1207
2135
  className: "h-full overflow-auto",
1208
- children: /* @__PURE__ */ Z(c, { schema: {
2136
+ children: /* @__PURE__ */ Z(m, { schema: {
1209
2137
  type: "spec-report",
1210
2138
  ...n,
1211
2139
  filter: t
1212
2140
  } })
1213
2141
  });
1214
- } else i = /* @__PURE__ */ Z("div", {
2142
+ } else a = /* @__PURE__ */ Z("div", {
1215
2143
  className: "h-full overflow-auto",
1216
- children: /* @__PURE__ */ Z(c, { schema: {
2144
+ children: /* @__PURE__ */ Z(m, { schema: {
1217
2145
  type: "object-data-table",
1218
2146
  objectName: e,
1219
- filter: q,
2147
+ filter: J,
1220
2148
  pageSize: 25,
1221
- drillDown: { enabled: !1 }
2149
+ drillDown: {
2150
+ enabled: !0,
2151
+ mode: "record",
2152
+ target: "dialog"
2153
+ }
1222
2154
  } })
1223
2155
  });
1224
- return t === "dialog" ? /* @__PURE__ */ Z(D, {
2156
+ return t === "dialog" ? /* @__PURE__ */ Z(L, {
1225
2157
  open: !0,
1226
- onOpenChange: (e) => !e && F(!1),
1227
- children: /* @__PURE__ */ Q(O, {
2158
+ onOpenChange: (e) => !e && M(!1),
2159
+ children: /* @__PURE__ */ Q(R, {
1228
2160
  className: "max-w-5xl",
1229
- children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Z(A, { children: ge }) }), i]
2161
+ children: [/* @__PURE__ */ Q(ee, {
2162
+ className: "flex-row items-center justify-between gap-4 pr-8",
2163
+ children: [/* @__PURE__ */ Z(te, { children: X }), i]
2164
+ }), a]
1230
2165
  })
1231
- }) : /* @__PURE__ */ Z(M, {
2166
+ }) : /* @__PURE__ */ Z(z, {
1232
2167
  open: !0,
1233
- onOpenChange: (e) => !e && F(!1),
1234
- children: /* @__PURE__ */ Q(ee, {
2168
+ onOpenChange: (e) => !e && M(!1),
2169
+ children: /* @__PURE__ */ Q(re, {
1235
2170
  side: "right",
1236
2171
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
1237
- children: [/* @__PURE__ */ Z(te, { children: /* @__PURE__ */ Z(ne, { children: ge }) }), /* @__PURE__ */ Z("div", {
2172
+ children: [/* @__PURE__ */ Q(ie, {
2173
+ className: "flex-row items-center justify-between gap-4 pr-8",
2174
+ children: [/* @__PURE__ */ Z(ae, { children: X }), i]
2175
+ }), /* @__PURE__ */ Z("div", {
1238
2176
  className: "flex-1 overflow-hidden mt-2",
1239
- children: i
2177
+ children: a
1240
2178
  })]
1241
2179
  })
1242
2180
  });
1243
2181
  }, [
1244
- Y,
1245
- C,
2182
+ ve,
2183
+ T,
1246
2184
  e,
1247
- q,
1248
- ge
2185
+ J,
2186
+ X
1249
2187
  ]);
1250
- return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(Ke, {
1251
- label: u,
1252
- value: J,
1253
- trend: he,
1254
- icon: p,
1255
- className: m,
1256
- description: h,
1257
- loading: ae,
1258
- error: oe,
2188
+ return /* @__PURE__ */ Q(Be, { children: [/* @__PURE__ */ Z(Ft, {
2189
+ label: r,
2190
+ value: Y,
2191
+ trend: _e,
2192
+ icon: s,
2193
+ className: c,
2194
+ description: l,
2195
+ loading: ne,
2196
+ error: V,
1259
2197
  colorVariant: _,
1260
- format: le,
1261
- currency: ue,
2198
+ format: ce,
2199
+ currency: de,
1262
2200
  prefix: b,
1263
2201
  suffix: x,
1264
- onClick: Y ? () => F(!0) : void 0
1265
- }), P && _e] });
2202
+ onClick: ve ? () => M(!0) : void 0
2203
+ }), j && ye] });
1266
2204
  };
1267
2205
  //#endregion
1268
- //#region src/PivotTable.tsx
1269
- function Xe() {
1270
- try {
1271
- let { t: e } = g(), t = e("dashboard.total");
1272
- return !t || t === "dashboard.total" ? "Total" : t;
1273
- } catch {
1274
- return "Total";
1275
- }
2206
+ //#region src/PivotTable.tsx
2207
+ function zt() {
2208
+ return D()("dashboard.total", "Total");
1276
2209
  }
1277
- function Ze() {
1278
- try {
1279
- let { t: e } = g(), t = e("dashboard.noDataAvailable");
1280
- return !t || t === "dashboard.noDataAvailable" ? "No data available" : t;
1281
- } catch {
1282
- return "No data available";
1283
- }
2210
+ function Bt() {
2211
+ return D()("dashboard.noDataAvailable", "No data available");
1284
2212
  }
1285
- function Qe(e, t) {
2213
+ function Vt(e, t) {
1286
2214
  if (!t) return String(e);
1287
2215
  let n = "", r = "", i = !1, a, o = t, s = o.match(/^([^0-9.,#]*)/);
1288
2216
  if (s && s[1]) {
@@ -1299,11 +2227,11 @@ function Qe(e, t) {
1299
2227
  }
1300
2228
  return n + l + r;
1301
2229
  }
1302
- var $e = "—";
1303
- function et(e, t) {
1304
- return e === "" ? $e : t?.[e] ?? e;
2230
+ var Ht = "—";
2231
+ function Ut(e, t) {
2232
+ return e === "" ? Ht : t?.[e] ?? e;
1305
2233
  }
1306
- function tt(e, t) {
2234
+ function Wt(e, t) {
1307
2235
  if (e.length === 0) return 0;
1308
2236
  switch (t) {
1309
2237
  case "sum": return e.reduce((e, t) => e + t, 0);
@@ -1314,30 +2242,30 @@ function tt(e, t) {
1314
2242
  default: return e.reduce((e, t) => e + t, 0);
1315
2243
  }
1316
2244
  }
1317
- var nt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: a, onDrillDown: o }) => {
1318
- let { title: s, rowField: c, columnField: l, valueField: u, aggregation: d = "sum", data: f = [], showRowTotals: p = !1, showColumnTotals: m = !1, format: h, columnColors: g, drillDown: _ } = e, v = Xe(), y = Ze(), b = i(_) && typeof o == "function", x = (e) => {
1319
- b && o({
2245
+ var Gt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2246
+ let { title: o, rowField: s, columnField: c, valueField: l, aggregation: d = "sum", data: f = [], showRowTotals: p = !1, showColumnTotals: m = !1, format: h, columnColors: g, drillDown: _ } = e, v = zt(), y = Bt(), b = u(_) && typeof a == "function", x = (e) => {
2247
+ b && a({
1320
2248
  ...e,
1321
2249
  rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
1322
2250
  colLabel: e.colKey === void 0 ? e.colLabel : r?.[e.colKey] ?? e.colKey
1323
2251
  });
1324
2252
  }, S = (e) => (t) => {
1325
2253
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
1326
- }, 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: D, matrix: O, rowTotals: k, colTotals: A, grandTotal: j } = V(() => {
2254
+ }, 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 } = K(() => {
1327
2255
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
1328
2256
  for (let r of w) {
1329
- let i = String(r[c] ?? ""), a = String(r[l] ?? ""), o = Number(r[u]) || 0;
2257
+ let i = String(r[s] ?? ""), a = String(r[c] ?? ""), o = Number(r[l]) || 0;
1330
2258
  e.set(i, !0), t.set(a, !0), n[i] || (n[i] = {}), n[i][a] || (n[i][a] = []), n[i][a].push(o);
1331
2259
  }
1332
- let r = Array.from(e.keys()), i = Array.from(t.keys()), a = {}, o = {}, s = {};
2260
+ let r = Array.from(e.keys()), i = Array.from(t.keys()), a = {}, o = {}, u = {};
1333
2261
  for (let e of r) {
1334
2262
  a[e] = {};
1335
2263
  let t = [];
1336
2264
  for (let r of i) {
1337
- let i = n[e]?.[r] ?? [], o = tt(i, d);
1338
- a[e][r] = o, t.push(...i), !s[r] && s[r];
2265
+ let i = n[e]?.[r] ?? [], o = Wt(i, d);
2266
+ a[e][r] = o, t.push(...i), !u[r] && u[r];
1339
2267
  }
1340
- o[e] = tt(t, d);
2268
+ o[e] = Wt(t, d);
1341
2269
  }
1342
2270
  for (let e of i) {
1343
2271
  let t = [];
@@ -1345,31 +2273,31 @@ var nt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
1345
2273
  let r = n[i]?.[e] ?? [];
1346
2274
  t.push(...r);
1347
2275
  }
1348
- s[e] = tt(t, d);
2276
+ u[e] = Wt(t, d);
1349
2277
  }
1350
2278
  let f = [];
1351
- for (let e of w) f.push(Number(e[u]) || 0);
2279
+ for (let e of w) f.push(Number(e[l]) || 0);
1352
2280
  return {
1353
2281
  rowKeys: r,
1354
2282
  colKeys: i,
1355
2283
  matrix: a,
1356
2284
  rowTotals: o,
1357
- colTotals: s,
1358
- grandTotal: tt(f, d)
2285
+ colTotals: u,
2286
+ grandTotal: Wt(f, d)
1359
2287
  };
1360
2288
  }, [
1361
2289
  w,
2290
+ s,
1362
2291
  c,
1363
2292
  l,
1364
- u,
1365
2293
  d
1366
- ]), M = (e) => Qe(e, h);
2294
+ ]), j = (e) => Vt(e, h);
1367
2295
  return w.length === 0 ? /* @__PURE__ */ Q("div", {
1368
- className: P("overflow-auto", t),
1369
- children: [s && /* @__PURE__ */ Z("h3", {
2296
+ className: V("overflow-auto", t),
2297
+ children: [o && /* @__PURE__ */ Z("h3", {
1370
2298
  className: "text-sm font-semibold mb-2",
1371
- children: s
1372
- }), /* @__PURE__ */ Z(E, {
2299
+ children: o
2300
+ }), /* @__PURE__ */ Z(I, {
1373
2301
  "data-testid": "pivot-empty-state",
1374
2302
  className: "py-8 gap-2 [&>h3]:hidden",
1375
2303
  icon: /* @__PURE__ */ Q("svg", {
@@ -1413,10 +2341,10 @@ var nt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
1413
2341
  description: y
1414
2342
  })]
1415
2343
  }) : /* @__PURE__ */ Q("div", {
1416
- className: P("overflow-auto", t),
1417
- children: [s && /* @__PURE__ */ Z("h3", {
2344
+ className: V("overflow-auto", t),
2345
+ children: [o && /* @__PURE__ */ Z("h3", {
1418
2346
  className: "text-sm font-semibold mb-2",
1419
- children: s
2347
+ children: o
1420
2348
  }), /* @__PURE__ */ Q("table", {
1421
2349
  className: "w-full text-sm border-collapse table-auto",
1422
2350
  role: "table",
@@ -1426,22 +2354,22 @@ var nt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
1426
2354
  children: [
1427
2355
  /* @__PURE__ */ Z("th", {
1428
2356
  className: "text-left p-2 font-medium text-muted-foreground whitespace-nowrap",
1429
- children: a || c
2357
+ children: i || s
1430
2358
  }),
1431
- D.map((e) => {
2359
+ E.map((e) => {
1432
2360
  let t = () => x({
1433
2361
  scope: "column",
1434
2362
  colKey: e
1435
2363
  });
1436
2364
  return /* @__PURE__ */ Z("th", {
1437
- className: P("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
1438
- title: e === "" ? `${l}: (empty)` : `${l}: ${e}`,
2365
+ className: V("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
2366
+ title: e === "" ? `${c}: (empty)` : `${c}: ${e}`,
1439
2367
  role: b ? "button" : void 0,
1440
2368
  tabIndex: b ? 0 : void 0,
1441
2369
  onClick: b ? t : void 0,
1442
2370
  onKeyDown: b ? S(t) : void 0,
1443
- "aria-label": b ? `Drill into ${l}: ${e || "(empty)"}` : void 0,
1444
- children: et(e, r)
2371
+ "aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
2372
+ children: Ut(e, r)
1445
2373
  }, e);
1446
2374
  }),
1447
2375
  p && /* @__PURE__ */ Z("th", {
@@ -1454,7 +2382,7 @@ var nt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
1454
2382
  className: "border-b border-border/50 hover:bg-muted/30",
1455
2383
  children: [
1456
2384
  /* @__PURE__ */ Z("td", {
1457
- className: P("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
2385
+ className: V("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
1458
2386
  role: b ? "button" : void 0,
1459
2387
  tabIndex: b ? 0 : void 0,
1460
2388
  onClick: b ? () => x({
@@ -1465,41 +2393,41 @@ var nt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
1465
2393
  scope: "row",
1466
2394
  rowKey: e
1467
2395
  })) : void 0,
1468
- "aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
1469
- children: et(e, n)
2396
+ "aria-label": b ? `Drill into ${s}: ${e || "(empty)"}` : void 0,
2397
+ children: Ut(e, n)
1470
2398
  }),
1471
- D.map((t) => {
1472
- let n = O[e]?.[t] ?? 0, r = () => x({
2399
+ E.map((t) => {
2400
+ let n = D[e]?.[t] ?? 0, r = () => x({
1473
2401
  scope: "cell",
1474
2402
  rowKey: e,
1475
2403
  colKey: t,
1476
2404
  value: n
1477
2405
  });
1478
2406
  return /* @__PURE__ */ Z("td", {
1479
- className: P("text-right p-2 tabular-nums", g?.[t], C),
2407
+ className: V("text-right p-2 tabular-nums", g?.[t], C),
1480
2408
  role: b ? "button" : void 0,
1481
2409
  tabIndex: b ? 0 : void 0,
1482
2410
  onClick: b ? r : void 0,
1483
2411
  onKeyDown: b ? S(r) : void 0,
1484
- "aria-label": b ? `Drill into ${c}=${e || "(empty)"}, ${l}=${t || "(empty)"}` : void 0,
1485
- children: M(n)
2412
+ "aria-label": b ? `Drill into ${s}=${e || "(empty)"}, ${c}=${t || "(empty)"}` : void 0,
2413
+ children: j(n)
1486
2414
  }, t);
1487
2415
  }),
1488
2416
  p && /* @__PURE__ */ Z("td", {
1489
- className: P("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
2417
+ className: V("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
1490
2418
  role: b ? "button" : void 0,
1491
2419
  tabIndex: b ? 0 : void 0,
1492
2420
  onClick: b ? () => x({
1493
2421
  scope: "row",
1494
2422
  rowKey: e,
1495
- value: k[e] ?? 0
2423
+ value: O[e] ?? 0
1496
2424
  }) : void 0,
1497
2425
  onKeyDown: b ? S(() => x({
1498
2426
  scope: "row",
1499
2427
  rowKey: e,
1500
- value: k[e] ?? 0
2428
+ value: O[e] ?? 0
1501
2429
  })) : void 0,
1502
- children: M(k[e] ?? 0)
2430
+ children: j(O[e] ?? 0)
1503
2431
  })
1504
2432
  ]
1505
2433
  }, e)) }),
@@ -1510,424 +2438,51 @@ var nt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
1510
2438
  className: "p-2",
1511
2439
  children: v
1512
2440
  }),
1513
- D.map((e) => /* @__PURE__ */ Z("td", {
1514
- className: P("text-right p-2 tabular-nums", C),
2441
+ E.map((e) => /* @__PURE__ */ Z("td", {
2442
+ className: V("text-right p-2 tabular-nums", C),
1515
2443
  role: b ? "button" : void 0,
1516
2444
  tabIndex: b ? 0 : void 0,
1517
2445
  onClick: b ? () => x({
1518
2446
  scope: "column",
1519
2447
  colKey: e,
1520
- value: A[e] ?? 0
2448
+ value: k[e] ?? 0
1521
2449
  }) : void 0,
1522
2450
  onKeyDown: b ? S(() => x({
1523
2451
  scope: "column",
1524
2452
  colKey: e,
1525
- value: A[e] ?? 0
2453
+ value: k[e] ?? 0
1526
2454
  })) : void 0,
1527
- children: M(A[e] ?? 0)
2455
+ children: j(k[e] ?? 0)
1528
2456
  }, e)),
1529
2457
  p && /* @__PURE__ */ Z("td", {
1530
- className: P("text-right p-2 tabular-nums font-bold", C),
2458
+ className: V("text-right p-2 tabular-nums font-bold", C),
1531
2459
  role: b ? "button" : void 0,
1532
2460
  tabIndex: b ? 0 : void 0,
1533
2461
  onClick: b ? () => x({
1534
2462
  scope: "total",
1535
- value: j
2463
+ value: A
1536
2464
  }) : void 0,
1537
2465
  onKeyDown: b ? S(() => x({
1538
2466
  scope: "total",
1539
- value: j
2467
+ value: A
1540
2468
  })) : void 0,
1541
- children: M(j)
2469
+ children: j(A)
1542
2470
  })
1543
2471
  ]
1544
2472
  }) })
1545
2473
  ]
1546
2474
  })]
1547
2475
  });
1548
- };
1549
- //#endregion
1550
- //#region src/ObjectDataTable.tsx
1551
- function rt(e) {
1552
- return e.map((e) => typeof e == "string" ? {
1553
- header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
1554
- accessorKey: e
1555
- } : e);
1556
- }
1557
- function it(e, t) {
1558
- if (!t?.fields) return [];
1559
- let n = {};
1560
- if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
1561
- else for (let [e, r] of Object.entries(t.fields)) n[e] = {
1562
- name: e,
1563
- ...r
1564
- };
1565
- let r = (e) => e === "lookup" || e === "reference" || e === "master_detail" || e === "user" || e === "owner", i = Array.isArray(e.columns) ? e.columns : [], a = /* @__PURE__ */ new Set();
1566
- if (i.length > 0) {
1567
- let e = i.map((e) => typeof e == "string" ? e : e.accessorKey || e.name).filter(Boolean);
1568
- for (let t of e) {
1569
- let e = n[t];
1570
- e && r(e.type) && a.add(t);
1571
- }
1572
- } else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
1573
- return Array.from(a);
1574
- }
1575
- var at = ({ schema: e, dataSource: t, className: n }) => {
1576
- let i = z(l), o = t || i?.dataSource, s = d(e.bind), { fieldLabel: u, fieldOptionLabel: f } = _(), p = "No data available", m = "No data source available for";
1577
- try {
1578
- let { t: e } = g(), t = e("dashboard.noDataAvailable");
1579
- t && t !== "dashboard.noDataAvailable" && (p = t);
1580
- let n = e("dashboard.noDataSourceFor");
1581
- n && n !== "dashboard.noDataSourceFor" && (m = n);
1582
- } catch {}
1583
- let [h, v] = H([]), [y, b] = H(null), [x, S] = H(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, w] = H(null);
1584
- B(() => {
1585
- let t = !0;
1586
- return e.objectName && !s && (!e.data || e.data.length === 0) ? (async () => {
1587
- if (!o || !e.objectName) {
1588
- t && S(!1);
1589
- return;
1590
- }
1591
- t && (S(!0), w(null));
1592
- try {
1593
- let n;
1594
- if (typeof o.find == "function") {
1595
- let t = it(e, y), i = { $filter: a(e.filter) };
1596
- t.length && (i.$expand = t), n = r(await o.find(e.objectName, i));
1597
- } else return;
1598
- t && v(n);
1599
- } catch (e) {
1600
- console.error("[ObjectDataTable] Fetch error:", e), t && w(e instanceof Error ? e.message : "Failed to load data");
1601
- } finally {
1602
- t && S(!1);
1603
- }
1604
- })() : t && S(!1), () => {
1605
- t = !1;
1606
- };
1607
- }, [
1608
- e.objectName,
1609
- o,
1610
- s,
1611
- e.data,
1612
- e.filter,
1613
- y
1614
- ]), B(() => {
1615
- let t = !0;
1616
- if (!(!o || !e.objectName || typeof o.getObjectSchema != "function")) return o.getObjectSchema(e.objectName).then((e) => {
1617
- t && b(e);
1618
- }).catch(() => {}), () => {
1619
- t = !1;
1620
- };
1621
- }, [e.objectName, o]);
1622
- let T = s || e.data || h, E = Array.isArray(T) ? T : [], D = V(() => {
1623
- let t = e.objectName, n = {};
1624
- if (y?.fields) {
1625
- let e = y.fields;
1626
- if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
1627
- else for (let [t, r] of Object.entries(e)) n[t] = {
1628
- name: t,
1629
- ...r
1630
- };
1631
- }
1632
- let r = (e) => {
1633
- let n = e.charAt(0).toUpperCase() + e.slice(1).replace(/([A-Z])/g, " $1");
1634
- return t ? u(t, e, n) : n;
1635
- }, i = (e) => {
1636
- let r = n[e.accessorKey], i = e.referenceTo ?? r?.referenceTo ?? (typeof r?.reference == "string" ? r.reference : r?.reference?.to) ?? r?.target, a = e.options ?? r?.options;
1637
- t && a && (r?.type === "select" || r?.type === "picklist" || r?.type === "dropdown" || r?.type === "status") && (a = a.map((n) => {
1638
- if (n == null) return n;
1639
- let r = typeof n == "object" ? n.value : n, i = typeof n == "object" && n.label || String(r);
1640
- return {
1641
- value: r,
1642
- label: f(t, e.accessorKey, String(r), i),
1643
- color: typeof n == "object" ? n.color : void 0
1644
- };
1645
- }));
1646
- let o = {
1647
- name: e.accessorKey,
1648
- label: e.header,
1649
- type: e.type ?? r?.type,
1650
- options: a,
1651
- referenceTo: i,
1652
- format: e.format ?? r?.format,
1653
- currency: e.currency ?? r?.currency ?? r?.defaultCurrency,
1654
- decimals: e.decimals ?? r?.decimals ?? r?.precision ?? r?.scale
1655
- }, s = new Set([
1656
- "currency",
1657
- "money",
1658
- "number",
1659
- "integer",
1660
- "decimal",
1661
- "float",
1662
- "percent",
1663
- "percentage"
1664
- ]), c = e.align ?? (s.has(o.type) || typeof o.format == "string" && /^[\$¥€£]|%$|0/.test(o.format) ? "right" : void 0);
1665
- if (typeof e.cell == "function") return {
1666
- ...e,
1667
- ...o,
1668
- align: c
1669
- };
1670
- let l = (e) => {
1671
- if (e == null || e === "") return "";
1672
- let t = o.format;
1673
- if (typeof t == "string" && /^\$|¥|€|£/.test(t) && typeof e == "number") {
1674
- let n = {
1675
- $: "USD",
1676
- "¥": "JPY",
1677
- "€": "EUR",
1678
- "£": "GBP"
1679
- }[t[0]];
1680
- return Ce(e, o.currency || n);
1681
- }
1682
- if (typeof t == "string" && /%/.test(t) && typeof e == "number") {
1683
- let n = (t.match(/0\.(0+)%/) || [, ""])[1].length;
1684
- return Te((e > 1 ? e / 100 : e) * 100, n);
1685
- }
1686
- return typeof t == "string" && /[YMDHms]/.test(t) ? we(e, t) : /* @__PURE__ */ Z(Ee(De(o)), {
1687
- value: e,
1688
- field: o
1689
- });
1690
- };
1691
- return {
1692
- ...e,
1693
- ...o,
1694
- align: c,
1695
- cell: l
1696
- };
1697
- };
1698
- if (e.columns && e.columns.length > 0) {
1699
- let n = rt(e.columns);
1700
- return (t ? n.map((e) => ({
1701
- ...e,
1702
- header: u(t, e.accessorKey, e.header)
1703
- })) : n).map(i);
1704
- }
1705
- if (E.length === 0) return [];
1706
- let a = new Set([
1707
- "id",
1708
- "organization_id",
1709
- "tenant_id",
1710
- "created_at",
1711
- "updated_at",
1712
- "created_by",
1713
- "updated_by",
1714
- "deleted_at",
1715
- "deleted_by",
1716
- "version",
1717
- "_id",
1718
- "__typename"
1719
- ]), o = (e, t) => t && (t.isSystem === !0 || t.system === !0) ? !0 : a.has(e);
1720
- return (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !o(e, n[e])) : Object.keys(E[0]).filter((e) => !e.startsWith("_") && !o(e))).map((e) => i({
1721
- header: r(e),
1722
- accessorKey: e
1723
- }));
1724
- }, [
1725
- e.columns,
1726
- e.objectName,
1727
- E,
1728
- y,
1729
- u,
1730
- f
1731
- ]);
1732
- if (x && E.length === 0) return /* @__PURE__ */ Z("div", {
1733
- className: P("overflow-auto", n),
1734
- "data-testid": "table-loading",
1735
- children: /* @__PURE__ */ Q("div", {
1736
- className: "space-y-2 p-2",
1737
- children: [/* @__PURE__ */ Q("div", {
1738
- className: "flex gap-2",
1739
- children: [
1740
- /* @__PURE__ */ Z(N, { className: "h-6 w-1/4" }),
1741
- /* @__PURE__ */ Z(N, { className: "h-6 w-1/4" }),
1742
- /* @__PURE__ */ Z(N, { className: "h-6 w-1/4" }),
1743
- /* @__PURE__ */ Z(N, { className: "h-6 w-1/4" })
1744
- ]
1745
- }), [
1746
- 1,
1747
- 2,
1748
- 3,
1749
- 4
1750
- ].map((e) => /* @__PURE__ */ Q("div", {
1751
- className: "flex gap-2",
1752
- children: [
1753
- /* @__PURE__ */ Z(N, { className: "h-5 w-1/4" }),
1754
- /* @__PURE__ */ Z(N, { className: "h-5 w-1/4" }),
1755
- /* @__PURE__ */ Z(N, { className: "h-5 w-1/4" }),
1756
- /* @__PURE__ */ Z(N, { className: "h-5 w-1/4" })
1757
- ]
1758
- }, e))]
1759
- })
1760
- });
1761
- if (C) return /* @__PURE__ */ Z("div", {
1762
- className: P("overflow-auto", n),
1763
- "data-testid": "table-error",
1764
- children: /* @__PURE__ */ Q("div", {
1765
- className: "flex flex-col items-center justify-center py-8 text-destructive",
1766
- "data-testid": "table-error-message",
1767
- children: [/* @__PURE__ */ Q("svg", {
1768
- xmlns: "http://www.w3.org/2000/svg",
1769
- className: "h-8 w-8 mb-2 opacity-60",
1770
- viewBox: "0 0 24 24",
1771
- fill: "none",
1772
- stroke: "currentColor",
1773
- strokeWidth: "1.5",
1774
- strokeLinecap: "round",
1775
- strokeLinejoin: "round",
1776
- children: [
1777
- /* @__PURE__ */ Z("circle", {
1778
- cx: "12",
1779
- cy: "12",
1780
- r: "10"
1781
- }),
1782
- /* @__PURE__ */ Z("line", {
1783
- x1: "12",
1784
- y1: "8",
1785
- x2: "12",
1786
- y2: "12"
1787
- }),
1788
- /* @__PURE__ */ Z("line", {
1789
- x1: "12",
1790
- y1: "16",
1791
- x2: "12.01",
1792
- y2: "16"
1793
- })
1794
- ]
1795
- }), /* @__PURE__ */ Z("p", {
1796
- className: "text-xs",
1797
- children: C
1798
- })]
1799
- })
1800
- });
1801
- if (!o && e.objectName && E.length === 0) return /* @__PURE__ */ Z("div", {
1802
- className: P("overflow-auto", n),
1803
- children: /* @__PURE__ */ Z("div", {
1804
- className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1805
- children: /* @__PURE__ */ Q("p", {
1806
- className: "text-xs",
1807
- children: [
1808
- m,
1809
- " “",
1810
- e.objectName,
1811
- "”"
1812
- ]
1813
- })
1814
- })
1815
- });
1816
- if (E.length === 0) return /* @__PURE__ */ Z("div", {
1817
- className: P("overflow-auto", n),
1818
- "data-testid": "table-empty-state",
1819
- children: /* @__PURE__ */ Q("div", {
1820
- className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1821
- children: [/* @__PURE__ */ Q("svg", {
1822
- xmlns: "http://www.w3.org/2000/svg",
1823
- className: "h-8 w-8 mb-2 opacity-40",
1824
- viewBox: "0 0 24 24",
1825
- fill: "none",
1826
- stroke: "currentColor",
1827
- strokeWidth: "1.5",
1828
- strokeLinecap: "round",
1829
- strokeLinejoin: "round",
1830
- children: [
1831
- /* @__PURE__ */ Z("rect", {
1832
- x: "3",
1833
- y: "3",
1834
- width: "18",
1835
- height: "18",
1836
- rx: "2",
1837
- ry: "2"
1838
- }),
1839
- /* @__PURE__ */ Z("line", {
1840
- x1: "3",
1841
- y1: "9",
1842
- x2: "21",
1843
- y2: "9"
1844
- }),
1845
- /* @__PURE__ */ Z("line", {
1846
- x1: "9",
1847
- y1: "21",
1848
- x2: "9",
1849
- y2: "9"
1850
- })
1851
- ]
1852
- }), /* @__PURE__ */ Z("p", {
1853
- className: "text-xs",
1854
- children: p
1855
- })]
1856
- })
1857
- });
1858
- let O = {
1859
- ...e,
1860
- type: "data-table",
1861
- data: E,
1862
- columns: D
1863
- };
1864
- return /* @__PURE__ */ Q("div", {
1865
- className: P("relative", n),
1866
- children: [/* @__PURE__ */ Z(j, { active: x && E.length > 0 }), /* @__PURE__ */ Z(c, {
1867
- schema: O,
1868
- className: n
1869
- })]
1870
- });
1871
- }, ot = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: l, className: u, report: d }) => {
1872
- let f = d && typeof d == "object" && (Array.isArray(d.columns) || "objectName" in d), p = /* @__PURE__ */ Z("div", {
1873
- className: P("overflow-auto", u),
1874
- "data-testid": "drill-down-body",
1875
- children: f ? (() => {
1876
- let e = d.filter, t = e ? a ? { $and: [e, a] } : e : a;
1877
- return /* @__PURE__ */ Z(c, { schema: {
1878
- ...d,
1879
- type: "spec-report",
1880
- report: {
1881
- ...d,
1882
- filter: t
1883
- },
1884
- filter: t
1885
- } });
1886
- })() : /* @__PURE__ */ Z(at, {
1887
- schema: {
1888
- type: "object-data-table",
1889
- objectName: i,
1890
- filter: a,
1891
- columns: s?.map((e) => ({
1892
- accessorKey: e,
1893
- header: e
1894
- })),
1895
- pagination: !0,
1896
- searchable: !1,
1897
- pageSize: l
1898
- },
1899
- dataSource: o
1900
- })
1901
- });
1902
- return r === "dialog" ? /* @__PURE__ */ Z(D, {
1903
- open: e,
1904
- onOpenChange: (e) => !e && t(),
1905
- children: /* @__PURE__ */ Q(O, {
1906
- className: "max-w-5xl",
1907
- children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Z(A, { children: n }) }), p]
1908
- })
1909
- }) : /* @__PURE__ */ Z(M, {
1910
- open: e,
1911
- onOpenChange: (e) => !e && t(),
1912
- children: /* @__PURE__ */ Q(ee, {
1913
- side: "right",
1914
- className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1915
- children: [/* @__PURE__ */ Z(te, { children: /* @__PURE__ */ Z(ne, { children: n }) }), /* @__PURE__ */ Z("div", {
1916
- className: "flex-1 overflow-hidden mt-2",
1917
- children: p
1918
- })]
1919
- })
1920
- });
1921
- }, st = ({ schema: e, dataSource: t, className: s }) => {
1922
- let c = z(l), u = t || c?.dataSource, f = d(e.bind), [p, m] = H([]), [h, g] = H(!1), [v, y] = H(null), [b, x] = H({}), [S, C] = H({}), [w, T] = H(null), { fieldLabel: E, fieldOptionLabel: D } = _(), O = ae(E), k = ae(D);
1923
- B(() => {
1924
- O.current = E, k.current = D;
1925
- }, [E, D]), B(() => {
1926
- if (!u || !e.objectName) return;
1927
- let t = u.getObjectSchema;
2476
+ }, Kt = ({ schema: e, dataSource: t, className: n }) => {
2477
+ let r = ue(h), i = t || r?.dataSource, s = _(e.bind), [c, l] = q([]), [p, m] = q(!1), [g, v] = q(null), [y, b] = q({}), [x, S] = q({}), [C, w] = q(null), { fieldLabel: T, fieldOptionLabel: D } = E(), O = de(T), k = de(D);
2478
+ G(() => {
2479
+ O.current = T, k.current = D;
2480
+ }, [T, D]), G(() => {
2481
+ if (!i || !e.objectName) return;
2482
+ let t = i.getObjectSchema;
1928
2483
  if (typeof t != "function") return;
1929
2484
  let n = !0;
1930
- return Promise.resolve(t.call(u, e.objectName)).then((t) => {
2485
+ return Promise.resolve(t.call(i, e.objectName)).then((t) => {
1931
2486
  if (!n || !t?.fields) return;
1932
2487
  let r = e.objectName, i = {}, a = {};
1933
2488
  for (let [e, n] of Object.entries(t.fields)) {
@@ -1943,24 +2498,24 @@ var at = ({ schema: e, dataSource: t, className: n }) => {
1943
2498
  Object.keys(t).length > 0 && (i[e] = t);
1944
2499
  }
1945
2500
  }
1946
- x(i), C(a);
2501
+ b(i), S(a);
1947
2502
  }).catch(() => {}), () => {
1948
2503
  n = !1;
1949
2504
  };
1950
- }, [u, e.objectName]), B(() => {
2505
+ }, [i, e.objectName]), G(() => {
1951
2506
  let t = !0;
1952
- return e.objectName && !f && (!e.data || e.data.length === 0) && (async () => {
1953
- if (!(!u || !e.objectName)) {
1954
- t && (g(!0), y(null));
2507
+ return e.objectName && !s && (!e.data || e.data.length === 0) && (async () => {
2508
+ if (!(!i || !e.objectName)) {
2509
+ t && (m(!0), v(null));
1955
2510
  try {
1956
2511
  let n;
1957
- if (typeof u.find == "function") n = r(await u.find(e.objectName, { $filter: a(e.filter) }));
2512
+ if (typeof i.find == "function") n = o(await i.find(e.objectName, { $filter: d(e.filter) }));
1958
2513
  else return;
1959
- t && m(n);
2514
+ t && l(n);
1960
2515
  } catch (e) {
1961
- console.error("[ObjectPivotTable] Fetch error:", e), t && y(e instanceof Error ? e.message : "Failed to load data");
2516
+ console.error("[ObjectPivotTable] Fetch error:", e), t && v(e instanceof Error ? e.message : "Failed to load data");
1962
2517
  } finally {
1963
- t && g(!1);
2518
+ t && m(!1);
1964
2519
  }
1965
2520
  }
1966
2521
  })(), () => {
@@ -1968,14 +2523,14 @@ var at = ({ schema: e, dataSource: t, className: n }) => {
1968
2523
  };
1969
2524
  }, [
1970
2525
  e.objectName,
1971
- u,
1972
- f,
2526
+ i,
2527
+ s,
1973
2528
  e.data,
1974
2529
  e.filter
1975
2530
  ]);
1976
- let A = f || e.data || p, j = Array.isArray(A) ? A : [];
1977
- if (h && j.length === 0) return /* @__PURE__ */ Q("div", {
1978
- className: P("overflow-auto", s),
2531
+ let A = s || e.data || c, j = Array.isArray(A) ? A : [];
2532
+ if (p && j.length === 0) return /* @__PURE__ */ Q("div", {
2533
+ className: V("overflow-auto", n),
1979
2534
  "data-testid": "pivot-loading",
1980
2535
  children: [e.title && /* @__PURE__ */ Z("h3", {
1981
2536
  className: "text-sm font-semibold mb-2",
@@ -1985,10 +2540,10 @@ var at = ({ schema: e, dataSource: t, className: n }) => {
1985
2540
  children: [/* @__PURE__ */ Q("div", {
1986
2541
  className: "flex gap-2",
1987
2542
  children: [
1988
- /* @__PURE__ */ Z(N, { className: "h-6 w-24" }),
1989
- /* @__PURE__ */ Z(N, { className: "h-6 w-20" }),
1990
- /* @__PURE__ */ Z(N, { className: "h-6 w-20" }),
1991
- /* @__PURE__ */ Z(N, { className: "h-6 w-20" })
2543
+ /* @__PURE__ */ Z(B, { className: "h-6 w-24" }),
2544
+ /* @__PURE__ */ Z(B, { className: "h-6 w-20" }),
2545
+ /* @__PURE__ */ Z(B, { className: "h-6 w-20" }),
2546
+ /* @__PURE__ */ Z(B, { className: "h-6 w-20" })
1992
2547
  ]
1993
2548
  }), [
1994
2549
  1,
@@ -1997,16 +2552,16 @@ var at = ({ schema: e, dataSource: t, className: n }) => {
1997
2552
  ].map((e) => /* @__PURE__ */ Q("div", {
1998
2553
  className: "flex gap-2",
1999
2554
  children: [
2000
- /* @__PURE__ */ Z(N, { className: "h-5 w-24" }),
2001
- /* @__PURE__ */ Z(N, { className: "h-5 w-20" }),
2002
- /* @__PURE__ */ Z(N, { className: "h-5 w-20" }),
2003
- /* @__PURE__ */ Z(N, { className: "h-5 w-20" })
2555
+ /* @__PURE__ */ Z(B, { className: "h-5 w-24" }),
2556
+ /* @__PURE__ */ Z(B, { className: "h-5 w-20" }),
2557
+ /* @__PURE__ */ Z(B, { className: "h-5 w-20" }),
2558
+ /* @__PURE__ */ Z(B, { className: "h-5 w-20" })
2004
2559
  ]
2005
2560
  }, e))]
2006
2561
  })]
2007
2562
  });
2008
- if (v) return /* @__PURE__ */ Q("div", {
2009
- className: P("overflow-auto", s),
2563
+ if (g) return /* @__PURE__ */ Q("div", {
2564
+ className: V("overflow-auto", n),
2010
2565
  "data-testid": "pivot-error",
2011
2566
  children: [e.title && /* @__PURE__ */ Z("h3", {
2012
2567
  className: "text-sm font-semibold mb-2",
@@ -2044,12 +2599,12 @@ var at = ({ schema: e, dataSource: t, className: n }) => {
2044
2599
  ]
2045
2600
  }), /* @__PURE__ */ Z("p", {
2046
2601
  className: "text-xs",
2047
- children: v
2602
+ children: g
2048
2603
  })]
2049
2604
  })]
2050
2605
  });
2051
- if (!u && e.objectName && j.length === 0) return /* @__PURE__ */ Q("div", {
2052
- className: P("overflow-auto", s),
2606
+ if (!i && e.objectName && j.length === 0) return /* @__PURE__ */ Q("div", {
2607
+ className: V("overflow-auto", n),
2053
2608
  children: [e.title && /* @__PURE__ */ Z("h3", {
2054
2609
  className: "text-sm font-semibold mb-2",
2055
2610
  children: e.title
@@ -2068,37 +2623,37 @@ var at = ({ schema: e, dataSource: t, className: n }) => {
2068
2623
  let M = {
2069
2624
  ...e,
2070
2625
  data: j
2071
- }, ee = e.rowField ? b[e.rowField] : void 0, te = e.columnField ? b[e.columnField] : void 0, ne = e.rowField ? S[e.rowField] : void 0, F = e.drillDown;
2072
- return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(nt, {
2626
+ }, 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;
2627
+ return /* @__PURE__ */ Q(Be, { children: [/* @__PURE__ */ Z(Gt, {
2073
2628
  schema: M,
2074
- className: s,
2075
- rowLabels: ee,
2076
- columnLabels: te,
2077
- rowFieldLabel: ne,
2078
- onDrillDown: i(F) ? (e) => T(e) : void 0
2629
+ className: n,
2630
+ rowLabels: N,
2631
+ columnLabels: P,
2632
+ rowFieldLabel: F,
2633
+ onDrillDown: u(I) ? (e) => w(e) : void 0
2079
2634
  }), (() => {
2080
- if (!w || !e.objectName) return null;
2081
- let t = n(F, w, {
2635
+ if (!C || !e.objectName) return null;
2636
+ let t = a(I, C, {
2082
2637
  rowField: e.rowField,
2083
2638
  columnField: e.columnField
2084
- }), r = {
2639
+ }), n = {
2085
2640
  ...e.filter || {},
2086
2641
  ...t
2087
2642
  };
2088
- return /* @__PURE__ */ Z(ot, {
2643
+ return /* @__PURE__ */ Z(at, {
2089
2644
  open: !0,
2090
- onClose: () => T(null),
2091
- title: o(F, w, e.title || "Details"),
2092
- target: F?.target ?? "drawer",
2645
+ onClose: () => w(null),
2646
+ title: f(I, C, e.title || "Details"),
2647
+ target: I?.target ?? "drawer",
2093
2648
  objectName: e.objectName,
2094
- filter: r,
2095
- dataSource: u,
2096
- columns: F?.columns,
2097
- maxRows: F?.maxRows,
2098
- report: F?.report
2649
+ filter: n,
2650
+ dataSource: i,
2651
+ columns: I?.columns,
2652
+ maxRows: I?.maxRows,
2653
+ report: I?.report
2099
2654
  });
2100
2655
  })()] });
2101
- }, ct = {
2656
+ }, qt = {
2102
2657
  breadcrumb: ["Dashboard", "Configuration"],
2103
2658
  sections: [
2104
2659
  {
@@ -2224,12 +2779,12 @@ var at = ({ schema: e, dataSource: t, className: n }) => {
2224
2779
  }
2225
2780
  ]
2226
2781
  };
2227
- function lt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2228
- let { draft: a, isDirty: o, updateField: s, discard: c } = I(n, { onUpdate: i });
2229
- return /* @__PURE__ */ Z(w, {
2782
+ function Jt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2783
+ let { draft: a, isDirty: o, updateField: s, discard: c } = se(n, { onUpdate: i });
2784
+ return /* @__PURE__ */ Z(P, {
2230
2785
  open: e,
2231
2786
  onClose: t,
2232
- schema: ct,
2787
+ schema: qt,
2233
2788
  draft: a,
2234
2789
  isDirty: o,
2235
2790
  onFieldChange: s,
@@ -2239,7 +2794,7 @@ function lt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2239
2794
  }
2240
2795
  //#endregion
2241
2796
  //#region src/WidgetConfigPanel.tsx
2242
- var ut = [
2797
+ var Yt = [
2243
2798
  {
2244
2799
  value: "metric",
2245
2800
  label: "Metric"
@@ -2284,7 +2839,7 @@ var ut = [
2284
2839
  value: "pivot",
2285
2840
  label: "Pivot Table"
2286
2841
  }
2287
- ], dt = [
2842
+ ], Xt = [
2288
2843
  {
2289
2844
  value: "default",
2290
2845
  label: "Default"
@@ -2317,7 +2872,7 @@ var ut = [
2317
2872
  value: "danger",
2318
2873
  label: "Danger"
2319
2874
  }
2320
- ], ft = [
2875
+ ], Zt = [
2321
2876
  {
2322
2877
  value: "count",
2323
2878
  label: "Count"
@@ -2338,7 +2893,7 @@ var ut = [
2338
2893
  value: "max",
2339
2894
  label: "Max"
2340
2895
  }
2341
- ], pt = [
2896
+ ], Qt = [
2342
2897
  "bar",
2343
2898
  "horizontal-bar",
2344
2899
  "line",
@@ -2347,17 +2902,17 @@ var ut = [
2347
2902
  "donut",
2348
2903
  "scatter",
2349
2904
  "funnel"
2350
- ], mt = [
2905
+ ], $t = [
2351
2906
  "bar",
2352
2907
  "horizontal-bar",
2353
2908
  "line",
2354
2909
  "area",
2355
2910
  "scatter"
2356
- ], ht = [
2911
+ ], en = [
2357
2912
  "pie",
2358
2913
  "donut",
2359
2914
  "funnel"
2360
- ], gt = ["metric", ...pt], _t = [...pt], vt = [
2915
+ ], tn = ["metric", ...Qt], nn = [...Qt], rn = [
2361
2916
  "pivot",
2362
2917
  "metric",
2363
2918
  "bar",
@@ -2366,52 +2921,57 @@ var ut = [
2366
2921
  "area",
2367
2922
  "pie",
2368
2923
  "donut",
2369
- "funnel"
2924
+ "funnel",
2925
+ "scatter",
2926
+ "treemap",
2927
+ "sankey",
2928
+ "table",
2929
+ "list"
2370
2930
  ];
2371
- function yt(e) {
2372
- return !!e && pt.includes(e);
2931
+ function an(e) {
2932
+ return !!e && Qt.includes(e);
2373
2933
  }
2374
- function bt(e) {
2375
- return !!e && mt.includes(e);
2934
+ function on(e) {
2935
+ return !!e && $t.includes(e);
2376
2936
  }
2377
- function xt(e) {
2378
- return !!e && _t.includes(e);
2937
+ function sn(e) {
2938
+ return !!e && nn.includes(e);
2379
2939
  }
2380
- function St(e) {
2381
- return !!e && gt.includes(e);
2940
+ function cn(e) {
2941
+ return !!e && tn.includes(e);
2382
2942
  }
2383
- function Ct(e) {
2384
- return !!e && vt.includes(e);
2943
+ function ln(e) {
2944
+ return !!e && rn.includes(e);
2385
2945
  }
2386
- var wt = [{
2946
+ var un = [{
2387
2947
  value: "drawer",
2388
2948
  label: "Side drawer"
2389
2949
  }, {
2390
2950
  value: "dialog",
2391
2951
  label: "Center dialog"
2392
- }], Tt = [{
2952
+ }], dn = [{
2393
2953
  value: "group",
2394
2954
  label: "Group"
2395
2955
  }, {
2396
2956
  value: "value",
2397
2957
  label: "Value"
2398
- }], Et = [{
2958
+ }], fn = [{
2399
2959
  value: "asc",
2400
2960
  label: "↑"
2401
2961
  }, {
2402
2962
  value: "desc",
2403
2963
  label: "↓"
2404
2964
  }];
2405
- function Dt(e, t, n, r) {
2965
+ function pn(e, t, n, r) {
2406
2966
  return {
2407
2967
  key: e,
2408
2968
  label: t,
2409
2969
  type: "custom",
2410
- render: (i, a, o) => /* @__PURE__ */ Z(T, {
2970
+ render: (i, a, o) => /* @__PURE__ */ Z(F, {
2411
2971
  label: t,
2412
2972
  children: /* @__PURE__ */ Z("div", {
2413
2973
  "data-testid": `config-field-${e}`,
2414
- children: /* @__PURE__ */ Z(C, {
2974
+ children: /* @__PURE__ */ Z(N, {
2415
2975
  options: r ?? [],
2416
2976
  value: i ?? "",
2417
2977
  onValueChange: a,
@@ -2425,16 +2985,16 @@ function Dt(e, t, n, r) {
2425
2985
  })
2426
2986
  };
2427
2987
  }
2428
- function Ot(e, t, n) {
2988
+ function mn(e, t, n) {
2429
2989
  let r = e && e.length > 0, i = r ? {
2430
2990
  key: "object",
2431
2991
  label: "Data source",
2432
2992
  type: "custom",
2433
- render: (t, n) => /* @__PURE__ */ Z(T, {
2993
+ render: (t, n) => /* @__PURE__ */ Z(F, {
2434
2994
  label: "Data source",
2435
2995
  children: /* @__PURE__ */ Z("div", {
2436
2996
  "data-testid": "config-field-object",
2437
- children: /* @__PURE__ */ Z(C, {
2997
+ children: /* @__PURE__ */ Z(N, {
2438
2998
  options: e,
2439
2999
  value: t ?? "",
2440
3000
  onValueChange: n,
@@ -2451,38 +3011,38 @@ function Ot(e, t, n) {
2451
3011
  type: "input",
2452
3012
  placeholder: "Object name"
2453
3013
  }, a = r ? {
2454
- ...Dt("categoryField", "Category field", "Select field…", t),
3014
+ ...pn("categoryField", "Category field", "Select field…", t),
2455
3015
  helpText: "Group records by this field (one bar/slice/segment per value).",
2456
- visibleWhen: (e) => xt(e.type)
3016
+ visibleWhen: (e) => sn(e.type)
2457
3017
  } : {
2458
3018
  key: "categoryField",
2459
3019
  label: "Category field",
2460
3020
  type: "input",
2461
3021
  placeholder: "e.g. status",
2462
3022
  helpText: "Group records by this field (one bar/slice/segment per value).",
2463
- visibleWhen: (e) => xt(e.type)
3023
+ visibleWhen: (e) => sn(e.type)
2464
3024
  }, o = r ? {
2465
- ...Dt("valueField", "Value field", "Select field…", t),
3025
+ ...pn("valueField", "Value field", "Select field…", t),
2466
3026
  helpText: "Field to aggregate (sum / average / min / max).",
2467
- visibleWhen: (e) => St(e.type) && (e.aggregate ?? "count") !== "count"
3027
+ visibleWhen: (e) => cn(e.type) && (e.aggregate ?? "count") !== "count"
2468
3028
  } : {
2469
3029
  key: "valueField",
2470
3030
  label: "Value field",
2471
3031
  type: "input",
2472
3032
  placeholder: "e.g. amount",
2473
3033
  helpText: "Field to aggregate (sum / average / min / max).",
2474
- visibleWhen: (e) => St(e.type) && (e.aggregate ?? "count") !== "count"
2475
- }, s = r ? Dt("rowField", "Field", "Select row field…", t) : {
3034
+ visibleWhen: (e) => cn(e.type) && (e.aggregate ?? "count") !== "count"
3035
+ }, s = r ? pn("rowField", "Field", "Select row field…", t) : {
2476
3036
  key: "rowField",
2477
3037
  label: "Field",
2478
3038
  type: "input",
2479
3039
  placeholder: "e.g. owner"
2480
- }, c = r ? Dt("columnField", "Field", "Select column field…", t) : {
3040
+ }, c = r ? pn("columnField", "Field", "Select column field…", t) : {
2481
3041
  key: "columnField",
2482
3042
  label: "Field",
2483
3043
  type: "input",
2484
3044
  placeholder: "e.g. stage"
2485
- }, l = r ? Dt("valueField", "Field", "Select value field…", t) : {
3045
+ }, l = r ? pn("valueField", "Field", "Select value field…", t) : {
2486
3046
  key: "valueField",
2487
3047
  label: "Field",
2488
3048
  type: "input",
@@ -2492,7 +3052,7 @@ function Ot(e, t, n) {
2492
3052
  breadcrumb: ["Dashboard", {
2493
3053
  pivot: "Pivot table",
2494
3054
  table: "Table"
2495
- }[n ?? ""] ?? (yt(n) ? "Chart" : "Widget")],
3055
+ }[n ?? ""] ?? (an(n) ? "Chart" : "Widget")],
2496
3056
  sections: [
2497
3057
  {
2498
3058
  key: "general",
@@ -2514,7 +3074,7 @@ function Ot(e, t, n) {
2514
3074
  key: "type",
2515
3075
  label: "Widget type",
2516
3076
  type: "select",
2517
- options: ut,
3077
+ options: Yt,
2518
3078
  defaultValue: "metric"
2519
3079
  }
2520
3080
  ]
@@ -2532,10 +3092,10 @@ function Ot(e, t, n) {
2532
3092
  key: "aggregate",
2533
3093
  label: "Aggregation",
2534
3094
  type: "select",
2535
- options: ft,
3095
+ options: Zt,
2536
3096
  defaultValue: "count",
2537
3097
  helpText: "Count ignores Value field; Sum / Avg / Min / Max require it.",
2538
- visibleWhen: (e) => St(e.type)
3098
+ visibleWhen: (e) => cn(e.type)
2539
3099
  }
2540
3100
  ]
2541
3101
  },
@@ -2557,14 +3117,14 @@ function Ot(e, t, n) {
2557
3117
  key: "rowSortBy",
2558
3118
  label: "Sort by",
2559
3119
  type: "icon-group",
2560
- options: Tt,
3120
+ options: dn,
2561
3121
  defaultValue: "group"
2562
3122
  },
2563
3123
  {
2564
3124
  key: "rowSortOrder",
2565
3125
  label: "Sort order",
2566
3126
  type: "icon-group",
2567
- options: Et,
3127
+ options: fn,
2568
3128
  defaultValue: "asc"
2569
3129
  },
2570
3130
  {
@@ -2592,14 +3152,14 @@ function Ot(e, t, n) {
2592
3152
  key: "columnSortBy",
2593
3153
  label: "Sort by",
2594
3154
  type: "icon-group",
2595
- options: Tt,
3155
+ options: dn,
2596
3156
  defaultValue: "group"
2597
3157
  },
2598
3158
  {
2599
3159
  key: "columnSortOrder",
2600
3160
  label: "Sort order",
2601
3161
  type: "icon-group",
2602
- options: Et,
3162
+ options: fn,
2603
3163
  defaultValue: "asc"
2604
3164
  },
2605
3165
  {
@@ -2627,7 +3187,7 @@ function Ot(e, t, n) {
2627
3187
  key: "aggregation",
2628
3188
  label: "Aggregation",
2629
3189
  type: "select",
2630
- options: ft,
3190
+ options: Zt,
2631
3191
  defaultValue: "sum"
2632
3192
  },
2633
3193
  {
@@ -2642,7 +3202,7 @@ function Ot(e, t, n) {
2642
3202
  key: "chart-axis",
2643
3203
  title: "Axis & Series",
2644
3204
  collapsible: !0,
2645
- visibleWhen: (e) => bt(e.type),
3205
+ visibleWhen: (e) => on(e.type),
2646
3206
  fields: [
2647
3207
  {
2648
3208
  key: "xAxisLabel",
@@ -2668,7 +3228,7 @@ function Ot(e, t, n) {
2668
3228
  key: "chart-legend",
2669
3229
  title: "Display",
2670
3230
  collapsible: !0,
2671
- visibleWhen: (e) => !!e.type && ht.includes(e.type),
3231
+ visibleWhen: (e) => !!e.type && en.includes(e.type),
2672
3232
  fields: [{
2673
3233
  key: "showLegend",
2674
3234
  label: "Show legend",
@@ -2720,18 +3280,18 @@ function Ot(e, t, n) {
2720
3280
  title: "Drill-down",
2721
3281
  collapsible: !0,
2722
3282
  defaultCollapsed: !0,
2723
- visibleWhen: (e) => Ct(e.type),
3283
+ visibleWhen: (e) => ln(e.type),
2724
3284
  fields: [{
2725
3285
  key: "drillDownEnabled",
2726
3286
  label: "Enable drill-down",
2727
3287
  type: "switch",
2728
3288
  defaultValue: !1,
2729
- helpText: "When enabled, clicking a cell / segment opens a filtered list of underlying records."
3289
+ helpText: "When enabled, clicking a chart segment / pivot cell opens a filtered list of underlying records; clicking a table or list row opens that record."
2730
3290
  }, {
2731
3291
  key: "drillDownTarget",
2732
3292
  label: "Open in",
2733
3293
  type: "select",
2734
- options: wt,
3294
+ options: un,
2735
3295
  defaultValue: "drawer",
2736
3296
  visibleWhen: (e) => !!e.drillDownEnabled
2737
3297
  }]
@@ -2757,14 +3317,14 @@ function Ot(e, t, n) {
2757
3317
  key: "colorVariant",
2758
3318
  label: "Color variant",
2759
3319
  type: "select",
2760
- options: dt,
3320
+ options: Xt,
2761
3321
  defaultValue: "default"
2762
3322
  }]
2763
3323
  }
2764
3324
  ]
2765
3325
  };
2766
3326
  }
2767
- function kt(e) {
3327
+ function hn(e) {
2768
3328
  if (e == null) return "";
2769
3329
  if (typeof e == "string") return e;
2770
3330
  if (typeof e == "object") {
@@ -2773,20 +3333,20 @@ function kt(e) {
2773
3333
  }
2774
3334
  return String(e);
2775
3335
  }
2776
- function At(e) {
3336
+ function gn(e) {
2777
3337
  let t = e.type, n = { ...e };
2778
- return xt(t) || delete n.categoryField, St(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), bt(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), Ct(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
3338
+ return sn(t) || delete n.categoryField, cn(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), on(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), ln(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
2779
3339
  }
2780
- function jt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
2781
- let { draft: c, isDirty: l, updateField: u, discard: d } = I(L.useMemo(() => ({
3340
+ function _n({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
3341
+ let { draft: c, isDirty: l, updateField: u, discard: d } = se(H.useMemo(() => ({
2782
3342
  ...n,
2783
- title: typeof n.title == "object" ? kt(n.title) : n.title,
2784
- description: typeof n.description == "object" ? kt(n.description) : n.description
3343
+ title: typeof n.title == "object" ? hn(n.title) : n.title,
3344
+ description: typeof n.description == "object" ? hn(n.description) : n.description
2785
3345
  }), [n]), { onUpdate: i });
2786
- return /* @__PURE__ */ Z(w, {
3346
+ return /* @__PURE__ */ Z(P, {
2787
3347
  open: e,
2788
3348
  onClose: t,
2789
- schema: L.useMemo(() => Ot(o, s, c.type), [
3349
+ schema: H.useMemo(() => mn(o, s, c.type), [
2790
3350
  o,
2791
3351
  s,
2792
3352
  c.type
@@ -2794,19 +3354,19 @@ function jt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
2794
3354
  draft: c,
2795
3355
  isDirty: l,
2796
3356
  onFieldChange: u,
2797
- onSave: () => r(At(c)),
3357
+ onSave: () => r(gn(c)),
2798
3358
  onDiscard: d,
2799
3359
  headerExtra: a
2800
3360
  });
2801
3361
  }
2802
3362
  //#endregion
2803
3363
  //#region src/DashboardWithConfig.tsx
2804
- function Mt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
2805
- let [c, l] = H(o), [u, d] = H(null), [f, p] = H(e), [m, h] = H(0);
2806
- B(() => {
3364
+ function vn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
3365
+ let [c, l] = q(o), [u, d] = q(null), [f, p] = q(e), [m, h] = q(0);
3366
+ G(() => {
2807
3367
  p(e), h((e) => e + 1);
2808
3368
  }, [e]);
2809
- let g = L.useMemo(() => {
3369
+ let g = H.useMemo(() => {
2810
3370
  if (!u || !f.widgets) return null;
2811
3371
  let e = f.widgets.find((e) => (e.id || e.title) === u);
2812
3372
  if (!e) return null;
@@ -2828,11 +3388,11 @@ function Mt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2828
3388
  layoutW: e.layout?.w ?? 1,
2829
3389
  layoutH: e.layout?.h ?? 1
2830
3390
  };
2831
- }, [u, m]), _ = R((e) => {
3391
+ }, [u, m]), _ = W((e) => {
2832
3392
  d(e), l(!0);
2833
- }, []), y = R(() => {
3393
+ }, []), v = W(() => {
2834
3394
  d(null);
2835
- }, []), b = R((e, t) => {
3395
+ }, []), y = W((e, t) => {
2836
3396
  u && p((n) => n.widgets ? {
2837
3397
  ...n,
2838
3398
  widgets: n.widgets.map((n) => {
@@ -2873,7 +3433,7 @@ function Mt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2873
3433
  };
2874
3434
  })
2875
3435
  } : n);
2876
- }, [u]), x = R((e) => {
3436
+ }, [u]), b = W((e) => {
2877
3437
  if (u && r) {
2878
3438
  let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
2879
3439
  (t || n) && (a.options = {
@@ -2886,24 +3446,24 @@ function Mt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2886
3446
  }), r(u, a);
2887
3447
  }
2888
3448
  d(null), h((e) => e + 1);
2889
- }, [u, r]), S = R(() => {
3449
+ }, [u, r]), x = W(() => {
2890
3450
  l((e) => !e), d(null);
2891
3451
  }, []);
2892
3452
  return /* @__PURE__ */ Q("div", {
2893
- className: P("flex h-full w-full", s),
3453
+ className: V("flex h-full w-full", s),
2894
3454
  "data-testid": "dashboard-with-config",
2895
3455
  children: [/* @__PURE__ */ Q("div", {
2896
3456
  className: "flex-1 min-w-0 overflow-auto relative",
2897
3457
  children: [/* @__PURE__ */ Z("div", {
2898
3458
  className: "absolute top-2 right-2 z-10",
2899
- children: /* @__PURE__ */ Q(v, {
3459
+ children: /* @__PURE__ */ Q(O, {
2900
3460
  size: "sm",
2901
3461
  variant: c ? "default" : "outline",
2902
- onClick: S,
3462
+ onClick: x,
2903
3463
  "data-testid": "dashboard-config-toggle",
2904
- children: [/* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3464
+ children: [/* @__PURE__ */ Z(Se, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
2905
3465
  })
2906
- }), /* @__PURE__ */ Z(Fe, {
3466
+ }), /* @__PURE__ */ Z(wt, {
2907
3467
  schema: f,
2908
3468
  onRefresh: i,
2909
3469
  recordCount: a,
@@ -2913,13 +3473,13 @@ function Mt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2913
3473
  })]
2914
3474
  }), c && /* @__PURE__ */ Z("div", {
2915
3475
  className: "relative shrink-0",
2916
- children: u && g ? /* @__PURE__ */ Z(jt, {
3476
+ children: u && g ? /* @__PURE__ */ Z(_n, {
2917
3477
  open: !0,
2918
- onClose: y,
3478
+ onClose: v,
2919
3479
  config: g,
2920
- onSave: x,
2921
- onFieldChange: b
2922
- }) : /* @__PURE__ */ Z(lt, {
3480
+ onSave: b,
3481
+ onFieldChange: y
3482
+ }) : /* @__PURE__ */ Z(Jt, {
2923
3483
  open: !0,
2924
3484
  onClose: () => l(!1),
2925
3485
  config: t,
@@ -2928,7 +3488,7 @@ function Mt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
2928
3488
  })]
2929
3489
  });
2930
3490
  }
2931
- e.register("dashboard", Fe, {
3491
+ e.register("dashboard", wt, {
2932
3492
  namespace: "view",
2933
3493
  label: "Dashboard",
2934
3494
  category: "Complex",
@@ -2956,7 +3516,7 @@ e.register("dashboard", Fe, {
2956
3516
  columns: 3,
2957
3517
  widgets: []
2958
3518
  }
2959
- }), e.register("metric", Ke, {
3519
+ }), e.register("metric", Ft, {
2960
3520
  namespace: "plugin-dashboard",
2961
3521
  label: "Metric Widget",
2962
3522
  category: "Dashboard",
@@ -2969,7 +3529,7 @@ e.register("dashboard", Fe, {
2969
3529
  type: "string",
2970
3530
  label: "Value"
2971
3531
  }]
2972
- }), e.register("metric-card", Je, {
3532
+ }), e.register("metric-card", Lt, {
2973
3533
  namespace: "plugin-dashboard",
2974
3534
  label: "Metric Card",
2975
3535
  category: "Dashboard",
@@ -3024,7 +3584,7 @@ e.register("dashboard", Fe, {
3024
3584
  title: "Metric",
3025
3585
  value: "0"
3026
3586
  }
3027
- }), e.register("object-metric", Ye, {
3587
+ }), e.register("object-metric", Rt, {
3028
3588
  namespace: "plugin-dashboard",
3029
3589
  label: "Object Metric",
3030
3590
  category: "Dashboard",
@@ -3053,7 +3613,7 @@ e.register("dashboard", Fe, {
3053
3613
  }
3054
3614
  ],
3055
3615
  defaultProps: { label: "Metric" }
3056
- }), e.register("pivot", nt, {
3616
+ }), e.register("pivot", Gt, {
3057
3617
  namespace: "plugin-dashboard",
3058
3618
  label: "Pivot Table",
3059
3619
  category: "Dashboard",
@@ -3132,7 +3692,7 @@ e.register("dashboard", Fe, {
3132
3692
  aggregation: "sum",
3133
3693
  data: []
3134
3694
  }
3135
- }), e.register("object-pivot", st, {
3695
+ }), e.register("object-pivot", Kt, {
3136
3696
  namespace: "plugin-dashboard",
3137
3697
  label: "Object Pivot Table",
3138
3698
  category: "Dashboard",
@@ -3221,7 +3781,7 @@ e.register("dashboard", Fe, {
3221
3781
  valueField: "",
3222
3782
  aggregation: "sum"
3223
3783
  }
3224
- }), e.register("dashboard-grid", Be, {
3784
+ }), e.register("dashboard-grid", kt, {
3225
3785
  namespace: "plugin-dashboard",
3226
3786
  label: "Dashboard Grid (Editable)",
3227
3787
  category: "Complex",
@@ -3239,7 +3799,7 @@ e.register("dashboard", Fe, {
3239
3799
  title: "Dashboard",
3240
3800
  widgets: []
3241
3801
  }
3242
- }), e.register("object-data-table", at, {
3802
+ }), e.register("object-data-table", rt, {
3243
3803
  namespace: "plugin-dashboard",
3244
3804
  label: "Object Data Table",
3245
3805
  category: "Dashboard",
@@ -3277,18 +3837,18 @@ e.register("dashboard", Fe, {
3277
3837
  pagination: !1
3278
3838
  }
3279
3839
  });
3280
- var Nt = {
3281
- DashboardRenderer: Fe,
3282
- DashboardGridLayout: Be,
3283
- MetricWidget: Ke,
3284
- MetricCard: Je,
3285
- ObjectMetricWidget: Ye,
3286
- PivotTable: nt,
3287
- ObjectPivotTable: st,
3288
- ObjectDataTable: at,
3289
- DashboardConfigPanel: lt,
3290
- WidgetConfigPanel: jt,
3291
- DashboardWithConfig: Mt
3840
+ var yn = {
3841
+ DashboardRenderer: wt,
3842
+ DashboardGridLayout: kt,
3843
+ MetricWidget: Ft,
3844
+ MetricCard: Lt,
3845
+ ObjectMetricWidget: Rt,
3846
+ PivotTable: Gt,
3847
+ ObjectPivotTable: Kt,
3848
+ ObjectDataTable: rt,
3849
+ DashboardConfigPanel: Jt,
3850
+ WidgetConfigPanel: _n,
3851
+ DashboardWithConfig: vn
3292
3852
  };
3293
3853
  //#endregion
3294
- export { lt as DashboardConfigPanel, Be as DashboardGridLayout, Fe as DashboardRenderer, Mt as DashboardWithConfig, ot as DrillDownDrawer, Je as MetricCard, Ke as MetricWidget, at as ObjectDataTable, Ye as ObjectMetricWidget, st as ObjectPivotTable, nt as PivotTable, jt as WidgetConfigPanel, Nt as dashboardComponents };
3854
+ export { Jt as DashboardConfigPanel, kt as DashboardGridLayout, wt as DashboardRenderer, vn as DashboardWithConfig, at as DrillDownDrawer, Lt as MetricCard, Ft as MetricWidget, rt as ObjectDataTable, Rt as ObjectMetricWidget, Kt as ObjectPivotTable, Gt as PivotTable, _n as WidgetConfigPanel, yn as dashboardComponents };