@object-ui/plugin-dashboard 16.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +161 -0
- package/dist/DashboardGridLayout.d.ts.map +1 -1
- package/dist/DashboardRenderer.d.ts.map +1 -1
- package/dist/DashboardWithConfig.d.ts +11 -1
- package/dist/DashboardWithConfig.d.ts.map +1 -1
- package/dist/DatasetWidget.d.ts.map +1 -1
- package/dist/MetricCard.d.ts.map +1 -1
- package/dist/MetricWidget.d.ts.map +1 -1
- package/dist/ObjectDataTable.d.ts.map +1 -1
- package/dist/PivotTable.d.ts.map +1 -1
- package/dist/WidgetConfigPanel.d.ts +12 -9
- package/dist/WidgetConfigPanel.d.ts.map +1 -1
- package/dist/dataset-catalog.d.ts +46 -0
- package/dist/dataset-catalog.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +943 -1335
- package/dist/index.umd.cjs +2 -2
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { ComponentRegistry as e, DATE_RANGE_PRESETS as t, buildChartSeries as n, buildDatasetDrillFilter as r, buildDatasetFieldHelpers as i, buildDimensionLabelMap as a, buildOptionColorMap as o, buildWidgetScopedFilter as s, compareToTrendLabelKey as c, computeDrillFilter as l, dashboardFilterVariableDefs as u, extractRecords as d, findChartSeriesRow as f, formatDimensionValue as p, formatMeasure as m, isDrillEnabled as h, mergeFilters as g, relabelDimensions as _, resolveDashboardFilterDefs as v, resolveDateMacros as y, resolveDrillTitle as b, shiftFilterByCompareTo as x } from "@object-ui/core";
|
|
2
2
|
import { PageVariablesProvider as S, SchemaRenderer as C, SchemaRendererContext as w, useActionEngine as T, useDataScope as E, useDnd as D, useDrillNavigation as O, useHasDndProvider as k, useObjectLabel as A, usePageVariables as j } from "@object-ui/react";
|
|
3
3
|
import { createSafeTranslation as M, resolveFieldCurrency as ee, useLocalization as te, useObjectTranslation as N, useSafeFieldLabel as ne, useSafeTranslate as P } from "@object-ui/i18n";
|
|
4
|
-
import { Button as F, Calendar as
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
7
|
-
import { AlertCircle as
|
|
8
|
-
import { DndContext as
|
|
9
|
-
import { SortableContext as
|
|
10
|
-
import { CSS as
|
|
11
|
-
import { formatCurrency as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
import { ResponsiveGridLayout as
|
|
4
|
+
import { Button as F, Calendar as I, Card as L, CardContent as re, CardHeader as ie, CardTitle as ae, ChartSkeleton as R, Combobox as z, ConfigPanelRenderer as oe, ConfigRow as se, DataEmptyState as ce, Dialog as le, DialogContent as ue, DialogHeader as B, DialogTitle as de, GridSkeleton as V, Input as fe, Popover as pe, PopoverContent as me, PopoverTrigger as he, RefreshIndicator as H, Select as U, SelectContent as ge, SelectItem as W, SelectTrigger as _e, SelectValue as ve, Sheet as ye, SheetContent as be, SheetHeader as xe, SheetTitle as Se, Skeleton as G, cn as K, getLazyIcon as Ce, useConfigDraft as we } from "@object-ui/components";
|
|
5
|
+
import * as q from "react";
|
|
6
|
+
import Te, { Fragment as Ee, forwardRef as De, useCallback as J, useContext as Oe, useEffect as Y, useMemo as X, useRef as ke, useState as Z } from "react";
|
|
7
|
+
import { AlertCircle as Ae, AlertTriangle as je, ArrowDownIcon as Me, ArrowUpIcon as Ne, ArrowUpRight as Pe, BarChart3 as Fe, CalendarIcon as Ie, Download as Le, Edit as Re, GripVertical as ze, Loader2 as Be, MinusIcon as Ve, RefreshCw as He, RotateCcw as Ue, Save as We, Settings as Ge, X as Ke } from "lucide-react";
|
|
8
|
+
import { DndContext as qe, PointerSensor as Je, closestCenter as Ye, useSensor as Xe, useSensors as Ze } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as Qe, arrayMove as $e, rectSortingStrategy as et, useSortable as tt, verticalListSortingStrategy as nt } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as rt } from "@dnd-kit/utilities";
|
|
11
|
+
import { formatCurrency as it, formatDate as at, formatPercent as ot, getCellRenderer as st, resolveCellRendererType as ct } from "@object-ui/fields";
|
|
12
|
+
import { Fragment as lt, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
13
|
+
import { ResponsiveGridLayout as ut, useContainerWidth as dt } from "react-grid-layout";
|
|
14
14
|
import "react-grid-layout/css/styles.css";
|
|
15
15
|
//#region src/utils.ts
|
|
16
|
-
function
|
|
16
|
+
function ft(e) {
|
|
17
17
|
return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
|
|
18
18
|
}
|
|
19
19
|
function pt(e, t) {
|
|
@@ -102,7 +102,7 @@ function yt(e) {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
function bt(e) {
|
|
105
|
-
return _t.has(e.type) || typeof e.format == "string" && /^[
|
|
105
|
+
return _t.has(e.type) || typeof e.format == "string" && /^[$¥€£]|%$|0/.test(e.format);
|
|
106
106
|
}
|
|
107
107
|
function xt(e, t, n) {
|
|
108
108
|
if (e == null || e === "") return "";
|
|
@@ -114,13 +114,13 @@ function xt(e, t, n) {
|
|
|
114
114
|
"€": "EUR",
|
|
115
115
|
"£": "GBP"
|
|
116
116
|
}[r[0]];
|
|
117
|
-
return
|
|
117
|
+
return it(e, t.currency || i || n);
|
|
118
118
|
}
|
|
119
119
|
if (typeof r == "string" && /%/.test(r) && typeof e == "number") {
|
|
120
|
-
let t = (r.match(/0\.(0+)%/) || [, ""])[1].length;
|
|
121
|
-
return
|
|
120
|
+
let t = (r.match(/0\.(0+)%/) || [void 0, ""])[1].length;
|
|
121
|
+
return ot((e > 1 ? e / 100 : e) * 100, t);
|
|
122
122
|
}
|
|
123
|
-
return typeof r == "string" && /[YMDHms]/.test(r) ?
|
|
123
|
+
return typeof r == "string" && /[YMDHms]/.test(r) ? at(e, r) : /* @__PURE__ */ Q(st(ct(t)), {
|
|
124
124
|
value: e,
|
|
125
125
|
field: t
|
|
126
126
|
});
|
|
@@ -145,7 +145,7 @@ function Ct(e, t) {
|
|
|
145
145
|
return n == null ? "Record" : String(n);
|
|
146
146
|
}
|
|
147
147
|
var wt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
|
|
148
|
-
let { fieldLabel: s, fieldOptionLabel: c } = ne(), { currency: l } = te(), u =
|
|
148
|
+
let { fieldLabel: s, fieldOptionLabel: c } = ne(), { currency: l } = te(), u = X(() => {
|
|
149
149
|
if (!e) return [];
|
|
150
150
|
let i = vt(n), a;
|
|
151
151
|
return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !ht(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !ht(e)), a.map((n) => {
|
|
@@ -173,40 +173,40 @@ var wt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
|
|
|
173
173
|
l
|
|
174
174
|
]);
|
|
175
175
|
if (!e) return null;
|
|
176
|
-
let d = Ct(e, i), f = /* @__PURE__ */
|
|
176
|
+
let d = Ct(e, i), f = /* @__PURE__ */ Q("dl", {
|
|
177
177
|
className: "divide-y divide-border/60",
|
|
178
178
|
"data-testid": "record-detail-body",
|
|
179
|
-
children: u.map((e) => /* @__PURE__ */
|
|
179
|
+
children: u.map((e) => /* @__PURE__ */ $("div", {
|
|
180
180
|
className: "grid grid-cols-3 gap-3 py-2.5",
|
|
181
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ Q("dt", {
|
|
182
182
|
className: "text-xs font-medium text-muted-foreground self-center",
|
|
183
183
|
children: e.label
|
|
184
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ Q("dd", {
|
|
185
185
|
className: `col-span-2 text-sm break-words ${e.numeric ? "tabular-nums" : ""}`,
|
|
186
|
-
children: e.node === "" || e.node == null ? /* @__PURE__ */
|
|
186
|
+
children: e.node === "" || e.node == null ? /* @__PURE__ */ Q("span", {
|
|
187
187
|
className: "text-muted-foreground/60",
|
|
188
188
|
children: "—"
|
|
189
189
|
}) : e.node
|
|
190
190
|
})]
|
|
191
191
|
}, e.key))
|
|
192
192
|
});
|
|
193
|
-
return a === "dialog" ? /* @__PURE__ */
|
|
193
|
+
return a === "dialog" ? /* @__PURE__ */ Q(le, {
|
|
194
194
|
open: !0,
|
|
195
195
|
onOpenChange: (e) => !e && o(),
|
|
196
|
-
children: /* @__PURE__ */
|
|
196
|
+
children: /* @__PURE__ */ $(ue, {
|
|
197
197
|
className: "max-w-2xl",
|
|
198
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ Q(B, { children: /* @__PURE__ */ Q(de, { children: d }) }), /* @__PURE__ */ Q("div", {
|
|
199
199
|
className: "max-h-[70vh] overflow-auto",
|
|
200
200
|
children: f
|
|
201
201
|
})]
|
|
202
202
|
})
|
|
203
|
-
}) : /* @__PURE__ */
|
|
203
|
+
}) : /* @__PURE__ */ Q(ye, {
|
|
204
204
|
open: !0,
|
|
205
205
|
onOpenChange: (e) => !e && o(),
|
|
206
|
-
children: /* @__PURE__ */
|
|
206
|
+
children: /* @__PURE__ */ $(be, {
|
|
207
207
|
side: "right",
|
|
208
208
|
className: "w-full sm:max-w-md md:max-w-lg flex flex-col",
|
|
209
|
-
children: [/* @__PURE__ */
|
|
209
|
+
children: [/* @__PURE__ */ Q(xe, { children: /* @__PURE__ */ Q(Se, { children: d }) }), /* @__PURE__ */ Q("div", {
|
|
210
210
|
className: "flex-1 overflow-auto mt-2 pr-1",
|
|
211
211
|
children: f
|
|
212
212
|
})]
|
|
@@ -240,37 +240,34 @@ function Et(e, t) {
|
|
|
240
240
|
return Array.from(a);
|
|
241
241
|
}
|
|
242
242
|
var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
243
|
-
let { currency: r } = te(), i =
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
} catch {}
|
|
250
|
-
let [f, p] = X([]), [m, g] = X(null), [_, v] = X(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [b, x] = X(null), S = e.drillDown, T = h(S) && (S?.mode ?? "record") === "record", [D, O] = X(null), k = q((e) => {
|
|
251
|
-
O(e ?? null);
|
|
243
|
+
let { currency: r } = te(), i = Oe(w), a = t || i?.dataSource, o = E(e.bind), { fieldLabel: s, fieldOptionLabel: c } = ne(), l = "No data available", u = "No data source available for", { t: f } = N(), p = f("dashboard.noDataAvailable");
|
|
244
|
+
p && p !== "dashboard.noDataAvailable" && (l = p);
|
|
245
|
+
let m = f("dashboard.noDataSourceFor");
|
|
246
|
+
m && m !== "dashboard.noDataSourceFor" && (u = m);
|
|
247
|
+
let [g, _] = Z([]), [v, b] = Z(null), [x, S] = Z(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [T, D] = Z(null), O = e.drillDown, k = h(O) && (O?.mode ?? "record") === "record", [A, j] = Z(null), M = J((e) => {
|
|
248
|
+
j(e ?? null);
|
|
252
249
|
}, []);
|
|
253
|
-
|
|
250
|
+
Y(() => {
|
|
254
251
|
let t = !0;
|
|
255
252
|
return e.objectName && !o && (!e.data || e.data.length === 0) ? (async () => {
|
|
256
253
|
if (!a || !e.objectName) {
|
|
257
|
-
t &&
|
|
254
|
+
t && S(!1);
|
|
258
255
|
return;
|
|
259
256
|
}
|
|
260
|
-
t && (
|
|
257
|
+
t && (S(!0), D(null));
|
|
261
258
|
try {
|
|
262
259
|
let n;
|
|
263
260
|
if (typeof a.find == "function") {
|
|
264
|
-
let t = Et(e,
|
|
261
|
+
let t = Et(e, v), r = { $filter: y(e.filter) };
|
|
265
262
|
t.length && (r.$expand = t), n = d(await a.find(e.objectName, r));
|
|
266
263
|
} else return;
|
|
267
|
-
t &&
|
|
264
|
+
t && _(n);
|
|
268
265
|
} catch (e) {
|
|
269
|
-
console.error("[ObjectDataTable] Fetch error:", e), t &&
|
|
266
|
+
console.error("[ObjectDataTable] Fetch error:", e), t && D(e instanceof Error ? e.message : "Failed to load data");
|
|
270
267
|
} finally {
|
|
271
|
-
t &&
|
|
268
|
+
t && S(!1);
|
|
272
269
|
}
|
|
273
|
-
})() : t &&
|
|
270
|
+
})() : t && S(!1), () => {
|
|
274
271
|
t = !1;
|
|
275
272
|
};
|
|
276
273
|
}, [
|
|
@@ -279,19 +276,19 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
279
276
|
o,
|
|
280
277
|
e.data,
|
|
281
278
|
e.filter,
|
|
282
|
-
|
|
283
|
-
]),
|
|
279
|
+
v
|
|
280
|
+
]), Y(() => {
|
|
284
281
|
let t = !0;
|
|
285
282
|
if (!(!a || !e.objectName || typeof a.getObjectSchema != "function")) return a.getObjectSchema(e.objectName).then((e) => {
|
|
286
|
-
t &&
|
|
283
|
+
t && b(e);
|
|
287
284
|
}).catch(() => {}), () => {
|
|
288
285
|
t = !1;
|
|
289
286
|
};
|
|
290
287
|
}, [e.objectName, a]);
|
|
291
|
-
let
|
|
288
|
+
let ee = o || e.data || g, P = Array.isArray(ee) ? ee : [], F = X(() => {
|
|
292
289
|
let t = e.objectName, n = {};
|
|
293
|
-
if (
|
|
294
|
-
let e =
|
|
290
|
+
if (v?.fields) {
|
|
291
|
+
let e = v.fields;
|
|
295
292
|
if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
|
|
296
293
|
else for (let [t, r] of Object.entries(e)) n[t] = {
|
|
297
294
|
name: t,
|
|
@@ -337,55 +334,55 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
337
334
|
header: s(t, e.accessorKey, e.header)
|
|
338
335
|
})) : n).map(a);
|
|
339
336
|
}
|
|
340
|
-
return
|
|
337
|
+
return P.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !ht(e, n[e])) : Object.keys(P[0]).filter((e) => !e.startsWith("_") && !ht(e))).map((e) => a({
|
|
341
338
|
header: i(e),
|
|
342
339
|
accessorKey: e
|
|
343
340
|
}));
|
|
344
341
|
}, [
|
|
345
342
|
e.columns,
|
|
346
343
|
e.objectName,
|
|
347
|
-
|
|
348
|
-
|
|
344
|
+
P,
|
|
345
|
+
v,
|
|
349
346
|
s,
|
|
350
347
|
c,
|
|
351
348
|
r
|
|
352
349
|
]);
|
|
353
|
-
if (
|
|
354
|
-
className:
|
|
350
|
+
if (x && P.length === 0) return /* @__PURE__ */ Q("div", {
|
|
351
|
+
className: K("overflow-auto", n),
|
|
355
352
|
"data-testid": "table-loading",
|
|
356
|
-
children: /* @__PURE__ */
|
|
353
|
+
children: /* @__PURE__ */ $("div", {
|
|
357
354
|
className: "space-y-2 p-2",
|
|
358
|
-
children: [/* @__PURE__ */
|
|
355
|
+
children: [/* @__PURE__ */ $("div", {
|
|
359
356
|
className: "flex gap-2",
|
|
360
357
|
children: [
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ Q(G, { className: "h-6 w-1/4" }),
|
|
359
|
+
/* @__PURE__ */ Q(G, { className: "h-6 w-1/4" }),
|
|
360
|
+
/* @__PURE__ */ Q(G, { className: "h-6 w-1/4" }),
|
|
361
|
+
/* @__PURE__ */ Q(G, { className: "h-6 w-1/4" })
|
|
365
362
|
]
|
|
366
363
|
}), [
|
|
367
364
|
1,
|
|
368
365
|
2,
|
|
369
366
|
3,
|
|
370
367
|
4
|
|
371
|
-
].map((e) => /* @__PURE__ */
|
|
368
|
+
].map((e) => /* @__PURE__ */ $("div", {
|
|
372
369
|
className: "flex gap-2",
|
|
373
370
|
children: [
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
371
|
+
/* @__PURE__ */ Q(G, { className: "h-5 w-1/4" }),
|
|
372
|
+
/* @__PURE__ */ Q(G, { className: "h-5 w-1/4" }),
|
|
373
|
+
/* @__PURE__ */ Q(G, { className: "h-5 w-1/4" }),
|
|
374
|
+
/* @__PURE__ */ Q(G, { className: "h-5 w-1/4" })
|
|
378
375
|
]
|
|
379
376
|
}, e))]
|
|
380
377
|
})
|
|
381
378
|
});
|
|
382
|
-
if (
|
|
383
|
-
className:
|
|
379
|
+
if (T) return /* @__PURE__ */ Q("div", {
|
|
380
|
+
className: K("overflow-auto", n),
|
|
384
381
|
"data-testid": "table-error",
|
|
385
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ $("div", {
|
|
386
383
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
387
384
|
"data-testid": "table-error-message",
|
|
388
|
-
children: [/* @__PURE__ */
|
|
385
|
+
children: [/* @__PURE__ */ $("svg", {
|
|
389
386
|
xmlns: "http://www.w3.org/2000/svg",
|
|
390
387
|
className: "h-8 w-8 mb-2 opacity-60",
|
|
391
388
|
viewBox: "0 0 24 24",
|
|
@@ -395,35 +392,35 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
395
392
|
strokeLinecap: "round",
|
|
396
393
|
strokeLinejoin: "round",
|
|
397
394
|
children: [
|
|
398
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ Q("circle", {
|
|
399
396
|
cx: "12",
|
|
400
397
|
cy: "12",
|
|
401
398
|
r: "10"
|
|
402
399
|
}),
|
|
403
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ Q("line", {
|
|
404
401
|
x1: "12",
|
|
405
402
|
y1: "8",
|
|
406
403
|
x2: "12",
|
|
407
404
|
y2: "12"
|
|
408
405
|
}),
|
|
409
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ Q("line", {
|
|
410
407
|
x1: "12",
|
|
411
408
|
y1: "16",
|
|
412
409
|
x2: "12.01",
|
|
413
410
|
y2: "16"
|
|
414
411
|
})
|
|
415
412
|
]
|
|
416
|
-
}), /* @__PURE__ */
|
|
413
|
+
}), /* @__PURE__ */ Q("p", {
|
|
417
414
|
className: "text-xs",
|
|
418
|
-
children:
|
|
415
|
+
children: T
|
|
419
416
|
})]
|
|
420
417
|
})
|
|
421
418
|
});
|
|
422
|
-
if (!a && e.objectName &&
|
|
423
|
-
className:
|
|
424
|
-
children: /* @__PURE__ */
|
|
419
|
+
if (!a && e.objectName && P.length === 0) return /* @__PURE__ */ Q("div", {
|
|
420
|
+
className: K("overflow-auto", n),
|
|
421
|
+
children: /* @__PURE__ */ Q("div", {
|
|
425
422
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
426
|
-
children: /* @__PURE__ */
|
|
423
|
+
children: /* @__PURE__ */ $("p", {
|
|
427
424
|
className: "text-xs",
|
|
428
425
|
children: [
|
|
429
426
|
u,
|
|
@@ -434,12 +431,12 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
434
431
|
})
|
|
435
432
|
})
|
|
436
433
|
});
|
|
437
|
-
if (
|
|
438
|
-
className:
|
|
434
|
+
if (P.length === 0) return /* @__PURE__ */ Q("div", {
|
|
435
|
+
className: K("overflow-auto", n),
|
|
439
436
|
"data-testid": "table-empty-state",
|
|
440
|
-
children: /* @__PURE__ */
|
|
437
|
+
children: /* @__PURE__ */ $("div", {
|
|
441
438
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
442
|
-
children: [/* @__PURE__ */
|
|
439
|
+
children: [/* @__PURE__ */ $("svg", {
|
|
443
440
|
xmlns: "http://www.w3.org/2000/svg",
|
|
444
441
|
className: "h-8 w-8 mb-2 opacity-40",
|
|
445
442
|
viewBox: "0 0 24 24",
|
|
@@ -449,7 +446,7 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
449
446
|
strokeLinecap: "round",
|
|
450
447
|
strokeLinejoin: "round",
|
|
451
448
|
children: [
|
|
452
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ Q("rect", {
|
|
453
450
|
x: "3",
|
|
454
451
|
y: "3",
|
|
455
452
|
width: "18",
|
|
@@ -457,54 +454,54 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
457
454
|
rx: "2",
|
|
458
455
|
ry: "2"
|
|
459
456
|
}),
|
|
460
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ Q("line", {
|
|
461
458
|
x1: "3",
|
|
462
459
|
y1: "9",
|
|
463
460
|
x2: "21",
|
|
464
461
|
y2: "9"
|
|
465
462
|
}),
|
|
466
|
-
/* @__PURE__ */
|
|
463
|
+
/* @__PURE__ */ Q("line", {
|
|
467
464
|
x1: "9",
|
|
468
465
|
y1: "21",
|
|
469
466
|
x2: "9",
|
|
470
467
|
y2: "9"
|
|
471
468
|
})
|
|
472
469
|
]
|
|
473
|
-
}), /* @__PURE__ */
|
|
470
|
+
}), /* @__PURE__ */ Q("p", {
|
|
474
471
|
className: "text-xs",
|
|
475
472
|
children: l
|
|
476
473
|
})]
|
|
477
474
|
})
|
|
478
475
|
});
|
|
479
|
-
let
|
|
476
|
+
let I = {
|
|
480
477
|
...e,
|
|
481
478
|
type: "data-table",
|
|
482
|
-
data:
|
|
483
|
-
columns:
|
|
484
|
-
onRowClick: e.onRowClick ?? (
|
|
485
|
-
},
|
|
486
|
-
return /* @__PURE__ */
|
|
487
|
-
className:
|
|
479
|
+
data: P,
|
|
480
|
+
columns: F,
|
|
481
|
+
onRowClick: e.onRowClick ?? (k ? M : void 0)
|
|
482
|
+
}, L = O?.title && !O.title.includes("${") ? O.title : void 0;
|
|
483
|
+
return /* @__PURE__ */ $("div", {
|
|
484
|
+
className: K("relative", n),
|
|
488
485
|
children: [
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
schema:
|
|
486
|
+
/* @__PURE__ */ Q(H, { active: x && P.length > 0 }),
|
|
487
|
+
/* @__PURE__ */ Q(C, {
|
|
488
|
+
schema: I,
|
|
492
489
|
className: n
|
|
493
490
|
}),
|
|
494
|
-
|
|
495
|
-
record:
|
|
491
|
+
k && /* @__PURE__ */ Q(wt, {
|
|
492
|
+
record: A,
|
|
496
493
|
objectName: e.objectName,
|
|
497
|
-
objectSchema:
|
|
498
|
-
fields:
|
|
499
|
-
title:
|
|
500
|
-
target:
|
|
501
|
-
onClose: () =>
|
|
494
|
+
objectSchema: v,
|
|
495
|
+
fields: O?.columns,
|
|
496
|
+
title: L,
|
|
497
|
+
target: O?.target === "dialog" ? "dialog" : "drawer",
|
|
498
|
+
onClose: () => j(null)
|
|
502
499
|
})
|
|
503
500
|
]
|
|
504
501
|
});
|
|
505
502
|
}, Ot = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
|
|
506
503
|
let { openRecordList: i } = O(), a = P();
|
|
507
|
-
return !i || !e ? null : /* @__PURE__ */
|
|
504
|
+
return !i || !e ? null : /* @__PURE__ */ $(F, {
|
|
508
505
|
type: "button",
|
|
509
506
|
variant: "ghost",
|
|
510
507
|
size: "sm",
|
|
@@ -513,23 +510,23 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
513
510
|
onClick: () => {
|
|
514
511
|
i(e, t), n?.();
|
|
515
512
|
},
|
|
516
|
-
children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */
|
|
513
|
+
children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Q(Pe, { className: "ml-1 h-3.5 w-3.5" })]
|
|
517
514
|
});
|
|
518
515
|
}, kt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
|
|
519
516
|
let { openRecordList: d } = O(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
|
|
520
|
-
if (
|
|
517
|
+
if (Te.useEffect(() => {
|
|
521
518
|
e && p && (d(i, a), t());
|
|
522
519
|
}, [e, p]), p) return null;
|
|
523
|
-
let m = f ? null : /* @__PURE__ */
|
|
520
|
+
let m = f ? null : /* @__PURE__ */ Q(Ot, {
|
|
524
521
|
objectName: i,
|
|
525
522
|
filter: a,
|
|
526
523
|
onNavigate: t
|
|
527
|
-
}), h = /* @__PURE__ */
|
|
528
|
-
className:
|
|
524
|
+
}), h = /* @__PURE__ */ Q("div", {
|
|
525
|
+
className: K("overflow-auto", l),
|
|
529
526
|
"data-testid": "drill-down-body",
|
|
530
527
|
children: f ? (() => {
|
|
531
528
|
let e = u.filter, t = e ? a ? { $and: [e, a] } : e : a;
|
|
532
|
-
return /* @__PURE__ */
|
|
529
|
+
return /* @__PURE__ */ Q(C, { schema: {
|
|
533
530
|
...u,
|
|
534
531
|
type: "spec-report",
|
|
535
532
|
report: {
|
|
@@ -538,7 +535,7 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
538
535
|
},
|
|
539
536
|
filter: t
|
|
540
537
|
} });
|
|
541
|
-
})() : /* @__PURE__ */
|
|
538
|
+
})() : /* @__PURE__ */ Q(Dt, {
|
|
542
539
|
schema: {
|
|
543
540
|
type: "object-data-table",
|
|
544
541
|
objectName: i,
|
|
@@ -559,26 +556,26 @@ var Dt = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
559
556
|
dataSource: o
|
|
560
557
|
})
|
|
561
558
|
});
|
|
562
|
-
return r === "dialog" ? /* @__PURE__ */
|
|
559
|
+
return r === "dialog" ? /* @__PURE__ */ Q(le, {
|
|
563
560
|
open: e,
|
|
564
561
|
onOpenChange: (e) => !e && t(),
|
|
565
|
-
children: /* @__PURE__ */
|
|
562
|
+
children: /* @__PURE__ */ $(ue, {
|
|
566
563
|
className: "max-w-5xl",
|
|
567
|
-
children: [/* @__PURE__ */
|
|
564
|
+
children: [/* @__PURE__ */ $(B, {
|
|
568
565
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
569
|
-
children: [/* @__PURE__ */
|
|
566
|
+
children: [/* @__PURE__ */ Q(de, { children: n }), m]
|
|
570
567
|
}), h]
|
|
571
568
|
})
|
|
572
|
-
}) : /* @__PURE__ */
|
|
569
|
+
}) : /* @__PURE__ */ Q(ye, {
|
|
573
570
|
open: e,
|
|
574
571
|
onOpenChange: (e) => !e && t(),
|
|
575
|
-
children: /* @__PURE__ */
|
|
572
|
+
children: /* @__PURE__ */ $(be, {
|
|
576
573
|
side: "right",
|
|
577
574
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
578
|
-
children: [/* @__PURE__ */
|
|
575
|
+
children: [/* @__PURE__ */ $(xe, {
|
|
579
576
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
580
|
-
children: [/* @__PURE__ */
|
|
581
|
-
}), /* @__PURE__ */
|
|
577
|
+
children: [/* @__PURE__ */ Q(Se, { children: n }), m]
|
|
578
|
+
}), /* @__PURE__ */ Q("div", {
|
|
582
579
|
className: "flex-1 overflow-hidden mt-2",
|
|
583
580
|
children: h
|
|
584
581
|
})]
|
|
@@ -612,7 +609,7 @@ function Nt(e) {
|
|
|
612
609
|
}
|
|
613
610
|
function Pt(e, t) {
|
|
614
611
|
if (typeof document > "u") return;
|
|
615
|
-
let n = e && e.trim() ? e.trim() : "export", r = new Blob([
|
|
612
|
+
let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${Nt(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
616
613
|
a.href = i, a.download = n.endsWith(".csv") ? n : `${n}.csv`, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
|
|
617
614
|
}
|
|
618
615
|
var Ft = /* @__PURE__ */ new Set([
|
|
@@ -644,15 +641,15 @@ var Ft = /* @__PURE__ */ new Set([
|
|
|
644
641
|
sankey: "sankey"
|
|
645
642
|
};
|
|
646
643
|
function Lt({ widget: e, dataSource: t }) {
|
|
647
|
-
let r = String(e?.dataset ?? ""), s =
|
|
644
|
+
let r = String(e?.dataset ?? ""), s = X(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), c = X(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), l = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, u = String(e?.type ?? ""), d = Ft.has(u) || s.length === 0, h = u === "table" || u === "pivot", g = u === "pivot" && s.length >= 2, v = g ? s.slice(0, -1) : [], b = g ? s[s.length - 1] : "", x = g ? [
|
|
648
645
|
v,
|
|
649
646
|
[b],
|
|
650
647
|
[]
|
|
651
|
-
] : void 0, S = P(), { fieldLabel: w } = ne(), T = e?.filter, E =
|
|
648
|
+
] : void 0, S = P(), { fieldLabel: w } = ne(), T = e?.filter, E = X(() => T && typeof T == "object" && Object.keys(T).length > 0 ? y(T) : void 0, [T]), [D, O] = Z({
|
|
652
649
|
status: "idle",
|
|
653
650
|
rows: []
|
|
654
|
-
}), [k, A] =
|
|
655
|
-
if (
|
|
651
|
+
}), [k, A] = Z(null), [j, M] = Z(null), [ee, te] = Z(null);
|
|
652
|
+
if (Y(() => {
|
|
656
653
|
let e = t;
|
|
657
654
|
if (!e || typeof e.queryDataset != "function") {
|
|
658
655
|
O({
|
|
@@ -687,6 +684,7 @@ function Lt({ widget: e, dataSource: t }) {
|
|
|
687
684
|
object: e?.object,
|
|
688
685
|
dimensionFields: e?.dimensionFields,
|
|
689
686
|
drillRawRows: Array.isArray(e?.drillRawRows) ? e.drillRawRows : void 0,
|
|
687
|
+
drillRanges: Array.isArray(e?.drillRanges) ? e.drillRanges : void 0,
|
|
690
688
|
totals: Array.isArray(e?.totals) ? e.totals : void 0
|
|
691
689
|
});
|
|
692
690
|
}).catch((e) => {
|
|
@@ -698,7 +696,7 @@ function Lt({ widget: e, dataSource: t }) {
|
|
|
698
696
|
}), () => {
|
|
699
697
|
n = !0;
|
|
700
698
|
};
|
|
701
|
-
}, [`${u}|${r}|${s.join(",")}|${c.join(",")}|${JSON.stringify(T ?? null)}|${JSON.stringify(l ?? null)}`]),
|
|
699
|
+
}, [`${u}|${r}|${s.join(",")}|${c.join(",")}|${JSON.stringify(T ?? null)}|${JSON.stringify(l ?? null)}`]), Y(() => {
|
|
702
700
|
if (d || h) {
|
|
703
701
|
M(null), te(null);
|
|
704
702
|
return;
|
|
@@ -732,70 +730,70 @@ function Lt({ widget: e, dataSource: t }) {
|
|
|
732
730
|
s,
|
|
733
731
|
d,
|
|
734
732
|
h
|
|
735
|
-
]), c.length === 0) return /* @__PURE__ */
|
|
733
|
+
]), c.length === 0) return /* @__PURE__ */ Q("div", {
|
|
736
734
|
className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
|
|
737
735
|
children: S("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
|
|
738
736
|
});
|
|
739
|
-
if (D.status === "loading" || D.status === "idle") return /* @__PURE__ */
|
|
737
|
+
if (D.status === "loading" || D.status === "idle") return /* @__PURE__ */ $("div", {
|
|
740
738
|
className: "h-full w-full p-2",
|
|
741
739
|
"data-testid": "dataset-loading",
|
|
742
740
|
role: "status",
|
|
743
741
|
"aria-busy": "true",
|
|
744
742
|
"aria-live": "polite",
|
|
745
|
-
children: [/* @__PURE__ */
|
|
743
|
+
children: [/* @__PURE__ */ Q("span", {
|
|
746
744
|
className: "sr-only",
|
|
747
745
|
children: S("dashboard.loading", "Loading…")
|
|
748
|
-
}), d ? /* @__PURE__ */
|
|
746
|
+
}), d ? /* @__PURE__ */ $("div", {
|
|
749
747
|
className: "flex h-full w-full flex-col items-start justify-center gap-2 p-2",
|
|
750
|
-
children: [/* @__PURE__ */
|
|
751
|
-
}) : h ? /* @__PURE__ */
|
|
748
|
+
children: [/* @__PURE__ */ Q(G, { className: "h-8 w-32 rounded" }), /* @__PURE__ */ Q(G, { className: "h-3 w-20 rounded" })]
|
|
749
|
+
}) : h ? /* @__PURE__ */ Q(V, {
|
|
752
750
|
className: "h-full",
|
|
753
751
|
rows: 5,
|
|
754
752
|
columns: Math.max(2, s.length + c.length)
|
|
755
|
-
}) : /* @__PURE__ */
|
|
753
|
+
}) : /* @__PURE__ */ Q(R, { className: "h-full" })]
|
|
756
754
|
});
|
|
757
|
-
if (D.status === "error") return /* @__PURE__ */
|
|
755
|
+
if (D.status === "error") return /* @__PURE__ */ $("div", {
|
|
758
756
|
role: "alert",
|
|
759
757
|
className: "flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive",
|
|
760
|
-
children: [/* @__PURE__ */
|
|
758
|
+
children: [/* @__PURE__ */ Q(je, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
761
759
|
className: "break-words",
|
|
762
760
|
children: D.error
|
|
763
761
|
})]
|
|
764
762
|
});
|
|
765
|
-
if (D.rows.length === 0 && !d) return /* @__PURE__ */
|
|
763
|
+
if (D.rows.length === 0 && !d) return /* @__PURE__ */ $("div", {
|
|
766
764
|
className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
|
|
767
|
-
children: [/* @__PURE__ */
|
|
765
|
+
children: [/* @__PURE__ */ Q(Fe, { className: "mr-2 h-4 w-4" }), S("dashboard.noRows", "No rows")]
|
|
768
766
|
});
|
|
769
|
-
let { measureField: N, headerLabel: F } = i(D.fields, D.object, w), { object:
|
|
770
|
-
if (!
|
|
771
|
-
let r = At(
|
|
767
|
+
let { measureField: N, headerLabel: F } = i(D.fields, D.object, w), { object: I, dimensionFields: L, drillRawRows: re, drillRanges: ie } = D, ae = L ? s.filter((e) => e in L) : [], z = !!I && (ae.length > 0 || !!ie?.length), oe = (t, n) => {
|
|
768
|
+
if (!I) return;
|
|
769
|
+
let r = At(re?.[t], ae, L ?? {}, E, ie?.[t]);
|
|
772
770
|
A({
|
|
773
771
|
filter: r,
|
|
774
772
|
title: n || String(e?.title ?? "")
|
|
775
773
|
});
|
|
776
|
-
},
|
|
774
|
+
}, se = k && I ? /* @__PURE__ */ Q(kt, {
|
|
777
775
|
open: !0,
|
|
778
776
|
onClose: () => A(null),
|
|
779
777
|
title: k.title || String(e?.title ?? S("dashboard.details", "Details")),
|
|
780
|
-
objectName:
|
|
778
|
+
objectName: I,
|
|
781
779
|
filter: k.filter,
|
|
782
780
|
dataSource: t
|
|
783
781
|
}) : null;
|
|
784
782
|
if (d) {
|
|
785
783
|
let e = N(c[0]);
|
|
786
|
-
return /* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ $("div", {
|
|
787
785
|
className: "flex h-full w-full flex-col items-start justify-center gap-1 p-2",
|
|
788
|
-
children: [/* @__PURE__ */
|
|
786
|
+
children: [/* @__PURE__ */ Q("span", {
|
|
789
787
|
className: "text-2xl font-semibold tabular-nums",
|
|
790
788
|
children: m(D.rows[0]?.[c[0]] ?? 0, e?.format, e?.currency)
|
|
791
|
-
}), /* @__PURE__ */
|
|
789
|
+
}), /* @__PURE__ */ Q("span", {
|
|
792
790
|
className: "text-xs text-muted-foreground",
|
|
793
791
|
children: F(c[0])
|
|
794
792
|
})]
|
|
795
793
|
});
|
|
796
794
|
}
|
|
797
795
|
if (h) {
|
|
798
|
-
let t = [...s, ...c], n = /* @__PURE__ */
|
|
796
|
+
let t = [...s, ...c], n = /* @__PURE__ */ Q("button", {
|
|
799
797
|
type: "button",
|
|
800
798
|
onClick: () => Pt(String(e?.title ?? r ?? "export"), [t.map((e) => F(e)), ...D.rows.map((e) => t.map((t) => {
|
|
801
799
|
let n = e[t];
|
|
@@ -805,7 +803,7 @@ function Lt({ widget: e, dataSource: t }) {
|
|
|
805
803
|
title: S("dashboard.exportCsv", "Export CSV"),
|
|
806
804
|
"aria-label": S("dashboard.exportCsv", "Export CSV"),
|
|
807
805
|
className: "absolute right-1 top-1 z-10 rounded p-1 text-muted-foreground opacity-70 hover:bg-accent/50 hover:text-foreground hover:opacity-100",
|
|
808
|
-
children: /* @__PURE__ */
|
|
806
|
+
children: /* @__PURE__ */ Q(Le, { className: "h-3.5 w-3.5" })
|
|
809
807
|
});
|
|
810
808
|
if (g) {
|
|
811
809
|
let e = jt(D.rows, v, b), t = e.colHeaders.flatMap((e) => c.map((t) => ({
|
|
@@ -817,66 +815,66 @@ function Lt({ widget: e, dataSource: t }) {
|
|
|
817
815
|
let o = /* @__PURE__ */ new Map();
|
|
818
816
|
for (let e of i([b]) ?? []) o.set(String(e[b] ?? "∅"), e);
|
|
819
817
|
let s = i([])?.[0], l = a.size > 0, u = o.size > 0, d = S("dashboard.total", "Total");
|
|
820
|
-
return /* @__PURE__ */
|
|
818
|
+
return /* @__PURE__ */ $("div", {
|
|
821
819
|
className: "relative h-full w-full overflow-auto p-1",
|
|
822
820
|
"data-testid": "dataset-matrix",
|
|
823
821
|
children: [
|
|
824
822
|
n,
|
|
825
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ $("table", {
|
|
826
824
|
className: "w-full text-xs",
|
|
827
|
-
children: [/* @__PURE__ */
|
|
825
|
+
children: [/* @__PURE__ */ Q("thead", {
|
|
828
826
|
className: "bg-muted/40",
|
|
829
|
-
children: /* @__PURE__ */
|
|
830
|
-
v.map((e) => /* @__PURE__ */
|
|
827
|
+
children: /* @__PURE__ */ $("tr", { children: [
|
|
828
|
+
v.map((e) => /* @__PURE__ */ Q("th", {
|
|
831
829
|
className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
|
|
832
830
|
children: F(e)
|
|
833
831
|
}, e)),
|
|
834
|
-
t.map((e) => /* @__PURE__ */
|
|
832
|
+
t.map((e) => /* @__PURE__ */ Q("th", {
|
|
835
833
|
className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
|
|
836
834
|
children: e.header
|
|
837
835
|
}, `${e.col.id}-${e.measure}`)),
|
|
838
|
-
l && c.map((e) => /* @__PURE__ */
|
|
836
|
+
l && c.map((e) => /* @__PURE__ */ Q("th", {
|
|
839
837
|
className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
|
|
840
838
|
"data-testid": "matrix-total-col-header",
|
|
841
839
|
children: c.length === 1 ? d : `${d} · ${F(e)}`
|
|
842
840
|
}, `total-${e}`))
|
|
843
841
|
] })
|
|
844
|
-
}), /* @__PURE__ */
|
|
842
|
+
}), /* @__PURE__ */ $("tbody", { children: [e.rowHeaders.map((n) => /* @__PURE__ */ $("tr", {
|
|
845
843
|
className: "border-t",
|
|
846
844
|
children: [
|
|
847
|
-
n.labels.map((e, t) => /* @__PURE__ */
|
|
845
|
+
n.labels.map((e, t) => /* @__PURE__ */ Q("td", {
|
|
848
846
|
className: "px-2 py-1 whitespace-nowrap font-medium",
|
|
849
847
|
children: e
|
|
850
848
|
}, t)),
|
|
851
849
|
t.map((t) => {
|
|
852
|
-
let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : D.rows[i], o =
|
|
853
|
-
return /* @__PURE__ */
|
|
854
|
-
className:
|
|
850
|
+
let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : D.rows[i], o = z && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
|
|
851
|
+
return /* @__PURE__ */ Q("td", {
|
|
852
|
+
className: K("px-2 py-1 text-right tabular-nums whitespace-nowrap", o && "cursor-pointer hover:bg-accent/40"),
|
|
855
853
|
"data-testid": o ? "dataset-drill-cell" : void 0,
|
|
856
|
-
onClick: o ? () =>
|
|
854
|
+
onClick: o ? () => oe(i, s) : void 0,
|
|
857
855
|
children: a ? r(a[t.measure], t.measure) : "—"
|
|
858
856
|
}, `${t.col.id}-${t.measure}`);
|
|
859
857
|
}),
|
|
860
|
-
l && c.map((e) => /* @__PURE__ */
|
|
858
|
+
l && c.map((e) => /* @__PURE__ */ Q("td", {
|
|
861
859
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium",
|
|
862
860
|
"data-testid": "matrix-row-total",
|
|
863
861
|
children: r(a.get(n.id)?.[e], e)
|
|
864
862
|
}, `total-${e}`))
|
|
865
863
|
]
|
|
866
|
-
}, n.id)), u && /* @__PURE__ */
|
|
864
|
+
}, n.id)), u && /* @__PURE__ */ $("tr", {
|
|
867
865
|
className: "border-t bg-muted/30 font-medium",
|
|
868
866
|
"data-testid": "matrix-total-row",
|
|
869
867
|
children: [
|
|
870
|
-
v.length > 0 && /* @__PURE__ */
|
|
868
|
+
v.length > 0 && /* @__PURE__ */ Q("td", {
|
|
871
869
|
colSpan: v.length,
|
|
872
870
|
className: "px-2 py-1 whitespace-nowrap",
|
|
873
871
|
children: d
|
|
874
872
|
}),
|
|
875
|
-
t.map((e) => /* @__PURE__ */
|
|
873
|
+
t.map((e) => /* @__PURE__ */ Q("td", {
|
|
876
874
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
|
|
877
875
|
children: r(o.get(e.col.id)?.[e.measure], e.measure)
|
|
878
876
|
}, `${e.col.id}-${e.measure}`)),
|
|
879
|
-
l && c.map((e) => /* @__PURE__ */
|
|
877
|
+
l && c.map((e) => /* @__PURE__ */ Q("td", {
|
|
880
878
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
|
|
881
879
|
"data-testid": "matrix-grand-total",
|
|
882
880
|
children: r(s?.[e], e)
|
|
@@ -884,57 +882,58 @@ function Lt({ widget: e, dataSource: t }) {
|
|
|
884
882
|
]
|
|
885
883
|
})] })]
|
|
886
884
|
}),
|
|
887
|
-
|
|
885
|
+
se
|
|
888
886
|
]
|
|
889
887
|
});
|
|
890
888
|
}
|
|
891
889
|
let i = [...s, ...c];
|
|
892
|
-
return /* @__PURE__ */
|
|
890
|
+
return /* @__PURE__ */ $("div", {
|
|
893
891
|
className: "relative h-full w-full overflow-auto p-1",
|
|
894
892
|
children: [
|
|
895
893
|
n,
|
|
896
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ $("table", {
|
|
897
895
|
className: "w-full text-xs",
|
|
898
|
-
children: [/* @__PURE__ */
|
|
896
|
+
children: [/* @__PURE__ */ Q("thead", {
|
|
899
897
|
className: "bg-muted/40",
|
|
900
|
-
children: /* @__PURE__ */
|
|
898
|
+
children: /* @__PURE__ */ Q("tr", { children: i.map((e) => /* @__PURE__ */ Q("th", {
|
|
901
899
|
className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
|
|
902
900
|
children: F(e)
|
|
903
901
|
}, e)) })
|
|
904
|
-
}), /* @__PURE__ */
|
|
905
|
-
className:
|
|
906
|
-
"data-testid":
|
|
907
|
-
onClick:
|
|
908
|
-
children: i.map((t) => /* @__PURE__ */
|
|
902
|
+
}), /* @__PURE__ */ Q("tbody", { children: D.rows.map((e, t) => /* @__PURE__ */ Q("tr", {
|
|
903
|
+
className: K("border-t", z && "cursor-pointer hover:bg-accent/40"),
|
|
904
|
+
"data-testid": z ? "dataset-drill-row" : void 0,
|
|
905
|
+
onClick: z ? () => oe(t, ae.map((t) => p(e[t])).filter(Boolean).join(" / ")) : void 0,
|
|
906
|
+
children: i.map((t) => /* @__PURE__ */ Q("td", {
|
|
909
907
|
className: "px-2 py-1 whitespace-nowrap tabular-nums",
|
|
910
908
|
children: c.includes(t) ? m(e[t], N(t)?.format, N(t)?.currency) : p(e[t])
|
|
911
909
|
}, t))
|
|
912
910
|
}, t)) })]
|
|
913
911
|
}),
|
|
914
|
-
|
|
912
|
+
se
|
|
915
913
|
]
|
|
916
914
|
});
|
|
917
915
|
}
|
|
918
|
-
let
|
|
919
|
-
let t = f(
|
|
916
|
+
let ce = It[u] ?? "bar", le = _(D.rows, ee), { data: ue, xAxisKey: B, series: de } = n(le, s, c, D.fields), fe = z ? (e) => {
|
|
917
|
+
let t = f(le, s, c, e?.category, e?.series);
|
|
920
918
|
if (t < 0) return;
|
|
921
919
|
let n = s.length >= 2 && c.length === 1, r = [e?.category, n ? e?.series : void 0].filter(Boolean).map(String).join(" / ");
|
|
922
|
-
|
|
920
|
+
oe(t, r);
|
|
923
921
|
} : void 0;
|
|
924
|
-
return /* @__PURE__ */
|
|
925
|
-
className:
|
|
926
|
-
children: [/* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ $("div", {
|
|
923
|
+
className: K("relative h-full w-full min-h-[220px]"),
|
|
924
|
+
children: [/* @__PURE__ */ Q(C, {
|
|
927
925
|
schema: {
|
|
928
926
|
type: "chart",
|
|
929
|
-
chartType:
|
|
930
|
-
data:
|
|
931
|
-
xAxisKey:
|
|
927
|
+
chartType: ce,
|
|
928
|
+
data: ue,
|
|
929
|
+
xAxisKey: B,
|
|
932
930
|
series: de,
|
|
931
|
+
isAnimationActive: !1,
|
|
933
932
|
...j ? { categoryColors: j } : {}
|
|
934
933
|
},
|
|
935
934
|
onChartClick: fe,
|
|
936
935
|
onSegmentClick: fe
|
|
937
|
-
}),
|
|
936
|
+
}), se]
|
|
938
937
|
});
|
|
939
938
|
}
|
|
940
939
|
//#endregion
|
|
@@ -950,49 +949,49 @@ function Vt(e) {
|
|
|
950
949
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
951
950
|
}
|
|
952
951
|
function Ht({ def: e, value: n, onChange: r }) {
|
|
953
|
-
let i = P(), [a, o] =
|
|
954
|
-
return /* @__PURE__ */
|
|
952
|
+
let i = P(), [a, o] = Z(!1), s = e.allowCustomRange !== !1, c = (e) => i(`dashboard.filters.range.${e}`, e.replace(/_/g, " ")), l = n?.preset ?? (n?.from || n?.to ? zt : Rt);
|
|
953
|
+
return /* @__PURE__ */ $("div", {
|
|
955
954
|
className: "flex items-center gap-1",
|
|
956
955
|
"data-testid": `dashboard-filter-${e.name}`,
|
|
957
|
-
children: [/* @__PURE__ */
|
|
956
|
+
children: [/* @__PURE__ */ $(U, {
|
|
958
957
|
value: l,
|
|
959
958
|
onValueChange: (e) => {
|
|
960
959
|
e === Rt ? r(void 0) : e === zt ? o(!0) : r({ preset: e });
|
|
961
960
|
},
|
|
962
|
-
children: [/* @__PURE__ */
|
|
961
|
+
children: [/* @__PURE__ */ $(_e, {
|
|
963
962
|
className: "h-8 w-auto min-w-36 gap-1",
|
|
964
963
|
"aria-label": e.label || i("dashboard.filters.dateRange", "Date range"),
|
|
965
|
-
children: [/* @__PURE__ */
|
|
964
|
+
children: [/* @__PURE__ */ Q(Ie, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ Q(ve, {
|
|
966
965
|
placeholder: i("dashboard.filters.dateRange", "Date range"),
|
|
967
966
|
children: Bt(n, c) ?? i("dashboard.filters.allTime", "All time")
|
|
968
967
|
})]
|
|
969
|
-
}), /* @__PURE__ */
|
|
970
|
-
/* @__PURE__ */
|
|
968
|
+
}), /* @__PURE__ */ $(ge, { children: [
|
|
969
|
+
/* @__PURE__ */ Q(W, {
|
|
971
970
|
value: Rt,
|
|
972
971
|
children: i("dashboard.filters.allTime", "All time")
|
|
973
972
|
}),
|
|
974
|
-
t.map((e) => /* @__PURE__ */
|
|
973
|
+
t.map((e) => /* @__PURE__ */ Q(W, {
|
|
975
974
|
value: e,
|
|
976
975
|
children: c(e)
|
|
977
976
|
}, e)),
|
|
978
|
-
s && /* @__PURE__ */
|
|
977
|
+
s && /* @__PURE__ */ Q(W, {
|
|
979
978
|
value: zt,
|
|
980
979
|
children: i("dashboard.filters.custom", "Custom…")
|
|
981
980
|
})
|
|
982
981
|
] })]
|
|
983
|
-
}), s && /* @__PURE__ */
|
|
982
|
+
}), s && /* @__PURE__ */ $(pe, {
|
|
984
983
|
open: a,
|
|
985
984
|
onOpenChange: o,
|
|
986
|
-
children: [/* @__PURE__ */
|
|
985
|
+
children: [/* @__PURE__ */ Q(he, {
|
|
987
986
|
asChild: !0,
|
|
988
|
-
children: /* @__PURE__ */
|
|
987
|
+
children: /* @__PURE__ */ Q("span", {
|
|
989
988
|
"aria-hidden": !0,
|
|
990
989
|
className: "size-0"
|
|
991
990
|
})
|
|
992
|
-
}), /* @__PURE__ */
|
|
991
|
+
}), /* @__PURE__ */ Q(me, {
|
|
993
992
|
className: "w-auto p-0",
|
|
994
993
|
align: "start",
|
|
995
|
-
children: /* @__PURE__ */
|
|
994
|
+
children: /* @__PURE__ */ Q(I, {
|
|
996
995
|
mode: "range",
|
|
997
996
|
numberOfMonths: 2,
|
|
998
997
|
selected: {
|
|
@@ -1015,8 +1014,8 @@ function Ht({ def: e, value: n, onChange: r }) {
|
|
|
1015
1014
|
});
|
|
1016
1015
|
}
|
|
1017
1016
|
function Ut({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
1018
|
-
let i = P(), [a, o] =
|
|
1019
|
-
|
|
1017
|
+
let i = P(), [a, o] = Z(null), s = e.optionsFrom;
|
|
1018
|
+
Y(() => {
|
|
1020
1019
|
if (!s || !r) return;
|
|
1021
1020
|
let e = !1, t = () => {
|
|
1022
1021
|
if (typeof r.find != "function") {
|
|
@@ -1093,27 +1092,27 @@ function Ut({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
|
1093
1092
|
s?.labelField,
|
|
1094
1093
|
r
|
|
1095
1094
|
]);
|
|
1096
|
-
let c =
|
|
1097
|
-
return /* @__PURE__ */
|
|
1095
|
+
let c = X(() => e.options?.length ? e.options : a ?? [], [e.options, a]), l = e.label || e.name, u = t ? c.find((e) => e.value === String(t))?.label ?? String(t) : void 0;
|
|
1096
|
+
return /* @__PURE__ */ $(U, {
|
|
1098
1097
|
value: t ? String(t) : Rt,
|
|
1099
1098
|
onValueChange: (e) => n(e === Rt ? void 0 : e),
|
|
1100
|
-
children: [/* @__PURE__ */
|
|
1099
|
+
children: [/* @__PURE__ */ Q(_e, {
|
|
1101
1100
|
className: "h-8 w-auto min-w-32",
|
|
1102
1101
|
"aria-label": l,
|
|
1103
1102
|
"data-testid": `dashboard-filter-${e.name}`,
|
|
1104
|
-
children: /* @__PURE__ */
|
|
1105
|
-
}), /* @__PURE__ */
|
|
1103
|
+
children: /* @__PURE__ */ Q(ve, { children: u ?? `${l}: ${i("dashboard.filters.all", "All")}` })
|
|
1104
|
+
}), /* @__PURE__ */ $(ge, { children: [/* @__PURE__ */ Q(W, {
|
|
1106
1105
|
value: Rt,
|
|
1107
1106
|
children: i("dashboard.filters.all", "All")
|
|
1108
|
-
}), c.map((e) => /* @__PURE__ */
|
|
1107
|
+
}), c.map((e) => /* @__PURE__ */ Q(W, {
|
|
1109
1108
|
value: e.value,
|
|
1110
1109
|
children: e.label
|
|
1111
1110
|
}, e.value))] })]
|
|
1112
1111
|
});
|
|
1113
1112
|
}
|
|
1114
1113
|
function Wt({ def: e, value: t, onChange: n }) {
|
|
1115
|
-
let [r, i] =
|
|
1116
|
-
|
|
1114
|
+
let [r, i] = Z(t == null ? "" : String(t));
|
|
1115
|
+
Y(() => {
|
|
1117
1116
|
i(t == null ? "" : String(t));
|
|
1118
1117
|
}, [t]);
|
|
1119
1118
|
let a = () => {
|
|
@@ -1124,7 +1123,7 @@ function Wt({ def: e, value: t, onChange: n }) {
|
|
|
1124
1123
|
}
|
|
1125
1124
|
n(e.type === "number" ? Number(t) : t);
|
|
1126
1125
|
};
|
|
1127
|
-
return /* @__PURE__ */
|
|
1126
|
+
return /* @__PURE__ */ Q(fe, {
|
|
1128
1127
|
className: "h-8 w-36",
|
|
1129
1128
|
type: e.type === "number" ? "number" : "text",
|
|
1130
1129
|
placeholder: e.label || e.name,
|
|
@@ -1145,47 +1144,47 @@ function Gt({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, classN
|
|
|
1145
1144
|
let n = t[e.name], r = e.defaultValue;
|
|
1146
1145
|
return s(n) && s(r) ? !1 : JSON.stringify(n ?? null) !== JSON.stringify(r ?? null);
|
|
1147
1146
|
});
|
|
1148
|
-
return /* @__PURE__ */
|
|
1149
|
-
className:
|
|
1147
|
+
return /* @__PURE__ */ $("div", {
|
|
1148
|
+
className: K("col-span-full flex flex-wrap items-center gap-2", a),
|
|
1150
1149
|
"data-testid": "dashboard-filter-bar",
|
|
1151
1150
|
role: "group",
|
|
1152
1151
|
"aria-label": o("dashboard.filters.label", "Dashboard filters"),
|
|
1153
1152
|
children: [e.map((e) => {
|
|
1154
1153
|
let r = t[e.name], a = (t) => n(e.name, t);
|
|
1155
|
-
return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */
|
|
1154
|
+
return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(Ht, {
|
|
1156
1155
|
def: e,
|
|
1157
1156
|
value: r,
|
|
1158
1157
|
onChange: a
|
|
1159
|
-
}, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */
|
|
1158
|
+
}, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q(Ut, {
|
|
1160
1159
|
def: e,
|
|
1161
1160
|
value: r,
|
|
1162
1161
|
onChange: a,
|
|
1163
1162
|
dataSource: i
|
|
1164
|
-
}, e.name) : /* @__PURE__ */
|
|
1163
|
+
}, e.name) : /* @__PURE__ */ Q(Wt, {
|
|
1165
1164
|
def: e,
|
|
1166
1165
|
value: r,
|
|
1167
1166
|
onChange: a
|
|
1168
1167
|
}, e.name);
|
|
1169
|
-
}), r && c && /* @__PURE__ */
|
|
1168
|
+
}), r && c && /* @__PURE__ */ $(F, {
|
|
1170
1169
|
variant: "ghost",
|
|
1171
1170
|
size: "sm",
|
|
1172
1171
|
onClick: r,
|
|
1173
1172
|
className: "text-muted-foreground",
|
|
1174
|
-
children: [/* @__PURE__ */
|
|
1173
|
+
children: [/* @__PURE__ */ Q(Ue, { className: "size-3.5" }), o("dashboard.filters.reset", "Reset")]
|
|
1175
1174
|
})]
|
|
1176
1175
|
});
|
|
1177
1176
|
}
|
|
1178
1177
|
//#endregion
|
|
1179
1178
|
//#region src/DashboardRenderer.tsx
|
|
1180
1179
|
function Kt({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
1181
|
-
let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } =
|
|
1180
|
+
let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = tt({
|
|
1182
1181
|
id: e,
|
|
1183
1182
|
disabled: t
|
|
1184
1183
|
});
|
|
1185
|
-
return /* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ Q("div", {
|
|
1186
1185
|
ref: s,
|
|
1187
1186
|
style: {
|
|
1188
|
-
transform:
|
|
1187
|
+
transform: rt.Transform.toString(c),
|
|
1189
1188
|
transition: l,
|
|
1190
1189
|
opacity: u ? .4 : 1,
|
|
1191
1190
|
...n ? {
|
|
@@ -1193,7 +1192,7 @@ function Kt({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
|
1193
1192
|
gridRow: `span ${n.h}`
|
|
1194
1193
|
} : {}
|
|
1195
1194
|
},
|
|
1196
|
-
className:
|
|
1195
|
+
className: K("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
|
|
1197
1196
|
"data-sortable-widget-id": e,
|
|
1198
1197
|
...a,
|
|
1199
1198
|
...o,
|
|
@@ -1201,7 +1200,7 @@ function Kt({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
|
1201
1200
|
});
|
|
1202
1201
|
}
|
|
1203
1202
|
function qt(e) {
|
|
1204
|
-
return e ?
|
|
1203
|
+
return e ? Ce(e) : null;
|
|
1205
1204
|
}
|
|
1206
1205
|
function Jt(e) {
|
|
1207
1206
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
@@ -1269,9 +1268,14 @@ function tn(e) {
|
|
|
1269
1268
|
var nn = /* @__PURE__ */ new Set([
|
|
1270
1269
|
"object-chart",
|
|
1271
1270
|
"object-metric",
|
|
1272
|
-
"object-data-table"
|
|
1273
|
-
|
|
1274
|
-
|
|
1271
|
+
"object-data-table"
|
|
1272
|
+
]), rn = {
|
|
1273
|
+
type: "text",
|
|
1274
|
+
value: "This widget uses a retired data format. Edit it to bind a dataset.",
|
|
1275
|
+
variant: "caption",
|
|
1276
|
+
align: "center",
|
|
1277
|
+
className: "flex h-full w-full items-center justify-center rounded border border-dashed border-destructive/40 bg-destructive/5 p-4 text-center text-destructive"
|
|
1278
|
+
}, an = De(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: c, onWidgetClick: l, onWidgetsReorder: u, modalHandler: d, scriptHandlers: f, hideHeaderText: p, ...m }, h) => {
|
|
1275
1279
|
let _ = (() => {
|
|
1276
1280
|
if (e.columns != null) return e.columns;
|
|
1277
1281
|
let t = e.widgets ?? [], n = 0;
|
|
@@ -1280,68 +1284,48 @@ var nn = /* @__PURE__ */ new Set([
|
|
|
1280
1284
|
t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
|
|
1281
1285
|
}
|
|
1282
1286
|
return n > 4 ? 12 : 4;
|
|
1283
|
-
})(), y = _, b = e.gap || 4, x = e.columns != null || _ !== 4, [S, w] =
|
|
1284
|
-
J(() => {
|
|
1285
|
-
if (k.length === 0 || !n || typeof n.getObjectSchema != "function") return;
|
|
1286
|
-
let t = Array.from(new Set((e.widgets ?? []).map((e) => e.object).filter((e) => typeof e == "string" && e.length > 0))), r = !1;
|
|
1287
|
-
for (let e of t) n.getObjectSchema(e).then((t) => {
|
|
1288
|
-
if (r) return;
|
|
1289
|
-
let n = t?.fields;
|
|
1290
|
-
!n || typeof n != "object" || P((t) => ({
|
|
1291
|
-
...t,
|
|
1292
|
-
[e]: new Set(Object.keys(n))
|
|
1293
|
-
}));
|
|
1294
|
-
}).catch(() => {});
|
|
1295
|
-
return () => {
|
|
1296
|
-
r = !0;
|
|
1297
|
-
};
|
|
1298
|
-
}, [
|
|
1299
|
-
k.length,
|
|
1300
|
-
n,
|
|
1301
|
-
e.widgets
|
|
1302
|
-
]);
|
|
1303
|
-
let { executeAction: re, engine: z } = T({ actions: Y(() => (e.header?.actions ?? []).map((e) => ({
|
|
1287
|
+
})(), y = _, b = e.gap || 4, x = e.columns != null || _ !== 4, [S, w] = Z(!1), [E, D] = Z(!1), O = ke(null), k = X(() => v(e), [e.globalFilters, e.dateRange]), { variables: M, setVariable: ee, resetVariables: te } = j(), { executeAction: ne, engine: P } = T({ actions: X(() => (e.header?.actions ?? []).map((e) => ({
|
|
1304
1288
|
name: e.actionUrl || e.label,
|
|
1305
1289
|
type: e.actionType || "url",
|
|
1306
1290
|
target: e.actionUrl,
|
|
1307
1291
|
label: e.label
|
|
1308
|
-
})), [e.header?.actions]) }), { dashboardLabel:
|
|
1292
|
+
})), [e.header?.actions]) }), { dashboardLabel: I, dashboardDescription: R, dashboardActionLabel: z, widgetTitle: oe, widgetDescription: se, fieldLabel: ce } = A(), { t: le } = N(), ue = J((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? le(`report.aggregate.${n}`, { defaultValue: n }) : e ? ce(e, t, t) : t, [le, ce]), B = e.name, de = J((e) => {
|
|
1309
1293
|
if (!B) return e.label;
|
|
1310
1294
|
let t = e.actionUrl || e.label;
|
|
1311
|
-
return
|
|
1312
|
-
}, [B,
|
|
1295
|
+
return z(B, t, e.label);
|
|
1296
|
+
}, [B, z]), V = J((e) => {
|
|
1313
1297
|
let t = Jt(e.title);
|
|
1314
|
-
return !B || !e.id || t === void 0 ? t :
|
|
1315
|
-
}, [B,
|
|
1298
|
+
return !B || !e.id || t === void 0 ? t : oe(B, e.id, t);
|
|
1299
|
+
}, [B, oe]), fe = J((e) => {
|
|
1316
1300
|
let t = Jt(e.description);
|
|
1317
|
-
return !B || !e.id ? t :
|
|
1318
|
-
}, [B,
|
|
1319
|
-
|
|
1320
|
-
let e =
|
|
1301
|
+
return !B || !e.id ? t : se(B, e.id, t);
|
|
1302
|
+
}, [B, se]);
|
|
1303
|
+
Y(() => {
|
|
1304
|
+
let e = P.getRunner();
|
|
1321
1305
|
if (d && e.setModalHandler(d), f) for (let [t, n] of Object.entries(f)) e.registerScript(t, n);
|
|
1322
1306
|
}, [
|
|
1323
|
-
|
|
1307
|
+
P,
|
|
1324
1308
|
d,
|
|
1325
1309
|
f
|
|
1326
|
-
]),
|
|
1310
|
+
]), Y(() => {
|
|
1327
1311
|
let e = () => D(window.innerWidth < 768);
|
|
1328
1312
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1329
1313
|
}, []);
|
|
1330
|
-
let
|
|
1314
|
+
let pe = J(() => {
|
|
1331
1315
|
r && (w(!0), r(), setTimeout(() => w(!1), 600));
|
|
1332
1316
|
}, [r]);
|
|
1333
|
-
|
|
1334
|
-
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return O.current = setInterval(
|
|
1317
|
+
Y(() => {
|
|
1318
|
+
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return O.current = setInterval(pe, e.refreshInterval * 1e3), () => {
|
|
1335
1319
|
O.current && clearInterval(O.current);
|
|
1336
1320
|
};
|
|
1337
1321
|
}, [
|
|
1338
1322
|
e.refreshInterval,
|
|
1339
1323
|
r,
|
|
1340
|
-
|
|
1324
|
+
pe
|
|
1341
1325
|
]);
|
|
1342
|
-
let
|
|
1326
|
+
let me = J((e, t) => {
|
|
1343
1327
|
!o || !l || !t || (e.stopPropagation(), l(t));
|
|
1344
|
-
}, [o, l]),
|
|
1328
|
+
}, [o, l]), he = J((t, n, r) => {
|
|
1345
1329
|
if (!o || !l) return;
|
|
1346
1330
|
let i = e.widgets || [];
|
|
1347
1331
|
if (t.key === "Enter" || t.key === " ") t.preventDefault(), l(n ?? null);
|
|
@@ -1358,19 +1342,19 @@ var nn = /* @__PURE__ */ new Set([
|
|
|
1358
1342
|
o,
|
|
1359
1343
|
l,
|
|
1360
1344
|
e.widgets
|
|
1361
|
-
]), H =
|
|
1345
|
+
]), H = J((e) => {
|
|
1362
1346
|
!o || !l || e.target === e.currentTarget && l(null);
|
|
1363
|
-
}, [o, l]), U = !!(o && u),
|
|
1347
|
+
}, [o, l]), U = !!(o && u), ge = Ze(Xe(Je, { activationConstraint: { distance: 5 } })), W = J((t) => {
|
|
1364
1348
|
if (!U) return;
|
|
1365
1349
|
let { active: n, over: r } = t;
|
|
1366
1350
|
if (!r || n.id === r.id) return;
|
|
1367
1351
|
let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
|
|
1368
|
-
a < 0 || o < 0 || u?.(
|
|
1352
|
+
a < 0 || o < 0 || u?.($e(i, a, o));
|
|
1369
1353
|
}, [
|
|
1370
1354
|
U,
|
|
1371
1355
|
e.widgets,
|
|
1372
1356
|
u
|
|
1373
|
-
]),
|
|
1357
|
+
]), _e = (e, t, r) => {
|
|
1374
1358
|
let i = e.type === "metric" || Qt.has(e.type || ""), a = x ? {
|
|
1375
1359
|
w: Math.min(i ? 3 : 6, y),
|
|
1376
1360
|
h: i ? 2 : 4
|
|
@@ -1379,238 +1363,99 @@ var nn = /* @__PURE__ */ new Set([
|
|
|
1379
1363
|
w: Math.min(l.w, y)
|
|
1380
1364
|
} : void 0, d = !!e.dataset, f = () => {
|
|
1381
1365
|
if (e.component) return e.component;
|
|
1382
|
-
let t = e.type, n = e.options || {};
|
|
1383
|
-
if (
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
return {
|
|
1394
|
-
type: "object-metric",
|
|
1395
|
-
objectName: e.object || ($(t) ? t.object : void 0),
|
|
1396
|
-
aggregate: r,
|
|
1397
|
-
filter: ($(t) ? t.filter : void 0) || e.filter,
|
|
1398
|
-
label: n.label || me(e) || "",
|
|
1399
|
-
fallbackValue: n.value,
|
|
1400
|
-
trend: n.trend,
|
|
1401
|
-
icon: n.icon,
|
|
1402
|
-
description: n.description,
|
|
1403
|
-
colorVariant: e.colorVariant,
|
|
1404
|
-
format: n.format,
|
|
1405
|
-
currency: n.currency,
|
|
1406
|
-
prefix: n.prefix,
|
|
1407
|
-
suffix: n.suffix,
|
|
1408
|
-
drillDown: n.drillDown ?? { enabled: !0 },
|
|
1409
|
-
title: n.label || me(e) || "",
|
|
1410
|
-
compareTo: e.compareTo
|
|
1411
|
-
};
|
|
1412
|
-
}
|
|
1413
|
-
if (Qt.has(t || "") && e.object) {
|
|
1414
|
-
let t = e.aggregate ? {
|
|
1415
|
-
field: e.valueField || "value",
|
|
1416
|
-
function: e.aggregate,
|
|
1417
|
-
groupBy: e.categoryField || "_all"
|
|
1418
|
-
} : void 0;
|
|
1419
|
-
return {
|
|
1420
|
-
type: "object-metric",
|
|
1421
|
-
objectName: e.object,
|
|
1422
|
-
aggregate: t,
|
|
1423
|
-
filter: e.filter,
|
|
1424
|
-
label: n.label || me(e) || "",
|
|
1425
|
-
fallbackValue: n.fallbackValue ?? n.value,
|
|
1426
|
-
icon: n.icon,
|
|
1427
|
-
description: n.description,
|
|
1428
|
-
colorVariant: e.colorVariant,
|
|
1429
|
-
format: n.format,
|
|
1430
|
-
currency: n.currency,
|
|
1431
|
-
prefix: n.prefix,
|
|
1432
|
-
suffix: n.suffix,
|
|
1433
|
-
invert: n.invert,
|
|
1434
|
-
compareTo: e.compareTo
|
|
1435
|
-
};
|
|
1436
|
-
}
|
|
1437
|
-
let r = t && Xt[t] || t;
|
|
1438
|
-
if (r && Zt.has(r)) {
|
|
1439
|
-
let t = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
|
|
1440
|
-
if ($(t)) {
|
|
1441
|
-
let o = t.aggregate, s = (() => {
|
|
1442
|
-
let t = e.categoryField || o?.groupBy;
|
|
1443
|
-
if (t) return e.categoryGranularity && typeof t == "string" ? {
|
|
1444
|
-
field: t,
|
|
1445
|
-
dateGranularity: e.categoryGranularity
|
|
1446
|
-
} : t;
|
|
1447
|
-
})(), c = o ? {
|
|
1448
|
-
field: e.valueField || o.field,
|
|
1449
|
-
function: e.aggregate || o.function,
|
|
1450
|
-
groupBy: s
|
|
1451
|
-
} : void 0, l = c?.field || a, u = e.object || t.object;
|
|
1452
|
-
return {
|
|
1453
|
-
type: "object-chart",
|
|
1454
|
-
chartType: r,
|
|
1455
|
-
objectName: u,
|
|
1456
|
-
aggregate: c,
|
|
1457
|
-
filter: t.filter || e.filter,
|
|
1458
|
-
xAxisKey: i,
|
|
1459
|
-
series: [{
|
|
1460
|
-
dataKey: l,
|
|
1461
|
-
label: fe(u, l, c?.function)
|
|
1462
|
-
}],
|
|
1463
|
-
colors: Yt,
|
|
1464
|
-
drillDown: n.drillDown ?? tn(r),
|
|
1465
|
-
compareTo: e.compareTo,
|
|
1466
|
-
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
1467
|
-
};
|
|
1468
|
-
}
|
|
1469
|
-
if (!t && e.object) {
|
|
1470
|
-
let t = e.categoryField || "name", a = e.categoryGranularity ? {
|
|
1471
|
-
field: t,
|
|
1472
|
-
dateGranularity: e.categoryGranularity
|
|
1473
|
-
} : t, o = e.aggregate ? {
|
|
1474
|
-
field: e.valueField || "value",
|
|
1475
|
-
function: e.aggregate,
|
|
1476
|
-
groupBy: a
|
|
1477
|
-
} : void 0, s = e.valueField || "value";
|
|
1366
|
+
let t = e.type, n = e.options || {}, r = e.data || n.data;
|
|
1367
|
+
if (!r && e.object) return rn;
|
|
1368
|
+
let i = t && Xt[t] || t;
|
|
1369
|
+
if (i && Zt.has(i)) {
|
|
1370
|
+
let t = n.xField || "name", a = n.yField || "value";
|
|
1371
|
+
if (ft(r)) {
|
|
1372
|
+
let o = r.aggregate, s = o ? {
|
|
1373
|
+
field: o.field,
|
|
1374
|
+
function: o.function,
|
|
1375
|
+
groupBy: o.groupBy
|
|
1376
|
+
} : void 0, c = s?.field || a;
|
|
1478
1377
|
return {
|
|
1479
1378
|
type: "object-chart",
|
|
1480
|
-
chartType:
|
|
1481
|
-
objectName:
|
|
1482
|
-
aggregate:
|
|
1483
|
-
filter: e.filter,
|
|
1484
|
-
xAxisKey:
|
|
1379
|
+
chartType: i,
|
|
1380
|
+
objectName: r.object,
|
|
1381
|
+
aggregate: s,
|
|
1382
|
+
filter: r.filter || e.filter,
|
|
1383
|
+
xAxisKey: t,
|
|
1485
1384
|
series: [{
|
|
1486
|
-
dataKey:
|
|
1487
|
-
label:
|
|
1385
|
+
dataKey: c,
|
|
1386
|
+
label: ue(r.object, c, s?.function)
|
|
1488
1387
|
}],
|
|
1489
1388
|
colors: Yt,
|
|
1490
|
-
|
|
1389
|
+
isAnimationActive: !1,
|
|
1390
|
+
drillDown: n.drillDown ?? tn(i),
|
|
1491
1391
|
compareTo: e.compareTo,
|
|
1492
1392
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
1493
1393
|
};
|
|
1494
1394
|
}
|
|
1495
1395
|
return {
|
|
1496
1396
|
type: "chart",
|
|
1497
|
-
chartType:
|
|
1498
|
-
data: Array.isArray(
|
|
1499
|
-
xAxisKey:
|
|
1397
|
+
chartType: i,
|
|
1398
|
+
data: Array.isArray(r) ? r : r?.items || [],
|
|
1399
|
+
xAxisKey: t,
|
|
1500
1400
|
series: [{
|
|
1501
1401
|
dataKey: a,
|
|
1502
|
-
label:
|
|
1402
|
+
label: ue(void 0, a, void 0)
|
|
1503
1403
|
}],
|
|
1504
1404
|
colors: Yt,
|
|
1405
|
+
isAnimationActive: !1,
|
|
1505
1406
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
1506
1407
|
};
|
|
1507
1408
|
}
|
|
1508
1409
|
if (t === "table") {
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
mode: "record"
|
|
1512
|
-
} : void 0;
|
|
1513
|
-
if ($(t)) {
|
|
1514
|
-
let { data: i, ...a } = n;
|
|
1410
|
+
if (ft(r)) {
|
|
1411
|
+
let { data: t, ...i } = n;
|
|
1515
1412
|
return {
|
|
1516
1413
|
type: "object-data-table",
|
|
1517
|
-
...
|
|
1518
|
-
objectName:
|
|
1519
|
-
dataProvider:
|
|
1520
|
-
filter:
|
|
1414
|
+
...i,
|
|
1415
|
+
objectName: r.object,
|
|
1416
|
+
dataProvider: r,
|
|
1417
|
+
filter: r.filter || e.filter,
|
|
1521
1418
|
searchable: e.searchable ?? !1,
|
|
1522
1419
|
pagination: e.pagination ?? !1,
|
|
1523
|
-
drillDown:
|
|
1420
|
+
drillDown: n.drillDown ?? {
|
|
1421
|
+
enabled: !0,
|
|
1422
|
+
mode: "record"
|
|
1423
|
+
},
|
|
1524
1424
|
className: "border-0"
|
|
1525
1425
|
};
|
|
1526
1426
|
}
|
|
1527
|
-
return
|
|
1528
|
-
type: "object-data-table",
|
|
1529
|
-
...n,
|
|
1530
|
-
objectName: e.object,
|
|
1531
|
-
filter: e.filter,
|
|
1532
|
-
searchable: e.searchable ?? !1,
|
|
1533
|
-
pagination: e.pagination ?? !1,
|
|
1534
|
-
drillDown: r,
|
|
1535
|
-
className: "border-0"
|
|
1536
|
-
} : {
|
|
1427
|
+
return {
|
|
1537
1428
|
type: "data-table",
|
|
1538
1429
|
...n,
|
|
1539
|
-
data:
|
|
1430
|
+
data: r?.items || [],
|
|
1540
1431
|
searchable: !1,
|
|
1541
1432
|
pagination: !1,
|
|
1542
1433
|
className: "border-0"
|
|
1543
1434
|
};
|
|
1544
1435
|
}
|
|
1545
|
-
if (t === "pivot")
|
|
1546
|
-
let t = e.data || n.data, r = e, i = {
|
|
1547
|
-
rowField: r.rowField ?? n.rowField,
|
|
1548
|
-
columnField: r.columnField ?? n.columnField,
|
|
1549
|
-
valueField: r.valueField ?? n.valueField,
|
|
1550
|
-
aggregation: r.aggregation ?? n.aggregation ?? "sum",
|
|
1551
|
-
showRowTotals: r.showRowTotals ?? n.showRowTotals,
|
|
1552
|
-
showColumnTotals: r.showColumnTotals ?? n.showColumnTotals,
|
|
1553
|
-
format: r.format ?? n.format
|
|
1554
|
-
}, a = ($(t) || !t && e.object) && n.drillDown === void 0 ? {
|
|
1555
|
-
...n,
|
|
1556
|
-
drillDown: { enabled: !0 }
|
|
1557
|
-
} : n;
|
|
1558
|
-
if ($(t)) {
|
|
1559
|
-
let { data: n, ...r } = a;
|
|
1560
|
-
return {
|
|
1561
|
-
type: "object-pivot",
|
|
1562
|
-
...r,
|
|
1563
|
-
...i,
|
|
1564
|
-
objectName: e.object || t.object,
|
|
1565
|
-
dataProvider: t,
|
|
1566
|
-
filter: t.filter || e.filter
|
|
1567
|
-
};
|
|
1568
|
-
}
|
|
1569
|
-
return !t && e.object ? {
|
|
1570
|
-
type: "object-pivot",
|
|
1571
|
-
...a,
|
|
1572
|
-
...i,
|
|
1573
|
-
objectName: e.object,
|
|
1574
|
-
filter: e.filter
|
|
1575
|
-
} : {
|
|
1576
|
-
type: "pivot",
|
|
1577
|
-
...n,
|
|
1578
|
-
...i,
|
|
1579
|
-
data: Array.isArray(t) ? t : t?.items || []
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1436
|
+
if (t === "pivot") return rn;
|
|
1582
1437
|
if (t === "list") {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
mode: "record"
|
|
1586
|
-
} : void 0;
|
|
1587
|
-
if ($(t)) {
|
|
1588
|
-
let { data: i, ...a } = n;
|
|
1438
|
+
if (ft(r)) {
|
|
1439
|
+
let { data: t, ...i } = n;
|
|
1589
1440
|
return {
|
|
1590
1441
|
type: "object-data-table",
|
|
1591
|
-
...
|
|
1592
|
-
objectName:
|
|
1593
|
-
dataProvider:
|
|
1594
|
-
filter:
|
|
1442
|
+
...i,
|
|
1443
|
+
objectName: r.object,
|
|
1444
|
+
dataProvider: r,
|
|
1445
|
+
filter: r.filter || e.filter,
|
|
1595
1446
|
searchable: !1,
|
|
1596
1447
|
pagination: !1,
|
|
1597
|
-
drillDown:
|
|
1448
|
+
drillDown: n.drillDown ?? {
|
|
1449
|
+
enabled: !0,
|
|
1450
|
+
mode: "record"
|
|
1451
|
+
},
|
|
1598
1452
|
className: "border-0"
|
|
1599
1453
|
};
|
|
1600
1454
|
}
|
|
1601
|
-
return
|
|
1602
|
-
type: "object-data-table",
|
|
1603
|
-
...n,
|
|
1604
|
-
objectName: e.object,
|
|
1605
|
-
filter: e.filter,
|
|
1606
|
-
searchable: !1,
|
|
1607
|
-
pagination: !1,
|
|
1608
|
-
drillDown: r,
|
|
1609
|
-
className: "border-0"
|
|
1610
|
-
} : {
|
|
1455
|
+
return {
|
|
1611
1456
|
type: "data-table",
|
|
1612
1457
|
...n,
|
|
1613
|
-
data: Array.isArray(
|
|
1458
|
+
data: Array.isArray(r) ? r : r?.items || [],
|
|
1614
1459
|
searchable: !1,
|
|
1615
1460
|
pagination: !1,
|
|
1616
1461
|
className: "border-0"
|
|
@@ -1632,7 +1477,7 @@ var nn = /* @__PURE__ */ new Set([
|
|
|
1632
1477
|
...e,
|
|
1633
1478
|
...n
|
|
1634
1479
|
};
|
|
1635
|
-
}, p = k.length > 0 ? s(e, k, M
|
|
1480
|
+
}, p = k.length > 0 ? s(e, k, M) : void 0, m = (() => {
|
|
1636
1481
|
let e = f();
|
|
1637
1482
|
return p && e && nn.has(e.type) ? {
|
|
1638
1483
|
...e,
|
|
@@ -1641,103 +1486,103 @@ var nn = /* @__PURE__ */ new Set([
|
|
|
1641
1486
|
})(), h = p && d ? {
|
|
1642
1487
|
...e,
|
|
1643
1488
|
filter: g(e.filter, p)
|
|
1644
|
-
} : e, _ = e.type === "metric" && !d, v =
|
|
1489
|
+
} : e, _ = e.type === "metric" && !d, v = V(e), b = fe(e), S = e.id || v || `widget-${t}`, w = o && c === e.id, T = o ? {
|
|
1645
1490
|
"data-testid": `dashboard-preview-widget-${e.id}`,
|
|
1646
1491
|
"data-widget-id": e.id,
|
|
1647
1492
|
role: "button",
|
|
1648
1493
|
tabIndex: 0,
|
|
1649
1494
|
"aria-selected": w,
|
|
1650
1495
|
"aria-label": `Widget: ${v || `Widget ${t + 1}`}`,
|
|
1651
|
-
onClick: (t) =>
|
|
1652
|
-
onKeyDown: (n) =>
|
|
1653
|
-
} : {}, D = o ?
|
|
1496
|
+
onClick: (t) => me(t, e.id),
|
|
1497
|
+
onKeyDown: (n) => he(n, e.id, t)
|
|
1498
|
+
} : {}, D = o ? K("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", w ? "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, O = !E && u && !U ? {
|
|
1654
1499
|
gridColumn: `span ${u.w}`,
|
|
1655
1500
|
gridRow: `span ${u.h}`
|
|
1656
|
-
} : void 0, A = _ ? /* @__PURE__ */
|
|
1657
|
-
className:
|
|
1501
|
+
} : void 0, A = _ ? /* @__PURE__ */ $("div", {
|
|
1502
|
+
className: K("h-full w-full", o && "relative", D),
|
|
1658
1503
|
style: O,
|
|
1659
1504
|
...T,
|
|
1660
|
-
children: [d ? /* @__PURE__ */
|
|
1661
|
-
className:
|
|
1662
|
-
children: /* @__PURE__ */
|
|
1505
|
+
children: [d ? /* @__PURE__ */ Q("div", {
|
|
1506
|
+
className: K("h-full w-full", o && "pointer-events-none"),
|
|
1507
|
+
children: /* @__PURE__ */ Q(Lt, {
|
|
1663
1508
|
widget: h,
|
|
1664
1509
|
dataSource: n
|
|
1665
1510
|
})
|
|
1666
|
-
}) : /* @__PURE__ */
|
|
1511
|
+
}) : /* @__PURE__ */ Q(C, {
|
|
1667
1512
|
schema: m,
|
|
1668
|
-
className:
|
|
1513
|
+
className: K("h-full w-full", o && "pointer-events-none"),
|
|
1669
1514
|
dataSource: n
|
|
1670
|
-
}), o && /* @__PURE__ */
|
|
1515
|
+
}), o && /* @__PURE__ */ Q("div", {
|
|
1671
1516
|
className: "absolute inset-0 z-10",
|
|
1672
1517
|
"aria-hidden": "true",
|
|
1673
1518
|
"data-testid": "widget-click-overlay"
|
|
1674
1519
|
})]
|
|
1675
|
-
}) : /* @__PURE__ */
|
|
1676
|
-
className:
|
|
1520
|
+
}) : /* @__PURE__ */ $(L, {
|
|
1521
|
+
className: K("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", D),
|
|
1677
1522
|
style: O,
|
|
1678
1523
|
...T,
|
|
1679
1524
|
children: [
|
|
1680
|
-
v && /* @__PURE__ */
|
|
1525
|
+
v && /* @__PURE__ */ $(ie, {
|
|
1681
1526
|
className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
|
|
1682
|
-
children: [/* @__PURE__ */
|
|
1527
|
+
children: [/* @__PURE__ */ Q(ae, {
|
|
1683
1528
|
className: "text-sm sm:text-base font-medium tracking-tight truncate",
|
|
1684
1529
|
title: v,
|
|
1685
1530
|
children: v
|
|
1686
|
-
}), b && /* @__PURE__ */
|
|
1531
|
+
}), b && /* @__PURE__ */ Q("p", {
|
|
1687
1532
|
className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
|
|
1688
1533
|
children: b
|
|
1689
1534
|
})]
|
|
1690
1535
|
}),
|
|
1691
|
-
/* @__PURE__ */
|
|
1536
|
+
/* @__PURE__ */ Q(re, {
|
|
1692
1537
|
className: "p-0",
|
|
1693
|
-
children: /* @__PURE__ */
|
|
1694
|
-
className:
|
|
1695
|
-
children: d ? /* @__PURE__ */
|
|
1538
|
+
children: /* @__PURE__ */ Q("div", {
|
|
1539
|
+
className: K("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
|
|
1540
|
+
children: d ? /* @__PURE__ */ Q(Lt, {
|
|
1696
1541
|
widget: h,
|
|
1697
1542
|
dataSource: n
|
|
1698
|
-
}) : /* @__PURE__ */
|
|
1543
|
+
}) : /* @__PURE__ */ Q(C, {
|
|
1699
1544
|
schema: m,
|
|
1700
1545
|
dataSource: n
|
|
1701
1546
|
})
|
|
1702
1547
|
})
|
|
1703
1548
|
}),
|
|
1704
|
-
o && /* @__PURE__ */
|
|
1549
|
+
o && /* @__PURE__ */ Q("div", {
|
|
1705
1550
|
className: "absolute inset-0 z-10",
|
|
1706
1551
|
"aria-hidden": "true",
|
|
1707
1552
|
"data-testid": "widget-click-overlay"
|
|
1708
1553
|
})
|
|
1709
1554
|
]
|
|
1710
1555
|
});
|
|
1711
|
-
return U && e.id ? /* @__PURE__ */
|
|
1556
|
+
return U && e.id ? /* @__PURE__ */ Q(Kt, {
|
|
1712
1557
|
id: e.id,
|
|
1713
1558
|
gridSpan: !E && u ? {
|
|
1714
1559
|
w: u.w,
|
|
1715
1560
|
h: u.h
|
|
1716
1561
|
} : void 0,
|
|
1717
1562
|
children: A
|
|
1718
|
-
}, S) : /* @__PURE__ */
|
|
1719
|
-
},
|
|
1563
|
+
}, S) : /* @__PURE__ */ Q(Ee, { children: A }, S);
|
|
1564
|
+
}, ve = e.header && /* @__PURE__ */ $("div", {
|
|
1720
1565
|
className: "col-span-full mb-4",
|
|
1721
1566
|
children: [
|
|
1722
|
-
!p && e.header.showTitle !== !1 && e.title && /* @__PURE__ */
|
|
1567
|
+
!p && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Q("h2", {
|
|
1723
1568
|
className: "text-lg font-semibold tracking-tight",
|
|
1724
|
-
children: B ?
|
|
1569
|
+
children: B ? I({
|
|
1725
1570
|
name: B,
|
|
1726
1571
|
label: Jt(e.title)
|
|
1727
1572
|
}) : Jt(e.title)
|
|
1728
1573
|
}),
|
|
1729
|
-
!p && e.header.showDescription !== !1 && e.description && /* @__PURE__ */
|
|
1574
|
+
!p && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Q("p", {
|
|
1730
1575
|
className: "text-sm text-muted-foreground mt-1",
|
|
1731
|
-
children: B ?
|
|
1576
|
+
children: B ? R({
|
|
1732
1577
|
name: B,
|
|
1733
1578
|
description: Jt(e.description)
|
|
1734
1579
|
}) : Jt(e.description)
|
|
1735
1580
|
}),
|
|
1736
|
-
e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */
|
|
1581
|
+
e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Q("div", {
|
|
1737
1582
|
className: "flex gap-2 mt-3",
|
|
1738
1583
|
children: e.header.actions.map((e, t) => {
|
|
1739
1584
|
let n = qt(e.icon);
|
|
1740
|
-
return /* @__PURE__ */
|
|
1585
|
+
return /* @__PURE__ */ $(F, {
|
|
1741
1586
|
variant: "outline",
|
|
1742
1587
|
size: "sm",
|
|
1743
1588
|
onClick: async () => {
|
|
@@ -1751,81 +1596,81 @@ var nn = /* @__PURE__ */ new Set([
|
|
|
1751
1596
|
return;
|
|
1752
1597
|
}
|
|
1753
1598
|
if (t === "modal" || t === "script") {
|
|
1754
|
-
let e = await
|
|
1599
|
+
let e = await ne(n || r);
|
|
1755
1600
|
e?.success || console.warn("[DashboardRenderer] action failed", e?.error);
|
|
1756
1601
|
return;
|
|
1757
1602
|
}
|
|
1758
1603
|
console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
|
|
1759
1604
|
},
|
|
1760
|
-
children: [n && /* @__PURE__ */
|
|
1605
|
+
children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }), de(e)]
|
|
1761
1606
|
}, t);
|
|
1762
1607
|
})
|
|
1763
1608
|
})
|
|
1764
1609
|
]
|
|
1765
|
-
}),
|
|
1610
|
+
}), ye = k.length > 0 && /* @__PURE__ */ Q(Gt, {
|
|
1766
1611
|
defs: k,
|
|
1767
1612
|
values: M,
|
|
1768
1613
|
onChange: ee,
|
|
1769
1614
|
onReset: te,
|
|
1770
1615
|
dataSource: n,
|
|
1771
1616
|
className: "mb-2"
|
|
1772
|
-
}),
|
|
1617
|
+
}), be = i !== void 0 && /* @__PURE__ */ $("span", {
|
|
1773
1618
|
className: "text-xs text-muted-foreground",
|
|
1774
1619
|
children: [i.toLocaleString(), " records"]
|
|
1775
|
-
}),
|
|
1776
|
-
className:
|
|
1777
|
-
children: [
|
|
1620
|
+
}), xe = a ? JSON.stringify(a) : void 0, Se = r && /* @__PURE__ */ $("div", {
|
|
1621
|
+
className: K("flex items-center justify-end gap-3 mb-2", !E && "col-span-full"),
|
|
1622
|
+
children: [be, /* @__PURE__ */ $(F, {
|
|
1778
1623
|
variant: "outline",
|
|
1779
1624
|
size: "sm",
|
|
1780
|
-
onClick:
|
|
1625
|
+
onClick: pe,
|
|
1781
1626
|
disabled: S,
|
|
1782
1627
|
"aria-label": "Refresh dashboard",
|
|
1783
|
-
children: [/* @__PURE__ */
|
|
1628
|
+
children: [/* @__PURE__ */ Q(He, { className: K("h-4 w-4 mr-2", S && "animate-spin") }), S ? "Refreshing…" : "Refresh All"]
|
|
1784
1629
|
})]
|
|
1785
|
-
}),
|
|
1630
|
+
}), G = X(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), Ce = X(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), we = X(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
|
|
1786
1631
|
if (E) {
|
|
1787
|
-
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */
|
|
1632
|
+
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ $("div", {
|
|
1788
1633
|
ref: h,
|
|
1789
|
-
className:
|
|
1790
|
-
"data-user-actions":
|
|
1634
|
+
className: K("flex flex-col gap-4 px-4", t),
|
|
1635
|
+
"data-user-actions": xe,
|
|
1791
1636
|
onClick: H,
|
|
1792
1637
|
...m,
|
|
1793
1638
|
children: [
|
|
1794
|
-
|
|
1639
|
+
ve,
|
|
1640
|
+
ye,
|
|
1795
1641
|
Se,
|
|
1796
|
-
|
|
1797
|
-
n.length > 0 && /* @__PURE__ */ Z("div", {
|
|
1642
|
+
n.length > 0 && /* @__PURE__ */ Q("div", {
|
|
1798
1643
|
className: "grid grid-cols-2 gap-3",
|
|
1799
1644
|
onClick: H,
|
|
1800
|
-
children: /* @__PURE__ */
|
|
1801
|
-
items:
|
|
1802
|
-
strategy:
|
|
1645
|
+
children: /* @__PURE__ */ Q(Qe, {
|
|
1646
|
+
items: Ce,
|
|
1647
|
+
strategy: et,
|
|
1803
1648
|
disabled: !U,
|
|
1804
|
-
children: n.map((e, t) =>
|
|
1649
|
+
children: n.map((e, t) => _e(e, t))
|
|
1805
1650
|
})
|
|
1806
1651
|
}),
|
|
1807
|
-
r.length > 0 && /* @__PURE__ */
|
|
1652
|
+
r.length > 0 && /* @__PURE__ */ Q("div", {
|
|
1808
1653
|
className: "flex flex-col gap-4",
|
|
1809
1654
|
onClick: H,
|
|
1810
|
-
children: /* @__PURE__ */
|
|
1811
|
-
items:
|
|
1812
|
-
strategy:
|
|
1655
|
+
children: /* @__PURE__ */ Q(Qe, {
|
|
1656
|
+
items: we,
|
|
1657
|
+
strategy: nt,
|
|
1813
1658
|
disabled: !U,
|
|
1814
|
-
children: r.map((e, t) =>
|
|
1659
|
+
children: r.map((e, t) => _e(e, t, !0))
|
|
1815
1660
|
})
|
|
1816
1661
|
})
|
|
1817
1662
|
]
|
|
1818
1663
|
});
|
|
1819
|
-
return U ? /* @__PURE__ */
|
|
1820
|
-
sensors:
|
|
1821
|
-
collisionDetection:
|
|
1822
|
-
onDragEnd:
|
|
1664
|
+
return U ? /* @__PURE__ */ Q(qe, {
|
|
1665
|
+
sensors: ge,
|
|
1666
|
+
collisionDetection: Ye,
|
|
1667
|
+
onDragEnd: W,
|
|
1823
1668
|
children: i
|
|
1824
1669
|
}) : i;
|
|
1825
1670
|
}
|
|
1826
|
-
let
|
|
1671
|
+
let q = /* @__PURE__ */ $("div", {
|
|
1827
1672
|
ref: h,
|
|
1828
|
-
className:
|
|
1673
|
+
className: K("grid", !x && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
|
|
1829
1674
|
style: {
|
|
1830
1675
|
...x && {
|
|
1831
1676
|
gridTemplateColumns: `repeat(${y}, minmax(0, 1fr))`,
|
|
@@ -1833,48 +1678,48 @@ var nn = /* @__PURE__ */ new Set([
|
|
|
1833
1678
|
},
|
|
1834
1679
|
gap: `${b * .25}rem`
|
|
1835
1680
|
},
|
|
1836
|
-
"data-user-actions":
|
|
1681
|
+
"data-user-actions": xe,
|
|
1837
1682
|
onClick: H,
|
|
1838
1683
|
...m,
|
|
1839
1684
|
children: [
|
|
1840
|
-
|
|
1685
|
+
ve,
|
|
1686
|
+
ye,
|
|
1841
1687
|
Se,
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
strategy: tt,
|
|
1688
|
+
/* @__PURE__ */ Q(Qe, {
|
|
1689
|
+
items: G,
|
|
1690
|
+
strategy: et,
|
|
1846
1691
|
disabled: !U,
|
|
1847
|
-
children: e.widgets?.map((e, t) =>
|
|
1692
|
+
children: e.widgets?.map((e, t) => _e(e, t))
|
|
1848
1693
|
})
|
|
1849
1694
|
]
|
|
1850
1695
|
});
|
|
1851
|
-
return U ? /* @__PURE__ */
|
|
1852
|
-
sensors:
|
|
1853
|
-
collisionDetection:
|
|
1854
|
-
onDragEnd:
|
|
1855
|
-
children:
|
|
1856
|
-
}) :
|
|
1696
|
+
return U ? /* @__PURE__ */ Q(qe, {
|
|
1697
|
+
sensors: ge,
|
|
1698
|
+
collisionDetection: Ye,
|
|
1699
|
+
onDragEnd: W,
|
|
1700
|
+
children: q
|
|
1701
|
+
}) : q;
|
|
1857
1702
|
});
|
|
1858
|
-
|
|
1859
|
-
var
|
|
1860
|
-
let { schema: n } = e, r =
|
|
1861
|
-
return r.length === 0 ? /* @__PURE__ */
|
|
1703
|
+
an.displayName = "DashboardRendererInner";
|
|
1704
|
+
var on = De((e, t) => {
|
|
1705
|
+
let { schema: n } = e, r = X(() => v(n), [n.globalFilters, n.dateRange]);
|
|
1706
|
+
return r.length === 0 ? /* @__PURE__ */ Q(an, {
|
|
1862
1707
|
ref: t,
|
|
1863
1708
|
...e
|
|
1864
|
-
}) : /* @__PURE__ */
|
|
1709
|
+
}) : /* @__PURE__ */ Q(S, {
|
|
1865
1710
|
definitions: u(r),
|
|
1866
|
-
children: /* @__PURE__ */
|
|
1711
|
+
children: /* @__PURE__ */ Q(an, {
|
|
1867
1712
|
ref: t,
|
|
1868
1713
|
...e
|
|
1869
1714
|
})
|
|
1870
1715
|
});
|
|
1871
1716
|
});
|
|
1872
|
-
|
|
1717
|
+
on.displayName = "DashboardRenderer";
|
|
1873
1718
|
//#endregion
|
|
1874
1719
|
//#region src/DashboardGridLayout.tsx
|
|
1875
|
-
function
|
|
1720
|
+
function sn({ editMode: e }) {
|
|
1876
1721
|
let t = D();
|
|
1877
|
-
return
|
|
1722
|
+
return q.useEffect(() => {
|
|
1878
1723
|
if (e) return t.startDrag({
|
|
1879
1724
|
id: "dashboard-layout",
|
|
1880
1725
|
type: "dashboard-widget",
|
|
@@ -1885,14 +1730,14 @@ function on({ editMode: e }) {
|
|
|
1885
1730
|
t.endDrag("dashboard");
|
|
1886
1731
|
}, [e, t]), null;
|
|
1887
1732
|
}
|
|
1888
|
-
var
|
|
1733
|
+
var cn = [
|
|
1889
1734
|
"hsl(var(--chart-1))",
|
|
1890
1735
|
"hsl(var(--chart-2))",
|
|
1891
1736
|
"hsl(var(--chart-3))",
|
|
1892
1737
|
"hsl(var(--chart-4))",
|
|
1893
1738
|
"hsl(var(--chart-5))"
|
|
1894
1739
|
];
|
|
1895
|
-
function
|
|
1740
|
+
function ln(e, t) {
|
|
1896
1741
|
if (!e.widgets?.length) return e;
|
|
1897
1742
|
let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
|
|
1898
1743
|
let r = e.id || `widget-${t}`, i = n.get(r);
|
|
@@ -1911,7 +1756,7 @@ function cn(e, t) {
|
|
|
1911
1756
|
widgets: r
|
|
1912
1757
|
};
|
|
1913
1758
|
}
|
|
1914
|
-
function
|
|
1759
|
+
function un(e) {
|
|
1915
1760
|
return { lg: e.widgets?.map((e, t) => ({
|
|
1916
1761
|
i: e.id || `widget-${t}`,
|
|
1917
1762
|
x: e.layout?.x ?? t % 4 * 3,
|
|
@@ -1920,11 +1765,11 @@ function ln(e) {
|
|
|
1920
1765
|
h: e.layout?.h ?? 4
|
|
1921
1766
|
})) || [] };
|
|
1922
1767
|
}
|
|
1923
|
-
var
|
|
1924
|
-
let { width: a, containerRef: o, mounted: s } =
|
|
1768
|
+
var dn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
|
|
1769
|
+
let { width: a, containerRef: o, mounted: s } = dt(), [c, l] = q.useState(!1), [u, d] = q.useState(!1), f = k(), p = q.useRef(null), m = q.useCallback(() => {
|
|
1925
1770
|
i && (d(!0), i(), setTimeout(() => d(!1), 600));
|
|
1926
1771
|
}, [i]);
|
|
1927
|
-
|
|
1772
|
+
q.useEffect(() => {
|
|
1928
1773
|
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return p.current = setInterval(m, e.refreshInterval * 1e3), () => {
|
|
1929
1774
|
p.current && clearInterval(p.current);
|
|
1930
1775
|
};
|
|
@@ -1933,62 +1778,46 @@ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
1933
1778
|
i,
|
|
1934
1779
|
m
|
|
1935
1780
|
]);
|
|
1936
|
-
let [h, g] =
|
|
1781
|
+
let [h, g] = q.useState(() => un(e)), _ = q.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
|
|
1937
1782
|
i: e.id || `widget-${t}`,
|
|
1938
1783
|
x: e.layout?.x,
|
|
1939
1784
|
y: e.layout?.y,
|
|
1940
1785
|
w: e.layout?.w,
|
|
1941
1786
|
h: e.layout?.h
|
|
1942
1787
|
})) ?? []), [e.widgets]);
|
|
1943
|
-
|
|
1944
|
-
g(
|
|
1788
|
+
q.useEffect(() => {
|
|
1789
|
+
g(un(e));
|
|
1945
1790
|
}, [_]);
|
|
1946
|
-
let v =
|
|
1791
|
+
let v = q.useCallback((e, t) => {
|
|
1947
1792
|
g(t), n?.(e);
|
|
1948
|
-
}, [n]), y =
|
|
1949
|
-
r ? r(
|
|
1793
|
+
}, [n]), y = q.useCallback(() => {
|
|
1794
|
+
r ? r(ln(e, h.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), l(!1);
|
|
1950
1795
|
}, [
|
|
1951
1796
|
r,
|
|
1952
1797
|
e,
|
|
1953
1798
|
h
|
|
1954
|
-
]), b =
|
|
1955
|
-
g(
|
|
1956
|
-
}, [e]), x =
|
|
1799
|
+
]), b = q.useCallback(() => {
|
|
1800
|
+
g(un(e));
|
|
1801
|
+
}, [e]), x = q.useCallback((e) => {
|
|
1957
1802
|
if (e.component) return e.component;
|
|
1958
1803
|
let t = e.type, n = e.options || {};
|
|
1959
1804
|
if (t === "bar" || t === "horizontal-bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter" || t === "funnel") {
|
|
1960
|
-
let r = e.data || n.data, i =
|
|
1961
|
-
if (
|
|
1962
|
-
let
|
|
1963
|
-
field: e.
|
|
1964
|
-
function: e.
|
|
1965
|
-
groupBy: e.
|
|
1966
|
-
} : void 0,
|
|
1967
|
-
return {
|
|
1968
|
-
type: "object-chart",
|
|
1969
|
-
chartType: t,
|
|
1970
|
-
objectName: e.object || r.object,
|
|
1971
|
-
aggregate: o,
|
|
1972
|
-
xAxisKey: i,
|
|
1973
|
-
series: [{ dataKey: s }],
|
|
1974
|
-
colors: sn,
|
|
1975
|
-
className: "h-full"
|
|
1976
|
-
};
|
|
1977
|
-
}
|
|
1978
|
-
if (!r && e.object) {
|
|
1979
|
-
let n = e.aggregate ? {
|
|
1980
|
-
field: e.valueField || "value",
|
|
1981
|
-
function: e.aggregate,
|
|
1982
|
-
groupBy: e.categoryField || "name"
|
|
1983
|
-
} : void 0;
|
|
1805
|
+
let r = e.data || n.data, i = n.xField || "name", a = n.yField || "value";
|
|
1806
|
+
if (ft(r)) {
|
|
1807
|
+
let e = r.aggregate, n = e ? {
|
|
1808
|
+
field: e.field,
|
|
1809
|
+
function: e.function,
|
|
1810
|
+
groupBy: e.groupBy
|
|
1811
|
+
} : void 0, o = n?.field || a;
|
|
1984
1812
|
return {
|
|
1985
1813
|
type: "object-chart",
|
|
1986
1814
|
chartType: t,
|
|
1987
|
-
objectName:
|
|
1815
|
+
objectName: r.object,
|
|
1988
1816
|
aggregate: n,
|
|
1989
1817
|
xAxisKey: i,
|
|
1990
|
-
series: [{ dataKey:
|
|
1991
|
-
colors:
|
|
1818
|
+
series: [{ dataKey: o }],
|
|
1819
|
+
colors: cn,
|
|
1820
|
+
isAnimationActive: !1,
|
|
1992
1821
|
className: "h-full"
|
|
1993
1822
|
};
|
|
1994
1823
|
}
|
|
@@ -1998,18 +1827,19 @@ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
1998
1827
|
data: Array.isArray(r) ? r : r?.items || [],
|
|
1999
1828
|
xAxisKey: i,
|
|
2000
1829
|
series: [{ dataKey: a }],
|
|
2001
|
-
colors:
|
|
1830
|
+
colors: cn,
|
|
1831
|
+
isAnimationActive: !1,
|
|
2002
1832
|
className: "h-full"
|
|
2003
1833
|
};
|
|
2004
1834
|
}
|
|
2005
1835
|
if (t === "table") {
|
|
2006
1836
|
let t = e.data || n.data;
|
|
2007
|
-
if (
|
|
2008
|
-
let { data:
|
|
1837
|
+
if (ft(t)) {
|
|
1838
|
+
let { data: e, ...r } = n;
|
|
2009
1839
|
return {
|
|
2010
1840
|
type: "data-table",
|
|
2011
|
-
...
|
|
2012
|
-
objectName:
|
|
1841
|
+
...r,
|
|
1842
|
+
objectName: t.object,
|
|
2013
1843
|
dataProvider: t,
|
|
2014
1844
|
data: [],
|
|
2015
1845
|
searchable: !1,
|
|
@@ -2017,15 +1847,7 @@ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
2017
1847
|
className: "border-0"
|
|
2018
1848
|
};
|
|
2019
1849
|
}
|
|
2020
|
-
return
|
|
2021
|
-
type: "data-table",
|
|
2022
|
-
...n,
|
|
2023
|
-
objectName: e.object,
|
|
2024
|
-
data: [],
|
|
2025
|
-
searchable: !1,
|
|
2026
|
-
pagination: !1,
|
|
2027
|
-
className: "border-0"
|
|
2028
|
-
} : {
|
|
1850
|
+
return {
|
|
2029
1851
|
type: "data-table",
|
|
2030
1852
|
...n,
|
|
2031
1853
|
data: t?.items || [],
|
|
@@ -2036,12 +1858,12 @@ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
2036
1858
|
}
|
|
2037
1859
|
if (t === "pivot") {
|
|
2038
1860
|
let t = e.data || n.data;
|
|
2039
|
-
if (
|
|
2040
|
-
let { data:
|
|
1861
|
+
if (ft(t)) {
|
|
1862
|
+
let { data: e, ...r } = n;
|
|
2041
1863
|
return {
|
|
2042
1864
|
type: "pivot",
|
|
2043
|
-
...
|
|
2044
|
-
objectName:
|
|
1865
|
+
...r,
|
|
1866
|
+
objectName: t.object,
|
|
2045
1867
|
dataProvider: t,
|
|
2046
1868
|
data: []
|
|
2047
1869
|
};
|
|
@@ -2057,54 +1879,54 @@ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
2057
1879
|
...n
|
|
2058
1880
|
};
|
|
2059
1881
|
}, []);
|
|
2060
|
-
return /* @__PURE__ */
|
|
1882
|
+
return /* @__PURE__ */ $("div", {
|
|
2061
1883
|
ref: o,
|
|
2062
|
-
className:
|
|
1884
|
+
className: K("w-full", t),
|
|
2063
1885
|
"data-testid": "grid-layout",
|
|
2064
1886
|
children: [
|
|
2065
|
-
f && /* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
1887
|
+
f && /* @__PURE__ */ Q(sn, { editMode: c }),
|
|
1888
|
+
/* @__PURE__ */ $("div", {
|
|
2067
1889
|
className: "mb-4 flex items-center justify-between",
|
|
2068
|
-
children: [/* @__PURE__ */
|
|
1890
|
+
children: [/* @__PURE__ */ Q("h2", {
|
|
2069
1891
|
className: "text-2xl font-bold",
|
|
2070
|
-
children: e.title || "Dashboard"
|
|
2071
|
-
}), /* @__PURE__ */
|
|
1892
|
+
children: e.title || e.label || "Dashboard"
|
|
1893
|
+
}), /* @__PURE__ */ Q("div", {
|
|
2072
1894
|
className: "flex gap-2",
|
|
2073
|
-
children: c ? /* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
1895
|
+
children: c ? /* @__PURE__ */ $(lt, { children: [
|
|
1896
|
+
/* @__PURE__ */ $(F, {
|
|
2075
1897
|
onClick: y,
|
|
2076
1898
|
size: "sm",
|
|
2077
1899
|
variant: "default",
|
|
2078
|
-
children: [/* @__PURE__ */
|
|
1900
|
+
children: [/* @__PURE__ */ Q(We, { className: "h-4 w-4 mr-2" }), "Save Layout"]
|
|
2079
1901
|
}),
|
|
2080
|
-
/* @__PURE__ */
|
|
1902
|
+
/* @__PURE__ */ $(F, {
|
|
2081
1903
|
onClick: b,
|
|
2082
1904
|
size: "sm",
|
|
2083
1905
|
variant: "outline",
|
|
2084
|
-
children: [/* @__PURE__ */
|
|
1906
|
+
children: [/* @__PURE__ */ Q(Ke, { className: "h-4 w-4 mr-2" }), "Reset"]
|
|
2085
1907
|
}),
|
|
2086
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ Q(F, {
|
|
2087
1909
|
onClick: () => l(!1),
|
|
2088
1910
|
size: "sm",
|
|
2089
1911
|
variant: "ghost",
|
|
2090
1912
|
children: "Cancel"
|
|
2091
1913
|
})
|
|
2092
|
-
] }) : /* @__PURE__ */
|
|
1914
|
+
] }) : /* @__PURE__ */ $(lt, { children: [i && /* @__PURE__ */ $(F, {
|
|
2093
1915
|
onClick: m,
|
|
2094
1916
|
size: "sm",
|
|
2095
1917
|
variant: "outline",
|
|
2096
1918
|
disabled: u,
|
|
2097
1919
|
"aria-label": "Refresh dashboard",
|
|
2098
|
-
children: [/* @__PURE__ */
|
|
2099
|
-
}), /* @__PURE__ */
|
|
1920
|
+
children: [/* @__PURE__ */ Q(He, { className: K("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
|
|
1921
|
+
}), /* @__PURE__ */ $(F, {
|
|
2100
1922
|
onClick: () => l(!0),
|
|
2101
1923
|
size: "sm",
|
|
2102
1924
|
variant: "outline",
|
|
2103
|
-
children: [/* @__PURE__ */
|
|
1925
|
+
children: [/* @__PURE__ */ Q(Re, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
|
|
2104
1926
|
})] })
|
|
2105
1927
|
})]
|
|
2106
1928
|
}),
|
|
2107
|
-
s && /* @__PURE__ */
|
|
1929
|
+
s && /* @__PURE__ */ Q(ut, {
|
|
2108
1930
|
className: "layout",
|
|
2109
1931
|
width: a,
|
|
2110
1932
|
layouts: h,
|
|
@@ -2131,34 +1953,34 @@ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
2131
1953
|
onLayoutChange: v,
|
|
2132
1954
|
children: e.widgets?.map((e, t) => {
|
|
2133
1955
|
let n = e.id || `widget-${t}`, r = x(e);
|
|
2134
|
-
return /* @__PURE__ */
|
|
1956
|
+
return /* @__PURE__ */ Q("div", {
|
|
2135
1957
|
className: "h-full",
|
|
2136
|
-
children: e.type === "metric" ? /* @__PURE__ */
|
|
1958
|
+
children: e.type === "metric" ? /* @__PURE__ */ $("div", {
|
|
2137
1959
|
className: "h-full w-full relative",
|
|
2138
|
-
children: [c && /* @__PURE__ */
|
|
1960
|
+
children: [c && /* @__PURE__ */ Q("div", {
|
|
2139
1961
|
className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
|
|
2140
|
-
children: /* @__PURE__ */
|
|
2141
|
-
}), /* @__PURE__ */
|
|
1962
|
+
children: /* @__PURE__ */ Q(ze, { className: "h-4 w-4" })
|
|
1963
|
+
}), /* @__PURE__ */ Q(C, {
|
|
2142
1964
|
schema: r,
|
|
2143
1965
|
className: "h-full w-full"
|
|
2144
1966
|
})]
|
|
2145
|
-
}) : /* @__PURE__ */
|
|
2146
|
-
className:
|
|
2147
|
-
children: [e.title && /* @__PURE__ */
|
|
1967
|
+
}) : /* @__PURE__ */ $(L, {
|
|
1968
|
+
className: K("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", c && "ring-2 ring-primary/20"),
|
|
1969
|
+
children: [e.title && /* @__PURE__ */ $(ie, {
|
|
2148
1970
|
className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
|
|
2149
|
-
children: [/* @__PURE__ */
|
|
1971
|
+
children: [/* @__PURE__ */ Q(ae, {
|
|
2150
1972
|
className: "text-base font-medium tracking-tight truncate",
|
|
2151
1973
|
title: e.title,
|
|
2152
1974
|
children: e.title
|
|
2153
|
-
}), c && /* @__PURE__ */
|
|
1975
|
+
}), c && /* @__PURE__ */ Q("div", {
|
|
2154
1976
|
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
2155
|
-
children: /* @__PURE__ */
|
|
1977
|
+
children: /* @__PURE__ */ Q(ze, { className: "h-4 w-4" })
|
|
2156
1978
|
})]
|
|
2157
|
-
}), /* @__PURE__ */
|
|
1979
|
+
}), /* @__PURE__ */ Q(re, {
|
|
2158
1980
|
className: "p-0 h-full",
|
|
2159
|
-
children: /* @__PURE__ */
|
|
2160
|
-
className:
|
|
2161
|
-
children: /* @__PURE__ */
|
|
1981
|
+
children: /* @__PURE__ */ Q("div", {
|
|
1982
|
+
className: K("h-full w-full overflow-auto p-4"),
|
|
1983
|
+
children: /* @__PURE__ */ Q(C, { schema: r })
|
|
2162
1984
|
})
|
|
2163
1985
|
})]
|
|
2164
1986
|
})
|
|
@@ -2167,7 +1989,7 @@ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
2167
1989
|
})
|
|
2168
1990
|
]
|
|
2169
1991
|
});
|
|
2170
|
-
},
|
|
1992
|
+
}, fn = M({
|
|
2171
1993
|
"dashboard.trend.vsLastQuarter": "vs last quarter",
|
|
2172
1994
|
"dashboard.trend.vsLastMonth": "vs last month",
|
|
2173
1995
|
"dashboard.trend.vsLastWeek": "vs last week",
|
|
@@ -2175,7 +1997,7 @@ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
|
|
|
2175
1997
|
"dashboard.trend.vsYesterday": "vs yesterday",
|
|
2176
1998
|
"dashboard.trend.vsPreviousPeriod": "vs previous period"
|
|
2177
1999
|
}, "dashboard.trend.vsLastQuarter");
|
|
2178
|
-
function
|
|
2000
|
+
function pn(e) {
|
|
2179
2001
|
switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
|
|
2180
2002
|
case "vs last quarter":
|
|
2181
2003
|
case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
|
|
@@ -2191,11 +2013,11 @@ function fn(e) {
|
|
|
2191
2013
|
default: return;
|
|
2192
2014
|
}
|
|
2193
2015
|
}
|
|
2194
|
-
function
|
|
2016
|
+
function mn(e, t, n) {
|
|
2195
2017
|
if (e == null) return "";
|
|
2196
2018
|
if (typeof e == "string") {
|
|
2197
2019
|
let r = Number(e);
|
|
2198
|
-
return !isFinite(r) || e.trim() === "" ? e :
|
|
2020
|
+
return !isFinite(r) || e.trim() === "" ? e : mn(r, t, n);
|
|
2199
2021
|
}
|
|
2200
2022
|
if (!isFinite(e)) return String(e);
|
|
2201
2023
|
let r = {
|
|
@@ -2232,10 +2054,10 @@ function pn(e, t, n) {
|
|
|
2232
2054
|
maximumFractionDigits: c
|
|
2233
2055
|
}).format(e);
|
|
2234
2056
|
}
|
|
2235
|
-
function
|
|
2057
|
+
function hn(e) {
|
|
2236
2058
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
2237
2059
|
}
|
|
2238
|
-
var
|
|
2060
|
+
var gn = {
|
|
2239
2061
|
default: "bg-muted text-muted-foreground",
|
|
2240
2062
|
blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
2241
2063
|
teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
|
|
@@ -2244,7 +2066,7 @@ var hn = {
|
|
|
2244
2066
|
success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
|
2245
2067
|
warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
2246
2068
|
danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
|
|
2247
|
-
},
|
|
2069
|
+
}, _n = {
|
|
2248
2070
|
default: "text-foreground",
|
|
2249
2071
|
blue: "text-blue-600 dark:text-blue-400",
|
|
2250
2072
|
teal: "text-teal-600 dark:text-teal-400",
|
|
@@ -2253,18 +2075,18 @@ var hn = {
|
|
|
2253
2075
|
success: "text-emerald-600 dark:text-emerald-400",
|
|
2254
2076
|
warning: "text-amber-600 dark:text-amber-400",
|
|
2255
2077
|
danger: "text-rose-600 dark:text-rose-400"
|
|
2256
|
-
},
|
|
2257
|
-
let g =
|
|
2258
|
-
let e =
|
|
2078
|
+
}, vn = ({ 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, variant: m = "card", ...h }) => {
|
|
2079
|
+
let g = gn[c] || gn.default, { t: _ } = fn(), v = X(() => {
|
|
2080
|
+
let e = hn(a) || hn(n?.label);
|
|
2259
2081
|
if (!e) return e;
|
|
2260
|
-
let t =
|
|
2082
|
+
let t = pn(e);
|
|
2261
2083
|
return t ? _(t) : e;
|
|
2262
2084
|
}, [
|
|
2263
2085
|
a,
|
|
2264
2086
|
n?.label,
|
|
2265
2087
|
_
|
|
2266
|
-
]), y =
|
|
2267
|
-
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ?
|
|
2088
|
+
]), y = X(() => {
|
|
2089
|
+
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? mn(t, l, u) : t ?? "", n = String(e);
|
|
2268
2090
|
return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
|
|
2269
2091
|
}, [
|
|
2270
2092
|
t,
|
|
@@ -2272,49 +2094,49 @@ var hn = {
|
|
|
2272
2094
|
u,
|
|
2273
2095
|
d,
|
|
2274
2096
|
f
|
|
2275
|
-
]), b =
|
|
2097
|
+
]), b = X(() => {
|
|
2276
2098
|
if (typeof r == "string") {
|
|
2277
|
-
let e =
|
|
2278
|
-
return e ? /* @__PURE__ */
|
|
2099
|
+
let e = Ce(r);
|
|
2100
|
+
return e ? /* @__PURE__ */ Q(e, { className: "h-4 w-4" }) : null;
|
|
2279
2101
|
}
|
|
2280
2102
|
return r;
|
|
2281
2103
|
}, [r]);
|
|
2282
2104
|
if (m === "bare") {
|
|
2283
|
-
let t =
|
|
2284
|
-
return /* @__PURE__ */
|
|
2285
|
-
className:
|
|
2105
|
+
let t = _n[c] || _n.default;
|
|
2106
|
+
return /* @__PURE__ */ Q("div", {
|
|
2107
|
+
className: K("flex flex-col gap-1 min-w-0", p && "cursor-pointer", i),
|
|
2286
2108
|
onClick: p,
|
|
2287
2109
|
role: p ? "button" : void 0,
|
|
2288
2110
|
tabIndex: p ? 0 : void 0,
|
|
2289
2111
|
onKeyDown: p ? (e) => {
|
|
2290
2112
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
|
|
2291
2113
|
} : void 0,
|
|
2292
|
-
children: o ? /* @__PURE__ */
|
|
2114
|
+
children: o ? /* @__PURE__ */ $("div", {
|
|
2293
2115
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2294
2116
|
"data-testid": "metric-loading",
|
|
2295
|
-
children: [/* @__PURE__ */
|
|
2117
|
+
children: [/* @__PURE__ */ Q(Be, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
2296
2118
|
className: "text-sm",
|
|
2297
2119
|
children: "Loading…"
|
|
2298
2120
|
})]
|
|
2299
|
-
}) : s ? /* @__PURE__ */
|
|
2121
|
+
}) : s ? /* @__PURE__ */ $("div", {
|
|
2300
2122
|
className: "flex items-center gap-2",
|
|
2301
2123
|
"data-testid": "metric-error",
|
|
2302
2124
|
role: "alert",
|
|
2303
|
-
children: [/* @__PURE__ */
|
|
2125
|
+
children: [/* @__PURE__ */ Q(Ae, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
2304
2126
|
className: "text-xs text-destructive truncate",
|
|
2305
2127
|
children: s
|
|
2306
2128
|
})]
|
|
2307
|
-
}) : /* @__PURE__ */
|
|
2308
|
-
className:
|
|
2129
|
+
}) : /* @__PURE__ */ $(lt, { children: [/* @__PURE__ */ Q("div", {
|
|
2130
|
+
className: K("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", t),
|
|
2309
2131
|
children: y
|
|
2310
|
-
}), /* @__PURE__ */
|
|
2132
|
+
}), /* @__PURE__ */ Q("div", {
|
|
2311
2133
|
className: "text-xs font-medium text-muted-foreground truncate",
|
|
2312
|
-
children:
|
|
2134
|
+
children: hn(e)
|
|
2313
2135
|
})] })
|
|
2314
2136
|
});
|
|
2315
2137
|
}
|
|
2316
|
-
return /* @__PURE__ */
|
|
2317
|
-
className:
|
|
2138
|
+
return /* @__PURE__ */ $(L, {
|
|
2139
|
+
className: K("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),
|
|
2318
2140
|
onClick: p,
|
|
2319
2141
|
role: p ? "button" : void 0,
|
|
2320
2142
|
tabIndex: p ? 0 : void 0,
|
|
@@ -2322,45 +2144,45 @@ var hn = {
|
|
|
2322
2144
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
|
|
2323
2145
|
} : void 0,
|
|
2324
2146
|
...h,
|
|
2325
|
-
children: [/* @__PURE__ */
|
|
2147
|
+
children: [/* @__PURE__ */ $(ie, {
|
|
2326
2148
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
2327
|
-
children: [/* @__PURE__ */
|
|
2149
|
+
children: [/* @__PURE__ */ Q(ae, {
|
|
2328
2150
|
className: "text-sm font-medium truncate",
|
|
2329
|
-
children:
|
|
2330
|
-
}), b && /* @__PURE__ */
|
|
2331
|
-
className:
|
|
2151
|
+
children: hn(e)
|
|
2152
|
+
}), b && /* @__PURE__ */ Q("div", {
|
|
2153
|
+
className: K("flex h-8 w-8 items-center justify-center rounded-md shrink-0", g),
|
|
2332
2154
|
children: b
|
|
2333
2155
|
})]
|
|
2334
|
-
}), /* @__PURE__ */
|
|
2156
|
+
}), /* @__PURE__ */ Q(re, { children: o ? /* @__PURE__ */ $("div", {
|
|
2335
2157
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2336
2158
|
"data-testid": "metric-loading",
|
|
2337
|
-
children: [/* @__PURE__ */
|
|
2159
|
+
children: [/* @__PURE__ */ Q(Be, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
2338
2160
|
className: "text-sm",
|
|
2339
2161
|
children: "Loading…"
|
|
2340
2162
|
})]
|
|
2341
|
-
}) : s ? /* @__PURE__ */
|
|
2163
|
+
}) : s ? /* @__PURE__ */ $("div", {
|
|
2342
2164
|
className: "flex items-center gap-2",
|
|
2343
2165
|
"data-testid": "metric-error",
|
|
2344
2166
|
role: "alert",
|
|
2345
|
-
children: [/* @__PURE__ */
|
|
2167
|
+
children: [/* @__PURE__ */ Q(Ae, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
2346
2168
|
className: "text-xs text-destructive truncate",
|
|
2347
2169
|
children: s
|
|
2348
2170
|
})]
|
|
2349
|
-
}) : /* @__PURE__ */
|
|
2171
|
+
}) : /* @__PURE__ */ $(lt, { children: [/* @__PURE__ */ Q("div", {
|
|
2350
2172
|
className: "text-2xl font-bold tabular-nums tracking-tight truncate",
|
|
2351
2173
|
children: y
|
|
2352
|
-
}), (n || a) && /* @__PURE__ */
|
|
2174
|
+
}), (n || a) && /* @__PURE__ */ $("div", {
|
|
2353
2175
|
className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
|
|
2354
|
-
children: [n && /* @__PURE__ */
|
|
2355
|
-
className:
|
|
2176
|
+
children: [n && /* @__PURE__ */ $("span", {
|
|
2177
|
+
className: K("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"),
|
|
2356
2178
|
children: [
|
|
2357
|
-
n.direction === "up" && /* @__PURE__ */
|
|
2358
|
-
n.direction === "down" && /* @__PURE__ */
|
|
2359
|
-
n.direction === "neutral" && /* @__PURE__ */
|
|
2179
|
+
n.direction === "up" && /* @__PURE__ */ Q(Ne, { className: "h-3 w-3 mr-1" }),
|
|
2180
|
+
n.direction === "down" && /* @__PURE__ */ Q(Me, { className: "h-3 w-3 mr-1" }),
|
|
2181
|
+
n.direction === "neutral" && /* @__PURE__ */ Q(Ve, { className: "h-3 w-3 mr-1" }),
|
|
2360
2182
|
n.value,
|
|
2361
2183
|
"%"
|
|
2362
2184
|
]
|
|
2363
|
-
}), /* @__PURE__ */
|
|
2185
|
+
}), /* @__PURE__ */ Q("span", {
|
|
2364
2186
|
className: "truncate min-w-0",
|
|
2365
2187
|
children: v
|
|
2366
2188
|
})]
|
|
@@ -2369,84 +2191,84 @@ var hn = {
|
|
|
2369
2191
|
};
|
|
2370
2192
|
//#endregion
|
|
2371
2193
|
//#region src/MetricCard.tsx
|
|
2372
|
-
function
|
|
2194
|
+
function yn(e) {
|
|
2373
2195
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
2374
2196
|
}
|
|
2375
|
-
var
|
|
2376
|
-
let u = n ?
|
|
2377
|
-
return /* @__PURE__ */
|
|
2378
|
-
className:
|
|
2197
|
+
var bn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
|
|
2198
|
+
let u = n ? Ce(n) : null;
|
|
2199
|
+
return /* @__PURE__ */ $(L, {
|
|
2200
|
+
className: K("h-full", o),
|
|
2379
2201
|
...l,
|
|
2380
|
-
children: [/* @__PURE__ */
|
|
2202
|
+
children: [/* @__PURE__ */ $(ie, {
|
|
2381
2203
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
2382
|
-
children: [/* @__PURE__ */
|
|
2204
|
+
children: [/* @__PURE__ */ Q(ae, {
|
|
2383
2205
|
className: "text-sm font-medium",
|
|
2384
|
-
children:
|
|
2385
|
-
}), u && /* @__PURE__ */
|
|
2386
|
-
}), /* @__PURE__ */
|
|
2206
|
+
children: yn(e)
|
|
2207
|
+
}), u && /* @__PURE__ */ Q(u, { className: "h-4 w-4 text-muted-foreground" })]
|
|
2208
|
+
}), /* @__PURE__ */ Q(re, { children: s ? /* @__PURE__ */ $("div", {
|
|
2387
2209
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2388
2210
|
"data-testid": "metric-card-loading",
|
|
2389
|
-
children: [/* @__PURE__ */
|
|
2211
|
+
children: [/* @__PURE__ */ Q(Be, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
2390
2212
|
className: "text-sm",
|
|
2391
2213
|
children: "Loading…"
|
|
2392
2214
|
})]
|
|
2393
|
-
}) : c ? /* @__PURE__ */
|
|
2215
|
+
}) : c ? /* @__PURE__ */ $("div", {
|
|
2394
2216
|
className: "flex items-center gap-2",
|
|
2395
2217
|
"data-testid": "metric-card-error",
|
|
2396
2218
|
role: "alert",
|
|
2397
|
-
children: [/* @__PURE__ */
|
|
2219
|
+
children: [/* @__PURE__ */ Q(Ae, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
2398
2220
|
className: "text-xs text-destructive truncate",
|
|
2399
2221
|
children: c
|
|
2400
2222
|
})]
|
|
2401
|
-
}) : /* @__PURE__ */
|
|
2223
|
+
}) : /* @__PURE__ */ $(lt, { children: [/* @__PURE__ */ Q("div", {
|
|
2402
2224
|
className: "text-2xl font-bold",
|
|
2403
2225
|
children: t
|
|
2404
|
-
}), (r || i || a) && /* @__PURE__ */
|
|
2226
|
+
}), (r || i || a) && /* @__PURE__ */ $("p", {
|
|
2405
2227
|
className: "text-xs text-muted-foreground flex items-center mt-1",
|
|
2406
|
-
children: [r && i && /* @__PURE__ */
|
|
2407
|
-
className:
|
|
2228
|
+
children: [r && i && /* @__PURE__ */ $("span", {
|
|
2229
|
+
className: K("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
|
|
2408
2230
|
children: [
|
|
2409
|
-
r === "up" && /* @__PURE__ */
|
|
2410
|
-
r === "down" && /* @__PURE__ */
|
|
2411
|
-
r === "neutral" && /* @__PURE__ */
|
|
2231
|
+
r === "up" && /* @__PURE__ */ Q(Ne, { className: "h-3 w-3 mr-1" }),
|
|
2232
|
+
r === "down" && /* @__PURE__ */ Q(Me, { className: "h-3 w-3 mr-1" }),
|
|
2233
|
+
r === "neutral" && /* @__PURE__ */ Q(Ve, { className: "h-3 w-3 mr-1" }),
|
|
2412
2234
|
i
|
|
2413
2235
|
]
|
|
2414
|
-
}),
|
|
2236
|
+
}), yn(a)]
|
|
2415
2237
|
})] }) })]
|
|
2416
2238
|
});
|
|
2417
|
-
},
|
|
2418
|
-
let O =
|
|
2419
|
-
|
|
2239
|
+
}, xn = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: a, icon: o, className: s, description: l, dataSource: u, colorVariant: d, format: f, currency: p, prefix: m, suffix: g, invert: _, drillDown: v, title: S, compareTo: T, t: E, variant: D }) => {
|
|
2240
|
+
let O = Oe(w), k = u || O?.dataSource, [A, j] = Z(!1), [M, N] = Z(null), [ne, P] = Z(null), [F, I] = Z(!1), [L, re] = Z(null), [ie, ae] = Z(null);
|
|
2241
|
+
Y(() => {
|
|
2420
2242
|
let t = !0;
|
|
2421
2243
|
if (!(!k || !e || typeof k.getObjectSchema != "function")) return k.getObjectSchema(e).then((e) => {
|
|
2422
|
-
t &&
|
|
2244
|
+
t && ae(e);
|
|
2423
2245
|
}).catch(() => {}), () => {
|
|
2424
2246
|
t = !1;
|
|
2425
2247
|
};
|
|
2426
2248
|
}, [k, e]);
|
|
2427
|
-
let
|
|
2249
|
+
let R = X(() => {
|
|
2428
2250
|
let e = t?.field;
|
|
2429
|
-
if (!e || !
|
|
2430
|
-
let n =
|
|
2251
|
+
if (!e || !ie?.fields) return null;
|
|
2252
|
+
let n = ie.fields;
|
|
2431
2253
|
return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
|
|
2432
|
-
}, [
|
|
2254
|
+
}, [ie, t?.field]), z = X(() => {
|
|
2433
2255
|
if (f) return f;
|
|
2434
|
-
if (
|
|
2435
|
-
if (
|
|
2436
|
-
let e =
|
|
2256
|
+
if (R) {
|
|
2257
|
+
if (R.type === "currency") {
|
|
2258
|
+
let e = R.scale ?? 0;
|
|
2437
2259
|
return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
|
|
2438
2260
|
}
|
|
2439
|
-
if (
|
|
2440
|
-
if (
|
|
2261
|
+
if (R.type === "percent") return "0,0%";
|
|
2262
|
+
if (R.type === "number" || R.type === "integer") return "0,0";
|
|
2441
2263
|
}
|
|
2442
|
-
}, [f,
|
|
2264
|
+
}, [f, R]), { currency: oe } = te(), se = X(() => {
|
|
2443
2265
|
if (p) return p;
|
|
2444
|
-
if (
|
|
2266
|
+
if (R?.type === "currency") return ee(R, oe);
|
|
2445
2267
|
}, [
|
|
2446
2268
|
p,
|
|
2447
|
-
|
|
2269
|
+
R,
|
|
2448
2270
|
oe
|
|
2449
|
-
]), ce =
|
|
2271
|
+
]), ce = X(() => t ? JSON.stringify(t) : "", [t]), V = X(() => y(n), [n]), fe = X(() => V ? JSON.stringify(V) : "", [V]), pe = X(() => T ? JSON.stringify(T) : "", [T]), me = J(async (n, r) => {
|
|
2450
2272
|
if (t && typeof n.aggregate == "function") {
|
|
2451
2273
|
let i = await n.aggregate(e, {
|
|
2452
2274
|
field: t.field,
|
|
@@ -2467,39 +2289,39 @@ var yn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
2467
2289
|
return (Array.isArray(t) ? t : t?.data || t?.records || []).length;
|
|
2468
2290
|
}
|
|
2469
2291
|
return null;
|
|
2470
|
-
}, [e, ce]),
|
|
2292
|
+
}, [e, ce]), he = J(async (t, r) => {
|
|
2471
2293
|
if (!(!t || !e)) {
|
|
2472
|
-
r.current && (
|
|
2294
|
+
r.current && (I(!0), re(null));
|
|
2473
2295
|
try {
|
|
2474
|
-
let e = T ? x(n, T) : null, [i, a] = await Promise.all([
|
|
2296
|
+
let e = T ? x(n, T) : null, [i, a] = await Promise.all([me(t, V), e ? me(t, e) : Promise.resolve(null)]);
|
|
2475
2297
|
if (i === null) return;
|
|
2476
2298
|
r.current && (N(i), P(typeof a == "number" && Number.isFinite(a) ? a : null));
|
|
2477
2299
|
} catch (e) {
|
|
2478
|
-
console.error("[ObjectMetricWidget] Fetch error:", e), r.current &&
|
|
2300
|
+
console.error("[ObjectMetricWidget] Fetch error:", e), r.current && re(e instanceof Error ? e.message : "Failed to load metric");
|
|
2479
2301
|
} finally {
|
|
2480
|
-
r.current &&
|
|
2302
|
+
r.current && I(!1);
|
|
2481
2303
|
}
|
|
2482
2304
|
}
|
|
2483
2305
|
}, [
|
|
2484
2306
|
e,
|
|
2485
2307
|
ce,
|
|
2308
|
+
fe,
|
|
2486
2309
|
pe,
|
|
2487
|
-
me
|
|
2488
|
-
he
|
|
2310
|
+
me
|
|
2489
2311
|
]);
|
|
2490
|
-
|
|
2312
|
+
Y(() => {
|
|
2491
2313
|
let t = { current: !0 };
|
|
2492
|
-
return k && e ?
|
|
2314
|
+
return k && e ? he(k, t) : (N(null), re(null)), () => {
|
|
2493
2315
|
t.current = !1;
|
|
2494
2316
|
};
|
|
2495
2317
|
}, [
|
|
2496
2318
|
k,
|
|
2497
2319
|
e,
|
|
2498
|
-
|
|
2320
|
+
he
|
|
2499
2321
|
]);
|
|
2500
|
-
let
|
|
2501
|
-
_ && typeof
|
|
2502
|
-
let
|
|
2322
|
+
let H = M === null ? k ? "—" : i ?? "—" : M;
|
|
2323
|
+
_ && typeof H == "number" && isFinite(H) && H >= 0 && H <= 1 && (H = 1 - H);
|
|
2324
|
+
let U = X(() => {
|
|
2503
2325
|
if (!T || typeof M != "number" || !Number.isFinite(M) || ne === null) return;
|
|
2504
2326
|
let e = pt(M, ne);
|
|
2505
2327
|
if (!e) return;
|
|
@@ -2522,36 +2344,36 @@ var yn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
2522
2344
|
ne,
|
|
2523
2345
|
n,
|
|
2524
2346
|
E
|
|
2525
|
-
]) ?? a,
|
|
2347
|
+
]) ?? a, ge = h(v) && !!e && !!k, W = X(() => {
|
|
2526
2348
|
let e = typeof r == "string" ? r : r?.defaultValue || "";
|
|
2527
2349
|
return b(v, {}, (typeof S == "string" ? S : S?.defaultValue || "") || e || "Details");
|
|
2528
2350
|
}, [
|
|
2529
2351
|
v,
|
|
2530
2352
|
r,
|
|
2531
2353
|
S
|
|
2532
|
-
]),
|
|
2533
|
-
if (!
|
|
2534
|
-
let t = v?.target ?? "drawer", n = v?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */
|
|
2354
|
+
]), _e = X(() => {
|
|
2355
|
+
if (!ge) return null;
|
|
2356
|
+
let t = v?.target ?? "drawer", n = v?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Q(Ot, {
|
|
2535
2357
|
objectName: e,
|
|
2536
|
-
filter:
|
|
2358
|
+
filter: V,
|
|
2537
2359
|
onNavigate: () => j(!1)
|
|
2538
2360
|
}), a;
|
|
2539
2361
|
if (r) {
|
|
2540
|
-
let e = n.filter, t = e ?
|
|
2541
|
-
a = /* @__PURE__ */
|
|
2362
|
+
let e = n.filter, t = e ? V ? { $and: [e, V] } : e : V;
|
|
2363
|
+
a = /* @__PURE__ */ Q("div", {
|
|
2542
2364
|
className: "h-full overflow-auto",
|
|
2543
|
-
children: /* @__PURE__ */
|
|
2365
|
+
children: /* @__PURE__ */ Q(C, { schema: {
|
|
2544
2366
|
type: "spec-report",
|
|
2545
2367
|
...n,
|
|
2546
2368
|
filter: t
|
|
2547
2369
|
} })
|
|
2548
2370
|
});
|
|
2549
|
-
} else a = /* @__PURE__ */
|
|
2371
|
+
} else a = /* @__PURE__ */ Q("div", {
|
|
2550
2372
|
className: "h-full overflow-auto",
|
|
2551
|
-
children: /* @__PURE__ */
|
|
2373
|
+
children: /* @__PURE__ */ Q(C, { schema: {
|
|
2552
2374
|
type: "object-data-table",
|
|
2553
2375
|
objectName: e,
|
|
2554
|
-
filter:
|
|
2376
|
+
filter: V,
|
|
2555
2377
|
pageSize: 25,
|
|
2556
2378
|
drillDown: {
|
|
2557
2379
|
enabled: !0,
|
|
@@ -2560,86 +2382,86 @@ var yn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
2560
2382
|
}
|
|
2561
2383
|
} })
|
|
2562
2384
|
});
|
|
2563
|
-
return t === "dialog" ? /* @__PURE__ */
|
|
2385
|
+
return t === "dialog" ? /* @__PURE__ */ Q(le, {
|
|
2564
2386
|
open: !0,
|
|
2565
2387
|
onOpenChange: (e) => !e && j(!1),
|
|
2566
|
-
children: /* @__PURE__ */
|
|
2388
|
+
children: /* @__PURE__ */ $(ue, {
|
|
2567
2389
|
className: "max-w-5xl",
|
|
2568
|
-
children: [/* @__PURE__ */
|
|
2390
|
+
children: [/* @__PURE__ */ $(B, {
|
|
2569
2391
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
2570
|
-
children: [/* @__PURE__ */
|
|
2392
|
+
children: [/* @__PURE__ */ Q(de, { children: W }), i]
|
|
2571
2393
|
}), a]
|
|
2572
2394
|
})
|
|
2573
|
-
}) : /* @__PURE__ */
|
|
2395
|
+
}) : /* @__PURE__ */ Q(ye, {
|
|
2574
2396
|
open: !0,
|
|
2575
2397
|
onOpenChange: (e) => !e && j(!1),
|
|
2576
|
-
children: /* @__PURE__ */
|
|
2398
|
+
children: /* @__PURE__ */ $(be, {
|
|
2577
2399
|
side: "right",
|
|
2578
2400
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
|
|
2579
|
-
children: [/* @__PURE__ */
|
|
2401
|
+
children: [/* @__PURE__ */ $(xe, {
|
|
2580
2402
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
2581
|
-
children: [/* @__PURE__ */
|
|
2582
|
-
}), /* @__PURE__ */
|
|
2403
|
+
children: [/* @__PURE__ */ Q(Se, { children: W }), i]
|
|
2404
|
+
}), /* @__PURE__ */ Q("div", {
|
|
2583
2405
|
className: "flex-1 overflow-hidden mt-2",
|
|
2584
2406
|
children: a
|
|
2585
2407
|
})]
|
|
2586
2408
|
})
|
|
2587
2409
|
});
|
|
2588
2410
|
}, [
|
|
2589
|
-
|
|
2411
|
+
ge,
|
|
2590
2412
|
v,
|
|
2591
2413
|
e,
|
|
2592
|
-
|
|
2593
|
-
|
|
2414
|
+
V,
|
|
2415
|
+
W
|
|
2594
2416
|
]);
|
|
2595
|
-
return /* @__PURE__ */
|
|
2417
|
+
return /* @__PURE__ */ $(lt, { children: [/* @__PURE__ */ Q(vn, {
|
|
2596
2418
|
label: r,
|
|
2597
|
-
value:
|
|
2598
|
-
trend:
|
|
2419
|
+
value: H,
|
|
2420
|
+
trend: U,
|
|
2599
2421
|
icon: o,
|
|
2600
2422
|
className: s,
|
|
2601
2423
|
description: l,
|
|
2602
2424
|
loading: F,
|
|
2603
|
-
error:
|
|
2425
|
+
error: L,
|
|
2604
2426
|
colorVariant: d,
|
|
2605
|
-
format:
|
|
2427
|
+
format: z,
|
|
2606
2428
|
currency: se,
|
|
2607
2429
|
prefix: m,
|
|
2608
2430
|
suffix: g,
|
|
2609
2431
|
variant: D,
|
|
2610
|
-
onClick:
|
|
2611
|
-
}), A &&
|
|
2432
|
+
onClick: ge ? () => j(!0) : void 0
|
|
2433
|
+
}), A && _e] });
|
|
2612
2434
|
};
|
|
2613
2435
|
//#endregion
|
|
2614
2436
|
//#region src/PivotTable.tsx
|
|
2615
|
-
function
|
|
2437
|
+
function Sn() {
|
|
2616
2438
|
return P()("dashboard.total", "Total");
|
|
2617
2439
|
}
|
|
2618
|
-
function
|
|
2440
|
+
function Cn() {
|
|
2619
2441
|
return P()("dashboard.noDataAvailable", "No data available");
|
|
2620
2442
|
}
|
|
2621
|
-
function
|
|
2443
|
+
function wn(e, t) {
|
|
2622
2444
|
if (!t) return String(e);
|
|
2623
|
-
let n = "", r =
|
|
2624
|
-
if (
|
|
2625
|
-
let e =
|
|
2626
|
-
n = e.replace(",", ""), e.includes(",") && (
|
|
2445
|
+
let n = "", r = !1, i, a = t, o = a.match(/^([^0-9.,#]*)/);
|
|
2446
|
+
if (o && o[1]) {
|
|
2447
|
+
let e = o[1];
|
|
2448
|
+
n = e.replace(",", ""), e.includes(",") && (r = !0), a = a.slice(o[1].length);
|
|
2627
2449
|
}
|
|
2628
|
-
|
|
2629
|
-
let
|
|
2630
|
-
|
|
2631
|
-
let
|
|
2632
|
-
if (
|
|
2633
|
-
let [e, t] = l.split("."),
|
|
2634
|
-
return n + (t === void 0 ?
|
|
2450
|
+
a.includes(",") && (r = !0, a = a.replace(/,/g, ""));
|
|
2451
|
+
let s = a.match(/\.(\d+)f?/);
|
|
2452
|
+
s && (i = Number(s[1]), a = a.slice(s[0].length));
|
|
2453
|
+
let c = a.replace(/[0-9#.f]/g, ""), l = i === void 0 ? String(e) : e.toFixed(i);
|
|
2454
|
+
if (r) {
|
|
2455
|
+
let [e, t] = l.split("."), r = e.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
2456
|
+
return n + (t === void 0 ? r : `${r}.${t}`) + c;
|
|
2635
2457
|
}
|
|
2636
|
-
return n + l +
|
|
2637
|
-
}
|
|
2638
|
-
var wn = "—";
|
|
2639
|
-
function Tn(e, t) {
|
|
2640
|
-
return e === "" ? wn : t?.[e] ?? e;
|
|
2458
|
+
return n + l + c;
|
|
2641
2459
|
}
|
|
2460
|
+
var Tn = "—";
|
|
2642
2461
|
function En(e, t) {
|
|
2462
|
+
return e === "" ? Tn : t?.[e] ?? e;
|
|
2463
|
+
}
|
|
2464
|
+
function Dn(e, t) {
|
|
2643
2465
|
if (e.length === 0) return 0;
|
|
2644
2466
|
switch (t) {
|
|
2645
2467
|
case "sum": return e.reduce((e, t) => e + t, 0);
|
|
@@ -2650,8 +2472,8 @@ function En(e, t) {
|
|
|
2650
2472
|
default: return e.reduce((e, t) => e + t, 0);
|
|
2651
2473
|
}
|
|
2652
2474
|
}
|
|
2653
|
-
var
|
|
2654
|
-
let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: f = !1, showColumnTotals: p = !1, format: m, columnColors: g, drillDown: _ } = e, v =
|
|
2475
|
+
var On = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
|
|
2476
|
+
let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: f = !1, showColumnTotals: p = !1, format: m, columnColors: g, drillDown: _ } = e, v = Sn(), y = Cn(), b = h(_) && typeof a == "function", x = (e) => {
|
|
2655
2477
|
b && a({
|
|
2656
2478
|
...e,
|
|
2657
2479
|
rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
|
|
@@ -2659,7 +2481,7 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2659
2481
|
});
|
|
2660
2482
|
}, S = (e) => (t) => {
|
|
2661
2483
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
|
|
2662
|
-
}, 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(d) ? d : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } =
|
|
2484
|
+
}, 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(d) ? d : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = X(() => {
|
|
2663
2485
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
|
|
2664
2486
|
for (let r of w) {
|
|
2665
2487
|
let i = String(r[s] ?? ""), a = String(r[c] ?? ""), o = Number(r[l]) || 0;
|
|
@@ -2670,10 +2492,10 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2670
2492
|
a[e] = {};
|
|
2671
2493
|
let t = [];
|
|
2672
2494
|
for (let r of i) {
|
|
2673
|
-
let i = n[e]?.[r] ?? [], o =
|
|
2495
|
+
let i = n[e]?.[r] ?? [], o = Dn(i, u);
|
|
2674
2496
|
a[e][r] = o, t.push(...i), !d[r] && d[r];
|
|
2675
2497
|
}
|
|
2676
|
-
o[e] =
|
|
2498
|
+
o[e] = Dn(t, u);
|
|
2677
2499
|
}
|
|
2678
2500
|
for (let e of i) {
|
|
2679
2501
|
let t = [];
|
|
@@ -2681,7 +2503,7 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2681
2503
|
let r = n[i]?.[e] ?? [];
|
|
2682
2504
|
t.push(...r);
|
|
2683
2505
|
}
|
|
2684
|
-
d[e] =
|
|
2506
|
+
d[e] = Dn(t, u);
|
|
2685
2507
|
}
|
|
2686
2508
|
let f = [];
|
|
2687
2509
|
for (let e of w) f.push(Number(e[l]) || 0);
|
|
@@ -2691,7 +2513,7 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2691
2513
|
matrix: a,
|
|
2692
2514
|
rowTotals: o,
|
|
2693
2515
|
colTotals: d,
|
|
2694
|
-
grandTotal:
|
|
2516
|
+
grandTotal: Dn(f, u)
|
|
2695
2517
|
};
|
|
2696
2518
|
}, [
|
|
2697
2519
|
w,
|
|
@@ -2699,16 +2521,16 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2699
2521
|
c,
|
|
2700
2522
|
l,
|
|
2701
2523
|
u
|
|
2702
|
-
]), j = (e) =>
|
|
2703
|
-
return w.length === 0 ? /* @__PURE__ */
|
|
2704
|
-
className:
|
|
2705
|
-
children: [o && /* @__PURE__ */
|
|
2524
|
+
]), j = (e) => wn(e, m);
|
|
2525
|
+
return w.length === 0 ? /* @__PURE__ */ $("div", {
|
|
2526
|
+
className: K("overflow-auto", t),
|
|
2527
|
+
children: [o && /* @__PURE__ */ Q("h3", {
|
|
2706
2528
|
className: "text-sm font-semibold mb-2",
|
|
2707
2529
|
children: o
|
|
2708
|
-
}), /* @__PURE__ */
|
|
2530
|
+
}), /* @__PURE__ */ Q(ce, {
|
|
2709
2531
|
"data-testid": "pivot-empty-state",
|
|
2710
2532
|
className: "py-8 gap-2 [&>h3]:hidden",
|
|
2711
|
-
icon: /* @__PURE__ */
|
|
2533
|
+
icon: /* @__PURE__ */ $("svg", {
|
|
2712
2534
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2713
2535
|
className: "h-8 w-8 opacity-40",
|
|
2714
2536
|
viewBox: "0 0 24 24",
|
|
@@ -2718,25 +2540,25 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2718
2540
|
strokeLinecap: "round",
|
|
2719
2541
|
strokeLinejoin: "round",
|
|
2720
2542
|
children: [
|
|
2721
|
-
/* @__PURE__ */
|
|
2543
|
+
/* @__PURE__ */ Q("rect", {
|
|
2722
2544
|
x: "3",
|
|
2723
2545
|
y: "3",
|
|
2724
2546
|
width: "7",
|
|
2725
2547
|
height: "7"
|
|
2726
2548
|
}),
|
|
2727
|
-
/* @__PURE__ */
|
|
2549
|
+
/* @__PURE__ */ Q("rect", {
|
|
2728
2550
|
x: "14",
|
|
2729
2551
|
y: "3",
|
|
2730
2552
|
width: "7",
|
|
2731
2553
|
height: "7"
|
|
2732
2554
|
}),
|
|
2733
|
-
/* @__PURE__ */
|
|
2555
|
+
/* @__PURE__ */ Q("rect", {
|
|
2734
2556
|
x: "3",
|
|
2735
2557
|
y: "14",
|
|
2736
2558
|
width: "7",
|
|
2737
2559
|
height: "7"
|
|
2738
2560
|
}),
|
|
2739
|
-
/* @__PURE__ */
|
|
2561
|
+
/* @__PURE__ */ Q("rect", {
|
|
2740
2562
|
x: "14",
|
|
2741
2563
|
y: "14",
|
|
2742
2564
|
width: "7",
|
|
@@ -2748,19 +2570,19 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2748
2570
|
title: "",
|
|
2749
2571
|
description: y
|
|
2750
2572
|
})]
|
|
2751
|
-
}) : /* @__PURE__ */
|
|
2752
|
-
className:
|
|
2753
|
-
children: [o && /* @__PURE__ */
|
|
2573
|
+
}) : /* @__PURE__ */ $("div", {
|
|
2574
|
+
className: K("overflow-auto", t),
|
|
2575
|
+
children: [o && /* @__PURE__ */ Q("h3", {
|
|
2754
2576
|
className: "text-sm font-semibold mb-2",
|
|
2755
2577
|
children: o
|
|
2756
|
-
}), /* @__PURE__ */
|
|
2578
|
+
}), /* @__PURE__ */ $("table", {
|
|
2757
2579
|
className: "w-full text-sm border-collapse table-auto",
|
|
2758
2580
|
role: "table",
|
|
2759
2581
|
children: [
|
|
2760
|
-
/* @__PURE__ */
|
|
2582
|
+
/* @__PURE__ */ Q("thead", { children: /* @__PURE__ */ $("tr", {
|
|
2761
2583
|
className: "border-b border-border",
|
|
2762
2584
|
children: [
|
|
2763
|
-
/* @__PURE__ */
|
|
2585
|
+
/* @__PURE__ */ Q("th", {
|
|
2764
2586
|
className: "text-left p-2 font-medium text-muted-foreground whitespace-nowrap",
|
|
2765
2587
|
children: i || s
|
|
2766
2588
|
}),
|
|
@@ -2769,28 +2591,28 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2769
2591
|
scope: "column",
|
|
2770
2592
|
colKey: e
|
|
2771
2593
|
});
|
|
2772
|
-
return /* @__PURE__ */
|
|
2773
|
-
className:
|
|
2594
|
+
return /* @__PURE__ */ Q("th", {
|
|
2595
|
+
className: K("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
|
|
2774
2596
|
title: e === "" ? `${c}: (empty)` : `${c}: ${e}`,
|
|
2775
2597
|
role: b ? "button" : void 0,
|
|
2776
2598
|
tabIndex: b ? 0 : void 0,
|
|
2777
2599
|
onClick: b ? t : void 0,
|
|
2778
2600
|
onKeyDown: b ? S(t) : void 0,
|
|
2779
2601
|
"aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
|
|
2780
|
-
children:
|
|
2602
|
+
children: En(e, r)
|
|
2781
2603
|
}, e);
|
|
2782
2604
|
}),
|
|
2783
|
-
f && /* @__PURE__ */
|
|
2605
|
+
f && /* @__PURE__ */ Q("th", {
|
|
2784
2606
|
className: "text-right p-2 font-semibold text-muted-foreground bg-muted/20 whitespace-nowrap",
|
|
2785
2607
|
children: v
|
|
2786
2608
|
})
|
|
2787
2609
|
]
|
|
2788
2610
|
}) }),
|
|
2789
|
-
/* @__PURE__ */
|
|
2611
|
+
/* @__PURE__ */ Q("tbody", { children: T.map((e) => /* @__PURE__ */ $("tr", {
|
|
2790
2612
|
className: "border-b border-border/50 hover:bg-muted/30",
|
|
2791
2613
|
children: [
|
|
2792
|
-
/* @__PURE__ */
|
|
2793
|
-
className:
|
|
2614
|
+
/* @__PURE__ */ Q("td", {
|
|
2615
|
+
className: K("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
|
|
2794
2616
|
role: b ? "button" : void 0,
|
|
2795
2617
|
tabIndex: b ? 0 : void 0,
|
|
2796
2618
|
onClick: b ? () => x({
|
|
@@ -2802,7 +2624,7 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2802
2624
|
rowKey: e
|
|
2803
2625
|
})) : void 0,
|
|
2804
2626
|
"aria-label": b ? `Drill into ${s}: ${e || "(empty)"}` : void 0,
|
|
2805
|
-
children:
|
|
2627
|
+
children: En(e, n)
|
|
2806
2628
|
}),
|
|
2807
2629
|
E.map((t) => {
|
|
2808
2630
|
let n = D[e]?.[t] ?? 0, r = () => x({
|
|
@@ -2811,8 +2633,8 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2811
2633
|
colKey: t,
|
|
2812
2634
|
value: n
|
|
2813
2635
|
});
|
|
2814
|
-
return /* @__PURE__ */
|
|
2815
|
-
className:
|
|
2636
|
+
return /* @__PURE__ */ Q("td", {
|
|
2637
|
+
className: K("text-right p-2 tabular-nums", g?.[t], C),
|
|
2816
2638
|
role: b ? "button" : void 0,
|
|
2817
2639
|
tabIndex: b ? 0 : void 0,
|
|
2818
2640
|
onClick: b ? r : void 0,
|
|
@@ -2821,8 +2643,8 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2821
2643
|
children: j(n)
|
|
2822
2644
|
}, t);
|
|
2823
2645
|
}),
|
|
2824
|
-
f && /* @__PURE__ */
|
|
2825
|
-
className:
|
|
2646
|
+
f && /* @__PURE__ */ Q("td", {
|
|
2647
|
+
className: K("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
|
|
2826
2648
|
role: b ? "button" : void 0,
|
|
2827
2649
|
tabIndex: b ? 0 : void 0,
|
|
2828
2650
|
onClick: b ? () => x({
|
|
@@ -2839,15 +2661,15 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2839
2661
|
})
|
|
2840
2662
|
]
|
|
2841
2663
|
}, e)) }),
|
|
2842
|
-
p && /* @__PURE__ */
|
|
2664
|
+
p && /* @__PURE__ */ Q("tfoot", { children: /* @__PURE__ */ $("tr", {
|
|
2843
2665
|
className: "border-t-2 border-border font-semibold bg-muted/40",
|
|
2844
2666
|
children: [
|
|
2845
|
-
/* @__PURE__ */
|
|
2667
|
+
/* @__PURE__ */ Q("td", {
|
|
2846
2668
|
className: "p-2",
|
|
2847
2669
|
children: v
|
|
2848
2670
|
}),
|
|
2849
|
-
E.map((e) => /* @__PURE__ */
|
|
2850
|
-
className:
|
|
2671
|
+
E.map((e) => /* @__PURE__ */ Q("td", {
|
|
2672
|
+
className: K("text-right p-2 tabular-nums", C),
|
|
2851
2673
|
role: b ? "button" : void 0,
|
|
2852
2674
|
tabIndex: b ? 0 : void 0,
|
|
2853
2675
|
onClick: b ? () => x({
|
|
@@ -2862,8 +2684,8 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2862
2684
|
})) : void 0,
|
|
2863
2685
|
children: j(k[e] ?? 0)
|
|
2864
2686
|
}, e)),
|
|
2865
|
-
f && /* @__PURE__ */
|
|
2866
|
-
className:
|
|
2687
|
+
f && /* @__PURE__ */ Q("td", {
|
|
2688
|
+
className: K("text-right p-2 tabular-nums font-bold", C),
|
|
2867
2689
|
role: b ? "button" : void 0,
|
|
2868
2690
|
tabIndex: b ? 0 : void 0,
|
|
2869
2691
|
onClick: b ? () => x({
|
|
@@ -2881,11 +2703,11 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2881
2703
|
]
|
|
2882
2704
|
})]
|
|
2883
2705
|
});
|
|
2884
|
-
},
|
|
2885
|
-
let r =
|
|
2886
|
-
|
|
2706
|
+
}, kn = ({ schema: e, dataSource: t, className: n }) => {
|
|
2707
|
+
let r = Oe(w), i = t || r?.dataSource, a = E(e.bind), [o, s] = Z([]), [c, u] = Z(!1), [f, p] = Z(null), [m, g] = Z({}), [_, v] = Z({}), [x, S] = Z(null), { fieldLabel: C, fieldOptionLabel: T } = ne(), D = ke(C), O = ke(T);
|
|
2708
|
+
Y(() => {
|
|
2887
2709
|
D.current = C, O.current = T;
|
|
2888
|
-
}, [C, T]),
|
|
2710
|
+
}, [C, T]), Y(() => {
|
|
2889
2711
|
if (!i || !e.objectName) return;
|
|
2890
2712
|
let t = i.getObjectSchema;
|
|
2891
2713
|
if (typeof t != "function") return;
|
|
@@ -2910,7 +2732,7 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2910
2732
|
}).catch(() => {}), () => {
|
|
2911
2733
|
n = !1;
|
|
2912
2734
|
};
|
|
2913
|
-
}, [i, e.objectName]),
|
|
2735
|
+
}, [i, e.objectName]), Y(() => {
|
|
2914
2736
|
let t = !0;
|
|
2915
2737
|
return e.objectName && !a && (!e.data || e.data.length === 0) && (async () => {
|
|
2916
2738
|
if (!(!i || !e.objectName)) {
|
|
@@ -2937,47 +2759,47 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2937
2759
|
e.filter
|
|
2938
2760
|
]);
|
|
2939
2761
|
let k = a || e.data || o, A = Array.isArray(k) ? k : [];
|
|
2940
|
-
if (c && A.length === 0) return /* @__PURE__ */
|
|
2941
|
-
className:
|
|
2762
|
+
if (c && A.length === 0) return /* @__PURE__ */ $("div", {
|
|
2763
|
+
className: K("overflow-auto", n),
|
|
2942
2764
|
"data-testid": "pivot-loading",
|
|
2943
|
-
children: [e.title && /* @__PURE__ */
|
|
2765
|
+
children: [e.title && /* @__PURE__ */ Q("h3", {
|
|
2944
2766
|
className: "text-sm font-semibold mb-2",
|
|
2945
2767
|
children: e.title
|
|
2946
|
-
}), /* @__PURE__ */
|
|
2768
|
+
}), /* @__PURE__ */ $("div", {
|
|
2947
2769
|
className: "space-y-2 p-2",
|
|
2948
|
-
children: [/* @__PURE__ */
|
|
2770
|
+
children: [/* @__PURE__ */ $("div", {
|
|
2949
2771
|
className: "flex gap-2",
|
|
2950
2772
|
children: [
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
2954
|
-
/* @__PURE__ */
|
|
2773
|
+
/* @__PURE__ */ Q(G, { className: "h-6 w-24" }),
|
|
2774
|
+
/* @__PURE__ */ Q(G, { className: "h-6 w-20" }),
|
|
2775
|
+
/* @__PURE__ */ Q(G, { className: "h-6 w-20" }),
|
|
2776
|
+
/* @__PURE__ */ Q(G, { className: "h-6 w-20" })
|
|
2955
2777
|
]
|
|
2956
2778
|
}), [
|
|
2957
2779
|
1,
|
|
2958
2780
|
2,
|
|
2959
2781
|
3
|
|
2960
|
-
].map((e) => /* @__PURE__ */
|
|
2782
|
+
].map((e) => /* @__PURE__ */ $("div", {
|
|
2961
2783
|
className: "flex gap-2",
|
|
2962
2784
|
children: [
|
|
2963
|
-
/* @__PURE__ */
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ Q(G, { className: "h-5 w-24" }),
|
|
2786
|
+
/* @__PURE__ */ Q(G, { className: "h-5 w-20" }),
|
|
2787
|
+
/* @__PURE__ */ Q(G, { className: "h-5 w-20" }),
|
|
2788
|
+
/* @__PURE__ */ Q(G, { className: "h-5 w-20" })
|
|
2967
2789
|
]
|
|
2968
2790
|
}, e))]
|
|
2969
2791
|
})]
|
|
2970
2792
|
});
|
|
2971
|
-
if (f) return /* @__PURE__ */
|
|
2972
|
-
className:
|
|
2793
|
+
if (f) return /* @__PURE__ */ $("div", {
|
|
2794
|
+
className: K("overflow-auto", n),
|
|
2973
2795
|
"data-testid": "pivot-error",
|
|
2974
|
-
children: [e.title && /* @__PURE__ */
|
|
2796
|
+
children: [e.title && /* @__PURE__ */ Q("h3", {
|
|
2975
2797
|
className: "text-sm font-semibold mb-2",
|
|
2976
2798
|
children: e.title
|
|
2977
|
-
}), /* @__PURE__ */
|
|
2799
|
+
}), /* @__PURE__ */ $("div", {
|
|
2978
2800
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
2979
2801
|
"data-testid": "pivot-error-message",
|
|
2980
|
-
children: [/* @__PURE__ */
|
|
2802
|
+
children: [/* @__PURE__ */ $("svg", {
|
|
2981
2803
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2982
2804
|
className: "h-8 w-8 mb-2 opacity-60",
|
|
2983
2805
|
viewBox: "0 0 24 24",
|
|
@@ -2987,38 +2809,38 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2987
2809
|
strokeLinecap: "round",
|
|
2988
2810
|
strokeLinejoin: "round",
|
|
2989
2811
|
children: [
|
|
2990
|
-
/* @__PURE__ */
|
|
2812
|
+
/* @__PURE__ */ Q("circle", {
|
|
2991
2813
|
cx: "12",
|
|
2992
2814
|
cy: "12",
|
|
2993
2815
|
r: "10"
|
|
2994
2816
|
}),
|
|
2995
|
-
/* @__PURE__ */
|
|
2817
|
+
/* @__PURE__ */ Q("line", {
|
|
2996
2818
|
x1: "12",
|
|
2997
2819
|
y1: "8",
|
|
2998
2820
|
x2: "12",
|
|
2999
2821
|
y2: "12"
|
|
3000
2822
|
}),
|
|
3001
|
-
/* @__PURE__ */
|
|
2823
|
+
/* @__PURE__ */ Q("line", {
|
|
3002
2824
|
x1: "12",
|
|
3003
2825
|
y1: "16",
|
|
3004
2826
|
x2: "12.01",
|
|
3005
2827
|
y2: "16"
|
|
3006
2828
|
})
|
|
3007
2829
|
]
|
|
3008
|
-
}), /* @__PURE__ */
|
|
2830
|
+
}), /* @__PURE__ */ Q("p", {
|
|
3009
2831
|
className: "text-xs",
|
|
3010
2832
|
children: f
|
|
3011
2833
|
})]
|
|
3012
2834
|
})]
|
|
3013
2835
|
});
|
|
3014
|
-
if (!i && e.objectName && A.length === 0) return /* @__PURE__ */
|
|
3015
|
-
className:
|
|
3016
|
-
children: [e.title && /* @__PURE__ */
|
|
2836
|
+
if (!i && e.objectName && A.length === 0) return /* @__PURE__ */ $("div", {
|
|
2837
|
+
className: K("overflow-auto", n),
|
|
2838
|
+
children: [e.title && /* @__PURE__ */ Q("h3", {
|
|
3017
2839
|
className: "text-sm font-semibold mb-2",
|
|
3018
2840
|
children: e.title
|
|
3019
|
-
}), /* @__PURE__ */
|
|
2841
|
+
}), /* @__PURE__ */ Q("div", {
|
|
3020
2842
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
3021
|
-
children: /* @__PURE__ */
|
|
2843
|
+
children: /* @__PURE__ */ $("p", {
|
|
3022
2844
|
className: "text-xs",
|
|
3023
2845
|
children: [
|
|
3024
2846
|
"No data source available for “",
|
|
@@ -3032,7 +2854,7 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3032
2854
|
...e,
|
|
3033
2855
|
data: A
|
|
3034
2856
|
}, M = e.rowField ? m[e.rowField] : void 0, ee = e.columnField ? m[e.columnField] : void 0, te = e.rowField ? _[e.rowField] : void 0, N = e.drillDown;
|
|
3035
|
-
return /* @__PURE__ */
|
|
2857
|
+
return /* @__PURE__ */ $(lt, { children: [/* @__PURE__ */ Q(On, {
|
|
3036
2858
|
schema: j,
|
|
3037
2859
|
className: n,
|
|
3038
2860
|
rowLabels: M,
|
|
@@ -3048,7 +2870,7 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3048
2870
|
...e.filter || {},
|
|
3049
2871
|
...t
|
|
3050
2872
|
};
|
|
3051
|
-
return /* @__PURE__ */
|
|
2873
|
+
return /* @__PURE__ */ Q(kt, {
|
|
3052
2874
|
open: !0,
|
|
3053
2875
|
onClose: () => S(null),
|
|
3054
2876
|
title: b(N, x, e.title || "Details"),
|
|
@@ -3061,7 +2883,7 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3061
2883
|
report: N?.report
|
|
3062
2884
|
});
|
|
3063
2885
|
})()] });
|
|
3064
|
-
},
|
|
2886
|
+
}, An = {
|
|
3065
2887
|
breadcrumb: ["Dashboard", "Configuration"],
|
|
3066
2888
|
sections: [
|
|
3067
2889
|
{
|
|
@@ -3187,12 +3009,12 @@ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3187
3009
|
}
|
|
3188
3010
|
]
|
|
3189
3011
|
};
|
|
3190
|
-
function
|
|
3191
|
-
let { draft: a, isDirty: o, updateField: s, discard: c } =
|
|
3192
|
-
return /* @__PURE__ */
|
|
3012
|
+
function jn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
3013
|
+
let { draft: a, isDirty: o, updateField: s, discard: c } = we(n, { onUpdate: i });
|
|
3014
|
+
return /* @__PURE__ */ Q(oe, {
|
|
3193
3015
|
open: e,
|
|
3194
3016
|
onClose: t,
|
|
3195
|
-
schema:
|
|
3017
|
+
schema: An,
|
|
3196
3018
|
draft: a,
|
|
3197
3019
|
isDirty: o,
|
|
3198
3020
|
onFieldChange: s,
|
|
@@ -3202,7 +3024,7 @@ function An({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
|
3202
3024
|
}
|
|
3203
3025
|
//#endregion
|
|
3204
3026
|
//#region src/WidgetConfigPanel.tsx
|
|
3205
|
-
var
|
|
3027
|
+
var Mn = [
|
|
3206
3028
|
{
|
|
3207
3029
|
value: "metric",
|
|
3208
3030
|
label: "Metric"
|
|
@@ -3247,7 +3069,7 @@ var jn = [
|
|
|
3247
3069
|
value: "pivot",
|
|
3248
3070
|
label: "Pivot Table"
|
|
3249
3071
|
}
|
|
3250
|
-
],
|
|
3072
|
+
], Nn = [
|
|
3251
3073
|
{
|
|
3252
3074
|
value: "default",
|
|
3253
3075
|
label: "Default"
|
|
@@ -3280,27 +3102,6 @@ var jn = [
|
|
|
3280
3102
|
value: "danger",
|
|
3281
3103
|
label: "Danger"
|
|
3282
3104
|
}
|
|
3283
|
-
], Nn = [
|
|
3284
|
-
{
|
|
3285
|
-
value: "count",
|
|
3286
|
-
label: "Count"
|
|
3287
|
-
},
|
|
3288
|
-
{
|
|
3289
|
-
value: "sum",
|
|
3290
|
-
label: "Sum"
|
|
3291
|
-
},
|
|
3292
|
-
{
|
|
3293
|
-
value: "avg",
|
|
3294
|
-
label: "Average"
|
|
3295
|
-
},
|
|
3296
|
-
{
|
|
3297
|
-
value: "min",
|
|
3298
|
-
label: "Min"
|
|
3299
|
-
},
|
|
3300
|
-
{
|
|
3301
|
-
value: "max",
|
|
3302
|
-
label: "Max"
|
|
3303
|
-
}
|
|
3304
3105
|
], Pn = [
|
|
3305
3106
|
"bar",
|
|
3306
3107
|
"horizontal-bar",
|
|
@@ -3311,156 +3112,133 @@ var jn = [
|
|
|
3311
3112
|
"scatter",
|
|
3312
3113
|
"funnel"
|
|
3313
3114
|
], Fn = [
|
|
3314
|
-
"bar",
|
|
3315
|
-
"horizontal-bar",
|
|
3316
|
-
"line",
|
|
3317
|
-
"area",
|
|
3318
|
-
"scatter"
|
|
3319
|
-
], In = [
|
|
3320
|
-
"pie",
|
|
3321
|
-
"donut",
|
|
3322
|
-
"funnel"
|
|
3323
|
-
], Ln = ["metric", ...Pn], Rn = [...Pn], zn = [
|
|
3324
|
-
"pivot",
|
|
3325
3115
|
"metric",
|
|
3326
|
-
"
|
|
3327
|
-
"
|
|
3328
|
-
"
|
|
3329
|
-
"
|
|
3330
|
-
"pie",
|
|
3331
|
-
"donut",
|
|
3332
|
-
"funnel",
|
|
3333
|
-
"scatter",
|
|
3334
|
-
"treemap",
|
|
3335
|
-
"sankey",
|
|
3336
|
-
"table",
|
|
3337
|
-
"list"
|
|
3116
|
+
"gauge",
|
|
3117
|
+
"solid-gauge",
|
|
3118
|
+
"kpi",
|
|
3119
|
+
"bullet"
|
|
3338
3120
|
];
|
|
3339
|
-
function
|
|
3121
|
+
function In(e) {
|
|
3340
3122
|
return !!e && Pn.includes(e);
|
|
3341
3123
|
}
|
|
3342
|
-
function
|
|
3343
|
-
return !!e && Fn.includes(e);
|
|
3344
|
-
}
|
|
3345
|
-
function Hn(e) {
|
|
3346
|
-
return !!e && Rn.includes(e);
|
|
3347
|
-
}
|
|
3348
|
-
function Un(e) {
|
|
3349
|
-
return !!e && Ln.includes(e);
|
|
3124
|
+
function Ln(e) {
|
|
3125
|
+
return !!e && !Fn.includes(e);
|
|
3350
3126
|
}
|
|
3351
|
-
function
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
}]
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
})
|
|
3393
|
-
|
|
3394
|
-
|
|
3127
|
+
function Rn({ names: e, options: t, placeholder: n, emptyText: r, onChange: i }) {
|
|
3128
|
+
let [a, o] = q.useState(""), s = q.useMemo(() => new Set(e), [e]), c = q.useMemo(() => t.filter((e) => !s.has(e.value)), [t, s]), l = (t) => {
|
|
3129
|
+
let n = t.trim();
|
|
3130
|
+
!n || s.has(n) || (i([...e, n]), o(""));
|
|
3131
|
+
}, u = (t) => i(e.filter((e) => e !== t));
|
|
3132
|
+
return /* @__PURE__ */ $("div", {
|
|
3133
|
+
className: "space-y-1.5",
|
|
3134
|
+
children: [e.length === 0 ? /* @__PURE__ */ Q("p", {
|
|
3135
|
+
className: "rounded border border-dashed px-2 py-1.5 text-center text-[11px] text-muted-foreground",
|
|
3136
|
+
children: r
|
|
3137
|
+
}) : /* @__PURE__ */ Q("div", {
|
|
3138
|
+
className: "flex flex-wrap gap-1",
|
|
3139
|
+
children: e.map((e) => /* @__PURE__ */ $("span", {
|
|
3140
|
+
"data-testid": `dataset-name-chip-${e}`,
|
|
3141
|
+
className: K("inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5", "font-mono text-[11px] text-foreground"),
|
|
3142
|
+
children: [e, /* @__PURE__ */ Q("button", {
|
|
3143
|
+
type: "button",
|
|
3144
|
+
"aria-label": `Remove ${e}`,
|
|
3145
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
3146
|
+
onClick: () => u(e),
|
|
3147
|
+
children: /* @__PURE__ */ Q(Ke, { className: "h-3 w-3" })
|
|
3148
|
+
})]
|
|
3149
|
+
}, e))
|
|
3150
|
+
}), c.length > 0 ? /* @__PURE__ */ Q(z, {
|
|
3151
|
+
options: c,
|
|
3152
|
+
value: "",
|
|
3153
|
+
onValueChange: l,
|
|
3154
|
+
placeholder: n,
|
|
3155
|
+
searchPlaceholder: "Search…",
|
|
3156
|
+
emptyText: "Nothing left to add.",
|
|
3157
|
+
className: "h-7 w-full text-xs"
|
|
3158
|
+
}) : /* @__PURE__ */ $("div", {
|
|
3159
|
+
className: "flex items-center gap-1",
|
|
3160
|
+
children: [/* @__PURE__ */ Q(fe, {
|
|
3161
|
+
value: a,
|
|
3162
|
+
onChange: (e) => o(e.target.value),
|
|
3163
|
+
onKeyDown: (e) => {
|
|
3164
|
+
e.key === "Enter" && (e.preventDefault(), l(a));
|
|
3165
|
+
},
|
|
3166
|
+
placeholder: n,
|
|
3167
|
+
className: "h-7 flex-1 text-xs"
|
|
3168
|
+
}), /* @__PURE__ */ Q(F, {
|
|
3169
|
+
type: "button",
|
|
3170
|
+
size: "sm",
|
|
3171
|
+
variant: "outline",
|
|
3172
|
+
className: "h-7 px-2 text-xs",
|
|
3173
|
+
onClick: () => l(a),
|
|
3174
|
+
disabled: !a.trim(),
|
|
3175
|
+
children: "Add"
|
|
3176
|
+
})]
|
|
3177
|
+
})]
|
|
3178
|
+
});
|
|
3395
3179
|
}
|
|
3396
|
-
function
|
|
3397
|
-
let
|
|
3398
|
-
|
|
3399
|
-
label:
|
|
3180
|
+
function zn(e, t) {
|
|
3181
|
+
let n = e ?? [], r = n.length > 0, i = n.map((e) => ({
|
|
3182
|
+
value: e.name,
|
|
3183
|
+
label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
|
|
3184
|
+
})), a = (e) => typeof e == "string" ? n.find((t) => t.name === e) : void 0, o = r ? {
|
|
3185
|
+
key: "dataset",
|
|
3186
|
+
label: "Dataset",
|
|
3400
3187
|
type: "custom",
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3188
|
+
helpText: "The semantic-layer dataset this widget binds to (ADR-0021).",
|
|
3189
|
+
render: (e, t) => /* @__PURE__ */ Q(se, {
|
|
3190
|
+
label: "Dataset",
|
|
3191
|
+
children: /* @__PURE__ */ Q("div", {
|
|
3192
|
+
"data-testid": "config-field-dataset",
|
|
3193
|
+
children: /* @__PURE__ */ Q(z, {
|
|
3194
|
+
options: i,
|
|
3195
|
+
value: e ?? "",
|
|
3196
|
+
onValueChange: t,
|
|
3197
|
+
placeholder: "Select dataset…",
|
|
3198
|
+
searchPlaceholder: "Search datasets…",
|
|
3199
|
+
emptyText: "No datasets found.",
|
|
3200
|
+
className: "h-7 w-40 text-xs"
|
|
3413
3201
|
})
|
|
3414
3202
|
})
|
|
3415
3203
|
})
|
|
3416
3204
|
} : {
|
|
3417
|
-
key: "
|
|
3418
|
-
label: "
|
|
3205
|
+
key: "dataset",
|
|
3206
|
+
label: "Dataset",
|
|
3419
3207
|
type: "input",
|
|
3420
|
-
placeholder: "
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
}, c = r ? Jn("columnField", "Field", "Select column field…", t) : {
|
|
3449
|
-
key: "columnField",
|
|
3450
|
-
label: "Field",
|
|
3451
|
-
type: "input",
|
|
3452
|
-
placeholder: "e.g. stage"
|
|
3453
|
-
}, l = r ? Jn("valueField", "Field", "Select value field…", t) : {
|
|
3454
|
-
key: "valueField",
|
|
3455
|
-
label: "Field",
|
|
3456
|
-
type: "input",
|
|
3457
|
-
placeholder: "e.g. amount"
|
|
3208
|
+
placeholder: "Dataset name",
|
|
3209
|
+
helpText: "The semantic-layer dataset this widget binds to (ADR-0021)."
|
|
3210
|
+
}, s = {
|
|
3211
|
+
key: "dimensions",
|
|
3212
|
+
label: "Dimensions",
|
|
3213
|
+
type: "custom",
|
|
3214
|
+
visibleWhen: (e) => Ln(e.type),
|
|
3215
|
+
helpText: t === "pivot" ? "Group/split fields. The last dimension spreads across as columns." : "Group/split the values by these dataset dimensions.",
|
|
3216
|
+
render: (e, t, n) => {
|
|
3217
|
+
let r = (a(n.dataset)?.dimensions ?? []).map((e) => ({
|
|
3218
|
+
value: e.name,
|
|
3219
|
+
label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
|
|
3220
|
+
}));
|
|
3221
|
+
return /* @__PURE__ */ Q(se, {
|
|
3222
|
+
label: "Dimensions",
|
|
3223
|
+
children: /* @__PURE__ */ Q("div", {
|
|
3224
|
+
"data-testid": "config-field-dimensions",
|
|
3225
|
+
className: "w-40",
|
|
3226
|
+
children: /* @__PURE__ */ Q(Rn, {
|
|
3227
|
+
names: Array.isArray(e) ? e : [],
|
|
3228
|
+
options: r,
|
|
3229
|
+
placeholder: "Add dimension…",
|
|
3230
|
+
emptyText: "No dimensions selected.",
|
|
3231
|
+
onChange: t
|
|
3232
|
+
})
|
|
3233
|
+
})
|
|
3234
|
+
});
|
|
3235
|
+
}
|
|
3458
3236
|
};
|
|
3459
3237
|
return {
|
|
3460
3238
|
breadcrumb: ["Dashboard", {
|
|
3461
3239
|
pivot: "Pivot table",
|
|
3462
3240
|
table: "Table"
|
|
3463
|
-
}[
|
|
3241
|
+
}[t ?? ""] ?? (In(t) ? "Chart" : "Widget")],
|
|
3464
3242
|
sections: [
|
|
3465
3243
|
{
|
|
3466
3244
|
key: "general",
|
|
@@ -3482,7 +3260,7 @@ function Yn(e, t, n) {
|
|
|
3482
3260
|
key: "type",
|
|
3483
3261
|
label: "Widget type",
|
|
3484
3262
|
type: "select",
|
|
3485
|
-
options:
|
|
3263
|
+
options: Mn,
|
|
3486
3264
|
defaultValue: "metric"
|
|
3487
3265
|
}
|
|
3488
3266
|
]
|
|
@@ -3491,176 +3269,37 @@ function Yn(e, t, n) {
|
|
|
3491
3269
|
key: "data",
|
|
3492
3270
|
title: "Data Binding",
|
|
3493
3271
|
collapsible: !0,
|
|
3494
|
-
visibleWhen: (e) => e.type !== "pivot",
|
|
3495
3272
|
fields: [
|
|
3496
|
-
i,
|
|
3497
|
-
a,
|
|
3498
3273
|
o,
|
|
3499
|
-
{
|
|
3500
|
-
key: "aggregate",
|
|
3501
|
-
label: "Aggregation",
|
|
3502
|
-
type: "select",
|
|
3503
|
-
options: Nn,
|
|
3504
|
-
defaultValue: "count",
|
|
3505
|
-
helpText: "Count ignores Value field; Sum / Avg / Min / Max require it.",
|
|
3506
|
-
visibleWhen: (e) => Un(e.type)
|
|
3507
|
-
}
|
|
3508
|
-
]
|
|
3509
|
-
},
|
|
3510
|
-
{
|
|
3511
|
-
key: "pivot-data",
|
|
3512
|
-
title: "Data",
|
|
3513
|
-
collapsible: !0,
|
|
3514
|
-
visibleWhen: (e) => e.type === "pivot",
|
|
3515
|
-
fields: [i]
|
|
3516
|
-
},
|
|
3517
|
-
{
|
|
3518
|
-
key: "pivot-rows",
|
|
3519
|
-
title: "Rows",
|
|
3520
|
-
collapsible: !0,
|
|
3521
|
-
visibleWhen: (e) => e.type === "pivot",
|
|
3522
|
-
fields: [
|
|
3523
3274
|
s,
|
|
3524
3275
|
{
|
|
3525
|
-
key: "
|
|
3526
|
-
label: "
|
|
3527
|
-
type: "
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
}
|
|
3550
|
-
]
|
|
3551
|
-
},
|
|
3552
|
-
{
|
|
3553
|
-
key: "pivot-columns",
|
|
3554
|
-
title: "Columns",
|
|
3555
|
-
collapsible: !0,
|
|
3556
|
-
visibleWhen: (e) => e.type === "pivot",
|
|
3557
|
-
fields: [
|
|
3558
|
-
c,
|
|
3559
|
-
{
|
|
3560
|
-
key: "columnSortBy",
|
|
3561
|
-
label: "Sort by",
|
|
3562
|
-
type: "icon-group",
|
|
3563
|
-
options: Kn,
|
|
3564
|
-
defaultValue: "group"
|
|
3565
|
-
},
|
|
3566
|
-
{
|
|
3567
|
-
key: "columnSortOrder",
|
|
3568
|
-
label: "Sort order",
|
|
3569
|
-
type: "icon-group",
|
|
3570
|
-
options: qn,
|
|
3571
|
-
defaultValue: "asc"
|
|
3572
|
-
},
|
|
3573
|
-
{
|
|
3574
|
-
key: "showColumnLabels",
|
|
3575
|
-
label: "Show label",
|
|
3576
|
-
type: "switch",
|
|
3577
|
-
defaultValue: !0
|
|
3578
|
-
},
|
|
3579
|
-
{
|
|
3580
|
-
key: "showColumnTotals",
|
|
3581
|
-
label: "Show totals",
|
|
3582
|
-
type: "switch",
|
|
3583
|
-
defaultValue: !1
|
|
3584
|
-
}
|
|
3585
|
-
]
|
|
3586
|
-
},
|
|
3587
|
-
{
|
|
3588
|
-
key: "pivot-values",
|
|
3589
|
-
title: "Values",
|
|
3590
|
-
collapsible: !0,
|
|
3591
|
-
visibleWhen: (e) => e.type === "pivot",
|
|
3592
|
-
fields: [
|
|
3593
|
-
l,
|
|
3594
|
-
{
|
|
3595
|
-
key: "aggregation",
|
|
3596
|
-
label: "Aggregation",
|
|
3597
|
-
type: "select",
|
|
3598
|
-
options: Nn,
|
|
3599
|
-
defaultValue: "sum"
|
|
3600
|
-
},
|
|
3601
|
-
{
|
|
3602
|
-
key: "format",
|
|
3603
|
-
label: "Number format",
|
|
3604
|
-
type: "input",
|
|
3605
|
-
placeholder: "e.g. $,.2f"
|
|
3606
|
-
}
|
|
3607
|
-
]
|
|
3608
|
-
},
|
|
3609
|
-
{
|
|
3610
|
-
key: "chart-axis",
|
|
3611
|
-
title: "Axis & Series",
|
|
3612
|
-
collapsible: !0,
|
|
3613
|
-
visibleWhen: (e) => Vn(e.type),
|
|
3614
|
-
fields: [
|
|
3615
|
-
{
|
|
3616
|
-
key: "xAxisLabel",
|
|
3617
|
-
label: "X-axis label",
|
|
3618
|
-
type: "input",
|
|
3619
|
-
placeholder: "e.g. Month"
|
|
3620
|
-
},
|
|
3621
|
-
{
|
|
3622
|
-
key: "yAxisLabel",
|
|
3623
|
-
label: "Y-axis label",
|
|
3624
|
-
type: "input",
|
|
3625
|
-
placeholder: "e.g. Revenue"
|
|
3626
|
-
},
|
|
3627
|
-
{
|
|
3628
|
-
key: "showLegend",
|
|
3629
|
-
label: "Show legend",
|
|
3630
|
-
type: "switch",
|
|
3631
|
-
defaultValue: !0
|
|
3276
|
+
key: "values",
|
|
3277
|
+
label: "Values",
|
|
3278
|
+
type: "custom",
|
|
3279
|
+
helpText: "Measure(s) from the dataset to display (at least one).",
|
|
3280
|
+
render: (e, t, n) => {
|
|
3281
|
+
let r = (a(n.dataset)?.measures ?? []).map((e) => ({
|
|
3282
|
+
value: e.name,
|
|
3283
|
+
label: e.aggregate ? `${e.label ?? e.name} · ${e.aggregate}` : e.label ?? e.name
|
|
3284
|
+
}));
|
|
3285
|
+
return /* @__PURE__ */ Q(se, {
|
|
3286
|
+
label: "Values",
|
|
3287
|
+
children: /* @__PURE__ */ Q("div", {
|
|
3288
|
+
"data-testid": "config-field-values",
|
|
3289
|
+
className: "w-40",
|
|
3290
|
+
children: /* @__PURE__ */ Q(Rn, {
|
|
3291
|
+
names: Array.isArray(e) ? e : [],
|
|
3292
|
+
options: r,
|
|
3293
|
+
placeholder: "Add measure…",
|
|
3294
|
+
emptyText: "No measures selected.",
|
|
3295
|
+
onChange: t
|
|
3296
|
+
})
|
|
3297
|
+
})
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3632
3300
|
}
|
|
3633
3301
|
]
|
|
3634
3302
|
},
|
|
3635
|
-
{
|
|
3636
|
-
key: "chart-legend",
|
|
3637
|
-
title: "Display",
|
|
3638
|
-
collapsible: !0,
|
|
3639
|
-
visibleWhen: (e) => !!e.type && In.includes(e.type),
|
|
3640
|
-
fields: [{
|
|
3641
|
-
key: "showLegend",
|
|
3642
|
-
label: "Show legend",
|
|
3643
|
-
type: "switch",
|
|
3644
|
-
defaultValue: !0
|
|
3645
|
-
}]
|
|
3646
|
-
},
|
|
3647
|
-
{
|
|
3648
|
-
key: "table-options",
|
|
3649
|
-
title: "Table options",
|
|
3650
|
-
collapsible: !0,
|
|
3651
|
-
visibleWhen: (e) => e.type === "table",
|
|
3652
|
-
fields: [{
|
|
3653
|
-
key: "searchable",
|
|
3654
|
-
label: "Searchable",
|
|
3655
|
-
type: "switch",
|
|
3656
|
-
defaultValue: !1
|
|
3657
|
-
}, {
|
|
3658
|
-
key: "pagination",
|
|
3659
|
-
label: "Pagination",
|
|
3660
|
-
type: "switch",
|
|
3661
|
-
defaultValue: !1
|
|
3662
|
-
}]
|
|
3663
|
-
},
|
|
3664
3303
|
{
|
|
3665
3304
|
key: "layout",
|
|
3666
3305
|
title: "Layout",
|
|
@@ -3683,27 +3322,6 @@ function Yn(e, t, n) {
|
|
|
3683
3322
|
defaultValue: 1
|
|
3684
3323
|
}]
|
|
3685
3324
|
},
|
|
3686
|
-
{
|
|
3687
|
-
key: "drill-down",
|
|
3688
|
-
title: "Drill-down",
|
|
3689
|
-
collapsible: !0,
|
|
3690
|
-
defaultCollapsed: !0,
|
|
3691
|
-
visibleWhen: (e) => Wn(e.type),
|
|
3692
|
-
fields: [{
|
|
3693
|
-
key: "drillDownEnabled",
|
|
3694
|
-
label: "Enable drill-down",
|
|
3695
|
-
type: "switch",
|
|
3696
|
-
defaultValue: !1,
|
|
3697
|
-
helpText: "When enabled, clicking a chart segment / pivot cell opens a filtered list of underlying records; clicking a table or list row opens that record."
|
|
3698
|
-
}, {
|
|
3699
|
-
key: "drillDownTarget",
|
|
3700
|
-
label: "Open in",
|
|
3701
|
-
type: "select",
|
|
3702
|
-
options: Gn,
|
|
3703
|
-
defaultValue: "drawer",
|
|
3704
|
-
visibleWhen: (e) => !!e.drillDownEnabled
|
|
3705
|
-
}]
|
|
3706
|
-
},
|
|
3707
3325
|
{
|
|
3708
3326
|
key: "behavior",
|
|
3709
3327
|
title: "Behavior",
|
|
@@ -3725,14 +3343,14 @@ function Yn(e, t, n) {
|
|
|
3725
3343
|
key: "colorVariant",
|
|
3726
3344
|
label: "Color variant",
|
|
3727
3345
|
type: "select",
|
|
3728
|
-
options:
|
|
3346
|
+
options: Nn,
|
|
3729
3347
|
defaultValue: "default"
|
|
3730
3348
|
}]
|
|
3731
3349
|
}
|
|
3732
3350
|
]
|
|
3733
3351
|
};
|
|
3734
3352
|
}
|
|
3735
|
-
function
|
|
3353
|
+
function Bn(e) {
|
|
3736
3354
|
if (e == null) return "";
|
|
3737
3355
|
if (typeof e == "string") return e;
|
|
3738
3356
|
if (typeof e == "object") {
|
|
@@ -3741,162 +3359,152 @@ function Xn(e) {
|
|
|
3741
3359
|
}
|
|
3742
3360
|
return String(e);
|
|
3743
3361
|
}
|
|
3744
|
-
|
|
3362
|
+
var Vn = [
|
|
3363
|
+
"object",
|
|
3364
|
+
"categoryField",
|
|
3365
|
+
"categoryGranularity",
|
|
3366
|
+
"valueField",
|
|
3367
|
+
"aggregate",
|
|
3368
|
+
"aggregation",
|
|
3369
|
+
"rowField",
|
|
3370
|
+
"columnField",
|
|
3371
|
+
"xAxisField",
|
|
3372
|
+
"yAxisFields",
|
|
3373
|
+
"xAxisLabel",
|
|
3374
|
+
"yAxisLabel",
|
|
3375
|
+
"measures",
|
|
3376
|
+
"rowSortBy",
|
|
3377
|
+
"rowSortOrder",
|
|
3378
|
+
"columnSortBy",
|
|
3379
|
+
"columnSortOrder",
|
|
3380
|
+
"showRowLabels",
|
|
3381
|
+
"showRowTotals",
|
|
3382
|
+
"showColumnLabels",
|
|
3383
|
+
"showColumnTotals",
|
|
3384
|
+
"format",
|
|
3385
|
+
"showLegend",
|
|
3386
|
+
"searchable",
|
|
3387
|
+
"pagination"
|
|
3388
|
+
];
|
|
3389
|
+
function Hn(e) {
|
|
3745
3390
|
let t = e.type, n = { ...e };
|
|
3746
|
-
|
|
3391
|
+
for (let e of Vn) delete n[e];
|
|
3392
|
+
return Ln(t) || delete n.dimensions, n;
|
|
3747
3393
|
}
|
|
3748
|
-
function
|
|
3749
|
-
let { draft: c, isDirty: l, updateField: u, discard: d } =
|
|
3394
|
+
function Un({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, datasets: o, datasetsLoading: s }) {
|
|
3395
|
+
let { draft: c, isDirty: l, updateField: u, discard: d } = we(q.useMemo(() => ({
|
|
3750
3396
|
...n,
|
|
3751
|
-
title: typeof n.title == "object" ?
|
|
3752
|
-
description: typeof n.description == "object" ?
|
|
3397
|
+
title: typeof n.title == "object" ? Bn(n.title) : n.title,
|
|
3398
|
+
description: typeof n.description == "object" ? Bn(n.description) : n.description
|
|
3753
3399
|
}), [n]), { onUpdate: i });
|
|
3754
|
-
return /* @__PURE__ */
|
|
3400
|
+
return /* @__PURE__ */ Q(oe, {
|
|
3755
3401
|
open: e,
|
|
3756
3402
|
onClose: t,
|
|
3757
|
-
schema:
|
|
3758
|
-
o,
|
|
3759
|
-
s,
|
|
3760
|
-
c.type
|
|
3761
|
-
]),
|
|
3403
|
+
schema: q.useMemo(() => zn(o, c.type), [o, c.type]),
|
|
3762
3404
|
draft: c,
|
|
3763
3405
|
isDirty: l,
|
|
3764
3406
|
onFieldChange: u,
|
|
3765
|
-
onSave: () => r(
|
|
3407
|
+
onSave: () => r(Hn(c)),
|
|
3766
3408
|
onDiscard: d,
|
|
3767
3409
|
headerExtra: a
|
|
3768
3410
|
});
|
|
3769
3411
|
}
|
|
3770
3412
|
//#endregion
|
|
3771
3413
|
//#region src/DashboardWithConfig.tsx
|
|
3772
|
-
function
|
|
3773
|
-
let [
|
|
3774
|
-
|
|
3775
|
-
|
|
3414
|
+
function Wn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s, datasets: c, datasetsLoading: l }) {
|
|
3415
|
+
let [u, d] = Z(o), [f, p] = Z(null), [m, h] = Z(e), [g, _] = Z(0);
|
|
3416
|
+
Y(() => {
|
|
3417
|
+
h(e), _((e) => e + 1);
|
|
3776
3418
|
}, [e]);
|
|
3777
|
-
let
|
|
3778
|
-
if (!
|
|
3779
|
-
let e =
|
|
3419
|
+
let v = q.useMemo(() => {
|
|
3420
|
+
if (!f || !m.widgets) return null;
|
|
3421
|
+
let e = m.widgets.find((e) => (e.id || e.title) === f);
|
|
3780
3422
|
if (!e) return null;
|
|
3781
|
-
let t = e
|
|
3423
|
+
let t = e;
|
|
3782
3424
|
return {
|
|
3783
|
-
...t,
|
|
3784
3425
|
id: e.id ?? "",
|
|
3785
3426
|
title: e.title ?? "",
|
|
3786
3427
|
description: e.description ?? "",
|
|
3787
3428
|
type: e.type ?? "",
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
actionUrl: e.actionUrl ?? t.actionUrl ?? "",
|
|
3794
|
-
drillDownEnabled: t.drillDown?.enabled ?? !!(e.object && (e.type === "pivot" || e.type === "metric" || e.type === "bar" || e.type === "horizontal-bar" || e.type === "line" || e.type === "area" || e.type === "pie" || e.type === "donut" || e.type === "funnel")),
|
|
3795
|
-
drillDownTarget: t.drillDown?.target ?? "drawer",
|
|
3429
|
+
dataset: typeof t.dataset == "string" ? t.dataset : "",
|
|
3430
|
+
dimensions: Array.isArray(t.dimensions) ? t.dimensions : [],
|
|
3431
|
+
values: Array.isArray(t.values) ? t.values : [],
|
|
3432
|
+
colorVariant: e.colorVariant ?? "default",
|
|
3433
|
+
actionUrl: e.actionUrl ?? "",
|
|
3796
3434
|
layoutW: e.layout?.w ?? 1,
|
|
3797
3435
|
layoutH: e.layout?.h ?? 1
|
|
3798
3436
|
};
|
|
3799
|
-
}, [
|
|
3800
|
-
|
|
3801
|
-
}, []),
|
|
3802
|
-
|
|
3803
|
-
}, []),
|
|
3804
|
-
|
|
3437
|
+
}, [f, g]), y = J((e) => {
|
|
3438
|
+
p(e), d(!0);
|
|
3439
|
+
}, []), b = J(() => {
|
|
3440
|
+
p(null);
|
|
3441
|
+
}, []), x = J((e, t) => {
|
|
3442
|
+
f && h((n) => n.widgets ? {
|
|
3805
3443
|
...n,
|
|
3806
|
-
widgets: n.widgets.map((n) => {
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
...n,
|
|
3810
|
-
|
|
3811
|
-
...n.layout || {},
|
|
3812
|
-
w: t
|
|
3813
|
-
}
|
|
3814
|
-
};
|
|
3815
|
-
if (e === "layoutH") return {
|
|
3816
|
-
...n,
|
|
3817
|
-
layout: {
|
|
3818
|
-
...n.layout || {},
|
|
3819
|
-
h: t
|
|
3820
|
-
}
|
|
3821
|
-
};
|
|
3822
|
-
if (e === "drillDownEnabled" || e === "drillDownTarget") {
|
|
3823
|
-
let r = n.options?.drillDown ?? {}, i = e === "drillDownEnabled" ? {
|
|
3824
|
-
...r,
|
|
3825
|
-
enabled: !!t
|
|
3826
|
-
} : {
|
|
3827
|
-
...r,
|
|
3828
|
-
target: t
|
|
3829
|
-
};
|
|
3830
|
-
return {
|
|
3831
|
-
...n,
|
|
3832
|
-
options: {
|
|
3833
|
-
...n.options || {},
|
|
3834
|
-
drillDown: i
|
|
3835
|
-
}
|
|
3836
|
-
};
|
|
3444
|
+
widgets: n.widgets.map((n) => (n.id || n.title) === f ? e === "layoutW" ? {
|
|
3445
|
+
...n,
|
|
3446
|
+
layout: {
|
|
3447
|
+
...n.layout || {},
|
|
3448
|
+
w: t
|
|
3837
3449
|
}
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
} : n);
|
|
3844
|
-
}, [u]), b = q((e) => {
|
|
3845
|
-
if (u && r) {
|
|
3846
|
-
let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
|
|
3847
|
-
(t || n) && (a.options = {
|
|
3848
|
-
...i.options || {},
|
|
3849
|
-
drillDown: {
|
|
3850
|
-
...i.options?.drillDown || {},
|
|
3851
|
-
...t === void 0 ? {} : { enabled: !!t },
|
|
3852
|
-
...n === void 0 ? {} : { target: n }
|
|
3450
|
+
} : e === "layoutH" ? {
|
|
3451
|
+
...n,
|
|
3452
|
+
layout: {
|
|
3453
|
+
...n.layout || {},
|
|
3454
|
+
h: t
|
|
3853
3455
|
}
|
|
3854
|
-
}
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3456
|
+
} : {
|
|
3457
|
+
...n,
|
|
3458
|
+
[e]: t
|
|
3459
|
+
} : n)
|
|
3460
|
+
} : n);
|
|
3461
|
+
}, [f]), S = J((e) => {
|
|
3462
|
+
f && r && r(f, e), p(null), _((e) => e + 1);
|
|
3463
|
+
}, [f, r]), C = J(() => {
|
|
3464
|
+
d((e) => !e), p(null);
|
|
3859
3465
|
}, []);
|
|
3860
|
-
return /* @__PURE__ */
|
|
3861
|
-
className:
|
|
3466
|
+
return /* @__PURE__ */ $("div", {
|
|
3467
|
+
className: K("flex h-full w-full", s),
|
|
3862
3468
|
"data-testid": "dashboard-with-config",
|
|
3863
|
-
children: [/* @__PURE__ */
|
|
3469
|
+
children: [/* @__PURE__ */ $("div", {
|
|
3864
3470
|
className: "flex-1 min-w-0 overflow-auto relative",
|
|
3865
|
-
children: [/* @__PURE__ */
|
|
3471
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
3866
3472
|
className: "absolute top-2 right-2 z-10",
|
|
3867
|
-
children: /* @__PURE__ */
|
|
3473
|
+
children: /* @__PURE__ */ $(F, {
|
|
3868
3474
|
size: "sm",
|
|
3869
|
-
variant:
|
|
3870
|
-
onClick:
|
|
3475
|
+
variant: u ? "default" : "outline",
|
|
3476
|
+
onClick: C,
|
|
3871
3477
|
"data-testid": "dashboard-config-toggle",
|
|
3872
|
-
children: [/* @__PURE__ */
|
|
3478
|
+
children: [/* @__PURE__ */ Q(Ge, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
|
|
3873
3479
|
})
|
|
3874
|
-
}), /* @__PURE__ */
|
|
3875
|
-
schema:
|
|
3480
|
+
}), /* @__PURE__ */ Q(on, {
|
|
3481
|
+
schema: m,
|
|
3876
3482
|
onRefresh: i,
|
|
3877
3483
|
recordCount: a,
|
|
3878
|
-
designMode:
|
|
3879
|
-
selectedWidgetId:
|
|
3880
|
-
onWidgetClick:
|
|
3484
|
+
designMode: u,
|
|
3485
|
+
selectedWidgetId: f,
|
|
3486
|
+
onWidgetClick: y
|
|
3881
3487
|
})]
|
|
3882
|
-
}),
|
|
3488
|
+
}), u && /* @__PURE__ */ Q("div", {
|
|
3883
3489
|
className: "relative shrink-0",
|
|
3884
|
-
children:
|
|
3490
|
+
children: f && v ? /* @__PURE__ */ Q(Un, {
|
|
3885
3491
|
open: !0,
|
|
3886
|
-
onClose:
|
|
3887
|
-
config:
|
|
3888
|
-
onSave:
|
|
3889
|
-
onFieldChange:
|
|
3890
|
-
|
|
3492
|
+
onClose: b,
|
|
3493
|
+
config: v,
|
|
3494
|
+
onSave: S,
|
|
3495
|
+
onFieldChange: x,
|
|
3496
|
+
datasets: c,
|
|
3497
|
+
datasetsLoading: l
|
|
3498
|
+
}) : /* @__PURE__ */ Q(jn, {
|
|
3891
3499
|
open: !0,
|
|
3892
|
-
onClose: () =>
|
|
3500
|
+
onClose: () => d(!1),
|
|
3893
3501
|
config: t,
|
|
3894
3502
|
onSave: n
|
|
3895
3503
|
})
|
|
3896
3504
|
})]
|
|
3897
3505
|
});
|
|
3898
3506
|
}
|
|
3899
|
-
e.register("dashboard",
|
|
3507
|
+
e.register("dashboard", on, {
|
|
3900
3508
|
namespace: "view",
|
|
3901
3509
|
label: "Dashboard",
|
|
3902
3510
|
category: "Complex",
|
|
@@ -3924,7 +3532,7 @@ e.register("dashboard", an, {
|
|
|
3924
3532
|
columns: 3,
|
|
3925
3533
|
widgets: []
|
|
3926
3534
|
}
|
|
3927
|
-
}), e.register("metric",
|
|
3535
|
+
}), e.register("metric", vn, {
|
|
3928
3536
|
namespace: "plugin-dashboard",
|
|
3929
3537
|
label: "Metric Widget",
|
|
3930
3538
|
category: "Dashboard",
|
|
@@ -3937,7 +3545,7 @@ e.register("dashboard", an, {
|
|
|
3937
3545
|
type: "string",
|
|
3938
3546
|
label: "Value"
|
|
3939
3547
|
}]
|
|
3940
|
-
}), e.register("metric-card",
|
|
3548
|
+
}), e.register("metric-card", bn, {
|
|
3941
3549
|
namespace: "plugin-dashboard",
|
|
3942
3550
|
label: "Metric Card",
|
|
3943
3551
|
category: "Dashboard",
|
|
@@ -3992,7 +3600,7 @@ e.register("dashboard", an, {
|
|
|
3992
3600
|
title: "Metric",
|
|
3993
3601
|
value: "0"
|
|
3994
3602
|
}
|
|
3995
|
-
}), e.register("object-metric",
|
|
3603
|
+
}), e.register("object-metric", xn, {
|
|
3996
3604
|
namespace: "plugin-dashboard",
|
|
3997
3605
|
label: "Object Metric",
|
|
3998
3606
|
category: "Dashboard",
|
|
@@ -4021,7 +3629,7 @@ e.register("dashboard", an, {
|
|
|
4021
3629
|
}
|
|
4022
3630
|
],
|
|
4023
3631
|
defaultProps: { label: "Metric" }
|
|
4024
|
-
}), e.register("pivot",
|
|
3632
|
+
}), e.register("pivot", On, {
|
|
4025
3633
|
namespace: "plugin-dashboard",
|
|
4026
3634
|
label: "Pivot Table",
|
|
4027
3635
|
category: "Dashboard",
|
|
@@ -4100,7 +3708,7 @@ e.register("dashboard", an, {
|
|
|
4100
3708
|
aggregation: "sum",
|
|
4101
3709
|
data: []
|
|
4102
3710
|
}
|
|
4103
|
-
}), e.register("object-pivot",
|
|
3711
|
+
}), e.register("object-pivot", kn, {
|
|
4104
3712
|
namespace: "plugin-dashboard",
|
|
4105
3713
|
label: "Object Pivot Table",
|
|
4106
3714
|
category: "Dashboard",
|
|
@@ -4189,7 +3797,7 @@ e.register("dashboard", an, {
|
|
|
4189
3797
|
valueField: "",
|
|
4190
3798
|
aggregation: "sum"
|
|
4191
3799
|
}
|
|
4192
|
-
}), e.register("dashboard-grid",
|
|
3800
|
+
}), e.register("dashboard-grid", dn, {
|
|
4193
3801
|
namespace: "plugin-dashboard",
|
|
4194
3802
|
label: "Dashboard Grid (Editable)",
|
|
4195
3803
|
category: "Complex",
|
|
@@ -4245,18 +3853,18 @@ e.register("dashboard", an, {
|
|
|
4245
3853
|
pagination: !1
|
|
4246
3854
|
}
|
|
4247
3855
|
});
|
|
4248
|
-
var
|
|
4249
|
-
DashboardRenderer:
|
|
4250
|
-
DashboardGridLayout:
|
|
4251
|
-
MetricWidget:
|
|
4252
|
-
MetricCard:
|
|
4253
|
-
ObjectMetricWidget:
|
|
4254
|
-
PivotTable:
|
|
4255
|
-
ObjectPivotTable:
|
|
3856
|
+
var Gn = {
|
|
3857
|
+
DashboardRenderer: on,
|
|
3858
|
+
DashboardGridLayout: dn,
|
|
3859
|
+
MetricWidget: vn,
|
|
3860
|
+
MetricCard: bn,
|
|
3861
|
+
ObjectMetricWidget: xn,
|
|
3862
|
+
PivotTable: On,
|
|
3863
|
+
ObjectPivotTable: kn,
|
|
4256
3864
|
ObjectDataTable: Dt,
|
|
4257
|
-
DashboardConfigPanel:
|
|
4258
|
-
WidgetConfigPanel:
|
|
4259
|
-
DashboardWithConfig:
|
|
3865
|
+
DashboardConfigPanel: jn,
|
|
3866
|
+
WidgetConfigPanel: Un,
|
|
3867
|
+
DashboardWithConfig: Wn
|
|
4260
3868
|
};
|
|
4261
3869
|
//#endregion
|
|
4262
|
-
export {
|
|
3870
|
+
export { jn as DashboardConfigPanel, dn as DashboardGridLayout, on as DashboardRenderer, Wn as DashboardWithConfig, kt as DrillDownDrawer, bn as MetricCard, vn as MetricWidget, Dt as ObjectDataTable, xn as ObjectMetricWidget, kn as ObjectPivotTable, On as PivotTable, Un as WidgetConfigPanel, Gn as dashboardComponents };
|