@object-ui/plugin-charts 11.0.0 → 11.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 +23 -0
- package/dist/index.js +453 -439
- package/dist/index.umd.cjs +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { ComponentRegistry as e, buildChartSeries as t,
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { Area as
|
|
7
|
-
import { SchemaRenderer as
|
|
8
|
-
import { AlertCircle as
|
|
9
|
-
import { useSafeFieldLabel as
|
|
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
|
+
import * as f from "react";
|
|
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 y, SheetTitle as b, Skeleton as x } from "@object-ui/components";
|
|
5
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
6
|
+
import { Area as T, AreaChart as de, Bar as fe, BarChart as E, CartesianGrid as D, Cell as O, Funnel as pe, FunnelChart as me, LabelList as he, Legend as k, Line as ge, LineChart as _e, Pie as ve, PieChart as A, PolarAngleAxis as ye, PolarGrid as be, PolarRadiusAxis as j, Radar as xe, RadarChart as M, ResponsiveContainer as N, Sankey as Se, Scatter as P, ScatterChart as F, Tooltip as I, Treemap as L, XAxis as R, YAxis as z, ZAxis as Ce } from "recharts";
|
|
7
|
+
import { SchemaRenderer as we, SchemaRendererContext as Te, useDataScope as B, useDrillNavigation as Ee } from "@object-ui/react";
|
|
8
|
+
import { AlertCircle as De, ArrowUpRight as Oe } from "lucide-react";
|
|
9
|
+
import { useSafeFieldLabel as ke, useSafeTranslate as Ae } from "@object-ui/i18n";
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
|
-
var V = Object.defineProperty, H = (e, t) => () => (e && (t = e(e = 0)), t),
|
|
11
|
+
var V = Object.defineProperty, H = (e, t) => () => (e && (t = e(e = 0)), t), je = (e, t) => {
|
|
12
12
|
let n = {};
|
|
13
13
|
for (var r in e) V(n, r, {
|
|
14
14
|
get: e[r],
|
|
15
15
|
enumerable: !0
|
|
16
16
|
});
|
|
17
17
|
return t || V(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
18
|
-
},
|
|
19
|
-
function
|
|
18
|
+
}, U = /* @__PURE__ */ je({ default: () => Pe });
|
|
19
|
+
function Me(e, t = 14) {
|
|
20
20
|
return e.length > t ? `${e.slice(0, t - 1)}…` : e;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
let r = String(n?.value ?? ""), i =
|
|
24
|
-
return /* @__PURE__ */
|
|
22
|
+
function Ne({ x: e, y: t, payload: n }) {
|
|
23
|
+
let r = String(n?.value ?? ""), i = Me(r);
|
|
24
|
+
return /* @__PURE__ */ C("g", {
|
|
25
25
|
transform: `translate(${e},${t})`,
|
|
26
|
-
children: /* @__PURE__ */
|
|
26
|
+
children: /* @__PURE__ */ w("text", {
|
|
27
27
|
dy: 10,
|
|
28
28
|
textAnchor: "end",
|
|
29
29
|
transform: "rotate(-32)",
|
|
30
30
|
fill: "hsl(var(--muted-foreground))",
|
|
31
31
|
fontSize: 11,
|
|
32
32
|
fontFamily: "monospace",
|
|
33
|
-
children: [r !== i && /* @__PURE__ */
|
|
33
|
+
children: [r !== i && /* @__PURE__ */ C("title", { children: r }), i]
|
|
34
34
|
})
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
|
|
38
38
|
let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ C("div", {
|
|
40
40
|
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}`,
|
|
41
|
-
children: /* @__PURE__ */
|
|
41
|
+
children: /* @__PURE__ */ C(N, {
|
|
42
42
|
width: "100%",
|
|
43
43
|
height: r,
|
|
44
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ w(E, {
|
|
45
45
|
data: e,
|
|
46
46
|
margin: {
|
|
47
47
|
top: 10,
|
|
@@ -50,66 +50,66 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
50
50
|
bottom: s ? 24 : 5
|
|
51
51
|
},
|
|
52
52
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ w("defs", { children: [/* @__PURE__ */ w("linearGradient", {
|
|
54
54
|
id: "barGradient",
|
|
55
55
|
x1: "0",
|
|
56
56
|
y1: "0",
|
|
57
57
|
x2: "0",
|
|
58
58
|
y2: "1",
|
|
59
59
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ C("stop", {
|
|
61
61
|
offset: "0%",
|
|
62
62
|
stopColor: a,
|
|
63
63
|
stopOpacity: 1
|
|
64
64
|
}),
|
|
65
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ C("stop", {
|
|
66
66
|
offset: "90%",
|
|
67
67
|
stopColor: a,
|
|
68
68
|
stopOpacity: .6
|
|
69
69
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ C("stop", {
|
|
71
71
|
offset: "100%",
|
|
72
72
|
stopColor: a,
|
|
73
73
|
stopOpacity: .3
|
|
74
74
|
})
|
|
75
75
|
]
|
|
76
|
-
}), /* @__PURE__ */
|
|
76
|
+
}), /* @__PURE__ */ w("filter", {
|
|
77
77
|
id: "glow",
|
|
78
78
|
height: "130%",
|
|
79
79
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ C("feGaussianBlur", {
|
|
81
81
|
in: "SourceAlpha",
|
|
82
82
|
stdDeviation: "3",
|
|
83
83
|
result: "blur"
|
|
84
84
|
}),
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ C("feOffset", {
|
|
86
86
|
in: "blur",
|
|
87
87
|
dx: "0",
|
|
88
88
|
dy: "0",
|
|
89
89
|
result: "offsetBlur"
|
|
90
90
|
}),
|
|
91
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ C("feFlood", {
|
|
92
92
|
floodColor: a,
|
|
93
93
|
floodOpacity: "0.5",
|
|
94
94
|
result: "offsetColor"
|
|
95
95
|
}),
|
|
96
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ C("feComposite", {
|
|
97
97
|
in: "offsetColor",
|
|
98
98
|
in2: "offsetBlur",
|
|
99
99
|
operator: "in",
|
|
100
100
|
result: "offsetBlur"
|
|
101
101
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ w("feMerge", { children: [/* @__PURE__ */ C("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ C("feMergeNode", { in: "SourceGraphic" })] })
|
|
103
103
|
]
|
|
104
104
|
})] }),
|
|
105
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ C(D, {
|
|
106
106
|
strokeDasharray: "3 3",
|
|
107
107
|
stroke: "hsl(var(--border))",
|
|
108
108
|
vertical: !1
|
|
109
109
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ C(R, {
|
|
111
111
|
dataKey: n,
|
|
112
|
-
tick: s ? /* @__PURE__ */
|
|
112
|
+
tick: s ? /* @__PURE__ */ C(Ne, {}) : {
|
|
113
113
|
fill: "hsl(var(--muted-foreground))",
|
|
114
114
|
fontSize: 12,
|
|
115
115
|
fontFamily: "monospace"
|
|
@@ -120,7 +120,7 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
120
120
|
height: s ? 56 : void 0,
|
|
121
121
|
dy: s ? void 0 : 10
|
|
122
122
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ C(z, {
|
|
124
124
|
tick: {
|
|
125
125
|
fill: "hsl(var(--muted-foreground))",
|
|
126
126
|
fontSize: 12,
|
|
@@ -129,7 +129,7 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
129
129
|
tickLine: !1,
|
|
130
130
|
axisLine: !1
|
|
131
131
|
}),
|
|
132
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ C(I, {
|
|
133
133
|
cursor: {
|
|
134
134
|
fill: "hsl(var(--muted))",
|
|
135
135
|
opacity: .2
|
|
@@ -144,11 +144,11 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
144
144
|
},
|
|
145
145
|
itemStyle: { color: "hsl(var(--primary))" }
|
|
146
146
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ C(k, { wrapperStyle: {
|
|
148
148
|
paddingTop: "20px",
|
|
149
149
|
fontFamily: "monospace"
|
|
150
150
|
} }),
|
|
151
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ C(fe, {
|
|
152
152
|
dataKey: t,
|
|
153
153
|
fill: "url(#barGradient)",
|
|
154
154
|
radius: [
|
|
@@ -165,32 +165,32 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
165
165
|
})
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
var
|
|
168
|
+
var Fe = H((() => {}));
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/ChartContainerImpl.tsx
|
|
171
|
-
function
|
|
172
|
-
let e =
|
|
171
|
+
function Ie() {
|
|
172
|
+
let e = f.useContext(ze);
|
|
173
173
|
if (!e) throw Error("useChart must be used within a <ChartContainer />");
|
|
174
174
|
return e;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
let a =
|
|
178
|
-
return /* @__PURE__ */
|
|
176
|
+
function W({ id: e, className: t, children: n, config: r, ...i }) {
|
|
177
|
+
let a = f.useId(), o = `chart-${e || a.replace(/:/g, "")}`;
|
|
178
|
+
return /* @__PURE__ */ C(ze.Provider, {
|
|
179
179
|
value: { config: r },
|
|
180
|
-
children: /* @__PURE__ */
|
|
180
|
+
children: /* @__PURE__ */ w("div", {
|
|
181
181
|
"data-slot": "chart",
|
|
182
182
|
"data-chart": o,
|
|
183
|
-
className:
|
|
183
|
+
className: q("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
|
|
184
184
|
style: {
|
|
185
185
|
minHeight: 280,
|
|
186
186
|
minWidth: 0,
|
|
187
187
|
...i.style
|
|
188
188
|
},
|
|
189
189
|
...i,
|
|
190
|
-
children: [/* @__PURE__ */
|
|
190
|
+
children: [/* @__PURE__ */ C(Be, {
|
|
191
191
|
id: o,
|
|
192
192
|
config: r
|
|
193
|
-
}), /* @__PURE__ */
|
|
193
|
+
}), /* @__PURE__ */ C(N, {
|
|
194
194
|
width: "100%",
|
|
195
195
|
height: "100%",
|
|
196
196
|
children: n
|
|
@@ -198,15 +198,15 @@ function U({ id: e, className: t, children: n, config: r, ...i }) {
|
|
|
198
198
|
})
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
let { config: m } =
|
|
201
|
+
function G({ 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: p }) {
|
|
202
|
+
let { config: m } = Ie(), h = f.useMemo(() => {
|
|
203
203
|
if (i || !t?.length) return null;
|
|
204
|
-
let [e] = t, n =
|
|
205
|
-
return s ? /* @__PURE__ */
|
|
206
|
-
className:
|
|
204
|
+
let [e] = t, n = Le(m, e, `${p || e?.dataKey || e?.name || "value"}`), r = !p && typeof o == "string" ? m[o]?.label || o : n?.label;
|
|
205
|
+
return s ? /* @__PURE__ */ C("div", {
|
|
206
|
+
className: q("font-medium", c),
|
|
207
207
|
children: s(r, t)
|
|
208
|
-
}) : r ? /* @__PURE__ */
|
|
209
|
-
className:
|
|
208
|
+
}) : r ? /* @__PURE__ */ C("div", {
|
|
209
|
+
className: q("font-medium", c),
|
|
210
210
|
children: r
|
|
211
211
|
}) : null;
|
|
212
212
|
}, [
|
|
@@ -220,29 +220,29 @@ function W({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
220
220
|
]);
|
|
221
221
|
if (!e || !t?.length) return null;
|
|
222
222
|
let g = t.length === 1 && r !== "dot";
|
|
223
|
-
return /* @__PURE__ */
|
|
224
|
-
className:
|
|
225
|
-
children: [g ? null : h, /* @__PURE__ */
|
|
223
|
+
return /* @__PURE__ */ w("div", {
|
|
224
|
+
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),
|
|
225
|
+
children: [g ? null : h, /* @__PURE__ */ C("div", {
|
|
226
226
|
className: "grid gap-1.5",
|
|
227
227
|
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
228
|
-
let n =
|
|
229
|
-
return /* @__PURE__ */
|
|
230
|
-
className:
|
|
231
|
-
children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ S
|
|
232
|
-
className:
|
|
228
|
+
let n = Le(m, e, `${d || e.name || e.dataKey || "value"}`), i = u || e.payload.fill || e.color;
|
|
229
|
+
return /* @__PURE__ */ C("div", {
|
|
230
|
+
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" : ""),
|
|
231
|
+
children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ w(S, { children: [n?.icon ? /* @__PURE__ */ C(n.icon, {}) : !a && /* @__PURE__ */ C("div", {
|
|
232
|
+
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" : ""),
|
|
233
233
|
style: {
|
|
234
234
|
"--color-bg": i,
|
|
235
235
|
"--color-border": i
|
|
236
236
|
}
|
|
237
|
-
}), /* @__PURE__ */
|
|
238
|
-
className:
|
|
239
|
-
children: [/* @__PURE__ */
|
|
237
|
+
}), /* @__PURE__ */ w("div", {
|
|
238
|
+
className: q("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
|
|
239
|
+
children: [/* @__PURE__ */ w("div", {
|
|
240
240
|
className: "grid gap-1.5",
|
|
241
|
-
children: [g ? h : null, /* @__PURE__ */
|
|
241
|
+
children: [g ? h : null, /* @__PURE__ */ C("span", {
|
|
242
242
|
className: "text-muted-foreground",
|
|
243
243
|
children: n?.label || e.name
|
|
244
244
|
})]
|
|
245
|
-
}), e.value && /* @__PURE__ */
|
|
245
|
+
}), e.value && /* @__PURE__ */ C("span", {
|
|
246
246
|
className: "text-foreground font-mono font-medium tabular-nums",
|
|
247
247
|
children: e.value.toLocaleString()
|
|
248
248
|
})]
|
|
@@ -252,15 +252,15 @@ function W({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
252
252
|
})]
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
let { config: a } =
|
|
257
|
-
return n?.length ? /* @__PURE__ */
|
|
258
|
-
className:
|
|
255
|
+
function K({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
|
|
256
|
+
let { config: a } = Ie();
|
|
257
|
+
return n?.length ? /* @__PURE__ */ C("div", {
|
|
258
|
+
className: q("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
259
259
|
children: n.filter((e) => e.type !== "none").map((e) => {
|
|
260
|
-
let n =
|
|
261
|
-
return /* @__PURE__ */
|
|
262
|
-
className:
|
|
263
|
-
children: [n?.icon && !t ? /* @__PURE__ */
|
|
260
|
+
let n = Le(a, e, `${i || e.dataKey || "value"}`);
|
|
261
|
+
return /* @__PURE__ */ w("div", {
|
|
262
|
+
className: q("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
263
|
+
children: [n?.icon && !t ? /* @__PURE__ */ C(n.icon, {}) : /* @__PURE__ */ C("div", {
|
|
264
264
|
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
265
265
|
style: { backgroundColor: e.color }
|
|
266
266
|
}), n?.label]
|
|
@@ -268,18 +268,18 @@ function G({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bot
|
|
|
268
268
|
})
|
|
269
269
|
}) : null;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function Le(e, t, n) {
|
|
272
272
|
if (typeof t != "object" || !t) return;
|
|
273
273
|
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
274
274
|
return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
|
|
275
275
|
}
|
|
276
|
-
var
|
|
277
|
-
|
|
276
|
+
var q, Re, ze, Be, J, Y, Ve = H((() => {
|
|
277
|
+
q = (...e) => e.filter(Boolean).join(" "), Re = {
|
|
278
278
|
light: "",
|
|
279
279
|
dark: ".dark"
|
|
280
|
-
},
|
|
280
|
+
}, ze = f.createContext(null), Be = ({ id: e, config: t }) => {
|
|
281
281
|
let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
282
|
-
return n.length ? /* @__PURE__ */
|
|
282
|
+
return n.length ? /* @__PURE__ */ C("style", { dangerouslySetInnerHTML: { __html: Object.entries(Re).map(([t, r]) => `
|
|
283
283
|
${r} [data-chart=${e}] {
|
|
284
284
|
${n.map(([e, n]) => {
|
|
285
285
|
let r = n.theme?.[t] || n.color;
|
|
@@ -287,47 +287,47 @@ ${n.map(([e, n]) => {
|
|
|
287
287
|
}).join("\n")}
|
|
288
288
|
}
|
|
289
289
|
`).join("\n") } }) : null;
|
|
290
|
-
},
|
|
290
|
+
}, J = I, Y = k;
|
|
291
291
|
}));
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/chartDrillEvents.ts
|
|
294
|
-
function
|
|
294
|
+
function He(e) {
|
|
295
295
|
return e?.[0]?.dataKey || "value";
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function Ue(e, t, n) {
|
|
298
298
|
if (!e) return null;
|
|
299
299
|
let r = e.payload ?? e, i = r?.[t];
|
|
300
300
|
if (i == null) return null;
|
|
301
|
-
let a =
|
|
301
|
+
let a = He(n);
|
|
302
302
|
return {
|
|
303
303
|
category: String(i),
|
|
304
304
|
series: a,
|
|
305
305
|
value: typeof r?.[a] == "number" ? r[a] : void 0
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function We(e, t) {
|
|
309
309
|
if (!e) return null;
|
|
310
310
|
let n = e.name ?? e.payload?.name ?? e.root?.name;
|
|
311
311
|
if (n == null) return null;
|
|
312
312
|
let r = e.value ?? e.size ?? e.payload?.size;
|
|
313
313
|
return {
|
|
314
314
|
category: String(n),
|
|
315
|
-
series:
|
|
315
|
+
series: He(t),
|
|
316
316
|
value: typeof r == "number" ? r : void 0
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Ge(e, t) {
|
|
320
320
|
if (!e) return null;
|
|
321
321
|
let n = e.payload ?? e, r = n?.name;
|
|
322
322
|
return r == null || n?.depth === 0 ? null : {
|
|
323
323
|
category: String(r),
|
|
324
|
-
series:
|
|
324
|
+
series: He(t),
|
|
325
325
|
value: typeof n?.value == "number" ? n.value : void 0
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
|
-
var
|
|
329
|
-
function
|
|
330
|
-
let
|
|
328
|
+
var Ke = H((() => {})), qe = /* @__PURE__ */ je({ default: () => Je });
|
|
329
|
+
function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r = "name", series: i = [], className: a = "", colors: o, categoryColors: s, onChartClick: c, isAnimationActive: l }) {
|
|
330
|
+
let u = e === "column" ? "bar" : e, d = Array.isArray(t) ? t : [], p = l === !1 ? { isAnimationActive: !1 } : {}, [m, h] = f.useState(!1), g = f.useCallback((e) => {
|
|
331
331
|
if (!c || !e) return;
|
|
332
332
|
let t = Array.isArray(e.activePayload) ? e.activePayload[0] : void 0;
|
|
333
333
|
c({
|
|
@@ -335,7 +335,7 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
335
335
|
series: t?.dataKey ? String(t.dataKey) : void 0,
|
|
336
336
|
value: typeof t?.value == "number" ? t.value : void 0
|
|
337
337
|
});
|
|
338
|
-
}, [c]), ee =
|
|
338
|
+
}, [c]), ee = f.useCallback((e) => {
|
|
339
339
|
if (!c || !e) return;
|
|
340
340
|
let t = e.payload?.[r], n = i[0]?.dataKey || "value";
|
|
341
341
|
c({
|
|
@@ -353,56 +353,56 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
353
353
|
} : {}, te = c ? {
|
|
354
354
|
onClick: ee,
|
|
355
355
|
style: { cursor: "pointer" }
|
|
356
|
-
} : {},
|
|
356
|
+
} : {}, v = f.useCallback((e, t, n) => s && s[e == null ? "" : String(e)] || n[t % n.length], [s]), ne = f.useCallback((e) => {
|
|
357
357
|
if (!c) return;
|
|
358
|
-
let t =
|
|
358
|
+
let t = Ue(e, r, i);
|
|
359
359
|
t && c(t);
|
|
360
360
|
}, [
|
|
361
361
|
c,
|
|
362
362
|
r,
|
|
363
363
|
i
|
|
364
|
-
]),
|
|
364
|
+
]), re = f.useCallback((e) => {
|
|
365
365
|
if (!c) return;
|
|
366
|
-
let t =
|
|
366
|
+
let t = We(e, i);
|
|
367
367
|
t && c(t);
|
|
368
|
-
}, [c, i]),
|
|
368
|
+
}, [c, i]), ie = f.useCallback((e) => {
|
|
369
369
|
if (!c) return;
|
|
370
|
-
let t =
|
|
370
|
+
let t = Ge(e, i);
|
|
371
371
|
t && c(t);
|
|
372
|
-
}, [c, i]),
|
|
373
|
-
onClick:
|
|
372
|
+
}, [c, i]), ae = c ? {
|
|
373
|
+
onClick: ne,
|
|
374
374
|
cursor: "pointer"
|
|
375
|
+
} : {}, oe = c ? {
|
|
376
|
+
onClick: re,
|
|
377
|
+
style: { cursor: "pointer" }
|
|
375
378
|
} : {}, se = c ? {
|
|
376
379
|
onClick: ie,
|
|
377
380
|
style: { cursor: "pointer" }
|
|
378
|
-
} : {}, ce = c ? {
|
|
379
|
-
onClick: ae,
|
|
380
|
-
style: { cursor: "pointer" }
|
|
381
381
|
} : {};
|
|
382
|
-
|
|
382
|
+
f.useEffect(() => {
|
|
383
383
|
let e = () => h(window.innerWidth < 640);
|
|
384
384
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
385
385
|
}, []);
|
|
386
|
-
let
|
|
387
|
-
bar:
|
|
388
|
-
"horizontal-bar":
|
|
389
|
-
line:
|
|
390
|
-
area:
|
|
386
|
+
let ce = {
|
|
387
|
+
bar: E,
|
|
388
|
+
"horizontal-bar": E,
|
|
389
|
+
line: _e,
|
|
390
|
+
area: de,
|
|
391
391
|
pie: A,
|
|
392
392
|
donut: A,
|
|
393
|
-
radar:
|
|
394
|
-
scatter:
|
|
395
|
-
funnel:
|
|
396
|
-
combo:
|
|
397
|
-
treemap:
|
|
398
|
-
sankey:
|
|
399
|
-
}[
|
|
393
|
+
radar: M,
|
|
394
|
+
scatter: F,
|
|
395
|
+
funnel: me,
|
|
396
|
+
combo: E,
|
|
397
|
+
treemap: E,
|
|
398
|
+
sankey: E
|
|
399
|
+
}[u] || E, le = f.useCallback((e) => {
|
|
400
400
|
if (e == null || e === "") return "";
|
|
401
401
|
let t = typeof e == "string" ? e : String(e);
|
|
402
402
|
if (/^\d{4}-\d{2}-\d{2}/.test(t)) {
|
|
403
403
|
let e = new Date(t);
|
|
404
404
|
if (!Number.isNaN(e.getTime())) {
|
|
405
|
-
let t = (
|
|
405
|
+
let t = (d.length > 1 ? Math.abs(new Date(String(d[d.length - 1][r] ?? "")).getTime() - new Date(String(d[0][r] ?? "")).getTime()) : 0) / (1e3 * 60 * 60 * 24);
|
|
406
406
|
try {
|
|
407
407
|
return t <= 62 ? e.toLocaleDateString(void 0, {
|
|
408
408
|
month: "short",
|
|
@@ -418,16 +418,16 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
418
418
|
}
|
|
419
419
|
return m && t.length > 8 ? t.slice(0, 8) + "…" : t;
|
|
420
420
|
}, [
|
|
421
|
-
|
|
421
|
+
d,
|
|
422
422
|
r,
|
|
423
423
|
m
|
|
424
|
-
]),
|
|
424
|
+
]), ue = f.useMemo(() => d.some((e) => String(e[r] || "").length > 5), [d, r]), y = () => Array.isArray(o) && o.length > 0 ? o : [
|
|
425
425
|
"hsl(var(--chart-1))",
|
|
426
426
|
"hsl(var(--chart-2))",
|
|
427
427
|
"hsl(var(--chart-3))",
|
|
428
428
|
"hsl(var(--chart-4))",
|
|
429
429
|
"hsl(var(--chart-5))"
|
|
430
|
-
],
|
|
430
|
+
], b = f.useCallback((e) => {
|
|
431
431
|
if (e == null || e === "") return "";
|
|
432
432
|
let t = typeof e == "number" ? e : Number(e);
|
|
433
433
|
if (!Number.isFinite(t)) return String(e);
|
|
@@ -439,43 +439,43 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
439
439
|
} catch {
|
|
440
440
|
return String(t);
|
|
441
441
|
}
|
|
442
|
-
}, []),
|
|
442
|
+
}, []), x = f.useMemo(() => ({
|
|
443
443
|
tickLine: !1,
|
|
444
444
|
tickMargin: 10,
|
|
445
445
|
axisLine: !1,
|
|
446
446
|
interval: "preserveStartEnd",
|
|
447
447
|
minTickGap: m ? 32 : 48,
|
|
448
|
-
tickFormatter:
|
|
449
|
-
...!m &&
|
|
448
|
+
tickFormatter: le,
|
|
449
|
+
...!m && ue && {
|
|
450
450
|
angle: -35,
|
|
451
451
|
textAnchor: "end",
|
|
452
452
|
height: 60
|
|
453
453
|
}
|
|
454
454
|
}), [
|
|
455
455
|
m,
|
|
456
|
-
|
|
457
|
-
|
|
456
|
+
ue,
|
|
457
|
+
le
|
|
458
458
|
]);
|
|
459
|
-
if (
|
|
460
|
-
let e =
|
|
461
|
-
return
|
|
459
|
+
if (u === "pie" || u === "donut") {
|
|
460
|
+
let e = u === "donut" ? "52%" : 0, t = y(), o = { ...n };
|
|
461
|
+
return d.forEach((e, n) => {
|
|
462
462
|
let i = e?.[r];
|
|
463
463
|
if (i == null || i === "") return;
|
|
464
464
|
let a = String(i);
|
|
465
465
|
o[a] || (o[a] = {
|
|
466
466
|
label: a,
|
|
467
|
-
color:
|
|
467
|
+
color: v(i, n, t)
|
|
468
468
|
});
|
|
469
|
-
}), /* @__PURE__ */
|
|
469
|
+
}), /* @__PURE__ */ C(W, {
|
|
470
470
|
config: o,
|
|
471
471
|
className: a,
|
|
472
|
-
children: /* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */
|
|
472
|
+
children: /* @__PURE__ */ w(A, { children: [
|
|
473
|
+
/* @__PURE__ */ C(J, {
|
|
474
474
|
cursor: !1,
|
|
475
|
-
content: /* @__PURE__ */
|
|
475
|
+
content: /* @__PURE__ */ C(G, { hideLabel: !0 })
|
|
476
476
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
-
data:
|
|
477
|
+
/* @__PURE__ */ C(ve, {
|
|
478
|
+
data: d,
|
|
479
479
|
dataKey: i[0]?.dataKey || "value",
|
|
480
480
|
nameKey: r || "name",
|
|
481
481
|
innerRadius: e,
|
|
@@ -484,15 +484,15 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
484
484
|
outerRadius: "85%",
|
|
485
485
|
...p,
|
|
486
486
|
...te,
|
|
487
|
-
children:
|
|
487
|
+
children: d.map((e, n) => /* @__PURE__ */ C(O, { fill: Z(v(e?.[r], n, t)) }, `cell-${n}`))
|
|
488
488
|
}),
|
|
489
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ C(Y, {
|
|
490
490
|
verticalAlign: "bottom",
|
|
491
491
|
wrapperStyle: {
|
|
492
492
|
fontSize: m ? "11px" : "12px",
|
|
493
493
|
paddingTop: "8px"
|
|
494
494
|
},
|
|
495
|
-
content: /* @__PURE__ */
|
|
495
|
+
content: /* @__PURE__ */ C(K, {
|
|
496
496
|
nameKey: r,
|
|
497
497
|
className: "flex-wrap"
|
|
498
498
|
})
|
|
@@ -500,8 +500,8 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
500
500
|
] })
|
|
501
501
|
});
|
|
502
502
|
}
|
|
503
|
-
if (
|
|
504
|
-
let e = i[0]?.dataKey || "value", t =
|
|
503
|
+
if (u === "funnel") {
|
|
504
|
+
let e = i[0]?.dataKey || "value", t = y(), o = c ? (t) => {
|
|
505
505
|
t && c({
|
|
506
506
|
category: t?.payload?.[r] ?? t?.[r],
|
|
507
507
|
value: t?.payload?.[e] ?? t?.[e]
|
|
@@ -509,45 +509,45 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
509
509
|
} : void 0, s = o ? {
|
|
510
510
|
onClick: o,
|
|
511
511
|
style: { cursor: "pointer" }
|
|
512
|
-
} : {}, l = [...
|
|
512
|
+
} : {}, l = [...d].sort((t, n) => {
|
|
513
513
|
let r = Number(t?.[e] ?? 0);
|
|
514
514
|
return Number(n?.[e] ?? 0) - r;
|
|
515
515
|
});
|
|
516
|
-
return /* @__PURE__ */
|
|
516
|
+
return /* @__PURE__ */ C(W, {
|
|
517
517
|
config: n,
|
|
518
518
|
className: a,
|
|
519
|
-
children: /* @__PURE__ */
|
|
519
|
+
children: /* @__PURE__ */ w(me, { children: [/* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }), /* @__PURE__ */ w(pe, {
|
|
520
520
|
dataKey: e,
|
|
521
521
|
data: l,
|
|
522
522
|
nameKey: r,
|
|
523
523
|
isAnimationActive: !0,
|
|
524
524
|
...s,
|
|
525
|
-
children: [/* @__PURE__ */
|
|
525
|
+
children: [/* @__PURE__ */ C(he, {
|
|
526
526
|
position: "right",
|
|
527
527
|
fill: "hsl(var(--foreground))",
|
|
528
528
|
stroke: "none",
|
|
529
529
|
dataKey: r
|
|
530
|
-
}), l.map((e, n) => /* @__PURE__ */
|
|
530
|
+
}), l.map((e, n) => /* @__PURE__ */ C(O, { fill: Z(t[n % t.length]) }, `funnel-cell-${n}`))]
|
|
531
531
|
})] })
|
|
532
532
|
});
|
|
533
533
|
}
|
|
534
|
-
if (
|
|
535
|
-
let e = i[0]?.dataKey || "value", t =
|
|
536
|
-
return /* @__PURE__ */
|
|
534
|
+
if (u === "treemap") {
|
|
535
|
+
let e = i[0]?.dataKey || "value", t = y();
|
|
536
|
+
return /* @__PURE__ */ C(W, {
|
|
537
537
|
config: n,
|
|
538
538
|
className: a,
|
|
539
|
-
children: /* @__PURE__ */
|
|
540
|
-
data:
|
|
539
|
+
children: /* @__PURE__ */ C(L, {
|
|
540
|
+
data: d.map((n, i) => ({
|
|
541
541
|
name: String(n?.[r] ?? ""),
|
|
542
542
|
size: Number(n?.[e]) || 0,
|
|
543
|
-
fill:
|
|
543
|
+
fill: Z(t[i % t.length])
|
|
544
544
|
})),
|
|
545
545
|
dataKey: "size",
|
|
546
546
|
nameKey: "name",
|
|
547
547
|
isAnimationActive: !0,
|
|
548
|
-
content: /* @__PURE__ */
|
|
548
|
+
content: /* @__PURE__ */ C((e) => {
|
|
549
549
|
let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
|
|
550
|
-
return r <= 0 || i <= 0 ? null : /* @__PURE__ */
|
|
550
|
+
return r <= 0 || i <= 0 ? null : /* @__PURE__ */ w("g", { children: [/* @__PURE__ */ C("rect", {
|
|
551
551
|
x: t,
|
|
552
552
|
y: n,
|
|
553
553
|
width: r,
|
|
@@ -555,7 +555,7 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
555
555
|
fill: o,
|
|
556
556
|
stroke: "hsl(var(--background))",
|
|
557
557
|
strokeWidth: 2
|
|
558
|
-
}), r > 48 && i > 18 ? /* @__PURE__ */
|
|
558
|
+
}), r > 48 && i > 18 ? /* @__PURE__ */ C("text", {
|
|
559
559
|
x: t + 6,
|
|
560
560
|
y: n + 18,
|
|
561
561
|
fill: "#fff",
|
|
@@ -564,21 +564,21 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
564
564
|
children: a
|
|
565
565
|
}) : null] });
|
|
566
566
|
}, {}),
|
|
567
|
-
...
|
|
568
|
-
children: /* @__PURE__ */
|
|
567
|
+
...oe,
|
|
568
|
+
children: /* @__PURE__ */ C(I, {})
|
|
569
569
|
})
|
|
570
570
|
});
|
|
571
571
|
}
|
|
572
|
-
if (
|
|
573
|
-
let e = i[0]?.dataKey || "value", t = i[0]?.label || e, o =
|
|
572
|
+
if (u === "sankey") {
|
|
573
|
+
let e = i[0]?.dataKey || "value", t = i[0]?.label || e, o = d.filter((t) => (Number(t?.[e]) || 0) > 0), s = [{ name: t }, ...o.map((e) => ({ name: String(e?.[r] ?? "") }))], c = o.map((t, n) => ({
|
|
574
574
|
source: 0,
|
|
575
575
|
target: n + 1,
|
|
576
576
|
value: Number(t?.[e]) || 0
|
|
577
577
|
}));
|
|
578
|
-
return c.length === 0 ? /* @__PURE__ */
|
|
578
|
+
return c.length === 0 ? /* @__PURE__ */ C("div", { className: a }) : /* @__PURE__ */ C(W, {
|
|
579
579
|
config: n,
|
|
580
580
|
className: a,
|
|
581
|
-
children: /* @__PURE__ */
|
|
581
|
+
children: /* @__PURE__ */ C(Se, {
|
|
582
582
|
data: {
|
|
583
583
|
nodes: s,
|
|
584
584
|
links: c
|
|
@@ -589,23 +589,23 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
589
589
|
strokeOpacity: .25
|
|
590
590
|
},
|
|
591
591
|
node: { fill: "hsl(var(--chart-1))" },
|
|
592
|
-
...
|
|
593
|
-
children: /* @__PURE__ */
|
|
592
|
+
...se,
|
|
593
|
+
children: /* @__PURE__ */ C(I, {})
|
|
594
594
|
})
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
|
-
if (
|
|
597
|
+
if (u === "radar") return /* @__PURE__ */ C(W, {
|
|
598
598
|
config: n,
|
|
599
599
|
className: a,
|
|
600
|
-
children: /* @__PURE__ */
|
|
601
|
-
data:
|
|
600
|
+
children: /* @__PURE__ */ w(M, {
|
|
601
|
+
data: d,
|
|
602
602
|
children: [
|
|
603
|
-
/* @__PURE__ */
|
|
604
|
-
/* @__PURE__ */
|
|
605
|
-
/* @__PURE__ */
|
|
606
|
-
/* @__PURE__ */
|
|
607
|
-
/* @__PURE__ */
|
|
608
|
-
content: /* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ C(be, {}),
|
|
604
|
+
/* @__PURE__ */ C(ye, { dataKey: r }),
|
|
605
|
+
/* @__PURE__ */ C(j, {}),
|
|
606
|
+
/* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
|
|
607
|
+
/* @__PURE__ */ C(Y, {
|
|
608
|
+
content: /* @__PURE__ */ C(K, {}),
|
|
609
609
|
...m && {
|
|
610
610
|
verticalAlign: "bottom",
|
|
611
611
|
wrapperStyle: {
|
|
@@ -615,8 +615,8 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
615
615
|
}
|
|
616
616
|
}),
|
|
617
617
|
i.map((e) => {
|
|
618
|
-
let t =
|
|
619
|
-
return /* @__PURE__ */
|
|
618
|
+
let t = Z(n[e.dataKey]?.color || X);
|
|
619
|
+
return /* @__PURE__ */ C(xe, {
|
|
620
620
|
dataKey: e.dataKey,
|
|
621
621
|
stroke: t,
|
|
622
622
|
fill: t,
|
|
@@ -626,12 +626,12 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
626
626
|
]
|
|
627
627
|
})
|
|
628
628
|
});
|
|
629
|
-
if (
|
|
629
|
+
if (u === "scatter") return /* @__PURE__ */ C(W, {
|
|
630
630
|
config: n,
|
|
631
631
|
className: a,
|
|
632
|
-
children: /* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
/* @__PURE__ */
|
|
632
|
+
children: /* @__PURE__ */ w(F, { children: [
|
|
633
|
+
/* @__PURE__ */ C(D, { vertical: !1 }),
|
|
634
|
+
/* @__PURE__ */ C(R, {
|
|
635
635
|
type: "number",
|
|
636
636
|
dataKey: r,
|
|
637
637
|
name: String(n[r]?.label || r),
|
|
@@ -639,22 +639,22 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
639
639
|
axisLine: !1,
|
|
640
640
|
minTickGap: m ? 32 : 48
|
|
641
641
|
}),
|
|
642
|
-
/* @__PURE__ */
|
|
642
|
+
/* @__PURE__ */ C(z, {
|
|
643
643
|
type: "number",
|
|
644
644
|
dataKey: i[0]?.dataKey || "value",
|
|
645
645
|
name: String(n[i[0]?.dataKey]?.label || i[0]?.dataKey),
|
|
646
646
|
tickLine: !1,
|
|
647
647
|
axisLine: !1,
|
|
648
|
-
tickFormatter:
|
|
648
|
+
tickFormatter: b,
|
|
649
649
|
width: 48
|
|
650
650
|
}),
|
|
651
|
-
/* @__PURE__ */
|
|
651
|
+
/* @__PURE__ */ C(Ce, {
|
|
652
652
|
type: "number",
|
|
653
653
|
range: [60, 400]
|
|
654
654
|
}),
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
content: /* @__PURE__ */
|
|
655
|
+
/* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
|
|
656
|
+
/* @__PURE__ */ C(Y, {
|
|
657
|
+
content: /* @__PURE__ */ C(K, {}),
|
|
658
658
|
...m && {
|
|
659
659
|
verticalAlign: "bottom",
|
|
660
660
|
wrapperStyle: {
|
|
@@ -664,46 +664,46 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
664
664
|
}
|
|
665
665
|
}),
|
|
666
666
|
i.map((e, t) => {
|
|
667
|
-
let r =
|
|
668
|
-
return /* @__PURE__ */
|
|
667
|
+
let r = y(), i = Z(n[e.dataKey]?.color || r[t % r.length]), a = Q(e, "scatter");
|
|
668
|
+
return /* @__PURE__ */ C(P, {
|
|
669
669
|
name: n[e.dataKey]?.label || e.dataKey,
|
|
670
|
-
data:
|
|
670
|
+
data: d,
|
|
671
671
|
fill: i,
|
|
672
672
|
fillOpacity: a?.fillOpacity,
|
|
673
|
-
...
|
|
673
|
+
...ae
|
|
674
674
|
}, e.dataKey);
|
|
675
675
|
})
|
|
676
676
|
] })
|
|
677
677
|
});
|
|
678
|
-
if (
|
|
678
|
+
if (u === "combo") return /* @__PURE__ */ C(W, {
|
|
679
679
|
config: n,
|
|
680
680
|
className: a,
|
|
681
|
-
children: /* @__PURE__ */
|
|
682
|
-
data:
|
|
681
|
+
children: /* @__PURE__ */ w(E, {
|
|
682
|
+
data: d,
|
|
683
683
|
children: [
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
684
|
+
/* @__PURE__ */ C(D, { vertical: !1 }),
|
|
685
|
+
/* @__PURE__ */ C(R, {
|
|
686
686
|
dataKey: r,
|
|
687
|
-
...
|
|
687
|
+
...x
|
|
688
688
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ C(z, {
|
|
690
690
|
yAxisId: "left",
|
|
691
691
|
tickLine: !1,
|
|
692
692
|
axisLine: !1,
|
|
693
|
-
tickFormatter:
|
|
693
|
+
tickFormatter: b,
|
|
694
694
|
width: 48
|
|
695
695
|
}),
|
|
696
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ C(z, {
|
|
697
697
|
yAxisId: "right",
|
|
698
698
|
orientation: "right",
|
|
699
699
|
tickLine: !1,
|
|
700
700
|
axisLine: !1,
|
|
701
|
-
tickFormatter:
|
|
701
|
+
tickFormatter: b,
|
|
702
702
|
width: 48
|
|
703
703
|
}),
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
content: /* @__PURE__ */
|
|
704
|
+
/* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
|
|
705
|
+
/* @__PURE__ */ C(Y, {
|
|
706
|
+
content: /* @__PURE__ */ C(K, {}),
|
|
707
707
|
...m && {
|
|
708
708
|
verticalAlign: "bottom",
|
|
709
709
|
wrapperStyle: {
|
|
@@ -713,8 +713,8 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
713
713
|
}
|
|
714
714
|
}),
|
|
715
715
|
i.map((e, t) => {
|
|
716
|
-
let r =
|
|
717
|
-
return i === "line" ? /* @__PURE__ */
|
|
716
|
+
let r = Z(n[e.dataKey]?.color || X), i = e.chartType || (t === 0 ? "bar" : "line"), a = i === "bar" ? "left" : "right", o = Q(e, i);
|
|
717
|
+
return i === "line" ? /* @__PURE__ */ C(ge, {
|
|
718
718
|
yAxisId: a,
|
|
719
719
|
type: "monotone",
|
|
720
720
|
dataKey: e.dataKey,
|
|
@@ -724,7 +724,7 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
724
724
|
strokeOpacity: o?.strokeOpacity,
|
|
725
725
|
strokeDasharray: o?.strokeDasharray,
|
|
726
726
|
...p
|
|
727
|
-
}, e.dataKey) : i === "area" ? /* @__PURE__ */
|
|
727
|
+
}, e.dataKey) : i === "area" ? /* @__PURE__ */ C(T, {
|
|
728
728
|
yAxisId: a,
|
|
729
729
|
type: "monotone",
|
|
730
730
|
dataKey: e.dataKey,
|
|
@@ -734,7 +734,7 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
734
734
|
strokeOpacity: o?.strokeOpacity,
|
|
735
735
|
strokeDasharray: o?.strokeDasharray,
|
|
736
736
|
...p
|
|
737
|
-
}, e.dataKey) : /* @__PURE__ */
|
|
737
|
+
}, e.dataKey) : /* @__PURE__ */ C(fe, {
|
|
738
738
|
yAxisId: a,
|
|
739
739
|
dataKey: e.dataKey,
|
|
740
740
|
fill: r,
|
|
@@ -746,75 +746,75 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
746
746
|
]
|
|
747
747
|
})
|
|
748
748
|
});
|
|
749
|
-
let
|
|
750
|
-
...
|
|
749
|
+
let k = u === "horizontal-bar", N = y(), we = s ? Object.values(s).map((e) => Z(String(e))) : [], Te = Array.from(new Set([
|
|
750
|
+
...N,
|
|
751
751
|
...we,
|
|
752
|
-
...i.map((e, t) =>
|
|
752
|
+
...i.map((e, t) => Z(n[e.dataKey]?.color || N[t % N.length] || X))
|
|
753
753
|
])), B = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
|
|
754
|
-
return /* @__PURE__ */
|
|
754
|
+
return /* @__PURE__ */ C(W, {
|
|
755
755
|
config: n,
|
|
756
756
|
className: a,
|
|
757
|
-
children: /* @__PURE__ */
|
|
758
|
-
data:
|
|
759
|
-
layout:
|
|
757
|
+
children: /* @__PURE__ */ w(ce, {
|
|
758
|
+
data: d,
|
|
759
|
+
layout: k ? "vertical" : "horizontal",
|
|
760
760
|
..._,
|
|
761
761
|
children: [
|
|
762
|
-
/* @__PURE__ */
|
|
762
|
+
/* @__PURE__ */ C("defs", { children: Te.map((e) => /* @__PURE__ */ w(f.Fragment, { children: [/* @__PURE__ */ w("linearGradient", {
|
|
763
763
|
id: `bg-${B(e)}`,
|
|
764
764
|
x1: "0",
|
|
765
765
|
y1: "0",
|
|
766
766
|
x2: "0",
|
|
767
767
|
y2: "1",
|
|
768
|
-
children: [/* @__PURE__ */
|
|
768
|
+
children: [/* @__PURE__ */ C("stop", {
|
|
769
769
|
offset: "0%",
|
|
770
770
|
style: { stopColor: e },
|
|
771
771
|
stopOpacity: .95
|
|
772
|
-
}), /* @__PURE__ */
|
|
772
|
+
}), /* @__PURE__ */ C("stop", {
|
|
773
773
|
offset: "100%",
|
|
774
774
|
style: { stopColor: e },
|
|
775
775
|
stopOpacity: .5
|
|
776
776
|
})]
|
|
777
|
-
}), /* @__PURE__ */
|
|
777
|
+
}), /* @__PURE__ */ w("linearGradient", {
|
|
778
778
|
id: `ag-${B(e)}`,
|
|
779
779
|
x1: "0",
|
|
780
780
|
y1: "0",
|
|
781
781
|
x2: "0",
|
|
782
782
|
y2: "1",
|
|
783
|
-
children: [/* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ C("stop", {
|
|
784
784
|
offset: "0%",
|
|
785
785
|
style: { stopColor: e },
|
|
786
786
|
stopOpacity: .5
|
|
787
|
-
}), /* @__PURE__ */
|
|
787
|
+
}), /* @__PURE__ */ C("stop", {
|
|
788
788
|
offset: "95%",
|
|
789
789
|
style: { stopColor: e },
|
|
790
790
|
stopOpacity: .05
|
|
791
791
|
})]
|
|
792
792
|
})] }, B(e))) }),
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
-
|
|
793
|
+
/* @__PURE__ */ C(D, { vertical: !1 }),
|
|
794
|
+
k ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(R, {
|
|
795
795
|
type: "number",
|
|
796
796
|
tickLine: !1,
|
|
797
797
|
axisLine: !1,
|
|
798
|
-
tickFormatter:
|
|
799
|
-
}), /* @__PURE__ */
|
|
798
|
+
tickFormatter: b
|
|
799
|
+
}), /* @__PURE__ */ C(z, {
|
|
800
800
|
type: "category",
|
|
801
801
|
dataKey: r,
|
|
802
802
|
tickLine: !1,
|
|
803
803
|
axisLine: !1,
|
|
804
|
-
width: Math.min(140, Math.max(60, Math.max(...
|
|
805
|
-
tickFormatter:
|
|
806
|
-
})] }) : /* @__PURE__ */ S
|
|
804
|
+
width: Math.min(140, Math.max(60, Math.max(...d.map((e) => String(e[r] ?? "").length)) * 7)),
|
|
805
|
+
tickFormatter: le
|
|
806
|
+
})] }) : /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(R, {
|
|
807
807
|
dataKey: r,
|
|
808
|
-
...
|
|
809
|
-
}), /* @__PURE__ */
|
|
808
|
+
...x
|
|
809
|
+
}), /* @__PURE__ */ C(z, {
|
|
810
810
|
tickLine: !1,
|
|
811
811
|
axisLine: !1,
|
|
812
|
-
tickFormatter:
|
|
812
|
+
tickFormatter: b,
|
|
813
813
|
width: 48
|
|
814
814
|
})] }),
|
|
815
|
-
/* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
content: /* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
|
|
816
|
+
/* @__PURE__ */ C(Y, {
|
|
817
|
+
content: /* @__PURE__ */ C(K, {}),
|
|
818
818
|
...m && {
|
|
819
819
|
verticalAlign: "bottom",
|
|
820
820
|
wrapperStyle: {
|
|
@@ -824,21 +824,21 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
824
824
|
}
|
|
825
825
|
}),
|
|
826
826
|
i.map((e, t) => {
|
|
827
|
-
let a =
|
|
828
|
-
if (
|
|
829
|
-
let t = i.filter((e) => e.variant !== "comparison").length === 1 && !o && i.length === 1 &&
|
|
830
|
-
return /* @__PURE__ */
|
|
827
|
+
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);
|
|
828
|
+
if (u === "bar" || u === "horizontal-bar") {
|
|
829
|
+
let t = i.filter((e) => e.variant !== "comparison").length === 1 && !o && i.length === 1 && d.length > 1, n = Q(e, "bar");
|
|
830
|
+
return /* @__PURE__ */ C(fe, {
|
|
831
831
|
dataKey: e.dataKey,
|
|
832
832
|
fill: `url(#bg-${B(l)})`,
|
|
833
833
|
radius: 4,
|
|
834
834
|
fillOpacity: n?.fillOpacity,
|
|
835
835
|
...p,
|
|
836
|
-
children: t &&
|
|
836
|
+
children: t && d.map((e, t) => /* @__PURE__ */ C(O, { fill: `url(#bg-${B(Z(v(e?.[r], t, a)))})` }, `cell-${t}`))
|
|
837
837
|
}, e.dataKey);
|
|
838
838
|
}
|
|
839
|
-
if (
|
|
840
|
-
let t =
|
|
841
|
-
return /* @__PURE__ */
|
|
839
|
+
if (u === "line") {
|
|
840
|
+
let t = Q(e, "line");
|
|
841
|
+
return /* @__PURE__ */ C(ge, {
|
|
842
842
|
type: "monotone",
|
|
843
843
|
dataKey: e.dataKey,
|
|
844
844
|
stroke: l,
|
|
@@ -849,9 +849,9 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
849
849
|
...p
|
|
850
850
|
}, e.dataKey);
|
|
851
851
|
}
|
|
852
|
-
if (
|
|
853
|
-
let t =
|
|
854
|
-
return /* @__PURE__ */
|
|
852
|
+
if (u === "area") {
|
|
853
|
+
let t = Q(e, "area");
|
|
854
|
+
return /* @__PURE__ */ C(T, {
|
|
855
855
|
type: "monotone",
|
|
856
856
|
dataKey: e.dataKey,
|
|
857
857
|
fill: `url(#ag-${B(l)})`,
|
|
@@ -869,8 +869,8 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
869
869
|
})
|
|
870
870
|
});
|
|
871
871
|
}
|
|
872
|
-
var
|
|
873
|
-
|
|
872
|
+
var X, Ye, Z, Q, Xe = H((() => {
|
|
873
|
+
Ve(), Ke(), X = "hsl(var(--primary))", Ye = {
|
|
874
874
|
slate: "#64748b",
|
|
875
875
|
gray: "#6b7280",
|
|
876
876
|
zinc: "#71717a",
|
|
@@ -893,14 +893,14 @@ var Y, qe, X, Z, Je = H((() => {
|
|
|
893
893
|
fuchsia: "#d946ef",
|
|
894
894
|
pink: "#ec4899",
|
|
895
895
|
rose: "#f43f5e"
|
|
896
|
-
},
|
|
896
|
+
}, Z = (e) => Ye[e] || e, Q = (e, t) => e?.variant === "comparison" ? {
|
|
897
897
|
strokeOpacity: typeof e.opacity == "number" ? e.opacity : t === "line" || t === "scatter" ? .5 : .6,
|
|
898
898
|
fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
|
|
899
899
|
strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
|
|
900
900
|
} : null;
|
|
901
|
-
})),
|
|
902
|
-
fallback: /* @__PURE__ */ x
|
|
903
|
-
children: /* @__PURE__ */
|
|
901
|
+
})), Ze = p.lazy(() => Promise.resolve().then(() => (Fe(), U))), Qe = p.lazy(() => Promise.resolve().then(() => (Xe(), qe))), $e = ({ schema: e }) => /* @__PURE__ */ C(m, {
|
|
902
|
+
fallback: /* @__PURE__ */ C(x, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
903
|
+
children: /* @__PURE__ */ C(Ze, {
|
|
904
904
|
data: e.data,
|
|
905
905
|
dataKey: e.dataKey,
|
|
906
906
|
xAxisKey: e.xAxisKey,
|
|
@@ -908,8 +908,8 @@ var Y, qe, X, Z, Je = H((() => {
|
|
|
908
908
|
className: e.className,
|
|
909
909
|
color: e.color
|
|
910
910
|
})
|
|
911
|
-
}),
|
|
912
|
-
let n =
|
|
911
|
+
}), $ = ({ schema: e, onChartClick: t }) => {
|
|
912
|
+
let n = p.useMemo(() => {
|
|
913
913
|
let t = e.series, n = e.xAxisKey, r = e.config;
|
|
914
914
|
if (n || (e.index ? n = e.index : e.category && (n = e.category)), t || (e.categories ? t = e.categories.map((e) => ({ dataKey: e })) : e.value && (t = [{ dataKey: e.value }])), !r && t) {
|
|
915
915
|
let n = e.colors || [
|
|
@@ -933,9 +933,9 @@ var Y, qe, X, Z, Je = H((() => {
|
|
|
933
933
|
className: e.className
|
|
934
934
|
};
|
|
935
935
|
}, [e]);
|
|
936
|
-
return /* @__PURE__ */
|
|
937
|
-
fallback: /* @__PURE__ */ x
|
|
938
|
-
children: /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ C(m, {
|
|
937
|
+
fallback: /* @__PURE__ */ C(x, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
938
|
+
children: /* @__PURE__ */ C(Qe, {
|
|
939
939
|
chartType: n.chartType,
|
|
940
940
|
data: n.data,
|
|
941
941
|
config: n.config,
|
|
@@ -951,10 +951,10 @@ var Y, qe, X, Z, Je = H((() => {
|
|
|
951
951
|
};
|
|
952
952
|
//#endregion
|
|
953
953
|
//#region src/ObjectChart.tsx
|
|
954
|
-
function
|
|
954
|
+
function et(e) {
|
|
955
955
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
956
956
|
}
|
|
957
|
-
function
|
|
957
|
+
function tt(e, t) {
|
|
958
958
|
let { field: n, function: r, groupBy: i } = t, a = {};
|
|
959
959
|
for (let t of e) {
|
|
960
960
|
let e = String(t[i] ?? "Unknown");
|
|
@@ -985,16 +985,16 @@ function Qe(e, t) {
|
|
|
985
985
|
};
|
|
986
986
|
});
|
|
987
987
|
}
|
|
988
|
-
async function
|
|
988
|
+
async function nt(e, t, n, r, i) {
|
|
989
989
|
if (!e.length || !t) return e;
|
|
990
|
-
let
|
|
990
|
+
let a = i || ((e, t) => t), s = `__raw_${t}`, c = n?.fields?.[t];
|
|
991
991
|
if (!c) {
|
|
992
992
|
let n = /^\d{4}-\d{2}-\d{2}/;
|
|
993
993
|
return e.map((e) => {
|
|
994
|
-
let r = e[t], i = String(r ?? ""),
|
|
994
|
+
let r = e[t], i = String(r ?? ""), o = n.test(i) ? i : et(i);
|
|
995
995
|
return {
|
|
996
996
|
...e,
|
|
997
|
-
[t]:
|
|
997
|
+
[t]: a(i, o),
|
|
998
998
|
[s]: r
|
|
999
999
|
};
|
|
1000
1000
|
});
|
|
@@ -1003,20 +1003,20 @@ async function $e(e, t, n, r, i) {
|
|
|
1003
1003
|
if (l === "select" || l === "picklist" || l === "dropdown") {
|
|
1004
1004
|
let n = c.options || [];
|
|
1005
1005
|
if (n.length === 0) return e.map((e) => {
|
|
1006
|
-
let n = e[t], r = String(n ?? ""), i =
|
|
1006
|
+
let n = e[t], r = String(n ?? ""), i = et(r);
|
|
1007
1007
|
return {
|
|
1008
1008
|
...e,
|
|
1009
|
-
[t]:
|
|
1009
|
+
[t]: a(r, i),
|
|
1010
1010
|
[s]: n
|
|
1011
1011
|
};
|
|
1012
1012
|
});
|
|
1013
1013
|
let r = {};
|
|
1014
1014
|
for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
|
|
1015
1015
|
return e.map((e) => {
|
|
1016
|
-
let n = e[t], i = String(n ?? ""),
|
|
1016
|
+
let n = e[t], i = String(n ?? ""), o = r[i] || et(i);
|
|
1017
1017
|
return {
|
|
1018
1018
|
...e,
|
|
1019
|
-
[t]:
|
|
1019
|
+
[t]: a(i, o),
|
|
1020
1020
|
[s]: n
|
|
1021
1021
|
};
|
|
1022
1022
|
});
|
|
@@ -1032,14 +1032,14 @@ async function $e(e, t, n, r, i) {
|
|
|
1032
1032
|
...e,
|
|
1033
1033
|
[s]: e[t]
|
|
1034
1034
|
}));
|
|
1035
|
-
let
|
|
1035
|
+
let a = c.id_field || "id";
|
|
1036
1036
|
try {
|
|
1037
|
-
let l =
|
|
1038
|
-
$filter: { [
|
|
1037
|
+
let l = o(await r.find(n, {
|
|
1038
|
+
$filter: { [a]: { $in: i } },
|
|
1039
1039
|
$top: i.length
|
|
1040
1040
|
})), u = c.reference_field || c.display_field || "name", d = {};
|
|
1041
1041
|
for (let e of l) {
|
|
1042
|
-
let t = String(e[
|
|
1042
|
+
let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[u] || e.name || e.label || e.title || t;
|
|
1043
1043
|
t && (d[t] = String(n));
|
|
1044
1044
|
}
|
|
1045
1045
|
return e.map((e) => {
|
|
@@ -1066,283 +1066,297 @@ async function $e(e, t, n, r, i) {
|
|
|
1066
1066
|
let n = e[t], r = String(n ?? "");
|
|
1067
1067
|
return {
|
|
1068
1068
|
...e,
|
|
1069
|
-
[t]: u.test(r) ? r :
|
|
1069
|
+
[t]: u.test(r) ? r : et(r),
|
|
1070
1070
|
[s]: n
|
|
1071
1071
|
};
|
|
1072
1072
|
});
|
|
1073
1073
|
}
|
|
1074
|
-
var
|
|
1075
|
-
let { schema:
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
}, [
|
|
1079
|
-
let [
|
|
1080
|
-
d:
|
|
1081
|
-
dim:
|
|
1082
|
-
val:
|
|
1074
|
+
var rt = (e) => {
|
|
1075
|
+
let { schema: f } = e, p = e.onSegmentClick, m = g(Te), x = e.dataSource || m?.dataSource, S = B(f.bind), { fieldOptionLabel: T } = ke(), de = te(T);
|
|
1076
|
+
ee(() => {
|
|
1077
|
+
de.current = T;
|
|
1078
|
+
}, [T]);
|
|
1079
|
+
let [fe, E] = v([]), [D, O] = v(() => !(Array.isArray(f.data) && f.data.length > 0) && (!!f.objectName || !!f.dataset)), [pe, me] = v(null), [he, k] = v(null), [ge, _e] = v(null), [ve, A] = v(null), { openRecordList: ye } = Ee(), be = Ae(), j = _(() => f.aggregate ? JSON.stringify(f.aggregate) : "", [f.aggregate]), xe = _(() => f.filter ? JSON.stringify(f.filter) : "", [f.filter]), M = _(() => f.compareTo ? JSON.stringify(f.compareTo) : "", [f.compareTo]), N = _(() => f.dataset ? JSON.stringify({
|
|
1080
|
+
d: f.dataset,
|
|
1081
|
+
dim: f.dimensions ?? [],
|
|
1082
|
+
val: f.values ?? []
|
|
1083
1083
|
}) : "", [
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
]),
|
|
1088
|
-
|
|
1084
|
+
f.dataset,
|
|
1085
|
+
f.dimensions,
|
|
1086
|
+
f.values
|
|
1087
|
+
]), Se = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
|
|
1088
|
+
ee(() => {
|
|
1089
1089
|
let e = !1;
|
|
1090
1090
|
return (async () => {
|
|
1091
1091
|
try {
|
|
1092
1092
|
let t = {
|
|
1093
1093
|
headers: { accept: "application/json" },
|
|
1094
1094
|
credentials: "include"
|
|
1095
|
-
},
|
|
1096
|
-
if (
|
|
1097
|
-
else if (
|
|
1098
|
-
let e = Array.isArray(
|
|
1099
|
-
|
|
1095
|
+
}, i = f.objectName, a, o = null, s = f.aggregate?.groupBy;
|
|
1096
|
+
if (i) a = s && typeof s == "object" && !Array.isArray(s) ? s.field : typeof s == "string" ? s : f.xAxisKey;
|
|
1097
|
+
else if (f.dataset) {
|
|
1098
|
+
let e = Array.isArray(f.dimensions) && f.dimensions.length ? f.dimensions[0] : void 0, n = await (await fetch(`/api/v1/meta/dataset/${encodeURIComponent(f.dataset)}`, t)).json().catch(() => null);
|
|
1099
|
+
o = n?.item ?? n?.data ?? n, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
|
|
1100
1100
|
}
|
|
1101
|
-
if (!
|
|
1102
|
-
e ||
|
|
1101
|
+
if (!i || !a) {
|
|
1102
|
+
e || (_e(null), A(null));
|
|
1103
1103
|
return;
|
|
1104
1104
|
}
|
|
1105
|
-
let
|
|
1106
|
-
|
|
1105
|
+
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;
|
|
1106
|
+
if (f.dataset && Array.isArray(f.dimensions)) {
|
|
1107
|
+
let e = {};
|
|
1108
|
+
for (let t of f.dimensions) {
|
|
1109
|
+
let r = (o?.dimensions || []).find((e) => e?.name === t)?.field ?? t, i = n(l?.fields?.[r]?.options);
|
|
1110
|
+
i && (e[t] = i);
|
|
1111
|
+
}
|
|
1112
|
+
Object.keys(e).length > 0 && (d = e);
|
|
1113
|
+
}
|
|
1114
|
+
e || (_e(u), A(d));
|
|
1107
1115
|
} catch {
|
|
1108
|
-
e ||
|
|
1116
|
+
e || (_e(null), A(null));
|
|
1109
1117
|
}
|
|
1110
1118
|
})(), () => {
|
|
1111
1119
|
e = !0;
|
|
1112
1120
|
};
|
|
1113
1121
|
}, [
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1122
|
+
f.objectName,
|
|
1123
|
+
f.dataset,
|
|
1124
|
+
N,
|
|
1117
1125
|
j,
|
|
1118
|
-
|
|
1126
|
+
f.xAxisKey
|
|
1119
1127
|
]);
|
|
1120
|
-
let
|
|
1121
|
-
if (
|
|
1122
|
-
let n =
|
|
1128
|
+
let P = h(async (e, t) => {
|
|
1129
|
+
if (f.aggregate && typeof e.aggregate == "function") {
|
|
1130
|
+
let n = f.aggregate.groupBy;
|
|
1123
1131
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
1124
|
-
let r =
|
|
1132
|
+
let r = f.aggregate.field, i = f.aggregate.function, a = {
|
|
1125
1133
|
function: i,
|
|
1126
1134
|
alias: r || i
|
|
1127
1135
|
};
|
|
1128
1136
|
i !== "count" && r && (a.field = r);
|
|
1129
|
-
let o = await e.aggregate(
|
|
1137
|
+
let o = await e.aggregate(f.objectName, {
|
|
1130
1138
|
groupBy: [n],
|
|
1131
1139
|
aggregations: [a],
|
|
1132
1140
|
where: t
|
|
1133
1141
|
});
|
|
1134
1142
|
return Array.isArray(o) ? o : [];
|
|
1135
1143
|
}
|
|
1136
|
-
let r = await e.aggregate(
|
|
1137
|
-
field:
|
|
1138
|
-
function:
|
|
1144
|
+
let r = await e.aggregate(f.objectName, {
|
|
1145
|
+
field: f.aggregate.field,
|
|
1146
|
+
function: f.aggregate.function,
|
|
1139
1147
|
groupBy: n,
|
|
1140
1148
|
filter: t
|
|
1141
1149
|
});
|
|
1142
1150
|
return Array.isArray(r) ? r : [];
|
|
1143
1151
|
}
|
|
1144
1152
|
if (typeof e.find == "function") {
|
|
1145
|
-
let n =
|
|
1146
|
-
return
|
|
1153
|
+
let n = o(await e.find(f.objectName, { $filter: t }));
|
|
1154
|
+
return f.aggregate && n.length > 0 && (n = tt(n, f.aggregate)), n;
|
|
1147
1155
|
}
|
|
1148
1156
|
return [];
|
|
1149
|
-
}, [
|
|
1150
|
-
if (!e || !
|
|
1151
|
-
t.current &&
|
|
1157
|
+
}, [f.objectName, j]), F = h(async (e, t) => {
|
|
1158
|
+
if (!e || !f.objectName && !f.dataset) {
|
|
1159
|
+
t.current && O(!1);
|
|
1152
1160
|
return;
|
|
1153
1161
|
}
|
|
1154
|
-
t.current && (
|
|
1162
|
+
t.current && (O(!0), me(null));
|
|
1155
1163
|
try {
|
|
1156
|
-
if (
|
|
1157
|
-
let n =
|
|
1158
|
-
dimensions: Array.isArray(
|
|
1159
|
-
measures: Array.isArray(
|
|
1164
|
+
if (f.dataset && typeof e.queryDataset == "function") {
|
|
1165
|
+
let n = l(f.filter), r = await e.queryDataset(f.dataset, {
|
|
1166
|
+
dimensions: Array.isArray(f.dimensions) ? f.dimensions : [],
|
|
1167
|
+
measures: Array.isArray(f.values) ? f.values : [],
|
|
1160
1168
|
...n ? { runtimeFilter: n } : {}
|
|
1161
1169
|
});
|
|
1162
|
-
t.current &&
|
|
1170
|
+
t.current && E(Array.isArray(r?.rows) ? r.rows : []);
|
|
1163
1171
|
return;
|
|
1164
1172
|
}
|
|
1165
|
-
let n =
|
|
1166
|
-
if (i &&
|
|
1167
|
-
let e =
|
|
1173
|
+
let n = l(f.filter), r = f.compareTo, i = !!r && Se(f.chartType), a = i ? d(f.filter, r) : null, [o, s] = await Promise.all([P(e, n), a ? P(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;
|
|
1174
|
+
if (i && s.length > 0 && f.aggregate) {
|
|
1175
|
+
let e = f.aggregate.field, t = f.aggregate.function, n = (n) => {
|
|
1168
1176
|
if (n == null) return null;
|
|
1169
1177
|
let r = `${e}_${t}`;
|
|
1170
1178
|
return r in n ? Number(n[r]) : t === "count" && `${e}_count` in n ? Number(n[`${e}_count`]) : e in n ? Number(n[e]) : "value" in n ? Number(n.value) : "count" in n ? Number(n.count) : null;
|
|
1171
1179
|
}, r = `${e}__comparison`, i = p;
|
|
1172
|
-
if (i &&
|
|
1180
|
+
if (i && c.some((e) => e[i] != null) && s.some((e) => e[i] != null)) {
|
|
1173
1181
|
let e = /* @__PURE__ */ new Map();
|
|
1174
|
-
for (let t of
|
|
1182
|
+
for (let t of s) {
|
|
1175
1183
|
let r = String(t[i] ?? "");
|
|
1176
1184
|
e.set(r, n(t));
|
|
1177
1185
|
}
|
|
1178
|
-
|
|
1186
|
+
c = c.map((t) => {
|
|
1179
1187
|
let n = String(t[i] ?? ""), a = e.get(n);
|
|
1180
1188
|
return a == null ? t : {
|
|
1181
1189
|
...t,
|
|
1182
1190
|
[r]: a
|
|
1183
1191
|
};
|
|
1184
1192
|
});
|
|
1185
|
-
let t = new Set(
|
|
1186
|
-
for (let e of
|
|
1193
|
+
let t = new Set(c.map((e) => String(e[i] ?? "")));
|
|
1194
|
+
for (let e of s) {
|
|
1187
1195
|
let a = String(e[i] ?? "");
|
|
1188
|
-
t.has(a) ||
|
|
1196
|
+
t.has(a) || c.push({
|
|
1189
1197
|
[i]: a,
|
|
1190
1198
|
[r]: n(e)
|
|
1191
1199
|
});
|
|
1192
1200
|
}
|
|
1193
1201
|
} else {
|
|
1194
|
-
let e = Math.max(
|
|
1202
|
+
let e = Math.max(c.length, s.length), t = [];
|
|
1195
1203
|
for (let i = 0; i < e; i++) {
|
|
1196
|
-
let e =
|
|
1204
|
+
let e = c[i] || {}, a = s[i];
|
|
1197
1205
|
t.push(a ? {
|
|
1198
1206
|
...e,
|
|
1199
1207
|
[r]: n(a)
|
|
1200
1208
|
} : e);
|
|
1201
1209
|
}
|
|
1202
|
-
|
|
1210
|
+
c = t;
|
|
1203
1211
|
}
|
|
1204
1212
|
}
|
|
1205
1213
|
if (p && typeof e.getObjectSchema == "function") try {
|
|
1206
|
-
let t = await e.getObjectSchema(
|
|
1207
|
-
|
|
1214
|
+
let t = await e.getObjectSchema(f.objectName);
|
|
1215
|
+
c = await nt(c, p, t, e, (e, t) => de.current(f.objectName, p, e, t));
|
|
1208
1216
|
} catch {}
|
|
1209
|
-
t.current &&
|
|
1217
|
+
t.current && E(c);
|
|
1210
1218
|
} catch (e) {
|
|
1211
|
-
console.error("[ObjectChart] Fetch error:", e), t.current &&
|
|
1219
|
+
console.error("[ObjectChart] Fetch error:", e), t.current && me(e instanceof Error ? e.message : "Failed to load chart data");
|
|
1212
1220
|
} finally {
|
|
1213
|
-
t.current &&
|
|
1221
|
+
t.current && O(!1);
|
|
1214
1222
|
}
|
|
1215
1223
|
}, [
|
|
1216
|
-
|
|
1217
|
-
|
|
1224
|
+
f.objectName,
|
|
1225
|
+
N,
|
|
1218
1226
|
j,
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1227
|
+
xe,
|
|
1228
|
+
M,
|
|
1229
|
+
f.xAxisKey,
|
|
1230
|
+
f.chartType,
|
|
1231
|
+
P
|
|
1224
1232
|
]);
|
|
1225
|
-
|
|
1233
|
+
ee(() => {
|
|
1226
1234
|
let e = { current: !0 };
|
|
1227
|
-
return (
|
|
1235
|
+
return (f.objectName || f.dataset) && !S && !f.data ? F(x, e) : e.current && O(!1), () => {
|
|
1228
1236
|
e.current = !1;
|
|
1229
1237
|
};
|
|
1230
1238
|
}, [
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1239
|
+
f.objectName,
|
|
1240
|
+
N,
|
|
1241
|
+
x,
|
|
1242
|
+
S,
|
|
1243
|
+
f.data,
|
|
1244
|
+
xe,
|
|
1237
1245
|
j,
|
|
1238
|
-
|
|
1239
|
-
|
|
1246
|
+
M,
|
|
1247
|
+
F
|
|
1240
1248
|
]);
|
|
1241
|
-
let
|
|
1242
|
-
if (!
|
|
1243
|
-
let e = /* @__PURE__ */ new Map(), t = `__raw_${
|
|
1244
|
-
for (let n of
|
|
1245
|
-
let r = n?.[
|
|
1249
|
+
let I = S || f.data || fe, L = Array.isArray(I) ? I : [], R = f.drillDown, z = f.aggregate?.groupBy || f.xAxisKey, Ce = _(() => {
|
|
1250
|
+
if (!z) return /* @__PURE__ */ new Map();
|
|
1251
|
+
let e = /* @__PURE__ */ new Map(), t = `__raw_${z}`;
|
|
1252
|
+
for (let n of L) {
|
|
1253
|
+
let r = n?.[z];
|
|
1246
1254
|
if (r == null) continue;
|
|
1247
1255
|
let i = t in (n || {}) ? n[t] : r;
|
|
1248
1256
|
e.set(String(r), i);
|
|
1249
1257
|
}
|
|
1250
1258
|
return e;
|
|
1251
|
-
}, [
|
|
1252
|
-
let e = Array.isArray(
|
|
1253
|
-
if (!
|
|
1254
|
-
let t = e || [{ dataKey:
|
|
1259
|
+
}, [L, z]), V = f.compareTo, H = !!V && Se(f.chartType) && !!f.aggregate && L.some((e) => e[`${f.aggregate.field}__comparison`] != null), je = _(() => {
|
|
1260
|
+
let e = Array.isArray(f.series) ? f.series : null;
|
|
1261
|
+
if (!H) return e;
|
|
1262
|
+
let t = e || [{ dataKey: f.aggregate.field }], n = {
|
|
1255
1263
|
vsLastWeek: "Previous week",
|
|
1256
1264
|
vsLastMonth: "Previous month",
|
|
1257
1265
|
vsLastQuarter: "Previous quarter",
|
|
1258
1266
|
vsLastYear: "Previous year",
|
|
1259
1267
|
vsYesterday: "Yesterday",
|
|
1260
1268
|
vsPreviousPeriod: "Previous period"
|
|
1261
|
-
}[
|
|
1269
|
+
}[i(V, f.filter)] || "Previous period";
|
|
1262
1270
|
return [...t.map((e) => ({
|
|
1263
1271
|
...e,
|
|
1264
1272
|
variant: e.variant || "current"
|
|
1265
1273
|
})), {
|
|
1266
|
-
dataKey: `${
|
|
1274
|
+
dataKey: `${f.aggregate.field}__comparison`,
|
|
1267
1275
|
label: n,
|
|
1268
1276
|
variant: "comparison"
|
|
1269
1277
|
}];
|
|
1270
1278
|
}, [
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
]),
|
|
1277
|
-
...
|
|
1278
|
-
data:
|
|
1279
|
-
xAxisKey:
|
|
1280
|
-
series:
|
|
1279
|
+
H,
|
|
1280
|
+
f.series,
|
|
1281
|
+
f.aggregate,
|
|
1282
|
+
f.filter,
|
|
1283
|
+
V
|
|
1284
|
+
]), U = f.dataset ? t(c(L, ve), f.dimensions, f.values) : null, Me = U ? {
|
|
1285
|
+
...f,
|
|
1286
|
+
data: U.data,
|
|
1287
|
+
xAxisKey: U.xAxisKey,
|
|
1288
|
+
series: U.series
|
|
1281
1289
|
} : {
|
|
1282
|
-
...
|
|
1283
|
-
data:
|
|
1284
|
-
...
|
|
1285
|
-
},
|
|
1286
|
-
...
|
|
1287
|
-
...
|
|
1288
|
-
} : void 0,
|
|
1289
|
-
...
|
|
1290
|
-
colors:
|
|
1291
|
-
...
|
|
1290
|
+
...f,
|
|
1291
|
+
data: L,
|
|
1292
|
+
...je ? { series: je } : {}
|
|
1293
|
+
}, Ne = f.colors && !Array.isArray(f.colors) && typeof f.colors == "object" ? f.colors : null, Pe = Array.isArray(f.colors) ? f.colors : void 0, Fe = ge || Ne ? {
|
|
1294
|
+
...ge || {},
|
|
1295
|
+
...Ne || {}
|
|
1296
|
+
} : void 0, Ie = {
|
|
1297
|
+
...Me,
|
|
1298
|
+
colors: Pe,
|
|
1299
|
+
...Fe ? { categoryColors: Fe } : {}
|
|
1292
1300
|
};
|
|
1293
|
-
if (
|
|
1294
|
-
className: "
|
|
1301
|
+
if (D && L.length === 0) return /* @__PURE__ */ w("div", {
|
|
1302
|
+
className: "p-2 " + (f.className || ""),
|
|
1295
1303
|
"data-testid": "chart-loading",
|
|
1296
|
-
|
|
1304
|
+
role: "status",
|
|
1305
|
+
"aria-busy": "true",
|
|
1306
|
+
"aria-live": "polite",
|
|
1307
|
+
children: [/* @__PURE__ */ C("span", {
|
|
1308
|
+
className: "sr-only",
|
|
1309
|
+
children: "Loading chart data…"
|
|
1310
|
+
}), /* @__PURE__ */ C(re, { className: "h-full" })]
|
|
1297
1311
|
});
|
|
1298
|
-
if (
|
|
1299
|
-
className: "flex flex-col items-center justify-center gap-2 p-4 " + (
|
|
1312
|
+
if (pe) return /* @__PURE__ */ w("div", {
|
|
1313
|
+
className: "flex flex-col items-center justify-center gap-2 p-4 " + (f.className || ""),
|
|
1300
1314
|
"data-testid": "chart-error",
|
|
1301
1315
|
role: "alert",
|
|
1302
1316
|
children: [
|
|
1303
|
-
/* @__PURE__ */
|
|
1304
|
-
/* @__PURE__ */
|
|
1317
|
+
/* @__PURE__ */ C(De, { className: "h-6 w-6 text-destructive opacity-60" }),
|
|
1318
|
+
/* @__PURE__ */ C("p", {
|
|
1305
1319
|
className: "text-xs text-destructive font-medium",
|
|
1306
1320
|
children: "Failed to load chart data"
|
|
1307
1321
|
}),
|
|
1308
|
-
/* @__PURE__ */
|
|
1322
|
+
/* @__PURE__ */ C("p", {
|
|
1309
1323
|
className: "text-xs text-muted-foreground max-w-xs text-center",
|
|
1310
|
-
children:
|
|
1324
|
+
children: pe
|
|
1311
1325
|
})
|
|
1312
1326
|
]
|
|
1313
1327
|
});
|
|
1314
|
-
if (!
|
|
1315
|
-
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (
|
|
1328
|
+
if (!x && f.objectName && L.length === 0) return /* @__PURE__ */ w("div", {
|
|
1329
|
+
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (f.className || ""),
|
|
1316
1330
|
"data-testid": "chart-no-datasource",
|
|
1317
1331
|
children: [
|
|
1318
1332
|
"No data source available for “",
|
|
1319
|
-
|
|
1333
|
+
f.objectName,
|
|
1320
1334
|
"”"
|
|
1321
1335
|
]
|
|
1322
1336
|
});
|
|
1323
|
-
let
|
|
1324
|
-
let t = e.category, n = t != null &&
|
|
1325
|
-
|
|
1337
|
+
let W = s(R) ? (e) => {
|
|
1338
|
+
let t = e.category, n = t != null && Ce.has(String(t)) ? Ce.get(String(t)) : t;
|
|
1339
|
+
k({
|
|
1326
1340
|
...e,
|
|
1327
1341
|
category: n,
|
|
1328
1342
|
categoryLabel: t,
|
|
1329
1343
|
scope: "cell"
|
|
1330
1344
|
});
|
|
1331
|
-
} : void 0,
|
|
1332
|
-
let e =
|
|
1333
|
-
...
|
|
1345
|
+
} : void 0, G = p ?? W, K = !p && he && f.objectName ? (() => {
|
|
1346
|
+
let e = a(R, he, { groupByField: z }), t = {
|
|
1347
|
+
...f.filter || {},
|
|
1334
1348
|
...e
|
|
1335
|
-
}, n =
|
|
1349
|
+
}, n = u(R, he, f.title || "Details"), r = R?.target ?? "drawer", i = /* @__PURE__ */ C("div", {
|
|
1336
1350
|
className: "overflow-auto",
|
|
1337
1351
|
"data-testid": "chart-drill-body",
|
|
1338
|
-
children: /* @__PURE__ */
|
|
1352
|
+
children: /* @__PURE__ */ C(we, {
|
|
1339
1353
|
schema: {
|
|
1340
1354
|
type: "object-data-table",
|
|
1341
|
-
objectName:
|
|
1355
|
+
objectName: f.objectName,
|
|
1342
1356
|
filter: t,
|
|
1343
1357
|
pagination: !0,
|
|
1344
|
-
pageSize:
|
|
1345
|
-
columns:
|
|
1358
|
+
pageSize: R?.maxRows,
|
|
1359
|
+
columns: R?.columns?.map((e) => ({
|
|
1346
1360
|
accessorKey: e,
|
|
1347
1361
|
header: e
|
|
1348
1362
|
})),
|
|
@@ -1352,58 +1366,58 @@ var et = (e) => {
|
|
|
1352
1366
|
target: "dialog"
|
|
1353
1367
|
}
|
|
1354
1368
|
},
|
|
1355
|
-
dataSource:
|
|
1369
|
+
dataSource: x
|
|
1356
1370
|
})
|
|
1357
|
-
}), o =
|
|
1371
|
+
}), o = ye && f.objectName ? /* @__PURE__ */ w(ne, {
|
|
1358
1372
|
type: "button",
|
|
1359
1373
|
variant: "ghost",
|
|
1360
1374
|
size: "sm",
|
|
1361
1375
|
"data-testid": "drill-open-in-list",
|
|
1362
1376
|
onClick: () => {
|
|
1363
|
-
|
|
1377
|
+
ye(f.objectName, t), k(null);
|
|
1364
1378
|
},
|
|
1365
|
-
children: [
|
|
1379
|
+
children: [be("dashboard.openInList", "Open in list"), /* @__PURE__ */ C(Oe, { className: "ml-1 h-3.5 w-3.5" })]
|
|
1366
1380
|
}) : null;
|
|
1367
|
-
return r === "dialog" ? /* @__PURE__ */
|
|
1381
|
+
return r === "dialog" ? /* @__PURE__ */ C(ie, {
|
|
1368
1382
|
open: !0,
|
|
1369
|
-
onOpenChange: (e) => !e &&
|
|
1370
|
-
children: /* @__PURE__ */
|
|
1383
|
+
onOpenChange: (e) => !e && k(null),
|
|
1384
|
+
children: /* @__PURE__ */ w(ae, {
|
|
1371
1385
|
className: "max-w-4xl",
|
|
1372
|
-
children: [/* @__PURE__ */
|
|
1386
|
+
children: [/* @__PURE__ */ w(oe, {
|
|
1373
1387
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1374
|
-
children: [/* @__PURE__ */
|
|
1375
|
-
}),
|
|
1388
|
+
children: [/* @__PURE__ */ C(se, { children: n }), o]
|
|
1389
|
+
}), i]
|
|
1376
1390
|
})
|
|
1377
|
-
}) : /* @__PURE__ */
|
|
1391
|
+
}) : /* @__PURE__ */ C(le, {
|
|
1378
1392
|
open: !0,
|
|
1379
|
-
onOpenChange: (e) => !e &&
|
|
1380
|
-
children: /* @__PURE__ */
|
|
1393
|
+
onOpenChange: (e) => !e && k(null),
|
|
1394
|
+
children: /* @__PURE__ */ w(ue, {
|
|
1381
1395
|
side: "right",
|
|
1382
1396
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1383
|
-
children: [/* @__PURE__ */
|
|
1397
|
+
children: [/* @__PURE__ */ w(y, {
|
|
1384
1398
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1385
|
-
children: [/* @__PURE__ */
|
|
1386
|
-
}), /* @__PURE__ */
|
|
1399
|
+
children: [/* @__PURE__ */ C(b, { children: n }), o]
|
|
1400
|
+
}), /* @__PURE__ */ C("div", {
|
|
1387
1401
|
className: "flex-1 overflow-hidden mt-2",
|
|
1388
|
-
children:
|
|
1402
|
+
children: i
|
|
1389
1403
|
})]
|
|
1390
1404
|
})
|
|
1391
1405
|
});
|
|
1392
1406
|
})() : null;
|
|
1393
|
-
return /* @__PURE__ */
|
|
1407
|
+
return /* @__PURE__ */ w("div", {
|
|
1394
1408
|
className: "relative",
|
|
1395
1409
|
children: [
|
|
1396
|
-
/* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
1410
|
+
/* @__PURE__ */ C(ce, { active: D && L.length > 0 }),
|
|
1411
|
+
/* @__PURE__ */ C($, {
|
|
1398
1412
|
...e,
|
|
1399
|
-
schema:
|
|
1400
|
-
onChartClick:
|
|
1413
|
+
schema: Ie,
|
|
1414
|
+
onChartClick: G
|
|
1401
1415
|
}),
|
|
1402
|
-
|
|
1416
|
+
K
|
|
1403
1417
|
]
|
|
1404
1418
|
});
|
|
1405
1419
|
};
|
|
1406
|
-
e.register("object-chart",
|
|
1420
|
+
e.register("object-chart", rt, {
|
|
1407
1421
|
namespace: "plugin-charts",
|
|
1408
1422
|
label: "Object Chart",
|
|
1409
1423
|
category: "view",
|
|
@@ -1435,11 +1449,11 @@ e.register("object-chart", et, {
|
|
|
1435
1449
|
});
|
|
1436
1450
|
//#endregion
|
|
1437
1451
|
//#region src/index.tsx
|
|
1438
|
-
var
|
|
1439
|
-
"bar-chart":
|
|
1440
|
-
chart:
|
|
1452
|
+
var it = {
|
|
1453
|
+
"bar-chart": $e,
|
|
1454
|
+
chart: $
|
|
1441
1455
|
};
|
|
1442
|
-
e.register("bar-chart",
|
|
1456
|
+
e.register("bar-chart", $e, {
|
|
1443
1457
|
namespace: "plugin-charts",
|
|
1444
1458
|
label: "Bar Chart",
|
|
1445
1459
|
category: "plugin",
|
|
@@ -1503,7 +1517,7 @@ e.register("bar-chart", Ze, {
|
|
|
1503
1517
|
height: 400,
|
|
1504
1518
|
color: "#8884d8"
|
|
1505
1519
|
}
|
|
1506
|
-
}), e.register("chart",
|
|
1520
|
+
}), e.register("chart", rt, {
|
|
1507
1521
|
namespace: "view",
|
|
1508
1522
|
category: "view",
|
|
1509
1523
|
label: "Chart",
|
|
@@ -1530,7 +1544,7 @@ e.register("bar-chart", Ze, {
|
|
|
1530
1544
|
label: "Value Field"
|
|
1531
1545
|
}
|
|
1532
1546
|
]
|
|
1533
|
-
}), e.register("chart",
|
|
1547
|
+
}), e.register("chart", $, {
|
|
1534
1548
|
namespace: "plugin-charts",
|
|
1535
1549
|
label: "Chart",
|
|
1536
1550
|
category: "plugin",
|
|
@@ -1642,31 +1656,31 @@ e.register("bar-chart", Ze, {
|
|
|
1642
1656
|
xAxisKey: "name",
|
|
1643
1657
|
series: [{ dataKey: "sales" }, { dataKey: "revenue" }]
|
|
1644
1658
|
}
|
|
1645
|
-
}), e.register("chart:bar",
|
|
1659
|
+
}), e.register("chart:bar", $, {
|
|
1646
1660
|
namespace: "plugin-charts",
|
|
1647
1661
|
label: "Bar Chart (Alias)",
|
|
1648
1662
|
category: "plugin",
|
|
1649
1663
|
defaultProps: { chartType: "bar" }
|
|
1650
|
-
}), e.register("pie-chart",
|
|
1664
|
+
}), e.register("pie-chart", $, {
|
|
1651
1665
|
namespace: "plugin-charts",
|
|
1652
1666
|
label: "Pie Chart",
|
|
1653
1667
|
category: "plugin",
|
|
1654
1668
|
defaultProps: { chartType: "pie" }
|
|
1655
|
-
}), e.register("donut-chart",
|
|
1669
|
+
}), e.register("donut-chart", $, {
|
|
1656
1670
|
namespace: "plugin-charts",
|
|
1657
1671
|
label: "Donut Chart",
|
|
1658
1672
|
category: "plugin",
|
|
1659
1673
|
defaultProps: { chartType: "donut" }
|
|
1660
|
-
}), e.register("radar-chart",
|
|
1674
|
+
}), e.register("radar-chart", $, {
|
|
1661
1675
|
namespace: "plugin-charts",
|
|
1662
1676
|
label: "Radar Chart",
|
|
1663
1677
|
category: "plugin",
|
|
1664
1678
|
defaultProps: { chartType: "radar" }
|
|
1665
|
-
}), e.register("scatter-chart",
|
|
1679
|
+
}), e.register("scatter-chart", $, {
|
|
1666
1680
|
namespace: "plugin-charts",
|
|
1667
1681
|
label: "Scatter Chart",
|
|
1668
1682
|
category: "plugin",
|
|
1669
1683
|
defaultProps: { chartType: "scatter" }
|
|
1670
1684
|
});
|
|
1671
1685
|
//#endregion
|
|
1672
|
-
export {
|
|
1686
|
+
export { $e as ChartBarRenderer, $ as ChartRenderer, rt as ObjectChart, it as chartComponents };
|