@object-ui/plugin-dashboard 4.0.7 → 4.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +42 -0
  3. package/dist/index.js +1388 -772
  4. package/dist/index.umd.cjs +1 -1
  5. package/dist/packages/plugin-dashboard/src/DashboardConfigPanel.d.ts.map +1 -1
  6. package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts.map +1 -1
  7. package/dist/packages/plugin-dashboard/src/DashboardWithConfig.d.ts.map +1 -1
  8. package/dist/packages/plugin-dashboard/src/DrillDownDrawer.d.ts +23 -0
  9. package/dist/packages/plugin-dashboard/src/DrillDownDrawer.d.ts.map +1 -0
  10. package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts +11 -1
  11. package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts.map +1 -1
  12. package/dist/packages/plugin-dashboard/src/ObjectDataTable.d.ts +11 -0
  13. package/dist/packages/plugin-dashboard/src/ObjectDataTable.d.ts.map +1 -1
  14. package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts +20 -0
  15. package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts.map +1 -1
  16. package/dist/packages/plugin-dashboard/src/ObjectPivotTable.d.ts.map +1 -1
  17. package/dist/packages/plugin-dashboard/src/PivotTable.d.ts +18 -0
  18. package/dist/packages/plugin-dashboard/src/PivotTable.d.ts.map +1 -1
  19. package/dist/packages/plugin-dashboard/src/WidgetConfigPanel.d.ts +1 -11
  20. package/dist/packages/plugin-dashboard/src/WidgetConfigPanel.d.ts.map +1 -1
  21. package/dist/packages/plugin-dashboard/src/index.d.ts +3 -2
  22. package/dist/packages/plugin-dashboard/src/index.d.ts.map +1 -1
  23. package/dist/packages/plugin-dashboard/src/utils.d.ts +1 -0
  24. package/dist/packages/plugin-dashboard/src/utils.d.ts.map +1 -1
  25. package/package.json +11 -10
package/dist/index.js CHANGED
@@ -1,33 +1,46 @@
1
- import { ComponentRegistry as e, extractRecords as t } from "@object-ui/core";
2
- import { SchemaRenderer as n, SchemaRendererContext as r, useActionEngine as i, useDataScope as a, useDnd as o, useHasDndProvider as s, useObjectLabel as c } from "@object-ui/react";
3
- import { Button as l, Card as u, CardContent as d, CardHeader as f, CardTitle as p, Combobox as m, ConfigPanelRenderer as h, ConfigRow as g, Skeleton as _, cn as v, getLazyIcon as y, useConfigDraft as b } from "@object-ui/components";
4
- import * as x from "react";
5
- import { forwardRef as S, useCallback as C, useContext as w, useEffect as T, useMemo as E, useRef as D, useState as O } from "react";
6
- import { AlertCircle as k, ArrowDownIcon as A, ArrowUpIcon as j, Edit as M, GripVertical as ee, Loader2 as N, MinusIcon as te, RefreshCw as ne, Save as re, Settings as ie, X as ae } from "lucide-react";
7
- import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
8
- import { ResponsiveGridLayout as L, useContainerWidth as R } from "react-grid-layout";
1
+ import { ComponentRegistry as e, computeDrillFilter as t, extractRecords as n, isDrillEnabled as r, resolveDateMacros as i, resolveDrillTitle as a } from "@object-ui/core";
2
+ import { SchemaRenderer as o, SchemaRendererContext as s, useActionEngine as c, useDataScope as l, useDnd as u, useHasDndProvider as d, useObjectLabel as f } from "@object-ui/react";
3
+ import { Button as p, Card as m, CardContent as h, CardHeader as g, CardTitle as _, Combobox as v, ConfigPanelRenderer as y, ConfigRow as b, Dialog as x, DialogContent as S, DialogHeader as C, DialogTitle as w, Sheet as T, SheetContent as E, SheetHeader as D, SheetTitle as O, Skeleton as k, cn as A, getLazyIcon as j, useConfigDraft as M } from "@object-ui/components";
4
+ import * as N from "react";
5
+ import { forwardRef as P, useCallback as F, useContext as ee, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
6
+ import { AlertCircle as B, ArrowDownIcon as V, ArrowUpIcon as H, Edit as te, GripVertical as U, Loader2 as ne, MinusIcon as W, RefreshCw as re, Save as ie, Settings as ae, X as G } from "lucide-react";
7
+ import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
8
+ import { ResponsiveGridLayout as Y, useContainerWidth as oe } from "react-grid-layout";
9
9
  import "react-grid-layout/css/styles.css";
10
- import { useSafeFieldLabel as z } from "@object-ui/i18n";
10
+ import { useObjectTranslation as X, useSafeFieldLabel as Z } from "@object-ui/i18n";
11
+ import { formatCurrency as se, formatDate as ce, formatPercent as le, getCellRenderer as ue, resolveCellRendererType as de } from "@object-ui/fields";
11
12
  //#region src/utils.ts
12
- function B(e) {
13
+ function Q(e) {
13
14
  return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
14
15
  }
15
16
  //#endregion
16
17
  //#region src/DashboardRenderer.tsx
17
- function oe(e) {
18
- return e ? y(e) : null;
18
+ function fe(e) {
19
+ return e ? j(e) : null;
19
20
  }
20
- function V(e) {
21
+ function $(e) {
21
22
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
22
23
  }
23
- var se = [
24
+ var pe = [
24
25
  "hsl(var(--chart-1))",
25
26
  "hsl(var(--chart-2))",
26
27
  "hsl(var(--chart-3))",
27
28
  "hsl(var(--chart-4))",
28
29
  "hsl(var(--chart-5))"
29
- ], H = S(({ schema: e, className: t, dataSource: r, onRefresh: a, recordCount: o, userActions: s, designMode: m, selectedWidgetId: h, onWidgetClick: g, modalHandler: _, scriptHandlers: y, ...b }, x) => {
30
- let S = (() => {
30
+ ], me = new Set([
31
+ "bar",
32
+ "horizontal-bar",
33
+ "line",
34
+ "area",
35
+ "pie",
36
+ "donut",
37
+ "funnel"
38
+ ]);
39
+ function he(e) {
40
+ return me.has(e) ? { enabled: !0 } : void 0;
41
+ }
42
+ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: s, selectedWidgetId: l, onWidgetClick: u, modalHandler: d, scriptHandlers: v, ...y }, b) => {
43
+ let x = (() => {
31
44
  if (e.columns != null) return e.columns;
32
45
  let t = e.widgets ?? [], n = 0;
33
46
  for (let e of t) {
@@ -35,71 +48,71 @@ var se = [
35
48
  t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
36
49
  }
37
50
  return n > 4 ? 12 : 4;
38
- })(), w = S, k = e.gap || 4, [A, j] = O(!1), [M, ee] = O(!1), N = D(null), { executeAction: te, engine: re } = i({ actions: E(() => (e.header?.actions ?? []).map((e) => ({
51
+ })(), S = x, C = e.gap || 4, [w, T] = z(!1), [E, D] = z(!1), O = R(null), { executeAction: k, engine: j } = c({ actions: L(() => (e.header?.actions ?? []).map((e) => ({
39
52
  name: e.actionUrl || e.label,
40
53
  type: e.actionType || "url",
41
54
  target: e.actionUrl,
42
55
  label: e.label
43
- })), [e.header?.actions]) }), { dashboardLabel: ie, dashboardDescription: ae, dashboardActionLabel: P, widgetTitle: L, widgetDescription: R, fieldLabel: z } = c(), H = e.name, ce = C((e) => H ? P(H, e.actionUrl || e.label, e.label) : e.label, [H, P]), U = C((e) => {
44
- let t = V(e.title);
45
- return !H || !e.id || t === void 0 ? t : L(H, e.id, t);
46
- }, [H, L]), W = C((e) => {
47
- let t = V(e.description);
48
- return !H || !e.id ? t : R(H, e.id, t);
49
- }, [H, R]);
50
- T(() => {
51
- let e = re.getRunner();
52
- if (_ && e.setModalHandler(_), y) for (let [t, n] of Object.entries(y)) e.registerScript(t, n);
56
+ })), [e.header?.actions]) }), { dashboardLabel: M, dashboardDescription: N, dashboardActionLabel: P, widgetTitle: ee, widgetDescription: B, fieldLabel: V } = f(), H = e.name, te = F((e) => H ? P(H, e.actionUrl || e.label, e.label) : e.label, [H, P]), U = F((e) => {
57
+ let t = $(e.title);
58
+ return !H || !e.id || t === void 0 ? t : ee(H, e.id, t);
59
+ }, [H, ee]), ne = F((e) => {
60
+ let t = $(e.description);
61
+ return !H || !e.id ? t : B(H, e.id, t);
62
+ }, [H, B]);
63
+ I(() => {
64
+ let e = j.getRunner();
65
+ if (d && e.setModalHandler(d), v) for (let [t, n] of Object.entries(v)) e.registerScript(t, n);
53
66
  }, [
54
- re,
55
- _,
56
- y
57
- ]), T(() => {
58
- let e = () => ee(window.innerWidth < 768);
67
+ j,
68
+ d,
69
+ v
70
+ ]), I(() => {
71
+ let e = () => D(window.innerWidth < 768);
59
72
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
60
73
  }, []);
61
- let G = C(() => {
62
- a && (j(!0), a(), setTimeout(() => j(!1), 600));
63
- }, [a]);
64
- T(() => {
65
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !a)) return N.current = setInterval(G, e.refreshInterval * 1e3), () => {
66
- N.current && clearInterval(N.current);
74
+ let W = F(() => {
75
+ r && (T(!0), r(), setTimeout(() => T(!1), 600));
76
+ }, [r]);
77
+ I(() => {
78
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return O.current = setInterval(W, e.refreshInterval * 1e3), () => {
79
+ O.current && clearInterval(O.current);
67
80
  };
68
81
  }, [
69
82
  e.refreshInterval,
70
- a,
71
- G
83
+ r,
84
+ W
72
85
  ]);
73
- let le = C((e, t) => {
74
- !m || !g || !t || (e.stopPropagation(), g(t));
75
- }, [m, g]), K = C((t, n, r) => {
76
- if (!m || !g) return;
86
+ let ie = F((e, t) => {
87
+ !s || !u || !t || (e.stopPropagation(), u(t));
88
+ }, [s, u]), ae = F((t, n, r) => {
89
+ if (!s || !u) return;
77
90
  let i = e.widgets || [];
78
- if (t.key === "Enter" || t.key === " ") t.preventDefault(), g(n ?? null);
91
+ if (t.key === "Enter" || t.key === " ") t.preventDefault(), u(n ?? null);
79
92
  else if (t.key === "ArrowRight" || t.key === "ArrowDown") {
80
93
  t.preventDefault();
81
94
  let e = r + 1 < i.length ? i[r + 1] : null;
82
- e?.id && g(e.id);
95
+ e?.id && u(e.id);
83
96
  } else if (t.key === "ArrowLeft" || t.key === "ArrowUp") {
84
97
  t.preventDefault();
85
98
  let e = r - 1 >= 0 ? i[r - 1] : null;
86
- e?.id && g(e.id);
87
- } else t.key === "Escape" && (t.preventDefault(), g(null));
99
+ e?.id && u(e.id);
100
+ } else t.key === "Escape" && (t.preventDefault(), u(null));
88
101
  }, [
89
- m,
90
- g,
102
+ s,
103
+ u,
91
104
  e.widgets
92
- ]), q = C((e) => {
93
- !m || !g || e.target === e.currentTarget && g(null);
94
- }, [m, g]), J = (e, t, i) => {
95
- let a = e.layout ? {
105
+ ]), G = F((e) => {
106
+ !s || !u || e.target === e.currentTarget && u(null);
107
+ }, [s, u]), K = (e, t, r) => {
108
+ let i = e.layout ? {
96
109
  ...e.layout,
97
- w: Math.min(e.layout.w, w)
98
- } : void 0, o = (() => {
110
+ w: Math.min(e.layout.w, S)
111
+ } : void 0, a = (() => {
99
112
  if (e.component) return e.component;
100
113
  let t = e.type, n = e.options || {};
101
114
  if (t === "metric" && e.object) {
102
- let t = n.data, r = B(t) && t.aggregate ? {
115
+ let t = n.data, r = Q(t) && t.aggregate ? {
103
116
  field: e.valueField || t.aggregate.field,
104
117
  function: e.aggregate || t.aggregate.function,
105
118
  groupBy: e.categoryField ?? t.aggregate.groupBy ?? "_all"
@@ -110,15 +123,21 @@ var se = [
110
123
  } : void 0;
111
124
  return {
112
125
  type: "object-metric",
113
- objectName: e.object || (B(t) ? t.object : void 0),
126
+ objectName: e.object || (Q(t) ? t.object : void 0),
114
127
  aggregate: r,
115
- filter: (B(t) ? t.filter : void 0) || e.filter,
128
+ filter: (Q(t) ? t.filter : void 0) || e.filter,
116
129
  label: n.label || U(e) || "",
117
130
  fallbackValue: n.value,
118
131
  trend: n.trend,
119
132
  icon: n.icon,
120
133
  description: n.description,
121
- colorVariant: e.colorVariant
134
+ colorVariant: e.colorVariant,
135
+ format: n.format,
136
+ currency: n.currency,
137
+ prefix: n.prefix,
138
+ suffix: n.suffix,
139
+ drillDown: n.drillDown ?? { enabled: !0 },
140
+ title: n.label || U(e) || ""
122
141
  };
123
142
  }
124
143
  if ((t === "gauge" || t === "solid-gauge") && e.object) {
@@ -138,29 +157,27 @@ var se = [
138
157
  description: n.description
139
158
  };
140
159
  }
141
- let r = {
142
- funnel: "bar",
143
- "horizontal-bar": "bar"
144
- }[t] || t;
145
- if (r === "bar" || r === "line" || r === "area" || r === "pie" || r === "donut" || r === "scatter") {
160
+ let r = {}[t] || t;
161
+ if (r === "bar" || r === "horizontal-bar" || r === "line" || r === "area" || r === "pie" || r === "donut" || r === "scatter" || r === "funnel") {
146
162
  let t = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
147
- if (B(t)) {
148
- let n = t.aggregate, o = n ? {
149
- field: e.valueField || n.field,
150
- function: e.aggregate || n.function,
151
- groupBy: e.categoryField || n.groupBy
152
- } : void 0, s = o?.field || a, c = e.object || t.object;
163
+ if (Q(t)) {
164
+ let o = t.aggregate, s = o ? {
165
+ field: e.valueField || o.field,
166
+ function: e.aggregate || o.function,
167
+ groupBy: e.categoryField || o.groupBy
168
+ } : void 0, c = s?.field || a, l = e.object || t.object;
153
169
  return {
154
170
  type: "object-chart",
155
171
  chartType: r,
156
- objectName: c,
157
- aggregate: o,
172
+ objectName: l,
173
+ aggregate: s,
158
174
  xAxisKey: i,
159
175
  series: [{
160
- dataKey: s,
161
- label: c ? z(c, s, s) : s
176
+ dataKey: c,
177
+ label: l ? V(l, c, c) : c
162
178
  }],
163
- colors: se,
179
+ colors: pe,
180
+ drillDown: n.drillDown ?? he(r),
164
181
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
165
182
  };
166
183
  }
@@ -169,7 +186,7 @@ var se = [
169
186
  field: e.valueField || "value",
170
187
  function: e.aggregate,
171
188
  groupBy: e.categoryField || "name"
172
- } : void 0, n = e.valueField || "value";
189
+ } : void 0, a = e.valueField || "value";
173
190
  return {
174
191
  type: "object-chart",
175
192
  chartType: r,
@@ -177,10 +194,11 @@ var se = [
177
194
  aggregate: t,
178
195
  xAxisKey: i,
179
196
  series: [{
180
- dataKey: n,
181
- label: z(e.object, n, n)
197
+ dataKey: a,
198
+ label: V(e.object, a, a)
182
199
  }],
183
- colors: se,
200
+ colors: pe,
201
+ drillDown: n.drillDown ?? he(r),
184
202
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
185
203
  };
186
204
  }
@@ -191,15 +209,15 @@ var se = [
191
209
  xAxisKey: i,
192
210
  series: [{
193
211
  dataKey: a,
194
- label: e.object ? z(e.object, a, a) : a
212
+ label: e.object ? V(e.object, a, a) : a
195
213
  }],
196
- colors: se,
214
+ colors: pe,
197
215
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
198
216
  };
199
217
  }
200
218
  if (t === "table") {
201
219
  let t = e.data || n.data;
202
- if (B(t)) {
220
+ if (Q(t)) {
203
221
  let { data: r, ...i } = n;
204
222
  return {
205
223
  type: "object-data-table",
@@ -230,11 +248,23 @@ var se = [
230
248
  };
231
249
  }
232
250
  if (t === "pivot") {
233
- let t = e.data || n.data;
234
- if (B(t)) {
235
- let { data: r, ...i } = n;
251
+ let t = e.data || n.data, r = e, i = {
252
+ rowField: r.rowField ?? n.rowField,
253
+ columnField: r.columnField ?? n.columnField,
254
+ valueField: r.valueField ?? n.valueField,
255
+ aggregation: r.aggregation ?? n.aggregation ?? "sum",
256
+ showRowTotals: r.showRowTotals ?? n.showRowTotals,
257
+ showColumnTotals: r.showColumnTotals ?? n.showColumnTotals,
258
+ format: r.format ?? n.format
259
+ }, a = (Q(t) || !t && e.object) && n.drillDown === void 0 ? {
260
+ ...n,
261
+ drillDown: { enabled: !0 }
262
+ } : n;
263
+ if (Q(t)) {
264
+ let { data: n, ...r } = a;
236
265
  return {
237
266
  type: "object-pivot",
267
+ ...r,
238
268
  ...i,
239
269
  objectName: e.object || t.object,
240
270
  dataProvider: t,
@@ -243,103 +273,143 @@ var se = [
243
273
  }
244
274
  return !t && e.object ? {
245
275
  type: "object-pivot",
246
- ...n,
276
+ ...a,
277
+ ...i,
247
278
  objectName: e.object,
248
279
  filter: e.filter
249
280
  } : {
250
281
  type: "pivot",
251
282
  ...n,
283
+ ...i,
252
284
  data: Array.isArray(t) ? t : t?.items || []
253
285
  };
254
286
  }
255
- return {
287
+ if (t === "list") {
288
+ let t = e.data || n.data;
289
+ if (Q(t)) {
290
+ let { data: r, ...i } = n;
291
+ return {
292
+ type: "object-data-table",
293
+ ...i,
294
+ objectName: e.object || t.object,
295
+ dataProvider: t,
296
+ filter: t.filter || e.filter,
297
+ searchable: !1,
298
+ pagination: !1,
299
+ className: "border-0"
300
+ };
301
+ }
302
+ return !t && e.object ? {
303
+ type: "object-data-table",
304
+ ...n,
305
+ objectName: e.object,
306
+ filter: e.filter,
307
+ searchable: !1,
308
+ pagination: !1,
309
+ className: "border-0"
310
+ } : {
311
+ type: "data-table",
312
+ ...n,
313
+ data: Array.isArray(t) ? t : t?.items || [],
314
+ searchable: !1,
315
+ pagination: !1,
316
+ className: "border-0"
317
+ };
318
+ }
319
+ return t === "custom" ? {
320
+ type: "text",
321
+ value: "Custom widget — set `component` to a UIComponent schema.",
322
+ variant: "caption",
323
+ align: "center",
324
+ className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground"
325
+ } : {
256
326
  ...e,
257
327
  ...n
258
328
  };
259
- })(), s = e.type === "metric", c = U(e), l = W(e), g = e.id || c || `widget-${t}`, _ = m && h === e.id, y = m ? {
329
+ })(), c = e.type === "metric", u = U(e), d = ne(e), f = e.id || u || `widget-${t}`, p = s && l === e.id, v = s ? {
260
330
  "data-testid": `dashboard-preview-widget-${e.id}`,
261
331
  "data-widget-id": e.id,
262
332
  role: "button",
263
333
  tabIndex: 0,
264
- "aria-selected": _,
265
- "aria-label": `Widget: ${c || `Widget ${t + 1}`}`,
266
- onClick: (t) => le(t, e.id),
267
- onKeyDown: (n) => K(n, e.id, t)
268
- } : {}, b = m ? v("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", _ ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0;
269
- return s ? /* @__PURE__ */ I("div", {
270
- className: v("h-full w-full", m && "relative", b),
271
- style: !M && a ? {
272
- gridColumn: `span ${a.w}`,
273
- gridRow: `span ${a.h}`
334
+ "aria-selected": p,
335
+ "aria-label": `Widget: ${u || `Widget ${t + 1}`}`,
336
+ onClick: (t) => ie(t, e.id),
337
+ onKeyDown: (n) => ae(n, e.id, t)
338
+ } : {}, y = s ? A("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;
339
+ return c ? /* @__PURE__ */ J("div", {
340
+ className: A("h-full w-full", s && "relative", y),
341
+ style: !E && i ? {
342
+ gridColumn: `span ${i.w}`,
343
+ gridRow: `span ${i.h}`
274
344
  } : void 0,
275
- ...y,
276
- children: [/* @__PURE__ */ F(n, {
277
- schema: o,
278
- className: v("h-full w-full", m && "pointer-events-none"),
279
- dataSource: r
280
- }), m && /* @__PURE__ */ F("div", {
345
+ ...v,
346
+ children: [/* @__PURE__ */ q(o, {
347
+ schema: a,
348
+ className: A("h-full w-full", s && "pointer-events-none"),
349
+ dataSource: n
350
+ }), s && /* @__PURE__ */ q("div", {
281
351
  className: "absolute inset-0 z-10",
282
352
  "aria-hidden": "true",
283
353
  "data-testid": "widget-click-overlay"
284
354
  })]
285
- }, g) : /* @__PURE__ */ I(u, {
286
- className: v("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", i && "w-full", m && "relative", b),
287
- style: !M && a ? {
288
- gridColumn: `span ${a.w}`,
289
- gridRow: `span ${a.h}`
355
+ }, f) : /* @__PURE__ */ J(m, {
356
+ className: A("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", s && "relative", y),
357
+ style: !E && i ? {
358
+ gridColumn: `span ${i.w}`,
359
+ gridRow: `span ${i.h}`
290
360
  } : void 0,
291
- ...y,
361
+ ...v,
292
362
  children: [
293
- c && /* @__PURE__ */ I(f, {
363
+ u && /* @__PURE__ */ J(g, {
294
364
  className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
295
- children: [/* @__PURE__ */ F(p, {
365
+ children: [/* @__PURE__ */ q(_, {
296
366
  className: "text-sm sm:text-base font-medium tracking-tight truncate",
297
- title: c,
298
- children: c
299
- }), l && /* @__PURE__ */ F("p", {
367
+ title: u,
368
+ children: u
369
+ }), d && /* @__PURE__ */ q("p", {
300
370
  className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
301
- children: l
371
+ children: d
302
372
  })]
303
373
  }),
304
- /* @__PURE__ */ F(d, {
374
+ /* @__PURE__ */ q(h, {
305
375
  className: "p-0",
306
- children: /* @__PURE__ */ F("div", {
307
- className: v("h-full w-full", "p-3 sm:p-4 md:p-6", m && "pointer-events-none"),
308
- children: /* @__PURE__ */ F(n, {
309
- schema: o,
310
- dataSource: r
376
+ children: /* @__PURE__ */ q("div", {
377
+ className: A("h-full w-full", "p-3 sm:p-4 md:p-6", s && "pointer-events-none"),
378
+ children: /* @__PURE__ */ q(o, {
379
+ schema: a,
380
+ dataSource: n
311
381
  })
312
382
  })
313
383
  }),
314
- m && /* @__PURE__ */ F("div", {
384
+ s && /* @__PURE__ */ q("div", {
315
385
  className: "absolute inset-0 z-10",
316
386
  "aria-hidden": "true",
317
387
  "data-testid": "widget-click-overlay"
318
388
  })
319
389
  ]
320
- }, g);
321
- }, Y = e.header && /* @__PURE__ */ I("div", {
390
+ }, f);
391
+ }, Y = e.header && /* @__PURE__ */ J("div", {
322
392
  className: "col-span-full mb-4",
323
393
  children: [
324
- e.header.showTitle !== !1 && e.title && /* @__PURE__ */ F("h2", {
394
+ e.header.showTitle !== !1 && e.title && /* @__PURE__ */ q("h2", {
325
395
  className: "text-lg font-semibold tracking-tight",
326
- children: H ? ie({
396
+ children: H ? M({
327
397
  name: H,
328
- label: V(e.title)
329
- }) : V(e.title)
398
+ label: $(e.title)
399
+ }) : $(e.title)
330
400
  }),
331
- e.header.showDescription !== !1 && e.description && /* @__PURE__ */ F("p", {
401
+ e.header.showDescription !== !1 && e.description && /* @__PURE__ */ q("p", {
332
402
  className: "text-sm text-muted-foreground mt-1",
333
- children: H ? ae({
403
+ children: H ? N({
334
404
  name: H,
335
- description: V(e.description)
336
- }) : V(e.description)
405
+ description: $(e.description)
406
+ }) : $(e.description)
337
407
  }),
338
- e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ F("div", {
408
+ e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ q("div", {
339
409
  className: "flex gap-2 mt-3",
340
410
  children: e.header.actions.map((e, t) => {
341
- let n = oe(e.icon);
342
- return /* @__PURE__ */ I(l, {
411
+ let n = fe(e.icon);
412
+ return /* @__PURE__ */ J(p, {
343
413
  variant: "outline",
344
414
  size: "sm",
345
415
  onClick: async () => {
@@ -353,78 +423,78 @@ var se = [
353
423
  return;
354
424
  }
355
425
  if (t === "modal" || t === "script") {
356
- let e = await te(n || r);
426
+ let e = await k(n || r);
357
427
  e?.success || console.warn("[DashboardRenderer] action failed", e?.error);
358
428
  return;
359
429
  }
360
430
  console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
361
431
  },
362
- children: [n && /* @__PURE__ */ F(n, { className: "w-4 h-4 mr-1.5" }), ce(e)]
432
+ children: [n && /* @__PURE__ */ q(n, { className: "w-4 h-4 mr-1.5" }), te(e)]
363
433
  }, t);
364
434
  })
365
435
  })
366
436
  ]
367
- }), ue = o !== void 0 && /* @__PURE__ */ I("span", {
437
+ }), oe = i !== void 0 && /* @__PURE__ */ J("span", {
368
438
  className: "text-xs text-muted-foreground",
369
- children: [o.toLocaleString(), " records"]
370
- }), X = s ? JSON.stringify(s) : void 0, Z = a && /* @__PURE__ */ I("div", {
371
- className: v("flex items-center justify-end gap-3 mb-2", !M && "col-span-full"),
372
- children: [ue, /* @__PURE__ */ I(l, {
439
+ children: [i.toLocaleString(), " records"]
440
+ }), X = a ? JSON.stringify(a) : void 0, Z = r && /* @__PURE__ */ J("div", {
441
+ className: A("flex items-center justify-end gap-3 mb-2", !E && "col-span-full"),
442
+ children: [oe, /* @__PURE__ */ J(p, {
373
443
  variant: "outline",
374
444
  size: "sm",
375
- onClick: G,
376
- disabled: A,
445
+ onClick: W,
446
+ disabled: w,
377
447
  "aria-label": "Refresh dashboard",
378
- children: [/* @__PURE__ */ F(ne, { className: v("h-4 w-4 mr-2", A && "animate-spin") }), A ? "Refreshing…" : "Refresh All"]
448
+ children: [/* @__PURE__ */ q(re, { className: A("h-4 w-4 mr-2", w && "animate-spin") }), w ? "Refreshing…" : "Refresh All"]
379
449
  })]
380
450
  });
381
- if (M) {
451
+ if (E) {
382
452
  let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [];
383
- return /* @__PURE__ */ I("div", {
384
- ref: x,
385
- className: v("flex flex-col gap-4 px-4", t),
453
+ return /* @__PURE__ */ J("div", {
454
+ ref: b,
455
+ className: A("flex flex-col gap-4 px-4", t),
386
456
  "data-user-actions": X,
387
- onClick: q,
388
- ...b,
457
+ onClick: G,
458
+ ...y,
389
459
  children: [
390
460
  Y,
391
461
  Z,
392
- n.length > 0 && /* @__PURE__ */ F("div", {
462
+ n.length > 0 && /* @__PURE__ */ q("div", {
393
463
  className: "grid grid-cols-2 gap-3",
394
- onClick: q,
395
- children: n.map((e, t) => J(e, t))
464
+ onClick: G,
465
+ children: n.map((e, t) => K(e, t))
396
466
  }),
397
- r.length > 0 && /* @__PURE__ */ F("div", {
467
+ r.length > 0 && /* @__PURE__ */ q("div", {
398
468
  className: "flex flex-col gap-4",
399
- onClick: q,
400
- children: r.map((e, t) => J(e, t, !0))
469
+ onClick: G,
470
+ children: r.map((e, t) => K(e, t, !0))
401
471
  })
402
472
  ]
403
473
  });
404
474
  }
405
- let Q = e.columns != null || S !== 4;
406
- return /* @__PURE__ */ I("div", {
407
- ref: x,
408
- className: v("grid auto-rows-min", !Q && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
475
+ let se = e.columns != null || x !== 4;
476
+ return /* @__PURE__ */ J("div", {
477
+ ref: b,
478
+ className: A("grid auto-rows-min", !se && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
409
479
  style: {
410
- ...Q && { gridTemplateColumns: `repeat(${w}, minmax(0, 1fr))` },
411
- gap: `${k * .25}rem`
480
+ ...se && { gridTemplateColumns: `repeat(${S}, minmax(0, 1fr))` },
481
+ gap: `${C * .25}rem`
412
482
  },
413
483
  "data-user-actions": X,
414
- onClick: q,
415
- ...b,
484
+ onClick: G,
485
+ ...y,
416
486
  children: [
417
487
  Y,
418
488
  Z,
419
- e.widgets?.map((e, t) => J(e, t))
489
+ e.widgets?.map((e, t) => K(e, t))
420
490
  ]
421
491
  });
422
492
  });
423
493
  //#endregion
424
494
  //#region src/DashboardGridLayout.tsx
425
- function ce({ editMode: e }) {
426
- let t = o();
427
- return x.useEffect(() => {
495
+ function _e({ editMode: e }) {
496
+ let t = u();
497
+ return N.useEffect(() => {
428
498
  if (e) return t.startDrag({
429
499
  id: "dashboard-layout",
430
500
  type: "dashboard-widget",
@@ -435,28 +505,28 @@ function ce({ editMode: e }) {
435
505
  t.endDrag("dashboard");
436
506
  }, [e, t]), null;
437
507
  }
438
- var U = [
508
+ var ve = [
439
509
  "hsl(var(--chart-1))",
440
510
  "hsl(var(--chart-2))",
441
511
  "hsl(var(--chart-3))",
442
512
  "hsl(var(--chart-4))",
443
513
  "hsl(var(--chart-5))"
444
- ], W = ({ schema: e, className: t, onLayoutChange: r, persistLayoutKey: i = "dashboard-layout", onRefresh: a }) => {
445
- let { width: o, containerRef: c, mounted: m } = R(), [h, g] = x.useState(!1), [_, y] = x.useState(!1), b = s(), S = x.useRef(null), C = x.useCallback(() => {
446
- a && (y(!0), a(), setTimeout(() => y(!1), 600));
447
- }, [a]);
448
- x.useEffect(() => {
449
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !a)) return S.current = setInterval(C, e.refreshInterval * 1e3), () => {
450
- S.current && clearInterval(S.current);
514
+ ], ye = ({ schema: e, className: t, onLayoutChange: n, persistLayoutKey: r = "dashboard-layout", onRefresh: i }) => {
515
+ let { width: a, containerRef: s, mounted: c } = oe(), [l, u] = N.useState(!1), [f, v] = N.useState(!1), y = d(), b = N.useRef(null), x = N.useCallback(() => {
516
+ i && (v(!0), i(), setTimeout(() => v(!1), 600));
517
+ }, [i]);
518
+ N.useEffect(() => {
519
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return b.current = setInterval(x, e.refreshInterval * 1e3), () => {
520
+ b.current && clearInterval(b.current);
451
521
  };
452
522
  }, [
453
523
  e.refreshInterval,
454
- a,
455
- C
524
+ i,
525
+ x
456
526
  ]);
457
- let [w, T] = x.useState(() => {
458
- if (typeof window < "u" && i) {
459
- let e = localStorage.getItem(i);
527
+ let [S, C] = N.useState(() => {
528
+ if (typeof window < "u" && r) {
529
+ let e = localStorage.getItem(r);
460
530
  if (e) try {
461
531
  return JSON.parse(e);
462
532
  } catch (e) {
@@ -470,24 +540,24 @@ var U = [
470
540
  w: e.layout?.w || 3,
471
541
  h: e.layout?.h || 4
472
542
  })) || [] };
473
- }), E = x.useCallback((e, t) => {
474
- T(t), r?.(e);
475
- }, [r]), D = x.useCallback(() => {
476
- typeof window < "u" && i && localStorage.setItem(i, JSON.stringify(w)), g(!1);
477
- }, [w, i]), O = x.useCallback(() => {
478
- T({ lg: e.widgets?.map((e, t) => ({
543
+ }), w = N.useCallback((e, t) => {
544
+ C(t), n?.(e);
545
+ }, [n]), T = N.useCallback(() => {
546
+ typeof window < "u" && r && localStorage.setItem(r, JSON.stringify(S)), u(!1);
547
+ }, [S, r]), E = N.useCallback(() => {
548
+ C({ lg: e.widgets?.map((e, t) => ({
479
549
  i: e.id || `widget-${t}`,
480
550
  x: e.layout?.x || t % 4 * 3,
481
551
  y: e.layout?.y || Math.floor(t / 4) * 4,
482
552
  w: e.layout?.w || 3,
483
553
  h: e.layout?.h || 4
484
- })) || [] }), typeof window < "u" && i && localStorage.removeItem(i);
485
- }, [e.widgets, i]), k = x.useCallback((e) => {
554
+ })) || [] }), typeof window < "u" && r && localStorage.removeItem(r);
555
+ }, [e.widgets, r]), D = N.useCallback((e) => {
486
556
  if (e.component) return e.component;
487
557
  let t = e.type, n = e.options || {};
488
- if (t === "bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter") {
558
+ if (t === "bar" || t === "horizontal-bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter" || t === "funnel") {
489
559
  let r = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
490
- if (B(r)) {
560
+ if (Q(r)) {
491
561
  let n = r.aggregate, o = n ? {
492
562
  field: e.valueField || n.field,
493
563
  function: e.aggregate || n.function,
@@ -500,7 +570,7 @@ var U = [
500
570
  aggregate: o,
501
571
  xAxisKey: i,
502
572
  series: [{ dataKey: s }],
503
- colors: U,
573
+ colors: ve,
504
574
  className: "h-full"
505
575
  };
506
576
  }
@@ -517,7 +587,7 @@ var U = [
517
587
  aggregate: n,
518
588
  xAxisKey: i,
519
589
  series: [{ dataKey: e.valueField || "value" }],
520
- colors: U,
590
+ colors: ve,
521
591
  className: "h-full"
522
592
  };
523
593
  }
@@ -527,13 +597,13 @@ var U = [
527
597
  data: Array.isArray(r) ? r : r?.items || [],
528
598
  xAxisKey: i,
529
599
  series: [{ dataKey: a }],
530
- colors: U,
600
+ colors: ve,
531
601
  className: "h-full"
532
602
  };
533
603
  }
534
604
  if (t === "table") {
535
605
  let t = e.data || n.data;
536
- if (B(t)) {
606
+ if (Q(t)) {
537
607
  let { data: r, ...i } = n;
538
608
  return {
539
609
  type: "data-table",
@@ -565,7 +635,7 @@ var U = [
565
635
  }
566
636
  if (t === "pivot") {
567
637
  let t = e.data || n.data;
568
- if (B(t)) {
638
+ if (Q(t)) {
569
639
  let { data: r, ...i } = n;
570
640
  return {
571
641
  type: "pivot",
@@ -586,57 +656,57 @@ var U = [
586
656
  ...n
587
657
  };
588
658
  }, []);
589
- return /* @__PURE__ */ I("div", {
590
- ref: c,
591
- className: v("w-full", t),
659
+ return /* @__PURE__ */ J("div", {
660
+ ref: s,
661
+ className: A("w-full", t),
592
662
  "data-testid": "grid-layout",
593
663
  children: [
594
- b && /* @__PURE__ */ F(ce, { editMode: h }),
595
- /* @__PURE__ */ I("div", {
664
+ y && /* @__PURE__ */ q(_e, { editMode: l }),
665
+ /* @__PURE__ */ J("div", {
596
666
  className: "mb-4 flex items-center justify-between",
597
- children: [/* @__PURE__ */ F("h2", {
667
+ children: [/* @__PURE__ */ q("h2", {
598
668
  className: "text-2xl font-bold",
599
669
  children: e.title || "Dashboard"
600
- }), /* @__PURE__ */ F("div", {
670
+ }), /* @__PURE__ */ q("div", {
601
671
  className: "flex gap-2",
602
- children: h ? /* @__PURE__ */ I(P, { children: [
603
- /* @__PURE__ */ I(l, {
604
- onClick: D,
672
+ children: l ? /* @__PURE__ */ J(K, { children: [
673
+ /* @__PURE__ */ J(p, {
674
+ onClick: T,
605
675
  size: "sm",
606
676
  variant: "default",
607
- children: [/* @__PURE__ */ F(re, { className: "h-4 w-4 mr-2" }), "Save Layout"]
677
+ children: [/* @__PURE__ */ q(ie, { className: "h-4 w-4 mr-2" }), "Save Layout"]
608
678
  }),
609
- /* @__PURE__ */ I(l, {
610
- onClick: O,
679
+ /* @__PURE__ */ J(p, {
680
+ onClick: E,
611
681
  size: "sm",
612
682
  variant: "outline",
613
- children: [/* @__PURE__ */ F(ae, { className: "h-4 w-4 mr-2" }), "Reset"]
683
+ children: [/* @__PURE__ */ q(G, { className: "h-4 w-4 mr-2" }), "Reset"]
614
684
  }),
615
- /* @__PURE__ */ F(l, {
616
- onClick: () => g(!1),
685
+ /* @__PURE__ */ q(p, {
686
+ onClick: () => u(!1),
617
687
  size: "sm",
618
688
  variant: "ghost",
619
689
  children: "Cancel"
620
690
  })
621
- ] }) : /* @__PURE__ */ I(P, { children: [a && /* @__PURE__ */ I(l, {
622
- onClick: C,
691
+ ] }) : /* @__PURE__ */ J(K, { children: [i && /* @__PURE__ */ J(p, {
692
+ onClick: x,
623
693
  size: "sm",
624
694
  variant: "outline",
625
- disabled: _,
695
+ disabled: f,
626
696
  "aria-label": "Refresh dashboard",
627
- children: [/* @__PURE__ */ F(ne, { className: v("h-4 w-4 mr-2", _ && "animate-spin") }), _ ? "Refreshing…" : "Refresh All"]
628
- }), /* @__PURE__ */ I(l, {
629
- onClick: () => g(!0),
697
+ children: [/* @__PURE__ */ q(re, { className: A("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
698
+ }), /* @__PURE__ */ J(p, {
699
+ onClick: () => u(!0),
630
700
  size: "sm",
631
701
  variant: "outline",
632
- children: [/* @__PURE__ */ F(M, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
702
+ children: [/* @__PURE__ */ q(te, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
633
703
  })] })
634
704
  })]
635
705
  }),
636
- m && /* @__PURE__ */ F(L, {
706
+ c && /* @__PURE__ */ q(Y, {
637
707
  className: "layout",
638
- width: o,
639
- layouts: w,
708
+ width: a,
709
+ layouts: S,
640
710
  breakpoints: {
641
711
  lg: 1200,
642
712
  md: 996,
@@ -653,45 +723,45 @@ var U = [
653
723
  },
654
724
  rowHeight: 60,
655
725
  dragConfig: {
656
- enabled: h,
726
+ enabled: l,
657
727
  handle: ".drag-handle"
658
728
  },
659
- resizeConfig: { enabled: h },
660
- onLayoutChange: E,
729
+ resizeConfig: { enabled: l },
730
+ onLayoutChange: w,
661
731
  children: e.widgets?.map((e, t) => {
662
- let r = e.id || `widget-${t}`, i = k(e);
663
- return /* @__PURE__ */ F("div", {
732
+ let n = e.id || `widget-${t}`, r = D(e);
733
+ return /* @__PURE__ */ q("div", {
664
734
  className: "h-full",
665
- children: e.type === "metric" ? /* @__PURE__ */ I("div", {
735
+ children: e.type === "metric" ? /* @__PURE__ */ J("div", {
666
736
  className: "h-full w-full relative",
667
- children: [h && /* @__PURE__ */ F("div", {
737
+ children: [l && /* @__PURE__ */ q("div", {
668
738
  className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
669
- children: /* @__PURE__ */ F(ee, { className: "h-4 w-4" })
670
- }), /* @__PURE__ */ F(n, {
671
- schema: i,
739
+ children: /* @__PURE__ */ q(U, { className: "h-4 w-4" })
740
+ }), /* @__PURE__ */ q(o, {
741
+ schema: r,
672
742
  className: "h-full w-full"
673
743
  })]
674
- }) : /* @__PURE__ */ I(u, {
675
- className: v("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", h && "ring-2 ring-primary/20"),
676
- children: [e.title && /* @__PURE__ */ I(f, {
744
+ }) : /* @__PURE__ */ J(m, {
745
+ className: A("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", l && "ring-2 ring-primary/20"),
746
+ children: [e.title && /* @__PURE__ */ J(g, {
677
747
  className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
678
- children: [/* @__PURE__ */ F(p, {
748
+ children: [/* @__PURE__ */ q(_, {
679
749
  className: "text-base font-medium tracking-tight truncate",
680
750
  title: e.title,
681
751
  children: e.title
682
- }), h && /* @__PURE__ */ F("div", {
752
+ }), l && /* @__PURE__ */ q("div", {
683
753
  className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
684
- children: /* @__PURE__ */ F(ee, { className: "h-4 w-4" })
754
+ children: /* @__PURE__ */ q(U, { className: "h-4 w-4" })
685
755
  })]
686
- }), /* @__PURE__ */ F(d, {
756
+ }), /* @__PURE__ */ q(h, {
687
757
  className: "p-0 h-full",
688
- children: /* @__PURE__ */ F("div", {
689
- className: v("h-full w-full overflow-auto p-4"),
690
- children: /* @__PURE__ */ F(n, { schema: i })
758
+ children: /* @__PURE__ */ q("div", {
759
+ className: A("h-full w-full overflow-auto p-4"),
760
+ children: /* @__PURE__ */ q(o, { schema: r })
691
761
  })
692
762
  })]
693
763
  })
694
- }, r);
764
+ }, n);
695
765
  })
696
766
  })
697
767
  ]
@@ -699,10 +769,41 @@ var U = [
699
769
  };
700
770
  //#endregion
701
771
  //#region src/MetricWidget.tsx
702
- function G(e) {
772
+ function be(e, t, n) {
773
+ if (e == null) return "";
774
+ if (typeof e == "string") {
775
+ let r = Number(e);
776
+ return !isFinite(r) || e.trim() === "" ? e : be(r, t, n);
777
+ }
778
+ if (!isFinite(e)) return String(e);
779
+ let r = {
780
+ $: "USD",
781
+ "¥": "JPY",
782
+ "€": "EUR",
783
+ "£": "GBP"
784
+ }, i = (t || "").trim(), a = !!n || i.length > 0 && r[i[0]] !== void 0, o = i.endsWith("%"), s = i.match(/0\.(0+)/), c = s ? s[1].length : 0;
785
+ if (a) {
786
+ let t = n || r[i[0]] || "USD";
787
+ try {
788
+ return new Intl.NumberFormat("en-US", {
789
+ style: "currency",
790
+ currency: t,
791
+ minimumFractionDigits: c,
792
+ maximumFractionDigits: c
793
+ }).format(e);
794
+ } catch {
795
+ return `${t} ${e.toFixed(c)}`;
796
+ }
797
+ }
798
+ return o ? `${(e > 1 ? e : e * 100).toFixed(c)}%` : new Intl.NumberFormat("en-US", {
799
+ minimumFractionDigits: c,
800
+ maximumFractionDigits: c
801
+ }).format(e);
802
+ }
803
+ function xe(e) {
703
804
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
704
805
  }
705
- var le = {
806
+ var Se = {
706
807
  default: "bg-muted text-muted-foreground",
707
808
  blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
708
809
  teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
@@ -711,163 +812,264 @@ var le = {
711
812
  success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
712
813
  warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
713
814
  danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
714
- }, K = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", ...l }) => {
715
- let m = le[c] || le.default, h = E(() => {
815
+ }, Ce = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, ...v }) => {
816
+ let y = Se[c] || Se.default, b = L(() => {
817
+ let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? be(t, l, u) : t ?? "", n = String(e);
818
+ return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
819
+ }, [
820
+ t,
821
+ l,
822
+ u,
823
+ d,
824
+ f
825
+ ]), x = L(() => {
716
826
  if (typeof r == "string") {
717
- let e = y(r);
718
- return e ? /* @__PURE__ */ F(e, { className: "h-4 w-4" }) : null;
827
+ let e = j(r);
828
+ return e ? /* @__PURE__ */ q(e, { className: "h-4 w-4" }) : null;
719
829
  }
720
830
  return r;
721
831
  }, [r]);
722
- return /* @__PURE__ */ I(u, {
723
- className: v("h-full overflow-hidden", i),
724
- ...l,
725
- children: [/* @__PURE__ */ I(f, {
832
+ return /* @__PURE__ */ J(m, {
833
+ className: A("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),
834
+ onClick: p,
835
+ role: p ? "button" : void 0,
836
+ tabIndex: p ? 0 : void 0,
837
+ onKeyDown: p ? (e) => {
838
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
839
+ } : void 0,
840
+ ...v,
841
+ children: [/* @__PURE__ */ J(g, {
726
842
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
727
- children: [/* @__PURE__ */ F(p, {
843
+ children: [/* @__PURE__ */ q(_, {
728
844
  className: "text-sm font-medium truncate",
729
- children: G(e)
730
- }), h && /* @__PURE__ */ F("div", {
731
- className: v("flex h-8 w-8 items-center justify-center rounded-md shrink-0", m),
732
- children: h
845
+ children: xe(e)
846
+ }), x && /* @__PURE__ */ q("div", {
847
+ className: A("flex h-8 w-8 items-center justify-center rounded-md shrink-0", y),
848
+ children: x
733
849
  })]
734
- }), /* @__PURE__ */ F(d, { children: o ? /* @__PURE__ */ I("div", {
850
+ }), /* @__PURE__ */ q(h, { children: o ? /* @__PURE__ */ J("div", {
735
851
  className: "flex items-center gap-2 text-muted-foreground",
736
852
  "data-testid": "metric-loading",
737
- children: [/* @__PURE__ */ F(N, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ F("span", {
853
+ children: [/* @__PURE__ */ q(ne, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ q("span", {
738
854
  className: "text-sm",
739
855
  children: "Loading…"
740
856
  })]
741
- }) : s ? /* @__PURE__ */ I("div", {
857
+ }) : s ? /* @__PURE__ */ J("div", {
742
858
  className: "flex items-center gap-2",
743
859
  "data-testid": "metric-error",
744
860
  role: "alert",
745
- children: [/* @__PURE__ */ F(k, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ F("span", {
861
+ children: [/* @__PURE__ */ q(B, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ q("span", {
746
862
  className: "text-xs text-destructive truncate",
747
863
  children: s
748
864
  })]
749
- }) : /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
865
+ }) : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("div", {
750
866
  className: "text-2xl font-bold truncate",
751
- children: t
752
- }), (n || a) && /* @__PURE__ */ I("p", {
753
- className: "text-xs text-muted-foreground flex items-center mt-1 truncate",
754
- children: [n && /* @__PURE__ */ I("span", {
755
- className: v("flex items-center mr-2 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"),
867
+ children: b
868
+ }), (n || a) && /* @__PURE__ */ J("div", {
869
+ className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
870
+ children: [n && /* @__PURE__ */ J("span", {
871
+ className: A("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"),
756
872
  children: [
757
- n.direction === "up" && /* @__PURE__ */ F(j, { className: "h-3 w-3 mr-1" }),
758
- n.direction === "down" && /* @__PURE__ */ F(A, { className: "h-3 w-3 mr-1" }),
759
- n.direction === "neutral" && /* @__PURE__ */ F(te, { className: "h-3 w-3 mr-1" }),
873
+ n.direction === "up" && /* @__PURE__ */ q(H, { className: "h-3 w-3 mr-1" }),
874
+ n.direction === "down" && /* @__PURE__ */ q(V, { className: "h-3 w-3 mr-1" }),
875
+ n.direction === "neutral" && /* @__PURE__ */ q(W, { className: "h-3 w-3 mr-1" }),
760
876
  n.value,
761
877
  "%"
762
878
  ]
763
- }), /* @__PURE__ */ F("span", {
764
- className: "truncate",
765
- children: G(a) || G(n?.label)
879
+ }), /* @__PURE__ */ q("span", {
880
+ className: "truncate min-w-0",
881
+ children: xe(a) || xe(n?.label)
766
882
  })]
767
883
  })] }) })]
768
884
  });
769
885
  };
770
886
  //#endregion
771
887
  //#region src/MetricCard.tsx
772
- function q(e) {
888
+ function we(e) {
773
889
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
774
890
  }
775
- var J = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
776
- let m = n ? y(n) : null;
777
- return /* @__PURE__ */ I(u, {
778
- className: v("h-full", o),
891
+ var Te = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
892
+ let u = n ? j(n) : null;
893
+ return /* @__PURE__ */ J(m, {
894
+ className: A("h-full", o),
779
895
  ...l,
780
- children: [/* @__PURE__ */ I(f, {
896
+ children: [/* @__PURE__ */ J(g, {
781
897
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
782
- children: [/* @__PURE__ */ F(p, {
898
+ children: [/* @__PURE__ */ q(_, {
783
899
  className: "text-sm font-medium",
784
- children: q(e)
785
- }), m && /* @__PURE__ */ F(m, { className: "h-4 w-4 text-muted-foreground" })]
786
- }), /* @__PURE__ */ F(d, { children: s ? /* @__PURE__ */ I("div", {
900
+ children: we(e)
901
+ }), u && /* @__PURE__ */ q(u, { className: "h-4 w-4 text-muted-foreground" })]
902
+ }), /* @__PURE__ */ q(h, { children: s ? /* @__PURE__ */ J("div", {
787
903
  className: "flex items-center gap-2 text-muted-foreground",
788
904
  "data-testid": "metric-card-loading",
789
- children: [/* @__PURE__ */ F(N, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ F("span", {
905
+ children: [/* @__PURE__ */ q(ne, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ q("span", {
790
906
  className: "text-sm",
791
907
  children: "Loading…"
792
908
  })]
793
- }) : c ? /* @__PURE__ */ I("div", {
909
+ }) : c ? /* @__PURE__ */ J("div", {
794
910
  className: "flex items-center gap-2",
795
911
  "data-testid": "metric-card-error",
796
912
  role: "alert",
797
- children: [/* @__PURE__ */ F(k, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ F("span", {
913
+ children: [/* @__PURE__ */ q(B, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ q("span", {
798
914
  className: "text-xs text-destructive truncate",
799
915
  children: c
800
916
  })]
801
- }) : /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
917
+ }) : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("div", {
802
918
  className: "text-2xl font-bold",
803
919
  children: t
804
- }), (r || i || a) && /* @__PURE__ */ I("p", {
920
+ }), (r || i || a) && /* @__PURE__ */ J("p", {
805
921
  className: "text-xs text-muted-foreground flex items-center mt-1",
806
- children: [r && i && /* @__PURE__ */ I("span", {
807
- className: v("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
922
+ children: [r && i && /* @__PURE__ */ J("span", {
923
+ className: A("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
808
924
  children: [
809
- r === "up" && /* @__PURE__ */ F(j, { className: "h-3 w-3 mr-1" }),
810
- r === "down" && /* @__PURE__ */ F(A, { className: "h-3 w-3 mr-1" }),
811
- r === "neutral" && /* @__PURE__ */ F(te, { className: "h-3 w-3 mr-1" }),
925
+ r === "up" && /* @__PURE__ */ q(H, { className: "h-3 w-3 mr-1" }),
926
+ r === "down" && /* @__PURE__ */ q(V, { className: "h-3 w-3 mr-1" }),
927
+ r === "neutral" && /* @__PURE__ */ q(W, { className: "h-3 w-3 mr-1" }),
812
928
  i
813
929
  ]
814
- }), q(a)]
930
+ }), we(a)]
815
931
  })] }) })]
816
932
  });
817
- }, Y = ({ objectName: e, aggregate: t, filter: n, label: i, fallbackValue: a, trend: o, icon: s, className: c, description: l, dataSource: u, colorVariant: d }) => {
818
- let f = w(r), p = u || f?.dataSource, [m, h] = O(null), [g, _] = O(!1), [v, y] = O(null), b = C(async (r, i) => {
819
- if (!(!r || !e)) {
820
- i.current && (_(!0), y(null));
933
+ }, Ee = ({ objectName: e, aggregate: t, filter: n, label: c, fallbackValue: l, trend: u, icon: d, className: f, description: p, dataSource: m, colorVariant: h, format: g, currency: _, prefix: v, suffix: y, drillDown: b, title: k }) => {
934
+ let A = ee(s), j = m || A?.dataSource, [M, N] = z(!1), [P, R] = z(null), [B, V] = z(!1), [H, te] = z(null), [U, ne] = z(null);
935
+ I(() => {
936
+ let t = !0;
937
+ if (!(!j || !e || typeof j.getObjectSchema != "function")) return j.getObjectSchema(e).then((e) => {
938
+ t && ne(e);
939
+ }).catch(() => {}), () => {
940
+ t = !1;
941
+ };
942
+ }, [j, e]);
943
+ let W = L(() => {
944
+ let e = t?.field;
945
+ if (!e || !U?.fields) return null;
946
+ let n = U.fields;
947
+ return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
948
+ }, [U, t?.field]), re = L(() => {
949
+ if (g) return g;
950
+ if (W) {
951
+ if (W.type === "currency") {
952
+ let e = W.precision ?? W.scale ?? 0;
953
+ return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
954
+ }
955
+ if (W.type === "percent") return "0,0%";
956
+ if (W.type === "number" || W.type === "integer") return "0,0";
957
+ }
958
+ }, [g, W]), ie = L(() => {
959
+ if (_) return _;
960
+ if (W?.type === "currency") return W.defaultCurrency || W.currency || void 0;
961
+ }, [_, W]), ae = L(() => t ? JSON.stringify(t) : "", [t]), G = L(() => i(n), [n]), Y = F(async (n, r) => {
962
+ if (!(!n || !e)) {
963
+ r.current && (V(!0), te(null));
821
964
  try {
822
- let a;
823
- if (t && typeof r.aggregate == "function") {
824
- let i = await r.aggregate(e, {
965
+ let i;
966
+ if (t && typeof n.aggregate == "function") {
967
+ let r = await n.aggregate(e, {
825
968
  field: t.field,
826
969
  function: t.function,
827
970
  groupBy: t.groupBy || "_all",
828
- filter: n
829
- }), o = Array.isArray(i) ? i : [];
830
- a = o.length === 0 ? 0 : t.function === "count" ? o.reduce((e, n) => e + (Number(n[t.field]) || Number(n.count) || 0), 0) : o[0][t.field] ?? 0;
831
- } else if (typeof r.find == "function") {
832
- let t = await r.find(e, { $filter: n });
833
- a = (Array.isArray(t) ? t : t?.data || t?.records || []).length;
971
+ filter: G
972
+ }), a = Array.isArray(r) ? r : [];
973
+ i = a.length === 0 ? 0 : t.function === "count" ? a.reduce((e, n) => e + (Number(n[t.field]) || Number(n.count) || 0), 0) : a[0][t.field] ?? 0;
974
+ } else if (typeof n.find == "function") {
975
+ let t = await n.find(e, { $filter: G });
976
+ i = (Array.isArray(t) ? t : t?.data || t?.records || []).length;
834
977
  } else return;
835
- i.current && h(a);
978
+ r.current && R(i);
836
979
  } catch (e) {
837
- console.error("[ObjectMetricWidget] Fetch error:", e), i.current && y(e instanceof Error ? e.message : "Failed to load metric");
980
+ console.error("[ObjectMetricWidget] Fetch error:", e), r.current && te(e instanceof Error ? e.message : "Failed to load metric");
838
981
  } finally {
839
- i.current && _(!1);
982
+ r.current && V(!1);
840
983
  }
841
984
  }
842
985
  }, [
843
986
  e,
844
- E(() => t ? JSON.stringify(t) : "", [t]),
845
- E(() => n ? JSON.stringify(n) : "", [n])
987
+ ae,
988
+ L(() => G ? JSON.stringify(G) : "", [G])
846
989
  ]);
847
- return T(() => {
990
+ I(() => {
848
991
  let t = { current: !0 };
849
- return p && e ? b(p, t) : (h(null), y(null)), () => {
992
+ return j && e ? Y(j, t) : (R(null), te(null)), () => {
850
993
  t.current = !1;
851
994
  };
852
995
  }, [
853
- p,
996
+ j,
854
997
  e,
855
- b
856
- ]), /* @__PURE__ */ F(K, {
857
- label: i,
858
- value: m === null ? p ? "—" : a ?? "—" : m,
859
- trend: o,
860
- icon: s,
861
- className: c,
862
- description: l,
863
- loading: g,
864
- error: v,
865
- colorVariant: d
866
- });
998
+ Y
999
+ ]);
1000
+ let oe = P === null ? j ? "—" : l ?? "—" : P, X = r(b) && !!e && !!j, Z = L(() => {
1001
+ let e = typeof c == "string" ? c : c?.defaultValue || "";
1002
+ return a(b, {}, (typeof k == "string" ? k : k?.defaultValue || "") || e || "Details");
1003
+ }, [
1004
+ b,
1005
+ c,
1006
+ k
1007
+ ]), se = L(() => {
1008
+ if (!X) return null;
1009
+ let t = b?.target ?? "drawer", n = /* @__PURE__ */ q("div", {
1010
+ className: "h-full overflow-auto",
1011
+ children: /* @__PURE__ */ q(o, { schema: {
1012
+ type: "object-data-table",
1013
+ objectName: e,
1014
+ filter: G,
1015
+ pageSize: 25,
1016
+ drillDown: { enabled: !1 }
1017
+ } })
1018
+ });
1019
+ return t === "modal" ? /* @__PURE__ */ q(x, {
1020
+ open: !0,
1021
+ onOpenChange: (e) => !e && N(!1),
1022
+ children: /* @__PURE__ */ J(S, {
1023
+ className: "max-w-4xl",
1024
+ children: [/* @__PURE__ */ q(C, { children: /* @__PURE__ */ q(w, { children: Z }) }), n]
1025
+ })
1026
+ }) : /* @__PURE__ */ q(T, {
1027
+ open: !0,
1028
+ onOpenChange: (e) => !e && N(!1),
1029
+ children: /* @__PURE__ */ J(E, {
1030
+ side: "right",
1031
+ className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1032
+ children: [/* @__PURE__ */ q(D, { children: /* @__PURE__ */ q(O, { children: Z }) }), /* @__PURE__ */ q("div", {
1033
+ className: "flex-1 overflow-hidden mt-2",
1034
+ children: n
1035
+ })]
1036
+ })
1037
+ });
1038
+ }, [
1039
+ X,
1040
+ b,
1041
+ e,
1042
+ G,
1043
+ Z
1044
+ ]);
1045
+ return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(Ce, {
1046
+ label: c,
1047
+ value: oe,
1048
+ trend: u,
1049
+ icon: d,
1050
+ className: f,
1051
+ description: p,
1052
+ loading: B,
1053
+ error: H,
1054
+ colorVariant: h,
1055
+ format: re,
1056
+ currency: ie,
1057
+ prefix: v,
1058
+ suffix: y,
1059
+ onClick: X ? () => N(!0) : void 0
1060
+ }), M && se] });
867
1061
  };
868
1062
  //#endregion
869
1063
  //#region src/PivotTable.tsx
870
- function ue(e, t) {
1064
+ function De() {
1065
+ try {
1066
+ let { t: e } = X(), t = e("dashboard.total");
1067
+ return !t || t === "dashboard.total" ? "Total" : t;
1068
+ } catch {
1069
+ return "Total";
1070
+ }
1071
+ }
1072
+ function Oe(e, t) {
871
1073
  if (!t) return String(e);
872
1074
  let n = "", r = "", i = !1, a, o = t, s = o.match(/^([^0-9.,#]*)/);
873
1075
  if (s && s[1]) {
@@ -884,7 +1086,11 @@ function ue(e, t) {
884
1086
  }
885
1087
  return n + l + r;
886
1088
  }
887
- function X(e, t) {
1089
+ var ke = "—";
1090
+ function Ae(e, t) {
1091
+ return e === "" ? ke : t?.[e] ?? e;
1092
+ }
1093
+ function je(e, t) {
888
1094
  if (e.length === 0) return 0;
889
1095
  switch (t) {
890
1096
  case "sum": return e.reduce((e, t) => e + t, 0);
@@ -895,57 +1101,65 @@ function X(e, t) {
895
1101
  default: return e.reduce((e, t) => e + t, 0);
896
1102
  }
897
1103
  }
898
- var Z = ({ schema: e, className: t }) => {
899
- let { title: n, rowField: r, columnField: i, valueField: a, aggregation: o = "sum", data: s = [], showRowTotals: c = !1, showColumnTotals: l = !1, format: u, columnColors: d } = e, f = Array.isArray(s) ? s : [], { rowKeys: p, colKeys: m, matrix: h, rowTotals: g, colTotals: _, grandTotal: y } = E(() => {
1104
+ var Me = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabel: a, onDrillDown: o }) => {
1105
+ 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 = De(), y = r(_) && typeof o == "function", b = (e) => {
1106
+ y && o({
1107
+ ...e,
1108
+ rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
1109
+ colLabel: e.colKey === void 0 ? e.colLabel : i?.[e.colKey] ?? e.colKey
1110
+ });
1111
+ }, x = (e) => (t) => {
1112
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
1113
+ }, S = y ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", C = Array.isArray(f) ? f : [], { rowKeys: w, colKeys: T, matrix: E, rowTotals: D, colTotals: O, grandTotal: k } = L(() => {
900
1114
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
901
- for (let o of f) {
902
- let s = String(o[r] ?? ""), c = String(o[i] ?? ""), l = Number(o[a]) || 0;
903
- e.set(s, !0), t.set(c, !0), n[s] || (n[s] = {}), n[s][c] || (n[s][c] = []), n[s][c].push(l);
1115
+ for (let r of C) {
1116
+ let i = String(r[c] ?? ""), a = String(r[l] ?? ""), o = Number(r[u]) || 0;
1117
+ e.set(i, !0), t.set(a, !0), n[i] || (n[i] = {}), n[i][a] || (n[i][a] = []), n[i][a].push(o);
904
1118
  }
905
- let s = Array.from(e.keys()), c = Array.from(t.keys()), l = {}, u = {}, d = {};
906
- for (let e of s) {
907
- l[e] = {};
1119
+ let r = Array.from(e.keys()), i = Array.from(t.keys()), a = {}, o = {}, s = {};
1120
+ for (let e of r) {
1121
+ a[e] = {};
908
1122
  let t = [];
909
- for (let r of c) {
910
- let i = n[e]?.[r] ?? [], a = X(i, o);
911
- l[e][r] = a, t.push(...i), !d[r] && d[r];
1123
+ for (let r of i) {
1124
+ let i = n[e]?.[r] ?? [], o = je(i, d);
1125
+ a[e][r] = o, t.push(...i), !s[r] && s[r];
912
1126
  }
913
- u[e] = X(t, o);
1127
+ o[e] = je(t, d);
914
1128
  }
915
- for (let e of c) {
1129
+ for (let e of i) {
916
1130
  let t = [];
917
- for (let r of s) {
918
- let i = n[r]?.[e] ?? [];
919
- t.push(...i);
1131
+ for (let i of r) {
1132
+ let r = n[i]?.[e] ?? [];
1133
+ t.push(...r);
920
1134
  }
921
- d[e] = X(t, o);
1135
+ s[e] = je(t, d);
922
1136
  }
923
- let p = [];
924
- for (let e of f) p.push(Number(e[a]) || 0);
1137
+ let f = [];
1138
+ for (let e of C) f.push(Number(e[u]) || 0);
925
1139
  return {
926
- rowKeys: s,
927
- colKeys: c,
928
- matrix: l,
929
- rowTotals: u,
930
- colTotals: d,
931
- grandTotal: X(p, o)
1140
+ rowKeys: r,
1141
+ colKeys: i,
1142
+ matrix: a,
1143
+ rowTotals: o,
1144
+ colTotals: s,
1145
+ grandTotal: je(f, d)
932
1146
  };
933
1147
  }, [
934
- f,
935
- r,
936
- i,
937
- a,
938
- o
939
- ]), b = (e) => ue(e, u);
940
- return f.length === 0 ? /* @__PURE__ */ I("div", {
941
- className: v("overflow-auto", t),
942
- children: [n && /* @__PURE__ */ F("h3", {
1148
+ C,
1149
+ c,
1150
+ l,
1151
+ u,
1152
+ d
1153
+ ]), j = (e) => Oe(e, h);
1154
+ return C.length === 0 ? /* @__PURE__ */ J("div", {
1155
+ className: A("overflow-auto", t),
1156
+ children: [s && /* @__PURE__ */ q("h3", {
943
1157
  className: "text-sm font-semibold mb-2",
944
- children: n
945
- }), /* @__PURE__ */ I("div", {
1158
+ children: s
1159
+ }), /* @__PURE__ */ J("div", {
946
1160
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
947
1161
  "data-testid": "pivot-empty-state",
948
- children: [/* @__PURE__ */ I("svg", {
1162
+ children: [/* @__PURE__ */ J("svg", {
949
1163
  xmlns: "http://www.w3.org/2000/svg",
950
1164
  className: "h-8 w-8 mb-2 opacity-40",
951
1165
  viewBox: "0 0 24 24",
@@ -955,353 +1169,379 @@ var Z = ({ schema: e, className: t }) => {
955
1169
  strokeLinecap: "round",
956
1170
  strokeLinejoin: "round",
957
1171
  children: [
958
- /* @__PURE__ */ F("rect", {
1172
+ /* @__PURE__ */ q("rect", {
959
1173
  x: "3",
960
1174
  y: "3",
961
1175
  width: "7",
962
1176
  height: "7"
963
1177
  }),
964
- /* @__PURE__ */ F("rect", {
1178
+ /* @__PURE__ */ q("rect", {
965
1179
  x: "14",
966
1180
  y: "3",
967
1181
  width: "7",
968
1182
  height: "7"
969
1183
  }),
970
- /* @__PURE__ */ F("rect", {
1184
+ /* @__PURE__ */ q("rect", {
971
1185
  x: "3",
972
1186
  y: "14",
973
1187
  width: "7",
974
1188
  height: "7"
975
1189
  }),
976
- /* @__PURE__ */ F("rect", {
1190
+ /* @__PURE__ */ q("rect", {
977
1191
  x: "14",
978
1192
  y: "14",
979
1193
  width: "7",
980
1194
  height: "7"
981
1195
  })
982
1196
  ]
983
- }), /* @__PURE__ */ F("p", {
1197
+ }), /* @__PURE__ */ q("p", {
984
1198
  className: "text-xs",
985
1199
  children: "No data available"
986
1200
  })]
987
1201
  })]
988
- }) : /* @__PURE__ */ I("div", {
989
- className: v("overflow-auto", t),
990
- children: [n && /* @__PURE__ */ F("h3", {
1202
+ }) : /* @__PURE__ */ J("div", {
1203
+ className: A("overflow-auto", t),
1204
+ children: [s && /* @__PURE__ */ q("h3", {
991
1205
  className: "text-sm font-semibold mb-2",
992
- children: n
993
- }), /* @__PURE__ */ I("table", {
994
- className: "w-full text-sm border-collapse",
1206
+ children: s
1207
+ }), /* @__PURE__ */ J("table", {
1208
+ className: "w-full text-sm border-collapse table-auto",
995
1209
  role: "table",
996
1210
  children: [
997
- /* @__PURE__ */ F("thead", { children: /* @__PURE__ */ I("tr", {
1211
+ /* @__PURE__ */ q("thead", { children: /* @__PURE__ */ J("tr", {
998
1212
  className: "border-b border-border",
999
1213
  children: [
1000
- /* @__PURE__ */ F("th", {
1001
- className: "text-left p-2 font-medium text-muted-foreground",
1002
- children: r
1214
+ /* @__PURE__ */ q("th", {
1215
+ className: "text-left p-2 font-medium text-muted-foreground whitespace-nowrap",
1216
+ children: a || c
1003
1217
  }),
1004
- m.map((e) => /* @__PURE__ */ F("th", {
1005
- className: v("text-right p-2 font-medium", d?.[e] ?? "text-muted-foreground"),
1006
- children: e
1007
- }, e)),
1008
- c && /* @__PURE__ */ F("th", {
1009
- className: "text-right p-2 font-semibold text-muted-foreground bg-muted/20",
1010
- children: "Total"
1218
+ T.map((e) => {
1219
+ let t = () => b({
1220
+ scope: "column",
1221
+ colKey: e
1222
+ });
1223
+ return /* @__PURE__ */ q("th", {
1224
+ className: A("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", S),
1225
+ title: e === "" ? `${l}: (empty)` : `${l}: ${e}`,
1226
+ role: y ? "button" : void 0,
1227
+ tabIndex: y ? 0 : void 0,
1228
+ onClick: y ? t : void 0,
1229
+ onKeyDown: y ? x(t) : void 0,
1230
+ "aria-label": y ? `Drill into ${l}: ${e || "(empty)"}` : void 0,
1231
+ children: Ae(e, i)
1232
+ }, e);
1233
+ }),
1234
+ p && /* @__PURE__ */ q("th", {
1235
+ className: "text-right p-2 font-semibold text-muted-foreground bg-muted/20 whitespace-nowrap",
1236
+ children: v
1011
1237
  })
1012
1238
  ]
1013
1239
  }) }),
1014
- /* @__PURE__ */ F("tbody", { children: p.map((e) => /* @__PURE__ */ I("tr", {
1240
+ /* @__PURE__ */ q("tbody", { children: w.map((e) => /* @__PURE__ */ J("tr", {
1015
1241
  className: "border-b border-border/50 hover:bg-muted/30",
1016
1242
  children: [
1017
- /* @__PURE__ */ F("td", {
1018
- className: "p-2 font-medium",
1019
- children: e
1243
+ /* @__PURE__ */ q("td", {
1244
+ className: A("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", S),
1245
+ role: y ? "button" : void 0,
1246
+ tabIndex: y ? 0 : void 0,
1247
+ onClick: y ? () => b({
1248
+ scope: "row",
1249
+ rowKey: e
1250
+ }) : void 0,
1251
+ onKeyDown: y ? x(() => b({
1252
+ scope: "row",
1253
+ rowKey: e
1254
+ })) : void 0,
1255
+ "aria-label": y ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
1256
+ children: Ae(e, n)
1257
+ }),
1258
+ T.map((t) => {
1259
+ let n = E[e]?.[t] ?? 0, r = () => b({
1260
+ scope: "cell",
1261
+ rowKey: e,
1262
+ colKey: t,
1263
+ value: n
1264
+ });
1265
+ return /* @__PURE__ */ q("td", {
1266
+ className: A("text-right p-2 tabular-nums", g?.[t], S),
1267
+ role: y ? "button" : void 0,
1268
+ tabIndex: y ? 0 : void 0,
1269
+ onClick: y ? r : void 0,
1270
+ onKeyDown: y ? x(r) : void 0,
1271
+ "aria-label": y ? `Drill into ${c}=${e || "(empty)"}, ${l}=${t || "(empty)"}` : void 0,
1272
+ children: j(n)
1273
+ }, t);
1020
1274
  }),
1021
- m.map((t) => /* @__PURE__ */ F("td", {
1022
- className: v("text-right p-2 tabular-nums", d?.[t]),
1023
- children: b(h[e]?.[t] ?? 0)
1024
- }, t)),
1025
- c && /* @__PURE__ */ F("td", {
1026
- className: "text-right p-2 font-semibold tabular-nums bg-muted/20",
1027
- children: b(g[e] ?? 0)
1275
+ p && /* @__PURE__ */ q("td", {
1276
+ className: A("text-right p-2 font-semibold tabular-nums bg-muted/20", S),
1277
+ role: y ? "button" : void 0,
1278
+ tabIndex: y ? 0 : void 0,
1279
+ onClick: y ? () => b({
1280
+ scope: "row",
1281
+ rowKey: e,
1282
+ value: D[e] ?? 0
1283
+ }) : void 0,
1284
+ onKeyDown: y ? x(() => b({
1285
+ scope: "row",
1286
+ rowKey: e,
1287
+ value: D[e] ?? 0
1288
+ })) : void 0,
1289
+ children: j(D[e] ?? 0)
1028
1290
  })
1029
1291
  ]
1030
1292
  }, e)) }),
1031
- l && /* @__PURE__ */ F("tfoot", { children: /* @__PURE__ */ I("tr", {
1293
+ m && /* @__PURE__ */ q("tfoot", { children: /* @__PURE__ */ J("tr", {
1032
1294
  className: "border-t-2 border-border font-semibold bg-muted/40",
1033
1295
  children: [
1034
- /* @__PURE__ */ F("td", {
1296
+ /* @__PURE__ */ q("td", {
1035
1297
  className: "p-2",
1036
- children: "Total"
1298
+ children: v
1037
1299
  }),
1038
- m.map((e) => /* @__PURE__ */ F("td", {
1039
- className: "text-right p-2 tabular-nums",
1040
- children: b(_[e] ?? 0)
1300
+ T.map((e) => /* @__PURE__ */ q("td", {
1301
+ className: A("text-right p-2 tabular-nums", S),
1302
+ role: y ? "button" : void 0,
1303
+ tabIndex: y ? 0 : void 0,
1304
+ onClick: y ? () => b({
1305
+ scope: "column",
1306
+ colKey: e,
1307
+ value: O[e] ?? 0
1308
+ }) : void 0,
1309
+ onKeyDown: y ? x(() => b({
1310
+ scope: "column",
1311
+ colKey: e,
1312
+ value: O[e] ?? 0
1313
+ })) : void 0,
1314
+ children: j(O[e] ?? 0)
1041
1315
  }, e)),
1042
- c && /* @__PURE__ */ F("td", {
1043
- className: "text-right p-2 tabular-nums font-bold",
1044
- children: b(y)
1316
+ p && /* @__PURE__ */ q("td", {
1317
+ className: A("text-right p-2 tabular-nums font-bold", S),
1318
+ role: y ? "button" : void 0,
1319
+ tabIndex: y ? 0 : void 0,
1320
+ onClick: y ? () => b({
1321
+ scope: "total",
1322
+ value: k
1323
+ }) : void 0,
1324
+ onKeyDown: y ? x(() => b({
1325
+ scope: "total",
1326
+ value: k
1327
+ })) : void 0,
1328
+ children: j(k)
1045
1329
  })
1046
1330
  ]
1047
1331
  }) })
1048
1332
  ]
1049
1333
  })]
1050
1334
  });
1051
- }, Q = ({ schema: e, dataSource: n, className: i }) => {
1052
- let o = w(r), s = n || o?.dataSource, c = a(e.bind), [l, u] = O([]), [d, f] = O(!1), [p, m] = O(null);
1053
- T(() => {
1054
- let n = !0;
1055
- return e.objectName && !c && (!e.data || e.data.length === 0) && (async () => {
1056
- if (!(!s || !e.objectName)) {
1057
- n && (f(!0), m(null));
1058
- try {
1059
- let r;
1060
- if (typeof s.find == "function") r = t(await s.find(e.objectName, { $filter: e.filter }));
1061
- else return;
1062
- n && u(r);
1063
- } catch (e) {
1064
- console.error("[ObjectPivotTable] Fetch error:", e), n && m(e instanceof Error ? e.message : "Failed to load data");
1065
- } finally {
1066
- n && f(!1);
1067
- }
1068
- }
1069
- })(), () => {
1070
- n = !1;
1071
- };
1072
- }, [
1073
- e.objectName,
1074
- s,
1075
- c,
1076
- e.data,
1077
- e.filter
1078
- ]);
1079
- let h = c || e.data || l, g = Array.isArray(h) ? h : [];
1080
- return d && g.length === 0 ? /* @__PURE__ */ I("div", {
1081
- className: v("overflow-auto", i),
1082
- "data-testid": "pivot-loading",
1083
- children: [e.title && /* @__PURE__ */ F("h3", {
1084
- className: "text-sm font-semibold mb-2",
1085
- children: e.title
1086
- }), /* @__PURE__ */ I("div", {
1087
- className: "space-y-2 p-2",
1088
- children: [/* @__PURE__ */ I("div", {
1089
- className: "flex gap-2",
1090
- children: [
1091
- /* @__PURE__ */ F(_, { className: "h-6 w-24" }),
1092
- /* @__PURE__ */ F(_, { className: "h-6 w-20" }),
1093
- /* @__PURE__ */ F(_, { className: "h-6 w-20" }),
1094
- /* @__PURE__ */ F(_, { className: "h-6 w-20" })
1095
- ]
1096
- }), [
1097
- 1,
1098
- 2,
1099
- 3
1100
- ].map((e) => /* @__PURE__ */ I("div", {
1101
- className: "flex gap-2",
1102
- children: [
1103
- /* @__PURE__ */ F(_, { className: "h-5 w-24" }),
1104
- /* @__PURE__ */ F(_, { className: "h-5 w-20" }),
1105
- /* @__PURE__ */ F(_, { className: "h-5 w-20" }),
1106
- /* @__PURE__ */ F(_, { className: "h-5 w-20" })
1107
- ]
1108
- }, e))]
1109
- })]
1110
- }) : p ? /* @__PURE__ */ I("div", {
1111
- className: v("overflow-auto", i),
1112
- "data-testid": "pivot-error",
1113
- children: [e.title && /* @__PURE__ */ F("h3", {
1114
- className: "text-sm font-semibold mb-2",
1115
- children: e.title
1116
- }), /* @__PURE__ */ I("div", {
1117
- className: "flex flex-col items-center justify-center py-8 text-destructive",
1118
- "data-testid": "pivot-error-message",
1119
- children: [/* @__PURE__ */ I("svg", {
1120
- xmlns: "http://www.w3.org/2000/svg",
1121
- className: "h-8 w-8 mb-2 opacity-60",
1122
- viewBox: "0 0 24 24",
1123
- fill: "none",
1124
- stroke: "currentColor",
1125
- strokeWidth: "1.5",
1126
- strokeLinecap: "round",
1127
- strokeLinejoin: "round",
1128
- children: [
1129
- /* @__PURE__ */ F("circle", {
1130
- cx: "12",
1131
- cy: "12",
1132
- r: "10"
1133
- }),
1134
- /* @__PURE__ */ F("line", {
1135
- x1: "12",
1136
- y1: "8",
1137
- x2: "12",
1138
- y2: "12"
1139
- }),
1140
- /* @__PURE__ */ F("line", {
1141
- x1: "12",
1142
- y1: "16",
1143
- x2: "12.01",
1144
- y2: "16"
1145
- })
1146
- ]
1147
- }), /* @__PURE__ */ F("p", {
1148
- className: "text-xs",
1149
- children: p
1150
- })]
1151
- })]
1152
- }) : !s && e.objectName && g.length === 0 ? /* @__PURE__ */ I("div", {
1153
- className: v("overflow-auto", i),
1154
- children: [e.title && /* @__PURE__ */ F("h3", {
1155
- className: "text-sm font-semibold mb-2",
1156
- children: e.title
1157
- }), /* @__PURE__ */ F("div", {
1158
- className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1159
- children: /* @__PURE__ */ I("p", {
1160
- className: "text-xs",
1161
- children: [
1162
- "No data source available for “",
1163
- e.objectName,
1164
- "”"
1165
- ]
1166
- })
1167
- })]
1168
- }) : /* @__PURE__ */ F(Z, {
1169
- schema: {
1170
- ...e,
1171
- data: g
1172
- },
1173
- className: i
1174
- });
1175
1335
  };
1176
1336
  //#endregion
1177
1337
  //#region src/ObjectDataTable.tsx
1178
- function de(e) {
1338
+ function Ne(e) {
1179
1339
  return e.map((e) => typeof e == "string" ? {
1180
1340
  header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
1181
1341
  accessorKey: e
1182
1342
  } : e);
1183
1343
  }
1184
- var fe = ({ schema: e, dataSource: i, className: o }) => {
1185
- let s = w(r), c = i || s?.dataSource, l = a(e.bind), { fieldLabel: u, fieldOptionLabel: d } = z(), [f, p] = O([]), [m, h] = O(null), [g, y] = O(!1), [b, x] = O(null);
1186
- T(() => {
1187
- let n = !0;
1188
- return e.objectName && !l && (!e.data || e.data.length === 0) && (async () => {
1344
+ function Pe(e, t) {
1345
+ if (!t?.fields) return [];
1346
+ let n = {};
1347
+ if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
1348
+ else for (let [e, r] of Object.entries(t.fields)) n[e] = {
1349
+ name: e,
1350
+ ...r
1351
+ };
1352
+ 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();
1353
+ if (i.length > 0) {
1354
+ let e = i.map((e) => typeof e == "string" ? e : e.accessorKey || e.name).filter(Boolean);
1355
+ for (let t of e) {
1356
+ let e = n[t];
1357
+ e && r(e.type) && a.add(t);
1358
+ }
1359
+ } else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
1360
+ return Array.from(a);
1361
+ }
1362
+ var Fe = ({ schema: e, dataSource: t, className: r }) => {
1363
+ let a = ee(s), c = t || a?.dataSource, u = l(e.bind), { fieldLabel: d, fieldOptionLabel: f } = Z(), [p, m] = z([]), [h, g] = z(null), [_, v] = z(!1), [y, b] = z(null);
1364
+ I(() => {
1365
+ let t = !0;
1366
+ return e.objectName && !u && (!e.data || e.data.length === 0) && (async () => {
1189
1367
  if (!(!c || !e.objectName)) {
1190
- n && (y(!0), x(null));
1368
+ t && (v(!0), b(null));
1191
1369
  try {
1192
1370
  let r;
1193
- if (typeof c.find == "function") r = t(await c.find(e.objectName, { $filter: e.filter }));
1194
- else return;
1195
- n && p(r);
1371
+ if (typeof c.find == "function") {
1372
+ let t = Pe(e, h), a = { $filter: i(e.filter) };
1373
+ t.length && (a.$expand = t), r = n(await c.find(e.objectName, a));
1374
+ } else return;
1375
+ t && m(r);
1196
1376
  } catch (e) {
1197
- console.error("[ObjectDataTable] Fetch error:", e), n && x(e instanceof Error ? e.message : "Failed to load data");
1377
+ console.error("[ObjectDataTable] Fetch error:", e), t && b(e instanceof Error ? e.message : "Failed to load data");
1198
1378
  } finally {
1199
- n && y(!1);
1379
+ t && v(!1);
1200
1380
  }
1201
1381
  }
1202
1382
  })(), () => {
1203
- n = !1;
1383
+ t = !1;
1204
1384
  };
1205
1385
  }, [
1206
1386
  e.objectName,
1207
1387
  c,
1208
- l,
1388
+ u,
1209
1389
  e.data,
1210
- e.filter
1211
- ]), T(() => {
1390
+ e.filter,
1391
+ h
1392
+ ]), I(() => {
1212
1393
  let t = !0;
1213
1394
  if (!(!c || !e.objectName || typeof c.getObjectSchema != "function")) return c.getObjectSchema(e.objectName).then((e) => {
1214
- t && h(e);
1395
+ t && g(e);
1215
1396
  }).catch(() => {}), () => {
1216
1397
  t = !1;
1217
1398
  };
1218
1399
  }, [e.objectName, c]);
1219
- let S = l || e.data || f, C = Array.isArray(S) ? S : [], D = E(() => {
1220
- let t = e.objectName, n = (e) => {
1400
+ let x = u || e.data || p, S = Array.isArray(x) ? x : [], C = L(() => {
1401
+ let t = e.objectName, n = {};
1402
+ if (h?.fields) {
1403
+ let e = h.fields;
1404
+ if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
1405
+ else for (let [t, r] of Object.entries(e)) n[t] = {
1406
+ name: t,
1407
+ ...r
1408
+ };
1409
+ }
1410
+ let r = (e) => {
1221
1411
  let n = e.charAt(0).toUpperCase() + e.slice(1).replace(/([A-Z])/g, " $1");
1222
- return t ? u(t, e, n) : n;
1412
+ return t ? d(t, e, n) : n;
1413
+ }, i = (e) => {
1414
+ 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;
1415
+ t && a && (r?.type === "select" || r?.type === "picklist" || r?.type === "dropdown" || r?.type === "status") && (a = a.map((n) => {
1416
+ if (n == null) return n;
1417
+ let r = typeof n == "object" ? n.value : n, i = typeof n == "object" && n.label || String(r);
1418
+ return {
1419
+ value: r,
1420
+ label: f(t, e.accessorKey, String(r), i),
1421
+ color: typeof n == "object" ? n.color : void 0
1422
+ };
1423
+ }));
1424
+ let o = {
1425
+ name: e.accessorKey,
1426
+ label: e.header,
1427
+ type: e.type ?? r?.type,
1428
+ options: a,
1429
+ referenceTo: i,
1430
+ format: e.format ?? r?.format,
1431
+ currency: e.currency ?? r?.currency ?? r?.defaultCurrency,
1432
+ decimals: e.decimals ?? r?.decimals ?? r?.precision ?? r?.scale
1433
+ }, s = new Set([
1434
+ "currency",
1435
+ "money",
1436
+ "number",
1437
+ "integer",
1438
+ "decimal",
1439
+ "float",
1440
+ "percent",
1441
+ "percentage"
1442
+ ]), c = e.align ?? (s.has(o.type) || typeof o.format == "string" && /^[\$¥€£]|%$|0/.test(o.format) ? "right" : void 0);
1443
+ if (typeof e.cell == "function") return {
1444
+ ...e,
1445
+ ...o,
1446
+ align: c
1447
+ };
1448
+ let l = (e) => {
1449
+ if (e == null || e === "") return "";
1450
+ let t = o.format;
1451
+ if (typeof t == "string" && /^\$|¥|€|£/.test(t) && typeof e == "number") {
1452
+ let n = {
1453
+ $: "USD",
1454
+ "¥": "JPY",
1455
+ "€": "EUR",
1456
+ "£": "GBP"
1457
+ }[t[0]];
1458
+ return se(e, o.currency || n);
1459
+ }
1460
+ if (typeof t == "string" && /%/.test(t) && typeof e == "number") {
1461
+ let n = (t.match(/0\.(0+)%/) || [, ""])[1].length;
1462
+ return le((e > 1 ? e / 100 : e) * 100, n);
1463
+ }
1464
+ return typeof t == "string" && /[YMDHms]/.test(t) ? ce(e, t) : /* @__PURE__ */ q(ue(de(o)), {
1465
+ value: e,
1466
+ field: o
1467
+ });
1468
+ };
1469
+ return {
1470
+ ...e,
1471
+ ...o,
1472
+ align: c,
1473
+ cell: l
1474
+ };
1223
1475
  };
1224
1476
  if (e.columns && e.columns.length > 0) {
1225
- let n = de(e.columns);
1226
- return t ? n.map((e) => ({
1477
+ let n = Ne(e.columns);
1478
+ return (t ? n.map((e) => ({
1227
1479
  ...e,
1228
- header: u(t, e.accessorKey, e.header)
1229
- })) : n;
1480
+ header: d(t, e.accessorKey, e.header)
1481
+ })) : n).map(i);
1230
1482
  }
1231
- return C.length === 0 ? [] : Object.keys(C[0]).filter((e) => !e.startsWith("_")).map((e) => ({
1232
- header: n(e),
1483
+ if (S.length === 0) return [];
1484
+ let a = new Set([
1485
+ "id",
1486
+ "organization_id",
1487
+ "tenant_id",
1488
+ "created_at",
1489
+ "updated_at",
1490
+ "created_by",
1491
+ "updated_by",
1492
+ "deleted_at",
1493
+ "deleted_by",
1494
+ "version",
1495
+ "_id",
1496
+ "__typename"
1497
+ ]), o = (e, t) => t && (t.isSystem === !0 || t.system === !0) ? !0 : a.has(e);
1498
+ return (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !o(e, n[e])) : Object.keys(S[0]).filter((e) => !e.startsWith("_") && !o(e))).map((e) => i({
1499
+ header: r(e),
1233
1500
  accessorKey: e
1234
1501
  }));
1235
1502
  }, [
1236
1503
  e.columns,
1237
1504
  e.objectName,
1238
- C,
1239
- u
1240
- ]), k = E(() => {
1241
- let t = e.objectName;
1242
- if (!t || !m?.fields || C.length === 0) return C;
1243
- let n = {};
1244
- for (let e of D) {
1245
- let t = m.fields[e.accessorKey];
1246
- if (!t) continue;
1247
- let r = t.type;
1248
- if (r !== "select" && r !== "picklist" && r !== "dropdown") continue;
1249
- let i = t.options || [], a = {};
1250
- for (let e of i) typeof e == "string" ? a[e] = e : e && typeof e == "object" && (a[String(e.value)] = e.label || String(e.value));
1251
- n[e.accessorKey] = a;
1252
- }
1253
- return Object.keys(n).length === 0 ? C : C.map((e) => {
1254
- let r = { ...e };
1255
- for (let [i, a] of Object.entries(n)) {
1256
- let n = e[i];
1257
- if (n == null || n === "") continue;
1258
- let o = String(n);
1259
- r[i] = d(t, i, o, a[o] || o);
1260
- }
1261
- return r;
1262
- });
1263
- }, [
1264
- C,
1265
- D,
1266
- m,
1267
- e.objectName,
1268
- d
1505
+ S,
1506
+ h,
1507
+ d,
1508
+ f
1269
1509
  ]);
1270
- return g && C.length === 0 ? /* @__PURE__ */ F("div", {
1271
- className: v("overflow-auto", o),
1510
+ return _ && S.length === 0 ? /* @__PURE__ */ q("div", {
1511
+ className: A("overflow-auto", r),
1272
1512
  "data-testid": "table-loading",
1273
- children: /* @__PURE__ */ I("div", {
1513
+ children: /* @__PURE__ */ J("div", {
1274
1514
  className: "space-y-2 p-2",
1275
- children: [/* @__PURE__ */ I("div", {
1515
+ children: [/* @__PURE__ */ J("div", {
1276
1516
  className: "flex gap-2",
1277
1517
  children: [
1278
- /* @__PURE__ */ F(_, { className: "h-6 w-1/4" }),
1279
- /* @__PURE__ */ F(_, { className: "h-6 w-1/4" }),
1280
- /* @__PURE__ */ F(_, { className: "h-6 w-1/4" }),
1281
- /* @__PURE__ */ F(_, { className: "h-6 w-1/4" })
1518
+ /* @__PURE__ */ q(k, { className: "h-6 w-1/4" }),
1519
+ /* @__PURE__ */ q(k, { className: "h-6 w-1/4" }),
1520
+ /* @__PURE__ */ q(k, { className: "h-6 w-1/4" }),
1521
+ /* @__PURE__ */ q(k, { className: "h-6 w-1/4" })
1282
1522
  ]
1283
1523
  }), [
1284
1524
  1,
1285
1525
  2,
1286
1526
  3,
1287
1527
  4
1288
- ].map((e) => /* @__PURE__ */ I("div", {
1528
+ ].map((e) => /* @__PURE__ */ J("div", {
1289
1529
  className: "flex gap-2",
1290
1530
  children: [
1291
- /* @__PURE__ */ F(_, { className: "h-5 w-1/4" }),
1292
- /* @__PURE__ */ F(_, { className: "h-5 w-1/4" }),
1293
- /* @__PURE__ */ F(_, { className: "h-5 w-1/4" }),
1294
- /* @__PURE__ */ F(_, { className: "h-5 w-1/4" })
1531
+ /* @__PURE__ */ q(k, { className: "h-5 w-1/4" }),
1532
+ /* @__PURE__ */ q(k, { className: "h-5 w-1/4" }),
1533
+ /* @__PURE__ */ q(k, { className: "h-5 w-1/4" }),
1534
+ /* @__PURE__ */ q(k, { className: "h-5 w-1/4" })
1295
1535
  ]
1296
1536
  }, e))]
1297
1537
  })
1298
- }) : b ? /* @__PURE__ */ F("div", {
1299
- className: v("overflow-auto", o),
1538
+ }) : y ? /* @__PURE__ */ q("div", {
1539
+ className: A("overflow-auto", r),
1300
1540
  "data-testid": "table-error",
1301
- children: /* @__PURE__ */ I("div", {
1541
+ children: /* @__PURE__ */ J("div", {
1302
1542
  className: "flex flex-col items-center justify-center py-8 text-destructive",
1303
1543
  "data-testid": "table-error-message",
1304
- children: [/* @__PURE__ */ I("svg", {
1544
+ children: [/* @__PURE__ */ J("svg", {
1305
1545
  xmlns: "http://www.w3.org/2000/svg",
1306
1546
  className: "h-8 w-8 mb-2 opacity-60",
1307
1547
  viewBox: "0 0 24 24",
@@ -1311,34 +1551,34 @@ var fe = ({ schema: e, dataSource: i, className: o }) => {
1311
1551
  strokeLinecap: "round",
1312
1552
  strokeLinejoin: "round",
1313
1553
  children: [
1314
- /* @__PURE__ */ F("circle", {
1554
+ /* @__PURE__ */ q("circle", {
1315
1555
  cx: "12",
1316
1556
  cy: "12",
1317
1557
  r: "10"
1318
1558
  }),
1319
- /* @__PURE__ */ F("line", {
1559
+ /* @__PURE__ */ q("line", {
1320
1560
  x1: "12",
1321
1561
  y1: "8",
1322
1562
  x2: "12",
1323
1563
  y2: "12"
1324
1564
  }),
1325
- /* @__PURE__ */ F("line", {
1565
+ /* @__PURE__ */ q("line", {
1326
1566
  x1: "12",
1327
1567
  y1: "16",
1328
1568
  x2: "12.01",
1329
1569
  y2: "16"
1330
1570
  })
1331
1571
  ]
1332
- }), /* @__PURE__ */ F("p", {
1572
+ }), /* @__PURE__ */ q("p", {
1333
1573
  className: "text-xs",
1334
- children: b
1574
+ children: y
1335
1575
  })]
1336
1576
  })
1337
- }) : !c && e.objectName && C.length === 0 ? /* @__PURE__ */ F("div", {
1338
- className: v("overflow-auto", o),
1339
- children: /* @__PURE__ */ F("div", {
1577
+ }) : !c && e.objectName && S.length === 0 ? /* @__PURE__ */ q("div", {
1578
+ className: A("overflow-auto", r),
1579
+ children: /* @__PURE__ */ q("div", {
1340
1580
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1341
- children: /* @__PURE__ */ I("p", {
1581
+ children: /* @__PURE__ */ J("p", {
1342
1582
  className: "text-xs",
1343
1583
  children: [
1344
1584
  "No data source available for “",
@@ -1347,12 +1587,12 @@ var fe = ({ schema: e, dataSource: i, className: o }) => {
1347
1587
  ]
1348
1588
  })
1349
1589
  })
1350
- }) : C.length === 0 ? /* @__PURE__ */ F("div", {
1351
- className: v("overflow-auto", o),
1590
+ }) : S.length === 0 ? /* @__PURE__ */ q("div", {
1591
+ className: A("overflow-auto", r),
1352
1592
  "data-testid": "table-empty-state",
1353
- children: /* @__PURE__ */ I("div", {
1593
+ children: /* @__PURE__ */ J("div", {
1354
1594
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1355
- children: [/* @__PURE__ */ I("svg", {
1595
+ children: [/* @__PURE__ */ J("svg", {
1356
1596
  xmlns: "http://www.w3.org/2000/svg",
1357
1597
  className: "h-8 w-8 mb-2 opacity-40",
1358
1598
  viewBox: "0 0 24 24",
@@ -1362,7 +1602,7 @@ var fe = ({ schema: e, dataSource: i, className: o }) => {
1362
1602
  strokeLinecap: "round",
1363
1603
  strokeLinejoin: "round",
1364
1604
  children: [
1365
- /* @__PURE__ */ F("rect", {
1605
+ /* @__PURE__ */ q("rect", {
1366
1606
  x: "3",
1367
1607
  y: "3",
1368
1608
  width: "18",
@@ -1370,39 +1610,258 @@ var fe = ({ schema: e, dataSource: i, className: o }) => {
1370
1610
  rx: "2",
1371
1611
  ry: "2"
1372
1612
  }),
1373
- /* @__PURE__ */ F("line", {
1613
+ /* @__PURE__ */ q("line", {
1374
1614
  x1: "3",
1375
1615
  y1: "9",
1376
1616
  x2: "21",
1377
1617
  y2: "9"
1378
1618
  }),
1379
- /* @__PURE__ */ F("line", {
1619
+ /* @__PURE__ */ q("line", {
1380
1620
  x1: "9",
1381
1621
  y1: "21",
1382
1622
  x2: "9",
1383
1623
  y2: "9"
1384
1624
  })
1385
1625
  ]
1386
- }), /* @__PURE__ */ F("p", {
1626
+ }), /* @__PURE__ */ q("p", {
1387
1627
  className: "text-xs",
1388
1628
  children: "No data available"
1389
1629
  })]
1390
1630
  })
1391
- }) : /* @__PURE__ */ F(n, {
1631
+ }) : /* @__PURE__ */ q(o, {
1392
1632
  schema: {
1393
1633
  ...e,
1394
1634
  type: "data-table",
1395
- data: k,
1396
- columns: D
1635
+ data: S,
1636
+ columns: C
1397
1637
  },
1398
- className: o
1638
+ className: r
1639
+ });
1640
+ }, Ie = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l }) => {
1641
+ let u = {
1642
+ type: "object-data-table",
1643
+ objectName: i,
1644
+ filter: a,
1645
+ columns: s?.map((e) => ({
1646
+ accessorKey: e,
1647
+ header: e
1648
+ })),
1649
+ pagination: !0,
1650
+ searchable: !1,
1651
+ pageSize: c
1652
+ }, d = /* @__PURE__ */ q("div", {
1653
+ className: A("overflow-auto", l),
1654
+ "data-testid": "drill-down-body",
1655
+ children: /* @__PURE__ */ q(Fe, {
1656
+ schema: u,
1657
+ dataSource: o
1658
+ })
1659
+ });
1660
+ return r === "dialog" ? /* @__PURE__ */ q(x, {
1661
+ open: e,
1662
+ onOpenChange: (e) => !e && t(),
1663
+ children: /* @__PURE__ */ J(S, {
1664
+ className: "max-w-4xl",
1665
+ children: [/* @__PURE__ */ q(C, { children: /* @__PURE__ */ q(w, { children: n }) }), d]
1666
+ })
1667
+ }) : /* @__PURE__ */ q(T, {
1668
+ open: e,
1669
+ onOpenChange: (e) => !e && t(),
1670
+ children: /* @__PURE__ */ J(E, {
1671
+ side: "right",
1672
+ className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1673
+ children: [/* @__PURE__ */ q(D, { children: /* @__PURE__ */ q(O, { children: n }) }), /* @__PURE__ */ q("div", {
1674
+ className: "flex-1 overflow-hidden mt-2",
1675
+ children: d
1676
+ })]
1677
+ })
1678
+ });
1679
+ }, Le = ({ schema: e, dataSource: o, className: c }) => {
1680
+ let u = ee(s), d = o || u?.dataSource, f = l(e.bind), [p, m] = z([]), [h, g] = z(!1), [_, v] = z(null), [y, b] = z({}), [x, S] = z({}), [C, w] = z(null), { fieldLabel: T, fieldOptionLabel: E } = Z(), D = R(T), O = R(E);
1681
+ I(() => {
1682
+ D.current = T, O.current = E;
1683
+ }, [T, E]), I(() => {
1684
+ if (!d || !e.objectName) return;
1685
+ let t = d.getObjectSchema;
1686
+ if (typeof t != "function") return;
1687
+ let n = !0;
1688
+ return Promise.resolve(t.call(d, e.objectName)).then((t) => {
1689
+ if (!n || !t?.fields) return;
1690
+ let r = e.objectName, i = {}, a = {};
1691
+ for (let [e, n] of Object.entries(t.fields)) {
1692
+ let t = n?.label ? String(n.label) : e;
1693
+ a[e] = D.current(r, e, t);
1694
+ let o = n?.options;
1695
+ if (Array.isArray(o) && o.length > 0) {
1696
+ let t = {};
1697
+ for (let n of o) if (n && n.value !== void 0 && n.label !== void 0) {
1698
+ let i = String(n.value), a = String(n.label);
1699
+ t[i] = O.current(r, e, i, a);
1700
+ }
1701
+ Object.keys(t).length > 0 && (i[e] = t);
1702
+ }
1703
+ }
1704
+ b(i), S(a);
1705
+ }).catch(() => {}), () => {
1706
+ n = !1;
1707
+ };
1708
+ }, [d, e.objectName]), I(() => {
1709
+ let t = !0;
1710
+ return e.objectName && !f && (!e.data || e.data.length === 0) && (async () => {
1711
+ if (!(!d || !e.objectName)) {
1712
+ t && (g(!0), v(null));
1713
+ try {
1714
+ let r;
1715
+ if (typeof d.find == "function") r = n(await d.find(e.objectName, { $filter: i(e.filter) }));
1716
+ else return;
1717
+ t && m(r);
1718
+ } catch (e) {
1719
+ console.error("[ObjectPivotTable] Fetch error:", e), t && v(e instanceof Error ? e.message : "Failed to load data");
1720
+ } finally {
1721
+ t && g(!1);
1722
+ }
1723
+ }
1724
+ })(), () => {
1725
+ t = !1;
1726
+ };
1727
+ }, [
1728
+ e.objectName,
1729
+ d,
1730
+ f,
1731
+ e.data,
1732
+ e.filter
1733
+ ]);
1734
+ let j = f || e.data || p, M = Array.isArray(j) ? j : [];
1735
+ if (h && M.length === 0) return /* @__PURE__ */ J("div", {
1736
+ className: A("overflow-auto", c),
1737
+ "data-testid": "pivot-loading",
1738
+ children: [e.title && /* @__PURE__ */ q("h3", {
1739
+ className: "text-sm font-semibold mb-2",
1740
+ children: e.title
1741
+ }), /* @__PURE__ */ J("div", {
1742
+ className: "space-y-2 p-2",
1743
+ children: [/* @__PURE__ */ J("div", {
1744
+ className: "flex gap-2",
1745
+ children: [
1746
+ /* @__PURE__ */ q(k, { className: "h-6 w-24" }),
1747
+ /* @__PURE__ */ q(k, { className: "h-6 w-20" }),
1748
+ /* @__PURE__ */ q(k, { className: "h-6 w-20" }),
1749
+ /* @__PURE__ */ q(k, { className: "h-6 w-20" })
1750
+ ]
1751
+ }), [
1752
+ 1,
1753
+ 2,
1754
+ 3
1755
+ ].map((e) => /* @__PURE__ */ J("div", {
1756
+ className: "flex gap-2",
1757
+ children: [
1758
+ /* @__PURE__ */ q(k, { className: "h-5 w-24" }),
1759
+ /* @__PURE__ */ q(k, { className: "h-5 w-20" }),
1760
+ /* @__PURE__ */ q(k, { className: "h-5 w-20" }),
1761
+ /* @__PURE__ */ q(k, { className: "h-5 w-20" })
1762
+ ]
1763
+ }, e))]
1764
+ })]
1399
1765
  });
1400
- }, pe = {
1766
+ if (_) return /* @__PURE__ */ J("div", {
1767
+ className: A("overflow-auto", c),
1768
+ "data-testid": "pivot-error",
1769
+ children: [e.title && /* @__PURE__ */ q("h3", {
1770
+ className: "text-sm font-semibold mb-2",
1771
+ children: e.title
1772
+ }), /* @__PURE__ */ J("div", {
1773
+ className: "flex flex-col items-center justify-center py-8 text-destructive",
1774
+ "data-testid": "pivot-error-message",
1775
+ children: [/* @__PURE__ */ J("svg", {
1776
+ xmlns: "http://www.w3.org/2000/svg",
1777
+ className: "h-8 w-8 mb-2 opacity-60",
1778
+ viewBox: "0 0 24 24",
1779
+ fill: "none",
1780
+ stroke: "currentColor",
1781
+ strokeWidth: "1.5",
1782
+ strokeLinecap: "round",
1783
+ strokeLinejoin: "round",
1784
+ children: [
1785
+ /* @__PURE__ */ q("circle", {
1786
+ cx: "12",
1787
+ cy: "12",
1788
+ r: "10"
1789
+ }),
1790
+ /* @__PURE__ */ q("line", {
1791
+ x1: "12",
1792
+ y1: "8",
1793
+ x2: "12",
1794
+ y2: "12"
1795
+ }),
1796
+ /* @__PURE__ */ q("line", {
1797
+ x1: "12",
1798
+ y1: "16",
1799
+ x2: "12.01",
1800
+ y2: "16"
1801
+ })
1802
+ ]
1803
+ }), /* @__PURE__ */ q("p", {
1804
+ className: "text-xs",
1805
+ children: _
1806
+ })]
1807
+ })]
1808
+ });
1809
+ if (!d && e.objectName && M.length === 0) return /* @__PURE__ */ J("div", {
1810
+ className: A("overflow-auto", c),
1811
+ children: [e.title && /* @__PURE__ */ q("h3", {
1812
+ className: "text-sm font-semibold mb-2",
1813
+ children: e.title
1814
+ }), /* @__PURE__ */ q("div", {
1815
+ className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
1816
+ children: /* @__PURE__ */ J("p", {
1817
+ className: "text-xs",
1818
+ children: [
1819
+ "No data source available for “",
1820
+ e.objectName,
1821
+ "”"
1822
+ ]
1823
+ })
1824
+ })]
1825
+ });
1826
+ let N = {
1827
+ ...e,
1828
+ data: M
1829
+ }, P = e.rowField ? y[e.rowField] : void 0, F = e.columnField ? y[e.columnField] : void 0, L = e.rowField ? x[e.rowField] : void 0, B = e.drillDown;
1830
+ return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(Me, {
1831
+ schema: N,
1832
+ className: c,
1833
+ rowLabels: P,
1834
+ columnLabels: F,
1835
+ rowFieldLabel: L,
1836
+ onDrillDown: r(B) ? (e) => w(e) : void 0
1837
+ }), (() => {
1838
+ if (!C || !e.objectName) return null;
1839
+ let n = t(B, C, {
1840
+ rowField: e.rowField,
1841
+ columnField: e.columnField
1842
+ }), r = {
1843
+ ...e.filter || {},
1844
+ ...n
1845
+ };
1846
+ return /* @__PURE__ */ q(Ie, {
1847
+ open: !0,
1848
+ onClose: () => w(null),
1849
+ title: a(B, C, e.title || "Details"),
1850
+ target: B?.target ?? "drawer",
1851
+ objectName: e.objectName,
1852
+ filter: r,
1853
+ dataSource: d,
1854
+ columns: B?.columns,
1855
+ maxRows: B?.maxRows
1856
+ });
1857
+ })()] });
1858
+ }, Re = {
1401
1859
  breadcrumb: ["Dashboard", "Configuration"],
1402
1860
  sections: [
1403
1861
  {
1404
1862
  key: "layout",
1405
1863
  title: "Layout",
1864
+ collapsible: !0,
1406
1865
  fields: [
1407
1866
  {
1408
1867
  key: "columns",
@@ -1424,10 +1883,12 @@ var fe = ({ schema: e, dataSource: i, className: o }) => {
1424
1883
  },
1425
1884
  {
1426
1885
  key: "rowHeight",
1427
- label: "Row height",
1428
- type: "input",
1429
- defaultValue: "120",
1430
- placeholder: "e.g. 120"
1886
+ label: "Row height (px)",
1887
+ type: "slider",
1888
+ defaultValue: 120,
1889
+ min: 40,
1890
+ max: 320,
1891
+ step: 10
1431
1892
  }
1432
1893
  ]
1433
1894
  },
@@ -1437,25 +1898,37 @@ var fe = ({ schema: e, dataSource: i, className: o }) => {
1437
1898
  collapsible: !0,
1438
1899
  fields: [{
1439
1900
  key: "refreshInterval",
1440
- label: "Refresh interval",
1901
+ label: "Auto refresh",
1441
1902
  type: "select",
1442
1903
  defaultValue: "0",
1443
1904
  options: [
1444
1905
  {
1445
1906
  value: "0",
1446
- label: "Manual"
1907
+ label: "Off"
1447
1908
  },
1448
1909
  {
1449
1910
  value: "30",
1450
- label: "30s"
1911
+ label: "Every 30s"
1451
1912
  },
1452
1913
  {
1453
1914
  value: "60",
1454
- label: "1 min"
1915
+ label: "Every 1 min"
1455
1916
  },
1456
1917
  {
1457
1918
  value: "300",
1458
- label: "5 min"
1919
+ label: "Every 5 min"
1920
+ },
1921
+ {
1922
+ value: "900",
1923
+ label: "Every 15 min"
1924
+ },
1925
+ {
1926
+ value: "1800",
1927
+ label: "Every 30 min"
1928
+ },
1929
+ {
1930
+ value: "3600",
1931
+ label: "Every 1 hour"
1459
1932
  }
1460
1933
  ]
1461
1934
  }]
@@ -1502,12 +1975,12 @@ var fe = ({ schema: e, dataSource: i, className: o }) => {
1502
1975
  }
1503
1976
  ]
1504
1977
  };
1505
- function me({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
1506
- let { draft: a, isDirty: o, updateField: s, discard: c } = b(n, { onUpdate: i });
1507
- return /* @__PURE__ */ F(h, {
1978
+ function ze({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
1979
+ let { draft: a, isDirty: o, updateField: s, discard: c } = M(n, { onUpdate: i });
1980
+ return /* @__PURE__ */ q(y, {
1508
1981
  open: e,
1509
1982
  onClose: t,
1510
- schema: pe,
1983
+ schema: Re,
1511
1984
  draft: a,
1512
1985
  isDirty: o,
1513
1986
  onFieldChange: s,
@@ -1517,7 +1990,7 @@ function me({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
1517
1990
  }
1518
1991
  //#endregion
1519
1992
  //#region src/WidgetConfigPanel.tsx
1520
- var he = [
1993
+ var Be = [
1521
1994
  {
1522
1995
  value: "metric",
1523
1996
  label: "Metric"
@@ -1526,6 +1999,10 @@ var he = [
1526
1999
  value: "bar",
1527
2000
  label: "Bar Chart"
1528
2001
  },
2002
+ {
2003
+ value: "horizontal-bar",
2004
+ label: "Horizontal Bar"
2005
+ },
1529
2006
  {
1530
2007
  value: "line",
1531
2008
  label: "Line Chart"
@@ -1546,6 +2023,10 @@ var he = [
1546
2023
  value: "scatter",
1547
2024
  label: "Scatter Plot"
1548
2025
  },
2026
+ {
2027
+ value: "funnel",
2028
+ label: "Funnel"
2029
+ },
1549
2030
  {
1550
2031
  value: "table",
1551
2032
  label: "Table"
@@ -1562,7 +2043,7 @@ var he = [
1562
2043
  value: "custom",
1563
2044
  label: "Custom"
1564
2045
  }
1565
- ], ge = [
2046
+ ], Ve = [
1566
2047
  {
1567
2048
  value: "default",
1568
2049
  label: "Default"
@@ -1595,7 +2076,7 @@ var he = [
1595
2076
  value: "danger",
1596
2077
  label: "Danger"
1597
2078
  }
1598
- ], _e = [
2079
+ ], He = [
1599
2080
  {
1600
2081
  value: "count",
1601
2082
  label: "Count"
@@ -1616,40 +2097,80 @@ var he = [
1616
2097
  value: "max",
1617
2098
  label: "Max"
1618
2099
  }
1619
- ], ve = [
2100
+ ], Ue = [
1620
2101
  "bar",
2102
+ "horizontal-bar",
1621
2103
  "line",
1622
2104
  "area",
1623
2105
  "pie",
1624
2106
  "donut",
2107
+ "scatter",
2108
+ "funnel"
2109
+ ], We = [
2110
+ "bar",
2111
+ "horizontal-bar",
2112
+ "line",
2113
+ "area",
1625
2114
  "scatter"
2115
+ ], Ge = [
2116
+ "pie",
2117
+ "donut",
2118
+ "funnel"
2119
+ ], Ke = ["metric", ...Ue], qe = [...Ue], Je = [
2120
+ "pivot",
2121
+ "metric",
2122
+ "bar",
2123
+ "horizontal-bar",
2124
+ "line",
2125
+ "area",
2126
+ "pie",
2127
+ "donut",
2128
+ "funnel"
1626
2129
  ];
1627
- function ye(e) {
1628
- return !!e && ve.includes(e);
2130
+ function Ye(e) {
2131
+ return !!e && Ue.includes(e);
2132
+ }
2133
+ function Xe(e) {
2134
+ return !!e && We.includes(e);
2135
+ }
2136
+ function Ze(e) {
2137
+ return !!e && qe.includes(e);
2138
+ }
2139
+ function Qe(e) {
2140
+ return !!e && Ke.includes(e);
1629
2141
  }
1630
- var be = [{
2142
+ function $e(e) {
2143
+ return !!e && Je.includes(e);
2144
+ }
2145
+ var et = [{
2146
+ value: "drawer",
2147
+ label: "Side drawer"
2148
+ }, {
2149
+ value: "dialog",
2150
+ label: "Center dialog"
2151
+ }], tt = [{
1631
2152
  value: "group",
1632
2153
  label: "Group"
1633
2154
  }, {
1634
2155
  value: "value",
1635
2156
  label: "Value"
1636
- }], xe = [{
2157
+ }], nt = [{
1637
2158
  value: "asc",
1638
2159
  label: "↑"
1639
2160
  }, {
1640
2161
  value: "desc",
1641
2162
  label: "↓"
1642
2163
  }];
1643
- function $(e, t, n, r) {
2164
+ function rt(e, t, n, r) {
1644
2165
  return {
1645
2166
  key: e,
1646
2167
  label: t,
1647
2168
  type: "custom",
1648
- render: (i, a, o) => /* @__PURE__ */ F(g, {
2169
+ render: (i, a, o) => /* @__PURE__ */ q(b, {
1649
2170
  label: t,
1650
- children: /* @__PURE__ */ F("div", {
2171
+ children: /* @__PURE__ */ q("div", {
1651
2172
  "data-testid": `config-field-${e}`,
1652
- children: /* @__PURE__ */ F(m, {
2173
+ children: /* @__PURE__ */ q(v, {
1653
2174
  options: r ?? [],
1654
2175
  value: i ?? "",
1655
2176
  onValueChange: a,
@@ -1663,16 +2184,16 @@ function $(e, t, n, r) {
1663
2184
  })
1664
2185
  };
1665
2186
  }
1666
- function Se(e, t, n) {
2187
+ function it(e, t, n) {
1667
2188
  let r = e && e.length > 0, i = r ? {
1668
2189
  key: "object",
1669
2190
  label: "Data source",
1670
2191
  type: "custom",
1671
- render: (t, n) => /* @__PURE__ */ F(g, {
2192
+ render: (t, n) => /* @__PURE__ */ q(b, {
1672
2193
  label: "Data source",
1673
- children: /* @__PURE__ */ F("div", {
2194
+ children: /* @__PURE__ */ q("div", {
1674
2195
  "data-testid": "config-field-object",
1675
- children: /* @__PURE__ */ F(m, {
2196
+ children: /* @__PURE__ */ q(v, {
1676
2197
  options: e,
1677
2198
  value: t ?? "",
1678
2199
  onValueChange: n,
@@ -1688,28 +2209,40 @@ function Se(e, t, n) {
1688
2209
  label: "Data source",
1689
2210
  type: "input",
1690
2211
  placeholder: "Object name"
1691
- }, a = r ? $("categoryField", "Category field", "Select field…", t) : {
2212
+ }, a = r ? {
2213
+ ...rt("categoryField", "Category field", "Select field…", t),
2214
+ helpText: "Group records by this field (one bar/slice/segment per value).",
2215
+ visibleWhen: (e) => Ze(e.type)
2216
+ } : {
1692
2217
  key: "categoryField",
1693
2218
  label: "Category field",
1694
2219
  type: "input",
1695
- placeholder: "e.g. status"
1696
- }, o = r ? $("valueField", "Value field", "Select field…", t) : {
2220
+ placeholder: "e.g. status",
2221
+ helpText: "Group records by this field (one bar/slice/segment per value).",
2222
+ visibleWhen: (e) => Ze(e.type)
2223
+ }, o = r ? {
2224
+ ...rt("valueField", "Value field", "Select field…", t),
2225
+ helpText: "Field to aggregate (sum / average / min / max).",
2226
+ visibleWhen: (e) => Qe(e.type) && (e.aggregate ?? "count") !== "count"
2227
+ } : {
1697
2228
  key: "valueField",
1698
2229
  label: "Value field",
1699
2230
  type: "input",
1700
- placeholder: "e.g. amount"
1701
- }, s = r ? $("rowField", "Field", "Select row field…", t) : {
2231
+ placeholder: "e.g. amount",
2232
+ helpText: "Field to aggregate (sum / average / min / max).",
2233
+ visibleWhen: (e) => Qe(e.type) && (e.aggregate ?? "count") !== "count"
2234
+ }, s = r ? rt("rowField", "Field", "Select row field…", t) : {
1702
2235
  key: "rowField",
1703
2236
  label: "Field",
1704
2237
  type: "input",
1705
2238
  placeholder: "e.g. owner"
1706
- }, c = r ? $("columnField", "Field", "Select column field…", t) : {
2239
+ }, c = r ? rt("columnField", "Field", "Select column field…", t) : {
1707
2240
  key: "columnField",
1708
2241
  label: "Field",
1709
2242
  type: "input",
1710
2243
  placeholder: "e.g. stage"
1711
- }, l = r ? $("pivotValueField", "Field", "Select value field…", t) : {
1712
- key: "pivotValueField",
2244
+ }, l = r ? rt("valueField", "Field", "Select value field…", t) : {
2245
+ key: "valueField",
1713
2246
  label: "Field",
1714
2247
  type: "input",
1715
2248
  placeholder: "e.g. amount"
@@ -1718,7 +2251,7 @@ function Se(e, t, n) {
1718
2251
  breadcrumb: ["Dashboard", {
1719
2252
  pivot: "Pivot table",
1720
2253
  table: "Table"
1721
- }[n ?? ""] ?? (ye(n) ? "Chart" : "Widget")],
2254
+ }[n ?? ""] ?? (Ye(n) ? "Chart" : "Widget")],
1722
2255
  sections: [
1723
2256
  {
1724
2257
  key: "general",
@@ -1740,7 +2273,7 @@ function Se(e, t, n) {
1740
2273
  key: "type",
1741
2274
  label: "Widget type",
1742
2275
  type: "select",
1743
- options: he,
2276
+ options: Be,
1744
2277
  defaultValue: "metric"
1745
2278
  }
1746
2279
  ]
@@ -1758,8 +2291,10 @@ function Se(e, t, n) {
1758
2291
  key: "aggregate",
1759
2292
  label: "Aggregation",
1760
2293
  type: "select",
1761
- options: _e,
1762
- defaultValue: "count"
2294
+ options: He,
2295
+ defaultValue: "count",
2296
+ helpText: "Count ignores Value field; Sum / Avg / Min / Max require it.",
2297
+ visibleWhen: (e) => Qe(e.type)
1763
2298
  }
1764
2299
  ]
1765
2300
  },
@@ -1781,14 +2316,14 @@ function Se(e, t, n) {
1781
2316
  key: "rowSortBy",
1782
2317
  label: "Sort by",
1783
2318
  type: "icon-group",
1784
- options: be,
2319
+ options: tt,
1785
2320
  defaultValue: "group"
1786
2321
  },
1787
2322
  {
1788
2323
  key: "rowSortOrder",
1789
2324
  label: "Sort order",
1790
2325
  type: "icon-group",
1791
- options: xe,
2326
+ options: nt,
1792
2327
  defaultValue: "asc"
1793
2328
  },
1794
2329
  {
@@ -1816,14 +2351,14 @@ function Se(e, t, n) {
1816
2351
  key: "columnSortBy",
1817
2352
  label: "Sort by",
1818
2353
  type: "icon-group",
1819
- options: be,
2354
+ options: tt,
1820
2355
  defaultValue: "group"
1821
2356
  },
1822
2357
  {
1823
2358
  key: "columnSortOrder",
1824
2359
  label: "Sort order",
1825
2360
  type: "icon-group",
1826
- options: xe,
2361
+ options: nt,
1827
2362
  defaultValue: "asc"
1828
2363
  },
1829
2364
  {
@@ -1851,7 +2386,7 @@ function Se(e, t, n) {
1851
2386
  key: "aggregation",
1852
2387
  label: "Aggregation",
1853
2388
  type: "select",
1854
- options: _e,
2389
+ options: He,
1855
2390
  defaultValue: "sum"
1856
2391
  },
1857
2392
  {
@@ -1866,7 +2401,7 @@ function Se(e, t, n) {
1866
2401
  key: "chart-axis",
1867
2402
  title: "Axis & Series",
1868
2403
  collapsible: !0,
1869
- visibleWhen: (e) => ye(e.type),
2404
+ visibleWhen: (e) => Xe(e.type),
1870
2405
  fields: [
1871
2406
  {
1872
2407
  key: "xAxisLabel",
@@ -1889,8 +2424,20 @@ function Se(e, t, n) {
1889
2424
  ]
1890
2425
  },
1891
2426
  {
1892
- key: "table-columns",
1893
- title: "Columns",
2427
+ key: "chart-legend",
2428
+ title: "Display",
2429
+ collapsible: !0,
2430
+ visibleWhen: (e) => !!e.type && Ge.includes(e.type),
2431
+ fields: [{
2432
+ key: "showLegend",
2433
+ label: "Show legend",
2434
+ type: "switch",
2435
+ defaultValue: !0
2436
+ }]
2437
+ },
2438
+ {
2439
+ key: "table-options",
2440
+ title: "Table options",
1894
2441
  collapsible: !0,
1895
2442
  visibleWhen: (e) => e.type === "table",
1896
2443
  fields: [{
@@ -1927,6 +2474,39 @@ function Se(e, t, n) {
1927
2474
  defaultValue: 1
1928
2475
  }]
1929
2476
  },
2477
+ {
2478
+ key: "drill-down",
2479
+ title: "Drill-down",
2480
+ collapsible: !0,
2481
+ defaultCollapsed: !0,
2482
+ visibleWhen: (e) => $e(e.type),
2483
+ fields: [{
2484
+ key: "drillDownEnabled",
2485
+ label: "Enable drill-down",
2486
+ type: "switch",
2487
+ defaultValue: !1,
2488
+ helpText: "When enabled, clicking a cell / segment opens a filtered list of underlying records."
2489
+ }, {
2490
+ key: "drillDownTarget",
2491
+ label: "Open in",
2492
+ type: "select",
2493
+ options: et,
2494
+ defaultValue: "drawer",
2495
+ visibleWhen: (e) => !!e.drillDownEnabled
2496
+ }]
2497
+ },
2498
+ {
2499
+ key: "behavior",
2500
+ title: "Behavior",
2501
+ collapsible: !0,
2502
+ defaultCollapsed: !0,
2503
+ fields: [{
2504
+ key: "actionUrl",
2505
+ label: "Click-through URL",
2506
+ type: "input",
2507
+ placeholder: "https://..."
2508
+ }]
2509
+ },
1930
2510
  {
1931
2511
  key: "appearance",
1932
2512
  title: "Appearance",
@@ -1936,19 +2516,14 @@ function Se(e, t, n) {
1936
2516
  key: "colorVariant",
1937
2517
  label: "Color variant",
1938
2518
  type: "select",
1939
- options: ge,
2519
+ options: Ve,
1940
2520
  defaultValue: "default"
1941
- }, {
1942
- key: "actionUrl",
1943
- label: "Action URL",
1944
- type: "input",
1945
- placeholder: "https://..."
1946
2521
  }]
1947
2522
  }
1948
2523
  ]
1949
2524
  };
1950
2525
  }
1951
- function Ce(e) {
2526
+ function at(e) {
1952
2527
  if (e == null) return "";
1953
2528
  if (typeof e == "string") return e;
1954
2529
  if (typeof e == "object") {
@@ -1957,16 +2532,20 @@ function Ce(e) {
1957
2532
  }
1958
2533
  return String(e);
1959
2534
  }
1960
- function we({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
1961
- let { draft: c, isDirty: l, updateField: u, discard: d } = b(x.useMemo(() => ({
2535
+ function ot(e) {
2536
+ let t = e.type, n = { ...e };
2537
+ return Ze(t) || delete n.categoryField, Qe(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), Xe(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), $e(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
2538
+ }
2539
+ function st({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
2540
+ let { draft: c, isDirty: l, updateField: u, discard: d } = M(N.useMemo(() => ({
1962
2541
  ...n,
1963
- title: typeof n.title == "object" ? Ce(n.title) : n.title,
1964
- description: typeof n.description == "object" ? Ce(n.description) : n.description
2542
+ title: typeof n.title == "object" ? at(n.title) : n.title,
2543
+ description: typeof n.description == "object" ? at(n.description) : n.description
1965
2544
  }), [n]), { onUpdate: i });
1966
- return /* @__PURE__ */ F(h, {
2545
+ return /* @__PURE__ */ q(y, {
1967
2546
  open: e,
1968
2547
  onClose: t,
1969
- schema: x.useMemo(() => Se(o, s, c.type), [
2548
+ schema: N.useMemo(() => it(o, s, c.type), [
1970
2549
  o,
1971
2550
  s,
1972
2551
  c.type
@@ -1974,104 +2553,141 @@ function we({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
1974
2553
  draft: c,
1975
2554
  isDirty: l,
1976
2555
  onFieldChange: u,
1977
- onSave: () => r(c),
2556
+ onSave: () => r(ot(c)),
1978
2557
  onDiscard: d,
1979
2558
  headerExtra: a
1980
2559
  });
1981
2560
  }
1982
2561
  //#endregion
1983
2562
  //#region src/DashboardWithConfig.tsx
1984
- function Te({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
1985
- let [c, u] = O(o), [d, f] = O(null), [p, m] = O(e), [h, g] = O(0);
1986
- T(() => {
2563
+ function ct({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
2564
+ let [c, l] = z(o), [u, d] = z(null), [f, m] = z(e), [h, g] = z(0);
2565
+ I(() => {
1987
2566
  m(e), g((e) => e + 1);
1988
2567
  }, [e]);
1989
- let _ = x.useMemo(() => {
1990
- if (!d || !p.widgets) return null;
1991
- let e = p.widgets.find((e) => (e.id || e.title) === d);
1992
- return e ? {
2568
+ let _ = N.useMemo(() => {
2569
+ if (!u || !f.widgets) return null;
2570
+ let e = f.widgets.find((e) => (e.id || e.title) === u);
2571
+ if (!e) return null;
2572
+ let t = e.options || {};
2573
+ return {
2574
+ ...t,
1993
2575
  id: e.id ?? "",
1994
2576
  title: e.title ?? "",
1995
2577
  description: e.description ?? "",
1996
2578
  type: e.type ?? "",
1997
2579
  object: e.object ?? "",
1998
- categoryField: e.categoryField ?? "",
1999
- valueField: e.valueField ?? "",
2000
- aggregate: e.aggregate ?? "",
2001
- colorVariant: e.colorVariant ?? "default",
2002
- actionUrl: e.actionUrl ?? "",
2580
+ categoryField: e.categoryField ?? t.categoryField ?? "",
2581
+ valueField: e.valueField ?? t.valueField ?? "",
2582
+ aggregate: e.aggregate ?? t.aggregate ?? "",
2583
+ colorVariant: e.colorVariant ?? t.colorVariant ?? "default",
2584
+ actionUrl: e.actionUrl ?? t.actionUrl ?? "",
2585
+ drillDownEnabled: t.drillDown?.enabled ?? !!(e.object && (e.type === "pivot" || e.type === "metric" || e.type === "bar" || e.type === "horizontal-bar" || e.type === "line" || e.type === "area" || e.type === "pie" || e.type === "donut" || e.type === "funnel")),
2586
+ drillDownTarget: t.drillDown?.target ?? "drawer",
2003
2587
  layoutW: e.layout?.w ?? 1,
2004
2588
  layoutH: e.layout?.h ?? 1
2005
- } : null;
2006
- }, [d, h]), y = C((e) => {
2007
- f(e), u(!0);
2008
- }, []), b = C(() => {
2009
- f(null);
2010
- }, []), S = C((e, t) => {
2011
- d && m((n) => n.widgets ? {
2589
+ };
2590
+ }, [u, h]), v = F((e) => {
2591
+ d(e), l(!0);
2592
+ }, []), y = F(() => {
2593
+ d(null);
2594
+ }, []), b = F((e, t) => {
2595
+ u && m((n) => n.widgets ? {
2012
2596
  ...n,
2013
- widgets: n.widgets.map((n) => (n.id || n.title) === d ? e === "layoutW" ? {
2014
- ...n,
2015
- layout: {
2016
- ...n.layout || {},
2017
- w: t
2018
- }
2019
- } : e === "layoutH" ? {
2020
- ...n,
2021
- layout: {
2022
- ...n.layout || {},
2023
- h: t
2597
+ widgets: n.widgets.map((n) => {
2598
+ if ((n.id || n.title) !== u) return n;
2599
+ if (e === "layoutW") return {
2600
+ ...n,
2601
+ layout: {
2602
+ ...n.layout || {},
2603
+ w: t
2604
+ }
2605
+ };
2606
+ if (e === "layoutH") return {
2607
+ ...n,
2608
+ layout: {
2609
+ ...n.layout || {},
2610
+ h: t
2611
+ }
2612
+ };
2613
+ if (e === "drillDownEnabled" || e === "drillDownTarget") {
2614
+ let r = n.options?.drillDown ?? {}, i = e === "drillDownEnabled" ? {
2615
+ ...r,
2616
+ enabled: !!t
2617
+ } : {
2618
+ ...r,
2619
+ target: t
2620
+ };
2621
+ return {
2622
+ ...n,
2623
+ options: {
2624
+ ...n.options || {},
2625
+ drillDown: i
2626
+ }
2627
+ };
2024
2628
  }
2025
- } : {
2026
- ...n,
2027
- [e]: t
2028
- } : n)
2629
+ return {
2630
+ ...n,
2631
+ [e]: t
2632
+ };
2633
+ })
2029
2634
  } : n);
2030
- }, [d]), w = C((e) => {
2031
- d && r && r(d, e), f(null), g((e) => e + 1);
2032
- }, [d, r]), E = C(() => {
2033
- u((e) => !e), f(null);
2635
+ }, [u]), x = F((e) => {
2636
+ if (u && r) {
2637
+ let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
2638
+ (t || n) && (a.options = {
2639
+ ...i.options || {},
2640
+ drillDown: {
2641
+ ...i.options?.drillDown || {},
2642
+ ...t === void 0 ? {} : { enabled: !!t },
2643
+ ...n === void 0 ? {} : { target: n }
2644
+ }
2645
+ }), r(u, a);
2646
+ }
2647
+ d(null), g((e) => e + 1);
2648
+ }, [u, r]), S = F(() => {
2649
+ l((e) => !e), d(null);
2034
2650
  }, []);
2035
- return /* @__PURE__ */ I("div", {
2036
- className: v("flex h-full w-full", s),
2651
+ return /* @__PURE__ */ J("div", {
2652
+ className: A("flex h-full w-full", s),
2037
2653
  "data-testid": "dashboard-with-config",
2038
- children: [/* @__PURE__ */ I("div", {
2654
+ children: [/* @__PURE__ */ J("div", {
2039
2655
  className: "flex-1 min-w-0 overflow-auto relative",
2040
- children: [/* @__PURE__ */ F("div", {
2656
+ children: [/* @__PURE__ */ q("div", {
2041
2657
  className: "absolute top-2 right-2 z-10",
2042
- children: /* @__PURE__ */ I(l, {
2658
+ children: /* @__PURE__ */ J(p, {
2043
2659
  size: "sm",
2044
2660
  variant: c ? "default" : "outline",
2045
- onClick: E,
2661
+ onClick: S,
2046
2662
  "data-testid": "dashboard-config-toggle",
2047
- children: [/* @__PURE__ */ F(ie, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
2663
+ children: [/* @__PURE__ */ q(ae, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
2048
2664
  })
2049
- }), /* @__PURE__ */ F(H, {
2050
- schema: p,
2665
+ }), /* @__PURE__ */ q(ge, {
2666
+ schema: f,
2051
2667
  onRefresh: i,
2052
2668
  recordCount: a,
2053
2669
  designMode: c,
2054
- selectedWidgetId: d,
2055
- onWidgetClick: y
2670
+ selectedWidgetId: u,
2671
+ onWidgetClick: v
2056
2672
  })]
2057
- }), c && /* @__PURE__ */ F("div", {
2673
+ }), c && /* @__PURE__ */ q("div", {
2058
2674
  className: "relative shrink-0",
2059
- children: d && _ ? /* @__PURE__ */ F(we, {
2675
+ children: u && _ ? /* @__PURE__ */ q(st, {
2060
2676
  open: !0,
2061
- onClose: b,
2677
+ onClose: y,
2062
2678
  config: _,
2063
- onSave: w,
2064
- onFieldChange: S
2065
- }) : /* @__PURE__ */ F(me, {
2679
+ onSave: x,
2680
+ onFieldChange: b
2681
+ }) : /* @__PURE__ */ q(ze, {
2066
2682
  open: !0,
2067
- onClose: () => u(!1),
2683
+ onClose: () => l(!1),
2068
2684
  config: t,
2069
2685
  onSave: n
2070
2686
  })
2071
2687
  })]
2072
2688
  });
2073
2689
  }
2074
- e.register("dashboard", H, {
2690
+ e.register("dashboard", ge, {
2075
2691
  namespace: "view",
2076
2692
  label: "Dashboard",
2077
2693
  category: "Complex",
@@ -2099,7 +2715,7 @@ e.register("dashboard", H, {
2099
2715
  columns: 3,
2100
2716
  widgets: []
2101
2717
  }
2102
- }), e.register("metric", K, {
2718
+ }), e.register("metric", Ce, {
2103
2719
  namespace: "plugin-dashboard",
2104
2720
  label: "Metric Widget",
2105
2721
  category: "Dashboard",
@@ -2112,7 +2728,7 @@ e.register("dashboard", H, {
2112
2728
  type: "string",
2113
2729
  label: "Value"
2114
2730
  }]
2115
- }), e.register("metric-card", J, {
2731
+ }), e.register("metric-card", Te, {
2116
2732
  namespace: "plugin-dashboard",
2117
2733
  label: "Metric Card",
2118
2734
  category: "Dashboard",
@@ -2167,7 +2783,7 @@ e.register("dashboard", H, {
2167
2783
  title: "Metric",
2168
2784
  value: "0"
2169
2785
  }
2170
- }), e.register("object-metric", Y, {
2786
+ }), e.register("object-metric", Ee, {
2171
2787
  namespace: "plugin-dashboard",
2172
2788
  label: "Object Metric",
2173
2789
  category: "Dashboard",
@@ -2196,7 +2812,7 @@ e.register("dashboard", H, {
2196
2812
  }
2197
2813
  ],
2198
2814
  defaultProps: { label: "Metric" }
2199
- }), e.register("pivot", Z, {
2815
+ }), e.register("pivot", Me, {
2200
2816
  namespace: "plugin-dashboard",
2201
2817
  label: "Pivot Table",
2202
2818
  category: "Dashboard",
@@ -2275,7 +2891,7 @@ e.register("dashboard", H, {
2275
2891
  aggregation: "sum",
2276
2892
  data: []
2277
2893
  }
2278
- }), e.register("object-pivot", Q, {
2894
+ }), e.register("object-pivot", Le, {
2279
2895
  namespace: "plugin-dashboard",
2280
2896
  label: "Object Pivot Table",
2281
2897
  category: "Dashboard",
@@ -2364,7 +2980,7 @@ e.register("dashboard", H, {
2364
2980
  valueField: "",
2365
2981
  aggregation: "sum"
2366
2982
  }
2367
- }), e.register("dashboard-grid", W, {
2983
+ }), e.register("dashboard-grid", ye, {
2368
2984
  namespace: "plugin-dashboard",
2369
2985
  label: "Dashboard Grid (Editable)",
2370
2986
  category: "Complex",
@@ -2392,7 +3008,7 @@ e.register("dashboard", H, {
2392
3008
  widgets: [],
2393
3009
  persistLayoutKey: "dashboard-layout"
2394
3010
  }
2395
- }), e.register("object-data-table", fe, {
3011
+ }), e.register("object-data-table", Fe, {
2396
3012
  namespace: "plugin-dashboard",
2397
3013
  label: "Object Data Table",
2398
3014
  category: "Dashboard",
@@ -2430,18 +3046,18 @@ e.register("dashboard", H, {
2430
3046
  pagination: !1
2431
3047
  }
2432
3048
  });
2433
- var Ee = {
2434
- DashboardRenderer: H,
2435
- DashboardGridLayout: W,
2436
- MetricWidget: K,
2437
- MetricCard: J,
2438
- ObjectMetricWidget: Y,
2439
- PivotTable: Z,
2440
- ObjectPivotTable: Q,
2441
- ObjectDataTable: fe,
2442
- DashboardConfigPanel: me,
2443
- WidgetConfigPanel: we,
2444
- DashboardWithConfig: Te
3049
+ var lt = {
3050
+ DashboardRenderer: ge,
3051
+ DashboardGridLayout: ye,
3052
+ MetricWidget: Ce,
3053
+ MetricCard: Te,
3054
+ ObjectMetricWidget: Ee,
3055
+ PivotTable: Me,
3056
+ ObjectPivotTable: Le,
3057
+ ObjectDataTable: Fe,
3058
+ DashboardConfigPanel: ze,
3059
+ WidgetConfigPanel: st,
3060
+ DashboardWithConfig: ct
2445
3061
  };
2446
3062
  //#endregion
2447
- export { me as DashboardConfigPanel, W as DashboardGridLayout, H as DashboardRenderer, Te as DashboardWithConfig, J as MetricCard, K as MetricWidget, fe as ObjectDataTable, Y as ObjectMetricWidget, Q as ObjectPivotTable, Z as PivotTable, we as WidgetConfigPanel, Ee as dashboardComponents };
3063
+ export { ze as DashboardConfigPanel, ye as DashboardGridLayout, ge as DashboardRenderer, ct as DashboardWithConfig, Ie as DrillDownDrawer, Te as MetricCard, Ce as MetricWidget, Fe as ObjectDataTable, Ee as ObjectMetricWidget, Le as ObjectPivotTable, Me as PivotTable, st as WidgetConfigPanel, lt as dashboardComponents };