@object-ui/plugin-charts 17.1.0 → 17.2.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 +96 -0
- package/dist/AdvancedChartImpl.d.ts +2 -2
- package/dist/ChartContainerImpl.d.ts +19 -3
- package/dist/index.js +426 -426
- package/dist/index.umd.cjs +2 -2
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildCategoryRank as t, buildChartSeries as n, buildDimensionLabelMap as r, buildOptionColorMap as i, compareToTrendLabelKey as a, computeDrillFilter as o, extractRecords as s, isDrillEnabled as c, relabelDimensions as l, resolveContextTokens as u, resolveDrillTitle as d, resolveFilterPlaceholders as f, shiftFilterByCompareTo as p } from "@object-ui/core";
|
|
2
2
|
import * as m from "react";
|
|
3
3
|
import h, { Suspense as g, useCallback as ee, useContext as te, useEffect as ne, useMemo as _, useRef as re, useState as v } from "react";
|
|
4
|
-
import { Button as ie, ChartSkeleton as y, Dialog as ae, DialogContent as b, DialogHeader as x, DialogTitle as S, RefreshIndicator as C, Sheet as oe, SheetContent as se, SheetHeader as ce, SheetTitle as le, Skeleton as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { Area as
|
|
7
|
-
import { SchemaRenderer as
|
|
8
|
-
import { AlertCircle as
|
|
9
|
-
import { useSafeFieldLabel as
|
|
4
|
+
import { Button as ie, ChartSkeleton as y, Dialog as ae, DialogContent as b, DialogHeader as x, DialogTitle as S, RefreshIndicator as C, Sheet as oe, SheetContent as se, SheetHeader as ce, SheetTitle as le, Skeleton as w } from "@object-ui/components";
|
|
5
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
6
|
+
import { Area as ue, AreaChart as de, Bar as fe, BarChart as O, Brush as pe, CartesianGrid as me, Cell as k, ComposedChart as he, Funnel as ge, FunnelChart as _e, LabelList as ve, Legend as A, Line as ye, LineChart as be, Pie as xe, PieChart as Se, PolarAngleAxis as Ce, PolarGrid as we, PolarRadiusAxis as Te, Radar as Ee, RadarChart as De, ReferenceArea as Oe, ReferenceLine as ke, ResponsiveContainer as j, Sankey as Ae, Scatter as je, ScatterChart as M, Tooltip as N, Treemap as P, XAxis as F, YAxis as I, ZAxis as Me } from "recharts";
|
|
7
|
+
import { SchemaRenderer as Ne, SchemaRendererContext as Pe, useDataScope as Fe, useDrillNavigation as Ie, useFilterScope as Le } from "@object-ui/react";
|
|
8
|
+
import { AlertCircle as Re, ArrowUpRight as ze } from "lucide-react";
|
|
9
|
+
import { useSafeFieldLabel as Be, useSafeTranslate as L } from "@object-ui/i18n";
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
|
-
var
|
|
11
|
+
var R = Object.defineProperty, z = (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
|
+
}, B = (e, t) => {
|
|
19
19
|
let n = {};
|
|
20
|
-
for (var r in e)
|
|
20
|
+
for (var r in e) R(n, r, {
|
|
21
21
|
get: e[r],
|
|
22
22
|
enumerable: !0
|
|
23
23
|
});
|
|
24
|
-
return t ||
|
|
24
|
+
return t || R(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/normalizeChartSchema.ts
|
|
28
|
-
function
|
|
29
|
-
let t =
|
|
28
|
+
function V(e) {
|
|
29
|
+
let t = G(e);
|
|
30
30
|
if (t) return t;
|
|
31
|
-
if (
|
|
31
|
+
if (W(e)) return Object.values(e).find((e) => typeof e == "string" && e);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
if (!
|
|
35
|
-
let t = {}, n =
|
|
33
|
+
function H(e) {
|
|
34
|
+
if (!W(e)) return;
|
|
35
|
+
let t = {}, n = G(e.field);
|
|
36
36
|
n && (t.field = n);
|
|
37
|
-
let r =
|
|
37
|
+
let r = G(e.format);
|
|
38
38
|
r && (t.format = r);
|
|
39
|
-
let i =
|
|
39
|
+
let i = K(e.min);
|
|
40
40
|
i !== void 0 && (t.min = i);
|
|
41
|
-
let a =
|
|
41
|
+
let a = K(e.max);
|
|
42
42
|
a !== void 0 && (t.max = a);
|
|
43
|
-
let o =
|
|
43
|
+
let o = K(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 = G(e.position);
|
|
46
46
|
(s === "left" || s === "right" || s === "top" || s === "bottom") && (t.position = s);
|
|
47
|
-
let c =
|
|
47
|
+
let c = V(e.title);
|
|
48
48
|
return c && (t.title = c), t;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
if (!
|
|
52
|
-
let t =
|
|
50
|
+
function U(e) {
|
|
51
|
+
if (!W(e)) {
|
|
52
|
+
let t = G(e);
|
|
53
53
|
return t ? { dataKey: t } : void 0;
|
|
54
54
|
}
|
|
55
|
-
let t =
|
|
55
|
+
let t = G(e.dataKey) ?? G(e.name);
|
|
56
56
|
if (!t) return;
|
|
57
|
-
let n = { dataKey: t }, r =
|
|
57
|
+
let n = { dataKey: t }, r = V(e.label);
|
|
58
58
|
r && (n.label = r);
|
|
59
|
-
let i =
|
|
59
|
+
let i = G(e.chartType) ?? G(e.type);
|
|
60
60
|
(i === "bar" || i === "line" || i === "area") && (n.chartType = i);
|
|
61
|
-
let a =
|
|
61
|
+
let a = G(e.variant);
|
|
62
62
|
(a === "comparison" || a === "current" || a === "primary") && (n.variant = a);
|
|
63
|
-
let o =
|
|
63
|
+
let o = K(e.opacity);
|
|
64
64
|
o !== void 0 && (n.opacity = o);
|
|
65
|
-
let s =
|
|
65
|
+
let s = G(e.dashArray);
|
|
66
66
|
s && (n.dashArray = s);
|
|
67
|
-
let c =
|
|
67
|
+
let c = G(e.stack);
|
|
68
68
|
c && (n.stack = c);
|
|
69
|
-
let l =
|
|
69
|
+
let l = G(e.yAxis);
|
|
70
70
|
(l === "left" || l === "right") && (n.yAxis = l);
|
|
71
|
-
let u =
|
|
71
|
+
let u = G(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 Ve(e) {
|
|
75
|
+
if (!W(e)) return {};
|
|
76
|
+
let t = {}, n = G(e.type), r = G(e.chartType) ?? G(e.specType) ?? (n && Xe.has(n) ? n : void 0);
|
|
77
|
+
r && qe.has(r) && (t.chartType = r);
|
|
78
|
+
let i = e.xAxis, a = H(i);
|
|
79
79
|
a && (a.format || a.title || a.showGridLines !== void 0) && (t.xAxis = a);
|
|
80
|
-
let o =
|
|
80
|
+
let o = G(e.xAxisKey) ?? a?.field ?? G(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) => H(e) ?? (G(e) ? { field: G(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(U).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 Ue(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 = V(e.title);
|
|
95
95
|
l && (t.title = l);
|
|
96
|
-
let u =
|
|
96
|
+
let u = V(e.subtitle);
|
|
97
97
|
u && (t.subtitle = u);
|
|
98
|
-
let d =
|
|
98
|
+
let d = V(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 = K(e.height);
|
|
101
|
+
return f !== void 0 && f > 0 && (t.height = f), Array.isArray(e.annotations) && e.annotations.length && (t.annotations = e.annotations.filter(W)), W(e.interaction) && (t.interaction = e.interaction), t;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function He(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 Ue(e, t) {
|
|
109
109
|
if (e === "combo") return "combo";
|
|
110
|
-
let n =
|
|
110
|
+
let n = He(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 We(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 H(e) {
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function Ge(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 > Ze) 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 Ke(e) {
|
|
152
152
|
if (!e) return;
|
|
153
153
|
let { min: t, max: n } = e;
|
|
154
154
|
if (!(t === void 0 && n === void 0)) return [t ?? "auto", n ?? "auto"];
|
|
155
155
|
}
|
|
156
|
-
var Je, Ye, Xe,
|
|
157
|
-
|
|
156
|
+
var qe, Je, Ye, Xe, W, G, K, Ze, Qe = z((() => {
|
|
157
|
+
qe = /* @__PURE__ */ new Set([
|
|
158
158
|
"bar",
|
|
159
159
|
"column",
|
|
160
160
|
"horizontal-bar",
|
|
@@ -168,44 +168,44 @@ var Je, Ye, Xe, Ze, U, W, G, Qe, $e = L((() => {
|
|
|
168
168
|
"treemap",
|
|
169
169
|
"sankey",
|
|
170
170
|
"combo"
|
|
171
|
-
]),
|
|
171
|
+
]), Je = /* @__PURE__ */ new Set([
|
|
172
172
|
"gauge",
|
|
173
173
|
"solid-gauge",
|
|
174
174
|
"metric",
|
|
175
175
|
"kpi",
|
|
176
176
|
"bullet"
|
|
177
|
-
]),
|
|
177
|
+
]), Ye = /* @__PURE__ */ new Set(["table", "pivot"]), Xe = /* @__PURE__ */ new Set([
|
|
178
|
+
...qe,
|
|
178
179
|
...Je,
|
|
179
|
-
...Ye
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
function tt(e, t = 14) {
|
|
180
|
+
...Ye
|
|
181
|
+
]), W = (e) => !!e && typeof e == "object" && !Array.isArray(e), G = (e) => typeof e == "string" && e ? e : void 0, K = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, Ze = 200;
|
|
182
|
+
})), $e = /* @__PURE__ */ B({ default: () => tt });
|
|
183
|
+
function et(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 =
|
|
188
|
-
return /* @__PURE__ */
|
|
186
|
+
function q({ x: e, y: t, payload: n }) {
|
|
187
|
+
let r = String(n?.value ?? ""), i = et(r);
|
|
188
|
+
return /* @__PURE__ */ E("g", {
|
|
189
189
|
transform: `translate(${e},${t})`,
|
|
190
|
-
children: /* @__PURE__ */
|
|
190
|
+
children: /* @__PURE__ */ D("text", {
|
|
191
191
|
dy: 10,
|
|
192
192
|
textAnchor: "end",
|
|
193
193
|
transform: "rotate(-32)",
|
|
194
194
|
fill: "hsl(var(--muted-foreground))",
|
|
195
195
|
fontSize: 11,
|
|
196
196
|
fontFamily: "monospace",
|
|
197
|
-
children: [r !== i && /* @__PURE__ */
|
|
197
|
+
children: [r !== i && /* @__PURE__ */ E("title", { children: r }), i]
|
|
198
198
|
})
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function tt({ 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
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
205
|
+
children: /* @__PURE__ */ E(j, {
|
|
206
206
|
width: "100%",
|
|
207
207
|
height: r,
|
|
208
|
-
children: /* @__PURE__ */
|
|
208
|
+
children: /* @__PURE__ */ D(O, {
|
|
209
209
|
data: e,
|
|
210
210
|
margin: {
|
|
211
211
|
top: 10,
|
|
@@ -214,66 +214,66 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
214
214
|
bottom: s ? 24 : 5
|
|
215
215
|
},
|
|
216
216
|
children: [
|
|
217
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ D("defs", { children: [/* @__PURE__ */ D("linearGradient", {
|
|
218
218
|
id: "barGradient",
|
|
219
219
|
x1: "0",
|
|
220
220
|
y1: "0",
|
|
221
221
|
x2: "0",
|
|
222
222
|
y2: "1",
|
|
223
223
|
children: [
|
|
224
|
-
/* @__PURE__ */
|
|
224
|
+
/* @__PURE__ */ E("stop", {
|
|
225
225
|
offset: "0%",
|
|
226
226
|
stopColor: a,
|
|
227
227
|
stopOpacity: 1
|
|
228
228
|
}),
|
|
229
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ E("stop", {
|
|
230
230
|
offset: "90%",
|
|
231
231
|
stopColor: a,
|
|
232
232
|
stopOpacity: .6
|
|
233
233
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ E("stop", {
|
|
235
235
|
offset: "100%",
|
|
236
236
|
stopColor: a,
|
|
237
237
|
stopOpacity: .3
|
|
238
238
|
})
|
|
239
239
|
]
|
|
240
|
-
}), /* @__PURE__ */
|
|
240
|
+
}), /* @__PURE__ */ D("filter", {
|
|
241
241
|
id: "glow",
|
|
242
242
|
height: "130%",
|
|
243
243
|
children: [
|
|
244
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ E("feGaussianBlur", {
|
|
245
245
|
in: "SourceAlpha",
|
|
246
246
|
stdDeviation: "3",
|
|
247
247
|
result: "blur"
|
|
248
248
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ E("feOffset", {
|
|
250
250
|
in: "blur",
|
|
251
251
|
dx: "0",
|
|
252
252
|
dy: "0",
|
|
253
253
|
result: "offsetBlur"
|
|
254
254
|
}),
|
|
255
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ E("feFlood", {
|
|
256
256
|
floodColor: a,
|
|
257
257
|
floodOpacity: "0.5",
|
|
258
258
|
result: "offsetColor"
|
|
259
259
|
}),
|
|
260
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ E("feComposite", {
|
|
261
261
|
in: "offsetColor",
|
|
262
262
|
in2: "offsetBlur",
|
|
263
263
|
operator: "in",
|
|
264
264
|
result: "offsetBlur"
|
|
265
265
|
}),
|
|
266
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ D("feMerge", { children: [/* @__PURE__ */ E("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ E("feMergeNode", { in: "SourceGraphic" })] })
|
|
267
267
|
]
|
|
268
268
|
})] }),
|
|
269
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ E(me, {
|
|
270
270
|
strokeDasharray: "3 3",
|
|
271
271
|
stroke: "hsl(var(--border))",
|
|
272
272
|
vertical: !1
|
|
273
273
|
}),
|
|
274
|
-
/* @__PURE__ */
|
|
274
|
+
/* @__PURE__ */ E(F, {
|
|
275
275
|
dataKey: n,
|
|
276
|
-
tick: s ? /* @__PURE__ */
|
|
276
|
+
tick: s ? /* @__PURE__ */ E(q, {}) : {
|
|
277
277
|
fill: "hsl(var(--muted-foreground))",
|
|
278
278
|
fontSize: 12,
|
|
279
279
|
fontFamily: "monospace"
|
|
@@ -284,7 +284,7 @@ function nt({ 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__ */
|
|
287
|
+
/* @__PURE__ */ E(I, {
|
|
288
288
|
tick: {
|
|
289
289
|
fill: "hsl(var(--muted-foreground))",
|
|
290
290
|
fontSize: 12,
|
|
@@ -293,7 +293,7 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
293
293
|
tickLine: !1,
|
|
294
294
|
axisLine: !1
|
|
295
295
|
}),
|
|
296
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ E(N, {
|
|
297
297
|
cursor: {
|
|
298
298
|
fill: "hsl(var(--muted))",
|
|
299
299
|
opacity: .2
|
|
@@ -308,11 +308,11 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
308
308
|
},
|
|
309
309
|
itemStyle: { color: "hsl(var(--primary))" }
|
|
310
310
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
311
|
+
/* @__PURE__ */ E(A, { wrapperStyle: {
|
|
312
312
|
paddingTop: "20px",
|
|
313
313
|
fontFamily: "monospace"
|
|
314
314
|
} }),
|
|
315
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ E(fe, {
|
|
316
316
|
dataKey: t,
|
|
317
317
|
fill: "url(#barGradient)",
|
|
318
318
|
radius: [
|
|
@@ -329,15 +329,15 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
329
329
|
})
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
|
-
var
|
|
332
|
+
var nt = z((() => {}));
|
|
333
333
|
//#endregion
|
|
334
334
|
//#region src/ChartContainerImpl.tsx
|
|
335
|
-
function
|
|
336
|
-
let e = m.useContext(
|
|
335
|
+
function rt() {
|
|
336
|
+
let e = m.useContext(st);
|
|
337
337
|
if (!e) throw Error("useChart must be used within a <ChartContainer />");
|
|
338
338
|
return e;
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function J({ id: e, className: t, children: n, config: r, disableSettleRemount: i, ...a }) {
|
|
341
341
|
let o = m.useId(), s = `chart-${e || o.replace(/:/g, "")}`, c = m.useRef(null), [l, u] = m.useState(0);
|
|
342
342
|
return m.useEffect(() => {
|
|
343
343
|
if (i) return;
|
|
@@ -353,23 +353,23 @@ function q({ id: e, className: t, children: n, config: r, disableSettleRemount:
|
|
|
353
353
|
return r.observe(e), () => {
|
|
354
354
|
t = !0, n != null && clearTimeout(n), r.disconnect();
|
|
355
355
|
};
|
|
356
|
-
}, [i]), /* @__PURE__ */
|
|
356
|
+
}, [i]), /* @__PURE__ */ E(st.Provider, {
|
|
357
357
|
value: { config: r },
|
|
358
|
-
children: /* @__PURE__ */
|
|
358
|
+
children: /* @__PURE__ */ D("div", {
|
|
359
359
|
ref: c,
|
|
360
360
|
"data-slot": "chart",
|
|
361
361
|
"data-chart": s,
|
|
362
|
-
className:
|
|
362
|
+
className: Y("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
|
|
363
363
|
style: {
|
|
364
364
|
minHeight: 280,
|
|
365
365
|
minWidth: 0,
|
|
366
366
|
...a.style
|
|
367
367
|
},
|
|
368
368
|
...a,
|
|
369
|
-
children: [/* @__PURE__ */
|
|
369
|
+
children: [/* @__PURE__ */ E(ct, {
|
|
370
370
|
id: s,
|
|
371
371
|
config: r
|
|
372
|
-
}), /* @__PURE__ */
|
|
372
|
+
}), /* @__PURE__ */ E(j, {
|
|
373
373
|
width: "100%",
|
|
374
374
|
height: "100%",
|
|
375
375
|
children: n
|
|
@@ -377,15 +377,15 @@ function q({ id: e, className: t, children: n, config: r, disableSettleRemount:
|
|
|
377
377
|
})
|
|
378
378
|
});
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
let { config: p } =
|
|
380
|
+
function it({ 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 }) {
|
|
381
|
+
let { config: p } = rt(), h = m.useMemo(() => {
|
|
382
382
|
if (i || !t?.length) return null;
|
|
383
|
-
let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r =
|
|
384
|
-
return s ? /* @__PURE__ */
|
|
385
|
-
className:
|
|
383
|
+
let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = ot(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
|
|
384
|
+
return s ? /* @__PURE__ */ E("div", {
|
|
385
|
+
className: Y("font-medium", c),
|
|
386
386
|
children: s(a, t)
|
|
387
|
-
}) : a ? /* @__PURE__ */
|
|
388
|
-
className:
|
|
387
|
+
}) : a ? /* @__PURE__ */ E("div", {
|
|
388
|
+
className: Y("font-medium", c),
|
|
389
389
|
children: a
|
|
390
390
|
}) : null;
|
|
391
391
|
}, [
|
|
@@ -399,29 +399,29 @@ function at({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
|
|
|
399
399
|
]);
|
|
400
400
|
if (!e || !t?.length) return null;
|
|
401
401
|
let g = t.length === 1 && r !== "dot";
|
|
402
|
-
return /* @__PURE__ */
|
|
403
|
-
className:
|
|
404
|
-
children: [g ? null : h, /* @__PURE__ */
|
|
402
|
+
return /* @__PURE__ */ D("div", {
|
|
403
|
+
className: Y("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),
|
|
404
|
+
children: [g ? null : h, /* @__PURE__ */ E("div", {
|
|
405
405
|
className: "grid gap-1.5",
|
|
406
406
|
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
407
|
-
let n = `${d || e.name || e.dataKey || "value"}`, i =
|
|
408
|
-
return /* @__PURE__ */
|
|
409
|
-
className:
|
|
410
|
-
children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */
|
|
411
|
-
className:
|
|
407
|
+
let n = `${d || e.name || e.dataKey || "value"}`, i = ot(p, e, n), o = u || e.payload.fill || e.color;
|
|
408
|
+
return /* @__PURE__ */ E("div", {
|
|
409
|
+
className: Y("[&>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
|
+
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: Y("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" : "", g && r === "dashed" ? "my-0.5" : ""),
|
|
412
412
|
style: {
|
|
413
413
|
"--color-bg": o,
|
|
414
414
|
"--color-border": o
|
|
415
415
|
}
|
|
416
|
-
}), /* @__PURE__ */
|
|
417
|
-
className:
|
|
418
|
-
children: [/* @__PURE__ */
|
|
416
|
+
}), /* @__PURE__ */ D("div", {
|
|
417
|
+
className: Y("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
|
|
418
|
+
children: [/* @__PURE__ */ D("div", {
|
|
419
419
|
className: "grid gap-1.5",
|
|
420
|
-
children: [g ? h : null, /* @__PURE__ */
|
|
420
|
+
children: [g ? h : null, /* @__PURE__ */ E("span", {
|
|
421
421
|
className: "text-muted-foreground",
|
|
422
422
|
children: i?.label || e.name
|
|
423
423
|
})]
|
|
424
|
-
}), e.value && /* @__PURE__ */
|
|
424
|
+
}), e.value && /* @__PURE__ */ E("span", {
|
|
425
425
|
className: "text-foreground font-mono font-medium tabular-nums",
|
|
426
426
|
children: e.value.toLocaleString()
|
|
427
427
|
})]
|
|
@@ -431,15 +431,15 @@ function at({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
|
|
|
431
431
|
})]
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
let { config: a } =
|
|
436
|
-
return n?.length ? /* @__PURE__ */
|
|
437
|
-
className:
|
|
434
|
+
function at({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
|
|
435
|
+
let { config: a } = rt();
|
|
436
|
+
return n?.length ? /* @__PURE__ */ E("div", {
|
|
437
|
+
className: Y("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
438
438
|
children: n.filter((e) => e.type !== "none").map((e) => {
|
|
439
|
-
let n = `${i || e.dataKey || "value"}`, r =
|
|
440
|
-
return /* @__PURE__ */
|
|
441
|
-
className:
|
|
442
|
-
children: [r?.icon && !t ? /* @__PURE__ */
|
|
439
|
+
let n = `${i || e.dataKey || "value"}`, r = ot(a, e, n);
|
|
440
|
+
return /* @__PURE__ */ D("div", {
|
|
441
|
+
className: Y("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
442
|
+
children: [r?.icon && !t ? /* @__PURE__ */ E(r.icon, {}) : /* @__PURE__ */ E("div", {
|
|
443
443
|
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
444
444
|
style: { backgroundColor: e.color }
|
|
445
445
|
}), r?.label]
|
|
@@ -447,18 +447,18 @@ function ot({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bo
|
|
|
447
447
|
})
|
|
448
448
|
}) : null;
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function ot(e, t, n) {
|
|
451
451
|
if (typeof t != "object" || !t) return;
|
|
452
452
|
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
453
|
-
return n in
|
|
453
|
+
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
454
|
}
|
|
455
|
-
var
|
|
456
|
-
|
|
455
|
+
var Y, X, st, ct, Z, lt, ut = z((() => {
|
|
456
|
+
Y = (...e) => e.filter(Boolean).join(" "), X = {
|
|
457
457
|
light: "",
|
|
458
458
|
dark: ".dark"
|
|
459
|
-
},
|
|
459
|
+
}, st = m.createContext(null), ct = ({ id: e, config: t }) => {
|
|
460
460
|
let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
461
|
-
return n.length ? /* @__PURE__ */
|
|
461
|
+
return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(X).map(([t, r]) => `
|
|
462
462
|
${r} [data-chart=${e}] {
|
|
463
463
|
${n.map(([e, n]) => {
|
|
464
464
|
let r = n.theme?.[t] || n.color;
|
|
@@ -466,7 +466,7 @@ ${n.map(([e, n]) => {
|
|
|
466
466
|
}).join("\n")}
|
|
467
467
|
}
|
|
468
468
|
`).join("\n") } }) : null;
|
|
469
|
-
},
|
|
469
|
+
}, Z = N, lt = A;
|
|
470
470
|
}));
|
|
471
471
|
//#endregion
|
|
472
472
|
//#region src/chartDrillEvents.ts
|
|
@@ -504,10 +504,10 @@ function mt(e, t) {
|
|
|
504
504
|
value: typeof n?.value == "number" ? n.value : void 0
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
|
-
var ht =
|
|
507
|
+
var ht = z((() => {})), gt = /* @__PURE__ */ B({ default: () => xt });
|
|
508
508
|
function _t(e) {
|
|
509
509
|
let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
|
|
510
|
-
return r <= 0 || i <= 0 ? null : /* @__PURE__ */
|
|
510
|
+
return r <= 0 || i <= 0 ? null : /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("rect", {
|
|
511
511
|
x: t,
|
|
512
512
|
y: n,
|
|
513
513
|
width: r,
|
|
@@ -515,7 +515,7 @@ function _t(e) {
|
|
|
515
515
|
fill: o,
|
|
516
516
|
stroke: "hsl(var(--background))",
|
|
517
517
|
strokeWidth: 2
|
|
518
|
-
}), r > 48 && i > 18 ? /* @__PURE__ */
|
|
518
|
+
}), r > 48 && i > 18 ? /* @__PURE__ */ E("text", {
|
|
519
519
|
x: t + 6,
|
|
520
520
|
y: n + 18,
|
|
521
521
|
fill: "#fff",
|
|
@@ -525,25 +525,25 @@ function _t(e) {
|
|
|
525
525
|
}) : null] });
|
|
526
526
|
}
|
|
527
527
|
function vt({ title: e, subtitle: t, children: n }) {
|
|
528
|
-
return !e && !t ? /* @__PURE__ */ T
|
|
528
|
+
return !e && !t ? /* @__PURE__ */ E(T, { children: n }) : /* @__PURE__ */ D("div", {
|
|
529
529
|
className: "flex h-full w-full flex-col",
|
|
530
|
-
children: [/* @__PURE__ */
|
|
530
|
+
children: [/* @__PURE__ */ D("div", {
|
|
531
531
|
className: "mb-2 shrink-0",
|
|
532
|
-
children: [e ? /* @__PURE__ */
|
|
532
|
+
children: [e ? /* @__PURE__ */ E("div", {
|
|
533
533
|
className: "text-sm font-medium leading-tight text-foreground",
|
|
534
534
|
children: e
|
|
535
|
-
}) : null, t ? /* @__PURE__ */
|
|
535
|
+
}) : null, t ? /* @__PURE__ */ E("div", {
|
|
536
536
|
className: "text-xs leading-tight text-muted-foreground",
|
|
537
537
|
children: t
|
|
538
538
|
}) : null]
|
|
539
|
-
}), /* @__PURE__ */
|
|
539
|
+
}), /* @__PURE__ */ E("div", {
|
|
540
540
|
className: "min-h-0 flex-1",
|
|
541
541
|
children: n
|
|
542
542
|
})]
|
|
543
543
|
});
|
|
544
544
|
}
|
|
545
545
|
function yt({ 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: h, showDataLabels: g, title: ee, subtitle: te, description: ne, height: _, annotations: re, interaction: v }) {
|
|
546
|
-
let ie = e === "column" ? "bar" : e, y =
|
|
546
|
+
let ie = e === "column" ? "bar" : e, y = Ue(ie, a), ae = He(ie), b = Array.isArray(n) ? n : [], x = d === !1 ? { isAnimationActive: !1 } : {}, S = {
|
|
547
547
|
...d === !1 ? { disableSettleRemount: !0 } : {},
|
|
548
548
|
..._ ? { style: { height: _ } } : {},
|
|
549
549
|
...ne ? {
|
|
@@ -573,10 +573,10 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
573
573
|
]), le = u ? {
|
|
574
574
|
onClick: se,
|
|
575
575
|
style: { cursor: "pointer" }
|
|
576
|
-
} : {},
|
|
576
|
+
} : {}, w = u ? {
|
|
577
577
|
onClick: ce,
|
|
578
578
|
style: { cursor: "pointer" }
|
|
579
|
-
} : {},
|
|
579
|
+
} : {}, A = m.useCallback((e, t, n) => c && c[e == null ? "" : String(e)] || n[t % n.length], [c]), j = m.useCallback((e) => {
|
|
580
580
|
if (!u) return;
|
|
581
581
|
let t = ft(e, i, a);
|
|
582
582
|
t && u(t);
|
|
@@ -584,42 +584,42 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
584
584
|
u,
|
|
585
585
|
i,
|
|
586
586
|
a
|
|
587
|
-
]),
|
|
587
|
+
]), Ne = m.useCallback((e) => {
|
|
588
588
|
if (!u) return;
|
|
589
589
|
let t = pt(e, a);
|
|
590
590
|
t && u(t);
|
|
591
|
-
}, [u, a]),
|
|
591
|
+
}, [u, a]), Pe = m.useCallback((e) => {
|
|
592
592
|
if (!u) return;
|
|
593
593
|
let t = mt(e, a);
|
|
594
594
|
t && u(t);
|
|
595
|
-
}, [u, a]),
|
|
596
|
-
onClick:
|
|
595
|
+
}, [u, a]), Fe = u ? {
|
|
596
|
+
onClick: j,
|
|
597
597
|
cursor: "pointer"
|
|
598
|
-
} : {},
|
|
599
|
-
onClick:
|
|
598
|
+
} : {}, Ie = u ? {
|
|
599
|
+
onClick: Ne,
|
|
600
600
|
style: { cursor: "pointer" }
|
|
601
|
-
} : {},
|
|
602
|
-
onClick:
|
|
601
|
+
} : {}, Le = u ? {
|
|
602
|
+
onClick: Pe,
|
|
603
603
|
style: { cursor: "pointer" }
|
|
604
604
|
} : {};
|
|
605
605
|
m.useEffect(() => {
|
|
606
606
|
let e = () => oe(window.innerWidth < 640);
|
|
607
607
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
608
608
|
}, []);
|
|
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] ||
|
|
609
|
+
let Re = {
|
|
610
|
+
bar: O,
|
|
611
|
+
"horizontal-bar": O,
|
|
612
|
+
line: be,
|
|
613
|
+
area: de,
|
|
614
|
+
pie: Se,
|
|
615
|
+
donut: Se,
|
|
616
|
+
radar: De,
|
|
617
|
+
scatter: M,
|
|
618
|
+
funnel: _e,
|
|
619
|
+
combo: he,
|
|
620
|
+
treemap: O,
|
|
621
|
+
sankey: O
|
|
622
|
+
}[y] || O, ze = m.useCallback((e) => {
|
|
623
623
|
if (e == null || e === "") return "";
|
|
624
624
|
let t = r?.[String(e)]?.label;
|
|
625
625
|
if (t != null) return String(t);
|
|
@@ -647,13 +647,13 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
647
647
|
i,
|
|
648
648
|
C,
|
|
649
649
|
r
|
|
650
|
-
]),
|
|
650
|
+
]), Be = m.useMemo(() => b.some((e) => String(e[i] || "").length > 5), [b, i]), L = () => Array.isArray(s) && s.length > 0 ? s : [
|
|
651
651
|
"hsl(var(--chart-1))",
|
|
652
652
|
"hsl(var(--chart-2))",
|
|
653
653
|
"hsl(var(--chart-3))",
|
|
654
654
|
"hsl(var(--chart-4))",
|
|
655
655
|
"hsl(var(--chart-5))"
|
|
656
|
-
],
|
|
656
|
+
], R = m.useCallback((e) => {
|
|
657
657
|
if (e == null || e === "") return "";
|
|
658
658
|
let t = typeof e == "number" ? e : Number(e);
|
|
659
659
|
if (!Number.isFinite(t)) return String(e);
|
|
@@ -665,8 +665,8 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
665
665
|
} catch {
|
|
666
666
|
return String(t);
|
|
667
667
|
}
|
|
668
|
-
}, []),
|
|
669
|
-
let t = a.filter((t) =>
|
|
668
|
+
}, []), z = p?.[0], B = p && p.length > 1 ? p[1] : z?.position === "right" ? z : void 0, V = !!p && p.length > 1, H = m.useMemo(() => We(f?.format) ?? ze, [f?.format, ze]), U = m.useMemo(() => We(z?.format) ?? R, [z?.format, R]), Ve = m.useMemo(() => We(B?.format) ?? R, [B?.format, R]), Xe = m.useCallback((e) => {
|
|
669
|
+
let t = a.filter((t) => V ? (t.yAxis === "right" ? "right" : "left") === e : e === "left").map((e) => e.dataKey), n = [];
|
|
670
670
|
for (let e of b) for (let r of t) {
|
|
671
671
|
let t = Number(e?.[r]);
|
|
672
672
|
Number.isFinite(t) && n.push(t);
|
|
@@ -675,10 +675,10 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
675
675
|
}, [
|
|
676
676
|
b,
|
|
677
677
|
a,
|
|
678
|
-
|
|
679
|
-
]),
|
|
678
|
+
V
|
|
679
|
+
]), W = m.useCallback((e, t = "left") => {
|
|
680
680
|
if (!e) return {};
|
|
681
|
-
let n =
|
|
681
|
+
let n = Ke(e), r = Ge(e, Xe(t));
|
|
682
682
|
return {
|
|
683
683
|
...r ? { ticks: r } : {},
|
|
684
684
|
...n ? { domain: n } : {},
|
|
@@ -693,10 +693,10 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
693
693
|
position: "insideLeft"
|
|
694
694
|
} } : {}
|
|
695
695
|
};
|
|
696
|
-
}, [
|
|
696
|
+
}, [Xe]), G = z?.showGridLines !== !1, K = {
|
|
697
697
|
vertical: f?.showGridLines === !0,
|
|
698
|
-
horizontal:
|
|
699
|
-
},
|
|
698
|
+
horizontal: G
|
|
699
|
+
}, Ze = h !== !1, Qe = m.useMemo(() => {
|
|
700
700
|
if (!Array.isArray(re) || re.length === 0) return null;
|
|
701
701
|
let e = {
|
|
702
702
|
solid: void 0,
|
|
@@ -710,7 +710,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
710
710
|
fill: i,
|
|
711
711
|
fontSize: 11
|
|
712
712
|
} } : {};
|
|
713
|
-
return t?.type === "region" ? /* @__PURE__ */
|
|
713
|
+
return t?.type === "region" ? /* @__PURE__ */ E(Oe, {
|
|
714
714
|
...r ? {
|
|
715
715
|
x1: t.value,
|
|
716
716
|
x2: t.endValue
|
|
@@ -718,71 +718,71 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
718
718
|
y1: t.value,
|
|
719
719
|
y2: t.endValue
|
|
720
720
|
},
|
|
721
|
-
...
|
|
721
|
+
...V && !r ? { yAxisId: "left" } : {},
|
|
722
722
|
fill: i,
|
|
723
723
|
fillOpacity: .12,
|
|
724
724
|
stroke: i,
|
|
725
725
|
strokeOpacity: .35,
|
|
726
726
|
...s
|
|
727
|
-
}, `ann-${n}`) : /* @__PURE__ */
|
|
727
|
+
}, `ann-${n}`) : /* @__PURE__ */ E(ke, {
|
|
728
728
|
...r ? { x: t?.value } : { y: t?.value },
|
|
729
|
-
...
|
|
729
|
+
...V && !r ? { yAxisId: "left" } : {},
|
|
730
730
|
stroke: i,
|
|
731
731
|
strokeDasharray: a,
|
|
732
732
|
...s
|
|
733
733
|
}, `ann-${n}`);
|
|
734
734
|
});
|
|
735
|
-
}, [re,
|
|
735
|
+
}, [re, V]), $e = v?.tooltips !== !1, et = v?.brush === !0 ? /* @__PURE__ */ E(pe, {
|
|
736
736
|
dataKey: i,
|
|
737
737
|
height: 24,
|
|
738
738
|
travellerWidth: 8,
|
|
739
739
|
stroke: "hsl(var(--muted-foreground))"
|
|
740
|
-
}) : null,
|
|
740
|
+
}) : null, q = (e) => g ? /* @__PURE__ */ E(ve, {
|
|
741
741
|
position: "top",
|
|
742
742
|
className: "fill-foreground",
|
|
743
743
|
fontSize: 11,
|
|
744
744
|
...e ? { formatter: e } : {}
|
|
745
|
-
}) : null,
|
|
745
|
+
}) : null, tt = m.useMemo(() => ({
|
|
746
746
|
tickLine: !1,
|
|
747
747
|
tickMargin: 10,
|
|
748
748
|
axisLine: !1,
|
|
749
749
|
interval: "preserveStartEnd",
|
|
750
750
|
minTickGap: C ? 32 : 48,
|
|
751
|
-
tickFormatter:
|
|
751
|
+
tickFormatter: H,
|
|
752
752
|
...f?.title ? { label: {
|
|
753
753
|
value: f.title,
|
|
754
754
|
position: "insideBottom",
|
|
755
755
|
offset: -4
|
|
756
756
|
} } : {},
|
|
757
|
-
...!C &&
|
|
757
|
+
...!C && Be && {
|
|
758
758
|
angle: -35,
|
|
759
759
|
textAnchor: "end",
|
|
760
760
|
height: 60
|
|
761
761
|
}
|
|
762
762
|
}), [
|
|
763
763
|
C,
|
|
764
|
-
|
|
765
|
-
|
|
764
|
+
Be,
|
|
765
|
+
H,
|
|
766
766
|
f?.title
|
|
767
767
|
]);
|
|
768
|
-
if (y &&
|
|
768
|
+
if (y && Je.has(y)) {
|
|
769
769
|
let e = a[0]?.dataKey || "value", t = b[0]?.[e], n = typeof t == "number" ? t : Number(t), i = a[0]?.label ?? r?.[e]?.label ?? e;
|
|
770
|
-
return /* @__PURE__ */
|
|
770
|
+
return /* @__PURE__ */ E("div", {
|
|
771
771
|
className: o,
|
|
772
772
|
"data-testid": "advanced-chart-single-value",
|
|
773
|
-
children: /* @__PURE__ */
|
|
773
|
+
children: /* @__PURE__ */ D("div", {
|
|
774
774
|
className: "flex flex-col gap-1 py-4",
|
|
775
|
-
children: [/* @__PURE__ */
|
|
775
|
+
children: [/* @__PURE__ */ E("span", {
|
|
776
776
|
className: "text-3xl font-semibold tabular-nums",
|
|
777
777
|
children: Number.isFinite(n) ? new Intl.NumberFormat().format(n) : String(t ?? "—")
|
|
778
|
-
}), /* @__PURE__ */
|
|
778
|
+
}), /* @__PURE__ */ E("span", {
|
|
779
779
|
className: "text-xs text-muted-foreground",
|
|
780
780
|
children: String(i)
|
|
781
781
|
})]
|
|
782
782
|
})
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
|
-
if (y &&
|
|
785
|
+
if (y && Ye.has(y)) return /* @__PURE__ */ D("div", {
|
|
786
786
|
className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
|
|
787
787
|
"data-testid": "advanced-chart-tabular-notice",
|
|
788
788
|
role: "note",
|
|
@@ -792,7 +792,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
792
792
|
"” is tabular — render it with the data-table / pivot components; a chart block draws series charts."
|
|
793
793
|
]
|
|
794
794
|
});
|
|
795
|
-
if (y && !
|
|
795
|
+
if (y && !qe.has(y)) return /* @__PURE__ */ D("div", {
|
|
796
796
|
className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
|
|
797
797
|
"data-testid": "advanced-chart-unknown-type",
|
|
798
798
|
role: "note",
|
|
@@ -803,25 +803,25 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
803
803
|
]
|
|
804
804
|
});
|
|
805
805
|
if (y === "pie" || y === "donut") {
|
|
806
|
-
let e = y === "donut" ? "52%" : 0, t =
|
|
806
|
+
let e = y === "donut" ? "52%" : 0, t = L(), n = { ...r };
|
|
807
807
|
return b.forEach((e, r) => {
|
|
808
808
|
let a = e?.[i];
|
|
809
809
|
if (a == null || a === "") return;
|
|
810
810
|
let o = String(a);
|
|
811
811
|
n[o] || (n[o] = {
|
|
812
812
|
label: o,
|
|
813
|
-
color:
|
|
813
|
+
color: A(a, r, t)
|
|
814
814
|
});
|
|
815
|
-
}), /* @__PURE__ */
|
|
815
|
+
}), /* @__PURE__ */ E(J, {
|
|
816
816
|
config: n,
|
|
817
817
|
className: o,
|
|
818
818
|
...S,
|
|
819
|
-
children: /* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
819
|
+
children: /* @__PURE__ */ D(Se, { children: [
|
|
820
|
+
/* @__PURE__ */ E(Z, {
|
|
821
821
|
cursor: !1,
|
|
822
|
-
content: /* @__PURE__ */
|
|
822
|
+
content: /* @__PURE__ */ E(it, { hideLabel: !0 })
|
|
823
823
|
}),
|
|
824
|
-
/* @__PURE__ */
|
|
824
|
+
/* @__PURE__ */ E(xe, {
|
|
825
825
|
data: b,
|
|
826
826
|
dataKey: a[0]?.dataKey || "value",
|
|
827
827
|
nameKey: i || "name",
|
|
@@ -830,28 +830,28 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
830
830
|
paddingAngle: 2,
|
|
831
831
|
outerRadius: "85%",
|
|
832
832
|
...x,
|
|
833
|
-
...
|
|
833
|
+
...w,
|
|
834
834
|
children: b.map((e, n) => {
|
|
835
|
-
let r =
|
|
836
|
-
return /* @__PURE__ */
|
|
835
|
+
let r = A(e?.[i], n, t);
|
|
836
|
+
return /* @__PURE__ */ E(k, { fill: Q(r) }, `cell-${n}`);
|
|
837
837
|
})
|
|
838
838
|
}),
|
|
839
|
-
/* @__PURE__ */
|
|
839
|
+
Ze ? /* @__PURE__ */ E(lt, {
|
|
840
840
|
verticalAlign: "bottom",
|
|
841
841
|
wrapperStyle: {
|
|
842
842
|
fontSize: C ? "11px" : "12px",
|
|
843
843
|
paddingTop: "8px"
|
|
844
844
|
},
|
|
845
|
-
content: /* @__PURE__ */
|
|
845
|
+
content: /* @__PURE__ */ E(at, {
|
|
846
846
|
nameKey: i,
|
|
847
847
|
className: "flex-wrap"
|
|
848
848
|
})
|
|
849
|
-
})
|
|
849
|
+
}) : null
|
|
850
850
|
] })
|
|
851
851
|
});
|
|
852
852
|
}
|
|
853
853
|
if (y === "funnel") {
|
|
854
|
-
let e = a[0]?.dataKey || "value", n =
|
|
854
|
+
let e = a[0]?.dataKey || "value", n = L(), s = u ? (t) => {
|
|
855
855
|
t && u({
|
|
856
856
|
category: t?.payload?.[i] ?? t?.[i],
|
|
857
857
|
value: t?.payload?.[e] ?? t?.[e]
|
|
@@ -863,43 +863,43 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
863
863
|
let r = Number(t?.[e] ?? 0);
|
|
864
864
|
return Number(n?.[e] ?? 0) - r;
|
|
865
865
|
});
|
|
866
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ E(J, {
|
|
867
867
|
config: r,
|
|
868
868
|
className: o,
|
|
869
869
|
...S,
|
|
870
|
-
children: /* @__PURE__ */
|
|
870
|
+
children: /* @__PURE__ */ D(_e, { children: [/* @__PURE__ */ E(Z, { content: /* @__PURE__ */ E(it, {}) }), /* @__PURE__ */ D(ge, {
|
|
871
871
|
dataKey: e,
|
|
872
872
|
data: f,
|
|
873
873
|
nameKey: i,
|
|
874
874
|
...x,
|
|
875
875
|
...c,
|
|
876
|
-
children: [/* @__PURE__ */
|
|
876
|
+
children: [/* @__PURE__ */ E(ve, {
|
|
877
877
|
position: "right",
|
|
878
878
|
fill: "hsl(var(--foreground))",
|
|
879
879
|
stroke: "none",
|
|
880
880
|
dataKey: i
|
|
881
|
-
}), f.map((e, t) => /* @__PURE__ */
|
|
881
|
+
}), f.map((e, t) => /* @__PURE__ */ E(k, { fill: Q(n[t % n.length]) }, `funnel-cell-${t}`))]
|
|
882
882
|
})] })
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
885
|
if (y === "treemap") {
|
|
886
|
-
let e = a[0]?.dataKey || "value", t =
|
|
886
|
+
let e = a[0]?.dataKey || "value", t = L(), n = b.map((n, r) => ({
|
|
887
887
|
name: String(n?.[i] ?? ""),
|
|
888
888
|
size: Number(n?.[e]) || 0,
|
|
889
889
|
fill: Q(t[r % t.length])
|
|
890
890
|
}));
|
|
891
|
-
return /* @__PURE__ */
|
|
891
|
+
return /* @__PURE__ */ E(J, {
|
|
892
892
|
config: r,
|
|
893
893
|
className: o,
|
|
894
894
|
...S,
|
|
895
|
-
children: /* @__PURE__ */
|
|
895
|
+
children: /* @__PURE__ */ E(P, {
|
|
896
896
|
data: n,
|
|
897
897
|
dataKey: "size",
|
|
898
898
|
nameKey: "name",
|
|
899
899
|
...x,
|
|
900
|
-
content: /* @__PURE__ */
|
|
901
|
-
...
|
|
902
|
-
children: /* @__PURE__ */
|
|
900
|
+
content: /* @__PURE__ */ E(_t, {}),
|
|
901
|
+
...Ie,
|
|
902
|
+
children: /* @__PURE__ */ E(N, {})
|
|
903
903
|
})
|
|
904
904
|
});
|
|
905
905
|
}
|
|
@@ -909,11 +909,11 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
909
909
|
target: n + 1,
|
|
910
910
|
value: Number(t?.[e]) || 0
|
|
911
911
|
}));
|
|
912
|
-
return c.length === 0 ? /* @__PURE__ */
|
|
912
|
+
return c.length === 0 ? /* @__PURE__ */ E("div", { className: o }) : /* @__PURE__ */ E(J, {
|
|
913
913
|
config: r,
|
|
914
914
|
className: o,
|
|
915
915
|
...S,
|
|
916
|
-
children: /* @__PURE__ */
|
|
916
|
+
children: /* @__PURE__ */ E(Ae, {
|
|
917
917
|
data: {
|
|
918
918
|
nodes: s,
|
|
919
919
|
links: c
|
|
@@ -924,24 +924,24 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
924
924
|
strokeOpacity: .25
|
|
925
925
|
},
|
|
926
926
|
node: { fill: "hsl(var(--chart-1))" },
|
|
927
|
-
...
|
|
928
|
-
children: /* @__PURE__ */
|
|
927
|
+
...Le,
|
|
928
|
+
children: /* @__PURE__ */ E(N, {})
|
|
929
929
|
})
|
|
930
930
|
});
|
|
931
931
|
}
|
|
932
|
-
if (y === "radar") return /* @__PURE__ */
|
|
932
|
+
if (y === "radar") return /* @__PURE__ */ E(J, {
|
|
933
933
|
config: r,
|
|
934
934
|
className: o,
|
|
935
935
|
...S,
|
|
936
|
-
children: /* @__PURE__ */
|
|
936
|
+
children: /* @__PURE__ */ D(De, {
|
|
937
937
|
data: b,
|
|
938
938
|
children: [
|
|
939
|
-
/* @__PURE__ */
|
|
940
|
-
/* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
content: /* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ E(we, {}),
|
|
940
|
+
/* @__PURE__ */ E(Ce, { dataKey: i }),
|
|
941
|
+
/* @__PURE__ */ E(Te, {}),
|
|
942
|
+
/* @__PURE__ */ E(Z, { content: /* @__PURE__ */ E(it, {}) }),
|
|
943
|
+
/* @__PURE__ */ E(lt, {
|
|
944
|
+
content: /* @__PURE__ */ E(at, {}),
|
|
945
945
|
...C && {
|
|
946
946
|
verticalAlign: "bottom",
|
|
947
947
|
wrapperStyle: {
|
|
@@ -952,7 +952,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
952
952
|
}),
|
|
953
953
|
a.map((e) => {
|
|
954
954
|
let t = Q(r[e.dataKey]?.color || St);
|
|
955
|
-
return /* @__PURE__ */
|
|
955
|
+
return /* @__PURE__ */ E(Ee, {
|
|
956
956
|
dataKey: e.dataKey,
|
|
957
957
|
stroke: t,
|
|
958
958
|
fill: t,
|
|
@@ -963,13 +963,13 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
963
963
|
]
|
|
964
964
|
})
|
|
965
965
|
});
|
|
966
|
-
if (y === "scatter") return /* @__PURE__ */
|
|
966
|
+
if (y === "scatter") return /* @__PURE__ */ E(J, {
|
|
967
967
|
config: r,
|
|
968
968
|
className: o,
|
|
969
969
|
...S,
|
|
970
|
-
children: /* @__PURE__ */
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
/* @__PURE__ */
|
|
970
|
+
children: /* @__PURE__ */ D(M, { children: [
|
|
971
|
+
/* @__PURE__ */ E(me, { vertical: !1 }),
|
|
972
|
+
/* @__PURE__ */ E(F, {
|
|
973
973
|
type: "number",
|
|
974
974
|
dataKey: i,
|
|
975
975
|
name: String(r[i]?.label || i),
|
|
@@ -977,22 +977,22 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
977
977
|
axisLine: !1,
|
|
978
978
|
minTickGap: C ? 32 : 48
|
|
979
979
|
}),
|
|
980
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ E(I, {
|
|
981
981
|
type: "number",
|
|
982
982
|
dataKey: a[0]?.dataKey || "value",
|
|
983
983
|
name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
|
|
984
984
|
tickLine: !1,
|
|
985
985
|
axisLine: !1,
|
|
986
|
-
tickFormatter:
|
|
986
|
+
tickFormatter: R,
|
|
987
987
|
width: 48
|
|
988
988
|
}),
|
|
989
|
-
/* @__PURE__ */
|
|
989
|
+
/* @__PURE__ */ E(Me, {
|
|
990
990
|
type: "number",
|
|
991
991
|
range: [60, 400]
|
|
992
992
|
}),
|
|
993
|
-
/* @__PURE__ */
|
|
994
|
-
/* @__PURE__ */
|
|
995
|
-
content: /* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ E(Z, { content: /* @__PURE__ */ E(it, {}) }),
|
|
994
|
+
/* @__PURE__ */ E(lt, {
|
|
995
|
+
content: /* @__PURE__ */ E(at, {}),
|
|
996
996
|
...C && {
|
|
997
997
|
verticalAlign: "bottom",
|
|
998
998
|
wrapperStyle: {
|
|
@@ -1002,53 +1002,53 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1002
1002
|
}
|
|
1003
1003
|
}),
|
|
1004
1004
|
a.map((e, t) => {
|
|
1005
|
-
let n =
|
|
1006
|
-
return /* @__PURE__ */
|
|
1005
|
+
let n = L(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = wt(e, "scatter");
|
|
1006
|
+
return /* @__PURE__ */ E(je, {
|
|
1007
1007
|
name: r[e.dataKey]?.label || e.dataKey,
|
|
1008
1008
|
data: b,
|
|
1009
1009
|
fill: i,
|
|
1010
1010
|
fillOpacity: a?.fillOpacity,
|
|
1011
1011
|
...x,
|
|
1012
|
-
...
|
|
1012
|
+
...Fe
|
|
1013
1013
|
}, e.dataKey);
|
|
1014
1014
|
})
|
|
1015
1015
|
] })
|
|
1016
1016
|
});
|
|
1017
|
-
if (y === "combo") return /* @__PURE__ */
|
|
1017
|
+
if (y === "combo") return /* @__PURE__ */ E(vt, {
|
|
1018
1018
|
title: ee,
|
|
1019
1019
|
subtitle: te,
|
|
1020
|
-
children: /* @__PURE__ */
|
|
1020
|
+
children: /* @__PURE__ */ E(J, {
|
|
1021
1021
|
config: r,
|
|
1022
1022
|
className: o,
|
|
1023
1023
|
...S,
|
|
1024
|
-
children: /* @__PURE__ */
|
|
1024
|
+
children: /* @__PURE__ */ D(he, {
|
|
1025
1025
|
data: b,
|
|
1026
1026
|
children: [
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
1027
|
+
/* @__PURE__ */ E(me, { ...K }),
|
|
1028
|
+
/* @__PURE__ */ E(F, {
|
|
1029
1029
|
dataKey: i,
|
|
1030
|
-
...
|
|
1030
|
+
...tt
|
|
1031
1031
|
}),
|
|
1032
|
-
/* @__PURE__ */
|
|
1032
|
+
/* @__PURE__ */ E(I, {
|
|
1033
1033
|
yAxisId: "left",
|
|
1034
1034
|
tickLine: !1,
|
|
1035
1035
|
axisLine: !1,
|
|
1036
|
-
tickFormatter:
|
|
1036
|
+
tickFormatter: U,
|
|
1037
1037
|
width: 48,
|
|
1038
|
-
...
|
|
1038
|
+
...W(z)
|
|
1039
1039
|
}),
|
|
1040
|
-
/* @__PURE__ */
|
|
1040
|
+
/* @__PURE__ */ E(I, {
|
|
1041
1041
|
yAxisId: "right",
|
|
1042
1042
|
orientation: "right",
|
|
1043
1043
|
tickLine: !1,
|
|
1044
1044
|
axisLine: !1,
|
|
1045
|
-
tickFormatter:
|
|
1045
|
+
tickFormatter: Ve,
|
|
1046
1046
|
width: 48,
|
|
1047
|
-
...
|
|
1047
|
+
...W(B, "right")
|
|
1048
1048
|
}),
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
content: /* @__PURE__ */
|
|
1049
|
+
$e ? /* @__PURE__ */ E(Z, { content: /* @__PURE__ */ E(it, {}) }) : null,
|
|
1050
|
+
Ze ? /* @__PURE__ */ E(lt, {
|
|
1051
|
+
content: /* @__PURE__ */ E(at, {}),
|
|
1052
1052
|
...C && {
|
|
1053
1053
|
verticalAlign: "bottom",
|
|
1054
1054
|
wrapperStyle: {
|
|
@@ -1057,11 +1057,11 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
1059
|
}) : null,
|
|
1060
|
-
|
|
1061
|
-
|
|
1060
|
+
Qe,
|
|
1061
|
+
et,
|
|
1062
1062
|
a.map((e, t) => {
|
|
1063
|
-
let n = Q(r[e.dataKey]?.color || St), i = e.chartType || ae || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : ae || i === "bar" ? "left" : "right", o = wt(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c =
|
|
1064
|
-
return i === "line" ? /* @__PURE__ */
|
|
1063
|
+
let n = Q(r[e.dataKey]?.color || St), i = e.chartType || ae || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : ae || i === "bar" ? "left" : "right", o = wt(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = We((a === "right" ? B : z)?.format);
|
|
1064
|
+
return i === "line" ? /* @__PURE__ */ E(ye, {
|
|
1065
1065
|
yAxisId: a,
|
|
1066
1066
|
type: "monotone",
|
|
1067
1067
|
dataKey: e.dataKey,
|
|
@@ -1071,8 +1071,8 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1071
1071
|
strokeOpacity: o?.strokeOpacity,
|
|
1072
1072
|
strokeDasharray: o?.strokeDasharray,
|
|
1073
1073
|
...x,
|
|
1074
|
-
children:
|
|
1075
|
-
}, e.dataKey) : i === "area" ? /* @__PURE__ */
|
|
1074
|
+
children: q(c)
|
|
1075
|
+
}, e.dataKey) : i === "area" ? /* @__PURE__ */ E(ue, {
|
|
1076
1076
|
yAxisId: a,
|
|
1077
1077
|
type: "monotone",
|
|
1078
1078
|
dataKey: e.dataKey,
|
|
@@ -1083,8 +1083,8 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1083
1083
|
strokeDasharray: o?.strokeDasharray,
|
|
1084
1084
|
...s,
|
|
1085
1085
|
...x,
|
|
1086
|
-
children:
|
|
1087
|
-
}, e.dataKey) : /* @__PURE__ */
|
|
1086
|
+
children: q(c)
|
|
1087
|
+
}, e.dataKey) : /* @__PURE__ */ E(fe, {
|
|
1088
1088
|
yAxisId: a,
|
|
1089
1089
|
dataKey: e.dataKey,
|
|
1090
1090
|
fill: n,
|
|
@@ -1092,101 +1092,101 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1092
1092
|
fillOpacity: o?.fillOpacity,
|
|
1093
1093
|
...s,
|
|
1094
1094
|
...x,
|
|
1095
|
-
children:
|
|
1095
|
+
children: q(c)
|
|
1096
1096
|
}, e.dataKey);
|
|
1097
1097
|
})
|
|
1098
1098
|
]
|
|
1099
1099
|
})
|
|
1100
1100
|
})
|
|
1101
1101
|
});
|
|
1102
|
-
let
|
|
1103
|
-
...
|
|
1104
|
-
...
|
|
1105
|
-
...a.map((e, t) => Q(r[e.dataKey]?.color ||
|
|
1106
|
-
])),
|
|
1107
|
-
return /* @__PURE__ */
|
|
1102
|
+
let nt = y === "horizontal-bar", rt = L(), ot = c ? Object.values(c).map((e) => Q(String(e))) : [], Y = Array.from(/* @__PURE__ */ new Set([
|
|
1103
|
+
...rt,
|
|
1104
|
+
...ot,
|
|
1105
|
+
...a.map((e, t) => Q(r[e.dataKey]?.color || rt[t % rt.length] || St))
|
|
1106
|
+
])), X = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
|
|
1107
|
+
return /* @__PURE__ */ E(vt, {
|
|
1108
1108
|
title: ee,
|
|
1109
1109
|
subtitle: te,
|
|
1110
|
-
children: /* @__PURE__ */
|
|
1110
|
+
children: /* @__PURE__ */ E(J, {
|
|
1111
1111
|
config: r,
|
|
1112
1112
|
className: o,
|
|
1113
1113
|
...S,
|
|
1114
|
-
children: /* @__PURE__ */
|
|
1114
|
+
children: /* @__PURE__ */ D(Re, {
|
|
1115
1115
|
data: b,
|
|
1116
|
-
layout:
|
|
1116
|
+
layout: nt ? "vertical" : "horizontal",
|
|
1117
1117
|
...le,
|
|
1118
1118
|
children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
id: `bg-${
|
|
1119
|
+
/* @__PURE__ */ E("defs", { children: Y.map((e) => /* @__PURE__ */ D(m.Fragment, { children: [/* @__PURE__ */ D("linearGradient", {
|
|
1120
|
+
id: `bg-${X(e)}`,
|
|
1121
1121
|
x1: "0",
|
|
1122
1122
|
y1: "0",
|
|
1123
1123
|
x2: "0",
|
|
1124
1124
|
y2: "1",
|
|
1125
|
-
children: [/* @__PURE__ */
|
|
1125
|
+
children: [/* @__PURE__ */ E("stop", {
|
|
1126
1126
|
offset: "0%",
|
|
1127
1127
|
style: { stopColor: e },
|
|
1128
1128
|
stopOpacity: .95
|
|
1129
|
-
}), /* @__PURE__ */
|
|
1129
|
+
}), /* @__PURE__ */ E("stop", {
|
|
1130
1130
|
offset: "100%",
|
|
1131
1131
|
style: { stopColor: e },
|
|
1132
1132
|
stopOpacity: .5
|
|
1133
1133
|
})]
|
|
1134
|
-
}), /* @__PURE__ */
|
|
1135
|
-
id: `ag-${
|
|
1134
|
+
}), /* @__PURE__ */ D("linearGradient", {
|
|
1135
|
+
id: `ag-${X(e)}`,
|
|
1136
1136
|
x1: "0",
|
|
1137
1137
|
y1: "0",
|
|
1138
1138
|
x2: "0",
|
|
1139
1139
|
y2: "1",
|
|
1140
|
-
children: [/* @__PURE__ */
|
|
1140
|
+
children: [/* @__PURE__ */ E("stop", {
|
|
1141
1141
|
offset: "0%",
|
|
1142
1142
|
style: { stopColor: e },
|
|
1143
1143
|
stopOpacity: .5
|
|
1144
|
-
}), /* @__PURE__ */
|
|
1144
|
+
}), /* @__PURE__ */ E("stop", {
|
|
1145
1145
|
offset: "95%",
|
|
1146
1146
|
style: { stopColor: e },
|
|
1147
1147
|
stopOpacity: .05
|
|
1148
1148
|
})]
|
|
1149
|
-
})] },
|
|
1150
|
-
/* @__PURE__ */
|
|
1151
|
-
|
|
1149
|
+
})] }, X(e))) }),
|
|
1150
|
+
/* @__PURE__ */ E(me, { ...K }),
|
|
1151
|
+
nt ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(F, {
|
|
1152
1152
|
type: "number",
|
|
1153
1153
|
tickLine: !1,
|
|
1154
1154
|
axisLine: !1,
|
|
1155
|
-
tickFormatter:
|
|
1156
|
-
...
|
|
1157
|
-
}), /* @__PURE__ */
|
|
1155
|
+
tickFormatter: U,
|
|
1156
|
+
...W(z)
|
|
1157
|
+
}), /* @__PURE__ */ E(I, {
|
|
1158
1158
|
type: "category",
|
|
1159
1159
|
dataKey: i,
|
|
1160
1160
|
tickLine: !1,
|
|
1161
1161
|
axisLine: !1,
|
|
1162
1162
|
width: Math.min(140, Math.max(60, Math.max(...b.map((e) => String(e[i] ?? "").length)) * 7)),
|
|
1163
|
-
tickFormatter:
|
|
1164
|
-
})] }) : /* @__PURE__ */
|
|
1165
|
-
/* @__PURE__ */
|
|
1163
|
+
tickFormatter: H
|
|
1164
|
+
})] }) : /* @__PURE__ */ D(T, { children: [
|
|
1165
|
+
/* @__PURE__ */ E(F, {
|
|
1166
1166
|
dataKey: i,
|
|
1167
|
-
...
|
|
1167
|
+
...tt
|
|
1168
1168
|
}),
|
|
1169
|
-
/* @__PURE__ */
|
|
1170
|
-
...
|
|
1169
|
+
/* @__PURE__ */ E(I, {
|
|
1170
|
+
...V ? { yAxisId: "left" } : {},
|
|
1171
1171
|
tickLine: !1,
|
|
1172
1172
|
axisLine: !1,
|
|
1173
|
-
tickFormatter:
|
|
1173
|
+
tickFormatter: U,
|
|
1174
1174
|
width: 48,
|
|
1175
|
-
...
|
|
1175
|
+
...W(z)
|
|
1176
1176
|
}),
|
|
1177
|
-
|
|
1177
|
+
V ? /* @__PURE__ */ E(I, {
|
|
1178
1178
|
yAxisId: "right",
|
|
1179
1179
|
orientation: "right",
|
|
1180
1180
|
tickLine: !1,
|
|
1181
1181
|
axisLine: !1,
|
|
1182
|
-
tickFormatter:
|
|
1182
|
+
tickFormatter: Ve,
|
|
1183
1183
|
width: 48,
|
|
1184
|
-
...
|
|
1184
|
+
...W(B, "right")
|
|
1185
1185
|
}) : null
|
|
1186
1186
|
] }),
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
content: /* @__PURE__ */
|
|
1187
|
+
$e ? /* @__PURE__ */ E(Z, { content: /* @__PURE__ */ E(it, {}) }) : null,
|
|
1188
|
+
Ze ? /* @__PURE__ */ E(lt, {
|
|
1189
|
+
content: /* @__PURE__ */ E(at, {}),
|
|
1190
1190
|
...C && {
|
|
1191
1191
|
verticalAlign: "bottom",
|
|
1192
1192
|
wrapperStyle: {
|
|
@@ -1195,26 +1195,26 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
1197
|
}) : null,
|
|
1198
|
-
|
|
1199
|
-
|
|
1198
|
+
Qe,
|
|
1199
|
+
et,
|
|
1200
1200
|
a.map((e, t) => {
|
|
1201
|
-
let n =
|
|
1201
|
+
let n = L(), 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] || St), u = V ? { yAxisId: e.yAxis === "right" ? "right" : "left" } : {}, d = e.stack ? { stackId: String(e.stack) } : {}, f = We((e.yAxis === "right" ? B : z)?.format);
|
|
1202
1202
|
if (y === "bar" || y === "horizontal-bar") {
|
|
1203
1203
|
let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && b.length > 1, r = wt(e, "bar");
|
|
1204
|
-
return /* @__PURE__ */
|
|
1204
|
+
return /* @__PURE__ */ D(fe, {
|
|
1205
1205
|
dataKey: e.dataKey,
|
|
1206
|
-
fill: `url(#bg-${
|
|
1206
|
+
fill: `url(#bg-${X(l)})`,
|
|
1207
1207
|
radius: 4,
|
|
1208
1208
|
fillOpacity: r?.fillOpacity,
|
|
1209
1209
|
...d,
|
|
1210
1210
|
...u,
|
|
1211
1211
|
...x,
|
|
1212
|
-
children: [t && b.map((e, t) => /* @__PURE__ */
|
|
1212
|
+
children: [t && b.map((e, t) => /* @__PURE__ */ E(k, { fill: `url(#bg-${X(Q(A(e?.[i], t, n)))})` }, `cell-${t}`)), q(f)]
|
|
1213
1213
|
}, e.dataKey);
|
|
1214
1214
|
}
|
|
1215
1215
|
if (y === "line") {
|
|
1216
1216
|
let t = wt(e, "line");
|
|
1217
|
-
return /* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ E(ye, {
|
|
1218
1218
|
type: "monotone",
|
|
1219
1219
|
dataKey: e.dataKey,
|
|
1220
1220
|
stroke: l,
|
|
@@ -1224,15 +1224,15 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1224
1224
|
strokeDasharray: t?.strokeDasharray,
|
|
1225
1225
|
...u,
|
|
1226
1226
|
...x,
|
|
1227
|
-
children:
|
|
1227
|
+
children: q(f)
|
|
1228
1228
|
}, e.dataKey);
|
|
1229
1229
|
}
|
|
1230
1230
|
if (y === "area") {
|
|
1231
1231
|
let t = wt(e, "area");
|
|
1232
|
-
return /* @__PURE__ */
|
|
1232
|
+
return /* @__PURE__ */ E(ue, {
|
|
1233
1233
|
type: "monotone",
|
|
1234
1234
|
dataKey: e.dataKey,
|
|
1235
|
-
fill: `url(#ag-${
|
|
1235
|
+
fill: `url(#ag-${X(l)})`,
|
|
1236
1236
|
stroke: l,
|
|
1237
1237
|
strokeWidth: 2,
|
|
1238
1238
|
fillOpacity: t?.fillOpacity ?? 1,
|
|
@@ -1241,7 +1241,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
1241
1241
|
...d,
|
|
1242
1242
|
...u,
|
|
1243
1243
|
...x,
|
|
1244
|
-
children:
|
|
1244
|
+
children: q(f)
|
|
1245
1245
|
}, e.dataKey);
|
|
1246
1246
|
}
|
|
1247
1247
|
return null;
|
|
@@ -1263,23 +1263,23 @@ function xt(e) {
|
|
|
1263
1263
|
t,
|
|
1264
1264
|
n,
|
|
1265
1265
|
r
|
|
1266
|
-
]), t ? /* @__PURE__ */
|
|
1266
|
+
]), t ? /* @__PURE__ */ E("div", {
|
|
1267
1267
|
className: `flex h-full min-h-[120px] w-full items-center justify-center p-4 text-center text-sm text-muted-foreground ${e.className ?? ""}`,
|
|
1268
1268
|
role: "status",
|
|
1269
1269
|
"data-chart-error": "missing-category-key",
|
|
1270
|
-
children: /* @__PURE__ */
|
|
1270
|
+
children: /* @__PURE__ */ D("span", { children: [
|
|
1271
1271
|
"This chart cannot plot its category axis: no row has a",
|
|
1272
1272
|
" ",
|
|
1273
|
-
/* @__PURE__ */
|
|
1273
|
+
/* @__PURE__ */ E("code", {
|
|
1274
1274
|
className: "font-mono",
|
|
1275
1275
|
children: n
|
|
1276
1276
|
}),
|
|
1277
1277
|
" field."
|
|
1278
1278
|
] })
|
|
1279
|
-
}) : /* @__PURE__ */
|
|
1279
|
+
}) : /* @__PURE__ */ E(yt, { ...e });
|
|
1280
1280
|
}
|
|
1281
|
-
var St, Ct, Q, wt, Tt, Et =
|
|
1282
|
-
ut(), ht(),
|
|
1281
|
+
var St, Ct, Q, wt, Tt, Et = z((() => {
|
|
1282
|
+
ut(), ht(), Qe(), St = "hsl(var(--primary))", Ct = {
|
|
1283
1283
|
slate: "#64748b",
|
|
1284
1284
|
gray: "#6b7280",
|
|
1285
1285
|
zinc: "#71717a",
|
|
@@ -1320,10 +1320,10 @@ var St, Ct, Q, wt, Tt, Et = L((() => {
|
|
|
1320
1320
|
}));
|
|
1321
1321
|
//#endregion
|
|
1322
1322
|
//#region src/ChartRenderer.tsx
|
|
1323
|
-
|
|
1324
|
-
var Dt = h.lazy(() => Promise.resolve().then(() => (
|
|
1325
|
-
fallback: /* @__PURE__ */
|
|
1326
|
-
children: /* @__PURE__ */
|
|
1323
|
+
Qe();
|
|
1324
|
+
var Dt = h.lazy(() => Promise.resolve().then(() => (nt(), $e))), Ot = h.lazy(() => Promise.resolve().then(() => (Et(), gt))), kt = ({ schema: e }) => /* @__PURE__ */ E(g, {
|
|
1325
|
+
fallback: /* @__PURE__ */ E(w, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
1326
|
+
children: /* @__PURE__ */ E(Dt, {
|
|
1327
1327
|
data: e.data,
|
|
1328
1328
|
dataKey: e.dataKey,
|
|
1329
1329
|
xAxisKey: e.xAxisKey,
|
|
@@ -1333,7 +1333,7 @@ var Dt = h.lazy(() => Promise.resolve().then(() => (rt(), et))), Ot = h.lazy(()
|
|
|
1333
1333
|
})
|
|
1334
1334
|
}), $ = ({ schema: e, onChartClick: t }) => {
|
|
1335
1335
|
let n = h.useMemo(() => {
|
|
1336
|
-
let t =
|
|
1336
|
+
let t = Ve(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
1337
|
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
1338
|
let t = e.colors || [
|
|
1339
1339
|
"hsl(var(--chart-1))",
|
|
@@ -1357,9 +1357,9 @@ var Dt = h.lazy(() => Promise.resolve().then(() => (rt(), et))), Ot = h.lazy(()
|
|
|
1357
1357
|
spec: t
|
|
1358
1358
|
};
|
|
1359
1359
|
}, [e]);
|
|
1360
|
-
return /* @__PURE__ */
|
|
1361
|
-
fallback: /* @__PURE__ */
|
|
1362
|
-
children: /* @__PURE__ */
|
|
1360
|
+
return /* @__PURE__ */ E(g, {
|
|
1361
|
+
fallback: /* @__PURE__ */ E(w, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
1362
|
+
children: /* @__PURE__ */ E(Ot, {
|
|
1363
1363
|
chartType: n.chartType,
|
|
1364
1364
|
data: n.data,
|
|
1365
1365
|
config: n.config,
|
|
@@ -1511,11 +1511,11 @@ async function Pt(e, t, n, r, i) {
|
|
|
1511
1511
|
});
|
|
1512
1512
|
}
|
|
1513
1513
|
var Ft = (e) => {
|
|
1514
|
-
let { schema: t } = e, m = e.onSegmentClick, h = te(
|
|
1514
|
+
let { schema: t } = e, m = e.onSegmentClick, h = te(Pe), g = e.dataSource || h?.dataSource, w = Fe(t.bind), { fieldOptionLabel: T } = Be(), ue = re(T);
|
|
1515
1515
|
ne(() => {
|
|
1516
|
-
|
|
1517
|
-
}, [
|
|
1518
|
-
let [
|
|
1516
|
+
ue.current = T;
|
|
1517
|
+
}, [T]);
|
|
1518
|
+
let [de, fe] = v([]), [O, pe] = v(null), [me, k] = v(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [he, ge] = v(null), [_e, ve] = v(null), [A, ye] = v(null), [be, xe] = v(null), { openRecordList: Se } = Ie(), Ce = L(), we = _(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Te = _(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), Ee = _(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), De = _(() => t.dataset ? JSON.stringify({
|
|
1519
1519
|
d: t.dataset,
|
|
1520
1520
|
dim: t.dimensions ?? [],
|
|
1521
1521
|
val: t.values ?? []
|
|
@@ -1523,7 +1523,7 @@ var Ft = (e) => {
|
|
|
1523
1523
|
t.dataset,
|
|
1524
1524
|
t.dimensions,
|
|
1525
1525
|
t.values
|
|
1526
|
-
]),
|
|
1526
|
+
]), Oe = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
|
|
1527
1527
|
ne(() => {
|
|
1528
1528
|
let e = !1;
|
|
1529
1529
|
return (async () => {
|
|
@@ -1538,7 +1538,7 @@ var Ft = (e) => {
|
|
|
1538
1538
|
s = r?.item ?? r?.data ?? r, a = s?.object, o = ((s?.dimensions || []).find((t) => t?.name === e) ?? (s?.dimensions || [])[0])?.field ?? e;
|
|
1539
1539
|
}
|
|
1540
1540
|
if (!a || !o) {
|
|
1541
|
-
e || (
|
|
1541
|
+
e || (ye(null), xe(null));
|
|
1542
1542
|
return;
|
|
1543
1543
|
}
|
|
1544
1544
|
let l = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(a)}`, n)).json().catch(() => null), u = l?.item ?? l?.data ?? l, d = i(u?.fields?.[o]?.options), f = null;
|
|
@@ -1550,9 +1550,9 @@ var Ft = (e) => {
|
|
|
1550
1550
|
}
|
|
1551
1551
|
Object.keys(e).length > 0 && (f = e);
|
|
1552
1552
|
}
|
|
1553
|
-
e || (
|
|
1553
|
+
e || (ye(d), xe(f));
|
|
1554
1554
|
} catch {
|
|
1555
|
-
e || (
|
|
1555
|
+
e || (ye(null), xe(null));
|
|
1556
1556
|
}
|
|
1557
1557
|
})(), () => {
|
|
1558
1558
|
e = !0;
|
|
@@ -1560,11 +1560,11 @@ var Ft = (e) => {
|
|
|
1560
1560
|
}, [
|
|
1561
1561
|
t.objectName,
|
|
1562
1562
|
t.dataset,
|
|
1563
|
-
|
|
1564
|
-
|
|
1563
|
+
De,
|
|
1564
|
+
we,
|
|
1565
1565
|
t.xAxisKey
|
|
1566
1566
|
]);
|
|
1567
|
-
let
|
|
1567
|
+
let ke = ee(async (e, n) => {
|
|
1568
1568
|
if (t.aggregate && typeof e.aggregate == "function") {
|
|
1569
1569
|
let r = t.aggregate.groupBy;
|
|
1570
1570
|
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
@@ -1593,23 +1593,23 @@ var Ft = (e) => {
|
|
|
1593
1593
|
return t.aggregate && r.length > 0 && (r = Nt(r, t.aggregate)), r;
|
|
1594
1594
|
}
|
|
1595
1595
|
return [];
|
|
1596
|
-
}, [t.objectName,
|
|
1596
|
+
}, [t.objectName, we]), j = Le(), Ae = ee(async (e, n) => {
|
|
1597
1597
|
if (!e || !t.objectName && !t.dataset) {
|
|
1598
|
-
n.current &&
|
|
1598
|
+
n.current && k(!1);
|
|
1599
1599
|
return;
|
|
1600
1600
|
}
|
|
1601
|
-
n.current && (
|
|
1601
|
+
n.current && (k(!0), ge(null));
|
|
1602
1602
|
try {
|
|
1603
1603
|
if (t.dataset && typeof e.queryDataset == "function") {
|
|
1604
|
-
let r = f(t.filter,
|
|
1604
|
+
let r = f(t.filter, j), i = await e.queryDataset(t.dataset, {
|
|
1605
1605
|
dimensions: Array.isArray(t.dimensions) ? t.dimensions : [],
|
|
1606
1606
|
measures: Array.isArray(t.values) ? t.values : [],
|
|
1607
1607
|
...r ? { runtimeFilter: r } : {}
|
|
1608
1608
|
});
|
|
1609
|
-
n.current && (
|
|
1609
|
+
n.current && (fe(Array.isArray(i?.rows) ? i.rows : []), pe(Array.isArray(i?.fields) ? i.fields : null));
|
|
1610
1610
|
return;
|
|
1611
1611
|
}
|
|
1612
|
-
let r = f(t.filter,
|
|
1612
|
+
let r = f(t.filter, j), i = t.compareTo, a = !!i && Oe(t.chartType), o = a ? u(p(t.filter, i), j) : null, [s, c] = await Promise.all([ke(e, r), o ? ke(e, o) : Promise.resolve([])]), l = s, d = t.aggregate?.groupBy, m = d && typeof d == "object" && !Array.isArray(d) ? d.alias || d.field : d || t.xAxisKey;
|
|
1613
1613
|
if (a && c.length > 0 && t.aggregate) {
|
|
1614
1614
|
let e = t.aggregate.field, n = t.aggregate.function, r = jt(t.aggregate), i = (t) => {
|
|
1615
1615
|
if (t == null) return null;
|
|
@@ -1655,122 +1655,122 @@ var Ft = (e) => {
|
|
|
1655
1655
|
}
|
|
1656
1656
|
if (m && typeof e.getObjectSchema == "function") try {
|
|
1657
1657
|
let n = await e.getObjectSchema(t.objectName);
|
|
1658
|
-
l = await Pt(l, m, n, e, (e, n) =>
|
|
1658
|
+
l = await Pt(l, m, n, e, (e, n) => ue.current(t.objectName, m, e, n));
|
|
1659
1659
|
} catch {}
|
|
1660
|
-
n.current &&
|
|
1660
|
+
n.current && fe(l);
|
|
1661
1661
|
} catch (e) {
|
|
1662
|
-
console.error("[ObjectChart] Fetch error:", e), n.current &&
|
|
1662
|
+
console.error("[ObjectChart] Fetch error:", e), n.current && ge(e instanceof Error ? e.message : "Failed to load chart data");
|
|
1663
1663
|
} finally {
|
|
1664
|
-
n.current &&
|
|
1664
|
+
n.current && k(!1);
|
|
1665
1665
|
}
|
|
1666
1666
|
}, [
|
|
1667
1667
|
t.objectName,
|
|
1668
|
-
|
|
1668
|
+
De,
|
|
1669
|
+
we,
|
|
1669
1670
|
Te,
|
|
1670
1671
|
Ee,
|
|
1671
|
-
De,
|
|
1672
1672
|
t.xAxisKey,
|
|
1673
1673
|
t.chartType,
|
|
1674
|
-
|
|
1675
|
-
|
|
1674
|
+
ke,
|
|
1675
|
+
j
|
|
1676
1676
|
]);
|
|
1677
1677
|
ne(() => {
|
|
1678
1678
|
let e = { current: !0 };
|
|
1679
|
-
return (t.objectName || t.dataset) && !
|
|
1679
|
+
return (t.objectName || t.dataset) && !w && !t.data ? Ae(g, e) : e.current && k(!1), () => {
|
|
1680
1680
|
e.current = !1;
|
|
1681
1681
|
};
|
|
1682
1682
|
}, [
|
|
1683
1683
|
t.objectName,
|
|
1684
|
-
|
|
1684
|
+
De,
|
|
1685
1685
|
g,
|
|
1686
|
-
|
|
1686
|
+
w,
|
|
1687
1687
|
t.data,
|
|
1688
|
-
Ee,
|
|
1689
1688
|
Te,
|
|
1690
|
-
|
|
1691
|
-
|
|
1689
|
+
we,
|
|
1690
|
+
Ee,
|
|
1691
|
+
Ae
|
|
1692
1692
|
]);
|
|
1693
|
-
let
|
|
1694
|
-
if (!
|
|
1695
|
-
let e = /* @__PURE__ */ new Map(), t = `__raw_${
|
|
1696
|
-
for (let n of
|
|
1697
|
-
let r = n?.[
|
|
1693
|
+
let je = w || t.data || de, M = Array.isArray(je) ? je : [], N = t.drillDown, P = t.aggregate?.groupBy || t.xAxisKey, F = _(() => {
|
|
1694
|
+
if (!P) return /* @__PURE__ */ new Map();
|
|
1695
|
+
let e = /* @__PURE__ */ new Map(), t = `__raw_${P}`;
|
|
1696
|
+
for (let n of M) {
|
|
1697
|
+
let r = n?.[P];
|
|
1698
1698
|
if (r == null) continue;
|
|
1699
1699
|
let i = t in (n || {}) ? n[t] : r;
|
|
1700
1700
|
e.set(String(r), i);
|
|
1701
1701
|
}
|
|
1702
1702
|
return e;
|
|
1703
|
-
}, [
|
|
1703
|
+
}, [M, P]), I = t.compareTo, Me = t.aggregate ? jt(t.aggregate) : void 0, R = Me ? `${Me}${Mt}` : void 0, z = !!I && Oe(t.chartType) && !!R && M.some((e) => e[R] != null), B = _(() => {
|
|
1704
1704
|
let e = Array.isArray(t.series) ? t.series : null;
|
|
1705
|
-
if (!
|
|
1706
|
-
let n = e || [{ dataKey:
|
|
1705
|
+
if (!z) return e;
|
|
1706
|
+
let n = e || [{ dataKey: Me }], r = {
|
|
1707
1707
|
vsLastWeek: "Previous week",
|
|
1708
1708
|
vsLastMonth: "Previous month",
|
|
1709
1709
|
vsLastQuarter: "Previous quarter",
|
|
1710
1710
|
vsLastYear: "Previous year",
|
|
1711
1711
|
vsYesterday: "Yesterday",
|
|
1712
1712
|
vsPreviousPeriod: "Previous period"
|
|
1713
|
-
}[a(
|
|
1713
|
+
}[a(I, t.filter)] || "Previous period";
|
|
1714
1714
|
return [...n.map((e) => ({
|
|
1715
1715
|
...e,
|
|
1716
1716
|
variant: e.variant || "current"
|
|
1717
1717
|
})), {
|
|
1718
|
-
dataKey:
|
|
1718
|
+
dataKey: R,
|
|
1719
1719
|
label: r,
|
|
1720
1720
|
variant: "comparison"
|
|
1721
1721
|
}];
|
|
1722
1722
|
}, [
|
|
1723
|
-
|
|
1723
|
+
z,
|
|
1724
1724
|
t.series,
|
|
1725
|
-
|
|
1726
|
-
|
|
1725
|
+
Me,
|
|
1726
|
+
R,
|
|
1727
1727
|
t.filter,
|
|
1728
|
-
|
|
1729
|
-
]),
|
|
1728
|
+
I
|
|
1729
|
+
]), V = t.dataset ? n(l(M, be), t.dimensions, t.values, O) : null, H = V ? {
|
|
1730
1730
|
...t,
|
|
1731
|
-
data:
|
|
1732
|
-
xAxisKey:
|
|
1733
|
-
series:
|
|
1731
|
+
data: V.data,
|
|
1732
|
+
xAxisKey: V.xAxisKey,
|
|
1733
|
+
series: V.series
|
|
1734
1734
|
} : {
|
|
1735
1735
|
...t,
|
|
1736
|
-
data:
|
|
1737
|
-
...
|
|
1738
|
-
},
|
|
1739
|
-
...
|
|
1740
|
-
...
|
|
1741
|
-
} : void 0,
|
|
1742
|
-
...
|
|
1743
|
-
colors:
|
|
1744
|
-
...
|
|
1736
|
+
data: M,
|
|
1737
|
+
...B ? { series: B } : {}
|
|
1738
|
+
}, U = t.colors && !Array.isArray(t.colors) && typeof t.colors == "object" ? t.colors : null, Ve = Array.isArray(t.colors) ? t.colors : void 0, He = A || U ? {
|
|
1739
|
+
...A || {},
|
|
1740
|
+
...U || {}
|
|
1741
|
+
} : void 0, Ue = {
|
|
1742
|
+
...H,
|
|
1743
|
+
colors: Ve,
|
|
1744
|
+
...He ? { categoryColors: He } : {}
|
|
1745
1745
|
};
|
|
1746
|
-
if (
|
|
1746
|
+
if (me && M.length === 0) return /* @__PURE__ */ D("div", {
|
|
1747
1747
|
className: "p-2 " + (t.className || ""),
|
|
1748
1748
|
"data-testid": "chart-loading",
|
|
1749
1749
|
role: "status",
|
|
1750
1750
|
"aria-busy": "true",
|
|
1751
1751
|
"aria-live": "polite",
|
|
1752
|
-
children: [/* @__PURE__ */
|
|
1752
|
+
children: [/* @__PURE__ */ E("span", {
|
|
1753
1753
|
className: "sr-only",
|
|
1754
1754
|
children: "Loading chart data…"
|
|
1755
|
-
}), /* @__PURE__ */
|
|
1755
|
+
}), /* @__PURE__ */ E(y, { className: "h-full" })]
|
|
1756
1756
|
});
|
|
1757
|
-
if (
|
|
1757
|
+
if (he) return /* @__PURE__ */ D("div", {
|
|
1758
1758
|
className: "flex flex-col items-center justify-center gap-2 p-4 " + (t.className || ""),
|
|
1759
1759
|
"data-testid": "chart-error",
|
|
1760
1760
|
role: "alert",
|
|
1761
1761
|
children: [
|
|
1762
|
-
/* @__PURE__ */
|
|
1763
|
-
/* @__PURE__ */
|
|
1762
|
+
/* @__PURE__ */ E(Re, { className: "h-6 w-6 text-destructive opacity-60" }),
|
|
1763
|
+
/* @__PURE__ */ E("p", {
|
|
1764
1764
|
className: "text-xs text-destructive font-medium",
|
|
1765
1765
|
children: "Failed to load chart data"
|
|
1766
1766
|
}),
|
|
1767
|
-
/* @__PURE__ */
|
|
1767
|
+
/* @__PURE__ */ E("p", {
|
|
1768
1768
|
className: "text-xs text-muted-foreground max-w-xs text-center",
|
|
1769
|
-
children:
|
|
1769
|
+
children: he
|
|
1770
1770
|
})
|
|
1771
1771
|
]
|
|
1772
1772
|
});
|
|
1773
|
-
if (!g && t.objectName &&
|
|
1773
|
+
if (!g && t.objectName && M.length === 0) return /* @__PURE__ */ D("div", {
|
|
1774
1774
|
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (t.className || ""),
|
|
1775
1775
|
"data-testid": "chart-no-datasource",
|
|
1776
1776
|
children: [
|
|
@@ -1779,29 +1779,29 @@ var Ft = (e) => {
|
|
|
1779
1779
|
"”"
|
|
1780
1780
|
]
|
|
1781
1781
|
});
|
|
1782
|
-
let
|
|
1783
|
-
let t = e.category, n = t != null &&
|
|
1784
|
-
|
|
1782
|
+
let We = c(N) ? (e) => {
|
|
1783
|
+
let t = e.category, n = t != null && F.has(String(t)) ? F.get(String(t)) : t;
|
|
1784
|
+
ve({
|
|
1785
1785
|
...e,
|
|
1786
1786
|
category: n,
|
|
1787
1787
|
categoryLabel: t,
|
|
1788
1788
|
scope: "cell"
|
|
1789
1789
|
});
|
|
1790
|
-
} : void 0,
|
|
1791
|
-
let e = o(
|
|
1790
|
+
} : void 0, Ge = m ?? We, Ke = !m && _e && t.objectName ? (() => {
|
|
1791
|
+
let e = o(N, _e, { groupByField: P }), n = {
|
|
1792
1792
|
...t.filter || {},
|
|
1793
1793
|
...e
|
|
1794
|
-
}, r = d(
|
|
1794
|
+
}, r = d(N, _e, t.title || "Details"), i = N?.target ?? "drawer", a = /* @__PURE__ */ E("div", {
|
|
1795
1795
|
className: "overflow-auto",
|
|
1796
1796
|
"data-testid": "chart-drill-body",
|
|
1797
|
-
children: /* @__PURE__ */
|
|
1797
|
+
children: /* @__PURE__ */ E(Ne, {
|
|
1798
1798
|
schema: {
|
|
1799
1799
|
type: "object-data-table",
|
|
1800
1800
|
objectName: t.objectName,
|
|
1801
1801
|
filter: n,
|
|
1802
1802
|
pagination: !0,
|
|
1803
|
-
pageSize:
|
|
1804
|
-
columns:
|
|
1803
|
+
pageSize: N?.maxRows,
|
|
1804
|
+
columns: N?.columns?.map((e) => ({
|
|
1805
1805
|
accessorKey: e,
|
|
1806
1806
|
header: e
|
|
1807
1807
|
})),
|
|
@@ -1813,52 +1813,52 @@ var Ft = (e) => {
|
|
|
1813
1813
|
},
|
|
1814
1814
|
dataSource: g
|
|
1815
1815
|
})
|
|
1816
|
-
}), s =
|
|
1816
|
+
}), s = Se && t.objectName ? /* @__PURE__ */ D(ie, {
|
|
1817
1817
|
type: "button",
|
|
1818
1818
|
variant: "ghost",
|
|
1819
1819
|
size: "sm",
|
|
1820
1820
|
"data-testid": "drill-open-in-list",
|
|
1821
1821
|
onClick: () => {
|
|
1822
|
-
|
|
1822
|
+
Se(t.objectName, n), ve(null);
|
|
1823
1823
|
},
|
|
1824
|
-
children: [
|
|
1824
|
+
children: [Ce("dashboard.openInList", "Open in list"), /* @__PURE__ */ E(ze, { className: "ml-1 h-3.5 w-3.5" })]
|
|
1825
1825
|
}) : null;
|
|
1826
|
-
return i === "dialog" ? /* @__PURE__ */
|
|
1826
|
+
return i === "dialog" ? /* @__PURE__ */ E(ae, {
|
|
1827
1827
|
open: !0,
|
|
1828
|
-
onOpenChange: (e) => !e &&
|
|
1829
|
-
children: /* @__PURE__ */
|
|
1828
|
+
onOpenChange: (e) => !e && ve(null),
|
|
1829
|
+
children: /* @__PURE__ */ D(b, {
|
|
1830
1830
|
className: "max-w-4xl",
|
|
1831
|
-
children: [/* @__PURE__ */
|
|
1831
|
+
children: [/* @__PURE__ */ D(x, {
|
|
1832
1832
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1833
|
-
children: [/* @__PURE__ */
|
|
1833
|
+
children: [/* @__PURE__ */ E(S, { children: r }), s]
|
|
1834
1834
|
}), a]
|
|
1835
1835
|
})
|
|
1836
|
-
}) : /* @__PURE__ */
|
|
1836
|
+
}) : /* @__PURE__ */ E(oe, {
|
|
1837
1837
|
open: !0,
|
|
1838
|
-
onOpenChange: (e) => !e &&
|
|
1839
|
-
children: /* @__PURE__ */
|
|
1838
|
+
onOpenChange: (e) => !e && ve(null),
|
|
1839
|
+
children: /* @__PURE__ */ D(se, {
|
|
1840
1840
|
side: "right",
|
|
1841
1841
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1842
|
-
children: [/* @__PURE__ */
|
|
1842
|
+
children: [/* @__PURE__ */ D(ce, {
|
|
1843
1843
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1844
|
-
children: [/* @__PURE__ */
|
|
1845
|
-
}), /* @__PURE__ */
|
|
1844
|
+
children: [/* @__PURE__ */ E(le, { children: r }), s]
|
|
1845
|
+
}), /* @__PURE__ */ E("div", {
|
|
1846
1846
|
className: "flex-1 overflow-hidden mt-2",
|
|
1847
1847
|
children: a
|
|
1848
1848
|
})]
|
|
1849
1849
|
})
|
|
1850
1850
|
});
|
|
1851
1851
|
})() : null;
|
|
1852
|
-
return /* @__PURE__ */
|
|
1852
|
+
return /* @__PURE__ */ D("div", {
|
|
1853
1853
|
className: "relative",
|
|
1854
1854
|
children: [
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
1855
|
+
/* @__PURE__ */ E(C, { active: me && M.length > 0 }),
|
|
1856
|
+
/* @__PURE__ */ E($, {
|
|
1857
1857
|
...e,
|
|
1858
|
-
schema:
|
|
1859
|
-
onChartClick:
|
|
1858
|
+
schema: Ue,
|
|
1859
|
+
onChartClick: Ge
|
|
1860
1860
|
}),
|
|
1861
|
-
|
|
1861
|
+
Ke
|
|
1862
1862
|
]
|
|
1863
1863
|
});
|
|
1864
1864
|
};
|