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