@object-ui/plugin-dashboard 4.0.9 → 4.0.11
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 +23 -0
- package/README.md +44 -0
- package/dist/index.js +730 -610
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-dashboard/src/DashboardConfigPanel.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/DashboardGridLayout.d.ts +17 -1
- package/dist/packages/plugin-dashboard/src/DashboardGridLayout.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts +15 -1
- package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/ObjectDataTable.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/PivotTable.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/WidgetConfigPanel.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/index.d.ts.map +1 -1
- package/package.json +10 -7
package/dist/index.js
CHANGED
|
@@ -2,32 +2,58 @@ import { ComponentRegistry as e, computeDrillFilter as t, extractRecords as n, i
|
|
|
2
2
|
import { SchemaRenderer as o, SchemaRendererContext as s, useActionEngine as c, useDataScope as l, useDnd as u, useHasDndProvider as d, useObjectLabel as f } from "@object-ui/react";
|
|
3
3
|
import { Button as p, Card as m, CardContent as h, CardHeader as g, CardTitle as _, Combobox as v, ConfigPanelRenderer as y, ConfigRow as b, Dialog as x, DialogContent as S, DialogHeader as C, DialogTitle as w, Sheet as T, SheetContent as E, SheetHeader as D, SheetTitle as O, Skeleton as k, cn as A, getLazyIcon as j, useConfigDraft as M } from "@object-ui/components";
|
|
4
4
|
import * as N from "react";
|
|
5
|
-
import { forwardRef as P, useCallback as F, useContext as
|
|
6
|
-
import { AlertCircle as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { Fragment as ee, forwardRef as P, useCallback as F, useContext as te, useEffect as I, useMemo as L, useRef as ne, useState as R } from "react";
|
|
6
|
+
import { AlertCircle as z, ArrowDownIcon as re, ArrowUpIcon as B, Edit as V, GripVertical as H, Loader2 as U, MinusIcon as W, RefreshCw as ie, Save as ae, Settings as G, X as oe } from "lucide-react";
|
|
7
|
+
import { DndContext as se, PointerSensor as ce, closestCenter as K, useSensor as le, useSensors as ue } from "@dnd-kit/core";
|
|
8
|
+
import { SortableContext as de, arrayMove as fe, rectSortingStrategy as pe, useSortable as me, verticalListSortingStrategy as he } from "@dnd-kit/sortable";
|
|
9
|
+
import { CSS as q } from "@dnd-kit/utilities";
|
|
10
|
+
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
11
|
+
import { ResponsiveGridLayout as ge, useContainerWidth as _e } from "react-grid-layout";
|
|
9
12
|
import "react-grid-layout/css/styles.css";
|
|
10
|
-
import { useObjectTranslation as
|
|
11
|
-
import { formatCurrency as
|
|
13
|
+
import { createSafeTranslation as ve, useObjectTranslation as ye, useSafeFieldLabel as be } from "@object-ui/i18n";
|
|
14
|
+
import { formatCurrency as xe, formatDate as Se, formatPercent as Ce, getCellRenderer as we, resolveCellRendererType as Te } from "@object-ui/fields";
|
|
12
15
|
//#region src/utils.ts
|
|
13
|
-
function
|
|
16
|
+
function Z(e) {
|
|
14
17
|
return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
|
|
15
18
|
}
|
|
16
19
|
//#endregion
|
|
17
20
|
//#region src/DashboardRenderer.tsx
|
|
18
|
-
function
|
|
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 } = me({
|
|
23
|
+
id: e,
|
|
24
|
+
disabled: t
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ Y("div", {
|
|
27
|
+
ref: s,
|
|
28
|
+
style: {
|
|
29
|
+
transform: q.Transform.toString(c),
|
|
30
|
+
transition: l,
|
|
31
|
+
opacity: u ? .4 : 1,
|
|
32
|
+
...n ? {
|
|
33
|
+
gridColumn: `span ${n.w}`,
|
|
34
|
+
gridRow: `span ${n.h}`
|
|
35
|
+
} : {}
|
|
36
|
+
},
|
|
37
|
+
className: A("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
|
|
38
|
+
"data-sortable-widget-id": e,
|
|
39
|
+
...a,
|
|
40
|
+
...o,
|
|
41
|
+
children: i
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function De(e) {
|
|
19
45
|
return e ? j(e) : null;
|
|
20
46
|
}
|
|
21
|
-
function
|
|
47
|
+
function Q(e) {
|
|
22
48
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
23
49
|
}
|
|
24
|
-
var
|
|
50
|
+
var Oe = [
|
|
25
51
|
"hsl(var(--chart-1))",
|
|
26
52
|
"hsl(var(--chart-2))",
|
|
27
53
|
"hsl(var(--chart-3))",
|
|
28
54
|
"hsl(var(--chart-4))",
|
|
29
55
|
"hsl(var(--chart-5))"
|
|
30
|
-
],
|
|
56
|
+
], ke = new Set([
|
|
31
57
|
"bar",
|
|
32
58
|
"horizontal-bar",
|
|
33
59
|
"line",
|
|
@@ -36,11 +62,11 @@ var pe = [
|
|
|
36
62
|
"donut",
|
|
37
63
|
"funnel"
|
|
38
64
|
]);
|
|
39
|
-
function
|
|
40
|
-
return
|
|
65
|
+
function Ae(e) {
|
|
66
|
+
return ke.has(e) ? { enabled: !0 } : void 0;
|
|
41
67
|
}
|
|
42
|
-
var
|
|
43
|
-
let
|
|
68
|
+
var $ = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: s, selectedWidgetId: l, onWidgetClick: u, onWidgetsReorder: d, modalHandler: v, scriptHandlers: y, hideHeaderText: b, ...x }, S) => {
|
|
69
|
+
let C = (() => {
|
|
44
70
|
if (e.columns != null) return e.columns;
|
|
45
71
|
let t = e.widgets ?? [], n = 0;
|
|
46
72
|
for (let e of t) {
|
|
@@ -48,44 +74,44 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
48
74
|
t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
|
|
49
75
|
}
|
|
50
76
|
return n > 4 ? 12 : 4;
|
|
51
|
-
})(),
|
|
77
|
+
})(), w = C, T = e.gap || 4, [E, D] = R(!1), [O, k] = R(!1), j = ne(null), { executeAction: M, engine: N } = c({ actions: L(() => (e.header?.actions ?? []).map((e) => ({
|
|
52
78
|
name: e.actionUrl || e.label,
|
|
53
79
|
type: e.actionType || "url",
|
|
54
80
|
target: e.actionUrl,
|
|
55
81
|
label: e.label
|
|
56
|
-
})), [e.header?.actions]) }), { dashboardLabel:
|
|
57
|
-
let t =
|
|
58
|
-
return !H || !e.id || t === void 0 ? t :
|
|
59
|
-
}, [H,
|
|
60
|
-
let t =
|
|
82
|
+
})), [e.header?.actions]) }), { dashboardLabel: P, dashboardDescription: te, dashboardActionLabel: z, widgetTitle: re, widgetDescription: B, fieldLabel: V } = f(), H = e.name, U = F((e) => H ? z(H, e.actionUrl || e.label, e.label) : e.label, [H, z]), W = F((e) => {
|
|
83
|
+
let t = Q(e.title);
|
|
84
|
+
return !H || !e.id || t === void 0 ? t : re(H, e.id, t);
|
|
85
|
+
}, [H, re]), ae = F((e) => {
|
|
86
|
+
let t = Q(e.description);
|
|
61
87
|
return !H || !e.id ? t : B(H, e.id, t);
|
|
62
88
|
}, [H, B]);
|
|
63
89
|
I(() => {
|
|
64
|
-
let e =
|
|
65
|
-
if (
|
|
90
|
+
let e = N.getRunner();
|
|
91
|
+
if (v && e.setModalHandler(v), y) for (let [t, n] of Object.entries(y)) e.registerScript(t, n);
|
|
66
92
|
}, [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
93
|
+
N,
|
|
94
|
+
v,
|
|
95
|
+
y
|
|
70
96
|
]), I(() => {
|
|
71
|
-
let e = () =>
|
|
97
|
+
let e = () => k(window.innerWidth < 768);
|
|
72
98
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
73
99
|
}, []);
|
|
74
|
-
let
|
|
75
|
-
r && (
|
|
100
|
+
let G = F(() => {
|
|
101
|
+
r && (D(!0), r(), setTimeout(() => D(!1), 600));
|
|
76
102
|
}, [r]);
|
|
77
103
|
I(() => {
|
|
78
|
-
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return
|
|
79
|
-
|
|
104
|
+
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return j.current = setInterval(G, e.refreshInterval * 1e3), () => {
|
|
105
|
+
j.current && clearInterval(j.current);
|
|
80
106
|
};
|
|
81
107
|
}, [
|
|
82
108
|
e.refreshInterval,
|
|
83
109
|
r,
|
|
84
|
-
|
|
110
|
+
G
|
|
85
111
|
]);
|
|
86
|
-
let
|
|
112
|
+
let oe = F((e, t) => {
|
|
87
113
|
!s || !u || !t || (e.stopPropagation(), u(t));
|
|
88
|
-
}, [s, u]),
|
|
114
|
+
}, [s, u]), me = F((t, n, r) => {
|
|
89
115
|
if (!s || !u) return;
|
|
90
116
|
let i = e.widgets || [];
|
|
91
117
|
if (t.key === "Enter" || t.key === " ") t.preventDefault(), u(n ?? null);
|
|
@@ -102,17 +128,27 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
102
128
|
s,
|
|
103
129
|
u,
|
|
104
130
|
e.widgets
|
|
105
|
-
]),
|
|
131
|
+
]), q = F((e) => {
|
|
106
132
|
!s || !u || e.target === e.currentTarget && u(null);
|
|
107
|
-
}, [s, u]),
|
|
133
|
+
}, [s, u]), J = !!(s && d), ge = ue(le(ce, { activationConstraint: { distance: 5 } })), _e = F((t) => {
|
|
134
|
+
if (!J) return;
|
|
135
|
+
let { active: n, over: r } = t;
|
|
136
|
+
if (!r || n.id === r.id) return;
|
|
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?.(fe(i, a, o));
|
|
139
|
+
}, [
|
|
140
|
+
J,
|
|
141
|
+
e.widgets,
|
|
142
|
+
d
|
|
143
|
+
]), ve = (e, t, r) => {
|
|
108
144
|
let i = e.layout ? {
|
|
109
145
|
...e.layout,
|
|
110
|
-
w: Math.min(e.layout.w,
|
|
146
|
+
w: Math.min(e.layout.w, w)
|
|
111
147
|
} : void 0, a = (() => {
|
|
112
148
|
if (e.component) return e.component;
|
|
113
149
|
let t = e.type, n = e.options || {};
|
|
114
150
|
if (t === "metric" && e.object) {
|
|
115
|
-
let t = n.data, r =
|
|
151
|
+
let t = n.data, r = Z(t) && t.aggregate ? {
|
|
116
152
|
field: e.valueField || t.aggregate.field,
|
|
117
153
|
function: e.aggregate || t.aggregate.function,
|
|
118
154
|
groupBy: e.categoryField ?? t.aggregate.groupBy ?? "_all"
|
|
@@ -123,10 +159,10 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
123
159
|
} : void 0;
|
|
124
160
|
return {
|
|
125
161
|
type: "object-metric",
|
|
126
|
-
objectName: e.object || (
|
|
162
|
+
objectName: e.object || (Z(t) ? t.object : void 0),
|
|
127
163
|
aggregate: r,
|
|
128
|
-
filter: (
|
|
129
|
-
label: n.label ||
|
|
164
|
+
filter: (Z(t) ? t.filter : void 0) || e.filter,
|
|
165
|
+
label: n.label || W(e) || "",
|
|
130
166
|
fallbackValue: n.value,
|
|
131
167
|
trend: n.trend,
|
|
132
168
|
icon: n.icon,
|
|
@@ -137,7 +173,7 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
137
173
|
prefix: n.prefix,
|
|
138
174
|
suffix: n.suffix,
|
|
139
175
|
drillDown: n.drillDown ?? { enabled: !0 },
|
|
140
|
-
title: n.label ||
|
|
176
|
+
title: n.label || W(e) || ""
|
|
141
177
|
};
|
|
142
178
|
}
|
|
143
179
|
if ((t === "gauge" || t === "solid-gauge") && e.object) {
|
|
@@ -151,7 +187,7 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
151
187
|
objectName: e.object,
|
|
152
188
|
aggregate: t,
|
|
153
189
|
filter: e.filter,
|
|
154
|
-
label: n.label ||
|
|
190
|
+
label: n.label || W(e) || "",
|
|
155
191
|
fallbackValue: n.fallbackValue ?? n.value,
|
|
156
192
|
icon: n.icon,
|
|
157
193
|
description: n.description
|
|
@@ -160,7 +196,7 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
160
196
|
let r = {}[t] || t;
|
|
161
197
|
if (r === "bar" || r === "horizontal-bar" || r === "line" || r === "area" || r === "pie" || r === "donut" || r === "scatter" || r === "funnel") {
|
|
162
198
|
let t = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
|
|
163
|
-
if (
|
|
199
|
+
if (Z(t)) {
|
|
164
200
|
let o = t.aggregate, s = o ? {
|
|
165
201
|
field: e.valueField || o.field,
|
|
166
202
|
function: e.aggregate || o.function,
|
|
@@ -176,8 +212,8 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
176
212
|
dataKey: c,
|
|
177
213
|
label: l ? V(l, c, c) : c
|
|
178
214
|
}],
|
|
179
|
-
colors:
|
|
180
|
-
drillDown: n.drillDown ??
|
|
215
|
+
colors: Oe,
|
|
216
|
+
drillDown: n.drillDown ?? Ae(r),
|
|
181
217
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
182
218
|
};
|
|
183
219
|
}
|
|
@@ -197,8 +233,8 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
197
233
|
dataKey: a,
|
|
198
234
|
label: V(e.object, a, a)
|
|
199
235
|
}],
|
|
200
|
-
colors:
|
|
201
|
-
drillDown: n.drillDown ??
|
|
236
|
+
colors: Oe,
|
|
237
|
+
drillDown: n.drillDown ?? Ae(r),
|
|
202
238
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
203
239
|
};
|
|
204
240
|
}
|
|
@@ -211,13 +247,13 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
211
247
|
dataKey: a,
|
|
212
248
|
label: e.object ? V(e.object, a, a) : a
|
|
213
249
|
}],
|
|
214
|
-
colors:
|
|
250
|
+
colors: Oe,
|
|
215
251
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
216
252
|
};
|
|
217
253
|
}
|
|
218
254
|
if (t === "table") {
|
|
219
255
|
let t = e.data || n.data;
|
|
220
|
-
if (
|
|
256
|
+
if (Z(t)) {
|
|
221
257
|
let { data: r, ...i } = n;
|
|
222
258
|
return {
|
|
223
259
|
type: "object-data-table",
|
|
@@ -256,11 +292,11 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
256
292
|
showRowTotals: r.showRowTotals ?? n.showRowTotals,
|
|
257
293
|
showColumnTotals: r.showColumnTotals ?? n.showColumnTotals,
|
|
258
294
|
format: r.format ?? n.format
|
|
259
|
-
}, a = (
|
|
295
|
+
}, a = (Z(t) || !t && e.object) && n.drillDown === void 0 ? {
|
|
260
296
|
...n,
|
|
261
297
|
drillDown: { enabled: !0 }
|
|
262
298
|
} : n;
|
|
263
|
-
if (
|
|
299
|
+
if (Z(t)) {
|
|
264
300
|
let { data: n, ...r } = a;
|
|
265
301
|
return {
|
|
266
302
|
type: "object-pivot",
|
|
@@ -286,7 +322,7 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
286
322
|
}
|
|
287
323
|
if (t === "list") {
|
|
288
324
|
let t = e.data || n.data;
|
|
289
|
-
if (
|
|
325
|
+
if (Z(t)) {
|
|
290
326
|
let { data: r, ...i } = n;
|
|
291
327
|
return {
|
|
292
328
|
type: "object-data-table",
|
|
@@ -326,90 +362,94 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
326
362
|
...e,
|
|
327
363
|
...n
|
|
328
364
|
};
|
|
329
|
-
})(), c = e.type === "metric", u =
|
|
365
|
+
})(), c = e.type === "metric", u = W(e), d = ae(e), f = e.id || u || `widget-${t}`, p = s && l === e.id, v = s ? {
|
|
330
366
|
"data-testid": `dashboard-preview-widget-${e.id}`,
|
|
331
367
|
"data-widget-id": e.id,
|
|
332
368
|
role: "button",
|
|
333
369
|
tabIndex: 0,
|
|
334
370
|
"aria-selected": p,
|
|
335
371
|
"aria-label": `Widget: ${u || `Widget ${t + 1}`}`,
|
|
336
|
-
onClick: (t) =>
|
|
337
|
-
onKeyDown: (n) =>
|
|
338
|
-
} : {}, y = s ? A("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", p ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0
|
|
339
|
-
|
|
372
|
+
onClick: (t) => oe(t, e.id),
|
|
373
|
+
onKeyDown: (n) => me(n, e.id, t)
|
|
374
|
+
} : {}, y = s ? A("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", p ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, b = !O && i && !J ? {
|
|
375
|
+
gridColumn: `span ${i.w}`,
|
|
376
|
+
gridRow: `span ${i.h}`
|
|
377
|
+
} : void 0, x = c ? /* @__PURE__ */ X("div", {
|
|
340
378
|
className: A("h-full w-full", s && "relative", y),
|
|
341
|
-
style:
|
|
342
|
-
gridColumn: `span ${i.w}`,
|
|
343
|
-
gridRow: `span ${i.h}`
|
|
344
|
-
} : void 0,
|
|
379
|
+
style: b,
|
|
345
380
|
...v,
|
|
346
|
-
children: [/* @__PURE__ */
|
|
381
|
+
children: [/* @__PURE__ */ Y(o, {
|
|
347
382
|
schema: a,
|
|
348
383
|
className: A("h-full w-full", s && "pointer-events-none"),
|
|
349
384
|
dataSource: n
|
|
350
|
-
}), s && /* @__PURE__ */
|
|
385
|
+
}), s && /* @__PURE__ */ Y("div", {
|
|
351
386
|
className: "absolute inset-0 z-10",
|
|
352
387
|
"aria-hidden": "true",
|
|
353
388
|
"data-testid": "widget-click-overlay"
|
|
354
389
|
})]
|
|
355
|
-
}
|
|
390
|
+
}) : /* @__PURE__ */ X(m, {
|
|
356
391
|
className: A("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", s && "relative", y),
|
|
357
|
-
style:
|
|
358
|
-
gridColumn: `span ${i.w}`,
|
|
359
|
-
gridRow: `span ${i.h}`
|
|
360
|
-
} : void 0,
|
|
392
|
+
style: b,
|
|
361
393
|
...v,
|
|
362
394
|
children: [
|
|
363
|
-
u && /* @__PURE__ */
|
|
395
|
+
u && /* @__PURE__ */ X(g, {
|
|
364
396
|
className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
|
|
365
|
-
children: [/* @__PURE__ */
|
|
397
|
+
children: [/* @__PURE__ */ Y(_, {
|
|
366
398
|
className: "text-sm sm:text-base font-medium tracking-tight truncate",
|
|
367
399
|
title: u,
|
|
368
400
|
children: u
|
|
369
|
-
}), d && /* @__PURE__ */
|
|
401
|
+
}), d && /* @__PURE__ */ Y("p", {
|
|
370
402
|
className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
|
|
371
403
|
children: d
|
|
372
404
|
})]
|
|
373
405
|
}),
|
|
374
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ Y(h, {
|
|
375
407
|
className: "p-0",
|
|
376
|
-
children: /* @__PURE__ */
|
|
408
|
+
children: /* @__PURE__ */ Y("div", {
|
|
377
409
|
className: A("h-full w-full", "p-3 sm:p-4 md:p-6", s && "pointer-events-none"),
|
|
378
|
-
children: /* @__PURE__ */
|
|
410
|
+
children: /* @__PURE__ */ Y(o, {
|
|
379
411
|
schema: a,
|
|
380
412
|
dataSource: n
|
|
381
413
|
})
|
|
382
414
|
})
|
|
383
415
|
}),
|
|
384
|
-
s && /* @__PURE__ */
|
|
416
|
+
s && /* @__PURE__ */ Y("div", {
|
|
385
417
|
className: "absolute inset-0 z-10",
|
|
386
418
|
"aria-hidden": "true",
|
|
387
419
|
"data-testid": "widget-click-overlay"
|
|
388
420
|
})
|
|
389
421
|
]
|
|
390
|
-
}
|
|
391
|
-
|
|
422
|
+
});
|
|
423
|
+
return J && e.id ? /* @__PURE__ */ Y(Ee, {
|
|
424
|
+
id: e.id,
|
|
425
|
+
gridSpan: !O && i ? {
|
|
426
|
+
w: i.w,
|
|
427
|
+
h: i.h
|
|
428
|
+
} : void 0,
|
|
429
|
+
children: x
|
|
430
|
+
}, f) : /* @__PURE__ */ Y(ee, { children: x }, f);
|
|
431
|
+
}, ye = e.header && /* @__PURE__ */ X("div", {
|
|
392
432
|
className: "col-span-full mb-4",
|
|
393
433
|
children: [
|
|
394
|
-
e.header.showTitle !== !1 && e.title && /* @__PURE__ */
|
|
434
|
+
!b && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Y("h2", {
|
|
395
435
|
className: "text-lg font-semibold tracking-tight",
|
|
396
|
-
children: H ?
|
|
436
|
+
children: H ? P({
|
|
397
437
|
name: H,
|
|
398
|
-
label:
|
|
399
|
-
}) :
|
|
438
|
+
label: Q(e.title)
|
|
439
|
+
}) : Q(e.title)
|
|
400
440
|
}),
|
|
401
|
-
e.header.showDescription !== !1 && e.description && /* @__PURE__ */
|
|
441
|
+
!b && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Y("p", {
|
|
402
442
|
className: "text-sm text-muted-foreground mt-1",
|
|
403
|
-
children: H ?
|
|
443
|
+
children: H ? te({
|
|
404
444
|
name: H,
|
|
405
|
-
description:
|
|
406
|
-
}) :
|
|
445
|
+
description: Q(e.description)
|
|
446
|
+
}) : Q(e.description)
|
|
407
447
|
}),
|
|
408
|
-
e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */
|
|
448
|
+
e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Y("div", {
|
|
409
449
|
className: "flex gap-2 mt-3",
|
|
410
450
|
children: e.header.actions.map((e, t) => {
|
|
411
|
-
let n =
|
|
412
|
-
return /* @__PURE__ */
|
|
451
|
+
let n = De(e.icon);
|
|
452
|
+
return /* @__PURE__ */ X(p, {
|
|
413
453
|
variant: "outline",
|
|
414
454
|
size: "sm",
|
|
415
455
|
onClick: async () => {
|
|
@@ -423,76 +463,101 @@ var ge = P(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount:
|
|
|
423
463
|
return;
|
|
424
464
|
}
|
|
425
465
|
if (t === "modal" || t === "script") {
|
|
426
|
-
let e = await
|
|
466
|
+
let e = await M(n || r);
|
|
427
467
|
e?.success || console.warn("[DashboardRenderer] action failed", e?.error);
|
|
428
468
|
return;
|
|
429
469
|
}
|
|
430
470
|
console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
|
|
431
471
|
},
|
|
432
|
-
children: [n && /* @__PURE__ */
|
|
472
|
+
children: [n && /* @__PURE__ */ Y(n, { className: "w-4 h-4 mr-1.5" }), U(e)]
|
|
433
473
|
}, t);
|
|
434
474
|
})
|
|
435
475
|
})
|
|
436
476
|
]
|
|
437
|
-
}),
|
|
477
|
+
}), be = i !== void 0 && /* @__PURE__ */ X("span", {
|
|
438
478
|
className: "text-xs text-muted-foreground",
|
|
439
479
|
children: [i.toLocaleString(), " records"]
|
|
440
|
-
}),
|
|
441
|
-
className: A("flex items-center justify-end gap-3 mb-2", !
|
|
442
|
-
children: [
|
|
480
|
+
}), xe = a ? JSON.stringify(a) : void 0, Se = r && /* @__PURE__ */ X("div", {
|
|
481
|
+
className: A("flex items-center justify-end gap-3 mb-2", !O && "col-span-full"),
|
|
482
|
+
children: [be, /* @__PURE__ */ X(p, {
|
|
443
483
|
variant: "outline",
|
|
444
484
|
size: "sm",
|
|
445
|
-
onClick:
|
|
446
|
-
disabled:
|
|
485
|
+
onClick: G,
|
|
486
|
+
disabled: E,
|
|
447
487
|
"aria-label": "Refresh dashboard",
|
|
448
|
-
children: [/* @__PURE__ */
|
|
488
|
+
children: [/* @__PURE__ */ Y(ie, { className: A("h-4 w-4 mr-2", E && "animate-spin") }), E ? "Refreshing…" : "Refresh All"]
|
|
449
489
|
})]
|
|
450
|
-
});
|
|
451
|
-
if (
|
|
452
|
-
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || []
|
|
453
|
-
|
|
454
|
-
ref: b,
|
|
490
|
+
}), Ce = L(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), we = L(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), Te = L(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
|
|
491
|
+
if (O) {
|
|
492
|
+
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ X("div", {
|
|
493
|
+
ref: S,
|
|
455
494
|
className: A("flex flex-col gap-4 px-4", t),
|
|
456
|
-
"data-user-actions":
|
|
457
|
-
onClick:
|
|
458
|
-
...
|
|
495
|
+
"data-user-actions": xe,
|
|
496
|
+
onClick: q,
|
|
497
|
+
...x,
|
|
459
498
|
children: [
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
n.length > 0 && /* @__PURE__ */
|
|
499
|
+
ye,
|
|
500
|
+
Se,
|
|
501
|
+
n.length > 0 && /* @__PURE__ */ Y("div", {
|
|
463
502
|
className: "grid grid-cols-2 gap-3",
|
|
464
|
-
onClick:
|
|
465
|
-
children:
|
|
503
|
+
onClick: q,
|
|
504
|
+
children: /* @__PURE__ */ Y(de, {
|
|
505
|
+
items: we,
|
|
506
|
+
strategy: pe,
|
|
507
|
+
disabled: !J,
|
|
508
|
+
children: n.map((e, t) => ve(e, t))
|
|
509
|
+
})
|
|
466
510
|
}),
|
|
467
|
-
r.length > 0 && /* @__PURE__ */
|
|
511
|
+
r.length > 0 && /* @__PURE__ */ Y("div", {
|
|
468
512
|
className: "flex flex-col gap-4",
|
|
469
|
-
onClick:
|
|
470
|
-
children:
|
|
513
|
+
onClick: q,
|
|
514
|
+
children: /* @__PURE__ */ Y(de, {
|
|
515
|
+
items: Te,
|
|
516
|
+
strategy: he,
|
|
517
|
+
disabled: !J,
|
|
518
|
+
children: r.map((e, t) => ve(e, t, !0))
|
|
519
|
+
})
|
|
471
520
|
})
|
|
472
521
|
]
|
|
473
522
|
});
|
|
523
|
+
return J ? /* @__PURE__ */ Y(se, {
|
|
524
|
+
sensors: ge,
|
|
525
|
+
collisionDetection: K,
|
|
526
|
+
onDragEnd: _e,
|
|
527
|
+
children: i
|
|
528
|
+
}) : i;
|
|
474
529
|
}
|
|
475
|
-
let
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
className: A("grid auto-rows-min", !se && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
|
|
530
|
+
let ke = e.columns != null || C !== 4, $ = /* @__PURE__ */ X("div", {
|
|
531
|
+
ref: S,
|
|
532
|
+
className: A("grid auto-rows-min", !ke && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
|
|
479
533
|
style: {
|
|
480
|
-
...
|
|
481
|
-
gap: `${
|
|
534
|
+
...ke && { gridTemplateColumns: `repeat(${w}, minmax(0, 1fr))` },
|
|
535
|
+
gap: `${T * .25}rem`
|
|
482
536
|
},
|
|
483
|
-
"data-user-actions":
|
|
484
|
-
onClick:
|
|
485
|
-
...
|
|
537
|
+
"data-user-actions": xe,
|
|
538
|
+
onClick: q,
|
|
539
|
+
...x,
|
|
486
540
|
children: [
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
541
|
+
ye,
|
|
542
|
+
Se,
|
|
543
|
+
/* @__PURE__ */ Y(de, {
|
|
544
|
+
items: Ce,
|
|
545
|
+
strategy: pe,
|
|
546
|
+
disabled: !J,
|
|
547
|
+
children: e.widgets?.map((e, t) => ve(e, t))
|
|
548
|
+
})
|
|
490
549
|
]
|
|
491
550
|
});
|
|
551
|
+
return J ? /* @__PURE__ */ Y(se, {
|
|
552
|
+
sensors: ge,
|
|
553
|
+
collisionDetection: K,
|
|
554
|
+
onDragEnd: _e,
|
|
555
|
+
children: $
|
|
556
|
+
}) : $;
|
|
492
557
|
});
|
|
493
558
|
//#endregion
|
|
494
559
|
//#region src/DashboardGridLayout.tsx
|
|
495
|
-
function
|
|
560
|
+
function je({ editMode: e }) {
|
|
496
561
|
let t = u();
|
|
497
562
|
return N.useEffect(() => {
|
|
498
563
|
if (e) return t.startDrag({
|
|
@@ -505,14 +570,43 @@ function _e({ editMode: e }) {
|
|
|
505
570
|
t.endDrag("dashboard");
|
|
506
571
|
}, [e, t]), null;
|
|
507
572
|
}
|
|
508
|
-
var
|
|
573
|
+
var Me = [
|
|
509
574
|
"hsl(var(--chart-1))",
|
|
510
575
|
"hsl(var(--chart-2))",
|
|
511
576
|
"hsl(var(--chart-3))",
|
|
512
577
|
"hsl(var(--chart-4))",
|
|
513
578
|
"hsl(var(--chart-5))"
|
|
514
|
-
]
|
|
515
|
-
|
|
579
|
+
];
|
|
580
|
+
function Ne(e, t) {
|
|
581
|
+
if (!e.widgets?.length) return e;
|
|
582
|
+
let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
|
|
583
|
+
let r = e.id || `widget-${t}`, i = n.get(r);
|
|
584
|
+
return i ? {
|
|
585
|
+
...e,
|
|
586
|
+
layout: {
|
|
587
|
+
x: i.x,
|
|
588
|
+
y: i.y,
|
|
589
|
+
w: i.w,
|
|
590
|
+
h: i.h
|
|
591
|
+
}
|
|
592
|
+
} : e;
|
|
593
|
+
});
|
|
594
|
+
return {
|
|
595
|
+
...e,
|
|
596
|
+
widgets: r
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
function Pe(e) {
|
|
600
|
+
return { lg: e.widgets?.map((e, t) => ({
|
|
601
|
+
i: e.id || `widget-${t}`,
|
|
602
|
+
x: e.layout?.x ?? t % 4 * 3,
|
|
603
|
+
y: e.layout?.y ?? Math.floor(t / 4) * 4,
|
|
604
|
+
w: e.layout?.w ?? 3,
|
|
605
|
+
h: e.layout?.h ?? 4
|
|
606
|
+
})) || [] };
|
|
607
|
+
}
|
|
608
|
+
var Fe = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
|
|
609
|
+
let { width: a, containerRef: s, mounted: c } = _e(), [l, u] = N.useState(!1), [f, v] = N.useState(!1), y = d(), b = N.useRef(null), x = N.useCallback(() => {
|
|
516
610
|
i && (v(!0), i(), setTimeout(() => v(!1), 600));
|
|
517
611
|
}, [i]);
|
|
518
612
|
N.useEffect(() => {
|
|
@@ -524,40 +618,32 @@ var ve = [
|
|
|
524
618
|
i,
|
|
525
619
|
x
|
|
526
620
|
]);
|
|
527
|
-
let [S, C] = N.useState(() => {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
x: e.layout?.x || t % 4 * 3,
|
|
539
|
-
y: e.layout?.y || Math.floor(t / 4) * 4,
|
|
540
|
-
w: e.layout?.w || 3,
|
|
541
|
-
h: e.layout?.h || 4
|
|
542
|
-
})) || [] };
|
|
543
|
-
}), w = N.useCallback((e, t) => {
|
|
621
|
+
let [S, C] = N.useState(() => Pe(e)), w = N.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
|
|
622
|
+
i: e.id || `widget-${t}`,
|
|
623
|
+
x: e.layout?.x,
|
|
624
|
+
y: e.layout?.y,
|
|
625
|
+
w: e.layout?.w,
|
|
626
|
+
h: e.layout?.h
|
|
627
|
+
})) ?? []), [e.widgets]);
|
|
628
|
+
N.useEffect(() => {
|
|
629
|
+
C(Pe(e));
|
|
630
|
+
}, [w]);
|
|
631
|
+
let T = N.useCallback((e, t) => {
|
|
544
632
|
C(t), n?.(e);
|
|
545
|
-
}, [n]),
|
|
546
|
-
|
|
547
|
-
}, [
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
})) || [] }), typeof window < "u" && r && localStorage.removeItem(r);
|
|
555
|
-
}, [e.widgets, r]), D = N.useCallback((e) => {
|
|
633
|
+
}, [n]), E = N.useCallback(() => {
|
|
634
|
+
r ? r(Ne(e, S.lg)) : process.env.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), u(!1);
|
|
635
|
+
}, [
|
|
636
|
+
r,
|
|
637
|
+
e,
|
|
638
|
+
S
|
|
639
|
+
]), D = N.useCallback(() => {
|
|
640
|
+
C(Pe(e));
|
|
641
|
+
}, [e]), O = N.useCallback((e) => {
|
|
556
642
|
if (e.component) return e.component;
|
|
557
643
|
let t = e.type, n = e.options || {};
|
|
558
644
|
if (t === "bar" || t === "horizontal-bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter" || t === "funnel") {
|
|
559
645
|
let r = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
|
|
560
|
-
if (
|
|
646
|
+
if (Z(r)) {
|
|
561
647
|
let n = r.aggregate, o = n ? {
|
|
562
648
|
field: e.valueField || n.field,
|
|
563
649
|
function: e.aggregate || n.function,
|
|
@@ -570,7 +656,7 @@ var ve = [
|
|
|
570
656
|
aggregate: o,
|
|
571
657
|
xAxisKey: i,
|
|
572
658
|
series: [{ dataKey: s }],
|
|
573
|
-
colors:
|
|
659
|
+
colors: Me,
|
|
574
660
|
className: "h-full"
|
|
575
661
|
};
|
|
576
662
|
}
|
|
@@ -587,7 +673,7 @@ var ve = [
|
|
|
587
673
|
aggregate: n,
|
|
588
674
|
xAxisKey: i,
|
|
589
675
|
series: [{ dataKey: e.valueField || "value" }],
|
|
590
|
-
colors:
|
|
676
|
+
colors: Me,
|
|
591
677
|
className: "h-full"
|
|
592
678
|
};
|
|
593
679
|
}
|
|
@@ -597,13 +683,13 @@ var ve = [
|
|
|
597
683
|
data: Array.isArray(r) ? r : r?.items || [],
|
|
598
684
|
xAxisKey: i,
|
|
599
685
|
series: [{ dataKey: a }],
|
|
600
|
-
colors:
|
|
686
|
+
colors: Me,
|
|
601
687
|
className: "h-full"
|
|
602
688
|
};
|
|
603
689
|
}
|
|
604
690
|
if (t === "table") {
|
|
605
691
|
let t = e.data || n.data;
|
|
606
|
-
if (
|
|
692
|
+
if (Z(t)) {
|
|
607
693
|
let { data: r, ...i } = n;
|
|
608
694
|
return {
|
|
609
695
|
type: "data-table",
|
|
@@ -635,7 +721,7 @@ var ve = [
|
|
|
635
721
|
}
|
|
636
722
|
if (t === "pivot") {
|
|
637
723
|
let t = e.data || n.data;
|
|
638
|
-
if (
|
|
724
|
+
if (Z(t)) {
|
|
639
725
|
let { data: r, ...i } = n;
|
|
640
726
|
return {
|
|
641
727
|
type: "pivot",
|
|
@@ -656,54 +742,54 @@ var ve = [
|
|
|
656
742
|
...n
|
|
657
743
|
};
|
|
658
744
|
}, []);
|
|
659
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ X("div", {
|
|
660
746
|
ref: s,
|
|
661
747
|
className: A("w-full", t),
|
|
662
748
|
"data-testid": "grid-layout",
|
|
663
749
|
children: [
|
|
664
|
-
y && /* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
750
|
+
y && /* @__PURE__ */ Y(je, { editMode: l }),
|
|
751
|
+
/* @__PURE__ */ X("div", {
|
|
666
752
|
className: "mb-4 flex items-center justify-between",
|
|
667
|
-
children: [/* @__PURE__ */
|
|
753
|
+
children: [/* @__PURE__ */ Y("h2", {
|
|
668
754
|
className: "text-2xl font-bold",
|
|
669
755
|
children: e.title || "Dashboard"
|
|
670
|
-
}), /* @__PURE__ */
|
|
756
|
+
}), /* @__PURE__ */ Y("div", {
|
|
671
757
|
className: "flex gap-2",
|
|
672
|
-
children: l ? /* @__PURE__ */ J
|
|
673
|
-
/* @__PURE__ */
|
|
674
|
-
onClick:
|
|
758
|
+
children: l ? /* @__PURE__ */ X(J, { children: [
|
|
759
|
+
/* @__PURE__ */ X(p, {
|
|
760
|
+
onClick: E,
|
|
675
761
|
size: "sm",
|
|
676
762
|
variant: "default",
|
|
677
|
-
children: [/* @__PURE__ */
|
|
763
|
+
children: [/* @__PURE__ */ Y(ae, { className: "h-4 w-4 mr-2" }), "Save Layout"]
|
|
678
764
|
}),
|
|
679
|
-
/* @__PURE__ */
|
|
680
|
-
onClick:
|
|
765
|
+
/* @__PURE__ */ X(p, {
|
|
766
|
+
onClick: D,
|
|
681
767
|
size: "sm",
|
|
682
768
|
variant: "outline",
|
|
683
|
-
children: [/* @__PURE__ */
|
|
769
|
+
children: [/* @__PURE__ */ Y(oe, { className: "h-4 w-4 mr-2" }), "Reset"]
|
|
684
770
|
}),
|
|
685
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ Y(p, {
|
|
686
772
|
onClick: () => u(!1),
|
|
687
773
|
size: "sm",
|
|
688
774
|
variant: "ghost",
|
|
689
775
|
children: "Cancel"
|
|
690
776
|
})
|
|
691
|
-
] }) : /* @__PURE__ */ J
|
|
777
|
+
] }) : /* @__PURE__ */ X(J, { children: [i && /* @__PURE__ */ X(p, {
|
|
692
778
|
onClick: x,
|
|
693
779
|
size: "sm",
|
|
694
780
|
variant: "outline",
|
|
695
781
|
disabled: f,
|
|
696
782
|
"aria-label": "Refresh dashboard",
|
|
697
|
-
children: [/* @__PURE__ */
|
|
698
|
-
}), /* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ Y(ie, { className: A("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
|
|
784
|
+
}), /* @__PURE__ */ X(p, {
|
|
699
785
|
onClick: () => u(!0),
|
|
700
786
|
size: "sm",
|
|
701
787
|
variant: "outline",
|
|
702
|
-
children: [/* @__PURE__ */
|
|
788
|
+
children: [/* @__PURE__ */ Y(V, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
|
|
703
789
|
})] })
|
|
704
790
|
})]
|
|
705
791
|
}),
|
|
706
|
-
c && /* @__PURE__ */
|
|
792
|
+
c && /* @__PURE__ */ Y(ge, {
|
|
707
793
|
className: "layout",
|
|
708
794
|
width: a,
|
|
709
795
|
layouts: S,
|
|
@@ -727,37 +813,37 @@ var ve = [
|
|
|
727
813
|
handle: ".drag-handle"
|
|
728
814
|
},
|
|
729
815
|
resizeConfig: { enabled: l },
|
|
730
|
-
onLayoutChange:
|
|
816
|
+
onLayoutChange: T,
|
|
731
817
|
children: e.widgets?.map((e, t) => {
|
|
732
|
-
let n = e.id || `widget-${t}`, r =
|
|
733
|
-
return /* @__PURE__ */
|
|
818
|
+
let n = e.id || `widget-${t}`, r = O(e);
|
|
819
|
+
return /* @__PURE__ */ Y("div", {
|
|
734
820
|
className: "h-full",
|
|
735
|
-
children: e.type === "metric" ? /* @__PURE__ */
|
|
821
|
+
children: e.type === "metric" ? /* @__PURE__ */ X("div", {
|
|
736
822
|
className: "h-full w-full relative",
|
|
737
|
-
children: [l && /* @__PURE__ */
|
|
823
|
+
children: [l && /* @__PURE__ */ Y("div", {
|
|
738
824
|
className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
|
|
739
|
-
children: /* @__PURE__ */
|
|
740
|
-
}), /* @__PURE__ */
|
|
825
|
+
children: /* @__PURE__ */ Y(H, { className: "h-4 w-4" })
|
|
826
|
+
}), /* @__PURE__ */ Y(o, {
|
|
741
827
|
schema: r,
|
|
742
828
|
className: "h-full w-full"
|
|
743
829
|
})]
|
|
744
|
-
}) : /* @__PURE__ */
|
|
830
|
+
}) : /* @__PURE__ */ X(m, {
|
|
745
831
|
className: A("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", l && "ring-2 ring-primary/20"),
|
|
746
|
-
children: [e.title && /* @__PURE__ */
|
|
832
|
+
children: [e.title && /* @__PURE__ */ X(g, {
|
|
747
833
|
className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
|
|
748
|
-
children: [/* @__PURE__ */
|
|
834
|
+
children: [/* @__PURE__ */ Y(_, {
|
|
749
835
|
className: "text-base font-medium tracking-tight truncate",
|
|
750
836
|
title: e.title,
|
|
751
837
|
children: e.title
|
|
752
|
-
}), l && /* @__PURE__ */
|
|
838
|
+
}), l && /* @__PURE__ */ Y("div", {
|
|
753
839
|
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
754
|
-
children: /* @__PURE__ */
|
|
840
|
+
children: /* @__PURE__ */ Y(H, { className: "h-4 w-4" })
|
|
755
841
|
})]
|
|
756
|
-
}), /* @__PURE__ */
|
|
842
|
+
}), /* @__PURE__ */ Y(h, {
|
|
757
843
|
className: "p-0 h-full",
|
|
758
|
-
children: /* @__PURE__ */
|
|
844
|
+
children: /* @__PURE__ */ Y("div", {
|
|
759
845
|
className: A("h-full w-full overflow-auto p-4"),
|
|
760
|
-
children: /* @__PURE__ */
|
|
846
|
+
children: /* @__PURE__ */ Y(o, { schema: r })
|
|
761
847
|
})
|
|
762
848
|
})]
|
|
763
849
|
})
|
|
@@ -766,14 +852,35 @@ var ve = [
|
|
|
766
852
|
})
|
|
767
853
|
]
|
|
768
854
|
});
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
855
|
+
}, Ie = ve({
|
|
856
|
+
"dashboard.trend.vsLastQuarter": "vs last quarter",
|
|
857
|
+
"dashboard.trend.vsLastMonth": "vs last month",
|
|
858
|
+
"dashboard.trend.vsLastWeek": "vs last week",
|
|
859
|
+
"dashboard.trend.vsLastYear": "vs last year",
|
|
860
|
+
"dashboard.trend.vsYesterday": "vs yesterday",
|
|
861
|
+
"dashboard.trend.vsPreviousPeriod": "vs previous period"
|
|
862
|
+
}, "dashboard.trend.vsLastQuarter");
|
|
863
|
+
function Le(e) {
|
|
864
|
+
switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
|
|
865
|
+
case "vs last quarter":
|
|
866
|
+
case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
|
|
867
|
+
case "vs last month":
|
|
868
|
+
case "vs previous month": return "dashboard.trend.vsLastMonth";
|
|
869
|
+
case "vs last week":
|
|
870
|
+
case "vs previous week": return "dashboard.trend.vsLastWeek";
|
|
871
|
+
case "vs last year":
|
|
872
|
+
case "vs previous year": return "dashboard.trend.vsLastYear";
|
|
873
|
+
case "vs yesterday": return "dashboard.trend.vsYesterday";
|
|
874
|
+
case "vs previous period":
|
|
875
|
+
case "vs prior period": return "dashboard.trend.vsPreviousPeriod";
|
|
876
|
+
default: return;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
function Re(e, t, n) {
|
|
773
880
|
if (e == null) return "";
|
|
774
881
|
if (typeof e == "string") {
|
|
775
882
|
let r = Number(e);
|
|
776
|
-
return !isFinite(r) || e.trim() === "" ? e :
|
|
883
|
+
return !isFinite(r) || e.trim() === "" ? e : Re(r, t, n);
|
|
777
884
|
}
|
|
778
885
|
if (!isFinite(e)) return String(e);
|
|
779
886
|
let r = {
|
|
@@ -800,10 +907,10 @@ function be(e, t, n) {
|
|
|
800
907
|
maximumFractionDigits: c
|
|
801
908
|
}).format(e);
|
|
802
909
|
}
|
|
803
|
-
function
|
|
910
|
+
function ze(e) {
|
|
804
911
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
805
912
|
}
|
|
806
|
-
var
|
|
913
|
+
var Be = {
|
|
807
914
|
default: "bg-muted text-muted-foreground",
|
|
808
915
|
blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
809
916
|
teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
|
|
@@ -812,9 +919,18 @@ var Se = {
|
|
|
812
919
|
success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
|
813
920
|
warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
814
921
|
danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
|
|
815
|
-
},
|
|
816
|
-
let y =
|
|
817
|
-
let e =
|
|
922
|
+
}, Ve = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, ...v }) => {
|
|
923
|
+
let y = Be[c] || Be.default, { t: b } = Ie(), x = L(() => {
|
|
924
|
+
let e = ze(a) || ze(n?.label);
|
|
925
|
+
if (!e) return e;
|
|
926
|
+
let t = Le(e);
|
|
927
|
+
return t ? b(t) : e;
|
|
928
|
+
}, [
|
|
929
|
+
a,
|
|
930
|
+
n?.label,
|
|
931
|
+
b
|
|
932
|
+
]), S = L(() => {
|
|
933
|
+
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Re(t, l, u) : t ?? "", n = String(e);
|
|
818
934
|
return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
|
|
819
935
|
}, [
|
|
820
936
|
t,
|
|
@@ -822,14 +938,14 @@ var Se = {
|
|
|
822
938
|
u,
|
|
823
939
|
d,
|
|
824
940
|
f
|
|
825
|
-
]),
|
|
941
|
+
]), C = L(() => {
|
|
826
942
|
if (typeof r == "string") {
|
|
827
943
|
let e = j(r);
|
|
828
|
-
return e ? /* @__PURE__ */
|
|
944
|
+
return e ? /* @__PURE__ */ Y(e, { className: "h-4 w-4" }) : null;
|
|
829
945
|
}
|
|
830
946
|
return r;
|
|
831
947
|
}, [r]);
|
|
832
|
-
return /* @__PURE__ */
|
|
948
|
+
return /* @__PURE__ */ X(m, {
|
|
833
949
|
className: A("h-full overflow-hidden", p && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
|
|
834
950
|
onClick: p,
|
|
835
951
|
role: p ? "button" : void 0,
|
|
@@ -838,129 +954,129 @@ var Se = {
|
|
|
838
954
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
|
|
839
955
|
} : void 0,
|
|
840
956
|
...v,
|
|
841
|
-
children: [/* @__PURE__ */
|
|
957
|
+
children: [/* @__PURE__ */ X(g, {
|
|
842
958
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
843
|
-
children: [/* @__PURE__ */
|
|
959
|
+
children: [/* @__PURE__ */ Y(_, {
|
|
844
960
|
className: "text-sm font-medium truncate",
|
|
845
|
-
children:
|
|
846
|
-
}),
|
|
961
|
+
children: ze(e)
|
|
962
|
+
}), C && /* @__PURE__ */ Y("div", {
|
|
847
963
|
className: A("flex h-8 w-8 items-center justify-center rounded-md shrink-0", y),
|
|
848
|
-
children:
|
|
964
|
+
children: C
|
|
849
965
|
})]
|
|
850
|
-
}), /* @__PURE__ */
|
|
966
|
+
}), /* @__PURE__ */ Y(h, { children: o ? /* @__PURE__ */ X("div", {
|
|
851
967
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
852
968
|
"data-testid": "metric-loading",
|
|
853
|
-
children: [/* @__PURE__ */
|
|
969
|
+
children: [/* @__PURE__ */ Y(U, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Y("span", {
|
|
854
970
|
className: "text-sm",
|
|
855
971
|
children: "Loading…"
|
|
856
972
|
})]
|
|
857
|
-
}) : s ? /* @__PURE__ */
|
|
973
|
+
}) : s ? /* @__PURE__ */ X("div", {
|
|
858
974
|
className: "flex items-center gap-2",
|
|
859
975
|
"data-testid": "metric-error",
|
|
860
976
|
role: "alert",
|
|
861
|
-
children: [/* @__PURE__ */
|
|
977
|
+
children: [/* @__PURE__ */ Y(z, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Y("span", {
|
|
862
978
|
className: "text-xs text-destructive truncate",
|
|
863
979
|
children: s
|
|
864
980
|
})]
|
|
865
|
-
}) : /* @__PURE__ */ J
|
|
981
|
+
}) : /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("div", {
|
|
866
982
|
className: "text-2xl font-bold truncate",
|
|
867
|
-
children:
|
|
868
|
-
}), (n || a) && /* @__PURE__ */
|
|
983
|
+
children: S
|
|
984
|
+
}), (n || a) && /* @__PURE__ */ X("div", {
|
|
869
985
|
className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
|
|
870
|
-
children: [n && /* @__PURE__ */
|
|
986
|
+
children: [n && /* @__PURE__ */ X("span", {
|
|
871
987
|
className: A("flex items-center shrink-0 font-medium", n.direction === "up" && "text-emerald-600 dark:text-emerald-400", n.direction === "down" && "text-rose-600 dark:text-rose-400", n.direction === "neutral" && "text-muted-foreground"),
|
|
872
988
|
children: [
|
|
873
|
-
n.direction === "up" && /* @__PURE__ */
|
|
874
|
-
n.direction === "down" && /* @__PURE__ */
|
|
875
|
-
n.direction === "neutral" && /* @__PURE__ */
|
|
989
|
+
n.direction === "up" && /* @__PURE__ */ Y(B, { className: "h-3 w-3 mr-1" }),
|
|
990
|
+
n.direction === "down" && /* @__PURE__ */ Y(re, { className: "h-3 w-3 mr-1" }),
|
|
991
|
+
n.direction === "neutral" && /* @__PURE__ */ Y(W, { className: "h-3 w-3 mr-1" }),
|
|
876
992
|
n.value,
|
|
877
993
|
"%"
|
|
878
994
|
]
|
|
879
|
-
}), /* @__PURE__ */
|
|
995
|
+
}), /* @__PURE__ */ Y("span", {
|
|
880
996
|
className: "truncate min-w-0",
|
|
881
|
-
children:
|
|
997
|
+
children: x
|
|
882
998
|
})]
|
|
883
999
|
})] }) })]
|
|
884
1000
|
});
|
|
885
1001
|
};
|
|
886
1002
|
//#endregion
|
|
887
1003
|
//#region src/MetricCard.tsx
|
|
888
|
-
function
|
|
1004
|
+
function He(e) {
|
|
889
1005
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
890
1006
|
}
|
|
891
|
-
var
|
|
1007
|
+
var Ue = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
|
|
892
1008
|
let u = n ? j(n) : null;
|
|
893
|
-
return /* @__PURE__ */
|
|
1009
|
+
return /* @__PURE__ */ X(m, {
|
|
894
1010
|
className: A("h-full", o),
|
|
895
1011
|
...l,
|
|
896
|
-
children: [/* @__PURE__ */
|
|
1012
|
+
children: [/* @__PURE__ */ X(g, {
|
|
897
1013
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
898
|
-
children: [/* @__PURE__ */
|
|
1014
|
+
children: [/* @__PURE__ */ Y(_, {
|
|
899
1015
|
className: "text-sm font-medium",
|
|
900
|
-
children:
|
|
901
|
-
}), u && /* @__PURE__ */
|
|
902
|
-
}), /* @__PURE__ */
|
|
1016
|
+
children: He(e)
|
|
1017
|
+
}), u && /* @__PURE__ */ Y(u, { className: "h-4 w-4 text-muted-foreground" })]
|
|
1018
|
+
}), /* @__PURE__ */ Y(h, { children: s ? /* @__PURE__ */ X("div", {
|
|
903
1019
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
904
1020
|
"data-testid": "metric-card-loading",
|
|
905
|
-
children: [/* @__PURE__ */
|
|
1021
|
+
children: [/* @__PURE__ */ Y(U, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Y("span", {
|
|
906
1022
|
className: "text-sm",
|
|
907
1023
|
children: "Loading…"
|
|
908
1024
|
})]
|
|
909
|
-
}) : c ? /* @__PURE__ */
|
|
1025
|
+
}) : c ? /* @__PURE__ */ X("div", {
|
|
910
1026
|
className: "flex items-center gap-2",
|
|
911
1027
|
"data-testid": "metric-card-error",
|
|
912
1028
|
role: "alert",
|
|
913
|
-
children: [/* @__PURE__ */
|
|
1029
|
+
children: [/* @__PURE__ */ Y(z, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Y("span", {
|
|
914
1030
|
className: "text-xs text-destructive truncate",
|
|
915
1031
|
children: c
|
|
916
1032
|
})]
|
|
917
|
-
}) : /* @__PURE__ */ J
|
|
1033
|
+
}) : /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("div", {
|
|
918
1034
|
className: "text-2xl font-bold",
|
|
919
1035
|
children: t
|
|
920
|
-
}), (r || i || a) && /* @__PURE__ */
|
|
1036
|
+
}), (r || i || a) && /* @__PURE__ */ X("p", {
|
|
921
1037
|
className: "text-xs text-muted-foreground flex items-center mt-1",
|
|
922
|
-
children: [r && i && /* @__PURE__ */
|
|
1038
|
+
children: [r && i && /* @__PURE__ */ X("span", {
|
|
923
1039
|
className: A("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
|
|
924
1040
|
children: [
|
|
925
|
-
r === "up" && /* @__PURE__ */
|
|
926
|
-
r === "down" && /* @__PURE__ */
|
|
927
|
-
r === "neutral" && /* @__PURE__ */
|
|
1041
|
+
r === "up" && /* @__PURE__ */ Y(B, { className: "h-3 w-3 mr-1" }),
|
|
1042
|
+
r === "down" && /* @__PURE__ */ Y(re, { className: "h-3 w-3 mr-1" }),
|
|
1043
|
+
r === "neutral" && /* @__PURE__ */ Y(W, { className: "h-3 w-3 mr-1" }),
|
|
928
1044
|
i
|
|
929
1045
|
]
|
|
930
|
-
}),
|
|
1046
|
+
}), He(a)]
|
|
931
1047
|
})] }) })]
|
|
932
1048
|
});
|
|
933
|
-
},
|
|
934
|
-
let A =
|
|
1049
|
+
}, We = ({ objectName: e, aggregate: t, filter: n, label: c, fallbackValue: l, trend: u, icon: d, className: f, description: p, dataSource: m, colorVariant: h, format: g, currency: _, prefix: v, suffix: y, drillDown: b, title: k }) => {
|
|
1050
|
+
let A = te(s), j = m || A?.dataSource, [M, N] = R(!1), [ee, P] = R(null), [ne, z] = R(!1), [re, B] = R(null), [V, H] = R(null);
|
|
935
1051
|
I(() => {
|
|
936
1052
|
let t = !0;
|
|
937
1053
|
if (!(!j || !e || typeof j.getObjectSchema != "function")) return j.getObjectSchema(e).then((e) => {
|
|
938
|
-
t &&
|
|
1054
|
+
t && H(e);
|
|
939
1055
|
}).catch(() => {}), () => {
|
|
940
1056
|
t = !1;
|
|
941
1057
|
};
|
|
942
1058
|
}, [j, e]);
|
|
943
|
-
let
|
|
1059
|
+
let U = L(() => {
|
|
944
1060
|
let e = t?.field;
|
|
945
|
-
if (!e || !
|
|
946
|
-
let n =
|
|
1061
|
+
if (!e || !V?.fields) return null;
|
|
1062
|
+
let n = V.fields;
|
|
947
1063
|
return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
|
|
948
|
-
}, [
|
|
1064
|
+
}, [V, t?.field]), W = L(() => {
|
|
949
1065
|
if (g) return g;
|
|
950
|
-
if (
|
|
951
|
-
if (
|
|
952
|
-
let e =
|
|
1066
|
+
if (U) {
|
|
1067
|
+
if (U.type === "currency") {
|
|
1068
|
+
let e = U.precision ?? U.scale ?? 0;
|
|
953
1069
|
return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
|
|
954
1070
|
}
|
|
955
|
-
if (
|
|
956
|
-
if (
|
|
1071
|
+
if (U.type === "percent") return "0,0%";
|
|
1072
|
+
if (U.type === "number" || U.type === "integer") return "0,0";
|
|
957
1073
|
}
|
|
958
|
-
}, [g,
|
|
1074
|
+
}, [g, U]), ie = L(() => {
|
|
959
1075
|
if (_) return _;
|
|
960
|
-
if (
|
|
961
|
-
}, [_,
|
|
1076
|
+
if (U?.type === "currency") return U.defaultCurrency || U.currency || void 0;
|
|
1077
|
+
}, [_, U]), ae = L(() => t ? JSON.stringify(t) : "", [t]), G = L(() => i(n), [n]), oe = F(async (n, r) => {
|
|
962
1078
|
if (!(!n || !e)) {
|
|
963
|
-
r.current && (
|
|
1079
|
+
r.current && (z(!0), B(null));
|
|
964
1080
|
try {
|
|
965
1081
|
let i;
|
|
966
1082
|
if (t && typeof n.aggregate == "function") {
|
|
@@ -975,11 +1091,11 @@ var Te = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
975
1091
|
let t = await n.find(e, { $filter: G });
|
|
976
1092
|
i = (Array.isArray(t) ? t : t?.data || t?.records || []).length;
|
|
977
1093
|
} else return;
|
|
978
|
-
r.current &&
|
|
1094
|
+
r.current && P(i);
|
|
979
1095
|
} catch (e) {
|
|
980
|
-
console.error("[ObjectMetricWidget] Fetch error:", e), r.current &&
|
|
1096
|
+
console.error("[ObjectMetricWidget] Fetch error:", e), r.current && B(e instanceof Error ? e.message : "Failed to load metric");
|
|
981
1097
|
} finally {
|
|
982
|
-
r.current &&
|
|
1098
|
+
r.current && z(!1);
|
|
983
1099
|
}
|
|
984
1100
|
}
|
|
985
1101
|
}, [
|
|
@@ -989,26 +1105,26 @@ var Te = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
989
1105
|
]);
|
|
990
1106
|
I(() => {
|
|
991
1107
|
let t = { current: !0 };
|
|
992
|
-
return j && e ?
|
|
1108
|
+
return j && e ? oe(j, t) : (P(null), B(null)), () => {
|
|
993
1109
|
t.current = !1;
|
|
994
1110
|
};
|
|
995
1111
|
}, [
|
|
996
1112
|
j,
|
|
997
1113
|
e,
|
|
998
|
-
|
|
1114
|
+
oe
|
|
999
1115
|
]);
|
|
1000
|
-
let
|
|
1116
|
+
let se = ee === null ? j ? "—" : l ?? "—" : ee, ce = r(b) && !!e && !!j, K = L(() => {
|
|
1001
1117
|
let e = typeof c == "string" ? c : c?.defaultValue || "";
|
|
1002
1118
|
return a(b, {}, (typeof k == "string" ? k : k?.defaultValue || "") || e || "Details");
|
|
1003
1119
|
}, [
|
|
1004
1120
|
b,
|
|
1005
1121
|
c,
|
|
1006
1122
|
k
|
|
1007
|
-
]),
|
|
1008
|
-
if (!
|
|
1009
|
-
let t = b?.target ?? "drawer", n = /* @__PURE__ */
|
|
1123
|
+
]), le = L(() => {
|
|
1124
|
+
if (!ce) return null;
|
|
1125
|
+
let t = b?.target ?? "drawer", n = /* @__PURE__ */ Y("div", {
|
|
1010
1126
|
className: "h-full overflow-auto",
|
|
1011
|
-
children: /* @__PURE__ */
|
|
1127
|
+
children: /* @__PURE__ */ Y(o, { schema: {
|
|
1012
1128
|
type: "object-data-table",
|
|
1013
1129
|
objectName: e,
|
|
1014
1130
|
filter: G,
|
|
@@ -1016,60 +1132,68 @@ var Te = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
1016
1132
|
drillDown: { enabled: !1 }
|
|
1017
1133
|
} })
|
|
1018
1134
|
});
|
|
1019
|
-
return t === "modal" ? /* @__PURE__ */
|
|
1135
|
+
return t === "modal" ? /* @__PURE__ */ Y(x, {
|
|
1020
1136
|
open: !0,
|
|
1021
1137
|
onOpenChange: (e) => !e && N(!1),
|
|
1022
|
-
children: /* @__PURE__ */
|
|
1138
|
+
children: /* @__PURE__ */ X(S, {
|
|
1023
1139
|
className: "max-w-4xl",
|
|
1024
|
-
children: [/* @__PURE__ */
|
|
1140
|
+
children: [/* @__PURE__ */ Y(C, { children: /* @__PURE__ */ Y(w, { children: K }) }), n]
|
|
1025
1141
|
})
|
|
1026
|
-
}) : /* @__PURE__ */
|
|
1142
|
+
}) : /* @__PURE__ */ Y(T, {
|
|
1027
1143
|
open: !0,
|
|
1028
1144
|
onOpenChange: (e) => !e && N(!1),
|
|
1029
|
-
children: /* @__PURE__ */
|
|
1145
|
+
children: /* @__PURE__ */ X(E, {
|
|
1030
1146
|
side: "right",
|
|
1031
1147
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1032
|
-
children: [/* @__PURE__ */
|
|
1148
|
+
children: [/* @__PURE__ */ Y(D, { children: /* @__PURE__ */ Y(O, { children: K }) }), /* @__PURE__ */ Y("div", {
|
|
1033
1149
|
className: "flex-1 overflow-hidden mt-2",
|
|
1034
1150
|
children: n
|
|
1035
1151
|
})]
|
|
1036
1152
|
})
|
|
1037
1153
|
});
|
|
1038
1154
|
}, [
|
|
1039
|
-
|
|
1155
|
+
ce,
|
|
1040
1156
|
b,
|
|
1041
1157
|
e,
|
|
1042
1158
|
G,
|
|
1043
|
-
|
|
1159
|
+
K
|
|
1044
1160
|
]);
|
|
1045
|
-
return /* @__PURE__ */ J
|
|
1161
|
+
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(Ve, {
|
|
1046
1162
|
label: c,
|
|
1047
|
-
value:
|
|
1163
|
+
value: se,
|
|
1048
1164
|
trend: u,
|
|
1049
1165
|
icon: d,
|
|
1050
1166
|
className: f,
|
|
1051
1167
|
description: p,
|
|
1052
|
-
loading:
|
|
1053
|
-
error:
|
|
1168
|
+
loading: ne,
|
|
1169
|
+
error: re,
|
|
1054
1170
|
colorVariant: h,
|
|
1055
|
-
format:
|
|
1171
|
+
format: W,
|
|
1056
1172
|
currency: ie,
|
|
1057
1173
|
prefix: v,
|
|
1058
1174
|
suffix: y,
|
|
1059
|
-
onClick:
|
|
1060
|
-
}), M &&
|
|
1175
|
+
onClick: ce ? () => N(!0) : void 0
|
|
1176
|
+
}), M && le] });
|
|
1061
1177
|
};
|
|
1062
1178
|
//#endregion
|
|
1063
1179
|
//#region src/PivotTable.tsx
|
|
1064
|
-
function
|
|
1180
|
+
function Ge() {
|
|
1065
1181
|
try {
|
|
1066
|
-
let { t: e } =
|
|
1182
|
+
let { t: e } = ye(), t = e("dashboard.total");
|
|
1067
1183
|
return !t || t === "dashboard.total" ? "Total" : t;
|
|
1068
1184
|
} catch {
|
|
1069
1185
|
return "Total";
|
|
1070
1186
|
}
|
|
1071
1187
|
}
|
|
1072
|
-
function
|
|
1188
|
+
function Ke() {
|
|
1189
|
+
try {
|
|
1190
|
+
let { t: e } = ye(), t = e("dashboard.noDataAvailable");
|
|
1191
|
+
return !t || t === "dashboard.noDataAvailable" ? "No data available" : t;
|
|
1192
|
+
} catch {
|
|
1193
|
+
return "No data available";
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
function qe(e, t) {
|
|
1073
1197
|
if (!t) return String(e);
|
|
1074
1198
|
let n = "", r = "", i = !1, a, o = t, s = o.match(/^([^0-9.,#]*)/);
|
|
1075
1199
|
if (s && s[1]) {
|
|
@@ -1086,11 +1210,11 @@ function Oe(e, t) {
|
|
|
1086
1210
|
}
|
|
1087
1211
|
return n + l + r;
|
|
1088
1212
|
}
|
|
1089
|
-
var
|
|
1090
|
-
function
|
|
1091
|
-
return e === "" ?
|
|
1213
|
+
var Je = "—";
|
|
1214
|
+
function Ye(e, t) {
|
|
1215
|
+
return e === "" ? Je : t?.[e] ?? e;
|
|
1092
1216
|
}
|
|
1093
|
-
function
|
|
1217
|
+
function Xe(e, t) {
|
|
1094
1218
|
if (e.length === 0) return 0;
|
|
1095
1219
|
switch (t) {
|
|
1096
1220
|
case "sum": return e.reduce((e, t) => e + t, 0);
|
|
@@ -1101,18 +1225,18 @@ function je(e, t) {
|
|
|
1101
1225
|
default: return e.reduce((e, t) => e + t, 0);
|
|
1102
1226
|
}
|
|
1103
1227
|
}
|
|
1104
|
-
var
|
|
1105
|
-
let { title: s, rowField: c, columnField: l, valueField: u, aggregation: d = "sum", data: f = [], showRowTotals: p = !1, showColumnTotals: m = !1, format: h, columnColors: g, drillDown: _ } = e, v =
|
|
1106
|
-
|
|
1228
|
+
var Ze = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabel: a, onDrillDown: o }) => {
|
|
1229
|
+
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 = Ge(), y = Ke(), b = r(_) && typeof o == "function", x = (e) => {
|
|
1230
|
+
b && o({
|
|
1107
1231
|
...e,
|
|
1108
1232
|
rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
|
|
1109
1233
|
colLabel: e.colKey === void 0 ? e.colLabel : i?.[e.colKey] ?? e.colKey
|
|
1110
1234
|
});
|
|
1111
|
-
},
|
|
1235
|
+
}, S = (e) => (t) => {
|
|
1112
1236
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
|
|
1113
|
-
},
|
|
1237
|
+
}, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: j } = L(() => {
|
|
1114
1238
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
|
|
1115
|
-
for (let r of
|
|
1239
|
+
for (let r of w) {
|
|
1116
1240
|
let i = String(r[c] ?? ""), a = String(r[l] ?? ""), o = Number(r[u]) || 0;
|
|
1117
1241
|
e.set(i, !0), t.set(a, !0), n[i] || (n[i] = {}), n[i][a] || (n[i][a] = []), n[i][a].push(o);
|
|
1118
1242
|
}
|
|
@@ -1121,10 +1245,10 @@ var Me = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1121
1245
|
a[e] = {};
|
|
1122
1246
|
let t = [];
|
|
1123
1247
|
for (let r of i) {
|
|
1124
|
-
let i = n[e]?.[r] ?? [], o =
|
|
1248
|
+
let i = n[e]?.[r] ?? [], o = Xe(i, d);
|
|
1125
1249
|
a[e][r] = o, t.push(...i), !s[r] && s[r];
|
|
1126
1250
|
}
|
|
1127
|
-
o[e] =
|
|
1251
|
+
o[e] = Xe(t, d);
|
|
1128
1252
|
}
|
|
1129
1253
|
for (let e of i) {
|
|
1130
1254
|
let t = [];
|
|
@@ -1132,34 +1256,34 @@ var Me = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1132
1256
|
let r = n[i]?.[e] ?? [];
|
|
1133
1257
|
t.push(...r);
|
|
1134
1258
|
}
|
|
1135
|
-
s[e] =
|
|
1259
|
+
s[e] = Xe(t, d);
|
|
1136
1260
|
}
|
|
1137
1261
|
let f = [];
|
|
1138
|
-
for (let e of
|
|
1262
|
+
for (let e of w) f.push(Number(e[u]) || 0);
|
|
1139
1263
|
return {
|
|
1140
1264
|
rowKeys: r,
|
|
1141
1265
|
colKeys: i,
|
|
1142
1266
|
matrix: a,
|
|
1143
1267
|
rowTotals: o,
|
|
1144
1268
|
colTotals: s,
|
|
1145
|
-
grandTotal:
|
|
1269
|
+
grandTotal: Xe(f, d)
|
|
1146
1270
|
};
|
|
1147
1271
|
}, [
|
|
1148
|
-
|
|
1272
|
+
w,
|
|
1149
1273
|
c,
|
|
1150
1274
|
l,
|
|
1151
1275
|
u,
|
|
1152
1276
|
d
|
|
1153
|
-
]),
|
|
1154
|
-
return
|
|
1277
|
+
]), M = (e) => qe(e, h);
|
|
1278
|
+
return w.length === 0 ? /* @__PURE__ */ X("div", {
|
|
1155
1279
|
className: A("overflow-auto", t),
|
|
1156
|
-
children: [s && /* @__PURE__ */
|
|
1280
|
+
children: [s && /* @__PURE__ */ Y("h3", {
|
|
1157
1281
|
className: "text-sm font-semibold mb-2",
|
|
1158
1282
|
children: s
|
|
1159
|
-
}), /* @__PURE__ */
|
|
1283
|
+
}), /* @__PURE__ */ X("div", {
|
|
1160
1284
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1161
1285
|
"data-testid": "pivot-empty-state",
|
|
1162
|
-
children: [/* @__PURE__ */
|
|
1286
|
+
children: [/* @__PURE__ */ X("svg", {
|
|
1163
1287
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1164
1288
|
className: "h-8 w-8 mb-2 opacity-40",
|
|
1165
1289
|
viewBox: "0 0 24 24",
|
|
@@ -1169,163 +1293,163 @@ var Me = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1169
1293
|
strokeLinecap: "round",
|
|
1170
1294
|
strokeLinejoin: "round",
|
|
1171
1295
|
children: [
|
|
1172
|
-
/* @__PURE__ */
|
|
1296
|
+
/* @__PURE__ */ Y("rect", {
|
|
1173
1297
|
x: "3",
|
|
1174
1298
|
y: "3",
|
|
1175
1299
|
width: "7",
|
|
1176
1300
|
height: "7"
|
|
1177
1301
|
}),
|
|
1178
|
-
/* @__PURE__ */
|
|
1302
|
+
/* @__PURE__ */ Y("rect", {
|
|
1179
1303
|
x: "14",
|
|
1180
1304
|
y: "3",
|
|
1181
1305
|
width: "7",
|
|
1182
1306
|
height: "7"
|
|
1183
1307
|
}),
|
|
1184
|
-
/* @__PURE__ */
|
|
1308
|
+
/* @__PURE__ */ Y("rect", {
|
|
1185
1309
|
x: "3",
|
|
1186
1310
|
y: "14",
|
|
1187
1311
|
width: "7",
|
|
1188
1312
|
height: "7"
|
|
1189
1313
|
}),
|
|
1190
|
-
/* @__PURE__ */
|
|
1314
|
+
/* @__PURE__ */ Y("rect", {
|
|
1191
1315
|
x: "14",
|
|
1192
1316
|
y: "14",
|
|
1193
1317
|
width: "7",
|
|
1194
1318
|
height: "7"
|
|
1195
1319
|
})
|
|
1196
1320
|
]
|
|
1197
|
-
}), /* @__PURE__ */
|
|
1321
|
+
}), /* @__PURE__ */ Y("p", {
|
|
1198
1322
|
className: "text-xs",
|
|
1199
|
-
children:
|
|
1323
|
+
children: y
|
|
1200
1324
|
})]
|
|
1201
1325
|
})]
|
|
1202
|
-
}) : /* @__PURE__ */
|
|
1326
|
+
}) : /* @__PURE__ */ X("div", {
|
|
1203
1327
|
className: A("overflow-auto", t),
|
|
1204
|
-
children: [s && /* @__PURE__ */
|
|
1328
|
+
children: [s && /* @__PURE__ */ Y("h3", {
|
|
1205
1329
|
className: "text-sm font-semibold mb-2",
|
|
1206
1330
|
children: s
|
|
1207
|
-
}), /* @__PURE__ */
|
|
1331
|
+
}), /* @__PURE__ */ X("table", {
|
|
1208
1332
|
className: "w-full text-sm border-collapse table-auto",
|
|
1209
1333
|
role: "table",
|
|
1210
1334
|
children: [
|
|
1211
|
-
/* @__PURE__ */
|
|
1335
|
+
/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", {
|
|
1212
1336
|
className: "border-b border-border",
|
|
1213
1337
|
children: [
|
|
1214
|
-
/* @__PURE__ */
|
|
1338
|
+
/* @__PURE__ */ Y("th", {
|
|
1215
1339
|
className: "text-left p-2 font-medium text-muted-foreground whitespace-nowrap",
|
|
1216
1340
|
children: a || c
|
|
1217
1341
|
}),
|
|
1218
|
-
|
|
1219
|
-
let t = () =>
|
|
1342
|
+
E.map((e) => {
|
|
1343
|
+
let t = () => x({
|
|
1220
1344
|
scope: "column",
|
|
1221
1345
|
colKey: e
|
|
1222
1346
|
});
|
|
1223
|
-
return /* @__PURE__ */
|
|
1224
|
-
className: A("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground",
|
|
1347
|
+
return /* @__PURE__ */ Y("th", {
|
|
1348
|
+
className: A("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
|
|
1225
1349
|
title: e === "" ? `${l}: (empty)` : `${l}: ${e}`,
|
|
1226
|
-
role:
|
|
1227
|
-
tabIndex:
|
|
1228
|
-
onClick:
|
|
1229
|
-
onKeyDown:
|
|
1230
|
-
"aria-label":
|
|
1231
|
-
children:
|
|
1350
|
+
role: b ? "button" : void 0,
|
|
1351
|
+
tabIndex: b ? 0 : void 0,
|
|
1352
|
+
onClick: b ? t : void 0,
|
|
1353
|
+
onKeyDown: b ? S(t) : void 0,
|
|
1354
|
+
"aria-label": b ? `Drill into ${l}: ${e || "(empty)"}` : void 0,
|
|
1355
|
+
children: Ye(e, i)
|
|
1232
1356
|
}, e);
|
|
1233
1357
|
}),
|
|
1234
|
-
p && /* @__PURE__ */
|
|
1358
|
+
p && /* @__PURE__ */ Y("th", {
|
|
1235
1359
|
className: "text-right p-2 font-semibold text-muted-foreground bg-muted/20 whitespace-nowrap",
|
|
1236
1360
|
children: v
|
|
1237
1361
|
})
|
|
1238
1362
|
]
|
|
1239
1363
|
}) }),
|
|
1240
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ Y("tbody", { children: T.map((e) => /* @__PURE__ */ X("tr", {
|
|
1241
1365
|
className: "border-b border-border/50 hover:bg-muted/30",
|
|
1242
1366
|
children: [
|
|
1243
|
-
/* @__PURE__ */
|
|
1244
|
-
className: A("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70",
|
|
1245
|
-
role:
|
|
1246
|
-
tabIndex:
|
|
1247
|
-
onClick:
|
|
1367
|
+
/* @__PURE__ */ Y("td", {
|
|
1368
|
+
className: A("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
|
|
1369
|
+
role: b ? "button" : void 0,
|
|
1370
|
+
tabIndex: b ? 0 : void 0,
|
|
1371
|
+
onClick: b ? () => x({
|
|
1248
1372
|
scope: "row",
|
|
1249
1373
|
rowKey: e
|
|
1250
1374
|
}) : void 0,
|
|
1251
|
-
onKeyDown:
|
|
1375
|
+
onKeyDown: b ? S(() => x({
|
|
1252
1376
|
scope: "row",
|
|
1253
1377
|
rowKey: e
|
|
1254
1378
|
})) : void 0,
|
|
1255
|
-
"aria-label":
|
|
1256
|
-
children:
|
|
1379
|
+
"aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
|
|
1380
|
+
children: Ye(e, n)
|
|
1257
1381
|
}),
|
|
1258
|
-
|
|
1259
|
-
let n =
|
|
1382
|
+
E.map((t) => {
|
|
1383
|
+
let n = D[e]?.[t] ?? 0, r = () => x({
|
|
1260
1384
|
scope: "cell",
|
|
1261
1385
|
rowKey: e,
|
|
1262
1386
|
colKey: t,
|
|
1263
1387
|
value: n
|
|
1264
1388
|
});
|
|
1265
|
-
return /* @__PURE__ */
|
|
1266
|
-
className: A("text-right p-2 tabular-nums", g?.[t],
|
|
1267
|
-
role:
|
|
1268
|
-
tabIndex:
|
|
1269
|
-
onClick:
|
|
1270
|
-
onKeyDown:
|
|
1271
|
-
"aria-label":
|
|
1272
|
-
children:
|
|
1389
|
+
return /* @__PURE__ */ Y("td", {
|
|
1390
|
+
className: A("text-right p-2 tabular-nums", g?.[t], C),
|
|
1391
|
+
role: b ? "button" : void 0,
|
|
1392
|
+
tabIndex: b ? 0 : void 0,
|
|
1393
|
+
onClick: b ? r : void 0,
|
|
1394
|
+
onKeyDown: b ? S(r) : void 0,
|
|
1395
|
+
"aria-label": b ? `Drill into ${c}=${e || "(empty)"}, ${l}=${t || "(empty)"}` : void 0,
|
|
1396
|
+
children: M(n)
|
|
1273
1397
|
}, t);
|
|
1274
1398
|
}),
|
|
1275
|
-
p && /* @__PURE__ */
|
|
1276
|
-
className: A("text-right p-2 font-semibold tabular-nums bg-muted/20",
|
|
1277
|
-
role:
|
|
1278
|
-
tabIndex:
|
|
1279
|
-
onClick:
|
|
1399
|
+
p && /* @__PURE__ */ Y("td", {
|
|
1400
|
+
className: A("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
|
|
1401
|
+
role: b ? "button" : void 0,
|
|
1402
|
+
tabIndex: b ? 0 : void 0,
|
|
1403
|
+
onClick: b ? () => x({
|
|
1280
1404
|
scope: "row",
|
|
1281
1405
|
rowKey: e,
|
|
1282
|
-
value:
|
|
1406
|
+
value: O[e] ?? 0
|
|
1283
1407
|
}) : void 0,
|
|
1284
|
-
onKeyDown:
|
|
1408
|
+
onKeyDown: b ? S(() => x({
|
|
1285
1409
|
scope: "row",
|
|
1286
1410
|
rowKey: e,
|
|
1287
|
-
value:
|
|
1411
|
+
value: O[e] ?? 0
|
|
1288
1412
|
})) : void 0,
|
|
1289
|
-
children:
|
|
1413
|
+
children: M(O[e] ?? 0)
|
|
1290
1414
|
})
|
|
1291
1415
|
]
|
|
1292
1416
|
}, e)) }),
|
|
1293
|
-
m && /* @__PURE__ */
|
|
1417
|
+
m && /* @__PURE__ */ Y("tfoot", { children: /* @__PURE__ */ X("tr", {
|
|
1294
1418
|
className: "border-t-2 border-border font-semibold bg-muted/40",
|
|
1295
1419
|
children: [
|
|
1296
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ Y("td", {
|
|
1297
1421
|
className: "p-2",
|
|
1298
1422
|
children: v
|
|
1299
1423
|
}),
|
|
1300
|
-
|
|
1301
|
-
className: A("text-right p-2 tabular-nums",
|
|
1302
|
-
role:
|
|
1303
|
-
tabIndex:
|
|
1304
|
-
onClick:
|
|
1424
|
+
E.map((e) => /* @__PURE__ */ Y("td", {
|
|
1425
|
+
className: A("text-right p-2 tabular-nums", C),
|
|
1426
|
+
role: b ? "button" : void 0,
|
|
1427
|
+
tabIndex: b ? 0 : void 0,
|
|
1428
|
+
onClick: b ? () => x({
|
|
1305
1429
|
scope: "column",
|
|
1306
1430
|
colKey: e,
|
|
1307
|
-
value:
|
|
1431
|
+
value: k[e] ?? 0
|
|
1308
1432
|
}) : void 0,
|
|
1309
|
-
onKeyDown:
|
|
1433
|
+
onKeyDown: b ? S(() => x({
|
|
1310
1434
|
scope: "column",
|
|
1311
1435
|
colKey: e,
|
|
1312
|
-
value:
|
|
1436
|
+
value: k[e] ?? 0
|
|
1313
1437
|
})) : void 0,
|
|
1314
|
-
children:
|
|
1438
|
+
children: M(k[e] ?? 0)
|
|
1315
1439
|
}, e)),
|
|
1316
|
-
p && /* @__PURE__ */
|
|
1317
|
-
className: A("text-right p-2 tabular-nums font-bold",
|
|
1318
|
-
role:
|
|
1319
|
-
tabIndex:
|
|
1320
|
-
onClick:
|
|
1440
|
+
p && /* @__PURE__ */ Y("td", {
|
|
1441
|
+
className: A("text-right p-2 tabular-nums font-bold", C),
|
|
1442
|
+
role: b ? "button" : void 0,
|
|
1443
|
+
tabIndex: b ? 0 : void 0,
|
|
1444
|
+
onClick: b ? () => x({
|
|
1321
1445
|
scope: "total",
|
|
1322
|
-
value:
|
|
1446
|
+
value: j
|
|
1323
1447
|
}) : void 0,
|
|
1324
|
-
onKeyDown:
|
|
1448
|
+
onKeyDown: b ? S(() => x({
|
|
1325
1449
|
scope: "total",
|
|
1326
|
-
value:
|
|
1450
|
+
value: j
|
|
1327
1451
|
})) : void 0,
|
|
1328
|
-
children: j
|
|
1452
|
+
children: M(j)
|
|
1329
1453
|
})
|
|
1330
1454
|
]
|
|
1331
1455
|
}) })
|
|
@@ -1335,13 +1459,13 @@ var Me = ({ schema: e, className: t, rowLabels: n, columnLabels: i, rowFieldLabe
|
|
|
1335
1459
|
};
|
|
1336
1460
|
//#endregion
|
|
1337
1461
|
//#region src/ObjectDataTable.tsx
|
|
1338
|
-
function
|
|
1462
|
+
function Qe(e) {
|
|
1339
1463
|
return e.map((e) => typeof e == "string" ? {
|
|
1340
1464
|
header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
|
|
1341
1465
|
accessorKey: e
|
|
1342
1466
|
} : e);
|
|
1343
1467
|
}
|
|
1344
|
-
function
|
|
1468
|
+
function $e(e, t) {
|
|
1345
1469
|
if (!t?.fields) return [];
|
|
1346
1470
|
let n = {};
|
|
1347
1471
|
if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
|
|
@@ -1359,24 +1483,31 @@ function Pe(e, t) {
|
|
|
1359
1483
|
} else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
|
|
1360
1484
|
return Array.from(a);
|
|
1361
1485
|
}
|
|
1362
|
-
var
|
|
1363
|
-
let a =
|
|
1486
|
+
var et = ({ schema: e, dataSource: t, className: r }) => {
|
|
1487
|
+
let a = te(s), c = t || a?.dataSource, u = l(e.bind), { fieldLabel: d, fieldOptionLabel: f } = be(), p = "No data available", m = "No data source available for";
|
|
1488
|
+
try {
|
|
1489
|
+
let { t: e } = ye(), t = e("dashboard.noDataAvailable");
|
|
1490
|
+
t && t !== "dashboard.noDataAvailable" && (p = t);
|
|
1491
|
+
let n = e("dashboard.noDataSourceFor");
|
|
1492
|
+
n && n !== "dashboard.noDataSourceFor" && (m = n);
|
|
1493
|
+
} catch {}
|
|
1494
|
+
let [h, g] = R([]), [_, v] = R(null), [y, b] = R(!1), [x, S] = R(null);
|
|
1364
1495
|
I(() => {
|
|
1365
1496
|
let t = !0;
|
|
1366
1497
|
return e.objectName && !u && (!e.data || e.data.length === 0) && (async () => {
|
|
1367
1498
|
if (!(!c || !e.objectName)) {
|
|
1368
|
-
t && (
|
|
1499
|
+
t && (b(!0), S(null));
|
|
1369
1500
|
try {
|
|
1370
1501
|
let r;
|
|
1371
1502
|
if (typeof c.find == "function") {
|
|
1372
|
-
let t =
|
|
1503
|
+
let t = $e(e, _), a = { $filter: i(e.filter) };
|
|
1373
1504
|
t.length && (a.$expand = t), r = n(await c.find(e.objectName, a));
|
|
1374
1505
|
} else return;
|
|
1375
|
-
t &&
|
|
1506
|
+
t && g(r);
|
|
1376
1507
|
} catch (e) {
|
|
1377
|
-
console.error("[ObjectDataTable] Fetch error:", e), t &&
|
|
1508
|
+
console.error("[ObjectDataTable] Fetch error:", e), t && S(e instanceof Error ? e.message : "Failed to load data");
|
|
1378
1509
|
} finally {
|
|
1379
|
-
t &&
|
|
1510
|
+
t && b(!1);
|
|
1380
1511
|
}
|
|
1381
1512
|
}
|
|
1382
1513
|
})(), () => {
|
|
@@ -1388,19 +1519,19 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1388
1519
|
u,
|
|
1389
1520
|
e.data,
|
|
1390
1521
|
e.filter,
|
|
1391
|
-
|
|
1522
|
+
_
|
|
1392
1523
|
]), I(() => {
|
|
1393
1524
|
let t = !0;
|
|
1394
1525
|
if (!(!c || !e.objectName || typeof c.getObjectSchema != "function")) return c.getObjectSchema(e.objectName).then((e) => {
|
|
1395
|
-
t &&
|
|
1526
|
+
t && v(e);
|
|
1396
1527
|
}).catch(() => {}), () => {
|
|
1397
1528
|
t = !1;
|
|
1398
1529
|
};
|
|
1399
1530
|
}, [e.objectName, c]);
|
|
1400
|
-
let
|
|
1531
|
+
let C = u || e.data || h, w = Array.isArray(C) ? C : [], T = L(() => {
|
|
1401
1532
|
let t = e.objectName, n = {};
|
|
1402
|
-
if (
|
|
1403
|
-
let e =
|
|
1533
|
+
if (_?.fields) {
|
|
1534
|
+
let e = _.fields;
|
|
1404
1535
|
if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
|
|
1405
1536
|
else for (let [t, r] of Object.entries(e)) n[t] = {
|
|
1406
1537
|
name: t,
|
|
@@ -1455,13 +1586,13 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1455
1586
|
"€": "EUR",
|
|
1456
1587
|
"£": "GBP"
|
|
1457
1588
|
}[t[0]];
|
|
1458
|
-
return
|
|
1589
|
+
return xe(e, o.currency || n);
|
|
1459
1590
|
}
|
|
1460
1591
|
if (typeof t == "string" && /%/.test(t) && typeof e == "number") {
|
|
1461
1592
|
let n = (t.match(/0\.(0+)%/) || [, ""])[1].length;
|
|
1462
|
-
return
|
|
1593
|
+
return Ce((e > 1 ? e / 100 : e) * 100, n);
|
|
1463
1594
|
}
|
|
1464
|
-
return typeof t == "string" && /[YMDHms]/.test(t) ?
|
|
1595
|
+
return typeof t == "string" && /[YMDHms]/.test(t) ? Se(e, t) : /* @__PURE__ */ Y(we(Te(o)), {
|
|
1465
1596
|
value: e,
|
|
1466
1597
|
field: o
|
|
1467
1598
|
});
|
|
@@ -1474,13 +1605,13 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1474
1605
|
};
|
|
1475
1606
|
};
|
|
1476
1607
|
if (e.columns && e.columns.length > 0) {
|
|
1477
|
-
let n =
|
|
1608
|
+
let n = Qe(e.columns);
|
|
1478
1609
|
return (t ? n.map((e) => ({
|
|
1479
1610
|
...e,
|
|
1480
1611
|
header: d(t, e.accessorKey, e.header)
|
|
1481
1612
|
})) : n).map(i);
|
|
1482
1613
|
}
|
|
1483
|
-
if (
|
|
1614
|
+
if (w.length === 0) return [];
|
|
1484
1615
|
let a = new Set([
|
|
1485
1616
|
"id",
|
|
1486
1617
|
"organization_id",
|
|
@@ -1495,53 +1626,53 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1495
1626
|
"_id",
|
|
1496
1627
|
"__typename"
|
|
1497
1628
|
]), o = (e, t) => t && (t.isSystem === !0 || t.system === !0) ? !0 : a.has(e);
|
|
1498
|
-
return (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !o(e, n[e])) : Object.keys(
|
|
1629
|
+
return (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !o(e, n[e])) : Object.keys(w[0]).filter((e) => !e.startsWith("_") && !o(e))).map((e) => i({
|
|
1499
1630
|
header: r(e),
|
|
1500
1631
|
accessorKey: e
|
|
1501
1632
|
}));
|
|
1502
1633
|
}, [
|
|
1503
1634
|
e.columns,
|
|
1504
1635
|
e.objectName,
|
|
1505
|
-
|
|
1506
|
-
|
|
1636
|
+
w,
|
|
1637
|
+
_,
|
|
1507
1638
|
d,
|
|
1508
1639
|
f
|
|
1509
1640
|
]);
|
|
1510
|
-
return
|
|
1641
|
+
return y && w.length === 0 ? /* @__PURE__ */ Y("div", {
|
|
1511
1642
|
className: A("overflow-auto", r),
|
|
1512
1643
|
"data-testid": "table-loading",
|
|
1513
|
-
children: /* @__PURE__ */
|
|
1644
|
+
children: /* @__PURE__ */ X("div", {
|
|
1514
1645
|
className: "space-y-2 p-2",
|
|
1515
|
-
children: [/* @__PURE__ */
|
|
1646
|
+
children: [/* @__PURE__ */ X("div", {
|
|
1516
1647
|
className: "flex gap-2",
|
|
1517
1648
|
children: [
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
/* @__PURE__ */
|
|
1649
|
+
/* @__PURE__ */ Y(k, { className: "h-6 w-1/4" }),
|
|
1650
|
+
/* @__PURE__ */ Y(k, { className: "h-6 w-1/4" }),
|
|
1651
|
+
/* @__PURE__ */ Y(k, { className: "h-6 w-1/4" }),
|
|
1652
|
+
/* @__PURE__ */ Y(k, { className: "h-6 w-1/4" })
|
|
1522
1653
|
]
|
|
1523
1654
|
}), [
|
|
1524
1655
|
1,
|
|
1525
1656
|
2,
|
|
1526
1657
|
3,
|
|
1527
1658
|
4
|
|
1528
|
-
].map((e) => /* @__PURE__ */
|
|
1659
|
+
].map((e) => /* @__PURE__ */ X("div", {
|
|
1529
1660
|
className: "flex gap-2",
|
|
1530
1661
|
children: [
|
|
1531
|
-
/* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1662
|
+
/* @__PURE__ */ Y(k, { className: "h-5 w-1/4" }),
|
|
1663
|
+
/* @__PURE__ */ Y(k, { className: "h-5 w-1/4" }),
|
|
1664
|
+
/* @__PURE__ */ Y(k, { className: "h-5 w-1/4" }),
|
|
1665
|
+
/* @__PURE__ */ Y(k, { className: "h-5 w-1/4" })
|
|
1535
1666
|
]
|
|
1536
1667
|
}, e))]
|
|
1537
1668
|
})
|
|
1538
|
-
}) :
|
|
1669
|
+
}) : x ? /* @__PURE__ */ Y("div", {
|
|
1539
1670
|
className: A("overflow-auto", r),
|
|
1540
1671
|
"data-testid": "table-error",
|
|
1541
|
-
children: /* @__PURE__ */
|
|
1672
|
+
children: /* @__PURE__ */ X("div", {
|
|
1542
1673
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
1543
1674
|
"data-testid": "table-error-message",
|
|
1544
|
-
children: [/* @__PURE__ */
|
|
1675
|
+
children: [/* @__PURE__ */ X("svg", {
|
|
1545
1676
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1546
1677
|
className: "h-8 w-8 mb-2 opacity-60",
|
|
1547
1678
|
viewBox: "0 0 24 24",
|
|
@@ -1551,48 +1682,49 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1551
1682
|
strokeLinecap: "round",
|
|
1552
1683
|
strokeLinejoin: "round",
|
|
1553
1684
|
children: [
|
|
1554
|
-
/* @__PURE__ */
|
|
1685
|
+
/* @__PURE__ */ Y("circle", {
|
|
1555
1686
|
cx: "12",
|
|
1556
1687
|
cy: "12",
|
|
1557
1688
|
r: "10"
|
|
1558
1689
|
}),
|
|
1559
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ Y("line", {
|
|
1560
1691
|
x1: "12",
|
|
1561
1692
|
y1: "8",
|
|
1562
1693
|
x2: "12",
|
|
1563
1694
|
y2: "12"
|
|
1564
1695
|
}),
|
|
1565
|
-
/* @__PURE__ */
|
|
1696
|
+
/* @__PURE__ */ Y("line", {
|
|
1566
1697
|
x1: "12",
|
|
1567
1698
|
y1: "16",
|
|
1568
1699
|
x2: "12.01",
|
|
1569
1700
|
y2: "16"
|
|
1570
1701
|
})
|
|
1571
1702
|
]
|
|
1572
|
-
}), /* @__PURE__ */
|
|
1703
|
+
}), /* @__PURE__ */ Y("p", {
|
|
1573
1704
|
className: "text-xs",
|
|
1574
|
-
children:
|
|
1705
|
+
children: x
|
|
1575
1706
|
})]
|
|
1576
1707
|
})
|
|
1577
|
-
}) : !c && e.objectName &&
|
|
1708
|
+
}) : !c && e.objectName && w.length === 0 ? /* @__PURE__ */ Y("div", {
|
|
1578
1709
|
className: A("overflow-auto", r),
|
|
1579
|
-
children: /* @__PURE__ */
|
|
1710
|
+
children: /* @__PURE__ */ Y("div", {
|
|
1580
1711
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1581
|
-
children: /* @__PURE__ */
|
|
1712
|
+
children: /* @__PURE__ */ X("p", {
|
|
1582
1713
|
className: "text-xs",
|
|
1583
1714
|
children: [
|
|
1584
|
-
|
|
1715
|
+
m,
|
|
1716
|
+
" “",
|
|
1585
1717
|
e.objectName,
|
|
1586
1718
|
"”"
|
|
1587
1719
|
]
|
|
1588
1720
|
})
|
|
1589
1721
|
})
|
|
1590
|
-
}) :
|
|
1722
|
+
}) : w.length === 0 ? /* @__PURE__ */ Y("div", {
|
|
1591
1723
|
className: A("overflow-auto", r),
|
|
1592
1724
|
"data-testid": "table-empty-state",
|
|
1593
|
-
children: /* @__PURE__ */
|
|
1725
|
+
children: /* @__PURE__ */ X("div", {
|
|
1594
1726
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1595
|
-
children: [/* @__PURE__ */
|
|
1727
|
+
children: [/* @__PURE__ */ X("svg", {
|
|
1596
1728
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1597
1729
|
className: "h-8 w-8 mb-2 opacity-40",
|
|
1598
1730
|
viewBox: "0 0 24 24",
|
|
@@ -1602,7 +1734,7 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1602
1734
|
strokeLinecap: "round",
|
|
1603
1735
|
strokeLinejoin: "round",
|
|
1604
1736
|
children: [
|
|
1605
|
-
/* @__PURE__ */
|
|
1737
|
+
/* @__PURE__ */ Y("rect", {
|
|
1606
1738
|
x: "3",
|
|
1607
1739
|
y: "3",
|
|
1608
1740
|
width: "18",
|
|
@@ -1610,34 +1742,34 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1610
1742
|
rx: "2",
|
|
1611
1743
|
ry: "2"
|
|
1612
1744
|
}),
|
|
1613
|
-
/* @__PURE__ */
|
|
1745
|
+
/* @__PURE__ */ Y("line", {
|
|
1614
1746
|
x1: "3",
|
|
1615
1747
|
y1: "9",
|
|
1616
1748
|
x2: "21",
|
|
1617
1749
|
y2: "9"
|
|
1618
1750
|
}),
|
|
1619
|
-
/* @__PURE__ */
|
|
1751
|
+
/* @__PURE__ */ Y("line", {
|
|
1620
1752
|
x1: "9",
|
|
1621
1753
|
y1: "21",
|
|
1622
1754
|
x2: "9",
|
|
1623
1755
|
y2: "9"
|
|
1624
1756
|
})
|
|
1625
1757
|
]
|
|
1626
|
-
}), /* @__PURE__ */
|
|
1758
|
+
}), /* @__PURE__ */ Y("p", {
|
|
1627
1759
|
className: "text-xs",
|
|
1628
|
-
children:
|
|
1760
|
+
children: p
|
|
1629
1761
|
})]
|
|
1630
1762
|
})
|
|
1631
|
-
}) : /* @__PURE__ */
|
|
1763
|
+
}) : /* @__PURE__ */ Y(o, {
|
|
1632
1764
|
schema: {
|
|
1633
1765
|
...e,
|
|
1634
1766
|
type: "data-table",
|
|
1635
|
-
data:
|
|
1636
|
-
columns:
|
|
1767
|
+
data: w,
|
|
1768
|
+
columns: T
|
|
1637
1769
|
},
|
|
1638
1770
|
className: r
|
|
1639
1771
|
});
|
|
1640
|
-
},
|
|
1772
|
+
}, tt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l }) => {
|
|
1641
1773
|
let u = {
|
|
1642
1774
|
type: "object-data-table",
|
|
1643
1775
|
objectName: i,
|
|
@@ -1649,35 +1781,35 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1649
1781
|
pagination: !0,
|
|
1650
1782
|
searchable: !1,
|
|
1651
1783
|
pageSize: c
|
|
1652
|
-
}, d = /* @__PURE__ */
|
|
1784
|
+
}, d = /* @__PURE__ */ Y("div", {
|
|
1653
1785
|
className: A("overflow-auto", l),
|
|
1654
1786
|
"data-testid": "drill-down-body",
|
|
1655
|
-
children: /* @__PURE__ */
|
|
1787
|
+
children: /* @__PURE__ */ Y(et, {
|
|
1656
1788
|
schema: u,
|
|
1657
1789
|
dataSource: o
|
|
1658
1790
|
})
|
|
1659
1791
|
});
|
|
1660
|
-
return r === "dialog" ? /* @__PURE__ */
|
|
1792
|
+
return r === "dialog" ? /* @__PURE__ */ Y(x, {
|
|
1661
1793
|
open: e,
|
|
1662
1794
|
onOpenChange: (e) => !e && t(),
|
|
1663
|
-
children: /* @__PURE__ */
|
|
1795
|
+
children: /* @__PURE__ */ X(S, {
|
|
1664
1796
|
className: "max-w-4xl",
|
|
1665
|
-
children: [/* @__PURE__ */
|
|
1797
|
+
children: [/* @__PURE__ */ Y(C, { children: /* @__PURE__ */ Y(w, { children: n }) }), d]
|
|
1666
1798
|
})
|
|
1667
|
-
}) : /* @__PURE__ */
|
|
1799
|
+
}) : /* @__PURE__ */ Y(T, {
|
|
1668
1800
|
open: e,
|
|
1669
1801
|
onOpenChange: (e) => !e && t(),
|
|
1670
|
-
children: /* @__PURE__ */
|
|
1802
|
+
children: /* @__PURE__ */ X(E, {
|
|
1671
1803
|
side: "right",
|
|
1672
1804
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1673
|
-
children: [/* @__PURE__ */
|
|
1805
|
+
children: [/* @__PURE__ */ Y(D, { children: /* @__PURE__ */ Y(O, { children: n }) }), /* @__PURE__ */ Y("div", {
|
|
1674
1806
|
className: "flex-1 overflow-hidden mt-2",
|
|
1675
1807
|
children: d
|
|
1676
1808
|
})]
|
|
1677
1809
|
})
|
|
1678
1810
|
});
|
|
1679
|
-
},
|
|
1680
|
-
let u =
|
|
1811
|
+
}, nt = ({ schema: e, dataSource: o, className: c }) => {
|
|
1812
|
+
let u = te(s), d = o || u?.dataSource, f = l(e.bind), [p, m] = R([]), [h, g] = R(!1), [_, v] = R(null), [y, b] = R({}), [x, S] = R({}), [C, w] = R(null), { fieldLabel: T, fieldOptionLabel: E } = be(), D = ne(T), O = ne(E);
|
|
1681
1813
|
I(() => {
|
|
1682
1814
|
D.current = T, O.current = E;
|
|
1683
1815
|
}, [T, E]), I(() => {
|
|
@@ -1732,47 +1864,47 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1732
1864
|
e.filter
|
|
1733
1865
|
]);
|
|
1734
1866
|
let j = f || e.data || p, M = Array.isArray(j) ? j : [];
|
|
1735
|
-
if (h && M.length === 0) return /* @__PURE__ */
|
|
1867
|
+
if (h && M.length === 0) return /* @__PURE__ */ X("div", {
|
|
1736
1868
|
className: A("overflow-auto", c),
|
|
1737
1869
|
"data-testid": "pivot-loading",
|
|
1738
|
-
children: [e.title && /* @__PURE__ */
|
|
1870
|
+
children: [e.title && /* @__PURE__ */ Y("h3", {
|
|
1739
1871
|
className: "text-sm font-semibold mb-2",
|
|
1740
1872
|
children: e.title
|
|
1741
|
-
}), /* @__PURE__ */
|
|
1873
|
+
}), /* @__PURE__ */ X("div", {
|
|
1742
1874
|
className: "space-y-2 p-2",
|
|
1743
|
-
children: [/* @__PURE__ */
|
|
1875
|
+
children: [/* @__PURE__ */ X("div", {
|
|
1744
1876
|
className: "flex gap-2",
|
|
1745
1877
|
children: [
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1749
|
-
/* @__PURE__ */
|
|
1878
|
+
/* @__PURE__ */ Y(k, { className: "h-6 w-24" }),
|
|
1879
|
+
/* @__PURE__ */ Y(k, { className: "h-6 w-20" }),
|
|
1880
|
+
/* @__PURE__ */ Y(k, { className: "h-6 w-20" }),
|
|
1881
|
+
/* @__PURE__ */ Y(k, { className: "h-6 w-20" })
|
|
1750
1882
|
]
|
|
1751
1883
|
}), [
|
|
1752
1884
|
1,
|
|
1753
1885
|
2,
|
|
1754
1886
|
3
|
|
1755
|
-
].map((e) => /* @__PURE__ */
|
|
1887
|
+
].map((e) => /* @__PURE__ */ X("div", {
|
|
1756
1888
|
className: "flex gap-2",
|
|
1757
1889
|
children: [
|
|
1758
|
-
/* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1760
|
-
/* @__PURE__ */
|
|
1761
|
-
/* @__PURE__ */
|
|
1890
|
+
/* @__PURE__ */ Y(k, { className: "h-5 w-24" }),
|
|
1891
|
+
/* @__PURE__ */ Y(k, { className: "h-5 w-20" }),
|
|
1892
|
+
/* @__PURE__ */ Y(k, { className: "h-5 w-20" }),
|
|
1893
|
+
/* @__PURE__ */ Y(k, { className: "h-5 w-20" })
|
|
1762
1894
|
]
|
|
1763
1895
|
}, e))]
|
|
1764
1896
|
})]
|
|
1765
1897
|
});
|
|
1766
|
-
if (_) return /* @__PURE__ */
|
|
1898
|
+
if (_) return /* @__PURE__ */ X("div", {
|
|
1767
1899
|
className: A("overflow-auto", c),
|
|
1768
1900
|
"data-testid": "pivot-error",
|
|
1769
|
-
children: [e.title && /* @__PURE__ */
|
|
1901
|
+
children: [e.title && /* @__PURE__ */ Y("h3", {
|
|
1770
1902
|
className: "text-sm font-semibold mb-2",
|
|
1771
1903
|
children: e.title
|
|
1772
|
-
}), /* @__PURE__ */
|
|
1904
|
+
}), /* @__PURE__ */ X("div", {
|
|
1773
1905
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
1774
1906
|
"data-testid": "pivot-error-message",
|
|
1775
|
-
children: [/* @__PURE__ */
|
|
1907
|
+
children: [/* @__PURE__ */ X("svg", {
|
|
1776
1908
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1777
1909
|
className: "h-8 w-8 mb-2 opacity-60",
|
|
1778
1910
|
viewBox: "0 0 24 24",
|
|
@@ -1782,38 +1914,38 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1782
1914
|
strokeLinecap: "round",
|
|
1783
1915
|
strokeLinejoin: "round",
|
|
1784
1916
|
children: [
|
|
1785
|
-
/* @__PURE__ */
|
|
1917
|
+
/* @__PURE__ */ Y("circle", {
|
|
1786
1918
|
cx: "12",
|
|
1787
1919
|
cy: "12",
|
|
1788
1920
|
r: "10"
|
|
1789
1921
|
}),
|
|
1790
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ Y("line", {
|
|
1791
1923
|
x1: "12",
|
|
1792
1924
|
y1: "8",
|
|
1793
1925
|
x2: "12",
|
|
1794
1926
|
y2: "12"
|
|
1795
1927
|
}),
|
|
1796
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ Y("line", {
|
|
1797
1929
|
x1: "12",
|
|
1798
1930
|
y1: "16",
|
|
1799
1931
|
x2: "12.01",
|
|
1800
1932
|
y2: "16"
|
|
1801
1933
|
})
|
|
1802
1934
|
]
|
|
1803
|
-
}), /* @__PURE__ */
|
|
1935
|
+
}), /* @__PURE__ */ Y("p", {
|
|
1804
1936
|
className: "text-xs",
|
|
1805
1937
|
children: _
|
|
1806
1938
|
})]
|
|
1807
1939
|
})]
|
|
1808
1940
|
});
|
|
1809
|
-
if (!d && e.objectName && M.length === 0) return /* @__PURE__ */
|
|
1941
|
+
if (!d && e.objectName && M.length === 0) return /* @__PURE__ */ X("div", {
|
|
1810
1942
|
className: A("overflow-auto", c),
|
|
1811
|
-
children: [e.title && /* @__PURE__ */
|
|
1943
|
+
children: [e.title && /* @__PURE__ */ Y("h3", {
|
|
1812
1944
|
className: "text-sm font-semibold mb-2",
|
|
1813
1945
|
children: e.title
|
|
1814
|
-
}), /* @__PURE__ */
|
|
1946
|
+
}), /* @__PURE__ */ Y("div", {
|
|
1815
1947
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
1816
|
-
children: /* @__PURE__ */
|
|
1948
|
+
children: /* @__PURE__ */ X("p", {
|
|
1817
1949
|
className: "text-xs",
|
|
1818
1950
|
children: [
|
|
1819
1951
|
"No data source available for “",
|
|
@@ -1826,36 +1958,36 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1826
1958
|
let N = {
|
|
1827
1959
|
...e,
|
|
1828
1960
|
data: M
|
|
1829
|
-
},
|
|
1830
|
-
return /* @__PURE__ */ J
|
|
1961
|
+
}, ee = e.rowField ? y[e.rowField] : void 0, P = e.columnField ? y[e.columnField] : void 0, F = e.rowField ? x[e.rowField] : void 0, L = e.drillDown;
|
|
1962
|
+
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(Ze, {
|
|
1831
1963
|
schema: N,
|
|
1832
1964
|
className: c,
|
|
1833
|
-
rowLabels:
|
|
1834
|
-
columnLabels:
|
|
1835
|
-
rowFieldLabel:
|
|
1836
|
-
onDrillDown: r(
|
|
1965
|
+
rowLabels: ee,
|
|
1966
|
+
columnLabels: P,
|
|
1967
|
+
rowFieldLabel: F,
|
|
1968
|
+
onDrillDown: r(L) ? (e) => w(e) : void 0
|
|
1837
1969
|
}), (() => {
|
|
1838
1970
|
if (!C || !e.objectName) return null;
|
|
1839
|
-
let n = t(
|
|
1971
|
+
let n = t(L, C, {
|
|
1840
1972
|
rowField: e.rowField,
|
|
1841
1973
|
columnField: e.columnField
|
|
1842
1974
|
}), r = {
|
|
1843
1975
|
...e.filter || {},
|
|
1844
1976
|
...n
|
|
1845
1977
|
};
|
|
1846
|
-
return /* @__PURE__ */
|
|
1978
|
+
return /* @__PURE__ */ Y(tt, {
|
|
1847
1979
|
open: !0,
|
|
1848
1980
|
onClose: () => w(null),
|
|
1849
|
-
title: a(
|
|
1850
|
-
target:
|
|
1981
|
+
title: a(L, C, e.title || "Details"),
|
|
1982
|
+
target: L?.target ?? "drawer",
|
|
1851
1983
|
objectName: e.objectName,
|
|
1852
1984
|
filter: r,
|
|
1853
1985
|
dataSource: d,
|
|
1854
|
-
columns:
|
|
1855
|
-
maxRows:
|
|
1986
|
+
columns: L?.columns,
|
|
1987
|
+
maxRows: L?.maxRows
|
|
1856
1988
|
});
|
|
1857
1989
|
})()] });
|
|
1858
|
-
},
|
|
1990
|
+
}, rt = {
|
|
1859
1991
|
breadcrumb: ["Dashboard", "Configuration"],
|
|
1860
1992
|
sections: [
|
|
1861
1993
|
{
|
|
@@ -1945,6 +2077,12 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1945
2077
|
type: "input",
|
|
1946
2078
|
placeholder: "Dashboard title"
|
|
1947
2079
|
},
|
|
2080
|
+
{
|
|
2081
|
+
key: "description",
|
|
2082
|
+
label: "Description",
|
|
2083
|
+
type: "textarea",
|
|
2084
|
+
placeholder: "Short summary shown under the title"
|
|
2085
|
+
},
|
|
1948
2086
|
{
|
|
1949
2087
|
key: "showDescription",
|
|
1950
2088
|
label: "Show description",
|
|
@@ -1975,12 +2113,12 @@ var Fe = ({ schema: e, dataSource: t, className: r }) => {
|
|
|
1975
2113
|
}
|
|
1976
2114
|
]
|
|
1977
2115
|
};
|
|
1978
|
-
function
|
|
2116
|
+
function it({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
1979
2117
|
let { draft: a, isDirty: o, updateField: s, discard: c } = M(n, { onUpdate: i });
|
|
1980
|
-
return /* @__PURE__ */
|
|
2118
|
+
return /* @__PURE__ */ Y(y, {
|
|
1981
2119
|
open: e,
|
|
1982
2120
|
onClose: t,
|
|
1983
|
-
schema:
|
|
2121
|
+
schema: rt,
|
|
1984
2122
|
draft: a,
|
|
1985
2123
|
isDirty: o,
|
|
1986
2124
|
onFieldChange: s,
|
|
@@ -1990,7 +2128,7 @@ function ze({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
|
1990
2128
|
}
|
|
1991
2129
|
//#endregion
|
|
1992
2130
|
//#region src/WidgetConfigPanel.tsx
|
|
1993
|
-
var
|
|
2131
|
+
var at = [
|
|
1994
2132
|
{
|
|
1995
2133
|
value: "metric",
|
|
1996
2134
|
label: "Metric"
|
|
@@ -2034,16 +2172,8 @@ var Be = [
|
|
|
2034
2172
|
{
|
|
2035
2173
|
value: "pivot",
|
|
2036
2174
|
label: "Pivot Table"
|
|
2037
|
-
},
|
|
2038
|
-
{
|
|
2039
|
-
value: "list",
|
|
2040
|
-
label: "List"
|
|
2041
|
-
},
|
|
2042
|
-
{
|
|
2043
|
-
value: "custom",
|
|
2044
|
-
label: "Custom"
|
|
2045
2175
|
}
|
|
2046
|
-
],
|
|
2176
|
+
], ot = [
|
|
2047
2177
|
{
|
|
2048
2178
|
value: "default",
|
|
2049
2179
|
label: "Default"
|
|
@@ -2076,7 +2206,7 @@ var Be = [
|
|
|
2076
2206
|
value: "danger",
|
|
2077
2207
|
label: "Danger"
|
|
2078
2208
|
}
|
|
2079
|
-
],
|
|
2209
|
+
], st = [
|
|
2080
2210
|
{
|
|
2081
2211
|
value: "count",
|
|
2082
2212
|
label: "Count"
|
|
@@ -2097,7 +2227,7 @@ var Be = [
|
|
|
2097
2227
|
value: "max",
|
|
2098
2228
|
label: "Max"
|
|
2099
2229
|
}
|
|
2100
|
-
],
|
|
2230
|
+
], ct = [
|
|
2101
2231
|
"bar",
|
|
2102
2232
|
"horizontal-bar",
|
|
2103
2233
|
"line",
|
|
@@ -2106,17 +2236,17 @@ var Be = [
|
|
|
2106
2236
|
"donut",
|
|
2107
2237
|
"scatter",
|
|
2108
2238
|
"funnel"
|
|
2109
|
-
],
|
|
2239
|
+
], lt = [
|
|
2110
2240
|
"bar",
|
|
2111
2241
|
"horizontal-bar",
|
|
2112
2242
|
"line",
|
|
2113
2243
|
"area",
|
|
2114
2244
|
"scatter"
|
|
2115
|
-
],
|
|
2245
|
+
], ut = [
|
|
2116
2246
|
"pie",
|
|
2117
2247
|
"donut",
|
|
2118
2248
|
"funnel"
|
|
2119
|
-
],
|
|
2249
|
+
], dt = ["metric", ...ct], ft = [...ct], pt = [
|
|
2120
2250
|
"pivot",
|
|
2121
2251
|
"metric",
|
|
2122
2252
|
"bar",
|
|
@@ -2127,50 +2257,50 @@ var Be = [
|
|
|
2127
2257
|
"donut",
|
|
2128
2258
|
"funnel"
|
|
2129
2259
|
];
|
|
2130
|
-
function
|
|
2131
|
-
return !!e &&
|
|
2260
|
+
function mt(e) {
|
|
2261
|
+
return !!e && ct.includes(e);
|
|
2132
2262
|
}
|
|
2133
|
-
function
|
|
2134
|
-
return !!e &&
|
|
2263
|
+
function ht(e) {
|
|
2264
|
+
return !!e && lt.includes(e);
|
|
2135
2265
|
}
|
|
2136
|
-
function
|
|
2137
|
-
return !!e &&
|
|
2266
|
+
function gt(e) {
|
|
2267
|
+
return !!e && ft.includes(e);
|
|
2138
2268
|
}
|
|
2139
|
-
function
|
|
2140
|
-
return !!e &&
|
|
2269
|
+
function _t(e) {
|
|
2270
|
+
return !!e && dt.includes(e);
|
|
2141
2271
|
}
|
|
2142
|
-
function
|
|
2143
|
-
return !!e &&
|
|
2272
|
+
function vt(e) {
|
|
2273
|
+
return !!e && pt.includes(e);
|
|
2144
2274
|
}
|
|
2145
|
-
var
|
|
2275
|
+
var yt = [{
|
|
2146
2276
|
value: "drawer",
|
|
2147
2277
|
label: "Side drawer"
|
|
2148
2278
|
}, {
|
|
2149
2279
|
value: "dialog",
|
|
2150
2280
|
label: "Center dialog"
|
|
2151
|
-
}],
|
|
2281
|
+
}], bt = [{
|
|
2152
2282
|
value: "group",
|
|
2153
2283
|
label: "Group"
|
|
2154
2284
|
}, {
|
|
2155
2285
|
value: "value",
|
|
2156
2286
|
label: "Value"
|
|
2157
|
-
}],
|
|
2287
|
+
}], xt = [{
|
|
2158
2288
|
value: "asc",
|
|
2159
2289
|
label: "↑"
|
|
2160
2290
|
}, {
|
|
2161
2291
|
value: "desc",
|
|
2162
2292
|
label: "↓"
|
|
2163
2293
|
}];
|
|
2164
|
-
function
|
|
2294
|
+
function St(e, t, n, r) {
|
|
2165
2295
|
return {
|
|
2166
2296
|
key: e,
|
|
2167
2297
|
label: t,
|
|
2168
2298
|
type: "custom",
|
|
2169
|
-
render: (i, a, o) => /* @__PURE__ */
|
|
2299
|
+
render: (i, a, o) => /* @__PURE__ */ Y(b, {
|
|
2170
2300
|
label: t,
|
|
2171
|
-
children: /* @__PURE__ */
|
|
2301
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2172
2302
|
"data-testid": `config-field-${e}`,
|
|
2173
|
-
children: /* @__PURE__ */
|
|
2303
|
+
children: /* @__PURE__ */ Y(v, {
|
|
2174
2304
|
options: r ?? [],
|
|
2175
2305
|
value: i ?? "",
|
|
2176
2306
|
onValueChange: a,
|
|
@@ -2184,16 +2314,16 @@ function rt(e, t, n, r) {
|
|
|
2184
2314
|
})
|
|
2185
2315
|
};
|
|
2186
2316
|
}
|
|
2187
|
-
function
|
|
2317
|
+
function Ct(e, t, n) {
|
|
2188
2318
|
let r = e && e.length > 0, i = r ? {
|
|
2189
2319
|
key: "object",
|
|
2190
2320
|
label: "Data source",
|
|
2191
2321
|
type: "custom",
|
|
2192
|
-
render: (t, n) => /* @__PURE__ */
|
|
2322
|
+
render: (t, n) => /* @__PURE__ */ Y(b, {
|
|
2193
2323
|
label: "Data source",
|
|
2194
|
-
children: /* @__PURE__ */
|
|
2324
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2195
2325
|
"data-testid": "config-field-object",
|
|
2196
|
-
children: /* @__PURE__ */
|
|
2326
|
+
children: /* @__PURE__ */ Y(v, {
|
|
2197
2327
|
options: e,
|
|
2198
2328
|
value: t ?? "",
|
|
2199
2329
|
onValueChange: n,
|
|
@@ -2210,38 +2340,38 @@ function it(e, t, n) {
|
|
|
2210
2340
|
type: "input",
|
|
2211
2341
|
placeholder: "Object name"
|
|
2212
2342
|
}, a = r ? {
|
|
2213
|
-
...
|
|
2343
|
+
...St("categoryField", "Category field", "Select field…", t),
|
|
2214
2344
|
helpText: "Group records by this field (one bar/slice/segment per value).",
|
|
2215
|
-
visibleWhen: (e) =>
|
|
2345
|
+
visibleWhen: (e) => gt(e.type)
|
|
2216
2346
|
} : {
|
|
2217
2347
|
key: "categoryField",
|
|
2218
2348
|
label: "Category field",
|
|
2219
2349
|
type: "input",
|
|
2220
2350
|
placeholder: "e.g. status",
|
|
2221
2351
|
helpText: "Group records by this field (one bar/slice/segment per value).",
|
|
2222
|
-
visibleWhen: (e) =>
|
|
2352
|
+
visibleWhen: (e) => gt(e.type)
|
|
2223
2353
|
}, o = r ? {
|
|
2224
|
-
...
|
|
2354
|
+
...St("valueField", "Value field", "Select field…", t),
|
|
2225
2355
|
helpText: "Field to aggregate (sum / average / min / max).",
|
|
2226
|
-
visibleWhen: (e) =>
|
|
2356
|
+
visibleWhen: (e) => _t(e.type) && (e.aggregate ?? "count") !== "count"
|
|
2227
2357
|
} : {
|
|
2228
2358
|
key: "valueField",
|
|
2229
2359
|
label: "Value field",
|
|
2230
2360
|
type: "input",
|
|
2231
2361
|
placeholder: "e.g. amount",
|
|
2232
2362
|
helpText: "Field to aggregate (sum / average / min / max).",
|
|
2233
|
-
visibleWhen: (e) =>
|
|
2234
|
-
}, s = r ?
|
|
2363
|
+
visibleWhen: (e) => _t(e.type) && (e.aggregate ?? "count") !== "count"
|
|
2364
|
+
}, s = r ? St("rowField", "Field", "Select row field…", t) : {
|
|
2235
2365
|
key: "rowField",
|
|
2236
2366
|
label: "Field",
|
|
2237
2367
|
type: "input",
|
|
2238
2368
|
placeholder: "e.g. owner"
|
|
2239
|
-
}, c = r ?
|
|
2369
|
+
}, c = r ? St("columnField", "Field", "Select column field…", t) : {
|
|
2240
2370
|
key: "columnField",
|
|
2241
2371
|
label: "Field",
|
|
2242
2372
|
type: "input",
|
|
2243
2373
|
placeholder: "e.g. stage"
|
|
2244
|
-
}, l = r ?
|
|
2374
|
+
}, l = r ? St("valueField", "Field", "Select value field…", t) : {
|
|
2245
2375
|
key: "valueField",
|
|
2246
2376
|
label: "Field",
|
|
2247
2377
|
type: "input",
|
|
@@ -2251,7 +2381,7 @@ function it(e, t, n) {
|
|
|
2251
2381
|
breadcrumb: ["Dashboard", {
|
|
2252
2382
|
pivot: "Pivot table",
|
|
2253
2383
|
table: "Table"
|
|
2254
|
-
}[n ?? ""] ?? (
|
|
2384
|
+
}[n ?? ""] ?? (mt(n) ? "Chart" : "Widget")],
|
|
2255
2385
|
sections: [
|
|
2256
2386
|
{
|
|
2257
2387
|
key: "general",
|
|
@@ -2273,7 +2403,7 @@ function it(e, t, n) {
|
|
|
2273
2403
|
key: "type",
|
|
2274
2404
|
label: "Widget type",
|
|
2275
2405
|
type: "select",
|
|
2276
|
-
options:
|
|
2406
|
+
options: at,
|
|
2277
2407
|
defaultValue: "metric"
|
|
2278
2408
|
}
|
|
2279
2409
|
]
|
|
@@ -2291,10 +2421,10 @@ function it(e, t, n) {
|
|
|
2291
2421
|
key: "aggregate",
|
|
2292
2422
|
label: "Aggregation",
|
|
2293
2423
|
type: "select",
|
|
2294
|
-
options:
|
|
2424
|
+
options: st,
|
|
2295
2425
|
defaultValue: "count",
|
|
2296
2426
|
helpText: "Count ignores Value field; Sum / Avg / Min / Max require it.",
|
|
2297
|
-
visibleWhen: (e) =>
|
|
2427
|
+
visibleWhen: (e) => _t(e.type)
|
|
2298
2428
|
}
|
|
2299
2429
|
]
|
|
2300
2430
|
},
|
|
@@ -2316,14 +2446,14 @@ function it(e, t, n) {
|
|
|
2316
2446
|
key: "rowSortBy",
|
|
2317
2447
|
label: "Sort by",
|
|
2318
2448
|
type: "icon-group",
|
|
2319
|
-
options:
|
|
2449
|
+
options: bt,
|
|
2320
2450
|
defaultValue: "group"
|
|
2321
2451
|
},
|
|
2322
2452
|
{
|
|
2323
2453
|
key: "rowSortOrder",
|
|
2324
2454
|
label: "Sort order",
|
|
2325
2455
|
type: "icon-group",
|
|
2326
|
-
options:
|
|
2456
|
+
options: xt,
|
|
2327
2457
|
defaultValue: "asc"
|
|
2328
2458
|
},
|
|
2329
2459
|
{
|
|
@@ -2351,14 +2481,14 @@ function it(e, t, n) {
|
|
|
2351
2481
|
key: "columnSortBy",
|
|
2352
2482
|
label: "Sort by",
|
|
2353
2483
|
type: "icon-group",
|
|
2354
|
-
options:
|
|
2484
|
+
options: bt,
|
|
2355
2485
|
defaultValue: "group"
|
|
2356
2486
|
},
|
|
2357
2487
|
{
|
|
2358
2488
|
key: "columnSortOrder",
|
|
2359
2489
|
label: "Sort order",
|
|
2360
2490
|
type: "icon-group",
|
|
2361
|
-
options:
|
|
2491
|
+
options: xt,
|
|
2362
2492
|
defaultValue: "asc"
|
|
2363
2493
|
},
|
|
2364
2494
|
{
|
|
@@ -2386,7 +2516,7 @@ function it(e, t, n) {
|
|
|
2386
2516
|
key: "aggregation",
|
|
2387
2517
|
label: "Aggregation",
|
|
2388
2518
|
type: "select",
|
|
2389
|
-
options:
|
|
2519
|
+
options: st,
|
|
2390
2520
|
defaultValue: "sum"
|
|
2391
2521
|
},
|
|
2392
2522
|
{
|
|
@@ -2401,7 +2531,7 @@ function it(e, t, n) {
|
|
|
2401
2531
|
key: "chart-axis",
|
|
2402
2532
|
title: "Axis & Series",
|
|
2403
2533
|
collapsible: !0,
|
|
2404
|
-
visibleWhen: (e) =>
|
|
2534
|
+
visibleWhen: (e) => ht(e.type),
|
|
2405
2535
|
fields: [
|
|
2406
2536
|
{
|
|
2407
2537
|
key: "xAxisLabel",
|
|
@@ -2427,7 +2557,7 @@ function it(e, t, n) {
|
|
|
2427
2557
|
key: "chart-legend",
|
|
2428
2558
|
title: "Display",
|
|
2429
2559
|
collapsible: !0,
|
|
2430
|
-
visibleWhen: (e) => !!e.type &&
|
|
2560
|
+
visibleWhen: (e) => !!e.type && ut.includes(e.type),
|
|
2431
2561
|
fields: [{
|
|
2432
2562
|
key: "showLegend",
|
|
2433
2563
|
label: "Show legend",
|
|
@@ -2479,7 +2609,7 @@ function it(e, t, n) {
|
|
|
2479
2609
|
title: "Drill-down",
|
|
2480
2610
|
collapsible: !0,
|
|
2481
2611
|
defaultCollapsed: !0,
|
|
2482
|
-
visibleWhen: (e) =>
|
|
2612
|
+
visibleWhen: (e) => vt(e.type),
|
|
2483
2613
|
fields: [{
|
|
2484
2614
|
key: "drillDownEnabled",
|
|
2485
2615
|
label: "Enable drill-down",
|
|
@@ -2490,7 +2620,7 @@ function it(e, t, n) {
|
|
|
2490
2620
|
key: "drillDownTarget",
|
|
2491
2621
|
label: "Open in",
|
|
2492
2622
|
type: "select",
|
|
2493
|
-
options:
|
|
2623
|
+
options: yt,
|
|
2494
2624
|
defaultValue: "drawer",
|
|
2495
2625
|
visibleWhen: (e) => !!e.drillDownEnabled
|
|
2496
2626
|
}]
|
|
@@ -2516,14 +2646,14 @@ function it(e, t, n) {
|
|
|
2516
2646
|
key: "colorVariant",
|
|
2517
2647
|
label: "Color variant",
|
|
2518
2648
|
type: "select",
|
|
2519
|
-
options:
|
|
2649
|
+
options: ot,
|
|
2520
2650
|
defaultValue: "default"
|
|
2521
2651
|
}]
|
|
2522
2652
|
}
|
|
2523
2653
|
]
|
|
2524
2654
|
};
|
|
2525
2655
|
}
|
|
2526
|
-
function
|
|
2656
|
+
function wt(e) {
|
|
2527
2657
|
if (e == null) return "";
|
|
2528
2658
|
if (typeof e == "string") return e;
|
|
2529
2659
|
if (typeof e == "object") {
|
|
@@ -2532,20 +2662,20 @@ function at(e) {
|
|
|
2532
2662
|
}
|
|
2533
2663
|
return String(e);
|
|
2534
2664
|
}
|
|
2535
|
-
function
|
|
2665
|
+
function Tt(e) {
|
|
2536
2666
|
let t = e.type, n = { ...e };
|
|
2537
|
-
return
|
|
2667
|
+
return gt(t) || delete n.categoryField, _t(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), ht(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), vt(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
|
|
2538
2668
|
}
|
|
2539
|
-
function
|
|
2669
|
+
function Et({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
|
|
2540
2670
|
let { draft: c, isDirty: l, updateField: u, discard: d } = M(N.useMemo(() => ({
|
|
2541
2671
|
...n,
|
|
2542
|
-
title: typeof n.title == "object" ?
|
|
2543
|
-
description: typeof n.description == "object" ?
|
|
2672
|
+
title: typeof n.title == "object" ? wt(n.title) : n.title,
|
|
2673
|
+
description: typeof n.description == "object" ? wt(n.description) : n.description
|
|
2544
2674
|
}), [n]), { onUpdate: i });
|
|
2545
|
-
return /* @__PURE__ */
|
|
2675
|
+
return /* @__PURE__ */ Y(y, {
|
|
2546
2676
|
open: e,
|
|
2547
2677
|
onClose: t,
|
|
2548
|
-
schema: N.useMemo(() =>
|
|
2678
|
+
schema: N.useMemo(() => Ct(o, s, c.type), [
|
|
2549
2679
|
o,
|
|
2550
2680
|
s,
|
|
2551
2681
|
c.type
|
|
@@ -2553,15 +2683,15 @@ function st({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
|
|
|
2553
2683
|
draft: c,
|
|
2554
2684
|
isDirty: l,
|
|
2555
2685
|
onFieldChange: u,
|
|
2556
|
-
onSave: () => r(
|
|
2686
|
+
onSave: () => r(Tt(c)),
|
|
2557
2687
|
onDiscard: d,
|
|
2558
2688
|
headerExtra: a
|
|
2559
2689
|
});
|
|
2560
2690
|
}
|
|
2561
2691
|
//#endregion
|
|
2562
2692
|
//#region src/DashboardWithConfig.tsx
|
|
2563
|
-
function
|
|
2564
|
-
let [c, l] =
|
|
2693
|
+
function Dt({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
|
|
2694
|
+
let [c, l] = R(o), [u, d] = R(null), [f, m] = R(e), [h, g] = R(0);
|
|
2565
2695
|
I(() => {
|
|
2566
2696
|
m(e), g((e) => e + 1);
|
|
2567
2697
|
}, [e]);
|
|
@@ -2648,21 +2778,21 @@ function ct({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2648
2778
|
}, [u, r]), S = F(() => {
|
|
2649
2779
|
l((e) => !e), d(null);
|
|
2650
2780
|
}, []);
|
|
2651
|
-
return /* @__PURE__ */
|
|
2781
|
+
return /* @__PURE__ */ X("div", {
|
|
2652
2782
|
className: A("flex h-full w-full", s),
|
|
2653
2783
|
"data-testid": "dashboard-with-config",
|
|
2654
|
-
children: [/* @__PURE__ */
|
|
2784
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2655
2785
|
className: "flex-1 min-w-0 overflow-auto relative",
|
|
2656
|
-
children: [/* @__PURE__ */
|
|
2786
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2657
2787
|
className: "absolute top-2 right-2 z-10",
|
|
2658
|
-
children: /* @__PURE__ */
|
|
2788
|
+
children: /* @__PURE__ */ X(p, {
|
|
2659
2789
|
size: "sm",
|
|
2660
2790
|
variant: c ? "default" : "outline",
|
|
2661
2791
|
onClick: S,
|
|
2662
2792
|
"data-testid": "dashboard-config-toggle",
|
|
2663
|
-
children: [/* @__PURE__ */
|
|
2793
|
+
children: [/* @__PURE__ */ Y(G, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
|
|
2664
2794
|
})
|
|
2665
|
-
}), /* @__PURE__ */
|
|
2795
|
+
}), /* @__PURE__ */ Y($, {
|
|
2666
2796
|
schema: f,
|
|
2667
2797
|
onRefresh: i,
|
|
2668
2798
|
recordCount: a,
|
|
@@ -2670,15 +2800,15 @@ function ct({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2670
2800
|
selectedWidgetId: u,
|
|
2671
2801
|
onWidgetClick: v
|
|
2672
2802
|
})]
|
|
2673
|
-
}), c && /* @__PURE__ */
|
|
2803
|
+
}), c && /* @__PURE__ */ Y("div", {
|
|
2674
2804
|
className: "relative shrink-0",
|
|
2675
|
-
children: u && _ ? /* @__PURE__ */
|
|
2805
|
+
children: u && _ ? /* @__PURE__ */ Y(Et, {
|
|
2676
2806
|
open: !0,
|
|
2677
2807
|
onClose: y,
|
|
2678
2808
|
config: _,
|
|
2679
2809
|
onSave: x,
|
|
2680
2810
|
onFieldChange: b
|
|
2681
|
-
}) : /* @__PURE__ */
|
|
2811
|
+
}) : /* @__PURE__ */ Y(it, {
|
|
2682
2812
|
open: !0,
|
|
2683
2813
|
onClose: () => l(!1),
|
|
2684
2814
|
config: t,
|
|
@@ -2687,7 +2817,7 @@ function ct({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
2687
2817
|
})]
|
|
2688
2818
|
});
|
|
2689
2819
|
}
|
|
2690
|
-
e.register("dashboard",
|
|
2820
|
+
e.register("dashboard", $, {
|
|
2691
2821
|
namespace: "view",
|
|
2692
2822
|
label: "Dashboard",
|
|
2693
2823
|
category: "Complex",
|
|
@@ -2715,7 +2845,7 @@ e.register("dashboard", ge, {
|
|
|
2715
2845
|
columns: 3,
|
|
2716
2846
|
widgets: []
|
|
2717
2847
|
}
|
|
2718
|
-
}), e.register("metric",
|
|
2848
|
+
}), e.register("metric", Ve, {
|
|
2719
2849
|
namespace: "plugin-dashboard",
|
|
2720
2850
|
label: "Metric Widget",
|
|
2721
2851
|
category: "Dashboard",
|
|
@@ -2728,7 +2858,7 @@ e.register("dashboard", ge, {
|
|
|
2728
2858
|
type: "string",
|
|
2729
2859
|
label: "Value"
|
|
2730
2860
|
}]
|
|
2731
|
-
}), e.register("metric-card",
|
|
2861
|
+
}), e.register("metric-card", Ue, {
|
|
2732
2862
|
namespace: "plugin-dashboard",
|
|
2733
2863
|
label: "Metric Card",
|
|
2734
2864
|
category: "Dashboard",
|
|
@@ -2783,7 +2913,7 @@ e.register("dashboard", ge, {
|
|
|
2783
2913
|
title: "Metric",
|
|
2784
2914
|
value: "0"
|
|
2785
2915
|
}
|
|
2786
|
-
}), e.register("object-metric",
|
|
2916
|
+
}), e.register("object-metric", We, {
|
|
2787
2917
|
namespace: "plugin-dashboard",
|
|
2788
2918
|
label: "Object Metric",
|
|
2789
2919
|
category: "Dashboard",
|
|
@@ -2812,7 +2942,7 @@ e.register("dashboard", ge, {
|
|
|
2812
2942
|
}
|
|
2813
2943
|
],
|
|
2814
2944
|
defaultProps: { label: "Metric" }
|
|
2815
|
-
}), e.register("pivot",
|
|
2945
|
+
}), e.register("pivot", Ze, {
|
|
2816
2946
|
namespace: "plugin-dashboard",
|
|
2817
2947
|
label: "Pivot Table",
|
|
2818
2948
|
category: "Dashboard",
|
|
@@ -2891,7 +3021,7 @@ e.register("dashboard", ge, {
|
|
|
2891
3021
|
aggregation: "sum",
|
|
2892
3022
|
data: []
|
|
2893
3023
|
}
|
|
2894
|
-
}), e.register("object-pivot",
|
|
3024
|
+
}), e.register("object-pivot", nt, {
|
|
2895
3025
|
namespace: "plugin-dashboard",
|
|
2896
3026
|
label: "Object Pivot Table",
|
|
2897
3027
|
category: "Dashboard",
|
|
@@ -2980,35 +3110,25 @@ e.register("dashboard", ge, {
|
|
|
2980
3110
|
valueField: "",
|
|
2981
3111
|
aggregation: "sum"
|
|
2982
3112
|
}
|
|
2983
|
-
}), e.register("dashboard-grid",
|
|
3113
|
+
}), e.register("dashboard-grid", Fe, {
|
|
2984
3114
|
namespace: "plugin-dashboard",
|
|
2985
3115
|
label: "Dashboard Grid (Editable)",
|
|
2986
3116
|
category: "Complex",
|
|
2987
3117
|
icon: "layout-grid",
|
|
2988
|
-
inputs: [
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
label: "Layout Storage Key",
|
|
2998
|
-
defaultValue: "dashboard-layout"
|
|
2999
|
-
},
|
|
3000
|
-
{
|
|
3001
|
-
name: "className",
|
|
3002
|
-
type: "string",
|
|
3003
|
-
label: "CSS Class"
|
|
3004
|
-
}
|
|
3005
|
-
],
|
|
3118
|
+
inputs: [{
|
|
3119
|
+
name: "title",
|
|
3120
|
+
type: "string",
|
|
3121
|
+
label: "Title"
|
|
3122
|
+
}, {
|
|
3123
|
+
name: "className",
|
|
3124
|
+
type: "string",
|
|
3125
|
+
label: "CSS Class"
|
|
3126
|
+
}],
|
|
3006
3127
|
defaultProps: {
|
|
3007
3128
|
title: "Dashboard",
|
|
3008
|
-
widgets: []
|
|
3009
|
-
persistLayoutKey: "dashboard-layout"
|
|
3129
|
+
widgets: []
|
|
3010
3130
|
}
|
|
3011
|
-
}), e.register("object-data-table",
|
|
3131
|
+
}), e.register("object-data-table", et, {
|
|
3012
3132
|
namespace: "plugin-dashboard",
|
|
3013
3133
|
label: "Object Data Table",
|
|
3014
3134
|
category: "Dashboard",
|
|
@@ -3046,18 +3166,18 @@ e.register("dashboard", ge, {
|
|
|
3046
3166
|
pagination: !1
|
|
3047
3167
|
}
|
|
3048
3168
|
});
|
|
3049
|
-
var
|
|
3050
|
-
DashboardRenderer:
|
|
3051
|
-
DashboardGridLayout:
|
|
3052
|
-
MetricWidget:
|
|
3053
|
-
MetricCard:
|
|
3054
|
-
ObjectMetricWidget:
|
|
3055
|
-
PivotTable:
|
|
3056
|
-
ObjectPivotTable:
|
|
3057
|
-
ObjectDataTable:
|
|
3058
|
-
DashboardConfigPanel:
|
|
3059
|
-
WidgetConfigPanel:
|
|
3060
|
-
DashboardWithConfig:
|
|
3169
|
+
var Ot = {
|
|
3170
|
+
DashboardRenderer: $,
|
|
3171
|
+
DashboardGridLayout: Fe,
|
|
3172
|
+
MetricWidget: Ve,
|
|
3173
|
+
MetricCard: Ue,
|
|
3174
|
+
ObjectMetricWidget: We,
|
|
3175
|
+
PivotTable: Ze,
|
|
3176
|
+
ObjectPivotTable: nt,
|
|
3177
|
+
ObjectDataTable: et,
|
|
3178
|
+
DashboardConfigPanel: it,
|
|
3179
|
+
WidgetConfigPanel: Et,
|
|
3180
|
+
DashboardWithConfig: Dt
|
|
3061
3181
|
};
|
|
3062
3182
|
//#endregion
|
|
3063
|
-
export {
|
|
3183
|
+
export { it as DashboardConfigPanel, Fe as DashboardGridLayout, $ as DashboardRenderer, Dt as DashboardWithConfig, tt as DrillDownDrawer, Ue as MetricCard, Ve as MetricWidget, et as ObjectDataTable, We as ObjectMetricWidget, nt as ObjectPivotTable, Ze as PivotTable, Et as WidgetConfigPanel, Ot as dashboardComponents };
|