@object-ui/plugin-dashboard 4.7.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/index.js +573 -563
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-dashboard/src/ObjectDataTable.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { ComponentRegistry as e, computeDrillFilter as t, extractRecords as n, isDrillEnabled as r, resolveDateMacros as i, resolveDrillTitle as a } from "@object-ui/core";
|
|
2
2
|
import { SchemaRenderer as o, SchemaRendererContext as s, useActionEngine as c, useDataScope as l, useDnd as u, useHasDndProvider as d, useObjectLabel as f } from "@object-ui/react";
|
|
3
|
-
import { Button as p, Card as m, CardContent as h, CardHeader as g, CardTitle as _, Combobox as v, ConfigPanelRenderer as y, ConfigRow as b, Dialog as x, DialogContent as S, DialogHeader as C, DialogTitle as w,
|
|
4
|
-
import * as
|
|
5
|
-
import { Fragment as ee, forwardRef as te, useCallback as
|
|
6
|
-
import { AlertCircle as
|
|
7
|
-
import { DndContext as
|
|
8
|
-
import { SortableContext as
|
|
9
|
-
import { CSS as
|
|
10
|
-
import { Fragment as
|
|
3
|
+
import { Button as p, Card as m, CardContent as h, CardHeader as g, CardTitle as _, Combobox as v, ConfigPanelRenderer as y, ConfigRow as b, Dialog as x, DialogContent as S, DialogHeader as C, DialogTitle as w, RefreshIndicator as T, Sheet as E, SheetContent as D, SheetHeader as O, SheetTitle as k, Skeleton as A, cn as j, getLazyIcon as M, useConfigDraft as N } from "@object-ui/components";
|
|
4
|
+
import * as P from "react";
|
|
5
|
+
import { Fragment as ee, forwardRef as te, useCallback as F, useContext as ne, useEffect as I, useMemo as L, useRef as re, useState as R } from "react";
|
|
6
|
+
import { AlertCircle as z, ArrowDownIcon as B, ArrowUpIcon as V, Edit as H, GripVertical as ie, Loader2 as U, MinusIcon as ae, RefreshCw as oe, Save as se, Settings as W, X as ce } from "lucide-react";
|
|
7
|
+
import { DndContext as G, PointerSensor as le, closestCenter as K, useSensor as ue, useSensors as de } from "@dnd-kit/core";
|
|
8
|
+
import { SortableContext as fe, arrayMove as pe, rectSortingStrategy as me, useSortable as q, verticalListSortingStrategy as he } from "@dnd-kit/sortable";
|
|
9
|
+
import { CSS as J } from "@dnd-kit/utilities";
|
|
10
|
+
import { Fragment as Y, jsx as X, jsxs as Z } from "react/jsx-runtime";
|
|
11
11
|
import { ResponsiveGridLayout as ge, useContainerWidth as _e } from "react-grid-layout";
|
|
12
12
|
import "react-grid-layout/css/styles.css";
|
|
13
13
|
import { createSafeTranslation as ve, useObjectTranslation as ye, useSafeFieldLabel as be } from "@object-ui/i18n";
|
|
14
14
|
import { formatCurrency as xe, formatDate as Se, formatPercent as Ce, getCellRenderer as we, resolveCellRendererType as Te } from "@object-ui/fields";
|
|
15
15
|
//#region src/utils.ts
|
|
16
|
-
function
|
|
16
|
+
function Q(e) {
|
|
17
17
|
return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/DashboardRenderer.tsx
|
|
21
21
|
function Ee({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
22
|
-
let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } =
|
|
22
|
+
let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = q({
|
|
23
23
|
id: e,
|
|
24
24
|
disabled: t
|
|
25
25
|
});
|
|
26
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ X("div", {
|
|
27
27
|
ref: s,
|
|
28
28
|
style: {
|
|
29
|
-
transform:
|
|
29
|
+
transform: J.Transform.toString(c),
|
|
30
30
|
transition: l,
|
|
31
31
|
opacity: u ? .4 : 1,
|
|
32
32
|
...n ? {
|
|
@@ -34,7 +34,7 @@ function Ee({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
|
34
34
|
gridRow: `span ${n.h}`
|
|
35
35
|
} : {}
|
|
36
36
|
},
|
|
37
|
-
className:
|
|
37
|
+
className: j("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
|
|
38
38
|
"data-sortable-widget-id": e,
|
|
39
39
|
...a,
|
|
40
40
|
...o,
|
|
@@ -42,9 +42,9 @@ function Ee({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
function De(e) {
|
|
45
|
-
return e ?
|
|
45
|
+
return e ? M(e) : null;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function $(e) {
|
|
48
48
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
49
49
|
}
|
|
50
50
|
var Oe = [
|
|
@@ -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 je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: s, selectedWidgetId: l, onWidgetClick: u, onWidgetsReorder: d, modalHandler: v, scriptHandlers: y, hideHeaderText: b, ...x }, S) => {
|
|
69
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 $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
74
74
|
t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
|
|
75
75
|
}
|
|
76
76
|
return n > 4 ? 12 : 4;
|
|
77
|
-
})(), w = C, T = e.gap || 4, [E, D] =
|
|
77
|
+
})(), w = C, T = e.gap || 4, [E, D] = R(!1), [O, k] = R(!1), A = re(null), { executeAction: M, engine: N } = c({ actions: L(() => (e.header?.actions ?? []).map((e) => ({
|
|
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:
|
|
83
|
-
let t =
|
|
84
|
-
return !
|
|
85
|
-
}, [
|
|
86
|
-
let t =
|
|
87
|
-
return !
|
|
88
|
-
}, [
|
|
89
|
-
|
|
82
|
+
})), [e.header?.actions]) }), { dashboardLabel: P, dashboardDescription: te, dashboardActionLabel: ne, widgetTitle: z, widgetDescription: B, fieldLabel: V } = f(), H = e.name, ie = F((e) => H ? ne(H, e.actionUrl || e.label, e.label) : e.label, [H, ne]), U = F((e) => {
|
|
83
|
+
let t = $(e.title);
|
|
84
|
+
return !H || !e.id || t === void 0 ? t : z(H, e.id, t);
|
|
85
|
+
}, [H, z]), ae = F((e) => {
|
|
86
|
+
let t = $(e.description);
|
|
87
|
+
return !H || !e.id ? t : B(H, e.id, t);
|
|
88
|
+
}, [H, B]);
|
|
89
|
+
I(() => {
|
|
90
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
|
+
]), I(() => {
|
|
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 se = F(() => {
|
|
101
101
|
r && (D(!0), r(), setTimeout(() => D(!1), 600));
|
|
102
102
|
}, [r]);
|
|
103
|
-
|
|
104
|
-
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return
|
|
105
|
-
|
|
103
|
+
I(() => {
|
|
104
|
+
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return A.current = setInterval(se, e.refreshInterval * 1e3), () => {
|
|
105
|
+
A.current && clearInterval(A.current);
|
|
106
106
|
};
|
|
107
107
|
}, [
|
|
108
108
|
e.refreshInterval,
|
|
109
109
|
r,
|
|
110
|
-
|
|
110
|
+
se
|
|
111
111
|
]);
|
|
112
|
-
let W =
|
|
112
|
+
let W = F((e, t) => {
|
|
113
113
|
!s || !u || !t || (e.stopPropagation(), u(t));
|
|
114
|
-
}, [s, u]),
|
|
114
|
+
}, [s, u]), ce = F((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,19 +128,19 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
128
128
|
s,
|
|
129
129
|
u,
|
|
130
130
|
e.widgets
|
|
131
|
-
]), q =
|
|
131
|
+
]), q = F((e) => {
|
|
132
132
|
!s || !u || e.target === e.currentTarget && u(null);
|
|
133
|
-
}, [s, u]), J = !!(s && d),
|
|
133
|
+
}, [s, u]), J = !!(s && d), Y = de(ue(le, { activationConstraint: { distance: 5 } })), ge = F((t) => {
|
|
134
134
|
if (!J) return;
|
|
135
135
|
let { active: n, over: r } = t;
|
|
136
136
|
if (!r || n.id === r.id) return;
|
|
137
137
|
let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
|
|
138
|
-
a < 0 || o < 0 || d?.(
|
|
138
|
+
a < 0 || o < 0 || d?.(pe(i, a, o));
|
|
139
139
|
}, [
|
|
140
140
|
J,
|
|
141
141
|
e.widgets,
|
|
142
142
|
d
|
|
143
|
-
]),
|
|
143
|
+
]), _e = (e, t, r) => {
|
|
144
144
|
let i = e.layout ? {
|
|
145
145
|
...e.layout,
|
|
146
146
|
w: Math.min(e.layout.w, w)
|
|
@@ -148,7 +148,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
148
148
|
if (e.component) return e.component;
|
|
149
149
|
let t = e.type, n = e.options || {};
|
|
150
150
|
if (t === "metric" && e.object) {
|
|
151
|
-
let t = n.data, r =
|
|
151
|
+
let t = n.data, r = Q(t) && t.aggregate ? {
|
|
152
152
|
field: e.valueField || t.aggregate.field,
|
|
153
153
|
function: e.aggregate || t.aggregate.function,
|
|
154
154
|
groupBy: e.categoryField ?? t.aggregate.groupBy ?? "_all"
|
|
@@ -159,10 +159,10 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
159
159
|
} : void 0;
|
|
160
160
|
return {
|
|
161
161
|
type: "object-metric",
|
|
162
|
-
objectName: e.object || (
|
|
162
|
+
objectName: e.object || (Q(t) ? t.object : void 0),
|
|
163
163
|
aggregate: r,
|
|
164
|
-
filter: (
|
|
165
|
-
label: n.label ||
|
|
164
|
+
filter: (Q(t) ? t.filter : void 0) || e.filter,
|
|
165
|
+
label: n.label || U(e) || "",
|
|
166
166
|
fallbackValue: n.value,
|
|
167
167
|
trend: n.trend,
|
|
168
168
|
icon: n.icon,
|
|
@@ -173,7 +173,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
173
173
|
prefix: n.prefix,
|
|
174
174
|
suffix: n.suffix,
|
|
175
175
|
drillDown: n.drillDown ?? { enabled: !0 },
|
|
176
|
-
title: n.label ||
|
|
176
|
+
title: n.label || U(e) || ""
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
if ((t === "gauge" || t === "solid-gauge") && e.object) {
|
|
@@ -187,7 +187,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
187
187
|
objectName: e.object,
|
|
188
188
|
aggregate: t,
|
|
189
189
|
filter: e.filter,
|
|
190
|
-
label: n.label ||
|
|
190
|
+
label: n.label || U(e) || "",
|
|
191
191
|
fallbackValue: n.fallbackValue ?? n.value,
|
|
192
192
|
icon: n.icon,
|
|
193
193
|
description: n.description,
|
|
@@ -202,7 +202,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
202
202
|
let r = t && {}[t] || t;
|
|
203
203
|
if (r === "bar" || r === "horizontal-bar" || r === "line" || r === "area" || r === "pie" || r === "donut" || r === "scatter" || r === "funnel") {
|
|
204
204
|
let t = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
|
|
205
|
-
if (
|
|
205
|
+
if (Q(t)) {
|
|
206
206
|
let o = t.aggregate, s = o ? {
|
|
207
207
|
field: e.valueField || o.field,
|
|
208
208
|
function: e.aggregate || o.function,
|
|
@@ -216,7 +216,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
216
216
|
xAxisKey: i,
|
|
217
217
|
series: [{
|
|
218
218
|
dataKey: c,
|
|
219
|
-
label: l ?
|
|
219
|
+
label: l ? V(l, c, c) : c
|
|
220
220
|
}],
|
|
221
221
|
colors: Oe,
|
|
222
222
|
drillDown: n.drillDown ?? Ae(r),
|
|
@@ -237,7 +237,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
237
237
|
xAxisKey: i,
|
|
238
238
|
series: [{
|
|
239
239
|
dataKey: a,
|
|
240
|
-
label:
|
|
240
|
+
label: V(e.object, a, a)
|
|
241
241
|
}],
|
|
242
242
|
colors: Oe,
|
|
243
243
|
drillDown: n.drillDown ?? Ae(r),
|
|
@@ -251,7 +251,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
251
251
|
xAxisKey: i,
|
|
252
252
|
series: [{
|
|
253
253
|
dataKey: a,
|
|
254
|
-
label: e.object ?
|
|
254
|
+
label: e.object ? V(e.object, a, a) : a
|
|
255
255
|
}],
|
|
256
256
|
colors: Oe,
|
|
257
257
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
@@ -259,7 +259,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
259
259
|
}
|
|
260
260
|
if (t === "table") {
|
|
261
261
|
let t = e.data || n.data;
|
|
262
|
-
if (
|
|
262
|
+
if (Q(t)) {
|
|
263
263
|
let { data: r, ...i } = n;
|
|
264
264
|
return {
|
|
265
265
|
type: "object-data-table",
|
|
@@ -298,11 +298,11 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
298
298
|
showRowTotals: r.showRowTotals ?? n.showRowTotals,
|
|
299
299
|
showColumnTotals: r.showColumnTotals ?? n.showColumnTotals,
|
|
300
300
|
format: r.format ?? n.format
|
|
301
|
-
}, a = (
|
|
301
|
+
}, a = (Q(t) || !t && e.object) && n.drillDown === void 0 ? {
|
|
302
302
|
...n,
|
|
303
303
|
drillDown: { enabled: !0 }
|
|
304
304
|
} : n;
|
|
305
|
-
if (
|
|
305
|
+
if (Q(t)) {
|
|
306
306
|
let { data: n, ...r } = a;
|
|
307
307
|
return {
|
|
308
308
|
type: "object-pivot",
|
|
@@ -328,7 +328,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
328
328
|
}
|
|
329
329
|
if (t === "list") {
|
|
330
330
|
let t = e.data || n.data;
|
|
331
|
-
if (
|
|
331
|
+
if (Q(t)) {
|
|
332
332
|
let { data: r, ...i } = n;
|
|
333
333
|
return {
|
|
334
334
|
type: "object-data-table",
|
|
@@ -368,7 +368,7 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
368
368
|
...e,
|
|
369
369
|
...n
|
|
370
370
|
};
|
|
371
|
-
})(), c = e.type === "metric", u =
|
|
371
|
+
})(), c = e.type === "metric", u = U(e), d = ae(e), f = e.id || u || `widget-${t}`, p = s && l === e.id, v = s ? {
|
|
372
372
|
"data-testid": `dashboard-preview-widget-${e.id}`,
|
|
373
373
|
"data-widget-id": e.id,
|
|
374
374
|
role: "button",
|
|
@@ -376,86 +376,86 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
376
376
|
"aria-selected": p,
|
|
377
377
|
"aria-label": `Widget: ${u || `Widget ${t + 1}`}`,
|
|
378
378
|
onClick: (t) => W(t, e.id),
|
|
379
|
-
onKeyDown: (n) =>
|
|
380
|
-
} : {}, y = s ?
|
|
379
|
+
onKeyDown: (n) => ce(n, e.id, t)
|
|
380
|
+
} : {}, y = s ? j("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", p ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, b = !O && i && !J ? {
|
|
381
381
|
gridColumn: `span ${i.w}`,
|
|
382
382
|
gridRow: `span ${i.h}`
|
|
383
|
-
} : void 0, x = c ? /* @__PURE__ */
|
|
384
|
-
className:
|
|
383
|
+
} : void 0, x = c ? /* @__PURE__ */ Z("div", {
|
|
384
|
+
className: j("h-full w-full", s && "relative", y),
|
|
385
385
|
style: b,
|
|
386
386
|
...v,
|
|
387
|
-
children: [/* @__PURE__ */
|
|
387
|
+
children: [/* @__PURE__ */ X(o, {
|
|
388
388
|
schema: a,
|
|
389
|
-
className:
|
|
389
|
+
className: j("h-full w-full", s && "pointer-events-none"),
|
|
390
390
|
dataSource: n
|
|
391
|
-
}), s && /* @__PURE__ */
|
|
391
|
+
}), s && /* @__PURE__ */ X("div", {
|
|
392
392
|
className: "absolute inset-0 z-10",
|
|
393
393
|
"aria-hidden": "true",
|
|
394
394
|
"data-testid": "widget-click-overlay"
|
|
395
395
|
})]
|
|
396
|
-
}) : /* @__PURE__ */
|
|
397
|
-
className:
|
|
396
|
+
}) : /* @__PURE__ */ Z(m, {
|
|
397
|
+
className: j("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", s && "relative", y),
|
|
398
398
|
style: b,
|
|
399
399
|
...v,
|
|
400
400
|
children: [
|
|
401
|
-
u && /* @__PURE__ */
|
|
401
|
+
u && /* @__PURE__ */ Z(g, {
|
|
402
402
|
className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
|
|
403
|
-
children: [/* @__PURE__ */
|
|
403
|
+
children: [/* @__PURE__ */ X(_, {
|
|
404
404
|
className: "text-sm sm:text-base font-medium tracking-tight truncate",
|
|
405
405
|
title: u,
|
|
406
406
|
children: u
|
|
407
|
-
}), d && /* @__PURE__ */
|
|
407
|
+
}), d && /* @__PURE__ */ X("p", {
|
|
408
408
|
className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
|
|
409
409
|
children: d
|
|
410
410
|
})]
|
|
411
411
|
}),
|
|
412
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ X(h, {
|
|
413
413
|
className: "p-0",
|
|
414
|
-
children: /* @__PURE__ */
|
|
415
|
-
className:
|
|
416
|
-
children: /* @__PURE__ */
|
|
414
|
+
children: /* @__PURE__ */ X("div", {
|
|
415
|
+
className: j("h-full w-full", "p-3 sm:p-4 md:p-6", s && "pointer-events-none"),
|
|
416
|
+
children: /* @__PURE__ */ X(o, {
|
|
417
417
|
schema: a,
|
|
418
418
|
dataSource: n
|
|
419
419
|
})
|
|
420
420
|
})
|
|
421
421
|
}),
|
|
422
|
-
s && /* @__PURE__ */
|
|
422
|
+
s && /* @__PURE__ */ X("div", {
|
|
423
423
|
className: "absolute inset-0 z-10",
|
|
424
424
|
"aria-hidden": "true",
|
|
425
425
|
"data-testid": "widget-click-overlay"
|
|
426
426
|
})
|
|
427
427
|
]
|
|
428
428
|
});
|
|
429
|
-
return J && e.id ? /* @__PURE__ */
|
|
429
|
+
return J && e.id ? /* @__PURE__ */ X(Ee, {
|
|
430
430
|
id: e.id,
|
|
431
431
|
gridSpan: !O && i ? {
|
|
432
432
|
w: i.w,
|
|
433
433
|
h: i.h
|
|
434
434
|
} : void 0,
|
|
435
435
|
children: x
|
|
436
|
-
}, f) : /* @__PURE__ */
|
|
437
|
-
},
|
|
436
|
+
}, f) : /* @__PURE__ */ X(ee, { children: x }, f);
|
|
437
|
+
}, ve = e.header && /* @__PURE__ */ Z("div", {
|
|
438
438
|
className: "col-span-full mb-4",
|
|
439
439
|
children: [
|
|
440
|
-
!b && e.header.showTitle !== !1 && e.title && /* @__PURE__ */
|
|
440
|
+
!b && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ X("h2", {
|
|
441
441
|
className: "text-lg font-semibold tracking-tight",
|
|
442
|
-
children:
|
|
443
|
-
name:
|
|
444
|
-
label:
|
|
445
|
-
}) :
|
|
442
|
+
children: H ? P({
|
|
443
|
+
name: H,
|
|
444
|
+
label: $(e.title)
|
|
445
|
+
}) : $(e.title)
|
|
446
446
|
}),
|
|
447
|
-
!b && e.header.showDescription !== !1 && e.description && /* @__PURE__ */
|
|
447
|
+
!b && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ X("p", {
|
|
448
448
|
className: "text-sm text-muted-foreground mt-1",
|
|
449
|
-
children:
|
|
450
|
-
name:
|
|
451
|
-
description:
|
|
452
|
-
}) :
|
|
449
|
+
children: H ? te({
|
|
450
|
+
name: H,
|
|
451
|
+
description: $(e.description)
|
|
452
|
+
}) : $(e.description)
|
|
453
453
|
}),
|
|
454
|
-
e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */
|
|
454
|
+
e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ X("div", {
|
|
455
455
|
className: "flex gap-2 mt-3",
|
|
456
456
|
children: e.header.actions.map((e, t) => {
|
|
457
457
|
let n = De(e.icon);
|
|
458
|
-
return /* @__PURE__ */
|
|
458
|
+
return /* @__PURE__ */ Z(p, {
|
|
459
459
|
variant: "outline",
|
|
460
460
|
size: "sm",
|
|
461
461
|
onClick: async () => {
|
|
@@ -475,97 +475,97 @@ var $ = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
475
475
|
}
|
|
476
476
|
console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
|
|
477
477
|
},
|
|
478
|
-
children: [n && /* @__PURE__ */
|
|
478
|
+
children: [n && /* @__PURE__ */ X(n, { className: "w-4 h-4 mr-1.5" }), ie(e)]
|
|
479
479
|
}, t);
|
|
480
480
|
})
|
|
481
481
|
})
|
|
482
482
|
]
|
|
483
|
-
}),
|
|
483
|
+
}), ye = i !== void 0 && /* @__PURE__ */ Z("span", {
|
|
484
484
|
className: "text-xs text-muted-foreground",
|
|
485
485
|
children: [i.toLocaleString(), " records"]
|
|
486
|
-
}),
|
|
487
|
-
className:
|
|
488
|
-
children: [
|
|
486
|
+
}), be = a ? JSON.stringify(a) : void 0, xe = r && /* @__PURE__ */ Z("div", {
|
|
487
|
+
className: j("flex items-center justify-end gap-3 mb-2", !O && "col-span-full"),
|
|
488
|
+
children: [ye, /* @__PURE__ */ Z(p, {
|
|
489
489
|
variant: "outline",
|
|
490
490
|
size: "sm",
|
|
491
|
-
onClick:
|
|
491
|
+
onClick: se,
|
|
492
492
|
disabled: E,
|
|
493
493
|
"aria-label": "Refresh dashboard",
|
|
494
|
-
children: [/* @__PURE__ */
|
|
494
|
+
children: [/* @__PURE__ */ X(oe, { className: j("h-4 w-4 mr-2", E && "animate-spin") }), E ? "Refreshing…" : "Refresh All"]
|
|
495
495
|
})]
|
|
496
|
-
}),
|
|
496
|
+
}), Se = L(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), Ce = L(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), we = L(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
|
|
497
497
|
if (O) {
|
|
498
|
-
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */
|
|
498
|
+
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ Z("div", {
|
|
499
499
|
ref: S,
|
|
500
|
-
className:
|
|
501
|
-
"data-user-actions":
|
|
500
|
+
className: j("flex flex-col gap-4 px-4", t),
|
|
501
|
+
"data-user-actions": be,
|
|
502
502
|
onClick: q,
|
|
503
503
|
...x,
|
|
504
504
|
children: [
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
n.length > 0 && /* @__PURE__ */
|
|
505
|
+
ve,
|
|
506
|
+
xe,
|
|
507
|
+
n.length > 0 && /* @__PURE__ */ X("div", {
|
|
508
508
|
className: "grid grid-cols-2 gap-3",
|
|
509
509
|
onClick: q,
|
|
510
|
-
children: /* @__PURE__ */
|
|
511
|
-
items:
|
|
512
|
-
strategy:
|
|
510
|
+
children: /* @__PURE__ */ X(fe, {
|
|
511
|
+
items: Ce,
|
|
512
|
+
strategy: me,
|
|
513
513
|
disabled: !J,
|
|
514
|
-
children: n.map((e, t) =>
|
|
514
|
+
children: n.map((e, t) => _e(e, t))
|
|
515
515
|
})
|
|
516
516
|
}),
|
|
517
|
-
r.length > 0 && /* @__PURE__ */
|
|
517
|
+
r.length > 0 && /* @__PURE__ */ X("div", {
|
|
518
518
|
className: "flex flex-col gap-4",
|
|
519
519
|
onClick: q,
|
|
520
|
-
children: /* @__PURE__ */
|
|
521
|
-
items:
|
|
520
|
+
children: /* @__PURE__ */ X(fe, {
|
|
521
|
+
items: we,
|
|
522
522
|
strategy: he,
|
|
523
523
|
disabled: !J,
|
|
524
|
-
children: r.map((e, t) =>
|
|
524
|
+
children: r.map((e, t) => _e(e, t, !0))
|
|
525
525
|
})
|
|
526
526
|
})
|
|
527
527
|
]
|
|
528
528
|
});
|
|
529
|
-
return J ? /* @__PURE__ */
|
|
530
|
-
sensors:
|
|
529
|
+
return J ? /* @__PURE__ */ X(G, {
|
|
530
|
+
sensors: Y,
|
|
531
531
|
collisionDetection: K,
|
|
532
|
-
onDragEnd:
|
|
532
|
+
onDragEnd: ge,
|
|
533
533
|
children: i
|
|
534
534
|
}) : i;
|
|
535
535
|
}
|
|
536
|
-
let
|
|
536
|
+
let Te = e.columns != null || C !== 4, ke = /* @__PURE__ */ Z("div", {
|
|
537
537
|
ref: S,
|
|
538
|
-
className:
|
|
538
|
+
className: j("grid auto-rows-min", !Te && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
|
|
539
539
|
style: {
|
|
540
|
-
...
|
|
540
|
+
...Te && { gridTemplateColumns: `repeat(${w}, minmax(0, 1fr))` },
|
|
541
541
|
gap: `${T * .25}rem`
|
|
542
542
|
},
|
|
543
|
-
"data-user-actions":
|
|
543
|
+
"data-user-actions": be,
|
|
544
544
|
onClick: q,
|
|
545
545
|
...x,
|
|
546
546
|
children: [
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
items:
|
|
551
|
-
strategy:
|
|
547
|
+
ve,
|
|
548
|
+
xe,
|
|
549
|
+
/* @__PURE__ */ X(fe, {
|
|
550
|
+
items: Se,
|
|
551
|
+
strategy: me,
|
|
552
552
|
disabled: !J,
|
|
553
|
-
children: e.widgets?.map((e, t) =>
|
|
553
|
+
children: e.widgets?.map((e, t) => _e(e, t))
|
|
554
554
|
})
|
|
555
555
|
]
|
|
556
556
|
});
|
|
557
|
-
return J ? /* @__PURE__ */
|
|
558
|
-
sensors:
|
|
557
|
+
return J ? /* @__PURE__ */ X(G, {
|
|
558
|
+
sensors: Y,
|
|
559
559
|
collisionDetection: K,
|
|
560
|
-
onDragEnd:
|
|
561
|
-
children:
|
|
562
|
-
}) :
|
|
560
|
+
onDragEnd: ge,
|
|
561
|
+
children: ke
|
|
562
|
+
}) : ke;
|
|
563
563
|
});
|
|
564
564
|
//#endregion
|
|
565
565
|
//#region src/DashboardGridLayout.tsx
|
|
566
|
-
function
|
|
566
|
+
function Me({ editMode: e }) {
|
|
567
567
|
let t = u();
|
|
568
|
-
return
|
|
568
|
+
return P.useEffect(() => {
|
|
569
569
|
if (e) return t.startDrag({
|
|
570
570
|
id: "dashboard-layout",
|
|
571
571
|
type: "dashboard-widget",
|
|
@@ -576,14 +576,14 @@ function je({ editMode: e }) {
|
|
|
576
576
|
t.endDrag("dashboard");
|
|
577
577
|
}, [e, t]), null;
|
|
578
578
|
}
|
|
579
|
-
var
|
|
579
|
+
var Ne = [
|
|
580
580
|
"hsl(var(--chart-1))",
|
|
581
581
|
"hsl(var(--chart-2))",
|
|
582
582
|
"hsl(var(--chart-3))",
|
|
583
583
|
"hsl(var(--chart-4))",
|
|
584
584
|
"hsl(var(--chart-5))"
|
|
585
585
|
];
|
|
586
|
-
function
|
|
586
|
+
function Pe(e, t) {
|
|
587
587
|
if (!e.widgets?.length) return e;
|
|
588
588
|
let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
|
|
589
589
|
let r = e.id || `widget-${t}`, i = n.get(r);
|
|
@@ -602,7 +602,7 @@ function Ne(e, t) {
|
|
|
602
602
|
widgets: r
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function Fe(e) {
|
|
606
606
|
return { lg: e.widgets?.map((e, t) => ({
|
|
607
607
|
i: e.id || `widget-${t}`,
|
|
608
608
|
x: e.layout?.x ?? t % 4 * 3,
|
|
@@ -611,11 +611,11 @@ function Pe(e) {
|
|
|
611
611
|
h: e.layout?.h ?? 4
|
|
612
612
|
})) || [] };
|
|
613
613
|
}
|
|
614
|
-
var
|
|
615
|
-
let { width: a, containerRef: s, mounted: c } = _e(), [l, u] =
|
|
614
|
+
var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
|
|
615
|
+
let { width: a, containerRef: s, mounted: c } = _e(), [l, u] = P.useState(!1), [f, v] = P.useState(!1), y = d(), b = P.useRef(null), x = P.useCallback(() => {
|
|
616
616
|
i && (v(!0), i(), setTimeout(() => v(!1), 600));
|
|
617
617
|
}, [i]);
|
|
618
|
-
|
|
618
|
+
P.useEffect(() => {
|
|
619
619
|
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return b.current = setInterval(x, e.refreshInterval * 1e3), () => {
|
|
620
620
|
b.current && clearInterval(b.current);
|
|
621
621
|
};
|
|
@@ -624,32 +624,32 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
624
624
|
i,
|
|
625
625
|
x
|
|
626
626
|
]);
|
|
627
|
-
let [S, C] =
|
|
627
|
+
let [S, C] = P.useState(() => Fe(e)), w = P.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
|
|
628
628
|
i: e.id || `widget-${t}`,
|
|
629
629
|
x: e.layout?.x,
|
|
630
630
|
y: e.layout?.y,
|
|
631
631
|
w: e.layout?.w,
|
|
632
632
|
h: e.layout?.h
|
|
633
633
|
})) ?? []), [e.widgets]);
|
|
634
|
-
|
|
635
|
-
C(
|
|
634
|
+
P.useEffect(() => {
|
|
635
|
+
C(Fe(e));
|
|
636
636
|
}, [w]);
|
|
637
|
-
let T =
|
|
637
|
+
let T = P.useCallback((e, t) => {
|
|
638
638
|
C(t), n?.(e);
|
|
639
|
-
}, [n]), E =
|
|
640
|
-
r ? r(
|
|
639
|
+
}, [n]), E = P.useCallback(() => {
|
|
640
|
+
r ? r(Pe(e, S.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), u(!1);
|
|
641
641
|
}, [
|
|
642
642
|
r,
|
|
643
643
|
e,
|
|
644
644
|
S
|
|
645
|
-
]), D =
|
|
646
|
-
C(
|
|
647
|
-
}, [e]), O =
|
|
645
|
+
]), D = P.useCallback(() => {
|
|
646
|
+
C(Fe(e));
|
|
647
|
+
}, [e]), O = P.useCallback((e) => {
|
|
648
648
|
if (e.component) return e.component;
|
|
649
649
|
let t = e.type, n = e.options || {};
|
|
650
650
|
if (t === "bar" || t === "horizontal-bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter" || t === "funnel") {
|
|
651
651
|
let r = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
|
|
652
|
-
if (
|
|
652
|
+
if (Q(r)) {
|
|
653
653
|
let n = r.aggregate, o = n ? {
|
|
654
654
|
field: e.valueField || n.field,
|
|
655
655
|
function: e.aggregate || n.function,
|
|
@@ -662,7 +662,7 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
662
662
|
aggregate: o,
|
|
663
663
|
xAxisKey: i,
|
|
664
664
|
series: [{ dataKey: s }],
|
|
665
|
-
colors:
|
|
665
|
+
colors: Ne,
|
|
666
666
|
className: "h-full"
|
|
667
667
|
};
|
|
668
668
|
}
|
|
@@ -679,7 +679,7 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
679
679
|
aggregate: n,
|
|
680
680
|
xAxisKey: i,
|
|
681
681
|
series: [{ dataKey: e.valueField || "value" }],
|
|
682
|
-
colors:
|
|
682
|
+
colors: Ne,
|
|
683
683
|
className: "h-full"
|
|
684
684
|
};
|
|
685
685
|
}
|
|
@@ -689,13 +689,13 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
689
689
|
data: Array.isArray(r) ? r : r?.items || [],
|
|
690
690
|
xAxisKey: i,
|
|
691
691
|
series: [{ dataKey: a }],
|
|
692
|
-
colors:
|
|
692
|
+
colors: Ne,
|
|
693
693
|
className: "h-full"
|
|
694
694
|
};
|
|
695
695
|
}
|
|
696
696
|
if (t === "table") {
|
|
697
697
|
let t = e.data || n.data;
|
|
698
|
-
if (
|
|
698
|
+
if (Q(t)) {
|
|
699
699
|
let { data: r, ...i } = n;
|
|
700
700
|
return {
|
|
701
701
|
type: "data-table",
|
|
@@ -727,7 +727,7 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
727
727
|
}
|
|
728
728
|
if (t === "pivot") {
|
|
729
729
|
let t = e.data || n.data;
|
|
730
|
-
if (
|
|
730
|
+
if (Q(t)) {
|
|
731
731
|
let { data: r, ...i } = n;
|
|
732
732
|
return {
|
|
733
733
|
type: "pivot",
|
|
@@ -748,54 +748,54 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
748
748
|
...n
|
|
749
749
|
};
|
|
750
750
|
}, []);
|
|
751
|
-
return /* @__PURE__ */
|
|
751
|
+
return /* @__PURE__ */ Z("div", {
|
|
752
752
|
ref: s,
|
|
753
|
-
className:
|
|
753
|
+
className: j("w-full", t),
|
|
754
754
|
"data-testid": "grid-layout",
|
|
755
755
|
children: [
|
|
756
|
-
y && /* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
756
|
+
y && /* @__PURE__ */ X(Me, { editMode: l }),
|
|
757
|
+
/* @__PURE__ */ Z("div", {
|
|
758
758
|
className: "mb-4 flex items-center justify-between",
|
|
759
|
-
children: [/* @__PURE__ */
|
|
759
|
+
children: [/* @__PURE__ */ X("h2", {
|
|
760
760
|
className: "text-2xl font-bold",
|
|
761
761
|
children: e.title || "Dashboard"
|
|
762
|
-
}), /* @__PURE__ */
|
|
762
|
+
}), /* @__PURE__ */ X("div", {
|
|
763
763
|
className: "flex gap-2",
|
|
764
|
-
children: l ? /* @__PURE__ */
|
|
765
|
-
/* @__PURE__ */
|
|
764
|
+
children: l ? /* @__PURE__ */ Z(Y, { children: [
|
|
765
|
+
/* @__PURE__ */ Z(p, {
|
|
766
766
|
onClick: E,
|
|
767
767
|
size: "sm",
|
|
768
768
|
variant: "default",
|
|
769
|
-
children: [/* @__PURE__ */
|
|
769
|
+
children: [/* @__PURE__ */ X(se, { className: "h-4 w-4 mr-2" }), "Save Layout"]
|
|
770
770
|
}),
|
|
771
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ Z(p, {
|
|
772
772
|
onClick: D,
|
|
773
773
|
size: "sm",
|
|
774
774
|
variant: "outline",
|
|
775
|
-
children: [/* @__PURE__ */
|
|
775
|
+
children: [/* @__PURE__ */ X(ce, { className: "h-4 w-4 mr-2" }), "Reset"]
|
|
776
776
|
}),
|
|
777
|
-
/* @__PURE__ */
|
|
777
|
+
/* @__PURE__ */ X(p, {
|
|
778
778
|
onClick: () => u(!1),
|
|
779
779
|
size: "sm",
|
|
780
780
|
variant: "ghost",
|
|
781
781
|
children: "Cancel"
|
|
782
782
|
})
|
|
783
|
-
] }) : /* @__PURE__ */
|
|
783
|
+
] }) : /* @__PURE__ */ Z(Y, { children: [i && /* @__PURE__ */ Z(p, {
|
|
784
784
|
onClick: x,
|
|
785
785
|
size: "sm",
|
|
786
786
|
variant: "outline",
|
|
787
787
|
disabled: f,
|
|
788
788
|
"aria-label": "Refresh dashboard",
|
|
789
|
-
children: [/* @__PURE__ */
|
|
790
|
-
}), /* @__PURE__ */
|
|
789
|
+
children: [/* @__PURE__ */ X(oe, { className: j("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
|
|
790
|
+
}), /* @__PURE__ */ Z(p, {
|
|
791
791
|
onClick: () => u(!0),
|
|
792
792
|
size: "sm",
|
|
793
793
|
variant: "outline",
|
|
794
|
-
children: [/* @__PURE__ */
|
|
794
|
+
children: [/* @__PURE__ */ X(H, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
|
|
795
795
|
})] })
|
|
796
796
|
})]
|
|
797
797
|
}),
|
|
798
|
-
c && /* @__PURE__ */
|
|
798
|
+
c && /* @__PURE__ */ X(ge, {
|
|
799
799
|
className: "layout",
|
|
800
800
|
width: a,
|
|
801
801
|
layouts: S,
|
|
@@ -822,34 +822,34 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
822
822
|
onLayoutChange: T,
|
|
823
823
|
children: e.widgets?.map((e, t) => {
|
|
824
824
|
let n = e.id || `widget-${t}`, r = O(e);
|
|
825
|
-
return /* @__PURE__ */
|
|
825
|
+
return /* @__PURE__ */ X("div", {
|
|
826
826
|
className: "h-full",
|
|
827
|
-
children: e.type === "metric" ? /* @__PURE__ */
|
|
827
|
+
children: e.type === "metric" ? /* @__PURE__ */ Z("div", {
|
|
828
828
|
className: "h-full w-full relative",
|
|
829
|
-
children: [l && /* @__PURE__ */
|
|
829
|
+
children: [l && /* @__PURE__ */ X("div", {
|
|
830
830
|
className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
|
|
831
|
-
children: /* @__PURE__ */
|
|
832
|
-
}), /* @__PURE__ */
|
|
831
|
+
children: /* @__PURE__ */ X(ie, { className: "h-4 w-4" })
|
|
832
|
+
}), /* @__PURE__ */ X(o, {
|
|
833
833
|
schema: r,
|
|
834
834
|
className: "h-full w-full"
|
|
835
835
|
})]
|
|
836
|
-
}) : /* @__PURE__ */
|
|
837
|
-
className:
|
|
838
|
-
children: [e.title && /* @__PURE__ */
|
|
836
|
+
}) : /* @__PURE__ */ Z(m, {
|
|
837
|
+
className: j("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", l && "ring-2 ring-primary/20"),
|
|
838
|
+
children: [e.title && /* @__PURE__ */ Z(g, {
|
|
839
839
|
className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
|
|
840
|
-
children: [/* @__PURE__ */
|
|
840
|
+
children: [/* @__PURE__ */ X(_, {
|
|
841
841
|
className: "text-base font-medium tracking-tight truncate",
|
|
842
842
|
title: e.title,
|
|
843
843
|
children: e.title
|
|
844
|
-
}), l && /* @__PURE__ */
|
|
844
|
+
}), l && /* @__PURE__ */ X("div", {
|
|
845
845
|
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
846
|
-
children: /* @__PURE__ */
|
|
846
|
+
children: /* @__PURE__ */ X(ie, { className: "h-4 w-4" })
|
|
847
847
|
})]
|
|
848
|
-
}), /* @__PURE__ */
|
|
848
|
+
}), /* @__PURE__ */ X(h, {
|
|
849
849
|
className: "p-0 h-full",
|
|
850
|
-
children: /* @__PURE__ */
|
|
851
|
-
className:
|
|
852
|
-
children: /* @__PURE__ */
|
|
850
|
+
children: /* @__PURE__ */ X("div", {
|
|
851
|
+
className: j("h-full w-full overflow-auto p-4"),
|
|
852
|
+
children: /* @__PURE__ */ X(o, { schema: r })
|
|
853
853
|
})
|
|
854
854
|
})]
|
|
855
855
|
})
|
|
@@ -858,7 +858,7 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
858
858
|
})
|
|
859
859
|
]
|
|
860
860
|
});
|
|
861
|
-
},
|
|
861
|
+
}, Le = ve({
|
|
862
862
|
"dashboard.trend.vsLastQuarter": "vs last quarter",
|
|
863
863
|
"dashboard.trend.vsLastMonth": "vs last month",
|
|
864
864
|
"dashboard.trend.vsLastWeek": "vs last week",
|
|
@@ -866,7 +866,7 @@ var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
866
866
|
"dashboard.trend.vsYesterday": "vs yesterday",
|
|
867
867
|
"dashboard.trend.vsPreviousPeriod": "vs previous period"
|
|
868
868
|
}, "dashboard.trend.vsLastQuarter");
|
|
869
|
-
function
|
|
869
|
+
function Re(e) {
|
|
870
870
|
switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
|
|
871
871
|
case "vs last quarter":
|
|
872
872
|
case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
|
|
@@ -882,11 +882,11 @@ function Le(e) {
|
|
|
882
882
|
default: return;
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function ze(e, t, n) {
|
|
886
886
|
if (e == null) return "";
|
|
887
887
|
if (typeof e == "string") {
|
|
888
888
|
let r = Number(e);
|
|
889
|
-
return !isFinite(r) || e.trim() === "" ? e :
|
|
889
|
+
return !isFinite(r) || e.trim() === "" ? e : ze(r, t, n);
|
|
890
890
|
}
|
|
891
891
|
if (!isFinite(e)) return String(e);
|
|
892
892
|
let r = {
|
|
@@ -913,10 +913,10 @@ function Re(e, t, n) {
|
|
|
913
913
|
maximumFractionDigits: c
|
|
914
914
|
}).format(e);
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function Be(e) {
|
|
917
917
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
918
918
|
}
|
|
919
|
-
var
|
|
919
|
+
var Ve = {
|
|
920
920
|
default: "bg-muted text-muted-foreground",
|
|
921
921
|
blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
922
922
|
teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
|
|
@@ -925,18 +925,18 @@ var Be = {
|
|
|
925
925
|
success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
|
926
926
|
warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
927
927
|
danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
|
|
928
|
-
},
|
|
929
|
-
let y =
|
|
930
|
-
let e =
|
|
928
|
+
}, He = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, ...v }) => {
|
|
929
|
+
let y = Ve[c] || Ve.default, { t: b } = Le(), x = L(() => {
|
|
930
|
+
let e = Be(a) || Be(n?.label);
|
|
931
931
|
if (!e) return e;
|
|
932
|
-
let t =
|
|
932
|
+
let t = Re(e);
|
|
933
933
|
return t ? b(t) : e;
|
|
934
934
|
}, [
|
|
935
935
|
a,
|
|
936
936
|
n?.label,
|
|
937
937
|
b
|
|
938
|
-
]), S =
|
|
939
|
-
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ?
|
|
938
|
+
]), S = L(() => {
|
|
939
|
+
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? ze(t, l, u) : t ?? "", n = String(e);
|
|
940
940
|
return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
|
|
941
941
|
}, [
|
|
942
942
|
t,
|
|
@@ -944,15 +944,15 @@ var Be = {
|
|
|
944
944
|
u,
|
|
945
945
|
d,
|
|
946
946
|
f
|
|
947
|
-
]), C =
|
|
947
|
+
]), C = L(() => {
|
|
948
948
|
if (typeof r == "string") {
|
|
949
|
-
let e =
|
|
950
|
-
return e ? /* @__PURE__ */
|
|
949
|
+
let e = M(r);
|
|
950
|
+
return e ? /* @__PURE__ */ X(e, { className: "h-4 w-4" }) : null;
|
|
951
951
|
}
|
|
952
952
|
return r;
|
|
953
953
|
}, [r]);
|
|
954
|
-
return /* @__PURE__ */
|
|
955
|
-
className:
|
|
954
|
+
return /* @__PURE__ */ Z(m, {
|
|
955
|
+
className: j("h-full overflow-hidden", p && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
|
|
956
956
|
onClick: p,
|
|
957
957
|
role: p ? "button" : void 0,
|
|
958
958
|
tabIndex: p ? 0 : void 0,
|
|
@@ -960,45 +960,45 @@ var Be = {
|
|
|
960
960
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
|
|
961
961
|
} : void 0,
|
|
962
962
|
...v,
|
|
963
|
-
children: [/* @__PURE__ */
|
|
963
|
+
children: [/* @__PURE__ */ Z(g, {
|
|
964
964
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
965
|
-
children: [/* @__PURE__ */
|
|
965
|
+
children: [/* @__PURE__ */ X(_, {
|
|
966
966
|
className: "text-sm font-medium truncate",
|
|
967
|
-
children:
|
|
968
|
-
}), C && /* @__PURE__ */
|
|
969
|
-
className:
|
|
967
|
+
children: Be(e)
|
|
968
|
+
}), C && /* @__PURE__ */ X("div", {
|
|
969
|
+
className: j("flex h-8 w-8 items-center justify-center rounded-md shrink-0", y),
|
|
970
970
|
children: C
|
|
971
971
|
})]
|
|
972
|
-
}), /* @__PURE__ */
|
|
972
|
+
}), /* @__PURE__ */ X(h, { children: o ? /* @__PURE__ */ Z("div", {
|
|
973
973
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
974
974
|
"data-testid": "metric-loading",
|
|
975
|
-
children: [/* @__PURE__ */
|
|
975
|
+
children: [/* @__PURE__ */ X(U, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ X("span", {
|
|
976
976
|
className: "text-sm",
|
|
977
977
|
children: "Loading…"
|
|
978
978
|
})]
|
|
979
|
-
}) : s ? /* @__PURE__ */
|
|
979
|
+
}) : s ? /* @__PURE__ */ Z("div", {
|
|
980
980
|
className: "flex items-center gap-2",
|
|
981
981
|
"data-testid": "metric-error",
|
|
982
982
|
role: "alert",
|
|
983
|
-
children: [/* @__PURE__ */
|
|
983
|
+
children: [/* @__PURE__ */ X(z, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ X("span", {
|
|
984
984
|
className: "text-xs text-destructive truncate",
|
|
985
985
|
children: s
|
|
986
986
|
})]
|
|
987
|
-
}) : /* @__PURE__ */
|
|
987
|
+
}) : /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("div", {
|
|
988
988
|
className: "text-2xl font-bold truncate",
|
|
989
989
|
children: S
|
|
990
|
-
}), (n || a) && /* @__PURE__ */
|
|
990
|
+
}), (n || a) && /* @__PURE__ */ Z("div", {
|
|
991
991
|
className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
|
|
992
|
-
children: [n && /* @__PURE__ */
|
|
993
|
-
className:
|
|
992
|
+
children: [n && /* @__PURE__ */ Z("span", {
|
|
993
|
+
className: j("flex items-center shrink-0 font-medium", n.direction === "up" && "text-emerald-600 dark:text-emerald-400", n.direction === "down" && "text-rose-600 dark:text-rose-400", n.direction === "neutral" && "text-muted-foreground"),
|
|
994
994
|
children: [
|
|
995
|
-
n.direction === "up" && /* @__PURE__ */
|
|
996
|
-
n.direction === "down" && /* @__PURE__ */
|
|
997
|
-
n.direction === "neutral" && /* @__PURE__ */
|
|
995
|
+
n.direction === "up" && /* @__PURE__ */ X(V, { className: "h-3 w-3 mr-1" }),
|
|
996
|
+
n.direction === "down" && /* @__PURE__ */ X(B, { className: "h-3 w-3 mr-1" }),
|
|
997
|
+
n.direction === "neutral" && /* @__PURE__ */ X(ae, { className: "h-3 w-3 mr-1" }),
|
|
998
998
|
n.value,
|
|
999
999
|
"%"
|
|
1000
1000
|
]
|
|
1001
|
-
}), /* @__PURE__ */
|
|
1001
|
+
}), /* @__PURE__ */ X("span", {
|
|
1002
1002
|
className: "truncate min-w-0",
|
|
1003
1003
|
children: x
|
|
1004
1004
|
})]
|
|
@@ -1007,82 +1007,82 @@ var Be = {
|
|
|
1007
1007
|
};
|
|
1008
1008
|
//#endregion
|
|
1009
1009
|
//#region src/MetricCard.tsx
|
|
1010
|
-
function
|
|
1010
|
+
function Ue(e) {
|
|
1011
1011
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
1012
1012
|
}
|
|
1013
|
-
var
|
|
1014
|
-
let u = n ?
|
|
1015
|
-
return /* @__PURE__ */
|
|
1016
|
-
className:
|
|
1013
|
+
var We = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
|
|
1014
|
+
let u = n ? M(n) : null;
|
|
1015
|
+
return /* @__PURE__ */ Z(m, {
|
|
1016
|
+
className: j("h-full", o),
|
|
1017
1017
|
...l,
|
|
1018
|
-
children: [/* @__PURE__ */
|
|
1018
|
+
children: [/* @__PURE__ */ Z(g, {
|
|
1019
1019
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
1020
|
-
children: [/* @__PURE__ */
|
|
1020
|
+
children: [/* @__PURE__ */ X(_, {
|
|
1021
1021
|
className: "text-sm font-medium",
|
|
1022
|
-
children:
|
|
1023
|
-
}), u && /* @__PURE__ */
|
|
1024
|
-
}), /* @__PURE__ */
|
|
1022
|
+
children: Ue(e)
|
|
1023
|
+
}), u && /* @__PURE__ */ X(u, { className: "h-4 w-4 text-muted-foreground" })]
|
|
1024
|
+
}), /* @__PURE__ */ X(h, { children: s ? /* @__PURE__ */ Z("div", {
|
|
1025
1025
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
1026
1026
|
"data-testid": "metric-card-loading",
|
|
1027
|
-
children: [/* @__PURE__ */
|
|
1027
|
+
children: [/* @__PURE__ */ X(U, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ X("span", {
|
|
1028
1028
|
className: "text-sm",
|
|
1029
1029
|
children: "Loading…"
|
|
1030
1030
|
})]
|
|
1031
|
-
}) : c ? /* @__PURE__ */
|
|
1031
|
+
}) : c ? /* @__PURE__ */ Z("div", {
|
|
1032
1032
|
className: "flex items-center gap-2",
|
|
1033
1033
|
"data-testid": "metric-card-error",
|
|
1034
1034
|
role: "alert",
|
|
1035
|
-
children: [/* @__PURE__ */
|
|
1035
|
+
children: [/* @__PURE__ */ X(z, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ X("span", {
|
|
1036
1036
|
className: "text-xs text-destructive truncate",
|
|
1037
1037
|
children: c
|
|
1038
1038
|
})]
|
|
1039
|
-
}) : /* @__PURE__ */
|
|
1039
|
+
}) : /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("div", {
|
|
1040
1040
|
className: "text-2xl font-bold",
|
|
1041
1041
|
children: t
|
|
1042
|
-
}), (r || i || a) && /* @__PURE__ */
|
|
1042
|
+
}), (r || i || a) && /* @__PURE__ */ Z("p", {
|
|
1043
1043
|
className: "text-xs text-muted-foreground flex items-center mt-1",
|
|
1044
|
-
children: [r && i && /* @__PURE__ */
|
|
1045
|
-
className:
|
|
1044
|
+
children: [r && i && /* @__PURE__ */ Z("span", {
|
|
1045
|
+
className: j("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
|
|
1046
1046
|
children: [
|
|
1047
|
-
r === "up" && /* @__PURE__ */
|
|
1048
|
-
r === "down" && /* @__PURE__ */
|
|
1049
|
-
r === "neutral" && /* @__PURE__ */
|
|
1047
|
+
r === "up" && /* @__PURE__ */ X(V, { className: "h-3 w-3 mr-1" }),
|
|
1048
|
+
r === "down" && /* @__PURE__ */ X(B, { className: "h-3 w-3 mr-1" }),
|
|
1049
|
+
r === "neutral" && /* @__PURE__ */ X(ae, { className: "h-3 w-3 mr-1" }),
|
|
1050
1050
|
i
|
|
1051
1051
|
]
|
|
1052
|
-
}),
|
|
1052
|
+
}), Ue(a)]
|
|
1053
1053
|
})] }) })]
|
|
1054
1054
|
});
|
|
1055
|
-
},
|
|
1056
|
-
let j = ne(s), M = m || j?.dataSource, [N,
|
|
1057
|
-
|
|
1055
|
+
}, Ge = ({ objectName: e, aggregate: t, filter: n, label: c, fallbackValue: l, trend: u, icon: d, className: f, description: p, dataSource: m, colorVariant: h, format: g, currency: _, prefix: v, suffix: y, invert: b, drillDown: T, title: A }) => {
|
|
1056
|
+
let j = ne(s), M = m || j?.dataSource, [N, P] = R(!1), [ee, te] = R(null), [re, z] = R(!1), [B, V] = R(null), [H, ie] = R(null);
|
|
1057
|
+
I(() => {
|
|
1058
1058
|
let t = !0;
|
|
1059
1059
|
if (!(!M || !e || typeof M.getObjectSchema != "function")) return M.getObjectSchema(e).then((e) => {
|
|
1060
|
-
t &&
|
|
1060
|
+
t && ie(e);
|
|
1061
1061
|
}).catch(() => {}), () => {
|
|
1062
1062
|
t = !1;
|
|
1063
1063
|
};
|
|
1064
1064
|
}, [M, e]);
|
|
1065
|
-
let
|
|
1065
|
+
let U = L(() => {
|
|
1066
1066
|
let e = t?.field;
|
|
1067
|
-
if (!e || !
|
|
1068
|
-
let n =
|
|
1067
|
+
if (!e || !H?.fields) return null;
|
|
1068
|
+
let n = H.fields;
|
|
1069
1069
|
return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
|
|
1070
|
-
}, [
|
|
1070
|
+
}, [H, t?.field]), ae = L(() => {
|
|
1071
1071
|
if (g) return g;
|
|
1072
|
-
if (
|
|
1073
|
-
if (
|
|
1074
|
-
let e =
|
|
1072
|
+
if (U) {
|
|
1073
|
+
if (U.type === "currency") {
|
|
1074
|
+
let e = U.precision ?? U.scale ?? 0;
|
|
1075
1075
|
return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
|
|
1076
1076
|
}
|
|
1077
|
-
if (
|
|
1078
|
-
if (
|
|
1077
|
+
if (U.type === "percent") return "0,0%";
|
|
1078
|
+
if (U.type === "number" || U.type === "integer") return "0,0";
|
|
1079
1079
|
}
|
|
1080
|
-
}, [g,
|
|
1080
|
+
}, [g, U]), oe = L(() => {
|
|
1081
1081
|
if (_) return _;
|
|
1082
|
-
if (
|
|
1083
|
-
}, [_,
|
|
1082
|
+
if (U?.type === "currency") return U.defaultCurrency || U.currency || void 0;
|
|
1083
|
+
}, [_, U]), se = L(() => t ? JSON.stringify(t) : "", [t]), W = L(() => i(n), [n]), ce = F(async (n, r) => {
|
|
1084
1084
|
if (!(!n || !e)) {
|
|
1085
|
-
r.current && (z(!0),
|
|
1085
|
+
r.current && (z(!0), V(null));
|
|
1086
1086
|
try {
|
|
1087
1087
|
let i;
|
|
1088
1088
|
if (t && typeof n.aggregate == "function") {
|
|
@@ -1097,21 +1097,21 @@ var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1097
1097
|
let t = await n.find(e, { $filter: W });
|
|
1098
1098
|
i = (Array.isArray(t) ? t : t?.data || t?.records || []).length;
|
|
1099
1099
|
} else return;
|
|
1100
|
-
r.current &&
|
|
1100
|
+
r.current && te(i);
|
|
1101
1101
|
} catch (e) {
|
|
1102
|
-
console.error("[ObjectMetricWidget] Fetch error:", e), r.current &&
|
|
1102
|
+
console.error("[ObjectMetricWidget] Fetch error:", e), r.current && V(e instanceof Error ? e.message : "Failed to load metric");
|
|
1103
1103
|
} finally {
|
|
1104
1104
|
r.current && z(!1);
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
}, [
|
|
1108
1108
|
e,
|
|
1109
|
-
|
|
1110
|
-
|
|
1109
|
+
se,
|
|
1110
|
+
L(() => W ? JSON.stringify(W) : "", [W])
|
|
1111
1111
|
]);
|
|
1112
|
-
|
|
1112
|
+
I(() => {
|
|
1113
1113
|
let t = { current: !0 };
|
|
1114
|
-
return M && e ? ce(M, t) : (
|
|
1114
|
+
return M && e ? ce(M, t) : (te(null), V(null)), () => {
|
|
1115
1115
|
t.current = !1;
|
|
1116
1116
|
};
|
|
1117
1117
|
}, [
|
|
@@ -1119,31 +1119,31 @@ var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1119
1119
|
e,
|
|
1120
1120
|
ce
|
|
1121
1121
|
]);
|
|
1122
|
-
let G =
|
|
1122
|
+
let G = ee === null ? M ? "—" : l ?? "—" : ee;
|
|
1123
1123
|
b && typeof G == "number" && isFinite(G) && G >= 0 && G <= 1 && (G = 1 - G);
|
|
1124
|
-
let
|
|
1124
|
+
let le = r(T) && !!e && !!M, K = L(() => {
|
|
1125
1125
|
let e = typeof c == "string" ? c : c?.defaultValue || "";
|
|
1126
|
-
return a(
|
|
1126
|
+
return a(T, {}, (typeof A == "string" ? A : A?.defaultValue || "") || e || "Details");
|
|
1127
1127
|
}, [
|
|
1128
|
-
|
|
1128
|
+
T,
|
|
1129
1129
|
c,
|
|
1130
1130
|
A
|
|
1131
|
-
]), ue =
|
|
1132
|
-
if (!
|
|
1133
|
-
let t =
|
|
1131
|
+
]), ue = L(() => {
|
|
1132
|
+
if (!le) return null;
|
|
1133
|
+
let t = T?.target ?? "drawer", n = T?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i;
|
|
1134
1134
|
if (r) {
|
|
1135
1135
|
let e = n.filter, t = e ? W ? { $and: [e, W] } : e : W;
|
|
1136
|
-
i = /* @__PURE__ */
|
|
1136
|
+
i = /* @__PURE__ */ X("div", {
|
|
1137
1137
|
className: "h-full overflow-auto",
|
|
1138
|
-
children: /* @__PURE__ */
|
|
1138
|
+
children: /* @__PURE__ */ X(o, { schema: {
|
|
1139
1139
|
type: "spec-report",
|
|
1140
1140
|
...n,
|
|
1141
1141
|
filter: t
|
|
1142
1142
|
} })
|
|
1143
1143
|
});
|
|
1144
|
-
} else i = /* @__PURE__ */
|
|
1144
|
+
} else i = /* @__PURE__ */ X("div", {
|
|
1145
1145
|
className: "h-full overflow-auto",
|
|
1146
|
-
children: /* @__PURE__ */
|
|
1146
|
+
children: /* @__PURE__ */ X(o, { schema: {
|
|
1147
1147
|
type: "object-data-table",
|
|
1148
1148
|
objectName: e,
|
|
1149
1149
|
filter: W,
|
|
@@ -1151,52 +1151,52 @@ var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1151
1151
|
drillDown: { enabled: !1 }
|
|
1152
1152
|
} })
|
|
1153
1153
|
});
|
|
1154
|
-
return t === "dialog" ? /* @__PURE__ */
|
|
1154
|
+
return t === "dialog" ? /* @__PURE__ */ X(x, {
|
|
1155
1155
|
open: !0,
|
|
1156
|
-
onOpenChange: (e) => !e &&
|
|
1157
|
-
children: /* @__PURE__ */
|
|
1156
|
+
onOpenChange: (e) => !e && P(!1),
|
|
1157
|
+
children: /* @__PURE__ */ Z(S, {
|
|
1158
1158
|
className: "max-w-5xl",
|
|
1159
|
-
children: [/* @__PURE__ */
|
|
1159
|
+
children: [/* @__PURE__ */ X(C, { children: /* @__PURE__ */ X(w, { children: K }) }), i]
|
|
1160
1160
|
})
|
|
1161
|
-
}) : /* @__PURE__ */
|
|
1161
|
+
}) : /* @__PURE__ */ X(E, {
|
|
1162
1162
|
open: !0,
|
|
1163
|
-
onOpenChange: (e) => !e &&
|
|
1164
|
-
children: /* @__PURE__ */
|
|
1163
|
+
onOpenChange: (e) => !e && P(!1),
|
|
1164
|
+
children: /* @__PURE__ */ Z(D, {
|
|
1165
1165
|
side: "right",
|
|
1166
1166
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
|
|
1167
|
-
children: [/* @__PURE__ */
|
|
1167
|
+
children: [/* @__PURE__ */ X(O, { children: /* @__PURE__ */ X(k, { children: K }) }), /* @__PURE__ */ X("div", {
|
|
1168
1168
|
className: "flex-1 overflow-hidden mt-2",
|
|
1169
1169
|
children: i
|
|
1170
1170
|
})]
|
|
1171
1171
|
})
|
|
1172
1172
|
});
|
|
1173
1173
|
}, [
|
|
1174
|
-
|
|
1175
|
-
|
|
1174
|
+
le,
|
|
1175
|
+
T,
|
|
1176
1176
|
e,
|
|
1177
1177
|
W,
|
|
1178
|
-
|
|
1178
|
+
K
|
|
1179
1179
|
]);
|
|
1180
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(He, {
|
|
1181
1181
|
label: c,
|
|
1182
1182
|
value: G,
|
|
1183
1183
|
trend: u,
|
|
1184
1184
|
icon: d,
|
|
1185
1185
|
className: f,
|
|
1186
1186
|
description: p,
|
|
1187
|
-
loading:
|
|
1188
|
-
error:
|
|
1187
|
+
loading: re,
|
|
1188
|
+
error: B,
|
|
1189
1189
|
colorVariant: h,
|
|
1190
|
-
format:
|
|
1191
|
-
currency:
|
|
1190
|
+
format: ae,
|
|
1191
|
+
currency: oe,
|
|
1192
1192
|
prefix: v,
|
|
1193
1193
|
suffix: y,
|
|
1194
|
-
onClick:
|
|
1194
|
+
onClick: le ? () => P(!0) : void 0
|
|
1195
1195
|
}), N && ue] });
|
|
1196
1196
|
};
|
|
1197
1197
|
//#endregion
|
|
1198
1198
|
//#region src/PivotTable.tsx
|
|
1199
|
-
function
|
|
1199
|
+
function Ke() {
|
|
1200
1200
|
try {
|
|
1201
1201
|
let { t: e } = ye(), t = e("dashboard.total");
|
|
1202
1202
|
return !t || t === "dashboard.total" ? "Total" : t;
|
|
@@ -1204,7 +1204,7 @@ function Ge() {
|
|
|
1204
1204
|
return "Total";
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
|
-
function
|
|
1207
|
+
function qe() {
|
|
1208
1208
|
try {
|
|
1209
1209
|
let { t: e } = ye(), t = e("dashboard.noDataAvailable");
|
|
1210
1210
|
return !t || t === "dashboard.noDataAvailable" ? "No data available" : t;
|
|
@@ -1212,7 +1212,7 @@ function Ke() {
|
|
|
1212
1212
|
return "No data available";
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
function
|
|
1215
|
+
function Je(e, t) {
|
|
1216
1216
|
if (!t) return String(e);
|
|
1217
1217
|
let n = "", r = "", i = !1, a, o = t, s = o.match(/^([^0-9.,#]*)/);
|
|
1218
1218
|
if (s && s[1]) {
|
|
@@ -1229,11 +1229,11 @@ function qe(e, t) {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
return n + l + r;
|
|
1231
1231
|
}
|
|
1232
|
-
var
|
|
1233
|
-
function Ye(e, t) {
|
|
1234
|
-
return e === "" ? Je : t?.[e] ?? e;
|
|
1235
|
-
}
|
|
1232
|
+
var Ye = "—";
|
|
1236
1233
|
function Xe(e, t) {
|
|
1234
|
+
return e === "" ? Ye : t?.[e] ?? e;
|
|
1235
|
+
}
|
|
1236
|
+
function Ze(e, t) {
|
|
1237
1237
|
if (e.length === 0) return 0;
|
|
1238
1238
|
switch (t) {
|
|
1239
1239
|
case "sum": return e.reduce((e, t) => e + t, 0);
|
|
@@ -1244,8 +1244,8 @@ function Xe(e, t) {
|
|
|
1244
1244
|
default: return e.reduce((e, t) => e + t, 0);
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
|
-
var
|
|
1248
|
-
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 =
|
|
1247
|
+
var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabel: a, onDrillDown: o }) => {
|
|
1248
|
+
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 = Ke(), y = qe(), b = r(_) && typeof o == "function", x = (e) => {
|
|
1249
1249
|
b && o({
|
|
1250
1250
|
...e,
|
|
1251
1251
|
rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
|
|
@@ -1253,7 +1253,7 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1253
1253
|
});
|
|
1254
1254
|
}, S = (e) => (t) => {
|
|
1255
1255
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
|
|
1256
|
-
}, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal:
|
|
1256
|
+
}, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = L(() => {
|
|
1257
1257
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
|
|
1258
1258
|
for (let r of w) {
|
|
1259
1259
|
let i = String(r[c] ?? ""), a = String(r[l] ?? ""), o = Number(r[u]) || 0;
|
|
@@ -1264,10 +1264,10 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1264
1264
|
a[e] = {};
|
|
1265
1265
|
let t = [];
|
|
1266
1266
|
for (let r of i) {
|
|
1267
|
-
let i = n[e]?.[r] ?? [], o =
|
|
1267
|
+
let i = n[e]?.[r] ?? [], o = Ze(i, d);
|
|
1268
1268
|
a[e][r] = o, t.push(...i), !s[r] && s[r];
|
|
1269
1269
|
}
|
|
1270
|
-
o[e] =
|
|
1270
|
+
o[e] = Ze(t, d);
|
|
1271
1271
|
}
|
|
1272
1272
|
for (let e of i) {
|
|
1273
1273
|
let t = [];
|
|
@@ -1275,7 +1275,7 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1275
1275
|
let r = n[i]?.[e] ?? [];
|
|
1276
1276
|
t.push(...r);
|
|
1277
1277
|
}
|
|
1278
|
-
s[e] =
|
|
1278
|
+
s[e] = Ze(t, d);
|
|
1279
1279
|
}
|
|
1280
1280
|
let f = [];
|
|
1281
1281
|
for (let e of w) f.push(Number(e[u]) || 0);
|
|
@@ -1285,7 +1285,7 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1285
1285
|
matrix: a,
|
|
1286
1286
|
rowTotals: o,
|
|
1287
1287
|
colTotals: s,
|
|
1288
|
-
grandTotal:
|
|
1288
|
+
grandTotal: Ze(f, d)
|
|
1289
1289
|
};
|
|
1290
1290
|
}, [
|
|
1291
1291
|
w,
|
|
@@ -1293,16 +1293,16 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1293
1293
|
l,
|
|
1294
1294
|
u,
|
|
1295
1295
|
d
|
|
1296
|
-
]), M = (e) =>
|
|
1297
|
-
return w.length === 0 ? /* @__PURE__ */
|
|
1298
|
-
className:
|
|
1299
|
-
children: [s && /* @__PURE__ */
|
|
1296
|
+
]), M = (e) => Je(e, h);
|
|
1297
|
+
return w.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1298
|
+
className: j("overflow-auto", t),
|
|
1299
|
+
children: [s && /* @__PURE__ */ X("h3", {
|
|
1300
1300
|
className: "text-sm font-semibold mb-2",
|
|
1301
1301
|
children: s
|
|
1302
|
-
}), /* @__PURE__ */
|
|
1302
|
+
}), /* @__PURE__ */ Z("div", {
|
|
1303
1303
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1304
1304
|
"data-testid": "pivot-empty-state",
|
|
1305
|
-
children: [/* @__PURE__ */
|
|
1305
|
+
children: [/* @__PURE__ */ Z("svg", {
|
|
1306
1306
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1307
1307
|
className: "h-8 w-8 mb-2 opacity-40",
|
|
1308
1308
|
viewBox: "0 0 24 24",
|
|
@@ -1312,49 +1312,49 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1312
1312
|
strokeLinecap: "round",
|
|
1313
1313
|
strokeLinejoin: "round",
|
|
1314
1314
|
children: [
|
|
1315
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ X("rect", {
|
|
1316
1316
|
x: "3",
|
|
1317
1317
|
y: "3",
|
|
1318
1318
|
width: "7",
|
|
1319
1319
|
height: "7"
|
|
1320
1320
|
}),
|
|
1321
|
-
/* @__PURE__ */
|
|
1321
|
+
/* @__PURE__ */ X("rect", {
|
|
1322
1322
|
x: "14",
|
|
1323
1323
|
y: "3",
|
|
1324
1324
|
width: "7",
|
|
1325
1325
|
height: "7"
|
|
1326
1326
|
}),
|
|
1327
|
-
/* @__PURE__ */
|
|
1327
|
+
/* @__PURE__ */ X("rect", {
|
|
1328
1328
|
x: "3",
|
|
1329
1329
|
y: "14",
|
|
1330
1330
|
width: "7",
|
|
1331
1331
|
height: "7"
|
|
1332
1332
|
}),
|
|
1333
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ X("rect", {
|
|
1334
1334
|
x: "14",
|
|
1335
1335
|
y: "14",
|
|
1336
1336
|
width: "7",
|
|
1337
1337
|
height: "7"
|
|
1338
1338
|
})
|
|
1339
1339
|
]
|
|
1340
|
-
}), /* @__PURE__ */
|
|
1340
|
+
}), /* @__PURE__ */ X("p", {
|
|
1341
1341
|
className: "text-xs",
|
|
1342
1342
|
children: y
|
|
1343
1343
|
})]
|
|
1344
1344
|
})]
|
|
1345
|
-
}) : /* @__PURE__ */
|
|
1346
|
-
className:
|
|
1347
|
-
children: [s && /* @__PURE__ */
|
|
1345
|
+
}) : /* @__PURE__ */ Z("div", {
|
|
1346
|
+
className: j("overflow-auto", t),
|
|
1347
|
+
children: [s && /* @__PURE__ */ X("h3", {
|
|
1348
1348
|
className: "text-sm font-semibold mb-2",
|
|
1349
1349
|
children: s
|
|
1350
|
-
}), /* @__PURE__ */
|
|
1350
|
+
}), /* @__PURE__ */ Z("table", {
|
|
1351
1351
|
className: "w-full text-sm border-collapse table-auto",
|
|
1352
1352
|
role: "table",
|
|
1353
1353
|
children: [
|
|
1354
|
-
/* @__PURE__ */
|
|
1354
|
+
/* @__PURE__ */ X("thead", { children: /* @__PURE__ */ Z("tr", {
|
|
1355
1355
|
className: "border-b border-border",
|
|
1356
1356
|
children: [
|
|
1357
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ X("th", {
|
|
1358
1358
|
className: "text-left p-2 font-medium text-muted-foreground whitespace-nowrap",
|
|
1359
1359
|
children: a || c
|
|
1360
1360
|
}),
|
|
@@ -1363,28 +1363,28 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1363
1363
|
scope: "column",
|
|
1364
1364
|
colKey: e
|
|
1365
1365
|
});
|
|
1366
|
-
return /* @__PURE__ */
|
|
1367
|
-
className:
|
|
1366
|
+
return /* @__PURE__ */ X("th", {
|
|
1367
|
+
className: j("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
|
|
1368
1368
|
title: e === "" ? `${l}: (empty)` : `${l}: ${e}`,
|
|
1369
1369
|
role: b ? "button" : void 0,
|
|
1370
1370
|
tabIndex: b ? 0 : void 0,
|
|
1371
1371
|
onClick: b ? t : void 0,
|
|
1372
1372
|
onKeyDown: b ? S(t) : void 0,
|
|
1373
1373
|
"aria-label": b ? `Drill into ${l}: ${e || "(empty)"}` : void 0,
|
|
1374
|
-
children:
|
|
1374
|
+
children: Xe(e, i)
|
|
1375
1375
|
}, e);
|
|
1376
1376
|
}),
|
|
1377
|
-
p && /* @__PURE__ */
|
|
1377
|
+
p && /* @__PURE__ */ X("th", {
|
|
1378
1378
|
className: "text-right p-2 font-semibold text-muted-foreground bg-muted/20 whitespace-nowrap",
|
|
1379
1379
|
children: v
|
|
1380
1380
|
})
|
|
1381
1381
|
]
|
|
1382
1382
|
}) }),
|
|
1383
|
-
/* @__PURE__ */
|
|
1383
|
+
/* @__PURE__ */ X("tbody", { children: T.map((e) => /* @__PURE__ */ Z("tr", {
|
|
1384
1384
|
className: "border-b border-border/50 hover:bg-muted/30",
|
|
1385
1385
|
children: [
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
className:
|
|
1386
|
+
/* @__PURE__ */ X("td", {
|
|
1387
|
+
className: j("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
|
|
1388
1388
|
role: b ? "button" : void 0,
|
|
1389
1389
|
tabIndex: b ? 0 : void 0,
|
|
1390
1390
|
onClick: b ? () => x({
|
|
@@ -1396,7 +1396,7 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1396
1396
|
rowKey: e
|
|
1397
1397
|
})) : void 0,
|
|
1398
1398
|
"aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
|
|
1399
|
-
children:
|
|
1399
|
+
children: Xe(e, n)
|
|
1400
1400
|
}),
|
|
1401
1401
|
E.map((t) => {
|
|
1402
1402
|
let n = D[e]?.[t] ?? 0, r = () => x({
|
|
@@ -1405,8 +1405,8 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1405
1405
|
colKey: t,
|
|
1406
1406
|
value: n
|
|
1407
1407
|
});
|
|
1408
|
-
return /* @__PURE__ */
|
|
1409
|
-
className:
|
|
1408
|
+
return /* @__PURE__ */ X("td", {
|
|
1409
|
+
className: j("text-right p-2 tabular-nums", g?.[t], C),
|
|
1410
1410
|
role: b ? "button" : void 0,
|
|
1411
1411
|
tabIndex: b ? 0 : void 0,
|
|
1412
1412
|
onClick: b ? r : void 0,
|
|
@@ -1415,8 +1415,8 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1415
1415
|
children: M(n)
|
|
1416
1416
|
}, t);
|
|
1417
1417
|
}),
|
|
1418
|
-
p && /* @__PURE__ */
|
|
1419
|
-
className:
|
|
1418
|
+
p && /* @__PURE__ */ X("td", {
|
|
1419
|
+
className: j("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
|
|
1420
1420
|
role: b ? "button" : void 0,
|
|
1421
1421
|
tabIndex: b ? 0 : void 0,
|
|
1422
1422
|
onClick: b ? () => x({
|
|
@@ -1433,15 +1433,15 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1433
1433
|
})
|
|
1434
1434
|
]
|
|
1435
1435
|
}, e)) }),
|
|
1436
|
-
m && /* @__PURE__ */
|
|
1436
|
+
m && /* @__PURE__ */ X("tfoot", { children: /* @__PURE__ */ Z("tr", {
|
|
1437
1437
|
className: "border-t-2 border-border font-semibold bg-muted/40",
|
|
1438
1438
|
children: [
|
|
1439
|
-
/* @__PURE__ */
|
|
1439
|
+
/* @__PURE__ */ X("td", {
|
|
1440
1440
|
className: "p-2",
|
|
1441
1441
|
children: v
|
|
1442
1442
|
}),
|
|
1443
|
-
E.map((e) => /* @__PURE__ */
|
|
1444
|
-
className:
|
|
1443
|
+
E.map((e) => /* @__PURE__ */ X("td", {
|
|
1444
|
+
className: j("text-right p-2 tabular-nums", C),
|
|
1445
1445
|
role: b ? "button" : void 0,
|
|
1446
1446
|
tabIndex: b ? 0 : void 0,
|
|
1447
1447
|
onClick: b ? () => x({
|
|
@@ -1456,19 +1456,19 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1456
1456
|
})) : void 0,
|
|
1457
1457
|
children: M(k[e] ?? 0)
|
|
1458
1458
|
}, e)),
|
|
1459
|
-
p && /* @__PURE__ */
|
|
1460
|
-
className:
|
|
1459
|
+
p && /* @__PURE__ */ X("td", {
|
|
1460
|
+
className: j("text-right p-2 tabular-nums font-bold", C),
|
|
1461
1461
|
role: b ? "button" : void 0,
|
|
1462
1462
|
tabIndex: b ? 0 : void 0,
|
|
1463
1463
|
onClick: b ? () => x({
|
|
1464
1464
|
scope: "total",
|
|
1465
|
-
value:
|
|
1465
|
+
value: A
|
|
1466
1466
|
}) : void 0,
|
|
1467
1467
|
onKeyDown: b ? S(() => x({
|
|
1468
1468
|
scope: "total",
|
|
1469
|
-
value:
|
|
1469
|
+
value: A
|
|
1470
1470
|
})) : void 0,
|
|
1471
|
-
children: M(
|
|
1471
|
+
children: M(A)
|
|
1472
1472
|
})
|
|
1473
1473
|
]
|
|
1474
1474
|
}) })
|
|
@@ -1478,13 +1478,13 @@ var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1478
1478
|
};
|
|
1479
1479
|
//#endregion
|
|
1480
1480
|
//#region src/ObjectDataTable.tsx
|
|
1481
|
-
function
|
|
1481
|
+
function $e(e) {
|
|
1482
1482
|
return e.map((e) => typeof e == "string" ? {
|
|
1483
1483
|
header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
|
|
1484
1484
|
accessorKey: e
|
|
1485
1485
|
} : e);
|
|
1486
1486
|
}
|
|
1487
|
-
function
|
|
1487
|
+
function et(e, t) {
|
|
1488
1488
|
if (!t?.fields) return [];
|
|
1489
1489
|
let n = {};
|
|
1490
1490
|
if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
|
|
@@ -1502,7 +1502,7 @@ function $e(e, t) {
|
|
|
1502
1502
|
} else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
|
|
1503
1503
|
return Array.from(a);
|
|
1504
1504
|
}
|
|
1505
|
-
var
|
|
1505
|
+
var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
1506
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";
|
|
1507
1507
|
try {
|
|
1508
1508
|
let { t: e } = ye(), t = e("dashboard.noDataAvailable");
|
|
@@ -1510,26 +1510,28 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1510
1510
|
let n = e("dashboard.noDataSourceFor");
|
|
1511
1511
|
n && n !== "dashboard.noDataSourceFor" && (m = n);
|
|
1512
1512
|
} catch {}
|
|
1513
|
-
let [h, g] =
|
|
1514
|
-
|
|
1513
|
+
let [h, g] = R([]), [_, v] = R(null), [y, b] = R(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [x, S] = R(null);
|
|
1514
|
+
I(() => {
|
|
1515
1515
|
let t = !0;
|
|
1516
|
-
return e.objectName && !u && (!e.data || e.data.length === 0)
|
|
1517
|
-
if (!
|
|
1518
|
-
t &&
|
|
1519
|
-
|
|
1520
|
-
let r;
|
|
1521
|
-
if (typeof c.find == "function") {
|
|
1522
|
-
let t = $e(e, _), a = { $filter: i(e.filter) };
|
|
1523
|
-
t.length && (a.$expand = t), r = n(await c.find(e.objectName, a));
|
|
1524
|
-
} else return;
|
|
1525
|
-
t && g(r);
|
|
1526
|
-
} catch (e) {
|
|
1527
|
-
console.error("[ObjectDataTable] Fetch error:", e), t && S(e instanceof Error ? e.message : "Failed to load data");
|
|
1528
|
-
} finally {
|
|
1529
|
-
t && b(!1);
|
|
1530
|
-
}
|
|
1516
|
+
return e.objectName && !u && (!e.data || e.data.length === 0) ? (async () => {
|
|
1517
|
+
if (!c || !e.objectName) {
|
|
1518
|
+
t && b(!1);
|
|
1519
|
+
return;
|
|
1531
1520
|
}
|
|
1532
|
-
|
|
1521
|
+
t && (b(!0), S(null));
|
|
1522
|
+
try {
|
|
1523
|
+
let r;
|
|
1524
|
+
if (typeof c.find == "function") {
|
|
1525
|
+
let t = et(e, _), a = { $filter: i(e.filter) };
|
|
1526
|
+
t.length && (a.$expand = t), r = n(await c.find(e.objectName, a));
|
|
1527
|
+
} else return;
|
|
1528
|
+
t && g(r);
|
|
1529
|
+
} catch (e) {
|
|
1530
|
+
console.error("[ObjectDataTable] Fetch error:", e), t && S(e instanceof Error ? e.message : "Failed to load data");
|
|
1531
|
+
} finally {
|
|
1532
|
+
t && b(!1);
|
|
1533
|
+
}
|
|
1534
|
+
})() : t && b(!1), () => {
|
|
1533
1535
|
t = !1;
|
|
1534
1536
|
};
|
|
1535
1537
|
}, [
|
|
@@ -1539,7 +1541,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1539
1541
|
e.data,
|
|
1540
1542
|
e.filter,
|
|
1541
1543
|
_
|
|
1542
|
-
]),
|
|
1544
|
+
]), I(() => {
|
|
1543
1545
|
let t = !0;
|
|
1544
1546
|
if (!(!c || !e.objectName || typeof c.getObjectSchema != "function")) return c.getObjectSchema(e.objectName).then((e) => {
|
|
1545
1547
|
t && v(e);
|
|
@@ -1547,7 +1549,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1547
1549
|
t = !1;
|
|
1548
1550
|
};
|
|
1549
1551
|
}, [e.objectName, c]);
|
|
1550
|
-
let C = u || e.data || h, w = Array.isArray(C) ? C : [],
|
|
1552
|
+
let C = u || e.data || h, w = Array.isArray(C) ? C : [], E = L(() => {
|
|
1551
1553
|
let t = e.objectName, n = {};
|
|
1552
1554
|
if (_?.fields) {
|
|
1553
1555
|
let e = _.fields;
|
|
@@ -1611,7 +1613,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1611
1613
|
let n = (t.match(/0\.(0+)%/) || [, ""])[1].length;
|
|
1612
1614
|
return Ce((e > 1 ? e / 100 : e) * 100, n);
|
|
1613
1615
|
}
|
|
1614
|
-
return typeof t == "string" && /[YMDHms]/.test(t) ? Se(e, t) : /* @__PURE__ */
|
|
1616
|
+
return typeof t == "string" && /[YMDHms]/.test(t) ? Se(e, t) : /* @__PURE__ */ X(we(Te(o)), {
|
|
1615
1617
|
value: e,
|
|
1616
1618
|
field: o
|
|
1617
1619
|
});
|
|
@@ -1624,7 +1626,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1624
1626
|
};
|
|
1625
1627
|
};
|
|
1626
1628
|
if (e.columns && e.columns.length > 0) {
|
|
1627
|
-
let n =
|
|
1629
|
+
let n = $e(e.columns);
|
|
1628
1630
|
return (t ? n.map((e) => ({
|
|
1629
1631
|
...e,
|
|
1630
1632
|
header: d(t, e.accessorKey, e.header)
|
|
@@ -1657,41 +1659,42 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1657
1659
|
d,
|
|
1658
1660
|
f
|
|
1659
1661
|
]);
|
|
1660
|
-
|
|
1661
|
-
className:
|
|
1662
|
+
if (y && w.length === 0) return /* @__PURE__ */ X("div", {
|
|
1663
|
+
className: j("overflow-auto", r),
|
|
1662
1664
|
"data-testid": "table-loading",
|
|
1663
|
-
children: /* @__PURE__ */
|
|
1665
|
+
children: /* @__PURE__ */ Z("div", {
|
|
1664
1666
|
className: "space-y-2 p-2",
|
|
1665
|
-
children: [/* @__PURE__ */
|
|
1667
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
1666
1668
|
className: "flex gap-2",
|
|
1667
1669
|
children: [
|
|
1668
|
-
/* @__PURE__ */
|
|
1669
|
-
/* @__PURE__ */
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1670
|
+
/* @__PURE__ */ X(A, { className: "h-6 w-1/4" }),
|
|
1671
|
+
/* @__PURE__ */ X(A, { className: "h-6 w-1/4" }),
|
|
1672
|
+
/* @__PURE__ */ X(A, { className: "h-6 w-1/4" }),
|
|
1673
|
+
/* @__PURE__ */ X(A, { className: "h-6 w-1/4" })
|
|
1672
1674
|
]
|
|
1673
1675
|
}), [
|
|
1674
1676
|
1,
|
|
1675
1677
|
2,
|
|
1676
1678
|
3,
|
|
1677
1679
|
4
|
|
1678
|
-
].map((e) => /* @__PURE__ */
|
|
1680
|
+
].map((e) => /* @__PURE__ */ Z("div", {
|
|
1679
1681
|
className: "flex gap-2",
|
|
1680
1682
|
children: [
|
|
1681
|
-
/* @__PURE__ */
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
1684
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ X(A, { className: "h-5 w-1/4" }),
|
|
1684
|
+
/* @__PURE__ */ X(A, { className: "h-5 w-1/4" }),
|
|
1685
|
+
/* @__PURE__ */ X(A, { className: "h-5 w-1/4" }),
|
|
1686
|
+
/* @__PURE__ */ X(A, { className: "h-5 w-1/4" })
|
|
1685
1687
|
]
|
|
1686
1688
|
}, e))]
|
|
1687
1689
|
})
|
|
1688
|
-
})
|
|
1689
|
-
|
|
1690
|
+
});
|
|
1691
|
+
if (x) return /* @__PURE__ */ X("div", {
|
|
1692
|
+
className: j("overflow-auto", r),
|
|
1690
1693
|
"data-testid": "table-error",
|
|
1691
|
-
children: /* @__PURE__ */
|
|
1694
|
+
children: /* @__PURE__ */ Z("div", {
|
|
1692
1695
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
1693
1696
|
"data-testid": "table-error-message",
|
|
1694
|
-
children: [/* @__PURE__ */
|
|
1697
|
+
children: [/* @__PURE__ */ Z("svg", {
|
|
1695
1698
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1696
1699
|
className: "h-8 w-8 mb-2 opacity-60",
|
|
1697
1700
|
viewBox: "0 0 24 24",
|
|
@@ -1701,34 +1704,35 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1701
1704
|
strokeLinecap: "round",
|
|
1702
1705
|
strokeLinejoin: "round",
|
|
1703
1706
|
children: [
|
|
1704
|
-
/* @__PURE__ */
|
|
1707
|
+
/* @__PURE__ */ X("circle", {
|
|
1705
1708
|
cx: "12",
|
|
1706
1709
|
cy: "12",
|
|
1707
1710
|
r: "10"
|
|
1708
1711
|
}),
|
|
1709
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ X("line", {
|
|
1710
1713
|
x1: "12",
|
|
1711
1714
|
y1: "8",
|
|
1712
1715
|
x2: "12",
|
|
1713
1716
|
y2: "12"
|
|
1714
1717
|
}),
|
|
1715
|
-
/* @__PURE__ */
|
|
1718
|
+
/* @__PURE__ */ X("line", {
|
|
1716
1719
|
x1: "12",
|
|
1717
1720
|
y1: "16",
|
|
1718
1721
|
x2: "12.01",
|
|
1719
1722
|
y2: "16"
|
|
1720
1723
|
})
|
|
1721
1724
|
]
|
|
1722
|
-
}), /* @__PURE__ */
|
|
1725
|
+
}), /* @__PURE__ */ X("p", {
|
|
1723
1726
|
className: "text-xs",
|
|
1724
1727
|
children: x
|
|
1725
1728
|
})]
|
|
1726
1729
|
})
|
|
1727
|
-
})
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
+
});
|
|
1731
|
+
if (!c && e.objectName && w.length === 0) return /* @__PURE__ */ X("div", {
|
|
1732
|
+
className: j("overflow-auto", r),
|
|
1733
|
+
children: /* @__PURE__ */ X("div", {
|
|
1730
1734
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1731
|
-
children: /* @__PURE__ */
|
|
1735
|
+
children: /* @__PURE__ */ Z("p", {
|
|
1732
1736
|
className: "text-xs",
|
|
1733
1737
|
children: [
|
|
1734
1738
|
m,
|
|
@@ -1738,12 +1742,13 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1738
1742
|
]
|
|
1739
1743
|
})
|
|
1740
1744
|
})
|
|
1741
|
-
})
|
|
1742
|
-
|
|
1745
|
+
});
|
|
1746
|
+
if (w.length === 0) return /* @__PURE__ */ X("div", {
|
|
1747
|
+
className: j("overflow-auto", r),
|
|
1743
1748
|
"data-testid": "table-empty-state",
|
|
1744
|
-
children: /* @__PURE__ */
|
|
1749
|
+
children: /* @__PURE__ */ Z("div", {
|
|
1745
1750
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1746
|
-
children: [/* @__PURE__ */
|
|
1751
|
+
children: [/* @__PURE__ */ Z("svg", {
|
|
1747
1752
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1748
1753
|
className: "h-8 w-8 mb-2 opacity-40",
|
|
1749
1754
|
viewBox: "0 0 24 24",
|
|
@@ -1753,7 +1758,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1753
1758
|
strokeLinecap: "round",
|
|
1754
1759
|
strokeLinejoin: "round",
|
|
1755
1760
|
children: [
|
|
1756
|
-
/* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ X("rect", {
|
|
1757
1762
|
x: "3",
|
|
1758
1763
|
y: "3",
|
|
1759
1764
|
width: "18",
|
|
@@ -1761,40 +1766,45 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1761
1766
|
rx: "2",
|
|
1762
1767
|
ry: "2"
|
|
1763
1768
|
}),
|
|
1764
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ X("line", {
|
|
1765
1770
|
x1: "3",
|
|
1766
1771
|
y1: "9",
|
|
1767
1772
|
x2: "21",
|
|
1768
1773
|
y2: "9"
|
|
1769
1774
|
}),
|
|
1770
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ X("line", {
|
|
1771
1776
|
x1: "9",
|
|
1772
1777
|
y1: "21",
|
|
1773
1778
|
x2: "9",
|
|
1774
1779
|
y2: "9"
|
|
1775
1780
|
})
|
|
1776
1781
|
]
|
|
1777
|
-
}), /* @__PURE__ */
|
|
1782
|
+
}), /* @__PURE__ */ X("p", {
|
|
1778
1783
|
className: "text-xs",
|
|
1779
1784
|
children: p
|
|
1780
1785
|
})]
|
|
1781
1786
|
})
|
|
1782
|
-
}) : /* @__PURE__ */ Y(o, {
|
|
1783
|
-
schema: {
|
|
1784
|
-
...e,
|
|
1785
|
-
type: "data-table",
|
|
1786
|
-
data: w,
|
|
1787
|
-
columns: T
|
|
1788
|
-
},
|
|
1789
|
-
className: r
|
|
1790
1787
|
});
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1788
|
+
let D = {
|
|
1789
|
+
...e,
|
|
1790
|
+
type: "data-table",
|
|
1791
|
+
data: w,
|
|
1792
|
+
columns: E
|
|
1793
|
+
};
|
|
1794
|
+
return /* @__PURE__ */ Z("div", {
|
|
1795
|
+
className: j("relative", r),
|
|
1796
|
+
children: [/* @__PURE__ */ X(T, { active: y && w.length > 0 }), /* @__PURE__ */ X(o, {
|
|
1797
|
+
schema: D,
|
|
1798
|
+
className: r
|
|
1799
|
+
})]
|
|
1800
|
+
});
|
|
1801
|
+
}, nt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: s, columns: c, maxRows: l, className: u, report: d }) => {
|
|
1802
|
+
let f = d && typeof d == "object" && (Array.isArray(d.columns) || "objectName" in d), p = /* @__PURE__ */ X("div", {
|
|
1803
|
+
className: j("overflow-auto", u),
|
|
1794
1804
|
"data-testid": "drill-down-body",
|
|
1795
1805
|
children: f ? (() => {
|
|
1796
1806
|
let e = d.filter, t = e ? a ? { $and: [e, a] } : e : a;
|
|
1797
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ X(o, { schema: {
|
|
1798
1808
|
...d,
|
|
1799
1809
|
type: "spec-report",
|
|
1800
1810
|
report: {
|
|
@@ -1803,7 +1813,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1803
1813
|
},
|
|
1804
1814
|
filter: t
|
|
1805
1815
|
} });
|
|
1806
|
-
})() : /* @__PURE__ */
|
|
1816
|
+
})() : /* @__PURE__ */ X(tt, {
|
|
1807
1817
|
schema: {
|
|
1808
1818
|
type: "object-data-table",
|
|
1809
1819
|
objectName: i,
|
|
@@ -1819,30 +1829,30 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1819
1829
|
dataSource: s
|
|
1820
1830
|
})
|
|
1821
1831
|
});
|
|
1822
|
-
return r === "dialog" ? /* @__PURE__ */
|
|
1832
|
+
return r === "dialog" ? /* @__PURE__ */ X(x, {
|
|
1823
1833
|
open: e,
|
|
1824
1834
|
onOpenChange: (e) => !e && t(),
|
|
1825
|
-
children: /* @__PURE__ */
|
|
1835
|
+
children: /* @__PURE__ */ Z(S, {
|
|
1826
1836
|
className: "max-w-5xl",
|
|
1827
|
-
children: [/* @__PURE__ */
|
|
1837
|
+
children: [/* @__PURE__ */ X(C, { children: /* @__PURE__ */ X(w, { children: n }) }), p]
|
|
1828
1838
|
})
|
|
1829
|
-
}) : /* @__PURE__ */
|
|
1839
|
+
}) : /* @__PURE__ */ X(E, {
|
|
1830
1840
|
open: e,
|
|
1831
1841
|
onOpenChange: (e) => !e && t(),
|
|
1832
|
-
children: /* @__PURE__ */
|
|
1842
|
+
children: /* @__PURE__ */ Z(D, {
|
|
1833
1843
|
side: "right",
|
|
1834
1844
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1835
|
-
children: [/* @__PURE__ */
|
|
1845
|
+
children: [/* @__PURE__ */ X(O, { children: /* @__PURE__ */ X(k, { children: n }) }), /* @__PURE__ */ X("div", {
|
|
1836
1846
|
className: "flex-1 overflow-hidden mt-2",
|
|
1837
1847
|
children: p
|
|
1838
1848
|
})]
|
|
1839
1849
|
})
|
|
1840
1850
|
});
|
|
1841
|
-
},
|
|
1842
|
-
let u = ne(s), d = o || u?.dataSource, f = l(e.bind), [p, m] =
|
|
1843
|
-
|
|
1851
|
+
}, rt = ({ schema: e, dataSource: o, className: c }) => {
|
|
1852
|
+
let u = ne(s), d = o || u?.dataSource, f = l(e.bind), [p, m] = R([]), [h, g] = R(!1), [_, v] = R(null), [y, b] = R({}), [x, S] = R({}), [C, w] = R(null), { fieldLabel: T, fieldOptionLabel: E } = be(), D = re(T), O = re(E);
|
|
1853
|
+
I(() => {
|
|
1844
1854
|
D.current = T, O.current = E;
|
|
1845
|
-
}, [T, E]),
|
|
1855
|
+
}, [T, E]), I(() => {
|
|
1846
1856
|
if (!d || !e.objectName) return;
|
|
1847
1857
|
let t = d.getObjectSchema;
|
|
1848
1858
|
if (typeof t != "function") return;
|
|
@@ -1867,7 +1877,7 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1867
1877
|
}).catch(() => {}), () => {
|
|
1868
1878
|
n = !1;
|
|
1869
1879
|
};
|
|
1870
|
-
}, [d, e.objectName]),
|
|
1880
|
+
}, [d, e.objectName]), I(() => {
|
|
1871
1881
|
let t = !0;
|
|
1872
1882
|
return e.objectName && !f && (!e.data || e.data.length === 0) && (async () => {
|
|
1873
1883
|
if (!(!d || !e.objectName)) {
|
|
@@ -1893,48 +1903,48 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1893
1903
|
e.data,
|
|
1894
1904
|
e.filter
|
|
1895
1905
|
]);
|
|
1896
|
-
let
|
|
1897
|
-
if (h && M.length === 0) return /* @__PURE__ */
|
|
1898
|
-
className:
|
|
1906
|
+
let k = f || e.data || p, M = Array.isArray(k) ? k : [];
|
|
1907
|
+
if (h && M.length === 0) return /* @__PURE__ */ Z("div", {
|
|
1908
|
+
className: j("overflow-auto", c),
|
|
1899
1909
|
"data-testid": "pivot-loading",
|
|
1900
|
-
children: [e.title && /* @__PURE__ */
|
|
1910
|
+
children: [e.title && /* @__PURE__ */ X("h3", {
|
|
1901
1911
|
className: "text-sm font-semibold mb-2",
|
|
1902
1912
|
children: e.title
|
|
1903
|
-
}), /* @__PURE__ */
|
|
1913
|
+
}), /* @__PURE__ */ Z("div", {
|
|
1904
1914
|
className: "space-y-2 p-2",
|
|
1905
|
-
children: [/* @__PURE__ */
|
|
1915
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
1906
1916
|
className: "flex gap-2",
|
|
1907
1917
|
children: [
|
|
1908
|
-
/* @__PURE__ */
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
1911
|
-
/* @__PURE__ */
|
|
1918
|
+
/* @__PURE__ */ X(A, { className: "h-6 w-24" }),
|
|
1919
|
+
/* @__PURE__ */ X(A, { className: "h-6 w-20" }),
|
|
1920
|
+
/* @__PURE__ */ X(A, { className: "h-6 w-20" }),
|
|
1921
|
+
/* @__PURE__ */ X(A, { className: "h-6 w-20" })
|
|
1912
1922
|
]
|
|
1913
1923
|
}), [
|
|
1914
1924
|
1,
|
|
1915
1925
|
2,
|
|
1916
1926
|
3
|
|
1917
|
-
].map((e) => /* @__PURE__ */
|
|
1927
|
+
].map((e) => /* @__PURE__ */ Z("div", {
|
|
1918
1928
|
className: "flex gap-2",
|
|
1919
1929
|
children: [
|
|
1920
|
-
/* @__PURE__ */
|
|
1921
|
-
/* @__PURE__ */
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ X(A, { className: "h-5 w-24" }),
|
|
1931
|
+
/* @__PURE__ */ X(A, { className: "h-5 w-20" }),
|
|
1932
|
+
/* @__PURE__ */ X(A, { className: "h-5 w-20" }),
|
|
1933
|
+
/* @__PURE__ */ X(A, { className: "h-5 w-20" })
|
|
1924
1934
|
]
|
|
1925
1935
|
}, e))]
|
|
1926
1936
|
})]
|
|
1927
1937
|
});
|
|
1928
|
-
if (_) return /* @__PURE__ */
|
|
1929
|
-
className:
|
|
1938
|
+
if (_) return /* @__PURE__ */ Z("div", {
|
|
1939
|
+
className: j("overflow-auto", c),
|
|
1930
1940
|
"data-testid": "pivot-error",
|
|
1931
|
-
children: [e.title && /* @__PURE__ */
|
|
1941
|
+
children: [e.title && /* @__PURE__ */ X("h3", {
|
|
1932
1942
|
className: "text-sm font-semibold mb-2",
|
|
1933
1943
|
children: e.title
|
|
1934
|
-
}), /* @__PURE__ */
|
|
1944
|
+
}), /* @__PURE__ */ Z("div", {
|
|
1935
1945
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
1936
1946
|
"data-testid": "pivot-error-message",
|
|
1937
|
-
children: [/* @__PURE__ */
|
|
1947
|
+
children: [/* @__PURE__ */ Z("svg", {
|
|
1938
1948
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1939
1949
|
className: "h-8 w-8 mb-2 opacity-60",
|
|
1940
1950
|
viewBox: "0 0 24 24",
|
|
@@ -1944,38 +1954,38 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1944
1954
|
strokeLinecap: "round",
|
|
1945
1955
|
strokeLinejoin: "round",
|
|
1946
1956
|
children: [
|
|
1947
|
-
/* @__PURE__ */
|
|
1957
|
+
/* @__PURE__ */ X("circle", {
|
|
1948
1958
|
cx: "12",
|
|
1949
1959
|
cy: "12",
|
|
1950
1960
|
r: "10"
|
|
1951
1961
|
}),
|
|
1952
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ X("line", {
|
|
1953
1963
|
x1: "12",
|
|
1954
1964
|
y1: "8",
|
|
1955
1965
|
x2: "12",
|
|
1956
1966
|
y2: "12"
|
|
1957
1967
|
}),
|
|
1958
|
-
/* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ X("line", {
|
|
1959
1969
|
x1: "12",
|
|
1960
1970
|
y1: "16",
|
|
1961
1971
|
x2: "12.01",
|
|
1962
1972
|
y2: "16"
|
|
1963
1973
|
})
|
|
1964
1974
|
]
|
|
1965
|
-
}), /* @__PURE__ */
|
|
1975
|
+
}), /* @__PURE__ */ X("p", {
|
|
1966
1976
|
className: "text-xs",
|
|
1967
1977
|
children: _
|
|
1968
1978
|
})]
|
|
1969
1979
|
})]
|
|
1970
1980
|
});
|
|
1971
|
-
if (!d && e.objectName && M.length === 0) return /* @__PURE__ */
|
|
1972
|
-
className:
|
|
1973
|
-
children: [e.title && /* @__PURE__ */
|
|
1981
|
+
if (!d && e.objectName && M.length === 0) return /* @__PURE__ */ Z("div", {
|
|
1982
|
+
className: j("overflow-auto", c),
|
|
1983
|
+
children: [e.title && /* @__PURE__ */ X("h3", {
|
|
1974
1984
|
className: "text-sm font-semibold mb-2",
|
|
1975
1985
|
children: e.title
|
|
1976
|
-
}), /* @__PURE__ */
|
|
1986
|
+
}), /* @__PURE__ */ X("div", {
|
|
1977
1987
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1978
|
-
children: /* @__PURE__ */
|
|
1988
|
+
children: /* @__PURE__ */ Z("p", {
|
|
1979
1989
|
className: "text-xs",
|
|
1980
1990
|
children: [
|
|
1981
1991
|
"No data source available for “",
|
|
@@ -1988,37 +1998,37 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1988
1998
|
let N = {
|
|
1989
1999
|
...e,
|
|
1990
2000
|
data: M
|
|
1991
|
-
},
|
|
1992
|
-
return /* @__PURE__ */
|
|
2001
|
+
}, P = e.rowField ? y[e.rowField] : void 0, ee = e.columnField ? y[e.columnField] : void 0, te = e.rowField ? x[e.rowField] : void 0, F = e.drillDown;
|
|
2002
|
+
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(Qe, {
|
|
1993
2003
|
schema: N,
|
|
1994
2004
|
className: c,
|
|
1995
|
-
rowLabels:
|
|
1996
|
-
columnLabels:
|
|
1997
|
-
rowFieldLabel:
|
|
1998
|
-
onDrillDown: r(
|
|
2005
|
+
rowLabels: P,
|
|
2006
|
+
columnLabels: ee,
|
|
2007
|
+
rowFieldLabel: te,
|
|
2008
|
+
onDrillDown: r(F) ? (e) => w(e) : void 0
|
|
1999
2009
|
}), (() => {
|
|
2000
2010
|
if (!C || !e.objectName) return null;
|
|
2001
|
-
let n = t(
|
|
2011
|
+
let n = t(F, C, {
|
|
2002
2012
|
rowField: e.rowField,
|
|
2003
2013
|
columnField: e.columnField
|
|
2004
2014
|
}), r = {
|
|
2005
2015
|
...e.filter || {},
|
|
2006
2016
|
...n
|
|
2007
2017
|
};
|
|
2008
|
-
return /* @__PURE__ */
|
|
2018
|
+
return /* @__PURE__ */ X(nt, {
|
|
2009
2019
|
open: !0,
|
|
2010
2020
|
onClose: () => w(null),
|
|
2011
|
-
title: a(
|
|
2012
|
-
target:
|
|
2021
|
+
title: a(F, C, e.title || "Details"),
|
|
2022
|
+
target: F?.target ?? "drawer",
|
|
2013
2023
|
objectName: e.objectName,
|
|
2014
2024
|
filter: r,
|
|
2015
2025
|
dataSource: d,
|
|
2016
|
-
columns:
|
|
2017
|
-
maxRows:
|
|
2018
|
-
report:
|
|
2026
|
+
columns: F?.columns,
|
|
2027
|
+
maxRows: F?.maxRows,
|
|
2028
|
+
report: F?.report
|
|
2019
2029
|
});
|
|
2020
2030
|
})()] });
|
|
2021
|
-
},
|
|
2031
|
+
}, it = {
|
|
2022
2032
|
breadcrumb: ["Dashboard", "Configuration"],
|
|
2023
2033
|
sections: [
|
|
2024
2034
|
{
|
|
@@ -2144,12 +2154,12 @@ var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
2144
2154
|
}
|
|
2145
2155
|
]
|
|
2146
2156
|
};
|
|
2147
|
-
function
|
|
2148
|
-
let { draft: a, isDirty: o, updateField: s, discard: c } =
|
|
2149
|
-
return /* @__PURE__ */
|
|
2157
|
+
function at({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
2158
|
+
let { draft: a, isDirty: o, updateField: s, discard: c } = N(n, { onUpdate: i });
|
|
2159
|
+
return /* @__PURE__ */ X(y, {
|
|
2150
2160
|
open: e,
|
|
2151
2161
|
onClose: t,
|
|
2152
|
-
schema:
|
|
2162
|
+
schema: it,
|
|
2153
2163
|
draft: a,
|
|
2154
2164
|
isDirty: o,
|
|
2155
2165
|
onFieldChange: s,
|
|
@@ -2159,7 +2169,7 @@ function it({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
|
2159
2169
|
}
|
|
2160
2170
|
//#endregion
|
|
2161
2171
|
//#region src/WidgetConfigPanel.tsx
|
|
2162
|
-
var
|
|
2172
|
+
var ot = [
|
|
2163
2173
|
{
|
|
2164
2174
|
value: "metric",
|
|
2165
2175
|
label: "Metric"
|
|
@@ -2204,7 +2214,7 @@ var at = [
|
|
|
2204
2214
|
value: "pivot",
|
|
2205
2215
|
label: "Pivot Table"
|
|
2206
2216
|
}
|
|
2207
|
-
],
|
|
2217
|
+
], st = [
|
|
2208
2218
|
{
|
|
2209
2219
|
value: "default",
|
|
2210
2220
|
label: "Default"
|
|
@@ -2237,7 +2247,7 @@ var at = [
|
|
|
2237
2247
|
value: "danger",
|
|
2238
2248
|
label: "Danger"
|
|
2239
2249
|
}
|
|
2240
|
-
],
|
|
2250
|
+
], ct = [
|
|
2241
2251
|
{
|
|
2242
2252
|
value: "count",
|
|
2243
2253
|
label: "Count"
|
|
@@ -2258,7 +2268,7 @@ var at = [
|
|
|
2258
2268
|
value: "max",
|
|
2259
2269
|
label: "Max"
|
|
2260
2270
|
}
|
|
2261
|
-
],
|
|
2271
|
+
], lt = [
|
|
2262
2272
|
"bar",
|
|
2263
2273
|
"horizontal-bar",
|
|
2264
2274
|
"line",
|
|
@@ -2267,17 +2277,17 @@ var at = [
|
|
|
2267
2277
|
"donut",
|
|
2268
2278
|
"scatter",
|
|
2269
2279
|
"funnel"
|
|
2270
|
-
],
|
|
2280
|
+
], ut = [
|
|
2271
2281
|
"bar",
|
|
2272
2282
|
"horizontal-bar",
|
|
2273
2283
|
"line",
|
|
2274
2284
|
"area",
|
|
2275
2285
|
"scatter"
|
|
2276
|
-
],
|
|
2286
|
+
], dt = [
|
|
2277
2287
|
"pie",
|
|
2278
2288
|
"donut",
|
|
2279
2289
|
"funnel"
|
|
2280
|
-
],
|
|
2290
|
+
], ft = ["metric", ...lt], pt = [...lt], mt = [
|
|
2281
2291
|
"pivot",
|
|
2282
2292
|
"metric",
|
|
2283
2293
|
"bar",
|
|
@@ -2288,50 +2298,50 @@ var at = [
|
|
|
2288
2298
|
"donut",
|
|
2289
2299
|
"funnel"
|
|
2290
2300
|
];
|
|
2291
|
-
function mt(e) {
|
|
2292
|
-
return !!e && ct.includes(e);
|
|
2293
|
-
}
|
|
2294
2301
|
function ht(e) {
|
|
2295
2302
|
return !!e && lt.includes(e);
|
|
2296
2303
|
}
|
|
2297
2304
|
function gt(e) {
|
|
2298
|
-
return !!e &&
|
|
2305
|
+
return !!e && ut.includes(e);
|
|
2299
2306
|
}
|
|
2300
2307
|
function _t(e) {
|
|
2301
|
-
return !!e &&
|
|
2308
|
+
return !!e && pt.includes(e);
|
|
2302
2309
|
}
|
|
2303
2310
|
function vt(e) {
|
|
2304
|
-
return !!e &&
|
|
2311
|
+
return !!e && ft.includes(e);
|
|
2312
|
+
}
|
|
2313
|
+
function yt(e) {
|
|
2314
|
+
return !!e && mt.includes(e);
|
|
2305
2315
|
}
|
|
2306
|
-
var
|
|
2316
|
+
var bt = [{
|
|
2307
2317
|
value: "drawer",
|
|
2308
2318
|
label: "Side drawer"
|
|
2309
2319
|
}, {
|
|
2310
2320
|
value: "dialog",
|
|
2311
2321
|
label: "Center dialog"
|
|
2312
|
-
}],
|
|
2322
|
+
}], xt = [{
|
|
2313
2323
|
value: "group",
|
|
2314
2324
|
label: "Group"
|
|
2315
2325
|
}, {
|
|
2316
2326
|
value: "value",
|
|
2317
2327
|
label: "Value"
|
|
2318
|
-
}],
|
|
2328
|
+
}], St = [{
|
|
2319
2329
|
value: "asc",
|
|
2320
2330
|
label: "↑"
|
|
2321
2331
|
}, {
|
|
2322
2332
|
value: "desc",
|
|
2323
2333
|
label: "↓"
|
|
2324
2334
|
}];
|
|
2325
|
-
function
|
|
2335
|
+
function Ct(e, t, n, r) {
|
|
2326
2336
|
return {
|
|
2327
2337
|
key: e,
|
|
2328
2338
|
label: t,
|
|
2329
2339
|
type: "custom",
|
|
2330
|
-
render: (i, a, o) => /* @__PURE__ */
|
|
2340
|
+
render: (i, a, o) => /* @__PURE__ */ X(b, {
|
|
2331
2341
|
label: t,
|
|
2332
|
-
children: /* @__PURE__ */
|
|
2342
|
+
children: /* @__PURE__ */ X("div", {
|
|
2333
2343
|
"data-testid": `config-field-${e}`,
|
|
2334
|
-
children: /* @__PURE__ */
|
|
2344
|
+
children: /* @__PURE__ */ X(v, {
|
|
2335
2345
|
options: r ?? [],
|
|
2336
2346
|
value: i ?? "",
|
|
2337
2347
|
onValueChange: a,
|
|
@@ -2345,16 +2355,16 @@ function St(e, t, n, r) {
|
|
|
2345
2355
|
})
|
|
2346
2356
|
};
|
|
2347
2357
|
}
|
|
2348
|
-
function
|
|
2358
|
+
function wt(e, t, n) {
|
|
2349
2359
|
let r = e && e.length > 0, i = r ? {
|
|
2350
2360
|
key: "object",
|
|
2351
2361
|
label: "Data source",
|
|
2352
2362
|
type: "custom",
|
|
2353
|
-
render: (t, n) => /* @__PURE__ */
|
|
2363
|
+
render: (t, n) => /* @__PURE__ */ X(b, {
|
|
2354
2364
|
label: "Data source",
|
|
2355
|
-
children: /* @__PURE__ */
|
|
2365
|
+
children: /* @__PURE__ */ X("div", {
|
|
2356
2366
|
"data-testid": "config-field-object",
|
|
2357
|
-
children: /* @__PURE__ */
|
|
2367
|
+
children: /* @__PURE__ */ X(v, {
|
|
2358
2368
|
options: e,
|
|
2359
2369
|
value: t ?? "",
|
|
2360
2370
|
onValueChange: n,
|
|
@@ -2371,38 +2381,38 @@ function Ct(e, t, n) {
|
|
|
2371
2381
|
type: "input",
|
|
2372
2382
|
placeholder: "Object name"
|
|
2373
2383
|
}, a = r ? {
|
|
2374
|
-
...
|
|
2384
|
+
...Ct("categoryField", "Category field", "Select field…", t),
|
|
2375
2385
|
helpText: "Group records by this field (one bar/slice/segment per value).",
|
|
2376
|
-
visibleWhen: (e) =>
|
|
2386
|
+
visibleWhen: (e) => _t(e.type)
|
|
2377
2387
|
} : {
|
|
2378
2388
|
key: "categoryField",
|
|
2379
2389
|
label: "Category field",
|
|
2380
2390
|
type: "input",
|
|
2381
2391
|
placeholder: "e.g. status",
|
|
2382
2392
|
helpText: "Group records by this field (one bar/slice/segment per value).",
|
|
2383
|
-
visibleWhen: (e) =>
|
|
2393
|
+
visibleWhen: (e) => _t(e.type)
|
|
2384
2394
|
}, o = r ? {
|
|
2385
|
-
...
|
|
2395
|
+
...Ct("valueField", "Value field", "Select field…", t),
|
|
2386
2396
|
helpText: "Field to aggregate (sum / average / min / max).",
|
|
2387
|
-
visibleWhen: (e) =>
|
|
2397
|
+
visibleWhen: (e) => vt(e.type) && (e.aggregate ?? "count") !== "count"
|
|
2388
2398
|
} : {
|
|
2389
2399
|
key: "valueField",
|
|
2390
2400
|
label: "Value field",
|
|
2391
2401
|
type: "input",
|
|
2392
2402
|
placeholder: "e.g. amount",
|
|
2393
2403
|
helpText: "Field to aggregate (sum / average / min / max).",
|
|
2394
|
-
visibleWhen: (e) =>
|
|
2395
|
-
}, s = r ?
|
|
2404
|
+
visibleWhen: (e) => vt(e.type) && (e.aggregate ?? "count") !== "count"
|
|
2405
|
+
}, s = r ? Ct("rowField", "Field", "Select row field…", t) : {
|
|
2396
2406
|
key: "rowField",
|
|
2397
2407
|
label: "Field",
|
|
2398
2408
|
type: "input",
|
|
2399
2409
|
placeholder: "e.g. owner"
|
|
2400
|
-
}, c = r ?
|
|
2410
|
+
}, c = r ? Ct("columnField", "Field", "Select column field…", t) : {
|
|
2401
2411
|
key: "columnField",
|
|
2402
2412
|
label: "Field",
|
|
2403
2413
|
type: "input",
|
|
2404
2414
|
placeholder: "e.g. stage"
|
|
2405
|
-
}, l = r ?
|
|
2415
|
+
}, l = r ? Ct("valueField", "Field", "Select value field…", t) : {
|
|
2406
2416
|
key: "valueField",
|
|
2407
2417
|
label: "Field",
|
|
2408
2418
|
type: "input",
|
|
@@ -2412,7 +2422,7 @@ function Ct(e, t, n) {
|
|
|
2412
2422
|
breadcrumb: ["Dashboard", {
|
|
2413
2423
|
pivot: "Pivot table",
|
|
2414
2424
|
table: "Table"
|
|
2415
|
-
}[n ?? ""] ?? (
|
|
2425
|
+
}[n ?? ""] ?? (ht(n) ? "Chart" : "Widget")],
|
|
2416
2426
|
sections: [
|
|
2417
2427
|
{
|
|
2418
2428
|
key: "general",
|
|
@@ -2434,7 +2444,7 @@ function Ct(e, t, n) {
|
|
|
2434
2444
|
key: "type",
|
|
2435
2445
|
label: "Widget type",
|
|
2436
2446
|
type: "select",
|
|
2437
|
-
options:
|
|
2447
|
+
options: ot,
|
|
2438
2448
|
defaultValue: "metric"
|
|
2439
2449
|
}
|
|
2440
2450
|
]
|
|
@@ -2452,10 +2462,10 @@ function Ct(e, t, n) {
|
|
|
2452
2462
|
key: "aggregate",
|
|
2453
2463
|
label: "Aggregation",
|
|
2454
2464
|
type: "select",
|
|
2455
|
-
options:
|
|
2465
|
+
options: ct,
|
|
2456
2466
|
defaultValue: "count",
|
|
2457
2467
|
helpText: "Count ignores Value field; Sum / Avg / Min / Max require it.",
|
|
2458
|
-
visibleWhen: (e) =>
|
|
2468
|
+
visibleWhen: (e) => vt(e.type)
|
|
2459
2469
|
}
|
|
2460
2470
|
]
|
|
2461
2471
|
},
|
|
@@ -2477,14 +2487,14 @@ function Ct(e, t, n) {
|
|
|
2477
2487
|
key: "rowSortBy",
|
|
2478
2488
|
label: "Sort by",
|
|
2479
2489
|
type: "icon-group",
|
|
2480
|
-
options:
|
|
2490
|
+
options: xt,
|
|
2481
2491
|
defaultValue: "group"
|
|
2482
2492
|
},
|
|
2483
2493
|
{
|
|
2484
2494
|
key: "rowSortOrder",
|
|
2485
2495
|
label: "Sort order",
|
|
2486
2496
|
type: "icon-group",
|
|
2487
|
-
options:
|
|
2497
|
+
options: St,
|
|
2488
2498
|
defaultValue: "asc"
|
|
2489
2499
|
},
|
|
2490
2500
|
{
|
|
@@ -2512,14 +2522,14 @@ function Ct(e, t, n) {
|
|
|
2512
2522
|
key: "columnSortBy",
|
|
2513
2523
|
label: "Sort by",
|
|
2514
2524
|
type: "icon-group",
|
|
2515
|
-
options:
|
|
2525
|
+
options: xt,
|
|
2516
2526
|
defaultValue: "group"
|
|
2517
2527
|
},
|
|
2518
2528
|
{
|
|
2519
2529
|
key: "columnSortOrder",
|
|
2520
2530
|
label: "Sort order",
|
|
2521
2531
|
type: "icon-group",
|
|
2522
|
-
options:
|
|
2532
|
+
options: St,
|
|
2523
2533
|
defaultValue: "asc"
|
|
2524
2534
|
},
|
|
2525
2535
|
{
|
|
@@ -2547,7 +2557,7 @@ function Ct(e, t, n) {
|
|
|
2547
2557
|
key: "aggregation",
|
|
2548
2558
|
label: "Aggregation",
|
|
2549
2559
|
type: "select",
|
|
2550
|
-
options:
|
|
2560
|
+
options: ct,
|
|
2551
2561
|
defaultValue: "sum"
|
|
2552
2562
|
},
|
|
2553
2563
|
{
|
|
@@ -2562,7 +2572,7 @@ function Ct(e, t, n) {
|
|
|
2562
2572
|
key: "chart-axis",
|
|
2563
2573
|
title: "Axis & Series",
|
|
2564
2574
|
collapsible: !0,
|
|
2565
|
-
visibleWhen: (e) =>
|
|
2575
|
+
visibleWhen: (e) => gt(e.type),
|
|
2566
2576
|
fields: [
|
|
2567
2577
|
{
|
|
2568
2578
|
key: "xAxisLabel",
|
|
@@ -2588,7 +2598,7 @@ function Ct(e, t, n) {
|
|
|
2588
2598
|
key: "chart-legend",
|
|
2589
2599
|
title: "Display",
|
|
2590
2600
|
collapsible: !0,
|
|
2591
|
-
visibleWhen: (e) => !!e.type &&
|
|
2601
|
+
visibleWhen: (e) => !!e.type && dt.includes(e.type),
|
|
2592
2602
|
fields: [{
|
|
2593
2603
|
key: "showLegend",
|
|
2594
2604
|
label: "Show legend",
|
|
@@ -2640,7 +2650,7 @@ function Ct(e, t, n) {
|
|
|
2640
2650
|
title: "Drill-down",
|
|
2641
2651
|
collapsible: !0,
|
|
2642
2652
|
defaultCollapsed: !0,
|
|
2643
|
-
visibleWhen: (e) =>
|
|
2653
|
+
visibleWhen: (e) => yt(e.type),
|
|
2644
2654
|
fields: [{
|
|
2645
2655
|
key: "drillDownEnabled",
|
|
2646
2656
|
label: "Enable drill-down",
|
|
@@ -2651,7 +2661,7 @@ function Ct(e, t, n) {
|
|
|
2651
2661
|
key: "drillDownTarget",
|
|
2652
2662
|
label: "Open in",
|
|
2653
2663
|
type: "select",
|
|
2654
|
-
options:
|
|
2664
|
+
options: bt,
|
|
2655
2665
|
defaultValue: "drawer",
|
|
2656
2666
|
visibleWhen: (e) => !!e.drillDownEnabled
|
|
2657
2667
|
}]
|
|
@@ -2677,14 +2687,14 @@ function Ct(e, t, n) {
|
|
|
2677
2687
|
key: "colorVariant",
|
|
2678
2688
|
label: "Color variant",
|
|
2679
2689
|
type: "select",
|
|
2680
|
-
options:
|
|
2690
|
+
options: st,
|
|
2681
2691
|
defaultValue: "default"
|
|
2682
2692
|
}]
|
|
2683
2693
|
}
|
|
2684
2694
|
]
|
|
2685
2695
|
};
|
|
2686
2696
|
}
|
|
2687
|
-
function
|
|
2697
|
+
function Tt(e) {
|
|
2688
2698
|
if (e == null) return "";
|
|
2689
2699
|
if (typeof e == "string") return e;
|
|
2690
2700
|
if (typeof e == "object") {
|
|
@@ -2693,20 +2703,20 @@ function wt(e) {
|
|
|
2693
2703
|
}
|
|
2694
2704
|
return String(e);
|
|
2695
2705
|
}
|
|
2696
|
-
function
|
|
2706
|
+
function Et(e) {
|
|
2697
2707
|
let t = e.type, n = { ...e };
|
|
2698
|
-
return
|
|
2708
|
+
return _t(t) || delete n.categoryField, vt(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), gt(t) || (delete n.xAxisLabel, delete n.yAxisLabel), t === "pivot" ? (delete n.aggregate, delete n.categoryField) : (delete n.rowField, delete n.columnField, delete n.aggregation, delete n.rowSortBy, delete n.rowSortOrder, delete n.columnSortBy, delete n.columnSortOrder, delete n.showRowLabels, delete n.showRowTotals, delete n.showColumnLabels, delete n.showColumnTotals, delete n.format), t !== "table" && (delete n.searchable, delete n.pagination), yt(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
|
|
2699
2709
|
}
|
|
2700
|
-
function
|
|
2701
|
-
let { draft: c, isDirty: l, updateField: u, discard: d } =
|
|
2710
|
+
function Dt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
|
|
2711
|
+
let { draft: c, isDirty: l, updateField: u, discard: d } = N(P.useMemo(() => ({
|
|
2702
2712
|
...n,
|
|
2703
|
-
title: typeof n.title == "object" ?
|
|
2704
|
-
description: typeof n.description == "object" ?
|
|
2713
|
+
title: typeof n.title == "object" ? Tt(n.title) : n.title,
|
|
2714
|
+
description: typeof n.description == "object" ? Tt(n.description) : n.description
|
|
2705
2715
|
}), [n]), { onUpdate: i });
|
|
2706
|
-
return /* @__PURE__ */
|
|
2716
|
+
return /* @__PURE__ */ X(y, {
|
|
2707
2717
|
open: e,
|
|
2708
2718
|
onClose: t,
|
|
2709
|
-
schema:
|
|
2719
|
+
schema: P.useMemo(() => wt(o, s, c.type), [
|
|
2710
2720
|
o,
|
|
2711
2721
|
s,
|
|
2712
2722
|
c.type
|
|
@@ -2714,19 +2724,19 @@ function Et({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
|
|
|
2714
2724
|
draft: c,
|
|
2715
2725
|
isDirty: l,
|
|
2716
2726
|
onFieldChange: u,
|
|
2717
|
-
onSave: () => r(
|
|
2727
|
+
onSave: () => r(Et(c)),
|
|
2718
2728
|
onDiscard: d,
|
|
2719
2729
|
headerExtra: a
|
|
2720
2730
|
});
|
|
2721
2731
|
}
|
|
2722
2732
|
//#endregion
|
|
2723
2733
|
//#region src/DashboardWithConfig.tsx
|
|
2724
|
-
function
|
|
2725
|
-
let [c, l] =
|
|
2726
|
-
|
|
2734
|
+
function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
|
|
2735
|
+
let [c, l] = R(o), [u, d] = R(null), [f, m] = R(e), [h, g] = R(0);
|
|
2736
|
+
I(() => {
|
|
2727
2737
|
m(e), g((e) => e + 1);
|
|
2728
2738
|
}, [e]);
|
|
2729
|
-
let _ =
|
|
2739
|
+
let _ = P.useMemo(() => {
|
|
2730
2740
|
if (!u || !f.widgets) return null;
|
|
2731
2741
|
let e = f.widgets.find((e) => (e.id || e.title) === u);
|
|
2732
2742
|
if (!e) return null;
|
|
@@ -2748,11 +2758,11 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2748
2758
|
layoutW: e.layout?.w ?? 1,
|
|
2749
2759
|
layoutH: e.layout?.h ?? 1
|
|
2750
2760
|
};
|
|
2751
|
-
}, [u, h]), v =
|
|
2761
|
+
}, [u, h]), v = F((e) => {
|
|
2752
2762
|
d(e), l(!0);
|
|
2753
|
-
}, []), y =
|
|
2763
|
+
}, []), y = F(() => {
|
|
2754
2764
|
d(null);
|
|
2755
|
-
}, []), b =
|
|
2765
|
+
}, []), b = F((e, t) => {
|
|
2756
2766
|
u && m((n) => n.widgets ? {
|
|
2757
2767
|
...n,
|
|
2758
2768
|
widgets: n.widgets.map((n) => {
|
|
@@ -2793,7 +2803,7 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2793
2803
|
};
|
|
2794
2804
|
})
|
|
2795
2805
|
} : n);
|
|
2796
|
-
}, [u]), x =
|
|
2806
|
+
}, [u]), x = F((e) => {
|
|
2797
2807
|
if (u && r) {
|
|
2798
2808
|
let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
|
|
2799
2809
|
(t || n) && (a.options = {
|
|
@@ -2806,24 +2816,24 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2806
2816
|
}), r(u, a);
|
|
2807
2817
|
}
|
|
2808
2818
|
d(null), g((e) => e + 1);
|
|
2809
|
-
}, [u, r]), S =
|
|
2819
|
+
}, [u, r]), S = F(() => {
|
|
2810
2820
|
l((e) => !e), d(null);
|
|
2811
2821
|
}, []);
|
|
2812
|
-
return /* @__PURE__ */
|
|
2813
|
-
className:
|
|
2822
|
+
return /* @__PURE__ */ Z("div", {
|
|
2823
|
+
className: j("flex h-full w-full", s),
|
|
2814
2824
|
"data-testid": "dashboard-with-config",
|
|
2815
|
-
children: [/* @__PURE__ */
|
|
2825
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
2816
2826
|
className: "flex-1 min-w-0 overflow-auto relative",
|
|
2817
|
-
children: [/* @__PURE__ */
|
|
2827
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2818
2828
|
className: "absolute top-2 right-2 z-10",
|
|
2819
|
-
children: /* @__PURE__ */
|
|
2829
|
+
children: /* @__PURE__ */ Z(p, {
|
|
2820
2830
|
size: "sm",
|
|
2821
2831
|
variant: c ? "default" : "outline",
|
|
2822
2832
|
onClick: S,
|
|
2823
2833
|
"data-testid": "dashboard-config-toggle",
|
|
2824
|
-
children: [/* @__PURE__ */
|
|
2834
|
+
children: [/* @__PURE__ */ X(W, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
|
|
2825
2835
|
})
|
|
2826
|
-
}), /* @__PURE__ */
|
|
2836
|
+
}), /* @__PURE__ */ X(je, {
|
|
2827
2837
|
schema: f,
|
|
2828
2838
|
onRefresh: i,
|
|
2829
2839
|
recordCount: a,
|
|
@@ -2831,15 +2841,15 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2831
2841
|
selectedWidgetId: u,
|
|
2832
2842
|
onWidgetClick: v
|
|
2833
2843
|
})]
|
|
2834
|
-
}), c && /* @__PURE__ */
|
|
2844
|
+
}), c && /* @__PURE__ */ X("div", {
|
|
2835
2845
|
className: "relative shrink-0",
|
|
2836
|
-
children: u && _ ? /* @__PURE__ */
|
|
2846
|
+
children: u && _ ? /* @__PURE__ */ X(Dt, {
|
|
2837
2847
|
open: !0,
|
|
2838
2848
|
onClose: y,
|
|
2839
2849
|
config: _,
|
|
2840
2850
|
onSave: x,
|
|
2841
2851
|
onFieldChange: b
|
|
2842
|
-
}) : /* @__PURE__ */
|
|
2852
|
+
}) : /* @__PURE__ */ X(at, {
|
|
2843
2853
|
open: !0,
|
|
2844
2854
|
onClose: () => l(!1),
|
|
2845
2855
|
config: t,
|
|
@@ -2848,7 +2858,7 @@ function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2848
2858
|
})]
|
|
2849
2859
|
});
|
|
2850
2860
|
}
|
|
2851
|
-
e.register("dashboard",
|
|
2861
|
+
e.register("dashboard", je, {
|
|
2852
2862
|
namespace: "view",
|
|
2853
2863
|
label: "Dashboard",
|
|
2854
2864
|
category: "Complex",
|
|
@@ -2876,7 +2886,7 @@ e.register("dashboard", $, {
|
|
|
2876
2886
|
columns: 3,
|
|
2877
2887
|
widgets: []
|
|
2878
2888
|
}
|
|
2879
|
-
}), e.register("metric",
|
|
2889
|
+
}), e.register("metric", He, {
|
|
2880
2890
|
namespace: "plugin-dashboard",
|
|
2881
2891
|
label: "Metric Widget",
|
|
2882
2892
|
category: "Dashboard",
|
|
@@ -2889,7 +2899,7 @@ e.register("dashboard", $, {
|
|
|
2889
2899
|
type: "string",
|
|
2890
2900
|
label: "Value"
|
|
2891
2901
|
}]
|
|
2892
|
-
}), e.register("metric-card",
|
|
2902
|
+
}), e.register("metric-card", We, {
|
|
2893
2903
|
namespace: "plugin-dashboard",
|
|
2894
2904
|
label: "Metric Card",
|
|
2895
2905
|
category: "Dashboard",
|
|
@@ -2944,7 +2954,7 @@ e.register("dashboard", $, {
|
|
|
2944
2954
|
title: "Metric",
|
|
2945
2955
|
value: "0"
|
|
2946
2956
|
}
|
|
2947
|
-
}), e.register("object-metric",
|
|
2957
|
+
}), e.register("object-metric", Ge, {
|
|
2948
2958
|
namespace: "plugin-dashboard",
|
|
2949
2959
|
label: "Object Metric",
|
|
2950
2960
|
category: "Dashboard",
|
|
@@ -2973,7 +2983,7 @@ e.register("dashboard", $, {
|
|
|
2973
2983
|
}
|
|
2974
2984
|
],
|
|
2975
2985
|
defaultProps: { label: "Metric" }
|
|
2976
|
-
}), e.register("pivot",
|
|
2986
|
+
}), e.register("pivot", Qe, {
|
|
2977
2987
|
namespace: "plugin-dashboard",
|
|
2978
2988
|
label: "Pivot Table",
|
|
2979
2989
|
category: "Dashboard",
|
|
@@ -3052,7 +3062,7 @@ e.register("dashboard", $, {
|
|
|
3052
3062
|
aggregation: "sum",
|
|
3053
3063
|
data: []
|
|
3054
3064
|
}
|
|
3055
|
-
}), e.register("object-pivot",
|
|
3065
|
+
}), e.register("object-pivot", rt, {
|
|
3056
3066
|
namespace: "plugin-dashboard",
|
|
3057
3067
|
label: "Object Pivot Table",
|
|
3058
3068
|
category: "Dashboard",
|
|
@@ -3141,7 +3151,7 @@ e.register("dashboard", $, {
|
|
|
3141
3151
|
valueField: "",
|
|
3142
3152
|
aggregation: "sum"
|
|
3143
3153
|
}
|
|
3144
|
-
}), e.register("dashboard-grid",
|
|
3154
|
+
}), e.register("dashboard-grid", Ie, {
|
|
3145
3155
|
namespace: "plugin-dashboard",
|
|
3146
3156
|
label: "Dashboard Grid (Editable)",
|
|
3147
3157
|
category: "Complex",
|
|
@@ -3159,7 +3169,7 @@ e.register("dashboard", $, {
|
|
|
3159
3169
|
title: "Dashboard",
|
|
3160
3170
|
widgets: []
|
|
3161
3171
|
}
|
|
3162
|
-
}), e.register("object-data-table",
|
|
3172
|
+
}), e.register("object-data-table", tt, {
|
|
3163
3173
|
namespace: "plugin-dashboard",
|
|
3164
3174
|
label: "Object Data Table",
|
|
3165
3175
|
category: "Dashboard",
|
|
@@ -3197,18 +3207,18 @@ e.register("dashboard", $, {
|
|
|
3197
3207
|
pagination: !1
|
|
3198
3208
|
}
|
|
3199
3209
|
});
|
|
3200
|
-
var
|
|
3201
|
-
DashboardRenderer:
|
|
3202
|
-
DashboardGridLayout:
|
|
3203
|
-
MetricWidget:
|
|
3204
|
-
MetricCard:
|
|
3205
|
-
ObjectMetricWidget:
|
|
3206
|
-
PivotTable:
|
|
3207
|
-
ObjectPivotTable:
|
|
3208
|
-
ObjectDataTable:
|
|
3209
|
-
DashboardConfigPanel:
|
|
3210
|
-
WidgetConfigPanel:
|
|
3211
|
-
DashboardWithConfig:
|
|
3210
|
+
var kt = {
|
|
3211
|
+
DashboardRenderer: je,
|
|
3212
|
+
DashboardGridLayout: Ie,
|
|
3213
|
+
MetricWidget: He,
|
|
3214
|
+
MetricCard: We,
|
|
3215
|
+
ObjectMetricWidget: Ge,
|
|
3216
|
+
PivotTable: Qe,
|
|
3217
|
+
ObjectPivotTable: rt,
|
|
3218
|
+
ObjectDataTable: tt,
|
|
3219
|
+
DashboardConfigPanel: at,
|
|
3220
|
+
WidgetConfigPanel: Dt,
|
|
3221
|
+
DashboardWithConfig: Ot
|
|
3212
3222
|
};
|
|
3213
3223
|
//#endregion
|
|
3214
|
-
export {
|
|
3224
|
+
export { at as DashboardConfigPanel, Ie as DashboardGridLayout, je as DashboardRenderer, Ot as DashboardWithConfig, nt as DrillDownDrawer, We as MetricCard, He as MetricWidget, tt as ObjectDataTable, Ge as ObjectMetricWidget, rt as ObjectPivotTable, Qe as PivotTable, Dt as WidgetConfigPanel, kt as dashboardComponents };
|