@object-ui/plugin-charts 17.2.0 → 17.5.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 +417 -0
- package/README.md +0 -11
- package/dist/ChartContainerImpl.d.ts +1 -1
- package/dist/ObjectChart.d.ts +13 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +601 -555
- package/dist/index.umd.cjs +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { ComponentRegistry as e, buildCategoryRank as t, buildChartSeries as n,
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
1
|
+
import { ComponentRegistry as e, buildCategoryRank as t, buildChartSeries as n, buildOptionColorMap as r, compareToTrendLabelKey as i, computeDrillFilter as a, deriveDimensionLabelMaps as o, dimensionOptionTranslator as s, extractRecords as c, isDrillEnabled as l, loadDimensionFieldMeta as u, localizeFieldOptions as d, relabelDimensions as f, resolveContextTokens as p, resolveDrillTitle as ee, resolveFilterPlaceholders as m, shiftFilterByCompareTo as te } from "@object-ui/core";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import g, { Suspense as _, useCallback as ne, useContext as re, useEffect as ie, useMemo as v, useRef as y, useState as b } from "react";
|
|
4
|
+
import { Button as x, ChartSkeleton as S, Dialog as C, DialogContent as w, DialogHeader as ae, DialogTitle as oe, RefreshIndicator as se, Sheet as ce, SheetContent as le, SheetHeader as ue, SheetTitle as de, Skeleton as fe } from "@object-ui/components";
|
|
5
5
|
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
6
|
-
import { Area as
|
|
7
|
-
import { SchemaRenderer as
|
|
8
|
-
import { AlertCircle as
|
|
9
|
-
import { useSafeFieldLabel as
|
|
6
|
+
import { Area as O, AreaChart as pe, Bar as me, BarChart as k, Brush as he, CartesianGrid as ge, Cell as _e, ComposedChart as ve, Funnel as ye, FunnelChart as be, LabelList as A, Legend as j, Line as xe, LineChart as Se, Pie as Ce, PieChart as we, PolarAngleAxis as Te, PolarGrid as Ee, PolarRadiusAxis as De, Radar as Oe, RadarChart as ke, ReferenceArea as Ae, ReferenceLine as je, ResponsiveContainer as Me, Sankey as Ne, Scatter as Pe, ScatterChart as Fe, Tooltip as M, Treemap as N, XAxis as P, YAxis as F, ZAxis as Ie } from "recharts";
|
|
7
|
+
import { ElementDataSourceGate as Le, SchemaRenderer as Re, SchemaRendererContext as ze, useDataScope as Be, useDrillNavigation as Ve, useFilterScope as I } from "@object-ui/react";
|
|
8
|
+
import { AlertCircle as He, ArrowUpRight as L } from "lucide-react";
|
|
9
|
+
import { useSafeFieldLabel as R, useSafeTranslate as z } from "@object-ui/i18n";
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
|
-
var
|
|
11
|
+
var B = Object.defineProperty, V = (e, t, n) => () => {
|
|
12
12
|
if (n) throw n[0];
|
|
13
13
|
try {
|
|
14
14
|
return e && (t = e(e = 0)), t;
|
|
15
15
|
} catch (e) {
|
|
16
16
|
throw n = [e], e;
|
|
17
17
|
}
|
|
18
|
-
},
|
|
18
|
+
}, H = (e, t) => {
|
|
19
19
|
let n = {};
|
|
20
|
-
for (var r in e)
|
|
20
|
+
for (var r in e) B(n, r, {
|
|
21
21
|
get: e[r],
|
|
22
22
|
enumerable: !0
|
|
23
23
|
});
|
|
24
|
-
return t ||
|
|
24
|
+
return t || B(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/normalizeChartSchema.ts
|
|
28
|
-
function
|
|
29
|
-
let t =
|
|
28
|
+
function U(e) {
|
|
29
|
+
let t = q(e);
|
|
30
30
|
if (t) return t;
|
|
31
|
-
if (
|
|
31
|
+
if (K(e)) return Object.values(e).find((e) => typeof e == "string" && e);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
if (!
|
|
35
|
-
let t = {}, n =
|
|
33
|
+
function W(e) {
|
|
34
|
+
if (!K(e)) return;
|
|
35
|
+
let t = {}, n = q(e.field);
|
|
36
36
|
n && (t.field = n);
|
|
37
|
-
let r =
|
|
37
|
+
let r = q(e.format);
|
|
38
38
|
r && (t.format = r);
|
|
39
|
-
let i =
|
|
39
|
+
let i = J(e.min);
|
|
40
40
|
i !== void 0 && (t.min = i);
|
|
41
|
-
let a =
|
|
41
|
+
let a = J(e.max);
|
|
42
42
|
a !== void 0 && (t.max = a);
|
|
43
|
-
let o =
|
|
43
|
+
let o = J(e.stepSize);
|
|
44
44
|
o !== void 0 && o > 0 && (t.stepSize = o), typeof e.showGridLines == "boolean" && (t.showGridLines = e.showGridLines), typeof e.logarithmic == "boolean" && (t.logarithmic = e.logarithmic);
|
|
45
|
-
let s =
|
|
45
|
+
let s = q(e.position);
|
|
46
46
|
(s === "left" || s === "right" || s === "top" || s === "bottom") && (t.position = s);
|
|
47
|
-
let c =
|
|
47
|
+
let c = U(e.title);
|
|
48
48
|
return c && (t.title = c), t;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
if (!
|
|
52
|
-
let t =
|
|
50
|
+
function Ue(e) {
|
|
51
|
+
if (!K(e)) {
|
|
52
|
+
let t = q(e);
|
|
53
53
|
return t ? { dataKey: t } : void 0;
|
|
54
54
|
}
|
|
55
|
-
let t =
|
|
55
|
+
let t = q(e.dataKey) ?? q(e.name);
|
|
56
56
|
if (!t) return;
|
|
57
|
-
let n = { dataKey: t }, r =
|
|
57
|
+
let n = { dataKey: t }, r = U(e.label);
|
|
58
58
|
r && (n.label = r);
|
|
59
|
-
let i =
|
|
59
|
+
let i = q(e.chartType) ?? q(e.type);
|
|
60
60
|
(i === "bar" || i === "line" || i === "area") && (n.chartType = i);
|
|
61
|
-
let a =
|
|
61
|
+
let a = q(e.variant);
|
|
62
62
|
(a === "comparison" || a === "current" || a === "primary") && (n.variant = a);
|
|
63
|
-
let o =
|
|
63
|
+
let o = J(e.opacity);
|
|
64
64
|
o !== void 0 && (n.opacity = o);
|
|
65
|
-
let s =
|
|
65
|
+
let s = q(e.dashArray);
|
|
66
66
|
s && (n.dashArray = s);
|
|
67
|
-
let c =
|
|
67
|
+
let c = q(e.stack);
|
|
68
68
|
c && (n.stack = c);
|
|
69
|
-
let l =
|
|
69
|
+
let l = q(e.yAxis);
|
|
70
70
|
(l === "left" || l === "right") && (n.yAxis = l);
|
|
71
|
-
let u =
|
|
71
|
+
let u = q(e.color);
|
|
72
72
|
return u && (n.color = u), n;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
if (!
|
|
76
|
-
let t = {}, n =
|
|
77
|
-
r &&
|
|
78
|
-
let i = e.xAxis, a =
|
|
74
|
+
function We(e) {
|
|
75
|
+
if (!K(e)) return {};
|
|
76
|
+
let t = {}, n = q(e.type), r = q(e.chartType) ?? q(e.specType) ?? (n && Qe.has(n) ? n : void 0);
|
|
77
|
+
r && Ye.has(r) && (t.chartType = r);
|
|
78
|
+
let i = e.xAxis, a = W(i);
|
|
79
79
|
a && (a.format || a.title || a.showGridLines !== void 0) && (t.xAxis = a);
|
|
80
|
-
let o =
|
|
80
|
+
let o = q(e.xAxisKey) ?? a?.field ?? q(i);
|
|
81
81
|
o && (t.xAxisKey = o);
|
|
82
|
-
let s = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) =>
|
|
82
|
+
let s = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) => W(e) ?? (q(e) ? { field: q(e) } : void 0)).filter((e) => !!e);
|
|
83
83
|
s.length && (t.yAxes = s);
|
|
84
|
-
let c = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map(
|
|
84
|
+
let c = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map(Ue).filter((e) => !!e);
|
|
85
85
|
if (!c?.length) {
|
|
86
86
|
let e = s.filter((e) => e.field).map((e, t) => ({
|
|
87
87
|
dataKey: e.field,
|
|
@@ -91,28 +91,28 @@ function Ve(e) {
|
|
|
91
91
|
e.length && (c = e);
|
|
92
92
|
}
|
|
93
93
|
c?.length && (t.series = c), typeof e.showLegend == "boolean" && (t.showLegend = e.showLegend), typeof e.showDataLabels == "boolean" && (t.showDataLabels = e.showDataLabels);
|
|
94
|
-
let l =
|
|
94
|
+
let l = U(e.title);
|
|
95
95
|
l && (t.title = l);
|
|
96
|
-
let u =
|
|
96
|
+
let u = U(e.subtitle);
|
|
97
97
|
u && (t.subtitle = u);
|
|
98
|
-
let d =
|
|
98
|
+
let d = U(e.description);
|
|
99
99
|
d && (t.description = d);
|
|
100
|
-
let f =
|
|
101
|
-
return f !== void 0 && f > 0 && (t.height = f), Array.isArray(e.annotations) && e.annotations.length && (t.annotations = e.annotations.filter(
|
|
100
|
+
let f = J(e.height);
|
|
101
|
+
return f !== void 0 && f > 0 && (t.height = f), Array.isArray(e.annotations) && e.annotations.length && (t.annotations = e.annotations.filter(K)), K(e.interaction) && (t.interaction = e.interaction), t;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function Ge(e) {
|
|
104
104
|
if (e === "bar" || e === "column") return "bar";
|
|
105
105
|
if (e === "line") return "line";
|
|
106
106
|
if (e === "area") return "area";
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Ke(e, t) {
|
|
109
109
|
if (e === "combo") return "combo";
|
|
110
|
-
let n =
|
|
110
|
+
let n = Ge(e);
|
|
111
111
|
if (!n || !t || t.length < 2) return e;
|
|
112
112
|
let r = t.map((e) => e.chartType ?? n);
|
|
113
113
|
return new Set(r).size > 1 ? "combo" : e;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function G(e) {
|
|
116
116
|
if (!e) return;
|
|
117
117
|
let t = e.includes("%"), n = /^([$£€¥₹])/.exec(e), r = e.includes(","), i = /\.(0+)/.exec(e)?.[1].length ?? 0, a = {
|
|
118
118
|
$: "USD",
|
|
@@ -137,24 +137,24 @@ function We(e) {
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function qe(e, t) {
|
|
141
141
|
let n = e?.stepSize;
|
|
142
142
|
if (!n || n <= 0) return;
|
|
143
143
|
let r = t.filter((e) => Number.isFinite(e)), i = r.length ? Math.min(...r) : void 0, a = r.length ? Math.max(...r) : void 0, o = e.min ?? Math.min(0, i ?? 0), s = e.max ?? a;
|
|
144
144
|
if (s === void 0 || !Number.isFinite(o) || !Number.isFinite(s) || s < o) return;
|
|
145
145
|
let c = Math.floor(o / n) * n, l = e.max === void 0 ? Math.ceil(s / n) * n : e.max, u = Math.floor((l - c) / n + 1e-9) + 1;
|
|
146
|
-
if (u < 1 || u >
|
|
146
|
+
if (u < 1 || u > Y) return;
|
|
147
147
|
let d = [];
|
|
148
148
|
for (let e = 0; e < u; e++) d.push(Number((c + e * n).toPrecision(12)));
|
|
149
149
|
return e.max !== void 0 && d[d.length - 1] < e.max && d.push(e.max), d;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function Je(e) {
|
|
152
152
|
if (!e) return;
|
|
153
153
|
let { min: t, max: n } = e;
|
|
154
|
-
if (
|
|
154
|
+
if (t !== void 0 || n !== void 0) return [t ?? "auto", n ?? "auto"];
|
|
155
155
|
}
|
|
156
|
-
var
|
|
157
|
-
|
|
156
|
+
var Ye, Xe, Ze, Qe, K, q, J, Y, $e = V((() => {
|
|
157
|
+
Ye = /* @__PURE__ */ new Set([
|
|
158
158
|
"bar",
|
|
159
159
|
"column",
|
|
160
160
|
"horizontal-bar",
|
|
@@ -168,23 +168,23 @@ var qe, Je, Ye, Xe, W, G, K, Ze, Qe = z((() => {
|
|
|
168
168
|
"treemap",
|
|
169
169
|
"sankey",
|
|
170
170
|
"combo"
|
|
171
|
-
]),
|
|
171
|
+
]), Xe = /* @__PURE__ */ new Set([
|
|
172
172
|
"gauge",
|
|
173
173
|
"solid-gauge",
|
|
174
174
|
"metric",
|
|
175
175
|
"kpi",
|
|
176
176
|
"bullet"
|
|
177
|
-
]),
|
|
178
|
-
...
|
|
179
|
-
...
|
|
180
|
-
...
|
|
181
|
-
]),
|
|
182
|
-
})),
|
|
183
|
-
function
|
|
177
|
+
]), Ze = /* @__PURE__ */ new Set(["table", "pivot"]), Qe = /* @__PURE__ */ new Set([
|
|
178
|
+
...Ye,
|
|
179
|
+
...Xe,
|
|
180
|
+
...Ze
|
|
181
|
+
]), K = (e) => !!e && typeof e == "object" && !Array.isArray(e), q = (e) => typeof e == "string" && e ? e : void 0, J = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, Y = 200;
|
|
182
|
+
})), et = /* @__PURE__ */ H({ default: () => rt });
|
|
183
|
+
function tt(e, t = 14) {
|
|
184
184
|
return e.length > t ? `${e.slice(0, t - 1)}…` : e;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
let r = String(n?.value ?? ""), i =
|
|
186
|
+
function nt({ x: e, y: t, payload: n }) {
|
|
187
|
+
let r = String(n?.value ?? ""), i = tt(r);
|
|
188
188
|
return /* @__PURE__ */ E("g", {
|
|
189
189
|
transform: `translate(${e},${t})`,
|
|
190
190
|
children: /* @__PURE__ */ D("text", {
|
|
@@ -198,14 +198,14 @@ function q({ x: e, y: t, payload: n }) {
|
|
|
198
198
|
})
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
|
|
202
202
|
let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
|
|
203
203
|
return /* @__PURE__ */ E("div", {
|
|
204
204
|
className: `p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,
|
|
205
|
-
children: /* @__PURE__ */ E(
|
|
205
|
+
children: /* @__PURE__ */ E(Me, {
|
|
206
206
|
width: "100%",
|
|
207
207
|
height: r,
|
|
208
|
-
children: /* @__PURE__ */ D(
|
|
208
|
+
children: /* @__PURE__ */ D(k, {
|
|
209
209
|
data: e,
|
|
210
210
|
margin: {
|
|
211
211
|
top: 10,
|
|
@@ -266,14 +266,14 @@ function tt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
266
266
|
/* @__PURE__ */ D("feMerge", { children: [/* @__PURE__ */ E("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ E("feMergeNode", { in: "SourceGraphic" })] })
|
|
267
267
|
]
|
|
268
268
|
})] }),
|
|
269
|
-
/* @__PURE__ */ E(
|
|
269
|
+
/* @__PURE__ */ E(ge, {
|
|
270
270
|
strokeDasharray: "3 3",
|
|
271
271
|
stroke: "hsl(var(--border))",
|
|
272
272
|
vertical: !1
|
|
273
273
|
}),
|
|
274
|
-
/* @__PURE__ */ E(
|
|
274
|
+
/* @__PURE__ */ E(P, {
|
|
275
275
|
dataKey: n,
|
|
276
|
-
tick: s ? /* @__PURE__ */ E(
|
|
276
|
+
tick: s ? /* @__PURE__ */ E(nt, {}) : {
|
|
277
277
|
fill: "hsl(var(--muted-foreground))",
|
|
278
278
|
fontSize: 12,
|
|
279
279
|
fontFamily: "monospace"
|
|
@@ -284,7 +284,7 @@ function tt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
284
284
|
height: s ? 56 : void 0,
|
|
285
285
|
dy: s ? void 0 : 10
|
|
286
286
|
}),
|
|
287
|
-
/* @__PURE__ */ E(
|
|
287
|
+
/* @__PURE__ */ E(F, {
|
|
288
288
|
tick: {
|
|
289
289
|
fill: "hsl(var(--muted-foreground))",
|
|
290
290
|
fontSize: 12,
|
|
@@ -293,7 +293,7 @@ function tt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
293
293
|
tickLine: !1,
|
|
294
294
|
axisLine: !1
|
|
295
295
|
}),
|
|
296
|
-
/* @__PURE__ */ E(
|
|
296
|
+
/* @__PURE__ */ E(M, {
|
|
297
297
|
cursor: {
|
|
298
298
|
fill: "hsl(var(--muted))",
|
|
299
299
|
opacity: .2
|
|
@@ -308,11 +308,11 @@ function tt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
308
308
|
},
|
|
309
309
|
itemStyle: { color: "hsl(var(--primary))" }
|
|
310
310
|
}),
|
|
311
|
-
/* @__PURE__ */ E(
|
|
311
|
+
/* @__PURE__ */ E(j, { wrapperStyle: {
|
|
312
312
|
paddingTop: "20px",
|
|
313
313
|
fontFamily: "monospace"
|
|
314
314
|
} }),
|
|
315
|
-
/* @__PURE__ */ E(
|
|
315
|
+
/* @__PURE__ */ E(me, {
|
|
316
316
|
dataKey: t,
|
|
317
317
|
fill: "url(#barGradient)",
|
|
318
318
|
radius: [
|
|
@@ -329,63 +329,65 @@ function tt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
329
329
|
})
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
|
-
var
|
|
332
|
+
var it = V((() => {}));
|
|
333
333
|
//#endregion
|
|
334
334
|
//#region src/ChartContainerImpl.tsx
|
|
335
|
-
function
|
|
336
|
-
let e =
|
|
335
|
+
function at() {
|
|
336
|
+
let e = h.useContext(ut);
|
|
337
337
|
if (!e) throw Error("useChart must be used within a <ChartContainer />");
|
|
338
338
|
return e;
|
|
339
339
|
}
|
|
340
|
-
function
|
|
341
|
-
let
|
|
342
|
-
|
|
340
|
+
function X({ id: e, className: t, children: n, config: r, disableSettleRemount: i, style: a, ...o }) {
|
|
341
|
+
let s = h.useId(), c = `chart-${e || s.replace(/:/g, "")}`, l = h.useRef(null), [u, d] = h.useState(0);
|
|
342
|
+
h.useEffect(() => {
|
|
343
343
|
if (i) return;
|
|
344
|
-
let e =
|
|
344
|
+
let e = l.current;
|
|
345
345
|
if (e == null || typeof ResizeObserver > "u") return;
|
|
346
346
|
let t = !1, n, r = new ResizeObserver((e) => {
|
|
347
347
|
if (t) return;
|
|
348
348
|
let i = e[0]?.contentRect;
|
|
349
349
|
i == null || i.width <= 0 || i.height <= 0 || (n != null && clearTimeout(n), n = setTimeout(() => {
|
|
350
|
-
t = !0, r.disconnect(),
|
|
350
|
+
t = !0, r.disconnect(), d((e) => e + 1);
|
|
351
351
|
}, 80));
|
|
352
352
|
});
|
|
353
353
|
return r.observe(e), () => {
|
|
354
354
|
t = !0, n != null && clearTimeout(n), r.disconnect();
|
|
355
355
|
};
|
|
356
|
-
}, [i])
|
|
356
|
+
}, [i]);
|
|
357
|
+
let f = a?.height != null || a?.minHeight != null, p = a?.width != null || a?.minWidth != null, ee = {
|
|
358
|
+
...f ? {} : { minHeight: 280 },
|
|
359
|
+
...p ? {} : { minWidth: 0 },
|
|
360
|
+
...a
|
|
361
|
+
};
|
|
362
|
+
return /* @__PURE__ */ E(ut.Provider, {
|
|
357
363
|
value: { config: r },
|
|
358
364
|
children: /* @__PURE__ */ D("div", {
|
|
359
|
-
ref:
|
|
365
|
+
ref: l,
|
|
360
366
|
"data-slot": "chart",
|
|
361
|
-
"data-chart":
|
|
362
|
-
className:
|
|
363
|
-
style:
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
},
|
|
368
|
-
...a,
|
|
369
|
-
children: [/* @__PURE__ */ E(ct, {
|
|
370
|
-
id: s,
|
|
367
|
+
"data-chart": c,
|
|
368
|
+
className: Z("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
|
|
369
|
+
style: ee,
|
|
370
|
+
...o,
|
|
371
|
+
children: [/* @__PURE__ */ E(dt, {
|
|
372
|
+
id: c,
|
|
371
373
|
config: r
|
|
372
|
-
}), /* @__PURE__ */ E(
|
|
374
|
+
}), /* @__PURE__ */ E(Me, {
|
|
373
375
|
width: "100%",
|
|
374
376
|
height: "100%",
|
|
375
377
|
children: n
|
|
376
|
-
},
|
|
378
|
+
}, u)]
|
|
377
379
|
})
|
|
378
380
|
});
|
|
379
381
|
}
|
|
380
|
-
function
|
|
381
|
-
let { config: p } =
|
|
382
|
+
function ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: f }) {
|
|
383
|
+
let { config: p } = at(), ee = h.useMemo(() => {
|
|
382
384
|
if (i || !t?.length) return null;
|
|
383
|
-
let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r =
|
|
385
|
+
let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = ct(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
|
|
384
386
|
return s ? /* @__PURE__ */ E("div", {
|
|
385
|
-
className:
|
|
387
|
+
className: Z("font-medium", c),
|
|
386
388
|
children: s(a, t)
|
|
387
389
|
}) : a ? /* @__PURE__ */ E("div", {
|
|
388
|
-
className:
|
|
390
|
+
className: Z("font-medium", c),
|
|
389
391
|
children: a
|
|
390
392
|
}) : null;
|
|
391
393
|
}, [
|
|
@@ -398,26 +400,26 @@ function it({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
|
|
|
398
400
|
f
|
|
399
401
|
]);
|
|
400
402
|
if (!e || !t?.length) return null;
|
|
401
|
-
let
|
|
403
|
+
let m = t.length === 1 && r !== "dot";
|
|
402
404
|
return /* @__PURE__ */ D("div", {
|
|
403
|
-
className:
|
|
404
|
-
children: [
|
|
405
|
+
className: Z("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
|
|
406
|
+
children: [m ? null : ee, /* @__PURE__ */ E("div", {
|
|
405
407
|
className: "grid gap-1.5",
|
|
406
408
|
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
407
|
-
let n = `${d || e.name || e.dataKey || "value"}`, i =
|
|
409
|
+
let n = `${d || e.name || e.dataKey || "value"}`, i = ct(p, e, n), o = u || e.payload.fill || e.color;
|
|
408
410
|
return /* @__PURE__ */ E("div", {
|
|
409
|
-
className:
|
|
411
|
+
className: Z("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" ? "items-center" : ""),
|
|
410
412
|
children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ D(T, { children: [i?.icon ? /* @__PURE__ */ E(i.icon, {}) : !a && /* @__PURE__ */ E("div", {
|
|
411
|
-
className:
|
|
413
|
+
className: Z("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", m && r === "dashed" ? "my-0.5" : ""),
|
|
412
414
|
style: {
|
|
413
415
|
"--color-bg": o,
|
|
414
416
|
"--color-border": o
|
|
415
417
|
}
|
|
416
418
|
}), /* @__PURE__ */ D("div", {
|
|
417
|
-
className:
|
|
419
|
+
className: Z("flex flex-1 justify-between leading-none", m ? "items-end" : "items-center"),
|
|
418
420
|
children: [/* @__PURE__ */ D("div", {
|
|
419
421
|
className: "grid gap-1.5",
|
|
420
|
-
children: [
|
|
422
|
+
children: [m ? ee : null, /* @__PURE__ */ E("span", {
|
|
421
423
|
className: "text-muted-foreground",
|
|
422
424
|
children: i?.label || e.name
|
|
423
425
|
})]
|
|
@@ -431,14 +433,14 @@ function it({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
|
|
|
431
433
|
})]
|
|
432
434
|
});
|
|
433
435
|
}
|
|
434
|
-
function
|
|
435
|
-
let { config: a } =
|
|
436
|
+
function st({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
|
|
437
|
+
let { config: a } = at();
|
|
436
438
|
return n?.length ? /* @__PURE__ */ E("div", {
|
|
437
|
-
className:
|
|
439
|
+
className: Z("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
438
440
|
children: n.filter((e) => e.type !== "none").map((e) => {
|
|
439
|
-
let n = `${i || e.dataKey || "value"}`, r =
|
|
441
|
+
let n = `${i || e.dataKey || "value"}`, r = ct(a, e, n);
|
|
440
442
|
return /* @__PURE__ */ D("div", {
|
|
441
|
-
className:
|
|
443
|
+
className: Z("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
442
444
|
children: [r?.icon && !t ? /* @__PURE__ */ E(r.icon, {}) : /* @__PURE__ */ E("div", {
|
|
443
445
|
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
444
446
|
style: { backgroundColor: e.color }
|
|
@@ -447,18 +449,18 @@ function at({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bo
|
|
|
447
449
|
})
|
|
448
450
|
}) : null;
|
|
449
451
|
}
|
|
450
|
-
function
|
|
452
|
+
function ct(e, t, n) {
|
|
451
453
|
if (typeof t != "object" || !t) return;
|
|
452
454
|
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
453
455
|
return r && n in r && typeof r[n] == "string" ? i = r[n] : n in t && typeof t[n] == "string" && (i = t[n]), i in e ? e[i] : e[n];
|
|
454
456
|
}
|
|
455
|
-
var
|
|
456
|
-
|
|
457
|
+
var Z, lt, ut, dt, ft, pt, mt = V((() => {
|
|
458
|
+
Z = (...e) => e.filter(Boolean).join(" "), lt = {
|
|
457
459
|
light: "",
|
|
458
460
|
dark: ".dark"
|
|
459
|
-
},
|
|
461
|
+
}, ut = h.createContext(null), dt = ({ id: e, config: t }) => {
|
|
460
462
|
let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
461
|
-
return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(
|
|
463
|
+
return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(lt).map(([t, r]) => `
|
|
462
464
|
${r} [data-chart=${e}] {
|
|
463
465
|
${n.map(([e, n]) => {
|
|
464
466
|
let r = n.theme?.[t] || n.color;
|
|
@@ -466,46 +468,46 @@ ${n.map(([e, n]) => {
|
|
|
466
468
|
}).join("\n")}
|
|
467
469
|
}
|
|
468
470
|
`).join("\n") } }) : null;
|
|
469
|
-
},
|
|
471
|
+
}, ft = M, pt = j;
|
|
470
472
|
}));
|
|
471
473
|
//#endregion
|
|
472
474
|
//#region src/chartDrillEvents.ts
|
|
473
|
-
function
|
|
475
|
+
function ht(e) {
|
|
474
476
|
return e?.[0]?.dataKey || "value";
|
|
475
477
|
}
|
|
476
|
-
function
|
|
478
|
+
function gt(e, t, n) {
|
|
477
479
|
if (!e) return null;
|
|
478
480
|
let r = e.payload ?? e, i = r?.[t];
|
|
479
481
|
if (i == null) return null;
|
|
480
|
-
let a =
|
|
482
|
+
let a = ht(n);
|
|
481
483
|
return {
|
|
482
484
|
category: String(i),
|
|
483
485
|
series: a,
|
|
484
486
|
value: typeof r?.[a] == "number" ? r[a] : void 0
|
|
485
487
|
};
|
|
486
488
|
}
|
|
487
|
-
function
|
|
489
|
+
function _t(e, t) {
|
|
488
490
|
if (!e) return null;
|
|
489
491
|
let n = e.name ?? e.payload?.name ?? e.root?.name;
|
|
490
492
|
if (n == null) return null;
|
|
491
493
|
let r = e.value ?? e.size ?? e.payload?.size;
|
|
492
494
|
return {
|
|
493
495
|
category: String(n),
|
|
494
|
-
series:
|
|
496
|
+
series: ht(t),
|
|
495
497
|
value: typeof r == "number" ? r : void 0
|
|
496
498
|
};
|
|
497
499
|
}
|
|
498
|
-
function
|
|
500
|
+
function vt(e, t) {
|
|
499
501
|
if (!e) return null;
|
|
500
502
|
let n = e.payload ?? e, r = n?.name;
|
|
501
503
|
return r == null || n?.depth === 0 ? null : {
|
|
502
504
|
category: String(r),
|
|
503
|
-
series:
|
|
505
|
+
series: ht(t),
|
|
504
506
|
value: typeof n?.value == "number" ? n.value : void 0
|
|
505
507
|
};
|
|
506
508
|
}
|
|
507
|
-
var
|
|
508
|
-
function
|
|
509
|
+
var yt = V((() => {})), bt = /* @__PURE__ */ H({ default: () => Tt });
|
|
510
|
+
function xt(e) {
|
|
509
511
|
let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
|
|
510
512
|
return r <= 0 || i <= 0 ? null : /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("rect", {
|
|
511
513
|
x: t,
|
|
@@ -524,7 +526,7 @@ function _t(e) {
|
|
|
524
526
|
children: a
|
|
525
527
|
}) : null] });
|
|
526
528
|
}
|
|
527
|
-
function
|
|
529
|
+
function St({ title: e, subtitle: t, children: n }) {
|
|
528
530
|
return !e && !t ? /* @__PURE__ */ E(T, { children: n }) : /* @__PURE__ */ D("div", {
|
|
529
531
|
className: "flex h-full w-full flex-col",
|
|
530
532
|
children: [/* @__PURE__ */ D("div", {
|
|
@@ -542,15 +544,15 @@ function vt({ title: e, subtitle: t, children: n }) {
|
|
|
542
544
|
})]
|
|
543
545
|
});
|
|
544
546
|
}
|
|
545
|
-
function
|
|
546
|
-
let
|
|
547
|
+
function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i = "name", series: a = [], className: o = "", colors: s, categoryColors: c, categoryOrder: l, onChartClick: u, isAnimationActive: d, xAxis: f, yAxes: p, showLegend: ee, showDataLabels: m, title: te, subtitle: g, description: _, height: ne, annotations: re, interaction: ie }) {
|
|
548
|
+
let v = e === "column" ? "bar" : e, y = Ke(v, a), b = Ge(v), x = Array.isArray(n) ? n : [], S = d === !1 ? { isAnimationActive: !1 } : {}, C = {
|
|
547
549
|
...d === !1 ? { disableSettleRemount: !0 } : {},
|
|
548
|
-
...
|
|
549
|
-
...
|
|
550
|
+
...ne ? { style: { height: ne } } : {},
|
|
551
|
+
..._ ? {
|
|
550
552
|
role: "img",
|
|
551
|
-
"aria-label":
|
|
553
|
+
"aria-label": _
|
|
552
554
|
} : {}
|
|
553
|
-
}, [
|
|
555
|
+
}, [w, ae] = h.useState(!1), oe = h.useCallback((e) => {
|
|
554
556
|
if (!u || !e) return;
|
|
555
557
|
let t = Array.isArray(e.activePayload) ? e.activePayload[0] : void 0;
|
|
556
558
|
u({
|
|
@@ -558,7 +560,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
558
560
|
series: t?.dataKey ? String(t.dataKey) : void 0,
|
|
559
561
|
value: typeof t?.value == "number" ? t.value : void 0
|
|
560
562
|
});
|
|
561
|
-
}, [u]),
|
|
563
|
+
}, [u]), se = h.useCallback((e) => {
|
|
562
564
|
if (!u || !e) return;
|
|
563
565
|
let t = e.payload?.[i], n = a[0]?.dataKey || "value";
|
|
564
566
|
u({
|
|
@@ -570,56 +572,56 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
570
572
|
u,
|
|
571
573
|
i,
|
|
572
574
|
a
|
|
573
|
-
]),
|
|
574
|
-
onClick:
|
|
575
|
+
]), ce = u ? {
|
|
576
|
+
onClick: oe,
|
|
575
577
|
style: { cursor: "pointer" }
|
|
576
|
-
} : {},
|
|
577
|
-
onClick:
|
|
578
|
+
} : {}, le = u ? {
|
|
579
|
+
onClick: se,
|
|
578
580
|
style: { cursor: "pointer" }
|
|
579
|
-
} : {},
|
|
581
|
+
} : {}, ue = h.useCallback((e, t, n) => c && c[e == null ? "" : String(e)] || n[t % n.length], [c]), de = h.useCallback((e) => {
|
|
580
582
|
if (!u) return;
|
|
581
|
-
let t =
|
|
583
|
+
let t = gt(e, i, a);
|
|
582
584
|
t && u(t);
|
|
583
585
|
}, [
|
|
584
586
|
u,
|
|
585
587
|
i,
|
|
586
588
|
a
|
|
587
|
-
]),
|
|
589
|
+
]), fe = h.useCallback((e) => {
|
|
588
590
|
if (!u) return;
|
|
589
|
-
let t =
|
|
591
|
+
let t = _t(e, a);
|
|
590
592
|
t && u(t);
|
|
591
|
-
}, [u, a]),
|
|
593
|
+
}, [u, a]), j = h.useCallback((e) => {
|
|
592
594
|
if (!u) return;
|
|
593
|
-
let t =
|
|
595
|
+
let t = vt(e, a);
|
|
594
596
|
t && u(t);
|
|
595
|
-
}, [u, a]),
|
|
596
|
-
onClick:
|
|
597
|
+
}, [u, a]), Me = u ? {
|
|
598
|
+
onClick: de,
|
|
597
599
|
cursor: "pointer"
|
|
598
|
-
} : {}, Ie = u ? {
|
|
599
|
-
onClick: Ne,
|
|
600
|
-
style: { cursor: "pointer" }
|
|
601
600
|
} : {}, Le = u ? {
|
|
602
|
-
onClick:
|
|
601
|
+
onClick: fe,
|
|
602
|
+
style: { cursor: "pointer" }
|
|
603
|
+
} : {}, Re = u ? {
|
|
604
|
+
onClick: j,
|
|
603
605
|
style: { cursor: "pointer" }
|
|
604
606
|
} : {};
|
|
605
|
-
|
|
606
|
-
let e = () =>
|
|
607
|
+
h.useEffect(() => {
|
|
608
|
+
let e = () => ae(window.innerWidth < 640);
|
|
607
609
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
608
610
|
}, []);
|
|
609
|
-
let
|
|
610
|
-
bar:
|
|
611
|
-
"horizontal-bar":
|
|
612
|
-
line:
|
|
613
|
-
area:
|
|
614
|
-
pie:
|
|
615
|
-
donut:
|
|
616
|
-
radar:
|
|
617
|
-
scatter:
|
|
618
|
-
funnel:
|
|
619
|
-
combo:
|
|
620
|
-
treemap:
|
|
621
|
-
sankey:
|
|
622
|
-
}[y] ||
|
|
611
|
+
let ze = {
|
|
612
|
+
bar: k,
|
|
613
|
+
"horizontal-bar": k,
|
|
614
|
+
line: Se,
|
|
615
|
+
area: pe,
|
|
616
|
+
pie: we,
|
|
617
|
+
donut: we,
|
|
618
|
+
radar: ke,
|
|
619
|
+
scatter: Fe,
|
|
620
|
+
funnel: be,
|
|
621
|
+
combo: ve,
|
|
622
|
+
treemap: k,
|
|
623
|
+
sankey: k
|
|
624
|
+
}[y] || k, Be = h.useCallback((e) => {
|
|
623
625
|
if (e == null || e === "") return "";
|
|
624
626
|
let t = r?.[String(e)]?.label;
|
|
625
627
|
if (t != null) return String(t);
|
|
@@ -627,7 +629,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
627
629
|
if (/^\d{4}-\d{2}-\d{2}/.test(n)) {
|
|
628
630
|
let e = new Date(n);
|
|
629
631
|
if (!Number.isNaN(e.getTime())) {
|
|
630
|
-
let t = (
|
|
632
|
+
let t = (x.length > 1 ? Math.abs(new Date(String(x[x.length - 1][i] ?? "")).getTime() - new Date(String(x[0][i] ?? "")).getTime()) : 0) / 864e5;
|
|
631
633
|
try {
|
|
632
634
|
return t <= 62 ? e.toLocaleDateString(void 0, {
|
|
633
635
|
month: "short",
|
|
@@ -641,19 +643,19 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
641
643
|
}
|
|
642
644
|
}
|
|
643
645
|
}
|
|
644
|
-
return
|
|
646
|
+
return w && n.length > 8 ? n.slice(0, 8) + "…" : n;
|
|
645
647
|
}, [
|
|
646
|
-
|
|
648
|
+
x,
|
|
647
649
|
i,
|
|
648
|
-
|
|
650
|
+
w,
|
|
649
651
|
r
|
|
650
|
-
]),
|
|
652
|
+
]), Ve = h.useMemo(() => x.some((e) => String(e[i] || "").length > 5), [x, i]), I = () => Array.isArray(s) && s.length > 0 ? s : [
|
|
651
653
|
"hsl(var(--chart-1))",
|
|
652
654
|
"hsl(var(--chart-2))",
|
|
653
655
|
"hsl(var(--chart-3))",
|
|
654
656
|
"hsl(var(--chart-4))",
|
|
655
657
|
"hsl(var(--chart-5))"
|
|
656
|
-
],
|
|
658
|
+
], He = h.useCallback((e) => {
|
|
657
659
|
if (e == null || e === "") return "";
|
|
658
660
|
let t = typeof e == "number" ? e : Number(e);
|
|
659
661
|
if (!Number.isFinite(t)) return String(e);
|
|
@@ -665,20 +667,20 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
665
667
|
} catch {
|
|
666
668
|
return String(t);
|
|
667
669
|
}
|
|
668
|
-
}, []),
|
|
669
|
-
let t = a.filter((t) =>
|
|
670
|
-
for (let e of
|
|
670
|
+
}, []), L = p?.[0], R = p && p.length > 1 ? p[1] : L?.position === "right" ? L : void 0, z = !!p && p.length > 1, B = h.useMemo(() => G(f?.format) ?? Be, [f?.format, Be]), V = h.useMemo(() => G(L?.format) ?? He, [L?.format, He]), H = h.useMemo(() => G(R?.format) ?? He, [R?.format, He]), U = h.useCallback((e) => {
|
|
671
|
+
let t = a.filter((t) => z ? (t.yAxis === "right" ? "right" : "left") === e : e === "left").map((e) => e.dataKey), n = [];
|
|
672
|
+
for (let e of x) for (let r of t) {
|
|
671
673
|
let t = Number(e?.[r]);
|
|
672
674
|
Number.isFinite(t) && n.push(t);
|
|
673
675
|
}
|
|
674
676
|
return n;
|
|
675
677
|
}, [
|
|
676
|
-
|
|
678
|
+
x,
|
|
677
679
|
a,
|
|
678
|
-
|
|
679
|
-
]), W =
|
|
680
|
+
z
|
|
681
|
+
]), W = h.useCallback((e, t = "left") => {
|
|
680
682
|
if (!e) return {};
|
|
681
|
-
let n =
|
|
683
|
+
let n = Je(e), r = qe(e, U(t));
|
|
682
684
|
return {
|
|
683
685
|
...r ? { ticks: r } : {},
|
|
684
686
|
...n ? { domain: n } : {},
|
|
@@ -693,10 +695,10 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
693
695
|
position: "insideLeft"
|
|
694
696
|
} } : {}
|
|
695
697
|
};
|
|
696
|
-
}, [
|
|
698
|
+
}, [U]), Ue = L?.showGridLines !== !1, We = {
|
|
697
699
|
vertical: f?.showGridLines === !0,
|
|
698
|
-
horizontal:
|
|
699
|
-
},
|
|
700
|
+
horizontal: Ue
|
|
701
|
+
}, Qe = ee !== !1, K = h.useMemo(() => {
|
|
700
702
|
if (!Array.isArray(re) || re.length === 0) return null;
|
|
701
703
|
let e = {
|
|
702
704
|
solid: void 0,
|
|
@@ -710,63 +712,67 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
710
712
|
fill: i,
|
|
711
713
|
fontSize: 11
|
|
712
714
|
} } : {};
|
|
713
|
-
|
|
714
|
-
|
|
715
|
+
if (t?.type === "region") {
|
|
716
|
+
let e = r ? {
|
|
715
717
|
x1: t.value,
|
|
716
718
|
x2: t.endValue
|
|
717
719
|
} : {
|
|
718
720
|
y1: t.value,
|
|
719
721
|
y2: t.endValue
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
722
|
+
};
|
|
723
|
+
return /* @__PURE__ */ E(Ae, {
|
|
724
|
+
...e,
|
|
725
|
+
...z && !r ? { yAxisId: "left" } : {},
|
|
726
|
+
fill: i,
|
|
727
|
+
fillOpacity: .12,
|
|
728
|
+
stroke: i,
|
|
729
|
+
strokeOpacity: .35,
|
|
730
|
+
...s
|
|
731
|
+
}, `ann-${n}`);
|
|
732
|
+
}
|
|
733
|
+
return /* @__PURE__ */ E(je, {
|
|
728
734
|
...r ? { x: t?.value } : { y: t?.value },
|
|
729
|
-
...
|
|
735
|
+
...z && !r ? { yAxisId: "left" } : {},
|
|
730
736
|
stroke: i,
|
|
731
737
|
strokeDasharray: a,
|
|
732
738
|
...s
|
|
733
739
|
}, `ann-${n}`);
|
|
734
740
|
});
|
|
735
|
-
}, [re,
|
|
741
|
+
}, [re, z]), q = ie?.tooltips !== !1, J = ie?.brush === !0 ? /* @__PURE__ */ E(he, {
|
|
736
742
|
dataKey: i,
|
|
737
743
|
height: 24,
|
|
738
744
|
travellerWidth: 8,
|
|
739
745
|
stroke: "hsl(var(--muted-foreground))"
|
|
740
|
-
}) : null,
|
|
746
|
+
}) : null, Y = (e) => m ? /* @__PURE__ */ E(A, {
|
|
741
747
|
position: "top",
|
|
742
748
|
className: "fill-foreground",
|
|
743
749
|
fontSize: 11,
|
|
744
750
|
...e ? { formatter: e } : {}
|
|
745
|
-
}) : null,
|
|
751
|
+
}) : null, $e = h.useMemo(() => ({
|
|
746
752
|
tickLine: !1,
|
|
747
753
|
tickMargin: 10,
|
|
748
754
|
axisLine: !1,
|
|
749
755
|
interval: "preserveStartEnd",
|
|
750
|
-
minTickGap:
|
|
751
|
-
tickFormatter:
|
|
756
|
+
minTickGap: w ? 32 : 48,
|
|
757
|
+
tickFormatter: B,
|
|
752
758
|
...f?.title ? { label: {
|
|
753
759
|
value: f.title,
|
|
754
760
|
position: "insideBottom",
|
|
755
761
|
offset: -4
|
|
756
762
|
} } : {},
|
|
757
|
-
...!
|
|
763
|
+
...!w && Ve && {
|
|
758
764
|
angle: -35,
|
|
759
765
|
textAnchor: "end",
|
|
760
766
|
height: 60
|
|
761
767
|
}
|
|
762
768
|
}), [
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
769
|
+
w,
|
|
770
|
+
Ve,
|
|
771
|
+
B,
|
|
766
772
|
f?.title
|
|
767
773
|
]);
|
|
768
|
-
if (y &&
|
|
769
|
-
let e = a[0]?.dataKey || "value", t =
|
|
774
|
+
if (y && Xe.has(y)) {
|
|
775
|
+
let e = a[0]?.dataKey || "value", t = x[0]?.[e], n = typeof t == "number" ? t : Number(t), i = a[0]?.label ?? r?.[e]?.label ?? e;
|
|
770
776
|
return /* @__PURE__ */ E("div", {
|
|
771
777
|
className: o,
|
|
772
778
|
"data-testid": "advanced-chart-single-value",
|
|
@@ -782,7 +788,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
782
788
|
})
|
|
783
789
|
});
|
|
784
790
|
}
|
|
785
|
-
if (y &&
|
|
791
|
+
if (y && Ze.has(y)) return /* @__PURE__ */ D("div", {
|
|
786
792
|
className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
|
|
787
793
|
"data-testid": "advanced-chart-tabular-notice",
|
|
788
794
|
role: "note",
|
|
@@ -792,7 +798,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
792
798
|
"” is tabular — render it with the data-table / pivot components; a chart block draws series charts."
|
|
793
799
|
]
|
|
794
800
|
});
|
|
795
|
-
if (y && !
|
|
801
|
+
if (y && !Ye.has(y)) return /* @__PURE__ */ D("div", {
|
|
796
802
|
className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
|
|
797
803
|
"data-testid": "advanced-chart-unknown-type",
|
|
798
804
|
role: "note",
|
|
@@ -803,46 +809,46 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
803
809
|
]
|
|
804
810
|
});
|
|
805
811
|
if (y === "pie" || y === "donut") {
|
|
806
|
-
let e = y === "donut" ? "52%" : 0, t =
|
|
807
|
-
return
|
|
812
|
+
let e = y === "donut" ? "52%" : 0, t = I(), n = { ...r };
|
|
813
|
+
return x.forEach((e, r) => {
|
|
808
814
|
let a = e?.[i];
|
|
809
815
|
if (a == null || a === "") return;
|
|
810
816
|
let o = String(a);
|
|
811
817
|
n[o] || (n[o] = {
|
|
812
818
|
label: o,
|
|
813
|
-
color:
|
|
819
|
+
color: ue(a, r, t)
|
|
814
820
|
});
|
|
815
|
-
}), /* @__PURE__ */ E(
|
|
821
|
+
}), /* @__PURE__ */ E(X, {
|
|
816
822
|
config: n,
|
|
817
823
|
className: o,
|
|
818
|
-
...
|
|
819
|
-
children: /* @__PURE__ */ D(
|
|
820
|
-
/* @__PURE__ */ E(
|
|
824
|
+
...C,
|
|
825
|
+
children: /* @__PURE__ */ D(we, { children: [
|
|
826
|
+
/* @__PURE__ */ E(ft, {
|
|
821
827
|
cursor: !1,
|
|
822
|
-
content: /* @__PURE__ */ E(
|
|
828
|
+
content: /* @__PURE__ */ E(ot, { hideLabel: !0 })
|
|
823
829
|
}),
|
|
824
|
-
/* @__PURE__ */ E(
|
|
825
|
-
data:
|
|
830
|
+
/* @__PURE__ */ E(Ce, {
|
|
831
|
+
data: x,
|
|
826
832
|
dataKey: a[0]?.dataKey || "value",
|
|
827
833
|
nameKey: i || "name",
|
|
828
834
|
innerRadius: e,
|
|
829
835
|
strokeWidth: 5,
|
|
830
836
|
paddingAngle: 2,
|
|
831
837
|
outerRadius: "85%",
|
|
832
|
-
...
|
|
833
|
-
...
|
|
834
|
-
children:
|
|
835
|
-
let r =
|
|
836
|
-
return /* @__PURE__ */ E(
|
|
838
|
+
...S,
|
|
839
|
+
...le,
|
|
840
|
+
children: x.map((e, n) => {
|
|
841
|
+
let r = ue(e?.[i], n, t);
|
|
842
|
+
return /* @__PURE__ */ E(_e, { fill: Q(r) }, `cell-${n}`);
|
|
837
843
|
})
|
|
838
844
|
}),
|
|
839
|
-
|
|
845
|
+
Qe ? /* @__PURE__ */ E(pt, {
|
|
840
846
|
verticalAlign: "bottom",
|
|
841
847
|
wrapperStyle: {
|
|
842
|
-
fontSize:
|
|
848
|
+
fontSize: w ? "11px" : "12px",
|
|
843
849
|
paddingTop: "8px"
|
|
844
850
|
},
|
|
845
|
-
content: /* @__PURE__ */ E(
|
|
851
|
+
content: /* @__PURE__ */ E(st, {
|
|
846
852
|
nameKey: i,
|
|
847
853
|
className: "flex-wrap"
|
|
848
854
|
})
|
|
@@ -851,7 +857,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
851
857
|
});
|
|
852
858
|
}
|
|
853
859
|
if (y === "funnel") {
|
|
854
|
-
let e = a[0]?.dataKey || "value", n =
|
|
860
|
+
let e = a[0]?.dataKey || "value", n = I(), s = u ? (t) => {
|
|
855
861
|
t && u({
|
|
856
862
|
category: t?.payload?.[i] ?? t?.[i],
|
|
857
863
|
value: t?.payload?.[e] ?? t?.[e]
|
|
@@ -859,61 +865,61 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
859
865
|
} : void 0, c = s ? {
|
|
860
866
|
onClick: s,
|
|
861
867
|
style: { cursor: "pointer" }
|
|
862
|
-
} : {}, d = t(l), f = d ? [...
|
|
868
|
+
} : {}, d = t(l), f = d ? [...x].sort((e, t) => (d.get(String(e?.[i] ?? "")) ?? 2 ** 53 - 1) - (d.get(String(t?.[i] ?? "")) ?? 2 ** 53 - 1)) : [...x].sort((t, n) => {
|
|
863
869
|
let r = Number(t?.[e] ?? 0);
|
|
864
870
|
return Number(n?.[e] ?? 0) - r;
|
|
865
871
|
});
|
|
866
|
-
return /* @__PURE__ */ E(
|
|
872
|
+
return /* @__PURE__ */ E(X, {
|
|
867
873
|
config: r,
|
|
868
874
|
className: o,
|
|
869
|
-
...
|
|
870
|
-
children: /* @__PURE__ */ D(
|
|
875
|
+
...C,
|
|
876
|
+
children: /* @__PURE__ */ D(be, { children: [/* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }), /* @__PURE__ */ D(ye, {
|
|
871
877
|
dataKey: e,
|
|
872
878
|
data: f,
|
|
873
879
|
nameKey: i,
|
|
874
|
-
...
|
|
880
|
+
...S,
|
|
875
881
|
...c,
|
|
876
|
-
children: [/* @__PURE__ */ E(
|
|
882
|
+
children: [/* @__PURE__ */ E(A, {
|
|
877
883
|
position: "right",
|
|
878
884
|
fill: "hsl(var(--foreground))",
|
|
879
885
|
stroke: "none",
|
|
880
886
|
dataKey: i
|
|
881
|
-
}), f.map((e, t) => /* @__PURE__ */ E(
|
|
887
|
+
}), f.map((e, t) => /* @__PURE__ */ E(_e, { fill: Q(n[t % n.length]) }, `funnel-cell-${t}`))]
|
|
882
888
|
})] })
|
|
883
889
|
});
|
|
884
890
|
}
|
|
885
891
|
if (y === "treemap") {
|
|
886
|
-
let e = a[0]?.dataKey || "value", t =
|
|
892
|
+
let e = a[0]?.dataKey || "value", t = I(), n = x.map((n, r) => ({
|
|
887
893
|
name: String(n?.[i] ?? ""),
|
|
888
894
|
size: Number(n?.[e]) || 0,
|
|
889
895
|
fill: Q(t[r % t.length])
|
|
890
896
|
}));
|
|
891
|
-
return /* @__PURE__ */ E(
|
|
897
|
+
return /* @__PURE__ */ E(X, {
|
|
892
898
|
config: r,
|
|
893
899
|
className: o,
|
|
894
|
-
...
|
|
895
|
-
children: /* @__PURE__ */ E(
|
|
900
|
+
...C,
|
|
901
|
+
children: /* @__PURE__ */ E(N, {
|
|
896
902
|
data: n,
|
|
897
903
|
dataKey: "size",
|
|
898
904
|
nameKey: "name",
|
|
899
|
-
...
|
|
900
|
-
content: /* @__PURE__ */ E(
|
|
901
|
-
...
|
|
902
|
-
children: /* @__PURE__ */ E(
|
|
905
|
+
...S,
|
|
906
|
+
content: /* @__PURE__ */ E(xt, {}),
|
|
907
|
+
...Le,
|
|
908
|
+
children: /* @__PURE__ */ E(M, {})
|
|
903
909
|
})
|
|
904
910
|
});
|
|
905
911
|
}
|
|
906
912
|
if (y === "sankey") {
|
|
907
|
-
let e = a[0]?.dataKey || "value", t = a[0]?.label || e, n =
|
|
913
|
+
let e = a[0]?.dataKey || "value", t = a[0]?.label || e, n = x.filter((t) => (Number(t?.[e]) || 0) > 0), s = [{ name: t }, ...n.map((e) => ({ name: String(e?.[i] ?? "") }))], c = n.map((t, n) => ({
|
|
908
914
|
source: 0,
|
|
909
915
|
target: n + 1,
|
|
910
916
|
value: Number(t?.[e]) || 0
|
|
911
917
|
}));
|
|
912
|
-
return c.length === 0 ? /* @__PURE__ */ E("div", { className: o }) : /* @__PURE__ */ E(
|
|
918
|
+
return c.length === 0 ? /* @__PURE__ */ E("div", { className: o }) : /* @__PURE__ */ E(X, {
|
|
913
919
|
config: r,
|
|
914
920
|
className: o,
|
|
915
|
-
...
|
|
916
|
-
children: /* @__PURE__ */ E(
|
|
921
|
+
...C,
|
|
922
|
+
children: /* @__PURE__ */ E(Ne, {
|
|
917
923
|
data: {
|
|
918
924
|
nodes: s,
|
|
919
925
|
links: c
|
|
@@ -924,25 +930,25 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
924
930
|
strokeOpacity: .25
|
|
925
931
|
},
|
|
926
932
|
node: { fill: "hsl(var(--chart-1))" },
|
|
927
|
-
...
|
|
928
|
-
children: /* @__PURE__ */ E(
|
|
933
|
+
...Re,
|
|
934
|
+
children: /* @__PURE__ */ E(M, {})
|
|
929
935
|
})
|
|
930
936
|
});
|
|
931
937
|
}
|
|
932
|
-
if (y === "radar") return /* @__PURE__ */ E(
|
|
938
|
+
if (y === "radar") return /* @__PURE__ */ E(X, {
|
|
933
939
|
config: r,
|
|
934
940
|
className: o,
|
|
935
|
-
...
|
|
936
|
-
children: /* @__PURE__ */ D(
|
|
937
|
-
data:
|
|
941
|
+
...C,
|
|
942
|
+
children: /* @__PURE__ */ D(ke, {
|
|
943
|
+
data: x,
|
|
938
944
|
children: [
|
|
939
|
-
/* @__PURE__ */ E(
|
|
940
|
-
/* @__PURE__ */ E(
|
|
941
|
-
/* @__PURE__ */ E(
|
|
942
|
-
/* @__PURE__ */ E(
|
|
943
|
-
/* @__PURE__ */ E(
|
|
944
|
-
content: /* @__PURE__ */ E(
|
|
945
|
-
...
|
|
945
|
+
/* @__PURE__ */ E(Ee, {}),
|
|
946
|
+
/* @__PURE__ */ E(Te, { dataKey: i }),
|
|
947
|
+
/* @__PURE__ */ E(De, {}),
|
|
948
|
+
/* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }),
|
|
949
|
+
/* @__PURE__ */ E(pt, {
|
|
950
|
+
content: /* @__PURE__ */ E(st, {}),
|
|
951
|
+
...w && {
|
|
946
952
|
verticalAlign: "bottom",
|
|
947
953
|
wrapperStyle: {
|
|
948
954
|
fontSize: "11px",
|
|
@@ -951,49 +957,49 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
951
957
|
}
|
|
952
958
|
}),
|
|
953
959
|
a.map((e) => {
|
|
954
|
-
let t = Q(r[e.dataKey]?.color ||
|
|
955
|
-
return /* @__PURE__ */ E(
|
|
960
|
+
let t = Q(r[e.dataKey]?.color || Et);
|
|
961
|
+
return /* @__PURE__ */ E(Oe, {
|
|
956
962
|
dataKey: e.dataKey,
|
|
957
963
|
stroke: t,
|
|
958
964
|
fill: t,
|
|
959
965
|
fillOpacity: .6,
|
|
960
|
-
...
|
|
966
|
+
...S
|
|
961
967
|
}, e.dataKey);
|
|
962
968
|
})
|
|
963
969
|
]
|
|
964
970
|
})
|
|
965
971
|
});
|
|
966
|
-
if (y === "scatter") return /* @__PURE__ */ E(
|
|
972
|
+
if (y === "scatter") return /* @__PURE__ */ E(X, {
|
|
967
973
|
config: r,
|
|
968
974
|
className: o,
|
|
969
|
-
...
|
|
970
|
-
children: /* @__PURE__ */ D(
|
|
971
|
-
/* @__PURE__ */ E(
|
|
972
|
-
/* @__PURE__ */ E(
|
|
975
|
+
...C,
|
|
976
|
+
children: /* @__PURE__ */ D(Fe, { children: [
|
|
977
|
+
/* @__PURE__ */ E(ge, { vertical: !1 }),
|
|
978
|
+
/* @__PURE__ */ E(P, {
|
|
973
979
|
type: "number",
|
|
974
980
|
dataKey: i,
|
|
975
981
|
name: String(r[i]?.label || i),
|
|
976
982
|
tickLine: !1,
|
|
977
983
|
axisLine: !1,
|
|
978
|
-
minTickGap:
|
|
984
|
+
minTickGap: w ? 32 : 48
|
|
979
985
|
}),
|
|
980
|
-
/* @__PURE__ */ E(
|
|
986
|
+
/* @__PURE__ */ E(F, {
|
|
981
987
|
type: "number",
|
|
982
988
|
dataKey: a[0]?.dataKey || "value",
|
|
983
989
|
name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
|
|
984
990
|
tickLine: !1,
|
|
985
991
|
axisLine: !1,
|
|
986
|
-
tickFormatter:
|
|
992
|
+
tickFormatter: He,
|
|
987
993
|
width: 48
|
|
988
994
|
}),
|
|
989
|
-
/* @__PURE__ */ E(
|
|
995
|
+
/* @__PURE__ */ E(Ie, {
|
|
990
996
|
type: "number",
|
|
991
997
|
range: [60, 400]
|
|
992
998
|
}),
|
|
993
|
-
/* @__PURE__ */ E(
|
|
994
|
-
/* @__PURE__ */ E(
|
|
995
|
-
content: /* @__PURE__ */ E(
|
|
996
|
-
...
|
|
999
|
+
/* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }),
|
|
1000
|
+
/* @__PURE__ */ E(pt, {
|
|
1001
|
+
content: /* @__PURE__ */ E(st, {}),
|
|
1002
|
+
...w && {
|
|
997
1003
|
verticalAlign: "bottom",
|
|
998
1004
|
wrapperStyle: {
|
|
999
1005
|
fontSize: "11px",
|
|
@@ -1002,54 +1008,54 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1002
1008
|
}
|
|
1003
1009
|
}),
|
|
1004
1010
|
a.map((e, t) => {
|
|
1005
|
-
let n =
|
|
1006
|
-
return /* @__PURE__ */ E(
|
|
1011
|
+
let n = I(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = Ot(e, "scatter");
|
|
1012
|
+
return /* @__PURE__ */ E(Pe, {
|
|
1007
1013
|
name: r[e.dataKey]?.label || e.dataKey,
|
|
1008
|
-
data:
|
|
1014
|
+
data: x,
|
|
1009
1015
|
fill: i,
|
|
1010
1016
|
fillOpacity: a?.fillOpacity,
|
|
1011
|
-
...
|
|
1012
|
-
...
|
|
1017
|
+
...S,
|
|
1018
|
+
...Me
|
|
1013
1019
|
}, e.dataKey);
|
|
1014
1020
|
})
|
|
1015
1021
|
] })
|
|
1016
1022
|
});
|
|
1017
|
-
if (y === "combo") return /* @__PURE__ */ E(
|
|
1018
|
-
title:
|
|
1019
|
-
subtitle:
|
|
1020
|
-
children: /* @__PURE__ */ E(
|
|
1023
|
+
if (y === "combo") return /* @__PURE__ */ E(St, {
|
|
1024
|
+
title: te,
|
|
1025
|
+
subtitle: g,
|
|
1026
|
+
children: /* @__PURE__ */ E(X, {
|
|
1021
1027
|
config: r,
|
|
1022
1028
|
className: o,
|
|
1023
|
-
...
|
|
1024
|
-
children: /* @__PURE__ */ D(
|
|
1025
|
-
data:
|
|
1029
|
+
...C,
|
|
1030
|
+
children: /* @__PURE__ */ D(ve, {
|
|
1031
|
+
data: x,
|
|
1026
1032
|
children: [
|
|
1027
|
-
/* @__PURE__ */ E(
|
|
1028
|
-
/* @__PURE__ */ E(
|
|
1033
|
+
/* @__PURE__ */ E(ge, { ...We }),
|
|
1034
|
+
/* @__PURE__ */ E(P, {
|
|
1029
1035
|
dataKey: i,
|
|
1030
|
-
|
|
1036
|
+
...$e
|
|
1031
1037
|
}),
|
|
1032
|
-
/* @__PURE__ */ E(
|
|
1038
|
+
/* @__PURE__ */ E(F, {
|
|
1033
1039
|
yAxisId: "left",
|
|
1034
1040
|
tickLine: !1,
|
|
1035
1041
|
axisLine: !1,
|
|
1036
|
-
tickFormatter:
|
|
1042
|
+
tickFormatter: V,
|
|
1037
1043
|
width: 48,
|
|
1038
|
-
...W(
|
|
1044
|
+
...W(L)
|
|
1039
1045
|
}),
|
|
1040
|
-
/* @__PURE__ */ E(
|
|
1046
|
+
/* @__PURE__ */ E(F, {
|
|
1041
1047
|
yAxisId: "right",
|
|
1042
1048
|
orientation: "right",
|
|
1043
1049
|
tickLine: !1,
|
|
1044
1050
|
axisLine: !1,
|
|
1045
|
-
tickFormatter:
|
|
1051
|
+
tickFormatter: H,
|
|
1046
1052
|
width: 48,
|
|
1047
|
-
...W(
|
|
1053
|
+
...W(R, "right")
|
|
1048
1054
|
}),
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
content: /* @__PURE__ */ E(
|
|
1052
|
-
...
|
|
1055
|
+
q ? /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }) : null,
|
|
1056
|
+
Qe ? /* @__PURE__ */ E(pt, {
|
|
1057
|
+
content: /* @__PURE__ */ E(st, {}),
|
|
1058
|
+
...w && {
|
|
1053
1059
|
verticalAlign: "bottom",
|
|
1054
1060
|
wrapperStyle: {
|
|
1055
1061
|
fontSize: "11px",
|
|
@@ -1057,11 +1063,11 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1057
1063
|
}
|
|
1058
1064
|
}
|
|
1059
1065
|
}) : null,
|
|
1060
|
-
|
|
1061
|
-
|
|
1066
|
+
K,
|
|
1067
|
+
J,
|
|
1062
1068
|
a.map((e, t) => {
|
|
1063
|
-
let n = Q(r[e.dataKey]?.color ||
|
|
1064
|
-
return i === "line" ? /* @__PURE__ */ E(
|
|
1069
|
+
let n = Q(r[e.dataKey]?.color || Et), i = e.chartType || b || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : b || i === "bar" ? "left" : "right", o = Ot(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = G((a === "right" ? R : L)?.format);
|
|
1070
|
+
return i === "line" ? /* @__PURE__ */ E(xe, {
|
|
1065
1071
|
yAxisId: a,
|
|
1066
1072
|
type: "monotone",
|
|
1067
1073
|
dataKey: e.dataKey,
|
|
@@ -1070,9 +1076,9 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1070
1076
|
dot: !1,
|
|
1071
1077
|
strokeOpacity: o?.strokeOpacity,
|
|
1072
1078
|
strokeDasharray: o?.strokeDasharray,
|
|
1073
|
-
...
|
|
1074
|
-
children:
|
|
1075
|
-
}, e.dataKey) : i === "area" ? /* @__PURE__ */ E(
|
|
1079
|
+
...S,
|
|
1080
|
+
children: Y(c)
|
|
1081
|
+
}, e.dataKey) : i === "area" ? /* @__PURE__ */ E(O, {
|
|
1076
1082
|
yAxisId: a,
|
|
1077
1083
|
type: "monotone",
|
|
1078
1084
|
dataKey: e.dataKey,
|
|
@@ -1082,42 +1088,42 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1082
1088
|
strokeOpacity: o?.strokeOpacity,
|
|
1083
1089
|
strokeDasharray: o?.strokeDasharray,
|
|
1084
1090
|
...s,
|
|
1085
|
-
...
|
|
1086
|
-
children:
|
|
1087
|
-
}, e.dataKey) : /* @__PURE__ */ E(
|
|
1091
|
+
...S,
|
|
1092
|
+
children: Y(c)
|
|
1093
|
+
}, e.dataKey) : /* @__PURE__ */ E(me, {
|
|
1088
1094
|
yAxisId: a,
|
|
1089
1095
|
dataKey: e.dataKey,
|
|
1090
1096
|
fill: n,
|
|
1091
1097
|
radius: 4,
|
|
1092
1098
|
fillOpacity: o?.fillOpacity,
|
|
1093
1099
|
...s,
|
|
1094
|
-
...
|
|
1095
|
-
children:
|
|
1100
|
+
...S,
|
|
1101
|
+
children: Y(c)
|
|
1096
1102
|
}, e.dataKey);
|
|
1097
1103
|
})
|
|
1098
1104
|
]
|
|
1099
1105
|
})
|
|
1100
1106
|
})
|
|
1101
1107
|
});
|
|
1102
|
-
let
|
|
1103
|
-
...
|
|
1104
|
-
...
|
|
1105
|
-
...a.map((e, t) => Q(r[e.dataKey]?.color ||
|
|
1106
|
-
])),
|
|
1107
|
-
return /* @__PURE__ */ E(
|
|
1108
|
-
title:
|
|
1109
|
-
subtitle:
|
|
1110
|
-
children: /* @__PURE__ */ E(
|
|
1108
|
+
let et = y === "horizontal-bar", tt = I(), nt = c ? Object.values(c).map((e) => Q(String(e))) : [], rt = Array.from(/* @__PURE__ */ new Set([
|
|
1109
|
+
...tt,
|
|
1110
|
+
...nt,
|
|
1111
|
+
...a.map((e, t) => Q(r[e.dataKey]?.color || tt[t % tt.length] || Et))
|
|
1112
|
+
])), it = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
|
|
1113
|
+
return /* @__PURE__ */ E(St, {
|
|
1114
|
+
title: te,
|
|
1115
|
+
subtitle: g,
|
|
1116
|
+
children: /* @__PURE__ */ E(X, {
|
|
1111
1117
|
config: r,
|
|
1112
1118
|
className: o,
|
|
1113
|
-
...
|
|
1114
|
-
children: /* @__PURE__ */ D(
|
|
1115
|
-
data:
|
|
1116
|
-
layout:
|
|
1117
|
-
...
|
|
1119
|
+
...C,
|
|
1120
|
+
children: /* @__PURE__ */ D(ze, {
|
|
1121
|
+
data: x,
|
|
1122
|
+
layout: et ? "vertical" : "horizontal",
|
|
1123
|
+
...ce,
|
|
1118
1124
|
children: [
|
|
1119
|
-
/* @__PURE__ */ E("defs", { children:
|
|
1120
|
-
id: `bg-${
|
|
1125
|
+
/* @__PURE__ */ E("defs", { children: rt.map((e) => /* @__PURE__ */ D(h.Fragment, { children: [/* @__PURE__ */ D("linearGradient", {
|
|
1126
|
+
id: `bg-${it(e)}`,
|
|
1121
1127
|
x1: "0",
|
|
1122
1128
|
y1: "0",
|
|
1123
1129
|
x2: "0",
|
|
@@ -1132,7 +1138,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1132
1138
|
stopOpacity: .5
|
|
1133
1139
|
})]
|
|
1134
1140
|
}), /* @__PURE__ */ D("linearGradient", {
|
|
1135
|
-
id: `ag-${
|
|
1141
|
+
id: `ag-${it(e)}`,
|
|
1136
1142
|
x1: "0",
|
|
1137
1143
|
y1: "0",
|
|
1138
1144
|
x2: "0",
|
|
@@ -1146,48 +1152,48 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1146
1152
|
style: { stopColor: e },
|
|
1147
1153
|
stopOpacity: .05
|
|
1148
1154
|
})]
|
|
1149
|
-
})] },
|
|
1150
|
-
/* @__PURE__ */ E(
|
|
1151
|
-
|
|
1155
|
+
})] }, it(e))) }),
|
|
1156
|
+
/* @__PURE__ */ E(ge, { ...We }),
|
|
1157
|
+
et ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(P, {
|
|
1152
1158
|
type: "number",
|
|
1153
1159
|
tickLine: !1,
|
|
1154
1160
|
axisLine: !1,
|
|
1155
|
-
tickFormatter:
|
|
1156
|
-
...W(
|
|
1157
|
-
}), /* @__PURE__ */ E(
|
|
1161
|
+
tickFormatter: V,
|
|
1162
|
+
...W(L)
|
|
1163
|
+
}), /* @__PURE__ */ E(F, {
|
|
1158
1164
|
type: "category",
|
|
1159
1165
|
dataKey: i,
|
|
1160
1166
|
tickLine: !1,
|
|
1161
1167
|
axisLine: !1,
|
|
1162
|
-
width: Math.min(140, Math.max(60, Math.max(...
|
|
1163
|
-
tickFormatter:
|
|
1168
|
+
width: Math.min(140, Math.max(60, Math.max(...x.map((e) => String(e[i] ?? "").length)) * 7)),
|
|
1169
|
+
tickFormatter: B
|
|
1164
1170
|
})] }) : /* @__PURE__ */ D(T, { children: [
|
|
1165
|
-
/* @__PURE__ */ E(
|
|
1171
|
+
/* @__PURE__ */ E(P, {
|
|
1166
1172
|
dataKey: i,
|
|
1167
|
-
|
|
1173
|
+
...$e
|
|
1168
1174
|
}),
|
|
1169
|
-
/* @__PURE__ */ E(
|
|
1170
|
-
...
|
|
1175
|
+
/* @__PURE__ */ E(F, {
|
|
1176
|
+
...z ? { yAxisId: "left" } : {},
|
|
1171
1177
|
tickLine: !1,
|
|
1172
1178
|
axisLine: !1,
|
|
1173
|
-
tickFormatter:
|
|
1179
|
+
tickFormatter: V,
|
|
1174
1180
|
width: 48,
|
|
1175
|
-
...W(
|
|
1181
|
+
...W(L)
|
|
1176
1182
|
}),
|
|
1177
|
-
|
|
1183
|
+
z ? /* @__PURE__ */ E(F, {
|
|
1178
1184
|
yAxisId: "right",
|
|
1179
1185
|
orientation: "right",
|
|
1180
1186
|
tickLine: !1,
|
|
1181
1187
|
axisLine: !1,
|
|
1182
|
-
tickFormatter:
|
|
1188
|
+
tickFormatter: H,
|
|
1183
1189
|
width: 48,
|
|
1184
|
-
...W(
|
|
1190
|
+
...W(R, "right")
|
|
1185
1191
|
}) : null
|
|
1186
1192
|
] }),
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
content: /* @__PURE__ */ E(
|
|
1190
|
-
...
|
|
1193
|
+
q ? /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }) : null,
|
|
1194
|
+
Qe ? /* @__PURE__ */ E(pt, {
|
|
1195
|
+
content: /* @__PURE__ */ E(st, {}),
|
|
1196
|
+
...w && {
|
|
1191
1197
|
verticalAlign: "bottom",
|
|
1192
1198
|
wrapperStyle: {
|
|
1193
1199
|
fontSize: "11px",
|
|
@@ -1195,26 +1201,26 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1195
1201
|
}
|
|
1196
1202
|
}
|
|
1197
1203
|
}) : null,
|
|
1198
|
-
|
|
1199
|
-
|
|
1204
|
+
K,
|
|
1205
|
+
J,
|
|
1200
1206
|
a.map((e, t) => {
|
|
1201
|
-
let n =
|
|
1207
|
+
let n = I(), o = e.variant === "comparison", s = o ? a.slice(0, t).find((e) => e.variant !== "comparison") || a[0] : e, c = o ? a.indexOf(s) : t, l = Q(r[s.dataKey]?.color || n[c % n.length] || Et), u = z ? { yAxisId: e.yAxis === "right" ? "right" : "left" } : {}, d = e.stack ? { stackId: String(e.stack) } : {}, f = G((e.yAxis === "right" ? R : L)?.format);
|
|
1202
1208
|
if (y === "bar" || y === "horizontal-bar") {
|
|
1203
|
-
let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 &&
|
|
1204
|
-
return /* @__PURE__ */ D(
|
|
1209
|
+
let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && x.length > 1, r = Ot(e, "bar");
|
|
1210
|
+
return /* @__PURE__ */ D(me, {
|
|
1205
1211
|
dataKey: e.dataKey,
|
|
1206
|
-
fill: `url(#bg-${
|
|
1212
|
+
fill: `url(#bg-${it(l)})`,
|
|
1207
1213
|
radius: 4,
|
|
1208
1214
|
fillOpacity: r?.fillOpacity,
|
|
1209
1215
|
...d,
|
|
1210
1216
|
...u,
|
|
1211
|
-
...
|
|
1212
|
-
children: [t &&
|
|
1217
|
+
...S,
|
|
1218
|
+
children: [t && x.map((e, t) => /* @__PURE__ */ E(_e, { fill: `url(#bg-${it(Q(ue(e?.[i], t, n)))})` }, `cell-${t}`)), Y(f)]
|
|
1213
1219
|
}, e.dataKey);
|
|
1214
1220
|
}
|
|
1215
1221
|
if (y === "line") {
|
|
1216
|
-
let t =
|
|
1217
|
-
return /* @__PURE__ */ E(
|
|
1222
|
+
let t = Ot(e, "line");
|
|
1223
|
+
return /* @__PURE__ */ E(xe, {
|
|
1218
1224
|
type: "monotone",
|
|
1219
1225
|
dataKey: e.dataKey,
|
|
1220
1226
|
stroke: l,
|
|
@@ -1223,16 +1229,16 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1223
1229
|
strokeOpacity: t?.strokeOpacity,
|
|
1224
1230
|
strokeDasharray: t?.strokeDasharray,
|
|
1225
1231
|
...u,
|
|
1226
|
-
...
|
|
1227
|
-
children:
|
|
1232
|
+
...S,
|
|
1233
|
+
children: Y(f)
|
|
1228
1234
|
}, e.dataKey);
|
|
1229
1235
|
}
|
|
1230
1236
|
if (y === "area") {
|
|
1231
|
-
let t =
|
|
1232
|
-
return /* @__PURE__ */ E(
|
|
1237
|
+
let t = Ot(e, "area");
|
|
1238
|
+
return /* @__PURE__ */ E(O, {
|
|
1233
1239
|
type: "monotone",
|
|
1234
1240
|
dataKey: e.dataKey,
|
|
1235
|
-
fill: `url(#ag-${
|
|
1241
|
+
fill: `url(#ag-${it(l)})`,
|
|
1236
1242
|
stroke: l,
|
|
1237
1243
|
strokeWidth: 2,
|
|
1238
1244
|
fillOpacity: t?.fillOpacity ?? 1,
|
|
@@ -1240,8 +1246,8 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1240
1246
|
strokeDasharray: t?.strokeDasharray,
|
|
1241
1247
|
...d,
|
|
1242
1248
|
...u,
|
|
1243
|
-
...
|
|
1244
|
-
children:
|
|
1249
|
+
...S,
|
|
1250
|
+
children: Y(f)
|
|
1245
1251
|
}, e.dataKey);
|
|
1246
1252
|
}
|
|
1247
1253
|
return null;
|
|
@@ -1251,13 +1257,13 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1251
1257
|
})
|
|
1252
1258
|
});
|
|
1253
1259
|
}
|
|
1254
|
-
function
|
|
1260
|
+
function wt(e) {
|
|
1255
1261
|
let t = e.chartType === "column" ? "bar" : e.chartType ?? "bar", n = Array.isArray(e.data) ? e.data : [], r = e.xAxisKey ?? "name";
|
|
1256
|
-
return
|
|
1262
|
+
return kt.has(t) && n.length > 0 && !n.some((e) => typeof e == "object" && !!e && r in e);
|
|
1257
1263
|
}
|
|
1258
|
-
function
|
|
1259
|
-
let t =
|
|
1260
|
-
return
|
|
1264
|
+
function Tt(e) {
|
|
1265
|
+
let t = wt(e), n = e.xAxisKey ?? "name", r = h.useMemo(() => Object.keys((Array.isArray(e.data) ? e.data[0] : void 0) ?? {}), [e.data]);
|
|
1266
|
+
return h.useEffect(() => {
|
|
1261
1267
|
t && console.warn(`[chart] no row has the category key "${n}" — rendering an explanatory placeholder instead of an empty axis. Row keys: ${JSON.stringify(r)}. A dataset query must PROJECT the dimension it groups by (framework#4033).`);
|
|
1262
1268
|
}, [
|
|
1263
1269
|
t,
|
|
@@ -1276,10 +1282,10 @@ function xt(e) {
|
|
|
1276
1282
|
}),
|
|
1277
1283
|
" field."
|
|
1278
1284
|
] })
|
|
1279
|
-
}) : /* @__PURE__ */ E(
|
|
1285
|
+
}) : /* @__PURE__ */ E(Ct, { ...e });
|
|
1280
1286
|
}
|
|
1281
|
-
var
|
|
1282
|
-
|
|
1287
|
+
var Et, Dt, Q, Ot, kt, At = V((() => {
|
|
1288
|
+
mt(), yt(), $e(), Et = "hsl(var(--primary))", Dt = {
|
|
1283
1289
|
slate: "#64748b",
|
|
1284
1290
|
gray: "#6b7280",
|
|
1285
1291
|
zinc: "#71717a",
|
|
@@ -1302,11 +1308,11 @@ var St, Ct, Q, wt, Tt, Et = z((() => {
|
|
|
1302
1308
|
fuchsia: "#d946ef",
|
|
1303
1309
|
pink: "#ec4899",
|
|
1304
1310
|
rose: "#f43f5e"
|
|
1305
|
-
}, Q = (e) =>
|
|
1311
|
+
}, Q = (e) => Dt[e] || e, Ot = (e, t) => e?.variant === "comparison" ? {
|
|
1306
1312
|
strokeOpacity: typeof e.opacity == "number" ? e.opacity : t === "line" || t === "scatter" ? .5 : .6,
|
|
1307
1313
|
fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
|
|
1308
1314
|
strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
|
|
1309
|
-
} : null,
|
|
1315
|
+
} : null, kt = /* @__PURE__ */ new Set([
|
|
1310
1316
|
"bar",
|
|
1311
1317
|
"horizontal-bar",
|
|
1312
1318
|
"line",
|
|
@@ -1320,10 +1326,10 @@ var St, Ct, Q, wt, Tt, Et = z((() => {
|
|
|
1320
1326
|
}));
|
|
1321
1327
|
//#endregion
|
|
1322
1328
|
//#region src/ChartRenderer.tsx
|
|
1323
|
-
|
|
1324
|
-
var
|
|
1325
|
-
fallback: /* @__PURE__ */ E(
|
|
1326
|
-
children: /* @__PURE__ */ E(
|
|
1329
|
+
$e();
|
|
1330
|
+
var jt = g.lazy(() => Promise.resolve().then(() => (it(), et))), Mt = g.lazy(() => Promise.resolve().then(() => (At(), bt))), Nt = ({ schema: e }) => /* @__PURE__ */ E(_, {
|
|
1331
|
+
fallback: /* @__PURE__ */ E(fe, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
1332
|
+
children: /* @__PURE__ */ E(jt, {
|
|
1327
1333
|
data: e.data,
|
|
1328
1334
|
dataKey: e.dataKey,
|
|
1329
1335
|
xAxisKey: e.xAxisKey,
|
|
@@ -1332,8 +1338,8 @@ var Dt = h.lazy(() => Promise.resolve().then(() => (nt(), $e))), Ot = h.lazy(()
|
|
|
1332
1338
|
color: e.color
|
|
1333
1339
|
})
|
|
1334
1340
|
}), $ = ({ schema: e, onChartClick: t }) => {
|
|
1335
|
-
let n =
|
|
1336
|
-
let t =
|
|
1341
|
+
let n = g.useMemo(() => {
|
|
1342
|
+
let t = We(e), n = Array.isArray(e.series) ? e.series : void 0, r = (n?.length && n.every((e) => !!e && typeof e == "object" && "dataKey" in e) ? n : t.series) ?? n, i = e.xAxisKey ?? t.xAxisKey, a = e.config;
|
|
1337
1343
|
if (i || (e.index ? i = e.index : e.category && (i = e.category)), r || (e.categories ? r = e.categories.map((e) => ({ dataKey: e })) : e.value && (r = [{ dataKey: e.value }])), !a && r) {
|
|
1338
1344
|
let t = e.colors || [
|
|
1339
1345
|
"hsl(var(--chart-1))",
|
|
@@ -1357,9 +1363,9 @@ var Dt = h.lazy(() => Promise.resolve().then(() => (nt(), $e))), Ot = h.lazy(()
|
|
|
1357
1363
|
spec: t
|
|
1358
1364
|
};
|
|
1359
1365
|
}, [e]);
|
|
1360
|
-
return /* @__PURE__ */ E(
|
|
1361
|
-
fallback: /* @__PURE__ */ E(
|
|
1362
|
-
children: /* @__PURE__ */ E(
|
|
1366
|
+
return /* @__PURE__ */ E(_, {
|
|
1367
|
+
fallback: /* @__PURE__ */ E(fe, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
1368
|
+
children: /* @__PURE__ */ E(Mt, {
|
|
1363
1369
|
chartType: n.chartType,
|
|
1364
1370
|
data: n.data,
|
|
1365
1371
|
config: n.config,
|
|
@@ -1386,15 +1392,15 @@ var Dt = h.lazy(() => Promise.resolve().then(() => (nt(), $e))), Ot = h.lazy(()
|
|
|
1386
1392
|
};
|
|
1387
1393
|
//#endregion
|
|
1388
1394
|
//#region src/ObjectChart.tsx
|
|
1389
|
-
function
|
|
1395
|
+
function Pt(e) {
|
|
1390
1396
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
1391
1397
|
}
|
|
1392
|
-
function
|
|
1398
|
+
function Ft(e) {
|
|
1393
1399
|
return e.field || e.function || "count";
|
|
1394
1400
|
}
|
|
1395
|
-
var
|
|
1396
|
-
function
|
|
1397
|
-
let { field: n, function: r, groupBy: i } = t, a =
|
|
1401
|
+
var It = "__comparison";
|
|
1402
|
+
function Lt(e, t) {
|
|
1403
|
+
let { field: n, function: r, groupBy: i } = t, a = Ft(t), o = {};
|
|
1398
1404
|
for (let t of e) {
|
|
1399
1405
|
let e = String(t[i] ?? "Unknown");
|
|
1400
1406
|
o[e] || (o[e] = []), o[e].push(t);
|
|
@@ -1414,9 +1420,7 @@ function Nt(e, t) {
|
|
|
1414
1420
|
case "max":
|
|
1415
1421
|
s = o.length > 0 ? Math.max(...o) : 0;
|
|
1416
1422
|
break;
|
|
1417
|
-
default:
|
|
1418
|
-
s = o.reduce((e, t) => e + t, 0);
|
|
1419
|
-
break;
|
|
1423
|
+
default: s = o.reduce((e, t) => e + t, 0);
|
|
1420
1424
|
}
|
|
1421
1425
|
return {
|
|
1422
1426
|
[i]: e,
|
|
@@ -1424,13 +1428,13 @@ function Nt(e, t) {
|
|
|
1424
1428
|
};
|
|
1425
1429
|
});
|
|
1426
1430
|
}
|
|
1427
|
-
async function
|
|
1431
|
+
async function Rt(e, t, n, r, i) {
|
|
1428
1432
|
if (!e.length || !t) return e;
|
|
1429
|
-
let a = i || ((e, t) => t), o = `__raw_${t}`,
|
|
1430
|
-
if (!
|
|
1433
|
+
let a = i || ((e, t) => t), o = `__raw_${t}`, s = n?.fields?.[t];
|
|
1434
|
+
if (!s) {
|
|
1431
1435
|
let n = /^\d{4}-\d{2}-\d{2}/;
|
|
1432
1436
|
return e.map((e) => {
|
|
1433
|
-
let r = e[t], i = String(r ?? ""), s = n.test(i) ? i :
|
|
1437
|
+
let r = e[t], i = String(r ?? ""), s = n.test(i) ? i : Pt(i);
|
|
1434
1438
|
return {
|
|
1435
1439
|
...e,
|
|
1436
1440
|
[t]: a(i, s),
|
|
@@ -1438,11 +1442,11 @@ async function Pt(e, t, n, r, i) {
|
|
|
1438
1442
|
};
|
|
1439
1443
|
});
|
|
1440
1444
|
}
|
|
1441
|
-
let l =
|
|
1445
|
+
let l = s.type;
|
|
1442
1446
|
if (l === "select" || l === "picklist" || l === "dropdown") {
|
|
1443
|
-
let n =
|
|
1447
|
+
let n = s.options || [];
|
|
1444
1448
|
if (n.length === 0) return e.map((e) => {
|
|
1445
|
-
let n = e[t], r = String(n ?? ""), i =
|
|
1449
|
+
let n = e[t], r = String(n ?? ""), i = Pt(r);
|
|
1446
1450
|
return {
|
|
1447
1451
|
...e,
|
|
1448
1452
|
[t]: a(r, i),
|
|
@@ -1452,7 +1456,7 @@ async function Pt(e, t, n, r, i) {
|
|
|
1452
1456
|
let r = {};
|
|
1453
1457
|
for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
|
|
1454
1458
|
return e.map((e) => {
|
|
1455
|
-
let n = e[t], i = String(n ?? ""), s = r[i] ||
|
|
1459
|
+
let n = e[t], i = String(n ?? ""), s = r[i] || Pt(i);
|
|
1456
1460
|
return {
|
|
1457
1461
|
...e,
|
|
1458
1462
|
[t]: a(i, s),
|
|
@@ -1461,7 +1465,7 @@ async function Pt(e, t, n, r, i) {
|
|
|
1461
1465
|
});
|
|
1462
1466
|
}
|
|
1463
1467
|
if (l === "lookup" || l === "master_detail") {
|
|
1464
|
-
let n =
|
|
1468
|
+
let n = s.reference_to || s.reference;
|
|
1465
1469
|
if (!n || !r || typeof r.find != "function") return e.map((e) => ({
|
|
1466
1470
|
...e,
|
|
1467
1471
|
[o]: e[t]
|
|
@@ -1471,21 +1475,21 @@ async function Pt(e, t, n, r, i) {
|
|
|
1471
1475
|
...e,
|
|
1472
1476
|
[o]: e[t]
|
|
1473
1477
|
}));
|
|
1474
|
-
let a =
|
|
1478
|
+
let a = s.id_field || "id";
|
|
1475
1479
|
try {
|
|
1476
|
-
let l =
|
|
1480
|
+
let l = await r.find(n, {
|
|
1477
1481
|
$filter: { [a]: { $in: i } },
|
|
1478
1482
|
$top: i.length
|
|
1479
|
-
})
|
|
1480
|
-
for (let e of
|
|
1481
|
-
let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[
|
|
1482
|
-
t && (
|
|
1483
|
+
}), u = c(l), d = s.reference_field || s.display_field || "name", f = {};
|
|
1484
|
+
for (let e of u) {
|
|
1485
|
+
let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[d] || e.name || e.label || e.title || t;
|
|
1486
|
+
t && (f[t] = String(n));
|
|
1483
1487
|
}
|
|
1484
1488
|
return e.map((e) => {
|
|
1485
1489
|
let n = e[t], r = String(n ?? "");
|
|
1486
1490
|
return {
|
|
1487
1491
|
...e,
|
|
1488
|
-
[t]:
|
|
1492
|
+
[t]: f[r] || r,
|
|
1489
1493
|
[o]: n
|
|
1490
1494
|
};
|
|
1491
1495
|
});
|
|
@@ -1505,17 +1509,17 @@ async function Pt(e, t, n, r, i) {
|
|
|
1505
1509
|
let n = e[t], r = String(n ?? "");
|
|
1506
1510
|
return {
|
|
1507
1511
|
...e,
|
|
1508
|
-
[t]: u.test(r) ? r :
|
|
1512
|
+
[t]: u.test(r) ? r : Pt(r),
|
|
1509
1513
|
[o]: n
|
|
1510
1514
|
};
|
|
1511
1515
|
});
|
|
1512
1516
|
}
|
|
1513
|
-
var
|
|
1514
|
-
let { schema: t } = e,
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
}, [
|
|
1518
|
-
let [
|
|
1517
|
+
var zt = (e) => {
|
|
1518
|
+
let { schema: t } = e, h = e.onSegmentClick, g = re(ze), _ = e.dataSource || g?.dataSource, fe = g?.apiFetch, T = Be(t.bind), { fieldOptionLabel: O } = R(), pe = y(O);
|
|
1519
|
+
ie(() => {
|
|
1520
|
+
pe.current = O;
|
|
1521
|
+
}, [O]);
|
|
1522
|
+
let [me, k] = b([]), [he, ge] = b(null), [_e, ve] = b(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [ye, be] = b(null), [A, j] = b(null), [xe, Se] = b(null), { openRecordList: Ce } = Ve(), we = z(), Te = v(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Ee = v(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), De = v(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), Oe = v(() => t.dataset ? JSON.stringify({
|
|
1519
1523
|
d: t.dataset,
|
|
1520
1524
|
dim: t.dimensions ?? [],
|
|
1521
1525
|
val: t.values ?? []
|
|
@@ -1523,36 +1527,37 @@ var Ft = (e) => {
|
|
|
1523
1527
|
t.dataset,
|
|
1524
1528
|
t.dimensions,
|
|
1525
1529
|
t.values
|
|
1526
|
-
]),
|
|
1527
|
-
|
|
1530
|
+
]), ke = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
|
|
1531
|
+
ie(() => {
|
|
1528
1532
|
let e = !1;
|
|
1529
1533
|
return (async () => {
|
|
1530
1534
|
try {
|
|
1531
|
-
let n = {
|
|
1535
|
+
let n = fe ?? fetch, r = {
|
|
1532
1536
|
headers: { accept: "application/json" },
|
|
1533
1537
|
credentials: "include"
|
|
1534
|
-
},
|
|
1535
|
-
if (
|
|
1538
|
+
}, i = t.objectName, a, o = null, s = t.aggregate?.groupBy;
|
|
1539
|
+
if (i) a = s && typeof s == "object" && !Array.isArray(s) ? s.field : typeof s == "string" ? s : t.xAxisKey;
|
|
1536
1540
|
else if (t.dataset) {
|
|
1537
|
-
let e = Array.isArray(t.dimensions) && t.dimensions.length ? t.dimensions[0] : void 0,
|
|
1538
|
-
|
|
1541
|
+
let e = Array.isArray(t.dimensions) && t.dimensions.length ? t.dimensions[0] : void 0, s = await (await n(`/api/v1/meta/dataset/${encodeURIComponent(t.dataset)}`, r)).json().catch(() => null);
|
|
1542
|
+
o = s?.item ?? s?.data ?? s, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
|
|
1539
1543
|
}
|
|
1540
|
-
if (!
|
|
1541
|
-
e || (
|
|
1544
|
+
if (!i || !a) {
|
|
1545
|
+
e || Se(null);
|
|
1542
1546
|
return;
|
|
1543
1547
|
}
|
|
1544
|
-
let
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1548
|
+
let c = async (e) => {
|
|
1549
|
+
let t = await (await n(`/api/v1/meta/object/${encodeURIComponent(e)}`, r)).json().catch(() => null);
|
|
1550
|
+
return t?.item ?? t?.data ?? t;
|
|
1551
|
+
}, l = {};
|
|
1552
|
+
if (t.dataset && Array.isArray(t.dimensions)) for (let e of t.dimensions) l[e] = (o?.dimensions || []).find((t) => t?.name === e)?.field ?? e;
|
|
1553
|
+
let d = await u(c, i, [a, ...Object.values(l)]);
|
|
1554
|
+
e || Se({
|
|
1555
|
+
metaByPath: d,
|
|
1556
|
+
colorPath: a,
|
|
1557
|
+
fieldByDim: t.dataset && Array.isArray(t.dimensions) ? l : null
|
|
1558
|
+
});
|
|
1554
1559
|
} catch {
|
|
1555
|
-
e || (
|
|
1560
|
+
e || Se(null);
|
|
1556
1561
|
}
|
|
1557
1562
|
})(), () => {
|
|
1558
1563
|
e = !0;
|
|
@@ -1560,17 +1565,31 @@ var Ft = (e) => {
|
|
|
1560
1565
|
}, [
|
|
1561
1566
|
t.objectName,
|
|
1562
1567
|
t.dataset,
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
t.xAxisKey
|
|
1568
|
+
Oe,
|
|
1569
|
+
Te,
|
|
1570
|
+
t.xAxisKey,
|
|
1571
|
+
fe
|
|
1566
1572
|
]);
|
|
1567
|
-
let
|
|
1573
|
+
let { fieldOptionColors: Ae, dimensionLabels: je } = v(() => {
|
|
1574
|
+
if (!xe) return {
|
|
1575
|
+
fieldOptionColors: null,
|
|
1576
|
+
dimensionLabels: null
|
|
1577
|
+
};
|
|
1578
|
+
let { metaByPath: e, colorPath: t, fieldByDim: n } = xe, i = d(e[t]?.options, s(e[t], O)), a = o(e, n ? Object.entries(n).map(([e, t]) => ({
|
|
1579
|
+
dim: e,
|
|
1580
|
+
path: t
|
|
1581
|
+
})) : null, O);
|
|
1582
|
+
return {
|
|
1583
|
+
fieldOptionColors: r(i),
|
|
1584
|
+
dimensionLabels: a
|
|
1585
|
+
};
|
|
1586
|
+
}, [xe, O]), Me = ne(async (e, n) => {
|
|
1568
1587
|
if (t.aggregate && typeof e.aggregate == "function") {
|
|
1569
1588
|
let r = t.aggregate.groupBy;
|
|
1570
1589
|
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
1571
1590
|
let i = t.aggregate.field, a = t.aggregate.function, o = {
|
|
1572
1591
|
function: a,
|
|
1573
|
-
alias:
|
|
1592
|
+
alias: Ft(t.aggregate)
|
|
1574
1593
|
};
|
|
1575
1594
|
a !== "count" && i && (o.field = i);
|
|
1576
1595
|
let s = await e.aggregate(t.objectName, {
|
|
@@ -1589,29 +1608,29 @@ var Ft = (e) => {
|
|
|
1589
1608
|
return Array.isArray(i) ? i : [];
|
|
1590
1609
|
}
|
|
1591
1610
|
if (typeof e.find == "function") {
|
|
1592
|
-
let r =
|
|
1593
|
-
return t.aggregate &&
|
|
1611
|
+
let r = await e.find(t.objectName, { $filter: n }), i = c(r);
|
|
1612
|
+
return t.aggregate && i.length > 0 && (i = Lt(i, t.aggregate)), i;
|
|
1594
1613
|
}
|
|
1595
1614
|
return [];
|
|
1596
|
-
}, [t.objectName,
|
|
1615
|
+
}, [t.objectName, Te]), Ne = I(), Pe = ne(async (e, n) => {
|
|
1597
1616
|
if (!e || !t.objectName && !t.dataset) {
|
|
1598
|
-
n.current &&
|
|
1617
|
+
n.current && ve(!1);
|
|
1599
1618
|
return;
|
|
1600
1619
|
}
|
|
1601
|
-
n.current && (
|
|
1620
|
+
n.current && (ve(!0), be(null));
|
|
1602
1621
|
try {
|
|
1603
1622
|
if (t.dataset && typeof e.queryDataset == "function") {
|
|
1604
|
-
let r =
|
|
1623
|
+
let r = m(t.filter, Ne), i = await e.queryDataset(t.dataset, {
|
|
1605
1624
|
dimensions: Array.isArray(t.dimensions) ? t.dimensions : [],
|
|
1606
1625
|
measures: Array.isArray(t.values) ? t.values : [],
|
|
1607
1626
|
...r ? { runtimeFilter: r } : {}
|
|
1608
1627
|
});
|
|
1609
|
-
n.current && (
|
|
1628
|
+
n.current && (k(Array.isArray(i?.rows) ? i.rows : []), ge(Array.isArray(i?.fields) ? i.fields : null));
|
|
1610
1629
|
return;
|
|
1611
1630
|
}
|
|
1612
|
-
let r =
|
|
1631
|
+
let r = m(t.filter, Ne), i = t.compareTo, a = !!i && ke(t.chartType), o = a ? p(te(t.filter, i), Ne) : null, [s, c] = await Promise.all([Me(e, r), o ? Me(e, o) : Promise.resolve([])]), l = s, u = t.aggregate?.groupBy, d = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || t.xAxisKey;
|
|
1613
1632
|
if (a && c.length > 0 && t.aggregate) {
|
|
1614
|
-
let e = t.aggregate.field, n = t.aggregate.function, r =
|
|
1633
|
+
let e = t.aggregate.field, n = t.aggregate.function, r = Ft(t.aggregate), i = (t) => {
|
|
1615
1634
|
if (t == null) return null;
|
|
1616
1635
|
if (e) {
|
|
1617
1636
|
let r = `${e}_${n}`;
|
|
@@ -1619,7 +1638,7 @@ var Ft = (e) => {
|
|
|
1619
1638
|
if (n === "count" && `${e}_count` in t) return Number(t[`${e}_count`]);
|
|
1620
1639
|
}
|
|
1621
1640
|
return r in t ? Number(t[r]) : "value" in t ? Number(t.value) : "count" in t ? Number(t.count) : null;
|
|
1622
|
-
}, a = `${r}${
|
|
1641
|
+
}, a = `${r}${It}`, o = d;
|
|
1623
1642
|
if (o && l.some((e) => e[o] != null) && c.some((e) => e[o] != null)) {
|
|
1624
1643
|
let e = /* @__PURE__ */ new Map();
|
|
1625
1644
|
for (let t of c) {
|
|
@@ -1653,44 +1672,44 @@ var Ft = (e) => {
|
|
|
1653
1672
|
l = t;
|
|
1654
1673
|
}
|
|
1655
1674
|
}
|
|
1656
|
-
if (
|
|
1675
|
+
if (d && typeof e.getObjectSchema == "function") try {
|
|
1657
1676
|
let n = await e.getObjectSchema(t.objectName);
|
|
1658
|
-
l = await
|
|
1677
|
+
l = await Rt(l, d, n, e, (e, n) => pe.current(t.objectName, d, e, n));
|
|
1659
1678
|
} catch {}
|
|
1660
|
-
n.current &&
|
|
1679
|
+
n.current && k(l);
|
|
1661
1680
|
} catch (e) {
|
|
1662
|
-
console.error("[ObjectChart] Fetch error:", e), n.current &&
|
|
1681
|
+
console.error("[ObjectChart] Fetch error:", e), n.current && be(e instanceof Error ? e.message : "Failed to load chart data");
|
|
1663
1682
|
} finally {
|
|
1664
|
-
n.current &&
|
|
1683
|
+
n.current && ve(!1);
|
|
1665
1684
|
}
|
|
1666
1685
|
}, [
|
|
1667
1686
|
t.objectName,
|
|
1668
|
-
|
|
1669
|
-
we,
|
|
1687
|
+
Oe,
|
|
1670
1688
|
Te,
|
|
1671
1689
|
Ee,
|
|
1690
|
+
De,
|
|
1672
1691
|
t.xAxisKey,
|
|
1673
1692
|
t.chartType,
|
|
1674
|
-
|
|
1675
|
-
|
|
1693
|
+
Me,
|
|
1694
|
+
Ne
|
|
1676
1695
|
]);
|
|
1677
|
-
|
|
1696
|
+
ie(() => {
|
|
1678
1697
|
let e = { current: !0 };
|
|
1679
|
-
return (t.objectName || t.dataset) && !
|
|
1698
|
+
return (t.objectName || t.dataset) && !T && !t.data ? Pe(_, e) : e.current && ve(!1), () => {
|
|
1680
1699
|
e.current = !1;
|
|
1681
1700
|
};
|
|
1682
1701
|
}, [
|
|
1683
1702
|
t.objectName,
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1703
|
+
Oe,
|
|
1704
|
+
_,
|
|
1705
|
+
T,
|
|
1687
1706
|
t.data,
|
|
1688
|
-
Te,
|
|
1689
|
-
we,
|
|
1690
1707
|
Ee,
|
|
1691
|
-
|
|
1708
|
+
Te,
|
|
1709
|
+
De,
|
|
1710
|
+
Pe
|
|
1692
1711
|
]);
|
|
1693
|
-
let
|
|
1712
|
+
let Fe = T || t.data || me, M = Array.isArray(Fe) ? Fe : [], N = t.drillDown, P = t.aggregate?.groupBy || t.xAxisKey, F = v(() => {
|
|
1694
1713
|
if (!P) return /* @__PURE__ */ new Map();
|
|
1695
1714
|
let e = /* @__PURE__ */ new Map(), t = `__raw_${P}`;
|
|
1696
1715
|
for (let n of M) {
|
|
@@ -1700,50 +1719,64 @@ var Ft = (e) => {
|
|
|
1700
1719
|
e.set(String(r), i);
|
|
1701
1720
|
}
|
|
1702
1721
|
return e;
|
|
1703
|
-
}, [M, P]),
|
|
1722
|
+
}, [M, P]), Ie = v(() => {
|
|
1723
|
+
if (A) return {
|
|
1724
|
+
...t.filter || {},
|
|
1725
|
+
...a(N, A, { groupByField: P })
|
|
1726
|
+
};
|
|
1727
|
+
}, [
|
|
1728
|
+
A,
|
|
1729
|
+
N,
|
|
1730
|
+
P,
|
|
1731
|
+
Ee
|
|
1732
|
+
]), Le = !h && !!A && !!t.objectName && N?.target === "navigate" && !!Ce;
|
|
1733
|
+
ie(() => {
|
|
1734
|
+
Le && (Ce(t.objectName, Ie), j(null));
|
|
1735
|
+
}, [Le]);
|
|
1736
|
+
let B = t.compareTo, V = t.aggregate ? Ft(t.aggregate) : void 0, H = V ? `${V}${It}` : void 0, U = !!B && ke(t.chartType) && !!H && M.some((e) => e[H] != null), W = v(() => {
|
|
1704
1737
|
let e = Array.isArray(t.series) ? t.series : null;
|
|
1705
|
-
if (!
|
|
1706
|
-
let n = e || [{ dataKey:
|
|
1738
|
+
if (!U) return e;
|
|
1739
|
+
let n = e || [{ dataKey: V }], r = {
|
|
1707
1740
|
vsLastWeek: "Previous week",
|
|
1708
1741
|
vsLastMonth: "Previous month",
|
|
1709
1742
|
vsLastQuarter: "Previous quarter",
|
|
1710
1743
|
vsLastYear: "Previous year",
|
|
1711
1744
|
vsYesterday: "Yesterday",
|
|
1712
1745
|
vsPreviousPeriod: "Previous period"
|
|
1713
|
-
}[
|
|
1746
|
+
}[i(B, t.filter)] || "Previous period";
|
|
1714
1747
|
return [...n.map((e) => ({
|
|
1715
1748
|
...e,
|
|
1716
1749
|
variant: e.variant || "current"
|
|
1717
1750
|
})), {
|
|
1718
|
-
dataKey:
|
|
1751
|
+
dataKey: H,
|
|
1719
1752
|
label: r,
|
|
1720
1753
|
variant: "comparison"
|
|
1721
1754
|
}];
|
|
1722
1755
|
}, [
|
|
1723
|
-
|
|
1756
|
+
U,
|
|
1724
1757
|
t.series,
|
|
1725
|
-
|
|
1726
|
-
|
|
1758
|
+
V,
|
|
1759
|
+
H,
|
|
1727
1760
|
t.filter,
|
|
1728
|
-
|
|
1729
|
-
]),
|
|
1761
|
+
B
|
|
1762
|
+
]), Ue = t.dataset ? n(f(M, je), t.dimensions, t.values, he, { nullCategoryLabel: we("chart.nullCategory", "(None)") }) : null, We = Ue ? {
|
|
1730
1763
|
...t,
|
|
1731
|
-
data:
|
|
1732
|
-
xAxisKey:
|
|
1733
|
-
series:
|
|
1764
|
+
data: Ue.data,
|
|
1765
|
+
xAxisKey: Ue.xAxisKey,
|
|
1766
|
+
series: Ue.series
|
|
1734
1767
|
} : {
|
|
1735
1768
|
...t,
|
|
1736
1769
|
data: M,
|
|
1737
|
-
...
|
|
1738
|
-
},
|
|
1739
|
-
...
|
|
1740
|
-
...
|
|
1741
|
-
} : void 0,
|
|
1742
|
-
...
|
|
1743
|
-
colors:
|
|
1744
|
-
...
|
|
1770
|
+
...W ? { series: W } : {}
|
|
1771
|
+
}, Ge = t.colors && !Array.isArray(t.colors) && typeof t.colors == "object" ? t.colors : null, Ke = Array.isArray(t.colors) ? t.colors : void 0, G = Ae || Ge ? {
|
|
1772
|
+
...Ae || {},
|
|
1773
|
+
...Ge || {}
|
|
1774
|
+
} : void 0, qe = {
|
|
1775
|
+
...We,
|
|
1776
|
+
colors: Ke,
|
|
1777
|
+
...G ? { categoryColors: G } : {}
|
|
1745
1778
|
};
|
|
1746
|
-
if (
|
|
1779
|
+
if (_e && M.length === 0) return /* @__PURE__ */ D("div", {
|
|
1747
1780
|
className: "p-2 " + (t.className || ""),
|
|
1748
1781
|
"data-testid": "chart-loading",
|
|
1749
1782
|
role: "status",
|
|
@@ -1752,25 +1785,25 @@ var Ft = (e) => {
|
|
|
1752
1785
|
children: [/* @__PURE__ */ E("span", {
|
|
1753
1786
|
className: "sr-only",
|
|
1754
1787
|
children: "Loading chart data…"
|
|
1755
|
-
}), /* @__PURE__ */ E(
|
|
1788
|
+
}), /* @__PURE__ */ E(S, { className: "h-full" })]
|
|
1756
1789
|
});
|
|
1757
|
-
if (
|
|
1790
|
+
if (ye) return /* @__PURE__ */ D("div", {
|
|
1758
1791
|
className: "flex flex-col items-center justify-center gap-2 p-4 " + (t.className || ""),
|
|
1759
1792
|
"data-testid": "chart-error",
|
|
1760
1793
|
role: "alert",
|
|
1761
1794
|
children: [
|
|
1762
|
-
/* @__PURE__ */ E(
|
|
1795
|
+
/* @__PURE__ */ E(He, { className: "h-6 w-6 text-destructive opacity-60" }),
|
|
1763
1796
|
/* @__PURE__ */ E("p", {
|
|
1764
1797
|
className: "text-xs text-destructive font-medium",
|
|
1765
1798
|
children: "Failed to load chart data"
|
|
1766
1799
|
}),
|
|
1767
1800
|
/* @__PURE__ */ E("p", {
|
|
1768
1801
|
className: "text-xs text-muted-foreground max-w-xs text-center",
|
|
1769
|
-
children:
|
|
1802
|
+
children: ye
|
|
1770
1803
|
})
|
|
1771
1804
|
]
|
|
1772
1805
|
});
|
|
1773
|
-
if (!
|
|
1806
|
+
if (!_ && t.objectName && M.length === 0) return /* @__PURE__ */ D("div", {
|
|
1774
1807
|
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (t.className || ""),
|
|
1775
1808
|
"data-testid": "chart-no-datasource",
|
|
1776
1809
|
children: [
|
|
@@ -1779,69 +1812,66 @@ var Ft = (e) => {
|
|
|
1779
1812
|
"”"
|
|
1780
1813
|
]
|
|
1781
1814
|
});
|
|
1782
|
-
let
|
|
1815
|
+
let Je = l(N) ? (e) => {
|
|
1783
1816
|
let t = e.category, n = t != null && F.has(String(t)) ? F.get(String(t)) : t;
|
|
1784
|
-
|
|
1817
|
+
j({
|
|
1785
1818
|
...e,
|
|
1786
1819
|
category: n,
|
|
1787
1820
|
categoryLabel: t,
|
|
1788
1821
|
scope: "cell"
|
|
1789
1822
|
});
|
|
1790
|
-
} : void 0,
|
|
1791
|
-
let e =
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1823
|
+
} : void 0, Ye = h ?? Je, Xe = !h && A && t.objectName && !Le ? (() => {
|
|
1824
|
+
let e = Ie ?? {}, n = ee(N, A, t.title || "Details"), r = N?.target ?? "drawer", i = {
|
|
1825
|
+
type: "object-data-table",
|
|
1826
|
+
objectName: t.objectName,
|
|
1827
|
+
filter: e,
|
|
1828
|
+
pagination: !0,
|
|
1829
|
+
pageSize: N?.maxRows,
|
|
1830
|
+
columns: N?.columns?.map((e) => ({
|
|
1831
|
+
accessorKey: e,
|
|
1832
|
+
header: e
|
|
1833
|
+
})),
|
|
1834
|
+
drillDown: {
|
|
1835
|
+
enabled: !0,
|
|
1836
|
+
mode: "record",
|
|
1837
|
+
target: "dialog"
|
|
1838
|
+
}
|
|
1839
|
+
}, a = /* @__PURE__ */ E("div", {
|
|
1795
1840
|
className: "overflow-auto",
|
|
1796
1841
|
"data-testid": "chart-drill-body",
|
|
1797
|
-
children: /* @__PURE__ */ E(
|
|
1798
|
-
schema:
|
|
1799
|
-
|
|
1800
|
-
objectName: t.objectName,
|
|
1801
|
-
filter: n,
|
|
1802
|
-
pagination: !0,
|
|
1803
|
-
pageSize: N?.maxRows,
|
|
1804
|
-
columns: N?.columns?.map((e) => ({
|
|
1805
|
-
accessorKey: e,
|
|
1806
|
-
header: e
|
|
1807
|
-
})),
|
|
1808
|
-
drillDown: {
|
|
1809
|
-
enabled: !0,
|
|
1810
|
-
mode: "record",
|
|
1811
|
-
target: "dialog"
|
|
1812
|
-
}
|
|
1813
|
-
},
|
|
1814
|
-
dataSource: g
|
|
1842
|
+
children: /* @__PURE__ */ E(Re, {
|
|
1843
|
+
schema: i,
|
|
1844
|
+
dataSource: _
|
|
1815
1845
|
})
|
|
1816
|
-
}),
|
|
1846
|
+
}), o = Ce && t.objectName ? /* @__PURE__ */ D(x, {
|
|
1817
1847
|
type: "button",
|
|
1818
1848
|
variant: "ghost",
|
|
1819
1849
|
size: "sm",
|
|
1820
1850
|
"data-testid": "drill-open-in-list",
|
|
1821
1851
|
onClick: () => {
|
|
1822
|
-
|
|
1852
|
+
Ce(t.objectName, e), j(null);
|
|
1823
1853
|
},
|
|
1824
|
-
children: [
|
|
1854
|
+
children: [we("dashboard.openInList", "Open in list"), /* @__PURE__ */ E(L, { className: "ml-1 h-3.5 w-3.5" })]
|
|
1825
1855
|
}) : null;
|
|
1826
|
-
return
|
|
1856
|
+
return r === "dialog" ? /* @__PURE__ */ E(C, {
|
|
1827
1857
|
open: !0,
|
|
1828
|
-
onOpenChange: (e) => !e &&
|
|
1829
|
-
children: /* @__PURE__ */ D(
|
|
1858
|
+
onOpenChange: (e) => !e && j(null),
|
|
1859
|
+
children: /* @__PURE__ */ D(w, {
|
|
1830
1860
|
className: "max-w-4xl",
|
|
1831
|
-
children: [/* @__PURE__ */ D(
|
|
1861
|
+
children: [/* @__PURE__ */ D(ae, {
|
|
1832
1862
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1833
|
-
children: [/* @__PURE__ */ E(
|
|
1863
|
+
children: [/* @__PURE__ */ E(oe, { children: n }), o]
|
|
1834
1864
|
}), a]
|
|
1835
1865
|
})
|
|
1836
|
-
}) : /* @__PURE__ */ E(
|
|
1866
|
+
}) : /* @__PURE__ */ E(ce, {
|
|
1837
1867
|
open: !0,
|
|
1838
|
-
onOpenChange: (e) => !e &&
|
|
1839
|
-
children: /* @__PURE__ */ D(
|
|
1868
|
+
onOpenChange: (e) => !e && j(null),
|
|
1869
|
+
children: /* @__PURE__ */ D(le, {
|
|
1840
1870
|
side: "right",
|
|
1841
1871
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1842
|
-
children: [/* @__PURE__ */ D(
|
|
1872
|
+
children: [/* @__PURE__ */ D(ue, {
|
|
1843
1873
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1844
|
-
children: [/* @__PURE__ */ E(
|
|
1874
|
+
children: [/* @__PURE__ */ E(de, { children: n }), o]
|
|
1845
1875
|
}), /* @__PURE__ */ E("div", {
|
|
1846
1876
|
className: "flex-1 overflow-hidden mt-2",
|
|
1847
1877
|
children: a
|
|
@@ -1852,17 +1882,29 @@ var Ft = (e) => {
|
|
|
1852
1882
|
return /* @__PURE__ */ D("div", {
|
|
1853
1883
|
className: "relative",
|
|
1854
1884
|
children: [
|
|
1855
|
-
/* @__PURE__ */ E(
|
|
1885
|
+
/* @__PURE__ */ E(se, { active: _e && M.length > 0 }),
|
|
1856
1886
|
/* @__PURE__ */ E($, {
|
|
1857
1887
|
...e,
|
|
1858
|
-
schema:
|
|
1859
|
-
onChartClick:
|
|
1888
|
+
schema: qe,
|
|
1889
|
+
onChartClick: Ye
|
|
1860
1890
|
}),
|
|
1861
|
-
|
|
1891
|
+
Xe
|
|
1862
1892
|
]
|
|
1863
1893
|
});
|
|
1864
|
-
}
|
|
1865
|
-
e.
|
|
1894
|
+
}, Bt = { filter: !0 }, Vt = (e) => /* @__PURE__ */ E(Le, {
|
|
1895
|
+
schema: e.schema,
|
|
1896
|
+
mapping: Bt,
|
|
1897
|
+
dataSource: e.dataSource,
|
|
1898
|
+
testId: "object-chart",
|
|
1899
|
+
errorTitle: "This chart’s data source could not be resolved",
|
|
1900
|
+
children: (t) => /* @__PURE__ */ E(zt, {
|
|
1901
|
+
...e,
|
|
1902
|
+
schema: t
|
|
1903
|
+
})
|
|
1904
|
+
});
|
|
1905
|
+
//#endregion
|
|
1906
|
+
//#region src/index.tsx
|
|
1907
|
+
e.register("object-chart", Vt, {
|
|
1866
1908
|
namespace: "plugin-charts",
|
|
1867
1909
|
label: "Object Chart",
|
|
1868
1910
|
category: "view",
|
|
@@ -1889,16 +1931,20 @@ e.register("object-chart", Ft, {
|
|
|
1889
1931
|
type: "object",
|
|
1890
1932
|
label: "Aggregate",
|
|
1891
1933
|
description: "Aggregation config: { field, function, groupBy }"
|
|
1934
|
+
},
|
|
1935
|
+
{
|
|
1936
|
+
name: "drillDown",
|
|
1937
|
+
type: "object",
|
|
1938
|
+
label: "Drill-down",
|
|
1939
|
+
description: "Segment drill config: { enabled?, filter?, title?, target?: 'drawer' | 'dialog', columns?, maxRows? }. Present = on; {} is enough. Clicking a segment opens the underlying records filtered by the clicked category."
|
|
1892
1940
|
}
|
|
1893
1941
|
]
|
|
1894
|
-
});
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
var It = {
|
|
1898
|
-
"bar-chart": kt,
|
|
1942
|
+
}), $e();
|
|
1943
|
+
var Ht = {
|
|
1944
|
+
"bar-chart": Nt,
|
|
1899
1945
|
chart: $
|
|
1900
1946
|
};
|
|
1901
|
-
e.register("bar-chart",
|
|
1947
|
+
e.register("bar-chart", Nt, {
|
|
1902
1948
|
namespace: "plugin-charts",
|
|
1903
1949
|
label: "Bar Chart",
|
|
1904
1950
|
category: "plugin",
|
|
@@ -1962,7 +2008,7 @@ e.register("bar-chart", kt, {
|
|
|
1962
2008
|
height: 400,
|
|
1963
2009
|
color: "#8884d8"
|
|
1964
2010
|
}
|
|
1965
|
-
}), e.register("chart",
|
|
2011
|
+
}), e.register("chart", Vt, {
|
|
1966
2012
|
namespace: "view",
|
|
1967
2013
|
category: "view",
|
|
1968
2014
|
label: "Chart",
|
|
@@ -2129,4 +2175,4 @@ e.register("bar-chart", kt, {
|
|
|
2129
2175
|
defaultProps: { chartType: "scatter" }
|
|
2130
2176
|
});
|
|
2131
2177
|
//#endregion
|
|
2132
|
-
export {
|
|
2178
|
+
export { Nt as ChartBarRenderer, $ as ChartRenderer, zt as ObjectChart, Vt as ObjectChartBlock, Ht as chartComponents, We as normalizeChartSchema };
|