@object-ui/plugin-dashboard 17.5.0 → 17.6.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 +523 -0
- package/README.md +147 -18
- package/dist/DashboardConfigPanel.d.ts +3 -0
- package/dist/DashboardConfigPanel.d.ts.map +1 -1
- package/dist/DashboardFilterBar.d.ts.map +1 -1
- package/dist/DashboardRenderer.d.ts.map +1 -1
- package/dist/DatasetWidget.d.ts +16 -120
- package/dist/DatasetWidget.d.ts.map +1 -1
- package/dist/ObjectDataTable.d.ts +68 -3
- package/dist/ObjectDataTable.d.ts.map +1 -1
- package/dist/ObjectMetricWidget.d.ts +31 -20
- package/dist/ObjectMetricWidget.d.ts.map +1 -1
- package/dist/ObjectPivotTable.d.ts.map +1 -1
- package/dist/PivotTable.d.ts.map +1 -1
- package/dist/WidgetConfigPanel.d.ts +28 -0
- package/dist/WidgetConfigPanel.d.ts.map +1 -1
- package/dist/index.d.ts +15 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1431 -1146
- package/dist/index.umd.cjs +2 -2
- package/dist/recordFields.d.ts +40 -1
- package/dist/recordFields.d.ts.map +1 -1
- package/dist/useConfigPanelTranslation.d.ts +35 -0
- package/dist/useConfigPanelTranslation.d.ts.map +1 -0
- package/package.json +11 -10
package/dist/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import t, { Fragment as n, forwardRef as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
3
|
-
import { ComponentRegistry as u, DATE_RANGE_PRESETS as d,
|
|
4
|
-
import { ElementDataSourceGate as
|
|
5
|
-
import { createSafeTranslation as
|
|
6
|
-
import { Button as
|
|
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
|
|
3
|
+
import { ComponentRegistry as u, DATE_RANGE_PRESETS as d, EXPANDABLE_FIELD_TYPES as f, buildCategoryOrder as p, buildChartSeries as m, buildDatasetDrillFilter as h, buildDatasetFieldHelpers as g, buildOptionColorMap as _, buildWidgetScopedFilter as v, chartConfigPresentation as y, columnHeader as b, columnIdentity as x, compareSortValues as S, compareToTrendLabelKey as C, compareToTrendLabelKey as w, computeDrillFilter as T, dashboardFilterVariableDefs as E, deriveDimensionLabelMaps as D, dimensionOptionTranslator as O, extractRecords as k, findChartSeriesRow as A, formatDimensionValue as j, formatMeasure as M, getSortValue as ee, isDrillEnabled as te, isRetiredFieldType as ne, localizeFieldOptions as re, mergeAuthoredPresentation as N, mergeFilters as P, pivotBucketId as ie, pivotCellKey as ae, pivotDimensionValue as oe, relabelDimensions as F, reportRetiredFieldType as se, resolveDashboardFilterDefs as ce, resolveDrillTitle as I, resolveFilterPlaceholders as le, shiftFilterByCompareTo as ue, toDomProps as L } from "@object-ui/core";
|
|
4
|
+
import { ElementDataSourceGate as R, PageVariablesProvider as z, SchemaRenderer as B, SchemaRendererContext as de, useActionEngine as V, useDataScope as H, useDatasetDimensionMeta as fe, useDnd as pe, useDrillNavigation as me, useFilterScope as he, useHasDndProvider as ge, useObjectLabel as _e, usePageVariables as ve } from "@object-ui/react";
|
|
5
|
+
import { createSafeTranslation as ye, formatDisplayNumber as be, pickLocalized as U, resolveFieldCurrency as xe, setLocalized as W, useDisplayLocale as G, useLocalization as K, useObjectTranslation as q, useSafeFieldLabel as Se, useSafeTranslate as J } from "@object-ui/i18n";
|
|
6
|
+
import { Button as Y, Calendar as Ce, Card as we, CardContent as Te, CardHeader as Ee, CardTitle as De, ChartSkeleton as Oe, Combobox as ke, ConfigPanelRenderer as Ae, ConfigRow as je, DataEmptyState as Me, Dialog as Ne, DialogContent as Pe, DialogHeader as Fe, DialogTitle as Ie, GridSkeleton as Le, Input as Re, Popover as ze, PopoverContent as Be, PopoverTrigger as Ve, RefreshIndicator as He, Select as Ue, SelectContent as We, SelectItem as Ge, SelectTrigger as Ke, SelectValue as qe, Sheet as Je, SheetContent as Ye, SheetHeader as Xe, SheetTitle as Ze, Skeleton as X, cn as Z, getLazyIcon as Qe, useConfigDraft as $e } from "@object-ui/components";
|
|
7
|
+
import { AlertCircle as et, AlertTriangle as tt, ArrowDownIcon as nt, ArrowUpIcon as rt, ArrowUpRight as it, BarChart3 as at, CalendarIcon as ot, ChevronDown as st, ChevronUp as ct, ChevronsUpDown as lt, Download as ut, Edit as dt, GripVertical as ft, Loader2 as pt, MinusIcon as mt, RefreshCw as ht, RotateCcw as gt, Save as _t, Settings as vt, X as yt } from "lucide-react";
|
|
8
|
+
import { DndContext as bt, PointerSensor as xt, closestCenter as St, useSensor as Ct, useSensors as wt } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as Tt, arrayMove as Et, rectSortingStrategy as Dt, useSortable as Ot, verticalListSortingStrategy as kt } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as At } from "@dnd-kit/utilities";
|
|
11
|
+
import { formatCurrency as jt, formatDate as Mt, formatPercent as Nt, getCellRenderer as Pt, resolveCellRendererType as Ft } from "@object-ui/fields";
|
|
12
|
+
import { Fragment as It, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
13
|
+
import { ResponsiveGridLayout as Lt, useContainerWidth as Rt } from "react-grid-layout";
|
|
14
14
|
import "react-grid-layout/css/styles.css";
|
|
15
15
|
//#region src/utils.ts
|
|
16
|
-
function
|
|
16
|
+
function zt(e) {
|
|
17
17
|
return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Bt(e) {
|
|
20
20
|
return e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase());
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Vt(e) {
|
|
23
23
|
if (!Array.isArray(e) || e.length === 0) return [];
|
|
24
24
|
let t = e[0];
|
|
25
25
|
return typeof t != "object" || !t || Array.isArray(t) ? [] : Object.keys(t).filter((e) => !e.startsWith("_")).map((e) => ({
|
|
26
|
-
header:
|
|
26
|
+
header: Bt(e),
|
|
27
27
|
accessorKey: e
|
|
28
28
|
}));
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Ht(e, t) {
|
|
31
31
|
if (t == null || e == null || typeof e != "number" || !Number.isFinite(e) || typeof t != "number" || !Number.isFinite(t)) return null;
|
|
32
32
|
if (t === 0) return e === 0 ? {
|
|
33
33
|
value: 0,
|
|
@@ -49,7 +49,7 @@ function kt(e, t) {
|
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/widgetDispatch.ts
|
|
52
|
-
var
|
|
52
|
+
var Ut = {
|
|
53
53
|
column: "bar",
|
|
54
54
|
"stacked-bar": "bar",
|
|
55
55
|
"grouped-bar": "bar",
|
|
@@ -59,7 +59,7 @@ var At = {
|
|
|
59
59
|
"stacked-area": "area",
|
|
60
60
|
pyramid: "funnel",
|
|
61
61
|
bubble: "scatter"
|
|
62
|
-
},
|
|
62
|
+
}, Wt = /* @__PURE__ */ new Set([
|
|
63
63
|
"bar",
|
|
64
64
|
"horizontal-bar",
|
|
65
65
|
"line",
|
|
@@ -72,13 +72,13 @@ var At = {
|
|
|
72
72
|
"treemap",
|
|
73
73
|
"sankey",
|
|
74
74
|
"combo"
|
|
75
|
-
]),
|
|
75
|
+
]), Gt = /* @__PURE__ */ new Set([
|
|
76
76
|
"metric",
|
|
77
77
|
"gauge",
|
|
78
78
|
"solid-gauge",
|
|
79
79
|
"kpi",
|
|
80
80
|
"bullet"
|
|
81
|
-
]),
|
|
81
|
+
]), Kt = /* @__PURE__ */ new Set(["table", "list"]), qt = /* @__PURE__ */ new Set([
|
|
82
82
|
"sunburst",
|
|
83
83
|
"word-cloud",
|
|
84
84
|
"choropleth",
|
|
@@ -91,31 +91,31 @@ var At = {
|
|
|
91
91
|
"candlestick",
|
|
92
92
|
"stock"
|
|
93
93
|
]);
|
|
94
|
-
function
|
|
94
|
+
function Jt(e) {
|
|
95
95
|
if (!e) return { family: "passthrough" };
|
|
96
|
-
let t =
|
|
97
|
-
return
|
|
96
|
+
let t = Ut[e] ?? e;
|
|
97
|
+
return Wt.has(t) ? {
|
|
98
98
|
family: "series",
|
|
99
99
|
chartType: t
|
|
100
|
-
} :
|
|
100
|
+
} : Gt.has(e) ? { family: "metric" } : Kt.has(e) ? { family: "table" } : e === "pivot" ? { family: "pivot" } : e === "custom" ? { family: "custom" } : qt.has(e) ? { family: "unsupported" } : { family: "passthrough" };
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region src/legacyRetiredWidget.ts
|
|
104
|
-
var
|
|
104
|
+
var Yt = {
|
|
105
105
|
type: "text",
|
|
106
106
|
value: "This widget uses a retired data format. Edit it to bind a dataset.",
|
|
107
107
|
variant: "caption",
|
|
108
108
|
align: "center",
|
|
109
109
|
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"
|
|
110
110
|
};
|
|
111
|
-
function
|
|
111
|
+
function Xt(e) {
|
|
112
112
|
if (!e) return !1;
|
|
113
113
|
let t = e;
|
|
114
114
|
return !t.dataset && !(t.data || t.options?.data) && !!t.object;
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/colorVariants.ts
|
|
118
|
-
var
|
|
118
|
+
var Zt = {
|
|
119
119
|
default: "bg-muted text-muted-foreground",
|
|
120
120
|
blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
121
121
|
teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
|
|
@@ -124,7 +124,7 @@ var Rt = {
|
|
|
124
124
|
success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
|
125
125
|
warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
126
126
|
danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
|
|
127
|
-
},
|
|
127
|
+
}, Qt = {
|
|
128
128
|
default: "text-foreground",
|
|
129
129
|
blue: "text-blue-600 dark:text-blue-400",
|
|
130
130
|
teal: "text-teal-600 dark:text-teal-400",
|
|
@@ -134,12 +134,12 @@ var Rt = {
|
|
|
134
134
|
warning: "text-amber-600 dark:text-amber-400",
|
|
135
135
|
danger: "text-rose-600 dark:text-rose-400"
|
|
136
136
|
};
|
|
137
|
-
function
|
|
138
|
-
if (typeof e == "string" && e !== "default") return
|
|
137
|
+
function $t(e) {
|
|
138
|
+
if (typeof e == "string" && e !== "default") return Qt[e];
|
|
139
139
|
}
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/recordFields.tsx
|
|
142
|
-
var
|
|
142
|
+
var en = /* @__PURE__ */ new Set([
|
|
143
143
|
"id",
|
|
144
144
|
"organization_id",
|
|
145
145
|
"tenant_id",
|
|
@@ -153,15 +153,15 @@ var Vt = /* @__PURE__ */ new Set([
|
|
|
153
153
|
"_id",
|
|
154
154
|
"__typename"
|
|
155
155
|
]);
|
|
156
|
-
function
|
|
157
|
-
return t && (t.isSystem === !0 || t.system === !0) ? !0 :
|
|
156
|
+
function tn(e, t) {
|
|
157
|
+
return t && (t.isSystem === !0 || t.system === !0) ? !0 : en.has(e);
|
|
158
158
|
}
|
|
159
|
-
var
|
|
159
|
+
var nn = /* @__PURE__ */ new Set([
|
|
160
160
|
"select",
|
|
161
161
|
"picklist",
|
|
162
162
|
"dropdown",
|
|
163
163
|
"status"
|
|
164
|
-
]),
|
|
164
|
+
]), rn = /* @__PURE__ */ new Set([
|
|
165
165
|
"currency",
|
|
166
166
|
"money",
|
|
167
167
|
"number",
|
|
@@ -171,7 +171,7 @@ var Ut = /* @__PURE__ */ new Set([
|
|
|
171
171
|
"percent",
|
|
172
172
|
"percentage"
|
|
173
173
|
]);
|
|
174
|
-
function
|
|
174
|
+
function an(e) {
|
|
175
175
|
let t = {}, n = e?.fields;
|
|
176
176
|
if (!n) return t;
|
|
177
177
|
if (Array.isArray(n)) for (let e of n) e?.name && (t[e.name] = e);
|
|
@@ -181,9 +181,9 @@ function Gt(e) {
|
|
|
181
181
|
};
|
|
182
182
|
return t;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function on(e) {
|
|
185
185
|
let { accessorKey: t, label: n, def: r, objectName: i, fieldOptionLabel: a, overrides: o = {} } = e, s = o.referenceTo ?? r?.referenceTo ?? (typeof r?.reference == "string" ? r.reference : r?.reference?.to) ?? r?.target, c = o.options ?? r?.options;
|
|
186
|
-
return i && c && a &&
|
|
186
|
+
return i && c && a && nn.has(r?.type) && (c = c.map((e) => {
|
|
187
187
|
if (e == null) return e;
|
|
188
188
|
let n = typeof e == "object" ? e.value : e, r = typeof e == "object" && e.label || String(n);
|
|
189
189
|
return {
|
|
@@ -202,10 +202,10 @@ function Kt(e) {
|
|
|
202
202
|
decimals: o.decimals ?? r?.decimals ?? r?.scale
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
return
|
|
205
|
+
function sn(e) {
|
|
206
|
+
return rn.has(e.type) || typeof e.format == "string" && /^[$¥€£]|%$|0/.test(e.format);
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function cn(e, t, n, r) {
|
|
209
209
|
if (e == null || e === "") return "";
|
|
210
210
|
let i = t.format;
|
|
211
211
|
if (typeof i == "string" && /^\$|¥|€|£/.test(i) && typeof e == "number") {
|
|
@@ -215,14 +215,14 @@ function Jt(e, t, n, r) {
|
|
|
215
215
|
"€": "EUR",
|
|
216
216
|
"£": "GBP"
|
|
217
217
|
}[i[0]];
|
|
218
|
-
return
|
|
218
|
+
return jt(e, t.currency || r || n);
|
|
219
219
|
}
|
|
220
220
|
if (typeof i == "string" && /%/.test(i) && typeof e == "number") {
|
|
221
|
-
let t = (i.match(/0\.(0+)%/) || [void 0, ""])[1].length
|
|
222
|
-
return
|
|
221
|
+
let t = (i.match(/0\.(0+)%/) || [void 0, ""])[1].length;
|
|
222
|
+
return Nt(e, t, r);
|
|
223
223
|
}
|
|
224
|
-
if (typeof i == "string" && /[YMDHms]/.test(i)) return
|
|
225
|
-
let a =
|
|
224
|
+
if (typeof i == "string" && /[YMDHms]/.test(i)) return Mt(e, i);
|
|
225
|
+
let a = Pt(Ft(t));
|
|
226
226
|
return /* @__PURE__ */ Q(a, {
|
|
227
227
|
value: e,
|
|
228
228
|
field: t
|
|
@@ -230,7 +230,7 @@ function Jt(e, t, n, r) {
|
|
|
230
230
|
}
|
|
231
231
|
//#endregion
|
|
232
232
|
//#region src/RecordDetailDrawer.tsx
|
|
233
|
-
var
|
|
233
|
+
var ln = [
|
|
234
234
|
"name",
|
|
235
235
|
"title",
|
|
236
236
|
"label",
|
|
@@ -238,21 +238,21 @@ var Yt = [
|
|
|
238
238
|
"display_name",
|
|
239
239
|
"full_name"
|
|
240
240
|
];
|
|
241
|
-
function
|
|
241
|
+
function un(e, t) {
|
|
242
242
|
if (t && t.trim()) return t;
|
|
243
|
-
for (let t of
|
|
243
|
+
for (let t of ln) {
|
|
244
244
|
let n = e[t];
|
|
245
245
|
if (typeof n == "string" && n.trim()) return n;
|
|
246
246
|
}
|
|
247
247
|
let n = e.id ?? e._id;
|
|
248
248
|
return n == null ? "Record" : String(n);
|
|
249
249
|
}
|
|
250
|
-
var
|
|
251
|
-
let { fieldLabel: c, fieldOptionLabel: l } =
|
|
250
|
+
var dn = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
|
|
251
|
+
let { fieldLabel: c, fieldOptionLabel: l } = Se(), { currency: u } = K(), d = G(), f = s(() => {
|
|
252
252
|
if (!e) return [];
|
|
253
|
-
let i =
|
|
254
|
-
return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !
|
|
255
|
-
let r = i[n], a = n.charAt(0).toUpperCase() + n.slice(1).replace(/([A-Z])/g, " $1").replace(/_/g, " "), o = t ? c(t, n, a) : a, s =
|
|
253
|
+
let i = an(n), a;
|
|
254
|
+
return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !tn(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !tn(e)), a.map((n) => {
|
|
255
|
+
let r = i[n], a = n.charAt(0).toUpperCase() + n.slice(1).replace(/([A-Z])/g, " $1").replace(/_/g, " "), o = t ? c(t, n, a) : a, s = on({
|
|
256
256
|
accessorKey: n,
|
|
257
257
|
label: o,
|
|
258
258
|
def: r,
|
|
@@ -262,8 +262,8 @@ var Zt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
|
|
|
262
262
|
return {
|
|
263
263
|
key: n,
|
|
264
264
|
label: o,
|
|
265
|
-
node:
|
|
266
|
-
numeric:
|
|
265
|
+
node: cn(e[n], s, u, d),
|
|
266
|
+
numeric: sn(s)
|
|
267
267
|
};
|
|
268
268
|
});
|
|
269
269
|
}, [
|
|
@@ -277,7 +277,7 @@ var Zt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
|
|
|
277
277
|
d
|
|
278
278
|
]);
|
|
279
279
|
if (!e) return null;
|
|
280
|
-
let p =
|
|
280
|
+
let p = un(e, i), m = /* @__PURE__ */ Q("dl", {
|
|
281
281
|
className: "divide-y divide-border/60",
|
|
282
282
|
"data-testid": "record-detail-body",
|
|
283
283
|
children: f.map((e) => /* @__PURE__ */ $("div", {
|
|
@@ -294,38 +294,52 @@ var Zt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
|
|
|
294
294
|
})]
|
|
295
295
|
}, e.key))
|
|
296
296
|
});
|
|
297
|
-
return a === "dialog" ? /* @__PURE__ */ Q(
|
|
297
|
+
return a === "dialog" ? /* @__PURE__ */ Q(Ne, {
|
|
298
298
|
open: !0,
|
|
299
299
|
onOpenChange: (e) => !e && o(),
|
|
300
|
-
children: /* @__PURE__ */ $(
|
|
300
|
+
children: /* @__PURE__ */ $(Pe, {
|
|
301
301
|
className: "max-w-2xl",
|
|
302
|
-
children: [/* @__PURE__ */ Q(
|
|
302
|
+
children: [/* @__PURE__ */ Q(Fe, { children: /* @__PURE__ */ Q(Ie, { children: p }) }), /* @__PURE__ */ Q("div", {
|
|
303
303
|
className: "max-h-[70vh] overflow-auto",
|
|
304
304
|
children: m
|
|
305
305
|
})]
|
|
306
306
|
})
|
|
307
|
-
}) : /* @__PURE__ */ Q(
|
|
307
|
+
}) : /* @__PURE__ */ Q(Je, {
|
|
308
308
|
open: !0,
|
|
309
309
|
onOpenChange: (e) => !e && o(),
|
|
310
|
-
children: /* @__PURE__ */ $(
|
|
310
|
+
children: /* @__PURE__ */ $(Ye, {
|
|
311
311
|
side: "right",
|
|
312
312
|
className: "w-full sm:max-w-md md:max-w-lg flex flex-col",
|
|
313
|
-
children: [/* @__PURE__ */ Q(
|
|
313
|
+
children: [/* @__PURE__ */ Q(Xe, { children: /* @__PURE__ */ Q(Ze, { children: p }) }), /* @__PURE__ */ Q("div", {
|
|
314
314
|
className: "flex-1 overflow-auto mt-2 pr-1",
|
|
315
315
|
children: m
|
|
316
316
|
})]
|
|
317
317
|
})
|
|
318
318
|
});
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
319
|
+
}, fn = Object.freeze([]);
|
|
320
|
+
function pn(e) {
|
|
321
|
+
return e.map((e) => {
|
|
322
|
+
if (typeof e == "string") return {
|
|
323
|
+
header: Bt(e),
|
|
324
|
+
accessorKey: e
|
|
325
|
+
};
|
|
326
|
+
if (!e) return e;
|
|
327
|
+
let t = {};
|
|
328
|
+
if (!e.accessorKey) {
|
|
329
|
+
let n = x(e);
|
|
330
|
+
n && (t.accessorKey = n);
|
|
331
|
+
}
|
|
332
|
+
if (!e.header) {
|
|
333
|
+
let n = b(e);
|
|
334
|
+
n && (t.header = n);
|
|
335
|
+
}
|
|
336
|
+
return Object.keys(t).length === 0 ? e : {
|
|
337
|
+
...e,
|
|
338
|
+
...t
|
|
339
|
+
};
|
|
340
|
+
});
|
|
327
341
|
}
|
|
328
|
-
function
|
|
342
|
+
function mn(e, t) {
|
|
329
343
|
if (!t?.fields) return [];
|
|
330
344
|
let n = {};
|
|
331
345
|
if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
|
|
@@ -333,9 +347,9 @@ function $t(e, t) {
|
|
|
333
347
|
name: e,
|
|
334
348
|
...r
|
|
335
349
|
};
|
|
336
|
-
let r = (e) =>
|
|
350
|
+
let r = (e) => typeof e == "string" && ne(e) ? (se(e), !1) : f.has(e), i = Array.isArray(e.columns) ? e.columns : [], a = /* @__PURE__ */ new Set();
|
|
337
351
|
if (i.length > 0) {
|
|
338
|
-
let e = i.map((e) => typeof e == "string" ? e : e
|
|
352
|
+
let e = i.map((e) => typeof e == "string" ? e : e?.accessorKey || x(e)).filter(Boolean);
|
|
339
353
|
for (let t of e) {
|
|
340
354
|
let e = n[t];
|
|
341
355
|
e && r(e.type) && a.add(t);
|
|
@@ -343,37 +357,37 @@ function $t(e, t) {
|
|
|
343
357
|
} else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
|
|
344
358
|
return Array.from(a);
|
|
345
359
|
}
|
|
346
|
-
var
|
|
347
|
-
let { currency: r } =
|
|
360
|
+
var hn = ({ schema: e, dataSource: t, className: n }) => {
|
|
361
|
+
let { currency: r } = K(), c = G(), u = a(de), d = t || u?.dataSource, f = H(e.bind), { fieldLabel: p, fieldOptionLabel: m } = Se(), h = "No data available", g = "No data source available for", { t: _ } = q(), v = _("dashboard.noDataAvailable");
|
|
348
362
|
v && v !== "dashboard.noDataAvailable" && (h = v);
|
|
349
363
|
let y = _("dashboard.noDataSourceFor");
|
|
350
364
|
y && y !== "dashboard.noDataSourceFor" && (g = y);
|
|
351
|
-
let [b, x] = l([]), [S, C] = l(null), [
|
|
352
|
-
|
|
353
|
-
}, []),
|
|
365
|
+
let [b, x] = l([]), [S, C] = l(null), [w, T] = l(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [E, D] = l(null), O = e.drillDown, A = te(O) && (O?.mode ?? "record") === "record", [j, M] = l(null), ee = i((e) => {
|
|
366
|
+
M(e ?? null);
|
|
367
|
+
}, []), ne = he();
|
|
354
368
|
o(() => {
|
|
355
369
|
let t = !0;
|
|
356
370
|
return e.objectName && !f && (!e.data || e.data.length === 0) ? (async () => {
|
|
357
371
|
if (!d || !e.objectName) {
|
|
358
|
-
t &&
|
|
372
|
+
t && T(!1);
|
|
359
373
|
return;
|
|
360
374
|
}
|
|
361
|
-
t && (
|
|
375
|
+
t && (T(!0), D(null));
|
|
362
376
|
try {
|
|
363
377
|
let n;
|
|
364
378
|
if (typeof d.find == "function") {
|
|
365
|
-
let t =
|
|
379
|
+
let t = mn(e, S), r = { $filter: le(e.filter, ne) };
|
|
366
380
|
t.length && (r.$expand = t);
|
|
367
381
|
let i = await d.find(e.objectName, r);
|
|
368
|
-
n =
|
|
382
|
+
n = k(i);
|
|
369
383
|
} else return;
|
|
370
384
|
t && x(n);
|
|
371
385
|
} catch (e) {
|
|
372
|
-
console.error("[ObjectDataTable] Fetch error:", e), t &&
|
|
386
|
+
console.error("[ObjectDataTable] Fetch error:", e), t && D(e instanceof Error ? e.message : "Failed to load data");
|
|
373
387
|
} finally {
|
|
374
|
-
t &&
|
|
388
|
+
t && T(!1);
|
|
375
389
|
}
|
|
376
|
-
})() : t &&
|
|
390
|
+
})() : t && T(!1), () => {
|
|
377
391
|
t = !1;
|
|
378
392
|
};
|
|
379
393
|
}, [
|
|
@@ -383,7 +397,7 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
383
397
|
e.data,
|
|
384
398
|
e.filter,
|
|
385
399
|
S,
|
|
386
|
-
|
|
400
|
+
ne
|
|
387
401
|
]), o(() => {
|
|
388
402
|
let t = !0;
|
|
389
403
|
if (!(!d || !e.objectName || typeof d.getObjectSchema != "function")) return d.getObjectSchema(e.objectName).then((e) => {
|
|
@@ -392,7 +406,7 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
392
406
|
t = !1;
|
|
393
407
|
};
|
|
394
408
|
}, [e.objectName, d]);
|
|
395
|
-
let
|
|
409
|
+
let re = f || e.data || b, N = Array.isArray(re) ? re : fn, P = s(() => {
|
|
396
410
|
let t = e.objectName, n = {};
|
|
397
411
|
if (S?.fields) {
|
|
398
412
|
let e = S.fields;
|
|
@@ -403,10 +417,10 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
403
417
|
};
|
|
404
418
|
}
|
|
405
419
|
let i = (e) => {
|
|
406
|
-
let n =
|
|
420
|
+
let n = Bt(e);
|
|
407
421
|
return t ? p(t, e, n) : n;
|
|
408
422
|
}, a = (e) => {
|
|
409
|
-
let i =
|
|
423
|
+
let i = on({
|
|
410
424
|
accessorKey: e.accessorKey,
|
|
411
425
|
label: e.header,
|
|
412
426
|
def: n[e.accessorKey],
|
|
@@ -420,13 +434,13 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
420
434
|
currency: e.currency,
|
|
421
435
|
decimals: e.decimals
|
|
422
436
|
}
|
|
423
|
-
}), a = e.align ?? (
|
|
437
|
+
}), a = e.align ?? (sn(i) ? "right" : void 0);
|
|
424
438
|
if (typeof e.cell == "function") return {
|
|
425
439
|
...e,
|
|
426
440
|
...i,
|
|
427
441
|
align: a
|
|
428
442
|
};
|
|
429
|
-
let o = (e) =>
|
|
443
|
+
let o = (e) => cn(e, i, r, c);
|
|
430
444
|
return {
|
|
431
445
|
...e,
|
|
432
446
|
...i,
|
|
@@ -435,27 +449,27 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
435
449
|
};
|
|
436
450
|
};
|
|
437
451
|
if (e.columns && e.columns.length > 0) {
|
|
438
|
-
let n =
|
|
452
|
+
let n = pn(e.columns);
|
|
439
453
|
return (t ? n.map((e) => ({
|
|
440
454
|
...e,
|
|
441
455
|
header: p(t, e.accessorKey, e.header)
|
|
442
456
|
})) : n).map(a);
|
|
443
457
|
}
|
|
444
|
-
return
|
|
458
|
+
return N.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !tn(e, n[e])) : Object.keys(N[0]).filter((e) => !e.startsWith("_") && !tn(e))).map((e) => a({
|
|
445
459
|
header: i(e),
|
|
446
460
|
accessorKey: e
|
|
447
461
|
}));
|
|
448
462
|
}, [
|
|
449
463
|
e.columns,
|
|
450
464
|
e.objectName,
|
|
451
|
-
|
|
465
|
+
N,
|
|
452
466
|
S,
|
|
453
467
|
p,
|
|
454
468
|
m,
|
|
455
469
|
r,
|
|
456
470
|
c
|
|
457
471
|
]);
|
|
458
|
-
if (
|
|
472
|
+
if (w && N.length === 0) return /* @__PURE__ */ Q("div", {
|
|
459
473
|
className: Z("overflow-auto", n),
|
|
460
474
|
"data-testid": "table-loading",
|
|
461
475
|
children: /* @__PURE__ */ $("div", {
|
|
@@ -484,7 +498,7 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
484
498
|
}, e))]
|
|
485
499
|
})
|
|
486
500
|
});
|
|
487
|
-
if (
|
|
501
|
+
if (E) return /* @__PURE__ */ Q("div", {
|
|
488
502
|
className: Z("overflow-auto", n),
|
|
489
503
|
"data-testid": "table-error",
|
|
490
504
|
children: /* @__PURE__ */ $("div", {
|
|
@@ -520,11 +534,11 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
520
534
|
]
|
|
521
535
|
}), /* @__PURE__ */ Q("p", {
|
|
522
536
|
className: "text-xs",
|
|
523
|
-
children:
|
|
537
|
+
children: E
|
|
524
538
|
})]
|
|
525
539
|
})
|
|
526
540
|
});
|
|
527
|
-
if (!d && e.objectName &&
|
|
541
|
+
if (!d && e.objectName && N.length === 0) return /* @__PURE__ */ Q("div", {
|
|
528
542
|
className: Z("overflow-auto", n),
|
|
529
543
|
children: /* @__PURE__ */ Q("div", {
|
|
530
544
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
@@ -539,7 +553,7 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
539
553
|
})
|
|
540
554
|
})
|
|
541
555
|
});
|
|
542
|
-
if (
|
|
556
|
+
if (N.length === 0) return /* @__PURE__ */ Q("div", {
|
|
543
557
|
className: Z("overflow-auto", n),
|
|
544
558
|
"data-testid": "table-empty-state",
|
|
545
559
|
children: /* @__PURE__ */ $("div", {
|
|
@@ -581,35 +595,35 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
581
595
|
})]
|
|
582
596
|
})
|
|
583
597
|
});
|
|
584
|
-
let
|
|
598
|
+
let ie = {
|
|
585
599
|
...e,
|
|
586
600
|
type: "data-table",
|
|
587
|
-
data:
|
|
588
|
-
columns:
|
|
589
|
-
onRowClick: e.onRowClick ?? (
|
|
590
|
-
}, ae =
|
|
601
|
+
data: N,
|
|
602
|
+
columns: P,
|
|
603
|
+
onRowClick: e.onRowClick ?? (A ? ee : void 0)
|
|
604
|
+
}, ae = O?.title && !O.title.includes("${") ? O.title : void 0;
|
|
591
605
|
return /* @__PURE__ */ $("div", {
|
|
592
606
|
className: Z("relative", n),
|
|
593
607
|
children: [
|
|
594
|
-
/* @__PURE__ */ Q(
|
|
595
|
-
/* @__PURE__ */ Q(
|
|
596
|
-
schema:
|
|
608
|
+
/* @__PURE__ */ Q(He, { active: w && N.length > 0 }),
|
|
609
|
+
/* @__PURE__ */ Q(B, {
|
|
610
|
+
schema: ie,
|
|
597
611
|
className: n
|
|
598
612
|
}),
|
|
599
|
-
|
|
600
|
-
record:
|
|
613
|
+
A && /* @__PURE__ */ Q(dn, {
|
|
614
|
+
record: j,
|
|
601
615
|
objectName: e.objectName,
|
|
602
616
|
objectSchema: S,
|
|
603
|
-
fields:
|
|
617
|
+
fields: O?.columns,
|
|
604
618
|
title: ae,
|
|
605
|
-
target:
|
|
606
|
-
onClose: () =>
|
|
619
|
+
target: O?.target === "dialog" ? "dialog" : "drawer",
|
|
620
|
+
onClose: () => M(null)
|
|
607
621
|
})
|
|
608
622
|
]
|
|
609
623
|
});
|
|
610
|
-
},
|
|
611
|
-
let { openRecordList: i } =
|
|
612
|
-
return !i || !e ? null : /* @__PURE__ */ $(
|
|
624
|
+
}, gn = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
|
|
625
|
+
let { openRecordList: i } = me(), a = J();
|
|
626
|
+
return !i || !e ? null : /* @__PURE__ */ $(Y, {
|
|
613
627
|
type: "button",
|
|
614
628
|
variant: "ghost",
|
|
615
629
|
size: "sm",
|
|
@@ -618,14 +632,14 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
618
632
|
onClick: () => {
|
|
619
633
|
i(e, t), n?.();
|
|
620
634
|
},
|
|
621
|
-
children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Q(
|
|
635
|
+
children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Q(it, { className: "ml-1 h-3.5 w-3.5" })]
|
|
622
636
|
});
|
|
623
|
-
},
|
|
624
|
-
let { openRecordList: f } =
|
|
637
|
+
}, _n = ({ open: e, onClose: n, title: r, target: i = "drawer", objectName: a, filter: o, dataSource: s, columns: c, maxRows: l, className: u, report: d }) => {
|
|
638
|
+
let { openRecordList: f } = me(), p = d && typeof d == "object" && (Array.isArray(d.columns) || "objectName" in d), m = i === "navigate" && !!f && !p && !!a;
|
|
625
639
|
if (t.useEffect(() => {
|
|
626
640
|
e && m && (f(a, o), n());
|
|
627
641
|
}, [e, m]), m) return null;
|
|
628
|
-
let h = p ? null : /* @__PURE__ */ Q(
|
|
642
|
+
let h = p ? null : /* @__PURE__ */ Q(gn, {
|
|
629
643
|
objectName: a,
|
|
630
644
|
filter: o,
|
|
631
645
|
onNavigate: n
|
|
@@ -642,8 +656,8 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
642
656
|
},
|
|
643
657
|
filter: t
|
|
644
658
|
};
|
|
645
|
-
return /* @__PURE__ */ Q(
|
|
646
|
-
})() : /* @__PURE__ */ Q(
|
|
659
|
+
return /* @__PURE__ */ Q(B, { schema: n });
|
|
660
|
+
})() : /* @__PURE__ */ Q(hn, {
|
|
647
661
|
schema: {
|
|
648
662
|
type: "object-data-table",
|
|
649
663
|
objectName: a,
|
|
@@ -664,78 +678,78 @@ var en = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
664
678
|
dataSource: s
|
|
665
679
|
})
|
|
666
680
|
});
|
|
667
|
-
return i === "dialog" ? /* @__PURE__ */ Q(
|
|
681
|
+
return i === "dialog" ? /* @__PURE__ */ Q(Ne, {
|
|
668
682
|
open: e,
|
|
669
683
|
onOpenChange: (e) => !e && n(),
|
|
670
|
-
children: /* @__PURE__ */ $(
|
|
684
|
+
children: /* @__PURE__ */ $(Pe, {
|
|
671
685
|
className: "max-w-5xl",
|
|
672
|
-
children: [/* @__PURE__ */ $(
|
|
686
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
673
687
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
674
|
-
children: [/* @__PURE__ */ Q(
|
|
688
|
+
children: [/* @__PURE__ */ Q(Ie, { children: r }), h]
|
|
675
689
|
}), g]
|
|
676
690
|
})
|
|
677
|
-
}) : /* @__PURE__ */ Q(
|
|
691
|
+
}) : /* @__PURE__ */ Q(Je, {
|
|
678
692
|
open: e,
|
|
679
693
|
onOpenChange: (e) => !e && n(),
|
|
680
|
-
children: /* @__PURE__ */ $(
|
|
694
|
+
children: /* @__PURE__ */ $(Ye, {
|
|
681
695
|
side: "right",
|
|
682
696
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
683
|
-
children: [/* @__PURE__ */ $(
|
|
697
|
+
children: [/* @__PURE__ */ $(Xe, {
|
|
684
698
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
685
|
-
children: [/* @__PURE__ */ Q(
|
|
699
|
+
children: [/* @__PURE__ */ Q(Ze, { children: r }), h]
|
|
686
700
|
}), /* @__PURE__ */ Q("div", {
|
|
687
701
|
className: "flex-1 overflow-hidden mt-2",
|
|
688
702
|
children: g
|
|
689
703
|
})]
|
|
690
704
|
})
|
|
691
705
|
});
|
|
692
|
-
},
|
|
693
|
-
function
|
|
706
|
+
}, vn = h;
|
|
707
|
+
function yn(e, t, n, r) {
|
|
694
708
|
let i = [], a = [], o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
|
|
695
709
|
return e.forEach((e, l) => {
|
|
696
|
-
let u =
|
|
710
|
+
let u = ie(t.map((t) => oe(e[t]))), d = ie([oe(e[n])]);
|
|
697
711
|
o.has(u) || (o.add(u), i.push({
|
|
698
712
|
id: u,
|
|
699
|
-
labels: t.map((t) =>
|
|
713
|
+
labels: t.map((t) => j(e[t], r))
|
|
700
714
|
})), s.has(d) || (s.add(d), a.push({
|
|
701
715
|
id: d,
|
|
702
|
-
label:
|
|
703
|
-
})), c.set(
|
|
716
|
+
label: j(e[n], r)
|
|
717
|
+
})), c.set(ae(u, d), l);
|
|
704
718
|
}), {
|
|
705
719
|
rowHeaders: i,
|
|
706
720
|
colHeaders: a,
|
|
707
721
|
cellIndex: c
|
|
708
722
|
};
|
|
709
723
|
}
|
|
710
|
-
function
|
|
724
|
+
function bn(e) {
|
|
711
725
|
if (e == null) return "";
|
|
712
726
|
let t = String(e);
|
|
713
727
|
return /[",\n\r]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
714
728
|
}
|
|
715
|
-
function
|
|
716
|
-
return e.map((e) => e.map(
|
|
729
|
+
function xn(e) {
|
|
730
|
+
return e.map((e) => e.map(bn).join(",")).join("\r\n");
|
|
717
731
|
}
|
|
718
|
-
function
|
|
732
|
+
function Sn(e, t) {
|
|
719
733
|
if (typeof document > "u") return;
|
|
720
|
-
let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${
|
|
734
|
+
let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${xn(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
721
735
|
a.href = i, a.download = n.endsWith(".csv") ? n : `${n}.csv`, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
|
|
722
736
|
}
|
|
723
|
-
var
|
|
737
|
+
var Cn = "__compare", wn = (e) => `${e}${Cn}`, Tn = {
|
|
724
738
|
vsLastQuarter: "vs last quarter",
|
|
725
739
|
vsLastMonth: "vs last month",
|
|
726
740
|
vsLastWeek: "vs last week",
|
|
727
741
|
vsLastYear: "vs last year",
|
|
728
742
|
vsYesterday: "vs yesterday",
|
|
729
743
|
vsPreviousPeriod: "vs previous period"
|
|
730
|
-
},
|
|
731
|
-
function
|
|
744
|
+
}, En = /^\d{4}-\d{2}-\d{2}(?:[T ][\d:.]+(?:Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
745
|
+
function Dn(e) {
|
|
732
746
|
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
733
747
|
let t = Object.keys(e);
|
|
734
748
|
if (t.length !== 2 || !t.includes("$gte") || !t.includes("$lte")) return null;
|
|
735
749
|
let { $gte: n, $lte: r } = e;
|
|
736
|
-
return typeof n != "string" || typeof r != "string" || !
|
|
750
|
+
return typeof n != "string" || typeof r != "string" || !En.test(n) || !En.test(r) ? null : [n, r];
|
|
737
751
|
}
|
|
738
|
-
function
|
|
752
|
+
function On(e) {
|
|
739
753
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
740
754
|
if (!e || typeof e != "object" || Array.isArray(e)) return e;
|
|
741
755
|
let r = {}, i = null;
|
|
@@ -748,7 +762,7 @@ function mn(e) {
|
|
|
748
762
|
r[a] = o;
|
|
749
763
|
continue;
|
|
750
764
|
}
|
|
751
|
-
let e =
|
|
765
|
+
let e = Dn(o);
|
|
752
766
|
if (!e) {
|
|
753
767
|
r[a] = o;
|
|
754
768
|
continue;
|
|
@@ -766,13 +780,13 @@ function mn(e) {
|
|
|
766
780
|
rest: i
|
|
767
781
|
};
|
|
768
782
|
}
|
|
769
|
-
var
|
|
783
|
+
var kn = /* @__PURE__ */ new Set([
|
|
770
784
|
"metric",
|
|
771
785
|
"kpi",
|
|
772
786
|
"gauge",
|
|
773
787
|
"solid-gauge",
|
|
774
788
|
"bullet"
|
|
775
|
-
]),
|
|
789
|
+
]), An = {
|
|
776
790
|
bar: "bar",
|
|
777
791
|
column: "column",
|
|
778
792
|
"horizontal-bar": "horizontal-bar",
|
|
@@ -795,77 +809,22 @@ var hn = /* @__PURE__ */ new Set([
|
|
|
795
809
|
sankey: "sankey",
|
|
796
810
|
combo: "combo"
|
|
797
811
|
};
|
|
798
|
-
function
|
|
799
|
-
let n = e && typeof e == "object" && !Array.isArray(e) ? e : {},
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
a && (r.title = a);
|
|
803
|
-
let o = i(n.subtitle);
|
|
804
|
-
o && (r.subtitle = o);
|
|
805
|
-
let s = i(n.description);
|
|
806
|
-
s && (r.description = s), typeof n.height == "number" && Number.isFinite(n.height) && n.height > 0 && (r.height = n.height), Array.isArray(n.annotations) && n.annotations.length > 0 && (r.annotations = n.annotations), n.interaction && typeof n.interaction == "object" && !Array.isArray(n.interaction) && (r.interaction = n.interaction);
|
|
807
|
-
let c = Array.isArray(n.colors) ? n.colors.filter((e) => typeof e == "string" && !!e) : void 0;
|
|
808
|
-
c?.length && (r.colors = c);
|
|
809
|
-
let l = n.colors && typeof n.colors == "object" && !Array.isArray(n.colors) ? n.colors : void 0;
|
|
810
|
-
return (t || l) && (r.categoryColors = {
|
|
811
|
-
...t ?? {},
|
|
812
|
-
...l ?? {}
|
|
813
|
-
}), r;
|
|
814
|
-
}
|
|
815
|
-
var vn = (e) => !!e && typeof e == "object" && !Array.isArray(e);
|
|
816
|
-
function yn(e) {
|
|
817
|
-
if (typeof e == "string" && e) return e;
|
|
818
|
-
if (vn(e)) return Object.values(e).find((e) => typeof e == "string" && e);
|
|
819
|
-
}
|
|
820
|
-
function bn(e) {
|
|
821
|
-
let t = {}, n = e.type;
|
|
822
|
-
(n === "bar" || n === "line" || n === "area") && (t.chartType = n), (e.yAxis === "left" || e.yAxis === "right") && (t.yAxis = e.yAxis);
|
|
823
|
-
let r = yn(e.label);
|
|
824
|
-
return r && (t.label = r), typeof e.color == "string" && e.color && (t.color = e.color), typeof e.stack == "string" && e.stack && (t.stack = e.stack), (e.variant === "primary" || e.variant === "comparison") && (t.variant = e.variant), typeof e.dashArray == "string" && e.dashArray && (t.dashArray = e.dashArray), typeof e.opacity == "number" && Number.isFinite(e.opacity) && (t.opacity = e.opacity), t;
|
|
825
|
-
}
|
|
826
|
-
function xn(e) {
|
|
827
|
-
let t = {};
|
|
828
|
-
if (!vn(e)) return t;
|
|
829
|
-
let n = yn(e.title);
|
|
830
|
-
return n && (t.title = n), typeof e.format == "string" && e.format && (t.format = e.format), typeof e.min == "number" && Number.isFinite(e.min) && (t.min = e.min), typeof e.max == "number" && Number.isFinite(e.max) && (t.max = e.max), typeof e.stepSize == "number" && Number.isFinite(e.stepSize) && e.stepSize > 0 && (t.stepSize = e.stepSize), typeof e.showGridLines == "boolean" && (t.showGridLines = e.showGridLines), (e.position === "left" || e.position === "right" || e.position === "top" || e.position === "bottom") && (t.position = e.position), typeof e.logarithmic == "boolean" && (t.logarithmic = e.logarithmic), t;
|
|
831
|
-
}
|
|
832
|
-
function Sn(e, t) {
|
|
833
|
-
let n = vn(t) ? t : {}, r = /* @__PURE__ */ new Map();
|
|
834
|
-
for (let e of Array.isArray(n.series) ? n.series : []) {
|
|
835
|
-
if (!vn(e)) continue;
|
|
836
|
-
let t = typeof e.name == "string" ? e.name : void 0;
|
|
837
|
-
t && !r.has(t) && r.set(t, e);
|
|
838
|
-
}
|
|
839
|
-
let i = e.map((e) => {
|
|
840
|
-
let t = r.get(e.dataKey);
|
|
841
|
-
return t ? {
|
|
842
|
-
...e,
|
|
843
|
-
...bn(t)
|
|
844
|
-
} : e;
|
|
845
|
-
}), a = {}, o = xn(n.xAxis);
|
|
846
|
-
Object.keys(o).length > 0 && (a.xAxis = o);
|
|
847
|
-
let s = Array.isArray(n.yAxis) ? n.yAxis : n.yAxis === void 0 ? [] : [n.yAxis];
|
|
848
|
-
return s.length > 0 && (a.yAxis = s.map(xn)), {
|
|
849
|
-
series: i,
|
|
850
|
-
axes: a
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
function Cn({ widget: e, dataSource: t }) {
|
|
854
|
-
let n = String(e?.dataset ?? ""), r = s(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), i = s(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), a = e?.compareTo, c = String(e?.type ?? ""), u = hn.has(c) || r.length === 0, d = c === "table" || c === "pivot", m = c === "pivot" && r.length >= 2, _ = m ? r.slice(0, -1) : [], y = m ? r[r.length - 1] : "", b = m ? [
|
|
855
|
-
_,
|
|
856
|
-
[y],
|
|
812
|
+
function jn({ widget: e, dataSource: t }) {
|
|
813
|
+
let n = String(e?.dataset ?? ""), r = s(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), i = s(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), a = e?.compareTo, c = String(e?.type ?? ""), u = kn.has(c) || r.length === 0, d = c === "table" || c === "pivot", f = c === "pivot" && r.length >= 2, h = f ? r.slice(0, -1) : [], v = f ? r[r.length - 1] : "", b = e?.options && typeof e.options == "object" && !Array.isArray(e.options) ? e.options : {}, x = typeof b.dateGranularity == "string" ? b.dateGranularity : void 0, w = typeof b.sortBy == "string" && b.sortBy ? b.sortBy : void 0, T = w && (r.includes(w) || i.includes(w)) ? w : void 0, E = T ? { [T]: b.sortOrder === "desc" ? "desc" : "asc" } : void 0, k = typeof b.limit == "number" && Number.isFinite(b.limit) && b.limit > 0 ? Math.floor(b.limit) : void 0, te = d && !f && r.length > 0 && k == null, ne = f ? [
|
|
814
|
+
h,
|
|
815
|
+
[v],
|
|
857
816
|
[]
|
|
858
|
-
] :
|
|
817
|
+
] : te ? [[]] : void 0, P = J(), { fieldLabel: se, fieldOptionLabel: ce } = Se(), I = G(), ue = he(), L = e?.filter, R = s(() => L && typeof L == "object" && Object.keys(L).length > 0 ? le(L, ue) : void 0, [L, ue]), { windows: z, rest: de } = s(() => a ? On(R) : {
|
|
859
818
|
windows: [],
|
|
860
|
-
rest:
|
|
861
|
-
}, [a,
|
|
819
|
+
rest: R
|
|
820
|
+
}, [a, R]), [V, H] = l({
|
|
862
821
|
status: "idle",
|
|
863
822
|
rows: []
|
|
864
|
-
}), [
|
|
823
|
+
}), [pe, me] = l(null), [ge, _e] = l(null), ve = `${c}|${n}|${r.join(",")}|${i.join(",")}|${JSON.stringify(L ?? null)}|${JSON.stringify(a ?? null)}|${x ?? ""}|${JSON.stringify(E ?? null)}|${k ?? ""}`;
|
|
865
824
|
o(() => {
|
|
866
825
|
let e = t;
|
|
867
826
|
if (!e || typeof e.queryDataset != "function") {
|
|
868
|
-
|
|
827
|
+
H({
|
|
869
828
|
status: "error",
|
|
870
829
|
rows: [],
|
|
871
830
|
error: P("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
|
|
@@ -873,28 +832,28 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
873
832
|
return;
|
|
874
833
|
}
|
|
875
834
|
if (i.length === 0) {
|
|
876
|
-
|
|
835
|
+
H({
|
|
877
836
|
status: "idle",
|
|
878
837
|
rows: []
|
|
879
838
|
});
|
|
880
839
|
return;
|
|
881
840
|
}
|
|
882
841
|
let o = !1;
|
|
883
|
-
return
|
|
842
|
+
return H({
|
|
884
843
|
status: "loading",
|
|
885
844
|
rows: []
|
|
886
845
|
}), e.queryDataset(n, {
|
|
887
846
|
dimensions: r,
|
|
888
847
|
measures: i,
|
|
889
|
-
...
|
|
890
|
-
...
|
|
848
|
+
...de ? { runtimeFilter: de } : {},
|
|
849
|
+
...z.length > 0 ? { timeDimensions: z } : {},
|
|
891
850
|
...a ? { compareTo: a } : {},
|
|
892
|
-
...
|
|
893
|
-
...
|
|
894
|
-
...
|
|
895
|
-
...
|
|
851
|
+
...ne ? { totals: { groupings: ne } } : {},
|
|
852
|
+
...x ? { dateGranularity: x } : {},
|
|
853
|
+
...E ? { order: E } : {},
|
|
854
|
+
...k == null ? {} : { limit: k }
|
|
896
855
|
}).then((e) => {
|
|
897
|
-
o ||
|
|
856
|
+
o || H({
|
|
898
857
|
status: "ok",
|
|
899
858
|
rows: Array.isArray(e?.rows) ? e.rows : [],
|
|
900
859
|
fields: Array.isArray(e?.fields) ? e.fields : [],
|
|
@@ -905,7 +864,7 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
905
864
|
totals: Array.isArray(e?.totals) ? e.totals : void 0
|
|
906
865
|
});
|
|
907
866
|
}).catch((e) => {
|
|
908
|
-
o ||
|
|
867
|
+
o || H({
|
|
909
868
|
status: "error",
|
|
910
869
|
rows: [],
|
|
911
870
|
error: String(e?.message ?? e)
|
|
@@ -913,29 +872,29 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
913
872
|
}), () => {
|
|
914
873
|
o = !0;
|
|
915
874
|
};
|
|
916
|
-
}, [
|
|
917
|
-
let
|
|
918
|
-
if (!
|
|
875
|
+
}, [ve]);
|
|
876
|
+
let ye = fe(V.object, V.dimensionFields, r, { enabled: !u }), { categoryColors: be, dimensionLabels: U, categoryOrder: xe } = s(() => {
|
|
877
|
+
if (!ye) return {
|
|
919
878
|
categoryColors: null,
|
|
920
879
|
dimensionLabels: null,
|
|
921
880
|
categoryOrder: null
|
|
922
881
|
};
|
|
923
|
-
let { metaByPath: e, relabel: t } =
|
|
882
|
+
let { metaByPath: e, relabel: t } = ye, n = d ? void 0 : t[0]?.path, r = n ? e[n] : void 0, i = n ? re(r?.options, O(r, ce)) : void 0;
|
|
924
883
|
return {
|
|
925
|
-
categoryColors:
|
|
926
|
-
dimensionLabels:
|
|
927
|
-
categoryOrder:
|
|
884
|
+
categoryColors: _(i),
|
|
885
|
+
dimensionLabels: D(e, t, ce),
|
|
886
|
+
categoryOrder: p(i)
|
|
928
887
|
};
|
|
929
888
|
}, [
|
|
930
|
-
|
|
931
|
-
|
|
889
|
+
ye,
|
|
890
|
+
ce,
|
|
932
891
|
d
|
|
933
892
|
]);
|
|
934
893
|
if (i.length === 0) return /* @__PURE__ */ Q("div", {
|
|
935
894
|
className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
|
|
936
895
|
children: P("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
|
|
937
896
|
});
|
|
938
|
-
if (
|
|
897
|
+
if (V.status === "loading" || V.status === "idle") return /* @__PURE__ */ $("div", {
|
|
939
898
|
className: "h-full w-full p-2",
|
|
940
899
|
"data-testid": "dataset-loading",
|
|
941
900
|
role: "status",
|
|
@@ -947,47 +906,47 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
947
906
|
}), u ? /* @__PURE__ */ $("div", {
|
|
948
907
|
className: "flex h-full w-full flex-col items-start justify-center gap-2 p-2",
|
|
949
908
|
children: [/* @__PURE__ */ Q(X, { className: "h-8 w-32 rounded" }), /* @__PURE__ */ Q(X, { className: "h-3 w-20 rounded" })]
|
|
950
|
-
}) : d ? /* @__PURE__ */ Q(
|
|
909
|
+
}) : d ? /* @__PURE__ */ Q(Le, {
|
|
951
910
|
className: "h-full",
|
|
952
911
|
rows: 5,
|
|
953
912
|
columns: Math.max(2, r.length + i.length)
|
|
954
|
-
}) : /* @__PURE__ */ Q(
|
|
913
|
+
}) : /* @__PURE__ */ Q(Oe, { className: "h-full" })]
|
|
955
914
|
});
|
|
956
|
-
if (
|
|
915
|
+
if (V.status === "error") return /* @__PURE__ */ $("div", {
|
|
957
916
|
role: "alert",
|
|
958
917
|
className: "flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive",
|
|
959
|
-
children: [/* @__PURE__ */ Q(
|
|
918
|
+
children: [/* @__PURE__ */ Q(tt, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
960
919
|
className: "break-words",
|
|
961
|
-
children:
|
|
920
|
+
children: V.error
|
|
962
921
|
})]
|
|
963
922
|
});
|
|
964
|
-
if (
|
|
923
|
+
if (V.rows.length === 0 && !u) return /* @__PURE__ */ $("div", {
|
|
965
924
|
className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
|
|
966
|
-
children: [/* @__PURE__ */ Q(
|
|
925
|
+
children: [/* @__PURE__ */ Q(at, { className: "mr-2 h-4 w-4" }), P("dashboard.noRows", "No rows")]
|
|
967
926
|
});
|
|
968
|
-
let { measureField:
|
|
969
|
-
if (!
|
|
970
|
-
let r =
|
|
971
|
-
|
|
927
|
+
let { measureField: W, headerLabel: K } = g(V.fields, V.object, se), q = a ? i.filter((e) => V.rows.some((t) => t[wn(e)] != null)) : [], Y = a ? C(a, L) : "", Ce = a ? P(`dashboard.trend.${Y}`, Tn[Y] ?? "vs previous period") : "", { object: we, dimensionFields: Te, drillRawRows: Ee, drillRanges: De } = V, ke = Te ? r.filter((e) => e in Te) : [], Ae = !!we && (ke.length > 0 || !!De?.length), je = (t, n) => {
|
|
928
|
+
if (!we) return;
|
|
929
|
+
let r = vn(Ee?.[t], ke, Te ?? {}, R, De?.[t]);
|
|
930
|
+
me({
|
|
972
931
|
filter: r,
|
|
973
932
|
title: n || String(e?.title ?? "")
|
|
974
933
|
});
|
|
975
|
-
},
|
|
934
|
+
}, Me = pe && we ? /* @__PURE__ */ Q(_n, {
|
|
976
935
|
open: !0,
|
|
977
|
-
onClose: () =>
|
|
978
|
-
title:
|
|
979
|
-
objectName:
|
|
980
|
-
filter:
|
|
936
|
+
onClose: () => me(null),
|
|
937
|
+
title: pe.title || String(e?.title ?? P("dashboard.details", "Details")),
|
|
938
|
+
objectName: we,
|
|
939
|
+
filter: pe.filter,
|
|
981
940
|
dataSource: t
|
|
982
941
|
}) : null;
|
|
983
942
|
if (u) {
|
|
984
|
-
let t =
|
|
943
|
+
let t = W(i[0]), n = V.rows[0]?.[i[0]] ?? 0, r = V.rows[0]?.[wn(i[0])], a = q.includes(i[0]) ? Ht(typeof n == "number" ? n : null, typeof r == "number" ? r : null) : null, o = $t(e?.colorVariant);
|
|
985
944
|
return /* @__PURE__ */ $("div", {
|
|
986
945
|
className: "flex h-full w-full flex-col items-start justify-center gap-1 p-2",
|
|
987
946
|
children: [
|
|
988
947
|
/* @__PURE__ */ Q("span", {
|
|
989
948
|
className: Z("text-2xl font-semibold tabular-nums", o),
|
|
990
|
-
children:
|
|
949
|
+
children: M(n, t?.format, t?.currency, t?.percentScale, I)
|
|
991
950
|
}),
|
|
992
951
|
a && /* @__PURE__ */ $("div", {
|
|
993
952
|
className: "mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground",
|
|
@@ -995,90 +954,90 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
995
954
|
children: [/* @__PURE__ */ $("span", {
|
|
996
955
|
className: Z("flex shrink-0 items-center font-medium", a.direction === "up" && "text-emerald-600 dark:text-emerald-400", a.direction === "down" && "text-rose-600 dark:text-rose-400", a.direction === "neutral" && "text-muted-foreground"),
|
|
997
956
|
children: [
|
|
998
|
-
a.direction === "up" && /* @__PURE__ */ Q(
|
|
999
|
-
a.direction === "down" && /* @__PURE__ */ Q(
|
|
1000
|
-
a.direction === "neutral" && /* @__PURE__ */ Q(
|
|
957
|
+
a.direction === "up" && /* @__PURE__ */ Q(rt, { className: "mr-1 h-3 w-3" }),
|
|
958
|
+
a.direction === "down" && /* @__PURE__ */ Q(nt, { className: "mr-1 h-3 w-3" }),
|
|
959
|
+
a.direction === "neutral" && /* @__PURE__ */ Q(mt, { className: "mr-1 h-3 w-3" }),
|
|
1001
960
|
a.value,
|
|
1002
961
|
"%"
|
|
1003
962
|
]
|
|
1004
963
|
}), /* @__PURE__ */ Q("span", {
|
|
1005
964
|
className: "min-w-0 truncate",
|
|
1006
|
-
children:
|
|
965
|
+
children: Ce
|
|
1007
966
|
})]
|
|
1008
967
|
}),
|
|
1009
968
|
/* @__PURE__ */ Q("span", {
|
|
1010
969
|
className: "text-xs text-muted-foreground",
|
|
1011
|
-
children:
|
|
970
|
+
children: K(i[0])
|
|
1012
971
|
})
|
|
1013
972
|
]
|
|
1014
973
|
});
|
|
1015
974
|
}
|
|
1016
975
|
if (d) {
|
|
1017
|
-
let t =
|
|
1018
|
-
if (i.includes(e) || !e.endsWith(
|
|
976
|
+
let t = F(V.rows, U), a = (e) => {
|
|
977
|
+
if (i.includes(e) || !e.endsWith(Cn)) return;
|
|
1019
978
|
let t = e.slice(0, -9);
|
|
1020
979
|
return i.includes(t) ? t : void 0;
|
|
1021
980
|
}, o = (e) => {
|
|
1022
981
|
let t = a(e);
|
|
1023
|
-
return t ? `${
|
|
1024
|
-
}, s = i.flatMap((e) =>
|
|
982
|
+
return t ? `${K(t)} · ${Ce}` : K(e);
|
|
983
|
+
}, s = i.flatMap((e) => q.includes(e) ? [e, wn(e)] : [e]), c = [...r, ...s], l = (t) => Sn(String(e?.title ?? n ?? "export"), [c.map((e) => o(e)), ...t.map((e) => c.map((t) => {
|
|
984
|
+
let n = e[t];
|
|
985
|
+
return n == null ? "" : typeof n == "number" ? n : String(n);
|
|
986
|
+
}))]), u = (e) => /* @__PURE__ */ Q("button", {
|
|
1025
987
|
type: "button",
|
|
1026
|
-
onClick: () =>
|
|
1027
|
-
let n = e[t];
|
|
1028
|
-
return n == null ? "" : typeof n == "number" ? n : String(n);
|
|
1029
|
-
}))]),
|
|
988
|
+
onClick: () => l(e),
|
|
1030
989
|
"data-testid": "dataset-export",
|
|
1031
990
|
title: P("dashboard.exportCsv", "Export CSV"),
|
|
1032
991
|
"aria-label": P("dashboard.exportCsv", "Export CSV"),
|
|
1033
992
|
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",
|
|
1034
|
-
children: /* @__PURE__ */ Q(
|
|
1035
|
-
});
|
|
1036
|
-
if (
|
|
1037
|
-
let e =
|
|
993
|
+
children: /* @__PURE__ */ Q(ut, { className: "h-3.5 w-3.5" })
|
|
994
|
+
}), d = u(t);
|
|
995
|
+
if (f) {
|
|
996
|
+
let e = yn(t, h, v, I), n = e.colHeaders.flatMap((e) => i.map((t) => ({
|
|
1038
997
|
col: e,
|
|
1039
998
|
measure: t,
|
|
1040
|
-
header: i.length === 1 ? e.label : `${e.label} · ${
|
|
1041
|
-
}))), r = (e, t) =>
|
|
1042
|
-
if (!
|
|
1043
|
-
let n = e?.[
|
|
999
|
+
header: i.length === 1 ? e.label : `${e.label} · ${K(t)}`
|
|
1000
|
+
}))), r = (e, t) => M(e, W(t)?.format, W(t)?.currency, W(t)?.percentScale, I), a = (e, t) => {
|
|
1001
|
+
if (!q.includes(t)) return null;
|
|
1002
|
+
let n = e?.[wn(t)];
|
|
1044
1003
|
if (n == null) return null;
|
|
1045
|
-
let i = e?.[t], a =
|
|
1004
|
+
let i = e?.[t], a = Ht(typeof i == "number" ? i : null, typeof n == "number" ? n : null);
|
|
1046
1005
|
return /* @__PURE__ */ $("div", {
|
|
1047
1006
|
className: "flex items-center justify-end gap-1 text-[10px] font-normal leading-tight text-muted-foreground",
|
|
1048
1007
|
"data-testid": "matrix-cell-compare",
|
|
1049
1008
|
"data-direction": a?.direction,
|
|
1050
|
-
title:
|
|
1009
|
+
title: Ce,
|
|
1051
1010
|
children: [/* @__PURE__ */ Q("span", {
|
|
1052
1011
|
className: "tabular-nums",
|
|
1053
1012
|
children: r(n, t)
|
|
1054
1013
|
}), a && /* @__PURE__ */ $("span", {
|
|
1055
1014
|
className: Z("flex shrink-0 items-center tabular-nums font-medium", a.direction === "up" && "text-emerald-600 dark:text-emerald-400", a.direction === "down" && "text-rose-600 dark:text-rose-400"),
|
|
1056
1015
|
children: [
|
|
1057
|
-
a.direction === "up" && /* @__PURE__ */ Q(
|
|
1058
|
-
a.direction === "down" && /* @__PURE__ */ Q(
|
|
1059
|
-
a.direction === "neutral" && /* @__PURE__ */ Q(
|
|
1016
|
+
a.direction === "up" && /* @__PURE__ */ Q(rt, { className: "h-2.5 w-2.5" }),
|
|
1017
|
+
a.direction === "down" && /* @__PURE__ */ Q(nt, { className: "h-2.5 w-2.5" }),
|
|
1018
|
+
a.direction === "neutral" && /* @__PURE__ */ Q(mt, { className: "h-2.5 w-2.5" }),
|
|
1060
1019
|
a.value,
|
|
1061
1020
|
"%"
|
|
1062
1021
|
]
|
|
1063
1022
|
})]
|
|
1064
1023
|
});
|
|
1065
|
-
}, o =
|
|
1024
|
+
}, o = q.length > 0 ? /* @__PURE__ */ Q("caption", {
|
|
1066
1025
|
className: "px-2 pb-1 text-left text-[10px] font-normal text-muted-foreground",
|
|
1067
1026
|
"data-testid": "matrix-compare-caption",
|
|
1068
|
-
children:
|
|
1027
|
+
children: Ce
|
|
1069
1028
|
}) : null, s = (e) => {
|
|
1070
|
-
let t =
|
|
1071
|
-
return t &&
|
|
1029
|
+
let t = V.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows;
|
|
1030
|
+
return t && F(t, U);
|
|
1072
1031
|
}, c = /* @__PURE__ */ new Map();
|
|
1073
|
-
for (let e of s(
|
|
1074
|
-
let
|
|
1075
|
-
for (let e of s([
|
|
1076
|
-
let
|
|
1032
|
+
for (let e of s(h) ?? []) c.set(ie(h.map((t) => oe(e[t]))), e);
|
|
1033
|
+
let l = /* @__PURE__ */ new Map();
|
|
1034
|
+
for (let e of s([v]) ?? []) l.set(ie([oe(e[v])]), e);
|
|
1035
|
+
let u = s([])?.[0], f = c.size > 0, p = l.size > 0, m = P("dashboard.total", "Total");
|
|
1077
1036
|
return /* @__PURE__ */ $("div", {
|
|
1078
1037
|
className: "relative h-full w-full overflow-auto p-1",
|
|
1079
1038
|
"data-testid": "dataset-matrix",
|
|
1080
1039
|
children: [
|
|
1081
|
-
|
|
1040
|
+
d,
|
|
1082
1041
|
/* @__PURE__ */ $("table", {
|
|
1083
1042
|
className: "w-full text-xs",
|
|
1084
1043
|
children: [
|
|
@@ -1086,9 +1045,9 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
1086
1045
|
/* @__PURE__ */ Q("thead", {
|
|
1087
1046
|
className: "bg-muted/40",
|
|
1088
1047
|
children: /* @__PURE__ */ $("tr", { children: [
|
|
1089
|
-
|
|
1048
|
+
h.map((e) => /* @__PURE__ */ Q("th", {
|
|
1090
1049
|
className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
|
|
1091
|
-
children:
|
|
1050
|
+
children: K(e)
|
|
1092
1051
|
}, e)),
|
|
1093
1052
|
n.map((e) => /* @__PURE__ */ Q("th", {
|
|
1094
1053
|
className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
|
|
@@ -1097,7 +1056,7 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
1097
1056
|
f && i.map((e) => /* @__PURE__ */ Q("th", {
|
|
1098
1057
|
className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
|
|
1099
1058
|
"data-testid": "matrix-total-col-header",
|
|
1100
|
-
children: i.length === 1 ? m : `${m} · ${
|
|
1059
|
+
children: i.length === 1 ? m : `${m} · ${K(e)}`
|
|
1101
1060
|
}, `total-${e}`))
|
|
1102
1061
|
] })
|
|
1103
1062
|
}),
|
|
@@ -1109,11 +1068,11 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
1109
1068
|
children: e
|
|
1110
1069
|
}, t)),
|
|
1111
1070
|
n.map((n) => {
|
|
1112
|
-
let i = e.cellIndex.get(
|
|
1071
|
+
let i = e.cellIndex.get(ae(t.id, n.col.id)), o = i == null ? void 0 : V.rows[i], s = Ae && i != null, c = [...t.labels, n.col.label].filter(Boolean).join(" / ");
|
|
1113
1072
|
return /* @__PURE__ */ $("td", {
|
|
1114
1073
|
className: Z("px-2 py-1 text-right tabular-nums whitespace-nowrap", s && "cursor-pointer hover:bg-accent/40"),
|
|
1115
1074
|
"data-testid": s ? "dataset-drill-cell" : void 0,
|
|
1116
|
-
onClick: s ? () =>
|
|
1075
|
+
onClick: s ? () => je(i, c) : void 0,
|
|
1117
1076
|
children: [o ? r(o[n.measure], n.measure) : "—", a(o, n.measure)]
|
|
1118
1077
|
}, `${n.col.id}-${n.measure}`);
|
|
1119
1078
|
}),
|
|
@@ -1130,13 +1089,13 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
1130
1089
|
className: "border-t bg-muted/30 font-medium",
|
|
1131
1090
|
"data-testid": "matrix-total-row",
|
|
1132
1091
|
children: [
|
|
1133
|
-
|
|
1134
|
-
colSpan:
|
|
1092
|
+
h.length > 0 && /* @__PURE__ */ Q("td", {
|
|
1093
|
+
colSpan: h.length,
|
|
1135
1094
|
className: "px-2 py-1 whitespace-nowrap",
|
|
1136
1095
|
children: m
|
|
1137
1096
|
}),
|
|
1138
1097
|
n.map((e) => {
|
|
1139
|
-
let t =
|
|
1098
|
+
let t = l.get(e.col.id);
|
|
1140
1099
|
return /* @__PURE__ */ $("td", {
|
|
1141
1100
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
|
|
1142
1101
|
children: [r(t?.[e.measure], e.measure), a(t, e.measure)]
|
|
@@ -1145,147 +1104,222 @@ function Cn({ widget: e, dataSource: t }) {
|
|
|
1145
1104
|
f && i.map((e) => /* @__PURE__ */ $("td", {
|
|
1146
1105
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
|
|
1147
1106
|
"data-testid": "matrix-grand-total",
|
|
1148
|
-
children: [r(
|
|
1107
|
+
children: [r(u?.[e], e), a(u, e)]
|
|
1149
1108
|
}, `grand-${e}`))
|
|
1150
1109
|
]
|
|
1151
1110
|
})] })
|
|
1152
1111
|
]
|
|
1153
1112
|
}),
|
|
1154
|
-
|
|
1113
|
+
Me
|
|
1155
1114
|
]
|
|
1156
1115
|
});
|
|
1157
1116
|
}
|
|
1158
|
-
let
|
|
1117
|
+
let p = [...r, ...s], m = new Set(p.filter((e) => (i.includes(e) || a(e) !== void 0) && t.every((t) => t[e] == null || typeof t[e] == "number"))), g = t.map((e, t) => ({
|
|
1118
|
+
row: e,
|
|
1119
|
+
index: t
|
|
1120
|
+
})), _ = ge && p.includes(ge.column) ? ge : null, y = _ ? g.map((e) => ({
|
|
1121
|
+
...e,
|
|
1122
|
+
key: ee(e.row[_.column])
|
|
1123
|
+
})).sort((e, t) => {
|
|
1124
|
+
if (e.key === null && t.key === null) return 0;
|
|
1125
|
+
if (e.key === null) return 1;
|
|
1126
|
+
if (t.key === null) return -1;
|
|
1127
|
+
let n = S(e.key, t.key);
|
|
1128
|
+
return _.dir === "asc" ? n : -n;
|
|
1129
|
+
}) : [...g].sort((e, t) => {
|
|
1130
|
+
for (let n of r) {
|
|
1131
|
+
let r = +(ee(e.row[n]) === null), i = +(ee(t.row[n]) === null);
|
|
1132
|
+
if (r !== i) return r - i;
|
|
1133
|
+
}
|
|
1134
|
+
return 0;
|
|
1135
|
+
}), b = (e) => m.has(e) ? "desc" : "asc", x = (e) => _e((t) => {
|
|
1136
|
+
let n = b(e);
|
|
1137
|
+
return t?.column === e ? t.dir === n ? {
|
|
1138
|
+
column: e,
|
|
1139
|
+
dir: n === "asc" ? "desc" : "asc"
|
|
1140
|
+
} : null : {
|
|
1141
|
+
column: e,
|
|
1142
|
+
dir: n
|
|
1143
|
+
};
|
|
1144
|
+
}), C = te ? V.totals?.find((e) => Array.isArray(e.dimensions) && e.dimensions.length === 0)?.rows?.[0] : void 0, w = P("dashboard.total", "Total"), T = (e) => {
|
|
1145
|
+
if (_?.column !== e) return /* @__PURE__ */ Q(lt, {
|
|
1146
|
+
className: "ml-0.5 h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-50",
|
|
1147
|
+
"aria-hidden": "true"
|
|
1148
|
+
});
|
|
1149
|
+
let t = _.dir === "asc" ? ct : st;
|
|
1150
|
+
return /* @__PURE__ */ Q(t, {
|
|
1151
|
+
className: "ml-0.5 h-3 w-3 shrink-0 text-primary",
|
|
1152
|
+
"aria-hidden": "true"
|
|
1153
|
+
});
|
|
1154
|
+
};
|
|
1159
1155
|
return /* @__PURE__ */ $("div", {
|
|
1160
1156
|
className: "relative h-full w-full overflow-auto p-1",
|
|
1161
1157
|
children: [
|
|
1162
|
-
|
|
1158
|
+
u(y.map((e) => e.row)),
|
|
1163
1159
|
/* @__PURE__ */ $("table", {
|
|
1164
1160
|
className: "w-full text-xs",
|
|
1165
|
-
children: [
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1161
|
+
children: [
|
|
1162
|
+
/* @__PURE__ */ Q("thead", {
|
|
1163
|
+
className: "bg-muted/40",
|
|
1164
|
+
children: /* @__PURE__ */ Q("tr", { children: p.map((e) => {
|
|
1165
|
+
let t = m.has(e);
|
|
1166
|
+
return /* @__PURE__ */ Q("th", {
|
|
1167
|
+
scope: "col",
|
|
1168
|
+
"aria-sort": _?.column === e ? _.dir === "asc" ? "ascending" : "descending" : "none",
|
|
1169
|
+
className: Z("group px-2 py-1.5 font-medium whitespace-nowrap", t ? "text-right" : "text-left"),
|
|
1170
|
+
"data-testid": a(e) ? "dataset-compare-column" : void 0,
|
|
1171
|
+
children: /* @__PURE__ */ $("button", {
|
|
1172
|
+
type: "button",
|
|
1173
|
+
onClick: () => x(e),
|
|
1174
|
+
"data-testid": "dataset-table-sort",
|
|
1175
|
+
className: Z("inline-flex w-full select-none items-center font-medium transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", t ? "justify-end" : "justify-between"),
|
|
1176
|
+
children: [/* @__PURE__ */ Q("span", {
|
|
1177
|
+
className: "truncate",
|
|
1178
|
+
children: o(e)
|
|
1179
|
+
}), T(e)]
|
|
1180
|
+
})
|
|
1181
|
+
}, e);
|
|
1182
|
+
}) })
|
|
1183
|
+
}),
|
|
1184
|
+
/* @__PURE__ */ Q("tbody", { children: y.map(({ row: e, index: t }) => /* @__PURE__ */ Q("tr", {
|
|
1185
|
+
className: Z("border-t transition-colors hover:bg-muted/40", Ae && "cursor-pointer hover:bg-accent/40"),
|
|
1186
|
+
"data-testid": Ae ? "dataset-drill-row" : void 0,
|
|
1187
|
+
onClick: Ae ? () => je(t, ke.map((t) => j(e[t], I)).filter(Boolean).join(" / ")) : void 0,
|
|
1188
|
+
children: p.map((t) => {
|
|
1189
|
+
let n = a(t) ?? (i.includes(t) ? t : void 0);
|
|
1190
|
+
return /* @__PURE__ */ Q("td", {
|
|
1191
|
+
className: Z("px-2 py-1 whitespace-nowrap tabular-nums", m.has(t) && "text-right"),
|
|
1192
|
+
children: n ? M(e[t], W(n)?.format, W(n)?.currency, W(n)?.percentScale, I) : j(e[t], I)
|
|
1193
|
+
}, t);
|
|
1194
|
+
})
|
|
1195
|
+
}, t)) }),
|
|
1196
|
+
C && /* @__PURE__ */ Q("tfoot", {
|
|
1197
|
+
className: "bg-muted/30",
|
|
1198
|
+
children: /* @__PURE__ */ $("tr", {
|
|
1199
|
+
className: "border-t font-medium",
|
|
1200
|
+
"data-testid": "dataset-table-total-row",
|
|
1201
|
+
children: [/* @__PURE__ */ Q("td", {
|
|
1202
|
+
colSpan: r.length,
|
|
1203
|
+
className: "px-2 py-1 whitespace-nowrap",
|
|
1204
|
+
children: w
|
|
1205
|
+
}), s.map((e) => {
|
|
1206
|
+
let t = a(e) ?? e;
|
|
1207
|
+
return /* @__PURE__ */ Q("td", {
|
|
1208
|
+
className: Z("px-2 py-1 whitespace-nowrap tabular-nums", m.has(e) && "text-right"),
|
|
1209
|
+
children: M(C[e], W(t)?.format, W(t)?.currency, W(t)?.percentScale, I)
|
|
1210
|
+
}, e);
|
|
1211
|
+
})]
|
|
1212
|
+
})
|
|
1182
1213
|
})
|
|
1183
|
-
|
|
1214
|
+
]
|
|
1184
1215
|
}),
|
|
1185
|
-
|
|
1216
|
+
Me
|
|
1186
1217
|
]
|
|
1187
1218
|
});
|
|
1188
1219
|
}
|
|
1189
|
-
let
|
|
1190
|
-
let t =
|
|
1220
|
+
let Ne = An[c] ?? "bar", Pe = F(V.rows, U), Fe = P("chart.nullCategory", "(None)"), { data: Ie, xAxisKey: Re, series: ze } = m(Pe, r, i, V.fields, { nullCategoryLabel: Fe }), { series: Be, axes: Ve } = N(ze, e?.chartConfig), He = r.length >= 2 && i.length === 1 ? [] : q.map((e) => {
|
|
1221
|
+
let t = Be.find((t) => t.dataKey === e);
|
|
1191
1222
|
return {
|
|
1192
|
-
dataKey:
|
|
1193
|
-
label: `${
|
|
1223
|
+
dataKey: wn(e),
|
|
1224
|
+
label: `${K(e)} · ${Ce}`,
|
|
1194
1225
|
variant: "comparison",
|
|
1195
1226
|
...t?.chartType ? { chartType: t.chartType } : {},
|
|
1196
1227
|
...t?.yAxis ? { yAxis: t.yAxis } : {}
|
|
1197
1228
|
};
|
|
1198
|
-
}),
|
|
1229
|
+
}), Ue = He.length > 0 ? [...Be.map((e) => ({
|
|
1199
1230
|
...e,
|
|
1200
1231
|
variant: e.variant ?? "current"
|
|
1201
|
-
})), ...
|
|
1202
|
-
let t = String(e), n =
|
|
1232
|
+
})), ...He] : Be, We = (Array.isArray(b.stageOrder) ? b.stageOrder : void 0)?.flatMap((e) => {
|
|
1233
|
+
let t = String(e), n = U?.[r[0]]?.[t];
|
|
1203
1234
|
return n && n !== t ? [t, n] : [t];
|
|
1204
|
-
}),
|
|
1205
|
-
let t =
|
|
1235
|
+
}), Ge = We?.length ? We : xe, Ke = y(e?.chartConfig, be), qe = Ae ? (e) => {
|
|
1236
|
+
let t = A(Pe, r, i, e?.category, e?.series, {
|
|
1237
|
+
nullCategoryLabel: Fe,
|
|
1238
|
+
bucketId: e?.categoryId
|
|
1239
|
+
});
|
|
1206
1240
|
if (t < 0) return;
|
|
1207
|
-
let n = r.length >= 2 && i.length === 1, a = [e?.category, n ?
|
|
1208
|
-
|
|
1241
|
+
let n = r.length >= 2 && i.length === 1, a = e?.seriesLabel ?? e?.series, o = [e?.category, n ? a : void 0].filter(Boolean).map(String).join(" / ");
|
|
1242
|
+
je(t, o);
|
|
1209
1243
|
} : void 0;
|
|
1210
1244
|
return /* @__PURE__ */ $("div", {
|
|
1211
1245
|
className: Z("relative h-full w-full min-h-[220px]"),
|
|
1212
|
-
children: [/* @__PURE__ */ Q(
|
|
1246
|
+
children: [/* @__PURE__ */ Q(B, {
|
|
1213
1247
|
schema: {
|
|
1214
1248
|
type: "chart",
|
|
1215
|
-
chartType:
|
|
1216
|
-
data:
|
|
1217
|
-
xAxisKey:
|
|
1218
|
-
series:
|
|
1249
|
+
chartType: Ne,
|
|
1250
|
+
data: Ie,
|
|
1251
|
+
xAxisKey: Re,
|
|
1252
|
+
series: Ue,
|
|
1219
1253
|
isAnimationActive: !1,
|
|
1220
|
-
...
|
|
1221
|
-
...
|
|
1222
|
-
...
|
|
1254
|
+
...Ke,
|
|
1255
|
+
...Ve,
|
|
1256
|
+
...Ge ? { categoryOrder: Ge } : {}
|
|
1223
1257
|
},
|
|
1224
|
-
onChartClick:
|
|
1225
|
-
onSegmentClick:
|
|
1226
|
-
}),
|
|
1258
|
+
onChartClick: qe,
|
|
1259
|
+
onSegmentClick: qe
|
|
1260
|
+
}), Me]
|
|
1227
1261
|
});
|
|
1228
1262
|
}
|
|
1229
1263
|
//#endregion
|
|
1230
1264
|
//#region src/DashboardFilterBar.tsx
|
|
1231
|
-
function
|
|
1232
|
-
let { language: t } =
|
|
1233
|
-
return
|
|
1265
|
+
function Mn(e) {
|
|
1266
|
+
let { language: t } = q();
|
|
1267
|
+
return U(e.label, t);
|
|
1234
1268
|
}
|
|
1235
|
-
var
|
|
1236
|
-
function
|
|
1269
|
+
var Nn = "__all__", Pn = "__custom__";
|
|
1270
|
+
function Fn(e, t) {
|
|
1237
1271
|
if (e) {
|
|
1238
1272
|
if (e.preset) return t(e.preset);
|
|
1239
1273
|
if (e.from || e.to) return `${e.from ?? "…"} – ${e.to ?? "…"}`;
|
|
1240
1274
|
}
|
|
1241
1275
|
}
|
|
1242
|
-
function
|
|
1276
|
+
function In(e) {
|
|
1243
1277
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
1244
1278
|
}
|
|
1245
|
-
function
|
|
1246
|
-
let r =
|
|
1279
|
+
function Ln({ def: e, value: t, onChange: n }) {
|
|
1280
|
+
let r = J(), i = Mn(e), [a, o] = l(!1), s = e.allowCustomRange !== !1, c = (e) => r(`dashboard.filters.range.${e}`, e.replace(/_/g, " ")), u = t?.preset ?? (t?.from || t?.to ? Pn : Nn);
|
|
1247
1281
|
return /* @__PURE__ */ $("div", {
|
|
1248
1282
|
className: "flex items-center gap-1",
|
|
1249
1283
|
"data-testid": `dashboard-filter-${e.name}`,
|
|
1250
|
-
children: [/* @__PURE__ */ $(
|
|
1284
|
+
children: [/* @__PURE__ */ $(Ue, {
|
|
1251
1285
|
value: u,
|
|
1252
1286
|
onValueChange: (e) => {
|
|
1253
|
-
e ===
|
|
1287
|
+
e === Nn ? n(void 0) : e === Pn ? o(!0) : n({ preset: e });
|
|
1254
1288
|
},
|
|
1255
|
-
children: [/* @__PURE__ */ $(
|
|
1289
|
+
children: [/* @__PURE__ */ $(Ke, {
|
|
1256
1290
|
className: "h-8 w-auto min-w-36 gap-1",
|
|
1257
1291
|
"aria-label": i || r("dashboard.filters.dateRange", "Date range"),
|
|
1258
|
-
children: [/* @__PURE__ */ Q(
|
|
1292
|
+
children: [/* @__PURE__ */ Q(ot, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ Q(qe, {
|
|
1259
1293
|
placeholder: r("dashboard.filters.dateRange", "Date range"),
|
|
1260
|
-
children:
|
|
1294
|
+
children: Fn(t, c) ?? r("dashboard.filters.allTime", "All time")
|
|
1261
1295
|
})]
|
|
1262
|
-
}), /* @__PURE__ */ $(
|
|
1263
|
-
/* @__PURE__ */ Q(
|
|
1264
|
-
value:
|
|
1296
|
+
}), /* @__PURE__ */ $(We, { children: [
|
|
1297
|
+
/* @__PURE__ */ Q(Ge, {
|
|
1298
|
+
value: Nn,
|
|
1265
1299
|
children: r("dashboard.filters.allTime", "All time")
|
|
1266
1300
|
}),
|
|
1267
|
-
d.map((e) => /* @__PURE__ */ Q(
|
|
1301
|
+
d.map((e) => /* @__PURE__ */ Q(Ge, {
|
|
1268
1302
|
value: e,
|
|
1269
1303
|
children: c(e)
|
|
1270
1304
|
}, e)),
|
|
1271
|
-
s && /* @__PURE__ */ Q(
|
|
1272
|
-
value:
|
|
1305
|
+
s && /* @__PURE__ */ Q(Ge, {
|
|
1306
|
+
value: Pn,
|
|
1273
1307
|
children: r("dashboard.filters.custom", "Custom…")
|
|
1274
1308
|
})
|
|
1275
1309
|
] })]
|
|
1276
|
-
}), s && /* @__PURE__ */ $(
|
|
1310
|
+
}), s && /* @__PURE__ */ $(ze, {
|
|
1277
1311
|
open: a,
|
|
1278
1312
|
onOpenChange: o,
|
|
1279
|
-
children: [/* @__PURE__ */ Q(
|
|
1313
|
+
children: [/* @__PURE__ */ Q(Ve, {
|
|
1280
1314
|
asChild: !0,
|
|
1281
1315
|
children: /* @__PURE__ */ Q("span", {
|
|
1282
1316
|
"aria-hidden": !0,
|
|
1283
1317
|
className: "size-0"
|
|
1284
1318
|
})
|
|
1285
|
-
}), /* @__PURE__ */ Q(
|
|
1319
|
+
}), /* @__PURE__ */ Q(Be, {
|
|
1286
1320
|
className: "w-auto p-0",
|
|
1287
1321
|
align: "start",
|
|
1288
|
-
children: /* @__PURE__ */ Q(
|
|
1322
|
+
children: /* @__PURE__ */ Q(Ce, {
|
|
1289
1323
|
mode: "range",
|
|
1290
1324
|
numberOfMonths: 2,
|
|
1291
1325
|
selected: {
|
|
@@ -1298,8 +1332,8 @@ function kn({ def: e, value: t, onChange: n }) {
|
|
|
1298
1332
|
return;
|
|
1299
1333
|
}
|
|
1300
1334
|
n({
|
|
1301
|
-
...e?.from ? { from:
|
|
1302
|
-
...e?.to ? { to:
|
|
1335
|
+
...e?.from ? { from: In(e.from) } : {},
|
|
1336
|
+
...e?.to ? { to: In(e.to) } : {}
|
|
1303
1337
|
});
|
|
1304
1338
|
}
|
|
1305
1339
|
})
|
|
@@ -1307,7 +1341,7 @@ function kn({ def: e, value: t, onChange: n }) {
|
|
|
1307
1341
|
})]
|
|
1308
1342
|
});
|
|
1309
1343
|
}
|
|
1310
|
-
function
|
|
1344
|
+
function Rn(e, t, n) {
|
|
1311
1345
|
let r = Array.isArray(t) && t.length === e.length && t.some((e) => e?.[n.valueField] !== void 0) ? t : void 0, i = /* @__PURE__ */ new Map();
|
|
1312
1346
|
for (let t = 0; t < e.length; t++) {
|
|
1313
1347
|
let a = e[t], o = r ? r[t]?.[n.valueField] : a?.[n.valueField];
|
|
@@ -1322,8 +1356,8 @@ function An(e, t, n) {
|
|
|
1322
1356
|
label: t
|
|
1323
1357
|
}));
|
|
1324
1358
|
}
|
|
1325
|
-
function
|
|
1326
|
-
let i =
|
|
1359
|
+
function zn({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
1360
|
+
let i = J(), { language: a } = q(), c = Mn(e), [u, d] = l(null), f = e.optionsFrom;
|
|
1327
1361
|
o(() => {
|
|
1328
1362
|
if (!f || !r) return;
|
|
1329
1363
|
let e = !1, t = () => {
|
|
@@ -1332,13 +1366,13 @@ function jn({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
|
1332
1366
|
return;
|
|
1333
1367
|
}
|
|
1334
1368
|
r.find(f.object, {
|
|
1335
|
-
|
|
1369
|
+
$select: [.../* @__PURE__ */ new Set([f.valueField, ...f.labelField ? [f.labelField] : []])],
|
|
1336
1370
|
...f.filter ? { $filter: f.filter } : {},
|
|
1337
|
-
top: 200
|
|
1371
|
+
$top: 200
|
|
1338
1372
|
}).then((t) => {
|
|
1339
1373
|
if (e) return;
|
|
1340
|
-
let n = Array.isArray(t) ? t : t?.
|
|
1341
|
-
d(
|
|
1374
|
+
let n = Array.isArray(t) ? t : t?.data ?? [];
|
|
1375
|
+
d(Rn(n, void 0, f));
|
|
1342
1376
|
}).catch(() => {
|
|
1343
1377
|
e || d([]);
|
|
1344
1378
|
});
|
|
@@ -1369,7 +1403,7 @@ function jn({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
|
1369
1403
|
}).then((t) => {
|
|
1370
1404
|
if (e) return;
|
|
1371
1405
|
let n = Array.isArray(t?.rows) ? t.rows : [], r = Array.isArray(t?.drillRawRows) ? t.drillRawRows : void 0;
|
|
1372
|
-
d(
|
|
1406
|
+
d(Rn(n, r, f));
|
|
1373
1407
|
}).catch(() => {
|
|
1374
1408
|
e || t();
|
|
1375
1409
|
});
|
|
@@ -1385,31 +1419,31 @@ function jn({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
|
1385
1419
|
]);
|
|
1386
1420
|
let p = s(() => (e.options?.length ? e.options : u ?? []).map((e) => ({
|
|
1387
1421
|
value: e.value,
|
|
1388
|
-
label:
|
|
1422
|
+
label: U(e.label, a) || e.value
|
|
1389
1423
|
})), [
|
|
1390
1424
|
e.options,
|
|
1391
1425
|
u,
|
|
1392
1426
|
a
|
|
1393
1427
|
]), m = c || e.name, h = t ? p.find((e) => e.value === String(t))?.label ?? String(t) : void 0;
|
|
1394
|
-
return /* @__PURE__ */ $(
|
|
1395
|
-
value: t ? String(t) :
|
|
1396
|
-
onValueChange: (e) => n(e ===
|
|
1397
|
-
children: [/* @__PURE__ */ Q(
|
|
1428
|
+
return /* @__PURE__ */ $(Ue, {
|
|
1429
|
+
value: t ? String(t) : Nn,
|
|
1430
|
+
onValueChange: (e) => n(e === Nn ? void 0 : e),
|
|
1431
|
+
children: [/* @__PURE__ */ Q(Ke, {
|
|
1398
1432
|
className: "h-8 w-auto min-w-32",
|
|
1399
1433
|
"aria-label": m,
|
|
1400
1434
|
"data-testid": `dashboard-filter-${e.name}`,
|
|
1401
|
-
children: /* @__PURE__ */ Q(
|
|
1402
|
-
}), /* @__PURE__ */ $(
|
|
1403
|
-
value:
|
|
1435
|
+
children: /* @__PURE__ */ Q(qe, { children: h ?? `${m}: ${i("dashboard.filters.all", "All")}` })
|
|
1436
|
+
}), /* @__PURE__ */ $(We, { children: [/* @__PURE__ */ Q(Ge, {
|
|
1437
|
+
value: Nn,
|
|
1404
1438
|
children: i("dashboard.filters.all", "All")
|
|
1405
|
-
}), p.map((e) => /* @__PURE__ */ Q(
|
|
1439
|
+
}), p.map((e) => /* @__PURE__ */ Q(Ge, {
|
|
1406
1440
|
value: e.value,
|
|
1407
1441
|
children: e.label
|
|
1408
1442
|
}, e.value))] })]
|
|
1409
1443
|
});
|
|
1410
1444
|
}
|
|
1411
|
-
function
|
|
1412
|
-
let r =
|
|
1445
|
+
function Bn({ def: e, value: t, onChange: n }) {
|
|
1446
|
+
let r = Mn(e) || e.name, [i, a] = l(t == null ? "" : String(t));
|
|
1413
1447
|
o(() => {
|
|
1414
1448
|
a(t == null ? "" : String(t));
|
|
1415
1449
|
}, [t]);
|
|
@@ -1421,7 +1455,7 @@ function Mn({ def: e, value: t, onChange: n }) {
|
|
|
1421
1455
|
}
|
|
1422
1456
|
n(e.type === "number" ? Number(t) : t);
|
|
1423
1457
|
};
|
|
1424
|
-
return /* @__PURE__ */ Q(
|
|
1458
|
+
return /* @__PURE__ */ Q(Re, {
|
|
1425
1459
|
className: "h-8 w-36",
|
|
1426
1460
|
type: e.type === "number" ? "number" : "text",
|
|
1427
1461
|
placeholder: r,
|
|
@@ -1435,8 +1469,8 @@ function Mn({ def: e, value: t, onChange: n }) {
|
|
|
1435
1469
|
"data-testid": `dashboard-filter-${e.name}`
|
|
1436
1470
|
});
|
|
1437
1471
|
}
|
|
1438
|
-
function
|
|
1439
|
-
let o =
|
|
1472
|
+
function Vn({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, className: a }) {
|
|
1473
|
+
let o = J();
|
|
1440
1474
|
if (e.length === 0) return null;
|
|
1441
1475
|
let s = (e) => e == null || e === "" || typeof e == "object" && Object.keys(e).length === 0, c = e.some((e) => {
|
|
1442
1476
|
let n = t[e.name], r = e.defaultValue;
|
|
@@ -1449,37 +1483,37 @@ function Nn({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, classN
|
|
|
1449
1483
|
"aria-label": o("dashboard.filters.label", "Dashboard filters"),
|
|
1450
1484
|
children: [e.map((e) => {
|
|
1451
1485
|
let r = t[e.name], a = (t) => n(e.name, t);
|
|
1452
|
-
return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(
|
|
1486
|
+
return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(Ln, {
|
|
1453
1487
|
def: e,
|
|
1454
1488
|
value: r,
|
|
1455
1489
|
onChange: a
|
|
1456
|
-
}, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q(
|
|
1490
|
+
}, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q(zn, {
|
|
1457
1491
|
def: e,
|
|
1458
1492
|
value: r,
|
|
1459
1493
|
onChange: a,
|
|
1460
1494
|
dataSource: i
|
|
1461
|
-
}, e.name) : /* @__PURE__ */ Q(
|
|
1495
|
+
}, e.name) : /* @__PURE__ */ Q(Bn, {
|
|
1462
1496
|
def: e,
|
|
1463
1497
|
value: r,
|
|
1464
1498
|
onChange: a
|
|
1465
1499
|
}, e.name);
|
|
1466
|
-
}), r && c && /* @__PURE__ */ $(
|
|
1500
|
+
}), r && c && /* @__PURE__ */ $(Y, {
|
|
1467
1501
|
variant: "ghost",
|
|
1468
1502
|
size: "sm",
|
|
1469
1503
|
onClick: r,
|
|
1470
1504
|
className: "text-muted-foreground",
|
|
1471
|
-
children: [/* @__PURE__ */ Q(
|
|
1505
|
+
children: [/* @__PURE__ */ Q(gt, { className: "size-3.5" }), o("dashboard.filters.reset", "Reset")]
|
|
1472
1506
|
})]
|
|
1473
1507
|
});
|
|
1474
1508
|
}
|
|
1475
1509
|
//#endregion
|
|
1476
1510
|
//#region src/DashboardRenderer.tsx
|
|
1477
|
-
function
|
|
1478
|
-
let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } =
|
|
1511
|
+
function Hn({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
1512
|
+
let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = Ot({
|
|
1479
1513
|
id: e,
|
|
1480
1514
|
disabled: t
|
|
1481
1515
|
}), f = {
|
|
1482
|
-
transform:
|
|
1516
|
+
transform: At.Transform.toString(c),
|
|
1483
1517
|
transition: l,
|
|
1484
1518
|
opacity: u ? .4 : 1,
|
|
1485
1519
|
...n ? {
|
|
@@ -1497,16 +1531,16 @@ function Pn({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
|
1497
1531
|
children: i
|
|
1498
1532
|
});
|
|
1499
1533
|
}
|
|
1500
|
-
function
|
|
1501
|
-
return e ?
|
|
1534
|
+
function Un(e) {
|
|
1535
|
+
return e ? Qe(e) : null;
|
|
1502
1536
|
}
|
|
1503
|
-
var
|
|
1537
|
+
var Wn = [
|
|
1504
1538
|
"hsl(var(--chart-1))",
|
|
1505
1539
|
"hsl(var(--chart-2))",
|
|
1506
1540
|
"hsl(var(--chart-3))",
|
|
1507
1541
|
"hsl(var(--chart-4))",
|
|
1508
1542
|
"hsl(var(--chart-5))"
|
|
1509
|
-
],
|
|
1543
|
+
], Gn = /* @__PURE__ */ new Set([
|
|
1510
1544
|
"bar",
|
|
1511
1545
|
"horizontal-bar",
|
|
1512
1546
|
"line",
|
|
@@ -1518,14 +1552,14 @@ var In = [
|
|
|
1518
1552
|
"treemap",
|
|
1519
1553
|
"sankey"
|
|
1520
1554
|
]);
|
|
1521
|
-
function
|
|
1522
|
-
return
|
|
1555
|
+
function Kn(e) {
|
|
1556
|
+
return Gn.has(e) ? { enabled: !0 } : void 0;
|
|
1523
1557
|
}
|
|
1524
|
-
var
|
|
1558
|
+
var qn = /* @__PURE__ */ new Set([
|
|
1525
1559
|
"object-chart",
|
|
1526
1560
|
"object-metric",
|
|
1527
1561
|
"object-data-table"
|
|
1528
|
-
]),
|
|
1562
|
+
]), Jn = r(({ schema: e, className: t, dataSource: r, onRefresh: a, recordCount: u, userActions: d, designMode: f, selectedWidgetId: p, onWidgetClick: m, onWidgetsReorder: h, modalHandler: g, scriptHandlers: _, hideHeaderText: y, ...b }, x) => {
|
|
1529
1563
|
let S = (() => {
|
|
1530
1564
|
if (e.columns != null) return e.columns;
|
|
1531
1565
|
let t = e.widgets ?? [], n = 0;
|
|
@@ -1534,58 +1568,65 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1534
1568
|
t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
|
|
1535
1569
|
}
|
|
1536
1570
|
return n > 4 ? 12 : 4;
|
|
1537
|
-
})(), C = S, w = e.gap || 4, T = e.columns != null || S !== 4, [E, D] = l(!1), [O, k] = l(!1),
|
|
1571
|
+
})(), C = S, w = e.gap || 4, T = e.columns != null || S !== 4, [E, D] = l(!1), [O, k] = l(!1), A = c(null), j = s(() => ce(e), [e.globalFilters, e.dateRange]), { variables: M, setVariable: ee, resetVariables: te } = ve(), ne = s(() => (e.header?.actions ?? []).map((e) => ({
|
|
1538
1572
|
name: e.actionUrl || e.label,
|
|
1539
1573
|
type: e.actionType || "url",
|
|
1540
1574
|
target: e.actionUrl,
|
|
1541
1575
|
label: e.label
|
|
1542
|
-
})), [e.header?.actions]), { executeAction:
|
|
1543
|
-
if (e != null) return
|
|
1544
|
-
}, [
|
|
1545
|
-
if (!
|
|
1576
|
+
})), [e.header?.actions]), { executeAction: re, engine: N } = V({ actions: ne }), { dashboardLabel: ie, dashboardDescription: ae, dashboardActionLabel: oe, widgetTitle: F, widgetDescription: se, widgetSubCaption: I, fieldLabel: le } = _e(), { t: ue, language: R } = q(), z = i((e) => {
|
|
1577
|
+
if (e != null) return U(e, R) || void 0;
|
|
1578
|
+
}, [R]), de = i((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? ue(`report.aggregate.${n}`, { defaultValue: n }) : e ? le(e, t, t) : t, [ue, le]), H = e.name, fe = i((e) => {
|
|
1579
|
+
if (!H) return e.label;
|
|
1546
1580
|
let t = e.actionUrl || e.label;
|
|
1547
|
-
return
|
|
1548
|
-
}, [
|
|
1549
|
-
let t =
|
|
1550
|
-
return !
|
|
1581
|
+
return oe(H, t, e.label);
|
|
1582
|
+
}, [H, oe]), pe = i((e) => {
|
|
1583
|
+
let t = z(e.title);
|
|
1584
|
+
return !H || !e.id || t === void 0 ? t : F(H, e.id, t);
|
|
1551
1585
|
}, [
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1586
|
+
H,
|
|
1587
|
+
F,
|
|
1588
|
+
z
|
|
1589
|
+
]), me = i((e) => {
|
|
1590
|
+
let t = z(e.description);
|
|
1591
|
+
return !H || !e.id ? t : se(H, e.id, t);
|
|
1592
|
+
}, [
|
|
1593
|
+
H,
|
|
1594
|
+
se,
|
|
1595
|
+
z
|
|
1555
1596
|
]), he = i((e) => {
|
|
1556
|
-
let t =
|
|
1557
|
-
return !
|
|
1597
|
+
let t = e.options?.description, n = z(t);
|
|
1598
|
+
return !H || !e.id ? n : I(H, e.id, n);
|
|
1558
1599
|
}, [
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1600
|
+
H,
|
|
1601
|
+
I,
|
|
1602
|
+
z
|
|
1562
1603
|
]);
|
|
1563
1604
|
o(() => {
|
|
1564
|
-
let e =
|
|
1565
|
-
if (g && e.setModalHandler(g),
|
|
1605
|
+
let e = N.getRunner();
|
|
1606
|
+
if (g && e.setModalHandler(g), _) for (let [t, n] of Object.entries(_)) e.registerScript(t, n);
|
|
1566
1607
|
}, [
|
|
1567
|
-
|
|
1608
|
+
N,
|
|
1568
1609
|
g,
|
|
1569
|
-
|
|
1610
|
+
_
|
|
1570
1611
|
]), o(() => {
|
|
1571
1612
|
let e = () => k(window.innerWidth < 768);
|
|
1572
1613
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1573
1614
|
}, []);
|
|
1574
|
-
let
|
|
1615
|
+
let ge = i(() => {
|
|
1575
1616
|
a && (D(!0), a(), setTimeout(() => D(!1), 600));
|
|
1576
1617
|
}, [a]);
|
|
1577
1618
|
o(() => {
|
|
1578
|
-
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !a)) return
|
|
1579
|
-
|
|
1619
|
+
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !a)) return A.current = setInterval(ge, e.refreshInterval * 1e3), () => {
|
|
1620
|
+
A.current && clearInterval(A.current);
|
|
1580
1621
|
};
|
|
1581
1622
|
}, [
|
|
1582
1623
|
e.refreshInterval,
|
|
1583
1624
|
a,
|
|
1584
|
-
|
|
1625
|
+
ge
|
|
1585
1626
|
]);
|
|
1586
|
-
let
|
|
1627
|
+
let ye = i((e, t) => {
|
|
1587
1628
|
!f || !m || !t || (e.stopPropagation(), m(t));
|
|
1588
|
-
}, [f, m]),
|
|
1629
|
+
}, [f, m]), be = i((t, n, r) => {
|
|
1589
1630
|
if (!f || !m) return;
|
|
1590
1631
|
let i = e.widgets || [];
|
|
1591
1632
|
if (t.key === "Enter" || t.key === " ") t.preventDefault(), m(n ?? null);
|
|
@@ -1602,22 +1643,22 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1602
1643
|
f,
|
|
1603
1644
|
m,
|
|
1604
1645
|
e.widgets
|
|
1605
|
-
]),
|
|
1646
|
+
]), xe = i((e) => {
|
|
1606
1647
|
!f || !m || e.target === e.currentTarget && m(null);
|
|
1607
|
-
}, [f, m]),
|
|
1608
|
-
|
|
1609
|
-
},
|
|
1610
|
-
if (!
|
|
1648
|
+
}, [f, m]), W = (e) => {
|
|
1649
|
+
xe(e), typeof b.onClick == "function" && b.onClick(e);
|
|
1650
|
+
}, G = !!(f && h), K = wt(Ct(xt, { activationConstraint: { distance: 5 } })), Se = i((t) => {
|
|
1651
|
+
if (!G) return;
|
|
1611
1652
|
let { active: n, over: r } = t;
|
|
1612
1653
|
if (!r || n.id === r.id) return;
|
|
1613
1654
|
let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
|
|
1614
|
-
a < 0 || o < 0 || h?.(
|
|
1655
|
+
a < 0 || o < 0 || h?.(Et(i, a, o));
|
|
1615
1656
|
}, [
|
|
1616
|
-
|
|
1657
|
+
G,
|
|
1617
1658
|
e.widgets,
|
|
1618
1659
|
h
|
|
1619
|
-
]),
|
|
1620
|
-
let a = e.type === "metric" ||
|
|
1660
|
+
]), J = (e, t, i) => {
|
|
1661
|
+
let a = e.type === "metric" || Gt.has(e.type || ""), o = T ? {
|
|
1621
1662
|
w: Math.min(a ? 3 : 6, C),
|
|
1622
1663
|
h: a ? 2 : 4
|
|
1623
1664
|
} : void 0, s = e.layout ?? o, c = s ? {
|
|
@@ -1626,11 +1667,11 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1626
1667
|
} : void 0, l = !!e.dataset, u = () => {
|
|
1627
1668
|
if (e.component) return e.component;
|
|
1628
1669
|
let t = e.type, n = e.options || {}, r = e.data || n.data;
|
|
1629
|
-
if (
|
|
1630
|
-
let i =
|
|
1670
|
+
if (Xt(e)) return Yt;
|
|
1671
|
+
let i = Jt(t), a = i.chartType ?? t;
|
|
1631
1672
|
if (i.family === "series" && i.chartType) {
|
|
1632
1673
|
let t = n.xField || "name", o = n.yField || "value";
|
|
1633
|
-
if (
|
|
1674
|
+
if (zt(r)) {
|
|
1634
1675
|
let s = r.aggregate, c = s ? {
|
|
1635
1676
|
field: s.field,
|
|
1636
1677
|
function: s.function,
|
|
@@ -1645,11 +1686,11 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1645
1686
|
xAxisKey: t,
|
|
1646
1687
|
series: [{
|
|
1647
1688
|
dataKey: l,
|
|
1648
|
-
label:
|
|
1689
|
+
label: de(r.object, l, c?.function)
|
|
1649
1690
|
}],
|
|
1650
|
-
colors:
|
|
1691
|
+
colors: Wn,
|
|
1651
1692
|
isAnimationActive: !1,
|
|
1652
|
-
drillDown: n.drillDown ??
|
|
1693
|
+
drillDown: n.drillDown ?? Kn(i.chartType),
|
|
1653
1694
|
compareTo: e.compareTo,
|
|
1654
1695
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
1655
1696
|
};
|
|
@@ -1661,22 +1702,23 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1661
1702
|
xAxisKey: t,
|
|
1662
1703
|
series: [{
|
|
1663
1704
|
dataKey: o,
|
|
1664
|
-
label:
|
|
1705
|
+
label: de(void 0, o, void 0)
|
|
1665
1706
|
}],
|
|
1666
|
-
colors:
|
|
1707
|
+
colors: Wn,
|
|
1667
1708
|
isAnimationActive: !1,
|
|
1668
1709
|
className: "h-[200px] sm:h-[250px] md:h-[300px]"
|
|
1669
1710
|
};
|
|
1670
1711
|
}
|
|
1671
1712
|
if (i.family === "metric") {
|
|
1672
|
-
let i =
|
|
1673
|
-
if (
|
|
1713
|
+
let i = pe(e) || t, a = he(e);
|
|
1714
|
+
if (zt(r)) {
|
|
1674
1715
|
let t = r.aggregate;
|
|
1675
1716
|
return {
|
|
1676
1717
|
type: "object-metric",
|
|
1677
1718
|
...n,
|
|
1678
1719
|
objectName: r.object,
|
|
1679
1720
|
label: i,
|
|
1721
|
+
description: a,
|
|
1680
1722
|
aggregate: t ? {
|
|
1681
1723
|
field: t.field,
|
|
1682
1724
|
function: t.function,
|
|
@@ -1685,17 +1727,18 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1685
1727
|
filter: r.filter || e.filter
|
|
1686
1728
|
};
|
|
1687
1729
|
}
|
|
1688
|
-
let
|
|
1730
|
+
let o = Array.isArray(r) ? r : r?.items || [], s = n.yField || "value";
|
|
1689
1731
|
return {
|
|
1690
1732
|
type: "metric",
|
|
1691
1733
|
...n,
|
|
1692
1734
|
label: i,
|
|
1693
|
-
|
|
1735
|
+
description: a,
|
|
1736
|
+
value: n.value ?? o[0]?.[s] ?? "—"
|
|
1694
1737
|
};
|
|
1695
1738
|
}
|
|
1696
1739
|
if (i.family === "table") {
|
|
1697
1740
|
let i = t === "list";
|
|
1698
|
-
if (
|
|
1741
|
+
if (zt(r)) {
|
|
1699
1742
|
let { data: t, ...a } = n;
|
|
1700
1743
|
return {
|
|
1701
1744
|
type: "object-data-table",
|
|
@@ -1717,13 +1760,13 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1717
1760
|
type: "data-table",
|
|
1718
1761
|
...n,
|
|
1719
1762
|
data: a,
|
|
1720
|
-
columns: Array.isArray(n.columns) && n.columns.length > 0 ? n.columns :
|
|
1763
|
+
columns: Array.isArray(n.columns) && n.columns.length > 0 ? n.columns : Vt(a),
|
|
1721
1764
|
searchable: !1,
|
|
1722
1765
|
pagination: !1,
|
|
1723
1766
|
className: "border-0"
|
|
1724
1767
|
};
|
|
1725
1768
|
}
|
|
1726
|
-
return i.family === "pivot" ?
|
|
1769
|
+
return i.family === "pivot" ? Yt : i.family === "custom" ? {
|
|
1727
1770
|
type: "text",
|
|
1728
1771
|
value: "Custom widget — set `component` to a UIComponent schema.",
|
|
1729
1772
|
variant: "caption",
|
|
@@ -1739,38 +1782,32 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1739
1782
|
...e,
|
|
1740
1783
|
...n
|
|
1741
1784
|
};
|
|
1742
|
-
}, d =
|
|
1785
|
+
}, d = j.length > 0 ? v(e, j, M) : void 0, m = (() => {
|
|
1743
1786
|
let e = u();
|
|
1744
|
-
return d && e &&
|
|
1787
|
+
return d && e && qn.has(e.type) ? {
|
|
1745
1788
|
...e,
|
|
1746
|
-
filter:
|
|
1789
|
+
filter: P(e.filter, d)
|
|
1747
1790
|
} : e;
|
|
1748
1791
|
})(), h = d && l ? {
|
|
1749
1792
|
...e,
|
|
1750
|
-
filter:
|
|
1751
|
-
} : e, g = e.type === "metric" && !l,
|
|
1793
|
+
filter: P(e.filter, d)
|
|
1794
|
+
} : e, g = e.type === "metric" && !l, _ = pe(e), y = me(e), b = e.id || _ || `widget-${t}`, x = f && p === e.id, S = f ? {
|
|
1752
1795
|
"data-testid": `dashboard-preview-widget-${e.id}`,
|
|
1753
1796
|
"data-widget-id": e.id,
|
|
1754
1797
|
role: "button",
|
|
1755
1798
|
tabIndex: 0,
|
|
1756
1799
|
"aria-selected": x,
|
|
1757
|
-
"aria-label": `Widget: ${
|
|
1758
|
-
onClick: (t) =>
|
|
1759
|
-
onKeyDown: (n) =>
|
|
1760
|
-
} : {}, w = f ? Z("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", x ? "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, E = !O && c && !
|
|
1800
|
+
"aria-label": `Widget: ${_ || `Widget ${t + 1}`}`,
|
|
1801
|
+
onClick: (t) => ye(t, e.id),
|
|
1802
|
+
onKeyDown: (n) => be(n, e.id, t)
|
|
1803
|
+
} : {}, w = f ? Z("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", x ? "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, E = !O && c && !G ? {
|
|
1761
1804
|
gridColumn: `span ${c.w}`,
|
|
1762
1805
|
gridRow: `span ${c.h}`
|
|
1763
1806
|
} : void 0, D = g ? /* @__PURE__ */ $("div", {
|
|
1764
1807
|
className: Z("h-full w-full", f && "relative", w),
|
|
1765
1808
|
style: E,
|
|
1766
1809
|
...S,
|
|
1767
|
-
children: [
|
|
1768
|
-
className: Z("h-full w-full", f && "pointer-events-none"),
|
|
1769
|
-
children: /* @__PURE__ */ Q(Cn, {
|
|
1770
|
-
widget: h,
|
|
1771
|
-
dataSource: r
|
|
1772
|
-
})
|
|
1773
|
-
}) : /* @__PURE__ */ Q(oe, {
|
|
1810
|
+
children: [/* @__PURE__ */ Q(B, {
|
|
1774
1811
|
schema: m,
|
|
1775
1812
|
className: Z("h-full w-full", f && "pointer-events-none"),
|
|
1776
1813
|
dataSource: r
|
|
@@ -1779,30 +1816,30 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1779
1816
|
"aria-hidden": "true",
|
|
1780
1817
|
"data-testid": "widget-click-overlay"
|
|
1781
1818
|
})]
|
|
1782
|
-
}) : /* @__PURE__ */ $(
|
|
1819
|
+
}) : /* @__PURE__ */ $(we, {
|
|
1783
1820
|
className: Z("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", i && "w-full", f && "relative", w),
|
|
1784
1821
|
style: E,
|
|
1785
1822
|
...S,
|
|
1786
1823
|
children: [
|
|
1787
|
-
|
|
1824
|
+
_ && /* @__PURE__ */ $(Ee, {
|
|
1788
1825
|
className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
|
|
1789
|
-
children: [/* @__PURE__ */ Q(
|
|
1826
|
+
children: [/* @__PURE__ */ Q(De, {
|
|
1790
1827
|
className: "text-sm sm:text-base font-medium tracking-tight truncate",
|
|
1791
|
-
title:
|
|
1792
|
-
children:
|
|
1828
|
+
title: _,
|
|
1829
|
+
children: _
|
|
1793
1830
|
}), y && /* @__PURE__ */ Q("p", {
|
|
1794
1831
|
className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
|
|
1795
1832
|
children: y
|
|
1796
1833
|
})]
|
|
1797
1834
|
}),
|
|
1798
|
-
/* @__PURE__ */ Q(
|
|
1835
|
+
/* @__PURE__ */ Q(Te, {
|
|
1799
1836
|
className: "p-0",
|
|
1800
1837
|
children: /* @__PURE__ */ Q("div", {
|
|
1801
1838
|
className: Z("h-full w-full", "p-3 sm:p-4 md:p-6", f && "pointer-events-none"),
|
|
1802
|
-
children: l ? /* @__PURE__ */ Q(
|
|
1839
|
+
children: l ? /* @__PURE__ */ Q(jn, {
|
|
1803
1840
|
widget: h,
|
|
1804
1841
|
dataSource: r
|
|
1805
|
-
}) : /* @__PURE__ */ Q(
|
|
1842
|
+
}) : /* @__PURE__ */ Q(B, {
|
|
1806
1843
|
schema: m,
|
|
1807
1844
|
dataSource: r
|
|
1808
1845
|
})
|
|
@@ -1815,7 +1852,7 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1815
1852
|
})
|
|
1816
1853
|
]
|
|
1817
1854
|
});
|
|
1818
|
-
return
|
|
1855
|
+
return G && e.id ? /* @__PURE__ */ Q(Hn, {
|
|
1819
1856
|
id: e.id,
|
|
1820
1857
|
gridSpan: !O && c ? {
|
|
1821
1858
|
w: c.w,
|
|
@@ -1823,28 +1860,28 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1823
1860
|
} : void 0,
|
|
1824
1861
|
children: D
|
|
1825
1862
|
}, b) : /* @__PURE__ */ Q(n, { children: D }, b);
|
|
1826
|
-
},
|
|
1863
|
+
}, Ce = e.title || e.label, Oe = e.header, ke = !y && Oe?.showTitle !== !1 && !!Ce, Ae = !y && Oe?.showDescription !== !1 && !!e.description, je = Oe?.actions ?? [], Me = Oe && (ke || Ae || je.length > 0) && /* @__PURE__ */ $("div", {
|
|
1827
1864
|
className: "col-span-full mb-4",
|
|
1828
1865
|
children: [
|
|
1829
|
-
|
|
1866
|
+
ke && /* @__PURE__ */ Q("h2", {
|
|
1830
1867
|
className: "text-lg font-semibold tracking-tight",
|
|
1831
|
-
children:
|
|
1832
|
-
name:
|
|
1833
|
-
label:
|
|
1834
|
-
}) :
|
|
1868
|
+
children: H ? ie({
|
|
1869
|
+
name: H,
|
|
1870
|
+
label: z(Ce)
|
|
1871
|
+
}) : z(Ce)
|
|
1835
1872
|
}),
|
|
1836
|
-
|
|
1873
|
+
Ae && /* @__PURE__ */ Q("p", {
|
|
1837
1874
|
className: "text-sm text-muted-foreground mt-1",
|
|
1838
|
-
children:
|
|
1839
|
-
name:
|
|
1840
|
-
description:
|
|
1841
|
-
}) :
|
|
1875
|
+
children: H ? ae({
|
|
1876
|
+
name: H,
|
|
1877
|
+
description: z(e.description)
|
|
1878
|
+
}) : z(e.description)
|
|
1842
1879
|
}),
|
|
1843
|
-
|
|
1880
|
+
je.length > 0 && /* @__PURE__ */ Q("div", {
|
|
1844
1881
|
className: "flex gap-2 mt-3",
|
|
1845
|
-
children:
|
|
1846
|
-
let n =
|
|
1847
|
-
return /* @__PURE__ */ $(
|
|
1882
|
+
children: je.map((e, t) => {
|
|
1883
|
+
let n = Un(e.icon);
|
|
1884
|
+
return /* @__PURE__ */ $(Y, {
|
|
1848
1885
|
variant: "outline",
|
|
1849
1886
|
size: "sm",
|
|
1850
1887
|
onClick: async () => {
|
|
@@ -1857,78 +1894,78 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1857
1894
|
/^https?:\/\//.test(n) || n.startsWith("//") ? window.location.assign(n) : (window.history.pushState({}, "", n), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
1858
1895
|
return;
|
|
1859
1896
|
}
|
|
1860
|
-
let i = await
|
|
1897
|
+
let i = await re(n || r);
|
|
1861
1898
|
i?.success || console.warn("[DashboardRenderer] action failed", i?.error);
|
|
1862
1899
|
},
|
|
1863
|
-
children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }),
|
|
1900
|
+
children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }), fe(e)]
|
|
1864
1901
|
}, t);
|
|
1865
1902
|
})
|
|
1866
1903
|
})
|
|
1867
1904
|
]
|
|
1868
|
-
}),
|
|
1869
|
-
defs:
|
|
1870
|
-
values:
|
|
1905
|
+
}), Ne = j.length > 0 && /* @__PURE__ */ Q(Vn, {
|
|
1906
|
+
defs: j,
|
|
1907
|
+
values: M,
|
|
1871
1908
|
onChange: ee,
|
|
1872
|
-
onReset:
|
|
1909
|
+
onReset: te,
|
|
1873
1910
|
dataSource: r,
|
|
1874
1911
|
className: "mb-2"
|
|
1875
|
-
}),
|
|
1912
|
+
}), Pe = u !== void 0 && /* @__PURE__ */ $("span", {
|
|
1876
1913
|
className: "text-xs text-muted-foreground",
|
|
1877
1914
|
children: [u.toLocaleString(), " records"]
|
|
1878
|
-
}),
|
|
1915
|
+
}), Fe = d ? JSON.stringify(d) : void 0, Ie = L(b), Le = a && /* @__PURE__ */ $("div", {
|
|
1879
1916
|
className: Z("flex items-center justify-end gap-3 mb-2", !O && "col-span-full"),
|
|
1880
|
-
children: [
|
|
1917
|
+
children: [Pe, /* @__PURE__ */ $(Y, {
|
|
1881
1918
|
variant: "outline",
|
|
1882
1919
|
size: "sm",
|
|
1883
|
-
onClick:
|
|
1920
|
+
onClick: ge,
|
|
1884
1921
|
disabled: E,
|
|
1885
1922
|
"aria-label": "Refresh dashboard",
|
|
1886
|
-
children: [/* @__PURE__ */ Q(
|
|
1923
|
+
children: [/* @__PURE__ */ Q(ht, { className: Z("h-4 w-4 mr-2", E && "animate-spin") }), E ? "Refreshing…" : "Refresh All"]
|
|
1887
1924
|
})]
|
|
1888
|
-
}),
|
|
1925
|
+
}), Re = s(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), ze = s(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), Be = s(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
|
|
1889
1926
|
if (O) {
|
|
1890
1927
|
let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ $("div", {
|
|
1891
1928
|
ref: x,
|
|
1892
|
-
...
|
|
1929
|
+
...Ie,
|
|
1893
1930
|
className: Z("flex flex-col gap-4 px-4", t),
|
|
1894
|
-
"data-user-actions":
|
|
1895
|
-
onClick:
|
|
1931
|
+
"data-user-actions": Fe,
|
|
1932
|
+
onClick: W,
|
|
1896
1933
|
children: [
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1934
|
+
Me,
|
|
1935
|
+
Ne,
|
|
1936
|
+
Le,
|
|
1900
1937
|
n.length > 0 && /* @__PURE__ */ Q("div", {
|
|
1901
1938
|
className: "grid grid-cols-2 gap-3",
|
|
1902
|
-
onClick:
|
|
1903
|
-
children: /* @__PURE__ */ Q(
|
|
1904
|
-
items:
|
|
1905
|
-
strategy:
|
|
1906
|
-
disabled: !
|
|
1907
|
-
children: n.map((e, t) =>
|
|
1939
|
+
onClick: xe,
|
|
1940
|
+
children: /* @__PURE__ */ Q(Tt, {
|
|
1941
|
+
items: ze,
|
|
1942
|
+
strategy: Dt,
|
|
1943
|
+
disabled: !G,
|
|
1944
|
+
children: n.map((e, t) => J(e, t))
|
|
1908
1945
|
})
|
|
1909
1946
|
}),
|
|
1910
1947
|
r.length > 0 && /* @__PURE__ */ Q("div", {
|
|
1911
1948
|
className: "flex flex-col gap-4",
|
|
1912
|
-
onClick:
|
|
1913
|
-
children: /* @__PURE__ */ Q(
|
|
1914
|
-
items:
|
|
1915
|
-
strategy:
|
|
1916
|
-
disabled: !
|
|
1917
|
-
children: r.map((e, t) =>
|
|
1949
|
+
onClick: xe,
|
|
1950
|
+
children: /* @__PURE__ */ Q(Tt, {
|
|
1951
|
+
items: Be,
|
|
1952
|
+
strategy: kt,
|
|
1953
|
+
disabled: !G,
|
|
1954
|
+
children: r.map((e, t) => J(e, t, !0))
|
|
1918
1955
|
})
|
|
1919
1956
|
})
|
|
1920
1957
|
]
|
|
1921
1958
|
});
|
|
1922
|
-
return
|
|
1923
|
-
sensors:
|
|
1924
|
-
collisionDetection:
|
|
1925
|
-
onDragEnd:
|
|
1959
|
+
return G ? /* @__PURE__ */ Q(bt, {
|
|
1960
|
+
sensors: K,
|
|
1961
|
+
collisionDetection: St,
|
|
1962
|
+
onDragEnd: Se,
|
|
1926
1963
|
children: i
|
|
1927
1964
|
}) : i;
|
|
1928
1965
|
}
|
|
1929
|
-
let
|
|
1966
|
+
let Ve = /* @__PURE__ */ $("div", {
|
|
1930
1967
|
ref: x,
|
|
1931
|
-
...
|
|
1968
|
+
...Ie,
|
|
1932
1969
|
className: Z("grid", !T && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
|
|
1933
1970
|
style: {
|
|
1934
1971
|
...T && {
|
|
@@ -1937,46 +1974,46 @@ var zn = /* @__PURE__ */ new Set([
|
|
|
1937
1974
|
},
|
|
1938
1975
|
gap: `${w * .25}rem`
|
|
1939
1976
|
},
|
|
1940
|
-
"data-user-actions":
|
|
1941
|
-
onClick:
|
|
1977
|
+
"data-user-actions": Fe,
|
|
1978
|
+
onClick: W,
|
|
1942
1979
|
children: [
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
/* @__PURE__ */ Q(
|
|
1947
|
-
items:
|
|
1948
|
-
strategy:
|
|
1949
|
-
disabled: !
|
|
1950
|
-
children: e.widgets?.map((e, t) =>
|
|
1980
|
+
Me,
|
|
1981
|
+
Ne,
|
|
1982
|
+
Le,
|
|
1983
|
+
/* @__PURE__ */ Q(Tt, {
|
|
1984
|
+
items: Re,
|
|
1985
|
+
strategy: Dt,
|
|
1986
|
+
disabled: !G,
|
|
1987
|
+
children: e.widgets?.map((e, t) => J(e, t))
|
|
1951
1988
|
})
|
|
1952
1989
|
]
|
|
1953
1990
|
});
|
|
1954
|
-
return
|
|
1955
|
-
sensors:
|
|
1956
|
-
collisionDetection:
|
|
1957
|
-
onDragEnd:
|
|
1958
|
-
children:
|
|
1959
|
-
}) :
|
|
1991
|
+
return G ? /* @__PURE__ */ Q(bt, {
|
|
1992
|
+
sensors: K,
|
|
1993
|
+
collisionDetection: St,
|
|
1994
|
+
onDragEnd: Se,
|
|
1995
|
+
children: Ve
|
|
1996
|
+
}) : Ve;
|
|
1960
1997
|
});
|
|
1961
|
-
|
|
1962
|
-
var
|
|
1963
|
-
let { schema: n } = e, r = s(() =>
|
|
1964
|
-
return r.length === 0 ? /* @__PURE__ */ Q(
|
|
1998
|
+
Jn.displayName = "DashboardRendererInner";
|
|
1999
|
+
var Yn = r((e, t) => {
|
|
2000
|
+
let { schema: n } = e, r = s(() => ce(n), [n.globalFilters, n.dateRange]);
|
|
2001
|
+
return r.length === 0 ? /* @__PURE__ */ Q(Jn, {
|
|
1965
2002
|
ref: t,
|
|
1966
2003
|
...e
|
|
1967
|
-
}) : /* @__PURE__ */ Q(
|
|
1968
|
-
definitions:
|
|
1969
|
-
children: /* @__PURE__ */ Q(
|
|
2004
|
+
}) : /* @__PURE__ */ Q(z, {
|
|
2005
|
+
definitions: E(r),
|
|
2006
|
+
children: /* @__PURE__ */ Q(Jn, {
|
|
1970
2007
|
ref: t,
|
|
1971
2008
|
...e
|
|
1972
2009
|
})
|
|
1973
2010
|
});
|
|
1974
2011
|
});
|
|
1975
|
-
|
|
2012
|
+
Yn.displayName = "DashboardRenderer";
|
|
1976
2013
|
//#endregion
|
|
1977
2014
|
//#region src/DashboardGridLayout.tsx
|
|
1978
|
-
function
|
|
1979
|
-
let n =
|
|
2015
|
+
function Xn({ editMode: t }) {
|
|
2016
|
+
let n = pe();
|
|
1980
2017
|
return e.useEffect(() => {
|
|
1981
2018
|
if (t) return n.startDrag({
|
|
1982
2019
|
id: "dashboard-layout",
|
|
@@ -1988,14 +2025,14 @@ function Hn({ editMode: t }) {
|
|
|
1988
2025
|
n.endDrag("dashboard");
|
|
1989
2026
|
}, [t, n]), null;
|
|
1990
2027
|
}
|
|
1991
|
-
var
|
|
2028
|
+
var Zn = [
|
|
1992
2029
|
"hsl(var(--chart-1))",
|
|
1993
2030
|
"hsl(var(--chart-2))",
|
|
1994
2031
|
"hsl(var(--chart-3))",
|
|
1995
2032
|
"hsl(var(--chart-4))",
|
|
1996
2033
|
"hsl(var(--chart-5))"
|
|
1997
2034
|
];
|
|
1998
|
-
function
|
|
2035
|
+
function Qn(e, t) {
|
|
1999
2036
|
if (!e.widgets?.length) return e;
|
|
2000
2037
|
let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
|
|
2001
2038
|
let r = e.id || `widget-${t}`, i = n.get(r);
|
|
@@ -2014,7 +2051,7 @@ function Wn(e, t) {
|
|
|
2014
2051
|
widgets: r
|
|
2015
2052
|
};
|
|
2016
2053
|
}
|
|
2017
|
-
function
|
|
2054
|
+
function $n(e) {
|
|
2018
2055
|
return { lg: e.widgets?.map((e, t) => ({
|
|
2019
2056
|
i: e.id || `widget-${t}`,
|
|
2020
2057
|
x: e.layout?.x ?? t % 4 * 3,
|
|
@@ -2023,8 +2060,8 @@ function Gn(e) {
|
|
|
2023
2060
|
h: e.layout?.h ?? 4
|
|
2024
2061
|
})) || [] };
|
|
2025
2062
|
}
|
|
2026
|
-
var
|
|
2027
|
-
let { width: s, containerRef: c, mounted: l } =
|
|
2063
|
+
var er = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaChange: a, onRefresh: o }) => {
|
|
2064
|
+
let { width: s, containerRef: c, mounted: l } = Rt(), [u, d] = e.useState(!1), [f, p] = e.useState(!1), m = ge(), { language: h } = q(), g = e.useRef(null), _ = e.useCallback(() => {
|
|
2028
2065
|
o && (p(!0), o(), setTimeout(() => p(!1), 600));
|
|
2029
2066
|
}, [o]);
|
|
2030
2067
|
e.useEffect(() => {
|
|
@@ -2036,7 +2073,7 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2036
2073
|
o,
|
|
2037
2074
|
_
|
|
2038
2075
|
]);
|
|
2039
|
-
let [v, y] = e.useState(() =>
|
|
2076
|
+
let [v, y] = e.useState(() => $n(t)), b = e.useMemo(() => JSON.stringify(t.widgets?.map((e, t) => ({
|
|
2040
2077
|
i: e.id || `widget-${t}`,
|
|
2041
2078
|
x: e.layout?.x,
|
|
2042
2079
|
y: e.layout?.y,
|
|
@@ -2044,25 +2081,25 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2044
2081
|
h: e.layout?.h
|
|
2045
2082
|
})) ?? []), [t.widgets]);
|
|
2046
2083
|
e.useEffect(() => {
|
|
2047
|
-
y(
|
|
2084
|
+
y($n(t));
|
|
2048
2085
|
}, [b]);
|
|
2049
2086
|
let x = e.useCallback((e, t) => {
|
|
2050
2087
|
y(t), i?.(e);
|
|
2051
2088
|
}, [i]), S = e.useCallback(() => {
|
|
2052
|
-
a ? a(
|
|
2089
|
+
a ? a(Qn(t, v.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), d(!1);
|
|
2053
2090
|
}, [
|
|
2054
2091
|
a,
|
|
2055
2092
|
t,
|
|
2056
2093
|
v
|
|
2057
2094
|
]), C = e.useCallback(() => {
|
|
2058
|
-
y(
|
|
2095
|
+
y($n(t));
|
|
2059
2096
|
}, [t]), w = e.useCallback((e) => {
|
|
2060
2097
|
if (e.component) return e.component;
|
|
2061
|
-
if (
|
|
2062
|
-
let t = e.type, n = e.options || {}, r =
|
|
2098
|
+
if (Xt(e)) return Yt;
|
|
2099
|
+
let t = e.type, n = e.options || {}, r = Jt(t);
|
|
2063
2100
|
if (r.family === "series" && r.chartType) {
|
|
2064
2101
|
let t = e.data || n.data, i = n.xField || "name", a = n.yField || "value";
|
|
2065
|
-
if (
|
|
2102
|
+
if (zt(t)) {
|
|
2066
2103
|
let e = t.aggregate, n = e ? {
|
|
2067
2104
|
field: e.field,
|
|
2068
2105
|
function: e.function,
|
|
@@ -2075,7 +2112,7 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2075
2112
|
aggregate: n,
|
|
2076
2113
|
xAxisKey: i,
|
|
2077
2114
|
series: [{ dataKey: o }],
|
|
2078
|
-
colors:
|
|
2115
|
+
colors: Zn,
|
|
2079
2116
|
isAnimationActive: !1,
|
|
2080
2117
|
className: "h-full"
|
|
2081
2118
|
};
|
|
@@ -2087,14 +2124,14 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2087
2124
|
data: o,
|
|
2088
2125
|
xAxisKey: i,
|
|
2089
2126
|
series: [{ dataKey: a }],
|
|
2090
|
-
colors:
|
|
2127
|
+
colors: Zn,
|
|
2091
2128
|
isAnimationActive: !1,
|
|
2092
2129
|
className: "h-full"
|
|
2093
2130
|
};
|
|
2094
2131
|
}
|
|
2095
2132
|
if (r.family === "metric") {
|
|
2096
2133
|
let r = e.data || n.data, i = e.title || t;
|
|
2097
|
-
if (
|
|
2134
|
+
if (zt(r)) {
|
|
2098
2135
|
let t = r.aggregate;
|
|
2099
2136
|
return {
|
|
2100
2137
|
type: "object-metric",
|
|
@@ -2119,7 +2156,7 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2119
2156
|
}
|
|
2120
2157
|
if (r.family === "table") {
|
|
2121
2158
|
let t = e.data || n.data;
|
|
2122
|
-
if (
|
|
2159
|
+
if (zt(t)) {
|
|
2123
2160
|
let { data: e, ...r } = n;
|
|
2124
2161
|
return {
|
|
2125
2162
|
type: "data-table",
|
|
@@ -2137,7 +2174,7 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2137
2174
|
type: "data-table",
|
|
2138
2175
|
...n,
|
|
2139
2176
|
data: r,
|
|
2140
|
-
columns: Array.isArray(n.columns) && n.columns.length > 0 ? n.columns :
|
|
2177
|
+
columns: Array.isArray(n.columns) && n.columns.length > 0 ? n.columns : Vt(r),
|
|
2141
2178
|
searchable: !1,
|
|
2142
2179
|
pagination: !1,
|
|
2143
2180
|
className: "border-0"
|
|
@@ -2145,7 +2182,7 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2145
2182
|
}
|
|
2146
2183
|
if (r.family === "pivot") {
|
|
2147
2184
|
let t = e.data || n.data;
|
|
2148
|
-
if (
|
|
2185
|
+
if (zt(t)) {
|
|
2149
2186
|
let { data: e, ...r } = n;
|
|
2150
2187
|
return {
|
|
2151
2188
|
type: "pivot",
|
|
@@ -2177,49 +2214,49 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2177
2214
|
className: Z("w-full", n),
|
|
2178
2215
|
"data-testid": "grid-layout",
|
|
2179
2216
|
children: [
|
|
2180
|
-
m && /* @__PURE__ */ Q(
|
|
2217
|
+
m && /* @__PURE__ */ Q(Xn, { editMode: u }),
|
|
2181
2218
|
/* @__PURE__ */ $("div", {
|
|
2182
2219
|
className: "mb-4 flex items-center justify-between",
|
|
2183
2220
|
children: [/* @__PURE__ */ Q("h2", {
|
|
2184
2221
|
className: "text-2xl font-bold",
|
|
2185
|
-
children: t.title ||
|
|
2222
|
+
children: t.title || U(t.label, h) || "Dashboard"
|
|
2186
2223
|
}), /* @__PURE__ */ Q("div", {
|
|
2187
2224
|
className: "flex gap-2",
|
|
2188
|
-
children: u ? /* @__PURE__ */ $(
|
|
2189
|
-
/* @__PURE__ */ $(
|
|
2225
|
+
children: u ? /* @__PURE__ */ $(It, { children: [
|
|
2226
|
+
/* @__PURE__ */ $(Y, {
|
|
2190
2227
|
onClick: S,
|
|
2191
2228
|
size: "sm",
|
|
2192
2229
|
variant: "default",
|
|
2193
|
-
children: [/* @__PURE__ */ Q(
|
|
2230
|
+
children: [/* @__PURE__ */ Q(_t, { className: "h-4 w-4 mr-2" }), "Save Layout"]
|
|
2194
2231
|
}),
|
|
2195
|
-
/* @__PURE__ */ $(
|
|
2232
|
+
/* @__PURE__ */ $(Y, {
|
|
2196
2233
|
onClick: C,
|
|
2197
2234
|
size: "sm",
|
|
2198
2235
|
variant: "outline",
|
|
2199
|
-
children: [/* @__PURE__ */ Q(
|
|
2236
|
+
children: [/* @__PURE__ */ Q(yt, { className: "h-4 w-4 mr-2" }), "Reset"]
|
|
2200
2237
|
}),
|
|
2201
|
-
/* @__PURE__ */ Q(
|
|
2238
|
+
/* @__PURE__ */ Q(Y, {
|
|
2202
2239
|
onClick: () => d(!1),
|
|
2203
2240
|
size: "sm",
|
|
2204
2241
|
variant: "ghost",
|
|
2205
2242
|
children: "Cancel"
|
|
2206
2243
|
})
|
|
2207
|
-
] }) : /* @__PURE__ */ $(
|
|
2244
|
+
] }) : /* @__PURE__ */ $(It, { children: [o && /* @__PURE__ */ $(Y, {
|
|
2208
2245
|
onClick: _,
|
|
2209
2246
|
size: "sm",
|
|
2210
2247
|
variant: "outline",
|
|
2211
2248
|
disabled: f,
|
|
2212
2249
|
"aria-label": "Refresh dashboard",
|
|
2213
|
-
children: [/* @__PURE__ */ Q(
|
|
2214
|
-
}), /* @__PURE__ */ $(
|
|
2250
|
+
children: [/* @__PURE__ */ Q(ht, { className: Z("h-4 w-4 mr-2", f && "animate-spin") }), f ? "Refreshing…" : "Refresh All"]
|
|
2251
|
+
}), /* @__PURE__ */ $(Y, {
|
|
2215
2252
|
onClick: () => d(!0),
|
|
2216
2253
|
size: "sm",
|
|
2217
2254
|
variant: "outline",
|
|
2218
|
-
children: [/* @__PURE__ */ Q(
|
|
2255
|
+
children: [/* @__PURE__ */ Q(dt, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
|
|
2219
2256
|
})] })
|
|
2220
2257
|
})]
|
|
2221
2258
|
}),
|
|
2222
|
-
l && /* @__PURE__ */ Q(
|
|
2259
|
+
l && /* @__PURE__ */ Q(Lt, {
|
|
2223
2260
|
className: "layout",
|
|
2224
2261
|
width: s,
|
|
2225
2262
|
layouts: v,
|
|
@@ -2245,38 +2282,38 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2245
2282
|
resizeConfig: { enabled: u },
|
|
2246
2283
|
onLayoutChange: x,
|
|
2247
2284
|
children: t.widgets?.map((e, t) => {
|
|
2248
|
-
let n = e.id || `widget-${t}`, i = w(e), a = !!e.dataset, o = e.type === "metric" && !a, s =
|
|
2285
|
+
let n = e.id || `widget-${t}`, i = w(e), a = !!e.dataset, o = e.type === "metric" && !a, s = U(e.title, h);
|
|
2249
2286
|
return /* @__PURE__ */ Q("div", {
|
|
2250
2287
|
className: "h-full",
|
|
2251
2288
|
children: o ? /* @__PURE__ */ $("div", {
|
|
2252
2289
|
className: "h-full w-full relative",
|
|
2253
2290
|
children: [u && /* @__PURE__ */ Q("div", {
|
|
2254
2291
|
className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
|
|
2255
|
-
children: /* @__PURE__ */ Q(
|
|
2256
|
-
}), /* @__PURE__ */ Q(
|
|
2292
|
+
children: /* @__PURE__ */ Q(ft, { className: "h-4 w-4" })
|
|
2293
|
+
}), /* @__PURE__ */ Q(B, {
|
|
2257
2294
|
schema: i,
|
|
2258
2295
|
className: "h-full w-full"
|
|
2259
2296
|
})]
|
|
2260
|
-
}) : /* @__PURE__ */ $(
|
|
2297
|
+
}) : /* @__PURE__ */ $(we, {
|
|
2261
2298
|
className: Z("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", u && "ring-2 ring-primary/20"),
|
|
2262
|
-
children: [s && /* @__PURE__ */ $(
|
|
2299
|
+
children: [s && /* @__PURE__ */ $(Ee, {
|
|
2263
2300
|
className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
|
|
2264
|
-
children: [/* @__PURE__ */ Q(
|
|
2301
|
+
children: [/* @__PURE__ */ Q(De, {
|
|
2265
2302
|
className: "text-base font-medium tracking-tight truncate",
|
|
2266
2303
|
title: s,
|
|
2267
2304
|
children: s
|
|
2268
2305
|
}), u && /* @__PURE__ */ Q("div", {
|
|
2269
2306
|
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
2270
|
-
children: /* @__PURE__ */ Q(
|
|
2307
|
+
children: /* @__PURE__ */ Q(ft, { className: "h-4 w-4" })
|
|
2271
2308
|
})]
|
|
2272
|
-
}), /* @__PURE__ */ Q(
|
|
2309
|
+
}), /* @__PURE__ */ Q(Te, {
|
|
2273
2310
|
className: "p-0 h-full",
|
|
2274
2311
|
children: /* @__PURE__ */ Q("div", {
|
|
2275
2312
|
className: Z("h-full w-full overflow-auto p-4"),
|
|
2276
|
-
children: a ? /* @__PURE__ */ Q(
|
|
2313
|
+
children: a ? /* @__PURE__ */ Q(jn, {
|
|
2277
2314
|
widget: e,
|
|
2278
2315
|
dataSource: r
|
|
2279
|
-
}) : /* @__PURE__ */ Q(
|
|
2316
|
+
}) : /* @__PURE__ */ Q(B, { schema: i })
|
|
2280
2317
|
})
|
|
2281
2318
|
})]
|
|
2282
2319
|
})
|
|
@@ -2285,7 +2322,7 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2285
2322
|
})
|
|
2286
2323
|
]
|
|
2287
2324
|
});
|
|
2288
|
-
},
|
|
2325
|
+
}, tr = ye({
|
|
2289
2326
|
"dashboard.trend.vsLastQuarter": "vs last quarter",
|
|
2290
2327
|
"dashboard.trend.vsLastMonth": "vs last month",
|
|
2291
2328
|
"dashboard.trend.vsLastWeek": "vs last week",
|
|
@@ -2293,7 +2330,7 @@ var Kn = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2293
2330
|
"dashboard.trend.vsYesterday": "vs yesterday",
|
|
2294
2331
|
"dashboard.trend.vsPreviousPeriod": "vs previous period"
|
|
2295
2332
|
}, "dashboard.trend.vsLastQuarter");
|
|
2296
|
-
function
|
|
2333
|
+
function nr(e) {
|
|
2297
2334
|
switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
|
|
2298
2335
|
case "vs last quarter":
|
|
2299
2336
|
case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
|
|
@@ -2309,11 +2346,11 @@ function Jn(e) {
|
|
|
2309
2346
|
default: return;
|
|
2310
2347
|
}
|
|
2311
2348
|
}
|
|
2312
|
-
function
|
|
2349
|
+
function rr(e, t, n, r) {
|
|
2313
2350
|
if (e == null) return "";
|
|
2314
2351
|
if (typeof e == "string") {
|
|
2315
2352
|
let i = Number(e);
|
|
2316
|
-
return !isFinite(i) || e.trim() === "" ? e :
|
|
2353
|
+
return !isFinite(i) || e.trim() === "" ? e : rr(i, t, n, r);
|
|
2317
2354
|
}
|
|
2318
2355
|
if (!isFinite(e)) return String(e);
|
|
2319
2356
|
let i = {
|
|
@@ -2330,13 +2367,13 @@ function Yn(e, t, n, r) {
|
|
|
2330
2367
|
};
|
|
2331
2368
|
o && (t.currency = n || i[a[0]] || "USD");
|
|
2332
2369
|
try {
|
|
2333
|
-
return
|
|
2370
|
+
return be(e, t);
|
|
2334
2371
|
} catch {}
|
|
2335
2372
|
}
|
|
2336
2373
|
if (o) {
|
|
2337
2374
|
let t = n || i[a[0]] || "USD";
|
|
2338
2375
|
try {
|
|
2339
|
-
return
|
|
2376
|
+
return be(e, {
|
|
2340
2377
|
locale: r,
|
|
2341
2378
|
currency: t,
|
|
2342
2379
|
minimumFractionDigits: l,
|
|
@@ -2346,17 +2383,17 @@ function Yn(e, t, n, r) {
|
|
|
2346
2383
|
return `${t} ${e.toFixed(l)}`;
|
|
2347
2384
|
}
|
|
2348
2385
|
}
|
|
2349
|
-
return s ? `${(e > 1 ? e : e * 100).toFixed(l)}%` :
|
|
2386
|
+
return s ? `${(e > 1 ? e : e * 100).toFixed(l)}%` : be(e, {
|
|
2350
2387
|
locale: r,
|
|
2351
2388
|
minimumFractionDigits: l,
|
|
2352
2389
|
maximumFractionDigits: l
|
|
2353
2390
|
});
|
|
2354
2391
|
}
|
|
2355
|
-
var
|
|
2356
|
-
let w =
|
|
2357
|
-
let e =
|
|
2392
|
+
var ir = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: c, colorVariant: l = "default", format: u, currency: d, prefix: f, suffix: p, onClick: m, variant: h = "card", schema: g, bind: _, events: v, props: y, ariaLabel: b, ariaDescribedBy: x, dataSource: S, ...C }) => {
|
|
2393
|
+
let w = Zt[l] || Zt.default, { t: T } = tr(), E = G(), { language: D } = q(), O = s(() => U(e, D) || void 0, [e, D]), k = s(() => {
|
|
2394
|
+
let e = U(a, D) || U(n?.label, D) || void 0;
|
|
2358
2395
|
if (!e) return e;
|
|
2359
|
-
let t =
|
|
2396
|
+
let t = nr(e);
|
|
2360
2397
|
return t ? T(t) : e;
|
|
2361
2398
|
}, [
|
|
2362
2399
|
a,
|
|
@@ -2364,7 +2401,7 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2364
2401
|
T,
|
|
2365
2402
|
D
|
|
2366
2403
|
]), A = s(() => {
|
|
2367
|
-
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ?
|
|
2404
|
+
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? rr(t, u, d, E) : t ?? "", n = String(e);
|
|
2368
2405
|
return `${f && n.startsWith(f) ? "" : f ?? ""}${n}${p && n.endsWith(p) ? "" : p ?? ""}`;
|
|
2369
2406
|
}, [
|
|
2370
2407
|
t,
|
|
@@ -2375,13 +2412,13 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2375
2412
|
E
|
|
2376
2413
|
]), j = s(() => {
|
|
2377
2414
|
if (typeof r == "string") {
|
|
2378
|
-
let e =
|
|
2415
|
+
let e = Qe(r);
|
|
2379
2416
|
return e ? /* @__PURE__ */ Q(e, { className: "h-4 w-4" }) : null;
|
|
2380
2417
|
}
|
|
2381
2418
|
return r;
|
|
2382
2419
|
}, [r]);
|
|
2383
2420
|
if (h === "bare") {
|
|
2384
|
-
let e =
|
|
2421
|
+
let e = Qt[l] || Qt.default;
|
|
2385
2422
|
return /* @__PURE__ */ Q("div", {
|
|
2386
2423
|
className: Z("flex flex-col gap-1 min-w-0", m && "cursor-pointer", i),
|
|
2387
2424
|
onClick: m,
|
|
@@ -2393,7 +2430,7 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2393
2430
|
children: o ? /* @__PURE__ */ $("div", {
|
|
2394
2431
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2395
2432
|
"data-testid": "metric-loading",
|
|
2396
|
-
children: [/* @__PURE__ */ Q(
|
|
2433
|
+
children: [/* @__PURE__ */ Q(pt, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
2397
2434
|
className: "text-sm",
|
|
2398
2435
|
children: "Loading…"
|
|
2399
2436
|
})]
|
|
@@ -2401,11 +2438,11 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2401
2438
|
className: "flex items-center gap-2",
|
|
2402
2439
|
"data-testid": "metric-error",
|
|
2403
2440
|
role: "alert",
|
|
2404
|
-
children: [/* @__PURE__ */ Q(
|
|
2441
|
+
children: [/* @__PURE__ */ Q(et, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
2405
2442
|
className: "text-xs text-destructive truncate",
|
|
2406
2443
|
children: c
|
|
2407
2444
|
})]
|
|
2408
|
-
}) : /* @__PURE__ */ $(
|
|
2445
|
+
}) : /* @__PURE__ */ $(It, { children: [/* @__PURE__ */ Q("div", {
|
|
2409
2446
|
className: Z("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", e),
|
|
2410
2447
|
children: A
|
|
2411
2448
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -2414,7 +2451,7 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2414
2451
|
})] })
|
|
2415
2452
|
});
|
|
2416
2453
|
}
|
|
2417
|
-
return /* @__PURE__ */ $(
|
|
2454
|
+
return /* @__PURE__ */ $(we, {
|
|
2418
2455
|
className: Z("h-full overflow-hidden", m && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
|
|
2419
2456
|
onClick: m,
|
|
2420
2457
|
role: m ? "button" : void 0,
|
|
@@ -2423,19 +2460,19 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2423
2460
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), m());
|
|
2424
2461
|
} : void 0,
|
|
2425
2462
|
...C,
|
|
2426
|
-
children: [/* @__PURE__ */ $(
|
|
2463
|
+
children: [/* @__PURE__ */ $(Ee, {
|
|
2427
2464
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
2428
|
-
children: [/* @__PURE__ */ Q(
|
|
2465
|
+
children: [/* @__PURE__ */ Q(De, {
|
|
2429
2466
|
className: "text-sm font-medium truncate",
|
|
2430
2467
|
children: O
|
|
2431
2468
|
}), j && /* @__PURE__ */ Q("div", {
|
|
2432
2469
|
className: Z("flex h-8 w-8 items-center justify-center rounded-md shrink-0", w),
|
|
2433
2470
|
children: j
|
|
2434
2471
|
})]
|
|
2435
|
-
}), /* @__PURE__ */ Q(
|
|
2472
|
+
}), /* @__PURE__ */ Q(Te, { children: o ? /* @__PURE__ */ $("div", {
|
|
2436
2473
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2437
2474
|
"data-testid": "metric-loading",
|
|
2438
|
-
children: [/* @__PURE__ */ Q(
|
|
2475
|
+
children: [/* @__PURE__ */ Q(pt, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
2439
2476
|
className: "text-sm",
|
|
2440
2477
|
children: "Loading…"
|
|
2441
2478
|
})]
|
|
@@ -2443,11 +2480,11 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2443
2480
|
className: "flex items-center gap-2",
|
|
2444
2481
|
"data-testid": "metric-error",
|
|
2445
2482
|
role: "alert",
|
|
2446
|
-
children: [/* @__PURE__ */ Q(
|
|
2483
|
+
children: [/* @__PURE__ */ Q(et, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
2447
2484
|
className: "text-xs text-destructive truncate",
|
|
2448
2485
|
children: c
|
|
2449
2486
|
})]
|
|
2450
|
-
}) : /* @__PURE__ */ $(
|
|
2487
|
+
}) : /* @__PURE__ */ $(It, { children: [/* @__PURE__ */ Q("div", {
|
|
2451
2488
|
className: "text-2xl font-bold tabular-nums tracking-tight truncate",
|
|
2452
2489
|
children: A
|
|
2453
2490
|
}), (n || a) && /* @__PURE__ */ $("div", {
|
|
@@ -2455,9 +2492,9 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2455
2492
|
children: [n && /* @__PURE__ */ $("span", {
|
|
2456
2493
|
className: Z("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"),
|
|
2457
2494
|
children: [
|
|
2458
|
-
n.direction === "up" && /* @__PURE__ */ Q(
|
|
2459
|
-
n.direction === "down" && /* @__PURE__ */ Q(
|
|
2460
|
-
n.direction === "neutral" && /* @__PURE__ */ Q(
|
|
2495
|
+
n.direction === "up" && /* @__PURE__ */ Q(rt, { className: "h-3 w-3 mr-1" }),
|
|
2496
|
+
n.direction === "down" && /* @__PURE__ */ Q(nt, { className: "h-3 w-3 mr-1" }),
|
|
2497
|
+
n.direction === "neutral" && /* @__PURE__ */ Q(mt, { className: "h-3 w-3 mr-1" }),
|
|
2461
2498
|
n.value,
|
|
2462
2499
|
"%"
|
|
2463
2500
|
]
|
|
@@ -2467,21 +2504,21 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2467
2504
|
})]
|
|
2468
2505
|
})] }) })]
|
|
2469
2506
|
});
|
|
2470
|
-
},
|
|
2471
|
-
let _ = n ?
|
|
2472
|
-
return /* @__PURE__ */ $(
|
|
2507
|
+
}, ar = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, schema: l, bind: u, events: d, props: f, ariaLabel: p, ariaDescribedBy: m, dataSource: h, ...g }) => {
|
|
2508
|
+
let _ = n ? Qe(n) : null, { language: v } = q();
|
|
2509
|
+
return /* @__PURE__ */ $(we, {
|
|
2473
2510
|
className: Z("h-full", o),
|
|
2474
2511
|
...g,
|
|
2475
|
-
children: [/* @__PURE__ */ $(
|
|
2512
|
+
children: [/* @__PURE__ */ $(Ee, {
|
|
2476
2513
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
2477
|
-
children: [/* @__PURE__ */ Q(
|
|
2514
|
+
children: [/* @__PURE__ */ Q(De, {
|
|
2478
2515
|
className: "text-sm font-medium",
|
|
2479
|
-
children:
|
|
2516
|
+
children: U(e, v)
|
|
2480
2517
|
}), _ && /* @__PURE__ */ Q(_, { className: "h-4 w-4 text-muted-foreground" })]
|
|
2481
|
-
}), /* @__PURE__ */ Q(
|
|
2518
|
+
}), /* @__PURE__ */ Q(Te, { children: s ? /* @__PURE__ */ $("div", {
|
|
2482
2519
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2483
2520
|
"data-testid": "metric-card-loading",
|
|
2484
|
-
children: [/* @__PURE__ */ Q(
|
|
2521
|
+
children: [/* @__PURE__ */ Q(pt, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
2485
2522
|
className: "text-sm",
|
|
2486
2523
|
children: "Loading…"
|
|
2487
2524
|
})]
|
|
@@ -2489,11 +2526,11 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2489
2526
|
className: "flex items-center gap-2",
|
|
2490
2527
|
"data-testid": "metric-card-error",
|
|
2491
2528
|
role: "alert",
|
|
2492
|
-
children: [/* @__PURE__ */ Q(
|
|
2529
|
+
children: [/* @__PURE__ */ Q(et, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
2493
2530
|
className: "text-xs text-destructive truncate",
|
|
2494
2531
|
children: c
|
|
2495
2532
|
})]
|
|
2496
|
-
}) : /* @__PURE__ */ $(
|
|
2533
|
+
}) : /* @__PURE__ */ $(It, { children: [/* @__PURE__ */ Q("div", {
|
|
2497
2534
|
className: "text-2xl font-bold",
|
|
2498
2535
|
children: t
|
|
2499
2536
|
}), (r || i || a) && /* @__PURE__ */ $("p", {
|
|
@@ -2501,47 +2538,47 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2501
2538
|
children: [r && i && /* @__PURE__ */ $("span", {
|
|
2502
2539
|
className: Z("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
|
|
2503
2540
|
children: [
|
|
2504
|
-
r === "up" && /* @__PURE__ */ Q(
|
|
2505
|
-
r === "down" && /* @__PURE__ */ Q(
|
|
2506
|
-
r === "neutral" && /* @__PURE__ */ Q(
|
|
2541
|
+
r === "up" && /* @__PURE__ */ Q(rt, { className: "h-3 w-3 mr-1" }),
|
|
2542
|
+
r === "down" && /* @__PURE__ */ Q(nt, { className: "h-3 w-3 mr-1" }),
|
|
2543
|
+
r === "neutral" && /* @__PURE__ */ Q(mt, { className: "h-3 w-3 mr-1" }),
|
|
2507
2544
|
i
|
|
2508
2545
|
]
|
|
2509
|
-
}),
|
|
2546
|
+
}), U(a, v)]
|
|
2510
2547
|
})] }) })]
|
|
2511
2548
|
});
|
|
2512
|
-
},
|
|
2513
|
-
let D = a(
|
|
2549
|
+
}, or = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: c, trend: u, icon: d, className: f, description: p, dataSource: m, colorVariant: h, format: g, currency: _, prefix: v, suffix: y, invert: b, drillDown: x, title: S, compareTo: C, t: T, variant: E }) => {
|
|
2550
|
+
let D = a(de), O = m || D?.dataSource, [k, A] = l(!1), [j, M] = l(null), [ee, ne] = l(null), [re, N] = l(!1), [P, ie] = l(null), [ae, oe] = l(null);
|
|
2514
2551
|
o(() => {
|
|
2515
2552
|
let t = !0;
|
|
2516
|
-
if (!(!
|
|
2517
|
-
t &&
|
|
2553
|
+
if (!(!O || !e || typeof O.getObjectSchema != "function")) return O.getObjectSchema(e).then((e) => {
|
|
2554
|
+
t && oe(e);
|
|
2518
2555
|
}).catch(() => {}), () => {
|
|
2519
2556
|
t = !1;
|
|
2520
2557
|
};
|
|
2521
|
-
}, [
|
|
2522
|
-
let
|
|
2558
|
+
}, [O, e]);
|
|
2559
|
+
let F = s(() => {
|
|
2523
2560
|
let e = t?.field;
|
|
2524
|
-
if (!e || !
|
|
2525
|
-
let n =
|
|
2561
|
+
if (!e || !ae?.fields) return null;
|
|
2562
|
+
let n = ae.fields;
|
|
2526
2563
|
return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
|
|
2527
|
-
}, [
|
|
2564
|
+
}, [ae, t?.field]), se = s(() => {
|
|
2528
2565
|
if (g) return g;
|
|
2529
|
-
if (
|
|
2530
|
-
if (
|
|
2531
|
-
let e =
|
|
2566
|
+
if (F) {
|
|
2567
|
+
if (F.type === "currency") {
|
|
2568
|
+
let e = F.scale ?? 0;
|
|
2532
2569
|
return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
|
|
2533
2570
|
}
|
|
2534
|
-
if (
|
|
2535
|
-
if (
|
|
2571
|
+
if (F.type === "percent") return "0,0%";
|
|
2572
|
+
if (F.type === "number" || F.type === "integer") return "0,0";
|
|
2536
2573
|
}
|
|
2537
|
-
}, [g,
|
|
2574
|
+
}, [g, F]), { currency: ce } = K(), { language: L } = q(), R = s(() => {
|
|
2538
2575
|
if (_) return _;
|
|
2539
|
-
if (
|
|
2576
|
+
if (F?.type === "currency") return xe(F, ce);
|
|
2540
2577
|
}, [
|
|
2541
2578
|
_,
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
]),
|
|
2579
|
+
F,
|
|
2580
|
+
ce
|
|
2581
|
+
]), z = s(() => t ? JSON.stringify(t) : "", [t]), V = he(), H = s(() => le(n, V), [n, V]), fe = s(() => H ? JSON.stringify(H) : "", [H]), pe = s(() => C ? JSON.stringify(C) : "", [C]), me = i(async (n, r) => {
|
|
2545
2582
|
if (t && typeof n.aggregate == "function") {
|
|
2546
2583
|
let i = await n.aggregate(e, {
|
|
2547
2584
|
field: t.field,
|
|
@@ -2562,43 +2599,43 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2562
2599
|
return (Array.isArray(t) ? t : t?.data || t?.records || []).length;
|
|
2563
2600
|
}
|
|
2564
2601
|
return null;
|
|
2565
|
-
}, [e,
|
|
2602
|
+
}, [e, z]), ge = i(async (t, r) => {
|
|
2566
2603
|
if (!(!t || !e)) {
|
|
2567
|
-
r.current && (
|
|
2604
|
+
r.current && (N(!0), ie(null));
|
|
2568
2605
|
try {
|
|
2569
|
-
let e =
|
|
2606
|
+
let e = C ? ue(n, C) : null, [i, a] = await Promise.all([me(t, H), e ? me(t, e) : Promise.resolve(null)]);
|
|
2570
2607
|
if (i === null) return;
|
|
2571
|
-
r.current && (
|
|
2608
|
+
r.current && (M(i), ne(typeof a == "number" && Number.isFinite(a) ? a : null));
|
|
2572
2609
|
} catch (e) {
|
|
2573
|
-
console.error("[ObjectMetricWidget] Fetch error:", e), r.current &&
|
|
2610
|
+
console.error("[ObjectMetricWidget] Fetch error:", e), r.current && ie(e instanceof Error ? e.message : "Failed to load metric");
|
|
2574
2611
|
} finally {
|
|
2575
|
-
r.current &&
|
|
2612
|
+
r.current && N(!1);
|
|
2576
2613
|
}
|
|
2577
2614
|
}
|
|
2578
2615
|
}, [
|
|
2579
2616
|
e,
|
|
2617
|
+
z,
|
|
2580
2618
|
fe,
|
|
2581
|
-
H,
|
|
2582
2619
|
pe,
|
|
2583
|
-
|
|
2620
|
+
me
|
|
2584
2621
|
]);
|
|
2585
2622
|
o(() => {
|
|
2586
2623
|
let t = { current: !0 };
|
|
2587
|
-
return
|
|
2624
|
+
return O && e ? ge(O, t) : (M(null), ie(null)), () => {
|
|
2588
2625
|
t.current = !1;
|
|
2589
2626
|
};
|
|
2590
2627
|
}, [
|
|
2591
|
-
|
|
2628
|
+
O,
|
|
2592
2629
|
e,
|
|
2593
|
-
|
|
2630
|
+
ge
|
|
2594
2631
|
]);
|
|
2595
|
-
let
|
|
2596
|
-
|
|
2597
|
-
let
|
|
2598
|
-
if (!
|
|
2599
|
-
let e =
|
|
2632
|
+
let _e = j === null ? O ? "—" : c ?? "—" : j;
|
|
2633
|
+
b && typeof _e == "number" && isFinite(_e) && _e >= 0 && _e <= 1 && (_e = 1 - _e);
|
|
2634
|
+
let ve = s(() => {
|
|
2635
|
+
if (!C || typeof j != "number" || !Number.isFinite(j) || ee === null) return;
|
|
2636
|
+
let e = Ht(j, ee);
|
|
2600
2637
|
if (!e) return;
|
|
2601
|
-
let t =
|
|
2638
|
+
let t = w(C, n), r = `dashboard.trend.${t}`, i = {
|
|
2602
2639
|
vsPreviousPeriod: "vs previous period",
|
|
2603
2640
|
vsLastWeek: "vs last week",
|
|
2604
2641
|
vsLastMonth: "vs last month",
|
|
@@ -2612,41 +2649,42 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2612
2649
|
label: a
|
|
2613
2650
|
};
|
|
2614
2651
|
}, [
|
|
2615
|
-
|
|
2616
|
-
|
|
2652
|
+
C,
|
|
2653
|
+
j,
|
|
2617
2654
|
ee,
|
|
2618
2655
|
n,
|
|
2619
2656
|
T
|
|
2620
|
-
]) ?? u,
|
|
2621
|
-
let e =
|
|
2622
|
-
return
|
|
2657
|
+
]) ?? u, ye = te(x) && !!e && !!O, be = s(() => {
|
|
2658
|
+
let e = U(r, L), t = U(S, L);
|
|
2659
|
+
return I(x, {}, t || e || "Details");
|
|
2623
2660
|
}, [
|
|
2624
|
-
|
|
2661
|
+
x,
|
|
2625
2662
|
r,
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2663
|
+
S,
|
|
2664
|
+
L
|
|
2665
|
+
]), W = s(() => {
|
|
2666
|
+
if (!ye) return null;
|
|
2667
|
+
let t = x?.target ?? "drawer", n = x?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Q(gn, {
|
|
2630
2668
|
objectName: e,
|
|
2631
|
-
filter:
|
|
2632
|
-
onNavigate: () =>
|
|
2669
|
+
filter: H,
|
|
2670
|
+
onNavigate: () => A(!1)
|
|
2633
2671
|
}), a;
|
|
2634
2672
|
if (r) {
|
|
2635
|
-
let e = n.filter, t = e ?
|
|
2673
|
+
let e = n.filter, t = e ? H ? { $and: [e, H] } : e : H, r = {
|
|
2636
2674
|
type: "spec-report",
|
|
2637
2675
|
...n,
|
|
2638
2676
|
filter: t
|
|
2639
2677
|
};
|
|
2640
2678
|
a = /* @__PURE__ */ Q("div", {
|
|
2641
2679
|
className: "h-full overflow-auto",
|
|
2642
|
-
children: /* @__PURE__ */ Q(
|
|
2680
|
+
children: /* @__PURE__ */ Q(B, { schema: r })
|
|
2643
2681
|
});
|
|
2644
2682
|
} else a = /* @__PURE__ */ Q("div", {
|
|
2645
2683
|
className: "h-full overflow-auto",
|
|
2646
|
-
children: /* @__PURE__ */ Q(
|
|
2684
|
+
children: /* @__PURE__ */ Q(B, { schema: {
|
|
2647
2685
|
type: "object-data-table",
|
|
2648
2686
|
objectName: e,
|
|
2649
|
-
filter:
|
|
2687
|
+
filter: H,
|
|
2650
2688
|
pageSize: 25,
|
|
2651
2689
|
drillDown: {
|
|
2652
2690
|
enabled: !0,
|
|
@@ -2655,25 +2693,25 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2655
2693
|
}
|
|
2656
2694
|
} })
|
|
2657
2695
|
});
|
|
2658
|
-
return t === "dialog" ? /* @__PURE__ */ Q(
|
|
2696
|
+
return t === "dialog" ? /* @__PURE__ */ Q(Ne, {
|
|
2659
2697
|
open: !0,
|
|
2660
|
-
onOpenChange: (e) => !e &&
|
|
2661
|
-
children: /* @__PURE__ */ $(
|
|
2698
|
+
onOpenChange: (e) => !e && A(!1),
|
|
2699
|
+
children: /* @__PURE__ */ $(Pe, {
|
|
2662
2700
|
className: "max-w-5xl",
|
|
2663
|
-
children: [/* @__PURE__ */ $(
|
|
2701
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
2664
2702
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
2665
|
-
children: [/* @__PURE__ */ Q(
|
|
2703
|
+
children: [/* @__PURE__ */ Q(Ie, { children: be }), i]
|
|
2666
2704
|
}), a]
|
|
2667
2705
|
})
|
|
2668
|
-
}) : /* @__PURE__ */ Q(
|
|
2706
|
+
}) : /* @__PURE__ */ Q(Je, {
|
|
2669
2707
|
open: !0,
|
|
2670
|
-
onOpenChange: (e) => !e &&
|
|
2671
|
-
children: /* @__PURE__ */ $(
|
|
2708
|
+
onOpenChange: (e) => !e && A(!1),
|
|
2709
|
+
children: /* @__PURE__ */ $(Ye, {
|
|
2672
2710
|
side: "right",
|
|
2673
2711
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
|
|
2674
|
-
children: [/* @__PURE__ */ $(
|
|
2712
|
+
children: [/* @__PURE__ */ $(Xe, {
|
|
2675
2713
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
2676
|
-
children: [/* @__PURE__ */ Q(
|
|
2714
|
+
children: [/* @__PURE__ */ Q(Ze, { children: be }), i]
|
|
2677
2715
|
}), /* @__PURE__ */ Q("div", {
|
|
2678
2716
|
className: "flex-1 overflow-hidden mt-2",
|
|
2679
2717
|
children: a
|
|
@@ -2681,39 +2719,39 @@ var Xn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2681
2719
|
})
|
|
2682
2720
|
});
|
|
2683
2721
|
}, [
|
|
2684
|
-
|
|
2685
|
-
|
|
2722
|
+
ye,
|
|
2723
|
+
x,
|
|
2686
2724
|
e,
|
|
2687
|
-
|
|
2688
|
-
|
|
2725
|
+
H,
|
|
2726
|
+
be
|
|
2689
2727
|
]);
|
|
2690
|
-
return /* @__PURE__ */ $(
|
|
2728
|
+
return /* @__PURE__ */ $(It, { children: [/* @__PURE__ */ Q(ir, {
|
|
2691
2729
|
label: r,
|
|
2692
|
-
value:
|
|
2693
|
-
trend:
|
|
2730
|
+
value: _e,
|
|
2731
|
+
trend: ve,
|
|
2694
2732
|
icon: d,
|
|
2695
2733
|
className: f,
|
|
2696
2734
|
description: p,
|
|
2697
|
-
loading:
|
|
2698
|
-
error:
|
|
2735
|
+
loading: re,
|
|
2736
|
+
error: P,
|
|
2699
2737
|
colorVariant: h,
|
|
2700
|
-
format:
|
|
2701
|
-
currency:
|
|
2738
|
+
format: se,
|
|
2739
|
+
currency: R,
|
|
2702
2740
|
prefix: v,
|
|
2703
|
-
suffix:
|
|
2741
|
+
suffix: y,
|
|
2704
2742
|
variant: E,
|
|
2705
|
-
onClick:
|
|
2706
|
-
}),
|
|
2743
|
+
onClick: ye ? () => A(!0) : void 0
|
|
2744
|
+
}), k && W] });
|
|
2707
2745
|
};
|
|
2708
2746
|
//#endregion
|
|
2709
2747
|
//#region src/PivotTable.tsx
|
|
2710
|
-
function
|
|
2711
|
-
return
|
|
2748
|
+
function sr() {
|
|
2749
|
+
return J()("dashboard.total", "Total");
|
|
2712
2750
|
}
|
|
2713
|
-
function
|
|
2714
|
-
return
|
|
2751
|
+
function cr() {
|
|
2752
|
+
return J()("dashboard.noDataAvailable", "No data available");
|
|
2715
2753
|
}
|
|
2716
|
-
function
|
|
2754
|
+
function lr(e, t) {
|
|
2717
2755
|
if (!t) return String(e);
|
|
2718
2756
|
let n = "", r = !1, i, a = t, o = a.match(/^([^0-9.,#]*)/);
|
|
2719
2757
|
if (o && o[1]) {
|
|
@@ -2730,18 +2768,18 @@ function tr(e, t) {
|
|
|
2730
2768
|
}
|
|
2731
2769
|
return n + l + c;
|
|
2732
2770
|
}
|
|
2733
|
-
var
|
|
2734
|
-
function
|
|
2735
|
-
return e === "" ?
|
|
2771
|
+
var ur = "—";
|
|
2772
|
+
function dr(e, t) {
|
|
2773
|
+
return e === "" ? ur : t?.[e] ?? e;
|
|
2736
2774
|
}
|
|
2737
|
-
var
|
|
2775
|
+
var fr = Object.freeze([]), pr = /* @__PURE__ */ new Set([
|
|
2738
2776
|
"sum",
|
|
2739
2777
|
"count",
|
|
2740
2778
|
"avg",
|
|
2741
2779
|
"min",
|
|
2742
2780
|
"max"
|
|
2743
2781
|
]);
|
|
2744
|
-
function
|
|
2782
|
+
function mr(e, t) {
|
|
2745
2783
|
if (e.length === 0) return 0;
|
|
2746
2784
|
switch (t) {
|
|
2747
2785
|
case "sum": return e.reduce((e, t) => e + t, 0);
|
|
@@ -2752,8 +2790,8 @@ function ar(e, t) {
|
|
|
2752
2790
|
default: return NaN;
|
|
2753
2791
|
}
|
|
2754
2792
|
}
|
|
2755
|
-
var
|
|
2756
|
-
let { title: o, rowField: c, columnField: l, valueField: u, aggregation: d = "sum", data: f =
|
|
2793
|
+
var hr = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
|
|
2794
|
+
let { title: o, rowField: c, columnField: l, valueField: u, aggregation: d = "sum", data: f = fr, showRowTotals: p = !1, showColumnTotals: m = !1, format: h, columnColors: g, drillDown: _ } = e, v = sr(), y = cr(), b = te(_) && typeof a == "function", x = (e) => {
|
|
2757
2795
|
b && a({
|
|
2758
2796
|
...e,
|
|
2759
2797
|
rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
|
|
@@ -2761,7 +2799,7 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2761
2799
|
});
|
|
2762
2800
|
}, S = (e) => (t) => {
|
|
2763
2801
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
|
|
2764
|
-
}, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f :
|
|
2802
|
+
}, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(f) ? f : fr, { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = s(() => {
|
|
2765
2803
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
|
|
2766
2804
|
for (let r of w) {
|
|
2767
2805
|
let i = String(r[c] ?? ""), a = String(r[l] ?? ""), o = Number(r[u]) || 0;
|
|
@@ -2772,10 +2810,10 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2772
2810
|
a[e] = {};
|
|
2773
2811
|
let t = [];
|
|
2774
2812
|
for (let r of i) {
|
|
2775
|
-
let i = n[e]?.[r] ?? [], o =
|
|
2813
|
+
let i = n[e]?.[r] ?? [], o = mr(i, d);
|
|
2776
2814
|
a[e][r] = o, t.push(...i), !s[r] && s[r];
|
|
2777
2815
|
}
|
|
2778
|
-
o[e] =
|
|
2816
|
+
o[e] = mr(t, d);
|
|
2779
2817
|
}
|
|
2780
2818
|
for (let e of i) {
|
|
2781
2819
|
let t = [];
|
|
@@ -2783,7 +2821,7 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2783
2821
|
let r = n[i]?.[e] ?? [];
|
|
2784
2822
|
t.push(...r);
|
|
2785
2823
|
}
|
|
2786
|
-
s[e] =
|
|
2824
|
+
s[e] = mr(t, d);
|
|
2787
2825
|
}
|
|
2788
2826
|
let f = [];
|
|
2789
2827
|
for (let e of w) f.push(Number(e[u]) || 0);
|
|
@@ -2793,7 +2831,7 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2793
2831
|
matrix: a,
|
|
2794
2832
|
rowTotals: o,
|
|
2795
2833
|
colTotals: s,
|
|
2796
|
-
grandTotal:
|
|
2834
|
+
grandTotal: mr(f, d)
|
|
2797
2835
|
};
|
|
2798
2836
|
}, [
|
|
2799
2837
|
w,
|
|
@@ -2801,13 +2839,13 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2801
2839
|
l,
|
|
2802
2840
|
u,
|
|
2803
2841
|
d
|
|
2804
|
-
]),
|
|
2805
|
-
return
|
|
2842
|
+
]), j = (e) => lr(e, h);
|
|
2843
|
+
return pr.has(d) ? w.length === 0 ? /* @__PURE__ */ $("div", {
|
|
2806
2844
|
className: Z("overflow-auto", t),
|
|
2807
2845
|
children: [o && /* @__PURE__ */ Q("h3", {
|
|
2808
2846
|
className: "text-sm font-semibold mb-2",
|
|
2809
2847
|
children: o
|
|
2810
|
-
}), /* @__PURE__ */ Q(
|
|
2848
|
+
}), /* @__PURE__ */ Q(Me, {
|
|
2811
2849
|
"data-testid": "pivot-empty-state",
|
|
2812
2850
|
className: "py-8 gap-2 [&>h3]:hidden",
|
|
2813
2851
|
icon: /* @__PURE__ */ $("svg", {
|
|
@@ -2879,7 +2917,7 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2879
2917
|
onClick: b ? t : void 0,
|
|
2880
2918
|
onKeyDown: b ? S(t) : void 0,
|
|
2881
2919
|
"aria-label": b ? `Drill into ${l}: ${e || "(empty)"}` : void 0,
|
|
2882
|
-
children:
|
|
2920
|
+
children: dr(e, r)
|
|
2883
2921
|
}, e);
|
|
2884
2922
|
}),
|
|
2885
2923
|
p && /* @__PURE__ */ Q("th", {
|
|
@@ -2904,7 +2942,7 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2904
2942
|
rowKey: e
|
|
2905
2943
|
})) : void 0,
|
|
2906
2944
|
"aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
|
|
2907
|
-
children:
|
|
2945
|
+
children: dr(e, n)
|
|
2908
2946
|
}),
|
|
2909
2947
|
E.map((t) => {
|
|
2910
2948
|
let n = D[e]?.[t] ?? 0, r = () => x({
|
|
@@ -2920,7 +2958,7 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2920
2958
|
onClick: b ? r : void 0,
|
|
2921
2959
|
onKeyDown: b ? S(r) : void 0,
|
|
2922
2960
|
"aria-label": b ? `Drill into ${c}=${e || "(empty)"}, ${l}=${t || "(empty)"}` : void 0,
|
|
2923
|
-
children:
|
|
2961
|
+
children: j(n)
|
|
2924
2962
|
}, t);
|
|
2925
2963
|
}),
|
|
2926
2964
|
p && /* @__PURE__ */ Q("td", {
|
|
@@ -2930,14 +2968,14 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2930
2968
|
onClick: b ? () => x({
|
|
2931
2969
|
scope: "row",
|
|
2932
2970
|
rowKey: e,
|
|
2933
|
-
value:
|
|
2971
|
+
value: O[e] ?? 0
|
|
2934
2972
|
}) : void 0,
|
|
2935
2973
|
onKeyDown: b ? S(() => x({
|
|
2936
2974
|
scope: "row",
|
|
2937
2975
|
rowKey: e,
|
|
2938
|
-
value:
|
|
2976
|
+
value: O[e] ?? 0
|
|
2939
2977
|
})) : void 0,
|
|
2940
|
-
children:
|
|
2978
|
+
children: j(O[e] ?? 0)
|
|
2941
2979
|
})
|
|
2942
2980
|
]
|
|
2943
2981
|
}, e)) }),
|
|
@@ -2955,14 +2993,14 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2955
2993
|
onClick: b ? () => x({
|
|
2956
2994
|
scope: "column",
|
|
2957
2995
|
colKey: e,
|
|
2958
|
-
value:
|
|
2996
|
+
value: k[e] ?? 0
|
|
2959
2997
|
}) : void 0,
|
|
2960
2998
|
onKeyDown: b ? S(() => x({
|
|
2961
2999
|
scope: "column",
|
|
2962
3000
|
colKey: e,
|
|
2963
|
-
value:
|
|
3001
|
+
value: k[e] ?? 0
|
|
2964
3002
|
})) : void 0,
|
|
2965
|
-
children:
|
|
3003
|
+
children: j(k[e] ?? 0)
|
|
2966
3004
|
}, e)),
|
|
2967
3005
|
p && /* @__PURE__ */ Q("td", {
|
|
2968
3006
|
className: Z("text-right p-2 tabular-nums font-bold", C),
|
|
@@ -2970,13 +3008,13 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2970
3008
|
tabIndex: b ? 0 : void 0,
|
|
2971
3009
|
onClick: b ? () => x({
|
|
2972
3010
|
scope: "total",
|
|
2973
|
-
value:
|
|
3011
|
+
value: A
|
|
2974
3012
|
}) : void 0,
|
|
2975
3013
|
onKeyDown: b ? S(() => x({
|
|
2976
3014
|
scope: "total",
|
|
2977
|
-
value:
|
|
3015
|
+
value: A
|
|
2978
3016
|
})) : void 0,
|
|
2979
|
-
children:
|
|
3017
|
+
children: j(A)
|
|
2980
3018
|
})
|
|
2981
3019
|
]
|
|
2982
3020
|
}) })
|
|
@@ -2998,17 +3036,15 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2998
3036
|
String(d),
|
|
2999
3037
|
"” — this pivot table renders",
|
|
3000
3038
|
" ",
|
|
3001
|
-
[...
|
|
3039
|
+
[...pr].join(", "),
|
|
3002
3040
|
"."
|
|
3003
3041
|
]
|
|
3004
3042
|
})
|
|
3005
3043
|
})]
|
|
3006
3044
|
});
|
|
3007
|
-
},
|
|
3008
|
-
let r = a(
|
|
3045
|
+
}, gr = Object.freeze([]), _r = ({ schema: e, dataSource: t, className: n }) => {
|
|
3046
|
+
let r = a(de), i = t || r?.dataSource, s = H(e.bind), [c, u] = l([]), [d, f] = l(!1), [p, m] = l(null), [h, g] = l({}), [_, v] = l({}), [y, b] = l(null), { fieldLabel: x, fieldOptionLabel: S } = Se();
|
|
3009
3047
|
o(() => {
|
|
3010
|
-
E.current = C, D.current = T;
|
|
3011
|
-
}, [C, T]), o(() => {
|
|
3012
3048
|
if (!i || !e.objectName) return;
|
|
3013
3049
|
let t = i.getObjectSchema;
|
|
3014
3050
|
if (typeof t != "function") return;
|
|
@@ -3018,39 +3054,44 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3018
3054
|
let r = e.objectName, i = {}, a = {};
|
|
3019
3055
|
for (let [e, n] of Object.entries(t.fields)) {
|
|
3020
3056
|
let t = n?.label ? String(n.label) : e;
|
|
3021
|
-
a[e] =
|
|
3057
|
+
a[e] = x(r, e, t);
|
|
3022
3058
|
let o = n?.options;
|
|
3023
3059
|
if (Array.isArray(o) && o.length > 0) {
|
|
3024
3060
|
let t = {};
|
|
3025
3061
|
for (let n of o) if (n && n.value !== void 0 && n.label !== void 0) {
|
|
3026
3062
|
let i = String(n.value), a = String(n.label);
|
|
3027
|
-
t[i] =
|
|
3063
|
+
t[i] = S(r, e, i, a);
|
|
3028
3064
|
}
|
|
3029
3065
|
Object.keys(t).length > 0 && (i[e] = t);
|
|
3030
3066
|
}
|
|
3031
3067
|
}
|
|
3032
|
-
|
|
3068
|
+
g(i), v(a);
|
|
3033
3069
|
}).catch(() => {}), () => {
|
|
3034
3070
|
n = !1;
|
|
3035
3071
|
};
|
|
3036
|
-
}, [
|
|
3037
|
-
|
|
3072
|
+
}, [
|
|
3073
|
+
i,
|
|
3074
|
+
e.objectName,
|
|
3075
|
+
x,
|
|
3076
|
+
S
|
|
3077
|
+
]);
|
|
3078
|
+
let C = he();
|
|
3038
3079
|
o(() => {
|
|
3039
3080
|
let t = !0;
|
|
3040
3081
|
return e.objectName && !s && (!e.data || e.data.length === 0) && (async () => {
|
|
3041
3082
|
if (!(!i || !e.objectName)) {
|
|
3042
|
-
t && (
|
|
3083
|
+
t && (f(!0), m(null));
|
|
3043
3084
|
try {
|
|
3044
3085
|
let n;
|
|
3045
3086
|
if (typeof i.find == "function") {
|
|
3046
|
-
let t = await i.find(e.objectName, { $filter:
|
|
3047
|
-
n =
|
|
3087
|
+
let t = await i.find(e.objectName, { $filter: le(e.filter, C) });
|
|
3088
|
+
n = k(t);
|
|
3048
3089
|
} else return;
|
|
3049
|
-
t &&
|
|
3090
|
+
t && u(n);
|
|
3050
3091
|
} catch (e) {
|
|
3051
|
-
console.error("[ObjectPivotTable] Fetch error:", e), t &&
|
|
3092
|
+
console.error("[ObjectPivotTable] Fetch error:", e), t && m(e instanceof Error ? e.message : "Failed to load data");
|
|
3052
3093
|
} finally {
|
|
3053
|
-
t &&
|
|
3094
|
+
t && f(!1);
|
|
3054
3095
|
}
|
|
3055
3096
|
}
|
|
3056
3097
|
})(), () => {
|
|
@@ -3062,10 +3103,10 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3062
3103
|
s,
|
|
3063
3104
|
e.data,
|
|
3064
3105
|
e.filter,
|
|
3065
|
-
|
|
3106
|
+
C
|
|
3066
3107
|
]);
|
|
3067
|
-
let
|
|
3068
|
-
if (
|
|
3108
|
+
let w = s || e.data || c, E = Array.isArray(w) ? w : gr;
|
|
3109
|
+
if (d && E.length === 0) return /* @__PURE__ */ $("div", {
|
|
3069
3110
|
className: Z("overflow-auto", n),
|
|
3070
3111
|
"data-testid": "pivot-loading",
|
|
3071
3112
|
children: [e.title && /* @__PURE__ */ Q("h3", {
|
|
@@ -3096,7 +3137,7 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3096
3137
|
}, e))]
|
|
3097
3138
|
})]
|
|
3098
3139
|
});
|
|
3099
|
-
if (
|
|
3140
|
+
if (p) return /* @__PURE__ */ $("div", {
|
|
3100
3141
|
className: Z("overflow-auto", n),
|
|
3101
3142
|
"data-testid": "pivot-error",
|
|
3102
3143
|
children: [e.title && /* @__PURE__ */ Q("h3", {
|
|
@@ -3135,11 +3176,11 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3135
3176
|
]
|
|
3136
3177
|
}), /* @__PURE__ */ Q("p", {
|
|
3137
3178
|
className: "text-xs",
|
|
3138
|
-
children:
|
|
3179
|
+
children: p
|
|
3139
3180
|
})]
|
|
3140
3181
|
})]
|
|
3141
3182
|
});
|
|
3142
|
-
if (!i && e.objectName &&
|
|
3183
|
+
if (!i && e.objectName && E.length === 0) return /* @__PURE__ */ $("div", {
|
|
3143
3184
|
className: Z("overflow-auto", n),
|
|
3144
3185
|
children: [e.title && /* @__PURE__ */ Q("h3", {
|
|
3145
3186
|
className: "text-sm font-semibold mb-2",
|
|
@@ -3156,259 +3197,352 @@ var or = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3156
3197
|
})
|
|
3157
3198
|
})]
|
|
3158
3199
|
});
|
|
3159
|
-
let
|
|
3200
|
+
let D = {
|
|
3160
3201
|
...e,
|
|
3161
|
-
data:
|
|
3162
|
-
},
|
|
3163
|
-
return /* @__PURE__ */ $(
|
|
3164
|
-
schema:
|
|
3202
|
+
data: E
|
|
3203
|
+
}, O = e.rowField ? h[e.rowField] : void 0, A = e.columnField ? h[e.columnField] : void 0, j = e.rowField ? _[e.rowField] : void 0, M = e.drillDown, ee = te(M) ? (e) => b(e) : void 0;
|
|
3204
|
+
return /* @__PURE__ */ $(It, { children: [/* @__PURE__ */ Q(hr, {
|
|
3205
|
+
schema: D,
|
|
3165
3206
|
className: n,
|
|
3166
|
-
rowLabels:
|
|
3167
|
-
columnLabels:
|
|
3168
|
-
rowFieldLabel:
|
|
3169
|
-
onDrillDown:
|
|
3207
|
+
rowLabels: O,
|
|
3208
|
+
columnLabels: A,
|
|
3209
|
+
rowFieldLabel: j,
|
|
3210
|
+
onDrillDown: ee
|
|
3170
3211
|
}), (() => {
|
|
3171
|
-
if (!
|
|
3172
|
-
let t =
|
|
3212
|
+
if (!y || !e.objectName) return null;
|
|
3213
|
+
let t = T(M, y, {
|
|
3173
3214
|
rowField: e.rowField,
|
|
3174
3215
|
columnField: e.columnField
|
|
3175
3216
|
}), n = {
|
|
3176
3217
|
...e.filter || {},
|
|
3177
3218
|
...t
|
|
3178
|
-
}, r =
|
|
3179
|
-
return /* @__PURE__ */ Q(
|
|
3219
|
+
}, r = I(M, y, e.title || "Details");
|
|
3220
|
+
return /* @__PURE__ */ Q(_n, {
|
|
3180
3221
|
open: !0,
|
|
3181
|
-
onClose: () =>
|
|
3222
|
+
onClose: () => b(null),
|
|
3182
3223
|
title: r,
|
|
3183
|
-
target:
|
|
3224
|
+
target: M?.target ?? "drawer",
|
|
3184
3225
|
objectName: e.objectName,
|
|
3185
3226
|
filter: n,
|
|
3186
3227
|
dataSource: i,
|
|
3187
|
-
columns:
|
|
3188
|
-
maxRows:
|
|
3189
|
-
report:
|
|
3228
|
+
columns: M?.columns,
|
|
3229
|
+
maxRows: M?.maxRows,
|
|
3230
|
+
report: M?.report
|
|
3190
3231
|
});
|
|
3191
3232
|
})()] });
|
|
3192
|
-
},
|
|
3193
|
-
breadcrumb:
|
|
3194
|
-
|
|
3233
|
+
}, vr = {
|
|
3234
|
+
"dashboard.config.breadcrumb.dashboard": "Dashboard",
|
|
3235
|
+
"dashboard.config.breadcrumb.configuration": "Configuration",
|
|
3236
|
+
"dashboard.config.breadcrumb.widget": "Widget",
|
|
3237
|
+
"dashboard.config.breadcrumb.chart": "Chart",
|
|
3238
|
+
"dashboard.config.breadcrumb.table": "Table",
|
|
3239
|
+
"dashboard.config.breadcrumb.pivotTable": "Pivot table",
|
|
3240
|
+
"dashboard.config.section.general": "General",
|
|
3241
|
+
"dashboard.config.section.layout": "Layout",
|
|
3242
|
+
"dashboard.config.section.data": "Data",
|
|
3243
|
+
"dashboard.config.section.dataBinding": "Data Binding",
|
|
3244
|
+
"dashboard.config.section.appearance": "Appearance",
|
|
3245
|
+
"dashboard.config.field.title": "Title",
|
|
3246
|
+
"dashboard.config.field.description": "Description",
|
|
3247
|
+
"dashboard.config.field.columns": "Columns",
|
|
3248
|
+
"dashboard.config.field.gap": "Gap",
|
|
3249
|
+
"dashboard.config.field.rowHeight": "Row height (px)",
|
|
3250
|
+
"dashboard.config.field.autoRefresh": "Auto refresh",
|
|
3251
|
+
"dashboard.config.field.showDescription": "Show description",
|
|
3252
|
+
"dashboard.config.field.theme": "Theme",
|
|
3253
|
+
"dashboard.config.field.widgetType": "Widget type",
|
|
3254
|
+
"dashboard.config.field.colorVariant": "Color variant",
|
|
3255
|
+
"dashboard.config.field.dataset": "Dataset",
|
|
3256
|
+
"dashboard.config.field.dimensions": "Dimensions",
|
|
3257
|
+
"dashboard.config.field.values": "Values",
|
|
3258
|
+
"dashboard.config.field.width": "Width (columns)",
|
|
3259
|
+
"dashboard.config.field.height": "Height (rows)",
|
|
3260
|
+
"dashboard.config.placeholder.dashboardTitle": "Dashboard title",
|
|
3261
|
+
"dashboard.config.placeholder.dashboardDescription": "Short summary shown under the title",
|
|
3262
|
+
"dashboard.config.placeholder.widgetTitle": "Widget title",
|
|
3263
|
+
"dashboard.config.placeholder.widgetDescription": "Widget description",
|
|
3264
|
+
"dashboard.config.placeholder.datasetName": "Dataset name",
|
|
3265
|
+
"dashboard.config.placeholder.selectDataset": "Select dataset…",
|
|
3266
|
+
"dashboard.config.placeholder.searchDatasets": "Search datasets…",
|
|
3267
|
+
"dashboard.config.placeholder.addDimension": "Add dimension…",
|
|
3268
|
+
"dashboard.config.placeholder.addMeasure": "Add measure…",
|
|
3269
|
+
"dashboard.config.placeholder.searchMembers": "Search…",
|
|
3270
|
+
"dashboard.config.empty.datasets": "No datasets found.",
|
|
3271
|
+
"dashboard.config.empty.dimensions": "No dimensions selected.",
|
|
3272
|
+
"dashboard.config.empty.measures": "No measures selected.",
|
|
3273
|
+
"dashboard.config.empty.nothingToAdd": "Nothing left to add.",
|
|
3274
|
+
"dashboard.config.help.dataset": "The semantic-layer dataset this widget binds to (ADR-0021).",
|
|
3275
|
+
"dashboard.config.help.dimensions": "Group/split the values by these dataset dimensions.",
|
|
3276
|
+
"dashboard.config.help.dimensionsPivot": "Group/split fields. The last dimension spreads across as columns.",
|
|
3277
|
+
"dashboard.config.help.values": "Measure(s) from the dataset to display (at least one).",
|
|
3278
|
+
"dashboard.config.action.add": "Add",
|
|
3279
|
+
"dashboard.config.action.remove": "Remove {{name}}",
|
|
3280
|
+
"dashboard.config.refresh.off": "Off",
|
|
3281
|
+
"dashboard.config.refresh.every30s": "Every 30s",
|
|
3282
|
+
"dashboard.config.refresh.every1m": "Every 1 min",
|
|
3283
|
+
"dashboard.config.refresh.every5m": "Every 5 min",
|
|
3284
|
+
"dashboard.config.refresh.every15m": "Every 15 min",
|
|
3285
|
+
"dashboard.config.refresh.every30m": "Every 30 min",
|
|
3286
|
+
"dashboard.config.refresh.every1h": "Every 1 hour",
|
|
3287
|
+
"dashboard.config.themeOption.light": "Light",
|
|
3288
|
+
"dashboard.config.themeOption.dark": "Dark",
|
|
3289
|
+
"dashboard.config.themeOption.auto": "Auto",
|
|
3290
|
+
"dashboard.config.widgetType.metric": "Metric",
|
|
3291
|
+
"dashboard.config.widgetType.bar": "Bar Chart",
|
|
3292
|
+
"dashboard.config.widgetType.horizontalBar": "Horizontal Bar",
|
|
3293
|
+
"dashboard.config.widgetType.line": "Line Chart",
|
|
3294
|
+
"dashboard.config.widgetType.pie": "Pie Chart",
|
|
3295
|
+
"dashboard.config.widgetType.donut": "Donut Chart",
|
|
3296
|
+
"dashboard.config.widgetType.area": "Area Chart",
|
|
3297
|
+
"dashboard.config.widgetType.scatter": "Scatter Plot",
|
|
3298
|
+
"dashboard.config.widgetType.funnel": "Funnel",
|
|
3299
|
+
"dashboard.config.widgetType.table": "Table",
|
|
3300
|
+
"dashboard.config.widgetType.pivot": "Pivot Table",
|
|
3301
|
+
"dashboard.config.color.default": "Default",
|
|
3302
|
+
"dashboard.config.color.blue": "Blue",
|
|
3303
|
+
"dashboard.config.color.teal": "Teal",
|
|
3304
|
+
"dashboard.config.color.orange": "Orange",
|
|
3305
|
+
"dashboard.config.color.purple": "Purple",
|
|
3306
|
+
"dashboard.config.color.success": "Success",
|
|
3307
|
+
"dashboard.config.color.warning": "Warning",
|
|
3308
|
+
"dashboard.config.color.danger": "Danger"
|
|
3309
|
+
}, yr = ye(vr, "dashboard.config.section.general");
|
|
3310
|
+
//#endregion
|
|
3311
|
+
//#region src/DashboardConfigPanel.tsx
|
|
3312
|
+
function br(e) {
|
|
3313
|
+
return [
|
|
3195
3314
|
{
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
{
|
|
3219
|
-
key: "rowHeight",
|
|
3220
|
-
label: "Row height (px)",
|
|
3221
|
-
type: "slider",
|
|
3222
|
-
defaultValue: 120,
|
|
3223
|
-
min: 40,
|
|
3224
|
-
max: 320,
|
|
3225
|
-
step: 10
|
|
3226
|
-
}
|
|
3227
|
-
]
|
|
3315
|
+
value: "0",
|
|
3316
|
+
label: e("dashboard.config.refresh.off")
|
|
3317
|
+
},
|
|
3318
|
+
{
|
|
3319
|
+
value: "30",
|
|
3320
|
+
label: e("dashboard.config.refresh.every30s")
|
|
3321
|
+
},
|
|
3322
|
+
{
|
|
3323
|
+
value: "60",
|
|
3324
|
+
label: e("dashboard.config.refresh.every1m")
|
|
3325
|
+
},
|
|
3326
|
+
{
|
|
3327
|
+
value: "300",
|
|
3328
|
+
label: e("dashboard.config.refresh.every5m")
|
|
3329
|
+
},
|
|
3330
|
+
{
|
|
3331
|
+
value: "900",
|
|
3332
|
+
label: e("dashboard.config.refresh.every15m")
|
|
3333
|
+
},
|
|
3334
|
+
{
|
|
3335
|
+
value: "1800",
|
|
3336
|
+
label: e("dashboard.config.refresh.every30m")
|
|
3228
3337
|
},
|
|
3229
3338
|
{
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3339
|
+
value: "3600",
|
|
3340
|
+
label: e("dashboard.config.refresh.every1h")
|
|
3341
|
+
}
|
|
3342
|
+
];
|
|
3343
|
+
}
|
|
3344
|
+
function xr(e) {
|
|
3345
|
+
return [
|
|
3346
|
+
{
|
|
3347
|
+
value: "light",
|
|
3348
|
+
label: e("dashboard.config.themeOption.light")
|
|
3349
|
+
},
|
|
3350
|
+
{
|
|
3351
|
+
value: "dark",
|
|
3352
|
+
label: e("dashboard.config.themeOption.dark")
|
|
3353
|
+
},
|
|
3354
|
+
{
|
|
3355
|
+
value: "auto",
|
|
3356
|
+
label: e("dashboard.config.themeOption.auto")
|
|
3357
|
+
}
|
|
3358
|
+
];
|
|
3359
|
+
}
|
|
3360
|
+
function Sr(e) {
|
|
3361
|
+
return {
|
|
3362
|
+
breadcrumb: [e("dashboard.config.breadcrumb.dashboard"), e("dashboard.config.breadcrumb.configuration")],
|
|
3363
|
+
sections: [
|
|
3364
|
+
{
|
|
3365
|
+
key: "layout",
|
|
3366
|
+
title: e("dashboard.config.section.layout"),
|
|
3367
|
+
collapsible: !0,
|
|
3368
|
+
fields: [
|
|
3239
3369
|
{
|
|
3240
|
-
|
|
3241
|
-
label: "
|
|
3370
|
+
key: "columns",
|
|
3371
|
+
label: e("dashboard.config.field.columns"),
|
|
3372
|
+
type: "slider",
|
|
3373
|
+
defaultValue: 3,
|
|
3374
|
+
min: 1,
|
|
3375
|
+
max: 12,
|
|
3376
|
+
step: 1
|
|
3242
3377
|
},
|
|
3243
3378
|
{
|
|
3244
|
-
|
|
3245
|
-
label: "
|
|
3379
|
+
key: "gap",
|
|
3380
|
+
label: e("dashboard.config.field.gap"),
|
|
3381
|
+
type: "slider",
|
|
3382
|
+
defaultValue: 4,
|
|
3383
|
+
min: 0,
|
|
3384
|
+
max: 16,
|
|
3385
|
+
step: 1
|
|
3246
3386
|
},
|
|
3247
3387
|
{
|
|
3248
|
-
|
|
3249
|
-
label: "
|
|
3250
|
-
|
|
3388
|
+
key: "rowHeight",
|
|
3389
|
+
label: e("dashboard.config.field.rowHeight"),
|
|
3390
|
+
type: "slider",
|
|
3391
|
+
defaultValue: 120,
|
|
3392
|
+
min: 40,
|
|
3393
|
+
max: 320,
|
|
3394
|
+
step: 10
|
|
3395
|
+
}
|
|
3396
|
+
]
|
|
3397
|
+
},
|
|
3398
|
+
{
|
|
3399
|
+
key: "data",
|
|
3400
|
+
title: e("dashboard.config.section.data"),
|
|
3401
|
+
collapsible: !0,
|
|
3402
|
+
fields: [{
|
|
3403
|
+
key: "refreshInterval",
|
|
3404
|
+
label: e("dashboard.config.field.autoRefresh"),
|
|
3405
|
+
type: "select",
|
|
3406
|
+
defaultValue: "0",
|
|
3407
|
+
options: br(e)
|
|
3408
|
+
}]
|
|
3409
|
+
},
|
|
3410
|
+
{
|
|
3411
|
+
key: "appearance",
|
|
3412
|
+
title: e("dashboard.config.section.appearance"),
|
|
3413
|
+
collapsible: !0,
|
|
3414
|
+
defaultCollapsed: !0,
|
|
3415
|
+
fields: [
|
|
3251
3416
|
{
|
|
3252
|
-
|
|
3253
|
-
label: "
|
|
3417
|
+
key: "title",
|
|
3418
|
+
label: e("dashboard.config.field.title"),
|
|
3419
|
+
type: "input",
|
|
3420
|
+
placeholder: e("dashboard.config.placeholder.dashboardTitle")
|
|
3254
3421
|
},
|
|
3255
3422
|
{
|
|
3256
|
-
|
|
3257
|
-
label: "
|
|
3423
|
+
key: "description",
|
|
3424
|
+
label: e("dashboard.config.field.description"),
|
|
3425
|
+
type: "textarea",
|
|
3426
|
+
placeholder: e("dashboard.config.placeholder.dashboardDescription")
|
|
3258
3427
|
},
|
|
3259
3428
|
{
|
|
3260
|
-
|
|
3261
|
-
label: "
|
|
3429
|
+
key: "showDescription",
|
|
3430
|
+
label: e("dashboard.config.field.showDescription"),
|
|
3431
|
+
type: "switch",
|
|
3432
|
+
defaultValue: !0
|
|
3262
3433
|
},
|
|
3263
3434
|
{
|
|
3264
|
-
|
|
3265
|
-
label: "
|
|
3435
|
+
key: "theme",
|
|
3436
|
+
label: e("dashboard.config.field.theme"),
|
|
3437
|
+
type: "select",
|
|
3438
|
+
defaultValue: "auto",
|
|
3439
|
+
options: xr(e)
|
|
3266
3440
|
}
|
|
3267
3441
|
]
|
|
3268
|
-
}
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
key: "description",
|
|
3284
|
-
label: "Description",
|
|
3285
|
-
type: "textarea",
|
|
3286
|
-
placeholder: "Short summary shown under the title"
|
|
3287
|
-
},
|
|
3288
|
-
{
|
|
3289
|
-
key: "showDescription",
|
|
3290
|
-
label: "Show description",
|
|
3291
|
-
type: "switch",
|
|
3292
|
-
defaultValue: !0
|
|
3293
|
-
},
|
|
3294
|
-
{
|
|
3295
|
-
key: "theme",
|
|
3296
|
-
label: "Theme",
|
|
3297
|
-
type: "select",
|
|
3298
|
-
defaultValue: "auto",
|
|
3299
|
-
options: [
|
|
3300
|
-
{
|
|
3301
|
-
value: "light",
|
|
3302
|
-
label: "Light"
|
|
3303
|
-
},
|
|
3304
|
-
{
|
|
3305
|
-
value: "dark",
|
|
3306
|
-
label: "Dark"
|
|
3307
|
-
},
|
|
3308
|
-
{
|
|
3309
|
-
value: "auto",
|
|
3310
|
-
label: "Auto"
|
|
3311
|
-
}
|
|
3312
|
-
]
|
|
3313
|
-
}
|
|
3314
|
-
]
|
|
3315
|
-
}
|
|
3316
|
-
]
|
|
3317
|
-
};
|
|
3318
|
-
function lr({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
3319
|
-
let { draft: a, isDirty: o, updateField: s, discard: c } = Ue(n, { onUpdate: i });
|
|
3320
|
-
return /* @__PURE__ */ Q(xe, {
|
|
3321
|
-
open: e,
|
|
3322
|
-
onClose: t,
|
|
3323
|
-
schema: cr,
|
|
3324
|
-
draft: a,
|
|
3325
|
-
isDirty: o,
|
|
3326
|
-
onFieldChange: s,
|
|
3327
|
-
onSave: () => r(a),
|
|
3328
|
-
onDiscard: c
|
|
3442
|
+
}
|
|
3443
|
+
]
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
function Cr({ open: t, onClose: n, config: r, onSave: i, onFieldChange: a }) {
|
|
3447
|
+
let { t: o } = yr(), { draft: s, isDirty: c, updateField: l, discard: u } = $e(r, { onUpdate: a }), d = e.useMemo(() => Sr(o), [o]);
|
|
3448
|
+
return /* @__PURE__ */ Q(Ae, {
|
|
3449
|
+
open: t,
|
|
3450
|
+
onClose: n,
|
|
3451
|
+
schema: d,
|
|
3452
|
+
draft: s,
|
|
3453
|
+
isDirty: c,
|
|
3454
|
+
onFieldChange: l,
|
|
3455
|
+
onSave: () => i(s),
|
|
3456
|
+
onDiscard: u
|
|
3329
3457
|
});
|
|
3330
3458
|
}
|
|
3331
3459
|
//#endregion
|
|
3332
3460
|
//#region src/WidgetConfigPanel.tsx
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
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
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3461
|
+
function wr(e) {
|
|
3462
|
+
return [
|
|
3463
|
+
{
|
|
3464
|
+
value: "metric",
|
|
3465
|
+
label: e("dashboard.config.widgetType.metric")
|
|
3466
|
+
},
|
|
3467
|
+
{
|
|
3468
|
+
value: "bar",
|
|
3469
|
+
label: e("dashboard.config.widgetType.bar")
|
|
3470
|
+
},
|
|
3471
|
+
{
|
|
3472
|
+
value: "horizontal-bar",
|
|
3473
|
+
label: e("dashboard.config.widgetType.horizontalBar")
|
|
3474
|
+
},
|
|
3475
|
+
{
|
|
3476
|
+
value: "line",
|
|
3477
|
+
label: e("dashboard.config.widgetType.line")
|
|
3478
|
+
},
|
|
3479
|
+
{
|
|
3480
|
+
value: "pie",
|
|
3481
|
+
label: e("dashboard.config.widgetType.pie")
|
|
3482
|
+
},
|
|
3483
|
+
{
|
|
3484
|
+
value: "donut",
|
|
3485
|
+
label: e("dashboard.config.widgetType.donut")
|
|
3486
|
+
},
|
|
3487
|
+
{
|
|
3488
|
+
value: "area",
|
|
3489
|
+
label: e("dashboard.config.widgetType.area")
|
|
3490
|
+
},
|
|
3491
|
+
{
|
|
3492
|
+
value: "scatter",
|
|
3493
|
+
label: e("dashboard.config.widgetType.scatter")
|
|
3494
|
+
},
|
|
3495
|
+
{
|
|
3496
|
+
value: "funnel",
|
|
3497
|
+
label: e("dashboard.config.widgetType.funnel")
|
|
3498
|
+
},
|
|
3499
|
+
{
|
|
3500
|
+
value: "table",
|
|
3501
|
+
label: e("dashboard.config.widgetType.table")
|
|
3502
|
+
},
|
|
3503
|
+
{
|
|
3504
|
+
value: "pivot",
|
|
3505
|
+
label: e("dashboard.config.widgetType.pivot")
|
|
3506
|
+
}
|
|
3507
|
+
];
|
|
3508
|
+
}
|
|
3509
|
+
function Tr(e) {
|
|
3510
|
+
return [
|
|
3511
|
+
{
|
|
3512
|
+
value: "default",
|
|
3513
|
+
label: e("dashboard.config.color.default")
|
|
3514
|
+
},
|
|
3515
|
+
{
|
|
3516
|
+
value: "blue",
|
|
3517
|
+
label: e("dashboard.config.color.blue")
|
|
3518
|
+
},
|
|
3519
|
+
{
|
|
3520
|
+
value: "teal",
|
|
3521
|
+
label: e("dashboard.config.color.teal")
|
|
3522
|
+
},
|
|
3523
|
+
{
|
|
3524
|
+
value: "orange",
|
|
3525
|
+
label: e("dashboard.config.color.orange")
|
|
3526
|
+
},
|
|
3527
|
+
{
|
|
3528
|
+
value: "purple",
|
|
3529
|
+
label: e("dashboard.config.color.purple")
|
|
3530
|
+
},
|
|
3531
|
+
{
|
|
3532
|
+
value: "success",
|
|
3533
|
+
label: e("dashboard.config.color.success")
|
|
3534
|
+
},
|
|
3535
|
+
{
|
|
3536
|
+
value: "warning",
|
|
3537
|
+
label: e("dashboard.config.color.warning")
|
|
3538
|
+
},
|
|
3539
|
+
{
|
|
3540
|
+
value: "danger",
|
|
3541
|
+
label: e("dashboard.config.color.danger")
|
|
3542
|
+
}
|
|
3543
|
+
];
|
|
3544
|
+
}
|
|
3545
|
+
var Er = [
|
|
3412
3546
|
"bar",
|
|
3413
3547
|
"horizontal-bar",
|
|
3414
3548
|
"line",
|
|
@@ -3417,24 +3551,27 @@ var ur = [
|
|
|
3417
3551
|
"donut",
|
|
3418
3552
|
"scatter",
|
|
3419
3553
|
"funnel"
|
|
3420
|
-
],
|
|
3554
|
+
], Dr = [
|
|
3421
3555
|
"metric",
|
|
3422
3556
|
"gauge",
|
|
3423
3557
|
"solid-gauge",
|
|
3424
3558
|
"kpi",
|
|
3425
3559
|
"bullet"
|
|
3426
3560
|
];
|
|
3427
|
-
function
|
|
3428
|
-
return !!e &&
|
|
3561
|
+
function Or(e) {
|
|
3562
|
+
return !!e && Er.includes(e);
|
|
3563
|
+
}
|
|
3564
|
+
function kr(e) {
|
|
3565
|
+
return !!e && !Dr.includes(e);
|
|
3429
3566
|
}
|
|
3430
|
-
function
|
|
3431
|
-
return
|
|
3567
|
+
function Ar(e, t) {
|
|
3568
|
+
return t === "pivot" ? e("dashboard.config.breadcrumb.pivotTable") : t === "table" ? e("dashboard.config.breadcrumb.table") : Or(t) ? e("dashboard.config.breadcrumb.chart") : e("dashboard.config.breadcrumb.widget");
|
|
3432
3569
|
}
|
|
3433
|
-
function
|
|
3434
|
-
let
|
|
3570
|
+
function jr({ names: t, options: n, placeholder: r, emptyText: i, onChange: a }) {
|
|
3571
|
+
let { t: o } = yr(), [s, c] = e.useState(""), l = e.useMemo(() => new Set(t), [t]), u = e.useMemo(() => n.filter((e) => !l.has(e.value)), [n, l]), d = (e) => {
|
|
3435
3572
|
let n = e.trim();
|
|
3436
|
-
!n ||
|
|
3437
|
-
},
|
|
3573
|
+
!n || l.has(n) || (a([...t, n]), c(""));
|
|
3574
|
+
}, f = (e) => a(t.filter((t) => t !== e));
|
|
3438
3575
|
return /* @__PURE__ */ $("div", {
|
|
3439
3576
|
className: "space-y-1.5",
|
|
3440
3577
|
children: [t.length === 0 ? /* @__PURE__ */ Q("p", {
|
|
@@ -3447,172 +3584,169 @@ function gr({ names: t, options: n, placeholder: r, emptyText: i, onChange: a })
|
|
|
3447
3584
|
className: Z("inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5", "font-mono text-[11px] text-foreground"),
|
|
3448
3585
|
children: [e, /* @__PURE__ */ Q("button", {
|
|
3449
3586
|
type: "button",
|
|
3450
|
-
"aria-label":
|
|
3587
|
+
"aria-label": o("dashboard.config.action.remove", { name: e }),
|
|
3451
3588
|
className: "text-muted-foreground hover:text-foreground",
|
|
3452
|
-
onClick: () =>
|
|
3453
|
-
children: /* @__PURE__ */ Q(
|
|
3589
|
+
onClick: () => f(e),
|
|
3590
|
+
children: /* @__PURE__ */ Q(yt, { className: "h-3 w-3" })
|
|
3454
3591
|
})]
|
|
3455
3592
|
}, e))
|
|
3456
|
-
}),
|
|
3457
|
-
options:
|
|
3593
|
+
}), u.length > 0 ? /* @__PURE__ */ Q(ke, {
|
|
3594
|
+
options: u,
|
|
3458
3595
|
value: "",
|
|
3459
|
-
onValueChange:
|
|
3596
|
+
onValueChange: d,
|
|
3460
3597
|
placeholder: r,
|
|
3461
|
-
searchPlaceholder: "
|
|
3462
|
-
emptyText: "
|
|
3598
|
+
searchPlaceholder: o("dashboard.config.placeholder.searchMembers"),
|
|
3599
|
+
emptyText: o("dashboard.config.empty.nothingToAdd"),
|
|
3463
3600
|
className: "h-7 w-full text-xs"
|
|
3464
3601
|
}) : /* @__PURE__ */ $("div", {
|
|
3465
3602
|
className: "flex items-center gap-1",
|
|
3466
|
-
children: [/* @__PURE__ */ Q(
|
|
3467
|
-
value:
|
|
3468
|
-
onChange: (e) =>
|
|
3603
|
+
children: [/* @__PURE__ */ Q(Re, {
|
|
3604
|
+
value: s,
|
|
3605
|
+
onChange: (e) => c(e.target.value),
|
|
3469
3606
|
onKeyDown: (e) => {
|
|
3470
|
-
e.key === "Enter" && (e.preventDefault(),
|
|
3607
|
+
e.key === "Enter" && (e.preventDefault(), d(s));
|
|
3471
3608
|
},
|
|
3472
3609
|
placeholder: r,
|
|
3473
3610
|
className: "h-7 flex-1 text-xs"
|
|
3474
|
-
}), /* @__PURE__ */ Q(
|
|
3611
|
+
}), /* @__PURE__ */ Q(Y, {
|
|
3475
3612
|
type: "button",
|
|
3476
3613
|
size: "sm",
|
|
3477
3614
|
variant: "outline",
|
|
3478
3615
|
className: "h-7 px-2 text-xs",
|
|
3479
|
-
onClick: () =>
|
|
3480
|
-
disabled: !
|
|
3481
|
-
children: "
|
|
3616
|
+
onClick: () => d(s),
|
|
3617
|
+
disabled: !s.trim(),
|
|
3618
|
+
children: o("dashboard.config.action.add")
|
|
3482
3619
|
})]
|
|
3483
3620
|
})]
|
|
3484
3621
|
});
|
|
3485
3622
|
}
|
|
3486
|
-
function
|
|
3487
|
-
let
|
|
3623
|
+
function Mr(e, t, n) {
|
|
3624
|
+
let r = t ?? [], i = r.length > 0, a = r.map((e) => ({
|
|
3488
3625
|
value: e.name,
|
|
3489
3626
|
label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
|
|
3490
|
-
})),
|
|
3627
|
+
})), o = (e) => typeof e == "string" ? r.find((t) => t.name === e) : void 0, s = e("dashboard.config.field.dataset"), c = e("dashboard.config.help.dataset"), l = i ? {
|
|
3491
3628
|
key: "dataset",
|
|
3492
|
-
label:
|
|
3629
|
+
label: s,
|
|
3493
3630
|
type: "custom",
|
|
3494
|
-
helpText:
|
|
3495
|
-
render: (
|
|
3496
|
-
label:
|
|
3631
|
+
helpText: c,
|
|
3632
|
+
render: (t, n) => /* @__PURE__ */ Q(je, {
|
|
3633
|
+
label: s,
|
|
3497
3634
|
children: /* @__PURE__ */ Q("div", {
|
|
3498
3635
|
"data-testid": "config-field-dataset",
|
|
3499
|
-
children: /* @__PURE__ */ Q(
|
|
3500
|
-
options:
|
|
3501
|
-
value:
|
|
3502
|
-
onValueChange:
|
|
3503
|
-
placeholder: "
|
|
3504
|
-
searchPlaceholder: "
|
|
3505
|
-
emptyText: "
|
|
3636
|
+
children: /* @__PURE__ */ Q(ke, {
|
|
3637
|
+
options: a,
|
|
3638
|
+
value: t ?? "",
|
|
3639
|
+
onValueChange: n,
|
|
3640
|
+
placeholder: e("dashboard.config.placeholder.selectDataset"),
|
|
3641
|
+
searchPlaceholder: e("dashboard.config.placeholder.searchDatasets"),
|
|
3642
|
+
emptyText: e("dashboard.config.empty.datasets"),
|
|
3506
3643
|
className: "h-7 w-40 text-xs"
|
|
3507
3644
|
})
|
|
3508
3645
|
})
|
|
3509
3646
|
})
|
|
3510
3647
|
} : {
|
|
3511
3648
|
key: "dataset",
|
|
3512
|
-
label:
|
|
3649
|
+
label: s,
|
|
3513
3650
|
type: "input",
|
|
3514
|
-
placeholder: "
|
|
3515
|
-
helpText:
|
|
3516
|
-
},
|
|
3651
|
+
placeholder: e("dashboard.config.placeholder.datasetName"),
|
|
3652
|
+
helpText: c
|
|
3653
|
+
}, u = e("dashboard.config.field.dimensions"), d = {
|
|
3517
3654
|
key: "dimensions",
|
|
3518
|
-
label:
|
|
3655
|
+
label: u,
|
|
3519
3656
|
type: "custom",
|
|
3520
|
-
visibleWhen: (e) =>
|
|
3521
|
-
helpText:
|
|
3522
|
-
render: (
|
|
3523
|
-
let
|
|
3657
|
+
visibleWhen: (e) => kr(e.type),
|
|
3658
|
+
helpText: e(n === "pivot" ? "dashboard.config.help.dimensionsPivot" : "dashboard.config.help.dimensions"),
|
|
3659
|
+
render: (t, n, r) => {
|
|
3660
|
+
let i = (o(r.dataset)?.dimensions ?? []).map((e) => ({
|
|
3524
3661
|
value: e.name,
|
|
3525
3662
|
label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
|
|
3526
3663
|
}));
|
|
3527
|
-
return /* @__PURE__ */ Q(
|
|
3528
|
-
label:
|
|
3664
|
+
return /* @__PURE__ */ Q(je, {
|
|
3665
|
+
label: u,
|
|
3529
3666
|
children: /* @__PURE__ */ Q("div", {
|
|
3530
3667
|
"data-testid": "config-field-dimensions",
|
|
3531
3668
|
className: "w-40",
|
|
3532
|
-
children: /* @__PURE__ */ Q(
|
|
3533
|
-
names: Array.isArray(
|
|
3534
|
-
options:
|
|
3535
|
-
placeholder: "
|
|
3536
|
-
emptyText: "
|
|
3537
|
-
onChange:
|
|
3669
|
+
children: /* @__PURE__ */ Q(jr, {
|
|
3670
|
+
names: Array.isArray(t) ? t : [],
|
|
3671
|
+
options: i,
|
|
3672
|
+
placeholder: e("dashboard.config.placeholder.addDimension"),
|
|
3673
|
+
emptyText: e("dashboard.config.empty.dimensions"),
|
|
3674
|
+
onChange: n
|
|
3675
|
+
})
|
|
3676
|
+
})
|
|
3677
|
+
});
|
|
3678
|
+
}
|
|
3679
|
+
}, f = e("dashboard.config.field.values"), p = {
|
|
3680
|
+
key: "values",
|
|
3681
|
+
label: f,
|
|
3682
|
+
type: "custom",
|
|
3683
|
+
helpText: e("dashboard.config.help.values"),
|
|
3684
|
+
render: (t, n, r) => {
|
|
3685
|
+
let i = (o(r.dataset)?.measures ?? []).map((e) => ({
|
|
3686
|
+
value: e.name,
|
|
3687
|
+
label: e.aggregate ? `${e.label ?? e.name} · ${e.aggregate}` : e.label ?? e.name
|
|
3688
|
+
}));
|
|
3689
|
+
return /* @__PURE__ */ Q(je, {
|
|
3690
|
+
label: f,
|
|
3691
|
+
children: /* @__PURE__ */ Q("div", {
|
|
3692
|
+
"data-testid": "config-field-values",
|
|
3693
|
+
className: "w-40",
|
|
3694
|
+
children: /* @__PURE__ */ Q(jr, {
|
|
3695
|
+
names: Array.isArray(t) ? t : [],
|
|
3696
|
+
options: i,
|
|
3697
|
+
placeholder: e("dashboard.config.placeholder.addMeasure"),
|
|
3698
|
+
emptyText: e("dashboard.config.empty.measures"),
|
|
3699
|
+
onChange: n
|
|
3538
3700
|
})
|
|
3539
3701
|
})
|
|
3540
3702
|
});
|
|
3541
3703
|
}
|
|
3542
3704
|
};
|
|
3543
3705
|
return {
|
|
3544
|
-
breadcrumb: ["
|
|
3545
|
-
pivot: "Pivot table",
|
|
3546
|
-
table: "Table"
|
|
3547
|
-
}[t ?? ""] ?? (mr(t) ? "Chart" : "Widget")],
|
|
3706
|
+
breadcrumb: [e("dashboard.config.breadcrumb.dashboard"), Ar(e, n)],
|
|
3548
3707
|
sections: [
|
|
3549
3708
|
{
|
|
3550
3709
|
key: "general",
|
|
3551
|
-
title: "
|
|
3710
|
+
title: e("dashboard.config.section.general"),
|
|
3552
3711
|
fields: [
|
|
3553
3712
|
{
|
|
3554
3713
|
key: "title",
|
|
3555
|
-
label: "
|
|
3714
|
+
label: e("dashboard.config.field.title"),
|
|
3556
3715
|
type: "input",
|
|
3557
|
-
placeholder: "
|
|
3716
|
+
placeholder: e("dashboard.config.placeholder.widgetTitle")
|
|
3558
3717
|
},
|
|
3559
3718
|
{
|
|
3560
3719
|
key: "description",
|
|
3561
|
-
label: "
|
|
3720
|
+
label: e("dashboard.config.field.description"),
|
|
3562
3721
|
type: "input",
|
|
3563
|
-
placeholder: "
|
|
3722
|
+
placeholder: e("dashboard.config.placeholder.widgetDescription")
|
|
3564
3723
|
},
|
|
3565
3724
|
{
|
|
3566
3725
|
key: "type",
|
|
3567
|
-
label: "
|
|
3726
|
+
label: e("dashboard.config.field.widgetType"),
|
|
3568
3727
|
type: "select",
|
|
3569
|
-
options:
|
|
3728
|
+
options: wr(e),
|
|
3570
3729
|
defaultValue: "metric"
|
|
3571
3730
|
}
|
|
3572
3731
|
]
|
|
3573
3732
|
},
|
|
3574
3733
|
{
|
|
3575
3734
|
key: "data",
|
|
3576
|
-
title: "
|
|
3735
|
+
title: e("dashboard.config.section.dataBinding"),
|
|
3577
3736
|
collapsible: !0,
|
|
3578
3737
|
fields: [
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
key: "values",
|
|
3583
|
-
label: "Values",
|
|
3584
|
-
type: "custom",
|
|
3585
|
-
helpText: "Measure(s) from the dataset to display (at least one).",
|
|
3586
|
-
render: (e, t, n) => {
|
|
3587
|
-
let r = (a(n.dataset)?.measures ?? []).map((e) => ({
|
|
3588
|
-
value: e.name,
|
|
3589
|
-
label: e.aggregate ? `${e.label ?? e.name} · ${e.aggregate}` : e.label ?? e.name
|
|
3590
|
-
}));
|
|
3591
|
-
return /* @__PURE__ */ Q(Y, {
|
|
3592
|
-
label: "Values",
|
|
3593
|
-
children: /* @__PURE__ */ Q("div", {
|
|
3594
|
-
"data-testid": "config-field-values",
|
|
3595
|
-
className: "w-40",
|
|
3596
|
-
children: /* @__PURE__ */ Q(gr, {
|
|
3597
|
-
names: Array.isArray(e) ? e : [],
|
|
3598
|
-
options: r,
|
|
3599
|
-
placeholder: "Add measure…",
|
|
3600
|
-
emptyText: "No measures selected.",
|
|
3601
|
-
onChange: t
|
|
3602
|
-
})
|
|
3603
|
-
})
|
|
3604
|
-
});
|
|
3605
|
-
}
|
|
3606
|
-
}
|
|
3738
|
+
l,
|
|
3739
|
+
d,
|
|
3740
|
+
p
|
|
3607
3741
|
]
|
|
3608
3742
|
},
|
|
3609
3743
|
{
|
|
3610
3744
|
key: "layout",
|
|
3611
|
-
title: "
|
|
3745
|
+
title: e("dashboard.config.section.layout"),
|
|
3612
3746
|
collapsible: !0,
|
|
3613
3747
|
fields: [{
|
|
3614
3748
|
key: "layoutW",
|
|
3615
|
-
label: "
|
|
3749
|
+
label: e("dashboard.config.field.width"),
|
|
3616
3750
|
type: "slider",
|
|
3617
3751
|
min: 1,
|
|
3618
3752
|
max: 12,
|
|
@@ -3620,7 +3754,7 @@ function _r(e, t) {
|
|
|
3620
3754
|
defaultValue: 1
|
|
3621
3755
|
}, {
|
|
3622
3756
|
key: "layoutH",
|
|
3623
|
-
label: "
|
|
3757
|
+
label: e("dashboard.config.field.height"),
|
|
3624
3758
|
type: "slider",
|
|
3625
3759
|
min: 1,
|
|
3626
3760
|
max: 6,
|
|
@@ -3630,34 +3764,39 @@ function _r(e, t) {
|
|
|
3630
3764
|
},
|
|
3631
3765
|
{
|
|
3632
3766
|
key: "appearance",
|
|
3633
|
-
title: "
|
|
3767
|
+
title: e("dashboard.config.section.appearance"),
|
|
3634
3768
|
collapsible: !0,
|
|
3635
3769
|
defaultCollapsed: !0,
|
|
3636
3770
|
fields: [{
|
|
3637
3771
|
key: "colorVariant",
|
|
3638
|
-
label: "
|
|
3772
|
+
label: e("dashboard.config.field.colorVariant"),
|
|
3639
3773
|
type: "select",
|
|
3640
|
-
options:
|
|
3774
|
+
options: Tr(e),
|
|
3641
3775
|
defaultValue: "default"
|
|
3642
3776
|
}]
|
|
3643
3777
|
}
|
|
3644
3778
|
]
|
|
3645
3779
|
};
|
|
3646
3780
|
}
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3781
|
+
var Nr = ["title", "description"];
|
|
3782
|
+
function Pr(e) {
|
|
3783
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
3784
|
+
}
|
|
3785
|
+
function Fr(e, t, n) {
|
|
3786
|
+
let r = e;
|
|
3787
|
+
for (let i of Nr) {
|
|
3788
|
+
let a = t?.[i];
|
|
3789
|
+
if (!Pr(a)) continue;
|
|
3790
|
+
let o = e[i];
|
|
3791
|
+
typeof o == "string" && (r === e && (r = { ...e }), r[i] = o === U(a, n) ? a : W(a, n, o));
|
|
3653
3792
|
}
|
|
3654
|
-
return
|
|
3793
|
+
return r;
|
|
3655
3794
|
}
|
|
3656
|
-
var
|
|
3795
|
+
var Ir = [
|
|
3657
3796
|
"actionUrl",
|
|
3658
3797
|
"actionType",
|
|
3659
3798
|
"actionIcon"
|
|
3660
|
-
],
|
|
3799
|
+
], Lr = [
|
|
3661
3800
|
"object",
|
|
3662
3801
|
"categoryField",
|
|
3663
3802
|
"categoryGranularity",
|
|
@@ -3684,33 +3823,45 @@ var yr = [
|
|
|
3684
3823
|
"searchable",
|
|
3685
3824
|
"pagination"
|
|
3686
3825
|
];
|
|
3687
|
-
function
|
|
3826
|
+
function Rr(e) {
|
|
3688
3827
|
let t = e.type, n = { ...e };
|
|
3689
|
-
for (let e of
|
|
3690
|
-
for (let e of
|
|
3691
|
-
return
|
|
3828
|
+
for (let e of Lr) delete n[e];
|
|
3829
|
+
for (let e of Ir) delete n[e];
|
|
3830
|
+
return kr(t) || delete n.dimensions, n;
|
|
3692
3831
|
}
|
|
3693
|
-
function
|
|
3694
|
-
let l = e.useMemo(() => ({
|
|
3832
|
+
function zr({ open: t, onClose: n, config: r, onSave: i, onFieldChange: a, headerExtra: o, datasets: s, datasetsLoading: c }) {
|
|
3833
|
+
let { t: l, language: u } = yr(), d = e.useMemo(() => ({
|
|
3695
3834
|
...r,
|
|
3696
|
-
title: typeof r.title == "object" ?
|
|
3697
|
-
description: typeof r.description == "object" ?
|
|
3698
|
-
}), [r
|
|
3699
|
-
|
|
3835
|
+
title: typeof r.title == "object" ? U(r.title, u) : r.title,
|
|
3836
|
+
description: typeof r.description == "object" ? U(r.description, u) : r.description
|
|
3837
|
+
}), [r, u]), f = e.useCallback((e, t) => {
|
|
3838
|
+
if (!a) return;
|
|
3839
|
+
let n = r?.[e];
|
|
3840
|
+
a(e, Nr.includes(e) && Pr(n) && typeof t == "string" ? W(n, u, t) : t);
|
|
3841
|
+
}, [
|
|
3842
|
+
a,
|
|
3843
|
+
r,
|
|
3844
|
+
u
|
|
3845
|
+
]), { draft: p, isDirty: m, updateField: h, discard: g } = $e(d, { onUpdate: f }), _ = e.useMemo(() => Mr(l, s, p.type), [
|
|
3846
|
+
l,
|
|
3847
|
+
s,
|
|
3848
|
+
p.type
|
|
3849
|
+
]);
|
|
3850
|
+
return /* @__PURE__ */ Q(Ae, {
|
|
3700
3851
|
open: t,
|
|
3701
3852
|
onClose: n,
|
|
3702
|
-
schema:
|
|
3703
|
-
draft:
|
|
3704
|
-
isDirty:
|
|
3705
|
-
onFieldChange:
|
|
3706
|
-
onSave: () => i(
|
|
3707
|
-
onDiscard:
|
|
3853
|
+
schema: _,
|
|
3854
|
+
draft: p,
|
|
3855
|
+
isDirty: m,
|
|
3856
|
+
onFieldChange: h,
|
|
3857
|
+
onSave: () => i(Rr(Fr(p, r, u))),
|
|
3858
|
+
onDiscard: g,
|
|
3708
3859
|
headerExtra: o
|
|
3709
3860
|
});
|
|
3710
3861
|
}
|
|
3711
3862
|
//#endregion
|
|
3712
3863
|
//#region src/DashboardWithConfig.tsx
|
|
3713
|
-
function
|
|
3864
|
+
function Br({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh: s, recordCount: c, defaultConfigOpen: u = !1, className: d, datasets: f, datasetsLoading: p }) {
|
|
3714
3865
|
let [m, h] = l(u), [g, _] = l(null), [v, y] = l(t), [b, x] = l(0);
|
|
3715
3866
|
o(() => {
|
|
3716
3867
|
y(t), x((e) => e + 1);
|
|
@@ -3768,14 +3919,14 @@ function Cr({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
3768
3919
|
className: "flex-1 min-w-0 overflow-auto relative",
|
|
3769
3920
|
children: [/* @__PURE__ */ Q("div", {
|
|
3770
3921
|
className: "absolute top-2 right-2 z-10",
|
|
3771
|
-
children: /* @__PURE__ */ $(
|
|
3922
|
+
children: /* @__PURE__ */ $(Y, {
|
|
3772
3923
|
size: "sm",
|
|
3773
3924
|
variant: m ? "default" : "outline",
|
|
3774
3925
|
onClick: D,
|
|
3775
3926
|
"data-testid": "dashboard-config-toggle",
|
|
3776
|
-
children: [/* @__PURE__ */ Q(
|
|
3927
|
+
children: [/* @__PURE__ */ Q(vt, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
|
|
3777
3928
|
})
|
|
3778
|
-
}), /* @__PURE__ */ Q(
|
|
3929
|
+
}), /* @__PURE__ */ Q(Yn, {
|
|
3779
3930
|
schema: v,
|
|
3780
3931
|
onRefresh: s,
|
|
3781
3932
|
recordCount: c,
|
|
@@ -3785,7 +3936,7 @@ function Cr({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
3785
3936
|
})]
|
|
3786
3937
|
}), m && /* @__PURE__ */ Q("div", {
|
|
3787
3938
|
className: "relative shrink-0",
|
|
3788
|
-
children: g && S ? /* @__PURE__ */ Q(
|
|
3939
|
+
children: g && S ? /* @__PURE__ */ Q(zr, {
|
|
3789
3940
|
open: !0,
|
|
3790
3941
|
onClose: w,
|
|
3791
3942
|
config: S,
|
|
@@ -3793,7 +3944,7 @@ function Cr({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
3793
3944
|
onFieldChange: T,
|
|
3794
3945
|
datasets: f,
|
|
3795
3946
|
datasetsLoading: p
|
|
3796
|
-
}) : /* @__PURE__ */ Q(
|
|
3947
|
+
}) : /* @__PURE__ */ Q(Cr, {
|
|
3797
3948
|
open: !0,
|
|
3798
3949
|
onClose: () => h(!1),
|
|
3799
3950
|
config: n,
|
|
@@ -3802,12 +3953,54 @@ function Cr({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
3802
3953
|
})]
|
|
3803
3954
|
});
|
|
3804
3955
|
}
|
|
3805
|
-
u.register("dashboard",
|
|
3956
|
+
u.register("dashboard", Yn, {
|
|
3806
3957
|
namespace: "view",
|
|
3807
3958
|
label: "Dashboard",
|
|
3808
3959
|
category: "Complex",
|
|
3809
3960
|
icon: "layout-dashboard",
|
|
3810
3961
|
inputs: [
|
|
3962
|
+
{
|
|
3963
|
+
name: "widgets",
|
|
3964
|
+
type: "array",
|
|
3965
|
+
label: "Widgets",
|
|
3966
|
+
description: "The widget tree — the spec’s DashboardWidget[]. Each widget binds a dataset (ADR-0021) and may carry a layout ({ x, y, w, h }) and filterBindings. When omitted the dashboard renders an empty grid."
|
|
3967
|
+
},
|
|
3968
|
+
{
|
|
3969
|
+
name: "label",
|
|
3970
|
+
type: ["string", "object"],
|
|
3971
|
+
label: "Label",
|
|
3972
|
+
description: "Display name, shown as the header title when `header` is declared — a string or an inline per-locale map such as { en, \"zh-CN\" }. Spec-canonical spelling; the legacy `title` spelling is not authoring surface."
|
|
3973
|
+
},
|
|
3974
|
+
{
|
|
3975
|
+
name: "description",
|
|
3976
|
+
type: ["string", "object"],
|
|
3977
|
+
label: "Description",
|
|
3978
|
+
description: "Header description shown under the title — a string or an inline per-locale map. Rendered only when `header` is declared and `header.showDescription` is not false."
|
|
3979
|
+
},
|
|
3980
|
+
{
|
|
3981
|
+
name: "header",
|
|
3982
|
+
type: "object",
|
|
3983
|
+
label: "Header",
|
|
3984
|
+
description: "Header block: { showTitle?, showDescription?, actions? }. Strict — the contract rejects any other key. Renders nothing (zero pixels) when everything it would show is suppressed."
|
|
3985
|
+
},
|
|
3986
|
+
{
|
|
3987
|
+
name: "globalFilters",
|
|
3988
|
+
type: "array",
|
|
3989
|
+
label: "Global Filters",
|
|
3990
|
+
description: "Dashboard-level filter bar — the spec’s GlobalFilter[]. Filter values live as dashboard variables (readable in widget expressions as page.<name>) and are AND-merged into each bound widget’s query per its filterBindings."
|
|
3991
|
+
},
|
|
3992
|
+
{
|
|
3993
|
+
name: "dateRange",
|
|
3994
|
+
type: "object",
|
|
3995
|
+
label: "Date Range",
|
|
3996
|
+
description: "Built-in date-range filter: { field?, defaultRange?, allowCustomRange? }. `defaultRange` takes the spec’s date presets plus \"custom\"; the bound field defaults to created_at."
|
|
3997
|
+
},
|
|
3998
|
+
{
|
|
3999
|
+
name: "refreshInterval",
|
|
4000
|
+
type: "number",
|
|
4001
|
+
label: "Refresh Interval",
|
|
4002
|
+
description: "Auto-refresh period in seconds. Zero or a negative value disables the timer, and it only runs when the host wires an onRefresh handler."
|
|
4003
|
+
},
|
|
3811
4004
|
{
|
|
3812
4005
|
name: "columns",
|
|
3813
4006
|
type: "number",
|
|
@@ -3830,7 +4023,7 @@ u.register("dashboard", Vn, {
|
|
|
3830
4023
|
columns: 3,
|
|
3831
4024
|
widgets: []
|
|
3832
4025
|
}
|
|
3833
|
-
}), u.register("metric",
|
|
4026
|
+
}), u.register("metric", ir, {
|
|
3834
4027
|
namespace: "plugin-dashboard",
|
|
3835
4028
|
label: "Metric Widget",
|
|
3836
4029
|
category: "Dashboard",
|
|
@@ -3843,7 +4036,7 @@ u.register("dashboard", Vn, {
|
|
|
3843
4036
|
type: "string",
|
|
3844
4037
|
label: "Value"
|
|
3845
4038
|
}]
|
|
3846
|
-
}), u.register("metric-card",
|
|
4039
|
+
}), u.register("metric-card", ar, {
|
|
3847
4040
|
namespace: "plugin-dashboard",
|
|
3848
4041
|
label: "Metric Card",
|
|
3849
4042
|
category: "Dashboard",
|
|
@@ -3899,19 +4092,19 @@ u.register("dashboard", Vn, {
|
|
|
3899
4092
|
value: "0"
|
|
3900
4093
|
}
|
|
3901
4094
|
});
|
|
3902
|
-
var
|
|
3903
|
-
u.register("object-metric", ({ schema: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
4095
|
+
var Vr = { filter: !0 }, Hr = ({ schema: e, ...t }) => /* @__PURE__ */ Q(R, {
|
|
3904
4096
|
schema: e,
|
|
3905
|
-
mapping:
|
|
4097
|
+
mapping: Vr,
|
|
3906
4098
|
dataSource: t.dataSource,
|
|
3907
4099
|
testId: "object-metric",
|
|
3908
4100
|
errorTitle: "This metric’s data source could not be resolved",
|
|
3909
|
-
children: (e) => /* @__PURE__ */ Q(
|
|
4101
|
+
children: (e) => /* @__PURE__ */ Q(or, {
|
|
3910
4102
|
...t,
|
|
3911
4103
|
objectName: e?.objectName ?? t.objectName,
|
|
3912
4104
|
filter: e?.filter ?? t.filter
|
|
3913
4105
|
})
|
|
3914
|
-
})
|
|
4106
|
+
});
|
|
4107
|
+
u.register("object-metric", Hr, {
|
|
3915
4108
|
namespace: "plugin-dashboard",
|
|
3916
4109
|
label: "Object Metric",
|
|
3917
4110
|
category: "Dashboard",
|
|
@@ -3937,10 +4130,105 @@ u.register("object-metric", ({ schema: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
|
3937
4130
|
name: "icon",
|
|
3938
4131
|
type: "string",
|
|
3939
4132
|
label: "Icon (Lucide name)"
|
|
4133
|
+
},
|
|
4134
|
+
{
|
|
4135
|
+
name: "description",
|
|
4136
|
+
type: "string",
|
|
4137
|
+
label: "Description",
|
|
4138
|
+
description: "Helper text rendered under the value."
|
|
4139
|
+
},
|
|
4140
|
+
{
|
|
4141
|
+
name: "title",
|
|
4142
|
+
type: "string",
|
|
4143
|
+
label: "Drill-down Title",
|
|
4144
|
+
description: "Heading of the drill-down panel. Defaults to `label` — set it only when the records list wants a different name from the tile."
|
|
4145
|
+
},
|
|
4146
|
+
{
|
|
4147
|
+
name: "filter",
|
|
4148
|
+
type: "array",
|
|
4149
|
+
label: "Filter",
|
|
4150
|
+
description: "Criteria the aggregation is scoped by. The same filter narrows the drill-down list, so the number and the records behind it always agree."
|
|
4151
|
+
},
|
|
4152
|
+
{
|
|
4153
|
+
name: "colorVariant",
|
|
4154
|
+
type: "enum",
|
|
4155
|
+
label: "Color Variant",
|
|
4156
|
+
enum: [
|
|
4157
|
+
"default",
|
|
4158
|
+
"blue",
|
|
4159
|
+
"teal",
|
|
4160
|
+
"orange",
|
|
4161
|
+
"purple",
|
|
4162
|
+
"success",
|
|
4163
|
+
"warning",
|
|
4164
|
+
"danger"
|
|
4165
|
+
],
|
|
4166
|
+
description: "Colour of the icon container. Semantic, not decorative: `success` / `warning` / `danger` should track what the number means."
|
|
4167
|
+
},
|
|
4168
|
+
{
|
|
4169
|
+
name: "variant",
|
|
4170
|
+
type: "enum",
|
|
4171
|
+
label: "Layout Variant",
|
|
4172
|
+
enum: ["card", "bare"],
|
|
4173
|
+
description: "`card` draws the tile’s own surface; `bare` drops it, for a metric already sitting inside a card."
|
|
4174
|
+
},
|
|
4175
|
+
{
|
|
4176
|
+
name: "format",
|
|
4177
|
+
type: "string",
|
|
4178
|
+
label: "Number Format",
|
|
4179
|
+
description: "Numeral-style format pattern, e.g. `0,0`, `$0,0`, `0%`. Use `currency` instead of hard-coding a currency symbol here."
|
|
4180
|
+
},
|
|
4181
|
+
{
|
|
4182
|
+
name: "currency",
|
|
4183
|
+
type: "string",
|
|
4184
|
+
label: "Currency Code",
|
|
4185
|
+
description: "ISO 4217 code, e.g. `USD`. Enables locale-aware currency formatting of the value."
|
|
4186
|
+
},
|
|
4187
|
+
{
|
|
4188
|
+
name: "prefix",
|
|
4189
|
+
type: "string",
|
|
4190
|
+
label: "Prefix",
|
|
4191
|
+
description: "Static text placed before the formatted value."
|
|
4192
|
+
},
|
|
4193
|
+
{
|
|
4194
|
+
name: "suffix",
|
|
4195
|
+
type: "string",
|
|
4196
|
+
label: "Suffix",
|
|
4197
|
+
description: "Static text placed after the formatted value."
|
|
4198
|
+
},
|
|
4199
|
+
{
|
|
4200
|
+
name: "invert",
|
|
4201
|
+
type: "boolean",
|
|
4202
|
+
label: "Invert",
|
|
4203
|
+
description: "Display `1 - value` — for gauges whose good direction is down, such as error rate shown as uptime."
|
|
4204
|
+
},
|
|
4205
|
+
{
|
|
4206
|
+
name: "fallbackValue",
|
|
4207
|
+
type: "string",
|
|
4208
|
+
label: "Fallback Value",
|
|
4209
|
+
description: "Value shown when no data source resolves. For static/demo tiles; a bound metric should not need it."
|
|
4210
|
+
},
|
|
4211
|
+
{
|
|
4212
|
+
name: "trend",
|
|
4213
|
+
type: "object",
|
|
4214
|
+
label: "Trend",
|
|
4215
|
+
description: "Static trend badge: `{ value, label, direction }`. Use `compareTo` instead when the trend should be computed from data."
|
|
4216
|
+
},
|
|
4217
|
+
{
|
|
4218
|
+
name: "compareTo",
|
|
4219
|
+
type: "object",
|
|
4220
|
+
label: "Compare To",
|
|
4221
|
+
description: "Period-over-period comparison, `{ kind: \"previousPeriod\" }` or `{ kind: \"previousYear\" }` — the computed alternative to a static `trend`."
|
|
4222
|
+
},
|
|
4223
|
+
{
|
|
4224
|
+
name: "drillDown",
|
|
4225
|
+
type: "object",
|
|
4226
|
+
label: "Drill Down",
|
|
4227
|
+
description: "Click-through config that opens the records behind the number."
|
|
3940
4228
|
}
|
|
3941
4229
|
],
|
|
3942
4230
|
defaultProps: { label: "Metric" }
|
|
3943
|
-
}), u.register("pivot",
|
|
4231
|
+
}), u.register("pivot", hr, {
|
|
3944
4232
|
namespace: "plugin-dashboard",
|
|
3945
4233
|
label: "Pivot Table",
|
|
3946
4234
|
category: "Dashboard",
|
|
@@ -4020,18 +4308,18 @@ u.register("object-metric", ({ schema: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
|
4020
4308
|
data: []
|
|
4021
4309
|
}
|
|
4022
4310
|
});
|
|
4023
|
-
var
|
|
4024
|
-
u.register("object-pivot", ({ schema: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
4311
|
+
var Ur = { filter: !0 }, Wr = ({ schema: e, ...t }) => /* @__PURE__ */ Q(R, {
|
|
4025
4312
|
schema: e,
|
|
4026
|
-
mapping:
|
|
4313
|
+
mapping: Ur,
|
|
4027
4314
|
dataSource: t.dataSource,
|
|
4028
4315
|
testId: "object-pivot",
|
|
4029
4316
|
errorTitle: "This pivot table’s data source could not be resolved",
|
|
4030
|
-
children: (e) => /* @__PURE__ */ Q(
|
|
4317
|
+
children: (e) => /* @__PURE__ */ Q(_r, {
|
|
4031
4318
|
...t,
|
|
4032
4319
|
schema: e
|
|
4033
4320
|
})
|
|
4034
|
-
})
|
|
4321
|
+
});
|
|
4322
|
+
u.register("object-pivot", Wr, {
|
|
4035
4323
|
namespace: "plugin-dashboard",
|
|
4036
4324
|
label: "Object Pivot Table",
|
|
4037
4325
|
category: "Dashboard",
|
|
@@ -4120,7 +4408,7 @@ u.register("object-pivot", ({ schema: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
|
4120
4408
|
valueField: "",
|
|
4121
4409
|
aggregation: "sum"
|
|
4122
4410
|
}
|
|
4123
|
-
}), u.register("dashboard-grid",
|
|
4411
|
+
}), u.register("dashboard-grid", er, {
|
|
4124
4412
|
namespace: "plugin-dashboard",
|
|
4125
4413
|
label: "Dashboard Grid (Editable)",
|
|
4126
4414
|
category: "Complex",
|
|
@@ -4138,7 +4426,7 @@ u.register("object-pivot", ({ schema: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
|
4138
4426
|
title: "Dashboard",
|
|
4139
4427
|
widgets: []
|
|
4140
4428
|
}
|
|
4141
|
-
}), u.register("object-data-table",
|
|
4429
|
+
}), u.register("object-data-table", hn, {
|
|
4142
4430
|
namespace: "plugin-dashboard",
|
|
4143
4431
|
label: "Object Data Table",
|
|
4144
4432
|
category: "Dashboard",
|
|
@@ -4176,18 +4464,15 @@ u.register("object-pivot", ({ schema: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
|
4176
4464
|
pagination: !1
|
|
4177
4465
|
}
|
|
4178
4466
|
});
|
|
4179
|
-
var
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
DashboardConfigPanel: lr,
|
|
4189
|
-
WidgetConfigPanel: Sr,
|
|
4190
|
-
DashboardWithConfig: Cr
|
|
4467
|
+
var Gr = {
|
|
4468
|
+
dashboard: Yn,
|
|
4469
|
+
metric: ir,
|
|
4470
|
+
"metric-card": ar,
|
|
4471
|
+
"object-metric": Hr,
|
|
4472
|
+
pivot: hr,
|
|
4473
|
+
"object-pivot": Wr,
|
|
4474
|
+
"dashboard-grid": er,
|
|
4475
|
+
"object-data-table": hn
|
|
4191
4476
|
};
|
|
4192
4477
|
//#endregion
|
|
4193
|
-
export {
|
|
4478
|
+
export { vr as CONFIG_PANEL_DEFAULT_TRANSLATIONS, Cr as DashboardConfigPanel, er as DashboardGridLayout, Yn as DashboardRenderer, Br as DashboardWithConfig, _n as DrillDownDrawer, ar as MetricCard, ir as MetricWidget, hn as ObjectDataTable, or as ObjectMetricWidget, _r as ObjectPivotTable, hr as PivotTable, zr as WidgetConfigPanel, Gr as dashboardComponents, yr as useConfigPanelTranslation };
|