@object-ui/plugin-dashboard 17.7.0 → 18.0.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 +525 -0
- package/README.md +56 -17
- package/dist/DashboardGridLayout.d.ts +7 -6
- package/dist/DashboardGridLayout.d.ts.map +1 -1
- package/dist/DashboardRenderer.d.ts +30 -2
- package/dist/DashboardRenderer.d.ts.map +1 -1
- package/dist/DashboardWithConfig.d.ts.map +1 -1
- package/dist/DatasetWidget.d.ts +22 -23
- package/dist/DatasetWidget.d.ts.map +1 -1
- package/dist/MetricCard.d.ts +6 -0
- package/dist/MetricCard.d.ts.map +1 -1
- package/dist/MetricWidget.d.ts +21 -4
- package/dist/MetricWidget.d.ts.map +1 -1
- package/dist/ObjectMetricWidget.d.ts.map +1 -1
- package/dist/ObjectPivotTable.d.ts +7 -6
- package/dist/ObjectPivotTable.d.ts.map +1 -1
- package/dist/RecordDetailDrawer.d.ts +13 -2
- package/dist/RecordDetailDrawer.d.ts.map +1 -1
- package/dist/chartRenderHandoff.d.ts +9 -0
- package/dist/chartRenderHandoff.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1136 -1037
- package/dist/index.umd.cjs +3 -2
- package/dist/legacyRetiredWidget.d.ts +24 -1
- package/dist/legacyRetiredWidget.d.ts.map +1 -1
- package/dist/metricTile.d.ts +87 -0
- package/dist/metricTile.d.ts.map +1 -0
- package/dist/schemaHostProps.d.ts +55 -11
- package/dist/schemaHostProps.d.ts.map +1 -1
- package/dist/utils.d.ts +24 -6
- package/dist/utils.d.ts.map +1 -1
- package/dist/widgetDispatch.d.ts +36 -6
- package/dist/widgetDispatch.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/widgetSubCaption.d.ts +0 -40
- package/dist/widgetSubCaption.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import t, { Fragment as n, forwardRef as r, useCallback as i, useContext as a, useEffect as o,
|
|
3
|
-
import { ComponentRegistry as
|
|
4
|
-
import { ElementDataSourceGate as
|
|
5
|
-
import { builtinAggregateLabels as
|
|
6
|
-
import { Button as q, Calendar as
|
|
2
|
+
import t, { Fragment as n, forwardRef as r, useCallback as i, useContext as a, useEffect as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
3
|
+
import { ComponentRegistry as d, DATE_RANGE_PRESETS as f, EXPANDABLE_FIELD_TYPES as p, FilterOperatorError as m, buildCategoryOrder as h, buildCategoryRank as g, buildChartSeries as _, buildDatasetDrillFilter as v, buildDatasetFieldHelpers as y, buildOptionColorMap as b, buildWidgetScopedFilter as x, chartCategoryKey as S, chartConfigPresentation as C, chartMeasureKey as w, chartTypeIgnoresCompareTo as T, columnHeader as E, columnIdentity as D, compareSortValues as O, compareToTrendLabelKey as k, composeDrillFilter as A, computeDrillFilter as j, dashboardFilterVariableDefs as M, deriveDimensionLabelMaps as N, dimensionOptionTranslator as ee, elementDataSourceBlock as P, extractRecords as te, findChartSeriesRow as ne, formatDimensionValue as F, formatMeasure as I, getSortValue as re, isDrillEnabled as ie, isStructuredGroupBy as ae, localizeFieldOptions as L, mergeFilters as oe, objectAggregateSpecQuery as R, pivotBucketId as se, pivotCellKey as ce, pivotDimensionValue as le, relabelDimensions as ue, resolveDashboardFilterDefs as de, resolveDrillTitle as z, resolveFilterPlaceholders as fe, shiftFilterByCompareTo as B, toDisplayDate as pe, toDomProps as me, toFilterNode as V } from "@object-ui/core";
|
|
4
|
+
import { ElementDataSourceGate as he, PageVariablesProvider as ge, SchemaRenderer as _e, SchemaRendererContext as H, classifyLoadError as ve, useActionEngine as ye, useDataInvalidation as be, useDataScope as U, useDatasetDimensionMeta as xe, useDnd as Se, useDrillNavigation as Ce, useFilterScope as we, useHasDndProvider as Te, useObjectLabel as Ee, usePageVariables as De, useResolvedDataSource as Oe, useSettledSchema as ke } from "@object-ui/react";
|
|
5
|
+
import { builtinAggregateLabels as Ae, createSafeTranslation as je, formatDisplayNumber as W, pickLocalized as G, resolveFieldCurrency as Me, setLocalized as Ne, useDisplayLocale as Pe, useLocalization as Fe, useObjectLabel as Ie, useObjectTranslation as K, useSafeFieldLabel as Le, useSafeTranslate as Re } from "@object-ui/i18n";
|
|
6
|
+
import { Button as q, Calendar as J, Card as Y, CardContent as ze, CardHeader as Be, CardTitle as Ve, ChartSkeleton as He, Combobox as Ue, ConfigPanelRenderer as We, ConfigRow as Ge, DataEmptyState as Ke, Dialog as qe, DialogContent as Je, DialogHeader as Ye, DialogTitle as Xe, EmptyValue as Ze, GridSkeleton as Qe, Input as $e, Popover as et, PopoverContent as tt, PopoverTrigger as nt, RefreshIndicator as rt, Select as it, SelectContent as at, SelectItem as ot, SelectTrigger as st, SelectValue as ct, Sheet as lt, SheetContent as ut, SheetHeader as dt, SheetTitle as ft, Skeleton as X, cn as Z, getLazyIcon as pt, useConfigDraft as mt } from "@object-ui/components";
|
|
7
7
|
import { AlertCircle as ht, AlertTriangle as gt, ArrowDownIcon as _t, ArrowUpIcon as vt, ArrowUpRight as yt, CalendarIcon as bt, ChevronDown as xt, ChevronUp as St, ChevronsUpDown as Ct, Download as wt, Edit as Tt, GripVertical as Et, Inbox as Dt, Loader2 as Ot, MinusIcon as kt, RefreshCw as At, RotateCcw as jt, Save as Mt, Settings as Nt, ShieldAlert as Pt, X as Ft } from "lucide-react";
|
|
8
8
|
import { DndContext as It, PointerSensor as Lt, closestCenter as Rt, useSensor as zt, useSensors as Bt } from "@dnd-kit/core";
|
|
9
9
|
import { SortableContext as Vt, arrayMove as Ht, rectSortingStrategy as Ut, useSortable as Wt, verticalListSortingStrategy as Gt } from "@dnd-kit/sortable";
|
|
10
10
|
import { CSS as Kt } from "@dnd-kit/utilities";
|
|
11
11
|
import { DASHBOARD_COMPONENT_WIDGET_TYPES as qt, completeWidgetLayout as Jt, defaultWidgetPlacement as Yt, normalizeTableColumnType as Xt } from "@object-ui/types";
|
|
12
|
-
import {
|
|
13
|
-
import { Fragment as
|
|
14
|
-
import { MaskedCellRenderer as
|
|
15
|
-
import { usePermissions as
|
|
16
|
-
import { ResponsiveGridLayout as
|
|
12
|
+
import { DASHBOARD_WIDGET_MULTI_MEASURE_TYPES as Zt, DashboardWidgetSchema as Qt } from "@objectstack/spec/ui";
|
|
13
|
+
import { Fragment as $t, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
14
|
+
import { MaskedCellRenderer as en, formatCurrency as tn, formatDate as nn, formatPercent as rn, getCellRenderer as an, isMaskedFieldType as on, isRetiredFieldType as sn, percentCellScale as cn, reportRetiredFieldType as ln, resolveCellRendererType as un } from "@object-ui/fields";
|
|
15
|
+
import { usePermissions as dn } from "@object-ui/permissions";
|
|
16
|
+
import { ResponsiveGridLayout as fn, useContainerWidth as pn } from "react-grid-layout";
|
|
17
17
|
import "react-grid-layout/css/styles.css";
|
|
18
|
-
import { isFilterAST as
|
|
19
|
-
import { DashboardWidgetSchema as
|
|
18
|
+
import { isFilterAST as mn, parseFilterAST as hn, resolveFieldScale as gn } from "@objectstack/spec/data";
|
|
19
|
+
import { DashboardWidgetSchema as _n } from "@object-ui/types/zod";
|
|
20
20
|
//#region src/utils.ts
|
|
21
|
-
function
|
|
21
|
+
function vn(e) {
|
|
22
22
|
return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function yn(e) {
|
|
25
25
|
return e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase());
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function bn(e, t, n, r, i) {
|
|
28
28
|
if (i && (!r || r === "value" || r === "count" || i === "count")) return e(`report.aggregate.${i}`, { defaultValue: i });
|
|
29
|
-
let a =
|
|
29
|
+
let a = yn(r);
|
|
30
30
|
return n ? t(n, r, a) : a;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function xn(e) {
|
|
33
33
|
if (!Array.isArray(e) || e.length === 0) return [];
|
|
34
34
|
let t = e[0];
|
|
35
35
|
return typeof t != "object" || !t || Array.isArray(t) ? [] : Object.keys(t).filter((e) => !e.startsWith("_")).map((e) => ({
|
|
36
|
-
header:
|
|
36
|
+
header: yn(e),
|
|
37
37
|
accessorKey: e
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Sn(e, t) {
|
|
41
41
|
if (t == null || e == null || typeof e != "number" || !Number.isFinite(e) || typeof t != "number" || !Number.isFinite(t)) return null;
|
|
42
42
|
if (t === 0) return e === 0 ? {
|
|
43
43
|
value: 0,
|
|
44
44
|
direction: "neutral"
|
|
45
45
|
} : {
|
|
46
|
-
value:
|
|
46
|
+
value: null,
|
|
47
47
|
direction: e > 0 ? "up" : "down"
|
|
48
48
|
};
|
|
49
49
|
let n = e - t;
|
|
@@ -57,22 +57,25 @@ function xn(e, t) {
|
|
|
57
57
|
direction: r > 0 ? "up" : "down"
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
function Cn(e) {
|
|
61
|
+
return e === null ? "—" : `${e}%`;
|
|
62
|
+
}
|
|
60
63
|
//#endregion
|
|
61
64
|
//#region src/widgetDispatch.ts
|
|
62
|
-
var
|
|
63
|
-
function
|
|
64
|
-
return
|
|
65
|
+
var wn;
|
|
66
|
+
function Tn() {
|
|
67
|
+
return wn === void 0 && (wn = Qt.shape.type.parse(void 0)), wn;
|
|
65
68
|
}
|
|
66
|
-
function
|
|
67
|
-
return e.type === void 0 ?
|
|
69
|
+
function En(e) {
|
|
70
|
+
return e.type === void 0 ? Dn(e) ? void 0 : Tn() : e.type;
|
|
68
71
|
}
|
|
69
|
-
function
|
|
70
|
-
return e.component;
|
|
72
|
+
function Dn(e) {
|
|
73
|
+
return On(e) ? void 0 : e.component;
|
|
71
74
|
}
|
|
72
|
-
function
|
|
75
|
+
function On(e) {
|
|
73
76
|
return qt.includes(e.type);
|
|
74
77
|
}
|
|
75
|
-
function
|
|
78
|
+
function kn(e) {
|
|
76
79
|
return {
|
|
77
80
|
type: "text",
|
|
78
81
|
content: `「${e}」chart type is not supported yet`,
|
|
@@ -81,7 +84,7 @@ function Dn(e) {
|
|
|
81
84
|
className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground"
|
|
82
85
|
};
|
|
83
86
|
}
|
|
84
|
-
var
|
|
87
|
+
var An = {
|
|
85
88
|
column: "bar",
|
|
86
89
|
"stacked-bar": "bar",
|
|
87
90
|
"grouped-bar": "bar",
|
|
@@ -91,7 +94,7 @@ var On = {
|
|
|
91
94
|
"stacked-area": "area",
|
|
92
95
|
pyramid: "funnel",
|
|
93
96
|
bubble: "scatter"
|
|
94
|
-
},
|
|
97
|
+
}, jn = /* @__PURE__ */ new Set([
|
|
95
98
|
"bar",
|
|
96
99
|
"horizontal-bar",
|
|
97
100
|
"line",
|
|
@@ -105,16 +108,16 @@ var On = {
|
|
|
105
108
|
"sankey",
|
|
106
109
|
"combo"
|
|
107
110
|
]);
|
|
108
|
-
function
|
|
109
|
-
return
|
|
111
|
+
function Mn(e) {
|
|
112
|
+
return jn.has(e);
|
|
110
113
|
}
|
|
111
|
-
var
|
|
114
|
+
var Nn = /* @__PURE__ */ new Set([
|
|
112
115
|
"metric",
|
|
113
116
|
"gauge",
|
|
114
117
|
"solid-gauge",
|
|
115
118
|
"kpi",
|
|
116
119
|
"bullet"
|
|
117
|
-
]),
|
|
120
|
+
]), Pn = /* @__PURE__ */ new Set(["table", "list"]), Fn = /* @__PURE__ */ new Set([
|
|
118
121
|
"sunburst",
|
|
119
122
|
"word-cloud",
|
|
120
123
|
"choropleth",
|
|
@@ -127,21 +130,25 @@ var jn = /* @__PURE__ */ new Set([
|
|
|
127
130
|
"candlestick",
|
|
128
131
|
"stock"
|
|
129
132
|
]);
|
|
130
|
-
function
|
|
133
|
+
function In(e) {
|
|
131
134
|
if (!e) return { family: "passthrough" };
|
|
132
|
-
let t =
|
|
133
|
-
return
|
|
135
|
+
let t = An[e] ?? e;
|
|
136
|
+
return Mn(t) ? {
|
|
134
137
|
family: "series",
|
|
135
138
|
chartType: t
|
|
136
|
-
} :
|
|
139
|
+
} : Nn.has(e) ? { family: "metric" } : Pn.has(e) ? { family: "table" } : e === "pivot" ? { family: "pivot" } : e === "custom" ? { family: "custom" } : Fn.has(e) ? { family: "unsupported" } : { family: "passthrough" };
|
|
137
140
|
}
|
|
138
|
-
var
|
|
141
|
+
var Ln = {
|
|
139
142
|
metric: "plugin-dashboard:metric",
|
|
140
143
|
"metric-card": "plugin-dashboard:metric-card"
|
|
141
|
-
},
|
|
142
|
-
function
|
|
144
|
+
}, Rn = Ln;
|
|
145
|
+
function zn(e) {
|
|
146
|
+
let { description: t, ...n } = e;
|
|
147
|
+
return n;
|
|
148
|
+
}
|
|
149
|
+
function Bn(e) {
|
|
143
150
|
if (!e || typeof e != "object") return e;
|
|
144
|
-
let t = e.type, n = typeof t == "string" ?
|
|
151
|
+
let t = e.type, n = typeof t == "string" ? Rn[t] : void 0;
|
|
145
152
|
return n ? {
|
|
146
153
|
...e,
|
|
147
154
|
type: n
|
|
@@ -149,25 +156,26 @@ function Ln(e) {
|
|
|
149
156
|
}
|
|
150
157
|
//#endregion
|
|
151
158
|
//#region src/legacyRetiredWidget.ts
|
|
152
|
-
var
|
|
159
|
+
var Vn = {
|
|
153
160
|
type: "text",
|
|
154
161
|
content: "This widget uses a retired data format. Edit it to bind a dataset.",
|
|
155
162
|
variant: "caption",
|
|
156
163
|
align: "center",
|
|
157
164
|
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"
|
|
158
165
|
};
|
|
159
|
-
function
|
|
166
|
+
function Hn(e) {
|
|
160
167
|
if (!e) return !1;
|
|
161
168
|
let t = e;
|
|
162
169
|
return !t.dataset && !(t.data || t.options?.data) && !!t.object;
|
|
163
170
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
171
|
+
function Un(e) {
|
|
172
|
+
if (!e) return !1;
|
|
173
|
+
let t = typeof e == "object" ? e.type : void 0;
|
|
174
|
+
return !qt.includes(t);
|
|
167
175
|
}
|
|
168
176
|
//#endregion
|
|
169
177
|
//#region src/WidgetEmptyState.tsx
|
|
170
|
-
function
|
|
178
|
+
function Wn({ source: e, className: t, testId: n }) {
|
|
171
179
|
let r = Re();
|
|
172
180
|
return /* @__PURE__ */ Q(Ke, {
|
|
173
181
|
role: "status",
|
|
@@ -193,7 +201,7 @@ function Hn({ source: e, className: t, testId: n }) {
|
|
|
193
201
|
}
|
|
194
202
|
//#endregion
|
|
195
203
|
//#region src/colorVariants.ts
|
|
196
|
-
var
|
|
204
|
+
var Gn = {
|
|
197
205
|
default: "bg-muted text-muted-foreground",
|
|
198
206
|
blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
199
207
|
teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
|
|
@@ -202,7 +210,7 @@ var Un = {
|
|
|
202
210
|
success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
|
203
211
|
warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
204
212
|
danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
|
|
205
|
-
},
|
|
213
|
+
}, Kn = {
|
|
206
214
|
default: "text-foreground",
|
|
207
215
|
blue: "text-blue-600 dark:text-blue-400",
|
|
208
216
|
teal: "text-teal-600 dark:text-teal-400",
|
|
@@ -212,12 +220,56 @@ var Un = {
|
|
|
212
220
|
warning: "text-amber-600 dark:text-amber-400",
|
|
213
221
|
danger: "text-rose-600 dark:text-rose-400"
|
|
214
222
|
};
|
|
215
|
-
function
|
|
216
|
-
if (typeof e == "string" && e !== "default") return
|
|
223
|
+
function qn(e) {
|
|
224
|
+
if (typeof e == "string" && e !== "default") return Kn[e];
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/metricTile.ts
|
|
228
|
+
var Jn = "@container", Yn = "min-w-0 line-clamp-2 break-words text-[13px] font-medium leading-snug text-foreground", Xn = "max-w-full overflow-hidden text-ellipsis whitespace-nowrap tabular-nums text-xl @[160px]:text-2xl", Zn = [
|
|
229
|
+
{
|
|
230
|
+
maxEm: 4.5,
|
|
231
|
+
sizes: "text-xl @[160px]:text-2xl"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
maxEm: 5.5,
|
|
235
|
+
sizes: "text-sm @[136px]:text-base @[147px]:text-lg @[158px]:text-xl @[180px]:text-2xl"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
maxEm: 6.75,
|
|
239
|
+
sizes: "text-sm @[156px]:text-base @[170px]:text-lg @[183px]:text-xl @[210px]:text-2xl"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
maxEm: 8,
|
|
243
|
+
sizes: "text-sm @[176px]:text-base @[192px]:text-lg @[208px]:text-xl @[240px]:text-2xl"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
maxEm: 10,
|
|
247
|
+
sizes: "text-sm @[208px]:text-base @[228px]:text-lg @[248px]:text-xl @[288px]:text-2xl"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
maxEm: 12.5,
|
|
251
|
+
sizes: "text-sm @[248px]:text-base @[273px]:text-lg @[298px]:text-xl @[348px]:text-2xl"
|
|
252
|
+
}
|
|
253
|
+
], Qn = "text-sm", $n = "max-w-full overflow-hidden text-ellipsis whitespace-nowrap tabular-nums";
|
|
254
|
+
function er(e) {
|
|
255
|
+
let t = 0;
|
|
256
|
+
for (let n of e) n >= "0" && n <= "9" ? t += .65 : /[.,'\s]/u.test(n) ? t += .27 : /[\p{Sc}%+\-\u2212]/u.test(n) ? t += .7 : t += 1;
|
|
257
|
+
return t;
|
|
258
|
+
}
|
|
259
|
+
function tr(e) {
|
|
260
|
+
let t = er(String(e)), n = Zn.find((e) => t <= e.maxEm);
|
|
261
|
+
return `${$n} ${n ? n.sizes : Qn}`;
|
|
262
|
+
}
|
|
263
|
+
function nr(e, t, n) {
|
|
264
|
+
return [t || e, n].filter(Boolean).join("\n") || void 0;
|
|
265
|
+
}
|
|
266
|
+
function rr(e) {
|
|
267
|
+
let t = String(e);
|
|
268
|
+
return er(t) > Zn[0].maxEm ? t : void 0;
|
|
217
269
|
}
|
|
218
270
|
//#endregion
|
|
219
271
|
//#region src/recordFields.tsx
|
|
220
|
-
var
|
|
272
|
+
var ir = /* @__PURE__ */ new Set([
|
|
221
273
|
"id",
|
|
222
274
|
"organization_id",
|
|
223
275
|
"tenant_id",
|
|
@@ -231,15 +283,15 @@ var Kn = /* @__PURE__ */ new Set([
|
|
|
231
283
|
"_id",
|
|
232
284
|
"__typename"
|
|
233
285
|
]);
|
|
234
|
-
function
|
|
235
|
-
return t && (t.isSystem === !0 || t.system === !0) ? !0 :
|
|
286
|
+
function ar(e, t) {
|
|
287
|
+
return t && (t.isSystem === !0 || t.system === !0) ? !0 : ir.has(e);
|
|
236
288
|
}
|
|
237
|
-
var
|
|
289
|
+
var or = /* @__PURE__ */ new Set([
|
|
238
290
|
"select",
|
|
239
291
|
"picklist",
|
|
240
292
|
"dropdown",
|
|
241
293
|
"status"
|
|
242
|
-
]),
|
|
294
|
+
]), sr = /* @__PURE__ */ new Set([
|
|
243
295
|
"currency",
|
|
244
296
|
"money",
|
|
245
297
|
"number",
|
|
@@ -248,14 +300,14 @@ var Jn = /* @__PURE__ */ new Set([
|
|
|
248
300
|
"float",
|
|
249
301
|
"percent",
|
|
250
302
|
"percentage"
|
|
251
|
-
]),
|
|
252
|
-
function
|
|
303
|
+
]), cr = /* @__PURE__ */ new Set(["date", "datetime"]), lr = ["reference", "displayField"];
|
|
304
|
+
function ur(e) {
|
|
253
305
|
let t = {};
|
|
254
306
|
if (!e) return t;
|
|
255
|
-
for (let n of
|
|
307
|
+
for (let n of lr) e[n] !== void 0 && (t[n] = e[n]);
|
|
256
308
|
return t;
|
|
257
309
|
}
|
|
258
|
-
function
|
|
310
|
+
function dr(e) {
|
|
259
311
|
let t = {}, n = e?.fields;
|
|
260
312
|
if (!n) return t;
|
|
261
313
|
if (Array.isArray(n)) for (let e of n) e?.name && (t[e.name] = e);
|
|
@@ -265,9 +317,9 @@ function $n(e) {
|
|
|
265
317
|
};
|
|
266
318
|
return t;
|
|
267
319
|
}
|
|
268
|
-
function
|
|
320
|
+
function fr(e) {
|
|
269
321
|
let { accessorKey: t, label: n, def: r, objectName: i, fieldOptionLabel: a, overrides: o = {} } = e, s = o.options ?? r?.options;
|
|
270
|
-
return i && s && a &&
|
|
322
|
+
return i && s && a && or.has(r?.type) && (s = s.map((e) => {
|
|
271
323
|
if (e == null) return e;
|
|
272
324
|
let n = typeof e == "object" ? e.value : e, r = typeof e == "object" && e.label || String(n);
|
|
273
325
|
return {
|
|
@@ -281,15 +333,15 @@ function er(e) {
|
|
|
281
333
|
type: o.type ?? r?.type,
|
|
282
334
|
options: s,
|
|
283
335
|
format: o.format ?? r?.format,
|
|
284
|
-
currency: o.currency ??
|
|
336
|
+
currency: o.currency ?? Me(r),
|
|
285
337
|
...typeof r?.max == "number" && { max: r.max },
|
|
286
|
-
...
|
|
338
|
+
...ur(r)
|
|
287
339
|
};
|
|
288
340
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
341
|
+
function pr(e) {
|
|
342
|
+
return sr.has(e.type) || typeof e.format == "string" && /^[$¥€£]|%$|0/.test(e.format);
|
|
291
343
|
}
|
|
292
|
-
function
|
|
344
|
+
function mr(e, t, n, r) {
|
|
293
345
|
if (e == null || e === "") return "";
|
|
294
346
|
let i = t.format;
|
|
295
347
|
if (typeof i == "string" && /^\$|¥|€|£/.test(i) && typeof e == "number") {
|
|
@@ -299,25 +351,25 @@ function nr(e, t, n, r) {
|
|
|
299
351
|
"€": "EUR",
|
|
300
352
|
"£": "GBP"
|
|
301
353
|
}[i[0]];
|
|
302
|
-
return
|
|
354
|
+
return tn(e, t.currency || a || n, r);
|
|
303
355
|
}
|
|
304
356
|
if (typeof i == "string" && /%/.test(i) && typeof e == "number") {
|
|
305
|
-
let n = (i.match(/0\.(0+)%/) || [void 0, ""])[1].length, a = t.type === "percent" || t.type === "progress" ?
|
|
306
|
-
return
|
|
357
|
+
let n = (i.match(/0\.(0+)%/) || [void 0, ""])[1].length, a = t.type === "percent" || t.type === "progress" ? cn(t) : "fraction";
|
|
358
|
+
return rn(e, a, n, r);
|
|
307
359
|
}
|
|
308
|
-
if (typeof i == "string" &&
|
|
309
|
-
let a =
|
|
360
|
+
if (typeof i == "string" && cr.has(t.type) && /[YMDHms]/.test(i)) return nn(e, i, { locale: r });
|
|
361
|
+
let a = an(un(t));
|
|
310
362
|
return /* @__PURE__ */ Q(a, {
|
|
311
363
|
value: e,
|
|
312
364
|
field: t
|
|
313
365
|
});
|
|
314
366
|
}
|
|
315
|
-
function
|
|
316
|
-
return typeof e == "string" &&
|
|
367
|
+
function hr(e) {
|
|
368
|
+
return typeof e == "string" && sn(e) ? (ln(e), !1) : p.has(e);
|
|
317
369
|
}
|
|
318
370
|
//#endregion
|
|
319
371
|
//#region src/RecordDetailDrawer.tsx
|
|
320
|
-
var
|
|
372
|
+
var gr = [
|
|
321
373
|
"name",
|
|
322
374
|
"title",
|
|
323
375
|
"label",
|
|
@@ -325,21 +377,21 @@ var ir = [
|
|
|
325
377
|
"display_name",
|
|
326
378
|
"full_name"
|
|
327
379
|
];
|
|
328
|
-
function
|
|
380
|
+
function _r(e, t) {
|
|
329
381
|
if (t && t.trim()) return t;
|
|
330
|
-
for (let t of
|
|
382
|
+
for (let t of gr) {
|
|
331
383
|
let n = e[t];
|
|
332
384
|
if (typeof n == "string" && n.trim()) return n;
|
|
333
385
|
}
|
|
334
386
|
let n = e.id ?? e._id;
|
|
335
387
|
return n == null ? "Record" : String(n);
|
|
336
388
|
}
|
|
337
|
-
var
|
|
338
|
-
let { fieldLabel: l, fieldOptionLabel: u } = Le(), { currency: d } =
|
|
389
|
+
var vr = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o, objectTypesPending: s = !1 }) => {
|
|
390
|
+
let { fieldLabel: l, fieldOptionLabel: u } = Le(), { currency: d } = Fe(), f = Pe(), p = c(() => {
|
|
339
391
|
if (!e) return [];
|
|
340
|
-
let i =
|
|
341
|
-
return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !
|
|
342
|
-
let r = i[n], a =
|
|
392
|
+
let i = dr(n), a;
|
|
393
|
+
return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !ar(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !ar(e)), a.map((n) => {
|
|
394
|
+
let r = i[n], a = yn(n), o = t ? l(t, n, a) : a, c = fr({
|
|
343
395
|
accessorKey: n,
|
|
344
396
|
label: o,
|
|
345
397
|
def: r,
|
|
@@ -349,8 +401,8 @@ var or = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
|
|
|
349
401
|
return {
|
|
350
402
|
key: n,
|
|
351
403
|
label: o,
|
|
352
|
-
node:
|
|
353
|
-
numeric: !
|
|
404
|
+
node: s ? /* @__PURE__ */ Q(en, { value: e[n] }) : mr(e[n], c, d, f),
|
|
405
|
+
numeric: !s && pr(c)
|
|
354
406
|
};
|
|
355
407
|
});
|
|
356
408
|
}, [
|
|
@@ -362,10 +414,10 @@ var or = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
|
|
|
362
414
|
u,
|
|
363
415
|
d,
|
|
364
416
|
f,
|
|
365
|
-
|
|
417
|
+
s
|
|
366
418
|
]);
|
|
367
419
|
if (!e) return null;
|
|
368
|
-
let m =
|
|
420
|
+
let m = _r(e, i), h = /* @__PURE__ */ Q("dl", {
|
|
369
421
|
className: "divide-y divide-border/60",
|
|
370
422
|
"data-testid": "record-detail-body",
|
|
371
423
|
children: p.map((e) => /* @__PURE__ */ $("div", {
|
|
@@ -401,24 +453,24 @@ var or = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
|
|
|
401
453
|
})]
|
|
402
454
|
})
|
|
403
455
|
});
|
|
404
|
-
},
|
|
405
|
-
function
|
|
406
|
-
return t.createElement(
|
|
456
|
+
}, yr = Object.freeze([]);
|
|
457
|
+
function br(e) {
|
|
458
|
+
return t.createElement(en, { value: e });
|
|
407
459
|
}
|
|
408
|
-
function
|
|
460
|
+
function xr(e) {
|
|
409
461
|
return e.map((e) => {
|
|
410
462
|
if (typeof e == "string") return {
|
|
411
|
-
header:
|
|
463
|
+
header: yn(e),
|
|
412
464
|
accessorKey: e
|
|
413
465
|
};
|
|
414
466
|
if (!e) return e;
|
|
415
467
|
let t = {};
|
|
416
468
|
if (!e.accessorKey) {
|
|
417
|
-
let n =
|
|
469
|
+
let n = D(e);
|
|
418
470
|
n && (t.accessorKey = n);
|
|
419
471
|
}
|
|
420
472
|
if (!e.header) {
|
|
421
|
-
let n =
|
|
473
|
+
let n = E(e);
|
|
422
474
|
n && (t.header = n);
|
|
423
475
|
}
|
|
424
476
|
return Object.keys(t).length === 0 ? e : {
|
|
@@ -427,7 +479,7 @@ function lr(e) {
|
|
|
427
479
|
};
|
|
428
480
|
});
|
|
429
481
|
}
|
|
430
|
-
function
|
|
482
|
+
function Sr(e, t) {
|
|
431
483
|
if (!t?.fields) return [];
|
|
432
484
|
let n = {};
|
|
433
485
|
if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
|
|
@@ -437,20 +489,20 @@ function ur(e, t) {
|
|
|
437
489
|
};
|
|
438
490
|
let r = Array.isArray(e.columns) ? e.columns : [], i = /* @__PURE__ */ new Set();
|
|
439
491
|
if (r.length > 0) {
|
|
440
|
-
let e = r.map((e) => typeof e == "string" ? e : e?.accessorKey ||
|
|
492
|
+
let e = r.map((e) => typeof e == "string" ? e : e?.accessorKey || D(e)).filter(Boolean);
|
|
441
493
|
for (let t of e) {
|
|
442
494
|
let e = n[t];
|
|
443
|
-
e &&
|
|
495
|
+
e && hr(e.type) && i.add(t);
|
|
444
496
|
}
|
|
445
|
-
} else for (let [e, t] of Object.entries(n))
|
|
497
|
+
} else for (let [e, t] of Object.entries(n)) hr(t?.type) && i.add(e);
|
|
446
498
|
return Array.from(i);
|
|
447
499
|
}
|
|
448
|
-
var
|
|
449
|
-
let { currency: r } =
|
|
500
|
+
var Cr = ({ schema: e, dataSource: t, className: n }) => {
|
|
501
|
+
let { currency: r } = Fe(), s = Pe(), l = a(H), d = t || l?.dataSource, f = U(e.bind), { fieldLabel: p, fieldOptionLabel: m } = Le(), h = "No data source available for", { t: g } = K(), _ = g("dashboard.noDataSourceFor");
|
|
450
502
|
_ && _ !== "dashboard.noDataSourceFor" && (h = _);
|
|
451
|
-
let [v, y] =
|
|
503
|
+
let [v, y] = u([]), [b, x] = u(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [S, C] = u(null), w = e.drillDown, T = ie(w) && (w?.mode ?? "record") === "record", [E, D] = u(null), O = i((e) => {
|
|
452
504
|
D(e ?? null);
|
|
453
|
-
}, []), k =
|
|
505
|
+
}, []), k = we(), A = dn(), { ready: j, def: M } = ke(e.objectName ?? "", d), N = Sr(e, M).join(","), ee = !!d && !!e.objectName && !f && (!e.data || e.data.length === 0), P = be(ee ? e.objectName : void 0);
|
|
454
506
|
o(() => {
|
|
455
507
|
let t = !0;
|
|
456
508
|
return e.objectName && !f && (!e.data || e.data.length === 0) ? j ? (async () => {
|
|
@@ -462,7 +514,7 @@ var dr = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
462
514
|
try {
|
|
463
515
|
let n;
|
|
464
516
|
if (typeof d.find == "function") {
|
|
465
|
-
let t =
|
|
517
|
+
let t = Sr(e, M), r = A?.isLoaded ? t.filter((t) => A.checkField(e.objectName, t, "read")) : t, i = { $filter: fe(e.filter, k) };
|
|
466
518
|
r.length && (i.$expand = r);
|
|
467
519
|
let a = await d.find(e.objectName, i);
|
|
468
520
|
n = te(a);
|
|
@@ -484,12 +536,12 @@ var dr = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
484
536
|
e.filter,
|
|
485
537
|
j,
|
|
486
538
|
M,
|
|
487
|
-
|
|
539
|
+
N,
|
|
488
540
|
k,
|
|
489
541
|
A,
|
|
490
|
-
|
|
542
|
+
P
|
|
491
543
|
]);
|
|
492
|
-
let
|
|
544
|
+
let ne = f || e.data || v, F = Array.isArray(ne) ? ne : yr, I = !!e.objectName && typeof d?.getObjectSchema == "function" && !M?.fields, re = c(() => {
|
|
493
545
|
let t = e.objectName, n = {};
|
|
494
546
|
if (M?.fields) {
|
|
495
547
|
let e = M.fields;
|
|
@@ -500,10 +552,10 @@ var dr = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
500
552
|
};
|
|
501
553
|
}
|
|
502
554
|
let i = (e) => {
|
|
503
|
-
let n =
|
|
555
|
+
let n = yn(e);
|
|
504
556
|
return t ? p(t, e, n) : n;
|
|
505
557
|
}, a = (e) => {
|
|
506
|
-
let i = e, a =
|
|
558
|
+
let i = e, a = fr({
|
|
507
559
|
accessorKey: e.accessorKey,
|
|
508
560
|
label: e.header,
|
|
509
561
|
def: n[e.accessorKey],
|
|
@@ -515,55 +567,55 @@ var dr = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
515
567
|
options: i.options,
|
|
516
568
|
currency: i.currency
|
|
517
569
|
}
|
|
518
|
-
}), o = e.align ?? (
|
|
570
|
+
}), o = e.align ?? (pr(a) ? "right" : void 0), c = Xt(a.type), l = I || on(i.type) || on(n[e.accessorKey]?.type) ? { masked: !0 } : {};
|
|
519
571
|
if (typeof e.cell == "function") return {
|
|
520
572
|
...e,
|
|
521
573
|
name: a.name,
|
|
522
|
-
type:
|
|
574
|
+
type: c,
|
|
523
575
|
align: o,
|
|
524
576
|
...l
|
|
525
577
|
};
|
|
526
|
-
if (
|
|
578
|
+
if (I && !i.type) return {
|
|
527
579
|
...e,
|
|
528
580
|
name: a.name,
|
|
529
|
-
type:
|
|
581
|
+
type: c,
|
|
530
582
|
align: o,
|
|
531
|
-
cell:
|
|
583
|
+
cell: br,
|
|
532
584
|
...l
|
|
533
585
|
};
|
|
534
|
-
let u = (e) =>
|
|
586
|
+
let u = (e) => mr(e, a, r, s);
|
|
535
587
|
return {
|
|
536
588
|
...e,
|
|
537
589
|
name: a.name,
|
|
538
|
-
type:
|
|
590
|
+
type: c,
|
|
539
591
|
align: o,
|
|
540
592
|
cell: u,
|
|
541
593
|
...l
|
|
542
594
|
};
|
|
543
595
|
};
|
|
544
|
-
return e.columns && e.columns.length > 0 ?
|
|
596
|
+
return e.columns && e.columns.length > 0 ? xr(e.columns).map((e) => {
|
|
545
597
|
if (!e?.accessorKey) return e;
|
|
546
|
-
let n = (e.header && e.header !== e.accessorKey ? e.header : void 0) ??
|
|
598
|
+
let n = (e.header && e.header !== e.accessorKey ? e.header : void 0) ?? yn(e.accessorKey), r = t ? p(t, e.accessorKey, n) : n;
|
|
547
599
|
return r === e.header ? e : {
|
|
548
600
|
...e,
|
|
549
601
|
header: r
|
|
550
602
|
};
|
|
551
|
-
}).map(a) :
|
|
603
|
+
}).map(a) : F.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !ar(e, n[e])) : Object.keys(F[0]).filter((e) => !e.startsWith("_") && !ar(e))).map((e) => a({
|
|
552
604
|
header: i(e),
|
|
553
605
|
accessorKey: e
|
|
554
606
|
}));
|
|
555
607
|
}, [
|
|
556
608
|
e.columns,
|
|
557
609
|
e.objectName,
|
|
558
|
-
P,
|
|
559
|
-
M,
|
|
560
610
|
F,
|
|
611
|
+
M,
|
|
612
|
+
I,
|
|
561
613
|
p,
|
|
562
614
|
m,
|
|
563
615
|
r,
|
|
564
|
-
|
|
616
|
+
s
|
|
565
617
|
]);
|
|
566
|
-
if (b &&
|
|
618
|
+
if (b && F.length === 0) return /* @__PURE__ */ Q("div", {
|
|
567
619
|
className: Z("overflow-auto", n),
|
|
568
620
|
"data-testid": "table-loading",
|
|
569
621
|
children: /* @__PURE__ */ $("div", {
|
|
@@ -632,7 +684,7 @@ var dr = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
632
684
|
})]
|
|
633
685
|
})
|
|
634
686
|
});
|
|
635
|
-
if (!d && e.objectName &&
|
|
687
|
+
if (!d && e.objectName && F.length === 0) return /* @__PURE__ */ Q("div", {
|
|
636
688
|
className: Z("overflow-auto", n),
|
|
637
689
|
children: /* @__PURE__ */ Q("div", {
|
|
638
690
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
|
|
@@ -647,46 +699,46 @@ var dr = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
647
699
|
})
|
|
648
700
|
})
|
|
649
701
|
});
|
|
650
|
-
if (
|
|
702
|
+
if (F.length === 0) return /* @__PURE__ */ Q("div", {
|
|
651
703
|
className: Z("overflow-auto", n),
|
|
652
704
|
"data-testid": "table-empty-state",
|
|
653
|
-
children: /* @__PURE__ */ Q(
|
|
705
|
+
children: /* @__PURE__ */ Q(Wn, {
|
|
654
706
|
source: e.objectName || void 0,
|
|
655
707
|
className: "py-8"
|
|
656
708
|
})
|
|
657
709
|
});
|
|
658
|
-
let { bind:
|
|
659
|
-
...
|
|
710
|
+
let { bind: ae, ...L } = e, oe = {
|
|
711
|
+
...L,
|
|
660
712
|
type: "data-table",
|
|
661
|
-
data:
|
|
662
|
-
columns:
|
|
713
|
+
data: F,
|
|
714
|
+
columns: re,
|
|
663
715
|
onRowClick: e.onRowClick ?? (T ? O : void 0)
|
|
664
|
-
},
|
|
716
|
+
}, R = w?.title && !w.title.includes("${") ? w.title : void 0;
|
|
665
717
|
return /* @__PURE__ */ $("div", {
|
|
666
718
|
className: Z("relative", n),
|
|
667
719
|
children: [
|
|
668
720
|
/* @__PURE__ */ Q(rt, {
|
|
669
|
-
active: b &&
|
|
721
|
+
active: b && F.length > 0,
|
|
670
722
|
ariaLabel: g("dashboard.refreshing")
|
|
671
723
|
}),
|
|
672
|
-
/* @__PURE__ */ Q(
|
|
673
|
-
schema:
|
|
724
|
+
/* @__PURE__ */ Q(_e, {
|
|
725
|
+
schema: oe,
|
|
674
726
|
className: n
|
|
675
727
|
}),
|
|
676
|
-
T && /* @__PURE__ */ Q(
|
|
728
|
+
T && /* @__PURE__ */ Q(vr, {
|
|
677
729
|
record: E,
|
|
678
730
|
objectName: e.objectName,
|
|
679
731
|
objectSchema: M,
|
|
680
732
|
fields: w?.columns,
|
|
681
|
-
title:
|
|
733
|
+
title: R,
|
|
682
734
|
target: w?.target === "dialog" ? "dialog" : "drawer",
|
|
683
735
|
onClose: () => D(null),
|
|
684
|
-
objectTypesPending:
|
|
736
|
+
objectTypesPending: I
|
|
685
737
|
})
|
|
686
738
|
]
|
|
687
739
|
});
|
|
688
|
-
},
|
|
689
|
-
let { openRecordList: i } =
|
|
740
|
+
}, wr = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
|
|
741
|
+
let { openRecordList: i } = Ce(), a = Re();
|
|
690
742
|
return !i || !e ? null : /* @__PURE__ */ $(q, {
|
|
691
743
|
type: "button",
|
|
692
744
|
variant: "ghost",
|
|
@@ -701,17 +753,17 @@ var dr = ({ schema: e, dataSource: t, className: n }) => {
|
|
|
701
753
|
};
|
|
702
754
|
//#endregion
|
|
703
755
|
//#region src/DrillDownDrawer.tsx
|
|
704
|
-
function
|
|
756
|
+
function Tr(e) {
|
|
705
757
|
if (!e || typeof e != "object") return !1;
|
|
706
758
|
let t = e;
|
|
707
759
|
return typeof t.dataset == "string" && t.dataset.length > 0 || t.type === "joined" && Array.isArray(t.blocks) && t.blocks.some((e) => typeof e?.dataset == "string");
|
|
708
760
|
}
|
|
709
|
-
var
|
|
710
|
-
let { openRecordList: f } =
|
|
761
|
+
var Er = ({ open: e, onClose: n, title: r, target: i = "drawer", objectName: a, filter: o, dataSource: s, columns: c, maxRows: l, className: u, report: d }) => {
|
|
762
|
+
let { openRecordList: f } = Ce(), p = Tr(d), m = i === "navigate" && !!f && !p && !!a;
|
|
711
763
|
if (t.useEffect(() => {
|
|
712
764
|
e && m && (f(a, o), n());
|
|
713
765
|
}, [e, m]), m) return null;
|
|
714
|
-
let h = p ? null : /* @__PURE__ */ Q(
|
|
766
|
+
let h = p ? null : /* @__PURE__ */ Q(wr, {
|
|
715
767
|
objectName: a,
|
|
716
768
|
filter: o,
|
|
717
769
|
onNavigate: n
|
|
@@ -726,8 +778,8 @@ var mr = ({ open: e, onClose: n, title: r, target: i = "drawer", objectName: a,
|
|
|
726
778
|
runtimeFilter: t
|
|
727
779
|
} : d
|
|
728
780
|
};
|
|
729
|
-
return /* @__PURE__ */ Q(
|
|
730
|
-
})() : /* @__PURE__ */ Q(
|
|
781
|
+
return /* @__PURE__ */ Q(_e, { schema: n });
|
|
782
|
+
})() : /* @__PURE__ */ Q(Cr, {
|
|
731
783
|
schema: {
|
|
732
784
|
type: "object-data-table",
|
|
733
785
|
objectName: a,
|
|
@@ -773,17 +825,17 @@ var mr = ({ open: e, onClose: n, title: r, target: i = "drawer", objectName: a,
|
|
|
773
825
|
})]
|
|
774
826
|
})
|
|
775
827
|
});
|
|
776
|
-
},
|
|
777
|
-
function
|
|
828
|
+
}, Dr = v;
|
|
829
|
+
function Or(e, t, n, r) {
|
|
778
830
|
let i = [], a = [], o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
|
|
779
831
|
return e.forEach((e, l) => {
|
|
780
|
-
let u =
|
|
832
|
+
let u = se(t.map((t) => le(e[t]))), d = se([le(e[n])]);
|
|
781
833
|
o.has(u) || (o.add(u), i.push({
|
|
782
834
|
id: u,
|
|
783
|
-
labels: t.map((t) =>
|
|
835
|
+
labels: t.map((t) => F(e[t], r))
|
|
784
836
|
})), s.has(d) || (s.add(d), a.push({
|
|
785
837
|
id: d,
|
|
786
|
-
label:
|
|
838
|
+
label: F(e[n], r)
|
|
787
839
|
})), c.set(ce(u, d), l);
|
|
788
840
|
}), {
|
|
789
841
|
rowHeaders: i,
|
|
@@ -791,35 +843,38 @@ function gr(e, t, n, r) {
|
|
|
791
843
|
cellIndex: c
|
|
792
844
|
};
|
|
793
845
|
}
|
|
794
|
-
function
|
|
846
|
+
function kr(e) {
|
|
795
847
|
if (e == null) return "";
|
|
796
848
|
let t = String(e);
|
|
797
849
|
return /[",\n\r]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
798
850
|
}
|
|
799
|
-
function
|
|
800
|
-
return e.map((e) => e.map(
|
|
851
|
+
function Ar(e) {
|
|
852
|
+
return e.map((e) => e.map(kr).join(",")).join("\r\n");
|
|
801
853
|
}
|
|
802
|
-
function
|
|
854
|
+
function jr(e, t) {
|
|
803
855
|
if (typeof document > "u") return;
|
|
804
|
-
let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${
|
|
856
|
+
let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${Ar(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
805
857
|
a.href = i, a.download = n.endsWith(".csv") ? n : `${n}.csv`, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
|
|
806
858
|
}
|
|
807
|
-
var
|
|
859
|
+
var Mr = "__compare", Nr = (e) => `${e}${Mr}`, Pr = {
|
|
808
860
|
vsLastQuarter: "vs last quarter",
|
|
809
861
|
vsLastMonth: "vs last month",
|
|
810
862
|
vsLastWeek: "vs last week",
|
|
811
863
|
vsLastYear: "vs last year",
|
|
812
864
|
vsYesterday: "vs yesterday",
|
|
813
865
|
vsPreviousPeriod: "vs previous period"
|
|
814
|
-
},
|
|
815
|
-
|
|
866
|
+
}, Fr = {
|
|
867
|
+
previousPeriod: "vsPreviousPeriod",
|
|
868
|
+
previousYear: "vsLastYear"
|
|
869
|
+
}, Ir = /^\d{4}-\d{2}-\d{2}(?:[T ][\d:.]+(?:Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
870
|
+
function Lr(e) {
|
|
816
871
|
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
817
872
|
let t = Object.keys(e);
|
|
818
873
|
if (t.length !== 2 || !t.includes("$gte") || !t.includes("$lte")) return null;
|
|
819
874
|
let { $gte: n, $lte: r } = e;
|
|
820
|
-
return typeof n != "string" || typeof r != "string" || !
|
|
875
|
+
return typeof n != "string" || typeof r != "string" || !Ir.test(n) || !Ir.test(r) ? null : [n, r];
|
|
821
876
|
}
|
|
822
|
-
function
|
|
877
|
+
function Rr(e) {
|
|
823
878
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
824
879
|
if (!e || typeof e != "object" || Array.isArray(e)) return e;
|
|
825
880
|
let r = {}, i = null;
|
|
@@ -832,7 +887,7 @@ function Tr(e) {
|
|
|
832
887
|
r[a] = o;
|
|
833
888
|
continue;
|
|
834
889
|
}
|
|
835
|
-
let e =
|
|
890
|
+
let e = Lr(o);
|
|
836
891
|
if (!e) {
|
|
837
892
|
r[a] = o;
|
|
838
893
|
continue;
|
|
@@ -850,26 +905,24 @@ function Tr(e) {
|
|
|
850
905
|
rest: i
|
|
851
906
|
};
|
|
852
907
|
}
|
|
853
|
-
var
|
|
908
|
+
var zr = /* @__PURE__ */ new Set([
|
|
854
909
|
"metric",
|
|
855
910
|
"kpi",
|
|
856
911
|
"gauge",
|
|
857
912
|
"solid-gauge",
|
|
858
913
|
"bullet"
|
|
859
|
-
]),
|
|
860
|
-
"bar",
|
|
861
|
-
"column",
|
|
862
|
-
"horizontal-bar",
|
|
863
|
-
"line",
|
|
864
|
-
"area",
|
|
865
|
-
"combo"
|
|
866
|
-
]), Or = /* @__PURE__ */ new Set([
|
|
914
|
+
]), Br = new Set(Zt), Vr = /* @__PURE__ */ new Set([
|
|
867
915
|
"pie",
|
|
868
916
|
"donut",
|
|
869
917
|
"funnel",
|
|
870
918
|
"treemap",
|
|
871
919
|
"sankey"
|
|
872
|
-
]),
|
|
920
|
+
]), Hr = "__measure", Ur = "__value";
|
|
921
|
+
function Wr(e, t, n) {
|
|
922
|
+
let r = e == null ? void 0 : t.get(String(e));
|
|
923
|
+
return r === void 0 ? e == null || e === "" || n !== void 0 && e === n ? 2 ** 53 - 1 : 2 ** 53 - 1 - 1 : r;
|
|
924
|
+
}
|
|
925
|
+
var Gr = {
|
|
873
926
|
bar: "bar",
|
|
874
927
|
column: "column",
|
|
875
928
|
"horizontal-bar": "horizontal-bar",
|
|
@@ -892,37 +945,49 @@ var Er = /* @__PURE__ */ new Set([
|
|
|
892
945
|
sankey: "sankey",
|
|
893
946
|
combo: "combo"
|
|
894
947
|
};
|
|
895
|
-
function
|
|
896
|
-
|
|
897
|
-
|
|
948
|
+
function Kr({ heading: e, label: t }) {
|
|
949
|
+
return /* @__PURE__ */ Q("div", {
|
|
950
|
+
className: "flex w-full min-w-0",
|
|
951
|
+
"data-testid": "dataset-metric-heading",
|
|
952
|
+
children: e.title && /* @__PURE__ */ Q("span", {
|
|
953
|
+
className: "min-w-0 line-clamp-2 break-words text-[13px] font-medium leading-snug text-foreground",
|
|
954
|
+
title: nr(e.title, e.description, t),
|
|
955
|
+
"data-testid": "dataset-metric-title",
|
|
956
|
+
children: e.title
|
|
957
|
+
})
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
function qr({ widget: e, dataSource: t, heading: n }) {
|
|
961
|
+
let r = String(e?.dataset ?? ""), i = c(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), a = c(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), s = String(e?.type ?? Tn()), l = s === "table" || s === "pivot", d = a.length > 1 && (l || Br.has(Gr[s] ?? "")), f = zr.has(s) || i.length === 0 && !d, p = Gr[s] ?? "bar", v = !f && !l && Vr.has(p), x = f || v ? a.slice(0, 1) : a, S = a.filter((e) => !x.includes(e)), w = !f && !l && T(p) ? void 0 : e?.compareTo, E = s === "pivot" && i.length >= 2, D = E ? i.slice(0, -1) : [], k = E ? i[i.length - 1] : "", A = e?.options && typeof e.options == "object" && !Array.isArray(e.options) ? e.options : {}, j = typeof A.dateGranularity == "string" ? A.dateGranularity : void 0, M = typeof A.sortBy == "string" && A.sortBy ? A.sortBy : void 0, P = M && (i.includes(M) || a.includes(M)) ? M : void 0, te = P ? { [P]: A.sortOrder === "desc" ? "desc" : "asc" } : void 0, ie = typeof A.limit == "number" && Number.isFinite(A.limit) && A.limit > 0 ? Math.floor(A.limit) : void 0, ae = l && !E && i.length > 0 && ie == null, oe = E ? [
|
|
962
|
+
D,
|
|
898
963
|
[k],
|
|
899
964
|
[]
|
|
900
|
-
] :
|
|
965
|
+
] : ae ? [[]] : void 0, R = Re(), { fieldLabel: de, fieldOptionLabel: z } = Le(), B = Pe(), pe = we(), me = e?.filter, V = c(() => me && typeof me == "object" && Object.keys(me).length > 0 ? fe(me, pe) : void 0, [me, pe]), { windows: he, rest: ge } = c(() => w ? Rr(V) : {
|
|
901
966
|
windows: [],
|
|
902
|
-
rest:
|
|
903
|
-
}, [w,
|
|
967
|
+
rest: V
|
|
968
|
+
}, [w, V]), [H, ye] = u({
|
|
904
969
|
status: "idle",
|
|
905
970
|
rows: []
|
|
906
|
-
}), [
|
|
971
|
+
}), [U, Se] = u(null), [Ce, Te] = u(null), Ee = `${s}|${r}|${i.join(",")}|${a.join(",")}|${JSON.stringify(me ?? null)}|${JSON.stringify(w ?? null)}|${j ?? ""}|${JSON.stringify(te ?? null)}|${ie ?? ""}`, [De, Oe] = u(void 0), ke = be(a.length > 0 ? De : void 0);
|
|
907
972
|
o(() => {
|
|
908
973
|
let e = t;
|
|
909
974
|
if (!e || typeof e.queryDataset != "function") {
|
|
910
|
-
|
|
975
|
+
ye({
|
|
911
976
|
status: "error",
|
|
912
977
|
rows: [],
|
|
913
|
-
error:
|
|
978
|
+
error: R("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
|
|
914
979
|
});
|
|
915
980
|
return;
|
|
916
981
|
}
|
|
917
982
|
if (a.length === 0) {
|
|
918
|
-
|
|
983
|
+
ye({
|
|
919
984
|
status: "idle",
|
|
920
985
|
rows: []
|
|
921
986
|
});
|
|
922
987
|
return;
|
|
923
988
|
}
|
|
924
989
|
let n = !1;
|
|
925
|
-
return
|
|
990
|
+
return ye((e) => e.status === "ok" && e.signature === Ee ? {
|
|
926
991
|
...e,
|
|
927
992
|
refreshing: !0
|
|
928
993
|
} : {
|
|
@@ -931,15 +996,15 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
931
996
|
}), e.queryDataset(r, {
|
|
932
997
|
dimensions: i,
|
|
933
998
|
measures: a,
|
|
934
|
-
...
|
|
935
|
-
...
|
|
999
|
+
...ge ? { runtimeFilter: ge } : {},
|
|
1000
|
+
...he.length > 0 ? { timeDimensions: he } : {},
|
|
936
1001
|
...w ? { compareTo: w } : {},
|
|
937
|
-
...
|
|
1002
|
+
...oe ? { totals: { groupings: oe } } : {},
|
|
938
1003
|
...j ? { dateGranularity: j } : {},
|
|
939
|
-
...
|
|
940
|
-
...
|
|
1004
|
+
...te ? { order: te } : {},
|
|
1005
|
+
...ie == null ? {} : { limit: ie }
|
|
941
1006
|
}).then((e) => {
|
|
942
|
-
n || (
|
|
1007
|
+
n || (ye({
|
|
943
1008
|
status: "ok",
|
|
944
1009
|
rows: Array.isArray(e?.rows) ? e.rows : [],
|
|
945
1010
|
fields: Array.isArray(e?.fields) ? e.fields : [],
|
|
@@ -948,19 +1013,19 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
948
1013
|
drillRawRows: Array.isArray(e?.drillRawRows) ? e.drillRawRows : void 0,
|
|
949
1014
|
drillRanges: Array.isArray(e?.drillRanges) ? e.drillRanges : void 0,
|
|
950
1015
|
totals: Array.isArray(e?.totals) ? e.totals : void 0,
|
|
951
|
-
signature:
|
|
952
|
-
}), typeof e?.object == "string" && e.object &&
|
|
1016
|
+
signature: Ee
|
|
1017
|
+
}), typeof e?.object == "string" && e.object && Oe(e.object));
|
|
953
1018
|
}).catch((e) => {
|
|
954
1019
|
if (!n) {
|
|
955
|
-
if (
|
|
956
|
-
|
|
1020
|
+
if (ve(e) === "forbidden") {
|
|
1021
|
+
ye({
|
|
957
1022
|
status: "error",
|
|
958
1023
|
rows: [],
|
|
959
1024
|
forbidden: !0
|
|
960
1025
|
});
|
|
961
1026
|
return;
|
|
962
1027
|
}
|
|
963
|
-
|
|
1028
|
+
ye({
|
|
964
1029
|
status: "error",
|
|
965
1030
|
rows: [],
|
|
966
1031
|
error: String(e?.message ?? e)
|
|
@@ -969,33 +1034,38 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
969
1034
|
}), () => {
|
|
970
1035
|
n = !0;
|
|
971
1036
|
};
|
|
972
|
-
}, [
|
|
973
|
-
let
|
|
1037
|
+
}, [Ee, ke]);
|
|
1038
|
+
let je = (e) => e.map((e) => `"${e}"`).join(", "), W = S.length > 0 ? `[DatasetWidget] Widget "${String(e?.id ?? "")}" (type "${s}", dataset "${r}") renders ${x.length} of its ${a.length} declared measures: ${je(x)}. Queried and then never displayed: ${je(S)}. ` + (v ? `Its chart family "${p}" draws a single series: the first declared measure.` : "The spec states what to author instead of a one-number tile with several measures in the replacement of its ADR-0087 entry \"dashboard-widget-metric-family-multi-measure-refused\".") : "";
|
|
974
1039
|
o(() => {
|
|
975
|
-
|
|
976
|
-
}, [
|
|
977
|
-
let
|
|
978
|
-
if (!
|
|
1040
|
+
W && console.warn(W);
|
|
1041
|
+
}, [W]);
|
|
1042
|
+
let G = xe(H.object, H.dimensionFields, i, { enabled: !f }), { categoryColors: Me, dimensionLabels: Ne, categoryOrder: Fe, seriesOrder: Ie } = c(() => {
|
|
1043
|
+
if (!G) return {
|
|
979
1044
|
categoryColors: null,
|
|
980
1045
|
dimensionLabels: null,
|
|
981
|
-
categoryOrder: null
|
|
1046
|
+
categoryOrder: null,
|
|
1047
|
+
seriesOrder: null
|
|
982
1048
|
};
|
|
983
|
-
let { metaByPath: e, relabel: t } =
|
|
1049
|
+
let { metaByPath: e, relabel: t } = G, n = l ? void 0 : t[0]?.path, r = n ? e[n] : void 0, i = n ? L(r?.options, ee(r, z)) : void 0, a = l ? void 0 : t[1]?.path, o = a ? e[a] : void 0, s = a ? L(o?.options, ee(o, z)) : void 0;
|
|
984
1050
|
return {
|
|
985
|
-
categoryColors:
|
|
986
|
-
dimensionLabels:
|
|
987
|
-
categoryOrder:
|
|
1051
|
+
categoryColors: b(i),
|
|
1052
|
+
dimensionLabels: N(e, t, z),
|
|
1053
|
+
categoryOrder: h(i),
|
|
1054
|
+
seriesOrder: h(s)
|
|
988
1055
|
};
|
|
989
1056
|
}, [
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
])
|
|
994
|
-
|
|
1057
|
+
G,
|
|
1058
|
+
z,
|
|
1059
|
+
l
|
|
1060
|
+
]), K = (e) => n ? /* @__PURE__ */ $("div", {
|
|
1061
|
+
className: Z("flex h-full w-full min-w-0 flex-col gap-1", Jn),
|
|
1062
|
+
children: [/* @__PURE__ */ Q(Kr, { heading: n }), e]
|
|
1063
|
+
}) : e;
|
|
1064
|
+
if (a.length === 0) return K(/* @__PURE__ */ Q("div", {
|
|
995
1065
|
className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
|
|
996
|
-
children:
|
|
997
|
-
});
|
|
998
|
-
if (
|
|
1066
|
+
children: R("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
|
|
1067
|
+
}));
|
|
1068
|
+
if (H.status === "loading" || H.status === "idle") return K(/* @__PURE__ */ $("div", {
|
|
999
1069
|
className: "h-full w-full p-2",
|
|
1000
1070
|
"data-testid": "dataset-loading",
|
|
1001
1071
|
role: "status",
|
|
@@ -1003,17 +1073,17 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1003
1073
|
"aria-live": "polite",
|
|
1004
1074
|
children: [/* @__PURE__ */ Q("span", {
|
|
1005
1075
|
className: "sr-only",
|
|
1006
|
-
children:
|
|
1076
|
+
children: R("dashboard.loading", "Loading…")
|
|
1007
1077
|
}), f ? /* @__PURE__ */ $("div", {
|
|
1008
1078
|
className: "flex h-full w-full flex-col items-start justify-center gap-2 p-2",
|
|
1009
1079
|
children: [/* @__PURE__ */ Q(X, { className: "h-8 w-32 rounded" }), /* @__PURE__ */ Q(X, { className: "h-3 w-20 rounded" })]
|
|
1010
|
-
}) :
|
|
1080
|
+
}) : l ? /* @__PURE__ */ Q(Qe, {
|
|
1011
1081
|
className: "h-full",
|
|
1012
1082
|
rows: 5,
|
|
1013
1083
|
columns: Math.max(2, i.length + a.length)
|
|
1014
1084
|
}) : /* @__PURE__ */ Q(He, { className: "h-full" })]
|
|
1015
|
-
});
|
|
1016
|
-
if (
|
|
1085
|
+
}));
|
|
1086
|
+
if (H.status === "error" && H.forbidden) return K(/* @__PURE__ */ $("div", {
|
|
1017
1087
|
role: "alert",
|
|
1018
1088
|
"data-testid": "dataset-widget-forbidden",
|
|
1019
1089
|
className: "flex h-full w-full flex-col items-center justify-center gap-1 p-3 text-center text-xs text-muted-foreground",
|
|
@@ -1024,34 +1094,34 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1024
1094
|
}),
|
|
1025
1095
|
/* @__PURE__ */ Q("span", {
|
|
1026
1096
|
className: "font-medium text-foreground/80",
|
|
1027
|
-
children:
|
|
1097
|
+
children: R("dashboard.widgetForbiddenTitle", "You don’t have access")
|
|
1028
1098
|
}),
|
|
1029
|
-
/* @__PURE__ */ Q("span", { children:
|
|
1099
|
+
/* @__PURE__ */ Q("span", { children: R("dashboard.widgetForbiddenMessage", "You don’t have permission to view the data behind this widget.") })
|
|
1030
1100
|
]
|
|
1031
|
-
});
|
|
1032
|
-
if (
|
|
1101
|
+
}));
|
|
1102
|
+
if (H.status === "error") return K(/* @__PURE__ */ $("div", {
|
|
1033
1103
|
role: "alert",
|
|
1034
1104
|
className: "flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive",
|
|
1035
1105
|
children: [/* @__PURE__ */ Q(gt, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
1036
1106
|
className: "break-words",
|
|
1037
|
-
children:
|
|
1107
|
+
children: H.error
|
|
1038
1108
|
})]
|
|
1109
|
+
}));
|
|
1110
|
+
let q = /* @__PURE__ */ Q(rt, {
|
|
1111
|
+
active: !!H.refreshing,
|
|
1112
|
+
ariaLabel: R("dashboard.refreshing", "Refreshing…")
|
|
1039
1113
|
});
|
|
1040
|
-
|
|
1041
|
-
active: !!U.refreshing,
|
|
1042
|
-
ariaLabel: z("dashboard.refreshing", "Refreshing…")
|
|
1043
|
-
});
|
|
1044
|
-
if (U.rows.length === 0 && !f) return /* @__PURE__ */ Q(Hn, {
|
|
1114
|
+
if (H.rows.length === 0 && !f) return /* @__PURE__ */ Q(Wn, {
|
|
1045
1115
|
className: "rounded border border-dashed bg-muted/20",
|
|
1046
1116
|
source: r || void 0
|
|
1047
1117
|
});
|
|
1048
|
-
let { measureField: J, headerLabel: Y } =
|
|
1049
|
-
if (!
|
|
1118
|
+
let { measureField: J, headerLabel: Y } = y(H.fields, H.object, de, Ae(R)), ze = w ? a.filter((e) => H.rows.some((t) => t[Nr(e)] != null)) : [], Be = w ? Fr[w.kind] : "", Ve = w ? R(`dashboard.trend.${Be}`, Pr[Be] ?? "vs previous period") : "", { object: Ue, dimensionFields: We, drillRawRows: Ge, drillRanges: Ke } = H, qe = We ? i.filter((e) => e in We) : [], Je = !!Ue && (qe.length > 0 || !!Ke?.length), Ye = (t, n) => {
|
|
1119
|
+
if (!Ue) return;
|
|
1050
1120
|
let r;
|
|
1051
1121
|
try {
|
|
1052
|
-
r =
|
|
1122
|
+
r = Dr(Ge?.[t], qe, We ?? {}, V, Ke?.[t]);
|
|
1053
1123
|
} catch (e) {
|
|
1054
|
-
if (!(e instanceof
|
|
1124
|
+
if (!(e instanceof m)) throw e;
|
|
1055
1125
|
console.warn(`[DatasetWidget] drill-down refused — the drilled list cannot be scoped: ${e.message}`);
|
|
1056
1126
|
return;
|
|
1057
1127
|
}
|
|
@@ -1059,23 +1129,32 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1059
1129
|
filter: r,
|
|
1060
1130
|
title: n || String(e?.title ?? "")
|
|
1061
1131
|
});
|
|
1062
|
-
},
|
|
1132
|
+
}, Xe = U && Ue ? /* @__PURE__ */ Q(Er, {
|
|
1063
1133
|
open: !0,
|
|
1064
1134
|
onClose: () => Se(null),
|
|
1065
|
-
title:
|
|
1066
|
-
objectName:
|
|
1067
|
-
filter:
|
|
1135
|
+
title: U.title || String(e?.title ?? R("dashboard.details", "Details")),
|
|
1136
|
+
objectName: Ue,
|
|
1137
|
+
filter: U.filter,
|
|
1068
1138
|
dataSource: t
|
|
1069
1139
|
}) : null;
|
|
1070
1140
|
if (f) {
|
|
1071
|
-
let t =
|
|
1141
|
+
let t = x[0], r = J(t), i = H.rows[0]?.[t] ?? 0, a = H.rows[0]?.[Nr(t)], o = ze.includes(t) ? Sn(typeof i == "number" ? i : null, typeof a == "number" ? a : null) : null, s = qn(e?.colorVariant), c = Y(t);
|
|
1072
1142
|
return /* @__PURE__ */ $("div", {
|
|
1073
|
-
className: Z("flex h-full w-full flex-col items-start justify-center gap-1 p-2",
|
|
1143
|
+
className: Z("flex h-full w-full flex-col items-start justify-center gap-1 p-2", n && Z("min-w-0", "@container"), H.refreshing && "relative"),
|
|
1074
1144
|
children: [
|
|
1075
|
-
|
|
1145
|
+
q,
|
|
1146
|
+
n && /* @__PURE__ */ Q(Kr, {
|
|
1147
|
+
heading: n,
|
|
1148
|
+
label: c
|
|
1149
|
+
}),
|
|
1076
1150
|
/* @__PURE__ */ Q("span", {
|
|
1077
|
-
className: Z("text-2xl font-semibold tabular-nums", s),
|
|
1078
|
-
children:
|
|
1151
|
+
className: Z(n ? Z("font-semibold", Xn) : "text-2xl font-semibold tabular-nums", s),
|
|
1152
|
+
children: I(i, r?.format, r?.currency, r?.percentScale, B)
|
|
1153
|
+
}),
|
|
1154
|
+
n && c && /* @__PURE__ */ Q("span", {
|
|
1155
|
+
className: "hidden max-w-full truncate text-[11px] text-muted-foreground @[160px]:block",
|
|
1156
|
+
"data-testid": "dataset-metric-label",
|
|
1157
|
+
children: c
|
|
1079
1158
|
}),
|
|
1080
1159
|
o && /* @__PURE__ */ $("div", {
|
|
1081
1160
|
className: "mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground",
|
|
@@ -1086,61 +1165,55 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1086
1165
|
o.direction === "up" && /* @__PURE__ */ Q(vt, { className: "mr-1 h-3 w-3" }),
|
|
1087
1166
|
o.direction === "down" && /* @__PURE__ */ Q(_t, { className: "mr-1 h-3 w-3" }),
|
|
1088
1167
|
o.direction === "neutral" && /* @__PURE__ */ Q(kt, { className: "mr-1 h-3 w-3" }),
|
|
1089
|
-
o.value
|
|
1090
|
-
"%"
|
|
1168
|
+
Cn(o.value)
|
|
1091
1169
|
]
|
|
1092
1170
|
}), /* @__PURE__ */ Q("span", {
|
|
1093
1171
|
className: "min-w-0 truncate",
|
|
1094
|
-
children:
|
|
1172
|
+
children: Ve
|
|
1095
1173
|
})]
|
|
1096
1174
|
}),
|
|
1097
|
-
/* @__PURE__ */ Q("span", {
|
|
1175
|
+
!n && /* @__PURE__ */ Q("span", {
|
|
1098
1176
|
className: "text-xs text-muted-foreground",
|
|
1099
|
-
children: Y(t)
|
|
1100
|
-
}),
|
|
1101
|
-
c && /* @__PURE__ */ Q("span", {
|
|
1102
|
-
className: "text-xs text-muted-foreground",
|
|
1103
|
-
"data-testid": "dataset-metric-subcaption",
|
|
1104
1177
|
children: c
|
|
1105
1178
|
})
|
|
1106
1179
|
]
|
|
1107
1180
|
});
|
|
1108
1181
|
}
|
|
1109
|
-
if (
|
|
1110
|
-
let t =
|
|
1111
|
-
if (a.includes(e) || !e.endsWith(
|
|
1182
|
+
if (l) {
|
|
1183
|
+
let t = ue(H.rows, Ne), n = (e) => {
|
|
1184
|
+
if (a.includes(e) || !e.endsWith(Mr)) return;
|
|
1112
1185
|
let t = e.slice(0, -9);
|
|
1113
1186
|
return a.includes(t) ? t : void 0;
|
|
1114
1187
|
}, o = (e) => {
|
|
1115
1188
|
let t = n(e);
|
|
1116
|
-
return t ? `${Y(t)} · ${
|
|
1117
|
-
}, s = a.flatMap((e) =>
|
|
1189
|
+
return t ? `${Y(t)} · ${Ve}` : Y(e);
|
|
1190
|
+
}, s = a.flatMap((e) => ze.includes(e) ? [e, Nr(e)] : [e]), c = [...i, ...s], l = (t) => jr(String(e?.title ?? r ?? "export"), [c.map((e) => o(e)), ...t.map((e) => c.map((t) => {
|
|
1118
1191
|
let n = e[t];
|
|
1119
1192
|
return n == null ? "" : typeof n == "number" ? n : String(n);
|
|
1120
1193
|
}))]), u = (e) => /* @__PURE__ */ Q("button", {
|
|
1121
1194
|
type: "button",
|
|
1122
1195
|
onClick: () => l(e),
|
|
1123
1196
|
"data-testid": "dataset-export",
|
|
1124
|
-
title:
|
|
1125
|
-
"aria-label":
|
|
1197
|
+
title: R("dashboard.exportCsv", "Export CSV"),
|
|
1198
|
+
"aria-label": R("dashboard.exportCsv", "Export CSV"),
|
|
1126
1199
|
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",
|
|
1127
1200
|
children: /* @__PURE__ */ Q(wt, { className: "h-3.5 w-3.5" })
|
|
1128
1201
|
}), d = u(t);
|
|
1129
|
-
if (
|
|
1130
|
-
let e =
|
|
1202
|
+
if (E) {
|
|
1203
|
+
let e = Or(t, D, k, B), n = e.colHeaders.flatMap((e) => a.map((t) => ({
|
|
1131
1204
|
col: e,
|
|
1132
1205
|
measure: t,
|
|
1133
1206
|
header: a.length === 1 ? e.label : `${e.label} · ${Y(t)}`
|
|
1134
|
-
}))), r = (e, t) =>
|
|
1135
|
-
if (!
|
|
1136
|
-
let n = e?.[
|
|
1207
|
+
}))), r = (e, t) => I(e, J(t)?.format, J(t)?.currency, J(t)?.percentScale, B), i = (e, t) => {
|
|
1208
|
+
if (!ze.includes(t)) return null;
|
|
1209
|
+
let n = e?.[Nr(t)];
|
|
1137
1210
|
if (n == null) return null;
|
|
1138
|
-
let i = e?.[t], a =
|
|
1211
|
+
let i = e?.[t], a = Sn(typeof i == "number" ? i : null, typeof n == "number" ? n : null);
|
|
1139
1212
|
return /* @__PURE__ */ $("div", {
|
|
1140
1213
|
className: "flex items-center justify-end gap-1 text-[10px] font-normal leading-tight text-muted-foreground",
|
|
1141
1214
|
"data-testid": "matrix-cell-compare",
|
|
1142
1215
|
"data-direction": a?.direction,
|
|
1143
|
-
title:
|
|
1216
|
+
title: Ve,
|
|
1144
1217
|
children: [/* @__PURE__ */ Q("span", {
|
|
1145
1218
|
className: "tabular-nums",
|
|
1146
1219
|
children: r(n, t)
|
|
@@ -1150,28 +1223,27 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1150
1223
|
a.direction === "up" && /* @__PURE__ */ Q(vt, { className: "h-2.5 w-2.5" }),
|
|
1151
1224
|
a.direction === "down" && /* @__PURE__ */ Q(_t, { className: "h-2.5 w-2.5" }),
|
|
1152
1225
|
a.direction === "neutral" && /* @__PURE__ */ Q(kt, { className: "h-2.5 w-2.5" }),
|
|
1153
|
-
a.value
|
|
1154
|
-
"%"
|
|
1226
|
+
Cn(a.value)
|
|
1155
1227
|
]
|
|
1156
1228
|
})]
|
|
1157
1229
|
});
|
|
1158
|
-
}, o =
|
|
1230
|
+
}, o = ze.length > 0 ? /* @__PURE__ */ Q("caption", {
|
|
1159
1231
|
className: "px-2 pb-1 text-left text-[10px] font-normal text-muted-foreground",
|
|
1160
1232
|
"data-testid": "matrix-compare-caption",
|
|
1161
|
-
children:
|
|
1233
|
+
children: Ve
|
|
1162
1234
|
}) : null, s = (e) => {
|
|
1163
|
-
let t =
|
|
1164
|
-
return t &&
|
|
1235
|
+
let t = H.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows;
|
|
1236
|
+
return t && ue(t, Ne);
|
|
1165
1237
|
}, c = /* @__PURE__ */ new Map();
|
|
1166
|
-
for (let e of s(
|
|
1238
|
+
for (let e of s(D) ?? []) c.set(se(D.map((t) => le(e[t]))), e);
|
|
1167
1239
|
let l = /* @__PURE__ */ new Map();
|
|
1168
|
-
for (let e of s([k]) ?? []) l.set(
|
|
1169
|
-
let u = s([])?.[0], f = c.size > 0, p = l.size > 0, m =
|
|
1240
|
+
for (let e of s([k]) ?? []) l.set(se([le(e[k])]), e);
|
|
1241
|
+
let u = s([])?.[0], f = c.size > 0, p = l.size > 0, m = R("dashboard.total", "Total");
|
|
1170
1242
|
return /* @__PURE__ */ $("div", {
|
|
1171
1243
|
className: "relative h-full w-full overflow-auto p-1",
|
|
1172
1244
|
"data-testid": "dataset-matrix",
|
|
1173
1245
|
children: [
|
|
1174
|
-
|
|
1246
|
+
q,
|
|
1175
1247
|
d,
|
|
1176
1248
|
/* @__PURE__ */ $("table", {
|
|
1177
1249
|
className: "w-full text-xs",
|
|
@@ -1180,7 +1252,7 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1180
1252
|
/* @__PURE__ */ Q("thead", {
|
|
1181
1253
|
className: "bg-muted/40",
|
|
1182
1254
|
children: /* @__PURE__ */ $("tr", { children: [
|
|
1183
|
-
|
|
1255
|
+
D.map((e) => /* @__PURE__ */ Q("th", {
|
|
1184
1256
|
className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
|
|
1185
1257
|
children: Y(e)
|
|
1186
1258
|
}, e)),
|
|
@@ -1203,11 +1275,11 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1203
1275
|
children: e
|
|
1204
1276
|
}, t)),
|
|
1205
1277
|
n.map((n) => {
|
|
1206
|
-
let a = e.cellIndex.get(ce(t.id, n.col.id)), o = a == null ? void 0 :
|
|
1278
|
+
let a = e.cellIndex.get(ce(t.id, n.col.id)), o = a == null ? void 0 : H.rows[a], s = Je && a != null, c = [...t.labels, n.col.label].filter(Boolean).join(" / ");
|
|
1207
1279
|
return /* @__PURE__ */ $("td", {
|
|
1208
1280
|
className: Z("px-2 py-1 text-right tabular-nums whitespace-nowrap", s && "cursor-pointer hover:bg-accent/40"),
|
|
1209
1281
|
"data-testid": s ? "dataset-drill-cell" : void 0,
|
|
1210
|
-
onClick: s ? () =>
|
|
1282
|
+
onClick: s ? () => Ye(a, c) : void 0,
|
|
1211
1283
|
children: [o ? r(o[n.measure], n.measure) : "—", i(o, n.measure)]
|
|
1212
1284
|
}, `${n.col.id}-${n.measure}`);
|
|
1213
1285
|
}),
|
|
@@ -1224,8 +1296,8 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1224
1296
|
className: "border-t bg-muted/30 font-medium",
|
|
1225
1297
|
"data-testid": "matrix-total-row",
|
|
1226
1298
|
children: [
|
|
1227
|
-
|
|
1228
|
-
colSpan:
|
|
1299
|
+
D.length > 0 && /* @__PURE__ */ Q("td", {
|
|
1300
|
+
colSpan: D.length,
|
|
1229
1301
|
className: "px-2 py-1 whitespace-nowrap",
|
|
1230
1302
|
children: m
|
|
1231
1303
|
}),
|
|
@@ -1245,7 +1317,7 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1245
1317
|
})] })
|
|
1246
1318
|
]
|
|
1247
1319
|
}),
|
|
1248
|
-
|
|
1320
|
+
Xe
|
|
1249
1321
|
]
|
|
1250
1322
|
});
|
|
1251
1323
|
}
|
|
@@ -1254,20 +1326,20 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1254
1326
|
index: t
|
|
1255
1327
|
})), h = Ce && f.includes(Ce.column) ? Ce : null, g = h ? m.map((e) => ({
|
|
1256
1328
|
...e,
|
|
1257
|
-
key:
|
|
1329
|
+
key: re(e.row[h.column])
|
|
1258
1330
|
})).sort((e, t) => {
|
|
1259
1331
|
if (e.key === null && t.key === null) return 0;
|
|
1260
1332
|
if (e.key === null) return 1;
|
|
1261
1333
|
if (t.key === null) return -1;
|
|
1262
|
-
let n =
|
|
1334
|
+
let n = O(e.key, t.key);
|
|
1263
1335
|
return h.dir === "asc" ? n : -n;
|
|
1264
1336
|
}) : [...m].sort((e, t) => {
|
|
1265
1337
|
for (let n of i) {
|
|
1266
|
-
let r = +(
|
|
1338
|
+
let r = +(re(e.row[n]) === null), i = +(re(t.row[n]) === null);
|
|
1267
1339
|
if (r !== i) return r - i;
|
|
1268
1340
|
}
|
|
1269
1341
|
return 0;
|
|
1270
|
-
}), _ = (e) => p.has(e) ? "desc" : "asc", v = (e) =>
|
|
1342
|
+
}), _ = (e) => p.has(e) ? "desc" : "asc", v = (e) => Te((t) => {
|
|
1271
1343
|
let n = _(e);
|
|
1272
1344
|
return t?.column === e ? t.dir === n ? {
|
|
1273
1345
|
column: e,
|
|
@@ -1276,7 +1348,7 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1276
1348
|
column: e,
|
|
1277
1349
|
dir: n
|
|
1278
1350
|
};
|
|
1279
|
-
}), y =
|
|
1351
|
+
}), y = ae ? H.totals?.find((e) => Array.isArray(e.dimensions) && e.dimensions.length === 0)?.rows?.[0] : void 0, b = R("dashboard.total", "Total"), x = (e) => {
|
|
1280
1352
|
if (h?.column !== e) return /* @__PURE__ */ Q(Ct, {
|
|
1281
1353
|
className: "ml-0.5 h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-50",
|
|
1282
1354
|
"aria-hidden": "true"
|
|
@@ -1290,7 +1362,7 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1290
1362
|
return /* @__PURE__ */ $("div", {
|
|
1291
1363
|
className: "relative h-full w-full overflow-auto p-1",
|
|
1292
1364
|
children: [
|
|
1293
|
-
|
|
1365
|
+
q,
|
|
1294
1366
|
u(g.map((e) => e.row)),
|
|
1295
1367
|
/* @__PURE__ */ $("table", {
|
|
1296
1368
|
className: "w-full text-xs",
|
|
@@ -1318,14 +1390,14 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1318
1390
|
}) })
|
|
1319
1391
|
}),
|
|
1320
1392
|
/* @__PURE__ */ Q("tbody", { children: g.map(({ row: e, index: t }) => /* @__PURE__ */ Q("tr", {
|
|
1321
|
-
className: Z("border-t transition-colors hover:bg-muted/40",
|
|
1322
|
-
"data-testid":
|
|
1323
|
-
onClick:
|
|
1393
|
+
className: Z("border-t transition-colors hover:bg-muted/40", Je && "cursor-pointer hover:bg-accent/40"),
|
|
1394
|
+
"data-testid": Je ? "dataset-drill-row" : void 0,
|
|
1395
|
+
onClick: Je ? () => Ye(t, qe.map((t) => F(e[t], B)).filter(Boolean).join(" / ")) : void 0,
|
|
1324
1396
|
children: f.map((t) => {
|
|
1325
1397
|
let r = n(t) ?? (a.includes(t) ? t : void 0);
|
|
1326
1398
|
return /* @__PURE__ */ Q("td", {
|
|
1327
1399
|
className: Z("px-2 py-1 whitespace-nowrap tabular-nums", p.has(t) && "text-right"),
|
|
1328
|
-
children: r ?
|
|
1400
|
+
children: r ? I(e[t], J(r)?.format, J(r)?.currency, J(r)?.percentScale, B) : F(e[t], B)
|
|
1329
1401
|
}, t);
|
|
1330
1402
|
})
|
|
1331
1403
|
}, t)) }),
|
|
@@ -1342,108 +1414,97 @@ function Mr({ widget: e, dataSource: t, subCaption: n }) {
|
|
|
1342
1414
|
let t = n(e) ?? e;
|
|
1343
1415
|
return /* @__PURE__ */ Q("td", {
|
|
1344
1416
|
className: Z("px-2 py-1 whitespace-nowrap tabular-nums", p.has(e) && "text-right"),
|
|
1345
|
-
children:
|
|
1417
|
+
children: I(y[e], J(t)?.format, J(t)?.currency, J(t)?.percentScale, B)
|
|
1346
1418
|
}, e);
|
|
1347
1419
|
})]
|
|
1348
1420
|
})
|
|
1349
1421
|
})
|
|
1350
1422
|
]
|
|
1351
1423
|
}),
|
|
1352
|
-
|
|
1424
|
+
Xe
|
|
1353
1425
|
]
|
|
1354
1426
|
});
|
|
1355
1427
|
}
|
|
1356
|
-
let
|
|
1428
|
+
let Ze = ue(H.rows, Ne), $e = R("chart.nullCategory", "(None)"), et = i.length === 0, tt = R("dashboard.total", "Total"), nt = new Set(a.map((e) => J(e)?.aggregate)), [it] = nt, at = {
|
|
1429
|
+
dataKey: Ur,
|
|
1430
|
+
label: tt,
|
|
1431
|
+
...nt.size === 1 && typeof it == "string" ? { aggregate: it } : {}
|
|
1432
|
+
}, ot = et || P ? null : g(Fe), st = ot ? [...Ze].sort((e, t) => Wr(e[i[0]], ot) - Wr(t[i[0]], ot)) : Ze, { data: ct, xAxisKey: lt, series: ut } = et ? {
|
|
1357
1433
|
data: a.map((e) => ({
|
|
1358
|
-
[
|
|
1359
|
-
[
|
|
1360
|
-
...
|
|
1434
|
+
[Hr]: Y(e),
|
|
1435
|
+
[Ur]: H.rows[0]?.[e],
|
|
1436
|
+
...ze.includes(e) ? { [Nr(Ur)]: H.rows[0]?.[Nr(e)] } : {}
|
|
1361
1437
|
})),
|
|
1362
|
-
xAxisKey:
|
|
1363
|
-
series: [
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
} :
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
})), ut = lt.length > 0 ? [...ot.map((e) => ({
|
|
1438
|
+
xAxisKey: Hr,
|
|
1439
|
+
series: [at]
|
|
1440
|
+
} : _(st, i, a, H.fields, {
|
|
1441
|
+
nullCategoryLabel: $e,
|
|
1442
|
+
builtinAggregateLabels: Ae(R)
|
|
1443
|
+
}), dt = i.length >= 2 && a.length === 1 && !P ? g(Ie) : null, ft = dt ? [...ut].sort((e, t) => Wr(e.label, dt, $e) - Wr(t.label, dt, $e)) : ut, pt = i.length >= 2 && a.length === 1, mt = et ? ze.length > 0 ? [at] : [] : ze.map((e) => {
|
|
1444
|
+
let t = J(e)?.aggregate;
|
|
1445
|
+
return {
|
|
1446
|
+
dataKey: e,
|
|
1447
|
+
label: Y(e),
|
|
1448
|
+
...typeof t == "string" ? { aggregate: t } : {}
|
|
1449
|
+
};
|
|
1450
|
+
}), ht = pt ? [] : mt.map(({ dataKey: e, label: t, aggregate: n }) => ({
|
|
1451
|
+
dataKey: Nr(e),
|
|
1452
|
+
label: `${t} · ${Ve}`,
|
|
1453
|
+
variant: "comparison",
|
|
1454
|
+
...n === void 0 ? {} : { aggregate: n }
|
|
1455
|
+
})), yt = ht.length > 0 ? [...ft.map((e) => ({
|
|
1381
1456
|
...e,
|
|
1382
1457
|
variant: "current"
|
|
1383
|
-
})), ...
|
|
1384
|
-
let t = String(e), n =
|
|
1458
|
+
})), ...ht] : ft, bt = (Array.isArray(A.stageOrder) ? A.stageOrder : void 0)?.flatMap((e) => {
|
|
1459
|
+
let t = String(e), n = Ne?.[i[0]]?.[t];
|
|
1385
1460
|
return n && n !== t ? [t, n] : [t];
|
|
1386
|
-
}),
|
|
1387
|
-
let t = ne(
|
|
1388
|
-
nullCategoryLabel:
|
|
1461
|
+
}), Tt = bt?.length ? bt : Fe, Et = C(e?.chartConfig, Me), Dt = Je ? (e) => {
|
|
1462
|
+
let t = ne(Ze, i, a, e?.category, e?.series, {
|
|
1463
|
+
nullCategoryLabel: $e,
|
|
1389
1464
|
bucketId: e?.categoryId
|
|
1390
1465
|
});
|
|
1391
1466
|
if (t < 0) return;
|
|
1392
1467
|
let n = i.length >= 2 && a.length === 1, r = e?.seriesLabel ?? e?.series, o = [e?.category, n ? r : void 0].filter(Boolean).map(String).join(" / ");
|
|
1393
|
-
|
|
1468
|
+
Ye(t, o);
|
|
1394
1469
|
} : void 0;
|
|
1395
1470
|
return /* @__PURE__ */ $("div", {
|
|
1396
1471
|
className: Z("relative h-full w-full min-h-[220px]"),
|
|
1397
1472
|
children: [
|
|
1398
|
-
|
|
1399
|
-
/* @__PURE__ */ Q(
|
|
1473
|
+
q,
|
|
1474
|
+
/* @__PURE__ */ Q(_e, {
|
|
1400
1475
|
schema: {
|
|
1401
1476
|
type: "chart",
|
|
1402
|
-
chartType:
|
|
1403
|
-
data:
|
|
1404
|
-
xAxisKey:
|
|
1405
|
-
series:
|
|
1477
|
+
chartType: p,
|
|
1478
|
+
data: ct,
|
|
1479
|
+
xAxisKey: lt,
|
|
1480
|
+
series: yt,
|
|
1406
1481
|
isAnimationActive: !1,
|
|
1407
|
-
...
|
|
1408
|
-
...
|
|
1482
|
+
...Et,
|
|
1483
|
+
...Tt ? { categoryOrder: Tt } : {}
|
|
1409
1484
|
},
|
|
1410
|
-
onChartClick:
|
|
1411
|
-
onSegmentClick:
|
|
1485
|
+
onChartClick: Dt,
|
|
1486
|
+
onSegmentClick: Dt
|
|
1412
1487
|
}),
|
|
1413
|
-
|
|
1488
|
+
Xe
|
|
1414
1489
|
]
|
|
1415
1490
|
});
|
|
1416
1491
|
}
|
|
1417
1492
|
//#endregion
|
|
1418
|
-
//#region src/widgetSubCaption.ts
|
|
1419
|
-
function Nr(e, t = !1) {
|
|
1420
|
-
let { widgetSubCaption: n } = Fe(), { language: r } = Ie();
|
|
1421
|
-
return i((i) => {
|
|
1422
|
-
let a = i.options?.description, o = K(a, r) || void 0;
|
|
1423
|
-
return t || !e || !i.id ? o : n(e, i.id, o);
|
|
1424
|
-
}, [
|
|
1425
|
-
t,
|
|
1426
|
-
e,
|
|
1427
|
-
n,
|
|
1428
|
-
r
|
|
1429
|
-
]);
|
|
1430
|
-
}
|
|
1431
|
-
//#endregion
|
|
1432
1493
|
//#region src/useDashboardAutoRefresh.ts
|
|
1433
|
-
function
|
|
1494
|
+
function Jr(e, t) {
|
|
1434
1495
|
e && (t(!0), e(), setTimeout(() => t(!1), 600));
|
|
1435
1496
|
}
|
|
1436
|
-
function
|
|
1497
|
+
function Yr(t, n) {
|
|
1437
1498
|
let [r, i] = e.useState(!1), a = e.useRef(n);
|
|
1438
1499
|
e.useEffect(() => {
|
|
1439
1500
|
a.current = n;
|
|
1440
1501
|
});
|
|
1441
1502
|
let o = e.useCallback(() => {
|
|
1442
|
-
|
|
1503
|
+
Jr(a.current, i);
|
|
1443
1504
|
}, []), s = t.refreshIntervalSeconds, c = !!n;
|
|
1444
1505
|
return e.useEffect(() => {
|
|
1445
1506
|
if (!s || s <= 0 || !c) return;
|
|
1446
|
-
let e = setInterval(() =>
|
|
1507
|
+
let e = setInterval(() => Jr(a.current, i), s * 1e3);
|
|
1447
1508
|
return () => clearInterval(e);
|
|
1448
1509
|
}, [s, c]), {
|
|
1449
1510
|
refreshing: r,
|
|
@@ -1452,22 +1513,22 @@ function Fr(t, n) {
|
|
|
1452
1513
|
}
|
|
1453
1514
|
//#endregion
|
|
1454
1515
|
//#region src/DashboardFilterBar.tsx
|
|
1455
|
-
function
|
|
1456
|
-
let { language: t } =
|
|
1516
|
+
function Xr(e) {
|
|
1517
|
+
let { language: t } = K(), { fieldLabel: n } = Le(), r = G(e.label, t);
|
|
1457
1518
|
return e.object ? n(e.object, e.field, r) : r;
|
|
1458
1519
|
}
|
|
1459
|
-
var
|
|
1460
|
-
function
|
|
1520
|
+
var Zr = "__all__", Qr = "__custom__";
|
|
1521
|
+
function $r(e, t) {
|
|
1461
1522
|
if (e) {
|
|
1462
1523
|
if (e.preset) return t(e.preset);
|
|
1463
1524
|
if (e.from || e.to) return `${e.from ?? "…"} – ${e.to ?? "…"}`;
|
|
1464
1525
|
}
|
|
1465
1526
|
}
|
|
1466
|
-
function
|
|
1527
|
+
function ei(e) {
|
|
1467
1528
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
1468
1529
|
}
|
|
1469
|
-
function
|
|
1470
|
-
let [e, t] =
|
|
1530
|
+
function ti() {
|
|
1531
|
+
let [e, t] = u(!1), [n, r] = u(!1), i = l(null), a = l(!1), o = l(!1), s = l(!1), c = () => {
|
|
1471
1532
|
a.current = !0, queueMicrotask(() => {
|
|
1472
1533
|
a.current = !1;
|
|
1473
1534
|
});
|
|
@@ -1484,10 +1545,10 @@ function Vr() {
|
|
|
1484
1545
|
o.current && (o.current = !1, e.preventDefault(), t(!0));
|
|
1485
1546
|
} },
|
|
1486
1547
|
customItem: {
|
|
1487
|
-
onPointerUp:
|
|
1488
|
-
onClick:
|
|
1548
|
+
onPointerUp: c,
|
|
1549
|
+
onClick: c,
|
|
1489
1550
|
onKeyDown: (e) => {
|
|
1490
|
-
(e.key === "Enter" || e.key === " ") &&
|
|
1551
|
+
(e.key === "Enter" || e.key === " ") && c();
|
|
1491
1552
|
}
|
|
1492
1553
|
},
|
|
1493
1554
|
onCustomValue: () => {
|
|
@@ -1507,8 +1568,8 @@ function Vr() {
|
|
|
1507
1568
|
}
|
|
1508
1569
|
};
|
|
1509
1570
|
}
|
|
1510
|
-
function
|
|
1511
|
-
let r = Re(), i =
|
|
1571
|
+
function ni({ def: e, value: t, onChange: n }) {
|
|
1572
|
+
let r = Re(), i = Xr(e), a = ti(), o = e.allowCustomRange !== !1, s = (e) => r(`dashboard.filters.range.${e}`, e.replace(/_/g, " ")), c = t?.preset ?? (t?.from || t?.to ? Qr : Zr), l = t?.from && !t.from.startsWith("{") ? pe(t.from) : void 0, u = t?.to && !t.to.startsWith("{") ? pe(t.to) : void 0, d = l && !Number.isNaN(l.getTime()) ? l : void 0;
|
|
1512
1573
|
return /* @__PURE__ */ $("div", {
|
|
1513
1574
|
className: "flex items-center gap-1",
|
|
1514
1575
|
"data-testid": `dashboard-filter-${e.name}`,
|
|
@@ -1516,7 +1577,7 @@ function Hr({ def: e, value: t, onChange: n }) {
|
|
|
1516
1577
|
value: c,
|
|
1517
1578
|
...a.select,
|
|
1518
1579
|
onValueChange: (e) => {
|
|
1519
|
-
e ===
|
|
1580
|
+
e === Zr ? n(void 0) : e === Qr ? a.onCustomValue() : n({ preset: e });
|
|
1520
1581
|
},
|
|
1521
1582
|
children: [/* @__PURE__ */ $(st, {
|
|
1522
1583
|
...a.selectTrigger,
|
|
@@ -1524,21 +1585,21 @@ function Hr({ def: e, value: t, onChange: n }) {
|
|
|
1524
1585
|
"aria-label": i || r("dashboard.filters.dateRange", "Date range"),
|
|
1525
1586
|
children: [/* @__PURE__ */ Q(bt, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ Q(ct, {
|
|
1526
1587
|
placeholder: r("dashboard.filters.dateRange", "Date range"),
|
|
1527
|
-
children:
|
|
1588
|
+
children: $r(t, s) ?? r("dashboard.filters.allTime", "All time")
|
|
1528
1589
|
})]
|
|
1529
1590
|
}), /* @__PURE__ */ $(at, {
|
|
1530
1591
|
...a.selectContent,
|
|
1531
1592
|
children: [
|
|
1532
1593
|
/* @__PURE__ */ Q(ot, {
|
|
1533
|
-
value:
|
|
1594
|
+
value: Zr,
|
|
1534
1595
|
children: r("dashboard.filters.allTime", "All time")
|
|
1535
1596
|
}),
|
|
1536
|
-
|
|
1597
|
+
f.map((e) => /* @__PURE__ */ Q(ot, {
|
|
1537
1598
|
value: e,
|
|
1538
1599
|
children: s(e)
|
|
1539
1600
|
}, e)),
|
|
1540
1601
|
o && /* @__PURE__ */ Q(ot, {
|
|
1541
|
-
value:
|
|
1602
|
+
value: Qr,
|
|
1542
1603
|
...a.customItem,
|
|
1543
1604
|
children: r("dashboard.filters.custom", "Custom…")
|
|
1544
1605
|
})
|
|
@@ -1556,10 +1617,10 @@ function Hr({ def: e, value: t, onChange: n }) {
|
|
|
1556
1617
|
...a.popoverContent,
|
|
1557
1618
|
className: "w-auto p-0",
|
|
1558
1619
|
align: "start",
|
|
1559
|
-
children: /* @__PURE__ */ Q(
|
|
1620
|
+
children: /* @__PURE__ */ Q(J, {
|
|
1560
1621
|
mode: "range",
|
|
1561
1622
|
numberOfMonths: 2,
|
|
1562
|
-
defaultMonth:
|
|
1623
|
+
defaultMonth: d,
|
|
1563
1624
|
selected: {
|
|
1564
1625
|
from: l,
|
|
1565
1626
|
to: u
|
|
@@ -1570,8 +1631,8 @@ function Hr({ def: e, value: t, onChange: n }) {
|
|
|
1570
1631
|
return;
|
|
1571
1632
|
}
|
|
1572
1633
|
n({
|
|
1573
|
-
...e?.from ? { from:
|
|
1574
|
-
...e?.to ? { to:
|
|
1634
|
+
...e?.from ? { from: ei(e.from) } : {},
|
|
1635
|
+
...e?.to ? { to: ei(e.to) } : {}
|
|
1575
1636
|
});
|
|
1576
1637
|
}
|
|
1577
1638
|
})
|
|
@@ -1579,7 +1640,7 @@ function Hr({ def: e, value: t, onChange: n }) {
|
|
|
1579
1640
|
})]
|
|
1580
1641
|
});
|
|
1581
1642
|
}
|
|
1582
|
-
function
|
|
1643
|
+
function ri(e, t, n) {
|
|
1583
1644
|
let r = Array.isArray(t) && t.length === e.length && t.some((e) => e?.[n.valueField] !== void 0) ? t : void 0, i = /* @__PURE__ */ new Map();
|
|
1584
1645
|
for (let t = 0; t < e.length; t++) {
|
|
1585
1646
|
let a = e[t], o = r ? r[t]?.[n.valueField] : a?.[n.valueField];
|
|
@@ -1594,8 +1655,8 @@ function Ur(e, t, n) {
|
|
|
1594
1655
|
label: t
|
|
1595
1656
|
}));
|
|
1596
1657
|
}
|
|
1597
|
-
function
|
|
1598
|
-
let i = Re(), { language: a } =
|
|
1658
|
+
function ii({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
1659
|
+
let i = Re(), { language: a } = K(), { translateOptions: s } = Le(), l = Xr(e), [d, f] = u(null), p = e.optionsFrom, m = JSON.stringify(p?.filter ?? null), h = be(p && r && (typeof r.queryDataset == "function" || typeof r.find == "function") && p.object || void 0);
|
|
1599
1660
|
o(() => {
|
|
1600
1661
|
if (!p || !r) return;
|
|
1601
1662
|
let e = !1, t = () => {
|
|
@@ -1610,7 +1671,7 @@ function Wr({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
|
1610
1671
|
}).then((t) => {
|
|
1611
1672
|
if (e) return;
|
|
1612
1673
|
let n = Array.isArray(t) ? t : t?.data ?? [];
|
|
1613
|
-
f(
|
|
1674
|
+
f(ri(n, void 0, p));
|
|
1614
1675
|
}).catch(() => {
|
|
1615
1676
|
e || f([]);
|
|
1616
1677
|
});
|
|
@@ -1641,7 +1702,7 @@ function Wr({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
|
1641
1702
|
}).then((t) => {
|
|
1642
1703
|
if (e) return;
|
|
1643
1704
|
let n = Array.isArray(t?.rows) ? t.rows : [], r = Array.isArray(t?.drillRawRows) ? t.drillRawRows : void 0;
|
|
1644
|
-
f(
|
|
1705
|
+
f(ri(n, r, p));
|
|
1645
1706
|
}).catch(() => {
|
|
1646
1707
|
e || t();
|
|
1647
1708
|
});
|
|
@@ -1657,24 +1718,24 @@ function Wr({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
|
1657
1718
|
r,
|
|
1658
1719
|
h
|
|
1659
1720
|
]);
|
|
1660
|
-
let g =
|
|
1721
|
+
let g = c(() => (e.options?.length ? e.options : d ?? []).map((e) => ({
|
|
1661
1722
|
value: e.value,
|
|
1662
|
-
label:
|
|
1723
|
+
label: G(e.label, a) || e.value
|
|
1663
1724
|
})), [
|
|
1664
1725
|
e.options,
|
|
1665
1726
|
d,
|
|
1666
1727
|
a
|
|
1667
|
-
]), _ = e.object ?
|
|
1728
|
+
]), _ = e.object ? s(e.object, e.field, g) : g, v = l || e.name, y = t ? _.find((e) => e.value === String(t))?.label ?? String(t) : void 0;
|
|
1668
1729
|
return /* @__PURE__ */ $(it, {
|
|
1669
|
-
value: t ? String(t) :
|
|
1670
|
-
onValueChange: (e) => n(e ===
|
|
1730
|
+
value: t ? String(t) : Zr,
|
|
1731
|
+
onValueChange: (e) => n(e === Zr ? void 0 : e),
|
|
1671
1732
|
children: [/* @__PURE__ */ Q(st, {
|
|
1672
1733
|
className: "h-8 w-auto min-w-32",
|
|
1673
1734
|
"aria-label": v,
|
|
1674
1735
|
"data-testid": `dashboard-filter-${e.name}`,
|
|
1675
1736
|
children: /* @__PURE__ */ Q(ct, { children: y ?? `${v}: ${i("dashboard.filters.all", "All")}` })
|
|
1676
1737
|
}), /* @__PURE__ */ $(at, { children: [/* @__PURE__ */ Q(ot, {
|
|
1677
|
-
value:
|
|
1738
|
+
value: Zr,
|
|
1678
1739
|
children: i("dashboard.filters.all", "All")
|
|
1679
1740
|
}), _.map((e) => /* @__PURE__ */ Q(ot, {
|
|
1680
1741
|
value: e.value,
|
|
@@ -1682,8 +1743,8 @@ function Wr({ def: e, value: t, onChange: n, dataSource: r }) {
|
|
|
1682
1743
|
}, e.value))] })]
|
|
1683
1744
|
});
|
|
1684
1745
|
}
|
|
1685
|
-
function
|
|
1686
|
-
let r =
|
|
1746
|
+
function ai({ def: e, value: t, onChange: n }) {
|
|
1747
|
+
let r = Xr(e) || e.name, [i, a] = u(t == null ? "" : String(t));
|
|
1687
1748
|
o(() => {
|
|
1688
1749
|
a(t == null ? "" : String(t));
|
|
1689
1750
|
}, [t]);
|
|
@@ -1709,7 +1770,7 @@ function Gr({ def: e, value: t, onChange: n }) {
|
|
|
1709
1770
|
"data-testid": `dashboard-filter-${e.name}`
|
|
1710
1771
|
});
|
|
1711
1772
|
}
|
|
1712
|
-
function
|
|
1773
|
+
function oi({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, className: a }) {
|
|
1713
1774
|
let o = Re();
|
|
1714
1775
|
if (e.length === 0) return null;
|
|
1715
1776
|
let s = (e) => e == null || e === "" || typeof e == "object" && Object.keys(e).length === 0, c = e.some((e) => {
|
|
@@ -1723,16 +1784,16 @@ function Kr({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, classN
|
|
|
1723
1784
|
"aria-label": o("dashboard.filters.label", "Dashboard filters"),
|
|
1724
1785
|
children: [e.map((e) => {
|
|
1725
1786
|
let r = t[e.name], a = (t) => n(e.name, t);
|
|
1726
|
-
return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(
|
|
1787
|
+
return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(ni, {
|
|
1727
1788
|
def: e,
|
|
1728
1789
|
value: r,
|
|
1729
1790
|
onChange: a
|
|
1730
|
-
}, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q(
|
|
1791
|
+
}, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q(ii, {
|
|
1731
1792
|
def: e,
|
|
1732
1793
|
value: r,
|
|
1733
1794
|
onChange: a,
|
|
1734
1795
|
dataSource: i
|
|
1735
|
-
}, e.name) : /* @__PURE__ */ Q(
|
|
1796
|
+
}, e.name) : /* @__PURE__ */ Q(ai, {
|
|
1736
1797
|
def: e,
|
|
1737
1798
|
value: r,
|
|
1738
1799
|
onChange: a
|
|
@@ -1748,7 +1809,7 @@ function Kr({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, classN
|
|
|
1748
1809
|
}
|
|
1749
1810
|
//#endregion
|
|
1750
1811
|
//#region src/DashboardRenderer.tsx
|
|
1751
|
-
function
|
|
1812
|
+
function si({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
1752
1813
|
let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = Wt({
|
|
1753
1814
|
id: e,
|
|
1754
1815
|
disabled: t
|
|
@@ -1771,16 +1832,16 @@ function qr({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
|
|
|
1771
1832
|
children: i
|
|
1772
1833
|
});
|
|
1773
1834
|
}
|
|
1774
|
-
function
|
|
1835
|
+
function ci(e) {
|
|
1775
1836
|
return e ? pt(e) : null;
|
|
1776
1837
|
}
|
|
1777
|
-
var
|
|
1838
|
+
var li = [
|
|
1778
1839
|
"hsl(var(--chart-1))",
|
|
1779
1840
|
"hsl(var(--chart-2))",
|
|
1780
1841
|
"hsl(var(--chart-3))",
|
|
1781
1842
|
"hsl(var(--chart-4))",
|
|
1782
1843
|
"hsl(var(--chart-5))"
|
|
1783
|
-
],
|
|
1844
|
+
], ui = /* @__PURE__ */ new Set([
|
|
1784
1845
|
"bar",
|
|
1785
1846
|
"horizontal-bar",
|
|
1786
1847
|
"line",
|
|
@@ -1792,15 +1853,15 @@ var Yr = [
|
|
|
1792
1853
|
"treemap",
|
|
1793
1854
|
"sankey"
|
|
1794
1855
|
]);
|
|
1795
|
-
function
|
|
1796
|
-
return
|
|
1856
|
+
function di(e) {
|
|
1857
|
+
return ui.has(e) ? { enabled: !0 } : void 0;
|
|
1797
1858
|
}
|
|
1798
|
-
var
|
|
1799
|
-
function
|
|
1800
|
-
return
|
|
1859
|
+
var fi = /* @__PURE__ */ new Set(["object-chart", "object-data-table"]);
|
|
1860
|
+
function pi(e) {
|
|
1861
|
+
return fi.has(e.type);
|
|
1801
1862
|
}
|
|
1802
|
-
var
|
|
1803
|
-
let
|
|
1863
|
+
var mi = r(({ schema: e, className: t, dataSource: r, onRefresh: a, recordCount: d, userActions: f, designMode: p, selectedWidgetId: m, onWidgetClick: h, onWidgetsReorder: g, modalHandler: _, scriptHandlers: v, hideHeaderText: y, onRefreshStateChange: b, localized: T, ...E }, D) => {
|
|
1864
|
+
let O = Oe(r), k = (() => {
|
|
1804
1865
|
if (e.columns != null) return e.columns;
|
|
1805
1866
|
let t = e.widgets ?? [], n = 0;
|
|
1806
1867
|
for (let e of t) {
|
|
@@ -1808,108 +1869,123 @@ var ei = r(({ schema: e, className: t, dataSource: r, onRefresh: a, recordCount:
|
|
|
1808
1869
|
t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
|
|
1809
1870
|
}
|
|
1810
1871
|
return n > 4 ? 12 : 4;
|
|
1811
|
-
})(),
|
|
1812
|
-
if (e != null) return
|
|
1813
|
-
}, [
|
|
1814
|
-
let t =
|
|
1872
|
+
})(), A = k, j = e.gap || 4, M = e.columns != null || k !== 4, [N, ee] = u(!1), P = c(() => de(e), [e.globalFilters, e.dateRange]), { variables: te, setVariable: ne, resetVariables: F } = De(), { dashboardLabel: I, dashboardDescription: re, dashboardActionLabel: ie, widgetTitle: ae, widgetDescription: L, fieldLabel: R } = Ee(), { t: se, language: ce } = K(), le = Re(), ue = Pe(), z = i((e) => {
|
|
1873
|
+
if (e != null) return G(e, ce) || void 0;
|
|
1874
|
+
}, [ce]), fe = i((e, t, n) => bn(se, R, e, t, n), [se, R]), B = e.name, pe = i((e) => {
|
|
1875
|
+
let t = G(e.label, ce) || "";
|
|
1815
1876
|
if (!B) return t;
|
|
1816
1877
|
let n = e.actionUrl || t;
|
|
1817
|
-
return
|
|
1878
|
+
return ie(B, n, t);
|
|
1818
1879
|
}, [
|
|
1819
1880
|
B,
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
]),
|
|
1823
|
-
let t =
|
|
1881
|
+
ie,
|
|
1882
|
+
ce
|
|
1883
|
+
]), V = c(() => (e.header?.actions ?? []).map((e) => {
|
|
1884
|
+
let t = G(e.label, ce) || void 0, n = e.actionType || "url";
|
|
1824
1885
|
return {
|
|
1825
1886
|
name: e.actionUrl || t,
|
|
1826
|
-
type:
|
|
1887
|
+
type: n,
|
|
1827
1888
|
target: e.actionUrl,
|
|
1828
|
-
label: t
|
|
1889
|
+
label: t,
|
|
1890
|
+
...n === "url" ? { toast: { showOnSuccess: !1 } } : {}
|
|
1829
1891
|
};
|
|
1830
|
-
}), [e.header?.actions,
|
|
1831
|
-
let t =
|
|
1832
|
-
return
|
|
1892
|
+
}), [e.header?.actions, ce]), { executeAction: he, engine: ge } = ye({ actions: V }), H = i((e) => {
|
|
1893
|
+
let t = z(e.title);
|
|
1894
|
+
return T || !B || !e.id || t === void 0 ? t : ae(B, e.id, t);
|
|
1833
1895
|
}, [
|
|
1834
|
-
|
|
1896
|
+
T,
|
|
1835
1897
|
B,
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
]),
|
|
1839
|
-
let t =
|
|
1840
|
-
return
|
|
1898
|
+
ae,
|
|
1899
|
+
z
|
|
1900
|
+
]), ve = i((e) => {
|
|
1901
|
+
let t = z(e.description);
|
|
1902
|
+
return T || !B || !e.id ? t : L(B, e.id, t);
|
|
1841
1903
|
}, [
|
|
1842
|
-
|
|
1904
|
+
T,
|
|
1843
1905
|
B,
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
])
|
|
1906
|
+
L,
|
|
1907
|
+
z
|
|
1908
|
+
]);
|
|
1847
1909
|
o(() => {
|
|
1848
|
-
let e =
|
|
1849
|
-
if (
|
|
1910
|
+
let e = ge.getRunner();
|
|
1911
|
+
if (_ && e.setModalHandler(_), v) for (let [t, n] of Object.entries(v)) e.registerScript(t, n);
|
|
1850
1912
|
}, [
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1913
|
+
ge,
|
|
1914
|
+
_,
|
|
1915
|
+
v
|
|
1854
1916
|
]), o(() => {
|
|
1855
|
-
let e = () =>
|
|
1917
|
+
let e = () => ee(window.innerWidth < 768);
|
|
1856
1918
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1857
1919
|
}, []);
|
|
1858
|
-
let { refreshing:
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1920
|
+
let { refreshing: be, handleRefresh: U } = Yr(e, a), xe = !!b, Se = !!a, Ce = l(b), we = l(U);
|
|
1921
|
+
s(() => {
|
|
1922
|
+
Ce.current = b, we.current = U;
|
|
1923
|
+
}), s(() => {
|
|
1924
|
+
xe && Ce.current?.(Se ? {
|
|
1925
|
+
refreshing: be,
|
|
1926
|
+
handleRefresh: () => we.current()
|
|
1927
|
+
} : null);
|
|
1928
|
+
}, [
|
|
1929
|
+
xe,
|
|
1930
|
+
Se,
|
|
1931
|
+
be
|
|
1932
|
+
]), s(() => () => Ce.current?.(null), []);
|
|
1933
|
+
let Te = i((e, t) => {
|
|
1934
|
+
p && h && t && (e.stopPropagation(), h(t));
|
|
1935
|
+
}, [p, h]), ke = i((t, n, r) => {
|
|
1936
|
+
if (!p || !h) return;
|
|
1862
1937
|
let i = e.widgets || [];
|
|
1863
|
-
if (t.key === "Enter" || t.key === " ") t.preventDefault(),
|
|
1938
|
+
if (t.key === "Enter" || t.key === " ") t.preventDefault(), h(n ?? null);
|
|
1864
1939
|
else if (t.key === "ArrowRight" || t.key === "ArrowDown") {
|
|
1865
1940
|
t.preventDefault();
|
|
1866
1941
|
let e = r + 1 < i.length ? i[r + 1] : null;
|
|
1867
|
-
e?.id &&
|
|
1942
|
+
e?.id && h(e.id);
|
|
1868
1943
|
} else if (t.key === "ArrowLeft" || t.key === "ArrowUp") {
|
|
1869
1944
|
t.preventDefault();
|
|
1870
1945
|
let e = r - 1 >= 0 ? i[r - 1] : null;
|
|
1871
|
-
e?.id &&
|
|
1872
|
-
} else t.key === "Escape" && (t.preventDefault(),
|
|
1946
|
+
e?.id && h(e.id);
|
|
1947
|
+
} else t.key === "Escape" && (t.preventDefault(), h(null));
|
|
1873
1948
|
}, [
|
|
1874
|
-
d,
|
|
1875
1949
|
p,
|
|
1950
|
+
h,
|
|
1876
1951
|
e.widgets
|
|
1877
|
-
]),
|
|
1878
|
-
|
|
1879
|
-
}, [
|
|
1880
|
-
|
|
1881
|
-
},
|
|
1882
|
-
if (!
|
|
1952
|
+
]), Ae = i((e) => {
|
|
1953
|
+
p && h && e.target === e.currentTarget && h(null);
|
|
1954
|
+
}, [p, h]), je = (e) => {
|
|
1955
|
+
Ae(e), typeof E.onClick == "function" && E.onClick(e);
|
|
1956
|
+
}, W = !!(p && g), Me = Bt(zt(Lt, { activationConstraint: { distance: 5 } })), Ne = i((t) => {
|
|
1957
|
+
if (!W) return;
|
|
1883
1958
|
let { active: n, over: r } = t;
|
|
1884
1959
|
if (!r || n.id === r.id) return;
|
|
1885
1960
|
let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
|
|
1886
|
-
a < 0 || o < 0 ||
|
|
1961
|
+
a < 0 || o < 0 || g?.(Ht(i, a, o));
|
|
1887
1962
|
}, [
|
|
1888
|
-
|
|
1963
|
+
W,
|
|
1889
1964
|
e.widgets,
|
|
1890
|
-
|
|
1891
|
-
]),
|
|
1892
|
-
let i =
|
|
1893
|
-
w: Math.min(a ? 3 : 6,
|
|
1894
|
-
h: a ?
|
|
1965
|
+
g
|
|
1966
|
+
]), Fe = (e, t, r) => {
|
|
1967
|
+
let i = En(e), a = i === "metric" || Nn.has(i || ""), o = M ? {
|
|
1968
|
+
w: Math.min(a ? 3 : 6, A),
|
|
1969
|
+
h: a ? 1 : 4
|
|
1895
1970
|
} : void 0, s = e.layout ?? o, c = s ? {
|
|
1896
1971
|
...s,
|
|
1897
|
-
w: Math.min(s.w,
|
|
1898
|
-
} : void 0, l =
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
if (t) return
|
|
1972
|
+
w: Math.min(s.w, A)
|
|
1973
|
+
} : void 0, l = On(e) ? void 0 : e, u = !!l?.dataset, d = () => {
|
|
1974
|
+
if (On(e)) return Bn({ ...e });
|
|
1975
|
+
let t = Dn(e);
|
|
1976
|
+
if (Un(t)) return Vn;
|
|
1977
|
+
if (t) return Bn(t);
|
|
1902
1978
|
let n = i, r = e.options || {}, a = e.data || r.data;
|
|
1903
|
-
if (
|
|
1904
|
-
let o =
|
|
1979
|
+
if (Hn(e)) return Vn;
|
|
1980
|
+
let o = In(n);
|
|
1905
1981
|
if (o.family === "series" && o.chartType) {
|
|
1906
|
-
let t = r.xField || "name", n = r.yField || "value", i =
|
|
1907
|
-
if (
|
|
1982
|
+
let t = r.xField || "name", n = r.yField || "value", i = C(e.chartConfig);
|
|
1983
|
+
if (vn(a)) {
|
|
1908
1984
|
let s = a.aggregate, c = s ? {
|
|
1909
1985
|
field: s.field,
|
|
1910
1986
|
function: s.function,
|
|
1911
1987
|
groupBy: s.groupBy
|
|
1912
|
-
} : void 0, l =
|
|
1988
|
+
} : void 0, l = w(c, n), u = S(c, t);
|
|
1913
1989
|
return {
|
|
1914
1990
|
type: "object-chart",
|
|
1915
1991
|
chartType: o.chartType,
|
|
@@ -1919,11 +1995,11 @@ var ei = r(({ schema: e, className: t, dataSource: r, onRefresh: a, recordCount:
|
|
|
1919
1995
|
xAxisKey: u,
|
|
1920
1996
|
series: [{
|
|
1921
1997
|
dataKey: l,
|
|
1922
|
-
label:
|
|
1998
|
+
label: fe(a.object, l, c?.function)
|
|
1923
1999
|
}],
|
|
1924
|
-
colors:
|
|
2000
|
+
colors: li,
|
|
1925
2001
|
isAnimationActive: !1,
|
|
1926
|
-
drillDown: r.drillDown ??
|
|
2002
|
+
drillDown: r.drillDown ?? di(o.chartType),
|
|
1927
2003
|
compareTo: e.compareTo,
|
|
1928
2004
|
className: "h-[200px] sm:h-[250px] md:h-[300px]",
|
|
1929
2005
|
...i
|
|
@@ -1937,28 +2013,27 @@ var ei = r(({ schema: e, className: t, dataSource: r, onRefresh: a, recordCount:
|
|
|
1937
2013
|
xAxisKey: t,
|
|
1938
2014
|
series: [{
|
|
1939
2015
|
dataKey: n,
|
|
1940
|
-
label:
|
|
2016
|
+
label: fe(void 0, n, void 0)
|
|
1941
2017
|
}],
|
|
1942
|
-
colors:
|
|
2018
|
+
colors: li,
|
|
1943
2019
|
isAnimationActive: !1,
|
|
1944
2020
|
className: "h-[200px] sm:h-[250px] md:h-[300px]",
|
|
1945
2021
|
...i
|
|
1946
2022
|
};
|
|
1947
2023
|
}
|
|
1948
2024
|
if (o.family === "metric" && n !== void 0) {
|
|
1949
|
-
if (
|
|
1950
|
-
let t = H(e) || n, i =
|
|
2025
|
+
if (vn(a)) return Vn;
|
|
2026
|
+
let t = H(e) || n, i = Array.isArray(a) ? a : a?.items || [], o = r.yField || "value";
|
|
1951
2027
|
return {
|
|
1952
|
-
type:
|
|
1953
|
-
...r,
|
|
2028
|
+
type: Ln.metric,
|
|
2029
|
+
...zn(r),
|
|
1954
2030
|
label: t,
|
|
1955
|
-
|
|
1956
|
-
value: r.value ?? o[0]?.[s] ?? "—"
|
|
2031
|
+
value: r.value ?? i[0]?.[o] ?? "—"
|
|
1957
2032
|
};
|
|
1958
2033
|
}
|
|
1959
2034
|
if (o.family === "table") {
|
|
1960
2035
|
let t = n === "list";
|
|
1961
|
-
if (
|
|
2036
|
+
if (vn(a)) {
|
|
1962
2037
|
let { data: n, ...i } = r;
|
|
1963
2038
|
return {
|
|
1964
2039
|
type: "object-data-table",
|
|
@@ -1979,255 +2054,251 @@ var ei = r(({ schema: e, className: t, dataSource: r, onRefresh: a, recordCount:
|
|
|
1979
2054
|
type: "data-table",
|
|
1980
2055
|
...r,
|
|
1981
2056
|
data: i,
|
|
1982
|
-
columns: Array.isArray(r.columns) && r.columns.length > 0 ? r.columns :
|
|
2057
|
+
columns: Array.isArray(r.columns) && r.columns.length > 0 ? r.columns : xn(i),
|
|
1983
2058
|
searchable: !1,
|
|
1984
2059
|
pagination: !1,
|
|
1985
2060
|
className: "border-0"
|
|
1986
2061
|
};
|
|
1987
2062
|
}
|
|
1988
|
-
return o.family === "pivot" ?
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
align: "center",
|
|
1993
|
-
className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground"
|
|
1994
|
-
} : o.family === "unsupported" ? Dn(n) : En(e) ? Ln({
|
|
1995
|
-
...e,
|
|
1996
|
-
...r
|
|
1997
|
-
}) : Dn(n);
|
|
1998
|
-
}, p = M.length > 0 ? y(e, M, ee) : void 0, m = (() => {
|
|
1999
|
-
let e = u();
|
|
2000
|
-
return p && e && typeof e == "object" && $r(e) ? {
|
|
2063
|
+
return o.family === "pivot" ? Vn : (o.family, kn(n));
|
|
2064
|
+
}, f = l && P.length > 0 ? x(l, P, te) : void 0, h = (() => {
|
|
2065
|
+
let e = d();
|
|
2066
|
+
return f && e && typeof e == "object" && pi(e) ? {
|
|
2001
2067
|
...e,
|
|
2002
|
-
filter:
|
|
2068
|
+
filter: oe(e.filter, f)
|
|
2003
2069
|
} : e;
|
|
2004
|
-
})(),
|
|
2005
|
-
...
|
|
2006
|
-
filter:
|
|
2007
|
-
} :
|
|
2070
|
+
})(), g = l && u ? f ? {
|
|
2071
|
+
...l,
|
|
2072
|
+
filter: oe(l.filter, f)
|
|
2073
|
+
} : l : void 0, _ = i === "metric" && !u, v = u && i === "metric", y = H(e), b = ve(e), T = e.id || y || `widget-${t}`, E = p && m === e.id, D = p ? {
|
|
2008
2074
|
"data-testid": `dashboard-preview-widget-${e.id}`,
|
|
2009
2075
|
"data-widget-id": e.id,
|
|
2010
2076
|
role: "button",
|
|
2011
2077
|
tabIndex: 0,
|
|
2012
|
-
"aria-selected":
|
|
2013
|
-
"aria-label": `Widget: ${
|
|
2014
|
-
onClick: (t) =>
|
|
2015
|
-
onKeyDown: (n) =>
|
|
2016
|
-
} : {},
|
|
2078
|
+
"aria-selected": E,
|
|
2079
|
+
"aria-label": `Widget: ${y || `Widget ${t + 1}`}`,
|
|
2080
|
+
onClick: (t) => Te(t, e.id),
|
|
2081
|
+
onKeyDown: (n) => ke(n, e.id, t)
|
|
2082
|
+
} : {}, k = p ? Z("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", E ? "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, j = !N && c && !W ? {
|
|
2017
2083
|
gridColumn: `span ${c.w}`,
|
|
2018
2084
|
gridRow: `span ${c.h}`
|
|
2019
|
-
} : void 0,
|
|
2020
|
-
className: Z("h-full w-full",
|
|
2085
|
+
} : void 0, ee = _ ? /* @__PURE__ */ $("div", {
|
|
2086
|
+
className: Z("h-full w-full", p && "relative", k),
|
|
2021
2087
|
style: j,
|
|
2022
|
-
...
|
|
2023
|
-
children: [/* @__PURE__ */ Q(
|
|
2024
|
-
schema:
|
|
2025
|
-
className: Z("h-full w-full",
|
|
2026
|
-
dataSource:
|
|
2027
|
-
}),
|
|
2088
|
+
...D,
|
|
2089
|
+
children: [/* @__PURE__ */ Q(_e, {
|
|
2090
|
+
schema: h,
|
|
2091
|
+
className: Z("h-full w-full", p && "pointer-events-none"),
|
|
2092
|
+
dataSource: O
|
|
2093
|
+
}), p && /* @__PURE__ */ Q("div", {
|
|
2028
2094
|
className: "absolute inset-0 z-10",
|
|
2029
2095
|
"aria-hidden": "true",
|
|
2030
2096
|
"data-testid": "widget-click-overlay"
|
|
2031
2097
|
})]
|
|
2032
|
-
}) : /* @__PURE__ */ $(
|
|
2033
|
-
className: Z("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full",
|
|
2098
|
+
}) : /* @__PURE__ */ $(Y, {
|
|
2099
|
+
className: Z("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", p && "relative", k),
|
|
2034
2100
|
style: j,
|
|
2035
|
-
...
|
|
2101
|
+
...D,
|
|
2036
2102
|
children: [
|
|
2037
|
-
|
|
2103
|
+
y && !v && /* @__PURE__ */ $(Be, {
|
|
2038
2104
|
className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
|
|
2039
2105
|
children: [/* @__PURE__ */ Q(Ve, {
|
|
2040
2106
|
className: "text-sm sm:text-base font-medium tracking-tight truncate",
|
|
2041
|
-
title:
|
|
2042
|
-
children:
|
|
2043
|
-
}),
|
|
2107
|
+
title: y,
|
|
2108
|
+
children: y
|
|
2109
|
+
}), b && /* @__PURE__ */ Q("p", {
|
|
2044
2110
|
className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
|
|
2045
|
-
children:
|
|
2111
|
+
children: b
|
|
2046
2112
|
})]
|
|
2047
2113
|
}),
|
|
2048
|
-
/* @__PURE__ */ Q(
|
|
2114
|
+
/* @__PURE__ */ Q(ze, {
|
|
2049
2115
|
className: "p-0",
|
|
2050
2116
|
children: /* @__PURE__ */ Q("div", {
|
|
2051
|
-
className: Z("h-full w-full", "p-3 sm:p-4 md:p-6",
|
|
2052
|
-
children:
|
|
2053
|
-
widget:
|
|
2054
|
-
dataSource:
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2117
|
+
className: Z("h-full w-full", v ? "p-3 sm:p-4" : "p-3 sm:p-4 md:p-6", p && "pointer-events-none"),
|
|
2118
|
+
children: g ? /* @__PURE__ */ Q(qr, {
|
|
2119
|
+
widget: g,
|
|
2120
|
+
dataSource: O,
|
|
2121
|
+
heading: v ? {
|
|
2122
|
+
title: y || "",
|
|
2123
|
+
description: b || void 0
|
|
2124
|
+
} : void 0
|
|
2125
|
+
}) : /* @__PURE__ */ Q(_e, {
|
|
2126
|
+
schema: h,
|
|
2127
|
+
dataSource: O
|
|
2059
2128
|
})
|
|
2060
2129
|
})
|
|
2061
2130
|
}),
|
|
2062
|
-
|
|
2131
|
+
p && /* @__PURE__ */ Q("div", {
|
|
2063
2132
|
className: "absolute inset-0 z-10",
|
|
2064
2133
|
"aria-hidden": "true",
|
|
2065
2134
|
"data-testid": "widget-click-overlay"
|
|
2066
2135
|
})
|
|
2067
2136
|
]
|
|
2068
2137
|
});
|
|
2069
|
-
return
|
|
2138
|
+
return W && e.id ? /* @__PURE__ */ Q(si, {
|
|
2070
2139
|
id: e.id,
|
|
2071
|
-
gridSpan: !
|
|
2140
|
+
gridSpan: !N && c ? {
|
|
2072
2141
|
w: c.w,
|
|
2073
2142
|
h: c.h
|
|
2074
2143
|
} : void 0,
|
|
2075
|
-
children:
|
|
2076
|
-
},
|
|
2077
|
-
},
|
|
2078
|
-
className: "col-span-full mb-4",
|
|
2079
|
-
children: [
|
|
2080
|
-
je && /* @__PURE__ */ Q("h2", {
|
|
2081
|
-
className: "text-lg font-semibold tracking-tight",
|
|
2082
|
-
children: B && !v ? ne({
|
|
2083
|
-
name: B,
|
|
2084
|
-
label: R(ke)
|
|
2085
|
-
}) : R(ke)
|
|
2086
|
-
}),
|
|
2087
|
-
Me && /* @__PURE__ */ Q("p", {
|
|
2088
|
-
className: "text-sm text-muted-foreground mt-1",
|
|
2089
|
-
children: B && !v ? re({
|
|
2090
|
-
name: B,
|
|
2091
|
-
description: R(e.description)
|
|
2092
|
-
}) : R(e.description)
|
|
2093
|
-
}),
|
|
2094
|
-
Pe.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2095
|
-
className: "flex gap-2 mt-3",
|
|
2096
|
-
children: Pe.map((e, t) => {
|
|
2097
|
-
let n = Jr(e.icon);
|
|
2098
|
-
return /* @__PURE__ */ $(q, {
|
|
2099
|
-
variant: "outline",
|
|
2100
|
-
size: "sm",
|
|
2101
|
-
onClick: async () => {
|
|
2102
|
-
let { actionType: t, actionUrl: n } = e;
|
|
2103
|
-
if (!t || !n) {
|
|
2104
|
-
console.warn("[DashboardRenderer] Header action missing actionType/actionUrl:", e);
|
|
2105
|
-
return;
|
|
2106
|
-
}
|
|
2107
|
-
if (t === "url") {
|
|
2108
|
-
/^https?:\/\//.test(n) || n.startsWith("//") ? window.location.assign(n) : (window.history.pushState({}, "", n), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
2109
|
-
return;
|
|
2110
|
-
}
|
|
2111
|
-
let r = await V(n);
|
|
2112
|
-
r?.success || console.warn("[DashboardRenderer] action failed", r?.error);
|
|
2113
|
-
},
|
|
2114
|
-
children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }), ue(e)]
|
|
2115
|
-
}, t);
|
|
2116
|
-
})
|
|
2117
|
-
})
|
|
2118
|
-
]
|
|
2119
|
-
}), Le = M.length > 0 && /* @__PURE__ */ Q(Kr, {
|
|
2120
|
-
defs: M,
|
|
2121
|
-
values: ee,
|
|
2122
|
-
onChange: N,
|
|
2123
|
-
onReset: te,
|
|
2124
|
-
dataSource: T,
|
|
2125
|
-
className: "mb-2"
|
|
2126
|
-
}), ze = c !== void 0 && /* @__PURE__ */ $("span", {
|
|
2144
|
+
children: ee
|
|
2145
|
+
}, T) : /* @__PURE__ */ Q(n, { children: ee }, T);
|
|
2146
|
+
}, Ie = e.label, Le = d !== void 0 && /* @__PURE__ */ $("span", {
|
|
2127
2147
|
className: "text-xs text-muted-foreground",
|
|
2128
|
-
children: [
|
|
2129
|
-
}),
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
}),
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2148
|
+
children: [d.toLocaleString(ue), " records"]
|
|
2149
|
+
}), J = a && !xe && /* @__PURE__ */ $(q, {
|
|
2150
|
+
variant: "outline",
|
|
2151
|
+
size: "sm",
|
|
2152
|
+
onClick: U,
|
|
2153
|
+
disabled: be,
|
|
2154
|
+
"aria-label": le("dashboard.refreshDashboard", "Refresh dashboard"),
|
|
2155
|
+
children: [/* @__PURE__ */ Q(At, { className: Z("h-4 w-4 mr-2", be && "animate-spin") }), be ? le("dashboard.refreshing", "Refreshing…") : le("dashboard.refreshAll", "Refresh All")]
|
|
2156
|
+
}), He = a && (J || Le) && /* @__PURE__ */ $("div", {
|
|
2157
|
+
className: "ml-auto flex shrink-0 items-center gap-3",
|
|
2158
|
+
children: [Le, J]
|
|
2159
|
+
}), Ue = !!He && P.length === 0, We = e.header, Ge = !y && We?.showTitle !== !1 && !!Ie, Ke = !y && We?.showDescription !== !1 && !!e.description, qe = We?.actions ?? [], Je = We && (Ge || Ke || qe.length > 0) && /* @__PURE__ */ $("div", {
|
|
2160
|
+
className: Z("col-span-full mb-4", Ue && "flex items-start justify-between gap-3"),
|
|
2161
|
+
children: [/* @__PURE__ */ $("div", {
|
|
2162
|
+
className: "min-w-0",
|
|
2163
|
+
children: [
|
|
2164
|
+
Ge && /* @__PURE__ */ Q("h2", {
|
|
2165
|
+
className: "text-lg font-semibold tracking-tight",
|
|
2166
|
+
children: B && !T ? I({
|
|
2167
|
+
name: B,
|
|
2168
|
+
label: z(Ie)
|
|
2169
|
+
}) : z(Ie)
|
|
2170
|
+
}),
|
|
2171
|
+
Ke && /* @__PURE__ */ Q("p", {
|
|
2172
|
+
className: "text-sm text-muted-foreground mt-1",
|
|
2173
|
+
children: B && !T ? re({
|
|
2174
|
+
name: B,
|
|
2175
|
+
description: z(e.description)
|
|
2176
|
+
}) : z(e.description)
|
|
2177
|
+
}),
|
|
2178
|
+
qe.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2179
|
+
className: "flex gap-2 mt-3",
|
|
2180
|
+
children: qe.map((e, t) => {
|
|
2181
|
+
let n = ci(e.icon);
|
|
2182
|
+
return /* @__PURE__ */ $(q, {
|
|
2183
|
+
variant: "outline",
|
|
2184
|
+
size: "sm",
|
|
2185
|
+
onClick: async () => {
|
|
2186
|
+
let n = await he(e.actionUrl);
|
|
2187
|
+
if (!n?.success) {
|
|
2188
|
+
console.warn("[DashboardRenderer] action failed", n?.error);
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
n.redirect && V[t]?.type === "url" && (window.history.pushState({}, "", n.redirect), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
2192
|
+
},
|
|
2193
|
+
children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }), pe(e)]
|
|
2194
|
+
}, t);
|
|
2195
|
+
})
|
|
2196
|
+
})
|
|
2197
|
+
]
|
|
2198
|
+
}), Ue && He]
|
|
2199
|
+
}), Ye = P.length > 0 && /* @__PURE__ */ Q(oi, {
|
|
2200
|
+
defs: P,
|
|
2201
|
+
values: te,
|
|
2202
|
+
onChange: ne,
|
|
2203
|
+
onReset: F,
|
|
2204
|
+
dataSource: O,
|
|
2205
|
+
className: He ? "min-w-0 grow" : void 0
|
|
2206
|
+
}), Xe = Ye ? He ? /* @__PURE__ */ $("div", {
|
|
2207
|
+
className: "col-span-full flex flex-wrap items-center gap-2",
|
|
2208
|
+
children: [Ye, He]
|
|
2209
|
+
}) : Ye : He && !Je && /* @__PURE__ */ Q("div", {
|
|
2210
|
+
className: "col-span-full flex",
|
|
2211
|
+
children: He
|
|
2212
|
+
}), Ze = +!!Je + +!!Xe, Qe = f ? JSON.stringify(f) : void 0, $e = me(E), et = c(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), tt = c(() => (e.widgets ?? []).filter((e) => En(e) === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), nt = c(() => (e.widgets ?? []).filter((e) => En(e) !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
|
|
2213
|
+
if (N) {
|
|
2214
|
+
let n = e.widgets?.filter((e) => En(e) === "metric") || [], r = e.widgets?.filter((e) => En(e) !== "metric") || [], i = /* @__PURE__ */ $("div", {
|
|
2215
|
+
ref: D,
|
|
2216
|
+
...$e,
|
|
2144
2217
|
className: Z("flex flex-col gap-4 px-4", t),
|
|
2145
|
-
"data-user-actions":
|
|
2146
|
-
onClick:
|
|
2218
|
+
"data-user-actions": Qe,
|
|
2219
|
+
onClick: je,
|
|
2147
2220
|
children: [
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
We,
|
|
2221
|
+
Je,
|
|
2222
|
+
Xe,
|
|
2151
2223
|
n.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2152
2224
|
className: "grid grid-cols-2 gap-3",
|
|
2153
|
-
onClick:
|
|
2225
|
+
onClick: Ae,
|
|
2154
2226
|
children: /* @__PURE__ */ Q(Vt, {
|
|
2155
|
-
items:
|
|
2227
|
+
items: tt,
|
|
2156
2228
|
strategy: Ut,
|
|
2157
|
-
disabled: !
|
|
2158
|
-
children: n.map((e, t) =>
|
|
2229
|
+
disabled: !W,
|
|
2230
|
+
children: n.map((e, t) => Fe(e, t))
|
|
2159
2231
|
})
|
|
2160
2232
|
}),
|
|
2161
2233
|
r.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2162
2234
|
className: "flex flex-col gap-4",
|
|
2163
|
-
onClick:
|
|
2235
|
+
onClick: Ae,
|
|
2164
2236
|
children: /* @__PURE__ */ Q(Vt, {
|
|
2165
|
-
items:
|
|
2237
|
+
items: nt,
|
|
2166
2238
|
strategy: Gt,
|
|
2167
|
-
disabled: !
|
|
2168
|
-
children: r.map((e, t) =>
|
|
2239
|
+
disabled: !W,
|
|
2240
|
+
children: r.map((e, t) => Fe(e, t, !0))
|
|
2169
2241
|
})
|
|
2170
2242
|
})
|
|
2171
2243
|
]
|
|
2172
2244
|
});
|
|
2173
|
-
return
|
|
2174
|
-
sensors:
|
|
2245
|
+
return W ? /* @__PURE__ */ Q(It, {
|
|
2246
|
+
sensors: Me,
|
|
2175
2247
|
collisionDetection: Rt,
|
|
2176
|
-
onDragEnd:
|
|
2248
|
+
onDragEnd: Ne,
|
|
2177
2249
|
children: i
|
|
2178
2250
|
}) : i;
|
|
2179
2251
|
}
|
|
2180
|
-
let
|
|
2181
|
-
ref:
|
|
2182
|
-
|
|
2183
|
-
className: Z("grid", !
|
|
2252
|
+
let rt = /* @__PURE__ */ $("div", {
|
|
2253
|
+
ref: D,
|
|
2254
|
+
...$e,
|
|
2255
|
+
className: Z("grid", !M && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", M && Ze === 1 && "grid-rows-[auto]", M && Ze === 2 && "grid-rows-[auto_auto]", t),
|
|
2184
2256
|
style: {
|
|
2185
|
-
...
|
|
2186
|
-
gridTemplateColumns: `repeat(${
|
|
2257
|
+
...M && {
|
|
2258
|
+
gridTemplateColumns: `repeat(${A}, minmax(0, 1fr))`,
|
|
2187
2259
|
gridAutoRows: "minmax(5rem, auto)"
|
|
2188
2260
|
},
|
|
2189
|
-
gap: `${
|
|
2261
|
+
gap: `${j * .25}rem`
|
|
2190
2262
|
},
|
|
2191
|
-
"data-user-actions":
|
|
2192
|
-
onClick:
|
|
2263
|
+
"data-user-actions": Qe,
|
|
2264
|
+
onClick: je,
|
|
2193
2265
|
children: [
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
We,
|
|
2266
|
+
Je,
|
|
2267
|
+
Xe,
|
|
2197
2268
|
/* @__PURE__ */ Q(Vt, {
|
|
2198
|
-
items:
|
|
2269
|
+
items: et,
|
|
2199
2270
|
strategy: Ut,
|
|
2200
|
-
disabled: !
|
|
2201
|
-
children: e.widgets?.map((e, t) =>
|
|
2271
|
+
disabled: !W,
|
|
2272
|
+
children: e.widgets?.map((e, t) => Fe(e, t))
|
|
2202
2273
|
})
|
|
2203
2274
|
]
|
|
2204
2275
|
});
|
|
2205
|
-
return
|
|
2206
|
-
sensors:
|
|
2276
|
+
return W ? /* @__PURE__ */ Q(It, {
|
|
2277
|
+
sensors: Me,
|
|
2207
2278
|
collisionDetection: Rt,
|
|
2208
|
-
onDragEnd:
|
|
2209
|
-
children:
|
|
2210
|
-
}) :
|
|
2279
|
+
onDragEnd: Ne,
|
|
2280
|
+
children: rt
|
|
2281
|
+
}) : rt;
|
|
2211
2282
|
});
|
|
2212
|
-
|
|
2213
|
-
var
|
|
2214
|
-
let { schema: n } = e, r =
|
|
2215
|
-
return r.length === 0 ? /* @__PURE__ */ Q(
|
|
2283
|
+
mi.displayName = "DashboardRendererInner";
|
|
2284
|
+
var hi = r((e, t) => {
|
|
2285
|
+
let { schema: n } = e, r = c(() => de(n), [n.globalFilters, n.dateRange]);
|
|
2286
|
+
return r.length === 0 ? /* @__PURE__ */ Q(mi, {
|
|
2216
2287
|
ref: t,
|
|
2217
2288
|
...e
|
|
2218
|
-
}) : /* @__PURE__ */ Q(
|
|
2219
|
-
definitions:
|
|
2220
|
-
children: /* @__PURE__ */ Q(
|
|
2289
|
+
}) : /* @__PURE__ */ Q(ge, {
|
|
2290
|
+
definitions: M(r),
|
|
2291
|
+
children: /* @__PURE__ */ Q(mi, {
|
|
2221
2292
|
ref: t,
|
|
2222
2293
|
...e
|
|
2223
2294
|
})
|
|
2224
2295
|
});
|
|
2225
2296
|
});
|
|
2226
|
-
|
|
2297
|
+
hi.displayName = "DashboardRenderer";
|
|
2227
2298
|
//#endregion
|
|
2228
2299
|
//#region src/DashboardGridLayout.tsx
|
|
2229
|
-
function
|
|
2230
|
-
let n =
|
|
2300
|
+
function gi({ editMode: t }) {
|
|
2301
|
+
let n = Se();
|
|
2231
2302
|
return e.useEffect(() => {
|
|
2232
2303
|
if (t) return n.startDrag({
|
|
2233
2304
|
id: "dashboard-layout",
|
|
@@ -2239,14 +2310,14 @@ function ni({ editMode: t }) {
|
|
|
2239
2310
|
n.endDrag("dashboard");
|
|
2240
2311
|
}, [t, n]), null;
|
|
2241
2312
|
}
|
|
2242
|
-
var
|
|
2313
|
+
var _i = [
|
|
2243
2314
|
"hsl(var(--chart-1))",
|
|
2244
2315
|
"hsl(var(--chart-2))",
|
|
2245
2316
|
"hsl(var(--chart-3))",
|
|
2246
2317
|
"hsl(var(--chart-4))",
|
|
2247
2318
|
"hsl(var(--chart-5))"
|
|
2248
2319
|
];
|
|
2249
|
-
function
|
|
2320
|
+
function vi(e, t) {
|
|
2250
2321
|
if (!e.widgets?.length) return e;
|
|
2251
2322
|
let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
|
|
2252
2323
|
let r = e.id || `widget-${t}`, i = n.get(r);
|
|
@@ -2265,14 +2336,14 @@ function ii(e, t) {
|
|
|
2265
2336
|
widgets: r
|
|
2266
2337
|
};
|
|
2267
2338
|
}
|
|
2268
|
-
function
|
|
2339
|
+
function yi(e) {
|
|
2269
2340
|
return { lg: e.widgets?.map((e, t) => ({
|
|
2270
2341
|
i: e.id || `widget-${t}`,
|
|
2271
2342
|
...Jt(e.layout, {}, Yt(t))
|
|
2272
2343
|
})) || [] };
|
|
2273
2344
|
}
|
|
2274
|
-
var
|
|
2275
|
-
let { width: s, containerRef: c, mounted: l } =
|
|
2345
|
+
var bi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaChange: a, onRefresh: o }) => {
|
|
2346
|
+
let { width: s, containerRef: c, mounted: l } = pn(), [u, d] = e.useState(!1), f = Te(), { t: p, language: m } = K(), h = Re(), { fieldLabel: g } = Ie(), _ = e.useCallback((e, t, n) => bn(p, g, e, t, n), [p, g]), { refreshing: v, handleRefresh: y } = Yr(t, o), [b, x] = e.useState(() => yi(t)), T = e.useMemo(() => JSON.stringify(t.widgets?.map((e, t) => ({
|
|
2276
2347
|
i: e.id || `widget-${t}`,
|
|
2277
2348
|
x: e.layout?.x,
|
|
2278
2349
|
y: e.layout?.y,
|
|
@@ -2280,32 +2351,33 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2280
2351
|
h: e.layout?.h
|
|
2281
2352
|
})) ?? []), [t.widgets]);
|
|
2282
2353
|
e.useEffect(() => {
|
|
2283
|
-
|
|
2284
|
-
}, [
|
|
2285
|
-
let
|
|
2286
|
-
|
|
2287
|
-
}, [i]),
|
|
2288
|
-
a ? a(
|
|
2354
|
+
x(yi(t));
|
|
2355
|
+
}, [T]);
|
|
2356
|
+
let E = e.useCallback((e, t) => {
|
|
2357
|
+
x(t), i?.(e);
|
|
2358
|
+
}, [i]), D = e.useCallback(() => {
|
|
2359
|
+
a ? a(vi(t, b.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);
|
|
2289
2360
|
}, [
|
|
2290
2361
|
a,
|
|
2291
2362
|
t,
|
|
2292
|
-
|
|
2293
|
-
]),
|
|
2294
|
-
|
|
2295
|
-
}, [t]),
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
if (t) return
|
|
2299
|
-
if (
|
|
2300
|
-
|
|
2363
|
+
b
|
|
2364
|
+
]), O = e.useCallback(() => {
|
|
2365
|
+
x(yi(t));
|
|
2366
|
+
}, [t]), k = e.useCallback((e) => {
|
|
2367
|
+
if (On(e)) return Bn({ ...e });
|
|
2368
|
+
let t = Dn(e);
|
|
2369
|
+
if (Un(t)) return Vn;
|
|
2370
|
+
if (t) return Bn(t);
|
|
2371
|
+
if (Hn(e)) return Vn;
|
|
2372
|
+
let n = En(e), r = e.options || {}, i = In(n);
|
|
2301
2373
|
if (i.family === "series" && i.chartType) {
|
|
2302
|
-
let t = e.data || r.data, n = r.xField || "name", a = r.yField || "value", o =
|
|
2303
|
-
if (
|
|
2374
|
+
let t = e.data || r.data, n = r.xField || "name", a = r.yField || "value", o = C(e.chartConfig);
|
|
2375
|
+
if (vn(t)) {
|
|
2304
2376
|
let e = t.aggregate, r = e ? {
|
|
2305
2377
|
field: e.field,
|
|
2306
2378
|
function: e.function,
|
|
2307
2379
|
groupBy: e.groupBy
|
|
2308
|
-
} : void 0, s =
|
|
2380
|
+
} : void 0, s = w(r, a), c = S(r, n);
|
|
2309
2381
|
return {
|
|
2310
2382
|
type: "object-chart",
|
|
2311
2383
|
chartType: i.chartType,
|
|
@@ -2316,7 +2388,7 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2316
2388
|
dataKey: s,
|
|
2317
2389
|
label: _(t.object, s, r?.function)
|
|
2318
2390
|
}],
|
|
2319
|
-
colors:
|
|
2391
|
+
colors: _i,
|
|
2320
2392
|
isAnimationActive: !1,
|
|
2321
2393
|
className: "h-full",
|
|
2322
2394
|
...o
|
|
@@ -2332,7 +2404,7 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2332
2404
|
dataKey: a,
|
|
2333
2405
|
label: _(void 0, a, void 0)
|
|
2334
2406
|
}],
|
|
2335
|
-
colors:
|
|
2407
|
+
colors: _i,
|
|
2336
2408
|
isAnimationActive: !1,
|
|
2337
2409
|
className: "h-full",
|
|
2338
2410
|
...o
|
|
@@ -2340,18 +2412,18 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2340
2412
|
}
|
|
2341
2413
|
if (i.family === "metric" && n !== void 0) {
|
|
2342
2414
|
let t = e.data || r.data;
|
|
2343
|
-
if (
|
|
2415
|
+
if (vn(t)) return Vn;
|
|
2344
2416
|
let i = e.title || n, a = Array.isArray(t) ? t : t?.items || [], o = r.yField || "value";
|
|
2345
2417
|
return {
|
|
2346
|
-
type:
|
|
2347
|
-
...r,
|
|
2418
|
+
type: Ln.metric,
|
|
2419
|
+
...zn(r),
|
|
2348
2420
|
label: i,
|
|
2349
2421
|
value: r.value ?? a[0]?.[o] ?? "—"
|
|
2350
2422
|
};
|
|
2351
2423
|
}
|
|
2352
2424
|
if (i.family === "table") {
|
|
2353
2425
|
let t = e.data || r.data;
|
|
2354
|
-
if (
|
|
2426
|
+
if (vn(t)) {
|
|
2355
2427
|
let i = n === "list", { data: a, ...o } = r;
|
|
2356
2428
|
return {
|
|
2357
2429
|
type: "object-data-table",
|
|
@@ -2372,7 +2444,7 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2372
2444
|
type: "data-table",
|
|
2373
2445
|
...r,
|
|
2374
2446
|
data: i,
|
|
2375
|
-
columns: Array.isArray(r.columns) && r.columns.length > 0 ? r.columns :
|
|
2447
|
+
columns: Array.isArray(r.columns) && r.columns.length > 0 ? r.columns : xn(i),
|
|
2376
2448
|
searchable: !1,
|
|
2377
2449
|
pagination: !1,
|
|
2378
2450
|
className: "border-0"
|
|
@@ -2380,7 +2452,7 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2380
2452
|
}
|
|
2381
2453
|
if (i.family === "pivot") {
|
|
2382
2454
|
let t = e.data || r.data;
|
|
2383
|
-
return
|
|
2455
|
+
return vn(t) ? Vn : {
|
|
2384
2456
|
type: "pivot",
|
|
2385
2457
|
title: r.title,
|
|
2386
2458
|
rowField: r.rowField,
|
|
@@ -2395,33 +2467,30 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2395
2467
|
data: Array.isArray(t) ? t : t?.items || []
|
|
2396
2468
|
};
|
|
2397
2469
|
}
|
|
2398
|
-
return i.family
|
|
2399
|
-
...e,
|
|
2400
|
-
...r
|
|
2401
|
-
}) : Dn(n);
|
|
2470
|
+
return i.family, kn(n);
|
|
2402
2471
|
}, [_]);
|
|
2403
2472
|
return /* @__PURE__ */ $("div", {
|
|
2404
2473
|
ref: c,
|
|
2405
2474
|
className: Z("w-full", n),
|
|
2406
2475
|
"data-testid": "grid-layout",
|
|
2407
2476
|
children: [
|
|
2408
|
-
f && /* @__PURE__ */ Q(
|
|
2477
|
+
f && /* @__PURE__ */ Q(gi, { editMode: u }),
|
|
2409
2478
|
/* @__PURE__ */ $("div", {
|
|
2410
2479
|
className: "mb-4 flex items-center justify-between",
|
|
2411
2480
|
children: [/* @__PURE__ */ Q("h2", {
|
|
2412
2481
|
className: "text-2xl font-bold",
|
|
2413
|
-
children:
|
|
2482
|
+
children: G(t.label, m) || "Dashboard"
|
|
2414
2483
|
}), /* @__PURE__ */ Q("div", {
|
|
2415
2484
|
className: "flex gap-2",
|
|
2416
|
-
children: u ? /* @__PURE__ */ $(
|
|
2485
|
+
children: u ? /* @__PURE__ */ $($t, { children: [
|
|
2417
2486
|
/* @__PURE__ */ $(q, {
|
|
2418
|
-
onClick:
|
|
2487
|
+
onClick: D,
|
|
2419
2488
|
size: "sm",
|
|
2420
2489
|
variant: "default",
|
|
2421
2490
|
children: [/* @__PURE__ */ Q(Mt, { className: "h-4 w-4 mr-2" }), "Save Layout"]
|
|
2422
2491
|
}),
|
|
2423
2492
|
/* @__PURE__ */ $(q, {
|
|
2424
|
-
onClick:
|
|
2493
|
+
onClick: O,
|
|
2425
2494
|
size: "sm",
|
|
2426
2495
|
variant: "outline",
|
|
2427
2496
|
children: [/* @__PURE__ */ Q(Ft, { className: "h-4 w-4 mr-2" }), "Reset"]
|
|
@@ -2432,13 +2501,13 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2432
2501
|
variant: "ghost",
|
|
2433
2502
|
children: "Cancel"
|
|
2434
2503
|
})
|
|
2435
|
-
] }) : /* @__PURE__ */ $(
|
|
2436
|
-
onClick:
|
|
2504
|
+
] }) : /* @__PURE__ */ $($t, { children: [o && /* @__PURE__ */ $(q, {
|
|
2505
|
+
onClick: y,
|
|
2437
2506
|
size: "sm",
|
|
2438
2507
|
variant: "outline",
|
|
2439
|
-
disabled:
|
|
2508
|
+
disabled: v,
|
|
2440
2509
|
"aria-label": h("dashboard.refreshDashboard", "Refresh dashboard"),
|
|
2441
|
-
children: [/* @__PURE__ */ Q(At, { className: Z("h-4 w-4 mr-2",
|
|
2510
|
+
children: [/* @__PURE__ */ Q(At, { className: Z("h-4 w-4 mr-2", v && "animate-spin") }), v ? h("dashboard.refreshing", "Refreshing…") : h("dashboard.refreshAll", "Refresh All")]
|
|
2442
2511
|
}), /* @__PURE__ */ $(q, {
|
|
2443
2512
|
onClick: () => d(!0),
|
|
2444
2513
|
size: "sm",
|
|
@@ -2447,10 +2516,10 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2447
2516
|
})] })
|
|
2448
2517
|
})]
|
|
2449
2518
|
}),
|
|
2450
|
-
l && /* @__PURE__ */ Q(
|
|
2519
|
+
l && /* @__PURE__ */ Q(fn, {
|
|
2451
2520
|
className: "layout",
|
|
2452
2521
|
width: s,
|
|
2453
|
-
layouts:
|
|
2522
|
+
layouts: b,
|
|
2454
2523
|
breakpoints: {
|
|
2455
2524
|
lg: 1200,
|
|
2456
2525
|
md: 996,
|
|
@@ -2471,50 +2540,68 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2471
2540
|
handle: ".drag-handle"
|
|
2472
2541
|
},
|
|
2473
2542
|
resizeConfig: { enabled: u },
|
|
2474
|
-
onLayoutChange:
|
|
2543
|
+
onLayoutChange: E,
|
|
2475
2544
|
children: t.widgets?.map((e, t) => {
|
|
2476
|
-
let n = e.id || `widget-${t}`, i =
|
|
2545
|
+
let n = e.id || `widget-${t}`, i = k(e), a = !On(e) && e.dataset ? e : void 0, o = a !== void 0, s = En(e) === "metric" && !o, c = o && En(e) === "metric", l = G(e.title, m);
|
|
2477
2546
|
return /* @__PURE__ */ Q("div", {
|
|
2478
2547
|
className: "h-full",
|
|
2479
|
-
children:
|
|
2548
|
+
children: s ? /* @__PURE__ */ $("div", {
|
|
2480
2549
|
className: "h-full w-full relative",
|
|
2481
2550
|
children: [u && /* @__PURE__ */ Q("div", {
|
|
2482
2551
|
className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
|
|
2483
2552
|
children: /* @__PURE__ */ Q(Et, { className: "h-4 w-4" })
|
|
2484
|
-
}), /* @__PURE__ */ Q(
|
|
2553
|
+
}), /* @__PURE__ */ Q(_e, {
|
|
2485
2554
|
schema: i,
|
|
2486
2555
|
className: "h-full w-full"
|
|
2487
2556
|
})]
|
|
2488
|
-
}) : /* @__PURE__ */ $(
|
|
2489
|
-
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"),
|
|
2490
|
-
children: [
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
className: "text-base font-medium tracking-tight truncate",
|
|
2494
|
-
title: s,
|
|
2495
|
-
children: s
|
|
2496
|
-
}), u && /* @__PURE__ */ Q("div", {
|
|
2497
|
-
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
2557
|
+
}) : /* @__PURE__ */ $(Y, {
|
|
2558
|
+
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", c && "relative"),
|
|
2559
|
+
children: [
|
|
2560
|
+
c && u && /* @__PURE__ */ Q("div", {
|
|
2561
|
+
className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
|
|
2498
2562
|
children: /* @__PURE__ */ Q(Et, { className: "h-4 w-4" })
|
|
2499
|
-
})
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2563
|
+
}),
|
|
2564
|
+
l && !c && /* @__PURE__ */ $(Be, {
|
|
2565
|
+
className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
|
|
2566
|
+
children: [/* @__PURE__ */ Q(Ve, {
|
|
2567
|
+
className: "text-base font-medium tracking-tight truncate",
|
|
2568
|
+
title: l,
|
|
2569
|
+
children: l
|
|
2570
|
+
}), u && /* @__PURE__ */ Q("div", {
|
|
2571
|
+
className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
|
|
2572
|
+
children: /* @__PURE__ */ Q(Et, { className: "h-4 w-4" })
|
|
2573
|
+
})]
|
|
2574
|
+
}),
|
|
2575
|
+
/* @__PURE__ */ Q(ze, {
|
|
2576
|
+
className: "p-0 h-full",
|
|
2577
|
+
children: /* @__PURE__ */ Q("div", {
|
|
2578
|
+
className: Z("h-full w-full overflow-auto p-4", c && u && "pr-10"),
|
|
2579
|
+
children: a ? /* @__PURE__ */ Q(qr, {
|
|
2580
|
+
widget: a,
|
|
2581
|
+
dataSource: r,
|
|
2582
|
+
heading: c ? {
|
|
2583
|
+
title: l,
|
|
2584
|
+
description: G(a.description, m) || void 0
|
|
2585
|
+
} : void 0
|
|
2586
|
+
}) : /* @__PURE__ */ Q(_e, { schema: i })
|
|
2587
|
+
})
|
|
2509
2588
|
})
|
|
2510
|
-
|
|
2589
|
+
]
|
|
2511
2590
|
})
|
|
2512
2591
|
}, n);
|
|
2513
2592
|
})
|
|
2514
2593
|
})
|
|
2515
2594
|
]
|
|
2516
2595
|
});
|
|
2517
|
-
}
|
|
2596
|
+
};
|
|
2597
|
+
//#endregion
|
|
2598
|
+
//#region src/schemaHostProps.ts
|
|
2599
|
+
function xi(e, t) {
|
|
2600
|
+
return e === void 0 ? t : me(t);
|
|
2601
|
+
}
|
|
2602
|
+
//#endregion
|
|
2603
|
+
//#region src/MetricWidget.tsx
|
|
2604
|
+
var Si = je({
|
|
2518
2605
|
"dashboard.trend.vsLastQuarter": "vs last quarter",
|
|
2519
2606
|
"dashboard.trend.vsLastMonth": "vs last month",
|
|
2520
2607
|
"dashboard.trend.vsLastWeek": "vs last week",
|
|
@@ -2522,7 +2609,7 @@ var oi = ({ schema: t, className: n, dataSource: r, onLayoutChange: i, onSchemaC
|
|
|
2522
2609
|
"dashboard.trend.vsYesterday": "vs yesterday",
|
|
2523
2610
|
"dashboard.trend.vsPreviousPeriod": "vs previous period"
|
|
2524
2611
|
}, "dashboard.trend.vsLastQuarter");
|
|
2525
|
-
function
|
|
2612
|
+
function Ci(e) {
|
|
2526
2613
|
switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
|
|
2527
2614
|
case "vs last quarter":
|
|
2528
2615
|
case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
|
|
@@ -2538,15 +2625,15 @@ function ci(e) {
|
|
|
2538
2625
|
default: return;
|
|
2539
2626
|
}
|
|
2540
2627
|
}
|
|
2541
|
-
function
|
|
2628
|
+
function wi(e) {
|
|
2542
2629
|
let t = (e || "").trim().match(/0\.(0+)/);
|
|
2543
2630
|
return t ? t[1].length : 0;
|
|
2544
2631
|
}
|
|
2545
|
-
function
|
|
2632
|
+
function Ti(e, t, n, r) {
|
|
2546
2633
|
if (e == null) return "";
|
|
2547
2634
|
if (typeof e == "string") {
|
|
2548
2635
|
let i = Number(e);
|
|
2549
|
-
return !isFinite(i) || e.trim() === "" ? e :
|
|
2636
|
+
return !isFinite(i) || e.trim() === "" ? e : Ti(i, t, n, r);
|
|
2550
2637
|
}
|
|
2551
2638
|
if (!isFinite(e)) return String(e);
|
|
2552
2639
|
let i = {
|
|
@@ -2554,7 +2641,7 @@ function ui(e, t, n, r) {
|
|
|
2554
2641
|
"¥": "JPY",
|
|
2555
2642
|
"€": "EUR",
|
|
2556
2643
|
"£": "GBP"
|
|
2557
|
-
}, a = (t || "").trim(), o = !!n || a.length > 0 && i[a[0]] !== void 0, s = a.endsWith("%"), c =
|
|
2644
|
+
}, a = (t || "").trim(), o = !!n || a.length > 0 && i[a[0]] !== void 0, s = a.endsWith("%"), c = wi(a);
|
|
2558
2645
|
if (/a/i.test(a)) {
|
|
2559
2646
|
let t = {
|
|
2560
2647
|
locale: r,
|
|
@@ -2563,13 +2650,13 @@ function ui(e, t, n, r) {
|
|
|
2563
2650
|
};
|
|
2564
2651
|
o && (t.currency = n || i[a[0]] || "USD");
|
|
2565
2652
|
try {
|
|
2566
|
-
return
|
|
2653
|
+
return W(e, t);
|
|
2567
2654
|
} catch {}
|
|
2568
2655
|
}
|
|
2569
2656
|
if (o) {
|
|
2570
2657
|
let t = n || i[a[0]] || "USD";
|
|
2571
2658
|
try {
|
|
2572
|
-
return
|
|
2659
|
+
return W(e, {
|
|
2573
2660
|
locale: r,
|
|
2574
2661
|
currency: t,
|
|
2575
2662
|
minimumFractionDigits: c,
|
|
@@ -2579,139 +2666,141 @@ function ui(e, t, n, r) {
|
|
|
2579
2666
|
return `${t} ${e.toFixed(c)}`;
|
|
2580
2667
|
}
|
|
2581
2668
|
}
|
|
2582
|
-
return s ?
|
|
2669
|
+
return s ? rn(e, "fraction", c, r) : W(e, {
|
|
2583
2670
|
locale: r,
|
|
2584
2671
|
minimumFractionDigits: c,
|
|
2585
2672
|
maximumFractionDigits: c
|
|
2586
2673
|
});
|
|
2587
2674
|
}
|
|
2588
|
-
var
|
|
2589
|
-
let w =
|
|
2590
|
-
let e =
|
|
2675
|
+
var Ei = ({ label: e, value: t, trend: n, derivedTrend: r, icon: i, className: a, description: o, loading: s, error: l, colorVariant: u = "default", format: d, currency: f, prefix: p, suffix: m, onClick: h, variant: g = "card", schema: _, bind: v, events: y, props: b, ariaLabel: x, ariaDescribedBy: S, dataSource: C, ...w }) => {
|
|
2676
|
+
let T = xi(_, w), E = r ?? n, D = Gn[u] || Gn.default, { t: O } = Si(), k = Pe(), { language: A } = K(), j = c(() => G(e, A) || void 0, [e, A]), M = c(() => {
|
|
2677
|
+
let e = G(o, A) || G(E?.label, A) || void 0;
|
|
2591
2678
|
if (!e) return e;
|
|
2592
|
-
let t =
|
|
2593
|
-
return t ?
|
|
2679
|
+
let t = Ci(e);
|
|
2680
|
+
return t ? O(t) : e;
|
|
2594
2681
|
}, [
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
]),
|
|
2600
|
-
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ?
|
|
2601
|
-
return `${
|
|
2682
|
+
o,
|
|
2683
|
+
E?.label,
|
|
2684
|
+
O,
|
|
2685
|
+
A
|
|
2686
|
+
]), N = c(() => {
|
|
2687
|
+
let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Ti(t, d, f, k) : t ?? "", n = String(e);
|
|
2688
|
+
return `${p && n.startsWith(p) ? "" : p ?? ""}${n}${m && n.endsWith(m) ? "" : m ?? ""}`;
|
|
2602
2689
|
}, [
|
|
2603
2690
|
t,
|
|
2604
|
-
u,
|
|
2605
2691
|
d,
|
|
2606
2692
|
f,
|
|
2607
2693
|
p,
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2694
|
+
m,
|
|
2695
|
+
k
|
|
2696
|
+
]), ee = c(() => {
|
|
2697
|
+
if (typeof i == "string") {
|
|
2698
|
+
let e = pt(i);
|
|
2612
2699
|
return e ? /* @__PURE__ */ Q(e, { className: "h-4 w-4" }) : null;
|
|
2613
2700
|
}
|
|
2614
|
-
return
|
|
2615
|
-
}, [
|
|
2616
|
-
if (
|
|
2617
|
-
let e =
|
|
2701
|
+
return i;
|
|
2702
|
+
}, [i]);
|
|
2703
|
+
if (g === "bare") {
|
|
2704
|
+
let e = Kn[u] || Kn.default;
|
|
2618
2705
|
return /* @__PURE__ */ Q("div", {
|
|
2619
|
-
className: Z("flex flex-col gap-1 min-w-0",
|
|
2620
|
-
onClick:
|
|
2621
|
-
role:
|
|
2622
|
-
tabIndex:
|
|
2623
|
-
onKeyDown:
|
|
2624
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
2706
|
+
className: Z("flex flex-col gap-1 min-w-0", h && "cursor-pointer", a),
|
|
2707
|
+
onClick: h,
|
|
2708
|
+
role: h ? "button" : void 0,
|
|
2709
|
+
tabIndex: h ? 0 : void 0,
|
|
2710
|
+
onKeyDown: h ? (e) => {
|
|
2711
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
|
|
2625
2712
|
} : void 0,
|
|
2626
|
-
children:
|
|
2713
|
+
children: s ? /* @__PURE__ */ $("div", {
|
|
2627
2714
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2628
2715
|
"data-testid": "metric-loading",
|
|
2629
2716
|
children: [/* @__PURE__ */ Q(Ot, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
2630
2717
|
className: "text-sm",
|
|
2631
2718
|
children: "Loading…"
|
|
2632
2719
|
})]
|
|
2633
|
-
}) :
|
|
2720
|
+
}) : l ? /* @__PURE__ */ $("div", {
|
|
2634
2721
|
className: "flex items-center gap-2",
|
|
2635
2722
|
"data-testid": "metric-error",
|
|
2636
2723
|
role: "alert",
|
|
2637
2724
|
children: [/* @__PURE__ */ Q(ht, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
2638
2725
|
className: "text-xs text-destructive truncate",
|
|
2639
|
-
children:
|
|
2726
|
+
children: l
|
|
2640
2727
|
})]
|
|
2641
|
-
}) : /* @__PURE__ */ $(
|
|
2728
|
+
}) : /* @__PURE__ */ $($t, { children: [/* @__PURE__ */ Q("div", {
|
|
2642
2729
|
className: Z("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", e),
|
|
2643
|
-
children:
|
|
2730
|
+
children: N
|
|
2644
2731
|
}), /* @__PURE__ */ Q("div", {
|
|
2645
2732
|
className: "text-xs font-medium text-muted-foreground truncate",
|
|
2646
|
-
children:
|
|
2733
|
+
children: j
|
|
2647
2734
|
})] })
|
|
2648
2735
|
});
|
|
2649
2736
|
}
|
|
2650
|
-
return /* @__PURE__ */ $(
|
|
2651
|
-
className: Z("h-full overflow-hidden",
|
|
2652
|
-
onClick:
|
|
2653
|
-
role:
|
|
2654
|
-
tabIndex:
|
|
2655
|
-
onKeyDown:
|
|
2656
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
2737
|
+
return /* @__PURE__ */ $(Y, {
|
|
2738
|
+
className: Z("h-full overflow-hidden", Jn, h && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", a),
|
|
2739
|
+
onClick: h,
|
|
2740
|
+
role: h ? "button" : void 0,
|
|
2741
|
+
tabIndex: h ? 0 : void 0,
|
|
2742
|
+
onKeyDown: h ? (e) => {
|
|
2743
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
|
|
2657
2744
|
} : void 0,
|
|
2658
|
-
...
|
|
2745
|
+
...T,
|
|
2659
2746
|
children: [/* @__PURE__ */ $(Be, {
|
|
2660
|
-
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
2747
|
+
className: "flex flex-row items-center justify-between gap-2 space-y-0 pb-2",
|
|
2661
2748
|
children: [/* @__PURE__ */ Q(Ve, {
|
|
2662
|
-
className:
|
|
2663
|
-
|
|
2664
|
-
}), j && /* @__PURE__ */ Q("div", {
|
|
2665
|
-
className: Z("flex h-8 w-8 items-center justify-center rounded-md shrink-0", w),
|
|
2749
|
+
className: Yn,
|
|
2750
|
+
title: j,
|
|
2666
2751
|
children: j
|
|
2752
|
+
}), ee && /* @__PURE__ */ Q("div", {
|
|
2753
|
+
className: Z("flex h-8 w-8 items-center justify-center rounded-md shrink-0", D),
|
|
2754
|
+
children: ee
|
|
2667
2755
|
})]
|
|
2668
|
-
}), /* @__PURE__ */ Q(
|
|
2756
|
+
}), /* @__PURE__ */ Q(ze, { children: s ? /* @__PURE__ */ $("div", {
|
|
2669
2757
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2670
2758
|
"data-testid": "metric-loading",
|
|
2671
2759
|
children: [/* @__PURE__ */ Q(Ot, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
2672
2760
|
className: "text-sm",
|
|
2673
2761
|
children: "Loading…"
|
|
2674
2762
|
})]
|
|
2675
|
-
}) :
|
|
2763
|
+
}) : l ? /* @__PURE__ */ $("div", {
|
|
2676
2764
|
className: "flex items-center gap-2",
|
|
2677
2765
|
"data-testid": "metric-error",
|
|
2678
2766
|
role: "alert",
|
|
2679
2767
|
children: [/* @__PURE__ */ Q(ht, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
|
|
2680
2768
|
className: "text-xs text-destructive truncate",
|
|
2681
|
-
children:
|
|
2769
|
+
children: l
|
|
2682
2770
|
})]
|
|
2683
|
-
}) : /* @__PURE__ */ $(
|
|
2684
|
-
className: "
|
|
2685
|
-
|
|
2686
|
-
|
|
2771
|
+
}) : /* @__PURE__ */ $($t, { children: [/* @__PURE__ */ Q("div", {
|
|
2772
|
+
className: Z("font-bold tracking-tight", tr(N)),
|
|
2773
|
+
title: rr(N),
|
|
2774
|
+
children: N
|
|
2775
|
+
}), (E || o) && /* @__PURE__ */ $("div", {
|
|
2687
2776
|
className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
|
|
2688
|
-
children: [
|
|
2689
|
-
className: Z("flex items-center shrink-0 font-medium",
|
|
2777
|
+
children: [E && /* @__PURE__ */ $("span", {
|
|
2778
|
+
className: Z("flex items-center shrink-0 font-medium", E.direction === "up" && "text-emerald-600 dark:text-emerald-400", E.direction === "down" && "text-rose-600 dark:text-rose-400", E.direction === "neutral" && "text-muted-foreground"),
|
|
2690
2779
|
children: [
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
"%"
|
|
2780
|
+
E.direction === "up" && /* @__PURE__ */ Q(vt, { className: "h-3 w-3 mr-1" }),
|
|
2781
|
+
E.direction === "down" && /* @__PURE__ */ Q(_t, { className: "h-3 w-3 mr-1" }),
|
|
2782
|
+
E.direction === "neutral" && /* @__PURE__ */ Q(kt, { className: "h-3 w-3 mr-1" }),
|
|
2783
|
+
Cn(E.value)
|
|
2696
2784
|
]
|
|
2697
2785
|
}), /* @__PURE__ */ Q("span", {
|
|
2698
2786
|
className: "truncate min-w-0",
|
|
2699
|
-
children:
|
|
2787
|
+
children: M
|
|
2700
2788
|
})]
|
|
2701
2789
|
})] }) })]
|
|
2702
2790
|
});
|
|
2703
|
-
},
|
|
2704
|
-
let _ = n ? pt(n) : null, { language:
|
|
2705
|
-
return /* @__PURE__ */ $(
|
|
2706
|
-
className: Z("h-full", o),
|
|
2707
|
-
...
|
|
2791
|
+
}, Di = ({ 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 }) => {
|
|
2792
|
+
let _ = xi(l, g), v = n ? pt(n) : null, { language: y } = K();
|
|
2793
|
+
return /* @__PURE__ */ $(Y, {
|
|
2794
|
+
className: Z("h-full", Jn, o),
|
|
2795
|
+
..._,
|
|
2708
2796
|
children: [/* @__PURE__ */ $(Be, {
|
|
2709
|
-
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
2797
|
+
className: "flex flex-row items-center justify-between gap-2 space-y-0 pb-2",
|
|
2710
2798
|
children: [/* @__PURE__ */ Q(Ve, {
|
|
2711
|
-
className:
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2799
|
+
className: Yn,
|
|
2800
|
+
title: G(e, y) || void 0,
|
|
2801
|
+
children: G(e, y)
|
|
2802
|
+
}), v && /* @__PURE__ */ Q(v, { className: "h-4 w-4 shrink-0 text-muted-foreground" })]
|
|
2803
|
+
}), /* @__PURE__ */ Q(ze, { children: s ? /* @__PURE__ */ $("div", {
|
|
2715
2804
|
className: "flex items-center gap-2 text-muted-foreground",
|
|
2716
2805
|
"data-testid": "metric-card-loading",
|
|
2717
2806
|
children: [/* @__PURE__ */ Q(Ot, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
|
|
@@ -2726,8 +2815,9 @@ var di = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2726
2815
|
className: "text-xs text-destructive truncate",
|
|
2727
2816
|
children: c
|
|
2728
2817
|
})]
|
|
2729
|
-
}) : /* @__PURE__ */ $(
|
|
2730
|
-
className: "
|
|
2818
|
+
}) : /* @__PURE__ */ $($t, { children: [/* @__PURE__ */ Q("div", {
|
|
2819
|
+
className: Z("font-bold", tr(t)),
|
|
2820
|
+
title: rr(t),
|
|
2731
2821
|
children: t
|
|
2732
2822
|
}), (r || i || a) && /* @__PURE__ */ $("p", {
|
|
2733
2823
|
className: "text-xs text-muted-foreground flex items-center mt-1",
|
|
@@ -2739,79 +2829,79 @@ var di = ({ label: e, value: t, trend: n, icon: r, className: i, description: a,
|
|
|
2739
2829
|
r === "neutral" && /* @__PURE__ */ Q(kt, { className: "h-3 w-3 mr-1" }),
|
|
2740
2830
|
i
|
|
2741
2831
|
]
|
|
2742
|
-
}),
|
|
2832
|
+
}), G(a, y)]
|
|
2743
2833
|
})] }) })]
|
|
2744
2834
|
});
|
|
2745
|
-
},
|
|
2835
|
+
}, Oi = 25, ki = {
|
|
2746
2836
|
sum: !0,
|
|
2747
2837
|
avg: !0,
|
|
2748
2838
|
min: !0,
|
|
2749
2839
|
max: !0,
|
|
2750
2840
|
count: !1
|
|
2751
2841
|
};
|
|
2752
|
-
function
|
|
2753
|
-
return typeof e == "string" && Object.prototype.hasOwnProperty.call(
|
|
2842
|
+
function Ai(e) {
|
|
2843
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(ki, e) && ki[e];
|
|
2754
2844
|
}
|
|
2755
|
-
function
|
|
2845
|
+
function ji(e, t) {
|
|
2756
2846
|
return `0,0${e > 0 ? `.${"0".repeat(e)}` : ""}${t ? "%" : ""}`;
|
|
2757
2847
|
}
|
|
2758
|
-
function
|
|
2848
|
+
function Mi(e) {
|
|
2759
2849
|
let [t, n] = String(e).split("e"), r = t.indexOf("."), i = r === -1 ? 0 : t.length - r - 1;
|
|
2760
2850
|
return Math.min(Math.max(i - (n ? Number(n) : 0), 0), 20);
|
|
2761
2851
|
}
|
|
2762
|
-
function
|
|
2852
|
+
function Ni(e) {
|
|
2763
2853
|
if (!Array.isArray(e)) return e;
|
|
2764
|
-
let t =
|
|
2765
|
-
return t !== void 0 &&
|
|
2854
|
+
let t = V(e);
|
|
2855
|
+
return t !== void 0 && mn(t) ? hn(t) : t;
|
|
2766
2856
|
}
|
|
2767
|
-
var
|
|
2768
|
-
let E = a(
|
|
2857
|
+
var Pi = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: s, trend: l, 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: w, variant: T }) => {
|
|
2858
|
+
let E = a(H), D = m || E?.dataSource, [O, A] = u(!1), [j, M] = u(null), [N, ee] = u(null), [P, te] = u(!1), [ne, F] = u(null), [I, re] = u(null);
|
|
2769
2859
|
o(() => {
|
|
2770
2860
|
let t = !0;
|
|
2771
2861
|
if (D && e && typeof D.getObjectSchema == "function") return D.getObjectSchema(e).then((e) => {
|
|
2772
|
-
t &&
|
|
2862
|
+
t && re(e);
|
|
2773
2863
|
}).catch(() => {}), () => {
|
|
2774
2864
|
t = !1;
|
|
2775
2865
|
};
|
|
2776
2866
|
}, [D, e]);
|
|
2777
|
-
let
|
|
2867
|
+
let L = c(() => {
|
|
2778
2868
|
let e = t?.field;
|
|
2779
|
-
if (!e || !
|
|
2780
|
-
let n =
|
|
2869
|
+
if (!e || !I?.fields) return null;
|
|
2870
|
+
let n = I.fields;
|
|
2781
2871
|
return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
|
|
2782
|
-
}, [
|
|
2872
|
+
}, [I, t?.field]), oe = Ai(t?.function), se = c(() => {
|
|
2783
2873
|
if (g) return g;
|
|
2784
|
-
if (!
|
|
2785
|
-
let e =
|
|
2874
|
+
if (!L || !oe) return;
|
|
2875
|
+
let e = L.type, n = e === "percent";
|
|
2786
2876
|
if (!n && e !== "number" && e !== "integer") return;
|
|
2787
|
-
let r =
|
|
2877
|
+
let r = gn({
|
|
2788
2878
|
type: e,
|
|
2789
|
-
scale:
|
|
2879
|
+
scale: L.scale
|
|
2790
2880
|
});
|
|
2791
|
-
if (r !== void 0) return
|
|
2881
|
+
if (r !== void 0) return ji(r, n);
|
|
2792
2882
|
let i = t?.function;
|
|
2793
2883
|
if (i === "min" || i === "max") {
|
|
2794
2884
|
let e = typeof j == "number" ? j : typeof j == "string" && j.trim() !== "" ? Number(j) : NaN;
|
|
2795
|
-
if (Number.isFinite(e)) return
|
|
2885
|
+
if (Number.isFinite(e)) return ji(Mi(e), !1);
|
|
2796
2886
|
}
|
|
2797
2887
|
return "0,0";
|
|
2798
2888
|
}, [
|
|
2799
2889
|
g,
|
|
2800
|
-
I,
|
|
2801
2890
|
L,
|
|
2891
|
+
oe,
|
|
2802
2892
|
t?.function,
|
|
2803
2893
|
j
|
|
2804
|
-
]), { currency:
|
|
2894
|
+
]), { currency: ce } = Fe(), { language: le } = K(), ue = Pe(), de = c(() => {
|
|
2805
2895
|
if (_) return _;
|
|
2806
|
-
if (
|
|
2896
|
+
if (oe && L?.type === "currency") return Me(L, ce);
|
|
2807
2897
|
}, [
|
|
2808
2898
|
_,
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
]),
|
|
2899
|
+
L,
|
|
2900
|
+
ce,
|
|
2901
|
+
oe
|
|
2902
|
+
]), pe = c(() => t ? JSON.stringify(t) : "", [t]), me = we(), V = c(() => fe(n, me), [n, me]), he = c(() => V ? JSON.stringify(V) : "", [V]), ge = c(() => C ? JSON.stringify(C) : "", [C]), _e = i(async (n, r) => {
|
|
2813
2903
|
if (t && typeof n.aggregate == "function") {
|
|
2814
|
-
let i = t.groupBy, a = ae(i) ? await n.aggregate(e,
|
|
2904
|
+
let i = t.groupBy, a = ae(i) ? await n.aggregate(e, R(t, i, Ni(r))) : await n.aggregate(e, {
|
|
2815
2905
|
field: t.field,
|
|
2816
2906
|
function: t.function,
|
|
2817
2907
|
groupBy: i || "_all",
|
|
@@ -2830,59 +2920,59 @@ var yi = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: c,
|
|
|
2830
2920
|
return (Array.isArray(t) ? t : t?.data || t?.records || []).length;
|
|
2831
2921
|
}
|
|
2832
2922
|
return null;
|
|
2833
|
-
}, [e,
|
|
2923
|
+
}, [e, pe]), ve = i(async (t, r) => {
|
|
2834
2924
|
if (t && e) {
|
|
2835
|
-
r.current && (
|
|
2925
|
+
r.current && (te(!0), F(null));
|
|
2836
2926
|
try {
|
|
2837
|
-
let e = C ?
|
|
2927
|
+
let e = C ? B(n, C) : null, [i, a] = await Promise.all([_e(t, V), e ? _e(t, e) : Promise.resolve(null)]);
|
|
2838
2928
|
if (i === null) return;
|
|
2839
|
-
r.current && (M(i),
|
|
2929
|
+
r.current && (M(i), ee(typeof a == "number" && Number.isFinite(a) ? a : null));
|
|
2840
2930
|
} catch (e) {
|
|
2841
|
-
console.error("[ObjectMetricWidget] Fetch error:", e), r.current &&
|
|
2931
|
+
console.error("[ObjectMetricWidget] Fetch error:", e), r.current && F(e instanceof Error ? e.message : "Failed to load metric");
|
|
2842
2932
|
} finally {
|
|
2843
|
-
r.current &&
|
|
2933
|
+
r.current && te(!1);
|
|
2844
2934
|
}
|
|
2845
2935
|
}
|
|
2846
2936
|
}, [
|
|
2847
2937
|
e,
|
|
2848
|
-
|
|
2849
|
-
me,
|
|
2938
|
+
pe,
|
|
2850
2939
|
he,
|
|
2940
|
+
ge,
|
|
2851
2941
|
_e
|
|
2852
|
-
]),
|
|
2942
|
+
]), ye = be(D && e || void 0);
|
|
2853
2943
|
o(() => {
|
|
2854
2944
|
let t = { current: !0 };
|
|
2855
|
-
return D && e ? ve(D, t) : (M(null),
|
|
2945
|
+
return D && e ? ve(D, t) : (M(null), F(null)), () => {
|
|
2856
2946
|
t.current = !1;
|
|
2857
2947
|
};
|
|
2858
2948
|
}, [
|
|
2859
2949
|
D,
|
|
2860
2950
|
e,
|
|
2861
2951
|
ve,
|
|
2862
|
-
|
|
2952
|
+
ye
|
|
2863
2953
|
]);
|
|
2864
|
-
let
|
|
2865
|
-
b && typeof
|
|
2866
|
-
let
|
|
2867
|
-
if (!g &&
|
|
2868
|
-
let e = typeof
|
|
2869
|
-
Number.isFinite(e) && (
|
|
2954
|
+
let U = j === null ? D ? "—" : s ?? "—" : j;
|
|
2955
|
+
b && typeof U == "number" && isFinite(U) && U >= 0 && U <= 1 && (U = 1 - U);
|
|
2956
|
+
let xe = U, Se = se;
|
|
2957
|
+
if (!g && oe && L?.type === "currency") {
|
|
2958
|
+
let e = typeof U == "number" ? U : U.trim() === "" ? NaN : Number(U);
|
|
2959
|
+
Number.isFinite(e) && (de ? xe = tn(e, de, ue) : Se = "0,0.00");
|
|
2870
2960
|
}
|
|
2871
|
-
if (
|
|
2872
|
-
let e = typeof
|
|
2961
|
+
if (oe && L?.type === "percent" && (!g || g.trim().endsWith("%"))) {
|
|
2962
|
+
let e = typeof U == "number" ? U : U.trim() === "" ? NaN : Number(U);
|
|
2873
2963
|
if (Number.isFinite(e)) {
|
|
2874
|
-
let t = g ?
|
|
2964
|
+
let t = g ? wi(g) : gn({
|
|
2875
2965
|
type: "percent",
|
|
2876
|
-
scale:
|
|
2966
|
+
scale: L.scale
|
|
2877
2967
|
});
|
|
2878
|
-
|
|
2968
|
+
xe = rn(e, cn(L), t, ue);
|
|
2879
2969
|
}
|
|
2880
2970
|
}
|
|
2881
|
-
let
|
|
2882
|
-
if (!C || typeof j != "number" || !Number.isFinite(j) ||
|
|
2883
|
-
let e =
|
|
2971
|
+
let Ce = c(() => {
|
|
2972
|
+
if (!C || typeof j != "number" || !Number.isFinite(j) || N === null) return;
|
|
2973
|
+
let e = Sn(j, N);
|
|
2884
2974
|
if (!e) return;
|
|
2885
|
-
let t =
|
|
2975
|
+
let t = k(C, n), r = `dashboard.trend.${t}`, i = {
|
|
2886
2976
|
vsPreviousPeriod: "vs previous period",
|
|
2887
2977
|
vsLastWeek: "vs last week",
|
|
2888
2978
|
vsLastMonth: "vs last month",
|
|
@@ -2898,54 +2988,55 @@ var yi = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: c,
|
|
|
2898
2988
|
}, [
|
|
2899
2989
|
C,
|
|
2900
2990
|
j,
|
|
2901
|
-
|
|
2991
|
+
N,
|
|
2902
2992
|
n,
|
|
2903
2993
|
w
|
|
2904
|
-
])
|
|
2905
|
-
let e =
|
|
2906
|
-
return
|
|
2994
|
+
]), Te = ie(x) && !!e && !!D, Ee = c(() => {
|
|
2995
|
+
let e = G(r, le), t = G(S, le);
|
|
2996
|
+
return z(x, {}, t || e || "Details");
|
|
2907
2997
|
}, [
|
|
2908
2998
|
x,
|
|
2909
2999
|
r,
|
|
2910
3000
|
S,
|
|
2911
3001
|
le
|
|
2912
|
-
]),
|
|
3002
|
+
]), De = Te ? /* @__PURE__ */ Q(Er, {
|
|
2913
3003
|
open: !0,
|
|
2914
3004
|
onClose: () => A(!1),
|
|
2915
|
-
title:
|
|
3005
|
+
title: Ee,
|
|
2916
3006
|
target: x?.target,
|
|
2917
3007
|
objectName: e,
|
|
2918
|
-
filter:
|
|
3008
|
+
filter: V,
|
|
2919
3009
|
dataSource: D,
|
|
2920
3010
|
columns: x?.columns,
|
|
2921
|
-
maxRows: x?.maxRows ??
|
|
3011
|
+
maxRows: x?.maxRows ?? Oi,
|
|
2922
3012
|
report: x?.report,
|
|
2923
3013
|
className: "h-full"
|
|
2924
3014
|
}) : null;
|
|
2925
|
-
return /* @__PURE__ */ $(
|
|
3015
|
+
return /* @__PURE__ */ $($t, { children: [/* @__PURE__ */ Q(Ei, {
|
|
2926
3016
|
label: r,
|
|
2927
|
-
value:
|
|
2928
|
-
trend:
|
|
3017
|
+
value: xe,
|
|
3018
|
+
trend: l,
|
|
3019
|
+
derivedTrend: Ce,
|
|
2929
3020
|
icon: d,
|
|
2930
3021
|
className: f,
|
|
2931
3022
|
description: p,
|
|
2932
|
-
loading:
|
|
2933
|
-
error:
|
|
3023
|
+
loading: P,
|
|
3024
|
+
error: ne,
|
|
2934
3025
|
colorVariant: h,
|
|
2935
|
-
format:
|
|
2936
|
-
currency:
|
|
3026
|
+
format: Se,
|
|
3027
|
+
currency: de,
|
|
2937
3028
|
prefix: v,
|
|
2938
3029
|
suffix: y,
|
|
2939
3030
|
variant: T,
|
|
2940
|
-
onClick:
|
|
2941
|
-
}),
|
|
3031
|
+
onClick: Te ? () => A(!0) : void 0
|
|
3032
|
+
}), O && De] });
|
|
2942
3033
|
};
|
|
2943
3034
|
//#endregion
|
|
2944
3035
|
//#region src/PivotTable.tsx
|
|
2945
|
-
function
|
|
3036
|
+
function Fi() {
|
|
2946
3037
|
return Re()("dashboard.total", "Total");
|
|
2947
3038
|
}
|
|
2948
|
-
function
|
|
3039
|
+
function Ii(e, t) {
|
|
2949
3040
|
if (!t) return String(e);
|
|
2950
3041
|
let n = "", r = !1, i, a = t, o = a.match(/^([^0-9.,#]*)/);
|
|
2951
3042
|
if (o && o[1]) {
|
|
@@ -2962,18 +3053,18 @@ function xi(e, t) {
|
|
|
2962
3053
|
}
|
|
2963
3054
|
return n + l + c;
|
|
2964
3055
|
}
|
|
2965
|
-
var
|
|
2966
|
-
function
|
|
2967
|
-
return e === "" ?
|
|
3056
|
+
var Li = "—";
|
|
3057
|
+
function Ri(e, t) {
|
|
3058
|
+
return e === "" ? Li : t?.[e] ?? e;
|
|
2968
3059
|
}
|
|
2969
|
-
var
|
|
3060
|
+
var zi = Object.freeze([]), Bi = /* @__PURE__ */ new Set([
|
|
2970
3061
|
"sum",
|
|
2971
3062
|
"count",
|
|
2972
3063
|
"avg",
|
|
2973
3064
|
"min",
|
|
2974
3065
|
"max"
|
|
2975
3066
|
]);
|
|
2976
|
-
function
|
|
3067
|
+
function Vi(e, t) {
|
|
2977
3068
|
if (e.length === 0) return 0;
|
|
2978
3069
|
switch (t) {
|
|
2979
3070
|
case "sum": return e.reduce((e, t) => e + t, 0);
|
|
@@ -2984,8 +3075,8 @@ function Ei(e, t) {
|
|
|
2984
3075
|
default: return NaN;
|
|
2985
3076
|
}
|
|
2986
3077
|
}
|
|
2987
|
-
var
|
|
2988
|
-
let { title:
|
|
3078
|
+
var Hi = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, sourceLabel: a, onDrillDown: o }) => {
|
|
3079
|
+
let { title: s, rowField: l, columnField: u, valueField: d, aggregation: f = "sum", data: p = zi, showRowTotals: m = !1, showColumnTotals: h = !1, format: g, columnColors: _ } = e, v = Fi(), y = typeof o == "function", b = (e) => {
|
|
2989
3080
|
y && o({
|
|
2990
3081
|
...e,
|
|
2991
3082
|
rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
|
|
@@ -2993,7 +3084,7 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
2993
3084
|
});
|
|
2994
3085
|
}, x = (e) => (t) => {
|
|
2995
3086
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
|
|
2996
|
-
}, S = y ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", C = Array.isArray(p) ? p :
|
|
3087
|
+
}, S = y ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", C = Array.isArray(p) ? p : zi, { rowKeys: w, colKeys: T, matrix: E, rowTotals: D, colTotals: O, grandTotal: k } = c(() => {
|
|
2997
3088
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
|
|
2998
3089
|
for (let r of C) {
|
|
2999
3090
|
let i = String(r[l] ?? ""), a = String(r[u] ?? ""), o = Number(r[d]) || 0;
|
|
@@ -3004,10 +3095,10 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3004
3095
|
a[e] = {};
|
|
3005
3096
|
let t = [];
|
|
3006
3097
|
for (let r of i) {
|
|
3007
|
-
let i = n[e]?.[r] ?? [], o =
|
|
3098
|
+
let i = n[e]?.[r] ?? [], o = Vi(i, f);
|
|
3008
3099
|
a[e][r] = o, t.push(...i), !s[r] && s[r];
|
|
3009
3100
|
}
|
|
3010
|
-
o[e] =
|
|
3101
|
+
o[e] = Vi(t, f);
|
|
3011
3102
|
}
|
|
3012
3103
|
for (let e of i) {
|
|
3013
3104
|
let t = [];
|
|
@@ -3015,7 +3106,7 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3015
3106
|
let r = n[i]?.[e] ?? [];
|
|
3016
3107
|
t.push(...r);
|
|
3017
3108
|
}
|
|
3018
|
-
s[e] =
|
|
3109
|
+
s[e] = Vi(t, f);
|
|
3019
3110
|
}
|
|
3020
3111
|
let c = [];
|
|
3021
3112
|
for (let e of C) c.push(Number(e[d]) || 0);
|
|
@@ -3025,7 +3116,7 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3025
3116
|
matrix: a,
|
|
3026
3117
|
rowTotals: o,
|
|
3027
3118
|
colTotals: s,
|
|
3028
|
-
grandTotal:
|
|
3119
|
+
grandTotal: Vi(c, f)
|
|
3029
3120
|
};
|
|
3030
3121
|
}, [
|
|
3031
3122
|
C,
|
|
@@ -3033,22 +3124,22 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3033
3124
|
u,
|
|
3034
3125
|
d,
|
|
3035
3126
|
f
|
|
3036
|
-
]), A = (e) =>
|
|
3037
|
-
return
|
|
3127
|
+
]), A = (e) => Ii(e, g);
|
|
3128
|
+
return Bi.has(f) ? C.length === 0 ? /* @__PURE__ */ $("div", {
|
|
3038
3129
|
className: Z("overflow-auto", t),
|
|
3039
|
-
children: [
|
|
3130
|
+
children: [s && /* @__PURE__ */ Q("h3", {
|
|
3040
3131
|
className: "text-sm font-semibold mb-2",
|
|
3041
|
-
children:
|
|
3042
|
-
}), /* @__PURE__ */ Q(
|
|
3132
|
+
children: s
|
|
3133
|
+
}), /* @__PURE__ */ Q(Wn, {
|
|
3043
3134
|
testId: "pivot-empty-state",
|
|
3044
3135
|
source: a,
|
|
3045
3136
|
className: "py-8"
|
|
3046
3137
|
})]
|
|
3047
3138
|
}) : /* @__PURE__ */ $("div", {
|
|
3048
3139
|
className: Z("overflow-auto", t),
|
|
3049
|
-
children: [
|
|
3140
|
+
children: [s && /* @__PURE__ */ Q("h3", {
|
|
3050
3141
|
className: "text-sm font-semibold mb-2",
|
|
3051
|
-
children:
|
|
3142
|
+
children: s
|
|
3052
3143
|
}), /* @__PURE__ */ $("table", {
|
|
3053
3144
|
className: "w-full text-sm border-collapse table-auto",
|
|
3054
3145
|
role: "table",
|
|
@@ -3073,7 +3164,7 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3073
3164
|
onClick: y ? t : void 0,
|
|
3074
3165
|
onKeyDown: y ? x(t) : void 0,
|
|
3075
3166
|
"aria-label": y ? `Drill into ${u}: ${e || "(empty)"}` : void 0,
|
|
3076
|
-
children:
|
|
3167
|
+
children: Ri(e, r)
|
|
3077
3168
|
}, e);
|
|
3078
3169
|
}),
|
|
3079
3170
|
m && /* @__PURE__ */ Q("th", {
|
|
@@ -3098,7 +3189,7 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3098
3189
|
rowKey: e
|
|
3099
3190
|
})) : void 0,
|
|
3100
3191
|
"aria-label": y ? `Drill into ${l}: ${e || "(empty)"}` : void 0,
|
|
3101
|
-
children:
|
|
3192
|
+
children: Ri(e, n)
|
|
3102
3193
|
}),
|
|
3103
3194
|
T.map((t) => {
|
|
3104
3195
|
let n = E[e]?.[t] ?? 0, r = () => b({
|
|
@@ -3179,9 +3270,9 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3179
3270
|
}) : /* @__PURE__ */ $("div", {
|
|
3180
3271
|
className: Z("overflow-auto", t),
|
|
3181
3272
|
"data-testid": "pivot-unsupported-aggregation",
|
|
3182
|
-
children: [
|
|
3273
|
+
children: [s && /* @__PURE__ */ Q("h3", {
|
|
3183
3274
|
className: "text-sm font-semibold mb-2",
|
|
3184
|
-
children:
|
|
3275
|
+
children: s
|
|
3185
3276
|
}), /* @__PURE__ */ Q("div", {
|
|
3186
3277
|
role: "alert",
|
|
3187
3278
|
className: "flex flex-col items-center justify-center py-8 text-destructive",
|
|
@@ -3192,14 +3283,14 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3192
3283
|
String(f),
|
|
3193
3284
|
"” — this pivot table renders",
|
|
3194
3285
|
" ",
|
|
3195
|
-
[...
|
|
3286
|
+
[...Bi].join(", "),
|
|
3196
3287
|
"."
|
|
3197
3288
|
]
|
|
3198
3289
|
})
|
|
3199
3290
|
})]
|
|
3200
3291
|
});
|
|
3201
|
-
},
|
|
3202
|
-
let r = a(
|
|
3292
|
+
}, Ui = Object.freeze([]), Wi = ({ schema: e, dataSource: t, className: n }) => {
|
|
3293
|
+
let r = a(H), i = t || r?.dataSource, s = U(e.bind), [l, d] = u([]), [f, p] = u(!1), [h, g] = u(null), [_, v] = u({}), [y, b] = u({}), [x, S] = u(null), { fieldLabel: C, fieldOptionLabel: w } = Le();
|
|
3203
3294
|
o(() => {
|
|
3204
3295
|
if (!i || !e.objectName) return;
|
|
3205
3296
|
let t = i.getObjectSchema;
|
|
@@ -3231,23 +3322,23 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3231
3322
|
C,
|
|
3232
3323
|
w
|
|
3233
3324
|
]);
|
|
3234
|
-
let T =
|
|
3325
|
+
let T = we(), E = !!i && !!e.objectName && !s && (!e.data || e.data.length === 0), D = be(E ? e.objectName : void 0);
|
|
3235
3326
|
o(() => {
|
|
3236
3327
|
let t = !0;
|
|
3237
|
-
return e.objectName && !
|
|
3328
|
+
return e.objectName && !s && (!e.data || e.data.length === 0) && (async () => {
|
|
3238
3329
|
if (i && e.objectName) {
|
|
3239
|
-
t && (
|
|
3330
|
+
t && (p(!0), g(null));
|
|
3240
3331
|
try {
|
|
3241
3332
|
let n;
|
|
3242
3333
|
if (typeof i.find == "function") {
|
|
3243
|
-
let t = await i.find(e.objectName, { $filter:
|
|
3334
|
+
let t = await i.find(e.objectName, { $filter: fe(e.filter, T) });
|
|
3244
3335
|
n = te(t);
|
|
3245
3336
|
} else return;
|
|
3246
3337
|
t && d(n);
|
|
3247
3338
|
} catch (e) {
|
|
3248
3339
|
console.error("[ObjectPivotTable] Fetch error:", e), t && g(e instanceof Error ? e.message : "Failed to load data");
|
|
3249
3340
|
} finally {
|
|
3250
|
-
t &&
|
|
3341
|
+
t && p(!1);
|
|
3251
3342
|
}
|
|
3252
3343
|
}
|
|
3253
3344
|
})(), () => {
|
|
@@ -3256,24 +3347,24 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3256
3347
|
}, [
|
|
3257
3348
|
e.objectName,
|
|
3258
3349
|
i,
|
|
3259
|
-
|
|
3350
|
+
s,
|
|
3260
3351
|
e.data,
|
|
3261
3352
|
e.filter,
|
|
3262
3353
|
T,
|
|
3263
3354
|
D
|
|
3264
3355
|
]);
|
|
3265
|
-
let O =
|
|
3356
|
+
let O = c(() => {
|
|
3266
3357
|
if (x) try {
|
|
3267
|
-
let t =
|
|
3358
|
+
let t = j(e.drillDown, x, {
|
|
3268
3359
|
rowField: e.rowField,
|
|
3269
3360
|
columnField: e.columnField
|
|
3270
3361
|
});
|
|
3271
3362
|
return {
|
|
3272
3363
|
ok: !0,
|
|
3273
|
-
filter:
|
|
3364
|
+
filter: A(e.filter, t)
|
|
3274
3365
|
};
|
|
3275
3366
|
} catch (e) {
|
|
3276
|
-
if (!(e instanceof
|
|
3367
|
+
if (!(e instanceof m)) throw e;
|
|
3277
3368
|
return {
|
|
3278
3369
|
ok: !1,
|
|
3279
3370
|
refusal: e
|
|
@@ -3285,12 +3376,12 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3285
3376
|
e.rowField,
|
|
3286
3377
|
e.columnField,
|
|
3287
3378
|
e.filter
|
|
3288
|
-
]),
|
|
3379
|
+
]), k = O?.ok === !1 ? O.refusal.message : void 0;
|
|
3289
3380
|
o(() => {
|
|
3290
|
-
|
|
3291
|
-
}, [
|
|
3292
|
-
let M =
|
|
3293
|
-
if (f &&
|
|
3381
|
+
k && console.warn(`[ObjectPivotTable] drill-down refused — the drilled list cannot be scoped: ${k}`);
|
|
3382
|
+
}, [k]);
|
|
3383
|
+
let M = s || e.data || l, N = Array.isArray(M) ? M : Ui;
|
|
3384
|
+
if (f && N.length === 0) return /* @__PURE__ */ $("div", {
|
|
3294
3385
|
className: Z("overflow-auto", n),
|
|
3295
3386
|
"data-testid": "pivot-loading",
|
|
3296
3387
|
children: [e.title && /* @__PURE__ */ Q("h3", {
|
|
@@ -3364,7 +3455,7 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3364
3455
|
})]
|
|
3365
3456
|
})]
|
|
3366
3457
|
});
|
|
3367
|
-
if (!i && e.objectName &&
|
|
3458
|
+
if (!i && e.objectName && N.length === 0) return /* @__PURE__ */ $("div", {
|
|
3368
3459
|
className: Z("overflow-auto", n),
|
|
3369
3460
|
children: [e.title && /* @__PURE__ */ Q("h3", {
|
|
3370
3461
|
className: "text-sm font-semibold mb-2",
|
|
@@ -3381,35 +3472,35 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3381
3472
|
})
|
|
3382
3473
|
})]
|
|
3383
3474
|
});
|
|
3384
|
-
let { drillDown:
|
|
3385
|
-
...
|
|
3386
|
-
data:
|
|
3387
|
-
},
|
|
3388
|
-
return /* @__PURE__ */ $(
|
|
3389
|
-
schema:
|
|
3475
|
+
let { drillDown: ee, ...P } = e, ne = {
|
|
3476
|
+
...P,
|
|
3477
|
+
data: N
|
|
3478
|
+
}, F = e.rowField ? _[e.rowField] : void 0, I = e.columnField ? _[e.columnField] : void 0, re = e.rowField ? y[e.rowField] : void 0, ae = e.drillDown, L = ie(ae) ? (e) => S(e) : void 0;
|
|
3479
|
+
return /* @__PURE__ */ $($t, { children: [/* @__PURE__ */ Q(Hi, {
|
|
3480
|
+
schema: ne,
|
|
3390
3481
|
className: n,
|
|
3391
|
-
rowLabels:
|
|
3392
|
-
columnLabels:
|
|
3393
|
-
rowFieldLabel:
|
|
3482
|
+
rowLabels: F,
|
|
3483
|
+
columnLabels: I,
|
|
3484
|
+
rowFieldLabel: re,
|
|
3394
3485
|
sourceLabel: e.objectName,
|
|
3395
|
-
onDrillDown:
|
|
3486
|
+
onDrillDown: L
|
|
3396
3487
|
}), (() => {
|
|
3397
3488
|
if (!x || !e.objectName || !O?.ok) return null;
|
|
3398
|
-
let t = O.filter, n =
|
|
3399
|
-
return /* @__PURE__ */ Q(
|
|
3489
|
+
let t = O.filter, n = z(ae, x, e.title || "Details");
|
|
3490
|
+
return /* @__PURE__ */ Q(Er, {
|
|
3400
3491
|
open: !0,
|
|
3401
3492
|
onClose: () => S(null),
|
|
3402
3493
|
title: n,
|
|
3403
|
-
target:
|
|
3494
|
+
target: ae?.target ?? "drawer",
|
|
3404
3495
|
objectName: e.objectName,
|
|
3405
3496
|
filter: t,
|
|
3406
3497
|
dataSource: i,
|
|
3407
|
-
columns:
|
|
3408
|
-
maxRows:
|
|
3409
|
-
report:
|
|
3498
|
+
columns: ae?.columns,
|
|
3499
|
+
maxRows: ae?.maxRows,
|
|
3500
|
+
report: ae?.report
|
|
3410
3501
|
});
|
|
3411
3502
|
})()] });
|
|
3412
|
-
},
|
|
3503
|
+
}, Gi = {
|
|
3413
3504
|
"dashboard.config.breadcrumb.dashboard": "Dashboard",
|
|
3414
3505
|
"dashboard.config.breadcrumb.configuration": "Configuration",
|
|
3415
3506
|
"dashboard.config.breadcrumb.widget": "Widget",
|
|
@@ -3485,10 +3576,10 @@ var Di = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
|
|
|
3485
3576
|
"dashboard.config.color.success": "Success",
|
|
3486
3577
|
"dashboard.config.color.warning": "Warning",
|
|
3487
3578
|
"dashboard.config.color.danger": "Danger"
|
|
3488
|
-
},
|
|
3579
|
+
}, Ki = je(Gi, "dashboard.config.section.general");
|
|
3489
3580
|
//#endregion
|
|
3490
3581
|
//#region src/DashboardConfigPanel.tsx
|
|
3491
|
-
function
|
|
3582
|
+
function qi(e) {
|
|
3492
3583
|
return [
|
|
3493
3584
|
{
|
|
3494
3585
|
value: "0",
|
|
@@ -3520,7 +3611,7 @@ function Mi(e) {
|
|
|
3520
3611
|
}
|
|
3521
3612
|
];
|
|
3522
3613
|
}
|
|
3523
|
-
function
|
|
3614
|
+
function Ji(e) {
|
|
3524
3615
|
return [
|
|
3525
3616
|
{
|
|
3526
3617
|
value: "light",
|
|
@@ -3536,7 +3627,7 @@ function Ni(e) {
|
|
|
3536
3627
|
}
|
|
3537
3628
|
];
|
|
3538
3629
|
}
|
|
3539
|
-
function
|
|
3630
|
+
function Yi(e) {
|
|
3540
3631
|
return {
|
|
3541
3632
|
breadcrumb: [e("dashboard.config.breadcrumb.dashboard"), e("dashboard.config.breadcrumb.configuration")],
|
|
3542
3633
|
sections: [
|
|
@@ -3583,7 +3674,7 @@ function Pi(e) {
|
|
|
3583
3674
|
label: e("dashboard.config.field.autoRefresh"),
|
|
3584
3675
|
type: "select",
|
|
3585
3676
|
defaultValue: "0",
|
|
3586
|
-
options:
|
|
3677
|
+
options: qi(e)
|
|
3587
3678
|
}]
|
|
3588
3679
|
},
|
|
3589
3680
|
{
|
|
@@ -3615,15 +3706,15 @@ function Pi(e) {
|
|
|
3615
3706
|
label: e("dashboard.config.field.theme"),
|
|
3616
3707
|
type: "select",
|
|
3617
3708
|
defaultValue: "auto",
|
|
3618
|
-
options:
|
|
3709
|
+
options: Ji(e)
|
|
3619
3710
|
}
|
|
3620
3711
|
]
|
|
3621
3712
|
}
|
|
3622
3713
|
]
|
|
3623
3714
|
};
|
|
3624
3715
|
}
|
|
3625
|
-
function
|
|
3626
|
-
let { t: o } =
|
|
3716
|
+
function Xi({ open: t, onClose: n, config: r, onSave: i, onFieldChange: a }) {
|
|
3717
|
+
let { t: o } = Ki(), { draft: s, isDirty: c, updateField: l, discard: u } = mt(r, { onUpdate: a }), d = e.useMemo(() => Yi(o), [o]);
|
|
3627
3718
|
return /* @__PURE__ */ Q(We, {
|
|
3628
3719
|
open: t,
|
|
3629
3720
|
onClose: n,
|
|
@@ -3637,19 +3728,19 @@ function Fi({ open: t, onClose: n, config: r, onSave: i, onFieldChange: a }) {
|
|
|
3637
3728
|
}
|
|
3638
3729
|
//#endregion
|
|
3639
3730
|
//#region src/measureRefusal.ts
|
|
3640
|
-
function
|
|
3731
|
+
function Zi(e) {
|
|
3641
3732
|
let t = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], n = {
|
|
3642
3733
|
...typeof e.id == "string" ? { id: e.id } : {},
|
|
3643
3734
|
...typeof e.type == "string" && e.type ? { type: e.type } : {},
|
|
3644
3735
|
values: t(e.values),
|
|
3645
3736
|
...Array.isArray(e.dimensions) ? { dimensions: t(e.dimensions) } : {}
|
|
3646
|
-
}, r =
|
|
3737
|
+
}, r = _n.safeParse(n);
|
|
3647
3738
|
if (!r.success) return r.error.issues.find((e) => e.code === "custom" && e.path.length === 1 && e.path[0] === "values")?.message;
|
|
3648
3739
|
}
|
|
3649
|
-
var
|
|
3740
|
+
var Qi = "__next_measure__";
|
|
3650
3741
|
//#endregion
|
|
3651
3742
|
//#region src/WidgetConfigPanel.tsx
|
|
3652
|
-
function
|
|
3743
|
+
function $i(e) {
|
|
3653
3744
|
return [
|
|
3654
3745
|
{
|
|
3655
3746
|
value: "metric",
|
|
@@ -3697,7 +3788,7 @@ function Ri(e) {
|
|
|
3697
3788
|
}
|
|
3698
3789
|
];
|
|
3699
3790
|
}
|
|
3700
|
-
function
|
|
3791
|
+
function ea(e) {
|
|
3701
3792
|
return [
|
|
3702
3793
|
{
|
|
3703
3794
|
value: "default",
|
|
@@ -3733,7 +3824,7 @@ function zi(e) {
|
|
|
3733
3824
|
}
|
|
3734
3825
|
];
|
|
3735
3826
|
}
|
|
3736
|
-
var
|
|
3827
|
+
var ta = [
|
|
3737
3828
|
"bar",
|
|
3738
3829
|
"horizontal-bar",
|
|
3739
3830
|
"line",
|
|
@@ -3742,24 +3833,24 @@ var Bi = [
|
|
|
3742
3833
|
"donut",
|
|
3743
3834
|
"scatter",
|
|
3744
3835
|
"funnel"
|
|
3745
|
-
],
|
|
3836
|
+
], na = [
|
|
3746
3837
|
"metric",
|
|
3747
3838
|
"gauge",
|
|
3748
3839
|
"solid-gauge",
|
|
3749
3840
|
"kpi",
|
|
3750
3841
|
"bullet"
|
|
3751
3842
|
];
|
|
3752
|
-
function
|
|
3753
|
-
return !!e &&
|
|
3843
|
+
function ra(e) {
|
|
3844
|
+
return !!e && ta.includes(e);
|
|
3754
3845
|
}
|
|
3755
|
-
function
|
|
3756
|
-
return !!e && !
|
|
3846
|
+
function ia(e) {
|
|
3847
|
+
return !!e && !na.includes(e);
|
|
3757
3848
|
}
|
|
3758
|
-
function
|
|
3759
|
-
return t === "pivot" ? e("dashboard.config.breadcrumb.pivotTable") : t === "table" ? e("dashboard.config.breadcrumb.table") :
|
|
3849
|
+
function aa(e, t) {
|
|
3850
|
+
return t === "pivot" ? e("dashboard.config.breadcrumb.pivotTable") : t === "table" ? e("dashboard.config.breadcrumb.table") : ra(t) ? e("dashboard.config.breadcrumb.chart") : e("dashboard.config.breadcrumb.widget");
|
|
3760
3851
|
}
|
|
3761
|
-
function
|
|
3762
|
-
let { t: c } =
|
|
3852
|
+
function oa({ names: t, options: n, placeholder: r, emptyText: i, onChange: a, canAdd: o = !0, refusal: s }) {
|
|
3853
|
+
let { t: c } = Ki(), [l, u] = e.useState(""), d = e.useMemo(() => new Set(t), [t]), f = e.useMemo(() => n.filter((e) => !d.has(e.value)), [n, d]), p = (e) => {
|
|
3763
3854
|
let n = e.trim();
|
|
3764
3855
|
o && n && !d.has(n) && (a([...t, n]), u(""));
|
|
3765
3856
|
}, m = (e) => a(t.filter((t) => t !== e));
|
|
@@ -3820,7 +3911,7 @@ function Gi({ names: t, options: n, placeholder: r, emptyText: i, onChange: a, c
|
|
|
3820
3911
|
]
|
|
3821
3912
|
});
|
|
3822
3913
|
}
|
|
3823
|
-
function
|
|
3914
|
+
function sa(e, t, n) {
|
|
3824
3915
|
let r = t ?? [], i = r.length > 0, a = r.map((e) => ({
|
|
3825
3916
|
value: e.name,
|
|
3826
3917
|
label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
|
|
@@ -3854,7 +3945,7 @@ function Ki(e, t, n) {
|
|
|
3854
3945
|
key: "dimensions",
|
|
3855
3946
|
label: u,
|
|
3856
3947
|
type: "custom",
|
|
3857
|
-
visibleWhen: (e) =>
|
|
3948
|
+
visibleWhen: (e) => ia(e.type),
|
|
3858
3949
|
helpText: e(n === "pivot" ? "dashboard.config.help.dimensionsPivot" : "dashboard.config.help.dimensions"),
|
|
3859
3950
|
render: (t, n, r) => {
|
|
3860
3951
|
let i = (o(r.dataset)?.dimensions ?? []).map((e) => ({
|
|
@@ -3866,7 +3957,7 @@ function Ki(e, t, n) {
|
|
|
3866
3957
|
children: /* @__PURE__ */ Q("div", {
|
|
3867
3958
|
"data-testid": "config-field-dimensions",
|
|
3868
3959
|
className: "w-40",
|
|
3869
|
-
children: /* @__PURE__ */ Q(
|
|
3960
|
+
children: /* @__PURE__ */ Q(oa, {
|
|
3870
3961
|
names: Array.isArray(t) ? t : [],
|
|
3871
3962
|
options: i,
|
|
3872
3963
|
placeholder: e("dashboard.config.placeholder.addDimension"),
|
|
@@ -3885,23 +3976,23 @@ function Ki(e, t, n) {
|
|
|
3885
3976
|
let i = (o(r.dataset)?.measures ?? []).map((e) => ({
|
|
3886
3977
|
value: e.name,
|
|
3887
3978
|
label: e.aggregate ? `${e.label ?? e.name} · ${e.aggregate}` : e.label ?? e.name
|
|
3888
|
-
})), a = Array.isArray(t) ? t : [], s =
|
|
3979
|
+
})), a = Array.isArray(t) ? t : [], s = pa(r), c = {
|
|
3889
3980
|
id: s.id,
|
|
3890
3981
|
type: s.type,
|
|
3891
3982
|
dimensions: s.dimensions
|
|
3892
|
-
}, l = a.length > 0 ?
|
|
3983
|
+
}, l = a.length > 0 ? Zi({
|
|
3893
3984
|
...c,
|
|
3894
3985
|
values: a
|
|
3895
|
-
}) : void 0, u = !
|
|
3986
|
+
}) : void 0, u = !Zi({
|
|
3896
3987
|
...c,
|
|
3897
|
-
values: [...a,
|
|
3988
|
+
values: [...a, Qi]
|
|
3898
3989
|
});
|
|
3899
3990
|
return /* @__PURE__ */ Q(Ge, {
|
|
3900
3991
|
label: f,
|
|
3901
3992
|
children: /* @__PURE__ */ Q("div", {
|
|
3902
3993
|
"data-testid": "config-field-values",
|
|
3903
3994
|
className: "w-40",
|
|
3904
|
-
children: /* @__PURE__ */ Q(
|
|
3995
|
+
children: /* @__PURE__ */ Q(oa, {
|
|
3905
3996
|
names: a,
|
|
3906
3997
|
options: i,
|
|
3907
3998
|
placeholder: e("dashboard.config.placeholder.addMeasure"),
|
|
@@ -3915,7 +4006,7 @@ function Ki(e, t, n) {
|
|
|
3915
4006
|
}
|
|
3916
4007
|
};
|
|
3917
4008
|
return {
|
|
3918
|
-
breadcrumb: [e("dashboard.config.breadcrumb.dashboard"),
|
|
4009
|
+
breadcrumb: [e("dashboard.config.breadcrumb.dashboard"), aa(e, n)],
|
|
3919
4010
|
sections: [
|
|
3920
4011
|
{
|
|
3921
4012
|
key: "general",
|
|
@@ -3937,7 +4028,7 @@ function Ki(e, t, n) {
|
|
|
3937
4028
|
key: "type",
|
|
3938
4029
|
label: e("dashboard.config.field.widgetType"),
|
|
3939
4030
|
type: "select",
|
|
3940
|
-
options:
|
|
4031
|
+
options: $i(e),
|
|
3941
4032
|
defaultValue: "metric"
|
|
3942
4033
|
}
|
|
3943
4034
|
]
|
|
@@ -3983,32 +4074,32 @@ function Ki(e, t, n) {
|
|
|
3983
4074
|
key: "colorVariant",
|
|
3984
4075
|
label: e("dashboard.config.field.colorVariant"),
|
|
3985
4076
|
type: "select",
|
|
3986
|
-
options:
|
|
4077
|
+
options: ea(e),
|
|
3987
4078
|
defaultValue: "default"
|
|
3988
4079
|
}]
|
|
3989
4080
|
}
|
|
3990
4081
|
]
|
|
3991
4082
|
};
|
|
3992
4083
|
}
|
|
3993
|
-
var
|
|
3994
|
-
function
|
|
4084
|
+
var ca = ["title", "description"];
|
|
4085
|
+
function la(e) {
|
|
3995
4086
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
3996
4087
|
}
|
|
3997
|
-
function
|
|
4088
|
+
function ua(e, t, n) {
|
|
3998
4089
|
let r = e;
|
|
3999
|
-
for (let i of
|
|
4090
|
+
for (let i of ca) {
|
|
4000
4091
|
let a = t?.[i];
|
|
4001
|
-
if (!
|
|
4092
|
+
if (!la(a)) continue;
|
|
4002
4093
|
let o = e[i];
|
|
4003
|
-
typeof o == "string" && (r === e && (r = { ...e }), r[i] = o ===
|
|
4094
|
+
typeof o == "string" && (r === e && (r = { ...e }), r[i] = o === G(a, n) ? a : Ne(a, n, o));
|
|
4004
4095
|
}
|
|
4005
4096
|
return r;
|
|
4006
4097
|
}
|
|
4007
|
-
var
|
|
4098
|
+
var da = [
|
|
4008
4099
|
"actionUrl",
|
|
4009
4100
|
"actionType",
|
|
4010
4101
|
"actionIcon"
|
|
4011
|
-
],
|
|
4102
|
+
], fa = [
|
|
4012
4103
|
"object",
|
|
4013
4104
|
"categoryField",
|
|
4014
4105
|
"categoryGranularity",
|
|
@@ -4035,26 +4126,26 @@ var Xi = [
|
|
|
4035
4126
|
"searchable",
|
|
4036
4127
|
"pagination"
|
|
4037
4128
|
];
|
|
4038
|
-
function
|
|
4129
|
+
function pa(e) {
|
|
4039
4130
|
let t = e.type, n = { ...e };
|
|
4040
|
-
for (let e of
|
|
4041
|
-
for (let e of
|
|
4042
|
-
return
|
|
4131
|
+
for (let e of fa) delete n[e];
|
|
4132
|
+
for (let e of da) delete n[e];
|
|
4133
|
+
return ia(t) || delete n.dimensions, n;
|
|
4043
4134
|
}
|
|
4044
|
-
function
|
|
4045
|
-
let { t: l, language: u } =
|
|
4135
|
+
function ma({ open: t, onClose: n, config: r, onSave: i, onFieldChange: a, headerExtra: o, datasets: s, datasetsLoading: c }) {
|
|
4136
|
+
let { t: l, language: u } = Ki(), d = e.useMemo(() => ({
|
|
4046
4137
|
...r,
|
|
4047
|
-
title: typeof r.title == "object" ?
|
|
4048
|
-
description: typeof r.description == "object" ?
|
|
4138
|
+
title: typeof r.title == "object" ? G(r.title, u) : r.title,
|
|
4139
|
+
description: typeof r.description == "object" ? G(r.description, u) : r.description
|
|
4049
4140
|
}), [r, u]), f = e.useCallback((e, t) => {
|
|
4050
4141
|
if (!a) return;
|
|
4051
4142
|
let n = r?.[e];
|
|
4052
|
-
a(e,
|
|
4143
|
+
a(e, ca.includes(e) && la(n) && typeof t == "string" ? Ne(n, u, t) : t);
|
|
4053
4144
|
}, [
|
|
4054
4145
|
a,
|
|
4055
4146
|
r,
|
|
4056
4147
|
u
|
|
4057
|
-
]), { draft: p, isDirty: m, updateField: h, discard: g } = mt(d, { onUpdate: f }), _ = e.useMemo(() =>
|
|
4148
|
+
]), { draft: p, isDirty: m, updateField: h, discard: g } = mt(d, { onUpdate: f }), _ = e.useMemo(() => sa(l, s, p.type), [
|
|
4058
4149
|
l,
|
|
4059
4150
|
s,
|
|
4060
4151
|
p.type
|
|
@@ -4066,15 +4157,15 @@ function $i({ open: t, onClose: n, config: r, onSave: i, onFieldChange: a, heade
|
|
|
4066
4157
|
draft: p,
|
|
4067
4158
|
isDirty: m,
|
|
4068
4159
|
onFieldChange: h,
|
|
4069
|
-
onSave: () => i(
|
|
4160
|
+
onSave: () => i(pa(ua(p, r, u))),
|
|
4070
4161
|
onDiscard: g,
|
|
4071
4162
|
headerExtra: o
|
|
4072
4163
|
});
|
|
4073
4164
|
}
|
|
4074
4165
|
//#endregion
|
|
4075
4166
|
//#region src/DashboardWithConfig.tsx
|
|
4076
|
-
function
|
|
4077
|
-
let [m, h] = l
|
|
4167
|
+
function ha({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh: s, recordCount: c, defaultConfigOpen: l = !1, className: d, datasets: f, datasetsLoading: p }) {
|
|
4168
|
+
let [m, h] = u(l), [g, _] = u(null), [v, y] = u(t), [b, x] = u(0);
|
|
4078
4169
|
o(() => {
|
|
4079
4170
|
y(t), x((e) => e + 1);
|
|
4080
4171
|
}, [t]);
|
|
@@ -4082,16 +4173,16 @@ function ea({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
4082
4173
|
if (!g || !v.widgets) return null;
|
|
4083
4174
|
let e = v.widgets, t = e.findIndex((e) => (e.id || e.title) === g);
|
|
4084
4175
|
if (t < 0) return null;
|
|
4085
|
-
let n = e[t], r = Jt(n.layout, {}, Yt(t)), i = n;
|
|
4176
|
+
let n = e[t], r = Jt(n.layout, {}, Yt(t)), i = On(n) ? void 0 : n, a = i?.dataset, o = i?.dimensions, s = i?.values;
|
|
4086
4177
|
return {
|
|
4087
4178
|
id: n.id ?? "",
|
|
4088
4179
|
title: n.title ?? "",
|
|
4089
4180
|
description: n.description ?? "",
|
|
4090
4181
|
type: n.type ?? "",
|
|
4091
|
-
dataset: typeof
|
|
4092
|
-
dimensions: Array.isArray(
|
|
4093
|
-
values: Array.isArray(
|
|
4094
|
-
colorVariant:
|
|
4182
|
+
dataset: typeof a == "string" ? a : "",
|
|
4183
|
+
dimensions: Array.isArray(o) ? o : [],
|
|
4184
|
+
values: Array.isArray(s) ? s : [],
|
|
4185
|
+
colorVariant: i?.colorVariant ?? "default",
|
|
4095
4186
|
layoutW: r.w,
|
|
4096
4187
|
layoutH: r.h
|
|
4097
4188
|
};
|
|
@@ -4136,7 +4227,7 @@ function ea({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
4136
4227
|
"data-testid": "dashboard-config-toggle",
|
|
4137
4228
|
children: [/* @__PURE__ */ Q(Nt, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
|
|
4138
4229
|
})
|
|
4139
|
-
}), /* @__PURE__ */ Q(
|
|
4230
|
+
}), /* @__PURE__ */ Q(hi, {
|
|
4140
4231
|
schema: v,
|
|
4141
4232
|
onRefresh: s,
|
|
4142
4233
|
recordCount: c,
|
|
@@ -4146,7 +4237,7 @@ function ea({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
4146
4237
|
})]
|
|
4147
4238
|
}), m && /* @__PURE__ */ Q("div", {
|
|
4148
4239
|
className: "relative shrink-0",
|
|
4149
|
-
children: g && S ? /* @__PURE__ */ Q(
|
|
4240
|
+
children: g && S ? /* @__PURE__ */ Q(ma, {
|
|
4150
4241
|
open: !0,
|
|
4151
4242
|
onClose: w,
|
|
4152
4243
|
config: S,
|
|
@@ -4154,7 +4245,7 @@ function ea({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
4154
4245
|
onFieldChange: T,
|
|
4155
4246
|
datasets: f,
|
|
4156
4247
|
datasetsLoading: p
|
|
4157
|
-
}) : /* @__PURE__ */ Q(
|
|
4248
|
+
}) : /* @__PURE__ */ Q(Xi, {
|
|
4158
4249
|
open: !0,
|
|
4159
4250
|
onClose: () => h(!1),
|
|
4160
4251
|
config: n,
|
|
@@ -4165,17 +4256,17 @@ function ea({ schema: t, config: n, onConfigSave: r, onWidgetSave: a, onRefresh:
|
|
|
4165
4256
|
}
|
|
4166
4257
|
//#endregion
|
|
4167
4258
|
//#region src/retired-node-types.tsx
|
|
4168
|
-
var
|
|
4169
|
-
function
|
|
4170
|
-
|
|
4259
|
+
var ga = Object.freeze({ dashboard: "[object-ui] Node type `view:dashboard` was RETIRED (objectui#9533). This package registers the dashboard renderer as `plugin-dashboard:dashboard`, the namespace the console's lazy stubs and the CLI's known-type whitelist already declare. Write `{ \"type\": \"plugin-dashboard:dashboard\" }`, or the bare `{ \"type\": \"dashboard\" }`, which resolves to the same renderer." }), _a = /* @__PURE__ */ new Set();
|
|
4260
|
+
function va(e) {
|
|
4261
|
+
_a.has(e) || (_a.add(e), console.error(ga[e] ?? `[object-ui] Node type \`${e}\` was retired by @object-ui/plugin-dashboard.`));
|
|
4171
4262
|
}
|
|
4172
|
-
function
|
|
4173
|
-
|
|
4263
|
+
function ya() {
|
|
4264
|
+
_a.clear();
|
|
4174
4265
|
}
|
|
4175
|
-
var
|
|
4176
|
-
let n = e?.schema, r = typeof n?.type == "string" ? n.type : void 0, i = typeof e?.type == "string" ? e.type : void 0, a = r ?? i ?? "view:dashboard", o = a.includes(":") ? a.slice(a.indexOf(":") + 1) : a, s =
|
|
4266
|
+
var ba = (e) => {
|
|
4267
|
+
let n = e?.schema, r = typeof n?.type == "string" ? n.type : void 0, i = typeof e?.type == "string" ? e.type : void 0, a = r ?? i ?? "view:dashboard", o = a.includes(":") ? a.slice(a.indexOf(":") + 1) : a, s = ga[o] ?? `[object-ui] Node type \`${a}\` was retired by @object-ui/plugin-dashboard.`;
|
|
4177
4268
|
return t.useEffect(() => {
|
|
4178
|
-
|
|
4269
|
+
va(o);
|
|
4179
4270
|
}, [o]), /* @__PURE__ */ Q("div", {
|
|
4180
4271
|
role: "alert",
|
|
4181
4272
|
"data-testid": "dashboard-retired-node-tombstone",
|
|
@@ -4184,7 +4275,7 @@ var aa = (e) => {
|
|
|
4184
4275
|
children: s
|
|
4185
4276
|
});
|
|
4186
4277
|
};
|
|
4187
|
-
|
|
4278
|
+
d.register("dashboard", hi, {
|
|
4188
4279
|
namespace: "plugin-dashboard",
|
|
4189
4280
|
label: "Dashboard",
|
|
4190
4281
|
category: "Complex",
|
|
@@ -4242,7 +4333,7 @@ u.register("dashboard", ti, {
|
|
|
4242
4333
|
columns: 3,
|
|
4243
4334
|
widgets: []
|
|
4244
4335
|
}
|
|
4245
|
-
}),
|
|
4336
|
+
}), d.register("metric", Ei, {
|
|
4246
4337
|
namespace: "plugin-dashboard",
|
|
4247
4338
|
skipFallback: !0,
|
|
4248
4339
|
label: "Metric Widget",
|
|
@@ -4254,7 +4345,7 @@ u.register("dashboard", ti, {
|
|
|
4254
4345
|
name: "value",
|
|
4255
4346
|
type: "string"
|
|
4256
4347
|
}]
|
|
4257
|
-
}),
|
|
4348
|
+
}), d.register("metric-card", Di, {
|
|
4258
4349
|
namespace: "plugin-dashboard",
|
|
4259
4350
|
skipFallback: !0,
|
|
4260
4351
|
label: "Metric Card",
|
|
@@ -4305,19 +4396,23 @@ u.register("dashboard", ti, {
|
|
|
4305
4396
|
value: "0"
|
|
4306
4397
|
}
|
|
4307
4398
|
});
|
|
4308
|
-
var
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4399
|
+
var xa = { filter: !0 }, Sa = P(({ schema: e, ...t }) => {
|
|
4400
|
+
let { t: n } = K();
|
|
4401
|
+
return /* @__PURE__ */ Q(he, {
|
|
4402
|
+
schema: e,
|
|
4403
|
+
mapping: xa,
|
|
4404
|
+
dataSource: t.dataSource,
|
|
4405
|
+
testId: "object-metric",
|
|
4406
|
+
errorTitle: n("element.number.sourceUnresolved", { defaultValue: "This metric’s data source could not be resolved" }),
|
|
4407
|
+
requiresObject: e != null && e.fallbackValue === void 0,
|
|
4408
|
+
children: (e) => /* @__PURE__ */ Q(Pi, {
|
|
4409
|
+
...t,
|
|
4410
|
+
objectName: e?.objectName ?? t.objectName,
|
|
4411
|
+
filter: e?.filter ?? t.filter
|
|
4412
|
+
})
|
|
4413
|
+
});
|
|
4414
|
+
});
|
|
4415
|
+
d.register("object-metric", Sa, {
|
|
4321
4416
|
namespace: "plugin-dashboard",
|
|
4322
4417
|
label: "Object Metric",
|
|
4323
4418
|
category: "Dashboard",
|
|
@@ -4325,7 +4420,7 @@ u.register("object-metric", sa, {
|
|
|
4325
4420
|
{
|
|
4326
4421
|
name: "objectName",
|
|
4327
4422
|
type: "string",
|
|
4328
|
-
required:
|
|
4423
|
+
description: "Object this metric aggregates. Not required: the node's `dataSource` binding can name the object instead, and `dataSource.object` lands on this key, outranking an authored value. With neither, and no `fallbackValue`, the tile shows a hint naming this key instead of a value."
|
|
4329
4424
|
},
|
|
4330
4425
|
{
|
|
4331
4426
|
name: "label",
|
|
@@ -4424,7 +4519,7 @@ u.register("object-metric", sa, {
|
|
|
4424
4519
|
}
|
|
4425
4520
|
],
|
|
4426
4521
|
defaultProps: { label: "Metric" }
|
|
4427
|
-
}),
|
|
4522
|
+
}), d.register("pivot", Hi, {
|
|
4428
4523
|
namespace: "plugin-dashboard",
|
|
4429
4524
|
label: "Pivot Table",
|
|
4430
4525
|
category: "Dashboard",
|
|
@@ -4496,18 +4591,22 @@ u.register("object-metric", sa, {
|
|
|
4496
4591
|
data: []
|
|
4497
4592
|
}
|
|
4498
4593
|
});
|
|
4499
|
-
var
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4594
|
+
var Ca = { filter: !0 }, wa = P(({ schema: e, ...t }) => {
|
|
4595
|
+
let { t: n } = K();
|
|
4596
|
+
return /* @__PURE__ */ Q(he, {
|
|
4597
|
+
schema: e,
|
|
4598
|
+
mapping: Ca,
|
|
4599
|
+
dataSource: t.dataSource,
|
|
4600
|
+
testId: "object-pivot",
|
|
4601
|
+
errorTitle: n("element.pivotTable.sourceUnresolved", { defaultValue: "This pivot table’s data source could not be resolved" }),
|
|
4602
|
+
requiresObject: e != null && e.data == null && e.bind == null,
|
|
4603
|
+
children: (e) => /* @__PURE__ */ Q(Wi, {
|
|
4604
|
+
...t,
|
|
4605
|
+
schema: e
|
|
4606
|
+
})
|
|
4607
|
+
});
|
|
4608
|
+
});
|
|
4609
|
+
d.register("object-pivot", wa, {
|
|
4511
4610
|
namespace: "plugin-dashboard",
|
|
4512
4611
|
label: "Object Pivot Table",
|
|
4513
4612
|
category: "Dashboard",
|
|
@@ -4516,7 +4615,7 @@ u.register("object-pivot", la, {
|
|
|
4516
4615
|
{
|
|
4517
4616
|
name: "objectName",
|
|
4518
4617
|
type: "string",
|
|
4519
|
-
required:
|
|
4618
|
+
description: "Object this pivot table cross-tabulates. Not required: the node's `dataSource` binding can name the object instead, and `dataSource.object` lands on this key, outranking an authored value. With neither, the table shows a hint naming this key and fetches nothing."
|
|
4520
4619
|
},
|
|
4521
4620
|
{
|
|
4522
4621
|
name: "title",
|
|
@@ -4591,7 +4690,7 @@ u.register("object-pivot", la, {
|
|
|
4591
4690
|
valueField: "",
|
|
4592
4691
|
aggregation: "sum"
|
|
4593
4692
|
}
|
|
4594
|
-
}),
|
|
4693
|
+
}), d.register("object-data-table", Cr, {
|
|
4595
4694
|
namespace: "plugin-dashboard",
|
|
4596
4695
|
label: "Object Data Table",
|
|
4597
4696
|
category: "Dashboard",
|
|
@@ -4624,18 +4723,18 @@ u.register("object-pivot", la, {
|
|
|
4624
4723
|
pagination: !1
|
|
4625
4724
|
}
|
|
4626
4725
|
});
|
|
4627
|
-
for (let e of Object.keys(
|
|
4726
|
+
for (let e of Object.keys(ga)) d.register(e, ba, {
|
|
4628
4727
|
namespace: "view",
|
|
4629
4728
|
skipFallback: !0
|
|
4630
4729
|
});
|
|
4631
|
-
var
|
|
4632
|
-
dashboard:
|
|
4633
|
-
"plugin-dashboard:metric":
|
|
4634
|
-
"plugin-dashboard:metric-card":
|
|
4635
|
-
"object-metric":
|
|
4636
|
-
pivot:
|
|
4637
|
-
"object-pivot":
|
|
4638
|
-
"object-data-table":
|
|
4730
|
+
var Ta = {
|
|
4731
|
+
dashboard: hi,
|
|
4732
|
+
"plugin-dashboard:metric": Ei,
|
|
4733
|
+
"plugin-dashboard:metric-card": Di,
|
|
4734
|
+
"object-metric": Sa,
|
|
4735
|
+
pivot: Hi,
|
|
4736
|
+
"object-pivot": wa,
|
|
4737
|
+
"object-data-table": Cr
|
|
4639
4738
|
};
|
|
4640
4739
|
//#endregion
|
|
4641
|
-
export {
|
|
4740
|
+
export { Gi as CONFIG_PANEL_DEFAULT_TRANSLATIONS, Xi as DashboardConfigPanel, bi as DashboardGridLayout, hi as DashboardRenderer, ha as DashboardWithConfig, Er as DrillDownDrawer, Di as MetricCard, Ei as MetricWidget, Cr as ObjectDataTable, Pi as ObjectMetricWidget, Wi as ObjectPivotTable, Hi as PivotTable, ga as RETIRED_DASHBOARD_NODE_TYPES, ba as RetiredDashboardNodeTombstone, ma as WidgetConfigPanel, Ta as dashboardComponents, va as reportRetiredDashboardNodeType, ya as resetRetiredDashboardNodeTypeReports, Ki as useConfigPanelTranslation };
|