@object-ui/plugin-charts 4.0.3 → 4.0.5
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 +52 -0
- package/dist/index.js +645 -446
- package/dist/index.umd.cjs +2 -56
- package/package.json +6 -6
- package/dist/AdvancedChartImpl-BLyJ4LaI.js +0 -3981
- package/dist/BarChart-C9W1kOQ6.js +0 -16506
- package/dist/ChartImpl-AHzX3Kht.js +0 -134
- package/dist/shim-oa8knWTF.js +0 -284
package/dist/index.js
CHANGED
|
@@ -1,12 +1,560 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Skeleton as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { ComponentRegistry as e, extractRecords as t } from "@object-ui/core";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import r, { Suspense as i, useCallback as a, useContext as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
4
|
+
import { Skeleton as d } from "@object-ui/components";
|
|
5
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
6
|
+
import { Area as h, AreaChart as g, Bar as _, BarChart as v, CartesianGrid as y, Cell as b, Legend as x, Line as S, LineChart as C, Pie as w, PieChart as T, PolarAngleAxis as E, PolarGrid as D, PolarRadiusAxis as ee, Radar as te, RadarChart as O, ResponsiveContainer as k, Scatter as ne, ScatterChart as A, Tooltip as j, XAxis as M, YAxis as N, ZAxis as re } from "recharts";
|
|
7
|
+
import { SchemaRendererContext as ie, useDataScope as ae } from "@object-ui/react";
|
|
8
|
+
import { AlertCircle as oe } from "lucide-react";
|
|
9
|
+
import { useSafeFieldLabel as se } from "@object-ui/i18n";
|
|
10
|
+
//#region \0rolldown/runtime.js
|
|
11
|
+
var P = Object.defineProperty, F = (e, t) => () => (e && (t = e(e = 0)), t), I = (e, t) => {
|
|
12
|
+
let n = {};
|
|
13
|
+
for (var r in e) P(n, r, {
|
|
14
|
+
get: e[r],
|
|
15
|
+
enumerable: !0
|
|
16
|
+
});
|
|
17
|
+
return t || P(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
18
|
+
}, ce = /* @__PURE__ */ I({ default: () => le });
|
|
19
|
+
function le({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
|
|
20
|
+
return /* @__PURE__ */ p("div", {
|
|
21
|
+
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__ */ p(k, {
|
|
23
|
+
width: "100%",
|
|
24
|
+
height: r,
|
|
25
|
+
children: /* @__PURE__ */ m(v, {
|
|
26
|
+
data: e,
|
|
27
|
+
margin: {
|
|
28
|
+
top: 10,
|
|
29
|
+
right: 10,
|
|
30
|
+
left: 10,
|
|
31
|
+
bottom: 5
|
|
32
|
+
},
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ m("defs", { children: [/* @__PURE__ */ m("linearGradient", {
|
|
35
|
+
id: "barGradient",
|
|
36
|
+
x1: "0",
|
|
37
|
+
y1: "0",
|
|
38
|
+
x2: "0",
|
|
39
|
+
y2: "1",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ p("stop", {
|
|
42
|
+
offset: "0%",
|
|
43
|
+
stopColor: a,
|
|
44
|
+
stopOpacity: 1
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ p("stop", {
|
|
47
|
+
offset: "90%",
|
|
48
|
+
stopColor: a,
|
|
49
|
+
stopOpacity: .6
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ p("stop", {
|
|
52
|
+
offset: "100%",
|
|
53
|
+
stopColor: a,
|
|
54
|
+
stopOpacity: .3
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
}), /* @__PURE__ */ m("filter", {
|
|
58
|
+
id: "glow",
|
|
59
|
+
height: "130%",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ p("feGaussianBlur", {
|
|
62
|
+
in: "SourceAlpha",
|
|
63
|
+
stdDeviation: "3",
|
|
64
|
+
result: "blur"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ p("feOffset", {
|
|
67
|
+
in: "blur",
|
|
68
|
+
dx: "0",
|
|
69
|
+
dy: "0",
|
|
70
|
+
result: "offsetBlur"
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ p("feFlood", {
|
|
73
|
+
floodColor: a,
|
|
74
|
+
floodOpacity: "0.5",
|
|
75
|
+
result: "offsetColor"
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ p("feComposite", {
|
|
78
|
+
in: "offsetColor",
|
|
79
|
+
in2: "offsetBlur",
|
|
80
|
+
operator: "in",
|
|
81
|
+
result: "offsetBlur"
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ m("feMerge", { children: [/* @__PURE__ */ p("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ p("feMergeNode", { in: "SourceGraphic" })] })
|
|
84
|
+
]
|
|
85
|
+
})] }),
|
|
86
|
+
/* @__PURE__ */ p(y, {
|
|
87
|
+
strokeDasharray: "3 3",
|
|
88
|
+
stroke: "hsl(var(--border))",
|
|
89
|
+
vertical: !1
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ p(M, {
|
|
92
|
+
dataKey: n,
|
|
93
|
+
tick: {
|
|
94
|
+
fill: "hsl(var(--muted-foreground))",
|
|
95
|
+
fontSize: 12,
|
|
96
|
+
fontFamily: "monospace"
|
|
97
|
+
},
|
|
98
|
+
tickLine: !1,
|
|
99
|
+
axisLine: { stroke: "hsl(var(--border))" },
|
|
100
|
+
dy: 10
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ p(N, {
|
|
103
|
+
tick: {
|
|
104
|
+
fill: "hsl(var(--muted-foreground))",
|
|
105
|
+
fontSize: 12,
|
|
106
|
+
fontFamily: "monospace"
|
|
107
|
+
},
|
|
108
|
+
tickLine: !1,
|
|
109
|
+
axisLine: !1
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ p(j, {
|
|
112
|
+
cursor: {
|
|
113
|
+
fill: "hsl(var(--muted))",
|
|
114
|
+
opacity: .2
|
|
115
|
+
},
|
|
116
|
+
contentStyle: {
|
|
117
|
+
backgroundColor: "hsl(var(--popover))",
|
|
118
|
+
borderColor: "hsl(var(--border))",
|
|
119
|
+
color: "hsl(var(--popover-foreground))",
|
|
120
|
+
borderRadius: "8px",
|
|
121
|
+
fontFamily: "monospace",
|
|
122
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
123
|
+
},
|
|
124
|
+
itemStyle: { color: "hsl(var(--primary))" }
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ p(x, { wrapperStyle: {
|
|
127
|
+
paddingTop: "20px",
|
|
128
|
+
fontFamily: "monospace"
|
|
129
|
+
} }),
|
|
130
|
+
/* @__PURE__ */ p(_, {
|
|
131
|
+
dataKey: t,
|
|
132
|
+
fill: "url(#barGradient)",
|
|
133
|
+
radius: [
|
|
134
|
+
4,
|
|
135
|
+
4,
|
|
136
|
+
0,
|
|
137
|
+
0
|
|
138
|
+
],
|
|
139
|
+
filter: "url(#glow)",
|
|
140
|
+
animationDuration: 1500
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
var ue = F((() => {}));
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/ChartContainerImpl.tsx
|
|
150
|
+
function L() {
|
|
151
|
+
let e = n.useContext(W);
|
|
152
|
+
if (!e) throw Error("useChart must be used within a <ChartContainer />");
|
|
153
|
+
return e;
|
|
154
|
+
}
|
|
155
|
+
function R({ id: e, className: t, children: r, config: i, ...a }) {
|
|
156
|
+
let o = n.useId(), s = `chart-${e || o.replace(/:/g, "")}`;
|
|
157
|
+
return /* @__PURE__ */ p(W.Provider, {
|
|
158
|
+
value: { config: i },
|
|
159
|
+
children: /* @__PURE__ */ m("div", {
|
|
160
|
+
"data-slot": "chart",
|
|
161
|
+
"data-chart": s,
|
|
162
|
+
className: H("flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
|
|
163
|
+
...a,
|
|
164
|
+
children: [/* @__PURE__ */ p(G, {
|
|
165
|
+
id: s,
|
|
166
|
+
config: i
|
|
167
|
+
}), /* @__PURE__ */ p(k, {
|
|
168
|
+
width: "100%",
|
|
169
|
+
height: "100%",
|
|
170
|
+
children: r
|
|
171
|
+
})]
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function z({ active: e, payload: t, className: r, indicator: i = "dot", hideLabel: a = !1, hideIndicator: o = !1, label: s, labelFormatter: c, labelClassName: l, formatter: u, color: d, nameKey: h, labelKey: g }) {
|
|
176
|
+
let { config: _ } = L(), v = n.useMemo(() => {
|
|
177
|
+
if (a || !t?.length) return null;
|
|
178
|
+
let [e] = t, n = V(_, e, `${g || e?.dataKey || e?.name || "value"}`), r = !g && typeof s == "string" ? _[s]?.label || s : n?.label;
|
|
179
|
+
return c ? /* @__PURE__ */ p("div", {
|
|
180
|
+
className: H("font-medium", l),
|
|
181
|
+
children: c(r, t)
|
|
182
|
+
}) : r ? /* @__PURE__ */ p("div", {
|
|
183
|
+
className: H("font-medium", l),
|
|
184
|
+
children: r
|
|
185
|
+
}) : null;
|
|
186
|
+
}, [
|
|
187
|
+
s,
|
|
188
|
+
c,
|
|
189
|
+
t,
|
|
190
|
+
a,
|
|
191
|
+
l,
|
|
192
|
+
_,
|
|
193
|
+
g
|
|
194
|
+
]);
|
|
195
|
+
if (!e || !t?.length) return null;
|
|
196
|
+
let y = t.length === 1 && i !== "dot";
|
|
197
|
+
return /* @__PURE__ */ m("div", {
|
|
198
|
+
className: H("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", r),
|
|
199
|
+
children: [y ? null : v, /* @__PURE__ */ p("div", {
|
|
200
|
+
className: "grid gap-1.5",
|
|
201
|
+
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
202
|
+
let n = V(_, e, `${h || e.name || e.dataKey || "value"}`), r = d || e.payload.fill || e.color;
|
|
203
|
+
return /* @__PURE__ */ p("div", {
|
|
204
|
+
className: H("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", i === "dot" ? "items-center" : ""),
|
|
205
|
+
children: u && e?.value !== void 0 && e.name ? u(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ m(f, { children: [n?.icon ? /* @__PURE__ */ p(n.icon, {}) : !o && /* @__PURE__ */ p("div", {
|
|
206
|
+
className: H("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", i === "dot" ? "h-2.5 w-2.5" : "", i === "line" ? "w-1" : "", i === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", y && i === "dashed" ? "my-0.5" : ""),
|
|
207
|
+
style: {
|
|
208
|
+
"--color-bg": r,
|
|
209
|
+
"--color-border": r
|
|
210
|
+
}
|
|
211
|
+
}), /* @__PURE__ */ m("div", {
|
|
212
|
+
className: H("flex flex-1 justify-between leading-none", y ? "items-end" : "items-center"),
|
|
213
|
+
children: [/* @__PURE__ */ m("div", {
|
|
214
|
+
className: "grid gap-1.5",
|
|
215
|
+
children: [y ? v : null, /* @__PURE__ */ p("span", {
|
|
216
|
+
className: "text-muted-foreground",
|
|
217
|
+
children: n?.label || e.name
|
|
218
|
+
})]
|
|
219
|
+
}), e.value && /* @__PURE__ */ p("span", {
|
|
220
|
+
className: "text-foreground font-mono font-medium tabular-nums",
|
|
221
|
+
children: e.value.toLocaleString()
|
|
222
|
+
})]
|
|
223
|
+
})] })
|
|
224
|
+
}, e.dataKey);
|
|
225
|
+
})
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function B({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
|
|
230
|
+
let { config: a } = L();
|
|
231
|
+
return n?.length ? /* @__PURE__ */ p("div", {
|
|
232
|
+
className: H("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
233
|
+
children: n.filter((e) => e.type !== "none").map((e) => {
|
|
234
|
+
let n = V(a, e, `${i || e.dataKey || "value"}`);
|
|
235
|
+
return /* @__PURE__ */ m("div", {
|
|
236
|
+
className: H("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
237
|
+
children: [n?.icon && !t ? /* @__PURE__ */ p(n.icon, {}) : /* @__PURE__ */ p("div", {
|
|
238
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
239
|
+
style: { backgroundColor: e.color }
|
|
240
|
+
}), n?.label]
|
|
241
|
+
}, e.value);
|
|
242
|
+
})
|
|
243
|
+
}) : null;
|
|
244
|
+
}
|
|
245
|
+
function V(e, t, n) {
|
|
246
|
+
if (typeof t != "object" || !t) return;
|
|
247
|
+
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
248
|
+
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];
|
|
249
|
+
}
|
|
250
|
+
var H, U, W, G, K, q, de = F((() => {
|
|
251
|
+
H = (...e) => e.filter(Boolean).join(" "), U = {
|
|
252
|
+
light: "",
|
|
253
|
+
dark: ".dark"
|
|
254
|
+
}, W = n.createContext(null), G = ({ id: e, config: t }) => {
|
|
255
|
+
let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
256
|
+
return n.length ? /* @__PURE__ */ p("style", { dangerouslySetInnerHTML: { __html: Object.entries(U).map(([t, r]) => `
|
|
257
|
+
${r} [data-chart=${e}] {
|
|
258
|
+
${n.map(([e, n]) => {
|
|
259
|
+
let r = n.theme?.[t] || n.color;
|
|
260
|
+
return r ? ` --color-${e}: ${r};` : null;
|
|
261
|
+
}).join("\n")}
|
|
262
|
+
}
|
|
263
|
+
`).join("\n") } }) : null;
|
|
264
|
+
}, K = j, q = x;
|
|
265
|
+
})), fe = /* @__PURE__ */ I({ default: () => pe });
|
|
266
|
+
function pe({ chartType: e = "bar", data: t = [], config: r = {}, xAxisKey: i = "name", series: a = [], className: o = "" }) {
|
|
267
|
+
let s = Array.isArray(t) ? t : [], [c, l] = n.useState(!1);
|
|
268
|
+
n.useEffect(() => {
|
|
269
|
+
let e = () => l(window.innerWidth < 640);
|
|
270
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
271
|
+
}, []);
|
|
272
|
+
let u = {
|
|
273
|
+
bar: v,
|
|
274
|
+
line: C,
|
|
275
|
+
area: g,
|
|
276
|
+
pie: T,
|
|
277
|
+
donut: T,
|
|
278
|
+
radar: O,
|
|
279
|
+
scatter: A,
|
|
280
|
+
combo: v
|
|
281
|
+
}[e] || v, d = n.useMemo(() => s.some((e) => String(e[i] || "").length > 5), [s, i]), f = () => [
|
|
282
|
+
"hsl(var(--chart-1))",
|
|
283
|
+
"hsl(var(--chart-2))",
|
|
284
|
+
"hsl(var(--chart-3))",
|
|
285
|
+
"hsl(var(--chart-4))",
|
|
286
|
+
"hsl(var(--chart-5))"
|
|
287
|
+
];
|
|
288
|
+
if (e === "pie" || e === "donut") {
|
|
289
|
+
let t = e === "donut" ? 60 : 0;
|
|
290
|
+
return /* @__PURE__ */ p(R, {
|
|
291
|
+
config: r,
|
|
292
|
+
className: o,
|
|
293
|
+
children: /* @__PURE__ */ m(T, { children: [
|
|
294
|
+
/* @__PURE__ */ p(K, {
|
|
295
|
+
cursor: !1,
|
|
296
|
+
content: /* @__PURE__ */ p(z, { hideLabel: !0 })
|
|
297
|
+
}),
|
|
298
|
+
/* @__PURE__ */ p(w, {
|
|
299
|
+
data: s,
|
|
300
|
+
dataKey: a[0]?.dataKey || "value",
|
|
301
|
+
nameKey: i || "name",
|
|
302
|
+
innerRadius: t,
|
|
303
|
+
strokeWidth: 5,
|
|
304
|
+
paddingAngle: 2,
|
|
305
|
+
outerRadius: 80,
|
|
306
|
+
children: s.map((e, t) => {
|
|
307
|
+
let n = r[e[i]]?.color;
|
|
308
|
+
if (!n) {
|
|
309
|
+
let e = f();
|
|
310
|
+
n = e[t % e.length];
|
|
311
|
+
}
|
|
312
|
+
return /* @__PURE__ */ p(b, { fill: Y(n) }, `cell-${t}`);
|
|
313
|
+
})
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ p(q, {
|
|
316
|
+
content: /* @__PURE__ */ p(B, { nameKey: i }),
|
|
317
|
+
...c && {
|
|
318
|
+
verticalAlign: "bottom",
|
|
319
|
+
wrapperStyle: {
|
|
320
|
+
fontSize: "11px",
|
|
321
|
+
paddingTop: "8px"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
})
|
|
325
|
+
] })
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return e === "radar" ? /* @__PURE__ */ p(R, {
|
|
329
|
+
config: r,
|
|
330
|
+
className: o,
|
|
331
|
+
children: /* @__PURE__ */ m(O, {
|
|
332
|
+
data: s,
|
|
333
|
+
children: [
|
|
334
|
+
/* @__PURE__ */ p(D, {}),
|
|
335
|
+
/* @__PURE__ */ p(E, { dataKey: i }),
|
|
336
|
+
/* @__PURE__ */ p(ee, {}),
|
|
337
|
+
/* @__PURE__ */ p(K, { content: /* @__PURE__ */ p(z, {}) }),
|
|
338
|
+
/* @__PURE__ */ p(q, {
|
|
339
|
+
content: /* @__PURE__ */ p(B, {}),
|
|
340
|
+
...c && {
|
|
341
|
+
verticalAlign: "bottom",
|
|
342
|
+
wrapperStyle: {
|
|
343
|
+
fontSize: "11px",
|
|
344
|
+
paddingTop: "8px"
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}),
|
|
348
|
+
a.map((e) => {
|
|
349
|
+
let t = Y(r[e.dataKey]?.color || J);
|
|
350
|
+
return /* @__PURE__ */ p(te, {
|
|
351
|
+
dataKey: e.dataKey,
|
|
352
|
+
stroke: t,
|
|
353
|
+
fill: t,
|
|
354
|
+
fillOpacity: .6
|
|
355
|
+
}, e.dataKey);
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
})
|
|
359
|
+
}) : e === "scatter" ? /* @__PURE__ */ p(R, {
|
|
360
|
+
config: r,
|
|
361
|
+
className: o,
|
|
362
|
+
children: /* @__PURE__ */ m(A, { children: [
|
|
363
|
+
/* @__PURE__ */ p(y, { vertical: !1 }),
|
|
364
|
+
/* @__PURE__ */ p(M, {
|
|
365
|
+
type: "number",
|
|
366
|
+
dataKey: i,
|
|
367
|
+
name: String(r[i]?.label || i),
|
|
368
|
+
tickLine: !1,
|
|
369
|
+
axisLine: !1,
|
|
370
|
+
interval: c ? Math.ceil(s.length / 5) : 0
|
|
371
|
+
}),
|
|
372
|
+
/* @__PURE__ */ p(N, {
|
|
373
|
+
type: "number",
|
|
374
|
+
dataKey: a[0]?.dataKey || "value",
|
|
375
|
+
name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
|
|
376
|
+
tickLine: !1,
|
|
377
|
+
axisLine: !1
|
|
378
|
+
}),
|
|
379
|
+
/* @__PURE__ */ p(re, {
|
|
380
|
+
type: "number",
|
|
381
|
+
range: [60, 400]
|
|
382
|
+
}),
|
|
383
|
+
/* @__PURE__ */ p(K, { content: /* @__PURE__ */ p(z, {}) }),
|
|
384
|
+
/* @__PURE__ */ p(q, {
|
|
385
|
+
content: /* @__PURE__ */ p(B, {}),
|
|
386
|
+
...c && {
|
|
387
|
+
verticalAlign: "bottom",
|
|
388
|
+
wrapperStyle: {
|
|
389
|
+
fontSize: "11px",
|
|
390
|
+
paddingTop: "8px"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}),
|
|
394
|
+
a.map((e, t) => {
|
|
395
|
+
let n = f(), i = Y(r[e.dataKey]?.color || n[t % n.length]);
|
|
396
|
+
return /* @__PURE__ */ p(ne, {
|
|
397
|
+
name: r[e.dataKey]?.label || e.dataKey,
|
|
398
|
+
data: s,
|
|
399
|
+
fill: i
|
|
400
|
+
}, e.dataKey);
|
|
401
|
+
})
|
|
402
|
+
] })
|
|
403
|
+
}) : e === "combo" ? /* @__PURE__ */ p(R, {
|
|
404
|
+
config: r,
|
|
405
|
+
className: o,
|
|
406
|
+
children: /* @__PURE__ */ m(v, {
|
|
407
|
+
data: s,
|
|
408
|
+
children: [
|
|
409
|
+
/* @__PURE__ */ p(y, { vertical: !1 }),
|
|
410
|
+
/* @__PURE__ */ p(M, {
|
|
411
|
+
dataKey: i,
|
|
412
|
+
tickLine: !1,
|
|
413
|
+
tickMargin: 10,
|
|
414
|
+
axisLine: !1,
|
|
415
|
+
interval: c ? Math.ceil(s.length / 5) : 0,
|
|
416
|
+
tickFormatter: (e) => !e || typeof e != "string" ? e : c && e.length > 8 ? e.slice(0, 8) + "…" : e,
|
|
417
|
+
...!c && d && {
|
|
418
|
+
angle: -35,
|
|
419
|
+
textAnchor: "end",
|
|
420
|
+
height: 60
|
|
421
|
+
}
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ p(N, {
|
|
424
|
+
yAxisId: "left",
|
|
425
|
+
tickLine: !1,
|
|
426
|
+
axisLine: !1
|
|
427
|
+
}),
|
|
428
|
+
/* @__PURE__ */ p(N, {
|
|
429
|
+
yAxisId: "right",
|
|
430
|
+
orientation: "right",
|
|
431
|
+
tickLine: !1,
|
|
432
|
+
axisLine: !1
|
|
433
|
+
}),
|
|
434
|
+
/* @__PURE__ */ p(K, { content: /* @__PURE__ */ p(z, {}) }),
|
|
435
|
+
/* @__PURE__ */ p(q, {
|
|
436
|
+
content: /* @__PURE__ */ p(B, {}),
|
|
437
|
+
...c && {
|
|
438
|
+
verticalAlign: "bottom",
|
|
439
|
+
wrapperStyle: {
|
|
440
|
+
fontSize: "11px",
|
|
441
|
+
paddingTop: "8px"
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}),
|
|
445
|
+
a.map((e, t) => {
|
|
446
|
+
let n = Y(r[e.dataKey]?.color || J), i = e.chartType || (t === 0 ? "bar" : "line"), a = i === "bar" ? "left" : "right";
|
|
447
|
+
return i === "line" ? /* @__PURE__ */ p(S, {
|
|
448
|
+
yAxisId: a,
|
|
449
|
+
type: "monotone",
|
|
450
|
+
dataKey: e.dataKey,
|
|
451
|
+
stroke: n,
|
|
452
|
+
strokeWidth: 2,
|
|
453
|
+
dot: !1
|
|
454
|
+
}, e.dataKey) : i === "area" ? /* @__PURE__ */ p(h, {
|
|
455
|
+
yAxisId: a,
|
|
456
|
+
type: "monotone",
|
|
457
|
+
dataKey: e.dataKey,
|
|
458
|
+
fill: n,
|
|
459
|
+
stroke: n,
|
|
460
|
+
fillOpacity: .4
|
|
461
|
+
}, e.dataKey) : /* @__PURE__ */ p(_, {
|
|
462
|
+
yAxisId: a,
|
|
463
|
+
dataKey: e.dataKey,
|
|
464
|
+
fill: n,
|
|
465
|
+
radius: 4
|
|
466
|
+
}, e.dataKey);
|
|
467
|
+
})
|
|
468
|
+
]
|
|
469
|
+
})
|
|
470
|
+
}) : /* @__PURE__ */ p(R, {
|
|
471
|
+
config: r,
|
|
472
|
+
className: o,
|
|
473
|
+
children: /* @__PURE__ */ m(u, {
|
|
474
|
+
data: s,
|
|
475
|
+
children: [
|
|
476
|
+
/* @__PURE__ */ p(y, { vertical: !1 }),
|
|
477
|
+
/* @__PURE__ */ p(M, {
|
|
478
|
+
dataKey: i,
|
|
479
|
+
tickLine: !1,
|
|
480
|
+
tickMargin: 10,
|
|
481
|
+
axisLine: !1,
|
|
482
|
+
interval: c ? Math.ceil(s.length / 5) : 0,
|
|
483
|
+
tickFormatter: (e) => !e || typeof e != "string" ? e : c && e.length > 8 ? e.slice(0, 8) + "…" : e,
|
|
484
|
+
...!c && d && {
|
|
485
|
+
angle: -35,
|
|
486
|
+
textAnchor: "end",
|
|
487
|
+
height: 60
|
|
488
|
+
}
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ p(K, { content: /* @__PURE__ */ p(z, {}) }),
|
|
491
|
+
/* @__PURE__ */ p(q, {
|
|
492
|
+
content: /* @__PURE__ */ p(B, {}),
|
|
493
|
+
...c && {
|
|
494
|
+
verticalAlign: "bottom",
|
|
495
|
+
wrapperStyle: {
|
|
496
|
+
fontSize: "11px",
|
|
497
|
+
paddingTop: "8px"
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}),
|
|
501
|
+
a.map((t, n) => {
|
|
502
|
+
let i = f(), o = Y(r[t.dataKey]?.color || i[n % i.length] || J);
|
|
503
|
+
if (e === "bar") {
|
|
504
|
+
let e = a.length === 1 && s.length > 1;
|
|
505
|
+
return /* @__PURE__ */ p(_, {
|
|
506
|
+
dataKey: t.dataKey,
|
|
507
|
+
fill: o,
|
|
508
|
+
radius: 4,
|
|
509
|
+
children: e && s.map((e, t) => /* @__PURE__ */ p(b, { fill: Y(i[t % i.length]) }, `cell-${t}`))
|
|
510
|
+
}, t.dataKey);
|
|
511
|
+
}
|
|
512
|
+
return e === "line" ? /* @__PURE__ */ p(S, {
|
|
513
|
+
type: "monotone",
|
|
514
|
+
dataKey: t.dataKey,
|
|
515
|
+
stroke: o,
|
|
516
|
+
strokeWidth: 2,
|
|
517
|
+
dot: !1
|
|
518
|
+
}, t.dataKey) : e === "area" ? /* @__PURE__ */ p(h, {
|
|
519
|
+
type: "monotone",
|
|
520
|
+
dataKey: t.dataKey,
|
|
521
|
+
fill: o,
|
|
522
|
+
stroke: o,
|
|
523
|
+
fillOpacity: .4
|
|
524
|
+
}, t.dataKey) : null;
|
|
525
|
+
})
|
|
526
|
+
]
|
|
527
|
+
})
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
var J, me, Y, he = F((() => {
|
|
531
|
+
de(), J = "hsl(var(--primary))", me = {
|
|
532
|
+
slate: "#64748b",
|
|
533
|
+
gray: "#6b7280",
|
|
534
|
+
zinc: "#71717a",
|
|
535
|
+
neutral: "#737373",
|
|
536
|
+
stone: "#78716c",
|
|
537
|
+
red: "#ef4444",
|
|
538
|
+
orange: "#f97316",
|
|
539
|
+
amber: "#f59e0b",
|
|
540
|
+
yellow: "#eab308",
|
|
541
|
+
lime: "#84cc16",
|
|
542
|
+
green: "#22c55e",
|
|
543
|
+
emerald: "#10b981",
|
|
544
|
+
teal: "#14b8a6",
|
|
545
|
+
cyan: "#06b6d4",
|
|
546
|
+
sky: "#0ea5e9",
|
|
547
|
+
blue: "#3b82f6",
|
|
548
|
+
indigo: "#6366f1",
|
|
549
|
+
violet: "#8b5cf6",
|
|
550
|
+
purple: "#a855f7",
|
|
551
|
+
fuchsia: "#d946ef",
|
|
552
|
+
pink: "#ec4899",
|
|
553
|
+
rose: "#f43f5e"
|
|
554
|
+
}, Y = (e) => me[e] || e;
|
|
555
|
+
})), ge = r.lazy(() => Promise.resolve().then(() => (ue(), ce))), _e = r.lazy(() => Promise.resolve().then(() => (he(), fe))), X = ({ schema: e }) => /* @__PURE__ */ p(i, {
|
|
556
|
+
fallback: /* @__PURE__ */ p(d, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
557
|
+
children: /* @__PURE__ */ p(ge, {
|
|
10
558
|
data: e.data,
|
|
11
559
|
dataKey: e.dataKey,
|
|
12
560
|
xAxisKey: e.xAxisKey,
|
|
@@ -14,8 +562,8 @@ var v = e(), y = i.lazy(() => import("./ChartImpl-AHzX3Kht.js")), b = i.lazy(()
|
|
|
14
562
|
className: e.className,
|
|
15
563
|
color: e.color
|
|
16
564
|
})
|
|
17
|
-
}),
|
|
18
|
-
let t =
|
|
565
|
+
}), Z = ({ schema: e }) => {
|
|
566
|
+
let t = r.useMemo(() => {
|
|
19
567
|
let t = e.series, n = e.xAxisKey, r = e.config;
|
|
20
568
|
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) {
|
|
21
569
|
let n = e.colors || [
|
|
@@ -39,9 +587,9 @@ var v = e(), y = i.lazy(() => import("./ChartImpl-AHzX3Kht.js")), b = i.lazy(()
|
|
|
39
587
|
className: e.className
|
|
40
588
|
};
|
|
41
589
|
}, [e]);
|
|
42
|
-
return /* @__PURE__ */ (
|
|
43
|
-
fallback: /* @__PURE__ */ (
|
|
44
|
-
children: /* @__PURE__ */ (
|
|
590
|
+
return /* @__PURE__ */ p(i, {
|
|
591
|
+
fallback: /* @__PURE__ */ p(d, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
592
|
+
children: /* @__PURE__ */ p(_e, {
|
|
45
593
|
chartType: t.chartType,
|
|
46
594
|
data: t.data,
|
|
47
595
|
config: t.config,
|
|
@@ -50,362 +598,13 @@ var v = e(), y = i.lazy(() => import("./ChartImpl-AHzX3Kht.js")), b = i.lazy(()
|
|
|
50
598
|
className: t.className
|
|
51
599
|
})
|
|
52
600
|
});
|
|
53
|
-
}
|
|
54
|
-
let t = T(e);
|
|
55
|
-
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
56
|
-
}, D = {
|
|
57
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
58
|
-
width: 24,
|
|
59
|
-
height: 24,
|
|
60
|
-
viewBox: "0 0 24 24",
|
|
61
|
-
fill: "none",
|
|
62
|
-
stroke: "currentColor",
|
|
63
|
-
strokeWidth: 2,
|
|
64
|
-
strokeLinecap: "round",
|
|
65
|
-
strokeLinejoin: "round"
|
|
66
|
-
}, O = (e) => {
|
|
67
|
-
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
68
|
-
return !1;
|
|
69
|
-
}, k = o({}), A = () => u(k), j = c(({ color: e, size: t, strokeWidth: n, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...c }, l) => {
|
|
70
|
-
let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } = A() ?? {}, h = r ?? f ? Number(n ?? d) * 24 / Number(t ?? u) : n ?? d;
|
|
71
|
-
return s("svg", {
|
|
72
|
-
ref: l,
|
|
73
|
-
...D,
|
|
74
|
-
width: t ?? u ?? D.width,
|
|
75
|
-
height: t ?? u ?? D.height,
|
|
76
|
-
stroke: e ?? p,
|
|
77
|
-
strokeWidth: h,
|
|
78
|
-
className: C("lucide", m, i),
|
|
79
|
-
...!a && !O(c) && { "aria-hidden": "true" },
|
|
80
|
-
...c
|
|
81
|
-
}, [...o.map(([e, t]) => s(e, t)), ...Array.isArray(a) ? a : [a]]);
|
|
82
|
-
}), ee = ((e, t) => {
|
|
83
|
-
let n = c(({ className: n, ...r }, i) => s(j, {
|
|
84
|
-
ref: i,
|
|
85
|
-
iconNode: t,
|
|
86
|
-
className: C(`lucide-${w(E(e))}`, `lucide-${e}`, n),
|
|
87
|
-
...r
|
|
88
|
-
}));
|
|
89
|
-
return n.displayName = E(e), n;
|
|
90
|
-
})("circle-alert", [
|
|
91
|
-
["circle", {
|
|
92
|
-
cx: "12",
|
|
93
|
-
cy: "12",
|
|
94
|
-
r: "10",
|
|
95
|
-
key: "1mglay"
|
|
96
|
-
}],
|
|
97
|
-
["line", {
|
|
98
|
-
x1: "12",
|
|
99
|
-
x2: "12",
|
|
100
|
-
y1: "8",
|
|
101
|
-
y2: "12",
|
|
102
|
-
key: "1pkeuh"
|
|
103
|
-
}],
|
|
104
|
-
["line", {
|
|
105
|
-
x1: "12",
|
|
106
|
-
x2: "12.01",
|
|
107
|
-
y1: "16",
|
|
108
|
-
y2: "16",
|
|
109
|
-
key: "4dfq90"
|
|
110
|
-
}]
|
|
111
|
-
]), te = (e, t, n, r) => {
|
|
112
|
-
let i = [n, {
|
|
113
|
-
code: t,
|
|
114
|
-
...r || {}
|
|
115
|
-
}];
|
|
116
|
-
if (e?.services?.logger?.forward) return e.services.logger.forward(i, "warn", "react-i18next::", !0);
|
|
117
|
-
L(i[0]) && (i[0] = `react-i18next:: ${i[0]}`), e?.services?.logger?.warn ? e.services.logger.warn(...i) : console?.warn && console.warn(...i);
|
|
118
|
-
}, M = {}, N = (e, t, n, r) => {
|
|
119
|
-
L(n) && M[n] || (L(n) && (M[n] = /* @__PURE__ */ new Date()), te(e, t, n, r));
|
|
120
|
-
}, P = (e, t) => () => {
|
|
121
|
-
if (e.isInitialized) t();
|
|
122
|
-
else {
|
|
123
|
-
let n = () => {
|
|
124
|
-
setTimeout(() => {
|
|
125
|
-
e.off("initialized", n);
|
|
126
|
-
}, 0), t();
|
|
127
|
-
};
|
|
128
|
-
e.on("initialized", n);
|
|
129
|
-
}
|
|
130
|
-
}, F = (e, t, n) => {
|
|
131
|
-
e.loadNamespaces(t, P(e, n));
|
|
132
|
-
}, I = (e, t, n, r) => {
|
|
133
|
-
if (L(n) && (n = [n]), e.options.preload && e.options.preload.indexOf(t) > -1) return F(e, n, r);
|
|
134
|
-
n.forEach((t) => {
|
|
135
|
-
e.options.ns.indexOf(t) < 0 && e.options.ns.push(t);
|
|
136
|
-
}), e.loadLanguages(t, P(e, r));
|
|
137
|
-
}, ne = (e, t, n = {}) => !t.languages || !t.languages.length ? (N(t, "NO_LANGUAGES", "i18n.languages were undefined or empty", { languages: t.languages }), !0) : t.hasLoadedNamespace(e, {
|
|
138
|
-
lng: n.lng,
|
|
139
|
-
precheck: (t, r) => {
|
|
140
|
-
if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && t.services.backendConnector.backend && t.isLanguageChangingTo && !r(t.isLanguageChangingTo, e)) return !1;
|
|
141
|
-
}
|
|
142
|
-
}), L = (e) => typeof e == "string", R = (e) => typeof e == "object" && !!e, z = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, B = {
|
|
143
|
-
"&": "&",
|
|
144
|
-
"&": "&",
|
|
145
|
-
"<": "<",
|
|
146
|
-
"<": "<",
|
|
147
|
-
">": ">",
|
|
148
|
-
">": ">",
|
|
149
|
-
"'": "'",
|
|
150
|
-
"'": "'",
|
|
151
|
-
""": "\"",
|
|
152
|
-
""": "\"",
|
|
153
|
-
" ": " ",
|
|
154
|
-
" ": " ",
|
|
155
|
-
"©": "©",
|
|
156
|
-
"©": "©",
|
|
157
|
-
"®": "®",
|
|
158
|
-
"®": "®",
|
|
159
|
-
"…": "…",
|
|
160
|
-
"…": "…",
|
|
161
|
-
"/": "/",
|
|
162
|
-
"/": "/"
|
|
163
|
-
}, V = (e) => B[e], H = {
|
|
164
|
-
bindI18n: "languageChanged",
|
|
165
|
-
bindI18nStore: "",
|
|
166
|
-
transEmptyNodeValue: "",
|
|
167
|
-
transSupportBasicHtmlNodes: !0,
|
|
168
|
-
transWrapTextNodes: "",
|
|
169
|
-
transKeepBasicHtmlNodesFor: [
|
|
170
|
-
"br",
|
|
171
|
-
"strong",
|
|
172
|
-
"i",
|
|
173
|
-
"p"
|
|
174
|
-
],
|
|
175
|
-
useSuspense: !0,
|
|
176
|
-
unescape: (e) => e.replace(z, V),
|
|
177
|
-
transDefaultProps: void 0
|
|
178
|
-
}, U = () => H, W, G = () => W, K = o(), q = class {
|
|
179
|
-
constructor() {
|
|
180
|
-
this.usedNamespaces = {};
|
|
181
|
-
}
|
|
182
|
-
addUsedNamespaces(e) {
|
|
183
|
-
e.forEach((e) => {
|
|
184
|
-
this.usedNamespaces[e] || (this.usedNamespaces[e] = !0);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
getUsedNamespaces() {
|
|
188
|
-
return Object.keys(this.usedNamespaces);
|
|
189
|
-
}
|
|
190
|
-
}, J = t(), Y = {
|
|
191
|
-
t: (e, t) => {
|
|
192
|
-
if (L(t)) return t;
|
|
193
|
-
if (R(t) && L(t.defaultValue)) return t.defaultValue;
|
|
194
|
-
if (typeof e == "function") return "";
|
|
195
|
-
if (Array.isArray(e)) {
|
|
196
|
-
let t = e[e.length - 1];
|
|
197
|
-
return typeof t == "function" ? "" : t;
|
|
198
|
-
}
|
|
199
|
-
return e;
|
|
200
|
-
},
|
|
201
|
-
ready: !1
|
|
202
|
-
}, X = () => () => {}, re = (e, t = {}) => {
|
|
203
|
-
let { i18n: n } = t, { i18n: r, defaultNS: i } = u(K) || {}, a = n || r || G();
|
|
204
|
-
a && !a.reportNamespaces && (a.reportNamespaces = new q()), a || N(a, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
205
|
-
let o = f(() => ({
|
|
206
|
-
...U(),
|
|
207
|
-
...a?.options?.react,
|
|
208
|
-
...t
|
|
209
|
-
}), [a, t]), { useSuspense: s, keyPrefix: c } = o, h = e || i || a?.options?.defaultNS, g = L(h) ? [h] : h || ["translation"], _ = f(() => g, g);
|
|
210
|
-
a?.reportNamespaces?.addUsedNamespaces?.(_);
|
|
211
|
-
let v = p(0), y = l((e) => {
|
|
212
|
-
if (!a) return X;
|
|
213
|
-
let { bindI18n: t, bindI18nStore: n } = o, r = () => {
|
|
214
|
-
v.current += 1, e();
|
|
215
|
-
};
|
|
216
|
-
return t && a.on(t, r), n && a.store.on(n, r), () => {
|
|
217
|
-
t && t.split(" ").forEach((e) => a.off(e, r)), n && n.split(" ").forEach((e) => a.store.off(e, r));
|
|
218
|
-
};
|
|
219
|
-
}, [a, o]), b = p(), x = l(() => {
|
|
220
|
-
if (!a) return Y;
|
|
221
|
-
let e = !!(a.isInitialized || a.initializedStoreOnce) && _.every((e) => ne(e, a, o)), n = t.lng || a.language, r = v.current, i = b.current;
|
|
222
|
-
if (i && i.ready === e && i.lng === n && i.keyPrefix === c && i.revision === r) return i;
|
|
223
|
-
let s = {
|
|
224
|
-
t: a.getFixedT(n, o.nsMode === "fallback" ? _ : _[0], c),
|
|
225
|
-
ready: e,
|
|
226
|
-
lng: n,
|
|
227
|
-
keyPrefix: c,
|
|
228
|
-
revision: r
|
|
229
|
-
};
|
|
230
|
-
return b.current = s, s;
|
|
231
|
-
}, [
|
|
232
|
-
a,
|
|
233
|
-
_,
|
|
234
|
-
c,
|
|
235
|
-
o,
|
|
236
|
-
t.lng
|
|
237
|
-
]), [S, C] = m(0), { t: w, ready: T } = (0, J.useSyncExternalStore)(y, x, x);
|
|
238
|
-
d(() => {
|
|
239
|
-
if (a && !T && !s) {
|
|
240
|
-
let e = () => C((e) => e + 1);
|
|
241
|
-
t.lng ? I(a, t.lng, _, e) : F(a, _, e);
|
|
242
|
-
}
|
|
243
|
-
}, [
|
|
244
|
-
a,
|
|
245
|
-
t.lng,
|
|
246
|
-
_,
|
|
247
|
-
T,
|
|
248
|
-
s,
|
|
249
|
-
S
|
|
250
|
-
]);
|
|
251
|
-
let E = a || {}, D = p(null), O = p(), k = (e) => {
|
|
252
|
-
let t = Object.getOwnPropertyDescriptors(e);
|
|
253
|
-
t.__original && delete t.__original;
|
|
254
|
-
let n = Object.create(Object.getPrototypeOf(e), t);
|
|
255
|
-
if (!Object.prototype.hasOwnProperty.call(n, "__original")) try {
|
|
256
|
-
Object.defineProperty(n, "__original", {
|
|
257
|
-
value: e,
|
|
258
|
-
writable: !1,
|
|
259
|
-
enumerable: !1,
|
|
260
|
-
configurable: !1
|
|
261
|
-
});
|
|
262
|
-
} catch {}
|
|
263
|
-
return n;
|
|
264
|
-
}, A = f(() => {
|
|
265
|
-
let e = E, t = e?.language, n = e;
|
|
266
|
-
e && (D.current && D.current.__original === e && O.current === t ? n = D.current : (n = k(e), D.current = n, O.current = t));
|
|
267
|
-
let r = !T && !s ? (...e) => (N(a, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."), w(...e)) : w, i = [
|
|
268
|
-
r,
|
|
269
|
-
n,
|
|
270
|
-
T
|
|
271
|
-
];
|
|
272
|
-
return i.t = r, i.i18n = n, i.ready = T, i;
|
|
273
|
-
}, [
|
|
274
|
-
w,
|
|
275
|
-
E,
|
|
276
|
-
T,
|
|
277
|
-
E.resolvedLanguage,
|
|
278
|
-
E.language,
|
|
279
|
-
E.languages
|
|
280
|
-
]);
|
|
281
|
-
if (a && s && !T) throw new Promise((e) => {
|
|
282
|
-
let n = () => e();
|
|
283
|
-
t.lng ? I(a, t.lng, _, n) : F(a, _, n);
|
|
284
|
-
});
|
|
285
|
-
return A;
|
|
286
|
-
}, ie = o(null);
|
|
287
|
-
function ae(e) {
|
|
288
|
-
let t = u(ie), { t: n, i18n: r } = re(e);
|
|
289
|
-
return {
|
|
290
|
-
t: n,
|
|
291
|
-
language: t?.language || r.language || "en",
|
|
292
|
-
changeLanguage: t?.changeLanguage || (async (e) => {
|
|
293
|
-
await r.changeLanguage(e);
|
|
294
|
-
}),
|
|
295
|
-
direction: t?.direction || "ltr",
|
|
296
|
-
i18n: r
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
//#endregion
|
|
300
|
-
//#region ../i18n/dist/useObjectLabel.js
|
|
301
|
-
var oe = new Set([
|
|
302
|
-
"common",
|
|
303
|
-
"validation",
|
|
304
|
-
"form",
|
|
305
|
-
"table",
|
|
306
|
-
"grid",
|
|
307
|
-
"calendar",
|
|
308
|
-
"list",
|
|
309
|
-
"kanban",
|
|
310
|
-
"chart",
|
|
311
|
-
"dashboard",
|
|
312
|
-
"configPanel",
|
|
313
|
-
"appDesigner",
|
|
314
|
-
"console",
|
|
315
|
-
"errors",
|
|
316
|
-
"detail"
|
|
317
|
-
]);
|
|
318
|
-
function Z() {
|
|
319
|
-
let { t: e, i18n: t } = ae(), n = () => {
|
|
320
|
-
if (!t || typeof t.getResourceBundle != "function") return [];
|
|
321
|
-
let e = t.language || "en", n = t.getResourceBundle(e, "translation");
|
|
322
|
-
return n ? Object.keys(n).filter((e) => !oe.has(e) && n[e] && typeof n[e] == "object" && (n[e].objects || n[e].fields || n[e].apps || n[e].dashboards || n[e].pages || n[e].reports)) : [];
|
|
323
|
-
}, r = (e) => {
|
|
324
|
-
let t = e.indexOf("__");
|
|
325
|
-
return t > 0 ? e.slice(t + 2) : e;
|
|
326
|
-
}, i = (t, r) => {
|
|
327
|
-
let i = Array.isArray(t) ? t : [t];
|
|
328
|
-
try {
|
|
329
|
-
let t = n();
|
|
330
|
-
for (let n of t) for (let t of i) {
|
|
331
|
-
let r = `${n}.${t}`, i = e(r, { defaultValue: "" });
|
|
332
|
-
if (i && i !== r && i !== "") return i;
|
|
333
|
-
}
|
|
334
|
-
} catch {}
|
|
335
|
-
return r;
|
|
336
|
-
}, a = (e, t) => {
|
|
337
|
-
let n = r(e);
|
|
338
|
-
return n === e ? [`objects.${e}.${t}`] : [`objects.${e}.${t}`, `objects.${n}.${t}`];
|
|
339
|
-
}, o = (e, t) => {
|
|
340
|
-
let n = r(e);
|
|
341
|
-
return n === e ? [`fields.${e}.${t}`] : [`fields.${e}.${t}`, `fields.${n}.${t}`];
|
|
342
|
-
}, s = (e, t, n) => {
|
|
343
|
-
let i = r(e);
|
|
344
|
-
return i === e ? [`fieldOptions.${e}.${t}.${n}`] : [`fieldOptions.${e}.${t}.${n}`, `fieldOptions.${i}.${t}.${n}`];
|
|
345
|
-
}, c = (e, t) => {
|
|
346
|
-
let n = r(e);
|
|
347
|
-
return n === e ? [`dashboards.${e}.${t}`] : [`dashboards.${e}.${t}`, `dashboards.${n}.${t}`];
|
|
348
|
-
}, l = (e, t) => {
|
|
349
|
-
let n = r(e);
|
|
350
|
-
return n === e ? [`pages.${e}.${t}`] : [`pages.${e}.${t}`, `pages.${n}.${t}`];
|
|
351
|
-
}, u = (e, t) => {
|
|
352
|
-
let n = r(e);
|
|
353
|
-
return n === e ? [`reports.${e}.${t}`] : [`reports.${e}.${t}`, `reports.${n}.${t}`];
|
|
354
|
-
};
|
|
355
|
-
return {
|
|
356
|
-
objectLabel: (e) => i(a(e.name, "label"), e.label),
|
|
357
|
-
objectDescription: (e) => {
|
|
358
|
-
if (e.description) return i(a(e.name, "description"), e.description);
|
|
359
|
-
},
|
|
360
|
-
fieldLabel: (e, t, n) => i(o(e, t), n),
|
|
361
|
-
fieldOptionLabel: (e, t, n, r) => i(s(e, t, n), r),
|
|
362
|
-
translateOptions: (e, t, n) => n.map((n) => ({
|
|
363
|
-
...n,
|
|
364
|
-
label: i(s(e, t, n.value), n.label)
|
|
365
|
-
})),
|
|
366
|
-
appLabel: (e) => i(`apps.${e.name}.label`, e.label ?? e.name),
|
|
367
|
-
appDescription: (e) => {
|
|
368
|
-
let t = e.description ?? "";
|
|
369
|
-
return i(`apps.${e.name}.description`, t) || void 0;
|
|
370
|
-
},
|
|
371
|
-
navGroupLabel: (e, t, n) => i(`apps.${e}.navigation.${t}.label`, n),
|
|
372
|
-
dashboardLabel: (e) => i(c(e.name, "label"), e.label ?? e.name),
|
|
373
|
-
dashboardDescription: (e) => {
|
|
374
|
-
let t = e.description ?? "";
|
|
375
|
-
return i(c(e.name, "description"), t) || void 0;
|
|
376
|
-
},
|
|
377
|
-
dashboardActionLabel: (e, t, n) => i(c(e, `actions.${t}.label`), n),
|
|
378
|
-
widgetTitle: (e, t, n) => i(c(e, `widgets.${t}.title`), n),
|
|
379
|
-
widgetDescription: (e, t, n) => {
|
|
380
|
-
let r = n ?? "";
|
|
381
|
-
return i(c(e, `widgets.${t}.description`), r) || void 0;
|
|
382
|
-
},
|
|
383
|
-
pageLabel: (e) => i(l(e.name, "label"), e.label ?? e.name),
|
|
384
|
-
reportLabel: (e) => i(u(e.name, "label"), e.label ?? e.name)
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
function se() {
|
|
388
|
-
try {
|
|
389
|
-
let { fieldLabel: e, translateOptions: t, fieldOptionLabel: n } = Z();
|
|
390
|
-
return {
|
|
391
|
-
fieldLabel: e,
|
|
392
|
-
translateOptions: t,
|
|
393
|
-
fieldOptionLabel: n
|
|
394
|
-
};
|
|
395
|
-
} catch {
|
|
396
|
-
return {
|
|
397
|
-
fieldLabel: (e, t, n) => n,
|
|
398
|
-
translateOptions: (e, t, n) => n,
|
|
399
|
-
fieldOptionLabel: (e, t, n, r) => r
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
}
|
|
601
|
+
};
|
|
403
602
|
//#endregion
|
|
404
603
|
//#region src/ObjectChart.tsx
|
|
405
604
|
function Q(e) {
|
|
406
605
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
407
606
|
}
|
|
408
|
-
function
|
|
607
|
+
function ve(e, t) {
|
|
409
608
|
let { field: n, function: r, groupBy: i } = t, a = {};
|
|
410
609
|
for (let t of e) {
|
|
411
610
|
let e = String(t[i] ?? "Unknown");
|
|
@@ -436,44 +635,44 @@ function ce(e, t) {
|
|
|
436
635
|
};
|
|
437
636
|
});
|
|
438
637
|
}
|
|
439
|
-
async function
|
|
440
|
-
if (!e.length || !
|
|
441
|
-
let o = a || ((e, t) => t), s =
|
|
638
|
+
async function ye(e, n, r, i, a) {
|
|
639
|
+
if (!e.length || !n) return e;
|
|
640
|
+
let o = a || ((e, t) => t), s = r?.fields?.[n];
|
|
442
641
|
if (!s) return e.map((e) => {
|
|
443
|
-
let
|
|
642
|
+
let t = String(e[n] ?? ""), r = Q(t);
|
|
444
643
|
return {
|
|
445
644
|
...e,
|
|
446
|
-
[
|
|
645
|
+
[n]: o(t, r)
|
|
447
646
|
};
|
|
448
647
|
});
|
|
449
648
|
let c = s.type;
|
|
450
649
|
if (c === "select" || c === "picklist" || c === "dropdown") {
|
|
451
|
-
let
|
|
452
|
-
if (
|
|
453
|
-
let
|
|
650
|
+
let t = s.options || [];
|
|
651
|
+
if (t.length === 0) return e.map((e) => {
|
|
652
|
+
let t = String(e[n] ?? ""), r = Q(t);
|
|
454
653
|
return {
|
|
455
654
|
...e,
|
|
456
|
-
[
|
|
655
|
+
[n]: o(t, r)
|
|
457
656
|
};
|
|
458
657
|
});
|
|
459
658
|
let r = {};
|
|
460
|
-
for (let e of
|
|
659
|
+
for (let e of t) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
|
|
461
660
|
return e.map((e) => {
|
|
462
|
-
let
|
|
661
|
+
let t = String(e[n] ?? ""), i = r[t] || Q(t);
|
|
463
662
|
return {
|
|
464
663
|
...e,
|
|
465
|
-
[
|
|
664
|
+
[n]: o(t, i)
|
|
466
665
|
};
|
|
467
666
|
});
|
|
468
667
|
}
|
|
469
668
|
if (c === "lookup" || c === "master_detail") {
|
|
470
|
-
let
|
|
471
|
-
if (!
|
|
472
|
-
let a = [...new Set(e.map((e) => e[
|
|
669
|
+
let r = s.reference_to || s.reference;
|
|
670
|
+
if (!r || !i || typeof i.find != "function") return e;
|
|
671
|
+
let a = [...new Set(e.map((e) => e[n]).filter((e) => e != null))];
|
|
473
672
|
if (a.length === 0) return e;
|
|
474
673
|
let o = s.id_field || "id";
|
|
475
674
|
try {
|
|
476
|
-
let c =
|
|
675
|
+
let c = t(await i.find(r, {
|
|
477
676
|
$filter: { [o]: { $in: a } },
|
|
478
677
|
$top: a.length
|
|
479
678
|
})), l = s.reference_field || s.display_field || "name", u = {};
|
|
@@ -482,10 +681,10 @@ async function le(e, t, n, i, a) {
|
|
|
482
681
|
t && (u[t] = String(n));
|
|
483
682
|
}
|
|
484
683
|
return e.map((e) => {
|
|
485
|
-
let
|
|
684
|
+
let t = String(e[n] ?? "");
|
|
486
685
|
return {
|
|
487
686
|
...e,
|
|
488
|
-
[
|
|
687
|
+
[n]: u[t] || t
|
|
489
688
|
};
|
|
490
689
|
});
|
|
491
690
|
} catch (t) {
|
|
@@ -494,98 +693,98 @@ async function le(e, t, n, i, a) {
|
|
|
494
693
|
}
|
|
495
694
|
return e.map((e) => ({
|
|
496
695
|
...e,
|
|
497
|
-
[
|
|
696
|
+
[n]: Q(String(e[n] ?? ""))
|
|
498
697
|
}));
|
|
499
698
|
}
|
|
500
699
|
var $ = (e) => {
|
|
501
|
-
let { schema:
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}, [
|
|
505
|
-
let [
|
|
506
|
-
if (!(!e || !
|
|
507
|
-
|
|
700
|
+
let { schema: n } = e, r = o(ie), i = e.dataSource || r?.dataSource, d = ae(n.bind), { fieldOptionLabel: f } = se(), h = l(f);
|
|
701
|
+
s(() => {
|
|
702
|
+
h.current = f;
|
|
703
|
+
}, [f]);
|
|
704
|
+
let [g, _] = u([]), [v, y] = u(!1), [b, x] = u(null), S = c(() => n.aggregate ? JSON.stringify(n.aggregate) : "", [n.aggregate]), C = c(() => n.filter ? JSON.stringify(n.filter) : "", [n.filter]), w = a(async (e, r) => {
|
|
705
|
+
if (!(!e || !n.objectName)) {
|
|
706
|
+
r.current && (y(!0), x(null));
|
|
508
707
|
try {
|
|
509
708
|
let i;
|
|
510
|
-
if (
|
|
511
|
-
let
|
|
512
|
-
field:
|
|
513
|
-
function:
|
|
514
|
-
groupBy:
|
|
515
|
-
filter:
|
|
709
|
+
if (n.aggregate && typeof e.aggregate == "function") {
|
|
710
|
+
let t = await e.aggregate(n.objectName, {
|
|
711
|
+
field: n.aggregate.field,
|
|
712
|
+
function: n.aggregate.function,
|
|
713
|
+
groupBy: n.aggregate.groupBy,
|
|
714
|
+
filter: n.filter
|
|
516
715
|
});
|
|
517
|
-
i = Array.isArray(
|
|
518
|
-
} else if (typeof e.find == "function") i =
|
|
716
|
+
i = Array.isArray(t) ? t : [];
|
|
717
|
+
} else if (typeof e.find == "function") i = t(await e.find(n.objectName, { $filter: n.filter })), n.aggregate && i.length > 0 && (i = ve(i, n.aggregate));
|
|
519
718
|
else return;
|
|
520
|
-
let a =
|
|
719
|
+
let a = n.aggregate?.groupBy || n.xAxisKey;
|
|
521
720
|
if (a && typeof e.getObjectSchema == "function") try {
|
|
522
|
-
let
|
|
523
|
-
i = await
|
|
721
|
+
let t = await e.getObjectSchema(n.objectName);
|
|
722
|
+
i = await ye(i, a, t, e, (e, t) => h.current(n.objectName, a, e, t));
|
|
524
723
|
} catch {}
|
|
525
|
-
|
|
724
|
+
r.current && _(i);
|
|
526
725
|
} catch (e) {
|
|
527
|
-
console.error("[ObjectChart] Fetch error:", e),
|
|
726
|
+
console.error("[ObjectChart] Fetch error:", e), r.current && x(e instanceof Error ? e.message : "Failed to load chart data");
|
|
528
727
|
} finally {
|
|
529
|
-
|
|
728
|
+
r.current && y(!1);
|
|
530
729
|
}
|
|
531
730
|
}
|
|
532
731
|
}, [
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
732
|
+
n.objectName,
|
|
733
|
+
S,
|
|
734
|
+
C,
|
|
735
|
+
n.xAxisKey
|
|
537
736
|
]);
|
|
538
|
-
|
|
737
|
+
s(() => {
|
|
539
738
|
let e = { current: !0 };
|
|
540
|
-
return
|
|
739
|
+
return n.objectName && !d && !n.data && w(i, e), () => {
|
|
541
740
|
e.current = !1;
|
|
542
741
|
};
|
|
543
742
|
}, [
|
|
544
|
-
|
|
743
|
+
n.objectName,
|
|
545
744
|
i,
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
745
|
+
d,
|
|
746
|
+
n.data,
|
|
747
|
+
C,
|
|
748
|
+
S,
|
|
749
|
+
w
|
|
551
750
|
]);
|
|
552
|
-
let
|
|
553
|
-
...
|
|
554
|
-
data:
|
|
751
|
+
let T = d || n.data || g, E = Array.isArray(T) ? T : [], D = {
|
|
752
|
+
...n,
|
|
753
|
+
data: E
|
|
555
754
|
};
|
|
556
|
-
return
|
|
557
|
-
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (
|
|
755
|
+
return v && E.length === 0 ? /* @__PURE__ */ p("div", {
|
|
756
|
+
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (n.className || ""),
|
|
558
757
|
"data-testid": "chart-loading",
|
|
559
758
|
children: "Loading chart data…"
|
|
560
|
-
}) :
|
|
561
|
-
className: "flex flex-col items-center justify-center gap-2 p-4 " + (
|
|
759
|
+
}) : b ? /* @__PURE__ */ m("div", {
|
|
760
|
+
className: "flex flex-col items-center justify-center gap-2 p-4 " + (n.className || ""),
|
|
562
761
|
"data-testid": "chart-error",
|
|
563
762
|
role: "alert",
|
|
564
763
|
children: [
|
|
565
|
-
/* @__PURE__ */ (
|
|
566
|
-
/* @__PURE__ */ (
|
|
764
|
+
/* @__PURE__ */ p(oe, { className: "h-6 w-6 text-destructive opacity-60" }),
|
|
765
|
+
/* @__PURE__ */ p("p", {
|
|
567
766
|
className: "text-xs text-destructive font-medium",
|
|
568
767
|
children: "Failed to load chart data"
|
|
569
768
|
}),
|
|
570
|
-
/* @__PURE__ */ (
|
|
769
|
+
/* @__PURE__ */ p("p", {
|
|
571
770
|
className: "text-xs text-muted-foreground max-w-xs text-center",
|
|
572
|
-
children:
|
|
771
|
+
children: b
|
|
573
772
|
})
|
|
574
773
|
]
|
|
575
|
-
}) : !i &&
|
|
576
|
-
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (
|
|
774
|
+
}) : !i && n.objectName && E.length === 0 ? /* @__PURE__ */ m("div", {
|
|
775
|
+
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (n.className || ""),
|
|
577
776
|
"data-testid": "chart-no-datasource",
|
|
578
777
|
children: [
|
|
579
778
|
"No data source available for “",
|
|
580
|
-
|
|
779
|
+
n.objectName,
|
|
581
780
|
"”"
|
|
582
781
|
]
|
|
583
|
-
}) : /* @__PURE__ */ (
|
|
782
|
+
}) : /* @__PURE__ */ p(Z, {
|
|
584
783
|
...e,
|
|
585
|
-
schema:
|
|
784
|
+
schema: D
|
|
586
785
|
});
|
|
587
786
|
};
|
|
588
|
-
|
|
787
|
+
e.register("object-chart", $, {
|
|
589
788
|
namespace: "plugin-charts",
|
|
590
789
|
label: "Object Chart",
|
|
591
790
|
category: "view",
|
|
@@ -617,11 +816,11 @@ n.register("object-chart", $, {
|
|
|
617
816
|
});
|
|
618
817
|
//#endregion
|
|
619
818
|
//#region src/index.tsx
|
|
620
|
-
var
|
|
621
|
-
"bar-chart":
|
|
622
|
-
chart:
|
|
819
|
+
var be = {
|
|
820
|
+
"bar-chart": X,
|
|
821
|
+
chart: Z
|
|
623
822
|
};
|
|
624
|
-
|
|
823
|
+
e.register("bar-chart", X, {
|
|
625
824
|
namespace: "plugin-charts",
|
|
626
825
|
label: "Bar Chart",
|
|
627
826
|
category: "plugin",
|
|
@@ -685,7 +884,7 @@ n.register("bar-chart", x, {
|
|
|
685
884
|
height: 400,
|
|
686
885
|
color: "#8884d8"
|
|
687
886
|
}
|
|
688
|
-
}),
|
|
887
|
+
}), e.register("chart", $, {
|
|
689
888
|
namespace: "view",
|
|
690
889
|
category: "view",
|
|
691
890
|
label: "Chart",
|
|
@@ -712,7 +911,7 @@ n.register("bar-chart", x, {
|
|
|
712
911
|
label: "Value Field"
|
|
713
912
|
}
|
|
714
913
|
]
|
|
715
|
-
}),
|
|
914
|
+
}), e.register("chart", Z, {
|
|
716
915
|
namespace: "plugin-charts",
|
|
717
916
|
label: "Chart",
|
|
718
917
|
category: "plugin",
|
|
@@ -824,31 +1023,31 @@ n.register("bar-chart", x, {
|
|
|
824
1023
|
xAxisKey: "name",
|
|
825
1024
|
series: [{ dataKey: "sales" }, { dataKey: "revenue" }]
|
|
826
1025
|
}
|
|
827
|
-
}),
|
|
1026
|
+
}), e.register("chart:bar", Z, {
|
|
828
1027
|
namespace: "plugin-charts",
|
|
829
1028
|
label: "Bar Chart (Alias)",
|
|
830
1029
|
category: "plugin",
|
|
831
1030
|
defaultProps: { chartType: "bar" }
|
|
832
|
-
}),
|
|
1031
|
+
}), e.register("pie-chart", Z, {
|
|
833
1032
|
namespace: "plugin-charts",
|
|
834
1033
|
label: "Pie Chart",
|
|
835
1034
|
category: "plugin",
|
|
836
1035
|
defaultProps: { chartType: "pie" }
|
|
837
|
-
}),
|
|
1036
|
+
}), e.register("donut-chart", Z, {
|
|
838
1037
|
namespace: "plugin-charts",
|
|
839
1038
|
label: "Donut Chart",
|
|
840
1039
|
category: "plugin",
|
|
841
1040
|
defaultProps: { chartType: "donut" }
|
|
842
|
-
}),
|
|
1041
|
+
}), e.register("radar-chart", Z, {
|
|
843
1042
|
namespace: "plugin-charts",
|
|
844
1043
|
label: "Radar Chart",
|
|
845
1044
|
category: "plugin",
|
|
846
1045
|
defaultProps: { chartType: "radar" }
|
|
847
|
-
}),
|
|
1046
|
+
}), e.register("scatter-chart", Z, {
|
|
848
1047
|
namespace: "plugin-charts",
|
|
849
1048
|
label: "Scatter Chart",
|
|
850
1049
|
category: "plugin",
|
|
851
1050
|
defaultProps: { chartType: "scatter" }
|
|
852
1051
|
});
|
|
853
1052
|
//#endregion
|
|
854
|
-
export {
|
|
1053
|
+
export { X as ChartBarRenderer, Z as ChartRenderer, $ as ObjectChart, be as chartComponents };
|