@object-ui/plugin-charts 16.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/dist/ChartContainerImpl.d.ts +8 -1
- package/dist/index.js +325 -299
- package/dist/index.umd.cjs +2 -2
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildChartSeries as t, buildDimensionLabelMap as n, buildOptionColorMap as r, compareToTrendLabelKey as i, computeDrillFilter as a, extractRecords as o, isDrillEnabled as s, relabelDimensions as c, resolveDateMacros as l, resolveDrillTitle as u, shiftFilterByCompareTo as d } from "@object-ui/core";
|
|
2
2
|
import * as f from "react";
|
|
3
3
|
import p, { Suspense as m, useCallback as h, useContext as g, useEffect as ee, useMemo as _, useRef as te, useState as v } from "react";
|
|
4
|
-
import { Button as ne, ChartSkeleton as re, Dialog as ie, DialogContent as ae, DialogHeader as oe, DialogTitle as se, RefreshIndicator as ce, Sheet as le, SheetContent as ue, SheetHeader as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { Area as
|
|
7
|
-
import { SchemaRenderer as Te, SchemaRendererContext as Ee, useDataScope as
|
|
4
|
+
import { Button as ne, ChartSkeleton as re, Dialog as ie, DialogContent as ae, DialogHeader as oe, DialogTitle as se, RefreshIndicator as ce, Sheet as le, SheetContent as ue, SheetHeader as de, SheetTitle as y, Skeleton as b } from "@object-ui/components";
|
|
5
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
6
|
+
import { Area as w, AreaChart as fe, Bar as pe, BarChart as T, CartesianGrid as E, Cell as me, Funnel as he, FunnelChart as D, LabelList as ge, Legend as O, Line as k, LineChart as A, Pie as _e, PieChart as j, PolarAngleAxis as ve, PolarGrid as ye, PolarRadiusAxis as be, Radar as xe, RadarChart as M, ResponsiveContainer as N, Sankey as Se, Scatter as Ce, ScatterChart as P, Tooltip as F, Treemap as we, XAxis as I, YAxis as L, ZAxis as R } from "recharts";
|
|
7
|
+
import { SchemaRenderer as Te, SchemaRendererContext as Ee, useDataScope as De, useDrillNavigation as z } from "@object-ui/react";
|
|
8
8
|
import { AlertCircle as Oe, ArrowUpRight as ke } from "lucide-react";
|
|
9
9
|
import { useSafeFieldLabel as Ae, useSafeTranslate as je } from "@object-ui/i18n";
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
@@ -28,27 +28,27 @@ function Ne(e, t = 14) {
|
|
|
28
28
|
}
|
|
29
29
|
function U({ x: e, y: t, payload: n }) {
|
|
30
30
|
let r = String(n?.value ?? ""), i = Ne(r);
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ S("g", {
|
|
32
32
|
transform: `translate(${e},${t})`,
|
|
33
|
-
children: /* @__PURE__ */
|
|
33
|
+
children: /* @__PURE__ */ C("text", {
|
|
34
34
|
dy: 10,
|
|
35
35
|
textAnchor: "end",
|
|
36
36
|
transform: "rotate(-32)",
|
|
37
37
|
fill: "hsl(var(--muted-foreground))",
|
|
38
38
|
fontSize: 11,
|
|
39
39
|
fontFamily: "monospace",
|
|
40
|
-
children: [r !== i && /* @__PURE__ */
|
|
40
|
+
children: [r !== i && /* @__PURE__ */ S("title", { children: r }), i]
|
|
41
41
|
})
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
|
|
45
45
|
let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ S("div", {
|
|
47
47
|
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}`,
|
|
48
|
-
children: /* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ S(N, {
|
|
49
49
|
width: "100%",
|
|
50
50
|
height: r,
|
|
51
|
-
children: /* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ C(T, {
|
|
52
52
|
data: e,
|
|
53
53
|
margin: {
|
|
54
54
|
top: 10,
|
|
@@ -57,66 +57,66 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
57
57
|
bottom: s ? 24 : 5
|
|
58
58
|
},
|
|
59
59
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ C("defs", { children: [/* @__PURE__ */ C("linearGradient", {
|
|
61
61
|
id: "barGradient",
|
|
62
62
|
x1: "0",
|
|
63
63
|
y1: "0",
|
|
64
64
|
x2: "0",
|
|
65
65
|
y2: "1",
|
|
66
66
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ S("stop", {
|
|
68
68
|
offset: "0%",
|
|
69
69
|
stopColor: a,
|
|
70
70
|
stopOpacity: 1
|
|
71
71
|
}),
|
|
72
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ S("stop", {
|
|
73
73
|
offset: "90%",
|
|
74
74
|
stopColor: a,
|
|
75
75
|
stopOpacity: .6
|
|
76
76
|
}),
|
|
77
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ S("stop", {
|
|
78
78
|
offset: "100%",
|
|
79
79
|
stopColor: a,
|
|
80
80
|
stopOpacity: .3
|
|
81
81
|
})
|
|
82
82
|
]
|
|
83
|
-
}), /* @__PURE__ */
|
|
83
|
+
}), /* @__PURE__ */ C("filter", {
|
|
84
84
|
id: "glow",
|
|
85
85
|
height: "130%",
|
|
86
86
|
children: [
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ S("feGaussianBlur", {
|
|
88
88
|
in: "SourceAlpha",
|
|
89
89
|
stdDeviation: "3",
|
|
90
90
|
result: "blur"
|
|
91
91
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ S("feOffset", {
|
|
93
93
|
in: "blur",
|
|
94
94
|
dx: "0",
|
|
95
95
|
dy: "0",
|
|
96
96
|
result: "offsetBlur"
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ S("feFlood", {
|
|
99
99
|
floodColor: a,
|
|
100
100
|
floodOpacity: "0.5",
|
|
101
101
|
result: "offsetColor"
|
|
102
102
|
}),
|
|
103
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ S("feComposite", {
|
|
104
104
|
in: "offsetColor",
|
|
105
105
|
in2: "offsetBlur",
|
|
106
106
|
operator: "in",
|
|
107
107
|
result: "offsetBlur"
|
|
108
108
|
}),
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ C("feMerge", { children: [/* @__PURE__ */ S("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ S("feMergeNode", { in: "SourceGraphic" })] })
|
|
110
110
|
]
|
|
111
111
|
})] }),
|
|
112
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ S(E, {
|
|
113
113
|
strokeDasharray: "3 3",
|
|
114
114
|
stroke: "hsl(var(--border))",
|
|
115
115
|
vertical: !1
|
|
116
116
|
}),
|
|
117
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ S(I, {
|
|
118
118
|
dataKey: n,
|
|
119
|
-
tick: s ? /* @__PURE__ */
|
|
119
|
+
tick: s ? /* @__PURE__ */ S(U, {}) : {
|
|
120
120
|
fill: "hsl(var(--muted-foreground))",
|
|
121
121
|
fontSize: 12,
|
|
122
122
|
fontFamily: "monospace"
|
|
@@ -127,7 +127,7 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
127
127
|
height: s ? 56 : void 0,
|
|
128
128
|
dy: s ? void 0 : 10
|
|
129
129
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ S(L, {
|
|
131
131
|
tick: {
|
|
132
132
|
fill: "hsl(var(--muted-foreground))",
|
|
133
133
|
fontSize: 12,
|
|
@@ -136,7 +136,7 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
136
136
|
tickLine: !1,
|
|
137
137
|
axisLine: !1
|
|
138
138
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ S(F, {
|
|
140
140
|
cursor: {
|
|
141
141
|
fill: "hsl(var(--muted))",
|
|
142
142
|
opacity: .2
|
|
@@ -151,11 +151,11 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
151
151
|
},
|
|
152
152
|
itemStyle: { color: "hsl(var(--primary))" }
|
|
153
153
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ S(O, { wrapperStyle: {
|
|
155
155
|
paddingTop: "20px",
|
|
156
156
|
fontFamily: "monospace"
|
|
157
157
|
} }),
|
|
158
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ S(pe, {
|
|
159
159
|
dataKey: t,
|
|
160
160
|
fill: "url(#barGradient)",
|
|
161
161
|
radius: [
|
|
@@ -180,28 +180,43 @@ function Ie() {
|
|
|
180
180
|
if (!e) throw Error("useChart must be used within a <ChartContainer />");
|
|
181
181
|
return e;
|
|
182
182
|
}
|
|
183
|
-
function W({ id: e, className: t, children: n, config: r,
|
|
184
|
-
let
|
|
185
|
-
return
|
|
183
|
+
function W({ id: e, className: t, children: n, config: r, disableSettleRemount: i, ...a }) {
|
|
184
|
+
let o = f.useId(), s = `chart-${e || o.replace(/:/g, "")}`, c = f.useRef(null), [l, u] = f.useState(0);
|
|
185
|
+
return f.useEffect(() => {
|
|
186
|
+
if (i) return;
|
|
187
|
+
let e = c.current;
|
|
188
|
+
if (e == null || typeof ResizeObserver > "u") return;
|
|
189
|
+
let t = !1, n, r = new ResizeObserver((e) => {
|
|
190
|
+
if (t) return;
|
|
191
|
+
let i = e[0]?.contentRect;
|
|
192
|
+
i == null || i.width <= 0 || i.height <= 0 || (n != null && clearTimeout(n), n = setTimeout(() => {
|
|
193
|
+
t = !0, r.disconnect(), u((e) => e + 1);
|
|
194
|
+
}, 80));
|
|
195
|
+
});
|
|
196
|
+
return r.observe(e), () => {
|
|
197
|
+
t = !0, n != null && clearTimeout(n), r.disconnect();
|
|
198
|
+
};
|
|
199
|
+
}, [i]), /* @__PURE__ */ S(ze.Provider, {
|
|
186
200
|
value: { config: r },
|
|
187
|
-
children: /* @__PURE__ */
|
|
201
|
+
children: /* @__PURE__ */ C("div", {
|
|
202
|
+
ref: c,
|
|
188
203
|
"data-slot": "chart",
|
|
189
|
-
"data-chart":
|
|
204
|
+
"data-chart": s,
|
|
190
205
|
className: q("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
|
|
191
206
|
style: {
|
|
192
207
|
minHeight: 280,
|
|
193
208
|
minWidth: 0,
|
|
194
|
-
...
|
|
209
|
+
...a.style
|
|
195
210
|
},
|
|
196
|
-
...
|
|
197
|
-
children: [/* @__PURE__ */
|
|
198
|
-
id:
|
|
211
|
+
...a,
|
|
212
|
+
children: [/* @__PURE__ */ S(Be, {
|
|
213
|
+
id: s,
|
|
199
214
|
config: r
|
|
200
|
-
}), /* @__PURE__ */
|
|
215
|
+
}), /* @__PURE__ */ S(N, {
|
|
201
216
|
width: "100%",
|
|
202
217
|
height: "100%",
|
|
203
218
|
children: n
|
|
204
|
-
})]
|
|
219
|
+
}, l)]
|
|
205
220
|
})
|
|
206
221
|
});
|
|
207
222
|
}
|
|
@@ -209,10 +224,10 @@ function G({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
209
224
|
let { config: m } = Ie(), h = f.useMemo(() => {
|
|
210
225
|
if (i || !t?.length) return null;
|
|
211
226
|
let [e] = t, n = `${p || e?.dataKey || e?.name || "value"}`, r = Le(m, e, n), a = !p && typeof o == "string" ? m[o]?.label || o : r?.label;
|
|
212
|
-
return s ? /* @__PURE__ */
|
|
227
|
+
return s ? /* @__PURE__ */ S("div", {
|
|
213
228
|
className: q("font-medium", c),
|
|
214
229
|
children: s(a, t)
|
|
215
|
-
}) : a ? /* @__PURE__ */
|
|
230
|
+
}) : a ? /* @__PURE__ */ S("div", {
|
|
216
231
|
className: q("font-medium", c),
|
|
217
232
|
children: a
|
|
218
233
|
}) : null;
|
|
@@ -227,29 +242,29 @@ function G({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
227
242
|
]);
|
|
228
243
|
if (!e || !t?.length) return null;
|
|
229
244
|
let g = t.length === 1 && r !== "dot";
|
|
230
|
-
return /* @__PURE__ */
|
|
245
|
+
return /* @__PURE__ */ C("div", {
|
|
231
246
|
className: q("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),
|
|
232
|
-
children: [g ? null : h, /* @__PURE__ */
|
|
247
|
+
children: [g ? null : h, /* @__PURE__ */ S("div", {
|
|
233
248
|
className: "grid gap-1.5",
|
|
234
249
|
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
235
250
|
let n = `${d || e.name || e.dataKey || "value"}`, i = Le(m, e, n), o = u || e.payload.fill || e.color;
|
|
236
|
-
return /* @__PURE__ */
|
|
251
|
+
return /* @__PURE__ */ S("div", {
|
|
237
252
|
className: q("[&>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" : ""),
|
|
238
|
-
children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */
|
|
253
|
+
children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ C(x, { children: [i?.icon ? /* @__PURE__ */ S(i.icon, {}) : !a && /* @__PURE__ */ S("div", {
|
|
239
254
|
className: q("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" : ""),
|
|
240
255
|
style: {
|
|
241
256
|
"--color-bg": o,
|
|
242
257
|
"--color-border": o
|
|
243
258
|
}
|
|
244
|
-
}), /* @__PURE__ */
|
|
259
|
+
}), /* @__PURE__ */ C("div", {
|
|
245
260
|
className: q("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
|
|
246
|
-
children: [/* @__PURE__ */
|
|
261
|
+
children: [/* @__PURE__ */ C("div", {
|
|
247
262
|
className: "grid gap-1.5",
|
|
248
|
-
children: [g ? h : null, /* @__PURE__ */
|
|
263
|
+
children: [g ? h : null, /* @__PURE__ */ S("span", {
|
|
249
264
|
className: "text-muted-foreground",
|
|
250
265
|
children: i?.label || e.name
|
|
251
266
|
})]
|
|
252
|
-
}), e.value && /* @__PURE__ */
|
|
267
|
+
}), e.value && /* @__PURE__ */ S("span", {
|
|
253
268
|
className: "text-foreground font-mono font-medium tabular-nums",
|
|
254
269
|
children: e.value.toLocaleString()
|
|
255
270
|
})]
|
|
@@ -261,13 +276,13 @@ function G({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
261
276
|
}
|
|
262
277
|
function K({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
|
|
263
278
|
let { config: a } = Ie();
|
|
264
|
-
return n?.length ? /* @__PURE__ */
|
|
279
|
+
return n?.length ? /* @__PURE__ */ S("div", {
|
|
265
280
|
className: q("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
266
281
|
children: n.filter((e) => e.type !== "none").map((e) => {
|
|
267
282
|
let n = `${i || e.dataKey || "value"}`, r = Le(a, e, n);
|
|
268
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ C("div", {
|
|
269
284
|
className: q("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
270
|
-
children: [r?.icon && !t ? /* @__PURE__ */
|
|
285
|
+
children: [r?.icon && !t ? /* @__PURE__ */ S(r.icon, {}) : /* @__PURE__ */ S("div", {
|
|
271
286
|
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
272
287
|
style: { backgroundColor: e.color }
|
|
273
288
|
}), r?.label]
|
|
@@ -286,7 +301,7 @@ var q, Re, ze, Be, J, Y, Ve = V((() => {
|
|
|
286
301
|
dark: ".dark"
|
|
287
302
|
}, ze = f.createContext(null), Be = ({ id: e, config: t }) => {
|
|
288
303
|
let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
289
|
-
return n.length ? /* @__PURE__ */
|
|
304
|
+
return n.length ? /* @__PURE__ */ S("style", { dangerouslySetInnerHTML: { __html: Object.entries(Re).map(([t, r]) => `
|
|
290
305
|
${r} [data-chart=${e}] {
|
|
291
306
|
${n.map(([e, n]) => {
|
|
292
307
|
let r = n.theme?.[t] || n.color;
|
|
@@ -294,7 +309,7 @@ ${n.map(([e, n]) => {
|
|
|
294
309
|
}).join("\n")}
|
|
295
310
|
}
|
|
296
311
|
`).join("\n") } }) : null;
|
|
297
|
-
}, J = F, Y =
|
|
312
|
+
}, J = F, Y = O;
|
|
298
313
|
}));
|
|
299
314
|
//#endregion
|
|
300
315
|
//#region src/chartDrillEvents.ts
|
|
@@ -332,9 +347,28 @@ function Ge(e, t) {
|
|
|
332
347
|
value: typeof n?.value == "number" ? n.value : void 0
|
|
333
348
|
};
|
|
334
349
|
}
|
|
335
|
-
var Ke = V((() => {})), qe = /* @__PURE__ */ H({ default: () =>
|
|
336
|
-
function Je(
|
|
337
|
-
let
|
|
350
|
+
var Ke = V((() => {})), qe = /* @__PURE__ */ H({ default: () => Ye });
|
|
351
|
+
function Je(e) {
|
|
352
|
+
let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
|
|
353
|
+
return r <= 0 || i <= 0 ? null : /* @__PURE__ */ C("g", { children: [/* @__PURE__ */ S("rect", {
|
|
354
|
+
x: t,
|
|
355
|
+
y: n,
|
|
356
|
+
width: r,
|
|
357
|
+
height: i,
|
|
358
|
+
fill: o,
|
|
359
|
+
stroke: "hsl(var(--background))",
|
|
360
|
+
strokeWidth: 2
|
|
361
|
+
}), r > 48 && i > 18 ? /* @__PURE__ */ S("text", {
|
|
362
|
+
x: t + 6,
|
|
363
|
+
y: n + 18,
|
|
364
|
+
fill: "#fff",
|
|
365
|
+
fontSize: 12,
|
|
366
|
+
className: "pointer-events-none",
|
|
367
|
+
children: a
|
|
368
|
+
}) : null] });
|
|
369
|
+
}
|
|
370
|
+
function Ye({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r = "name", series: i = [], className: a = "", colors: o, categoryColors: s, onChartClick: c, isAnimationActive: l }) {
|
|
371
|
+
let u = e === "column" ? "bar" : e, d = Array.isArray(t) ? t : [], p = l === !1 ? { isAnimationActive: !1 } : {}, m = l === !1 ? { disableSettleRemount: !0 } : {}, [h, g] = f.useState(!1), ee = f.useCallback((e) => {
|
|
338
372
|
if (!c || !e) return;
|
|
339
373
|
let t = Array.isArray(e.activePayload) ? e.activePayload[0] : void 0;
|
|
340
374
|
c({
|
|
@@ -342,7 +376,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
342
376
|
series: t?.dataKey ? String(t.dataKey) : void 0,
|
|
343
377
|
value: typeof t?.value == "number" ? t.value : void 0
|
|
344
378
|
});
|
|
345
|
-
}, [c]),
|
|
379
|
+
}, [c]), _ = f.useCallback((e) => {
|
|
346
380
|
if (!c || !e) return;
|
|
347
381
|
let t = e.payload?.[r], n = i[0]?.dataKey || "value";
|
|
348
382
|
c({
|
|
@@ -354,13 +388,13 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
354
388
|
c,
|
|
355
389
|
r,
|
|
356
390
|
i
|
|
357
|
-
]),
|
|
358
|
-
onClick: g,
|
|
359
|
-
style: { cursor: "pointer" }
|
|
360
|
-
} : {}, te = c ? {
|
|
391
|
+
]), te = c ? {
|
|
361
392
|
onClick: ee,
|
|
362
393
|
style: { cursor: "pointer" }
|
|
363
|
-
} : {}, v =
|
|
394
|
+
} : {}, v = c ? {
|
|
395
|
+
onClick: _,
|
|
396
|
+
style: { cursor: "pointer" }
|
|
397
|
+
} : {}, ne = f.useCallback((e, t, n) => s && s[e == null ? "" : String(e)] || n[t % n.length], [s]), re = f.useCallback((e) => {
|
|
364
398
|
if (!c) return;
|
|
365
399
|
let t = Ue(e, r, i);
|
|
366
400
|
t && c(t);
|
|
@@ -368,42 +402,42 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
368
402
|
c,
|
|
369
403
|
r,
|
|
370
404
|
i
|
|
371
|
-
]),
|
|
405
|
+
]), ie = f.useCallback((e) => {
|
|
372
406
|
if (!c) return;
|
|
373
407
|
let t = We(e, i);
|
|
374
408
|
t && c(t);
|
|
375
|
-
}, [c, i]),
|
|
409
|
+
}, [c, i]), ae = f.useCallback((e) => {
|
|
376
410
|
if (!c) return;
|
|
377
411
|
let t = Ge(e, i);
|
|
378
412
|
t && c(t);
|
|
379
|
-
}, [c, i]),
|
|
380
|
-
onClick: ne,
|
|
381
|
-
cursor: "pointer"
|
|
382
|
-
} : {}, oe = c ? {
|
|
413
|
+
}, [c, i]), oe = c ? {
|
|
383
414
|
onClick: re,
|
|
384
|
-
|
|
415
|
+
cursor: "pointer"
|
|
385
416
|
} : {}, se = c ? {
|
|
386
417
|
onClick: ie,
|
|
387
418
|
style: { cursor: "pointer" }
|
|
419
|
+
} : {}, ce = c ? {
|
|
420
|
+
onClick: ae,
|
|
421
|
+
style: { cursor: "pointer" }
|
|
388
422
|
} : {};
|
|
389
423
|
f.useEffect(() => {
|
|
390
|
-
let e = () =>
|
|
424
|
+
let e = () => g(window.innerWidth < 640);
|
|
391
425
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
392
426
|
}, []);
|
|
393
|
-
let
|
|
394
|
-
bar:
|
|
395
|
-
"horizontal-bar":
|
|
396
|
-
line:
|
|
397
|
-
area:
|
|
398
|
-
pie:
|
|
399
|
-
donut:
|
|
400
|
-
radar:
|
|
401
|
-
scatter:
|
|
402
|
-
funnel:
|
|
403
|
-
combo:
|
|
404
|
-
treemap:
|
|
405
|
-
sankey:
|
|
406
|
-
}[u] ||
|
|
427
|
+
let le = {
|
|
428
|
+
bar: T,
|
|
429
|
+
"horizontal-bar": T,
|
|
430
|
+
line: A,
|
|
431
|
+
area: fe,
|
|
432
|
+
pie: j,
|
|
433
|
+
donut: j,
|
|
434
|
+
radar: M,
|
|
435
|
+
scatter: P,
|
|
436
|
+
funnel: D,
|
|
437
|
+
combo: T,
|
|
438
|
+
treemap: T,
|
|
439
|
+
sankey: T
|
|
440
|
+
}[u] || T, ue = f.useCallback((e) => {
|
|
407
441
|
if (e == null || e === "") return "";
|
|
408
442
|
let t = n?.[String(e)]?.label;
|
|
409
443
|
if (t != null) return String(t);
|
|
@@ -425,13 +459,13 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
425
459
|
}
|
|
426
460
|
}
|
|
427
461
|
}
|
|
428
|
-
return
|
|
462
|
+
return h && i.length > 8 ? i.slice(0, 8) + "…" : i;
|
|
429
463
|
}, [
|
|
430
464
|
d,
|
|
431
465
|
r,
|
|
432
|
-
|
|
466
|
+
h,
|
|
433
467
|
n
|
|
434
|
-
]),
|
|
468
|
+
]), de = f.useMemo(() => d.some((e) => String(e[r] || "").length > 5), [d, r]), y = () => Array.isArray(o) && o.length > 0 ? o : [
|
|
435
469
|
"hsl(var(--chart-1))",
|
|
436
470
|
"hsl(var(--chart-2))",
|
|
437
471
|
"hsl(var(--chart-3))",
|
|
@@ -449,22 +483,22 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
449
483
|
} catch {
|
|
450
484
|
return String(t);
|
|
451
485
|
}
|
|
452
|
-
}, []),
|
|
486
|
+
}, []), O = f.useMemo(() => ({
|
|
453
487
|
tickLine: !1,
|
|
454
488
|
tickMargin: 10,
|
|
455
489
|
axisLine: !1,
|
|
456
490
|
interval: "preserveStartEnd",
|
|
457
|
-
minTickGap:
|
|
458
|
-
tickFormatter:
|
|
459
|
-
...!
|
|
491
|
+
minTickGap: h ? 32 : 48,
|
|
492
|
+
tickFormatter: ue,
|
|
493
|
+
...!h && de && {
|
|
460
494
|
angle: -35,
|
|
461
495
|
textAnchor: "end",
|
|
462
496
|
height: 60
|
|
463
497
|
}
|
|
464
498
|
}), [
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
499
|
+
h,
|
|
500
|
+
de,
|
|
501
|
+
ue
|
|
468
502
|
]);
|
|
469
503
|
if (u === "pie" || u === "donut") {
|
|
470
504
|
let e = u === "donut" ? "52%" : 0, t = y(), o = { ...n };
|
|
@@ -474,17 +508,18 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
474
508
|
let a = String(i);
|
|
475
509
|
o[a] || (o[a] = {
|
|
476
510
|
label: a,
|
|
477
|
-
color:
|
|
511
|
+
color: ne(i, n, t)
|
|
478
512
|
});
|
|
479
|
-
}), /* @__PURE__ */
|
|
513
|
+
}), /* @__PURE__ */ S(W, {
|
|
480
514
|
config: o,
|
|
481
515
|
className: a,
|
|
482
|
-
|
|
483
|
-
|
|
516
|
+
...m,
|
|
517
|
+
children: /* @__PURE__ */ C(j, { children: [
|
|
518
|
+
/* @__PURE__ */ S(J, {
|
|
484
519
|
cursor: !1,
|
|
485
|
-
content: /* @__PURE__ */
|
|
520
|
+
content: /* @__PURE__ */ S(G, { hideLabel: !0 })
|
|
486
521
|
}),
|
|
487
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ S(_e, {
|
|
488
523
|
data: d,
|
|
489
524
|
dataKey: i[0]?.dataKey || "value",
|
|
490
525
|
nameKey: r || "name",
|
|
@@ -493,19 +528,19 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
493
528
|
paddingAngle: 2,
|
|
494
529
|
outerRadius: "85%",
|
|
495
530
|
...p,
|
|
496
|
-
...
|
|
531
|
+
...v,
|
|
497
532
|
children: d.map((e, n) => {
|
|
498
|
-
let i =
|
|
499
|
-
return /* @__PURE__ */
|
|
533
|
+
let i = ne(e?.[r], n, t);
|
|
534
|
+
return /* @__PURE__ */ S(me, { fill: Z(i) }, `cell-${n}`);
|
|
500
535
|
})
|
|
501
536
|
}),
|
|
502
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ S(Y, {
|
|
503
538
|
verticalAlign: "bottom",
|
|
504
539
|
wrapperStyle: {
|
|
505
|
-
fontSize:
|
|
540
|
+
fontSize: h ? "11px" : "12px",
|
|
506
541
|
paddingTop: "8px"
|
|
507
542
|
},
|
|
508
|
-
content: /* @__PURE__ */
|
|
543
|
+
content: /* @__PURE__ */ S(K, {
|
|
509
544
|
nameKey: r,
|
|
510
545
|
className: "flex-wrap"
|
|
511
546
|
})
|
|
@@ -526,59 +561,43 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
526
561
|
let r = Number(t?.[e] ?? 0);
|
|
527
562
|
return Number(n?.[e] ?? 0) - r;
|
|
528
563
|
});
|
|
529
|
-
return /* @__PURE__ */
|
|
564
|
+
return /* @__PURE__ */ S(W, {
|
|
530
565
|
config: n,
|
|
531
566
|
className: a,
|
|
532
|
-
|
|
567
|
+
...m,
|
|
568
|
+
children: /* @__PURE__ */ C(D, { children: [/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }), /* @__PURE__ */ C(he, {
|
|
533
569
|
dataKey: e,
|
|
534
570
|
data: l,
|
|
535
571
|
nameKey: r,
|
|
536
|
-
|
|
572
|
+
...p,
|
|
537
573
|
...s,
|
|
538
|
-
children: [/* @__PURE__ */
|
|
574
|
+
children: [/* @__PURE__ */ S(ge, {
|
|
539
575
|
position: "right",
|
|
540
576
|
fill: "hsl(var(--foreground))",
|
|
541
577
|
stroke: "none",
|
|
542
578
|
dataKey: r
|
|
543
|
-
}), l.map((e, n) => /* @__PURE__ */
|
|
579
|
+
}), l.map((e, n) => /* @__PURE__ */ S(me, { fill: Z(t[n % t.length]) }, `funnel-cell-${n}`))]
|
|
544
580
|
})] })
|
|
545
581
|
});
|
|
546
582
|
}
|
|
547
583
|
if (u === "treemap") {
|
|
548
|
-
let e = i[0]?.dataKey || "value", t = y()
|
|
549
|
-
|
|
584
|
+
let e = i[0]?.dataKey || "value", t = y(), o = d.map((n, i) => ({
|
|
585
|
+
name: String(n?.[r] ?? ""),
|
|
586
|
+
size: Number(n?.[e]) || 0,
|
|
587
|
+
fill: Z(t[i % t.length])
|
|
588
|
+
}));
|
|
589
|
+
return /* @__PURE__ */ S(W, {
|
|
550
590
|
config: n,
|
|
551
591
|
className: a,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
size: Number(n?.[e]) || 0,
|
|
556
|
-
fill: Z(t[i % t.length])
|
|
557
|
-
})),
|
|
592
|
+
...m,
|
|
593
|
+
children: /* @__PURE__ */ S(we, {
|
|
594
|
+
data: o,
|
|
558
595
|
dataKey: "size",
|
|
559
596
|
nameKey: "name",
|
|
560
|
-
|
|
561
|
-
content: /* @__PURE__ */
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
x: t,
|
|
565
|
-
y: n,
|
|
566
|
-
width: r,
|
|
567
|
-
height: i,
|
|
568
|
-
fill: o,
|
|
569
|
-
stroke: "hsl(var(--background))",
|
|
570
|
-
strokeWidth: 2
|
|
571
|
-
}), r > 48 && i > 18 ? /* @__PURE__ */ C("text", {
|
|
572
|
-
x: t + 6,
|
|
573
|
-
y: n + 18,
|
|
574
|
-
fill: "#fff",
|
|
575
|
-
fontSize: 12,
|
|
576
|
-
className: "pointer-events-none",
|
|
577
|
-
children: a
|
|
578
|
-
}) : null] });
|
|
579
|
-
}, {}),
|
|
580
|
-
...oe,
|
|
581
|
-
children: /* @__PURE__ */ C(F, {})
|
|
597
|
+
...p,
|
|
598
|
+
content: /* @__PURE__ */ S(Je, {}),
|
|
599
|
+
...se,
|
|
600
|
+
children: /* @__PURE__ */ S(F, {})
|
|
582
601
|
})
|
|
583
602
|
});
|
|
584
603
|
}
|
|
@@ -588,10 +607,11 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
588
607
|
target: n + 1,
|
|
589
608
|
value: Number(t?.[e]) || 0
|
|
590
609
|
}));
|
|
591
|
-
return c.length === 0 ? /* @__PURE__ */
|
|
610
|
+
return c.length === 0 ? /* @__PURE__ */ S("div", { className: a }) : /* @__PURE__ */ S(W, {
|
|
592
611
|
config: n,
|
|
593
612
|
className: a,
|
|
594
|
-
|
|
613
|
+
...m,
|
|
614
|
+
children: /* @__PURE__ */ S(Se, {
|
|
595
615
|
data: {
|
|
596
616
|
nodes: s,
|
|
597
617
|
links: c
|
|
@@ -602,24 +622,25 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
602
622
|
strokeOpacity: .25
|
|
603
623
|
},
|
|
604
624
|
node: { fill: "hsl(var(--chart-1))" },
|
|
605
|
-
...
|
|
606
|
-
children: /* @__PURE__ */
|
|
625
|
+
...ce,
|
|
626
|
+
children: /* @__PURE__ */ S(F, {})
|
|
607
627
|
})
|
|
608
628
|
});
|
|
609
629
|
}
|
|
610
|
-
if (u === "radar") return /* @__PURE__ */
|
|
630
|
+
if (u === "radar") return /* @__PURE__ */ S(W, {
|
|
611
631
|
config: n,
|
|
612
632
|
className: a,
|
|
613
|
-
|
|
633
|
+
...m,
|
|
634
|
+
children: /* @__PURE__ */ C(M, {
|
|
614
635
|
data: d,
|
|
615
636
|
children: [
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
content: /* @__PURE__ */
|
|
622
|
-
...
|
|
637
|
+
/* @__PURE__ */ S(ye, {}),
|
|
638
|
+
/* @__PURE__ */ S(ve, { dataKey: r }),
|
|
639
|
+
/* @__PURE__ */ S(be, {}),
|
|
640
|
+
/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }),
|
|
641
|
+
/* @__PURE__ */ S(Y, {
|
|
642
|
+
content: /* @__PURE__ */ S(K, {}),
|
|
643
|
+
...h && {
|
|
623
644
|
verticalAlign: "bottom",
|
|
624
645
|
wrapperStyle: {
|
|
625
646
|
fontSize: "11px",
|
|
@@ -629,30 +650,32 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
629
650
|
}),
|
|
630
651
|
i.map((e) => {
|
|
631
652
|
let t = Z(n[e.dataKey]?.color || X);
|
|
632
|
-
return /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ S(xe, {
|
|
633
654
|
dataKey: e.dataKey,
|
|
634
655
|
stroke: t,
|
|
635
656
|
fill: t,
|
|
636
|
-
fillOpacity: .6
|
|
657
|
+
fillOpacity: .6,
|
|
658
|
+
...p
|
|
637
659
|
}, e.dataKey);
|
|
638
660
|
})
|
|
639
661
|
]
|
|
640
662
|
})
|
|
641
663
|
});
|
|
642
|
-
if (u === "scatter") return /* @__PURE__ */
|
|
664
|
+
if (u === "scatter") return /* @__PURE__ */ S(W, {
|
|
643
665
|
config: n,
|
|
644
666
|
className: a,
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
/* @__PURE__ */
|
|
667
|
+
...m,
|
|
668
|
+
children: /* @__PURE__ */ C(P, { children: [
|
|
669
|
+
/* @__PURE__ */ S(E, { vertical: !1 }),
|
|
670
|
+
/* @__PURE__ */ S(I, {
|
|
648
671
|
type: "number",
|
|
649
672
|
dataKey: r,
|
|
650
673
|
name: String(n[r]?.label || r),
|
|
651
674
|
tickLine: !1,
|
|
652
675
|
axisLine: !1,
|
|
653
|
-
minTickGap:
|
|
676
|
+
minTickGap: h ? 32 : 48
|
|
654
677
|
}),
|
|
655
|
-
/* @__PURE__ */
|
|
678
|
+
/* @__PURE__ */ S(L, {
|
|
656
679
|
type: "number",
|
|
657
680
|
dataKey: i[0]?.dataKey || "value",
|
|
658
681
|
name: String(n[i[0]?.dataKey]?.label || i[0]?.dataKey),
|
|
@@ -661,14 +684,14 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
661
684
|
tickFormatter: b,
|
|
662
685
|
width: 48
|
|
663
686
|
}),
|
|
664
|
-
/* @__PURE__ */
|
|
687
|
+
/* @__PURE__ */ S(R, {
|
|
665
688
|
type: "number",
|
|
666
689
|
range: [60, 400]
|
|
667
690
|
}),
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
content: /* @__PURE__ */
|
|
671
|
-
...
|
|
691
|
+
/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }),
|
|
692
|
+
/* @__PURE__ */ S(Y, {
|
|
693
|
+
content: /* @__PURE__ */ S(K, {}),
|
|
694
|
+
...h && {
|
|
672
695
|
verticalAlign: "bottom",
|
|
673
696
|
wrapperStyle: {
|
|
674
697
|
fontSize: "11px",
|
|
@@ -678,35 +701,37 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
678
701
|
}),
|
|
679
702
|
i.map((e, t) => {
|
|
680
703
|
let r = y(), i = Z(n[e.dataKey]?.color || r[t % r.length]), a = Q(e, "scatter");
|
|
681
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ S(Ce, {
|
|
682
705
|
name: n[e.dataKey]?.label || e.dataKey,
|
|
683
706
|
data: d,
|
|
684
707
|
fill: i,
|
|
685
708
|
fillOpacity: a?.fillOpacity,
|
|
686
|
-
...
|
|
709
|
+
...p,
|
|
710
|
+
...oe
|
|
687
711
|
}, e.dataKey);
|
|
688
712
|
})
|
|
689
713
|
] })
|
|
690
714
|
});
|
|
691
|
-
if (u === "combo") return /* @__PURE__ */
|
|
715
|
+
if (u === "combo") return /* @__PURE__ */ S(W, {
|
|
692
716
|
config: n,
|
|
693
717
|
className: a,
|
|
694
|
-
|
|
718
|
+
...m,
|
|
719
|
+
children: /* @__PURE__ */ C(T, {
|
|
695
720
|
data: d,
|
|
696
721
|
children: [
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
722
|
+
/* @__PURE__ */ S(E, { vertical: !1 }),
|
|
723
|
+
/* @__PURE__ */ S(I, {
|
|
699
724
|
dataKey: r,
|
|
700
|
-
...
|
|
725
|
+
...O
|
|
701
726
|
}),
|
|
702
|
-
/* @__PURE__ */
|
|
727
|
+
/* @__PURE__ */ S(L, {
|
|
703
728
|
yAxisId: "left",
|
|
704
729
|
tickLine: !1,
|
|
705
730
|
axisLine: !1,
|
|
706
731
|
tickFormatter: b,
|
|
707
732
|
width: 48
|
|
708
733
|
}),
|
|
709
|
-
/* @__PURE__ */
|
|
734
|
+
/* @__PURE__ */ S(L, {
|
|
710
735
|
yAxisId: "right",
|
|
711
736
|
orientation: "right",
|
|
712
737
|
tickLine: !1,
|
|
@@ -714,10 +739,10 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
714
739
|
tickFormatter: b,
|
|
715
740
|
width: 48
|
|
716
741
|
}),
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
content: /* @__PURE__ */
|
|
720
|
-
...
|
|
742
|
+
/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }),
|
|
743
|
+
/* @__PURE__ */ S(Y, {
|
|
744
|
+
content: /* @__PURE__ */ S(K, {}),
|
|
745
|
+
...h && {
|
|
721
746
|
verticalAlign: "bottom",
|
|
722
747
|
wrapperStyle: {
|
|
723
748
|
fontSize: "11px",
|
|
@@ -727,7 +752,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
727
752
|
}),
|
|
728
753
|
i.map((e, t) => {
|
|
729
754
|
let r = Z(n[e.dataKey]?.color || X), i = e.chartType || (t === 0 ? "bar" : "line"), a = i === "bar" ? "left" : "right", o = Q(e, i);
|
|
730
|
-
return i === "line" ? /* @__PURE__ */
|
|
755
|
+
return i === "line" ? /* @__PURE__ */ S(k, {
|
|
731
756
|
yAxisId: a,
|
|
732
757
|
type: "monotone",
|
|
733
758
|
dataKey: e.dataKey,
|
|
@@ -737,7 +762,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
737
762
|
strokeOpacity: o?.strokeOpacity,
|
|
738
763
|
strokeDasharray: o?.strokeDasharray,
|
|
739
764
|
...p
|
|
740
|
-
}, e.dataKey) : i === "area" ? /* @__PURE__ */
|
|
765
|
+
}, e.dataKey) : i === "area" ? /* @__PURE__ */ S(w, {
|
|
741
766
|
yAxisId: a,
|
|
742
767
|
type: "monotone",
|
|
743
768
|
dataKey: e.dataKey,
|
|
@@ -747,7 +772,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
747
772
|
strokeOpacity: o?.strokeOpacity,
|
|
748
773
|
strokeDasharray: o?.strokeDasharray,
|
|
749
774
|
...p
|
|
750
|
-
}, e.dataKey) : /* @__PURE__ */
|
|
775
|
+
}, e.dataKey) : /* @__PURE__ */ S(pe, {
|
|
751
776
|
yAxisId: a,
|
|
752
777
|
dataKey: e.dataKey,
|
|
753
778
|
fill: r,
|
|
@@ -759,76 +784,77 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
759
784
|
]
|
|
760
785
|
})
|
|
761
786
|
});
|
|
762
|
-
let
|
|
763
|
-
...P,
|
|
787
|
+
let N = u === "horizontal-bar", Te = y(), Ee = s ? Object.values(s).map((e) => Z(String(e))) : [], De = Array.from(/* @__PURE__ */ new Set([
|
|
764
788
|
...Te,
|
|
765
|
-
...
|
|
789
|
+
...Ee,
|
|
790
|
+
...i.map((e, t) => Z(n[e.dataKey]?.color || Te[t % Te.length] || X))
|
|
766
791
|
])), z = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
|
|
767
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ S(W, {
|
|
768
793
|
config: n,
|
|
769
794
|
className: a,
|
|
770
|
-
|
|
795
|
+
...m,
|
|
796
|
+
children: /* @__PURE__ */ C(le, {
|
|
771
797
|
data: d,
|
|
772
|
-
layout:
|
|
773
|
-
...
|
|
798
|
+
layout: N ? "vertical" : "horizontal",
|
|
799
|
+
...te,
|
|
774
800
|
children: [
|
|
775
|
-
/* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ S("defs", { children: De.map((e) => /* @__PURE__ */ C(f.Fragment, { children: [/* @__PURE__ */ C("linearGradient", {
|
|
776
802
|
id: `bg-${z(e)}`,
|
|
777
803
|
x1: "0",
|
|
778
804
|
y1: "0",
|
|
779
805
|
x2: "0",
|
|
780
806
|
y2: "1",
|
|
781
|
-
children: [/* @__PURE__ */
|
|
807
|
+
children: [/* @__PURE__ */ S("stop", {
|
|
782
808
|
offset: "0%",
|
|
783
809
|
style: { stopColor: e },
|
|
784
810
|
stopOpacity: .95
|
|
785
|
-
}), /* @__PURE__ */
|
|
811
|
+
}), /* @__PURE__ */ S("stop", {
|
|
786
812
|
offset: "100%",
|
|
787
813
|
style: { stopColor: e },
|
|
788
814
|
stopOpacity: .5
|
|
789
815
|
})]
|
|
790
|
-
}), /* @__PURE__ */
|
|
816
|
+
}), /* @__PURE__ */ C("linearGradient", {
|
|
791
817
|
id: `ag-${z(e)}`,
|
|
792
818
|
x1: "0",
|
|
793
819
|
y1: "0",
|
|
794
820
|
x2: "0",
|
|
795
821
|
y2: "1",
|
|
796
|
-
children: [/* @__PURE__ */
|
|
822
|
+
children: [/* @__PURE__ */ S("stop", {
|
|
797
823
|
offset: "0%",
|
|
798
824
|
style: { stopColor: e },
|
|
799
825
|
stopOpacity: .5
|
|
800
|
-
}), /* @__PURE__ */
|
|
826
|
+
}), /* @__PURE__ */ S("stop", {
|
|
801
827
|
offset: "95%",
|
|
802
828
|
style: { stopColor: e },
|
|
803
829
|
stopOpacity: .05
|
|
804
830
|
})]
|
|
805
831
|
})] }, z(e))) }),
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
|
|
832
|
+
/* @__PURE__ */ S(E, { vertical: !1 }),
|
|
833
|
+
N ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(I, {
|
|
808
834
|
type: "number",
|
|
809
835
|
tickLine: !1,
|
|
810
836
|
axisLine: !1,
|
|
811
837
|
tickFormatter: b
|
|
812
|
-
}), /* @__PURE__ */
|
|
838
|
+
}), /* @__PURE__ */ S(L, {
|
|
813
839
|
type: "category",
|
|
814
840
|
dataKey: r,
|
|
815
841
|
tickLine: !1,
|
|
816
842
|
axisLine: !1,
|
|
817
843
|
width: Math.min(140, Math.max(60, Math.max(...d.map((e) => String(e[r] ?? "").length)) * 7)),
|
|
818
|
-
tickFormatter:
|
|
819
|
-
})] }) : /* @__PURE__ */
|
|
844
|
+
tickFormatter: ue
|
|
845
|
+
})] }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(I, {
|
|
820
846
|
dataKey: r,
|
|
821
|
-
...
|
|
822
|
-
}), /* @__PURE__ */
|
|
847
|
+
...O
|
|
848
|
+
}), /* @__PURE__ */ S(L, {
|
|
823
849
|
tickLine: !1,
|
|
824
850
|
axisLine: !1,
|
|
825
851
|
tickFormatter: b,
|
|
826
852
|
width: 48
|
|
827
853
|
})] }),
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
content: /* @__PURE__ */
|
|
831
|
-
...
|
|
854
|
+
/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }),
|
|
855
|
+
/* @__PURE__ */ S(Y, {
|
|
856
|
+
content: /* @__PURE__ */ S(K, {}),
|
|
857
|
+
...h && {
|
|
832
858
|
verticalAlign: "bottom",
|
|
833
859
|
wrapperStyle: {
|
|
834
860
|
fontSize: "11px",
|
|
@@ -840,18 +866,18 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
840
866
|
let a = y(), o = e.variant === "comparison", s = o ? i.slice(0, t).find((e) => e.variant !== "comparison") || i[0] : e, c = o ? i.indexOf(s) : t, l = Z(n[s.dataKey]?.color || a[c % a.length] || X);
|
|
841
867
|
if (u === "bar" || u === "horizontal-bar") {
|
|
842
868
|
let t = i.filter((e) => e.variant !== "comparison").length === 1 && !o && i.length === 1 && d.length > 1, n = Q(e, "bar");
|
|
843
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ S(pe, {
|
|
844
870
|
dataKey: e.dataKey,
|
|
845
871
|
fill: `url(#bg-${z(l)})`,
|
|
846
872
|
radius: 4,
|
|
847
873
|
fillOpacity: n?.fillOpacity,
|
|
848
874
|
...p,
|
|
849
|
-
children: t && d.map((e, t) => /* @__PURE__ */
|
|
875
|
+
children: t && d.map((e, t) => /* @__PURE__ */ S(me, { fill: `url(#bg-${z(Z(ne(e?.[r], t, a)))})` }, `cell-${t}`))
|
|
850
876
|
}, e.dataKey);
|
|
851
877
|
}
|
|
852
878
|
if (u === "line") {
|
|
853
879
|
let t = Q(e, "line");
|
|
854
|
-
return /* @__PURE__ */
|
|
880
|
+
return /* @__PURE__ */ S(k, {
|
|
855
881
|
type: "monotone",
|
|
856
882
|
dataKey: e.dataKey,
|
|
857
883
|
stroke: l,
|
|
@@ -864,7 +890,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
864
890
|
}
|
|
865
891
|
if (u === "area") {
|
|
866
892
|
let t = Q(e, "area");
|
|
867
|
-
return /* @__PURE__ */
|
|
893
|
+
return /* @__PURE__ */ S(w, {
|
|
868
894
|
type: "monotone",
|
|
869
895
|
dataKey: e.dataKey,
|
|
870
896
|
fill: `url(#ag-${z(l)})`,
|
|
@@ -882,8 +908,8 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
882
908
|
})
|
|
883
909
|
});
|
|
884
910
|
}
|
|
885
|
-
var X,
|
|
886
|
-
Ve(), Ke(), X = "hsl(var(--primary))",
|
|
911
|
+
var X, Xe, Z, Q, Ze = V((() => {
|
|
912
|
+
Ve(), Ke(), X = "hsl(var(--primary))", Xe = {
|
|
887
913
|
slate: "#64748b",
|
|
888
914
|
gray: "#6b7280",
|
|
889
915
|
zinc: "#71717a",
|
|
@@ -906,14 +932,14 @@ var X, Ye, Z, Q, Xe = V((() => {
|
|
|
906
932
|
fuchsia: "#d946ef",
|
|
907
933
|
pink: "#ec4899",
|
|
908
934
|
rose: "#f43f5e"
|
|
909
|
-
}, Z = (e) =>
|
|
935
|
+
}, Z = (e) => Xe[e] || e, Q = (e, t) => e?.variant === "comparison" ? {
|
|
910
936
|
strokeOpacity: typeof e.opacity == "number" ? e.opacity : t === "line" || t === "scatter" ? .5 : .6,
|
|
911
937
|
fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
|
|
912
938
|
strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
|
|
913
939
|
} : null;
|
|
914
|
-
})),
|
|
915
|
-
fallback: /* @__PURE__ */
|
|
916
|
-
children: /* @__PURE__ */
|
|
940
|
+
})), Qe = p.lazy(() => Promise.resolve().then(() => (Fe(), Me))), $e = p.lazy(() => Promise.resolve().then(() => (Ze(), qe))), et = ({ schema: e }) => /* @__PURE__ */ S(m, {
|
|
941
|
+
fallback: /* @__PURE__ */ S(b, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
942
|
+
children: /* @__PURE__ */ S(Qe, {
|
|
917
943
|
data: e.data,
|
|
918
944
|
dataKey: e.dataKey,
|
|
919
945
|
xAxisKey: e.xAxisKey,
|
|
@@ -946,9 +972,9 @@ var X, Ye, Z, Q, Xe = V((() => {
|
|
|
946
972
|
className: e.className
|
|
947
973
|
};
|
|
948
974
|
}, [e]);
|
|
949
|
-
return /* @__PURE__ */
|
|
950
|
-
fallback: /* @__PURE__ */
|
|
951
|
-
children: /* @__PURE__ */
|
|
975
|
+
return /* @__PURE__ */ S(m, {
|
|
976
|
+
fallback: /* @__PURE__ */ S(b, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
977
|
+
children: /* @__PURE__ */ S($e, {
|
|
952
978
|
chartType: n.chartType,
|
|
953
979
|
data: n.data,
|
|
954
980
|
config: n.config,
|
|
@@ -964,10 +990,10 @@ var X, Ye, Z, Q, Xe = V((() => {
|
|
|
964
990
|
};
|
|
965
991
|
//#endregion
|
|
966
992
|
//#region src/ObjectChart.tsx
|
|
967
|
-
function
|
|
993
|
+
function tt(e) {
|
|
968
994
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
969
995
|
}
|
|
970
|
-
function
|
|
996
|
+
function nt(e, t) {
|
|
971
997
|
let { field: n, function: r, groupBy: i } = t, a = {};
|
|
972
998
|
for (let t of e) {
|
|
973
999
|
let e = String(t[i] ?? "Unknown");
|
|
@@ -998,13 +1024,13 @@ function tt(e, t) {
|
|
|
998
1024
|
};
|
|
999
1025
|
});
|
|
1000
1026
|
}
|
|
1001
|
-
async function
|
|
1027
|
+
async function rt(e, t, n, r, i) {
|
|
1002
1028
|
if (!e.length || !t) return e;
|
|
1003
1029
|
let a = i || ((e, t) => t), s = `__raw_${t}`, c = n?.fields?.[t];
|
|
1004
1030
|
if (!c) {
|
|
1005
1031
|
let n = /^\d{4}-\d{2}-\d{2}/;
|
|
1006
1032
|
return e.map((e) => {
|
|
1007
|
-
let r = e[t], i = String(r ?? ""), o = n.test(i) ? i :
|
|
1033
|
+
let r = e[t], i = String(r ?? ""), o = n.test(i) ? i : tt(i);
|
|
1008
1034
|
return {
|
|
1009
1035
|
...e,
|
|
1010
1036
|
[t]: a(i, o),
|
|
@@ -1016,7 +1042,7 @@ async function nt(e, t, n, r, i) {
|
|
|
1016
1042
|
if (l === "select" || l === "picklist" || l === "dropdown") {
|
|
1017
1043
|
let n = c.options || [];
|
|
1018
1044
|
if (n.length === 0) return e.map((e) => {
|
|
1019
|
-
let n = e[t], r = String(n ?? ""), i =
|
|
1045
|
+
let n = e[t], r = String(n ?? ""), i = tt(r);
|
|
1020
1046
|
return {
|
|
1021
1047
|
...e,
|
|
1022
1048
|
[t]: a(r, i),
|
|
@@ -1026,7 +1052,7 @@ async function nt(e, t, n, r, i) {
|
|
|
1026
1052
|
let r = {};
|
|
1027
1053
|
for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
|
|
1028
1054
|
return e.map((e) => {
|
|
1029
|
-
let n = e[t], i = String(n ?? ""), o = r[i] ||
|
|
1055
|
+
let n = e[t], i = String(n ?? ""), o = r[i] || tt(i);
|
|
1030
1056
|
return {
|
|
1031
1057
|
...e,
|
|
1032
1058
|
[t]: a(i, o),
|
|
@@ -1079,17 +1105,17 @@ async function nt(e, t, n, r, i) {
|
|
|
1079
1105
|
let n = e[t], r = String(n ?? "");
|
|
1080
1106
|
return {
|
|
1081
1107
|
...e,
|
|
1082
|
-
[t]: u.test(r) ? r :
|
|
1108
|
+
[t]: u.test(r) ? r : tt(r),
|
|
1083
1109
|
[s]: n
|
|
1084
1110
|
};
|
|
1085
1111
|
});
|
|
1086
1112
|
}
|
|
1087
|
-
var
|
|
1088
|
-
let { schema: f } = e, p = e.onSegmentClick, m = g(Ee),
|
|
1113
|
+
var it = (e) => {
|
|
1114
|
+
let { schema: f } = e, p = e.onSegmentClick, m = g(Ee), b = e.dataSource || m?.dataSource, x = De(f.bind), { fieldOptionLabel: w } = Ae(), fe = te(w);
|
|
1089
1115
|
ee(() => {
|
|
1090
|
-
|
|
1091
|
-
}, [
|
|
1092
|
-
let [
|
|
1116
|
+
fe.current = w;
|
|
1117
|
+
}, [w]);
|
|
1118
|
+
let [pe, T] = v([]), [E, me] = v(null), [he, D] = v(() => !(Array.isArray(f.data) && f.data.length > 0) && (!!f.objectName || !!f.dataset)), [ge, O] = v(null), [k, A] = v(null), [_e, j] = v(null), [ve, ye] = v(null), { openRecordList: be } = z(), xe = je(), M = _(() => f.aggregate ? JSON.stringify(f.aggregate) : "", [f.aggregate]), N = _(() => f.filter ? JSON.stringify(f.filter) : "", [f.filter]), Se = _(() => f.compareTo ? JSON.stringify(f.compareTo) : "", [f.compareTo]), Ce = _(() => f.dataset ? JSON.stringify({
|
|
1093
1119
|
d: f.dataset,
|
|
1094
1120
|
dim: f.dimensions ?? [],
|
|
1095
1121
|
val: f.values ?? []
|
|
@@ -1097,7 +1123,7 @@ var rt = (e) => {
|
|
|
1097
1123
|
f.dataset,
|
|
1098
1124
|
f.dimensions,
|
|
1099
1125
|
f.values
|
|
1100
|
-
]),
|
|
1126
|
+
]), P = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
|
|
1101
1127
|
ee(() => {
|
|
1102
1128
|
let e = !1;
|
|
1103
1129
|
return (async () => {
|
|
@@ -1112,7 +1138,7 @@ var rt = (e) => {
|
|
|
1112
1138
|
o = n?.item ?? n?.data ?? n, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
|
|
1113
1139
|
}
|
|
1114
1140
|
if (!i || !a) {
|
|
1115
|
-
e || (
|
|
1141
|
+
e || (j(null), ye(null));
|
|
1116
1142
|
return;
|
|
1117
1143
|
}
|
|
1118
1144
|
let c = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(i)}`, t)).json().catch(() => null), l = c?.item ?? c?.data ?? c, u = r(l?.fields?.[a]?.options), d = null;
|
|
@@ -1124,9 +1150,9 @@ var rt = (e) => {
|
|
|
1124
1150
|
}
|
|
1125
1151
|
Object.keys(e).length > 0 && (d = e);
|
|
1126
1152
|
}
|
|
1127
|
-
e || (
|
|
1153
|
+
e || (j(u), ye(d));
|
|
1128
1154
|
} catch {
|
|
1129
|
-
e || (
|
|
1155
|
+
e || (j(null), ye(null));
|
|
1130
1156
|
}
|
|
1131
1157
|
})(), () => {
|
|
1132
1158
|
e = !0;
|
|
@@ -1134,8 +1160,8 @@ var rt = (e) => {
|
|
|
1134
1160
|
}, [
|
|
1135
1161
|
f.objectName,
|
|
1136
1162
|
f.dataset,
|
|
1137
|
-
|
|
1138
|
-
|
|
1163
|
+
Ce,
|
|
1164
|
+
M,
|
|
1139
1165
|
f.xAxisKey
|
|
1140
1166
|
]);
|
|
1141
1167
|
let F = h(async (e, t) => {
|
|
@@ -1164,15 +1190,15 @@ var rt = (e) => {
|
|
|
1164
1190
|
}
|
|
1165
1191
|
if (typeof e.find == "function") {
|
|
1166
1192
|
let n = o(await e.find(f.objectName, { $filter: t }));
|
|
1167
|
-
return f.aggregate && n.length > 0 && (n =
|
|
1193
|
+
return f.aggregate && n.length > 0 && (n = nt(n, f.aggregate)), n;
|
|
1168
1194
|
}
|
|
1169
1195
|
return [];
|
|
1170
|
-
}, [f.objectName,
|
|
1196
|
+
}, [f.objectName, M]), we = h(async (e, t) => {
|
|
1171
1197
|
if (!e || !f.objectName && !f.dataset) {
|
|
1172
|
-
t.current &&
|
|
1198
|
+
t.current && D(!1);
|
|
1173
1199
|
return;
|
|
1174
1200
|
}
|
|
1175
|
-
t.current && (
|
|
1201
|
+
t.current && (D(!0), O(null));
|
|
1176
1202
|
try {
|
|
1177
1203
|
if (f.dataset && typeof e.queryDataset == "function") {
|
|
1178
1204
|
let n = l(f.filter), r = await e.queryDataset(f.dataset, {
|
|
@@ -1180,10 +1206,10 @@ var rt = (e) => {
|
|
|
1180
1206
|
measures: Array.isArray(f.values) ? f.values : [],
|
|
1181
1207
|
...n ? { runtimeFilter: n } : {}
|
|
1182
1208
|
});
|
|
1183
|
-
t.current && (
|
|
1209
|
+
t.current && (T(Array.isArray(r?.rows) ? r.rows : []), me(Array.isArray(r?.fields) ? r.fields : null));
|
|
1184
1210
|
return;
|
|
1185
1211
|
}
|
|
1186
|
-
let n = l(f.filter), r = f.compareTo, i = !!r &&
|
|
1212
|
+
let n = l(f.filter), r = f.compareTo, i = !!r && P(f.chartType), a = i ? d(f.filter, r) : null, [o, s] = await Promise.all([F(e, n), a ? F(e, a) : Promise.resolve([])]), c = o, u = f.aggregate?.groupBy, p = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || f.xAxisKey;
|
|
1187
1213
|
if (i && s.length > 0 && f.aggregate) {
|
|
1188
1214
|
let e = f.aggregate.field, t = f.aggregate.function, n = (n) => {
|
|
1189
1215
|
if (n == null) return null;
|
|
@@ -1225,41 +1251,41 @@ var rt = (e) => {
|
|
|
1225
1251
|
}
|
|
1226
1252
|
if (p && typeof e.getObjectSchema == "function") try {
|
|
1227
1253
|
let t = await e.getObjectSchema(f.objectName);
|
|
1228
|
-
c = await
|
|
1254
|
+
c = await rt(c, p, t, e, (e, t) => fe.current(f.objectName, p, e, t));
|
|
1229
1255
|
} catch {}
|
|
1230
|
-
t.current &&
|
|
1256
|
+
t.current && T(c);
|
|
1231
1257
|
} catch (e) {
|
|
1232
|
-
console.error("[ObjectChart] Fetch error:", e), t.current &&
|
|
1258
|
+
console.error("[ObjectChart] Fetch error:", e), t.current && O(e instanceof Error ? e.message : "Failed to load chart data");
|
|
1233
1259
|
} finally {
|
|
1234
|
-
t.current &&
|
|
1260
|
+
t.current && D(!1);
|
|
1235
1261
|
}
|
|
1236
1262
|
}, [
|
|
1237
1263
|
f.objectName,
|
|
1238
|
-
|
|
1264
|
+
Ce,
|
|
1265
|
+
M,
|
|
1239
1266
|
N,
|
|
1240
|
-
|
|
1241
|
-
xe,
|
|
1267
|
+
Se,
|
|
1242
1268
|
f.xAxisKey,
|
|
1243
1269
|
f.chartType,
|
|
1244
1270
|
F
|
|
1245
1271
|
]);
|
|
1246
1272
|
ee(() => {
|
|
1247
1273
|
let e = { current: !0 };
|
|
1248
|
-
return (f.objectName || f.dataset) && !
|
|
1274
|
+
return (f.objectName || f.dataset) && !x && !f.data ? we(b, e) : e.current && D(!1), () => {
|
|
1249
1275
|
e.current = !1;
|
|
1250
1276
|
};
|
|
1251
1277
|
}, [
|
|
1252
1278
|
f.objectName,
|
|
1253
|
-
|
|
1279
|
+
Ce,
|
|
1280
|
+
b,
|
|
1254
1281
|
x,
|
|
1255
|
-
S,
|
|
1256
1282
|
f.data,
|
|
1257
|
-
P,
|
|
1258
1283
|
N,
|
|
1259
|
-
|
|
1284
|
+
M,
|
|
1285
|
+
Se,
|
|
1260
1286
|
we
|
|
1261
1287
|
]);
|
|
1262
|
-
let I =
|
|
1288
|
+
let I = x || f.data || pe, L = Array.isArray(I) ? I : [], R = f.drillDown, B = f.aggregate?.groupBy || f.xAxisKey, V = _(() => {
|
|
1263
1289
|
if (!B) return /* @__PURE__ */ new Map();
|
|
1264
1290
|
let e = /* @__PURE__ */ new Map(), t = `__raw_${B}`;
|
|
1265
1291
|
for (let n of L) {
|
|
@@ -1269,7 +1295,7 @@ var rt = (e) => {
|
|
|
1269
1295
|
e.set(String(r), i);
|
|
1270
1296
|
}
|
|
1271
1297
|
return e;
|
|
1272
|
-
}, [L, B]), H = f.compareTo, Me = !!H &&
|
|
1298
|
+
}, [L, B]), H = f.compareTo, Me = !!H && P(f.chartType) && !!f.aggregate && L.some((e) => e[`${f.aggregate.field}__comparison`] != null), Ne = _(() => {
|
|
1273
1299
|
let e = Array.isArray(f.series) ? f.series : null;
|
|
1274
1300
|
if (!Me) return e;
|
|
1275
1301
|
let t = e || [{ dataKey: f.aggregate.field }], n = {
|
|
@@ -1294,7 +1320,7 @@ var rt = (e) => {
|
|
|
1294
1320
|
f.aggregate,
|
|
1295
1321
|
f.filter,
|
|
1296
1322
|
H
|
|
1297
|
-
]), U = f.dataset ? t(c(L,
|
|
1323
|
+
]), U = f.dataset ? t(c(L, ve), f.dimensions, f.values, E) : null, Pe = U ? {
|
|
1298
1324
|
...f,
|
|
1299
1325
|
data: U.data,
|
|
1300
1326
|
xAxisKey: U.xAxisKey,
|
|
@@ -1303,42 +1329,42 @@ var rt = (e) => {
|
|
|
1303
1329
|
...f,
|
|
1304
1330
|
data: L,
|
|
1305
1331
|
...Ne ? { series: Ne } : {}
|
|
1306
|
-
}, Fe = f.colors && !Array.isArray(f.colors) && typeof f.colors == "object" ? f.colors : null, Ie = Array.isArray(f.colors) ? f.colors : void 0, W =
|
|
1307
|
-
...
|
|
1332
|
+
}, Fe = f.colors && !Array.isArray(f.colors) && typeof f.colors == "object" ? f.colors : null, Ie = Array.isArray(f.colors) ? f.colors : void 0, W = _e || Fe ? {
|
|
1333
|
+
..._e || {},
|
|
1308
1334
|
...Fe || {}
|
|
1309
1335
|
} : void 0, G = {
|
|
1310
1336
|
...Pe,
|
|
1311
1337
|
colors: Ie,
|
|
1312
1338
|
...W ? { categoryColors: W } : {}
|
|
1313
1339
|
};
|
|
1314
|
-
if (
|
|
1340
|
+
if (he && L.length === 0) return /* @__PURE__ */ C("div", {
|
|
1315
1341
|
className: "p-2 " + (f.className || ""),
|
|
1316
1342
|
"data-testid": "chart-loading",
|
|
1317
1343
|
role: "status",
|
|
1318
1344
|
"aria-busy": "true",
|
|
1319
1345
|
"aria-live": "polite",
|
|
1320
|
-
children: [/* @__PURE__ */
|
|
1346
|
+
children: [/* @__PURE__ */ S("span", {
|
|
1321
1347
|
className: "sr-only",
|
|
1322
1348
|
children: "Loading chart data…"
|
|
1323
|
-
}), /* @__PURE__ */
|
|
1349
|
+
}), /* @__PURE__ */ S(re, { className: "h-full" })]
|
|
1324
1350
|
});
|
|
1325
|
-
if (
|
|
1351
|
+
if (ge) return /* @__PURE__ */ C("div", {
|
|
1326
1352
|
className: "flex flex-col items-center justify-center gap-2 p-4 " + (f.className || ""),
|
|
1327
1353
|
"data-testid": "chart-error",
|
|
1328
1354
|
role: "alert",
|
|
1329
1355
|
children: [
|
|
1330
|
-
/* @__PURE__ */
|
|
1331
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ S(Oe, { className: "h-6 w-6 text-destructive opacity-60" }),
|
|
1357
|
+
/* @__PURE__ */ S("p", {
|
|
1332
1358
|
className: "text-xs text-destructive font-medium",
|
|
1333
1359
|
children: "Failed to load chart data"
|
|
1334
1360
|
}),
|
|
1335
|
-
/* @__PURE__ */
|
|
1361
|
+
/* @__PURE__ */ S("p", {
|
|
1336
1362
|
className: "text-xs text-muted-foreground max-w-xs text-center",
|
|
1337
|
-
children:
|
|
1363
|
+
children: ge
|
|
1338
1364
|
})
|
|
1339
1365
|
]
|
|
1340
1366
|
});
|
|
1341
|
-
if (!
|
|
1367
|
+
if (!b && f.objectName && L.length === 0) return /* @__PURE__ */ C("div", {
|
|
1342
1368
|
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (f.className || ""),
|
|
1343
1369
|
"data-testid": "chart-no-datasource",
|
|
1344
1370
|
children: [
|
|
@@ -1349,20 +1375,20 @@ var rt = (e) => {
|
|
|
1349
1375
|
});
|
|
1350
1376
|
let K = s(R) ? (e) => {
|
|
1351
1377
|
let t = e.category, n = t != null && V.has(String(t)) ? V.get(String(t)) : t;
|
|
1352
|
-
|
|
1378
|
+
A({
|
|
1353
1379
|
...e,
|
|
1354
1380
|
category: n,
|
|
1355
1381
|
categoryLabel: t,
|
|
1356
1382
|
scope: "cell"
|
|
1357
1383
|
});
|
|
1358
|
-
} : void 0, Le = p ?? K, q = !p &&
|
|
1359
|
-
let e = a(R,
|
|
1384
|
+
} : void 0, Le = p ?? K, q = !p && k && f.objectName ? (() => {
|
|
1385
|
+
let e = a(R, k, { groupByField: B }), t = {
|
|
1360
1386
|
...f.filter || {},
|
|
1361
1387
|
...e
|
|
1362
|
-
}, n = u(R,
|
|
1388
|
+
}, n = u(R, k, f.title || "Details"), r = R?.target ?? "drawer", i = /* @__PURE__ */ S("div", {
|
|
1363
1389
|
className: "overflow-auto",
|
|
1364
1390
|
"data-testid": "chart-drill-body",
|
|
1365
|
-
children: /* @__PURE__ */
|
|
1391
|
+
children: /* @__PURE__ */ S(Te, {
|
|
1366
1392
|
schema: {
|
|
1367
1393
|
type: "object-data-table",
|
|
1368
1394
|
objectName: f.objectName,
|
|
@@ -1379,49 +1405,49 @@ var rt = (e) => {
|
|
|
1379
1405
|
target: "dialog"
|
|
1380
1406
|
}
|
|
1381
1407
|
},
|
|
1382
|
-
dataSource:
|
|
1408
|
+
dataSource: b
|
|
1383
1409
|
})
|
|
1384
|
-
}), o =
|
|
1410
|
+
}), o = be && f.objectName ? /* @__PURE__ */ C(ne, {
|
|
1385
1411
|
type: "button",
|
|
1386
1412
|
variant: "ghost",
|
|
1387
1413
|
size: "sm",
|
|
1388
1414
|
"data-testid": "drill-open-in-list",
|
|
1389
1415
|
onClick: () => {
|
|
1390
|
-
|
|
1416
|
+
be(f.objectName, t), A(null);
|
|
1391
1417
|
},
|
|
1392
|
-
children: [
|
|
1418
|
+
children: [xe("dashboard.openInList", "Open in list"), /* @__PURE__ */ S(ke, { className: "ml-1 h-3.5 w-3.5" })]
|
|
1393
1419
|
}) : null;
|
|
1394
|
-
return r === "dialog" ? /* @__PURE__ */
|
|
1420
|
+
return r === "dialog" ? /* @__PURE__ */ S(ie, {
|
|
1395
1421
|
open: !0,
|
|
1396
|
-
onOpenChange: (e) => !e &&
|
|
1397
|
-
children: /* @__PURE__ */
|
|
1422
|
+
onOpenChange: (e) => !e && A(null),
|
|
1423
|
+
children: /* @__PURE__ */ C(ae, {
|
|
1398
1424
|
className: "max-w-4xl",
|
|
1399
|
-
children: [/* @__PURE__ */
|
|
1425
|
+
children: [/* @__PURE__ */ C(oe, {
|
|
1400
1426
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1401
|
-
children: [/* @__PURE__ */
|
|
1427
|
+
children: [/* @__PURE__ */ S(se, { children: n }), o]
|
|
1402
1428
|
}), i]
|
|
1403
1429
|
})
|
|
1404
|
-
}) : /* @__PURE__ */
|
|
1430
|
+
}) : /* @__PURE__ */ S(le, {
|
|
1405
1431
|
open: !0,
|
|
1406
|
-
onOpenChange: (e) => !e &&
|
|
1407
|
-
children: /* @__PURE__ */
|
|
1432
|
+
onOpenChange: (e) => !e && A(null),
|
|
1433
|
+
children: /* @__PURE__ */ C(ue, {
|
|
1408
1434
|
side: "right",
|
|
1409
1435
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1410
|
-
children: [/* @__PURE__ */
|
|
1436
|
+
children: [/* @__PURE__ */ C(de, {
|
|
1411
1437
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1412
|
-
children: [/* @__PURE__ */
|
|
1413
|
-
}), /* @__PURE__ */
|
|
1438
|
+
children: [/* @__PURE__ */ S(y, { children: n }), o]
|
|
1439
|
+
}), /* @__PURE__ */ S("div", {
|
|
1414
1440
|
className: "flex-1 overflow-hidden mt-2",
|
|
1415
1441
|
children: i
|
|
1416
1442
|
})]
|
|
1417
1443
|
})
|
|
1418
1444
|
});
|
|
1419
1445
|
})() : null;
|
|
1420
|
-
return /* @__PURE__ */
|
|
1446
|
+
return /* @__PURE__ */ C("div", {
|
|
1421
1447
|
className: "relative",
|
|
1422
1448
|
children: [
|
|
1423
|
-
/* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1449
|
+
/* @__PURE__ */ S(ce, { active: he && L.length > 0 }),
|
|
1450
|
+
/* @__PURE__ */ S($, {
|
|
1425
1451
|
...e,
|
|
1426
1452
|
schema: G,
|
|
1427
1453
|
onChartClick: Le
|
|
@@ -1430,7 +1456,7 @@ var rt = (e) => {
|
|
|
1430
1456
|
]
|
|
1431
1457
|
});
|
|
1432
1458
|
};
|
|
1433
|
-
e.register("object-chart",
|
|
1459
|
+
e.register("object-chart", it, {
|
|
1434
1460
|
namespace: "plugin-charts",
|
|
1435
1461
|
label: "Object Chart",
|
|
1436
1462
|
category: "view",
|
|
@@ -1462,11 +1488,11 @@ e.register("object-chart", rt, {
|
|
|
1462
1488
|
});
|
|
1463
1489
|
//#endregion
|
|
1464
1490
|
//#region src/index.tsx
|
|
1465
|
-
var
|
|
1466
|
-
"bar-chart":
|
|
1491
|
+
var at = {
|
|
1492
|
+
"bar-chart": et,
|
|
1467
1493
|
chart: $
|
|
1468
1494
|
};
|
|
1469
|
-
e.register("bar-chart",
|
|
1495
|
+
e.register("bar-chart", et, {
|
|
1470
1496
|
namespace: "plugin-charts",
|
|
1471
1497
|
label: "Bar Chart",
|
|
1472
1498
|
category: "plugin",
|
|
@@ -1530,7 +1556,7 @@ e.register("bar-chart", $e, {
|
|
|
1530
1556
|
height: 400,
|
|
1531
1557
|
color: "#8884d8"
|
|
1532
1558
|
}
|
|
1533
|
-
}), e.register("chart",
|
|
1559
|
+
}), e.register("chart", it, {
|
|
1534
1560
|
namespace: "view",
|
|
1535
1561
|
category: "view",
|
|
1536
1562
|
label: "Chart",
|
|
@@ -1697,4 +1723,4 @@ e.register("bar-chart", $e, {
|
|
|
1697
1723
|
defaultProps: { chartType: "scatter" }
|
|
1698
1724
|
});
|
|
1699
1725
|
//#endregion
|
|
1700
|
-
export {
|
|
1726
|
+
export { et as ChartBarRenderer, $ as ChartRenderer, it as ObjectChart, at as chartComponents };
|