@object-ui/plugin-dashboard 4.0.11 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/dist/index.js +187 -156
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/DrillDownDrawer.d.ts +8 -0
- package/dist/packages/plugin-dashboard/src/DrillDownDrawer.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts +7 -0
- package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/ObjectPivotTable.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import { ComponentRegistry as e, computeDrillFilter as t, extractRecords as n, i
|
|
|
2
2
|
import { SchemaRenderer as o, SchemaRendererContext as s, useActionEngine as c, useDataScope as l, useDnd as u, useHasDndProvider as d, useObjectLabel as f } from "@object-ui/react";
|
|
3
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
4
|
import * as N from "react";
|
|
5
|
-
import { Fragment as ee, forwardRef as
|
|
6
|
-
import { AlertCircle as
|
|
7
|
-
import { DndContext as
|
|
5
|
+
import { Fragment as ee, forwardRef as te, useCallback as P, useContext as ne, useEffect as F, useMemo as I, useRef as re, useState as L } from "react";
|
|
6
|
+
import { AlertCircle as R, ArrowDownIcon as z, ArrowUpIcon as ie, Edit as B, GripVertical as V, Loader2 as ae, MinusIcon as H, RefreshCw as oe, Save as se, Settings as U, X as W } from "lucide-react";
|
|
7
|
+
import { DndContext as ce, PointerSensor as G, closestCenter as K, useSensor as le, useSensors as ue } from "@dnd-kit/core";
|
|
8
8
|
import { SortableContext as de, arrayMove as fe, rectSortingStrategy as pe, useSortable as me, verticalListSortingStrategy as he } from "@dnd-kit/sortable";
|
|
9
9
|
import { CSS as q } from "@dnd-kit/utilities";
|
|
10
10
|
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
@@ -65,7 +65,7 @@ var Oe = [
|
|
|
65
65
|
function Ae(e) {
|
|
66
66
|
return ke.has(e) ? { enabled: !0 } : void 0;
|
|
67
67
|
}
|
|
68
|
-
var $ =
|
|
68
|
+
var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: s, selectedWidgetId: l, onWidgetClick: u, onWidgetsReorder: d, modalHandler: v, scriptHandlers: y, hideHeaderText: b, ...x }, S) => {
|
|
69
69
|
let C = (() => {
|
|
70
70
|
if (e.columns != null) return e.columns;
|
|
71
71
|
let t = e.widgets ?? [], n = 0;
|
|
@@ -74,44 +74,44 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
74
74
|
t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
|
|
75
75
|
}
|
|
76
76
|
return n > 4 ? 12 : 4;
|
|
77
|
-
})(), w = C, T = e.gap || 4, [E, D] =
|
|
77
|
+
})(), w = C, T = e.gap || 4, [E, D] = L(!1), [O, k] = L(!1), j = re(null), { executeAction: M, engine: N } = c({ actions: I(() => (e.header?.actions ?? []).map((e) => ({
|
|
78
78
|
name: e.actionUrl || e.label,
|
|
79
79
|
type: e.actionType || "url",
|
|
80
80
|
target: e.actionUrl,
|
|
81
81
|
label: e.label
|
|
82
|
-
})), [e.header?.actions]) }), { dashboardLabel:
|
|
82
|
+
})), [e.header?.actions]) }), { dashboardLabel: te, dashboardDescription: ne, dashboardActionLabel: R, widgetTitle: z, widgetDescription: ie, fieldLabel: B } = f(), V = e.name, ae = P((e) => V ? R(V, e.actionUrl || e.label, e.label) : e.label, [V, R]), H = P((e) => {
|
|
83
83
|
let t = Q(e.title);
|
|
84
|
-
return !
|
|
85
|
-
}, [
|
|
84
|
+
return !V || !e.id || t === void 0 ? t : z(V, e.id, t);
|
|
85
|
+
}, [V, z]), se = P((e) => {
|
|
86
86
|
let t = Q(e.description);
|
|
87
|
-
return !
|
|
88
|
-
}, [
|
|
89
|
-
|
|
87
|
+
return !V || !e.id ? t : ie(V, e.id, t);
|
|
88
|
+
}, [V, ie]);
|
|
89
|
+
F(() => {
|
|
90
90
|
let e = N.getRunner();
|
|
91
91
|
if (v && e.setModalHandler(v), y) for (let [t, n] of Object.entries(y)) e.registerScript(t, n);
|
|
92
92
|
}, [
|
|
93
93
|
N,
|
|
94
94
|
v,
|
|
95
95
|
y
|
|
96
|
-
]),
|
|
96
|
+
]), F(() => {
|
|
97
97
|
let e = () => k(window.innerWidth < 768);
|
|
98
98
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
99
99
|
}, []);
|
|
100
|
-
let
|
|
100
|
+
let U = P(() => {
|
|
101
101
|
r && (D(!0), r(), setTimeout(() => D(!1), 600));
|
|
102
102
|
}, [r]);
|
|
103
|
-
|
|
104
|
-
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return j.current = setInterval(
|
|
103
|
+
F(() => {
|
|
104
|
+
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return j.current = setInterval(U, e.refreshInterval * 1e3), () => {
|
|
105
105
|
j.current && clearInterval(j.current);
|
|
106
106
|
};
|
|
107
107
|
}, [
|
|
108
108
|
e.refreshInterval,
|
|
109
109
|
r,
|
|
110
|
-
|
|
110
|
+
U
|
|
111
111
|
]);
|
|
112
|
-
let
|
|
112
|
+
let W = P((e, t) => {
|
|
113
113
|
!s || !u || !t || (e.stopPropagation(), u(t));
|
|
114
|
-
}, [s, u]), me =
|
|
114
|
+
}, [s, u]), me = P((t, n, r) => {
|
|
115
115
|
if (!s || !u) return;
|
|
116
116
|
let i = e.widgets || [];
|
|
117
117
|
if (t.key === "Enter" || t.key === " ") t.preventDefault(), u(n ?? null);
|
|
@@ -128,9 +128,9 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
128
128
|
s,
|
|
129
129
|
u,
|
|
130
130
|
e.widgets
|
|
131
|
-
]), q =
|
|
131
|
+
]), q = P((e) => {
|
|
132
132
|
!s || !u || e.target === e.currentTarget && u(null);
|
|
133
|
-
}, [s, u]), J = !!(s && d), ge = ue(le(
|
|
133
|
+
}, [s, u]), J = !!(s && d), ge = ue(le(G, { activationConstraint: { distance: 5 } })), _e = P((t) => {
|
|
134
134
|
if (!J) return;
|
|
135
135
|
let { active: n, over: r } = t;
|
|
136
136
|
if (!r || n.id === r.id) return;
|
|
@@ -162,7 +162,7 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
162
162
|
objectName: e.object || (Z(t) ? t.object : void 0),
|
|
163
163
|
aggregate: r,
|
|
164
164
|
filter: (Z(t) ? t.filter : void 0) || e.filter,
|
|
165
|
-
label: n.label ||
|
|
165
|
+
label: n.label || H(e) || "",
|
|
166
166
|
fallbackValue: n.value,
|
|
167
167
|
trend: n.trend,
|
|
168
168
|
icon: n.icon,
|
|
@@ -173,7 +173,7 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
173
173
|
prefix: n.prefix,
|
|
174
174
|
suffix: n.suffix,
|
|
175
175
|
drillDown: n.drillDown ?? { enabled: !0 },
|
|
176
|
-
title: n.label ||
|
|
176
|
+
title: n.label || H(e) || ""
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
if ((t === "gauge" || t === "solid-gauge") && e.object) {
|
|
@@ -187,10 +187,16 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
187
187
|
objectName: e.object,
|
|
188
188
|
aggregate: t,
|
|
189
189
|
filter: e.filter,
|
|
190
|
-
label: n.label ||
|
|
190
|
+
label: n.label || H(e) || "",
|
|
191
191
|
fallbackValue: n.fallbackValue ?? n.value,
|
|
192
192
|
icon: n.icon,
|
|
193
|
-
description: n.description
|
|
193
|
+
description: n.description,
|
|
194
|
+
colorVariant: e.colorVariant,
|
|
195
|
+
format: n.format,
|
|
196
|
+
currency: n.currency,
|
|
197
|
+
prefix: n.prefix,
|
|
198
|
+
suffix: n.suffix,
|
|
199
|
+
invert: n.invert
|
|
194
200
|
};
|
|
195
201
|
}
|
|
196
202
|
let r = {}[t] || t;
|
|
@@ -210,7 +216,7 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
210
216
|
xAxisKey: i,
|
|
211
217
|
series: [{
|
|
212
218
|
dataKey: c,
|
|
213
|
-
label: l ?
|
|
219
|
+
label: l ? B(l, c, c) : c
|
|
214
220
|
}],
|
|
215
221
|
colors: Oe,
|
|
216
222
|
drillDown: n.drillDown ?? Ae(r),
|
|
@@ -231,7 +237,7 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
231
237
|
xAxisKey: i,
|
|
232
238
|
series: [{
|
|
233
239
|
dataKey: a,
|
|
234
|
-
label:
|
|
240
|
+
label: B(e.object, a, a)
|
|
235
241
|
}],
|
|
236
242
|
colors: Oe,
|
|
237
243
|
drillDown: n.drillDown ?? Ae(r),
|
|
@@ -245,7 +251,7 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
245
251
|
xAxisKey: i,
|
|
246
252
|
series: [{
|
|
247
253
|
dataKey: a,
|
|
248
|
-
label: e.object ?
|
|
254
|
+
label: e.object ? B(e.object, a, a) : a
|
|
249
255
|
}],
|
|
250
256
|
colors: Oe,
|
|
251
257
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
@@ -362,14 +368,14 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
362
368
|
...e,
|
|
363
369
|
...n
|
|
364
370
|
};
|
|
365
|
-
})(), c = e.type === "metric", u =
|
|
371
|
+
})(), c = e.type === "metric", u = H(e), d = se(e), f = e.id || u || `widget-${t}`, p = s && l === e.id, v = s ? {
|
|
366
372
|
"data-testid": `dashboard-preview-widget-${e.id}`,
|
|
367
373
|
"data-widget-id": e.id,
|
|
368
374
|
role: "button",
|
|
369
375
|
tabIndex: 0,
|
|
370
376
|
"aria-selected": p,
|
|
371
377
|
"aria-label": `Widget: ${u || `Widget ${t + 1}`}`,
|
|
372
|
-
onClick: (t) =>
|
|
378
|
+
onClick: (t) => W(t, e.id),
|
|
373
379
|
onKeyDown: (n) => me(n, e.id, t)
|
|
374
380
|
} : {}, 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, b = !O && i && !J ? {
|
|
375
381
|
gridColumn: `span ${i.w}`,
|
|
@@ -433,15 +439,15 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
433
439
|
children: [
|
|
434
440
|
!b && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Y("h2", {
|
|
435
441
|
className: "text-lg font-semibold tracking-tight",
|
|
436
|
-
children:
|
|
437
|
-
name:
|
|
442
|
+
children: V ? te({
|
|
443
|
+
name: V,
|
|
438
444
|
label: Q(e.title)
|
|
439
445
|
}) : Q(e.title)
|
|
440
446
|
}),
|
|
441
447
|
!b && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Y("p", {
|
|
442
448
|
className: "text-sm text-muted-foreground mt-1",
|
|
443
|
-
children:
|
|
444
|
-
name:
|
|
449
|
+
children: V ? ne({
|
|
450
|
+
name: V,
|
|
445
451
|
description: Q(e.description)
|
|
446
452
|
}) : Q(e.description)
|
|
447
453
|
}),
|
|
@@ -469,7 +475,7 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
469
475
|
}
|
|
470
476
|
console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
|
|
471
477
|
},
|
|
472
|
-
children: [n && /* @__PURE__ */ Y(n, { className: "w-4 h-4 mr-1.5" }),
|
|
478
|
+
children: [n && /* @__PURE__ */ Y(n, { className: "w-4 h-4 mr-1.5" }), ae(e)]
|
|
473
479
|
}, t);
|
|
474
480
|
})
|
|
475
481
|
})
|
|
@@ -482,12 +488,12 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
482
488
|
children: [be, /* @__PURE__ */ X(p, {
|
|
483
489
|
variant: "outline",
|
|
484
490
|
size: "sm",
|
|
485
|
-
onClick:
|
|
491
|
+
onClick: U,
|
|
486
492
|
disabled: E,
|
|
487
493
|
"aria-label": "Refresh dashboard",
|
|
488
|
-
children: [/* @__PURE__ */ Y(
|
|
494
|
+
children: [/* @__PURE__ */ Y(oe, { className: A("h-4 w-4 mr-2", E && "animate-spin") }), E ? "Refreshing…" : "Refresh All"]
|
|
489
495
|
})]
|
|
490
|
-
}), Ce =
|
|
496
|
+
}), Ce = I(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), we = I(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), Te = I(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
|
|
491
497
|
if (O) {
|
|
492
498
|
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ X("div", {
|
|
493
499
|
ref: S,
|
|
@@ -520,7 +526,7 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
520
526
|
})
|
|
521
527
|
]
|
|
522
528
|
});
|
|
523
|
-
return J ? /* @__PURE__ */ Y(
|
|
529
|
+
return J ? /* @__PURE__ */ Y(ce, {
|
|
524
530
|
sensors: ge,
|
|
525
531
|
collisionDetection: K,
|
|
526
532
|
onDragEnd: _e,
|
|
@@ -548,7 +554,7 @@ var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
548
554
|
})
|
|
549
555
|
]
|
|
550
556
|
});
|
|
551
|
-
return J ? /* @__PURE__ */ Y(
|
|
557
|
+
return J ? /* @__PURE__ */ Y(ce, {
|
|
552
558
|
sensors: ge,
|
|
553
559
|
collisionDetection: K,
|
|
554
560
|
onDragEnd: _e,
|
|
@@ -760,13 +766,13 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
760
766
|
onClick: E,
|
|
761
767
|
size: "sm",
|
|
762
768
|
variant: "default",
|
|
763
|
-
children: [/* @__PURE__ */ Y(
|
|
769
|
+
children: [/* @__PURE__ */ Y(se, { className: "h-4 w-4 mr-2" }), "Save Layout"]
|
|
764
770
|
}),
|
|
765
771
|
/* @__PURE__ */ X(p, {
|
|
766
772
|
onClick: D,
|
|
767
773
|
size: "sm",
|
|
768
774
|
variant: "outline",
|
|
769
|
-
children: [/* @__PURE__ */ Y(
|
|
775
|
+
children: [/* @__PURE__ */ Y(W, { className: "h-4 w-4 mr-2" }), "Reset"]
|
|
770
776
|
}),
|
|
771
777
|
/* @__PURE__ */ Y(p, {
|
|
772
778
|
onClick: () => u(!1),
|
|
@@ -780,12 +786,12 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
780
786
|
variant: "outline",
|
|
781
787
|
disabled: f,
|
|
782
788
|
"aria-label": "Refresh dashboard",
|
|
783
|
-
children: [/* @__PURE__ */ Y(
|
|
789
|
+
children: [/* @__PURE__ */ Y(oe, { className: A("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
|
|
784
790
|
}), /* @__PURE__ */ X(p, {
|
|
785
791
|
onClick: () => u(!0),
|
|
786
792
|
size: "sm",
|
|
787
793
|
variant: "outline",
|
|
788
|
-
children: [/* @__PURE__ */ Y(
|
|
794
|
+
children: [/* @__PURE__ */ Y(B, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
|
|
789
795
|
})] })
|
|
790
796
|
})]
|
|
791
797
|
}),
|
|
@@ -822,7 +828,7 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
822
828
|
className: "h-full w-full relative",
|
|
823
829
|
children: [l && /* @__PURE__ */ Y("div", {
|
|
824
830
|
className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
|
|
825
|
-
children: /* @__PURE__ */ Y(
|
|
831
|
+
children: /* @__PURE__ */ Y(V, { className: "h-4 w-4" })
|
|
826
832
|
}), /* @__PURE__ */ Y(o, {
|
|
827
833
|
schema: r,
|
|
828
834
|
className: "h-full w-full"
|
|
@@ -837,7 +843,7 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
837
843
|
children: e.title
|
|
838
844
|
}), l && /* @__PURE__ */ Y("div", {
|
|
839
845
|
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
840
|
-
children: /* @__PURE__ */ Y(
|
|
846
|
+
children: /* @__PURE__ */ Y(V, { className: "h-4 w-4" })
|
|
841
847
|
})]
|
|
842
848
|
}), /* @__PURE__ */ Y(h, {
|
|
843
849
|
className: "p-0 h-full",
|
|
@@ -920,7 +926,7 @@ var Be = {
|
|
|
920
926
|
warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
921
927
|
danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
|
|
922
928
|
}, Ve = ({ 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 }) => {
|
|
923
|
-
let y = Be[c] || Be.default, { t: b } = Ie(), x =
|
|
929
|
+
let y = Be[c] || Be.default, { t: b } = Ie(), x = I(() => {
|
|
924
930
|
let e = ze(a) || ze(n?.label);
|
|
925
931
|
if (!e) return e;
|
|
926
932
|
let t = Le(e);
|
|
@@ -929,7 +935,7 @@ var Be = {
|
|
|
929
935
|
a,
|
|
930
936
|
n?.label,
|
|
931
937
|
b
|
|
932
|
-
]), S =
|
|
938
|
+
]), S = I(() => {
|
|
933
939
|
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Re(t, l, u) : t ?? "", n = String(e);
|
|
934
940
|
return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
|
|
935
941
|
}, [
|
|
@@ -938,7 +944,7 @@ var Be = {
|
|
|
938
944
|
u,
|
|
939
945
|
d,
|
|
940
946
|
f
|
|
941
|
-
]), C =
|
|
947
|
+
]), C = I(() => {
|
|
942
948
|
if (typeof r == "string") {
|
|
943
949
|
let e = j(r);
|
|
944
950
|
return e ? /* @__PURE__ */ Y(e, { className: "h-4 w-4" }) : null;
|
|
@@ -966,7 +972,7 @@ var Be = {
|
|
|
966
972
|
}), /* @__PURE__ */ Y(h, { children: o ? /* @__PURE__ */ X("div", {
|
|
967
973
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
968
974
|
"data-testid": "metric-loading",
|
|
969
|
-
children: [/* @__PURE__ */ Y(
|
|
975
|
+
children: [/* @__PURE__ */ Y(ae, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Y("span", {
|
|
970
976
|
className: "text-sm",
|
|
971
977
|
children: "Loading…"
|
|
972
978
|
})]
|
|
@@ -974,7 +980,7 @@ var Be = {
|
|
|
974
980
|
className: "flex items-center gap-2",
|
|
975
981
|
"data-testid": "metric-error",
|
|
976
982
|
role: "alert",
|
|
977
|
-
children: [/* @__PURE__ */ Y(
|
|
983
|
+
children: [/* @__PURE__ */ Y(R, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Y("span", {
|
|
978
984
|
className: "text-xs text-destructive truncate",
|
|
979
985
|
children: s
|
|
980
986
|
})]
|
|
@@ -986,9 +992,9 @@ var Be = {
|
|
|
986
992
|
children: [n && /* @__PURE__ */ X("span", {
|
|
987
993
|
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"),
|
|
988
994
|
children: [
|
|
989
|
-
n.direction === "up" && /* @__PURE__ */ Y(
|
|
990
|
-
n.direction === "down" && /* @__PURE__ */ Y(
|
|
991
|
-
n.direction === "neutral" && /* @__PURE__ */ Y(
|
|
995
|
+
n.direction === "up" && /* @__PURE__ */ Y(ie, { className: "h-3 w-3 mr-1" }),
|
|
996
|
+
n.direction === "down" && /* @__PURE__ */ Y(z, { className: "h-3 w-3 mr-1" }),
|
|
997
|
+
n.direction === "neutral" && /* @__PURE__ */ Y(H, { className: "h-3 w-3 mr-1" }),
|
|
992
998
|
n.value,
|
|
993
999
|
"%"
|
|
994
1000
|
]
|
|
@@ -1018,7 +1024,7 @@ var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1018
1024
|
}), /* @__PURE__ */ Y(h, { children: s ? /* @__PURE__ */ X("div", {
|
|
1019
1025
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
1020
1026
|
"data-testid": "metric-card-loading",
|
|
1021
|
-
children: [/* @__PURE__ */ Y(
|
|
1027
|
+
children: [/* @__PURE__ */ Y(ae, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Y("span", {
|
|
1022
1028
|
className: "text-sm",
|
|
1023
1029
|
children: "Loading…"
|
|
1024
1030
|
})]
|
|
@@ -1026,7 +1032,7 @@ var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1026
1032
|
className: "flex items-center gap-2",
|
|
1027
1033
|
"data-testid": "metric-card-error",
|
|
1028
1034
|
role: "alert",
|
|
1029
|
-
children: [/* @__PURE__ */ Y(
|
|
1035
|
+
children: [/* @__PURE__ */ Y(R, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Y("span", {
|
|
1030
1036
|
className: "text-xs text-destructive truncate",
|
|
1031
1037
|
children: c
|
|
1032
1038
|
})]
|
|
@@ -1038,43 +1044,43 @@ var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1038
1044
|
children: [r && i && /* @__PURE__ */ X("span", {
|
|
1039
1045
|
className: A("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
|
|
1040
1046
|
children: [
|
|
1041
|
-
r === "up" && /* @__PURE__ */ Y(
|
|
1042
|
-
r === "down" && /* @__PURE__ */ Y(
|
|
1043
|
-
r === "neutral" && /* @__PURE__ */ Y(
|
|
1047
|
+
r === "up" && /* @__PURE__ */ Y(ie, { className: "h-3 w-3 mr-1" }),
|
|
1048
|
+
r === "down" && /* @__PURE__ */ Y(z, { className: "h-3 w-3 mr-1" }),
|
|
1049
|
+
r === "neutral" && /* @__PURE__ */ Y(H, { className: "h-3 w-3 mr-1" }),
|
|
1044
1050
|
i
|
|
1045
1051
|
]
|
|
1046
1052
|
}), He(a)]
|
|
1047
1053
|
})] }) })]
|
|
1048
1054
|
});
|
|
1049
|
-
}, We = ({ 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,
|
|
1050
|
-
let
|
|
1051
|
-
|
|
1055
|
+
}, We = ({ objectName: e, aggregate: t, filter: n, label: c, fallbackValue: l, trend: u, icon: d, className: f, description: p, dataSource: m, colorVariant: h, format: g, currency: _, prefix: v, suffix: y, invert: b, drillDown: k, title: A }) => {
|
|
1056
|
+
let j = ne(s), M = m || j?.dataSource, [N, ee] = L(!1), [te, re] = L(null), [R, z] = L(!1), [ie, B] = L(null), [V, ae] = L(null);
|
|
1057
|
+
F(() => {
|
|
1052
1058
|
let t = !0;
|
|
1053
|
-
if (!(!
|
|
1054
|
-
t &&
|
|
1059
|
+
if (!(!M || !e || typeof M.getObjectSchema != "function")) return M.getObjectSchema(e).then((e) => {
|
|
1060
|
+
t && ae(e);
|
|
1055
1061
|
}).catch(() => {}), () => {
|
|
1056
1062
|
t = !1;
|
|
1057
1063
|
};
|
|
1058
|
-
}, [
|
|
1059
|
-
let
|
|
1064
|
+
}, [M, e]);
|
|
1065
|
+
let H = I(() => {
|
|
1060
1066
|
let e = t?.field;
|
|
1061
1067
|
if (!e || !V?.fields) return null;
|
|
1062
1068
|
let n = V.fields;
|
|
1063
1069
|
return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
|
|
1064
|
-
}, [V, t?.field]),
|
|
1070
|
+
}, [V, t?.field]), oe = I(() => {
|
|
1065
1071
|
if (g) return g;
|
|
1066
|
-
if (
|
|
1067
|
-
if (
|
|
1068
|
-
let e =
|
|
1072
|
+
if (H) {
|
|
1073
|
+
if (H.type === "currency") {
|
|
1074
|
+
let e = H.precision ?? H.scale ?? 0;
|
|
1069
1075
|
return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
|
|
1070
1076
|
}
|
|
1071
|
-
if (
|
|
1072
|
-
if (
|
|
1077
|
+
if (H.type === "percent") return "0,0%";
|
|
1078
|
+
if (H.type === "number" || H.type === "integer") return "0,0";
|
|
1073
1079
|
}
|
|
1074
|
-
}, [g,
|
|
1080
|
+
}, [g, H]), se = I(() => {
|
|
1075
1081
|
if (_) return _;
|
|
1076
|
-
if (
|
|
1077
|
-
}, [_,
|
|
1082
|
+
if (H?.type === "currency") return H.defaultCurrency || H.currency || void 0;
|
|
1083
|
+
}, [_, H]), U = I(() => t ? JSON.stringify(t) : "", [t]), W = I(() => i(n), [n]), ce = P(async (n, r) => {
|
|
1078
1084
|
if (!(!n || !e)) {
|
|
1079
1085
|
r.current && (z(!0), B(null));
|
|
1080
1086
|
try {
|
|
@@ -1084,14 +1090,14 @@ var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1084
1090
|
field: t.field,
|
|
1085
1091
|
function: t.function,
|
|
1086
1092
|
groupBy: t.groupBy || "_all",
|
|
1087
|
-
filter:
|
|
1093
|
+
filter: W
|
|
1088
1094
|
}), a = Array.isArray(r) ? r : [];
|
|
1089
1095
|
i = a.length === 0 ? 0 : t.function === "count" ? a.reduce((e, n) => e + (Number(n[t.field]) || Number(n.count) || 0), 0) : a[0][t.field] ?? 0;
|
|
1090
1096
|
} else if (typeof n.find == "function") {
|
|
1091
|
-
let t = await n.find(e, { $filter:
|
|
1097
|
+
let t = await n.find(e, { $filter: W });
|
|
1092
1098
|
i = (Array.isArray(t) ? t : t?.data || t?.records || []).length;
|
|
1093
1099
|
} else return;
|
|
1094
|
-
r.current &&
|
|
1100
|
+
r.current && re(i);
|
|
1095
1101
|
} catch (e) {
|
|
1096
1102
|
console.error("[ObjectMetricWidget] Fetch error:", e), r.current && B(e instanceof Error ? e.message : "Failed to load metric");
|
|
1097
1103
|
} finally {
|
|
@@ -1100,80 +1106,93 @@ var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1100
1106
|
}
|
|
1101
1107
|
}, [
|
|
1102
1108
|
e,
|
|
1103
|
-
|
|
1104
|
-
|
|
1109
|
+
U,
|
|
1110
|
+
I(() => W ? JSON.stringify(W) : "", [W])
|
|
1105
1111
|
]);
|
|
1106
|
-
|
|
1112
|
+
F(() => {
|
|
1107
1113
|
let t = { current: !0 };
|
|
1108
|
-
return
|
|
1114
|
+
return M && e ? ce(M, t) : (re(null), B(null)), () => {
|
|
1109
1115
|
t.current = !1;
|
|
1110
1116
|
};
|
|
1111
1117
|
}, [
|
|
1112
|
-
|
|
1118
|
+
M,
|
|
1113
1119
|
e,
|
|
1114
|
-
|
|
1120
|
+
ce
|
|
1115
1121
|
]);
|
|
1116
|
-
let
|
|
1122
|
+
let G = te === null ? M ? "—" : l ?? "—" : te;
|
|
1123
|
+
b && typeof G == "number" && isFinite(G) && G >= 0 && G <= 1 && (G = 1 - G);
|
|
1124
|
+
let K = r(k) && !!e && !!M, le = I(() => {
|
|
1117
1125
|
let e = typeof c == "string" ? c : c?.defaultValue || "";
|
|
1118
|
-
return a(
|
|
1126
|
+
return a(k, {}, (typeof A == "string" ? A : A?.defaultValue || "") || e || "Details");
|
|
1119
1127
|
}, [
|
|
1120
|
-
|
|
1128
|
+
k,
|
|
1121
1129
|
c,
|
|
1122
|
-
|
|
1123
|
-
]),
|
|
1124
|
-
if (!
|
|
1125
|
-
let t =
|
|
1130
|
+
A
|
|
1131
|
+
]), ue = I(() => {
|
|
1132
|
+
if (!K) return null;
|
|
1133
|
+
let t = k?.target ?? "drawer", n = k?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i;
|
|
1134
|
+
if (r) {
|
|
1135
|
+
let e = n.filter, t = e ? W ? { $and: [e, W] } : e : W;
|
|
1136
|
+
i = /* @__PURE__ */ Y("div", {
|
|
1137
|
+
className: "h-full overflow-auto",
|
|
1138
|
+
children: /* @__PURE__ */ Y(o, { schema: {
|
|
1139
|
+
type: "spec-report",
|
|
1140
|
+
...n,
|
|
1141
|
+
filter: t
|
|
1142
|
+
} })
|
|
1143
|
+
});
|
|
1144
|
+
} else i = /* @__PURE__ */ Y("div", {
|
|
1126
1145
|
className: "h-full overflow-auto",
|
|
1127
1146
|
children: /* @__PURE__ */ Y(o, { schema: {
|
|
1128
1147
|
type: "object-data-table",
|
|
1129
1148
|
objectName: e,
|
|
1130
|
-
filter:
|
|
1149
|
+
filter: W,
|
|
1131
1150
|
pageSize: 25,
|
|
1132
1151
|
drillDown: { enabled: !1 }
|
|
1133
1152
|
} })
|
|
1134
1153
|
});
|
|
1135
1154
|
return t === "modal" ? /* @__PURE__ */ Y(x, {
|
|
1136
1155
|
open: !0,
|
|
1137
|
-
onOpenChange: (e) => !e &&
|
|
1156
|
+
onOpenChange: (e) => !e && ee(!1),
|
|
1138
1157
|
children: /* @__PURE__ */ X(S, {
|
|
1139
|
-
className: "max-w-
|
|
1140
|
-
children: [/* @__PURE__ */ Y(C, { children: /* @__PURE__ */ Y(w, { children:
|
|
1158
|
+
className: "max-w-5xl",
|
|
1159
|
+
children: [/* @__PURE__ */ Y(C, { children: /* @__PURE__ */ Y(w, { children: le }) }), i]
|
|
1141
1160
|
})
|
|
1142
1161
|
}) : /* @__PURE__ */ Y(T, {
|
|
1143
1162
|
open: !0,
|
|
1144
|
-
onOpenChange: (e) => !e &&
|
|
1163
|
+
onOpenChange: (e) => !e && ee(!1),
|
|
1145
1164
|
children: /* @__PURE__ */ X(E, {
|
|
1146
1165
|
side: "right",
|
|
1147
|
-
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-
|
|
1148
|
-
children: [/* @__PURE__ */ Y(D, { children: /* @__PURE__ */ Y(O, { children:
|
|
1166
|
+
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
|
|
1167
|
+
children: [/* @__PURE__ */ Y(D, { children: /* @__PURE__ */ Y(O, { children: le }) }), /* @__PURE__ */ Y("div", {
|
|
1149
1168
|
className: "flex-1 overflow-hidden mt-2",
|
|
1150
|
-
children:
|
|
1169
|
+
children: i
|
|
1151
1170
|
})]
|
|
1152
1171
|
})
|
|
1153
1172
|
});
|
|
1154
1173
|
}, [
|
|
1155
|
-
|
|
1156
|
-
|
|
1174
|
+
K,
|
|
1175
|
+
k,
|
|
1157
1176
|
e,
|
|
1158
|
-
|
|
1159
|
-
|
|
1177
|
+
W,
|
|
1178
|
+
le
|
|
1160
1179
|
]);
|
|
1161
1180
|
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(Ve, {
|
|
1162
1181
|
label: c,
|
|
1163
|
-
value:
|
|
1182
|
+
value: G,
|
|
1164
1183
|
trend: u,
|
|
1165
1184
|
icon: d,
|
|
1166
1185
|
className: f,
|
|
1167
1186
|
description: p,
|
|
1168
|
-
loading:
|
|
1169
|
-
error:
|
|
1187
|
+
loading: R,
|
|
1188
|
+
error: ie,
|
|
1170
1189
|
colorVariant: h,
|
|
1171
|
-
format:
|
|
1172
|
-
currency:
|
|
1190
|
+
format: oe,
|
|
1191
|
+
currency: se,
|
|
1173
1192
|
prefix: v,
|
|
1174
1193
|
suffix: y,
|
|
1175
|
-
onClick:
|
|
1176
|
-
}),
|
|
1194
|
+
onClick: K ? () => ee(!0) : void 0
|
|
1195
|
+
}), N && ue] });
|
|
1177
1196
|
};
|
|
1178
1197
|
//#endregion
|
|
1179
1198
|
//#region src/PivotTable.tsx
|
|
@@ -1234,7 +1253,7 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1234
1253
|
});
|
|
1235
1254
|
}, S = (e) => (t) => {
|
|
1236
1255
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
|
|
1237
|
-
}, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: j } =
|
|
1256
|
+
}, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: j } = I(() => {
|
|
1238
1257
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
|
|
1239
1258
|
for (let r of w) {
|
|
1240
1259
|
let i = String(r[c] ?? ""), a = String(r[l] ?? ""), o = Number(r[u]) || 0;
|
|
@@ -1484,15 +1503,15 @@ function $e(e, t) {
|
|
|
1484
1503
|
return Array.from(a);
|
|
1485
1504
|
}
|
|
1486
1505
|
var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
1487
|
-
let a =
|
|
1506
|
+
let a = ne(s), c = t || a?.dataSource, u = l(e.bind), { fieldLabel: d, fieldOptionLabel: f } = be(), p = "No data available", m = "No data source available for";
|
|
1488
1507
|
try {
|
|
1489
1508
|
let { t: e } = ye(), t = e("dashboard.noDataAvailable");
|
|
1490
1509
|
t && t !== "dashboard.noDataAvailable" && (p = t);
|
|
1491
1510
|
let n = e("dashboard.noDataSourceFor");
|
|
1492
1511
|
n && n !== "dashboard.noDataSourceFor" && (m = n);
|
|
1493
1512
|
} catch {}
|
|
1494
|
-
let [h, g] =
|
|
1495
|
-
|
|
1513
|
+
let [h, g] = L([]), [_, v] = L(null), [y, b] = L(!1), [x, S] = L(null);
|
|
1514
|
+
F(() => {
|
|
1496
1515
|
let t = !0;
|
|
1497
1516
|
return e.objectName && !u && (!e.data || e.data.length === 0) && (async () => {
|
|
1498
1517
|
if (!(!c || !e.objectName)) {
|
|
@@ -1520,7 +1539,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1520
1539
|
e.data,
|
|
1521
1540
|
e.filter,
|
|
1522
1541
|
_
|
|
1523
|
-
]),
|
|
1542
|
+
]), F(() => {
|
|
1524
1543
|
let t = !0;
|
|
1525
1544
|
if (!(!c || !e.objectName || typeof c.getObjectSchema != "function")) return c.getObjectSchema(e.objectName).then((e) => {
|
|
1526
1545
|
t && v(e);
|
|
@@ -1528,7 +1547,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1528
1547
|
t = !1;
|
|
1529
1548
|
};
|
|
1530
1549
|
}, [e.objectName, c]);
|
|
1531
|
-
let C = u || e.data || h, w = Array.isArray(C) ? C : [], T =
|
|
1550
|
+
let C = u || e.data || h, w = Array.isArray(C) ? C : [], T = I(() => {
|
|
1532
1551
|
let t = e.objectName, n = {};
|
|
1533
1552
|
if (_?.fields) {
|
|
1534
1553
|
let e = _.fields;
|
|
@@ -1769,32 +1788,43 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1769
1788
|
},
|
|
1770
1789
|
className: r
|
|
1771
1790
|
});
|
|
1772
|
-
}, tt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource:
|
|
1773
|
-
let
|
|
1774
|
-
|
|
1775
|
-
objectName: i,
|
|
1776
|
-
filter: a,
|
|
1777
|
-
columns: s?.map((e) => ({
|
|
1778
|
-
accessorKey: e,
|
|
1779
|
-
header: e
|
|
1780
|
-
})),
|
|
1781
|
-
pagination: !0,
|
|
1782
|
-
searchable: !1,
|
|
1783
|
-
pageSize: c
|
|
1784
|
-
}, d = /* @__PURE__ */ Y("div", {
|
|
1785
|
-
className: A("overflow-auto", l),
|
|
1791
|
+
}, tt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: s, columns: c, maxRows: l, className: u, report: d }) => {
|
|
1792
|
+
let f = d && typeof d == "object" && (Array.isArray(d.columns) || "objectName" in d), p = /* @__PURE__ */ Y("div", {
|
|
1793
|
+
className: A("overflow-auto", u),
|
|
1786
1794
|
"data-testid": "drill-down-body",
|
|
1787
|
-
children:
|
|
1788
|
-
|
|
1789
|
-
|
|
1795
|
+
children: f ? (() => {
|
|
1796
|
+
let e = d.filter, t = e ? a ? { $and: [e, a] } : e : a;
|
|
1797
|
+
return /* @__PURE__ */ Y(o, { schema: {
|
|
1798
|
+
...d,
|
|
1799
|
+
type: "spec-report",
|
|
1800
|
+
report: {
|
|
1801
|
+
...d,
|
|
1802
|
+
filter: t
|
|
1803
|
+
},
|
|
1804
|
+
filter: t
|
|
1805
|
+
} });
|
|
1806
|
+
})() : /* @__PURE__ */ Y(et, {
|
|
1807
|
+
schema: {
|
|
1808
|
+
type: "object-data-table",
|
|
1809
|
+
objectName: i,
|
|
1810
|
+
filter: a,
|
|
1811
|
+
columns: c?.map((e) => ({
|
|
1812
|
+
accessorKey: e,
|
|
1813
|
+
header: e
|
|
1814
|
+
})),
|
|
1815
|
+
pagination: !0,
|
|
1816
|
+
searchable: !1,
|
|
1817
|
+
pageSize: l
|
|
1818
|
+
},
|
|
1819
|
+
dataSource: s
|
|
1790
1820
|
})
|
|
1791
1821
|
});
|
|
1792
1822
|
return r === "dialog" ? /* @__PURE__ */ Y(x, {
|
|
1793
1823
|
open: e,
|
|
1794
1824
|
onOpenChange: (e) => !e && t(),
|
|
1795
1825
|
children: /* @__PURE__ */ X(S, {
|
|
1796
|
-
className: "max-w-
|
|
1797
|
-
children: [/* @__PURE__ */ Y(C, { children: /* @__PURE__ */ Y(w, { children: n }) }),
|
|
1826
|
+
className: "max-w-5xl",
|
|
1827
|
+
children: [/* @__PURE__ */ Y(C, { children: /* @__PURE__ */ Y(w, { children: n }) }), p]
|
|
1798
1828
|
})
|
|
1799
1829
|
}) : /* @__PURE__ */ Y(T, {
|
|
1800
1830
|
open: e,
|
|
@@ -1804,15 +1834,15 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1804
1834
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1805
1835
|
children: [/* @__PURE__ */ Y(D, { children: /* @__PURE__ */ Y(O, { children: n }) }), /* @__PURE__ */ Y("div", {
|
|
1806
1836
|
className: "flex-1 overflow-hidden mt-2",
|
|
1807
|
-
children:
|
|
1837
|
+
children: p
|
|
1808
1838
|
})]
|
|
1809
1839
|
})
|
|
1810
1840
|
});
|
|
1811
1841
|
}, nt = ({ schema: e, dataSource: o, className: c }) => {
|
|
1812
|
-
let u =
|
|
1813
|
-
|
|
1842
|
+
let u = ne(s), d = o || u?.dataSource, f = l(e.bind), [p, m] = L([]), [h, g] = L(!1), [_, v] = L(null), [y, b] = L({}), [x, S] = L({}), [C, w] = L(null), { fieldLabel: T, fieldOptionLabel: E } = be(), D = re(T), O = re(E);
|
|
1843
|
+
F(() => {
|
|
1814
1844
|
D.current = T, O.current = E;
|
|
1815
|
-
}, [T, E]),
|
|
1845
|
+
}, [T, E]), F(() => {
|
|
1816
1846
|
if (!d || !e.objectName) return;
|
|
1817
1847
|
let t = d.getObjectSchema;
|
|
1818
1848
|
if (typeof t != "function") return;
|
|
@@ -1837,7 +1867,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1837
1867
|
}).catch(() => {}), () => {
|
|
1838
1868
|
n = !1;
|
|
1839
1869
|
};
|
|
1840
|
-
}, [d, e.objectName]),
|
|
1870
|
+
}, [d, e.objectName]), F(() => {
|
|
1841
1871
|
let t = !0;
|
|
1842
1872
|
return e.objectName && !f && (!e.data || e.data.length === 0) && (async () => {
|
|
1843
1873
|
if (!(!d || !e.objectName)) {
|
|
@@ -1958,17 +1988,17 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1958
1988
|
let N = {
|
|
1959
1989
|
...e,
|
|
1960
1990
|
data: M
|
|
1961
|
-
}, ee = e.rowField ? y[e.rowField] : void 0,
|
|
1991
|
+
}, ee = e.rowField ? y[e.rowField] : void 0, te = e.columnField ? y[e.columnField] : void 0, P = e.rowField ? x[e.rowField] : void 0, I = e.drillDown;
|
|
1962
1992
|
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(Ze, {
|
|
1963
1993
|
schema: N,
|
|
1964
1994
|
className: c,
|
|
1965
1995
|
rowLabels: ee,
|
|
1966
|
-
columnLabels:
|
|
1967
|
-
rowFieldLabel:
|
|
1968
|
-
onDrillDown: r(
|
|
1996
|
+
columnLabels: te,
|
|
1997
|
+
rowFieldLabel: P,
|
|
1998
|
+
onDrillDown: r(I) ? (e) => w(e) : void 0
|
|
1969
1999
|
}), (() => {
|
|
1970
2000
|
if (!C || !e.objectName) return null;
|
|
1971
|
-
let n = t(
|
|
2001
|
+
let n = t(I, C, {
|
|
1972
2002
|
rowField: e.rowField,
|
|
1973
2003
|
columnField: e.columnField
|
|
1974
2004
|
}), r = {
|
|
@@ -1978,13 +2008,14 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1978
2008
|
return /* @__PURE__ */ Y(tt, {
|
|
1979
2009
|
open: !0,
|
|
1980
2010
|
onClose: () => w(null),
|
|
1981
|
-
title: a(
|
|
1982
|
-
target:
|
|
2011
|
+
title: a(I, C, e.title || "Details"),
|
|
2012
|
+
target: I?.target ?? "drawer",
|
|
1983
2013
|
objectName: e.objectName,
|
|
1984
2014
|
filter: r,
|
|
1985
2015
|
dataSource: d,
|
|
1986
|
-
columns:
|
|
1987
|
-
maxRows:
|
|
2016
|
+
columns: I?.columns,
|
|
2017
|
+
maxRows: I?.maxRows,
|
|
2018
|
+
report: I?.report
|
|
1988
2019
|
});
|
|
1989
2020
|
})()] });
|
|
1990
2021
|
}, rt = {
|
|
@@ -2691,8 +2722,8 @@ function Et({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
|
|
|
2691
2722
|
//#endregion
|
|
2692
2723
|
//#region src/DashboardWithConfig.tsx
|
|
2693
2724
|
function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
|
|
2694
|
-
let [c, l] =
|
|
2695
|
-
|
|
2725
|
+
let [c, l] = L(o), [u, d] = L(null), [f, m] = L(e), [h, g] = L(0);
|
|
2726
|
+
F(() => {
|
|
2696
2727
|
m(e), g((e) => e + 1);
|
|
2697
2728
|
}, [e]);
|
|
2698
2729
|
let _ = N.useMemo(() => {
|
|
@@ -2717,11 +2748,11 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2717
2748
|
layoutW: e.layout?.w ?? 1,
|
|
2718
2749
|
layoutH: e.layout?.h ?? 1
|
|
2719
2750
|
};
|
|
2720
|
-
}, [u, h]), v =
|
|
2751
|
+
}, [u, h]), v = P((e) => {
|
|
2721
2752
|
d(e), l(!0);
|
|
2722
|
-
}, []), y =
|
|
2753
|
+
}, []), y = P(() => {
|
|
2723
2754
|
d(null);
|
|
2724
|
-
}, []), b =
|
|
2755
|
+
}, []), b = P((e, t) => {
|
|
2725
2756
|
u && m((n) => n.widgets ? {
|
|
2726
2757
|
...n,
|
|
2727
2758
|
widgets: n.widgets.map((n) => {
|
|
@@ -2762,7 +2793,7 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2762
2793
|
};
|
|
2763
2794
|
})
|
|
2764
2795
|
} : n);
|
|
2765
|
-
}, [u]), x =
|
|
2796
|
+
}, [u]), x = P((e) => {
|
|
2766
2797
|
if (u && r) {
|
|
2767
2798
|
let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
|
|
2768
2799
|
(t || n) && (a.options = {
|
|
@@ -2775,7 +2806,7 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2775
2806
|
}), r(u, a);
|
|
2776
2807
|
}
|
|
2777
2808
|
d(null), g((e) => e + 1);
|
|
2778
|
-
}, [u, r]), S =
|
|
2809
|
+
}, [u, r]), S = P(() => {
|
|
2779
2810
|
l((e) => !e), d(null);
|
|
2780
2811
|
}, []);
|
|
2781
2812
|
return /* @__PURE__ */ X("div", {
|
|
@@ -2790,7 +2821,7 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2790
2821
|
variant: c ? "default" : "outline",
|
|
2791
2822
|
onClick: S,
|
|
2792
2823
|
"data-testid": "dashboard-config-toggle",
|
|
2793
|
-
children: [/* @__PURE__ */ Y(
|
|
2824
|
+
children: [/* @__PURE__ */ Y(U, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
|
|
2794
2825
|
})
|
|
2795
2826
|
}), /* @__PURE__ */ Y($, {
|
|
2796
2827
|
schema: f,
|