@object-ui/plugin-dashboard 5.1.1 → 5.3.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 +97 -0
- package/dist/index.js +399 -399
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-dashboard/src/PivotTable.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
3
|
import { createSafeTranslation as p, useObjectTranslation as m, useSafeFieldLabel as h } from "@object-ui/i18n";
|
|
4
|
-
import { Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Combobox as x, ConfigPanelRenderer as S, ConfigRow as C,
|
|
4
|
+
import { Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Combobox as x, ConfigPanelRenderer as S, ConfigRow as C, DataEmptyState as w, Dialog as T, DialogContent as E, DialogHeader as D, DialogTitle as O, RefreshIndicator as k, Sheet as A, SheetContent as j, SheetHeader as M, SheetTitle as ee, Skeleton as N, cn as P, getLazyIcon as F, useConfigDraft as te } from "@object-ui/components";
|
|
5
5
|
import * as I from "react";
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { AlertCircle as
|
|
8
|
-
import { DndContext as
|
|
9
|
-
import { SortableContext as
|
|
10
|
-
import { CSS as
|
|
6
|
+
import { Fragment as ne, forwardRef as L, useCallback as R, useContext as re, useEffect as z, useMemo as B, useRef as ie, useState as V } from "react";
|
|
7
|
+
import { AlertCircle as ae, ArrowDownIcon as H, ArrowUpIcon as U, Edit as oe, GripVertical as W, Loader2 as G, MinusIcon as K, RefreshCw as q, Save as se, Settings as ce, X as J } from "lucide-react";
|
|
8
|
+
import { DndContext as le, PointerSensor as ue, closestCenter as de, useSensor as fe, useSensors as pe } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as me, arrayMove as he, rectSortingStrategy as ge, useSortable as Y, verticalListSortingStrategy as _e } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as ve } from "@dnd-kit/utilities";
|
|
11
11
|
import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
12
|
-
import { ResponsiveGridLayout as
|
|
12
|
+
import { ResponsiveGridLayout as ye, useContainerWidth as be } from "react-grid-layout";
|
|
13
13
|
import "react-grid-layout/css/styles.css";
|
|
14
|
-
import { formatCurrency as
|
|
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
16
|
function $(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
|
-
function
|
|
22
|
-
let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } =
|
|
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 } = Y({
|
|
23
23
|
id: e,
|
|
24
24
|
disabled: t
|
|
25
25
|
});
|
|
26
26
|
return /* @__PURE__ */ Z("div", {
|
|
27
27
|
ref: s,
|
|
28
28
|
style: {
|
|
29
|
-
transform:
|
|
29
|
+
transform: ve.Transform.toString(c),
|
|
30
30
|
transition: l,
|
|
31
31
|
opacity: u ? .4 : 1,
|
|
32
32
|
...n ? {
|
|
@@ -34,26 +34,26 @@ function Te({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
|
34
34
|
gridRow: `span ${n.h}`
|
|
35
35
|
} : {}
|
|
36
36
|
},
|
|
37
|
-
className:
|
|
37
|
+
className: P("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,
|
|
41
41
|
children: i
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function Ee(e) {
|
|
45
|
-
return e ? P(e) : null;
|
|
46
|
-
}
|
|
47
44
|
function De(e) {
|
|
45
|
+
return e ? F(e) : null;
|
|
46
|
+
}
|
|
47
|
+
function Oe(e) {
|
|
48
48
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
49
49
|
}
|
|
50
|
-
var
|
|
50
|
+
var ke = [
|
|
51
51
|
"hsl(var(--chart-1))",
|
|
52
52
|
"hsl(var(--chart-2))",
|
|
53
53
|
"hsl(var(--chart-3))",
|
|
54
54
|
"hsl(var(--chart-4))",
|
|
55
55
|
"hsl(var(--chart-5))"
|
|
56
|
-
],
|
|
56
|
+
], Ae = new Set([
|
|
57
57
|
"bar",
|
|
58
58
|
"horizontal-bar",
|
|
59
59
|
"line",
|
|
@@ -62,10 +62,10 @@ var Oe = [
|
|
|
62
62
|
"donut",
|
|
63
63
|
"funnel"
|
|
64
64
|
]);
|
|
65
|
-
function
|
|
66
|
-
return
|
|
65
|
+
function je(e) {
|
|
66
|
+
return Ae.has(e) ? { enabled: !0 } : void 0;
|
|
67
67
|
}
|
|
68
|
-
var
|
|
68
|
+
var Me = L(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: s, selectedWidgetId: l, onWidgetClick: u, onWidgetsReorder: d, modalHandler: p, scriptHandlers: h, hideHeaderText: x, ...S }, C) => {
|
|
69
69
|
let w = (() => {
|
|
70
70
|
if (e.columns != null) return e.columns;
|
|
71
71
|
let t = e.widgets ?? [], n = 0;
|
|
@@ -74,44 +74,44 @@ var je = 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
|
-
})(), T = w, E = e.gap || 4, [D, O] =
|
|
77
|
+
})(), T = w, E = e.gap || 4, [D, O] = V(!1), [k, A] = V(!1), j = ie(null), { executeAction: M, engine: ee } = c({ actions: B(() => (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
|
-
}, [
|
|
82
|
+
})), [e.header?.actions]) }), { dashboardLabel: N, dashboardDescription: F, dashboardActionLabel: te, widgetTitle: I, widgetDescription: L, fieldLabel: re } = f(), { t: ae } = m(), H = R((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? ae(`report.aggregate.${n}`, { defaultValue: n }) : e ? re(e, t, t) : t, [ae, re]), U = e.name, oe = R((e) => U ? te(U, e.actionUrl || e.label, e.label) : e.label, [U, te]), W = R((e) => {
|
|
83
|
+
let t = Oe(e.title);
|
|
84
|
+
return !U || !e.id || t === void 0 ? t : I(U, e.id, t);
|
|
85
|
+
}, [U, I]), G = R((e) => {
|
|
86
|
+
let t = Oe(e.description);
|
|
87
|
+
return !U || !e.id ? t : L(U, e.id, t);
|
|
88
|
+
}, [U, L]);
|
|
89
89
|
z(() => {
|
|
90
|
-
let e =
|
|
90
|
+
let e = ee.getRunner();
|
|
91
91
|
if (p && e.setModalHandler(p), h) for (let [t, n] of Object.entries(h)) e.registerScript(t, n);
|
|
92
92
|
}, [
|
|
93
|
-
|
|
93
|
+
ee,
|
|
94
94
|
p,
|
|
95
95
|
h
|
|
96
96
|
]), z(() => {
|
|
97
97
|
let e = () => A(window.innerWidth < 768);
|
|
98
98
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
99
99
|
}, []);
|
|
100
|
-
let
|
|
100
|
+
let K = R(() => {
|
|
101
101
|
r && (O(!0), r(), setTimeout(() => O(!1), 600));
|
|
102
102
|
}, [r]);
|
|
103
103
|
z(() => {
|
|
104
|
-
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return j.current = setInterval(
|
|
104
|
+
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return j.current = setInterval(K, e.refreshInterval * 1e3), () => {
|
|
105
105
|
j.current && clearInterval(j.current);
|
|
106
106
|
};
|
|
107
107
|
}, [
|
|
108
108
|
e.refreshInterval,
|
|
109
109
|
r,
|
|
110
|
-
|
|
110
|
+
K
|
|
111
111
|
]);
|
|
112
|
-
let
|
|
112
|
+
let se = R((e, t) => {
|
|
113
113
|
!s || !u || !t || (e.stopPropagation(), u(t));
|
|
114
|
-
}, [s, u]),
|
|
114
|
+
}, [s, u]), ce = R((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,14 +128,14 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
128
128
|
s,
|
|
129
129
|
u,
|
|
130
130
|
e.widgets
|
|
131
|
-
]),
|
|
131
|
+
]), J = R((e) => {
|
|
132
132
|
!s || !u || e.target === e.currentTarget && u(null);
|
|
133
|
-
}, [s, u]), Y = !!(s && d),
|
|
133
|
+
}, [s, u]), Y = !!(s && d), ve = pe(fe(ue, { activationConstraint: { distance: 5 } })), X = R((t) => {
|
|
134
134
|
if (!Y) 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?.(he(i, a, o));
|
|
139
139
|
}, [
|
|
140
140
|
Y,
|
|
141
141
|
e.widgets,
|
|
@@ -162,7 +162,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
162
162
|
objectName: e.object || ($(t) ? t.object : void 0),
|
|
163
163
|
aggregate: r,
|
|
164
164
|
filter: ($(t) ? t.filter : void 0) || e.filter,
|
|
165
|
-
label: n.label ||
|
|
165
|
+
label: n.label || W(e) || "",
|
|
166
166
|
fallbackValue: n.value,
|
|
167
167
|
trend: n.trend,
|
|
168
168
|
icon: n.icon,
|
|
@@ -173,7 +173,7 @@ var je = 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 || W(e) || ""
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
if ((t === "gauge" || t === "solid-gauge") && e.object) {
|
|
@@ -187,7 +187,7 @@ var je = 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 || W(e) || "",
|
|
191
191
|
fallbackValue: n.fallbackValue ?? n.value,
|
|
192
192
|
icon: n.icon,
|
|
193
193
|
description: n.description,
|
|
@@ -216,10 +216,10 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
216
216
|
xAxisKey: i,
|
|
217
217
|
series: [{
|
|
218
218
|
dataKey: c,
|
|
219
|
-
label:
|
|
219
|
+
label: H(l, c, s?.function)
|
|
220
220
|
}],
|
|
221
|
-
colors:
|
|
222
|
-
drillDown: n.drillDown ??
|
|
221
|
+
colors: ke,
|
|
222
|
+
drillDown: n.drillDown ?? je(r),
|
|
223
223
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
224
224
|
};
|
|
225
225
|
}
|
|
@@ -237,10 +237,10 @@ var je = 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: H(e.object, a, e.aggregate)
|
|
241
241
|
}],
|
|
242
|
-
colors:
|
|
243
|
-
drillDown: n.drillDown ??
|
|
242
|
+
colors: ke,
|
|
243
|
+
drillDown: n.drillDown ?? je(r),
|
|
244
244
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
245
245
|
};
|
|
246
246
|
}
|
|
@@ -251,9 +251,9 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
251
251
|
xAxisKey: i,
|
|
252
252
|
series: [{
|
|
253
253
|
dataKey: a,
|
|
254
|
-
label:
|
|
254
|
+
label: H(e.object, a, e.aggregate)
|
|
255
255
|
}],
|
|
256
|
-
colors:
|
|
256
|
+
colors: ke,
|
|
257
257
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
258
258
|
};
|
|
259
259
|
}
|
|
@@ -368,25 +368,25 @@ var je = 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 = W(e), d = G(e), f = e.id || u || `widget-${t}`, p = s && l === e.id, m = s ? {
|
|
372
372
|
"data-testid": `dashboard-preview-widget-${e.id}`,
|
|
373
373
|
"data-widget-id": e.id,
|
|
374
374
|
role: "button",
|
|
375
375
|
tabIndex: 0,
|
|
376
376
|
"aria-selected": p,
|
|
377
377
|
"aria-label": `Widget: ${u || `Widget ${t + 1}`}`,
|
|
378
|
-
onClick: (t) =>
|
|
379
|
-
onKeyDown: (n) =>
|
|
380
|
-
} : {}, h = s ?
|
|
378
|
+
onClick: (t) => se(t, e.id),
|
|
379
|
+
onKeyDown: (n) => ce(n, e.id, t)
|
|
380
|
+
} : {}, h = s ? P("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", p ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, g = !k && i && !Y ? {
|
|
381
381
|
gridColumn: `span ${i.w}`,
|
|
382
382
|
gridRow: `span ${i.h}`
|
|
383
383
|
} : void 0, x = c ? /* @__PURE__ */ Q("div", {
|
|
384
|
-
className:
|
|
384
|
+
className: P("h-full w-full", s && "relative", h),
|
|
385
385
|
style: g,
|
|
386
386
|
...m,
|
|
387
387
|
children: [/* @__PURE__ */ Z(o, {
|
|
388
388
|
schema: a,
|
|
389
|
-
className:
|
|
389
|
+
className: P("h-full w-full", s && "pointer-events-none"),
|
|
390
390
|
dataSource: n
|
|
391
391
|
}), s && /* @__PURE__ */ Z("div", {
|
|
392
392
|
className: "absolute inset-0 z-10",
|
|
@@ -394,7 +394,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
394
394
|
"data-testid": "widget-click-overlay"
|
|
395
395
|
})]
|
|
396
396
|
}) : /* @__PURE__ */ Q(_, {
|
|
397
|
-
className:
|
|
397
|
+
className: P("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", s && "relative", h),
|
|
398
398
|
style: g,
|
|
399
399
|
...m,
|
|
400
400
|
children: [
|
|
@@ -412,7 +412,7 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
412
412
|
/* @__PURE__ */ Z(v, {
|
|
413
413
|
className: "p-0",
|
|
414
414
|
children: /* @__PURE__ */ Z("div", {
|
|
415
|
-
className:
|
|
415
|
+
className: P("h-full w-full", "p-3 sm:p-4 md:p-6", s && "pointer-events-none"),
|
|
416
416
|
children: /* @__PURE__ */ Z(o, {
|
|
417
417
|
schema: a,
|
|
418
418
|
dataSource: n
|
|
@@ -426,35 +426,35 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
426
426
|
})
|
|
427
427
|
]
|
|
428
428
|
});
|
|
429
|
-
return Y && e.id ? /* @__PURE__ */ Z(
|
|
429
|
+
return Y && e.id ? /* @__PURE__ */ Z(Ee, {
|
|
430
430
|
id: e.id,
|
|
431
431
|
gridSpan: !k && i ? {
|
|
432
432
|
w: i.w,
|
|
433
433
|
h: i.h
|
|
434
434
|
} : void 0,
|
|
435
435
|
children: x
|
|
436
|
-
}, f) : /* @__PURE__ */ Z(
|
|
436
|
+
}, f) : /* @__PURE__ */ Z(ne, { children: x }, f);
|
|
437
437
|
}, be = e.header && /* @__PURE__ */ Q("div", {
|
|
438
438
|
className: "col-span-full mb-4",
|
|
439
439
|
children: [
|
|
440
440
|
!x && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Z("h2", {
|
|
441
441
|
className: "text-lg font-semibold tracking-tight",
|
|
442
|
-
children:
|
|
443
|
-
name:
|
|
444
|
-
label:
|
|
445
|
-
}) :
|
|
442
|
+
children: U ? N({
|
|
443
|
+
name: U,
|
|
444
|
+
label: Oe(e.title)
|
|
445
|
+
}) : Oe(e.title)
|
|
446
446
|
}),
|
|
447
447
|
!x && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Z("p", {
|
|
448
448
|
className: "text-sm text-muted-foreground mt-1",
|
|
449
|
-
children:
|
|
450
|
-
name:
|
|
451
|
-
description:
|
|
452
|
-
}) :
|
|
449
|
+
children: U ? F({
|
|
450
|
+
name: U,
|
|
451
|
+
description: Oe(e.description)
|
|
452
|
+
}) : Oe(e.description)
|
|
453
453
|
}),
|
|
454
454
|
e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
455
455
|
className: "flex gap-2 mt-3",
|
|
456
456
|
children: e.header.actions.map((e, t) => {
|
|
457
|
-
let n =
|
|
457
|
+
let n = De(e.icon);
|
|
458
458
|
return /* @__PURE__ */ Q(g, {
|
|
459
459
|
variant: "outline",
|
|
460
460
|
size: "sm",
|
|
@@ -469,13 +469,13 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
469
469
|
return;
|
|
470
470
|
}
|
|
471
471
|
if (t === "modal" || t === "script") {
|
|
472
|
-
let e = await
|
|
472
|
+
let e = await M(n || r);
|
|
473
473
|
e?.success || console.warn("[DashboardRenderer] action failed", e?.error);
|
|
474
474
|
return;
|
|
475
475
|
}
|
|
476
476
|
console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
|
|
477
477
|
},
|
|
478
|
-
children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }),
|
|
478
|
+
children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), oe(e)]
|
|
479
479
|
}, t);
|
|
480
480
|
})
|
|
481
481
|
})
|
|
@@ -484,41 +484,41 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
484
484
|
className: "text-xs text-muted-foreground",
|
|
485
485
|
children: [i.toLocaleString(), " records"]
|
|
486
486
|
}), Se = a ? JSON.stringify(a) : void 0, Ce = r && /* @__PURE__ */ Q("div", {
|
|
487
|
-
className:
|
|
487
|
+
className: P("flex items-center justify-end gap-3 mb-2", !k && "col-span-full"),
|
|
488
488
|
children: [xe, /* @__PURE__ */ Q(g, {
|
|
489
489
|
variant: "outline",
|
|
490
490
|
size: "sm",
|
|
491
|
-
onClick:
|
|
491
|
+
onClick: K,
|
|
492
492
|
disabled: D,
|
|
493
493
|
"aria-label": "Refresh dashboard",
|
|
494
|
-
children: [/* @__PURE__ */ Z(
|
|
494
|
+
children: [/* @__PURE__ */ Z(q, { className: P("h-4 w-4 mr-2", D && "animate-spin") }), D ? "Refreshing…" : "Refresh All"]
|
|
495
495
|
})]
|
|
496
|
-
}), we = B(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]),
|
|
496
|
+
}), we = B(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), Te = B(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), Ae = B(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
|
|
497
497
|
if (k) {
|
|
498
498
|
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ Q("div", {
|
|
499
499
|
ref: C,
|
|
500
|
-
className:
|
|
500
|
+
className: P("flex flex-col gap-4 px-4", t),
|
|
501
501
|
"data-user-actions": Se,
|
|
502
|
-
onClick:
|
|
502
|
+
onClick: J,
|
|
503
503
|
...S,
|
|
504
504
|
children: [
|
|
505
505
|
be,
|
|
506
506
|
Ce,
|
|
507
507
|
n.length > 0 && /* @__PURE__ */ Z("div", {
|
|
508
508
|
className: "grid grid-cols-2 gap-3",
|
|
509
|
-
onClick:
|
|
510
|
-
children: /* @__PURE__ */ Z(
|
|
511
|
-
items:
|
|
512
|
-
strategy:
|
|
509
|
+
onClick: J,
|
|
510
|
+
children: /* @__PURE__ */ Z(me, {
|
|
511
|
+
items: Te,
|
|
512
|
+
strategy: ge,
|
|
513
513
|
disabled: !Y,
|
|
514
514
|
children: n.map((e, t) => ye(e, t))
|
|
515
515
|
})
|
|
516
516
|
}),
|
|
517
517
|
r.length > 0 && /* @__PURE__ */ Z("div", {
|
|
518
518
|
className: "flex flex-col gap-4",
|
|
519
|
-
onClick:
|
|
520
|
-
children: /* @__PURE__ */ Z(
|
|
521
|
-
items:
|
|
519
|
+
onClick: J,
|
|
520
|
+
children: /* @__PURE__ */ Z(me, {
|
|
521
|
+
items: Ae,
|
|
522
522
|
strategy: _e,
|
|
523
523
|
disabled: !Y,
|
|
524
524
|
children: r.map((e, t) => ye(e, t, !0))
|
|
@@ -526,44 +526,44 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
526
526
|
})
|
|
527
527
|
]
|
|
528
528
|
});
|
|
529
|
-
return Y ? /* @__PURE__ */ Z(
|
|
530
|
-
sensors:
|
|
531
|
-
collisionDetection:
|
|
532
|
-
onDragEnd:
|
|
529
|
+
return Y ? /* @__PURE__ */ Z(le, {
|
|
530
|
+
sensors: ve,
|
|
531
|
+
collisionDetection: de,
|
|
532
|
+
onDragEnd: X,
|
|
533
533
|
children: i
|
|
534
534
|
}) : i;
|
|
535
535
|
}
|
|
536
536
|
let Me = e.columns != null || w !== 4, Ne = /* @__PURE__ */ Q("div", {
|
|
537
537
|
ref: C,
|
|
538
|
-
className:
|
|
538
|
+
className: P("grid auto-rows-min", !Me && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
|
|
539
539
|
style: {
|
|
540
540
|
...Me && { gridTemplateColumns: `repeat(${T}, minmax(0, 1fr))` },
|
|
541
541
|
gap: `${E * .25}rem`
|
|
542
542
|
},
|
|
543
543
|
"data-user-actions": Se,
|
|
544
|
-
onClick:
|
|
544
|
+
onClick: J,
|
|
545
545
|
...S,
|
|
546
546
|
children: [
|
|
547
547
|
be,
|
|
548
548
|
Ce,
|
|
549
|
-
/* @__PURE__ */ Z(
|
|
549
|
+
/* @__PURE__ */ Z(me, {
|
|
550
550
|
items: we,
|
|
551
|
-
strategy:
|
|
551
|
+
strategy: ge,
|
|
552
552
|
disabled: !Y,
|
|
553
553
|
children: e.widgets?.map((e, t) => ye(e, t))
|
|
554
554
|
})
|
|
555
555
|
]
|
|
556
556
|
});
|
|
557
|
-
return Y ? /* @__PURE__ */ Z(
|
|
558
|
-
sensors:
|
|
559
|
-
collisionDetection:
|
|
560
|
-
onDragEnd:
|
|
557
|
+
return Y ? /* @__PURE__ */ Z(le, {
|
|
558
|
+
sensors: ve,
|
|
559
|
+
collisionDetection: de,
|
|
560
|
+
onDragEnd: X,
|
|
561
561
|
children: Ne
|
|
562
562
|
}) : Ne;
|
|
563
563
|
});
|
|
564
564
|
//#endregion
|
|
565
565
|
//#region src/DashboardGridLayout.tsx
|
|
566
|
-
function
|
|
566
|
+
function Ne({ editMode: e }) {
|
|
567
567
|
let t = u();
|
|
568
568
|
return I.useEffect(() => {
|
|
569
569
|
if (e) return t.startDrag({
|
|
@@ -576,14 +576,14 @@ function Me({ editMode: e }) {
|
|
|
576
576
|
t.endDrag("dashboard");
|
|
577
577
|
}, [e, t]), null;
|
|
578
578
|
}
|
|
579
|
-
var
|
|
579
|
+
var Pe = [
|
|
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 Fe(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 Pe(e, t) {
|
|
|
602
602
|
widgets: r
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function Ie(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,8 +611,8 @@ function Fe(e) {
|
|
|
611
611
|
h: e.layout?.h ?? 4
|
|
612
612
|
})) || [] };
|
|
613
613
|
}
|
|
614
|
-
var
|
|
615
|
-
let { width: a, containerRef: s, mounted: c } =
|
|
614
|
+
var Le = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
|
|
615
|
+
let { width: a, containerRef: s, mounted: c } = be(), [l, u] = I.useState(!1), [f, p] = I.useState(!1), m = d(), h = I.useRef(null), x = I.useCallback(() => {
|
|
616
616
|
i && (p(!0), i(), setTimeout(() => p(!1), 600));
|
|
617
617
|
}, [i]);
|
|
618
618
|
I.useEffect(() => {
|
|
@@ -624,7 +624,7 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
624
624
|
i,
|
|
625
625
|
x
|
|
626
626
|
]);
|
|
627
|
-
let [S, C] = I.useState(() =>
|
|
627
|
+
let [S, C] = I.useState(() => Ie(e)), w = I.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,
|
|
@@ -632,18 +632,18 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
632
632
|
h: e.layout?.h
|
|
633
633
|
})) ?? []), [e.widgets]);
|
|
634
634
|
I.useEffect(() => {
|
|
635
|
-
C(
|
|
635
|
+
C(Ie(e));
|
|
636
636
|
}, [w]);
|
|
637
637
|
let T = I.useCallback((e, t) => {
|
|
638
638
|
C(t), n?.(e);
|
|
639
639
|
}, [n]), E = I.useCallback(() => {
|
|
640
|
-
r ? r(
|
|
640
|
+
r ? r(Fe(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
645
|
]), D = I.useCallback(() => {
|
|
646
|
-
C(
|
|
646
|
+
C(Ie(e));
|
|
647
647
|
}, [e]), O = I.useCallback((e) => {
|
|
648
648
|
if (e.component) return e.component;
|
|
649
649
|
let t = e.type, n = e.options || {};
|
|
@@ -662,7 +662,7 @@ var Ie = ({ 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: Pe,
|
|
666
666
|
className: "h-full"
|
|
667
667
|
};
|
|
668
668
|
}
|
|
@@ -679,7 +679,7 @@ var Ie = ({ 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: Pe,
|
|
683
683
|
className: "h-full"
|
|
684
684
|
};
|
|
685
685
|
}
|
|
@@ -689,7 +689,7 @@ var Ie = ({ 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: Pe,
|
|
693
693
|
className: "h-full"
|
|
694
694
|
};
|
|
695
695
|
}
|
|
@@ -750,10 +750,10 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
750
750
|
}, []);
|
|
751
751
|
return /* @__PURE__ */ Q("div", {
|
|
752
752
|
ref: s,
|
|
753
|
-
className:
|
|
753
|
+
className: P("w-full", t),
|
|
754
754
|
"data-testid": "grid-layout",
|
|
755
755
|
children: [
|
|
756
|
-
m && /* @__PURE__ */ Z(
|
|
756
|
+
m && /* @__PURE__ */ Z(Ne, { editMode: l }),
|
|
757
757
|
/* @__PURE__ */ Q("div", {
|
|
758
758
|
className: "mb-4 flex items-center justify-between",
|
|
759
759
|
children: [/* @__PURE__ */ Z("h2", {
|
|
@@ -766,13 +766,13 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
766
766
|
onClick: E,
|
|
767
767
|
size: "sm",
|
|
768
768
|
variant: "default",
|
|
769
|
-
children: [/* @__PURE__ */ Z(
|
|
769
|
+
children: [/* @__PURE__ */ Z(se, { className: "h-4 w-4 mr-2" }), "Save Layout"]
|
|
770
770
|
}),
|
|
771
771
|
/* @__PURE__ */ Q(g, {
|
|
772
772
|
onClick: D,
|
|
773
773
|
size: "sm",
|
|
774
774
|
variant: "outline",
|
|
775
|
-
children: [/* @__PURE__ */ Z(
|
|
775
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4 mr-2" }), "Reset"]
|
|
776
776
|
}),
|
|
777
777
|
/* @__PURE__ */ Z(g, {
|
|
778
778
|
onClick: () => u(!1),
|
|
@@ -786,16 +786,16 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
786
786
|
variant: "outline",
|
|
787
787
|
disabled: f,
|
|
788
788
|
"aria-label": "Refresh dashboard",
|
|
789
|
-
children: [/* @__PURE__ */ Z(
|
|
789
|
+
children: [/* @__PURE__ */ Z(q, { className: P("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
|
|
790
790
|
}), /* @__PURE__ */ Q(g, {
|
|
791
791
|
onClick: () => u(!0),
|
|
792
792
|
size: "sm",
|
|
793
793
|
variant: "outline",
|
|
794
|
-
children: [/* @__PURE__ */ Z(
|
|
794
|
+
children: [/* @__PURE__ */ Z(oe, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
|
|
795
795
|
})] })
|
|
796
796
|
})]
|
|
797
797
|
}),
|
|
798
|
-
c && /* @__PURE__ */ Z(
|
|
798
|
+
c && /* @__PURE__ */ Z(ye, {
|
|
799
799
|
className: "layout",
|
|
800
800
|
width: a,
|
|
801
801
|
layouts: S,
|
|
@@ -828,13 +828,13 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
828
828
|
className: "h-full w-full relative",
|
|
829
829
|
children: [l && /* @__PURE__ */ Z("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__ */ Z(
|
|
831
|
+
children: /* @__PURE__ */ Z(W, { className: "h-4 w-4" })
|
|
832
832
|
}), /* @__PURE__ */ Z(o, {
|
|
833
833
|
schema: r,
|
|
834
834
|
className: "h-full w-full"
|
|
835
835
|
})]
|
|
836
836
|
}) : /* @__PURE__ */ Q(_, {
|
|
837
|
-
className:
|
|
837
|
+
className: P("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", l && "ring-2 ring-primary/20"),
|
|
838
838
|
children: [e.title && /* @__PURE__ */ Q(y, {
|
|
839
839
|
className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
|
|
840
840
|
children: [/* @__PURE__ */ Z(b, {
|
|
@@ -843,12 +843,12 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
843
843
|
children: e.title
|
|
844
844
|
}), l && /* @__PURE__ */ Z("div", {
|
|
845
845
|
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
846
|
-
children: /* @__PURE__ */ Z(
|
|
846
|
+
children: /* @__PURE__ */ Z(W, { className: "h-4 w-4" })
|
|
847
847
|
})]
|
|
848
848
|
}), /* @__PURE__ */ Z(v, {
|
|
849
849
|
className: "p-0 h-full",
|
|
850
850
|
children: /* @__PURE__ */ Z("div", {
|
|
851
|
-
className:
|
|
851
|
+
className: P("h-full w-full overflow-auto p-4"),
|
|
852
852
|
children: /* @__PURE__ */ Z(o, { schema: r })
|
|
853
853
|
})
|
|
854
854
|
})]
|
|
@@ -858,7 +858,7 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
858
858
|
})
|
|
859
859
|
]
|
|
860
860
|
});
|
|
861
|
-
},
|
|
861
|
+
}, Re = p({
|
|
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 Ie = ({ 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 ze(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 Re(e) {
|
|
|
882
882
|
default: return;
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function Be(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 : Be(r, t, n);
|
|
890
890
|
}
|
|
891
891
|
if (!isFinite(e)) return String(e);
|
|
892
892
|
let r = {
|
|
@@ -913,10 +913,10 @@ function ze(e, t, n) {
|
|
|
913
913
|
maximumFractionDigits: c
|
|
914
914
|
}).format(e);
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function Ve(e) {
|
|
917
917
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
918
918
|
}
|
|
919
|
-
var
|
|
919
|
+
var He = {
|
|
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 Ve = {
|
|
|
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 h =
|
|
930
|
-
let e =
|
|
928
|
+
}, Ue = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, ...m }) => {
|
|
929
|
+
let h = He[c] || He.default, { t: g } = Re(), x = B(() => {
|
|
930
|
+
let e = Ve(a) || Ve(n?.label);
|
|
931
931
|
if (!e) return e;
|
|
932
|
-
let t =
|
|
932
|
+
let t = ze(e);
|
|
933
933
|
return t ? g(t) : e;
|
|
934
934
|
}, [
|
|
935
935
|
a,
|
|
936
936
|
n?.label,
|
|
937
937
|
g
|
|
938
938
|
]), S = B(() => {
|
|
939
|
-
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ?
|
|
939
|
+
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Be(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,
|
|
@@ -946,13 +946,13 @@ var Ve = {
|
|
|
946
946
|
f
|
|
947
947
|
]), C = B(() => {
|
|
948
948
|
if (typeof r == "string") {
|
|
949
|
-
let e =
|
|
949
|
+
let e = F(r);
|
|
950
950
|
return e ? /* @__PURE__ */ Z(e, { className: "h-4 w-4" }) : null;
|
|
951
951
|
}
|
|
952
952
|
return r;
|
|
953
953
|
}, [r]);
|
|
954
954
|
return /* @__PURE__ */ Q(_, {
|
|
955
|
-
className:
|
|
955
|
+
className: P("h-full overflow-hidden", p && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
|
|
956
956
|
onClick: p,
|
|
957
957
|
role: p ? "button" : void 0,
|
|
958
958
|
tabIndex: p ? 0 : void 0,
|
|
@@ -964,15 +964,15 @@ var Ve = {
|
|
|
964
964
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
965
965
|
children: [/* @__PURE__ */ Z(b, {
|
|
966
966
|
className: "text-sm font-medium truncate",
|
|
967
|
-
children:
|
|
967
|
+
children: Ve(e)
|
|
968
968
|
}), C && /* @__PURE__ */ Z("div", {
|
|
969
|
-
className:
|
|
969
|
+
className: P("flex h-8 w-8 items-center justify-center rounded-md shrink-0", h),
|
|
970
970
|
children: C
|
|
971
971
|
})]
|
|
972
972
|
}), /* @__PURE__ */ Z(v, { children: o ? /* @__PURE__ */ Q("div", {
|
|
973
973
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
974
974
|
"data-testid": "metric-loading",
|
|
975
|
-
children: [/* @__PURE__ */ Z(
|
|
975
|
+
children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
|
|
976
976
|
className: "text-sm",
|
|
977
977
|
children: "Loading…"
|
|
978
978
|
})]
|
|
@@ -980,7 +980,7 @@ var Ve = {
|
|
|
980
980
|
className: "flex items-center gap-2",
|
|
981
981
|
"data-testid": "metric-error",
|
|
982
982
|
role: "alert",
|
|
983
|
-
children: [/* @__PURE__ */ Z(
|
|
983
|
+
children: [/* @__PURE__ */ Z(ae, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
|
|
984
984
|
className: "text-xs text-destructive truncate",
|
|
985
985
|
children: s
|
|
986
986
|
})]
|
|
@@ -990,11 +990,11 @@ var Ve = {
|
|
|
990
990
|
}), (n || a) && /* @__PURE__ */ Q("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
992
|
children: [n && /* @__PURE__ */ Q("span", {
|
|
993
|
-
className:
|
|
993
|
+
className: P("flex items-center shrink-0 font-medium", n.direction === "up" && "text-emerald-600 dark:text-emerald-400", n.direction === "down" && "text-rose-600 dark:text-rose-400", n.direction === "neutral" && "text-muted-foreground"),
|
|
994
994
|
children: [
|
|
995
|
-
n.direction === "up" && /* @__PURE__ */ Z(
|
|
996
|
-
n.direction === "down" && /* @__PURE__ */ Z(
|
|
997
|
-
n.direction === "neutral" && /* @__PURE__ */ Z(
|
|
995
|
+
n.direction === "up" && /* @__PURE__ */ Z(U, { className: "h-3 w-3 mr-1" }),
|
|
996
|
+
n.direction === "down" && /* @__PURE__ */ Z(H, { className: "h-3 w-3 mr-1" }),
|
|
997
|
+
n.direction === "neutral" && /* @__PURE__ */ Z(K, { className: "h-3 w-3 mr-1" }),
|
|
998
998
|
n.value,
|
|
999
999
|
"%"
|
|
1000
1000
|
]
|
|
@@ -1007,24 +1007,24 @@ var Ve = {
|
|
|
1007
1007
|
};
|
|
1008
1008
|
//#endregion
|
|
1009
1009
|
//#region src/MetricCard.tsx
|
|
1010
|
-
function
|
|
1010
|
+
function We(e) {
|
|
1011
1011
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
1012
1012
|
}
|
|
1013
|
-
var
|
|
1014
|
-
let u = n ?
|
|
1013
|
+
var Ge = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
|
|
1014
|
+
let u = n ? F(n) : null;
|
|
1015
1015
|
return /* @__PURE__ */ Q(_, {
|
|
1016
|
-
className:
|
|
1016
|
+
className: P("h-full", o),
|
|
1017
1017
|
...l,
|
|
1018
1018
|
children: [/* @__PURE__ */ Q(y, {
|
|
1019
1019
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
1020
1020
|
children: [/* @__PURE__ */ Z(b, {
|
|
1021
1021
|
className: "text-sm font-medium",
|
|
1022
|
-
children:
|
|
1022
|
+
children: We(e)
|
|
1023
1023
|
}), u && /* @__PURE__ */ Z(u, { className: "h-4 w-4 text-muted-foreground" })]
|
|
1024
1024
|
}), /* @__PURE__ */ Z(v, { children: s ? /* @__PURE__ */ Q("div", {
|
|
1025
1025
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
1026
1026
|
"data-testid": "metric-card-loading",
|
|
1027
|
-
children: [/* @__PURE__ */ Z(
|
|
1027
|
+
children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
|
|
1028
1028
|
className: "text-sm",
|
|
1029
1029
|
children: "Loading…"
|
|
1030
1030
|
})]
|
|
@@ -1032,7 +1032,7 @@ var We = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1032
1032
|
className: "flex items-center gap-2",
|
|
1033
1033
|
"data-testid": "metric-card-error",
|
|
1034
1034
|
role: "alert",
|
|
1035
|
-
children: [/* @__PURE__ */ Z(
|
|
1035
|
+
children: [/* @__PURE__ */ Z(ae, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
|
|
1036
1036
|
className: "text-xs text-destructive truncate",
|
|
1037
1037
|
children: c
|
|
1038
1038
|
})]
|
|
@@ -1042,47 +1042,47 @@ var We = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1042
1042
|
}), (r || i || a) && /* @__PURE__ */ Q("p", {
|
|
1043
1043
|
className: "text-xs text-muted-foreground flex items-center mt-1",
|
|
1044
1044
|
children: [r && i && /* @__PURE__ */ Q("span", {
|
|
1045
|
-
className:
|
|
1045
|
+
className: P("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__ */ Z(
|
|
1048
|
-
r === "down" && /* @__PURE__ */ Z(
|
|
1049
|
-
r === "neutral" && /* @__PURE__ */ Z(
|
|
1047
|
+
r === "up" && /* @__PURE__ */ Z(U, { className: "h-3 w-3 mr-1" }),
|
|
1048
|
+
r === "down" && /* @__PURE__ */ Z(H, { className: "h-3 w-3 mr-1" }),
|
|
1049
|
+
r === "neutral" && /* @__PURE__ */ Z(K, { className: "h-3 w-3 mr-1" }),
|
|
1050
1050
|
i
|
|
1051
1051
|
]
|
|
1052
|
-
}),
|
|
1052
|
+
}), We(a)]
|
|
1053
1053
|
})] }) })]
|
|
1054
1054
|
});
|
|
1055
|
-
},
|
|
1056
|
-
let C =
|
|
1055
|
+
}, Ke = ({ 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: x, title: S }) => {
|
|
1056
|
+
let C = re(s), w = m || C?.dataSource, [k, N] = V(!1), [P, F] = V(null), [te, I] = V(!1), [ne, L] = V(null), [ie, ae] = V(null);
|
|
1057
1057
|
z(() => {
|
|
1058
1058
|
let t = !0;
|
|
1059
|
-
if (!(!
|
|
1060
|
-
t &&
|
|
1059
|
+
if (!(!w || !e || typeof w.getObjectSchema != "function")) return w.getObjectSchema(e).then((e) => {
|
|
1060
|
+
t && ae(e);
|
|
1061
1061
|
}).catch(() => {}), () => {
|
|
1062
1062
|
t = !1;
|
|
1063
1063
|
};
|
|
1064
|
-
}, [
|
|
1065
|
-
let
|
|
1064
|
+
}, [w, e]);
|
|
1065
|
+
let H = B(() => {
|
|
1066
1066
|
let e = t?.field;
|
|
1067
|
-
if (!e || !
|
|
1068
|
-
let n =
|
|
1067
|
+
if (!e || !ie?.fields) return null;
|
|
1068
|
+
let n = ie.fields;
|
|
1069
1069
|
return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
|
|
1070
|
-
}, [
|
|
1070
|
+
}, [ie, t?.field]), U = B(() => {
|
|
1071
1071
|
if (g) return g;
|
|
1072
|
-
if (
|
|
1073
|
-
if (
|
|
1074
|
-
let e =
|
|
1072
|
+
if (H) {
|
|
1073
|
+
if (H.type === "currency") {
|
|
1074
|
+
let e = H.precision ?? H.scale ?? 0;
|
|
1075
1075
|
return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
|
|
1076
1076
|
}
|
|
1077
|
-
if (
|
|
1078
|
-
if (
|
|
1077
|
+
if (H.type === "percent") return "0,0%";
|
|
1078
|
+
if (H.type === "number" || H.type === "integer") return "0,0";
|
|
1079
1079
|
}
|
|
1080
|
-
}, [g,
|
|
1080
|
+
}, [g, H]), oe = B(() => {
|
|
1081
1081
|
if (_) return _;
|
|
1082
|
-
if (
|
|
1083
|
-
}, [_,
|
|
1082
|
+
if (H?.type === "currency") return H.defaultCurrency || H.currency || void 0;
|
|
1083
|
+
}, [_, H]), W = B(() => t ? JSON.stringify(t) : "", [t]), G = B(() => i(n), [n]), K = R(async (n, r) => {
|
|
1084
1084
|
if (!(!n || !e)) {
|
|
1085
|
-
r.current && (
|
|
1085
|
+
r.current && (I(!0), L(null));
|
|
1086
1086
|
try {
|
|
1087
1087
|
let i;
|
|
1088
1088
|
if (t && typeof n.aggregate == "function") {
|
|
@@ -1090,49 +1090,49 @@ var We = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1090
1090
|
field: t.field,
|
|
1091
1091
|
function: t.function,
|
|
1092
1092
|
groupBy: t.groupBy || "_all",
|
|
1093
|
-
filter:
|
|
1093
|
+
filter: G
|
|
1094
1094
|
}), a = Array.isArray(r) ? r : [];
|
|
1095
1095
|
i = a.length === 0 ? 0 : t.function === "count" ? a.reduce((e, n) => e + (Number(n[t.field]) || Number(n.count) || 0), 0) : a[0][t.field] ?? 0;
|
|
1096
1096
|
} else if (typeof n.find == "function") {
|
|
1097
|
-
let t = await n.find(e, { $filter:
|
|
1097
|
+
let t = await n.find(e, { $filter: G });
|
|
1098
1098
|
i = (Array.isArray(t) ? t : t?.data || t?.records || []).length;
|
|
1099
1099
|
} else return;
|
|
1100
1100
|
r.current && F(i);
|
|
1101
1101
|
} catch (e) {
|
|
1102
|
-
console.error("[ObjectMetricWidget] Fetch error:", e), r.current &&
|
|
1102
|
+
console.error("[ObjectMetricWidget] Fetch error:", e), r.current && L(e instanceof Error ? e.message : "Failed to load metric");
|
|
1103
1103
|
} finally {
|
|
1104
|
-
r.current &&
|
|
1104
|
+
r.current && I(!1);
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
}, [
|
|
1108
1108
|
e,
|
|
1109
|
-
|
|
1110
|
-
B(() =>
|
|
1109
|
+
W,
|
|
1110
|
+
B(() => G ? JSON.stringify(G) : "", [G])
|
|
1111
1111
|
]);
|
|
1112
1112
|
z(() => {
|
|
1113
1113
|
let t = { current: !0 };
|
|
1114
|
-
return
|
|
1114
|
+
return w && e ? K(w, t) : (F(null), L(null)), () => {
|
|
1115
1115
|
t.current = !1;
|
|
1116
1116
|
};
|
|
1117
1117
|
}, [
|
|
1118
|
-
|
|
1118
|
+
w,
|
|
1119
1119
|
e,
|
|
1120
|
-
|
|
1120
|
+
K
|
|
1121
1121
|
]);
|
|
1122
|
-
let
|
|
1123
|
-
b && typeof
|
|
1124
|
-
let
|
|
1122
|
+
let q = P === null ? w ? "—" : l ?? "—" : P;
|
|
1123
|
+
b && typeof q == "number" && isFinite(q) && q >= 0 && q <= 1 && (q = 1 - q);
|
|
1124
|
+
let se = r(x) && !!e && !!w, ce = B(() => {
|
|
1125
1125
|
let e = typeof c == "string" ? c : c?.defaultValue || "";
|
|
1126
1126
|
return a(x, {}, (typeof S == "string" ? S : S?.defaultValue || "") || e || "Details");
|
|
1127
1127
|
}, [
|
|
1128
1128
|
x,
|
|
1129
1129
|
c,
|
|
1130
1130
|
S
|
|
1131
|
-
]),
|
|
1132
|
-
if (!
|
|
1131
|
+
]), J = B(() => {
|
|
1132
|
+
if (!se) return null;
|
|
1133
1133
|
let t = x?.target ?? "drawer", n = x?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i;
|
|
1134
1134
|
if (r) {
|
|
1135
|
-
let e = n.filter, t = e ?
|
|
1135
|
+
let e = n.filter, t = e ? G ? { $and: [e, G] } : e : G;
|
|
1136
1136
|
i = /* @__PURE__ */ Z("div", {
|
|
1137
1137
|
className: "h-full overflow-auto",
|
|
1138
1138
|
children: /* @__PURE__ */ Z(o, { schema: {
|
|
@@ -1146,57 +1146,57 @@ var We = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1146
1146
|
children: /* @__PURE__ */ Z(o, { schema: {
|
|
1147
1147
|
type: "object-data-table",
|
|
1148
1148
|
objectName: e,
|
|
1149
|
-
filter:
|
|
1149
|
+
filter: G,
|
|
1150
1150
|
pageSize: 25,
|
|
1151
1151
|
drillDown: { enabled: !1 }
|
|
1152
1152
|
} })
|
|
1153
1153
|
});
|
|
1154
|
-
return t === "dialog" ? /* @__PURE__ */ Z(
|
|
1154
|
+
return t === "dialog" ? /* @__PURE__ */ Z(T, {
|
|
1155
1155
|
open: !0,
|
|
1156
1156
|
onOpenChange: (e) => !e && N(!1),
|
|
1157
|
-
children: /* @__PURE__ */ Q(
|
|
1157
|
+
children: /* @__PURE__ */ Q(E, {
|
|
1158
1158
|
className: "max-w-5xl",
|
|
1159
|
-
children: [/* @__PURE__ */ Z(
|
|
1159
|
+
children: [/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(O, { children: ce }) }), i]
|
|
1160
1160
|
})
|
|
1161
|
-
}) : /* @__PURE__ */ Z(
|
|
1161
|
+
}) : /* @__PURE__ */ Z(A, {
|
|
1162
1162
|
open: !0,
|
|
1163
1163
|
onOpenChange: (e) => !e && N(!1),
|
|
1164
|
-
children: /* @__PURE__ */ Q(
|
|
1164
|
+
children: /* @__PURE__ */ Q(j, {
|
|
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__ */ Z(
|
|
1167
|
+
children: [/* @__PURE__ */ Z(M, { children: /* @__PURE__ */ Z(ee, { children: ce }) }), /* @__PURE__ */ Z("div", {
|
|
1168
1168
|
className: "flex-1 overflow-hidden mt-2",
|
|
1169
1169
|
children: i
|
|
1170
1170
|
})]
|
|
1171
1171
|
})
|
|
1172
1172
|
});
|
|
1173
1173
|
}, [
|
|
1174
|
-
|
|
1174
|
+
se,
|
|
1175
1175
|
x,
|
|
1176
1176
|
e,
|
|
1177
|
-
|
|
1178
|
-
|
|
1177
|
+
G,
|
|
1178
|
+
ce
|
|
1179
1179
|
]);
|
|
1180
|
-
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(
|
|
1180
|
+
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(Ue, {
|
|
1181
1181
|
label: c,
|
|
1182
|
-
value:
|
|
1182
|
+
value: q,
|
|
1183
1183
|
trend: u,
|
|
1184
1184
|
icon: d,
|
|
1185
1185
|
className: f,
|
|
1186
1186
|
description: p,
|
|
1187
|
-
loading:
|
|
1188
|
-
error:
|
|
1187
|
+
loading: te,
|
|
1188
|
+
error: ne,
|
|
1189
1189
|
colorVariant: h,
|
|
1190
|
-
format:
|
|
1191
|
-
currency:
|
|
1190
|
+
format: U,
|
|
1191
|
+
currency: oe,
|
|
1192
1192
|
prefix: v,
|
|
1193
1193
|
suffix: y,
|
|
1194
|
-
onClick:
|
|
1195
|
-
}),
|
|
1194
|
+
onClick: se ? () => N(!0) : void 0
|
|
1195
|
+
}), k && J] });
|
|
1196
1196
|
};
|
|
1197
1197
|
//#endregion
|
|
1198
1198
|
//#region src/PivotTable.tsx
|
|
1199
|
-
function
|
|
1199
|
+
function qe() {
|
|
1200
1200
|
try {
|
|
1201
1201
|
let { t: e } = m(), t = e("dashboard.total");
|
|
1202
1202
|
return !t || t === "dashboard.total" ? "Total" : t;
|
|
@@ -1204,7 +1204,7 @@ function Ke() {
|
|
|
1204
1204
|
return "Total";
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
|
-
function
|
|
1207
|
+
function Je() {
|
|
1208
1208
|
try {
|
|
1209
1209
|
let { t: e } = m(), t = e("dashboard.noDataAvailable");
|
|
1210
1210
|
return !t || t === "dashboard.noDataAvailable" ? "No data available" : t;
|
|
@@ -1212,7 +1212,7 @@ function qe() {
|
|
|
1212
1212
|
return "No data available";
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
function
|
|
1215
|
+
function Ye(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 Je(e, t) {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
return n + l + r;
|
|
1231
1231
|
}
|
|
1232
|
-
var
|
|
1233
|
-
function Xe(e, t) {
|
|
1234
|
-
return e === "" ? Ye : t?.[e] ?? e;
|
|
1235
|
-
}
|
|
1232
|
+
var Xe = "—";
|
|
1236
1233
|
function Ze(e, t) {
|
|
1234
|
+
return e === "" ? Xe : t?.[e] ?? e;
|
|
1235
|
+
}
|
|
1236
|
+
function Qe(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 Ze(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 $e = ({ 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 = qe(), y = Je(), 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,9 +1253,9 @@ var Qe = ({ 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]" : "",
|
|
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]" : "", T = Array.isArray(f) ? f : [], { rowKeys: E, colKeys: D, matrix: O, rowTotals: k, colTotals: A, grandTotal: j } = B(() => {
|
|
1257
1257
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
|
|
1258
|
-
for (let r of
|
|
1258
|
+
for (let r of T) {
|
|
1259
1259
|
let i = String(r[c] ?? ""), a = String(r[l] ?? ""), o = Number(r[u]) || 0;
|
|
1260
1260
|
e.set(i, !0), t.set(a, !0), n[i] || (n[i] = {}), n[i][a] || (n[i][a] = []), n[i][a].push(o);
|
|
1261
1261
|
}
|
|
@@ -1264,10 +1264,10 @@ var Qe = ({ 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 = Qe(i, d);
|
|
1268
1268
|
a[e][r] = o, t.push(...i), !s[r] && s[r];
|
|
1269
1269
|
}
|
|
1270
|
-
o[e] =
|
|
1270
|
+
o[e] = Qe(t, d);
|
|
1271
1271
|
}
|
|
1272
1272
|
for (let e of i) {
|
|
1273
1273
|
let t = [];
|
|
@@ -1275,36 +1275,36 @@ var Qe = ({ 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] = Qe(t, d);
|
|
1279
1279
|
}
|
|
1280
1280
|
let f = [];
|
|
1281
|
-
for (let e of
|
|
1281
|
+
for (let e of T) f.push(Number(e[u]) || 0);
|
|
1282
1282
|
return {
|
|
1283
1283
|
rowKeys: r,
|
|
1284
1284
|
colKeys: i,
|
|
1285
1285
|
matrix: a,
|
|
1286
1286
|
rowTotals: o,
|
|
1287
1287
|
colTotals: s,
|
|
1288
|
-
grandTotal:
|
|
1288
|
+
grandTotal: Qe(f, d)
|
|
1289
1289
|
};
|
|
1290
1290
|
}, [
|
|
1291
|
-
|
|
1291
|
+
T,
|
|
1292
1292
|
c,
|
|
1293
1293
|
l,
|
|
1294
1294
|
u,
|
|
1295
1295
|
d
|
|
1296
|
-
]),
|
|
1297
|
-
return
|
|
1298
|
-
className:
|
|
1296
|
+
]), M = (e) => Ye(e, h);
|
|
1297
|
+
return T.length === 0 ? /* @__PURE__ */ Q("div", {
|
|
1298
|
+
className: P("overflow-auto", t),
|
|
1299
1299
|
children: [s && /* @__PURE__ */ Z("h3", {
|
|
1300
1300
|
className: "text-sm font-semibold mb-2",
|
|
1301
1301
|
children: s
|
|
1302
|
-
}), /* @__PURE__ */
|
|
1303
|
-
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1302
|
+
}), /* @__PURE__ */ Z(w, {
|
|
1304
1303
|
"data-testid": "pivot-empty-state",
|
|
1305
|
-
|
|
1304
|
+
className: "py-8 gap-2 [&>h3]:hidden",
|
|
1305
|
+
icon: /* @__PURE__ */ Q("svg", {
|
|
1306
1306
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1307
|
-
className: "h-8 w-8
|
|
1307
|
+
className: "h-8 w-8 opacity-40",
|
|
1308
1308
|
viewBox: "0 0 24 24",
|
|
1309
1309
|
fill: "none",
|
|
1310
1310
|
stroke: "currentColor",
|
|
@@ -1337,13 +1337,13 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1337
1337
|
height: "7"
|
|
1338
1338
|
})
|
|
1339
1339
|
]
|
|
1340
|
-
}),
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1340
|
+
}),
|
|
1341
|
+
iconWrapperClassName: "",
|
|
1342
|
+
title: "",
|
|
1343
|
+
description: y
|
|
1344
1344
|
})]
|
|
1345
1345
|
}) : /* @__PURE__ */ Q("div", {
|
|
1346
|
-
className:
|
|
1346
|
+
className: P("overflow-auto", t),
|
|
1347
1347
|
children: [s && /* @__PURE__ */ Z("h3", {
|
|
1348
1348
|
className: "text-sm font-semibold mb-2",
|
|
1349
1349
|
children: s
|
|
@@ -1358,20 +1358,20 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1358
1358
|
className: "text-left p-2 font-medium text-muted-foreground whitespace-nowrap",
|
|
1359
1359
|
children: a || c
|
|
1360
1360
|
}),
|
|
1361
|
-
|
|
1361
|
+
D.map((e) => {
|
|
1362
1362
|
let t = () => x({
|
|
1363
1363
|
scope: "column",
|
|
1364
1364
|
colKey: e
|
|
1365
1365
|
});
|
|
1366
1366
|
return /* @__PURE__ */ Z("th", {
|
|
1367
|
-
className:
|
|
1367
|
+
className: P("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: Ze(e, i)
|
|
1375
1375
|
}, e);
|
|
1376
1376
|
}),
|
|
1377
1377
|
p && /* @__PURE__ */ Z("th", {
|
|
@@ -1380,11 +1380,11 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1380
1380
|
})
|
|
1381
1381
|
]
|
|
1382
1382
|
}) }),
|
|
1383
|
-
/* @__PURE__ */ Z("tbody", { children:
|
|
1383
|
+
/* @__PURE__ */ Z("tbody", { children: E.map((e) => /* @__PURE__ */ Q("tr", {
|
|
1384
1384
|
className: "border-b border-border/50 hover:bg-muted/30",
|
|
1385
1385
|
children: [
|
|
1386
1386
|
/* @__PURE__ */ Z("td", {
|
|
1387
|
-
className:
|
|
1387
|
+
className: P("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,40 +1396,40 @@ var Qe = ({ 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: Ze(e, n)
|
|
1400
1400
|
}),
|
|
1401
|
-
|
|
1402
|
-
let n =
|
|
1401
|
+
D.map((t) => {
|
|
1402
|
+
let n = O[e]?.[t] ?? 0, r = () => x({
|
|
1403
1403
|
scope: "cell",
|
|
1404
1404
|
rowKey: e,
|
|
1405
1405
|
colKey: t,
|
|
1406
1406
|
value: n
|
|
1407
1407
|
});
|
|
1408
1408
|
return /* @__PURE__ */ Z("td", {
|
|
1409
|
-
className:
|
|
1409
|
+
className: P("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,
|
|
1413
1413
|
onKeyDown: b ? S(r) : void 0,
|
|
1414
1414
|
"aria-label": b ? `Drill into ${c}=${e || "(empty)"}, ${l}=${t || "(empty)"}` : void 0,
|
|
1415
|
-
children:
|
|
1415
|
+
children: M(n)
|
|
1416
1416
|
}, t);
|
|
1417
1417
|
}),
|
|
1418
1418
|
p && /* @__PURE__ */ Z("td", {
|
|
1419
|
-
className:
|
|
1419
|
+
className: P("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({
|
|
1423
1423
|
scope: "row",
|
|
1424
1424
|
rowKey: e,
|
|
1425
|
-
value:
|
|
1425
|
+
value: k[e] ?? 0
|
|
1426
1426
|
}) : void 0,
|
|
1427
1427
|
onKeyDown: b ? S(() => x({
|
|
1428
1428
|
scope: "row",
|
|
1429
1429
|
rowKey: e,
|
|
1430
|
-
value:
|
|
1430
|
+
value: k[e] ?? 0
|
|
1431
1431
|
})) : void 0,
|
|
1432
|
-
children:
|
|
1432
|
+
children: M(k[e] ?? 0)
|
|
1433
1433
|
})
|
|
1434
1434
|
]
|
|
1435
1435
|
}, e)) }),
|
|
@@ -1440,35 +1440,35 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1440
1440
|
className: "p-2",
|
|
1441
1441
|
children: v
|
|
1442
1442
|
}),
|
|
1443
|
-
|
|
1444
|
-
className:
|
|
1443
|
+
D.map((e) => /* @__PURE__ */ Z("td", {
|
|
1444
|
+
className: P("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({
|
|
1448
1448
|
scope: "column",
|
|
1449
1449
|
colKey: e,
|
|
1450
|
-
value:
|
|
1450
|
+
value: A[e] ?? 0
|
|
1451
1451
|
}) : void 0,
|
|
1452
1452
|
onKeyDown: b ? S(() => x({
|
|
1453
1453
|
scope: "column",
|
|
1454
1454
|
colKey: e,
|
|
1455
|
-
value:
|
|
1455
|
+
value: A[e] ?? 0
|
|
1456
1456
|
})) : void 0,
|
|
1457
|
-
children:
|
|
1457
|
+
children: M(A[e] ?? 0)
|
|
1458
1458
|
}, e)),
|
|
1459
1459
|
p && /* @__PURE__ */ Z("td", {
|
|
1460
|
-
className:
|
|
1460
|
+
className: P("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: j
|
|
1466
1466
|
}) : void 0,
|
|
1467
1467
|
onKeyDown: b ? S(() => x({
|
|
1468
1468
|
scope: "total",
|
|
1469
|
-
value:
|
|
1469
|
+
value: j
|
|
1470
1470
|
})) : void 0,
|
|
1471
|
-
children: j
|
|
1471
|
+
children: M(j)
|
|
1472
1472
|
})
|
|
1473
1473
|
]
|
|
1474
1474
|
}) })
|
|
@@ -1478,13 +1478,13 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1478
1478
|
};
|
|
1479
1479
|
//#endregion
|
|
1480
1480
|
//#region src/ObjectDataTable.tsx
|
|
1481
|
-
function
|
|
1481
|
+
function et(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 tt(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,15 +1502,15 @@ function et(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
|
|
1506
|
-
let a =
|
|
1505
|
+
var nt = ({ schema: e, dataSource: t, className: r }) => {
|
|
1506
|
+
let a = re(s), c = t || a?.dataSource, u = l(e.bind), { fieldLabel: d, fieldOptionLabel: f } = h(), p = "No data available", g = "No data source available for";
|
|
1507
1507
|
try {
|
|
1508
1508
|
let { t: e } = m(), t = e("dashboard.noDataAvailable");
|
|
1509
1509
|
t && t !== "dashboard.noDataAvailable" && (p = t);
|
|
1510
1510
|
let n = e("dashboard.noDataSourceFor");
|
|
1511
1511
|
n && n !== "dashboard.noDataSourceFor" && (g = n);
|
|
1512
1512
|
} catch {}
|
|
1513
|
-
let [_, v] =
|
|
1513
|
+
let [_, v] = V([]), [y, b] = V(null), [x, S] = V(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, w] = V(null);
|
|
1514
1514
|
z(() => {
|
|
1515
1515
|
let t = !0;
|
|
1516
1516
|
return e.objectName && !u && (!e.data || e.data.length === 0) ? (async () => {
|
|
@@ -1522,7 +1522,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1522
1522
|
try {
|
|
1523
1523
|
let r;
|
|
1524
1524
|
if (typeof c.find == "function") {
|
|
1525
|
-
let t =
|
|
1525
|
+
let t = tt(e, y), a = { $filter: i(e.filter) };
|
|
1526
1526
|
t.length && (a.$expand = t), r = n(await c.find(e.objectName, a));
|
|
1527
1527
|
} else return;
|
|
1528
1528
|
t && v(r);
|
|
@@ -1607,13 +1607,13 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1607
1607
|
"€": "EUR",
|
|
1608
1608
|
"£": "GBP"
|
|
1609
1609
|
}[t[0]];
|
|
1610
|
-
return
|
|
1610
|
+
return xe(e, o.currency || n);
|
|
1611
1611
|
}
|
|
1612
1612
|
if (typeof t == "string" && /%/.test(t) && typeof e == "number") {
|
|
1613
1613
|
let n = (t.match(/0\.(0+)%/) || [, ""])[1].length;
|
|
1614
|
-
return
|
|
1614
|
+
return Ce((e > 1 ? e / 100 : e) * 100, n);
|
|
1615
1615
|
}
|
|
1616
|
-
return typeof t == "string" && /[YMDHms]/.test(t) ?
|
|
1616
|
+
return typeof t == "string" && /[YMDHms]/.test(t) ? Se(e, t) : /* @__PURE__ */ Z(we(Te(o)), {
|
|
1617
1617
|
value: e,
|
|
1618
1618
|
field: o
|
|
1619
1619
|
});
|
|
@@ -1626,7 +1626,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1626
1626
|
};
|
|
1627
1627
|
};
|
|
1628
1628
|
if (e.columns && e.columns.length > 0) {
|
|
1629
|
-
let n =
|
|
1629
|
+
let n = et(e.columns);
|
|
1630
1630
|
return (t ? n.map((e) => ({
|
|
1631
1631
|
...e,
|
|
1632
1632
|
header: d(t, e.accessorKey, e.header)
|
|
@@ -1660,17 +1660,17 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1660
1660
|
f
|
|
1661
1661
|
]);
|
|
1662
1662
|
if (x && E.length === 0) return /* @__PURE__ */ Z("div", {
|
|
1663
|
-
className:
|
|
1663
|
+
className: P("overflow-auto", r),
|
|
1664
1664
|
"data-testid": "table-loading",
|
|
1665
1665
|
children: /* @__PURE__ */ Q("div", {
|
|
1666
1666
|
className: "space-y-2 p-2",
|
|
1667
1667
|
children: [/* @__PURE__ */ Q("div", {
|
|
1668
1668
|
className: "flex gap-2",
|
|
1669
1669
|
children: [
|
|
1670
|
-
/* @__PURE__ */ Z(
|
|
1671
|
-
/* @__PURE__ */ Z(
|
|
1672
|
-
/* @__PURE__ */ Z(
|
|
1673
|
-
/* @__PURE__ */ Z(
|
|
1670
|
+
/* @__PURE__ */ Z(N, { className: "h-6 w-1/4" }),
|
|
1671
|
+
/* @__PURE__ */ Z(N, { className: "h-6 w-1/4" }),
|
|
1672
|
+
/* @__PURE__ */ Z(N, { className: "h-6 w-1/4" }),
|
|
1673
|
+
/* @__PURE__ */ Z(N, { className: "h-6 w-1/4" })
|
|
1674
1674
|
]
|
|
1675
1675
|
}), [
|
|
1676
1676
|
1,
|
|
@@ -1680,16 +1680,16 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1680
1680
|
].map((e) => /* @__PURE__ */ Q("div", {
|
|
1681
1681
|
className: "flex gap-2",
|
|
1682
1682
|
children: [
|
|
1683
|
-
/* @__PURE__ */ Z(
|
|
1684
|
-
/* @__PURE__ */ Z(
|
|
1685
|
-
/* @__PURE__ */ Z(
|
|
1686
|
-
/* @__PURE__ */ Z(
|
|
1683
|
+
/* @__PURE__ */ Z(N, { className: "h-5 w-1/4" }),
|
|
1684
|
+
/* @__PURE__ */ Z(N, { className: "h-5 w-1/4" }),
|
|
1685
|
+
/* @__PURE__ */ Z(N, { className: "h-5 w-1/4" }),
|
|
1686
|
+
/* @__PURE__ */ Z(N, { className: "h-5 w-1/4" })
|
|
1687
1687
|
]
|
|
1688
1688
|
}, e))]
|
|
1689
1689
|
})
|
|
1690
1690
|
});
|
|
1691
1691
|
if (C) return /* @__PURE__ */ Z("div", {
|
|
1692
|
-
className:
|
|
1692
|
+
className: P("overflow-auto", r),
|
|
1693
1693
|
"data-testid": "table-error",
|
|
1694
1694
|
children: /* @__PURE__ */ Q("div", {
|
|
1695
1695
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
@@ -1729,7 +1729,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1729
1729
|
})
|
|
1730
1730
|
});
|
|
1731
1731
|
if (!c && e.objectName && E.length === 0) return /* @__PURE__ */ Z("div", {
|
|
1732
|
-
className:
|
|
1732
|
+
className: P("overflow-auto", r),
|
|
1733
1733
|
children: /* @__PURE__ */ Z("div", {
|
|
1734
1734
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1735
1735
|
children: /* @__PURE__ */ Q("p", {
|
|
@@ -1744,7 +1744,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1744
1744
|
})
|
|
1745
1745
|
});
|
|
1746
1746
|
if (E.length === 0) return /* @__PURE__ */ Z("div", {
|
|
1747
|
-
className:
|
|
1747
|
+
className: P("overflow-auto", r),
|
|
1748
1748
|
"data-testid": "table-empty-state",
|
|
1749
1749
|
children: /* @__PURE__ */ Q("div", {
|
|
1750
1750
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
@@ -1785,22 +1785,22 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1785
1785
|
})]
|
|
1786
1786
|
})
|
|
1787
1787
|
});
|
|
1788
|
-
let
|
|
1788
|
+
let O = {
|
|
1789
1789
|
...e,
|
|
1790
1790
|
type: "data-table",
|
|
1791
1791
|
data: E,
|
|
1792
1792
|
columns: D
|
|
1793
1793
|
};
|
|
1794
1794
|
return /* @__PURE__ */ Q("div", {
|
|
1795
|
-
className:
|
|
1796
|
-
children: [/* @__PURE__ */ Z(
|
|
1797
|
-
schema:
|
|
1795
|
+
className: P("relative", r),
|
|
1796
|
+
children: [/* @__PURE__ */ Z(k, { active: x && E.length > 0 }), /* @__PURE__ */ Z(o, {
|
|
1797
|
+
schema: O,
|
|
1798
1798
|
className: r
|
|
1799
1799
|
})]
|
|
1800
1800
|
});
|
|
1801
|
-
},
|
|
1801
|
+
}, rt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: s, columns: c, maxRows: l, className: u, report: d }) => {
|
|
1802
1802
|
let f = d && typeof d == "object" && (Array.isArray(d.columns) || "objectName" in d), p = /* @__PURE__ */ Z("div", {
|
|
1803
|
-
className:
|
|
1803
|
+
className: P("overflow-auto", u),
|
|
1804
1804
|
"data-testid": "drill-down-body",
|
|
1805
1805
|
children: f ? (() => {
|
|
1806
1806
|
let e = d.filter, t = e ? a ? { $and: [e, a] } : e : a;
|
|
@@ -1813,7 +1813,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1813
1813
|
},
|
|
1814
1814
|
filter: t
|
|
1815
1815
|
} });
|
|
1816
|
-
})() : /* @__PURE__ */ Z(
|
|
1816
|
+
})() : /* @__PURE__ */ Z(nt, {
|
|
1817
1817
|
schema: {
|
|
1818
1818
|
type: "object-data-table",
|
|
1819
1819
|
objectName: i,
|
|
@@ -1829,27 +1829,27 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1829
1829
|
dataSource: s
|
|
1830
1830
|
})
|
|
1831
1831
|
});
|
|
1832
|
-
return r === "dialog" ? /* @__PURE__ */ Z(
|
|
1832
|
+
return r === "dialog" ? /* @__PURE__ */ Z(T, {
|
|
1833
1833
|
open: e,
|
|
1834
1834
|
onOpenChange: (e) => !e && t(),
|
|
1835
|
-
children: /* @__PURE__ */ Q(
|
|
1835
|
+
children: /* @__PURE__ */ Q(E, {
|
|
1836
1836
|
className: "max-w-5xl",
|
|
1837
|
-
children: [/* @__PURE__ */ Z(
|
|
1837
|
+
children: [/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(O, { children: n }) }), p]
|
|
1838
1838
|
})
|
|
1839
|
-
}) : /* @__PURE__ */ Z(
|
|
1839
|
+
}) : /* @__PURE__ */ Z(A, {
|
|
1840
1840
|
open: e,
|
|
1841
1841
|
onOpenChange: (e) => !e && t(),
|
|
1842
|
-
children: /* @__PURE__ */ Q(
|
|
1842
|
+
children: /* @__PURE__ */ Q(j, {
|
|
1843
1843
|
side: "right",
|
|
1844
1844
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1845
|
-
children: [/* @__PURE__ */ Z(
|
|
1845
|
+
children: [/* @__PURE__ */ Z(M, { children: /* @__PURE__ */ Z(ee, { children: n }) }), /* @__PURE__ */ Z("div", {
|
|
1846
1846
|
className: "flex-1 overflow-hidden mt-2",
|
|
1847
1847
|
children: p
|
|
1848
1848
|
})]
|
|
1849
1849
|
})
|
|
1850
1850
|
});
|
|
1851
|
-
},
|
|
1852
|
-
let u =
|
|
1851
|
+
}, it = ({ schema: e, dataSource: o, className: c }) => {
|
|
1852
|
+
let u = re(s), d = o || u?.dataSource, f = l(e.bind), [p, m] = V([]), [g, _] = V(!1), [v, y] = V(null), [b, x] = V({}), [S, C] = V({}), [w, T] = V(null), { fieldLabel: E, fieldOptionLabel: D } = h(), O = ie(E), k = ie(D);
|
|
1853
1853
|
z(() => {
|
|
1854
1854
|
O.current = E, k.current = D;
|
|
1855
1855
|
}, [E, D]), z(() => {
|
|
@@ -1905,7 +1905,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1905
1905
|
]);
|
|
1906
1906
|
let A = f || e.data || p, j = Array.isArray(A) ? A : [];
|
|
1907
1907
|
if (g && j.length === 0) return /* @__PURE__ */ Q("div", {
|
|
1908
|
-
className:
|
|
1908
|
+
className: P("overflow-auto", c),
|
|
1909
1909
|
"data-testid": "pivot-loading",
|
|
1910
1910
|
children: [e.title && /* @__PURE__ */ Z("h3", {
|
|
1911
1911
|
className: "text-sm font-semibold mb-2",
|
|
@@ -1915,10 +1915,10 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1915
1915
|
children: [/* @__PURE__ */ Q("div", {
|
|
1916
1916
|
className: "flex gap-2",
|
|
1917
1917
|
children: [
|
|
1918
|
-
/* @__PURE__ */ Z(
|
|
1919
|
-
/* @__PURE__ */ Z(
|
|
1920
|
-
/* @__PURE__ */ Z(
|
|
1921
|
-
/* @__PURE__ */ Z(
|
|
1918
|
+
/* @__PURE__ */ Z(N, { className: "h-6 w-24" }),
|
|
1919
|
+
/* @__PURE__ */ Z(N, { className: "h-6 w-20" }),
|
|
1920
|
+
/* @__PURE__ */ Z(N, { className: "h-6 w-20" }),
|
|
1921
|
+
/* @__PURE__ */ Z(N, { className: "h-6 w-20" })
|
|
1922
1922
|
]
|
|
1923
1923
|
}), [
|
|
1924
1924
|
1,
|
|
@@ -1927,16 +1927,16 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1927
1927
|
].map((e) => /* @__PURE__ */ Q("div", {
|
|
1928
1928
|
className: "flex gap-2",
|
|
1929
1929
|
children: [
|
|
1930
|
-
/* @__PURE__ */ Z(
|
|
1931
|
-
/* @__PURE__ */ Z(
|
|
1932
|
-
/* @__PURE__ */ Z(
|
|
1933
|
-
/* @__PURE__ */ Z(
|
|
1930
|
+
/* @__PURE__ */ Z(N, { className: "h-5 w-24" }),
|
|
1931
|
+
/* @__PURE__ */ Z(N, { className: "h-5 w-20" }),
|
|
1932
|
+
/* @__PURE__ */ Z(N, { className: "h-5 w-20" }),
|
|
1933
|
+
/* @__PURE__ */ Z(N, { className: "h-5 w-20" })
|
|
1934
1934
|
]
|
|
1935
1935
|
}, e))]
|
|
1936
1936
|
})]
|
|
1937
1937
|
});
|
|
1938
1938
|
if (v) return /* @__PURE__ */ Q("div", {
|
|
1939
|
-
className:
|
|
1939
|
+
className: P("overflow-auto", c),
|
|
1940
1940
|
"data-testid": "pivot-error",
|
|
1941
1941
|
children: [e.title && /* @__PURE__ */ Z("h3", {
|
|
1942
1942
|
className: "text-sm font-semibold mb-2",
|
|
@@ -1979,7 +1979,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1979
1979
|
})]
|
|
1980
1980
|
});
|
|
1981
1981
|
if (!d && e.objectName && j.length === 0) return /* @__PURE__ */ Q("div", {
|
|
1982
|
-
className:
|
|
1982
|
+
className: P("overflow-auto", c),
|
|
1983
1983
|
children: [e.title && /* @__PURE__ */ Z("h3", {
|
|
1984
1984
|
className: "text-sm font-semibold mb-2",
|
|
1985
1985
|
children: e.title
|
|
@@ -1995,40 +1995,40 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1995
1995
|
})
|
|
1996
1996
|
})]
|
|
1997
1997
|
});
|
|
1998
|
-
let
|
|
1998
|
+
let M = {
|
|
1999
1999
|
...e,
|
|
2000
2000
|
data: j
|
|
2001
|
-
},
|
|
2002
|
-
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(
|
|
2003
|
-
schema:
|
|
2001
|
+
}, ee = e.rowField ? b[e.rowField] : void 0, F = e.columnField ? b[e.columnField] : void 0, te = e.rowField ? S[e.rowField] : void 0, I = e.drillDown;
|
|
2002
|
+
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z($e, {
|
|
2003
|
+
schema: M,
|
|
2004
2004
|
className: c,
|
|
2005
|
-
rowLabels:
|
|
2005
|
+
rowLabels: ee,
|
|
2006
2006
|
columnLabels: F,
|
|
2007
|
-
rowFieldLabel:
|
|
2008
|
-
onDrillDown: r(
|
|
2007
|
+
rowFieldLabel: te,
|
|
2008
|
+
onDrillDown: r(I) ? (e) => T(e) : void 0
|
|
2009
2009
|
}), (() => {
|
|
2010
2010
|
if (!w || !e.objectName) return null;
|
|
2011
|
-
let n = t(
|
|
2011
|
+
let n = t(I, w, {
|
|
2012
2012
|
rowField: e.rowField,
|
|
2013
2013
|
columnField: e.columnField
|
|
2014
2014
|
}), r = {
|
|
2015
2015
|
...e.filter || {},
|
|
2016
2016
|
...n
|
|
2017
2017
|
};
|
|
2018
|
-
return /* @__PURE__ */ Z(
|
|
2018
|
+
return /* @__PURE__ */ Z(rt, {
|
|
2019
2019
|
open: !0,
|
|
2020
2020
|
onClose: () => T(null),
|
|
2021
|
-
title: a(
|
|
2022
|
-
target:
|
|
2021
|
+
title: a(I, w, e.title || "Details"),
|
|
2022
|
+
target: I?.target ?? "drawer",
|
|
2023
2023
|
objectName: e.objectName,
|
|
2024
2024
|
filter: r,
|
|
2025
2025
|
dataSource: d,
|
|
2026
|
-
columns:
|
|
2027
|
-
maxRows:
|
|
2028
|
-
report:
|
|
2026
|
+
columns: I?.columns,
|
|
2027
|
+
maxRows: I?.maxRows,
|
|
2028
|
+
report: I?.report
|
|
2029
2029
|
});
|
|
2030
2030
|
})()] });
|
|
2031
|
-
},
|
|
2031
|
+
}, at = {
|
|
2032
2032
|
breadcrumb: ["Dashboard", "Configuration"],
|
|
2033
2033
|
sections: [
|
|
2034
2034
|
{
|
|
@@ -2154,12 +2154,12 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
2154
2154
|
}
|
|
2155
2155
|
]
|
|
2156
2156
|
};
|
|
2157
|
-
function
|
|
2158
|
-
let { draft: a, isDirty: o, updateField: s, discard: c } =
|
|
2157
|
+
function ot({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
2158
|
+
let { draft: a, isDirty: o, updateField: s, discard: c } = te(n, { onUpdate: i });
|
|
2159
2159
|
return /* @__PURE__ */ Z(S, {
|
|
2160
2160
|
open: e,
|
|
2161
2161
|
onClose: t,
|
|
2162
|
-
schema:
|
|
2162
|
+
schema: at,
|
|
2163
2163
|
draft: a,
|
|
2164
2164
|
isDirty: o,
|
|
2165
2165
|
onFieldChange: s,
|
|
@@ -2169,7 +2169,7 @@ function at({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
|
2169
2169
|
}
|
|
2170
2170
|
//#endregion
|
|
2171
2171
|
//#region src/WidgetConfigPanel.tsx
|
|
2172
|
-
var
|
|
2172
|
+
var st = [
|
|
2173
2173
|
{
|
|
2174
2174
|
value: "metric",
|
|
2175
2175
|
label: "Metric"
|
|
@@ -2214,7 +2214,7 @@ var ot = [
|
|
|
2214
2214
|
value: "pivot",
|
|
2215
2215
|
label: "Pivot Table"
|
|
2216
2216
|
}
|
|
2217
|
-
],
|
|
2217
|
+
], ct = [
|
|
2218
2218
|
{
|
|
2219
2219
|
value: "default",
|
|
2220
2220
|
label: "Default"
|
|
@@ -2247,7 +2247,7 @@ var ot = [
|
|
|
2247
2247
|
value: "danger",
|
|
2248
2248
|
label: "Danger"
|
|
2249
2249
|
}
|
|
2250
|
-
],
|
|
2250
|
+
], lt = [
|
|
2251
2251
|
{
|
|
2252
2252
|
value: "count",
|
|
2253
2253
|
label: "Count"
|
|
@@ -2268,7 +2268,7 @@ var ot = [
|
|
|
2268
2268
|
value: "max",
|
|
2269
2269
|
label: "Max"
|
|
2270
2270
|
}
|
|
2271
|
-
],
|
|
2271
|
+
], ut = [
|
|
2272
2272
|
"bar",
|
|
2273
2273
|
"horizontal-bar",
|
|
2274
2274
|
"line",
|
|
@@ -2277,17 +2277,17 @@ var ot = [
|
|
|
2277
2277
|
"donut",
|
|
2278
2278
|
"scatter",
|
|
2279
2279
|
"funnel"
|
|
2280
|
-
],
|
|
2280
|
+
], dt = [
|
|
2281
2281
|
"bar",
|
|
2282
2282
|
"horizontal-bar",
|
|
2283
2283
|
"line",
|
|
2284
2284
|
"area",
|
|
2285
2285
|
"scatter"
|
|
2286
|
-
],
|
|
2286
|
+
], ft = [
|
|
2287
2287
|
"pie",
|
|
2288
2288
|
"donut",
|
|
2289
2289
|
"funnel"
|
|
2290
|
-
],
|
|
2290
|
+
], pt = ["metric", ...ut], mt = [...ut], ht = [
|
|
2291
2291
|
"pivot",
|
|
2292
2292
|
"metric",
|
|
2293
2293
|
"bar",
|
|
@@ -2298,41 +2298,41 @@ var ot = [
|
|
|
2298
2298
|
"donut",
|
|
2299
2299
|
"funnel"
|
|
2300
2300
|
];
|
|
2301
|
-
function ht(e) {
|
|
2302
|
-
return !!e && lt.includes(e);
|
|
2303
|
-
}
|
|
2304
2301
|
function gt(e) {
|
|
2305
2302
|
return !!e && ut.includes(e);
|
|
2306
2303
|
}
|
|
2307
2304
|
function _t(e) {
|
|
2308
|
-
return !!e &&
|
|
2305
|
+
return !!e && dt.includes(e);
|
|
2309
2306
|
}
|
|
2310
2307
|
function vt(e) {
|
|
2311
|
-
return !!e &&
|
|
2308
|
+
return !!e && mt.includes(e);
|
|
2312
2309
|
}
|
|
2313
2310
|
function yt(e) {
|
|
2314
|
-
return !!e &&
|
|
2311
|
+
return !!e && pt.includes(e);
|
|
2312
|
+
}
|
|
2313
|
+
function bt(e) {
|
|
2314
|
+
return !!e && ht.includes(e);
|
|
2315
2315
|
}
|
|
2316
|
-
var
|
|
2316
|
+
var xt = [{
|
|
2317
2317
|
value: "drawer",
|
|
2318
2318
|
label: "Side drawer"
|
|
2319
2319
|
}, {
|
|
2320
2320
|
value: "dialog",
|
|
2321
2321
|
label: "Center dialog"
|
|
2322
|
-
}],
|
|
2322
|
+
}], St = [{
|
|
2323
2323
|
value: "group",
|
|
2324
2324
|
label: "Group"
|
|
2325
2325
|
}, {
|
|
2326
2326
|
value: "value",
|
|
2327
2327
|
label: "Value"
|
|
2328
|
-
}],
|
|
2328
|
+
}], Ct = [{
|
|
2329
2329
|
value: "asc",
|
|
2330
2330
|
label: "↑"
|
|
2331
2331
|
}, {
|
|
2332
2332
|
value: "desc",
|
|
2333
2333
|
label: "↓"
|
|
2334
2334
|
}];
|
|
2335
|
-
function
|
|
2335
|
+
function wt(e, t, n, r) {
|
|
2336
2336
|
return {
|
|
2337
2337
|
key: e,
|
|
2338
2338
|
label: t,
|
|
@@ -2355,7 +2355,7 @@ function Ct(e, t, n, r) {
|
|
|
2355
2355
|
})
|
|
2356
2356
|
};
|
|
2357
2357
|
}
|
|
2358
|
-
function
|
|
2358
|
+
function Tt(e, t, n) {
|
|
2359
2359
|
let r = e && e.length > 0, i = r ? {
|
|
2360
2360
|
key: "object",
|
|
2361
2361
|
label: "Data source",
|
|
@@ -2381,38 +2381,38 @@ function wt(e, t, n) {
|
|
|
2381
2381
|
type: "input",
|
|
2382
2382
|
placeholder: "Object name"
|
|
2383
2383
|
}, a = r ? {
|
|
2384
|
-
...
|
|
2384
|
+
...wt("categoryField", "Category field", "Select field…", t),
|
|
2385
2385
|
helpText: "Group records by this field (one bar/slice/segment per value).",
|
|
2386
|
-
visibleWhen: (e) =>
|
|
2386
|
+
visibleWhen: (e) => vt(e.type)
|
|
2387
2387
|
} : {
|
|
2388
2388
|
key: "categoryField",
|
|
2389
2389
|
label: "Category field",
|
|
2390
2390
|
type: "input",
|
|
2391
2391
|
placeholder: "e.g. status",
|
|
2392
2392
|
helpText: "Group records by this field (one bar/slice/segment per value).",
|
|
2393
|
-
visibleWhen: (e) =>
|
|
2393
|
+
visibleWhen: (e) => vt(e.type)
|
|
2394
2394
|
}, o = r ? {
|
|
2395
|
-
...
|
|
2395
|
+
...wt("valueField", "Value field", "Select field…", t),
|
|
2396
2396
|
helpText: "Field to aggregate (sum / average / min / max).",
|
|
2397
|
-
visibleWhen: (e) =>
|
|
2397
|
+
visibleWhen: (e) => yt(e.type) && (e.aggregate ?? "count") !== "count"
|
|
2398
2398
|
} : {
|
|
2399
2399
|
key: "valueField",
|
|
2400
2400
|
label: "Value field",
|
|
2401
2401
|
type: "input",
|
|
2402
2402
|
placeholder: "e.g. amount",
|
|
2403
2403
|
helpText: "Field to aggregate (sum / average / min / max).",
|
|
2404
|
-
visibleWhen: (e) =>
|
|
2405
|
-
}, s = r ?
|
|
2404
|
+
visibleWhen: (e) => yt(e.type) && (e.aggregate ?? "count") !== "count"
|
|
2405
|
+
}, s = r ? wt("rowField", "Field", "Select row field…", t) : {
|
|
2406
2406
|
key: "rowField",
|
|
2407
2407
|
label: "Field",
|
|
2408
2408
|
type: "input",
|
|
2409
2409
|
placeholder: "e.g. owner"
|
|
2410
|
-
}, c = r ?
|
|
2410
|
+
}, c = r ? wt("columnField", "Field", "Select column field…", t) : {
|
|
2411
2411
|
key: "columnField",
|
|
2412
2412
|
label: "Field",
|
|
2413
2413
|
type: "input",
|
|
2414
2414
|
placeholder: "e.g. stage"
|
|
2415
|
-
}, l = r ?
|
|
2415
|
+
}, l = r ? wt("valueField", "Field", "Select value field…", t) : {
|
|
2416
2416
|
key: "valueField",
|
|
2417
2417
|
label: "Field",
|
|
2418
2418
|
type: "input",
|
|
@@ -2422,7 +2422,7 @@ function wt(e, t, n) {
|
|
|
2422
2422
|
breadcrumb: ["Dashboard", {
|
|
2423
2423
|
pivot: "Pivot table",
|
|
2424
2424
|
table: "Table"
|
|
2425
|
-
}[n ?? ""] ?? (
|
|
2425
|
+
}[n ?? ""] ?? (gt(n) ? "Chart" : "Widget")],
|
|
2426
2426
|
sections: [
|
|
2427
2427
|
{
|
|
2428
2428
|
key: "general",
|
|
@@ -2444,7 +2444,7 @@ function wt(e, t, n) {
|
|
|
2444
2444
|
key: "type",
|
|
2445
2445
|
label: "Widget type",
|
|
2446
2446
|
type: "select",
|
|
2447
|
-
options:
|
|
2447
|
+
options: st,
|
|
2448
2448
|
defaultValue: "metric"
|
|
2449
2449
|
}
|
|
2450
2450
|
]
|
|
@@ -2462,10 +2462,10 @@ function wt(e, t, n) {
|
|
|
2462
2462
|
key: "aggregate",
|
|
2463
2463
|
label: "Aggregation",
|
|
2464
2464
|
type: "select",
|
|
2465
|
-
options:
|
|
2465
|
+
options: lt,
|
|
2466
2466
|
defaultValue: "count",
|
|
2467
2467
|
helpText: "Count ignores Value field; Sum / Avg / Min / Max require it.",
|
|
2468
|
-
visibleWhen: (e) =>
|
|
2468
|
+
visibleWhen: (e) => yt(e.type)
|
|
2469
2469
|
}
|
|
2470
2470
|
]
|
|
2471
2471
|
},
|
|
@@ -2487,14 +2487,14 @@ function wt(e, t, n) {
|
|
|
2487
2487
|
key: "rowSortBy",
|
|
2488
2488
|
label: "Sort by",
|
|
2489
2489
|
type: "icon-group",
|
|
2490
|
-
options:
|
|
2490
|
+
options: St,
|
|
2491
2491
|
defaultValue: "group"
|
|
2492
2492
|
},
|
|
2493
2493
|
{
|
|
2494
2494
|
key: "rowSortOrder",
|
|
2495
2495
|
label: "Sort order",
|
|
2496
2496
|
type: "icon-group",
|
|
2497
|
-
options:
|
|
2497
|
+
options: Ct,
|
|
2498
2498
|
defaultValue: "asc"
|
|
2499
2499
|
},
|
|
2500
2500
|
{
|
|
@@ -2522,14 +2522,14 @@ function wt(e, t, n) {
|
|
|
2522
2522
|
key: "columnSortBy",
|
|
2523
2523
|
label: "Sort by",
|
|
2524
2524
|
type: "icon-group",
|
|
2525
|
-
options:
|
|
2525
|
+
options: St,
|
|
2526
2526
|
defaultValue: "group"
|
|
2527
2527
|
},
|
|
2528
2528
|
{
|
|
2529
2529
|
key: "columnSortOrder",
|
|
2530
2530
|
label: "Sort order",
|
|
2531
2531
|
type: "icon-group",
|
|
2532
|
-
options:
|
|
2532
|
+
options: Ct,
|
|
2533
2533
|
defaultValue: "asc"
|
|
2534
2534
|
},
|
|
2535
2535
|
{
|
|
@@ -2557,7 +2557,7 @@ function wt(e, t, n) {
|
|
|
2557
2557
|
key: "aggregation",
|
|
2558
2558
|
label: "Aggregation",
|
|
2559
2559
|
type: "select",
|
|
2560
|
-
options:
|
|
2560
|
+
options: lt,
|
|
2561
2561
|
defaultValue: "sum"
|
|
2562
2562
|
},
|
|
2563
2563
|
{
|
|
@@ -2572,7 +2572,7 @@ function wt(e, t, n) {
|
|
|
2572
2572
|
key: "chart-axis",
|
|
2573
2573
|
title: "Axis & Series",
|
|
2574
2574
|
collapsible: !0,
|
|
2575
|
-
visibleWhen: (e) =>
|
|
2575
|
+
visibleWhen: (e) => _t(e.type),
|
|
2576
2576
|
fields: [
|
|
2577
2577
|
{
|
|
2578
2578
|
key: "xAxisLabel",
|
|
@@ -2598,7 +2598,7 @@ function wt(e, t, n) {
|
|
|
2598
2598
|
key: "chart-legend",
|
|
2599
2599
|
title: "Display",
|
|
2600
2600
|
collapsible: !0,
|
|
2601
|
-
visibleWhen: (e) => !!e.type &&
|
|
2601
|
+
visibleWhen: (e) => !!e.type && ft.includes(e.type),
|
|
2602
2602
|
fields: [{
|
|
2603
2603
|
key: "showLegend",
|
|
2604
2604
|
label: "Show legend",
|
|
@@ -2650,7 +2650,7 @@ function wt(e, t, n) {
|
|
|
2650
2650
|
title: "Drill-down",
|
|
2651
2651
|
collapsible: !0,
|
|
2652
2652
|
defaultCollapsed: !0,
|
|
2653
|
-
visibleWhen: (e) =>
|
|
2653
|
+
visibleWhen: (e) => bt(e.type),
|
|
2654
2654
|
fields: [{
|
|
2655
2655
|
key: "drillDownEnabled",
|
|
2656
2656
|
label: "Enable drill-down",
|
|
@@ -2661,7 +2661,7 @@ function wt(e, t, n) {
|
|
|
2661
2661
|
key: "drillDownTarget",
|
|
2662
2662
|
label: "Open in",
|
|
2663
2663
|
type: "select",
|
|
2664
|
-
options:
|
|
2664
|
+
options: xt,
|
|
2665
2665
|
defaultValue: "drawer",
|
|
2666
2666
|
visibleWhen: (e) => !!e.drillDownEnabled
|
|
2667
2667
|
}]
|
|
@@ -2687,14 +2687,14 @@ function wt(e, t, n) {
|
|
|
2687
2687
|
key: "colorVariant",
|
|
2688
2688
|
label: "Color variant",
|
|
2689
2689
|
type: "select",
|
|
2690
|
-
options:
|
|
2690
|
+
options: ct,
|
|
2691
2691
|
defaultValue: "default"
|
|
2692
2692
|
}]
|
|
2693
2693
|
}
|
|
2694
2694
|
]
|
|
2695
2695
|
};
|
|
2696
2696
|
}
|
|
2697
|
-
function
|
|
2697
|
+
function Et(e) {
|
|
2698
2698
|
if (e == null) return "";
|
|
2699
2699
|
if (typeof e == "string") return e;
|
|
2700
2700
|
if (typeof e == "object") {
|
|
@@ -2703,20 +2703,20 @@ function Tt(e) {
|
|
|
2703
2703
|
}
|
|
2704
2704
|
return String(e);
|
|
2705
2705
|
}
|
|
2706
|
-
function
|
|
2706
|
+
function Dt(e) {
|
|
2707
2707
|
let t = e.type, n = { ...e };
|
|
2708
|
-
return
|
|
2708
|
+
return vt(t) || delete n.categoryField, yt(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), _t(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), bt(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
|
|
2709
2709
|
}
|
|
2710
|
-
function
|
|
2711
|
-
let { draft: c, isDirty: l, updateField: u, discard: d } =
|
|
2710
|
+
function Ot({ 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 } = te(I.useMemo(() => ({
|
|
2712
2712
|
...n,
|
|
2713
|
-
title: typeof n.title == "object" ?
|
|
2714
|
-
description: typeof n.description == "object" ?
|
|
2713
|
+
title: typeof n.title == "object" ? Et(n.title) : n.title,
|
|
2714
|
+
description: typeof n.description == "object" ? Et(n.description) : n.description
|
|
2715
2715
|
}), [n]), { onUpdate: i });
|
|
2716
2716
|
return /* @__PURE__ */ Z(S, {
|
|
2717
2717
|
open: e,
|
|
2718
2718
|
onClose: t,
|
|
2719
|
-
schema: I.useMemo(() =>
|
|
2719
|
+
schema: I.useMemo(() => Tt(o, s, c.type), [
|
|
2720
2720
|
o,
|
|
2721
2721
|
s,
|
|
2722
2722
|
c.type
|
|
@@ -2724,15 +2724,15 @@ function Dt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
|
|
|
2724
2724
|
draft: c,
|
|
2725
2725
|
isDirty: l,
|
|
2726
2726
|
onFieldChange: u,
|
|
2727
|
-
onSave: () => r(
|
|
2727
|
+
onSave: () => r(Dt(c)),
|
|
2728
2728
|
onDiscard: d,
|
|
2729
2729
|
headerExtra: a
|
|
2730
2730
|
});
|
|
2731
2731
|
}
|
|
2732
2732
|
//#endregion
|
|
2733
2733
|
//#region src/DashboardWithConfig.tsx
|
|
2734
|
-
function
|
|
2735
|
-
let [c, l] =
|
|
2734
|
+
function kt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
|
|
2735
|
+
let [c, l] = V(o), [u, d] = V(null), [f, p] = V(e), [m, h] = V(0);
|
|
2736
2736
|
z(() => {
|
|
2737
2737
|
p(e), h((e) => e + 1);
|
|
2738
2738
|
}, [e]);
|
|
@@ -2820,7 +2820,7 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2820
2820
|
l((e) => !e), d(null);
|
|
2821
2821
|
}, []);
|
|
2822
2822
|
return /* @__PURE__ */ Q("div", {
|
|
2823
|
-
className:
|
|
2823
|
+
className: P("flex h-full w-full", s),
|
|
2824
2824
|
"data-testid": "dashboard-with-config",
|
|
2825
2825
|
children: [/* @__PURE__ */ Q("div", {
|
|
2826
2826
|
className: "flex-1 min-w-0 overflow-auto relative",
|
|
@@ -2831,9 +2831,9 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2831
2831
|
variant: c ? "default" : "outline",
|
|
2832
2832
|
onClick: S,
|
|
2833
2833
|
"data-testid": "dashboard-config-toggle",
|
|
2834
|
-
children: [/* @__PURE__ */ Z(
|
|
2834
|
+
children: [/* @__PURE__ */ Z(ce, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
|
|
2835
2835
|
})
|
|
2836
|
-
}), /* @__PURE__ */ Z(
|
|
2836
|
+
}), /* @__PURE__ */ Z(Me, {
|
|
2837
2837
|
schema: f,
|
|
2838
2838
|
onRefresh: i,
|
|
2839
2839
|
recordCount: a,
|
|
@@ -2843,13 +2843,13 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2843
2843
|
})]
|
|
2844
2844
|
}), c && /* @__PURE__ */ Z("div", {
|
|
2845
2845
|
className: "relative shrink-0",
|
|
2846
|
-
children: u && _ ? /* @__PURE__ */ Z(
|
|
2846
|
+
children: u && _ ? /* @__PURE__ */ Z(Ot, {
|
|
2847
2847
|
open: !0,
|
|
2848
2848
|
onClose: y,
|
|
2849
2849
|
config: _,
|
|
2850
2850
|
onSave: x,
|
|
2851
2851
|
onFieldChange: b
|
|
2852
|
-
}) : /* @__PURE__ */ Z(
|
|
2852
|
+
}) : /* @__PURE__ */ Z(ot, {
|
|
2853
2853
|
open: !0,
|
|
2854
2854
|
onClose: () => l(!1),
|
|
2855
2855
|
config: t,
|
|
@@ -2858,7 +2858,7 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2858
2858
|
})]
|
|
2859
2859
|
});
|
|
2860
2860
|
}
|
|
2861
|
-
e.register("dashboard",
|
|
2861
|
+
e.register("dashboard", Me, {
|
|
2862
2862
|
namespace: "view",
|
|
2863
2863
|
label: "Dashboard",
|
|
2864
2864
|
category: "Complex",
|
|
@@ -2886,7 +2886,7 @@ e.register("dashboard", je, {
|
|
|
2886
2886
|
columns: 3,
|
|
2887
2887
|
widgets: []
|
|
2888
2888
|
}
|
|
2889
|
-
}), e.register("metric",
|
|
2889
|
+
}), e.register("metric", Ue, {
|
|
2890
2890
|
namespace: "plugin-dashboard",
|
|
2891
2891
|
label: "Metric Widget",
|
|
2892
2892
|
category: "Dashboard",
|
|
@@ -2899,7 +2899,7 @@ e.register("dashboard", je, {
|
|
|
2899
2899
|
type: "string",
|
|
2900
2900
|
label: "Value"
|
|
2901
2901
|
}]
|
|
2902
|
-
}), e.register("metric-card",
|
|
2902
|
+
}), e.register("metric-card", Ge, {
|
|
2903
2903
|
namespace: "plugin-dashboard",
|
|
2904
2904
|
label: "Metric Card",
|
|
2905
2905
|
category: "Dashboard",
|
|
@@ -2954,7 +2954,7 @@ e.register("dashboard", je, {
|
|
|
2954
2954
|
title: "Metric",
|
|
2955
2955
|
value: "0"
|
|
2956
2956
|
}
|
|
2957
|
-
}), e.register("object-metric",
|
|
2957
|
+
}), e.register("object-metric", Ke, {
|
|
2958
2958
|
namespace: "plugin-dashboard",
|
|
2959
2959
|
label: "Object Metric",
|
|
2960
2960
|
category: "Dashboard",
|
|
@@ -2983,7 +2983,7 @@ e.register("dashboard", je, {
|
|
|
2983
2983
|
}
|
|
2984
2984
|
],
|
|
2985
2985
|
defaultProps: { label: "Metric" }
|
|
2986
|
-
}), e.register("pivot",
|
|
2986
|
+
}), e.register("pivot", $e, {
|
|
2987
2987
|
namespace: "plugin-dashboard",
|
|
2988
2988
|
label: "Pivot Table",
|
|
2989
2989
|
category: "Dashboard",
|
|
@@ -3062,7 +3062,7 @@ e.register("dashboard", je, {
|
|
|
3062
3062
|
aggregation: "sum",
|
|
3063
3063
|
data: []
|
|
3064
3064
|
}
|
|
3065
|
-
}), e.register("object-pivot",
|
|
3065
|
+
}), e.register("object-pivot", it, {
|
|
3066
3066
|
namespace: "plugin-dashboard",
|
|
3067
3067
|
label: "Object Pivot Table",
|
|
3068
3068
|
category: "Dashboard",
|
|
@@ -3151,7 +3151,7 @@ e.register("dashboard", je, {
|
|
|
3151
3151
|
valueField: "",
|
|
3152
3152
|
aggregation: "sum"
|
|
3153
3153
|
}
|
|
3154
|
-
}), e.register("dashboard-grid",
|
|
3154
|
+
}), e.register("dashboard-grid", Le, {
|
|
3155
3155
|
namespace: "plugin-dashboard",
|
|
3156
3156
|
label: "Dashboard Grid (Editable)",
|
|
3157
3157
|
category: "Complex",
|
|
@@ -3169,7 +3169,7 @@ e.register("dashboard", je, {
|
|
|
3169
3169
|
title: "Dashboard",
|
|
3170
3170
|
widgets: []
|
|
3171
3171
|
}
|
|
3172
|
-
}), e.register("object-data-table",
|
|
3172
|
+
}), e.register("object-data-table", nt, {
|
|
3173
3173
|
namespace: "plugin-dashboard",
|
|
3174
3174
|
label: "Object Data Table",
|
|
3175
3175
|
category: "Dashboard",
|
|
@@ -3207,18 +3207,18 @@ e.register("dashboard", je, {
|
|
|
3207
3207
|
pagination: !1
|
|
3208
3208
|
}
|
|
3209
3209
|
});
|
|
3210
|
-
var
|
|
3211
|
-
DashboardRenderer:
|
|
3212
|
-
DashboardGridLayout:
|
|
3213
|
-
MetricWidget:
|
|
3214
|
-
MetricCard:
|
|
3215
|
-
ObjectMetricWidget:
|
|
3216
|
-
PivotTable:
|
|
3217
|
-
ObjectPivotTable:
|
|
3218
|
-
ObjectDataTable:
|
|
3219
|
-
DashboardConfigPanel:
|
|
3220
|
-
WidgetConfigPanel:
|
|
3221
|
-
DashboardWithConfig:
|
|
3210
|
+
var At = {
|
|
3211
|
+
DashboardRenderer: Me,
|
|
3212
|
+
DashboardGridLayout: Le,
|
|
3213
|
+
MetricWidget: Ue,
|
|
3214
|
+
MetricCard: Ge,
|
|
3215
|
+
ObjectMetricWidget: Ke,
|
|
3216
|
+
PivotTable: $e,
|
|
3217
|
+
ObjectPivotTable: it,
|
|
3218
|
+
ObjectDataTable: nt,
|
|
3219
|
+
DashboardConfigPanel: ot,
|
|
3220
|
+
WidgetConfigPanel: Ot,
|
|
3221
|
+
DashboardWithConfig: kt
|
|
3222
3222
|
};
|
|
3223
3223
|
//#endregion
|
|
3224
|
-
export {
|
|
3224
|
+
export { ot as DashboardConfigPanel, Le as DashboardGridLayout, Me as DashboardRenderer, kt as DashboardWithConfig, rt as DrillDownDrawer, Ge as MetricCard, Ue as MetricWidget, nt as ObjectDataTable, Ke as ObjectMetricWidget, it as ObjectPivotTable, $e as PivotTable, Ot as WidgetConfigPanel, At as dashboardComponents };
|