@object-ui/plugin-charts 6.2.3 → 7.0.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 +129 -0
- package/dist/{packages/plugin-charts/src/AdvancedChartImpl.d.ts → AdvancedChartImpl.d.ts} +10 -2
- package/dist/{packages/plugin-charts/src/ChartContainerImpl.d.ts → ChartContainerImpl.d.ts} +4 -4
- package/dist/{packages/plugin-charts/src/ChartImpl.d.ts → ChartImpl.d.ts} +1 -1
- package/dist/{packages/plugin-charts/src/ChartRenderer.d.ts → ChartRenderer.d.ts} +1 -1
- package/dist/{packages/plugin-charts/src/ObjectChart.d.ts → ObjectChart.d.ts} +3 -2
- package/dist/chartDrillEvents.d.ts +38 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +452 -259
- package/dist/index.umd.cjs +2 -2
- package/dist/{packages/plugin-charts/src/types.d.ts → types.d.ts} +1 -1
- package/package.json +10 -10
- package/dist/packages/plugin-charts/src/ObjectChart.stories.d.ts +0 -24
- package/dist/packages/plugin-charts/src/index.d.ts +0 -8
package/dist/index.js
CHANGED
|
@@ -1,25 +1,44 @@
|
|
|
1
|
-
import { ComponentRegistry as e,
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { Dialog as
|
|
1
|
+
import { ComponentRegistry as e, buildChartSeries as t, compareToTrendLabelKey as n, computeDrillFilter as r, extractRecords as i, isDrillEnabled as a, resolveDateMacros as o, resolveDrillTitle as s, shiftFilterByCompareTo as c } from "@object-ui/core";
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import u, { Suspense as d, useCallback as f, useContext as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
4
|
+
import { Button as ee, Dialog as te, DialogContent as ne, DialogHeader as re, DialogTitle as ie, RefreshIndicator as ae, Sheet as oe, SheetContent as v, SheetHeader as y, SheetTitle as se, Skeleton as b } from "@object-ui/components";
|
|
5
5
|
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
6
|
-
import { Area as w, AreaChart as
|
|
7
|
-
import { SchemaRenderer as
|
|
8
|
-
import { AlertCircle as
|
|
9
|
-
import { useSafeFieldLabel as
|
|
6
|
+
import { Area as w, AreaChart as ce, Bar as T, BarChart as E, CartesianGrid as D, Cell as O, Funnel as le, FunnelChart as ue, LabelList as de, Legend as k, Line as fe, LineChart as pe, Pie as A, PieChart as j, PolarAngleAxis as me, PolarGrid as he, PolarRadiusAxis as ge, Radar as M, RadarChart as N, ResponsiveContainer as P, Sankey as F, Scatter as I, ScatterChart as L, Tooltip as R, Treemap as z, XAxis as B, YAxis as V, ZAxis as H } from "recharts";
|
|
7
|
+
import { SchemaRenderer as _e, SchemaRendererContext as ve, useDataScope as ye, useDrillNavigation as be } from "@object-ui/react";
|
|
8
|
+
import { AlertCircle as xe, ArrowUpRight as Se } from "lucide-react";
|
|
9
|
+
import { useSafeFieldLabel as Ce, useSafeTranslate as we } from "@object-ui/i18n";
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
|
-
var
|
|
11
|
+
var Te = Object.defineProperty, U = (e, t) => () => (e && (t = e(e = 0)), t), Ee = (e, t) => {
|
|
12
12
|
let n = {};
|
|
13
|
-
for (var r in e)
|
|
13
|
+
for (var r in e) Te(n, r, {
|
|
14
14
|
get: e[r],
|
|
15
15
|
enumerable: !0
|
|
16
16
|
});
|
|
17
|
-
return t ||
|
|
18
|
-
},
|
|
19
|
-
function
|
|
17
|
+
return t || Te(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
18
|
+
}, De = /* @__PURE__ */ Ee({ default: () => Ae });
|
|
19
|
+
function Oe(e, t = 14) {
|
|
20
|
+
return e.length > t ? `${e.slice(0, t - 1)}…` : e;
|
|
21
|
+
}
|
|
22
|
+
function ke({ x: e, y: t, payload: n }) {
|
|
23
|
+
let r = String(n?.value ?? ""), i = Oe(r);
|
|
24
|
+
return /* @__PURE__ */ S("g", {
|
|
25
|
+
transform: `translate(${e},${t})`,
|
|
26
|
+
children: /* @__PURE__ */ C("text", {
|
|
27
|
+
dy: 10,
|
|
28
|
+
textAnchor: "end",
|
|
29
|
+
transform: "rotate(-32)",
|
|
30
|
+
fill: "hsl(var(--muted-foreground))",
|
|
31
|
+
fontSize: 11,
|
|
32
|
+
fontFamily: "monospace",
|
|
33
|
+
children: [r !== i && /* @__PURE__ */ S("title", { children: r }), i]
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function Ae({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
|
|
38
|
+
let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
|
|
20
39
|
return /* @__PURE__ */ S("div", {
|
|
21
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}`,
|
|
22
|
-
children: /* @__PURE__ */ S(
|
|
41
|
+
children: /* @__PURE__ */ S(P, {
|
|
23
42
|
width: "100%",
|
|
24
43
|
height: r,
|
|
25
44
|
children: /* @__PURE__ */ C(E, {
|
|
@@ -28,7 +47,7 @@ function Se({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
28
47
|
top: 10,
|
|
29
48
|
right: 10,
|
|
30
49
|
left: 10,
|
|
31
|
-
bottom: 5
|
|
50
|
+
bottom: s ? 24 : 5
|
|
32
51
|
},
|
|
33
52
|
children: [
|
|
34
53
|
/* @__PURE__ */ C("defs", { children: [/* @__PURE__ */ C("linearGradient", {
|
|
@@ -88,18 +107,20 @@ function Se({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
88
107
|
stroke: "hsl(var(--border))",
|
|
89
108
|
vertical: !1
|
|
90
109
|
}),
|
|
91
|
-
/* @__PURE__ */ S(
|
|
110
|
+
/* @__PURE__ */ S(B, {
|
|
92
111
|
dataKey: n,
|
|
93
|
-
tick: {
|
|
112
|
+
tick: s ? /* @__PURE__ */ S(ke, {}) : {
|
|
94
113
|
fill: "hsl(var(--muted-foreground))",
|
|
95
114
|
fontSize: 12,
|
|
96
115
|
fontFamily: "monospace"
|
|
97
116
|
},
|
|
98
117
|
tickLine: !1,
|
|
99
118
|
axisLine: { stroke: "hsl(var(--border))" },
|
|
100
|
-
|
|
119
|
+
interval: s ? 0 : "preserveStartEnd",
|
|
120
|
+
height: s ? 56 : void 0,
|
|
121
|
+
dy: s ? void 0 : 10
|
|
101
122
|
}),
|
|
102
|
-
/* @__PURE__ */ S(
|
|
123
|
+
/* @__PURE__ */ S(V, {
|
|
103
124
|
tick: {
|
|
104
125
|
fill: "hsl(var(--muted-foreground))",
|
|
105
126
|
fontSize: 12,
|
|
@@ -108,7 +129,7 @@ function Se({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
108
129
|
tickLine: !1,
|
|
109
130
|
axisLine: !1
|
|
110
131
|
}),
|
|
111
|
-
/* @__PURE__ */ S(
|
|
132
|
+
/* @__PURE__ */ S(R, {
|
|
112
133
|
cursor: {
|
|
113
134
|
fill: "hsl(var(--muted))",
|
|
114
135
|
opacity: .2
|
|
@@ -123,7 +144,7 @@ function Se({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
123
144
|
},
|
|
124
145
|
itemStyle: { color: "hsl(var(--primary))" }
|
|
125
146
|
}),
|
|
126
|
-
/* @__PURE__ */ S(
|
|
147
|
+
/* @__PURE__ */ S(k, { wrapperStyle: {
|
|
127
148
|
paddingTop: "20px",
|
|
128
149
|
fontFamily: "monospace"
|
|
129
150
|
} }),
|
|
@@ -144,32 +165,32 @@ function Se({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
144
165
|
})
|
|
145
166
|
});
|
|
146
167
|
}
|
|
147
|
-
var
|
|
168
|
+
var je = U((() => {}));
|
|
148
169
|
//#endregion
|
|
149
170
|
//#region src/ChartContainerImpl.tsx
|
|
150
|
-
function
|
|
151
|
-
let e =
|
|
171
|
+
function Me() {
|
|
172
|
+
let e = l.useContext(Fe);
|
|
152
173
|
if (!e) throw Error("useChart must be used within a <ChartContainer />");
|
|
153
174
|
return e;
|
|
154
175
|
}
|
|
155
|
-
function
|
|
156
|
-
let a =
|
|
157
|
-
return /* @__PURE__ */ S(
|
|
176
|
+
function W({ id: e, className: t, children: n, config: r, ...i }) {
|
|
177
|
+
let a = l.useId(), o = `chart-${e || a.replace(/:/g, "")}`;
|
|
178
|
+
return /* @__PURE__ */ S(Fe.Provider, {
|
|
158
179
|
value: { config: r },
|
|
159
180
|
children: /* @__PURE__ */ C("div", {
|
|
160
181
|
"data-slot": "chart",
|
|
161
182
|
"data-chart": o,
|
|
162
|
-
className:
|
|
183
|
+
className: q("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
|
|
163
184
|
style: {
|
|
164
185
|
minHeight: 280,
|
|
165
186
|
minWidth: 0,
|
|
166
187
|
...i.style
|
|
167
188
|
},
|
|
168
189
|
...i,
|
|
169
|
-
children: [/* @__PURE__ */ S(
|
|
190
|
+
children: [/* @__PURE__ */ S(Ie, {
|
|
170
191
|
id: o,
|
|
171
192
|
config: r
|
|
172
|
-
}), /* @__PURE__ */ S(
|
|
193
|
+
}), /* @__PURE__ */ S(P, {
|
|
173
194
|
width: "100%",
|
|
174
195
|
height: "100%",
|
|
175
196
|
children: n
|
|
@@ -177,15 +198,15 @@ function U({ id: e, className: t, children: n, config: r, ...i }) {
|
|
|
177
198
|
})
|
|
178
199
|
});
|
|
179
200
|
}
|
|
180
|
-
function
|
|
181
|
-
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: u, color: d, nameKey: f, labelKey: p }) {
|
|
202
|
+
let { config: m } = Me(), h = l.useMemo(() => {
|
|
182
203
|
if (i || !t?.length) return null;
|
|
183
|
-
let [e] = t, n =
|
|
204
|
+
let [e] = t, n = Ne(m, e, `${p || e?.dataKey || e?.name || "value"}`), r = !p && typeof o == "string" ? m[o]?.label || o : n?.label;
|
|
184
205
|
return s ? /* @__PURE__ */ S("div", {
|
|
185
|
-
className:
|
|
206
|
+
className: q("font-medium", c),
|
|
186
207
|
children: s(r, t)
|
|
187
208
|
}) : r ? /* @__PURE__ */ S("div", {
|
|
188
|
-
className:
|
|
209
|
+
className: q("font-medium", c),
|
|
189
210
|
children: r
|
|
190
211
|
}) : null;
|
|
191
212
|
}, [
|
|
@@ -193,28 +214,28 @@ function W({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
193
214
|
s,
|
|
194
215
|
t,
|
|
195
216
|
i,
|
|
196
|
-
|
|
217
|
+
c,
|
|
197
218
|
m,
|
|
198
219
|
p
|
|
199
220
|
]);
|
|
200
221
|
if (!e || !t?.length) return null;
|
|
201
222
|
let g = t.length === 1 && r !== "dot";
|
|
202
223
|
return /* @__PURE__ */ C("div", {
|
|
203
|
-
className:
|
|
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),
|
|
204
225
|
children: [g ? null : h, /* @__PURE__ */ S("div", {
|
|
205
226
|
className: "grid gap-1.5",
|
|
206
227
|
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
207
|
-
let n =
|
|
228
|
+
let n = Ne(m, e, `${f || e.name || e.dataKey || "value"}`), i = d || e.payload.fill || e.color;
|
|
208
229
|
return /* @__PURE__ */ S("div", {
|
|
209
|
-
className:
|
|
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" : ""),
|
|
210
231
|
children: u && e?.value !== void 0 && e.name ? u(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ C(x, { children: [n?.icon ? /* @__PURE__ */ S(n.icon, {}) : !a && /* @__PURE__ */ S("div", {
|
|
211
|
-
className:
|
|
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" : ""),
|
|
212
233
|
style: {
|
|
213
234
|
"--color-bg": i,
|
|
214
235
|
"--color-border": i
|
|
215
236
|
}
|
|
216
237
|
}), /* @__PURE__ */ C("div", {
|
|
217
|
-
className:
|
|
238
|
+
className: q("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
|
|
218
239
|
children: [/* @__PURE__ */ C("div", {
|
|
219
240
|
className: "grid gap-1.5",
|
|
220
241
|
children: [g ? h : null, /* @__PURE__ */ S("span", {
|
|
@@ -231,14 +252,14 @@ function W({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
231
252
|
})]
|
|
232
253
|
});
|
|
233
254
|
}
|
|
234
|
-
function
|
|
235
|
-
let { config: a } =
|
|
255
|
+
function K({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
|
|
256
|
+
let { config: a } = Me();
|
|
236
257
|
return n?.length ? /* @__PURE__ */ S("div", {
|
|
237
|
-
className:
|
|
258
|
+
className: q("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
238
259
|
children: n.filter((e) => e.type !== "none").map((e) => {
|
|
239
|
-
let n =
|
|
260
|
+
let n = Ne(a, e, `${i || e.dataKey || "value"}`);
|
|
240
261
|
return /* @__PURE__ */ C("div", {
|
|
241
|
-
className:
|
|
262
|
+
className: q("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
242
263
|
children: [n?.icon && !t ? /* @__PURE__ */ S(n.icon, {}) : /* @__PURE__ */ S("div", {
|
|
243
264
|
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
244
265
|
style: { backgroundColor: e.color }
|
|
@@ -247,18 +268,18 @@ function G({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bot
|
|
|
247
268
|
})
|
|
248
269
|
}) : null;
|
|
249
270
|
}
|
|
250
|
-
function
|
|
271
|
+
function Ne(e, t, n) {
|
|
251
272
|
if (typeof t != "object" || !t) return;
|
|
252
273
|
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
253
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];
|
|
254
275
|
}
|
|
255
|
-
var
|
|
256
|
-
|
|
276
|
+
var q, Pe, Fe, Ie, J, Y, Le = U((() => {
|
|
277
|
+
q = (...e) => e.filter(Boolean).join(" "), Pe = {
|
|
257
278
|
light: "",
|
|
258
279
|
dark: ".dark"
|
|
259
|
-
},
|
|
280
|
+
}, Fe = l.createContext(null), Ie = ({ id: e, config: t }) => {
|
|
260
281
|
let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
261
|
-
return n.length ? /* @__PURE__ */ S("style", { dangerouslySetInnerHTML: { __html: Object.entries(
|
|
282
|
+
return n.length ? /* @__PURE__ */ S("style", { dangerouslySetInnerHTML: { __html: Object.entries(Pe).map(([t, r]) => `
|
|
262
283
|
${r} [data-chart=${e}] {
|
|
263
284
|
${n.map(([e, n]) => {
|
|
264
285
|
let r = n.theme?.[t] || n.color;
|
|
@@ -266,10 +287,47 @@ ${n.map(([e, n]) => {
|
|
|
266
287
|
}).join("\n")}
|
|
267
288
|
}
|
|
268
289
|
`).join("\n") } }) : null;
|
|
269
|
-
},
|
|
270
|
-
}))
|
|
271
|
-
|
|
272
|
-
|
|
290
|
+
}, J = R, Y = k;
|
|
291
|
+
}));
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/chartDrillEvents.ts
|
|
294
|
+
function Re(e) {
|
|
295
|
+
return e?.[0]?.dataKey || "value";
|
|
296
|
+
}
|
|
297
|
+
function ze(e, t, n) {
|
|
298
|
+
if (!e) return null;
|
|
299
|
+
let r = e.payload ?? e, i = r?.[t];
|
|
300
|
+
if (i == null) return null;
|
|
301
|
+
let a = Re(n);
|
|
302
|
+
return {
|
|
303
|
+
category: String(i),
|
|
304
|
+
series: a,
|
|
305
|
+
value: typeof r?.[a] == "number" ? r[a] : void 0
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function Be(e, t) {
|
|
309
|
+
if (!e) return null;
|
|
310
|
+
let n = e.name ?? e.payload?.name ?? e.root?.name;
|
|
311
|
+
if (n == null) return null;
|
|
312
|
+
let r = e.value ?? e.size ?? e.payload?.size;
|
|
313
|
+
return {
|
|
314
|
+
category: String(n),
|
|
315
|
+
series: Re(t),
|
|
316
|
+
value: typeof r == "number" ? r : void 0
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function Ve(e, t) {
|
|
320
|
+
if (!e) return null;
|
|
321
|
+
let n = e.payload ?? e, r = n?.name;
|
|
322
|
+
return r == null || n?.depth === 0 ? null : {
|
|
323
|
+
category: String(r),
|
|
324
|
+
series: Re(t),
|
|
325
|
+
value: typeof n?.value == "number" ? n.value : void 0
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
var He = U((() => {})), Ue = /* @__PURE__ */ Ee({ default: () => We });
|
|
329
|
+
function We({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r = "name", series: i = [], className: a = "", onChartClick: o }) {
|
|
330
|
+
let s = e === "column" ? "bar" : e, c = Array.isArray(t) ? t : [], [u, d] = l.useState(!1), f = l.useCallback((e) => {
|
|
273
331
|
if (!o || !e) return;
|
|
274
332
|
let t = Array.isArray(e.activePayload) ? e.activePayload[0] : void 0;
|
|
275
333
|
o({
|
|
@@ -277,7 +335,7 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
277
335
|
series: t?.dataKey ? String(t.dataKey) : void 0,
|
|
278
336
|
value: typeof t?.value == "number" ? t.value : void 0
|
|
279
337
|
});
|
|
280
|
-
}, [o]), p =
|
|
338
|
+
}, [o]), p = l.useCallback((e) => {
|
|
281
339
|
if (!o || !e) return;
|
|
282
340
|
let t = e.payload?.[r], n = i[0]?.dataKey || "value";
|
|
283
341
|
o({
|
|
@@ -295,29 +353,56 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
295
353
|
} : {}, h = o ? {
|
|
296
354
|
onClick: p,
|
|
297
355
|
style: { cursor: "pointer" }
|
|
356
|
+
} : {}, g = l.useCallback((e) => {
|
|
357
|
+
if (!o) return;
|
|
358
|
+
let t = ze(e, r, i);
|
|
359
|
+
t && o(t);
|
|
360
|
+
}, [
|
|
361
|
+
o,
|
|
362
|
+
r,
|
|
363
|
+
i
|
|
364
|
+
]), _ = l.useCallback((e) => {
|
|
365
|
+
if (!o) return;
|
|
366
|
+
let t = Be(e, i);
|
|
367
|
+
t && o(t);
|
|
368
|
+
}, [o, i]), ee = l.useCallback((e) => {
|
|
369
|
+
if (!o) return;
|
|
370
|
+
let t = Ve(e, i);
|
|
371
|
+
t && o(t);
|
|
372
|
+
}, [o, i]), te = o ? {
|
|
373
|
+
onClick: g,
|
|
374
|
+
cursor: "pointer"
|
|
375
|
+
} : {}, ne = o ? {
|
|
376
|
+
onClick: _,
|
|
377
|
+
style: { cursor: "pointer" }
|
|
378
|
+
} : {}, re = o ? {
|
|
379
|
+
onClick: ee,
|
|
380
|
+
style: { cursor: "pointer" }
|
|
298
381
|
} : {};
|
|
299
|
-
|
|
382
|
+
l.useEffect(() => {
|
|
300
383
|
let e = () => d(window.innerWidth < 640);
|
|
301
384
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
302
385
|
}, []);
|
|
303
|
-
let
|
|
386
|
+
let ie = {
|
|
304
387
|
bar: E,
|
|
305
388
|
"horizontal-bar": E,
|
|
306
|
-
line:
|
|
307
|
-
area:
|
|
308
|
-
pie:
|
|
309
|
-
donut:
|
|
310
|
-
radar:
|
|
311
|
-
scatter:
|
|
312
|
-
funnel:
|
|
313
|
-
combo: E
|
|
314
|
-
|
|
389
|
+
line: pe,
|
|
390
|
+
area: ce,
|
|
391
|
+
pie: j,
|
|
392
|
+
donut: j,
|
|
393
|
+
radar: N,
|
|
394
|
+
scatter: L,
|
|
395
|
+
funnel: ue,
|
|
396
|
+
combo: E,
|
|
397
|
+
treemap: E,
|
|
398
|
+
sankey: E
|
|
399
|
+
}[s] || E, ae = l.useCallback((e) => {
|
|
315
400
|
if (e == null || e === "") return "";
|
|
316
401
|
let t = typeof e == "string" ? e : String(e);
|
|
317
402
|
if (/^\d{4}-\d{2}-\d{2}/.test(t)) {
|
|
318
403
|
let e = new Date(t);
|
|
319
404
|
if (!Number.isNaN(e.getTime())) {
|
|
320
|
-
let t = (
|
|
405
|
+
let t = (c.length > 1 ? Math.abs(new Date(String(c[c.length - 1][r] ?? "")).getTime() - new Date(String(c[0][r] ?? "")).getTime()) : 0) / (1e3 * 60 * 60 * 24);
|
|
321
406
|
try {
|
|
322
407
|
return t <= 62 ? e.toLocaleDateString(void 0, {
|
|
323
408
|
month: "short",
|
|
@@ -333,16 +418,16 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
333
418
|
}
|
|
334
419
|
return u && t.length > 8 ? t.slice(0, 8) + "…" : t;
|
|
335
420
|
}, [
|
|
336
|
-
|
|
421
|
+
c,
|
|
337
422
|
r,
|
|
338
423
|
u
|
|
339
|
-
]),
|
|
424
|
+
]), oe = l.useMemo(() => c.some((e) => String(e[r] || "").length > 5), [c, r]), v = () => [
|
|
340
425
|
"hsl(var(--chart-1))",
|
|
341
426
|
"hsl(var(--chart-2))",
|
|
342
427
|
"hsl(var(--chart-3))",
|
|
343
428
|
"hsl(var(--chart-4))",
|
|
344
429
|
"hsl(var(--chart-5))"
|
|
345
|
-
], y =
|
|
430
|
+
], y = l.useCallback((e) => {
|
|
346
431
|
if (e == null || e === "") return "";
|
|
347
432
|
let t = typeof e == "number" ? e : Number(e);
|
|
348
433
|
if (!Number.isFinite(t)) return String(e);
|
|
@@ -354,26 +439,26 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
354
439
|
} catch {
|
|
355
440
|
return String(t);
|
|
356
441
|
}
|
|
357
|
-
}, []),
|
|
442
|
+
}, []), se = l.useMemo(() => ({
|
|
358
443
|
tickLine: !1,
|
|
359
444
|
tickMargin: 10,
|
|
360
445
|
axisLine: !1,
|
|
361
446
|
interval: "preserveStartEnd",
|
|
362
447
|
minTickGap: u ? 32 : 48,
|
|
363
|
-
tickFormatter:
|
|
364
|
-
...!u &&
|
|
448
|
+
tickFormatter: ae,
|
|
449
|
+
...!u && oe && {
|
|
365
450
|
angle: -35,
|
|
366
451
|
textAnchor: "end",
|
|
367
452
|
height: 60
|
|
368
453
|
}
|
|
369
454
|
}), [
|
|
370
455
|
u,
|
|
371
|
-
|
|
372
|
-
|
|
456
|
+
oe,
|
|
457
|
+
ae
|
|
373
458
|
]);
|
|
374
459
|
if (s === "pie" || s === "donut") {
|
|
375
460
|
let e = s === "donut" ? 60 : 0, t = v(), o = { ...n };
|
|
376
|
-
return
|
|
461
|
+
return c.forEach((e, n) => {
|
|
377
462
|
let i = e?.[r];
|
|
378
463
|
if (i == null || i === "") return;
|
|
379
464
|
let a = String(i);
|
|
@@ -381,16 +466,16 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
381
466
|
label: a,
|
|
382
467
|
color: t[n % t.length]
|
|
383
468
|
});
|
|
384
|
-
}), /* @__PURE__ */ S(
|
|
469
|
+
}), /* @__PURE__ */ S(W, {
|
|
385
470
|
config: o,
|
|
386
471
|
className: a,
|
|
387
|
-
children: /* @__PURE__ */ C(
|
|
388
|
-
/* @__PURE__ */ S(
|
|
472
|
+
children: /* @__PURE__ */ C(j, { children: [
|
|
473
|
+
/* @__PURE__ */ S(J, {
|
|
389
474
|
cursor: !1,
|
|
390
|
-
content: /* @__PURE__ */ S(
|
|
475
|
+
content: /* @__PURE__ */ S(G, { hideLabel: !0 })
|
|
391
476
|
}),
|
|
392
|
-
/* @__PURE__ */ S(
|
|
393
|
-
data:
|
|
477
|
+
/* @__PURE__ */ S(A, {
|
|
478
|
+
data: c,
|
|
394
479
|
dataKey: i[0]?.dataKey || "value",
|
|
395
480
|
nameKey: r || "name",
|
|
396
481
|
innerRadius: e,
|
|
@@ -398,18 +483,18 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
398
483
|
paddingAngle: 2,
|
|
399
484
|
outerRadius: 80,
|
|
400
485
|
...h,
|
|
401
|
-
children:
|
|
486
|
+
children: c.map((e, n) => {
|
|
402
487
|
let i = o[String(e[r])]?.color;
|
|
403
488
|
return i ||= t[n % t.length], /* @__PURE__ */ S(O, { fill: X(i) }, `cell-${n}`);
|
|
404
489
|
})
|
|
405
490
|
}),
|
|
406
|
-
/* @__PURE__ */ S(
|
|
491
|
+
/* @__PURE__ */ S(Y, {
|
|
407
492
|
verticalAlign: "bottom",
|
|
408
493
|
wrapperStyle: {
|
|
409
494
|
fontSize: u ? "11px" : "12px",
|
|
410
495
|
paddingTop: "8px"
|
|
411
496
|
},
|
|
412
|
-
content: /* @__PURE__ */ S(
|
|
497
|
+
content: /* @__PURE__ */ S(K, {
|
|
413
498
|
nameKey: r,
|
|
414
499
|
className: "flex-wrap"
|
|
415
500
|
})
|
|
@@ -423,23 +508,23 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
423
508
|
category: t?.payload?.[r] ?? t?.[r],
|
|
424
509
|
value: t?.payload?.[e] ?? t?.[e]
|
|
425
510
|
});
|
|
426
|
-
} : void 0,
|
|
511
|
+
} : void 0, l = s ? {
|
|
427
512
|
onClick: s,
|
|
428
513
|
style: { cursor: "pointer" }
|
|
429
|
-
} : {}, u = [...
|
|
514
|
+
} : {}, u = [...c].sort((t, n) => {
|
|
430
515
|
let r = Number(t?.[e] ?? 0);
|
|
431
516
|
return Number(n?.[e] ?? 0) - r;
|
|
432
517
|
});
|
|
433
|
-
return /* @__PURE__ */ S(
|
|
518
|
+
return /* @__PURE__ */ S(W, {
|
|
434
519
|
config: n,
|
|
435
520
|
className: a,
|
|
436
|
-
children: /* @__PURE__ */ C(
|
|
521
|
+
children: /* @__PURE__ */ C(ue, { children: [/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }), /* @__PURE__ */ C(le, {
|
|
437
522
|
dataKey: e,
|
|
438
523
|
data: u,
|
|
439
524
|
nameKey: r,
|
|
440
525
|
isAnimationActive: !0,
|
|
441
|
-
...
|
|
442
|
-
children: [/* @__PURE__ */ S(
|
|
526
|
+
...l,
|
|
527
|
+
children: [/* @__PURE__ */ S(de, {
|
|
443
528
|
position: "right",
|
|
444
529
|
fill: "hsl(var(--foreground))",
|
|
445
530
|
stroke: "none",
|
|
@@ -448,18 +533,81 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
448
533
|
})] })
|
|
449
534
|
});
|
|
450
535
|
}
|
|
451
|
-
if (s === "
|
|
536
|
+
if (s === "treemap") {
|
|
537
|
+
let e = i[0]?.dataKey || "value", t = v();
|
|
538
|
+
return /* @__PURE__ */ S(W, {
|
|
539
|
+
config: n,
|
|
540
|
+
className: a,
|
|
541
|
+
children: /* @__PURE__ */ S(z, {
|
|
542
|
+
data: c.map((n, i) => ({
|
|
543
|
+
name: String(n?.[r] ?? ""),
|
|
544
|
+
size: Number(n?.[e]) || 0,
|
|
545
|
+
fill: X(t[i % t.length])
|
|
546
|
+
})),
|
|
547
|
+
dataKey: "size",
|
|
548
|
+
nameKey: "name",
|
|
549
|
+
isAnimationActive: !0,
|
|
550
|
+
content: /* @__PURE__ */ S((e) => {
|
|
551
|
+
let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
|
|
552
|
+
return r <= 0 || i <= 0 ? null : /* @__PURE__ */ C("g", { children: [/* @__PURE__ */ S("rect", {
|
|
553
|
+
x: t,
|
|
554
|
+
y: n,
|
|
555
|
+
width: r,
|
|
556
|
+
height: i,
|
|
557
|
+
fill: o,
|
|
558
|
+
stroke: "hsl(var(--background))",
|
|
559
|
+
strokeWidth: 2
|
|
560
|
+
}), r > 48 && i > 18 ? /* @__PURE__ */ S("text", {
|
|
561
|
+
x: t + 6,
|
|
562
|
+
y: n + 18,
|
|
563
|
+
fill: "#fff",
|
|
564
|
+
fontSize: 12,
|
|
565
|
+
className: "pointer-events-none",
|
|
566
|
+
children: a
|
|
567
|
+
}) : null] });
|
|
568
|
+
}, {}),
|
|
569
|
+
...ne,
|
|
570
|
+
children: /* @__PURE__ */ S(R, {})
|
|
571
|
+
})
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
if (s === "sankey") {
|
|
575
|
+
let e = i[0]?.dataKey || "value", t = i[0]?.label || e, o = c.filter((t) => (Number(t?.[e]) || 0) > 0), s = [{ name: t }, ...o.map((e) => ({ name: String(e?.[r] ?? "") }))], l = o.map((t, n) => ({
|
|
576
|
+
source: 0,
|
|
577
|
+
target: n + 1,
|
|
578
|
+
value: Number(t?.[e]) || 0
|
|
579
|
+
}));
|
|
580
|
+
return l.length === 0 ? /* @__PURE__ */ S("div", { className: a }) : /* @__PURE__ */ S(W, {
|
|
581
|
+
config: n,
|
|
582
|
+
className: a,
|
|
583
|
+
children: /* @__PURE__ */ S(F, {
|
|
584
|
+
data: {
|
|
585
|
+
nodes: s,
|
|
586
|
+
links: l
|
|
587
|
+
},
|
|
588
|
+
nodePadding: 24,
|
|
589
|
+
link: {
|
|
590
|
+
stroke: "hsl(var(--muted-foreground))",
|
|
591
|
+
strokeOpacity: .25
|
|
592
|
+
},
|
|
593
|
+
node: { fill: "hsl(var(--chart-1))" },
|
|
594
|
+
...re,
|
|
595
|
+
children: /* @__PURE__ */ S(R, {})
|
|
596
|
+
})
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
if (s === "radar") return /* @__PURE__ */ S(W, {
|
|
452
600
|
config: n,
|
|
453
601
|
className: a,
|
|
454
|
-
children: /* @__PURE__ */ C(
|
|
455
|
-
data:
|
|
602
|
+
children: /* @__PURE__ */ C(N, {
|
|
603
|
+
data: c,
|
|
456
604
|
children: [
|
|
457
|
-
/* @__PURE__ */ S(
|
|
458
|
-
/* @__PURE__ */ S(
|
|
459
|
-
/* @__PURE__ */ S(
|
|
460
|
-
/* @__PURE__ */ S(
|
|
461
|
-
/* @__PURE__ */ S(
|
|
462
|
-
content: /* @__PURE__ */ S(
|
|
605
|
+
/* @__PURE__ */ S(he, {}),
|
|
606
|
+
/* @__PURE__ */ S(me, { dataKey: r }),
|
|
607
|
+
/* @__PURE__ */ S(ge, {}),
|
|
608
|
+
/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }),
|
|
609
|
+
/* @__PURE__ */ S(Y, {
|
|
610
|
+
content: /* @__PURE__ */ S(K, {}),
|
|
463
611
|
...u && {
|
|
464
612
|
verticalAlign: "bottom",
|
|
465
613
|
wrapperStyle: {
|
|
@@ -469,8 +617,8 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
469
617
|
}
|
|
470
618
|
}),
|
|
471
619
|
i.map((e) => {
|
|
472
|
-
let t = X(n[e.dataKey]?.color ||
|
|
473
|
-
return /* @__PURE__ */ S(
|
|
620
|
+
let t = X(n[e.dataKey]?.color || Ge);
|
|
621
|
+
return /* @__PURE__ */ S(M, {
|
|
474
622
|
dataKey: e.dataKey,
|
|
475
623
|
stroke: t,
|
|
476
624
|
fill: t,
|
|
@@ -480,12 +628,12 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
480
628
|
]
|
|
481
629
|
})
|
|
482
630
|
});
|
|
483
|
-
if (s === "scatter") return /* @__PURE__ */ S(
|
|
631
|
+
if (s === "scatter") return /* @__PURE__ */ S(W, {
|
|
484
632
|
config: n,
|
|
485
633
|
className: a,
|
|
486
|
-
children: /* @__PURE__ */ C(
|
|
634
|
+
children: /* @__PURE__ */ C(L, { children: [
|
|
487
635
|
/* @__PURE__ */ S(D, { vertical: !1 }),
|
|
488
|
-
/* @__PURE__ */ S(
|
|
636
|
+
/* @__PURE__ */ S(B, {
|
|
489
637
|
type: "number",
|
|
490
638
|
dataKey: r,
|
|
491
639
|
name: String(n[r]?.label || r),
|
|
@@ -493,7 +641,7 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
493
641
|
axisLine: !1,
|
|
494
642
|
minTickGap: u ? 32 : 48
|
|
495
643
|
}),
|
|
496
|
-
/* @__PURE__ */ S(
|
|
644
|
+
/* @__PURE__ */ S(V, {
|
|
497
645
|
type: "number",
|
|
498
646
|
dataKey: i[0]?.dataKey || "value",
|
|
499
647
|
name: String(n[i[0]?.dataKey]?.label || i[0]?.dataKey),
|
|
@@ -502,13 +650,13 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
502
650
|
tickFormatter: y,
|
|
503
651
|
width: 48
|
|
504
652
|
}),
|
|
505
|
-
/* @__PURE__ */ S(
|
|
653
|
+
/* @__PURE__ */ S(H, {
|
|
506
654
|
type: "number",
|
|
507
655
|
range: [60, 400]
|
|
508
656
|
}),
|
|
509
|
-
/* @__PURE__ */ S(
|
|
510
|
-
/* @__PURE__ */ S(
|
|
511
|
-
content: /* @__PURE__ */ S(
|
|
657
|
+
/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }),
|
|
658
|
+
/* @__PURE__ */ S(Y, {
|
|
659
|
+
content: /* @__PURE__ */ S(K, {}),
|
|
512
660
|
...u && {
|
|
513
661
|
verticalAlign: "bottom",
|
|
514
662
|
wrapperStyle: {
|
|
@@ -519,34 +667,35 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
519
667
|
}),
|
|
520
668
|
i.map((e, t) => {
|
|
521
669
|
let r = v(), i = X(n[e.dataKey]?.color || r[t % r.length]), a = Z(e, "scatter");
|
|
522
|
-
return /* @__PURE__ */ S(
|
|
670
|
+
return /* @__PURE__ */ S(I, {
|
|
523
671
|
name: n[e.dataKey]?.label || e.dataKey,
|
|
524
|
-
data:
|
|
672
|
+
data: c,
|
|
525
673
|
fill: i,
|
|
526
|
-
fillOpacity: a?.fillOpacity
|
|
674
|
+
fillOpacity: a?.fillOpacity,
|
|
675
|
+
...te
|
|
527
676
|
}, e.dataKey);
|
|
528
677
|
})
|
|
529
678
|
] })
|
|
530
679
|
});
|
|
531
|
-
if (s === "combo") return /* @__PURE__ */ S(
|
|
680
|
+
if (s === "combo") return /* @__PURE__ */ S(W, {
|
|
532
681
|
config: n,
|
|
533
682
|
className: a,
|
|
534
683
|
children: /* @__PURE__ */ C(E, {
|
|
535
|
-
data:
|
|
684
|
+
data: c,
|
|
536
685
|
children: [
|
|
537
686
|
/* @__PURE__ */ S(D, { vertical: !1 }),
|
|
538
|
-
/* @__PURE__ */ S(
|
|
687
|
+
/* @__PURE__ */ S(B, {
|
|
539
688
|
dataKey: r,
|
|
540
|
-
...
|
|
689
|
+
...se
|
|
541
690
|
}),
|
|
542
|
-
/* @__PURE__ */ S(
|
|
691
|
+
/* @__PURE__ */ S(V, {
|
|
543
692
|
yAxisId: "left",
|
|
544
693
|
tickLine: !1,
|
|
545
694
|
axisLine: !1,
|
|
546
695
|
tickFormatter: y,
|
|
547
696
|
width: 48
|
|
548
697
|
}),
|
|
549
|
-
/* @__PURE__ */ S(
|
|
698
|
+
/* @__PURE__ */ S(V, {
|
|
550
699
|
yAxisId: "right",
|
|
551
700
|
orientation: "right",
|
|
552
701
|
tickLine: !1,
|
|
@@ -554,9 +703,9 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
554
703
|
tickFormatter: y,
|
|
555
704
|
width: 48
|
|
556
705
|
}),
|
|
557
|
-
/* @__PURE__ */ S(
|
|
558
|
-
/* @__PURE__ */ S(
|
|
559
|
-
content: /* @__PURE__ */ S(
|
|
706
|
+
/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }),
|
|
707
|
+
/* @__PURE__ */ S(Y, {
|
|
708
|
+
content: /* @__PURE__ */ S(K, {}),
|
|
560
709
|
...u && {
|
|
561
710
|
verticalAlign: "bottom",
|
|
562
711
|
wrapperStyle: {
|
|
@@ -566,8 +715,8 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
566
715
|
}
|
|
567
716
|
}),
|
|
568
717
|
i.map((e, t) => {
|
|
569
|
-
let r = X(n[e.dataKey]?.color ||
|
|
570
|
-
return i === "line" ? /* @__PURE__ */ S(
|
|
718
|
+
let r = X(n[e.dataKey]?.color || Ge), i = e.chartType || (t === 0 ? "bar" : "line"), a = i === "bar" ? "left" : "right", o = Z(e, i);
|
|
719
|
+
return i === "line" ? /* @__PURE__ */ S(fe, {
|
|
571
720
|
yAxisId: a,
|
|
572
721
|
type: "monotone",
|
|
573
722
|
dataKey: e.dataKey,
|
|
@@ -596,40 +745,40 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
596
745
|
]
|
|
597
746
|
})
|
|
598
747
|
});
|
|
599
|
-
let
|
|
600
|
-
return /* @__PURE__ */ S(
|
|
748
|
+
let b = s === "horizontal-bar";
|
|
749
|
+
return /* @__PURE__ */ S(W, {
|
|
601
750
|
config: n,
|
|
602
751
|
className: a,
|
|
603
|
-
children: /* @__PURE__ */ C(
|
|
604
|
-
data:
|
|
605
|
-
layout:
|
|
752
|
+
children: /* @__PURE__ */ C(ie, {
|
|
753
|
+
data: c,
|
|
754
|
+
layout: b ? "vertical" : "horizontal",
|
|
606
755
|
...m,
|
|
607
756
|
children: [
|
|
608
757
|
/* @__PURE__ */ S(D, { vertical: !1 }),
|
|
609
|
-
|
|
758
|
+
b ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(B, {
|
|
610
759
|
type: "number",
|
|
611
760
|
tickLine: !1,
|
|
612
761
|
axisLine: !1,
|
|
613
762
|
tickFormatter: y
|
|
614
|
-
}), /* @__PURE__ */ S(
|
|
763
|
+
}), /* @__PURE__ */ S(V, {
|
|
615
764
|
type: "category",
|
|
616
765
|
dataKey: r,
|
|
617
766
|
tickLine: !1,
|
|
618
767
|
axisLine: !1,
|
|
619
|
-
width: Math.min(140, Math.max(60, Math.max(...
|
|
620
|
-
tickFormatter:
|
|
621
|
-
})] }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(
|
|
768
|
+
width: Math.min(140, Math.max(60, Math.max(...c.map((e) => String(e[r] ?? "").length)) * 7)),
|
|
769
|
+
tickFormatter: ae
|
|
770
|
+
})] }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(B, {
|
|
622
771
|
dataKey: r,
|
|
623
|
-
...
|
|
624
|
-
}), /* @__PURE__ */ S(
|
|
772
|
+
...se
|
|
773
|
+
}), /* @__PURE__ */ S(V, {
|
|
625
774
|
tickLine: !1,
|
|
626
775
|
axisLine: !1,
|
|
627
776
|
tickFormatter: y,
|
|
628
777
|
width: 48
|
|
629
778
|
})] }),
|
|
630
|
-
/* @__PURE__ */ S(
|
|
631
|
-
/* @__PURE__ */ S(
|
|
632
|
-
content: /* @__PURE__ */ S(
|
|
779
|
+
/* @__PURE__ */ S(J, { content: /* @__PURE__ */ S(G, {}) }),
|
|
780
|
+
/* @__PURE__ */ S(Y, {
|
|
781
|
+
content: /* @__PURE__ */ S(K, {}),
|
|
633
782
|
...u && {
|
|
634
783
|
verticalAlign: "bottom",
|
|
635
784
|
wrapperStyle: {
|
|
@@ -639,20 +788,20 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
639
788
|
}
|
|
640
789
|
}),
|
|
641
790
|
i.map((e, t) => {
|
|
642
|
-
let r = v(), a = e.variant === "comparison", o = a ? i.slice(0, t).find((e) => e.variant !== "comparison") || i[0] : e,
|
|
791
|
+
let r = v(), a = e.variant === "comparison", o = a ? i.slice(0, t).find((e) => e.variant !== "comparison") || i[0] : e, l = a ? i.indexOf(o) : t, u = X(n[o.dataKey]?.color || r[l % r.length] || Ge);
|
|
643
792
|
if (s === "bar" || s === "horizontal-bar") {
|
|
644
|
-
let t = i.filter((e) => e.variant !== "comparison").length === 1 && !a && i.length === 1 &&
|
|
793
|
+
let t = i.filter((e) => e.variant !== "comparison").length === 1 && !a && i.length === 1 && c.length > 1, n = Z(e, "bar");
|
|
645
794
|
return /* @__PURE__ */ S(T, {
|
|
646
795
|
dataKey: e.dataKey,
|
|
647
796
|
fill: u,
|
|
648
797
|
radius: 4,
|
|
649
798
|
fillOpacity: n?.fillOpacity,
|
|
650
|
-
children: t &&
|
|
799
|
+
children: t && c.map((e, t) => /* @__PURE__ */ S(O, { fill: X(r[t % r.length]) }, `cell-${t}`))
|
|
651
800
|
}, e.dataKey);
|
|
652
801
|
}
|
|
653
802
|
if (s === "line") {
|
|
654
803
|
let t = Z(e, "line");
|
|
655
|
-
return /* @__PURE__ */ S(
|
|
804
|
+
return /* @__PURE__ */ S(fe, {
|
|
656
805
|
type: "monotone",
|
|
657
806
|
dataKey: e.dataKey,
|
|
658
807
|
stroke: u,
|
|
@@ -680,8 +829,8 @@ function je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
|
|
|
680
829
|
})
|
|
681
830
|
});
|
|
682
831
|
}
|
|
683
|
-
var
|
|
684
|
-
|
|
832
|
+
var Ge, Ke, X, Z, qe = U((() => {
|
|
833
|
+
Le(), He(), Ge = "hsl(var(--primary))", Ke = {
|
|
685
834
|
slate: "#64748b",
|
|
686
835
|
gray: "#6b7280",
|
|
687
836
|
zinc: "#71717a",
|
|
@@ -704,14 +853,14 @@ var Y, Me, X, Z, Ne = ye((() => {
|
|
|
704
853
|
fuchsia: "#d946ef",
|
|
705
854
|
pink: "#ec4899",
|
|
706
855
|
rose: "#f43f5e"
|
|
707
|
-
}, X = (e) =>
|
|
856
|
+
}, X = (e) => Ke[e] || e, Z = (e, t) => e?.variant === "comparison" ? {
|
|
708
857
|
strokeOpacity: typeof e.opacity == "number" ? e.opacity : t === "line" || t === "scatter" ? .5 : .6,
|
|
709
858
|
fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
|
|
710
859
|
strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
|
|
711
860
|
} : null;
|
|
712
|
-
})),
|
|
861
|
+
})), Je = u.lazy(() => Promise.resolve().then(() => (je(), De))), Ye = u.lazy(() => Promise.resolve().then(() => (qe(), Ue))), Xe = ({ schema: e }) => /* @__PURE__ */ S(d, {
|
|
713
862
|
fallback: /* @__PURE__ */ S(b, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
714
|
-
children: /* @__PURE__ */ S(
|
|
863
|
+
children: /* @__PURE__ */ S(Je, {
|
|
715
864
|
data: e.data,
|
|
716
865
|
dataKey: e.dataKey,
|
|
717
866
|
xAxisKey: e.xAxisKey,
|
|
@@ -720,7 +869,7 @@ var Y, Me, X, Z, Ne = ye((() => {
|
|
|
720
869
|
color: e.color
|
|
721
870
|
})
|
|
722
871
|
}), Q = ({ schema: e, onChartClick: t }) => {
|
|
723
|
-
let n =
|
|
872
|
+
let n = u.useMemo(() => {
|
|
724
873
|
let t = e.series, n = e.xAxisKey, r = e.config;
|
|
725
874
|
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) {
|
|
726
875
|
let n = e.colors || [
|
|
@@ -744,9 +893,9 @@ var Y, Me, X, Z, Ne = ye((() => {
|
|
|
744
893
|
className: e.className
|
|
745
894
|
};
|
|
746
895
|
}, [e]);
|
|
747
|
-
return /* @__PURE__ */ S(
|
|
896
|
+
return /* @__PURE__ */ S(d, {
|
|
748
897
|
fallback: /* @__PURE__ */ S(b, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
749
|
-
children: /* @__PURE__ */ S(
|
|
898
|
+
children: /* @__PURE__ */ S(Ye, {
|
|
750
899
|
chartType: n.chartType,
|
|
751
900
|
data: n.data,
|
|
752
901
|
config: n.config,
|
|
@@ -762,7 +911,7 @@ var Y, Me, X, Z, Ne = ye((() => {
|
|
|
762
911
|
function $(e) {
|
|
763
912
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
764
913
|
}
|
|
765
|
-
function
|
|
914
|
+
function Ze(e, t) {
|
|
766
915
|
let { field: n, function: r, groupBy: i } = t, a = {};
|
|
767
916
|
for (let t of e) {
|
|
768
917
|
let e = String(t[i] ?? "Unknown");
|
|
@@ -793,7 +942,7 @@ function Le(e, t) {
|
|
|
793
942
|
};
|
|
794
943
|
});
|
|
795
944
|
}
|
|
796
|
-
async function
|
|
945
|
+
async function Qe(e, t, n, r, a) {
|
|
797
946
|
if (!e.length || !t) return e;
|
|
798
947
|
let o = a || ((e, t) => t), s = `__raw_${t}`, c = n?.fields?.[t];
|
|
799
948
|
if (!c) {
|
|
@@ -831,7 +980,7 @@ async function Re(e, t, n, i, a) {
|
|
|
831
980
|
}
|
|
832
981
|
if (l === "lookup" || l === "master_detail") {
|
|
833
982
|
let n = c.reference_to || c.reference;
|
|
834
|
-
if (!n || !
|
|
983
|
+
if (!n || !r || typeof r.find != "function") return e.map((e) => ({
|
|
835
984
|
...e,
|
|
836
985
|
[s]: e[t]
|
|
837
986
|
}));
|
|
@@ -842,7 +991,7 @@ async function Re(e, t, n, i, a) {
|
|
|
842
991
|
}));
|
|
843
992
|
let o = c.id_field || "id";
|
|
844
993
|
try {
|
|
845
|
-
let l =
|
|
994
|
+
let l = i(await r.find(n, {
|
|
846
995
|
$filter: { [o]: { $in: a } },
|
|
847
996
|
$top: a.length
|
|
848
997
|
})), u = c.reference_field || c.display_field || "name", d = {};
|
|
@@ -879,50 +1028,67 @@ async function Re(e, t, n, i, a) {
|
|
|
879
1028
|
};
|
|
880
1029
|
});
|
|
881
1030
|
}
|
|
882
|
-
var
|
|
883
|
-
let { schema:
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
}, [
|
|
887
|
-
let [
|
|
888
|
-
|
|
889
|
-
|
|
1031
|
+
var $e = (e) => {
|
|
1032
|
+
let { schema: l } = e, u = e.onSegmentClick, d = p(ve), b = e.dataSource || d?.dataSource, x = ye(l.bind), { fieldOptionLabel: w } = Ce(), ce = g(w);
|
|
1033
|
+
m(() => {
|
|
1034
|
+
ce.current = w;
|
|
1035
|
+
}, [w]);
|
|
1036
|
+
let [T, E] = _([]), [D, O] = _(() => !(Array.isArray(l.data) && l.data.length > 0) && (!!l.objectName || !!l.dataset)), [le, ue] = _(null), [de, k] = _(null), { openRecordList: fe } = be(), pe = we(), A = h(() => l.aggregate ? JSON.stringify(l.aggregate) : "", [l.aggregate]), j = h(() => l.filter ? JSON.stringify(l.filter) : "", [l.filter]), me = h(() => l.compareTo ? JSON.stringify(l.compareTo) : "", [l.compareTo]), he = h(() => l.dataset ? JSON.stringify({
|
|
1037
|
+
d: l.dataset,
|
|
1038
|
+
dim: l.dimensions ?? [],
|
|
1039
|
+
val: l.values ?? []
|
|
1040
|
+
}) : "", [
|
|
1041
|
+
l.dataset,
|
|
1042
|
+
l.dimensions,
|
|
1043
|
+
l.values
|
|
1044
|
+
]), ge = (e) => e !== "pie" && e !== "donut" && e !== "funnel", M = f(async (e, t) => {
|
|
1045
|
+
if (l.aggregate && typeof e.aggregate == "function") {
|
|
1046
|
+
let n = l.aggregate.groupBy;
|
|
890
1047
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
891
|
-
let r =
|
|
1048
|
+
let r = l.aggregate.field, i = l.aggregate.function, a = {
|
|
892
1049
|
function: i,
|
|
893
1050
|
alias: r || i
|
|
894
1051
|
};
|
|
895
1052
|
i !== "count" && r && (a.field = r);
|
|
896
|
-
let o = await e.aggregate(
|
|
1053
|
+
let o = await e.aggregate(l.objectName, {
|
|
897
1054
|
groupBy: [n],
|
|
898
1055
|
aggregations: [a],
|
|
899
1056
|
where: t
|
|
900
1057
|
});
|
|
901
1058
|
return Array.isArray(o) ? o : [];
|
|
902
1059
|
}
|
|
903
|
-
let r = await e.aggregate(
|
|
904
|
-
field:
|
|
905
|
-
function:
|
|
1060
|
+
let r = await e.aggregate(l.objectName, {
|
|
1061
|
+
field: l.aggregate.field,
|
|
1062
|
+
function: l.aggregate.function,
|
|
906
1063
|
groupBy: n,
|
|
907
1064
|
filter: t
|
|
908
1065
|
});
|
|
909
1066
|
return Array.isArray(r) ? r : [];
|
|
910
1067
|
}
|
|
911
1068
|
if (typeof e.find == "function") {
|
|
912
|
-
let n =
|
|
913
|
-
return
|
|
1069
|
+
let n = i(await e.find(l.objectName, { $filter: t }));
|
|
1070
|
+
return l.aggregate && n.length > 0 && (n = Ze(n, l.aggregate)), n;
|
|
914
1071
|
}
|
|
915
1072
|
return [];
|
|
916
|
-
}, [
|
|
917
|
-
if (!e || !
|
|
918
|
-
t.current &&
|
|
1073
|
+
}, [l.objectName, A]), N = f(async (e, t) => {
|
|
1074
|
+
if (!e || !l.objectName && !l.dataset) {
|
|
1075
|
+
t.current && O(!1);
|
|
919
1076
|
return;
|
|
920
1077
|
}
|
|
921
|
-
t.current && (
|
|
1078
|
+
t.current && (O(!0), ue(null));
|
|
922
1079
|
try {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1080
|
+
if (l.dataset && typeof e.queryDataset == "function") {
|
|
1081
|
+
let n = o(l.filter), r = await e.queryDataset(l.dataset, {
|
|
1082
|
+
dimensions: Array.isArray(l.dimensions) ? l.dimensions : [],
|
|
1083
|
+
measures: Array.isArray(l.values) ? l.values : [],
|
|
1084
|
+
...n ? { runtimeFilter: n } : {}
|
|
1085
|
+
});
|
|
1086
|
+
t.current && E(Array.isArray(r?.rows) ? r.rows : []);
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
let n = o(l.filter), r = l.compareTo, i = !!r && ge(l.chartType), a = i ? c(l.filter, r) : null, [s, u] = await Promise.all([M(e, n), a ? M(e, a) : Promise.resolve([])]), d = s, f = l.aggregate?.groupBy, p = f && typeof f == "object" && !Array.isArray(f) ? f.alias || f.field : f || l.xAxisKey;
|
|
1090
|
+
if (i && u.length > 0 && l.aggregate) {
|
|
1091
|
+
let e = l.aggregate.field, t = l.aggregate.function, n = (n) => {
|
|
926
1092
|
if (n == null) return null;
|
|
927
1093
|
let r = `${e}_${t}`;
|
|
928
1094
|
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;
|
|
@@ -961,153 +1127,180 @@ var ze = (e) => {
|
|
|
961
1127
|
}
|
|
962
1128
|
}
|
|
963
1129
|
if (p && typeof e.getObjectSchema == "function") try {
|
|
964
|
-
let t = await e.getObjectSchema(
|
|
965
|
-
d = await
|
|
1130
|
+
let t = await e.getObjectSchema(l.objectName);
|
|
1131
|
+
d = await Qe(d, p, t, e, (e, t) => ce.current(l.objectName, p, e, t));
|
|
966
1132
|
} catch {}
|
|
967
|
-
t.current &&
|
|
1133
|
+
t.current && E(d);
|
|
968
1134
|
} catch (e) {
|
|
969
|
-
console.error("[ObjectChart] Fetch error:", e), t.current &&
|
|
1135
|
+
console.error("[ObjectChart] Fetch error:", e), t.current && ue(e instanceof Error ? e.message : "Failed to load chart data");
|
|
970
1136
|
} finally {
|
|
971
|
-
t.current &&
|
|
1137
|
+
t.current && O(!1);
|
|
972
1138
|
}
|
|
973
1139
|
}, [
|
|
974
|
-
|
|
1140
|
+
l.objectName,
|
|
1141
|
+
he,
|
|
1142
|
+
A,
|
|
975
1143
|
j,
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
N
|
|
1144
|
+
me,
|
|
1145
|
+
l.xAxisKey,
|
|
1146
|
+
l.chartType,
|
|
1147
|
+
M
|
|
981
1148
|
]);
|
|
982
|
-
|
|
1149
|
+
m(() => {
|
|
983
1150
|
let e = { current: !0 };
|
|
984
|
-
return
|
|
1151
|
+
return (l.objectName || l.dataset) && !x && !l.data ? N(b, e) : e.current && O(!1), () => {
|
|
985
1152
|
e.current = !1;
|
|
986
1153
|
};
|
|
987
1154
|
}, [
|
|
988
|
-
|
|
989
|
-
|
|
1155
|
+
l.objectName,
|
|
1156
|
+
he,
|
|
990
1157
|
b,
|
|
991
|
-
|
|
992
|
-
|
|
1158
|
+
x,
|
|
1159
|
+
l.data,
|
|
993
1160
|
j,
|
|
994
|
-
|
|
995
|
-
|
|
1161
|
+
A,
|
|
1162
|
+
me,
|
|
1163
|
+
N
|
|
996
1164
|
]);
|
|
997
|
-
let
|
|
998
|
-
if (!
|
|
999
|
-
let e = /* @__PURE__ */ new Map(), t = `__raw_${
|
|
1000
|
-
for (let n of
|
|
1001
|
-
let r = n?.[
|
|
1165
|
+
let P = x || l.data || T, F = Array.isArray(P) ? P : [], I = l.drillDown, L = l.aggregate?.groupBy || l.xAxisKey, R = h(() => {
|
|
1166
|
+
if (!L) return /* @__PURE__ */ new Map();
|
|
1167
|
+
let e = /* @__PURE__ */ new Map(), t = `__raw_${L}`;
|
|
1168
|
+
for (let n of F) {
|
|
1169
|
+
let r = n?.[L];
|
|
1002
1170
|
if (r == null) continue;
|
|
1003
1171
|
let i = t in (n || {}) ? n[t] : r;
|
|
1004
1172
|
e.set(String(r), i);
|
|
1005
1173
|
}
|
|
1006
1174
|
return e;
|
|
1007
|
-
}, [
|
|
1008
|
-
let e = Array.isArray(
|
|
1009
|
-
if (!
|
|
1010
|
-
let
|
|
1175
|
+
}, [F, L]), z = l.compareTo, B = !!z && ge(l.chartType) && !!l.aggregate && F.some((e) => e[`${l.aggregate.field}__comparison`] != null), V = h(() => {
|
|
1176
|
+
let e = Array.isArray(l.series) ? l.series : null;
|
|
1177
|
+
if (!B) return e;
|
|
1178
|
+
let t = e || [{ dataKey: l.aggregate.field }], r = {
|
|
1011
1179
|
vsLastWeek: "Previous week",
|
|
1012
1180
|
vsLastMonth: "Previous month",
|
|
1013
1181
|
vsLastQuarter: "Previous quarter",
|
|
1014
1182
|
vsLastYear: "Previous year",
|
|
1015
1183
|
vsYesterday: "Yesterday",
|
|
1016
1184
|
vsPreviousPeriod: "Previous period"
|
|
1017
|
-
}[
|
|
1018
|
-
return [...
|
|
1185
|
+
}[n(z, l.filter)] || "Previous period";
|
|
1186
|
+
return [...t.map((e) => ({
|
|
1019
1187
|
...e,
|
|
1020
1188
|
variant: e.variant || "current"
|
|
1021
1189
|
})), {
|
|
1022
|
-
dataKey: `${
|
|
1190
|
+
dataKey: `${l.aggregate.field}__comparison`,
|
|
1023
1191
|
label: r,
|
|
1024
1192
|
variant: "comparison"
|
|
1025
1193
|
}];
|
|
1026
1194
|
}, [
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
]),
|
|
1033
|
-
...
|
|
1034
|
-
data:
|
|
1035
|
-
|
|
1195
|
+
B,
|
|
1196
|
+
l.series,
|
|
1197
|
+
l.aggregate,
|
|
1198
|
+
l.filter,
|
|
1199
|
+
z
|
|
1200
|
+
]), H = l.dataset ? t(F, l.dimensions, l.values) : null, Te = H ? {
|
|
1201
|
+
...l,
|
|
1202
|
+
data: H.data,
|
|
1203
|
+
xAxisKey: H.xAxisKey,
|
|
1204
|
+
series: H.series
|
|
1205
|
+
} : {
|
|
1206
|
+
...l,
|
|
1207
|
+
data: F,
|
|
1208
|
+
...V ? { series: V } : {}
|
|
1036
1209
|
};
|
|
1037
|
-
if (
|
|
1038
|
-
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (
|
|
1210
|
+
if (D && F.length === 0) return /* @__PURE__ */ S("div", {
|
|
1211
|
+
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (l.className || ""),
|
|
1039
1212
|
"data-testid": "chart-loading",
|
|
1040
1213
|
children: "Loading chart data…"
|
|
1041
1214
|
});
|
|
1042
|
-
if (
|
|
1043
|
-
className: "flex flex-col items-center justify-center gap-2 p-4 " + (
|
|
1215
|
+
if (le) return /* @__PURE__ */ C("div", {
|
|
1216
|
+
className: "flex flex-col items-center justify-center gap-2 p-4 " + (l.className || ""),
|
|
1044
1217
|
"data-testid": "chart-error",
|
|
1045
1218
|
role: "alert",
|
|
1046
1219
|
children: [
|
|
1047
|
-
/* @__PURE__ */ S(
|
|
1220
|
+
/* @__PURE__ */ S(xe, { className: "h-6 w-6 text-destructive opacity-60" }),
|
|
1048
1221
|
/* @__PURE__ */ S("p", {
|
|
1049
1222
|
className: "text-xs text-destructive font-medium",
|
|
1050
1223
|
children: "Failed to load chart data"
|
|
1051
1224
|
}),
|
|
1052
1225
|
/* @__PURE__ */ S("p", {
|
|
1053
1226
|
className: "text-xs text-muted-foreground max-w-xs text-center",
|
|
1054
|
-
children:
|
|
1227
|
+
children: le
|
|
1055
1228
|
})
|
|
1056
1229
|
]
|
|
1057
1230
|
});
|
|
1058
|
-
if (!
|
|
1059
|
-
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (
|
|
1231
|
+
if (!b && l.objectName && F.length === 0) return /* @__PURE__ */ C("div", {
|
|
1232
|
+
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (l.className || ""),
|
|
1060
1233
|
"data-testid": "chart-no-datasource",
|
|
1061
1234
|
children: [
|
|
1062
1235
|
"No data source available for “",
|
|
1063
|
-
|
|
1236
|
+
l.objectName,
|
|
1064
1237
|
"”"
|
|
1065
1238
|
]
|
|
1066
1239
|
});
|
|
1067
|
-
let
|
|
1068
|
-
let t = e.category, n = t != null &&
|
|
1069
|
-
|
|
1240
|
+
let U = a(I) ? (e) => {
|
|
1241
|
+
let t = e.category, n = t != null && R.has(String(t)) ? R.get(String(t)) : t;
|
|
1242
|
+
k({
|
|
1070
1243
|
...e,
|
|
1071
1244
|
category: n,
|
|
1072
1245
|
categoryLabel: t,
|
|
1073
1246
|
scope: "cell"
|
|
1074
1247
|
});
|
|
1075
|
-
} : void 0,
|
|
1076
|
-
let e =
|
|
1077
|
-
...
|
|
1248
|
+
} : void 0, Ee = u ?? U, De = !u && de && l.objectName ? (() => {
|
|
1249
|
+
let e = r(I, de, { groupByField: L }), t = {
|
|
1250
|
+
...l.filter || {},
|
|
1078
1251
|
...e
|
|
1079
|
-
},
|
|
1252
|
+
}, n = s(I, de, l.title || "Details"), i = I?.target ?? "drawer", a = /* @__PURE__ */ S("div", {
|
|
1080
1253
|
className: "overflow-auto",
|
|
1081
1254
|
"data-testid": "chart-drill-body",
|
|
1082
|
-
children: /* @__PURE__ */ S(
|
|
1255
|
+
children: /* @__PURE__ */ S(_e, {
|
|
1083
1256
|
schema: {
|
|
1084
1257
|
type: "object-data-table",
|
|
1085
|
-
objectName:
|
|
1258
|
+
objectName: l.objectName,
|
|
1086
1259
|
filter: t,
|
|
1087
1260
|
pagination: !0,
|
|
1088
|
-
pageSize:
|
|
1089
|
-
columns:
|
|
1261
|
+
pageSize: I?.maxRows,
|
|
1262
|
+
columns: I?.columns?.map((e) => ({
|
|
1090
1263
|
accessorKey: e,
|
|
1091
1264
|
header: e
|
|
1092
|
-
}))
|
|
1265
|
+
})),
|
|
1266
|
+
drillDown: {
|
|
1267
|
+
enabled: !0,
|
|
1268
|
+
mode: "record",
|
|
1269
|
+
target: "dialog"
|
|
1270
|
+
}
|
|
1093
1271
|
},
|
|
1094
|
-
dataSource:
|
|
1272
|
+
dataSource: b
|
|
1095
1273
|
})
|
|
1096
|
-
})
|
|
1097
|
-
|
|
1274
|
+
}), o = fe && l.objectName ? /* @__PURE__ */ C(ee, {
|
|
1275
|
+
type: "button",
|
|
1276
|
+
variant: "ghost",
|
|
1277
|
+
size: "sm",
|
|
1278
|
+
"data-testid": "drill-open-in-list",
|
|
1279
|
+
onClick: () => {
|
|
1280
|
+
fe(l.objectName, t), k(null);
|
|
1281
|
+
},
|
|
1282
|
+
children: [pe("dashboard.openInList", "Open in list"), /* @__PURE__ */ S(Se, { className: "ml-1 h-3.5 w-3.5" })]
|
|
1283
|
+
}) : null;
|
|
1284
|
+
return i === "dialog" ? /* @__PURE__ */ S(te, {
|
|
1098
1285
|
open: !0,
|
|
1099
|
-
onOpenChange: (e) => !e &&
|
|
1100
|
-
children: /* @__PURE__ */ C(
|
|
1286
|
+
onOpenChange: (e) => !e && k(null),
|
|
1287
|
+
children: /* @__PURE__ */ C(ne, {
|
|
1101
1288
|
className: "max-w-4xl",
|
|
1102
|
-
children: [/* @__PURE__ */
|
|
1289
|
+
children: [/* @__PURE__ */ C(re, {
|
|
1290
|
+
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1291
|
+
children: [/* @__PURE__ */ S(ie, { children: n }), o]
|
|
1292
|
+
}), a]
|
|
1103
1293
|
})
|
|
1104
|
-
}) : /* @__PURE__ */ S(
|
|
1294
|
+
}) : /* @__PURE__ */ S(oe, {
|
|
1105
1295
|
open: !0,
|
|
1106
|
-
onOpenChange: (e) => !e &&
|
|
1107
|
-
children: /* @__PURE__ */ C(
|
|
1296
|
+
onOpenChange: (e) => !e && k(null),
|
|
1297
|
+
children: /* @__PURE__ */ C(v, {
|
|
1108
1298
|
side: "right",
|
|
1109
1299
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1300
|
+
children: [/* @__PURE__ */ C(y, {
|
|
1301
|
+
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1302
|
+
children: [/* @__PURE__ */ S(se, { children: n }), o]
|
|
1303
|
+
}), /* @__PURE__ */ S("div", {
|
|
1111
1304
|
className: "flex-1 overflow-hidden mt-2",
|
|
1112
1305
|
children: a
|
|
1113
1306
|
})]
|
|
@@ -1117,17 +1310,17 @@ var ze = (e) => {
|
|
|
1117
1310
|
return /* @__PURE__ */ C("div", {
|
|
1118
1311
|
className: "relative",
|
|
1119
1312
|
children: [
|
|
1120
|
-
/* @__PURE__ */ S(
|
|
1313
|
+
/* @__PURE__ */ S(ae, { active: D && F.length > 0 }),
|
|
1121
1314
|
/* @__PURE__ */ S(Q, {
|
|
1122
1315
|
...e,
|
|
1123
|
-
schema:
|
|
1124
|
-
onChartClick:
|
|
1316
|
+
schema: Te,
|
|
1317
|
+
onChartClick: Ee
|
|
1125
1318
|
}),
|
|
1126
|
-
|
|
1319
|
+
De
|
|
1127
1320
|
]
|
|
1128
1321
|
});
|
|
1129
1322
|
};
|
|
1130
|
-
e.register("object-chart",
|
|
1323
|
+
e.register("object-chart", $e, {
|
|
1131
1324
|
namespace: "plugin-charts",
|
|
1132
1325
|
label: "Object Chart",
|
|
1133
1326
|
category: "view",
|
|
@@ -1159,11 +1352,11 @@ e.register("object-chart", ze, {
|
|
|
1159
1352
|
});
|
|
1160
1353
|
//#endregion
|
|
1161
1354
|
//#region src/index.tsx
|
|
1162
|
-
var
|
|
1163
|
-
"bar-chart":
|
|
1355
|
+
var et = {
|
|
1356
|
+
"bar-chart": Xe,
|
|
1164
1357
|
chart: Q
|
|
1165
1358
|
};
|
|
1166
|
-
e.register("bar-chart",
|
|
1359
|
+
e.register("bar-chart", Xe, {
|
|
1167
1360
|
namespace: "plugin-charts",
|
|
1168
1361
|
label: "Bar Chart",
|
|
1169
1362
|
category: "plugin",
|
|
@@ -1227,7 +1420,7 @@ e.register("bar-chart", Ie, {
|
|
|
1227
1420
|
height: 400,
|
|
1228
1421
|
color: "#8884d8"
|
|
1229
1422
|
}
|
|
1230
|
-
}), e.register("chart",
|
|
1423
|
+
}), e.register("chart", $e, {
|
|
1231
1424
|
namespace: "view",
|
|
1232
1425
|
category: "view",
|
|
1233
1426
|
label: "Chart",
|
|
@@ -1393,4 +1586,4 @@ e.register("bar-chart", Ie, {
|
|
|
1393
1586
|
defaultProps: { chartType: "scatter" }
|
|
1394
1587
|
});
|
|
1395
1588
|
//#endregion
|
|
1396
|
-
export {
|
|
1589
|
+
export { Xe as ChartBarRenderer, Q as ChartRenderer, $e as ObjectChart, et as chartComponents };
|