@object-ui/plugin-dashboard 5.0.1 → 5.0.2
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 +12 -0
- package/dist/index.js +528 -528
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-dashboard/src/DashboardRenderer.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 {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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, Dialog as w, DialogContent as T, DialogHeader as E, DialogTitle as D, RefreshIndicator as O, Sheet as k, SheetContent as A, SheetHeader as j, SheetTitle as ee, Skeleton as M, cn as N, getLazyIcon as P, useConfigDraft as F } from "@object-ui/components";
|
|
5
|
+
import * as I from "react";
|
|
6
|
+
import { Fragment as L, forwardRef as te, useCallback as R, useContext as ne, useEffect as z, useMemo as B, useRef as V, useState as H } from "react";
|
|
7
|
+
import { AlertCircle as U, ArrowDownIcon as re, ArrowUpIcon as W, Edit as G, GripVertical as ie, Loader2 as K, MinusIcon as q, RefreshCw as ae, Save as J, Settings as oe, X as se } from "lucide-react";
|
|
8
|
+
import { DndContext as ce, PointerSensor as le, closestCenter as ue, useSensor as de, useSensors as fe } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as pe, arrayMove as me, rectSortingStrategy as he, useSortable as ge, verticalListSortingStrategy as _e } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as Y } from "@dnd-kit/utilities";
|
|
11
|
+
import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
12
|
+
import { ResponsiveGridLayout as ve, useContainerWidth as ye } from "react-grid-layout";
|
|
12
13
|
import "react-grid-layout/css/styles.css";
|
|
13
|
-
import {
|
|
14
|
-
import { formatCurrency as xe, formatDate as Se, formatPercent as Ce, getCellRenderer as we, resolveCellRendererType as Te } from "@object-ui/fields";
|
|
14
|
+
import { formatCurrency as be, formatDate as xe, formatPercent as Se, getCellRenderer as Ce, resolveCellRendererType as we } from "@object-ui/fields";
|
|
15
15
|
//#region src/utils.ts
|
|
16
|
-
function
|
|
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 Te({ 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 } = ge({
|
|
23
23
|
id: e,
|
|
24
24
|
disabled: t
|
|
25
25
|
});
|
|
26
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ Z("div", {
|
|
27
27
|
ref: s,
|
|
28
28
|
style: {
|
|
29
|
-
transform:
|
|
29
|
+
transform: Y.Transform.toString(c),
|
|
30
30
|
transition: l,
|
|
31
31
|
opacity: u ? .4 : 1,
|
|
32
32
|
...n ? {
|
|
@@ -34,17 +34,17 @@ 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: N("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
|
|
45
|
-
return e ?
|
|
44
|
+
function Ee(e) {
|
|
45
|
+
return e ? P(e) : null;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function De(e) {
|
|
48
48
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
49
49
|
}
|
|
50
50
|
var Oe = [
|
|
@@ -65,8 +65,8 @@ var Oe = [
|
|
|
65
65
|
function Ae(e) {
|
|
66
66
|
return ke.has(e) ? { enabled: !0 } : void 0;
|
|
67
67
|
}
|
|
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:
|
|
69
|
-
let
|
|
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: p, scriptHandlers: h, hideHeaderText: x, ...S }, C) => {
|
|
69
|
+
let w = (() => {
|
|
70
70
|
if (e.columns != null) return e.columns;
|
|
71
71
|
let t = e.widgets ?? [], n = 0;
|
|
72
72
|
for (let e of t) {
|
|
@@ -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
|
-
})(),
|
|
77
|
+
})(), T = w, E = e.gap || 4, [D, O] = H(!1), [k, A] = H(!1), j = V(null), { executeAction: ee, engine: M } = 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: P, dashboardDescription:
|
|
83
|
-
let t =
|
|
84
|
-
return !
|
|
85
|
-
}, [
|
|
86
|
-
let t =
|
|
87
|
-
return !
|
|
88
|
-
}, [
|
|
89
|
-
|
|
90
|
-
let e =
|
|
91
|
-
if (
|
|
82
|
+
})), [e.header?.actions]) }), { dashboardLabel: P, dashboardDescription: F, dashboardActionLabel: I, widgetTitle: te, widgetDescription: ne, fieldLabel: U } = f(), { t: re } = m(), W = R((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? re(`report.aggregate.${n}`, { defaultValue: n }) : e ? U(e, t, t) : t, [re, U]), G = e.name, ie = R((e) => G ? I(G, e.actionUrl || e.label, e.label) : e.label, [G, I]), K = R((e) => {
|
|
83
|
+
let t = De(e.title);
|
|
84
|
+
return !G || !e.id || t === void 0 ? t : te(G, e.id, t);
|
|
85
|
+
}, [G, te]), q = R((e) => {
|
|
86
|
+
let t = De(e.description);
|
|
87
|
+
return !G || !e.id ? t : ne(G, e.id, t);
|
|
88
|
+
}, [G, ne]);
|
|
89
|
+
z(() => {
|
|
90
|
+
let e = M.getRunner();
|
|
91
|
+
if (p && e.setModalHandler(p), h) for (let [t, n] of Object.entries(h)) e.registerScript(t, n);
|
|
92
92
|
}, [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
]),
|
|
97
|
-
let e = () =>
|
|
93
|
+
M,
|
|
94
|
+
p,
|
|
95
|
+
h
|
|
96
|
+
]), z(() => {
|
|
97
|
+
let e = () => A(window.innerWidth < 768);
|
|
98
98
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
99
99
|
}, []);
|
|
100
|
-
let
|
|
101
|
-
r && (
|
|
100
|
+
let J = R(() => {
|
|
101
|
+
r && (O(!0), r(), setTimeout(() => O(!1), 600));
|
|
102
102
|
}, [r]);
|
|
103
|
-
|
|
104
|
-
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return
|
|
105
|
-
|
|
103
|
+
z(() => {
|
|
104
|
+
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return j.current = setInterval(J, e.refreshInterval * 1e3), () => {
|
|
105
|
+
j.current && clearInterval(j.current);
|
|
106
106
|
};
|
|
107
107
|
}, [
|
|
108
108
|
e.refreshInterval,
|
|
109
109
|
r,
|
|
110
|
-
|
|
110
|
+
J
|
|
111
111
|
]);
|
|
112
|
-
let
|
|
112
|
+
let oe = R((e, t) => {
|
|
113
113
|
!s || !u || !t || (e.stopPropagation(), u(t));
|
|
114
|
-
}, [s, u]),
|
|
114
|
+
}, [s, u]), se = 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,27 +128,27 @@ var je = te(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
|
|
|
128
128
|
s,
|
|
129
129
|
u,
|
|
130
130
|
e.widgets
|
|
131
|
-
]),
|
|
131
|
+
]), ge = R((e) => {
|
|
132
132
|
!s || !u || e.target === e.currentTarget && u(null);
|
|
133
|
-
}, [s, u]),
|
|
134
|
-
if (!
|
|
133
|
+
}, [s, u]), Y = !!(s && d), X = fe(de(le, { activationConstraint: { distance: 5 } })), ve = R((t) => {
|
|
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?.(me(i, a, o));
|
|
139
139
|
}, [
|
|
140
|
-
|
|
140
|
+
Y,
|
|
141
141
|
e.widgets,
|
|
142
142
|
d
|
|
143
|
-
]),
|
|
143
|
+
]), ye = (e, t, r) => {
|
|
144
144
|
let i = e.layout ? {
|
|
145
145
|
...e.layout,
|
|
146
|
-
w: Math.min(e.layout.w,
|
|
146
|
+
w: Math.min(e.layout.w, T)
|
|
147
147
|
} : void 0, a = (() => {
|
|
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 = $(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 je = 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 || ($(t) ? t.object : void 0),
|
|
163
163
|
aggregate: r,
|
|
164
|
-
filter: (
|
|
165
|
-
label: n.label ||
|
|
164
|
+
filter: ($(t) ? t.filter : void 0) || e.filter,
|
|
165
|
+
label: n.label || K(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 || K(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 || K(e) || "",
|
|
191
191
|
fallbackValue: n.fallbackValue ?? n.value,
|
|
192
192
|
icon: n.icon,
|
|
193
193
|
description: n.description,
|
|
@@ -202,7 +202,7 @@ var je = 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 ($(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 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: W(l, c, s?.function)
|
|
220
220
|
}],
|
|
221
221
|
colors: Oe,
|
|
222
222
|
drillDown: n.drillDown ?? Ae(r),
|
|
@@ -237,7 +237,7 @@ 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: W(e.object, a, e.aggregate)
|
|
241
241
|
}],
|
|
242
242
|
colors: Oe,
|
|
243
243
|
drillDown: n.drillDown ?? Ae(r),
|
|
@@ -251,7 +251,7 @@ 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: W(e.object, a, e.aggregate)
|
|
255
255
|
}],
|
|
256
256
|
colors: Oe,
|
|
257
257
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
@@ -259,7 +259,7 @@ var je = 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 ($(t)) {
|
|
263
263
|
let { data: r, ...i } = n;
|
|
264
264
|
return {
|
|
265
265
|
type: "object-data-table",
|
|
@@ -298,11 +298,11 @@ var je = 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 = ($(t) || !t && e.object) && n.drillDown === void 0 ? {
|
|
302
302
|
...n,
|
|
303
303
|
drillDown: { enabled: !0 }
|
|
304
304
|
} : n;
|
|
305
|
-
if (
|
|
305
|
+
if ($(t)) {
|
|
306
306
|
let { data: n, ...r } = a;
|
|
307
307
|
return {
|
|
308
308
|
type: "object-pivot",
|
|
@@ -328,7 +328,7 @@ var je = 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 ($(t)) {
|
|
332
332
|
let { data: r, ...i } = n;
|
|
333
333
|
return {
|
|
334
334
|
type: "object-data-table",
|
|
@@ -368,94 +368,94 @@ 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 = K(e), d = q(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
|
-
} : {},
|
|
378
|
+
onClick: (t) => oe(t, e.id),
|
|
379
|
+
onKeyDown: (n) => se(n, e.id, t)
|
|
380
|
+
} : {}, h = s ? N("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
|
-
} : void 0, x = c ? /* @__PURE__ */
|
|
384
|
-
className:
|
|
385
|
-
style:
|
|
386
|
-
...
|
|
387
|
-
children: [/* @__PURE__ */
|
|
383
|
+
} : void 0, x = c ? /* @__PURE__ */ Q("div", {
|
|
384
|
+
className: N("h-full w-full", s && "relative", h),
|
|
385
|
+
style: g,
|
|
386
|
+
...m,
|
|
387
|
+
children: [/* @__PURE__ */ Z(o, {
|
|
388
388
|
schema: a,
|
|
389
|
-
className:
|
|
389
|
+
className: N("h-full w-full", s && "pointer-events-none"),
|
|
390
390
|
dataSource: n
|
|
391
|
-
}), s && /* @__PURE__ */
|
|
391
|
+
}), s && /* @__PURE__ */ Z("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:
|
|
398
|
-
style:
|
|
399
|
-
...
|
|
396
|
+
}) : /* @__PURE__ */ Q(_, {
|
|
397
|
+
className: N("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
|
+
style: g,
|
|
399
|
+
...m,
|
|
400
400
|
children: [
|
|
401
|
-
u && /* @__PURE__ */
|
|
401
|
+
u && /* @__PURE__ */ Q(y, {
|
|
402
402
|
className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
|
|
403
|
-
children: [/* @__PURE__ */
|
|
403
|
+
children: [/* @__PURE__ */ Z(b, {
|
|
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__ */ Z("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__ */ Z(v, {
|
|
413
413
|
className: "p-0",
|
|
414
|
-
children: /* @__PURE__ */
|
|
415
|
-
className:
|
|
416
|
-
children: /* @__PURE__ */
|
|
414
|
+
children: /* @__PURE__ */ Z("div", {
|
|
415
|
+
className: N("h-full w-full", "p-3 sm:p-4 md:p-6", s && "pointer-events-none"),
|
|
416
|
+
children: /* @__PURE__ */ Z(o, {
|
|
417
417
|
schema: a,
|
|
418
418
|
dataSource: n
|
|
419
419
|
})
|
|
420
420
|
})
|
|
421
421
|
}),
|
|
422
|
-
s && /* @__PURE__ */
|
|
422
|
+
s && /* @__PURE__ */ Z("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
|
|
429
|
+
return Y && e.id ? /* @__PURE__ */ Z(Te, {
|
|
430
430
|
id: e.id,
|
|
431
|
-
gridSpan: !
|
|
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__ */
|
|
437
|
-
},
|
|
436
|
+
}, f) : /* @__PURE__ */ Z(L, { children: x }, f);
|
|
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: G ? P({
|
|
443
|
+
name: G,
|
|
444
|
+
label: De(e.title)
|
|
445
|
+
}) : De(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: G ? F({
|
|
450
|
+
name: G,
|
|
451
|
+
description: De(e.description)
|
|
452
|
+
}) : De(e.description)
|
|
453
453
|
}),
|
|
454
|
-
e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */
|
|
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 =
|
|
458
|
-
return /* @__PURE__ */
|
|
457
|
+
let n = Ee(e.icon);
|
|
458
|
+
return /* @__PURE__ */ Q(g, {
|
|
459
459
|
variant: "outline",
|
|
460
460
|
size: "sm",
|
|
461
461
|
onClick: async () => {
|
|
@@ -469,103 +469,103 @@ 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 ee(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__ */
|
|
478
|
+
children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), ie(e)]
|
|
479
479
|
}, t);
|
|
480
480
|
})
|
|
481
481
|
})
|
|
482
482
|
]
|
|
483
|
-
}),
|
|
483
|
+
}), xe = i !== void 0 && /* @__PURE__ */ Q("span", {
|
|
484
484
|
className: "text-xs text-muted-foreground",
|
|
485
485
|
children: [i.toLocaleString(), " records"]
|
|
486
|
-
}),
|
|
487
|
-
className:
|
|
488
|
-
children: [
|
|
486
|
+
}), Se = a ? JSON.stringify(a) : void 0, Ce = r && /* @__PURE__ */ Q("div", {
|
|
487
|
+
className: N("flex items-center justify-end gap-3 mb-2", !k && "col-span-full"),
|
|
488
|
+
children: [xe, /* @__PURE__ */ Q(g, {
|
|
489
489
|
variant: "outline",
|
|
490
490
|
size: "sm",
|
|
491
|
-
onClick:
|
|
492
|
-
disabled:
|
|
491
|
+
onClick: J,
|
|
492
|
+
disabled: D,
|
|
493
493
|
"aria-label": "Refresh dashboard",
|
|
494
|
-
children: [/* @__PURE__ */
|
|
494
|
+
children: [/* @__PURE__ */ Z(ae, { className: N("h-4 w-4 mr-2", D && "animate-spin") }), D ? "Refreshing…" : "Refresh All"]
|
|
495
495
|
})]
|
|
496
|
-
}),
|
|
497
|
-
if (
|
|
498
|
-
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */
|
|
499
|
-
ref:
|
|
500
|
-
className:
|
|
501
|
-
"data-user-actions":
|
|
502
|
-
onClick:
|
|
503
|
-
...
|
|
496
|
+
}), we = B(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), ke = B(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), je = B(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
|
|
497
|
+
if (k) {
|
|
498
|
+
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ Q("div", {
|
|
499
|
+
ref: C,
|
|
500
|
+
className: N("flex flex-col gap-4 px-4", t),
|
|
501
|
+
"data-user-actions": Se,
|
|
502
|
+
onClick: ge,
|
|
503
|
+
...S,
|
|
504
504
|
children: [
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
n.length > 0 && /* @__PURE__ */
|
|
505
|
+
be,
|
|
506
|
+
Ce,
|
|
507
|
+
n.length > 0 && /* @__PURE__ */ Z("div", {
|
|
508
508
|
className: "grid grid-cols-2 gap-3",
|
|
509
|
-
onClick:
|
|
510
|
-
children: /* @__PURE__ */
|
|
511
|
-
items:
|
|
512
|
-
strategy:
|
|
513
|
-
disabled: !
|
|
514
|
-
children: n.map((e, t) =>
|
|
509
|
+
onClick: ge,
|
|
510
|
+
children: /* @__PURE__ */ Z(pe, {
|
|
511
|
+
items: ke,
|
|
512
|
+
strategy: he,
|
|
513
|
+
disabled: !Y,
|
|
514
|
+
children: n.map((e, t) => ye(e, t))
|
|
515
515
|
})
|
|
516
516
|
}),
|
|
517
|
-
r.length > 0 && /* @__PURE__ */
|
|
517
|
+
r.length > 0 && /* @__PURE__ */ Z("div", {
|
|
518
518
|
className: "flex flex-col gap-4",
|
|
519
|
-
onClick:
|
|
520
|
-
children: /* @__PURE__ */
|
|
521
|
-
items:
|
|
522
|
-
strategy:
|
|
523
|
-
disabled: !
|
|
524
|
-
children: r.map((e, t) =>
|
|
519
|
+
onClick: ge,
|
|
520
|
+
children: /* @__PURE__ */ Z(pe, {
|
|
521
|
+
items: je,
|
|
522
|
+
strategy: _e,
|
|
523
|
+
disabled: !Y,
|
|
524
|
+
children: r.map((e, t) => ye(e, t, !0))
|
|
525
525
|
})
|
|
526
526
|
})
|
|
527
527
|
]
|
|
528
528
|
});
|
|
529
|
-
return
|
|
530
|
-
sensors:
|
|
531
|
-
collisionDetection:
|
|
532
|
-
onDragEnd:
|
|
529
|
+
return Y ? /* @__PURE__ */ Z(ce, {
|
|
530
|
+
sensors: X,
|
|
531
|
+
collisionDetection: ue,
|
|
532
|
+
onDragEnd: ve,
|
|
533
533
|
children: i
|
|
534
534
|
}) : i;
|
|
535
535
|
}
|
|
536
|
-
let
|
|
537
|
-
ref:
|
|
538
|
-
className:
|
|
536
|
+
let Me = e.columns != null || w !== 4, Ne = /* @__PURE__ */ Q("div", {
|
|
537
|
+
ref: C,
|
|
538
|
+
className: N("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
|
-
...
|
|
541
|
-
gap: `${
|
|
540
|
+
...Me && { gridTemplateColumns: `repeat(${T}, minmax(0, 1fr))` },
|
|
541
|
+
gap: `${E * .25}rem`
|
|
542
542
|
},
|
|
543
|
-
"data-user-actions":
|
|
544
|
-
onClick:
|
|
545
|
-
...
|
|
543
|
+
"data-user-actions": Se,
|
|
544
|
+
onClick: ge,
|
|
545
|
+
...S,
|
|
546
546
|
children: [
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
items:
|
|
551
|
-
strategy:
|
|
552
|
-
disabled: !
|
|
553
|
-
children: e.widgets?.map((e, t) =>
|
|
547
|
+
be,
|
|
548
|
+
Ce,
|
|
549
|
+
/* @__PURE__ */ Z(pe, {
|
|
550
|
+
items: we,
|
|
551
|
+
strategy: he,
|
|
552
|
+
disabled: !Y,
|
|
553
|
+
children: e.widgets?.map((e, t) => ye(e, t))
|
|
554
554
|
})
|
|
555
555
|
]
|
|
556
556
|
});
|
|
557
|
-
return
|
|
558
|
-
sensors:
|
|
559
|
-
collisionDetection:
|
|
560
|
-
onDragEnd:
|
|
561
|
-
children:
|
|
562
|
-
}) :
|
|
557
|
+
return Y ? /* @__PURE__ */ Z(ce, {
|
|
558
|
+
sensors: X,
|
|
559
|
+
collisionDetection: ue,
|
|
560
|
+
onDragEnd: ve,
|
|
561
|
+
children: Ne
|
|
562
|
+
}) : Ne;
|
|
563
563
|
});
|
|
564
564
|
//#endregion
|
|
565
565
|
//#region src/DashboardGridLayout.tsx
|
|
566
566
|
function Me({ editMode: e }) {
|
|
567
567
|
let t = u();
|
|
568
|
-
return
|
|
568
|
+
return I.useEffect(() => {
|
|
569
569
|
if (e) return t.startDrag({
|
|
570
570
|
id: "dashboard-layout",
|
|
571
571
|
type: "dashboard-widget",
|
|
@@ -612,44 +612,44 @@ function Fe(e) {
|
|
|
612
612
|
})) || [] };
|
|
613
613
|
}
|
|
614
614
|
var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
|
|
615
|
-
let { width: a, containerRef: s, mounted: c } =
|
|
616
|
-
i && (
|
|
615
|
+
let { width: a, containerRef: s, mounted: c } = ye(), [l, u] = I.useState(!1), [f, p] = I.useState(!1), m = d(), h = I.useRef(null), x = I.useCallback(() => {
|
|
616
|
+
i && (p(!0), i(), setTimeout(() => p(!1), 600));
|
|
617
617
|
}, [i]);
|
|
618
|
-
|
|
619
|
-
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return
|
|
620
|
-
|
|
618
|
+
I.useEffect(() => {
|
|
619
|
+
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return h.current = setInterval(x, e.refreshInterval * 1e3), () => {
|
|
620
|
+
h.current && clearInterval(h.current);
|
|
621
621
|
};
|
|
622
622
|
}, [
|
|
623
623
|
e.refreshInterval,
|
|
624
624
|
i,
|
|
625
625
|
x
|
|
626
626
|
]);
|
|
627
|
-
let [S, C] =
|
|
627
|
+
let [S, C] = I.useState(() => Fe(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,
|
|
631
631
|
w: e.layout?.w,
|
|
632
632
|
h: e.layout?.h
|
|
633
633
|
})) ?? []), [e.widgets]);
|
|
634
|
-
|
|
634
|
+
I.useEffect(() => {
|
|
635
635
|
C(Fe(e));
|
|
636
636
|
}, [w]);
|
|
637
|
-
let T =
|
|
637
|
+
let T = I.useCallback((e, t) => {
|
|
638
638
|
C(t), n?.(e);
|
|
639
|
-
}, [n]), E =
|
|
639
|
+
}, [n]), E = I.useCallback(() => {
|
|
640
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 =
|
|
645
|
+
]), D = I.useCallback(() => {
|
|
646
646
|
C(Fe(e));
|
|
647
|
-
}, [e]), O =
|
|
647
|
+
}, [e]), O = I.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 ($(r)) {
|
|
653
653
|
let n = r.aggregate, o = n ? {
|
|
654
654
|
field: e.valueField || n.field,
|
|
655
655
|
function: e.aggregate || n.function,
|
|
@@ -695,7 +695,7 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
695
695
|
}
|
|
696
696
|
if (t === "table") {
|
|
697
697
|
let t = e.data || n.data;
|
|
698
|
-
if (
|
|
698
|
+
if ($(t)) {
|
|
699
699
|
let { data: r, ...i } = n;
|
|
700
700
|
return {
|
|
701
701
|
type: "data-table",
|
|
@@ -727,7 +727,7 @@ var Ie = ({ 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 ($(t)) {
|
|
731
731
|
let { data: r, ...i } = n;
|
|
732
732
|
return {
|
|
733
733
|
type: "pivot",
|
|
@@ -748,54 +748,54 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
748
748
|
...n
|
|
749
749
|
};
|
|
750
750
|
}, []);
|
|
751
|
-
return /* @__PURE__ */
|
|
751
|
+
return /* @__PURE__ */ Q("div", {
|
|
752
752
|
ref: s,
|
|
753
|
-
className:
|
|
753
|
+
className: N("w-full", t),
|
|
754
754
|
"data-testid": "grid-layout",
|
|
755
755
|
children: [
|
|
756
|
-
|
|
757
|
-
/* @__PURE__ */
|
|
756
|
+
m && /* @__PURE__ */ Z(Me, { editMode: l }),
|
|
757
|
+
/* @__PURE__ */ Q("div", {
|
|
758
758
|
className: "mb-4 flex items-center justify-between",
|
|
759
|
-
children: [/* @__PURE__ */
|
|
759
|
+
children: [/* @__PURE__ */ Z("h2", {
|
|
760
760
|
className: "text-2xl font-bold",
|
|
761
761
|
children: e.title || "Dashboard"
|
|
762
|
-
}), /* @__PURE__ */
|
|
762
|
+
}), /* @__PURE__ */ Z("div", {
|
|
763
763
|
className: "flex gap-2",
|
|
764
|
-
children: l ? /* @__PURE__ */
|
|
765
|
-
/* @__PURE__ */
|
|
764
|
+
children: l ? /* @__PURE__ */ Q(X, { children: [
|
|
765
|
+
/* @__PURE__ */ Q(g, {
|
|
766
766
|
onClick: E,
|
|
767
767
|
size: "sm",
|
|
768
768
|
variant: "default",
|
|
769
|
-
children: [/* @__PURE__ */
|
|
769
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4 mr-2" }), "Save Layout"]
|
|
770
770
|
}),
|
|
771
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ Q(g, {
|
|
772
772
|
onClick: D,
|
|
773
773
|
size: "sm",
|
|
774
774
|
variant: "outline",
|
|
775
|
-
children: [/* @__PURE__ */
|
|
775
|
+
children: [/* @__PURE__ */ Z(se, { className: "h-4 w-4 mr-2" }), "Reset"]
|
|
776
776
|
}),
|
|
777
|
-
/* @__PURE__ */
|
|
777
|
+
/* @__PURE__ */ Z(g, {
|
|
778
778
|
onClick: () => u(!1),
|
|
779
779
|
size: "sm",
|
|
780
780
|
variant: "ghost",
|
|
781
781
|
children: "Cancel"
|
|
782
782
|
})
|
|
783
|
-
] }) : /* @__PURE__ */
|
|
783
|
+
] }) : /* @__PURE__ */ Q(X, { children: [i && /* @__PURE__ */ Q(g, {
|
|
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__ */ Z(ae, { className: N("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
|
|
790
|
+
}), /* @__PURE__ */ Q(g, {
|
|
791
791
|
onClick: () => u(!0),
|
|
792
792
|
size: "sm",
|
|
793
793
|
variant: "outline",
|
|
794
|
-
children: [/* @__PURE__ */
|
|
794
|
+
children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
|
|
795
795
|
})] })
|
|
796
796
|
})]
|
|
797
797
|
}),
|
|
798
|
-
c && /* @__PURE__ */
|
|
798
|
+
c && /* @__PURE__ */ Z(ve, {
|
|
799
799
|
className: "layout",
|
|
800
800
|
width: a,
|
|
801
801
|
layouts: S,
|
|
@@ -822,34 +822,34 @@ var Ie = ({ 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__ */ Z("div", {
|
|
826
826
|
className: "h-full",
|
|
827
|
-
children: e.type === "metric" ? /* @__PURE__ */
|
|
827
|
+
children: e.type === "metric" ? /* @__PURE__ */ Q("div", {
|
|
828
828
|
className: "h-full w-full relative",
|
|
829
|
-
children: [l && /* @__PURE__ */
|
|
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__ */
|
|
832
|
-
}), /* @__PURE__ */
|
|
831
|
+
children: /* @__PURE__ */ Z(ie, { className: "h-4 w-4" })
|
|
832
|
+
}), /* @__PURE__ */ Z(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__ */ Q(_, {
|
|
837
|
+
className: N("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__ */ Q(y, {
|
|
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__ */ Z(b, {
|
|
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__ */ Z("div", {
|
|
845
845
|
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
846
|
-
children: /* @__PURE__ */
|
|
846
|
+
children: /* @__PURE__ */ Z(ie, { className: "h-4 w-4" })
|
|
847
847
|
})]
|
|
848
|
-
}), /* @__PURE__ */
|
|
848
|
+
}), /* @__PURE__ */ Z(v, {
|
|
849
849
|
className: "p-0 h-full",
|
|
850
|
-
children: /* @__PURE__ */
|
|
851
|
-
className:
|
|
852
|
-
children: /* @__PURE__ */
|
|
850
|
+
children: /* @__PURE__ */ Z("div", {
|
|
851
|
+
className: N("h-full w-full overflow-auto p-4"),
|
|
852
|
+
children: /* @__PURE__ */ Z(o, { schema: r })
|
|
853
853
|
})
|
|
854
854
|
})]
|
|
855
855
|
})
|
|
@@ -858,7 +858,7 @@ var Ie = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
858
858
|
})
|
|
859
859
|
]
|
|
860
860
|
});
|
|
861
|
-
}, Le =
|
|
861
|
+
}, Le = 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",
|
|
@@ -925,17 +925,17 @@ 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
|
-
}, 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, ...
|
|
929
|
-
let
|
|
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, ...m }) => {
|
|
929
|
+
let h = Ve[c] || Ve.default, { t: g } = Le(), x = B(() => {
|
|
930
930
|
let e = Be(a) || Be(n?.label);
|
|
931
931
|
if (!e) return e;
|
|
932
932
|
let t = Re(e);
|
|
933
|
-
return t ?
|
|
933
|
+
return t ? g(t) : e;
|
|
934
934
|
}, [
|
|
935
935
|
a,
|
|
936
936
|
n?.label,
|
|
937
|
-
|
|
938
|
-
]), S =
|
|
937
|
+
g
|
|
938
|
+
]), S = B(() => {
|
|
939
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
|
}, [
|
|
@@ -944,61 +944,61 @@ var Ve = {
|
|
|
944
944
|
u,
|
|
945
945
|
d,
|
|
946
946
|
f
|
|
947
|
-
]), C =
|
|
947
|
+
]), C = B(() => {
|
|
948
948
|
if (typeof r == "string") {
|
|
949
|
-
let e =
|
|
950
|
-
return e ? /* @__PURE__ */
|
|
949
|
+
let e = P(r);
|
|
950
|
+
return e ? /* @__PURE__ */ Z(e, { className: "h-4 w-4" }) : null;
|
|
951
951
|
}
|
|
952
952
|
return r;
|
|
953
953
|
}, [r]);
|
|
954
|
-
return /* @__PURE__ */
|
|
955
|
-
className:
|
|
954
|
+
return /* @__PURE__ */ Q(_, {
|
|
955
|
+
className: N("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,
|
|
959
959
|
onKeyDown: p ? (e) => {
|
|
960
960
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
|
|
961
961
|
} : void 0,
|
|
962
|
-
...
|
|
963
|
-
children: [/* @__PURE__ */
|
|
962
|
+
...m,
|
|
963
|
+
children: [/* @__PURE__ */ Q(y, {
|
|
964
964
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
965
|
-
children: [/* @__PURE__ */
|
|
965
|
+
children: [/* @__PURE__ */ Z(b, {
|
|
966
966
|
className: "text-sm font-medium truncate",
|
|
967
967
|
children: Be(e)
|
|
968
|
-
}), C && /* @__PURE__ */
|
|
969
|
-
className:
|
|
968
|
+
}), C && /* @__PURE__ */ Z("div", {
|
|
969
|
+
className: N("flex h-8 w-8 items-center justify-center rounded-md shrink-0", h),
|
|
970
970
|
children: C
|
|
971
971
|
})]
|
|
972
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
975
|
+
children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
|
|
976
976
|
className: "text-sm",
|
|
977
977
|
children: "Loading…"
|
|
978
978
|
})]
|
|
979
|
-
}) : s ? /* @__PURE__ */
|
|
979
|
+
}) : s ? /* @__PURE__ */ Q("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__ */ Z(U, { 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
|
})]
|
|
987
|
-
}) : /* @__PURE__ */
|
|
987
|
+
}) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
|
|
988
988
|
className: "text-2xl font-bold truncate",
|
|
989
989
|
children: S
|
|
990
|
-
}), (n || a) && /* @__PURE__ */
|
|
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
|
-
children: [n && /* @__PURE__ */
|
|
993
|
-
className:
|
|
992
|
+
children: [n && /* @__PURE__ */ Q("span", {
|
|
993
|
+
className: N("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__ */ Z(W, { className: "h-3 w-3 mr-1" }),
|
|
996
|
+
n.direction === "down" && /* @__PURE__ */ Z(re, { className: "h-3 w-3 mr-1" }),
|
|
997
|
+
n.direction === "neutral" && /* @__PURE__ */ Z(q, { className: "h-3 w-3 mr-1" }),
|
|
998
998
|
n.value,
|
|
999
999
|
"%"
|
|
1000
1000
|
]
|
|
1001
|
-
}), /* @__PURE__ */
|
|
1001
|
+
}), /* @__PURE__ */ Z("span", {
|
|
1002
1002
|
className: "truncate min-w-0",
|
|
1003
1003
|
children: x
|
|
1004
1004
|
})]
|
|
@@ -1011,78 +1011,78 @@ function Ue(e) {
|
|
|
1011
1011
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
1012
1012
|
}
|
|
1013
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 ?
|
|
1015
|
-
return /* @__PURE__ */
|
|
1016
|
-
className:
|
|
1014
|
+
let u = n ? P(n) : null;
|
|
1015
|
+
return /* @__PURE__ */ Q(_, {
|
|
1016
|
+
className: N("h-full", o),
|
|
1017
1017
|
...l,
|
|
1018
|
-
children: [/* @__PURE__ */
|
|
1018
|
+
children: [/* @__PURE__ */ Q(y, {
|
|
1019
1019
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
1020
|
-
children: [/* @__PURE__ */
|
|
1020
|
+
children: [/* @__PURE__ */ Z(b, {
|
|
1021
1021
|
className: "text-sm font-medium",
|
|
1022
1022
|
children: Ue(e)
|
|
1023
|
-
}), u && /* @__PURE__ */
|
|
1024
|
-
}), /* @__PURE__ */
|
|
1023
|
+
}), u && /* @__PURE__ */ Z(u, { className: "h-4 w-4 text-muted-foreground" })]
|
|
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__ */
|
|
1027
|
+
children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
|
|
1028
1028
|
className: "text-sm",
|
|
1029
1029
|
children: "Loading…"
|
|
1030
1030
|
})]
|
|
1031
|
-
}) : c ? /* @__PURE__ */
|
|
1031
|
+
}) : c ? /* @__PURE__ */ Q("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__ */ Z(U, { 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
|
})]
|
|
1039
|
-
}) : /* @__PURE__ */
|
|
1039
|
+
}) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
|
|
1040
1040
|
className: "text-2xl font-bold",
|
|
1041
1041
|
children: t
|
|
1042
|
-
}), (r || i || a) && /* @__PURE__ */
|
|
1042
|
+
}), (r || i || a) && /* @__PURE__ */ Q("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__ */ Q("span", {
|
|
1045
|
+
className: N("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__ */ Z(W, { className: "h-3 w-3 mr-1" }),
|
|
1048
|
+
r === "down" && /* @__PURE__ */ Z(re, { className: "h-3 w-3 mr-1" }),
|
|
1049
|
+
r === "neutral" && /* @__PURE__ */ Z(q, { className: "h-3 w-3 mr-1" }),
|
|
1050
1050
|
i
|
|
1051
1051
|
]
|
|
1052
1052
|
}), Ue(a)]
|
|
1053
1053
|
})] }) })]
|
|
1054
1054
|
});
|
|
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:
|
|
1056
|
-
let
|
|
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: x, title: S }) => {
|
|
1056
|
+
let C = ne(s), O = m || C?.dataSource, [M, N] = H(!1), [P, F] = H(null), [I, L] = H(!1), [te, V] = H(null), [U, re] = H(null);
|
|
1057
|
+
z(() => {
|
|
1058
1058
|
let t = !0;
|
|
1059
|
-
if (!(!
|
|
1060
|
-
t &&
|
|
1059
|
+
if (!(!O || !e || typeof O.getObjectSchema != "function")) return O.getObjectSchema(e).then((e) => {
|
|
1060
|
+
t && re(e);
|
|
1061
1061
|
}).catch(() => {}), () => {
|
|
1062
1062
|
t = !1;
|
|
1063
1063
|
};
|
|
1064
|
-
}, [
|
|
1065
|
-
let
|
|
1064
|
+
}, [O, e]);
|
|
1065
|
+
let W = B(() => {
|
|
1066
1066
|
let e = t?.field;
|
|
1067
|
-
if (!e || !
|
|
1068
|
-
let n =
|
|
1067
|
+
if (!e || !U?.fields) return null;
|
|
1068
|
+
let n = U.fields;
|
|
1069
1069
|
return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
|
|
1070
|
-
}, [
|
|
1070
|
+
}, [U, t?.field]), G = B(() => {
|
|
1071
1071
|
if (g) return g;
|
|
1072
|
-
if (
|
|
1073
|
-
if (
|
|
1074
|
-
let e =
|
|
1072
|
+
if (W) {
|
|
1073
|
+
if (W.type === "currency") {
|
|
1074
|
+
let e = W.precision ?? W.scale ?? 0;
|
|
1075
1075
|
return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
|
|
1076
1076
|
}
|
|
1077
|
-
if (
|
|
1078
|
-
if (
|
|
1077
|
+
if (W.type === "percent") return "0,0%";
|
|
1078
|
+
if (W.type === "number" || W.type === "integer") return "0,0";
|
|
1079
1079
|
}
|
|
1080
|
-
}, [g,
|
|
1080
|
+
}, [g, W]), ie = B(() => {
|
|
1081
1081
|
if (_) return _;
|
|
1082
|
-
if (
|
|
1083
|
-
}, [_,
|
|
1082
|
+
if (W?.type === "currency") return W.defaultCurrency || W.currency || "USD";
|
|
1083
|
+
}, [_, W]), K = B(() => t ? JSON.stringify(t) : "", [t]), q = B(() => i(n), [n]), ae = R(async (n, r) => {
|
|
1084
1084
|
if (!(!n || !e)) {
|
|
1085
|
-
r.current && (
|
|
1085
|
+
r.current && (L(!0), V(null));
|
|
1086
1086
|
try {
|
|
1087
1087
|
let i;
|
|
1088
1088
|
if (t && typeof n.aggregate == "function") {
|
|
@@ -1090,115 +1090,115 @@ 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: q
|
|
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: q });
|
|
1098
1098
|
i = (Array.isArray(t) ? t : t?.data || t?.records || []).length;
|
|
1099
1099
|
} else return;
|
|
1100
|
-
r.current &&
|
|
1100
|
+
r.current && F(i);
|
|
1101
1101
|
} catch (e) {
|
|
1102
1102
|
console.error("[ObjectMetricWidget] Fetch error:", e), r.current && V(e instanceof Error ? e.message : "Failed to load metric");
|
|
1103
1103
|
} finally {
|
|
1104
|
-
r.current &&
|
|
1104
|
+
r.current && L(!1);
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
}, [
|
|
1108
1108
|
e,
|
|
1109
|
-
|
|
1110
|
-
|
|
1109
|
+
K,
|
|
1110
|
+
B(() => q ? JSON.stringify(q) : "", [q])
|
|
1111
1111
|
]);
|
|
1112
|
-
|
|
1112
|
+
z(() => {
|
|
1113
1113
|
let t = { current: !0 };
|
|
1114
|
-
return
|
|
1114
|
+
return O && e ? ae(O, t) : (F(null), V(null)), () => {
|
|
1115
1115
|
t.current = !1;
|
|
1116
1116
|
};
|
|
1117
1117
|
}, [
|
|
1118
|
-
|
|
1118
|
+
O,
|
|
1119
1119
|
e,
|
|
1120
|
-
|
|
1120
|
+
ae
|
|
1121
1121
|
]);
|
|
1122
|
-
let
|
|
1123
|
-
b && typeof
|
|
1124
|
-
let
|
|
1122
|
+
let J = P === null ? O ? "—" : l ?? "—" : P;
|
|
1123
|
+
b && typeof J == "number" && isFinite(J) && J >= 0 && J <= 1 && (J = 1 - J);
|
|
1124
|
+
let oe = r(x) && !!e && !!O, se = B(() => {
|
|
1125
1125
|
let e = typeof c == "string" ? c : c?.defaultValue || "";
|
|
1126
|
-
return a(
|
|
1126
|
+
return a(x, {}, (typeof S == "string" ? S : S?.defaultValue || "") || e || "Details");
|
|
1127
1127
|
}, [
|
|
1128
|
-
|
|
1128
|
+
x,
|
|
1129
1129
|
c,
|
|
1130
|
-
|
|
1131
|
-
]),
|
|
1132
|
-
if (!
|
|
1133
|
-
let t =
|
|
1130
|
+
S
|
|
1131
|
+
]), ce = B(() => {
|
|
1132
|
+
if (!oe) return null;
|
|
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 ?
|
|
1136
|
-
i = /* @__PURE__ */
|
|
1135
|
+
let e = n.filter, t = e ? q ? { $and: [e, q] } : e : q;
|
|
1136
|
+
i = /* @__PURE__ */ Z("div", {
|
|
1137
1137
|
className: "h-full overflow-auto",
|
|
1138
|
-
children: /* @__PURE__ */
|
|
1138
|
+
children: /* @__PURE__ */ Z(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__ */ Z("div", {
|
|
1145
1145
|
className: "h-full overflow-auto",
|
|
1146
|
-
children: /* @__PURE__ */
|
|
1146
|
+
children: /* @__PURE__ */ Z(o, { schema: {
|
|
1147
1147
|
type: "object-data-table",
|
|
1148
1148
|
objectName: e,
|
|
1149
|
-
filter:
|
|
1149
|
+
filter: q,
|
|
1150
1150
|
pageSize: 25,
|
|
1151
1151
|
drillDown: { enabled: !1 }
|
|
1152
1152
|
} })
|
|
1153
1153
|
});
|
|
1154
|
-
return t === "dialog" ? /* @__PURE__ */
|
|
1154
|
+
return t === "dialog" ? /* @__PURE__ */ Z(w, {
|
|
1155
1155
|
open: !0,
|
|
1156
|
-
onOpenChange: (e) => !e &&
|
|
1157
|
-
children: /* @__PURE__ */
|
|
1156
|
+
onOpenChange: (e) => !e && N(!1),
|
|
1157
|
+
children: /* @__PURE__ */ Q(T, {
|
|
1158
1158
|
className: "max-w-5xl",
|
|
1159
|
-
children: [/* @__PURE__ */
|
|
1159
|
+
children: [/* @__PURE__ */ Z(E, { children: /* @__PURE__ */ Z(D, { children: se }) }), i]
|
|
1160
1160
|
})
|
|
1161
|
-
}) : /* @__PURE__ */
|
|
1161
|
+
}) : /* @__PURE__ */ Z(k, {
|
|
1162
1162
|
open: !0,
|
|
1163
|
-
onOpenChange: (e) => !e &&
|
|
1164
|
-
children: /* @__PURE__ */
|
|
1163
|
+
onOpenChange: (e) => !e && N(!1),
|
|
1164
|
+
children: /* @__PURE__ */ Q(A, {
|
|
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__ */ Z(j, { children: /* @__PURE__ */ Z(ee, { children: se }) }), /* @__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
|
-
|
|
1175
|
-
|
|
1174
|
+
oe,
|
|
1175
|
+
x,
|
|
1176
1176
|
e,
|
|
1177
|
-
|
|
1178
|
-
|
|
1177
|
+
q,
|
|
1178
|
+
se
|
|
1179
1179
|
]);
|
|
1180
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(He, {
|
|
1181
1181
|
label: c,
|
|
1182
|
-
value:
|
|
1182
|
+
value: J,
|
|
1183
1183
|
trend: u,
|
|
1184
1184
|
icon: d,
|
|
1185
1185
|
className: f,
|
|
1186
1186
|
description: p,
|
|
1187
|
-
loading:
|
|
1188
|
-
error:
|
|
1187
|
+
loading: I,
|
|
1188
|
+
error: te,
|
|
1189
1189
|
colorVariant: h,
|
|
1190
|
-
format:
|
|
1191
|
-
currency:
|
|
1190
|
+
format: G,
|
|
1191
|
+
currency: ie,
|
|
1192
1192
|
prefix: v,
|
|
1193
1193
|
suffix: y,
|
|
1194
|
-
onClick:
|
|
1195
|
-
}),
|
|
1194
|
+
onClick: oe ? () => N(!0) : void 0
|
|
1195
|
+
}), M && ce] });
|
|
1196
1196
|
};
|
|
1197
1197
|
//#endregion
|
|
1198
1198
|
//#region src/PivotTable.tsx
|
|
1199
1199
|
function Ke() {
|
|
1200
1200
|
try {
|
|
1201
|
-
let { t: e } =
|
|
1201
|
+
let { t: e } = m(), t = e("dashboard.total");
|
|
1202
1202
|
return !t || t === "dashboard.total" ? "Total" : t;
|
|
1203
1203
|
} catch {
|
|
1204
1204
|
return "Total";
|
|
@@ -1206,7 +1206,7 @@ function Ke() {
|
|
|
1206
1206
|
}
|
|
1207
1207
|
function qe() {
|
|
1208
1208
|
try {
|
|
1209
|
-
let { t: e } =
|
|
1209
|
+
let { t: e } = m(), t = e("dashboard.noDataAvailable");
|
|
1210
1210
|
return !t || t === "dashboard.noDataAvailable" ? "No data available" : t;
|
|
1211
1211
|
} catch {
|
|
1212
1212
|
return "No data available";
|
|
@@ -1253,7 +1253,7 @@ 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]" : "", w = Array.isArray(f) ? f : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } =
|
|
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 } = B(() => {
|
|
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;
|
|
@@ -1293,16 +1293,16 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1293
1293
|
l,
|
|
1294
1294
|
u,
|
|
1295
1295
|
d
|
|
1296
|
-
]),
|
|
1297
|
-
return w.length === 0 ? /* @__PURE__ */
|
|
1298
|
-
className:
|
|
1299
|
-
children: [s && /* @__PURE__ */
|
|
1296
|
+
]), j = (e) => Je(e, h);
|
|
1297
|
+
return w.length === 0 ? /* @__PURE__ */ Q("div", {
|
|
1298
|
+
className: N("overflow-auto", t),
|
|
1299
|
+
children: [s && /* @__PURE__ */ Z("h3", {
|
|
1300
1300
|
className: "text-sm font-semibold mb-2",
|
|
1301
1301
|
children: s
|
|
1302
|
-
}), /* @__PURE__ */
|
|
1302
|
+
}), /* @__PURE__ */ Q("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__ */ Q("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 Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1312
1312
|
strokeLinecap: "round",
|
|
1313
1313
|
strokeLinejoin: "round",
|
|
1314
1314
|
children: [
|
|
1315
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ Z("rect", {
|
|
1316
1316
|
x: "3",
|
|
1317
1317
|
y: "3",
|
|
1318
1318
|
width: "7",
|
|
1319
1319
|
height: "7"
|
|
1320
1320
|
}),
|
|
1321
|
-
/* @__PURE__ */
|
|
1321
|
+
/* @__PURE__ */ Z("rect", {
|
|
1322
1322
|
x: "14",
|
|
1323
1323
|
y: "3",
|
|
1324
1324
|
width: "7",
|
|
1325
1325
|
height: "7"
|
|
1326
1326
|
}),
|
|
1327
|
-
/* @__PURE__ */
|
|
1327
|
+
/* @__PURE__ */ Z("rect", {
|
|
1328
1328
|
x: "3",
|
|
1329
1329
|
y: "14",
|
|
1330
1330
|
width: "7",
|
|
1331
1331
|
height: "7"
|
|
1332
1332
|
}),
|
|
1333
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ Z("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__ */ Z("p", {
|
|
1341
1341
|
className: "text-xs",
|
|
1342
1342
|
children: y
|
|
1343
1343
|
})]
|
|
1344
1344
|
})]
|
|
1345
|
-
}) : /* @__PURE__ */
|
|
1346
|
-
className:
|
|
1347
|
-
children: [s && /* @__PURE__ */
|
|
1345
|
+
}) : /* @__PURE__ */ Q("div", {
|
|
1346
|
+
className: N("overflow-auto", t),
|
|
1347
|
+
children: [s && /* @__PURE__ */ Z("h3", {
|
|
1348
1348
|
className: "text-sm font-semibold mb-2",
|
|
1349
1349
|
children: s
|
|
1350
|
-
}), /* @__PURE__ */
|
|
1350
|
+
}), /* @__PURE__ */ Q("table", {
|
|
1351
1351
|
className: "w-full text-sm border-collapse table-auto",
|
|
1352
1352
|
role: "table",
|
|
1353
1353
|
children: [
|
|
1354
|
-
/* @__PURE__ */
|
|
1354
|
+
/* @__PURE__ */ Z("thead", { children: /* @__PURE__ */ Q("tr", {
|
|
1355
1355
|
className: "border-b border-border",
|
|
1356
1356
|
children: [
|
|
1357
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ Z("th", {
|
|
1358
1358
|
className: "text-left p-2 font-medium text-muted-foreground whitespace-nowrap",
|
|
1359
1359
|
children: a || c
|
|
1360
1360
|
}),
|
|
@@ -1363,8 +1363,8 @@ var Qe = ({ 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__ */ Z("th", {
|
|
1367
|
+
className: N("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,
|
|
@@ -1374,17 +1374,17 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1374
1374
|
children: Xe(e, i)
|
|
1375
1375
|
}, e);
|
|
1376
1376
|
}),
|
|
1377
|
-
p && /* @__PURE__ */
|
|
1377
|
+
p && /* @__PURE__ */ Z("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__ */ Z("tbody", { children: T.map((e) => /* @__PURE__ */ Q("tr", {
|
|
1384
1384
|
className: "border-b border-border/50 hover:bg-muted/30",
|
|
1385
1385
|
children: [
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
className:
|
|
1386
|
+
/* @__PURE__ */ Z("td", {
|
|
1387
|
+
className: N("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({
|
|
@@ -1405,18 +1405,18 @@ var Qe = ({ 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__ */ Z("td", {
|
|
1409
|
+
className: N("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: j(n)
|
|
1416
1416
|
}, t);
|
|
1417
1417
|
}),
|
|
1418
|
-
p && /* @__PURE__ */
|
|
1419
|
-
className:
|
|
1418
|
+
p && /* @__PURE__ */ Z("td", {
|
|
1419
|
+
className: N("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({
|
|
@@ -1429,19 +1429,19 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1429
1429
|
rowKey: e,
|
|
1430
1430
|
value: O[e] ?? 0
|
|
1431
1431
|
})) : void 0,
|
|
1432
|
-
children:
|
|
1432
|
+
children: j(O[e] ?? 0)
|
|
1433
1433
|
})
|
|
1434
1434
|
]
|
|
1435
1435
|
}, e)) }),
|
|
1436
|
-
m && /* @__PURE__ */
|
|
1436
|
+
m && /* @__PURE__ */ Z("tfoot", { children: /* @__PURE__ */ Q("tr", {
|
|
1437
1437
|
className: "border-t-2 border-border font-semibold bg-muted/40",
|
|
1438
1438
|
children: [
|
|
1439
|
-
/* @__PURE__ */
|
|
1439
|
+
/* @__PURE__ */ Z("td", {
|
|
1440
1440
|
className: "p-2",
|
|
1441
1441
|
children: v
|
|
1442
1442
|
}),
|
|
1443
|
-
E.map((e) => /* @__PURE__ */
|
|
1444
|
-
className:
|
|
1443
|
+
E.map((e) => /* @__PURE__ */ Z("td", {
|
|
1444
|
+
className: N("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({
|
|
@@ -1454,10 +1454,10 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1454
1454
|
colKey: e,
|
|
1455
1455
|
value: k[e] ?? 0
|
|
1456
1456
|
})) : void 0,
|
|
1457
|
-
children:
|
|
1457
|
+
children: j(k[e] ?? 0)
|
|
1458
1458
|
}, e)),
|
|
1459
|
-
p && /* @__PURE__ */
|
|
1460
|
-
className:
|
|
1459
|
+
p && /* @__PURE__ */ Z("td", {
|
|
1460
|
+
className: N("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({
|
|
@@ -1468,7 +1468,7 @@ var Qe = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1468
1468
|
scope: "total",
|
|
1469
1469
|
value: A
|
|
1470
1470
|
})) : void 0,
|
|
1471
|
-
children:
|
|
1471
|
+
children: j(A)
|
|
1472
1472
|
})
|
|
1473
1473
|
]
|
|
1474
1474
|
}) })
|
|
@@ -1503,35 +1503,35 @@ function et(e, t) {
|
|
|
1503
1503
|
return Array.from(a);
|
|
1504
1504
|
}
|
|
1505
1505
|
var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
1506
|
-
let a = ne(s), c = t || a?.dataSource, u = l(e.bind), { fieldLabel: d, fieldOptionLabel: f } =
|
|
1506
|
+
let a = ne(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
|
-
let { t: e } =
|
|
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
|
-
n && n !== "dashboard.noDataSourceFor" && (
|
|
1511
|
+
n && n !== "dashboard.noDataSourceFor" && (g = n);
|
|
1512
1512
|
} catch {}
|
|
1513
|
-
let [
|
|
1514
|
-
|
|
1513
|
+
let [_, v] = H([]), [y, b] = H(null), [x, S] = H(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, w] = H(null);
|
|
1514
|
+
z(() => {
|
|
1515
1515
|
let t = !0;
|
|
1516
1516
|
return e.objectName && !u && (!e.data || e.data.length === 0) ? (async () => {
|
|
1517
1517
|
if (!c || !e.objectName) {
|
|
1518
|
-
t &&
|
|
1518
|
+
t && S(!1);
|
|
1519
1519
|
return;
|
|
1520
1520
|
}
|
|
1521
|
-
t && (
|
|
1521
|
+
t && (S(!0), w(null));
|
|
1522
1522
|
try {
|
|
1523
1523
|
let r;
|
|
1524
1524
|
if (typeof c.find == "function") {
|
|
1525
|
-
let t = et(e,
|
|
1525
|
+
let t = et(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
|
-
t &&
|
|
1528
|
+
t && v(r);
|
|
1529
1529
|
} catch (e) {
|
|
1530
|
-
console.error("[ObjectDataTable] Fetch error:", e), t &&
|
|
1530
|
+
console.error("[ObjectDataTable] Fetch error:", e), t && w(e instanceof Error ? e.message : "Failed to load data");
|
|
1531
1531
|
} finally {
|
|
1532
|
-
t &&
|
|
1532
|
+
t && S(!1);
|
|
1533
1533
|
}
|
|
1534
|
-
})() : t &&
|
|
1534
|
+
})() : t && S(!1), () => {
|
|
1535
1535
|
t = !1;
|
|
1536
1536
|
};
|
|
1537
1537
|
}, [
|
|
@@ -1540,19 +1540,19 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1540
1540
|
u,
|
|
1541
1541
|
e.data,
|
|
1542
1542
|
e.filter,
|
|
1543
|
-
|
|
1544
|
-
]),
|
|
1543
|
+
y
|
|
1544
|
+
]), z(() => {
|
|
1545
1545
|
let t = !0;
|
|
1546
1546
|
if (!(!c || !e.objectName || typeof c.getObjectSchema != "function")) return c.getObjectSchema(e.objectName).then((e) => {
|
|
1547
|
-
t &&
|
|
1547
|
+
t && b(e);
|
|
1548
1548
|
}).catch(() => {}), () => {
|
|
1549
1549
|
t = !1;
|
|
1550
1550
|
};
|
|
1551
1551
|
}, [e.objectName, c]);
|
|
1552
|
-
let
|
|
1552
|
+
let T = u || e.data || _, E = Array.isArray(T) ? T : [], D = B(() => {
|
|
1553
1553
|
let t = e.objectName, n = {};
|
|
1554
|
-
if (
|
|
1555
|
-
let e =
|
|
1554
|
+
if (y?.fields) {
|
|
1555
|
+
let e = y.fields;
|
|
1556
1556
|
if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
|
|
1557
1557
|
else for (let [t, r] of Object.entries(e)) n[t] = {
|
|
1558
1558
|
name: t,
|
|
@@ -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 be(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 Se((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) ? xe(e, t) : /* @__PURE__ */ Z(Ce(we(o)), {
|
|
1617
1617
|
value: e,
|
|
1618
1618
|
field: o
|
|
1619
1619
|
});
|
|
@@ -1632,7 +1632,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1632
1632
|
header: d(t, e.accessorKey, e.header)
|
|
1633
1633
|
})) : n).map(i);
|
|
1634
1634
|
}
|
|
1635
|
-
if (
|
|
1635
|
+
if (E.length === 0) return [];
|
|
1636
1636
|
let a = new Set([
|
|
1637
1637
|
"id",
|
|
1638
1638
|
"organization_id",
|
|
@@ -1647,54 +1647,54 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1647
1647
|
"_id",
|
|
1648
1648
|
"__typename"
|
|
1649
1649
|
]), o = (e, t) => t && (t.isSystem === !0 || t.system === !0) ? !0 : a.has(e);
|
|
1650
|
-
return (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !o(e, n[e])) : Object.keys(
|
|
1650
|
+
return (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !o(e, n[e])) : Object.keys(E[0]).filter((e) => !e.startsWith("_") && !o(e))).map((e) => i({
|
|
1651
1651
|
header: r(e),
|
|
1652
1652
|
accessorKey: e
|
|
1653
1653
|
}));
|
|
1654
1654
|
}, [
|
|
1655
1655
|
e.columns,
|
|
1656
1656
|
e.objectName,
|
|
1657
|
-
|
|
1658
|
-
|
|
1657
|
+
E,
|
|
1658
|
+
y,
|
|
1659
1659
|
d,
|
|
1660
1660
|
f
|
|
1661
1661
|
]);
|
|
1662
|
-
if (
|
|
1663
|
-
className:
|
|
1662
|
+
if (x && E.length === 0) return /* @__PURE__ */ Z("div", {
|
|
1663
|
+
className: N("overflow-auto", r),
|
|
1664
1664
|
"data-testid": "table-loading",
|
|
1665
|
-
children: /* @__PURE__ */
|
|
1665
|
+
children: /* @__PURE__ */ Q("div", {
|
|
1666
1666
|
className: "space-y-2 p-2",
|
|
1667
|
-
children: [/* @__PURE__ */
|
|
1667
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
1668
1668
|
className: "flex gap-2",
|
|
1669
1669
|
children: [
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1670
|
+
/* @__PURE__ */ Z(M, { className: "h-6 w-1/4" }),
|
|
1671
|
+
/* @__PURE__ */ Z(M, { className: "h-6 w-1/4" }),
|
|
1672
|
+
/* @__PURE__ */ Z(M, { className: "h-6 w-1/4" }),
|
|
1673
|
+
/* @__PURE__ */ Z(M, { className: "h-6 w-1/4" })
|
|
1674
1674
|
]
|
|
1675
1675
|
}), [
|
|
1676
1676
|
1,
|
|
1677
1677
|
2,
|
|
1678
1678
|
3,
|
|
1679
1679
|
4
|
|
1680
|
-
].map((e) => /* @__PURE__ */
|
|
1680
|
+
].map((e) => /* @__PURE__ */ Q("div", {
|
|
1681
1681
|
className: "flex gap-2",
|
|
1682
1682
|
children: [
|
|
1683
|
-
/* @__PURE__ */
|
|
1684
|
-
/* @__PURE__ */
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ Z(M, { className: "h-5 w-1/4" }),
|
|
1684
|
+
/* @__PURE__ */ Z(M, { className: "h-5 w-1/4" }),
|
|
1685
|
+
/* @__PURE__ */ Z(M, { className: "h-5 w-1/4" }),
|
|
1686
|
+
/* @__PURE__ */ Z(M, { className: "h-5 w-1/4" })
|
|
1687
1687
|
]
|
|
1688
1688
|
}, e))]
|
|
1689
1689
|
})
|
|
1690
1690
|
});
|
|
1691
|
-
if (
|
|
1692
|
-
className:
|
|
1691
|
+
if (C) return /* @__PURE__ */ Z("div", {
|
|
1692
|
+
className: N("overflow-auto", r),
|
|
1693
1693
|
"data-testid": "table-error",
|
|
1694
|
-
children: /* @__PURE__ */
|
|
1694
|
+
children: /* @__PURE__ */ Q("div", {
|
|
1695
1695
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
1696
1696
|
"data-testid": "table-error-message",
|
|
1697
|
-
children: [/* @__PURE__ */
|
|
1697
|
+
children: [/* @__PURE__ */ Q("svg", {
|
|
1698
1698
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1699
1699
|
className: "h-8 w-8 mb-2 opacity-60",
|
|
1700
1700
|
viewBox: "0 0 24 24",
|
|
@@ -1704,38 +1704,38 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1704
1704
|
strokeLinecap: "round",
|
|
1705
1705
|
strokeLinejoin: "round",
|
|
1706
1706
|
children: [
|
|
1707
|
-
/* @__PURE__ */
|
|
1707
|
+
/* @__PURE__ */ Z("circle", {
|
|
1708
1708
|
cx: "12",
|
|
1709
1709
|
cy: "12",
|
|
1710
1710
|
r: "10"
|
|
1711
1711
|
}),
|
|
1712
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ Z("line", {
|
|
1713
1713
|
x1: "12",
|
|
1714
1714
|
y1: "8",
|
|
1715
1715
|
x2: "12",
|
|
1716
1716
|
y2: "12"
|
|
1717
1717
|
}),
|
|
1718
|
-
/* @__PURE__ */
|
|
1718
|
+
/* @__PURE__ */ Z("line", {
|
|
1719
1719
|
x1: "12",
|
|
1720
1720
|
y1: "16",
|
|
1721
1721
|
x2: "12.01",
|
|
1722
1722
|
y2: "16"
|
|
1723
1723
|
})
|
|
1724
1724
|
]
|
|
1725
|
-
}), /* @__PURE__ */
|
|
1725
|
+
}), /* @__PURE__ */ Z("p", {
|
|
1726
1726
|
className: "text-xs",
|
|
1727
|
-
children:
|
|
1727
|
+
children: C
|
|
1728
1728
|
})]
|
|
1729
1729
|
})
|
|
1730
1730
|
});
|
|
1731
|
-
if (!c && e.objectName &&
|
|
1732
|
-
className:
|
|
1733
|
-
children: /* @__PURE__ */
|
|
1731
|
+
if (!c && e.objectName && E.length === 0) return /* @__PURE__ */ Z("div", {
|
|
1732
|
+
className: N("overflow-auto", r),
|
|
1733
|
+
children: /* @__PURE__ */ Z("div", {
|
|
1734
1734
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1735
|
-
children: /* @__PURE__ */
|
|
1735
|
+
children: /* @__PURE__ */ Q("p", {
|
|
1736
1736
|
className: "text-xs",
|
|
1737
1737
|
children: [
|
|
1738
|
-
|
|
1738
|
+
g,
|
|
1739
1739
|
" “",
|
|
1740
1740
|
e.objectName,
|
|
1741
1741
|
"”"
|
|
@@ -1743,12 +1743,12 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1743
1743
|
})
|
|
1744
1744
|
})
|
|
1745
1745
|
});
|
|
1746
|
-
if (
|
|
1747
|
-
className:
|
|
1746
|
+
if (E.length === 0) return /* @__PURE__ */ Z("div", {
|
|
1747
|
+
className: N("overflow-auto", r),
|
|
1748
1748
|
"data-testid": "table-empty-state",
|
|
1749
|
-
children: /* @__PURE__ */
|
|
1749
|
+
children: /* @__PURE__ */ Q("div", {
|
|
1750
1750
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1751
|
-
children: [/* @__PURE__ */
|
|
1751
|
+
children: [/* @__PURE__ */ Q("svg", {
|
|
1752
1752
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1753
1753
|
className: "h-8 w-8 mb-2 opacity-40",
|
|
1754
1754
|
viewBox: "0 0 24 24",
|
|
@@ -1758,7 +1758,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1758
1758
|
strokeLinecap: "round",
|
|
1759
1759
|
strokeLinejoin: "round",
|
|
1760
1760
|
children: [
|
|
1761
|
-
/* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ Z("rect", {
|
|
1762
1762
|
x: "3",
|
|
1763
1763
|
y: "3",
|
|
1764
1764
|
width: "18",
|
|
@@ -1766,45 +1766,45 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1766
1766
|
rx: "2",
|
|
1767
1767
|
ry: "2"
|
|
1768
1768
|
}),
|
|
1769
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ Z("line", {
|
|
1770
1770
|
x1: "3",
|
|
1771
1771
|
y1: "9",
|
|
1772
1772
|
x2: "21",
|
|
1773
1773
|
y2: "9"
|
|
1774
1774
|
}),
|
|
1775
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ Z("line", {
|
|
1776
1776
|
x1: "9",
|
|
1777
1777
|
y1: "21",
|
|
1778
1778
|
x2: "9",
|
|
1779
1779
|
y2: "9"
|
|
1780
1780
|
})
|
|
1781
1781
|
]
|
|
1782
|
-
}), /* @__PURE__ */
|
|
1782
|
+
}), /* @__PURE__ */ Z("p", {
|
|
1783
1783
|
className: "text-xs",
|
|
1784
1784
|
children: p
|
|
1785
1785
|
})]
|
|
1786
1786
|
})
|
|
1787
1787
|
});
|
|
1788
|
-
let
|
|
1788
|
+
let k = {
|
|
1789
1789
|
...e,
|
|
1790
1790
|
type: "data-table",
|
|
1791
|
-
data:
|
|
1792
|
-
columns:
|
|
1791
|
+
data: E,
|
|
1792
|
+
columns: D
|
|
1793
1793
|
};
|
|
1794
|
-
return /* @__PURE__ */
|
|
1795
|
-
className:
|
|
1796
|
-
children: [/* @__PURE__ */
|
|
1797
|
-
schema:
|
|
1794
|
+
return /* @__PURE__ */ Q("div", {
|
|
1795
|
+
className: N("relative", r),
|
|
1796
|
+
children: [/* @__PURE__ */ Z(O, { active: x && E.length > 0 }), /* @__PURE__ */ Z(o, {
|
|
1797
|
+
schema: k,
|
|
1798
1798
|
className: r
|
|
1799
1799
|
})]
|
|
1800
1800
|
});
|
|
1801
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__ */
|
|
1803
|
-
className:
|
|
1802
|
+
let f = d && typeof d == "object" && (Array.isArray(d.columns) || "objectName" in d), p = /* @__PURE__ */ Z("div", {
|
|
1803
|
+
className: N("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;
|
|
1807
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ Z(o, { schema: {
|
|
1808
1808
|
...d,
|
|
1809
1809
|
type: "spec-report",
|
|
1810
1810
|
report: {
|
|
@@ -1813,7 +1813,7 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1813
1813
|
},
|
|
1814
1814
|
filter: t
|
|
1815
1815
|
} });
|
|
1816
|
-
})() : /* @__PURE__ */
|
|
1816
|
+
})() : /* @__PURE__ */ Z(tt, {
|
|
1817
1817
|
schema: {
|
|
1818
1818
|
type: "object-data-table",
|
|
1819
1819
|
objectName: i,
|
|
@@ -1829,30 +1829,30 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1829
1829
|
dataSource: s
|
|
1830
1830
|
})
|
|
1831
1831
|
});
|
|
1832
|
-
return r === "dialog" ? /* @__PURE__ */
|
|
1832
|
+
return r === "dialog" ? /* @__PURE__ */ Z(w, {
|
|
1833
1833
|
open: e,
|
|
1834
1834
|
onOpenChange: (e) => !e && t(),
|
|
1835
|
-
children: /* @__PURE__ */
|
|
1835
|
+
children: /* @__PURE__ */ Q(T, {
|
|
1836
1836
|
className: "max-w-5xl",
|
|
1837
|
-
children: [/* @__PURE__ */
|
|
1837
|
+
children: [/* @__PURE__ */ Z(E, { children: /* @__PURE__ */ Z(D, { children: n }) }), p]
|
|
1838
1838
|
})
|
|
1839
|
-
}) : /* @__PURE__ */
|
|
1839
|
+
}) : /* @__PURE__ */ Z(k, {
|
|
1840
1840
|
open: e,
|
|
1841
1841
|
onOpenChange: (e) => !e && t(),
|
|
1842
|
-
children: /* @__PURE__ */
|
|
1842
|
+
children: /* @__PURE__ */ Q(A, {
|
|
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__ */
|
|
1845
|
+
children: [/* @__PURE__ */ Z(j, { 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
1851
|
}, rt = ({ schema: e, dataSource: o, className: c }) => {
|
|
1852
|
-
let u = ne(s), d = o || u?.dataSource, f = l(e.bind), [p, m] =
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
}, [
|
|
1852
|
+
let u = ne(s), d = o || u?.dataSource, f = l(e.bind), [p, m] = H([]), [g, _] = H(!1), [v, y] = H(null), [b, x] = H({}), [S, C] = H({}), [w, T] = H(null), { fieldLabel: E, fieldOptionLabel: D } = h(), O = V(E), k = V(D);
|
|
1853
|
+
z(() => {
|
|
1854
|
+
O.current = E, k.current = D;
|
|
1855
|
+
}, [E, D]), z(() => {
|
|
1856
1856
|
if (!d || !e.objectName) return;
|
|
1857
1857
|
let t = d.getObjectSchema;
|
|
1858
1858
|
if (typeof t != "function") return;
|
|
@@ -1862,35 +1862,35 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1862
1862
|
let r = e.objectName, i = {}, a = {};
|
|
1863
1863
|
for (let [e, n] of Object.entries(t.fields)) {
|
|
1864
1864
|
let t = n?.label ? String(n.label) : e;
|
|
1865
|
-
a[e] =
|
|
1865
|
+
a[e] = O.current(r, e, t);
|
|
1866
1866
|
let o = n?.options;
|
|
1867
1867
|
if (Array.isArray(o) && o.length > 0) {
|
|
1868
1868
|
let t = {};
|
|
1869
1869
|
for (let n of o) if (n && n.value !== void 0 && n.label !== void 0) {
|
|
1870
1870
|
let i = String(n.value), a = String(n.label);
|
|
1871
|
-
t[i] =
|
|
1871
|
+
t[i] = k.current(r, e, i, a);
|
|
1872
1872
|
}
|
|
1873
1873
|
Object.keys(t).length > 0 && (i[e] = t);
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
|
-
|
|
1876
|
+
x(i), C(a);
|
|
1877
1877
|
}).catch(() => {}), () => {
|
|
1878
1878
|
n = !1;
|
|
1879
1879
|
};
|
|
1880
|
-
}, [d, e.objectName]),
|
|
1880
|
+
}, [d, e.objectName]), z(() => {
|
|
1881
1881
|
let t = !0;
|
|
1882
1882
|
return e.objectName && !f && (!e.data || e.data.length === 0) && (async () => {
|
|
1883
1883
|
if (!(!d || !e.objectName)) {
|
|
1884
|
-
t && (
|
|
1884
|
+
t && (_(!0), y(null));
|
|
1885
1885
|
try {
|
|
1886
1886
|
let r;
|
|
1887
1887
|
if (typeof d.find == "function") r = n(await d.find(e.objectName, { $filter: i(e.filter) }));
|
|
1888
1888
|
else return;
|
|
1889
1889
|
t && m(r);
|
|
1890
1890
|
} catch (e) {
|
|
1891
|
-
console.error("[ObjectPivotTable] Fetch error:", e), t &&
|
|
1891
|
+
console.error("[ObjectPivotTable] Fetch error:", e), t && y(e instanceof Error ? e.message : "Failed to load data");
|
|
1892
1892
|
} finally {
|
|
1893
|
-
t &&
|
|
1893
|
+
t && _(!1);
|
|
1894
1894
|
}
|
|
1895
1895
|
}
|
|
1896
1896
|
})(), () => {
|
|
@@ -1903,48 +1903,48 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1903
1903
|
e.data,
|
|
1904
1904
|
e.filter
|
|
1905
1905
|
]);
|
|
1906
|
-
let
|
|
1907
|
-
if (
|
|
1908
|
-
className:
|
|
1906
|
+
let A = f || e.data || p, j = Array.isArray(A) ? A : [];
|
|
1907
|
+
if (g && j.length === 0) return /* @__PURE__ */ Q("div", {
|
|
1908
|
+
className: N("overflow-auto", c),
|
|
1909
1909
|
"data-testid": "pivot-loading",
|
|
1910
|
-
children: [e.title && /* @__PURE__ */
|
|
1910
|
+
children: [e.title && /* @__PURE__ */ Z("h3", {
|
|
1911
1911
|
className: "text-sm font-semibold mb-2",
|
|
1912
1912
|
children: e.title
|
|
1913
|
-
}), /* @__PURE__ */
|
|
1913
|
+
}), /* @__PURE__ */ Q("div", {
|
|
1914
1914
|
className: "space-y-2 p-2",
|
|
1915
|
-
children: [/* @__PURE__ */
|
|
1915
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
1916
1916
|
className: "flex gap-2",
|
|
1917
1917
|
children: [
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
/* @__PURE__ */
|
|
1920
|
-
/* @__PURE__ */
|
|
1921
|
-
/* @__PURE__ */
|
|
1918
|
+
/* @__PURE__ */ Z(M, { className: "h-6 w-24" }),
|
|
1919
|
+
/* @__PURE__ */ Z(M, { className: "h-6 w-20" }),
|
|
1920
|
+
/* @__PURE__ */ Z(M, { className: "h-6 w-20" }),
|
|
1921
|
+
/* @__PURE__ */ Z(M, { className: "h-6 w-20" })
|
|
1922
1922
|
]
|
|
1923
1923
|
}), [
|
|
1924
1924
|
1,
|
|
1925
1925
|
2,
|
|
1926
1926
|
3
|
|
1927
|
-
].map((e) => /* @__PURE__ */
|
|
1927
|
+
].map((e) => /* @__PURE__ */ Q("div", {
|
|
1928
1928
|
className: "flex gap-2",
|
|
1929
1929
|
children: [
|
|
1930
|
-
/* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ Z(M, { className: "h-5 w-24" }),
|
|
1931
|
+
/* @__PURE__ */ Z(M, { className: "h-5 w-20" }),
|
|
1932
|
+
/* @__PURE__ */ Z(M, { className: "h-5 w-20" }),
|
|
1933
|
+
/* @__PURE__ */ Z(M, { className: "h-5 w-20" })
|
|
1934
1934
|
]
|
|
1935
1935
|
}, e))]
|
|
1936
1936
|
})]
|
|
1937
1937
|
});
|
|
1938
|
-
if (
|
|
1939
|
-
className:
|
|
1938
|
+
if (v) return /* @__PURE__ */ Q("div", {
|
|
1939
|
+
className: N("overflow-auto", c),
|
|
1940
1940
|
"data-testid": "pivot-error",
|
|
1941
|
-
children: [e.title && /* @__PURE__ */
|
|
1941
|
+
children: [e.title && /* @__PURE__ */ Z("h3", {
|
|
1942
1942
|
className: "text-sm font-semibold mb-2",
|
|
1943
1943
|
children: e.title
|
|
1944
|
-
}), /* @__PURE__ */
|
|
1944
|
+
}), /* @__PURE__ */ Q("div", {
|
|
1945
1945
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
1946
1946
|
"data-testid": "pivot-error-message",
|
|
1947
|
-
children: [/* @__PURE__ */
|
|
1947
|
+
children: [/* @__PURE__ */ Q("svg", {
|
|
1948
1948
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1949
1949
|
className: "h-8 w-8 mb-2 opacity-60",
|
|
1950
1950
|
viewBox: "0 0 24 24",
|
|
@@ -1954,38 +1954,38 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1954
1954
|
strokeLinecap: "round",
|
|
1955
1955
|
strokeLinejoin: "round",
|
|
1956
1956
|
children: [
|
|
1957
|
-
/* @__PURE__ */
|
|
1957
|
+
/* @__PURE__ */ Z("circle", {
|
|
1958
1958
|
cx: "12",
|
|
1959
1959
|
cy: "12",
|
|
1960
1960
|
r: "10"
|
|
1961
1961
|
}),
|
|
1962
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ Z("line", {
|
|
1963
1963
|
x1: "12",
|
|
1964
1964
|
y1: "8",
|
|
1965
1965
|
x2: "12",
|
|
1966
1966
|
y2: "12"
|
|
1967
1967
|
}),
|
|
1968
|
-
/* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ Z("line", {
|
|
1969
1969
|
x1: "12",
|
|
1970
1970
|
y1: "16",
|
|
1971
1971
|
x2: "12.01",
|
|
1972
1972
|
y2: "16"
|
|
1973
1973
|
})
|
|
1974
1974
|
]
|
|
1975
|
-
}), /* @__PURE__ */
|
|
1975
|
+
}), /* @__PURE__ */ Z("p", {
|
|
1976
1976
|
className: "text-xs",
|
|
1977
|
-
children:
|
|
1977
|
+
children: v
|
|
1978
1978
|
})]
|
|
1979
1979
|
})]
|
|
1980
1980
|
});
|
|
1981
|
-
if (!d && e.objectName &&
|
|
1982
|
-
className:
|
|
1983
|
-
children: [e.title && /* @__PURE__ */
|
|
1981
|
+
if (!d && e.objectName && j.length === 0) return /* @__PURE__ */ Q("div", {
|
|
1982
|
+
className: N("overflow-auto", c),
|
|
1983
|
+
children: [e.title && /* @__PURE__ */ Z("h3", {
|
|
1984
1984
|
className: "text-sm font-semibold mb-2",
|
|
1985
1985
|
children: e.title
|
|
1986
|
-
}), /* @__PURE__ */
|
|
1986
|
+
}), /* @__PURE__ */ Z("div", {
|
|
1987
1987
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1988
|
-
children: /* @__PURE__ */
|
|
1988
|
+
children: /* @__PURE__ */ Q("p", {
|
|
1989
1989
|
className: "text-xs",
|
|
1990
1990
|
children: [
|
|
1991
1991
|
"No data source available for “",
|
|
@@ -1995,37 +1995,37 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1995
1995
|
})
|
|
1996
1996
|
})]
|
|
1997
1997
|
});
|
|
1998
|
-
let
|
|
1998
|
+
let ee = {
|
|
1999
1999
|
...e,
|
|
2000
|
-
data:
|
|
2001
|
-
}, P = e.rowField ?
|
|
2002
|
-
return /* @__PURE__ */
|
|
2003
|
-
schema:
|
|
2000
|
+
data: j
|
|
2001
|
+
}, P = e.rowField ? b[e.rowField] : void 0, F = e.columnField ? b[e.columnField] : void 0, I = e.rowField ? S[e.rowField] : void 0, L = e.drillDown;
|
|
2002
|
+
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(Qe, {
|
|
2003
|
+
schema: ee,
|
|
2004
2004
|
className: c,
|
|
2005
2005
|
rowLabels: P,
|
|
2006
|
-
columnLabels:
|
|
2007
|
-
rowFieldLabel:
|
|
2008
|
-
onDrillDown: r(
|
|
2006
|
+
columnLabels: F,
|
|
2007
|
+
rowFieldLabel: I,
|
|
2008
|
+
onDrillDown: r(L) ? (e) => T(e) : void 0
|
|
2009
2009
|
}), (() => {
|
|
2010
|
-
if (!
|
|
2011
|
-
let n = t(
|
|
2010
|
+
if (!w || !e.objectName) return null;
|
|
2011
|
+
let n = t(L, 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__ */
|
|
2018
|
+
return /* @__PURE__ */ Z(nt, {
|
|
2019
2019
|
open: !0,
|
|
2020
|
-
onClose: () =>
|
|
2021
|
-
title: a(
|
|
2022
|
-
target:
|
|
2020
|
+
onClose: () => T(null),
|
|
2021
|
+
title: a(L, w, e.title || "Details"),
|
|
2022
|
+
target: L?.target ?? "drawer",
|
|
2023
2023
|
objectName: e.objectName,
|
|
2024
2024
|
filter: r,
|
|
2025
2025
|
dataSource: d,
|
|
2026
|
-
columns:
|
|
2027
|
-
maxRows:
|
|
2028
|
-
report:
|
|
2026
|
+
columns: L?.columns,
|
|
2027
|
+
maxRows: L?.maxRows,
|
|
2028
|
+
report: L?.report
|
|
2029
2029
|
});
|
|
2030
2030
|
})()] });
|
|
2031
2031
|
}, it = {
|
|
@@ -2155,8 +2155,8 @@ var tt = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
2155
2155
|
]
|
|
2156
2156
|
};
|
|
2157
2157
|
function at({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
2158
|
-
let { draft: a, isDirty: o, updateField: s, discard: c } =
|
|
2159
|
-
return /* @__PURE__ */
|
|
2158
|
+
let { draft: a, isDirty: o, updateField: s, discard: c } = F(n, { onUpdate: i });
|
|
2159
|
+
return /* @__PURE__ */ Z(S, {
|
|
2160
2160
|
open: e,
|
|
2161
2161
|
onClose: t,
|
|
2162
2162
|
schema: it,
|
|
@@ -2337,11 +2337,11 @@ function Ct(e, t, n, r) {
|
|
|
2337
2337
|
key: e,
|
|
2338
2338
|
label: t,
|
|
2339
2339
|
type: "custom",
|
|
2340
|
-
render: (i, a, o) => /* @__PURE__ */
|
|
2340
|
+
render: (i, a, o) => /* @__PURE__ */ Z(C, {
|
|
2341
2341
|
label: t,
|
|
2342
|
-
children: /* @__PURE__ */
|
|
2342
|
+
children: /* @__PURE__ */ Z("div", {
|
|
2343
2343
|
"data-testid": `config-field-${e}`,
|
|
2344
|
-
children: /* @__PURE__ */
|
|
2344
|
+
children: /* @__PURE__ */ Z(x, {
|
|
2345
2345
|
options: r ?? [],
|
|
2346
2346
|
value: i ?? "",
|
|
2347
2347
|
onValueChange: a,
|
|
@@ -2360,11 +2360,11 @@ function wt(e, t, n) {
|
|
|
2360
2360
|
key: "object",
|
|
2361
2361
|
label: "Data source",
|
|
2362
2362
|
type: "custom",
|
|
2363
|
-
render: (t, n) => /* @__PURE__ */
|
|
2363
|
+
render: (t, n) => /* @__PURE__ */ Z(C, {
|
|
2364
2364
|
label: "Data source",
|
|
2365
|
-
children: /* @__PURE__ */
|
|
2365
|
+
children: /* @__PURE__ */ Z("div", {
|
|
2366
2366
|
"data-testid": "config-field-object",
|
|
2367
|
-
children: /* @__PURE__ */
|
|
2367
|
+
children: /* @__PURE__ */ Z(x, {
|
|
2368
2368
|
options: e,
|
|
2369
2369
|
value: t ?? "",
|
|
2370
2370
|
onValueChange: n,
|
|
@@ -2708,15 +2708,15 @@ function Et(e) {
|
|
|
2708
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;
|
|
2709
2709
|
}
|
|
2710
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 } =
|
|
2711
|
+
let { draft: c, isDirty: l, updateField: u, discard: d } = F(I.useMemo(() => ({
|
|
2712
2712
|
...n,
|
|
2713
2713
|
title: typeof n.title == "object" ? Tt(n.title) : n.title,
|
|
2714
2714
|
description: typeof n.description == "object" ? Tt(n.description) : n.description
|
|
2715
2715
|
}), [n]), { onUpdate: i });
|
|
2716
|
-
return /* @__PURE__ */
|
|
2716
|
+
return /* @__PURE__ */ Z(S, {
|
|
2717
2717
|
open: e,
|
|
2718
2718
|
onClose: t,
|
|
2719
|
-
schema:
|
|
2719
|
+
schema: I.useMemo(() => wt(o, s, c.type), [
|
|
2720
2720
|
o,
|
|
2721
2721
|
s,
|
|
2722
2722
|
c.type
|
|
@@ -2732,11 +2732,11 @@ function Dt({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
|
|
|
2732
2732
|
//#endregion
|
|
2733
2733
|
//#region src/DashboardWithConfig.tsx
|
|
2734
2734
|
function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
|
|
2735
|
-
let [c, l] =
|
|
2736
|
-
|
|
2737
|
-
|
|
2735
|
+
let [c, l] = H(o), [u, d] = H(null), [f, p] = H(e), [m, h] = H(0);
|
|
2736
|
+
z(() => {
|
|
2737
|
+
p(e), h((e) => e + 1);
|
|
2738
2738
|
}, [e]);
|
|
2739
|
-
let _ =
|
|
2739
|
+
let _ = I.useMemo(() => {
|
|
2740
2740
|
if (!u || !f.widgets) return null;
|
|
2741
2741
|
let e = f.widgets.find((e) => (e.id || e.title) === u);
|
|
2742
2742
|
if (!e) return null;
|
|
@@ -2758,12 +2758,12 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2758
2758
|
layoutW: e.layout?.w ?? 1,
|
|
2759
2759
|
layoutH: e.layout?.h ?? 1
|
|
2760
2760
|
};
|
|
2761
|
-
}, [u,
|
|
2761
|
+
}, [u, m]), v = R((e) => {
|
|
2762
2762
|
d(e), l(!0);
|
|
2763
|
-
}, []), y =
|
|
2763
|
+
}, []), y = R(() => {
|
|
2764
2764
|
d(null);
|
|
2765
|
-
}, []), b =
|
|
2766
|
-
u &&
|
|
2765
|
+
}, []), b = R((e, t) => {
|
|
2766
|
+
u && p((n) => n.widgets ? {
|
|
2767
2767
|
...n,
|
|
2768
2768
|
widgets: n.widgets.map((n) => {
|
|
2769
2769
|
if ((n.id || n.title) !== u) return n;
|
|
@@ -2803,7 +2803,7 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2803
2803
|
};
|
|
2804
2804
|
})
|
|
2805
2805
|
} : n);
|
|
2806
|
-
}, [u]), x =
|
|
2806
|
+
}, [u]), x = R((e) => {
|
|
2807
2807
|
if (u && r) {
|
|
2808
2808
|
let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
|
|
2809
2809
|
(t || n) && (a.options = {
|
|
@@ -2815,25 +2815,25 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2815
2815
|
}
|
|
2816
2816
|
}), r(u, a);
|
|
2817
2817
|
}
|
|
2818
|
-
d(null),
|
|
2819
|
-
}, [u, r]), S =
|
|
2818
|
+
d(null), h((e) => e + 1);
|
|
2819
|
+
}, [u, r]), S = R(() => {
|
|
2820
2820
|
l((e) => !e), d(null);
|
|
2821
2821
|
}, []);
|
|
2822
|
-
return /* @__PURE__ */
|
|
2823
|
-
className:
|
|
2822
|
+
return /* @__PURE__ */ Q("div", {
|
|
2823
|
+
className: N("flex h-full w-full", s),
|
|
2824
2824
|
"data-testid": "dashboard-with-config",
|
|
2825
|
-
children: [/* @__PURE__ */
|
|
2825
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
2826
2826
|
className: "flex-1 min-w-0 overflow-auto relative",
|
|
2827
|
-
children: [/* @__PURE__ */
|
|
2827
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
2828
2828
|
className: "absolute top-2 right-2 z-10",
|
|
2829
|
-
children: /* @__PURE__ */
|
|
2829
|
+
children: /* @__PURE__ */ Q(g, {
|
|
2830
2830
|
size: "sm",
|
|
2831
2831
|
variant: c ? "default" : "outline",
|
|
2832
2832
|
onClick: S,
|
|
2833
2833
|
"data-testid": "dashboard-config-toggle",
|
|
2834
|
-
children: [/* @__PURE__ */
|
|
2834
|
+
children: [/* @__PURE__ */ Z(oe, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
|
|
2835
2835
|
})
|
|
2836
|
-
}), /* @__PURE__ */
|
|
2836
|
+
}), /* @__PURE__ */ Z(je, {
|
|
2837
2837
|
schema: f,
|
|
2838
2838
|
onRefresh: i,
|
|
2839
2839
|
recordCount: a,
|
|
@@ -2841,15 +2841,15 @@ function Ot({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2841
2841
|
selectedWidgetId: u,
|
|
2842
2842
|
onWidgetClick: v
|
|
2843
2843
|
})]
|
|
2844
|
-
}), c && /* @__PURE__ */
|
|
2844
|
+
}), c && /* @__PURE__ */ Z("div", {
|
|
2845
2845
|
className: "relative shrink-0",
|
|
2846
|
-
children: u && _ ? /* @__PURE__ */
|
|
2846
|
+
children: u && _ ? /* @__PURE__ */ Z(Dt, {
|
|
2847
2847
|
open: !0,
|
|
2848
2848
|
onClose: y,
|
|
2849
2849
|
config: _,
|
|
2850
2850
|
onSave: x,
|
|
2851
2851
|
onFieldChange: b
|
|
2852
|
-
}) : /* @__PURE__ */
|
|
2852
|
+
}) : /* @__PURE__ */ Z(at, {
|
|
2853
2853
|
open: !0,
|
|
2854
2854
|
onClose: () => l(!1),
|
|
2855
2855
|
config: t,
|