@object-ui/plugin-charts 17.5.0 → 17.7.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 +3143 -0
- package/README.md +32 -17
- package/dist/AdvancedChartImpl.d.ts +57 -18
- package/dist/ChartRenderer.d.ts +15 -7
- package/dist/ObjectChart.d.ts +144 -5
- package/dist/index.d.ts +67 -7
- package/dist/index.js +1729 -1006
- package/dist/index.umd.cjs +2 -2
- package/dist/normalizeChartSchema.d.ts +225 -14
- package/dist/types.d.ts +31 -28
- package/package.json +13 -12
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ComponentRegistry as e,
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
1
|
+
import { ComponentRegistry as e, FilterOperatorError as t, buildCategoryRank as n, buildChartSeries as r, buildOptionColorMap as i, chartMeasureKey as a, chartRowBucketId as o, chartTypeIgnoresCompareTo as s, compareToTrendLabelKey as c, composeDrillFilter as l, computeDrillFilter as u, deriveDimensionLabelMaps as d, dimensionOptionTranslator as f, elementDataSourceBlock as p, extractRecords as m, humanizeLabel as h, isDrillEnabled as ee, isRealCalendarDate as te, isStructuredGroupBy as ne, loadDimensionFieldMeta as re, localizeFieldOptions as ie, objectAggregateSpecQuery as ae, relabelDimensions as oe, resolveContextTokens as se, resolveDrillTitle as ce, resolveFilterPlaceholders as g, shiftFilterByCompareTo as le, toDateInputValue as ue, toDisplayDate as de } from "@object-ui/core";
|
|
2
|
+
import * as _ from "react";
|
|
3
|
+
import v, { Suspense as y, useCallback as b, useContext as x, useEffect as S, useMemo as C, useState as w } from "react";
|
|
4
|
+
import { Button as fe, ChartSkeleton as pe, DataEmptyState as me, Dialog as he, DialogContent as ge, DialogHeader as _e, DialogTitle as ve, RefreshIndicator as ye, Sheet as be, SheetContent as xe, SheetHeader as Se, SheetTitle as Ce, Skeleton as we } from "@object-ui/components";
|
|
5
|
+
import { builtinAggregateLabels as Te, pickLocalized as Ee, useDisplayLocale as De, useObjectTranslation as Oe, useSafeFieldLabel as ke, useSafeTranslate as Ae } from "@object-ui/i18n";
|
|
5
6
|
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
6
|
-
import { Area as
|
|
7
|
-
import { ElementDataSourceGate as
|
|
8
|
-
import { AlertCircle as
|
|
9
|
-
import { useSafeFieldLabel as R, useSafeTranslate as z } from "@object-ui/i18n";
|
|
7
|
+
import { Area as je, AreaChart as Me, Bar as Ne, BarChart as Pe, Brush as Fe, CartesianGrid as O, Cell as Ie, ComposedChart as Le, Funnel as Re, FunnelChart as k, LabelList as ze, Legend as Be, Line as Ve, LineChart as He, Pie as Ue, PieChart as We, PolarAngleAxis as Ge, PolarGrid as Ke, PolarRadiusAxis as qe, Radar as Je, RadarChart as Ye, ReferenceArea as Xe, ReferenceLine as Ze, ResponsiveContainer as Qe, Sankey as $e, Scatter as A, ScatterChart as j, Tooltip as M, Treemap as et, XAxis as N, YAxis as P } from "recharts";
|
|
8
|
+
import { ElementDataSourceGate as tt, SchemaRenderer as nt, SchemaRendererContext as rt, useDataInvalidation as F, useDataScope as I, useDrillNavigation as L, useFilterScope as R } from "@object-ui/react";
|
|
9
|
+
import { AlertCircle as z, ArrowUpRight as it, Inbox as at } from "lucide-react";
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
11
|
var B = Object.defineProperty, V = (e, t, n) => () => {
|
|
12
12
|
if (n) throw n[0];
|
|
@@ -15,7 +15,7 @@ var B = Object.defineProperty, V = (e, t, n) => () => {
|
|
|
15
15
|
} catch (e) {
|
|
16
16
|
throw n = [e], e;
|
|
17
17
|
}
|
|
18
|
-
},
|
|
18
|
+
}, ot = (e, t) => {
|
|
19
19
|
let n = {};
|
|
20
20
|
for (var r in e) B(n, r, {
|
|
21
21
|
get: e[r],
|
|
@@ -25,136 +25,175 @@ var B = Object.defineProperty, V = (e, t, n) => () => {
|
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/normalizeChartSchema.ts
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
function
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
r
|
|
39
|
-
|
|
40
|
-
i
|
|
41
|
-
|
|
42
|
-
a
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
function H(e) {
|
|
29
|
+
if (!e) return;
|
|
30
|
+
let t = e.startsWith(K) ? e.slice(14) : e;
|
|
31
|
+
return vt.get(t);
|
|
32
|
+
}
|
|
33
|
+
function U(e, t) {
|
|
34
|
+
if (typeof e == "string" || q(e)) return Ee(e, t) || void 0;
|
|
35
|
+
}
|
|
36
|
+
function st(e, t) {
|
|
37
|
+
if (!q(e)) return;
|
|
38
|
+
let n = {}, r = J(e.field);
|
|
39
|
+
r && (n.field = r);
|
|
40
|
+
let i = J(e.format);
|
|
41
|
+
i && (n.format = i);
|
|
42
|
+
let a = Y(e.min);
|
|
43
|
+
a !== void 0 && (n.min = a);
|
|
44
|
+
let o = Y(e.max);
|
|
45
|
+
o !== void 0 && (n.max = o);
|
|
46
|
+
let s = Y(e.stepSize);
|
|
47
|
+
s !== void 0 && s > 0 && (n.stepSize = s), typeof e.showGridLines == "boolean" && (n.showGridLines = e.showGridLines), typeof e.logarithmic == "boolean" && (n.logarithmic = e.logarithmic);
|
|
48
|
+
let c = J(e.position);
|
|
49
|
+
(c === "left" || c === "right" || c === "top" || c === "bottom") && (n.position = c);
|
|
50
|
+
let l = U(e.title, t);
|
|
51
|
+
return l && (n.title = l), n;
|
|
52
|
+
}
|
|
53
|
+
function ct(e, t) {
|
|
54
|
+
if (!q(e)) {
|
|
55
|
+
let t = J(e);
|
|
53
56
|
return t ? { dataKey: t } : void 0;
|
|
54
57
|
}
|
|
55
|
-
let
|
|
56
|
-
if (!
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
-
(
|
|
61
|
-
let
|
|
62
|
-
(
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
let
|
|
68
|
-
|
|
69
|
-
let
|
|
70
|
-
(
|
|
71
|
-
let
|
|
72
|
-
return
|
|
73
|
-
}
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
58
|
+
let n = J(e.dataKey) ?? J(e.name);
|
|
59
|
+
if (!n) return;
|
|
60
|
+
let r = { dataKey: n }, i = U(e.label, t);
|
|
61
|
+
i && (r.label = i);
|
|
62
|
+
let a = J(e.chartType) ?? J(e.type);
|
|
63
|
+
(a === "bar" || a === "line" || a === "area") && (r.chartType = a);
|
|
64
|
+
let o = J(e.variant);
|
|
65
|
+
(o === "comparison" || o === "current" || o === "primary") && (r.variant = o);
|
|
66
|
+
let s = Y(e.opacity);
|
|
67
|
+
s !== void 0 && (r.opacity = s);
|
|
68
|
+
let c = J(e.dashArray);
|
|
69
|
+
c && (r.dashArray = c);
|
|
70
|
+
let l = J(e.stack);
|
|
71
|
+
l && (r.stack = l);
|
|
72
|
+
let u = J(e.yAxis);
|
|
73
|
+
(u === "left" || u === "right") && (r.yAxis = u);
|
|
74
|
+
let d = J(e.color);
|
|
75
|
+
return d && (r.color = d), r;
|
|
76
|
+
}
|
|
77
|
+
function lt(e, t) {
|
|
78
|
+
let n = t === "horizontal-bar", r = t === "scatter" ? 1 : 2, i = (e ?? []).slice(0, r), a = [], o = (e) => n ? e === "bottom" ? "left" : e === "top" ? "right" : void 0 : e === "left" || e === "right" ? e : void 0, s = (e) => e === "left" ? "right" : "left", c = i.map((e) => o(e.position)), l = [];
|
|
79
|
+
if (i.length === 1) l.push(c[0] ?? "left");
|
|
80
|
+
else if (i.length === 2) {
|
|
81
|
+
let [e, t] = c;
|
|
82
|
+
e && t ? l.push(e, e === t ? s(e) : t) : e ? l.push(e, s(e)) : t ? l.push(s(t), t) : l.push("left", "right");
|
|
83
|
+
}
|
|
84
|
+
i.forEach((e, t) => {
|
|
85
|
+
e.position && (c[t] ? c[t] !== l[t] && a.push({
|
|
86
|
+
index: t,
|
|
87
|
+
position: e.position,
|
|
88
|
+
reason: "taken",
|
|
89
|
+
drawn: l[t]
|
|
90
|
+
}) : a.push({
|
|
91
|
+
index: t,
|
|
92
|
+
position: e.position,
|
|
93
|
+
reason: "side",
|
|
94
|
+
drawn: l[t]
|
|
95
|
+
}));
|
|
96
|
+
});
|
|
97
|
+
let u = r === 1 ? l[0] : "right", d = {
|
|
98
|
+
slotOf: l,
|
|
99
|
+
notes: a,
|
|
100
|
+
undrawn: (e ?? []).slice(i.length).map((e, t) => ({
|
|
101
|
+
index: i.length + t,
|
|
102
|
+
boundTo: u
|
|
103
|
+
}))
|
|
104
|
+
};
|
|
105
|
+
return l.forEach((e, t) => {
|
|
106
|
+
d[e] = t;
|
|
107
|
+
}), d;
|
|
108
|
+
}
|
|
109
|
+
function ut(e, t) {
|
|
110
|
+
if (!q(e)) return {};
|
|
111
|
+
let n = {}, r = J(e.type), i = J(e.chartType) ?? J(e.specType) ?? (r && _t.has(r) ? r : void 0) ?? H(r);
|
|
112
|
+
i && (n.chartType = i);
|
|
113
|
+
let a = e.xAxis, o = st(a, t);
|
|
114
|
+
o && Object.keys(o).some((e) => e !== "field") && (n.xAxis = o);
|
|
115
|
+
let s = J(e.xAxisKey) ?? o?.field ?? J(a);
|
|
116
|
+
s && (n.xAxisKey = s);
|
|
117
|
+
let c = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) => st(e, t) ?? (J(e) ? { field: J(e) } : void 0)).filter((e) => !!e);
|
|
118
|
+
c.length && (n.yAxes = c);
|
|
119
|
+
let l = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map((e) => ct(e, t)).filter((e) => !!e);
|
|
120
|
+
if (!l?.length) {
|
|
121
|
+
let e = lt(c, i), t = [...e.slotOf, ...e.undrawn.map((e) => e.boundTo)], n = c.map((e, n) => ({
|
|
122
|
+
a: e,
|
|
123
|
+
slot: t[n],
|
|
124
|
+
i: n
|
|
125
|
+
})).filter(({ a: e }) => e.field).map(({ a: e, slot: t, i: n }) => ({
|
|
87
126
|
dataKey: e.field,
|
|
88
127
|
...e.title ? { label: e.title } : {},
|
|
89
|
-
...t
|
|
128
|
+
...t === "right" || n > 0 ? { yAxis: t } : {}
|
|
90
129
|
}));
|
|
91
|
-
|
|
130
|
+
n.length && (l = n);
|
|
92
131
|
}
|
|
93
|
-
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
let
|
|
97
|
-
|
|
98
|
-
let
|
|
99
|
-
|
|
100
|
-
let
|
|
101
|
-
return
|
|
102
|
-
}
|
|
103
|
-
function
|
|
132
|
+
l?.length && (n.series = l), typeof e.showLegend == "boolean" && (n.showLegend = e.showLegend), typeof e.showDataLabels == "boolean" && (n.showDataLabels = e.showDataLabels);
|
|
133
|
+
let u = U(e.title, t);
|
|
134
|
+
u && (n.title = u);
|
|
135
|
+
let d = U(e.subtitle, t);
|
|
136
|
+
d && (n.subtitle = d);
|
|
137
|
+
let f = U(e.description, t);
|
|
138
|
+
f && (n.description = f);
|
|
139
|
+
let p = Y(e.height);
|
|
140
|
+
return p !== void 0 && p > 0 && (n.height = p), Array.isArray(e.annotations) && e.annotations.length && (n.annotations = e.annotations.filter(q)), q(e.interaction) && (n.interaction = e.interaction), n;
|
|
141
|
+
}
|
|
142
|
+
function dt(e) {
|
|
104
143
|
if (e === "bar" || e === "column") return "bar";
|
|
105
144
|
if (e === "line") return "line";
|
|
106
145
|
if (e === "area") return "area";
|
|
107
146
|
}
|
|
108
|
-
function
|
|
147
|
+
function ft(e, t) {
|
|
109
148
|
if (e === "combo") return "combo";
|
|
110
|
-
let n =
|
|
149
|
+
let n = dt(e);
|
|
111
150
|
if (!n || !t || t.length < 2) return e;
|
|
112
151
|
let r = t.map((e) => e.chartType ?? n);
|
|
113
152
|
return new Set(r).size > 1 ? "combo" : e;
|
|
114
153
|
}
|
|
115
|
-
function
|
|
154
|
+
function W(e, t) {
|
|
116
155
|
if (!e) return;
|
|
117
|
-
let
|
|
156
|
+
let n = e.includes("%"), r = /^([$£€¥₹])/.exec(e), i = e.includes(","), a = /\.(0+)/.exec(e)?.[1].length ?? 0, o = {
|
|
118
157
|
$: "USD",
|
|
119
158
|
"£": "GBP",
|
|
120
159
|
"€": "EUR",
|
|
121
160
|
"¥": "CNY",
|
|
122
161
|
"₹": "INR"
|
|
123
162
|
};
|
|
124
|
-
if (!
|
|
125
|
-
let
|
|
126
|
-
minimumFractionDigits:
|
|
127
|
-
maximumFractionDigits:
|
|
128
|
-
useGrouping:
|
|
163
|
+
if (!n && !r && !i && a === 0) return;
|
|
164
|
+
let s = {
|
|
165
|
+
minimumFractionDigits: a,
|
|
166
|
+
maximumFractionDigits: a,
|
|
167
|
+
useGrouping: i
|
|
129
168
|
};
|
|
130
|
-
return
|
|
131
|
-
let
|
|
132
|
-
if (!Number.isFinite(
|
|
169
|
+
return n ? s.style = "percent" : r && (s.style = "currency", s.currency = o[r[1]] ?? "USD"), (e) => {
|
|
170
|
+
let n = typeof e == "number" ? e : Number(e);
|
|
171
|
+
if (!Number.isFinite(n)) return e == null ? "" : String(e);
|
|
133
172
|
try {
|
|
134
|
-
return new Intl.NumberFormat(
|
|
173
|
+
return new Intl.NumberFormat(t, s).format(n);
|
|
135
174
|
} catch {
|
|
136
|
-
return String(
|
|
175
|
+
return String(n);
|
|
137
176
|
}
|
|
138
177
|
};
|
|
139
178
|
}
|
|
140
|
-
function
|
|
179
|
+
function pt(e, t) {
|
|
141
180
|
let n = e?.stepSize;
|
|
142
181
|
if (!n || n <= 0) return;
|
|
143
182
|
let r = t.filter((e) => Number.isFinite(e)), i = r.length ? Math.min(...r) : void 0, a = r.length ? Math.max(...r) : void 0, o = e.min ?? Math.min(0, i ?? 0), s = e.max ?? a;
|
|
144
183
|
if (s === void 0 || !Number.isFinite(o) || !Number.isFinite(s) || s < o) return;
|
|
145
184
|
let c = Math.floor(o / n) * n, l = e.max === void 0 ? Math.ceil(s / n) * n : e.max, u = Math.floor((l - c) / n + 1e-9) + 1;
|
|
146
|
-
if (u < 1 || u >
|
|
185
|
+
if (u < 1 || u > yt) return;
|
|
147
186
|
let d = [];
|
|
148
187
|
for (let e = 0; e < u; e++) d.push(Number((c + e * n).toPrecision(12)));
|
|
149
188
|
return e.max !== void 0 && d[d.length - 1] < e.max && d.push(e.max), d;
|
|
150
189
|
}
|
|
151
|
-
function
|
|
190
|
+
function G(e) {
|
|
152
191
|
if (!e) return;
|
|
153
192
|
let { min: t, max: n } = e;
|
|
154
193
|
if (t !== void 0 || n !== void 0) return [t ?? "auto", n ?? "auto"];
|
|
155
194
|
}
|
|
156
|
-
var
|
|
157
|
-
|
|
195
|
+
var mt, ht, gt, _t, vt, K, q, J, Y, yt, bt = V((() => {
|
|
196
|
+
mt = /* @__PURE__ */ new Set([
|
|
158
197
|
"bar",
|
|
159
198
|
"column",
|
|
160
199
|
"horizontal-bar",
|
|
@@ -168,23 +207,23 @@ var Ye, Xe, Ze, Qe, K, q, J, Y, $e = V((() => {
|
|
|
168
207
|
"treemap",
|
|
169
208
|
"sankey",
|
|
170
209
|
"combo"
|
|
171
|
-
]),
|
|
210
|
+
]), ht = /* @__PURE__ */ new Set([
|
|
172
211
|
"gauge",
|
|
173
212
|
"solid-gauge",
|
|
174
213
|
"metric",
|
|
175
214
|
"kpi",
|
|
176
215
|
"bullet"
|
|
177
|
-
]),
|
|
178
|
-
...
|
|
179
|
-
...
|
|
180
|
-
...
|
|
181
|
-
]), K = (e) => !!e && typeof e == "object" && !Array.isArray(e),
|
|
182
|
-
})),
|
|
183
|
-
function
|
|
216
|
+
]), gt = /* @__PURE__ */ new Set(["table", "pivot"]), _t = /* @__PURE__ */ new Set([
|
|
217
|
+
...mt,
|
|
218
|
+
...ht,
|
|
219
|
+
...gt
|
|
220
|
+
]), vt = /* @__PURE__ */ new Map([["chart:bar", "bar"]]), K = "plugin-charts:", q = (e) => !!e && typeof e == "object" && !Array.isArray(e), J = (e) => typeof e == "string" && e ? e : void 0, Y = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, yt = 200;
|
|
221
|
+
})), xt = /* @__PURE__ */ ot({ default: () => wt });
|
|
222
|
+
function St(e, t = 14) {
|
|
184
223
|
return e.length > t ? `${e.slice(0, t - 1)}…` : e;
|
|
185
224
|
}
|
|
186
|
-
function
|
|
187
|
-
let r = String(n?.value ?? ""), i =
|
|
225
|
+
function Ct({ x: e, y: t, payload: n }) {
|
|
226
|
+
let r = String(n?.value ?? ""), i = St(r);
|
|
188
227
|
return /* @__PURE__ */ E("g", {
|
|
189
228
|
transform: `translate(${e},${t})`,
|
|
190
229
|
children: /* @__PURE__ */ D("text", {
|
|
@@ -198,14 +237,14 @@ function nt({ x: e, y: t, payload: n }) {
|
|
|
198
237
|
})
|
|
199
238
|
});
|
|
200
239
|
}
|
|
201
|
-
function
|
|
240
|
+
function wt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
|
|
202
241
|
let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
|
|
203
242
|
return /* @__PURE__ */ E("div", {
|
|
204
243
|
className: `p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,
|
|
205
|
-
children: /* @__PURE__ */ E(
|
|
244
|
+
children: /* @__PURE__ */ E(Qe, {
|
|
206
245
|
width: "100%",
|
|
207
246
|
height: r,
|
|
208
|
-
children: /* @__PURE__ */ D(
|
|
247
|
+
children: /* @__PURE__ */ D(Pe, {
|
|
209
248
|
data: e,
|
|
210
249
|
margin: {
|
|
211
250
|
top: 10,
|
|
@@ -266,14 +305,14 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
266
305
|
/* @__PURE__ */ D("feMerge", { children: [/* @__PURE__ */ E("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ E("feMergeNode", { in: "SourceGraphic" })] })
|
|
267
306
|
]
|
|
268
307
|
})] }),
|
|
269
|
-
/* @__PURE__ */ E(
|
|
308
|
+
/* @__PURE__ */ E(O, {
|
|
270
309
|
strokeDasharray: "3 3",
|
|
271
310
|
stroke: "hsl(var(--border))",
|
|
272
311
|
vertical: !1
|
|
273
312
|
}),
|
|
274
|
-
/* @__PURE__ */ E(
|
|
313
|
+
/* @__PURE__ */ E(N, {
|
|
275
314
|
dataKey: n,
|
|
276
|
-
tick: s ? /* @__PURE__ */ E(
|
|
315
|
+
tick: s ? /* @__PURE__ */ E(Ct, {}) : {
|
|
277
316
|
fill: "hsl(var(--muted-foreground))",
|
|
278
317
|
fontSize: 12,
|
|
279
318
|
fontFamily: "monospace"
|
|
@@ -284,7 +323,7 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
284
323
|
height: s ? 56 : void 0,
|
|
285
324
|
dy: s ? void 0 : 10
|
|
286
325
|
}),
|
|
287
|
-
/* @__PURE__ */ E(
|
|
326
|
+
/* @__PURE__ */ E(P, {
|
|
288
327
|
tick: {
|
|
289
328
|
fill: "hsl(var(--muted-foreground))",
|
|
290
329
|
fontSize: 12,
|
|
@@ -308,11 +347,11 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
308
347
|
},
|
|
309
348
|
itemStyle: { color: "hsl(var(--primary))" }
|
|
310
349
|
}),
|
|
311
|
-
/* @__PURE__ */ E(
|
|
350
|
+
/* @__PURE__ */ E(Be, { wrapperStyle: {
|
|
312
351
|
paddingTop: "20px",
|
|
313
352
|
fontFamily: "monospace"
|
|
314
353
|
} }),
|
|
315
|
-
/* @__PURE__ */ E(
|
|
354
|
+
/* @__PURE__ */ E(Ne, {
|
|
316
355
|
dataKey: t,
|
|
317
356
|
fill: "url(#barGradient)",
|
|
318
357
|
radius: [
|
|
@@ -329,17 +368,17 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
|
|
|
329
368
|
})
|
|
330
369
|
});
|
|
331
370
|
}
|
|
332
|
-
var
|
|
371
|
+
var Tt = V((() => {}));
|
|
333
372
|
//#endregion
|
|
334
373
|
//#region src/ChartContainerImpl.tsx
|
|
335
|
-
function
|
|
336
|
-
let e =
|
|
374
|
+
function Et() {
|
|
375
|
+
let e = _.useContext(Z);
|
|
337
376
|
if (!e) throw Error("useChart must be used within a <ChartContainer />");
|
|
338
377
|
return e;
|
|
339
378
|
}
|
|
340
|
-
function
|
|
341
|
-
let s =
|
|
342
|
-
|
|
379
|
+
function Dt({ id: e, className: t, children: n, config: r, disableSettleRemount: i, style: a, ...o }) {
|
|
380
|
+
let s = _.useId(), c = `chart-${e || s.replace(/:/g, "")}`, l = _.useRef(null), [u, d] = _.useState(0);
|
|
381
|
+
_.useEffect(() => {
|
|
343
382
|
if (i) return;
|
|
344
383
|
let e = l.current;
|
|
345
384
|
if (e == null || typeof ResizeObserver > "u") return;
|
|
@@ -354,40 +393,41 @@ function X({ id: e, className: t, children: n, config: r, disableSettleRemount:
|
|
|
354
393
|
t = !0, n != null && clearTimeout(n), r.disconnect();
|
|
355
394
|
};
|
|
356
395
|
}, [i]);
|
|
357
|
-
let f = a?.height != null || a?.minHeight != null, p = a?.width != null || a?.minWidth != null,
|
|
358
|
-
...f ? {} : { minHeight:
|
|
396
|
+
let f = a?.height != null || a?.minHeight != null, p = a?.width != null || a?.minWidth != null, m = {
|
|
397
|
+
...f ? {} : { minHeight: Mt },
|
|
359
398
|
...p ? {} : { minWidth: 0 },
|
|
360
399
|
...a
|
|
361
400
|
};
|
|
362
|
-
return /* @__PURE__ */ E(
|
|
401
|
+
return /* @__PURE__ */ E(Z.Provider, {
|
|
363
402
|
value: { config: r },
|
|
364
403
|
children: /* @__PURE__ */ D("div", {
|
|
365
404
|
ref: l,
|
|
366
405
|
"data-slot": "chart",
|
|
367
406
|
"data-chart": c,
|
|
368
|
-
className:
|
|
369
|
-
style:
|
|
407
|
+
className: X("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
|
|
408
|
+
style: m,
|
|
370
409
|
...o,
|
|
371
|
-
children: [/* @__PURE__ */ E(
|
|
410
|
+
children: [/* @__PURE__ */ E(Nt, {
|
|
372
411
|
id: c,
|
|
373
412
|
config: r
|
|
374
|
-
}), /* @__PURE__ */ E(
|
|
413
|
+
}), /* @__PURE__ */ E(Qe, {
|
|
375
414
|
width: "100%",
|
|
376
415
|
height: "100%",
|
|
416
|
+
...f ? {} : { minHeight: Mt },
|
|
377
417
|
children: n
|
|
378
418
|
}, u)]
|
|
379
419
|
})
|
|
380
420
|
});
|
|
381
421
|
}
|
|
382
|
-
function
|
|
383
|
-
let { config: p } =
|
|
422
|
+
function Ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: f }) {
|
|
423
|
+
let { config: p } = Et(), m = De(), h = _.useMemo(() => {
|
|
384
424
|
if (i || !t?.length) return null;
|
|
385
|
-
let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r =
|
|
425
|
+
let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = At(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
|
|
386
426
|
return s ? /* @__PURE__ */ E("div", {
|
|
387
|
-
className:
|
|
427
|
+
className: X("font-medium", c),
|
|
388
428
|
children: s(a, t)
|
|
389
429
|
}) : a ? /* @__PURE__ */ E("div", {
|
|
390
|
-
className:
|
|
430
|
+
className: X("font-medium", c),
|
|
391
431
|
children: a
|
|
392
432
|
}) : null;
|
|
393
433
|
}, [
|
|
@@ -400,32 +440,32 @@ function ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
|
|
|
400
440
|
f
|
|
401
441
|
]);
|
|
402
442
|
if (!e || !t?.length) return null;
|
|
403
|
-
let
|
|
443
|
+
let ee = t.length === 1 && r !== "dot";
|
|
404
444
|
return /* @__PURE__ */ D("div", {
|
|
405
|
-
className:
|
|
406
|
-
children: [
|
|
445
|
+
className: X("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),
|
|
446
|
+
children: [ee ? null : h, /* @__PURE__ */ E("div", {
|
|
407
447
|
className: "grid gap-1.5",
|
|
408
448
|
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
409
|
-
let n = `${d || e.name || e.dataKey || "value"}`, i =
|
|
449
|
+
let n = `${d || e.name || e.dataKey || "value"}`, i = At(p, e, n), o = u || e.payload.fill || e.color;
|
|
410
450
|
return /* @__PURE__ */ E("div", {
|
|
411
|
-
className:
|
|
451
|
+
className: X("[&>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" : ""),
|
|
412
452
|
children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ D(T, { children: [i?.icon ? /* @__PURE__ */ E(i.icon, {}) : !a && /* @__PURE__ */ E("div", {
|
|
413
|
-
className:
|
|
453
|
+
className: X("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" : "", ee && r === "dashed" ? "my-0.5" : ""),
|
|
414
454
|
style: {
|
|
415
455
|
"--color-bg": o,
|
|
416
456
|
"--color-border": o
|
|
417
457
|
}
|
|
418
458
|
}), /* @__PURE__ */ D("div", {
|
|
419
|
-
className:
|
|
459
|
+
className: X("flex flex-1 justify-between leading-none", ee ? "items-end" : "items-center"),
|
|
420
460
|
children: [/* @__PURE__ */ D("div", {
|
|
421
461
|
className: "grid gap-1.5",
|
|
422
|
-
children: [
|
|
462
|
+
children: [ee ? h : null, /* @__PURE__ */ E("span", {
|
|
423
463
|
className: "text-muted-foreground",
|
|
424
464
|
children: i?.label || e.name
|
|
425
465
|
})]
|
|
426
466
|
}), e.value && /* @__PURE__ */ E("span", {
|
|
427
467
|
className: "text-foreground font-mono font-medium tabular-nums",
|
|
428
|
-
children: e.value.toLocaleString()
|
|
468
|
+
children: e.value.toLocaleString(m)
|
|
429
469
|
})]
|
|
430
470
|
})] })
|
|
431
471
|
}, e.dataKey);
|
|
@@ -433,34 +473,34 @@ function ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
|
|
|
433
473
|
})]
|
|
434
474
|
});
|
|
435
475
|
}
|
|
436
|
-
function
|
|
437
|
-
let { config: a } =
|
|
476
|
+
function kt({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
|
|
477
|
+
let { config: a } = Et();
|
|
438
478
|
return n?.length ? /* @__PURE__ */ E("div", {
|
|
439
|
-
className:
|
|
479
|
+
className: X("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
440
480
|
children: n.filter((e) => e.type !== "none").map((e) => {
|
|
441
|
-
let n = `${i || e.dataKey || "value"}`, r =
|
|
481
|
+
let n = `${i || e.dataKey || "value"}`, r = At(a, e, n);
|
|
442
482
|
return /* @__PURE__ */ D("div", {
|
|
443
|
-
className:
|
|
483
|
+
className: X("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
444
484
|
children: [r?.icon && !t ? /* @__PURE__ */ E(r.icon, {}) : /* @__PURE__ */ E("div", {
|
|
445
|
-
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
446
|
-
style: {
|
|
447
|
-
}), r?.label]
|
|
485
|
+
className: "h-2 w-2 shrink-0 rounded-[2px] bg-(--color-bg)",
|
|
486
|
+
style: { "--color-bg": e.color }
|
|
487
|
+
}), r?.label ?? e.value]
|
|
448
488
|
}, e.value);
|
|
449
489
|
})
|
|
450
490
|
}) : null;
|
|
451
491
|
}
|
|
452
|
-
function
|
|
492
|
+
function At(e, t, n) {
|
|
453
493
|
if (typeof t != "object" || !t) return;
|
|
454
494
|
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
455
495
|
return r && n in r && typeof r[n] == "string" ? i = r[n] : n in t && typeof t[n] == "string" && (i = t[n]), i in e ? e[i] : e[n];
|
|
456
496
|
}
|
|
457
|
-
var
|
|
458
|
-
|
|
497
|
+
var X, jt, Z, Mt, Nt, Pt, Ft, It = V((() => {
|
|
498
|
+
X = (...e) => e.filter(Boolean).join(" "), jt = {
|
|
459
499
|
light: "",
|
|
460
500
|
dark: ".dark"
|
|
461
|
-
},
|
|
501
|
+
}, Z = _.createContext(null), Mt = 280, Nt = ({ id: e, config: t }) => {
|
|
462
502
|
let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
463
|
-
return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(
|
|
503
|
+
return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(jt).map(([t, r]) => `
|
|
464
504
|
${r} [data-chart=${e}] {
|
|
465
505
|
${n.map(([e, n]) => {
|
|
466
506
|
let r = n.theme?.[t] || n.color;
|
|
@@ -468,46 +508,214 @@ ${n.map(([e, n]) => {
|
|
|
468
508
|
}).join("\n")}
|
|
469
509
|
}
|
|
470
510
|
`).join("\n") } }) : null;
|
|
471
|
-
},
|
|
511
|
+
}, Pt = M, Ft = Be;
|
|
472
512
|
}));
|
|
473
513
|
//#endregion
|
|
474
514
|
//#region src/chartDrillEvents.ts
|
|
475
|
-
function
|
|
515
|
+
function Lt(e) {
|
|
476
516
|
return e?.[0]?.dataKey || "value";
|
|
477
517
|
}
|
|
478
|
-
function
|
|
518
|
+
function Rt(e, t, n) {
|
|
479
519
|
if (!e) return null;
|
|
480
520
|
let r = e.payload ?? e, i = r?.[t];
|
|
481
521
|
if (i == null) return null;
|
|
482
|
-
let a =
|
|
522
|
+
let a = Lt(n);
|
|
483
523
|
return {
|
|
484
524
|
category: String(i),
|
|
485
525
|
series: a,
|
|
486
526
|
value: typeof r?.[a] == "number" ? r[a] : void 0
|
|
487
527
|
};
|
|
488
528
|
}
|
|
489
|
-
function
|
|
529
|
+
function zt(e, t) {
|
|
490
530
|
if (!e) return null;
|
|
491
531
|
let n = e.name ?? e.payload?.name ?? e.root?.name;
|
|
492
532
|
if (n == null) return null;
|
|
493
533
|
let r = e.value ?? e.size ?? e.payload?.size;
|
|
494
534
|
return {
|
|
495
535
|
category: String(n),
|
|
496
|
-
series:
|
|
536
|
+
series: Lt(t),
|
|
497
537
|
value: typeof r == "number" ? r : void 0
|
|
498
538
|
};
|
|
499
539
|
}
|
|
500
|
-
function
|
|
540
|
+
function Bt(e, t) {
|
|
501
541
|
if (!e) return null;
|
|
502
542
|
let n = e.payload ?? e, r = n?.name;
|
|
503
543
|
return r == null || n?.depth === 0 ? null : {
|
|
504
544
|
category: String(r),
|
|
505
|
-
series:
|
|
545
|
+
series: Lt(t),
|
|
506
546
|
value: typeof n?.value == "number" ? n.value : void 0
|
|
507
547
|
};
|
|
508
548
|
}
|
|
509
|
-
var
|
|
510
|
-
function
|
|
549
|
+
var Vt = V((() => {})), Ht = /* @__PURE__ */ ot({ default: () => Tn });
|
|
550
|
+
function Ut(e) {
|
|
551
|
+
return e === "top" ? Vn : Bn;
|
|
552
|
+
}
|
|
553
|
+
function Wt(e) {
|
|
554
|
+
return e === "right" ? Hn : zn;
|
|
555
|
+
}
|
|
556
|
+
function Gt(e, t) {
|
|
557
|
+
return e ? t ? e === "left" || e === "right" ? { down: e } : { refused: e } : e === "top" || e === "bottom" ? { across: e } : { refused: e } : {};
|
|
558
|
+
}
|
|
559
|
+
function Kt(e, t) {
|
|
560
|
+
return e ? /* @__PURE__ */ D("p", {
|
|
561
|
+
role: "note",
|
|
562
|
+
"data-chart-note": "x-axis-position",
|
|
563
|
+
className: "px-1 text-xs text-muted-foreground",
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ E("code", {
|
|
566
|
+
className: "font-mono",
|
|
567
|
+
children: "xAxis.position"
|
|
568
|
+
}),
|
|
569
|
+
" is",
|
|
570
|
+
" ",
|
|
571
|
+
/* @__PURE__ */ E("code", {
|
|
572
|
+
className: "font-mono",
|
|
573
|
+
children: e
|
|
574
|
+
}),
|
|
575
|
+
" —",
|
|
576
|
+
" ",
|
|
577
|
+
t ? /* @__PURE__ */ E(T, { children: "this chart's categories run down its side, so its x axis sits on the left or the right. It is drawn on the left." }) : /* @__PURE__ */ E(T, { children: "this chart's x axis runs across it, so it sits at the top or the bottom. It is drawn at the bottom." })
|
|
578
|
+
]
|
|
579
|
+
}) : null;
|
|
580
|
+
}
|
|
581
|
+
function qt(e, t) {
|
|
582
|
+
return t ? e === "left" ? "bottom" : "top" : e;
|
|
583
|
+
}
|
|
584
|
+
function Jt(e) {
|
|
585
|
+
return e === "left" || e === "right" ? `on the ${e}` : `at the ${e}`;
|
|
586
|
+
}
|
|
587
|
+
function Yt(e, t) {
|
|
588
|
+
return e ? t ? Gn : Wn : Un;
|
|
589
|
+
}
|
|
590
|
+
function Xt(e, t) {
|
|
591
|
+
if (e.notes.length === 0) return null;
|
|
592
|
+
let n = t ? "this chart's value axes run across it, so each sits at the bottom or the top." : "this chart's value axes run up its side, so each sits on the left or the right.";
|
|
593
|
+
return Qt(...e.notes.map((e) => {
|
|
594
|
+
let r = Jt(qt(e.drawn, t));
|
|
595
|
+
return /* @__PURE__ */ D("p", {
|
|
596
|
+
role: "note",
|
|
597
|
+
"data-chart-note": "y-axis-position",
|
|
598
|
+
className: "px-1 text-xs text-muted-foreground",
|
|
599
|
+
children: [
|
|
600
|
+
/* @__PURE__ */ E("code", {
|
|
601
|
+
className: "font-mono",
|
|
602
|
+
children: `yAxis[${e.index}].position`
|
|
603
|
+
}),
|
|
604
|
+
" is",
|
|
605
|
+
" ",
|
|
606
|
+
/* @__PURE__ */ E("code", {
|
|
607
|
+
className: "font-mono",
|
|
608
|
+
children: e.position
|
|
609
|
+
}),
|
|
610
|
+
" —",
|
|
611
|
+
" ",
|
|
612
|
+
e.reason === "side" ? /* @__PURE__ */ D(T, { children: [
|
|
613
|
+
n,
|
|
614
|
+
" It is drawn ",
|
|
615
|
+
r,
|
|
616
|
+
"."
|
|
617
|
+
] }) : /* @__PURE__ */ D(T, { children: [
|
|
618
|
+
/* @__PURE__ */ E("code", {
|
|
619
|
+
className: "font-mono",
|
|
620
|
+
children: "yAxis[0]"
|
|
621
|
+
}),
|
|
622
|
+
" already sits ",
|
|
623
|
+
Jt(e.position),
|
|
624
|
+
", so this axis is drawn ",
|
|
625
|
+
r,
|
|
626
|
+
"."
|
|
627
|
+
] })
|
|
628
|
+
]
|
|
629
|
+
}, e.index);
|
|
630
|
+
}));
|
|
631
|
+
}
|
|
632
|
+
function Zt(e, t, n) {
|
|
633
|
+
if (e.undrawn.length === 0) return null;
|
|
634
|
+
let r = e.slotOf.length === 1, i = n ? "one at the bottom and one at the top" : "one on each side";
|
|
635
|
+
return Qt(...e.undrawn.map((a) => {
|
|
636
|
+
let o = e[a.boundTo];
|
|
637
|
+
if (r) return /* @__PURE__ */ D("p", {
|
|
638
|
+
role: "note",
|
|
639
|
+
"data-chart-note": "y-axis-undrawn",
|
|
640
|
+
className: "px-1 text-xs text-muted-foreground",
|
|
641
|
+
children: [
|
|
642
|
+
/* @__PURE__ */ E("code", {
|
|
643
|
+
className: "font-mono",
|
|
644
|
+
children: `yAxis[${a.index}]`
|
|
645
|
+
}),
|
|
646
|
+
" is not drawn — this chart draws one value axis",
|
|
647
|
+
o === void 0 ? null : /* @__PURE__ */ D(T, { children: [", ", /* @__PURE__ */ E("code", {
|
|
648
|
+
className: "font-mono",
|
|
649
|
+
children: `yAxis[${o}]`
|
|
650
|
+
})] }),
|
|
651
|
+
"."
|
|
652
|
+
]
|
|
653
|
+
}, a.index);
|
|
654
|
+
let s = t?.[a.index]?.field;
|
|
655
|
+
return /* @__PURE__ */ D("p", {
|
|
656
|
+
role: "note",
|
|
657
|
+
"data-chart-note": "y-axis-undrawn",
|
|
658
|
+
className: "px-1 text-xs text-muted-foreground",
|
|
659
|
+
children: [
|
|
660
|
+
/* @__PURE__ */ E("code", {
|
|
661
|
+
className: "font-mono",
|
|
662
|
+
children: `yAxis[${a.index}]`
|
|
663
|
+
}),
|
|
664
|
+
" is not drawn — this chart draws at most two value axes, ",
|
|
665
|
+
i,
|
|
666
|
+
".",
|
|
667
|
+
s ? /* @__PURE__ */ D(T, { children: [
|
|
668
|
+
" ",
|
|
669
|
+
"When the chart declares neither ",
|
|
670
|
+
/* @__PURE__ */ E("code", {
|
|
671
|
+
className: "font-mono",
|
|
672
|
+
children: "series"
|
|
673
|
+
}),
|
|
674
|
+
" nor",
|
|
675
|
+
" ",
|
|
676
|
+
/* @__PURE__ */ E("code", {
|
|
677
|
+
className: "font-mono",
|
|
678
|
+
children: "categories"
|
|
679
|
+
}),
|
|
680
|
+
", its field ",
|
|
681
|
+
/* @__PURE__ */ E("code", {
|
|
682
|
+
className: "font-mono",
|
|
683
|
+
children: s
|
|
684
|
+
}),
|
|
685
|
+
" is plotted against the axis ",
|
|
686
|
+
Jt(qt(a.boundTo, n)),
|
|
687
|
+
o === void 0 ? null : /* @__PURE__ */ D(T, { children: [", ", /* @__PURE__ */ E("code", {
|
|
688
|
+
className: "font-mono",
|
|
689
|
+
children: `yAxis[${o}]`
|
|
690
|
+
})] }),
|
|
691
|
+
"."
|
|
692
|
+
] }) : null
|
|
693
|
+
]
|
|
694
|
+
}, a.index);
|
|
695
|
+
}));
|
|
696
|
+
}
|
|
697
|
+
function Qt(...e) {
|
|
698
|
+
let t = e.filter((e) => e != null && e !== !1);
|
|
699
|
+
return t.length <= 1 ? t[0] ?? null : /* @__PURE__ */ E(T, { children: t.map((e, t) => /* @__PURE__ */ E(_.Fragment, { children: e }, t)) });
|
|
700
|
+
}
|
|
701
|
+
function $t(e, t, n) {
|
|
702
|
+
if (!e) return {};
|
|
703
|
+
let r = G(e), i = pt(e, t);
|
|
704
|
+
return {
|
|
705
|
+
...i ? { ticks: i } : {},
|
|
706
|
+
...r ? { domain: r } : {},
|
|
707
|
+
...r ? { allowDataOverflow: !0 } : {},
|
|
708
|
+
...e.logarithmic ? {
|
|
709
|
+
scale: "log",
|
|
710
|
+
domain: r ?? [1, "auto"]
|
|
711
|
+
} : {},
|
|
712
|
+
...e.title ? { label: {
|
|
713
|
+
value: e.title,
|
|
714
|
+
...n
|
|
715
|
+
} } : {}
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
function en(e) {
|
|
511
719
|
let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
|
|
512
720
|
return r <= 0 || i <= 0 ? null : /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("rect", {
|
|
513
721
|
x: t,
|
|
@@ -526,7 +734,7 @@ function xt(e) {
|
|
|
526
734
|
children: a
|
|
527
735
|
}) : null] });
|
|
528
736
|
}
|
|
529
|
-
function
|
|
737
|
+
function tn({ title: e, subtitle: t, children: n }) {
|
|
530
738
|
return !e && !t ? /* @__PURE__ */ E(T, { children: n }) : /* @__PURE__ */ D("div", {
|
|
531
739
|
className: "flex h-full w-full flex-col",
|
|
532
740
|
children: [/* @__PURE__ */ D("div", {
|
|
@@ -544,243 +752,450 @@ function St({ title: e, subtitle: t, children: n }) {
|
|
|
544
752
|
})]
|
|
545
753
|
});
|
|
546
754
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
755
|
+
function nn({ note: e, children: t }) {
|
|
756
|
+
return e ? /* @__PURE__ */ D("div", {
|
|
757
|
+
className: "flex h-full w-full flex-col",
|
|
758
|
+
children: [/* @__PURE__ */ E("div", {
|
|
759
|
+
className: "min-h-0 flex-1",
|
|
760
|
+
children: t
|
|
761
|
+
}), /* @__PURE__ */ E("div", {
|
|
762
|
+
className: "mt-1 shrink-0",
|
|
763
|
+
children: e
|
|
764
|
+
})]
|
|
765
|
+
}) : /* @__PURE__ */ E(T, { children: t });
|
|
766
|
+
}
|
|
767
|
+
function rn(e, t) {
|
|
768
|
+
let n = 0;
|
|
769
|
+
for (let r of e) {
|
|
770
|
+
let e = Number(r?.[t]);
|
|
771
|
+
Number.isFinite(e) && e > 0 && (n += 1);
|
|
772
|
+
}
|
|
773
|
+
return {
|
|
774
|
+
sizable: n,
|
|
775
|
+
total: e.length
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
function an({ dataKey: e, className: t }) {
|
|
779
|
+
return /* @__PURE__ */ D(Q, {
|
|
780
|
+
code: "no-positive-magnitude",
|
|
781
|
+
className: t,
|
|
782
|
+
children: [
|
|
783
|
+
"This chart has nothing to size: no row's",
|
|
784
|
+
" ",
|
|
785
|
+
/* @__PURE__ */ E("code", {
|
|
786
|
+
className: "font-mono",
|
|
787
|
+
children: e
|
|
788
|
+
}),
|
|
789
|
+
" is above zero."
|
|
790
|
+
]
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
function on(e, t, n) {
|
|
794
|
+
let r = t - e;
|
|
795
|
+
return r <= 0 ? null : /* @__PURE__ */ D("p", {
|
|
796
|
+
role: "note",
|
|
797
|
+
"data-chart-note": "unsized-rows",
|
|
798
|
+
className: "px-1 text-xs text-muted-foreground",
|
|
799
|
+
children: [
|
|
800
|
+
r,
|
|
801
|
+
" of ",
|
|
802
|
+
t,
|
|
803
|
+
" rows ",
|
|
804
|
+
r === 1 ? "has" : "have",
|
|
805
|
+
" no",
|
|
806
|
+
" ",
|
|
807
|
+
/* @__PURE__ */ E("code", {
|
|
808
|
+
className: "font-mono",
|
|
809
|
+
children: n
|
|
810
|
+
}),
|
|
811
|
+
" above zero — this chart sizes by value, so",
|
|
812
|
+
" ",
|
|
813
|
+
r === 1 ? "that row is" : "those rows are",
|
|
814
|
+
" not drawn to scale."
|
|
815
|
+
]
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
function sn(e) {
|
|
819
|
+
return e != null && Number.isFinite(Number(e));
|
|
820
|
+
}
|
|
821
|
+
function cn(e, t, n) {
|
|
822
|
+
let r = 0;
|
|
823
|
+
for (let i of e) {
|
|
824
|
+
let e = i;
|
|
825
|
+
sn(e?.[t]) && sn(e?.[n]) && (r += 1);
|
|
826
|
+
}
|
|
827
|
+
return {
|
|
828
|
+
plottable: r,
|
|
829
|
+
total: e.length
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
function ln({ xKey: e, yKey: t, className: n }) {
|
|
833
|
+
return /* @__PURE__ */ D(Q, {
|
|
834
|
+
code: "no-plottable-points",
|
|
835
|
+
className: n,
|
|
836
|
+
children: [
|
|
837
|
+
"This chart has nothing to place: no row carries a number for both",
|
|
838
|
+
" ",
|
|
839
|
+
/* @__PURE__ */ E("code", {
|
|
840
|
+
className: "font-mono",
|
|
841
|
+
children: e
|
|
842
|
+
}),
|
|
843
|
+
" and",
|
|
844
|
+
" ",
|
|
845
|
+
/* @__PURE__ */ E("code", {
|
|
846
|
+
className: "font-mono",
|
|
847
|
+
children: t
|
|
848
|
+
}),
|
|
849
|
+
"."
|
|
850
|
+
]
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
function un(e) {
|
|
854
|
+
return typeof e == "boolean" ? !1 : Array.isArray(e) ? dn(e[0]) && dn(e[1]) : dn(e);
|
|
855
|
+
}
|
|
856
|
+
function dn(e) {
|
|
857
|
+
return typeof e == "number" || e instanceof Number || typeof e == "string" || e instanceof Date ? Number.isFinite(Number(e)) : !1;
|
|
858
|
+
}
|
|
859
|
+
function fn(e) {
|
|
860
|
+
let t = (e) => typeof e == "number" && Number.isFinite(e);
|
|
861
|
+
return t(e?.min) && t(e?.max) || t(e?.stepSize);
|
|
862
|
+
}
|
|
863
|
+
function pn(e, t) {
|
|
864
|
+
return e.some((e) => un(e?.[t]));
|
|
865
|
+
}
|
|
866
|
+
function mn(e, t, n) {
|
|
867
|
+
let r = t[n];
|
|
868
|
+
if (!r?.stack) return "none";
|
|
869
|
+
let i = ft(e, t), a = i === "combo" ? r.chartType || dt(e) || (n === 0 ? "bar" : "line") : i;
|
|
870
|
+
return a === "line" ? "none" : a === "area" ? "area" : "bar";
|
|
871
|
+
}
|
|
872
|
+
function hn({ keys: e, total: t, className: n }) {
|
|
873
|
+
return /* @__PURE__ */ D(Q, {
|
|
874
|
+
code: "no-numeric-value",
|
|
875
|
+
className: n,
|
|
876
|
+
children: [
|
|
877
|
+
"This chart has no scale to draw on:",
|
|
878
|
+
" ",
|
|
879
|
+
t === 1 ? "its only row has no" : `none of the ${t} rows has a`,
|
|
880
|
+
" numeric value for",
|
|
881
|
+
" ",
|
|
882
|
+
e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? " or " : "", /* @__PURE__ */ E("code", {
|
|
883
|
+
className: "font-mono",
|
|
884
|
+
children: e
|
|
885
|
+
})] }, `${t}-${e}`)),
|
|
886
|
+
"."
|
|
887
|
+
]
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
function gn({ seriesKeys: e, className: t }) {
|
|
891
|
+
let n = Ae();
|
|
892
|
+
return /* @__PURE__ */ D(Q, {
|
|
893
|
+
code: "scatter-multi-series",
|
|
894
|
+
className: t,
|
|
895
|
+
children: [
|
|
896
|
+
n("chart.scatterOneMeasure", "A scatter plots one measure. Keep exactly one series:"),
|
|
897
|
+
" ",
|
|
898
|
+
e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? ", " : "", /* @__PURE__ */ E("code", {
|
|
899
|
+
className: "font-mono",
|
|
900
|
+
children: e
|
|
901
|
+
})] }, `${t}-${e}`))
|
|
902
|
+
]
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
function _n(e, t, n, r) {
|
|
906
|
+
let i = t - e;
|
|
907
|
+
return i <= 0 ? null : /* @__PURE__ */ D("p", {
|
|
908
|
+
role: "note",
|
|
909
|
+
"data-chart-note": "unplotted-points",
|
|
910
|
+
className: "px-1 text-xs text-muted-foreground",
|
|
911
|
+
children: [
|
|
912
|
+
i,
|
|
913
|
+
" of ",
|
|
914
|
+
t,
|
|
915
|
+
" rows ",
|
|
916
|
+
i === 1 ? "has" : "have",
|
|
917
|
+
" no number for both",
|
|
918
|
+
" ",
|
|
919
|
+
/* @__PURE__ */ E("code", {
|
|
920
|
+
className: "font-mono",
|
|
921
|
+
children: n
|
|
922
|
+
}),
|
|
923
|
+
" and",
|
|
924
|
+
" ",
|
|
925
|
+
/* @__PURE__ */ E("code", {
|
|
926
|
+
className: "font-mono",
|
|
927
|
+
children: r
|
|
928
|
+
}),
|
|
929
|
+
" — this chart plots by position, so",
|
|
930
|
+
" ",
|
|
931
|
+
i === 1 ? "that point is" : "those points are",
|
|
932
|
+
" not drawn."
|
|
933
|
+
]
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
function vn({ chartType: e, data: t = [], config: r = {}, xAxisKey: i = "name", series: a = [], className: s = "", colors: c, categoryColors: l, categoryOrder: u, onChartClick: d, isAnimationActive: f, xAxis: p, yAxes: m, showLegend: h, showDataLabels: ee, title: ne, subtitle: re, description: ie, height: ae, annotations: oe, interaction: se }) {
|
|
937
|
+
let ce = e === "column" ? "bar" : e, g = ft(ce, a), le = dt(ce), v = Array.isArray(t) ? t : [], y = De(), b = f === !1 ? { isAnimationActive: !1 } : {}, x = {
|
|
938
|
+
...f === !1 ? { disableSettleRemount: !0 } : {},
|
|
939
|
+
...ae ? { style: { height: ae } } : {},
|
|
940
|
+
...ie ? {
|
|
552
941
|
role: "img",
|
|
553
|
-
"aria-label":
|
|
942
|
+
"aria-label": ie
|
|
554
943
|
} : {}
|
|
555
|
-
}, [
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
944
|
+
}, [S, C] = _.useState(!1), w = _.useRef(null), fe = _.useCallback((e) => (...t) => {
|
|
945
|
+
let n = jn(t);
|
|
946
|
+
n !== void 0 && (w.current = {
|
|
947
|
+
gesture: n,
|
|
948
|
+
dataKey: String(e.dataKey)
|
|
949
|
+
});
|
|
950
|
+
}, []), pe = d ? (e) => ({ onClick: fe(e) }) : () => ({}), me = _.useCallback((e, t, n) => {
|
|
951
|
+
if (!d || !e) return;
|
|
952
|
+
let r = e.activeTooltipIndex ?? e.activeIndex, i = r == null ? NaN : Number(r), s = Number.isInteger(i) && i >= 0 ? v[i] : void 0, c = w.current;
|
|
953
|
+
w.current = null;
|
|
954
|
+
let l = An(t), u = c != null && l !== void 0 && c.gesture === l;
|
|
955
|
+
if (n && !u) return;
|
|
956
|
+
let f = u ? c.dataKey : kn(e.activeDataKey, a), p = f != null && s ? s[f] : void 0;
|
|
957
|
+
d({
|
|
559
958
|
category: e.activeLabel == null ? void 0 : String(e.activeLabel),
|
|
560
|
-
|
|
561
|
-
|
|
959
|
+
categoryId: o(s),
|
|
960
|
+
series: f,
|
|
961
|
+
seriesLabel: Mn(f, a),
|
|
962
|
+
value: typeof p == "number" ? p : void 0
|
|
562
963
|
});
|
|
563
|
-
}, [
|
|
564
|
-
|
|
964
|
+
}, [
|
|
965
|
+
d,
|
|
966
|
+
v,
|
|
967
|
+
a
|
|
968
|
+
]), he = _.useCallback((e, t) => {
|
|
969
|
+
me(e, t, !1);
|
|
970
|
+
}, [me]), ge = _.useCallback((e, t) => {
|
|
971
|
+
me(e, t, !0);
|
|
972
|
+
}, [me]), _e = _.useCallback((e) => {
|
|
973
|
+
if (!d || !e) return;
|
|
565
974
|
let t = e.payload?.[i], n = a[0]?.dataKey || "value";
|
|
566
|
-
|
|
975
|
+
d({
|
|
567
976
|
category: t == null ? void 0 : String(t),
|
|
977
|
+
categoryId: o(e.payload),
|
|
568
978
|
series: n,
|
|
979
|
+
seriesLabel: Mn(n, a),
|
|
569
980
|
value: typeof e.payload?.[n] == "number" ? e.payload[n] : void 0
|
|
570
981
|
});
|
|
571
982
|
}, [
|
|
572
|
-
|
|
983
|
+
d,
|
|
573
984
|
i,
|
|
574
985
|
a
|
|
575
|
-
]),
|
|
576
|
-
onClick:
|
|
986
|
+
]), ve = d ? {
|
|
987
|
+
onClick: he,
|
|
577
988
|
style: { cursor: "pointer" }
|
|
578
|
-
} : {},
|
|
579
|
-
|
|
989
|
+
} : {}, ye = d ? { onClick: ge } : {}, be = d ? (e) => ({
|
|
990
|
+
...pe(e),
|
|
991
|
+
cursor: "pointer"
|
|
992
|
+
}) : () => ({}), xe = d ? {
|
|
993
|
+
onClick: _e,
|
|
580
994
|
style: { cursor: "pointer" }
|
|
581
|
-
} : {},
|
|
582
|
-
if (!
|
|
583
|
-
let t =
|
|
584
|
-
t &&
|
|
995
|
+
} : {}, Se = _.useCallback((e, t, n) => l && l[e == null ? "" : String(e)] || n[t % n.length], [l]), Ce = _.useCallback((e) => {
|
|
996
|
+
if (!d) return;
|
|
997
|
+
let t = Rt(e, i, a);
|
|
998
|
+
t && d(t);
|
|
585
999
|
}, [
|
|
586
|
-
|
|
1000
|
+
d,
|
|
587
1001
|
i,
|
|
588
1002
|
a
|
|
589
|
-
]),
|
|
590
|
-
if (!
|
|
591
|
-
let t =
|
|
592
|
-
t &&
|
|
593
|
-
}, [
|
|
594
|
-
if (!
|
|
595
|
-
let t =
|
|
596
|
-
t &&
|
|
597
|
-
}, [
|
|
598
|
-
onClick:
|
|
1003
|
+
]), we = _.useCallback((e) => {
|
|
1004
|
+
if (!d) return;
|
|
1005
|
+
let t = zt(e, a);
|
|
1006
|
+
t && d(t);
|
|
1007
|
+
}, [d, a]), Te = _.useCallback((e) => {
|
|
1008
|
+
if (!d) return;
|
|
1009
|
+
let t = Bt(e, a);
|
|
1010
|
+
t && d(t);
|
|
1011
|
+
}, [d, a]), Ee = d ? {
|
|
1012
|
+
onClick: Ce,
|
|
599
1013
|
cursor: "pointer"
|
|
600
|
-
} : {},
|
|
601
|
-
onClick:
|
|
1014
|
+
} : {}, Oe = d ? {
|
|
1015
|
+
onClick: we,
|
|
602
1016
|
style: { cursor: "pointer" }
|
|
603
|
-
} : {},
|
|
604
|
-
onClick:
|
|
1017
|
+
} : {}, ke = d ? {
|
|
1018
|
+
onClick: Te,
|
|
605
1019
|
style: { cursor: "pointer" }
|
|
606
1020
|
} : {};
|
|
607
|
-
|
|
608
|
-
let e = () =>
|
|
1021
|
+
_.useEffect(() => {
|
|
1022
|
+
let e = () => C(window.innerWidth < 640);
|
|
609
1023
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
610
1024
|
}, []);
|
|
611
|
-
let
|
|
612
|
-
bar: k,
|
|
613
|
-
"horizontal-bar": k,
|
|
614
|
-
line: Se,
|
|
615
|
-
area: pe,
|
|
616
|
-
pie: we,
|
|
617
|
-
donut: we,
|
|
618
|
-
radar: ke,
|
|
619
|
-
scatter: Fe,
|
|
620
|
-
funnel: be,
|
|
621
|
-
combo: ve,
|
|
622
|
-
treemap: k,
|
|
623
|
-
sankey: k
|
|
624
|
-
}[y] || k, Be = h.useCallback((e) => {
|
|
1025
|
+
let Ae = _.useCallback((e) => {
|
|
625
1026
|
if (e == null || e === "") return "";
|
|
626
1027
|
let t = r?.[String(e)]?.label;
|
|
627
1028
|
if (t != null) return String(t);
|
|
628
1029
|
let n = typeof e == "string" ? e : String(e);
|
|
629
1030
|
if (/^\d{4}-\d{2}-\d{2}/.test(n)) {
|
|
630
|
-
let e =
|
|
1031
|
+
let e = de(n);
|
|
631
1032
|
if (!Number.isNaN(e.getTime())) {
|
|
632
|
-
let t = (
|
|
1033
|
+
let t = (v.length > 1 ? Math.abs(new Date(String(v[v.length - 1][i] ?? "")).getTime() - new Date(String(v[0][i] ?? "")).getTime()) : 0) / 864e5;
|
|
633
1034
|
try {
|
|
634
|
-
return t <= 62 ? e.toLocaleDateString(
|
|
1035
|
+
return t <= 62 ? e.toLocaleDateString(y, {
|
|
635
1036
|
month: "short",
|
|
636
1037
|
day: "numeric"
|
|
637
|
-
}) : e.toLocaleDateString(
|
|
1038
|
+
}) : e.toLocaleDateString(y, {
|
|
638
1039
|
month: "short",
|
|
639
1040
|
year: "numeric"
|
|
640
1041
|
});
|
|
641
1042
|
} catch {
|
|
642
|
-
return e.toISOString().slice(0, 10);
|
|
1043
|
+
return te(n) ? ue(e) : e.toISOString().slice(0, 10);
|
|
643
1044
|
}
|
|
644
1045
|
}
|
|
645
1046
|
}
|
|
646
|
-
return
|
|
1047
|
+
return S && n.length > 8 ? n.slice(0, 8) + "…" : n;
|
|
647
1048
|
}, [
|
|
648
|
-
|
|
1049
|
+
v,
|
|
649
1050
|
i,
|
|
650
|
-
|
|
651
|
-
r
|
|
652
|
-
|
|
1051
|
+
S,
|
|
1052
|
+
r,
|
|
1053
|
+
y
|
|
1054
|
+
]), Be = _.useMemo(() => v.some((e) => String(e[i] || "").length > 5), [v, i]), Qe = v.length > 0 && v.length <= Pn, tt = (Qe || !S) && Be, nt = () => Array.isArray(c) && c.length > 0 ? c : [
|
|
653
1055
|
"hsl(var(--chart-1))",
|
|
654
1056
|
"hsl(var(--chart-2))",
|
|
655
1057
|
"hsl(var(--chart-3))",
|
|
656
1058
|
"hsl(var(--chart-4))",
|
|
657
1059
|
"hsl(var(--chart-5))"
|
|
658
|
-
],
|
|
1060
|
+
], rt = _.useCallback((e) => {
|
|
659
1061
|
if (e == null || e === "") return "";
|
|
660
1062
|
let t = typeof e == "number" ? e : Number(e);
|
|
661
1063
|
if (!Number.isFinite(t)) return String(e);
|
|
662
1064
|
try {
|
|
663
|
-
return new Intl.NumberFormat(
|
|
1065
|
+
return new Intl.NumberFormat(y, {
|
|
664
1066
|
notation: "compact",
|
|
665
1067
|
maximumFractionDigits: 1
|
|
666
1068
|
}).format(t);
|
|
667
1069
|
} catch {
|
|
668
1070
|
return String(t);
|
|
669
1071
|
}
|
|
670
|
-
}, []),
|
|
671
|
-
|
|
672
|
-
|
|
1072
|
+
}, [y]), F = m?.[0], I = g === "horizontal-bar", L = lt(m, g), R = L.left === void 0 ? void 0 : m?.[L.left], z = L.right === void 0 ? void 0 : m?.[L.right], it = !!R && !!z, at = g === "combo" || it, B = L.slotOf[0] ?? "left", V = Qt(Xt(L, I), Zt(L, m, I)), ot = (e) => it ? e.yAxis === "right" ? z : R : F, H = _.useMemo(() => W(p?.format, y) ?? Ae, [
|
|
1073
|
+
p?.format,
|
|
1074
|
+
y,
|
|
1075
|
+
Ae
|
|
1076
|
+
]), U = _.useMemo(() => !Qe || !tt ? H : (e) => {
|
|
1077
|
+
let t = String(H(e) ?? "");
|
|
1078
|
+
return t.length > Fn ? `${t.slice(0, 11)}…` : t;
|
|
1079
|
+
}, [
|
|
1080
|
+
Qe,
|
|
1081
|
+
tt,
|
|
1082
|
+
H
|
|
1083
|
+
]), st = _.useMemo(() => W(F?.format, y) ?? rt, [
|
|
1084
|
+
F?.format,
|
|
1085
|
+
y,
|
|
1086
|
+
rt
|
|
1087
|
+
]), ct = _.useMemo(() => W(R?.format, y) ?? rt, [
|
|
1088
|
+
R?.format,
|
|
1089
|
+
y,
|
|
1090
|
+
rt
|
|
1091
|
+
]), ut = _.useMemo(() => W(z?.format, y) ?? rt, [
|
|
1092
|
+
z?.format,
|
|
1093
|
+
y,
|
|
1094
|
+
rt
|
|
1095
|
+
]), pt = _.useCallback((e) => {
|
|
1096
|
+
let t = a.filter((t) => !it || (t.yAxis === "right" ? "right" : "left") === e).map((e) => e.dataKey), n = [];
|
|
1097
|
+
for (let e of v) for (let r of t) {
|
|
673
1098
|
let t = Number(e?.[r]);
|
|
674
1099
|
Number.isFinite(t) && n.push(t);
|
|
675
1100
|
}
|
|
676
1101
|
return n;
|
|
677
1102
|
}, [
|
|
678
|
-
|
|
1103
|
+
v,
|
|
679
1104
|
a,
|
|
680
|
-
|
|
681
|
-
]),
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
...n ? { domain: n } : {},
|
|
687
|
-
...n ? { allowDataOverflow: !0 } : {},
|
|
688
|
-
...e.logarithmic ? {
|
|
689
|
-
scale: "log",
|
|
690
|
-
domain: n ?? [1, "auto"]
|
|
691
|
-
} : {},
|
|
692
|
-
...e.title ? { label: {
|
|
693
|
-
value: e.title,
|
|
694
|
-
angle: -90,
|
|
695
|
-
position: "insideLeft"
|
|
696
|
-
} } : {}
|
|
697
|
-
};
|
|
698
|
-
}, [U]), Ue = L?.showGridLines !== !1, We = {
|
|
699
|
-
vertical: f?.showGridLines === !0,
|
|
700
|
-
horizontal: Ue
|
|
701
|
-
}, Qe = ee !== !1, K = h.useMemo(() => {
|
|
702
|
-
if (!Array.isArray(re) || re.length === 0) return null;
|
|
1105
|
+
it
|
|
1106
|
+
]), G = _.useCallback((e, t = "left", n) => $t(e, pt(t), n ?? Wt(t)), [pt]), _t = F?.showGridLines !== !1, vt = {
|
|
1107
|
+
vertical: p?.showGridLines === !0,
|
|
1108
|
+
horizontal: _t
|
|
1109
|
+
}, { across: K, down: q, refused: J } = Gt(p?.position, I), Y = Kt(J, I), yt = h !== !1, bt = _.useMemo(() => {
|
|
1110
|
+
if (!Array.isArray(oe) || oe.length === 0) return null;
|
|
703
1111
|
let e = {
|
|
704
1112
|
solid: void 0,
|
|
705
1113
|
dashed: "4 4",
|
|
706
1114
|
dotted: "1 4"
|
|
707
|
-
};
|
|
708
|
-
return
|
|
709
|
-
let
|
|
710
|
-
value:
|
|
1115
|
+
}, t = Yt(at, I);
|
|
1116
|
+
return oe.map((n, r) => {
|
|
1117
|
+
let i = n?.axis === "x", a = $(String(n?.color || "hsl(var(--muted-foreground))")), o = e[String(n?.style ?? "dashed")], s = typeof n?.label == "string" ? n.label : void 0, c = s ? { label: {
|
|
1118
|
+
value: s,
|
|
711
1119
|
position: "insideTopRight",
|
|
712
|
-
fill:
|
|
1120
|
+
fill: a,
|
|
713
1121
|
fontSize: 11
|
|
714
1122
|
} } : {};
|
|
715
|
-
if (
|
|
716
|
-
let e =
|
|
717
|
-
x1:
|
|
718
|
-
x2:
|
|
1123
|
+
if (n?.type === "region") {
|
|
1124
|
+
let e = i ? {
|
|
1125
|
+
x1: n.value,
|
|
1126
|
+
x2: n.endValue
|
|
719
1127
|
} : {
|
|
720
|
-
y1:
|
|
721
|
-
y2:
|
|
1128
|
+
y1: n.value,
|
|
1129
|
+
y2: n.endValue
|
|
722
1130
|
};
|
|
723
|
-
return /* @__PURE__ */ E(
|
|
1131
|
+
return /* @__PURE__ */ E(Xe, {
|
|
724
1132
|
...e,
|
|
725
|
-
...
|
|
726
|
-
fill:
|
|
1133
|
+
...t,
|
|
1134
|
+
fill: a,
|
|
727
1135
|
fillOpacity: .12,
|
|
728
|
-
stroke:
|
|
1136
|
+
stroke: a,
|
|
729
1137
|
strokeOpacity: .35,
|
|
730
|
-
...
|
|
731
|
-
}, `ann-${
|
|
1138
|
+
...c
|
|
1139
|
+
}, `ann-${r}`);
|
|
732
1140
|
}
|
|
733
|
-
return /* @__PURE__ */ E(
|
|
734
|
-
...
|
|
735
|
-
...
|
|
736
|
-
stroke:
|
|
737
|
-
strokeDasharray:
|
|
738
|
-
...
|
|
739
|
-
}, `ann-${
|
|
1141
|
+
return /* @__PURE__ */ E(Ze, {
|
|
1142
|
+
...i ? { x: n?.value } : { y: n?.value },
|
|
1143
|
+
...t,
|
|
1144
|
+
stroke: a,
|
|
1145
|
+
strokeDasharray: o,
|
|
1146
|
+
...c
|
|
1147
|
+
}, `ann-${r}`);
|
|
740
1148
|
});
|
|
741
|
-
}, [
|
|
1149
|
+
}, [
|
|
1150
|
+
oe,
|
|
1151
|
+
at,
|
|
1152
|
+
I
|
|
1153
|
+
]), xt = se?.tooltips !== !1, St = se?.brush === !0 ? /* @__PURE__ */ E(Fe, {
|
|
742
1154
|
dataKey: i,
|
|
743
1155
|
height: 24,
|
|
744
1156
|
travellerWidth: 8,
|
|
745
1157
|
stroke: "hsl(var(--muted-foreground))"
|
|
746
|
-
}) : null,
|
|
1158
|
+
}) : null, Ct = (e) => ee ? /* @__PURE__ */ E(ze, {
|
|
747
1159
|
position: "top",
|
|
748
1160
|
className: "fill-foreground",
|
|
749
1161
|
fontSize: 11,
|
|
750
1162
|
...e ? { formatter: e } : {}
|
|
751
|
-
}) : null,
|
|
1163
|
+
}) : null, wt = _.useMemo(() => ({
|
|
752
1164
|
tickLine: !1,
|
|
753
1165
|
tickMargin: 10,
|
|
754
1166
|
axisLine: !1,
|
|
755
|
-
interval:
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
1167
|
+
...Qe ? { interval: 0 } : {
|
|
1168
|
+
interval: "preserveStartEnd",
|
|
1169
|
+
minTickGap: 0
|
|
1170
|
+
},
|
|
1171
|
+
tickFormatter: U,
|
|
1172
|
+
...K ? { orientation: K } : {},
|
|
1173
|
+
...p?.title ? { label: {
|
|
1174
|
+
value: p.title,
|
|
1175
|
+
...Ut(K)
|
|
762
1176
|
} } : {},
|
|
763
|
-
|
|
764
|
-
angle: -35,
|
|
1177
|
+
...tt && {
|
|
1178
|
+
angle: K === "top" ? 35 : -35,
|
|
765
1179
|
textAnchor: "end",
|
|
766
1180
|
height: 60
|
|
767
1181
|
}
|
|
768
1182
|
}), [
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
1183
|
+
Qe,
|
|
1184
|
+
tt,
|
|
1185
|
+
U,
|
|
1186
|
+
p?.title,
|
|
1187
|
+
K
|
|
773
1188
|
]);
|
|
774
|
-
if (
|
|
775
|
-
let e = a[0]?.dataKey || "value", t =
|
|
1189
|
+
if (g && ht.has(g)) {
|
|
1190
|
+
let e = a[0]?.dataKey || "value", t = v[0]?.[e], n = typeof t == "number" ? t : Number(t), i = a[0]?.label ?? r?.[e]?.label ?? e;
|
|
776
1191
|
return /* @__PURE__ */ E("div", {
|
|
777
|
-
className:
|
|
1192
|
+
className: s,
|
|
778
1193
|
"data-testid": "advanced-chart-single-value",
|
|
779
1194
|
children: /* @__PURE__ */ D("div", {
|
|
780
1195
|
className: "flex flex-col gap-1 py-4",
|
|
781
1196
|
children: [/* @__PURE__ */ E("span", {
|
|
782
1197
|
className: "text-3xl font-semibold tabular-nums",
|
|
783
|
-
children: Number.isFinite(n) ? new Intl.NumberFormat().format(n) : String(t ?? "—")
|
|
1198
|
+
children: Number.isFinite(n) ? new Intl.NumberFormat(y).format(n) : String(t ?? "—")
|
|
784
1199
|
}), /* @__PURE__ */ E("span", {
|
|
785
1200
|
className: "text-xs text-muted-foreground",
|
|
786
1201
|
children: String(i)
|
|
@@ -788,167 +1203,246 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
788
1203
|
})
|
|
789
1204
|
});
|
|
790
1205
|
}
|
|
791
|
-
if (
|
|
792
|
-
className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${
|
|
1206
|
+
if (g && gt.has(g)) return /* @__PURE__ */ D("div", {
|
|
1207
|
+
className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${s ?? ""}`,
|
|
793
1208
|
"data-testid": "advanced-chart-tabular-notice",
|
|
794
1209
|
role: "note",
|
|
795
1210
|
children: [
|
|
796
1211
|
"Chart type “",
|
|
797
|
-
|
|
1212
|
+
g,
|
|
798
1213
|
"” is tabular — render it with the data-table / pivot components; a chart block draws series charts."
|
|
799
1214
|
]
|
|
800
1215
|
});
|
|
801
|
-
if (
|
|
802
|
-
className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${
|
|
1216
|
+
if (!g || !mt.has(g)) return /* @__PURE__ */ E("div", {
|
|
1217
|
+
className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${s ?? ""}`,
|
|
803
1218
|
"data-testid": "advanced-chart-unknown-type",
|
|
804
1219
|
role: "note",
|
|
805
|
-
children: [
|
|
1220
|
+
children: g ? /* @__PURE__ */ D(T, { children: [
|
|
806
1221
|
"Chart type “",
|
|
807
|
-
|
|
1222
|
+
g,
|
|
808
1223
|
"” is not a spec chart type — nothing was drawn."
|
|
809
|
-
]
|
|
1224
|
+
] }) : /* @__PURE__ */ E(T, { children: "This chart names no chart type — nothing was drawn." })
|
|
810
1225
|
});
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
1226
|
+
let Tt = {
|
|
1227
|
+
bar: Pe,
|
|
1228
|
+
"horizontal-bar": Pe,
|
|
1229
|
+
line: He,
|
|
1230
|
+
area: Me,
|
|
1231
|
+
pie: We,
|
|
1232
|
+
donut: We,
|
|
1233
|
+
radar: Ye,
|
|
1234
|
+
scatter: j,
|
|
1235
|
+
funnel: k,
|
|
1236
|
+
combo: Le,
|
|
1237
|
+
treemap: Pe,
|
|
1238
|
+
sankey: Pe
|
|
1239
|
+
}[g] || Pe;
|
|
1240
|
+
if (g === "pie" || g === "donut") {
|
|
1241
|
+
let e = g === "donut" ? "52%" : 0, t = nt(), n = a[0]?.dataKey || "value", o = rn(v, n);
|
|
1242
|
+
if (o.total > 0 && o.sizable === 0) return /* @__PURE__ */ E(an, {
|
|
1243
|
+
dataKey: n,
|
|
1244
|
+
className: s
|
|
1245
|
+
});
|
|
1246
|
+
let c = { ...r };
|
|
1247
|
+
v.forEach((e, n) => {
|
|
1248
|
+
let r = e?.[i];
|
|
1249
|
+
if (r == null || r === "") return;
|
|
1250
|
+
let a = String(r);
|
|
1251
|
+
c[a] || (c[a] = {
|
|
1252
|
+
label: a,
|
|
1253
|
+
color: Se(r, n, t)
|
|
820
1254
|
});
|
|
821
|
-
})
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
1255
|
+
});
|
|
1256
|
+
let l = /* @__PURE__ */ E(Dt, {
|
|
1257
|
+
config: c,
|
|
1258
|
+
className: s,
|
|
1259
|
+
...x,
|
|
1260
|
+
children: /* @__PURE__ */ D(We, { children: [
|
|
1261
|
+
/* @__PURE__ */ E(Pt, {
|
|
827
1262
|
cursor: !1,
|
|
828
|
-
content: /* @__PURE__ */ E(
|
|
1263
|
+
content: /* @__PURE__ */ E(Ot, { hideLabel: !0 })
|
|
829
1264
|
}),
|
|
830
|
-
/* @__PURE__ */ E(
|
|
831
|
-
data:
|
|
832
|
-
dataKey:
|
|
1265
|
+
/* @__PURE__ */ E(Ue, {
|
|
1266
|
+
data: v,
|
|
1267
|
+
dataKey: n,
|
|
833
1268
|
nameKey: i || "name",
|
|
834
1269
|
innerRadius: e,
|
|
835
1270
|
strokeWidth: 5,
|
|
836
1271
|
paddingAngle: 2,
|
|
837
1272
|
outerRadius: "85%",
|
|
838
|
-
...
|
|
839
|
-
...
|
|
840
|
-
children:
|
|
841
|
-
let r =
|
|
842
|
-
return /* @__PURE__ */ E(
|
|
1273
|
+
...b,
|
|
1274
|
+
...xe,
|
|
1275
|
+
children: v.map((e, n) => {
|
|
1276
|
+
let r = Se(e?.[i], n, t);
|
|
1277
|
+
return /* @__PURE__ */ E(Ie, { fill: $(r) }, `cell-${n}`);
|
|
843
1278
|
})
|
|
844
1279
|
}),
|
|
845
|
-
|
|
1280
|
+
yt ? /* @__PURE__ */ E(Ft, {
|
|
846
1281
|
verticalAlign: "bottom",
|
|
847
1282
|
wrapperStyle: {
|
|
848
|
-
fontSize:
|
|
1283
|
+
fontSize: S ? "11px" : "12px",
|
|
849
1284
|
paddingTop: "8px"
|
|
850
1285
|
},
|
|
851
|
-
content: /* @__PURE__ */ E(
|
|
1286
|
+
content: /* @__PURE__ */ E(kt, {
|
|
852
1287
|
nameKey: i,
|
|
853
1288
|
className: "flex-wrap"
|
|
854
1289
|
})
|
|
855
1290
|
}) : null
|
|
856
1291
|
] })
|
|
857
1292
|
});
|
|
1293
|
+
return /* @__PURE__ */ E(nn, {
|
|
1294
|
+
note: on(o.sizable, o.total, n),
|
|
1295
|
+
children: l
|
|
1296
|
+
});
|
|
858
1297
|
}
|
|
859
|
-
if (
|
|
860
|
-
let e = a[0]?.dataKey || "value",
|
|
861
|
-
|
|
1298
|
+
if (g === "funnel") {
|
|
1299
|
+
let e = a[0]?.dataKey || "value", t = nt(), c = rn(v, e);
|
|
1300
|
+
if (c.total > 0 && c.sizable === 0) return /* @__PURE__ */ E(an, {
|
|
1301
|
+
dataKey: e,
|
|
1302
|
+
className: s
|
|
1303
|
+
});
|
|
1304
|
+
let l = d ? (t) => {
|
|
1305
|
+
t && d({
|
|
862
1306
|
category: t?.payload?.[i] ?? t?.[i],
|
|
1307
|
+
categoryId: o(t?.payload) ?? o(t),
|
|
863
1308
|
value: t?.payload?.[e] ?? t?.[e]
|
|
864
1309
|
});
|
|
865
|
-
} : void 0,
|
|
866
|
-
onClick:
|
|
1310
|
+
} : void 0, f = l ? {
|
|
1311
|
+
onClick: l,
|
|
867
1312
|
style: { cursor: "pointer" }
|
|
868
|
-
} : {},
|
|
1313
|
+
} : {}, p = n(u), m = p ? [...v].sort((e, t) => (p.get(String(e?.[i] ?? "")) ?? 2 ** 53 - 1) - (p.get(String(t?.[i] ?? "")) ?? 2 ** 53 - 1)) : [...v].sort((t, n) => {
|
|
869
1314
|
let r = Number(t?.[e] ?? 0);
|
|
870
1315
|
return Number(n?.[e] ?? 0) - r;
|
|
871
|
-
})
|
|
872
|
-
return /* @__PURE__ */ E(X, {
|
|
1316
|
+
}), h = /* @__PURE__ */ E(Dt, {
|
|
873
1317
|
config: r,
|
|
874
|
-
className:
|
|
875
|
-
...
|
|
876
|
-
children: /* @__PURE__ */ D(
|
|
1318
|
+
className: s,
|
|
1319
|
+
...x,
|
|
1320
|
+
children: /* @__PURE__ */ D(k, { children: [/* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }), /* @__PURE__ */ D(Re, {
|
|
877
1321
|
dataKey: e,
|
|
878
|
-
data:
|
|
1322
|
+
data: m,
|
|
879
1323
|
nameKey: i,
|
|
880
|
-
...
|
|
881
|
-
...
|
|
882
|
-
children: [/* @__PURE__ */ E(
|
|
1324
|
+
...b,
|
|
1325
|
+
...f,
|
|
1326
|
+
children: [/* @__PURE__ */ E(ze, {
|
|
883
1327
|
position: "right",
|
|
884
1328
|
fill: "hsl(var(--foreground))",
|
|
885
1329
|
stroke: "none",
|
|
886
1330
|
dataKey: i
|
|
887
|
-
}),
|
|
1331
|
+
}), m.map((e, n) => /* @__PURE__ */ E(Ie, { fill: $(t[n % t.length]) }, `funnel-cell-${n}`))]
|
|
888
1332
|
})] })
|
|
889
1333
|
});
|
|
1334
|
+
return /* @__PURE__ */ E(nn, {
|
|
1335
|
+
note: on(c.sizable, c.total, e),
|
|
1336
|
+
children: h
|
|
1337
|
+
});
|
|
890
1338
|
}
|
|
891
|
-
if (
|
|
892
|
-
let e = a[0]?.dataKey || "value", t =
|
|
1339
|
+
if (g === "treemap") {
|
|
1340
|
+
let e = a[0]?.dataKey || "value", t = nt(), n = rn(v, e);
|
|
1341
|
+
if (n.total > 0 && n.sizable === 0) return /* @__PURE__ */ E(an, {
|
|
1342
|
+
dataKey: e,
|
|
1343
|
+
className: s
|
|
1344
|
+
});
|
|
1345
|
+
let o = v.map((n, r) => ({
|
|
893
1346
|
name: String(n?.[i] ?? ""),
|
|
894
1347
|
size: Number(n?.[e]) || 0,
|
|
895
|
-
fill:
|
|
896
|
-
}))
|
|
897
|
-
return /* @__PURE__ */ E(X, {
|
|
1348
|
+
fill: $(t[r % t.length])
|
|
1349
|
+
})), c = /* @__PURE__ */ E(Dt, {
|
|
898
1350
|
config: r,
|
|
899
|
-
className:
|
|
900
|
-
...
|
|
901
|
-
children: /* @__PURE__ */ E(
|
|
902
|
-
data:
|
|
1351
|
+
className: s,
|
|
1352
|
+
...x,
|
|
1353
|
+
children: /* @__PURE__ */ E(et, {
|
|
1354
|
+
data: o,
|
|
903
1355
|
dataKey: "size",
|
|
904
1356
|
nameKey: "name",
|
|
905
|
-
...
|
|
906
|
-
content: /* @__PURE__ */ E(
|
|
907
|
-
...
|
|
1357
|
+
...b,
|
|
1358
|
+
content: /* @__PURE__ */ E(en, {}),
|
|
1359
|
+
...Oe,
|
|
908
1360
|
children: /* @__PURE__ */ E(M, {})
|
|
909
1361
|
})
|
|
910
1362
|
});
|
|
1363
|
+
return /* @__PURE__ */ E(nn, {
|
|
1364
|
+
note: on(n.sizable, n.total, e),
|
|
1365
|
+
children: c
|
|
1366
|
+
});
|
|
911
1367
|
}
|
|
912
|
-
if (
|
|
913
|
-
let e = a[0]?.dataKey || "value", t = a[0]?.label || e, n =
|
|
1368
|
+
if (g === "sankey") {
|
|
1369
|
+
let e = a[0]?.dataKey || "value", t = a[0]?.label || e, n = v.filter((t) => (Number(t?.[e]) || 0) > 0), o = [{ name: t }, ...n.map((e) => ({ name: String(e?.[i] ?? "") }))], c = n.map((t, n) => ({
|
|
914
1370
|
source: 0,
|
|
915
1371
|
target: n + 1,
|
|
916
1372
|
value: Number(t?.[e]) || 0
|
|
917
1373
|
}));
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
className:
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1374
|
+
if (c.length === 0) return v.length === 0 ? /* @__PURE__ */ E("div", { className: s }) : /* @__PURE__ */ D(Q, {
|
|
1375
|
+
code: "no-positive-flow",
|
|
1376
|
+
className: s,
|
|
1377
|
+
children: [
|
|
1378
|
+
"This chart has no flow to draw: no row's",
|
|
1379
|
+
" ",
|
|
1380
|
+
/* @__PURE__ */ E("code", {
|
|
1381
|
+
className: "font-mono",
|
|
1382
|
+
children: e
|
|
1383
|
+
}),
|
|
1384
|
+
" is above zero."
|
|
1385
|
+
]
|
|
1386
|
+
});
|
|
1387
|
+
let l = v.length - n.length;
|
|
1388
|
+
return /* @__PURE__ */ E(nn, {
|
|
1389
|
+
note: l > 0 ? /* @__PURE__ */ D("p", {
|
|
1390
|
+
role: "note",
|
|
1391
|
+
"data-chart-note": "omitted-rows",
|
|
1392
|
+
className: "px-1 text-xs text-muted-foreground",
|
|
1393
|
+
children: [
|
|
1394
|
+
"Showing ",
|
|
1395
|
+
n.length,
|
|
1396
|
+
" of ",
|
|
1397
|
+
v.length,
|
|
1398
|
+
" rows — ",
|
|
1399
|
+
l,
|
|
1400
|
+
" ",
|
|
1401
|
+
l === 1 ? "row has" : "rows have",
|
|
1402
|
+
" no",
|
|
1403
|
+
" ",
|
|
1404
|
+
/* @__PURE__ */ E("code", {
|
|
1405
|
+
className: "font-mono",
|
|
1406
|
+
children: e
|
|
1407
|
+
}),
|
|
1408
|
+
" above zero, which a flow cannot draw."
|
|
1409
|
+
]
|
|
1410
|
+
}) : null,
|
|
1411
|
+
children: /* @__PURE__ */ E(Dt, {
|
|
1412
|
+
config: r,
|
|
1413
|
+
className: s,
|
|
1414
|
+
...x,
|
|
1415
|
+
children: /* @__PURE__ */ E($e, {
|
|
1416
|
+
data: {
|
|
1417
|
+
nodes: o,
|
|
1418
|
+
links: c
|
|
1419
|
+
},
|
|
1420
|
+
nodePadding: 24,
|
|
1421
|
+
link: {
|
|
1422
|
+
stroke: "hsl(var(--muted-foreground))",
|
|
1423
|
+
strokeOpacity: .25
|
|
1424
|
+
},
|
|
1425
|
+
node: { fill: "hsl(var(--chart-1))" },
|
|
1426
|
+
...ke,
|
|
1427
|
+
children: /* @__PURE__ */ E(M, {})
|
|
1428
|
+
})
|
|
935
1429
|
})
|
|
936
1430
|
});
|
|
937
1431
|
}
|
|
938
|
-
if (
|
|
1432
|
+
if (g === "radar") return /* @__PURE__ */ E(Dt, {
|
|
939
1433
|
config: r,
|
|
940
|
-
className:
|
|
941
|
-
...
|
|
942
|
-
children: /* @__PURE__ */ D(
|
|
943
|
-
data:
|
|
1434
|
+
className: s,
|
|
1435
|
+
...x,
|
|
1436
|
+
children: /* @__PURE__ */ D(Ye, {
|
|
1437
|
+
data: v,
|
|
944
1438
|
children: [
|
|
945
|
-
/* @__PURE__ */ E(
|
|
946
|
-
/* @__PURE__ */ E(
|
|
947
|
-
/* @__PURE__ */ E(
|
|
948
|
-
/* @__PURE__ */ E(
|
|
949
|
-
/* @__PURE__ */ E(
|
|
950
|
-
content: /* @__PURE__ */ E(
|
|
951
|
-
...
|
|
1439
|
+
/* @__PURE__ */ E(Ke, {}),
|
|
1440
|
+
/* @__PURE__ */ E(Ge, { dataKey: i }),
|
|
1441
|
+
/* @__PURE__ */ E(qe, {}),
|
|
1442
|
+
/* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }),
|
|
1443
|
+
/* @__PURE__ */ E(Ft, {
|
|
1444
|
+
content: /* @__PURE__ */ E(kt, {}),
|
|
1445
|
+
...S && {
|
|
952
1446
|
verticalAlign: "bottom",
|
|
953
1447
|
wrapperStyle: {
|
|
954
1448
|
fontSize: "11px",
|
|
@@ -957,335 +1451,501 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
|
|
|
957
1451
|
}
|
|
958
1452
|
}),
|
|
959
1453
|
a.map((e) => {
|
|
960
|
-
let t =
|
|
961
|
-
return /* @__PURE__ */ E(
|
|
1454
|
+
let t = $(r[e.dataKey]?.color || En), n = On(e, "radar");
|
|
1455
|
+
return /* @__PURE__ */ E(Je, {
|
|
962
1456
|
dataKey: e.dataKey,
|
|
963
1457
|
stroke: t,
|
|
964
1458
|
fill: t,
|
|
965
|
-
fillOpacity: .6,
|
|
966
|
-
|
|
1459
|
+
fillOpacity: n.fillOpacity ?? .6,
|
|
1460
|
+
strokeOpacity: n.strokeOpacity,
|
|
1461
|
+
strokeDasharray: n.strokeDasharray,
|
|
1462
|
+
...b
|
|
967
1463
|
}, e.dataKey);
|
|
968
1464
|
})
|
|
969
1465
|
]
|
|
970
1466
|
})
|
|
971
1467
|
});
|
|
972
|
-
if (
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
content: /* @__PURE__ */ E(st, {}),
|
|
1002
|
-
...w && {
|
|
1003
|
-
verticalAlign: "bottom",
|
|
1004
|
-
wrapperStyle: {
|
|
1005
|
-
fontSize: "11px",
|
|
1006
|
-
paddingTop: "8px"
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}),
|
|
1010
|
-
a.map((e, t) => {
|
|
1011
|
-
let n = I(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = Ot(e, "scatter");
|
|
1012
|
-
return /* @__PURE__ */ E(Pe, {
|
|
1013
|
-
name: r[e.dataKey]?.label || e.dataKey,
|
|
1014
|
-
data: x,
|
|
1015
|
-
fill: i,
|
|
1016
|
-
fillOpacity: a?.fillOpacity,
|
|
1017
|
-
...S,
|
|
1018
|
-
...Me
|
|
1019
|
-
}, e.dataKey);
|
|
1020
|
-
})
|
|
1021
|
-
] })
|
|
1022
|
-
});
|
|
1023
|
-
if (y === "combo") return /* @__PURE__ */ E(St, {
|
|
1024
|
-
title: te,
|
|
1025
|
-
subtitle: g,
|
|
1026
|
-
children: /* @__PURE__ */ E(X, {
|
|
1027
|
-
config: r,
|
|
1028
|
-
className: o,
|
|
1029
|
-
...C,
|
|
1030
|
-
children: /* @__PURE__ */ D(ve, {
|
|
1031
|
-
data: x,
|
|
1032
|
-
children: [
|
|
1033
|
-
/* @__PURE__ */ E(ge, { ...We }),
|
|
1034
|
-
/* @__PURE__ */ E(P, {
|
|
1468
|
+
if (g === "scatter") {
|
|
1469
|
+
if (a.length > 1) return /* @__PURE__ */ E(gn, {
|
|
1470
|
+
seriesKeys: a.map((e) => String(e.dataKey)),
|
|
1471
|
+
className: s
|
|
1472
|
+
});
|
|
1473
|
+
let e = a[0]?.dataKey || "value", t = cn(v, i, e), n = v.map((e) => Number(e?.[i])).filter((e) => Number.isFinite(e)), o = W(p?.format, y);
|
|
1474
|
+
if (t.total > 0 && t.plottable === 0) return /* @__PURE__ */ E(ln, {
|
|
1475
|
+
xKey: i,
|
|
1476
|
+
yKey: e,
|
|
1477
|
+
className: s
|
|
1478
|
+
});
|
|
1479
|
+
if (t.total > 0) {
|
|
1480
|
+
let n = [[i, p], [e, m?.[0]]].filter(([e, t]) => !fn(t) && !pn(v, e)).map(([e]) => e).filter((e, t, n) => n.indexOf(e) === t);
|
|
1481
|
+
if (n.length > 0) return /* @__PURE__ */ E(hn, {
|
|
1482
|
+
keys: n,
|
|
1483
|
+
total: t.total,
|
|
1484
|
+
className: s
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
return /* @__PURE__ */ E(nn, {
|
|
1488
|
+
note: Qt(_n(t.plottable, t.total, i, e), Y, V),
|
|
1489
|
+
children: /* @__PURE__ */ E(Dt, {
|
|
1490
|
+
config: r,
|
|
1491
|
+
className: s,
|
|
1492
|
+
...x,
|
|
1493
|
+
children: /* @__PURE__ */ D(j, { children: [
|
|
1494
|
+
/* @__PURE__ */ E(O, { ...vt }),
|
|
1495
|
+
/* @__PURE__ */ E(N, {
|
|
1496
|
+
type: "number",
|
|
1035
1497
|
dataKey: i,
|
|
1036
|
-
|
|
1037
|
-
}),
|
|
1038
|
-
/* @__PURE__ */ E(F, {
|
|
1039
|
-
yAxisId: "left",
|
|
1498
|
+
name: String(r[i]?.label || i),
|
|
1040
1499
|
tickLine: !1,
|
|
1041
1500
|
axisLine: !1,
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
...
|
|
1501
|
+
minTickGap: S ? 32 : 48,
|
|
1502
|
+
padding: Ln,
|
|
1503
|
+
...o ? { tickFormatter: o } : {},
|
|
1504
|
+
...K ? { orientation: K } : {},
|
|
1505
|
+
...$t(p, n, Ut(K))
|
|
1045
1506
|
}),
|
|
1046
|
-
/* @__PURE__ */ E(
|
|
1047
|
-
|
|
1048
|
-
|
|
1507
|
+
/* @__PURE__ */ E(P, {
|
|
1508
|
+
type: "number",
|
|
1509
|
+
dataKey: e,
|
|
1510
|
+
name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
|
|
1049
1511
|
tickLine: !1,
|
|
1050
1512
|
axisLine: !1,
|
|
1051
|
-
tickFormatter:
|
|
1513
|
+
tickFormatter: st,
|
|
1052
1514
|
width: 48,
|
|
1053
|
-
|
|
1515
|
+
padding: Rn,
|
|
1516
|
+
...B === "right" ? { orientation: "right" } : {},
|
|
1517
|
+
...G(F, B)
|
|
1054
1518
|
}),
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
content: /* @__PURE__ */ E(
|
|
1058
|
-
...
|
|
1519
|
+
/* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }),
|
|
1520
|
+
/* @__PURE__ */ E(Ft, {
|
|
1521
|
+
content: /* @__PURE__ */ E(kt, { nameKey: e }),
|
|
1522
|
+
...S && {
|
|
1059
1523
|
verticalAlign: "bottom",
|
|
1060
1524
|
wrapperStyle: {
|
|
1061
1525
|
fontSize: "11px",
|
|
1062
1526
|
paddingTop: "8px"
|
|
1063
1527
|
}
|
|
1064
1528
|
}
|
|
1065
|
-
})
|
|
1066
|
-
K,
|
|
1067
|
-
J,
|
|
1529
|
+
}),
|
|
1068
1530
|
a.map((e, t) => {
|
|
1069
|
-
let n =
|
|
1070
|
-
return
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
...S,
|
|
1080
|
-
children: Y(c)
|
|
1081
|
-
}, e.dataKey) : i === "area" ? /* @__PURE__ */ E(O, {
|
|
1082
|
-
yAxisId: a,
|
|
1083
|
-
type: "monotone",
|
|
1084
|
-
dataKey: e.dataKey,
|
|
1085
|
-
fill: n,
|
|
1086
|
-
stroke: n,
|
|
1087
|
-
fillOpacity: o?.fillOpacity ?? .4,
|
|
1088
|
-
strokeOpacity: o?.strokeOpacity,
|
|
1089
|
-
strokeDasharray: o?.strokeDasharray,
|
|
1090
|
-
...s,
|
|
1091
|
-
...S,
|
|
1092
|
-
children: Y(c)
|
|
1093
|
-
}, e.dataKey) : /* @__PURE__ */ E(me, {
|
|
1094
|
-
yAxisId: a,
|
|
1095
|
-
dataKey: e.dataKey,
|
|
1096
|
-
fill: n,
|
|
1097
|
-
radius: 4,
|
|
1098
|
-
fillOpacity: o?.fillOpacity,
|
|
1099
|
-
...s,
|
|
1100
|
-
...S,
|
|
1101
|
-
children: Y(c)
|
|
1531
|
+
let n = nt(), i = $(r[e.dataKey]?.color || n[t % n.length]), a = On(e, "scatter");
|
|
1532
|
+
return /* @__PURE__ */ E(A, {
|
|
1533
|
+
name: r[e.dataKey]?.label || e.dataKey,
|
|
1534
|
+
data: v,
|
|
1535
|
+
fill: i,
|
|
1536
|
+
fillOpacity: a.fillOpacity,
|
|
1537
|
+
strokeOpacity: a.strokeOpacity,
|
|
1538
|
+
strokeDasharray: a.strokeDasharray,
|
|
1539
|
+
...b,
|
|
1540
|
+
...Ee
|
|
1102
1541
|
}, e.dataKey);
|
|
1103
1542
|
})
|
|
1104
|
-
]
|
|
1543
|
+
] })
|
|
1105
1544
|
})
|
|
1106
|
-
})
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
id: `bg-${it(e)}`,
|
|
1127
|
-
x1: "0",
|
|
1128
|
-
y1: "0",
|
|
1129
|
-
x2: "0",
|
|
1130
|
-
y2: "1",
|
|
1131
|
-
children: [/* @__PURE__ */ E("stop", {
|
|
1132
|
-
offset: "0%",
|
|
1133
|
-
style: { stopColor: e },
|
|
1134
|
-
stopOpacity: .95
|
|
1135
|
-
}), /* @__PURE__ */ E("stop", {
|
|
1136
|
-
offset: "100%",
|
|
1137
|
-
style: { stopColor: e },
|
|
1138
|
-
stopOpacity: .5
|
|
1139
|
-
})]
|
|
1140
|
-
}), /* @__PURE__ */ D("linearGradient", {
|
|
1141
|
-
id: `ag-${it(e)}`,
|
|
1142
|
-
x1: "0",
|
|
1143
|
-
y1: "0",
|
|
1144
|
-
x2: "0",
|
|
1145
|
-
y2: "1",
|
|
1146
|
-
children: [/* @__PURE__ */ E("stop", {
|
|
1147
|
-
offset: "0%",
|
|
1148
|
-
style: { stopColor: e },
|
|
1149
|
-
stopOpacity: .5
|
|
1150
|
-
}), /* @__PURE__ */ E("stop", {
|
|
1151
|
-
offset: "95%",
|
|
1152
|
-
style: { stopColor: e },
|
|
1153
|
-
stopOpacity: .05
|
|
1154
|
-
})]
|
|
1155
|
-
})] }, it(e))) }),
|
|
1156
|
-
/* @__PURE__ */ E(ge, { ...We }),
|
|
1157
|
-
et ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(P, {
|
|
1158
|
-
type: "number",
|
|
1159
|
-
tickLine: !1,
|
|
1160
|
-
axisLine: !1,
|
|
1161
|
-
tickFormatter: V,
|
|
1162
|
-
...W(L)
|
|
1163
|
-
}), /* @__PURE__ */ E(F, {
|
|
1164
|
-
type: "category",
|
|
1165
|
-
dataKey: i,
|
|
1166
|
-
tickLine: !1,
|
|
1167
|
-
axisLine: !1,
|
|
1168
|
-
width: Math.min(140, Math.max(60, Math.max(...x.map((e) => String(e[i] ?? "").length)) * 7)),
|
|
1169
|
-
tickFormatter: B
|
|
1170
|
-
})] }) : /* @__PURE__ */ D(T, { children: [
|
|
1171
|
-
/* @__PURE__ */ E(P, {
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
if (g === "combo") return /* @__PURE__ */ E(tn, {
|
|
1548
|
+
title: ne,
|
|
1549
|
+
subtitle: re,
|
|
1550
|
+
children: /* @__PURE__ */ E(nn, {
|
|
1551
|
+
note: Qt(Y, V),
|
|
1552
|
+
children: /* @__PURE__ */ E(Dt, {
|
|
1553
|
+
config: r,
|
|
1554
|
+
className: s,
|
|
1555
|
+
...x,
|
|
1556
|
+
children: /* @__PURE__ */ D(Le, {
|
|
1557
|
+
data: v,
|
|
1558
|
+
...ye,
|
|
1559
|
+
children: [
|
|
1560
|
+
/* @__PURE__ */ E(O, {
|
|
1561
|
+
...vt,
|
|
1562
|
+
...Yt(at, I)
|
|
1563
|
+
}),
|
|
1564
|
+
/* @__PURE__ */ E(N, {
|
|
1172
1565
|
dataKey: i,
|
|
1173
|
-
|
|
1566
|
+
...wt
|
|
1174
1567
|
}),
|
|
1175
|
-
/* @__PURE__ */ E(
|
|
1176
|
-
|
|
1568
|
+
/* @__PURE__ */ E(P, {
|
|
1569
|
+
yAxisId: "left",
|
|
1177
1570
|
tickLine: !1,
|
|
1178
1571
|
axisLine: !1,
|
|
1179
|
-
tickFormatter:
|
|
1572
|
+
tickFormatter: ct,
|
|
1180
1573
|
width: 48,
|
|
1181
|
-
...
|
|
1574
|
+
...G(R, "left")
|
|
1182
1575
|
}),
|
|
1183
|
-
|
|
1576
|
+
/* @__PURE__ */ E(P, {
|
|
1184
1577
|
yAxisId: "right",
|
|
1185
1578
|
orientation: "right",
|
|
1186
1579
|
tickLine: !1,
|
|
1187
1580
|
axisLine: !1,
|
|
1188
|
-
tickFormatter:
|
|
1581
|
+
tickFormatter: ut,
|
|
1189
1582
|
width: 48,
|
|
1190
|
-
...
|
|
1191
|
-
})
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1583
|
+
...G(z, "right")
|
|
1584
|
+
}),
|
|
1585
|
+
xt ? /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }) : null,
|
|
1586
|
+
yt ? /* @__PURE__ */ E(Ft, {
|
|
1587
|
+
content: /* @__PURE__ */ E(kt, {}),
|
|
1588
|
+
...S && {
|
|
1589
|
+
verticalAlign: "bottom",
|
|
1590
|
+
wrapperStyle: {
|
|
1591
|
+
fontSize: "11px",
|
|
1592
|
+
paddingTop: "8px"
|
|
1593
|
+
}
|
|
1201
1594
|
}
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && x.length > 1, r = Ot(e, "bar");
|
|
1210
|
-
return /* @__PURE__ */ D(me, {
|
|
1211
|
-
dataKey: e.dataKey,
|
|
1212
|
-
fill: `url(#bg-${it(l)})`,
|
|
1213
|
-
radius: 4,
|
|
1214
|
-
fillOpacity: r?.fillOpacity,
|
|
1215
|
-
...d,
|
|
1216
|
-
...u,
|
|
1217
|
-
...S,
|
|
1218
|
-
children: [t && x.map((e, t) => /* @__PURE__ */ E(_e, { fill: `url(#bg-${it(Q(ue(e?.[i], t, n)))})` }, `cell-${t}`)), Y(f)]
|
|
1219
|
-
}, e.dataKey);
|
|
1220
|
-
}
|
|
1221
|
-
if (y === "line") {
|
|
1222
|
-
let t = Ot(e, "line");
|
|
1223
|
-
return /* @__PURE__ */ E(xe, {
|
|
1595
|
+
}) : null,
|
|
1596
|
+
bt,
|
|
1597
|
+
St,
|
|
1598
|
+
a.map((e, t) => {
|
|
1599
|
+
let n = $(r[e.dataKey]?.color || En), i = e.chartType || le || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : le || i === "bar" ? "left" : "right", o = On(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = W((a === "right" ? z : R)?.format, y);
|
|
1600
|
+
return i === "line" ? /* @__PURE__ */ E(Ve, {
|
|
1601
|
+
yAxisId: a,
|
|
1224
1602
|
type: "monotone",
|
|
1225
1603
|
dataKey: e.dataKey,
|
|
1226
|
-
stroke:
|
|
1604
|
+
stroke: n,
|
|
1227
1605
|
strokeWidth: 2,
|
|
1228
1606
|
dot: !1,
|
|
1229
|
-
strokeOpacity:
|
|
1230
|
-
strokeDasharray:
|
|
1231
|
-
...
|
|
1232
|
-
...
|
|
1233
|
-
children:
|
|
1234
|
-
}, e.dataKey)
|
|
1235
|
-
|
|
1236
|
-
if (y === "area") {
|
|
1237
|
-
let t = Ot(e, "area");
|
|
1238
|
-
return /* @__PURE__ */ E(O, {
|
|
1607
|
+
strokeOpacity: o.strokeOpacity,
|
|
1608
|
+
strokeDasharray: o.strokeDasharray,
|
|
1609
|
+
...b,
|
|
1610
|
+
...be(e),
|
|
1611
|
+
children: Ct(c)
|
|
1612
|
+
}, e.dataKey) : i === "area" ? /* @__PURE__ */ E(je, {
|
|
1613
|
+
yAxisId: a,
|
|
1239
1614
|
type: "monotone",
|
|
1240
1615
|
dataKey: e.dataKey,
|
|
1241
|
-
fill:
|
|
1242
|
-
stroke:
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
...
|
|
1248
|
-
...
|
|
1249
|
-
|
|
1250
|
-
|
|
1616
|
+
fill: n,
|
|
1617
|
+
stroke: n,
|
|
1618
|
+
fillOpacity: o.fillOpacity ?? .4,
|
|
1619
|
+
strokeOpacity: o.strokeOpacity,
|
|
1620
|
+
strokeDasharray: o.strokeDasharray,
|
|
1621
|
+
...s,
|
|
1622
|
+
...b,
|
|
1623
|
+
...be(e),
|
|
1624
|
+
children: Ct(c)
|
|
1625
|
+
}, e.dataKey) : /* @__PURE__ */ E(Ne, {
|
|
1626
|
+
yAxisId: a,
|
|
1627
|
+
dataKey: e.dataKey,
|
|
1628
|
+
fill: n,
|
|
1629
|
+
radius: 4,
|
|
1630
|
+
fillOpacity: o.fillOpacity,
|
|
1631
|
+
strokeOpacity: o.strokeOpacity,
|
|
1632
|
+
strokeDasharray: o.strokeDasharray,
|
|
1633
|
+
...s,
|
|
1634
|
+
...b,
|
|
1635
|
+
...be(e),
|
|
1636
|
+
children: Ct(c)
|
|
1251
1637
|
}, e.dataKey);
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
]
|
|
1638
|
+
})
|
|
1639
|
+
]
|
|
1640
|
+
})
|
|
1256
1641
|
})
|
|
1257
1642
|
})
|
|
1258
1643
|
});
|
|
1644
|
+
let Et = g === "horizontal-bar", At = nt(), X = l ? Object.values(l).map((e) => $(String(e))) : [], jt = Array.from(/* @__PURE__ */ new Set([
|
|
1645
|
+
...At,
|
|
1646
|
+
...X,
|
|
1647
|
+
...a.map((e, t) => $(r[e.dataKey]?.color || At[t % At.length] || En))
|
|
1648
|
+
])), Z = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
|
|
1649
|
+
return /* @__PURE__ */ E(tn, {
|
|
1650
|
+
title: ne,
|
|
1651
|
+
subtitle: re,
|
|
1652
|
+
children: /* @__PURE__ */ E(nn, {
|
|
1653
|
+
note: Qt(Y, V),
|
|
1654
|
+
children: /* @__PURE__ */ E(Dt, {
|
|
1655
|
+
config: r,
|
|
1656
|
+
className: s,
|
|
1657
|
+
...x,
|
|
1658
|
+
children: /* @__PURE__ */ D(Tt, {
|
|
1659
|
+
data: v,
|
|
1660
|
+
layout: Et ? "vertical" : "horizontal",
|
|
1661
|
+
...ve,
|
|
1662
|
+
children: [
|
|
1663
|
+
/* @__PURE__ */ E("defs", { children: jt.map((e) => /* @__PURE__ */ D(_.Fragment, { children: [/* @__PURE__ */ D("linearGradient", {
|
|
1664
|
+
id: `bg-${Z(e)}`,
|
|
1665
|
+
x1: "0",
|
|
1666
|
+
y1: "0",
|
|
1667
|
+
x2: "0",
|
|
1668
|
+
y2: "1",
|
|
1669
|
+
children: [/* @__PURE__ */ E("stop", {
|
|
1670
|
+
offset: "0%",
|
|
1671
|
+
style: { stopColor: e },
|
|
1672
|
+
stopOpacity: .95
|
|
1673
|
+
}), /* @__PURE__ */ E("stop", {
|
|
1674
|
+
offset: "100%",
|
|
1675
|
+
style: { stopColor: e },
|
|
1676
|
+
stopOpacity: .5
|
|
1677
|
+
})]
|
|
1678
|
+
}), /* @__PURE__ */ D("linearGradient", {
|
|
1679
|
+
id: `ag-${Z(e)}`,
|
|
1680
|
+
x1: "0",
|
|
1681
|
+
y1: "0",
|
|
1682
|
+
x2: "0",
|
|
1683
|
+
y2: "1",
|
|
1684
|
+
children: [/* @__PURE__ */ E("stop", {
|
|
1685
|
+
offset: "0%",
|
|
1686
|
+
style: { stopColor: e },
|
|
1687
|
+
stopOpacity: .5
|
|
1688
|
+
}), /* @__PURE__ */ E("stop", {
|
|
1689
|
+
offset: "95%",
|
|
1690
|
+
style: { stopColor: e },
|
|
1691
|
+
stopOpacity: .05
|
|
1692
|
+
})]
|
|
1693
|
+
})] }, Z(e))) }),
|
|
1694
|
+
/* @__PURE__ */ E(O, {
|
|
1695
|
+
...vt,
|
|
1696
|
+
...Yt(at, I)
|
|
1697
|
+
}),
|
|
1698
|
+
Et ? /* @__PURE__ */ D(T, { children: [it ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(N, {
|
|
1699
|
+
xAxisId: "left",
|
|
1700
|
+
type: "number",
|
|
1701
|
+
tickLine: !1,
|
|
1702
|
+
axisLine: !1,
|
|
1703
|
+
tickFormatter: ct,
|
|
1704
|
+
...G(R, "left", Bn)
|
|
1705
|
+
}), /* @__PURE__ */ E(N, {
|
|
1706
|
+
xAxisId: "right",
|
|
1707
|
+
orientation: "top",
|
|
1708
|
+
type: "number",
|
|
1709
|
+
tickLine: !1,
|
|
1710
|
+
axisLine: !1,
|
|
1711
|
+
tickFormatter: ut,
|
|
1712
|
+
...G(z, "right", Vn)
|
|
1713
|
+
})] }) : /* @__PURE__ */ E(N, {
|
|
1714
|
+
type: "number",
|
|
1715
|
+
tickLine: !1,
|
|
1716
|
+
axisLine: !1,
|
|
1717
|
+
tickFormatter: st,
|
|
1718
|
+
...B === "right" ? { orientation: "top" } : {},
|
|
1719
|
+
...G(F, B, Ut(B === "right" ? "top" : "bottom"))
|
|
1720
|
+
}), /* @__PURE__ */ E(P, {
|
|
1721
|
+
type: "category",
|
|
1722
|
+
dataKey: i,
|
|
1723
|
+
tickLine: !1,
|
|
1724
|
+
axisLine: !1,
|
|
1725
|
+
width: Math.min(140, Math.max(60, Math.max(...v.map((e) => String(e[i] ?? "").length)) * 7)),
|
|
1726
|
+
tickFormatter: H,
|
|
1727
|
+
...q ? { orientation: q } : {},
|
|
1728
|
+
...p?.title ? { label: {
|
|
1729
|
+
value: p.title,
|
|
1730
|
+
...Wt(q)
|
|
1731
|
+
} } : {}
|
|
1732
|
+
})] }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(N, {
|
|
1733
|
+
dataKey: i,
|
|
1734
|
+
...wt
|
|
1735
|
+
}), it ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(P, {
|
|
1736
|
+
yAxisId: "left",
|
|
1737
|
+
tickLine: !1,
|
|
1738
|
+
axisLine: !1,
|
|
1739
|
+
tickFormatter: ct,
|
|
1740
|
+
width: 48,
|
|
1741
|
+
...G(R, "left")
|
|
1742
|
+
}), /* @__PURE__ */ E(P, {
|
|
1743
|
+
yAxisId: "right",
|
|
1744
|
+
orientation: "right",
|
|
1745
|
+
tickLine: !1,
|
|
1746
|
+
axisLine: !1,
|
|
1747
|
+
tickFormatter: ut,
|
|
1748
|
+
width: 48,
|
|
1749
|
+
...G(z, "right")
|
|
1750
|
+
})] }) : /* @__PURE__ */ E(P, {
|
|
1751
|
+
tickLine: !1,
|
|
1752
|
+
axisLine: !1,
|
|
1753
|
+
tickFormatter: st,
|
|
1754
|
+
width: 48,
|
|
1755
|
+
...B === "right" ? { orientation: "right" } : {},
|
|
1756
|
+
...G(F, B)
|
|
1757
|
+
})] }),
|
|
1758
|
+
xt ? /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }) : null,
|
|
1759
|
+
yt ? /* @__PURE__ */ E(Ft, {
|
|
1760
|
+
content: /* @__PURE__ */ E(kt, {}),
|
|
1761
|
+
...S && {
|
|
1762
|
+
verticalAlign: "bottom",
|
|
1763
|
+
wrapperStyle: {
|
|
1764
|
+
fontSize: "11px",
|
|
1765
|
+
paddingTop: "8px"
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
}) : null,
|
|
1769
|
+
bt,
|
|
1770
|
+
St,
|
|
1771
|
+
a.map((e, t) => {
|
|
1772
|
+
let n = nt(), o = e.variant === "comparison", s = o ? a.slice(0, t).find((e) => e.variant !== "comparison") || a[0] : e, c = o ? a.indexOf(s) : t, l = $(r[s.dataKey]?.color || n[c % n.length] || En), u = e.yAxis === "right" ? "right" : "left", d = it ? Et ? { xAxisId: u } : { yAxisId: u } : {}, f = e.stack ? { stackId: String(e.stack) } : {}, p = W(ot(e)?.format, y);
|
|
1773
|
+
if (g === "bar" || g === "horizontal-bar") {
|
|
1774
|
+
let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && v.length > 1, r = On(e, "bar");
|
|
1775
|
+
return /* @__PURE__ */ D(Ne, {
|
|
1776
|
+
dataKey: e.dataKey,
|
|
1777
|
+
fill: `url(#bg-${Z(l)})`,
|
|
1778
|
+
radius: 4,
|
|
1779
|
+
fillOpacity: r.fillOpacity,
|
|
1780
|
+
strokeOpacity: r.strokeOpacity,
|
|
1781
|
+
strokeDasharray: r.strokeDasharray,
|
|
1782
|
+
...f,
|
|
1783
|
+
...d,
|
|
1784
|
+
...b,
|
|
1785
|
+
...pe(e),
|
|
1786
|
+
children: [t && v.map((e, t) => /* @__PURE__ */ E(Ie, { fill: `url(#bg-${Z($(Se(e?.[i], t, n)))})` }, `cell-${t}`)), Ct(p)]
|
|
1787
|
+
}, e.dataKey);
|
|
1788
|
+
}
|
|
1789
|
+
if (g === "line") {
|
|
1790
|
+
let t = On(e, "line");
|
|
1791
|
+
return /* @__PURE__ */ E(Ve, {
|
|
1792
|
+
type: "monotone",
|
|
1793
|
+
dataKey: e.dataKey,
|
|
1794
|
+
stroke: l,
|
|
1795
|
+
strokeWidth: 2,
|
|
1796
|
+
dot: !1,
|
|
1797
|
+
strokeOpacity: t.strokeOpacity,
|
|
1798
|
+
strokeDasharray: t.strokeDasharray,
|
|
1799
|
+
...d,
|
|
1800
|
+
...b,
|
|
1801
|
+
...pe(e),
|
|
1802
|
+
children: Ct(p)
|
|
1803
|
+
}, e.dataKey);
|
|
1804
|
+
}
|
|
1805
|
+
if (g === "area") {
|
|
1806
|
+
let t = On(e, "area");
|
|
1807
|
+
return /* @__PURE__ */ E(je, {
|
|
1808
|
+
type: "monotone",
|
|
1809
|
+
dataKey: e.dataKey,
|
|
1810
|
+
fill: `url(#ag-${Z(l)})`,
|
|
1811
|
+
stroke: l,
|
|
1812
|
+
strokeWidth: 2,
|
|
1813
|
+
fillOpacity: t.fillOpacity ?? 1,
|
|
1814
|
+
strokeOpacity: t.strokeOpacity,
|
|
1815
|
+
strokeDasharray: t.strokeDasharray,
|
|
1816
|
+
...f,
|
|
1817
|
+
...d,
|
|
1818
|
+
...b,
|
|
1819
|
+
...pe(e),
|
|
1820
|
+
children: Ct(p)
|
|
1821
|
+
}, e.dataKey);
|
|
1822
|
+
}
|
|
1823
|
+
return null;
|
|
1824
|
+
})
|
|
1825
|
+
]
|
|
1826
|
+
})
|
|
1827
|
+
})
|
|
1828
|
+
})
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
function yn(e) {
|
|
1832
|
+
return e.chartType === "column" ? "bar" : e.chartType;
|
|
1259
1833
|
}
|
|
1260
|
-
function
|
|
1261
|
-
let t = e
|
|
1262
|
-
return
|
|
1834
|
+
function bn(e) {
|
|
1835
|
+
let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = e.xAxisKey ?? "name";
|
|
1836
|
+
return t !== void 0 && Nn.has(t) && n.length > 0 && !n.some((e) => typeof e == "object" && !!e && r in e);
|
|
1263
1837
|
}
|
|
1264
|
-
function
|
|
1265
|
-
let t =
|
|
1266
|
-
return
|
|
1267
|
-
|
|
1838
|
+
function xn(e) {
|
|
1839
|
+
let t = yn(e), n = Array.isArray(e.data) ? e.data : [];
|
|
1840
|
+
return t === void 0 || !Kn.has(t) || n.length === 0 ? null : e.series === void 0 ? "undeclared" : Array.isArray(e.series) && e.series.length === 0 ? "empty" : null;
|
|
1841
|
+
}
|
|
1842
|
+
function Sn(e) {
|
|
1843
|
+
let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = Array.isArray(e.series) ? e.series : [];
|
|
1844
|
+
if (t === void 0 || !Kn.has(t) || n.length === 0 || r.length === 0) return null;
|
|
1845
|
+
let i = Array.from(new Set(r.map((e) => String(e.dataKey))));
|
|
1846
|
+
if (!i.every((e) => n.some((t) => typeof t == "object" && !!t && Object.prototype.hasOwnProperty.call(t, e)))) return null;
|
|
1847
|
+
let a = Array.isArray(e.yAxes) ? e.yAxes : [], o = lt(a, t), s = o.left === void 0 ? void 0 : a[o.left], c = o.right === void 0 ? void 0 : a[o.right], l = !!s && !!c, u = (e) => fn(s) || (!l || e.yAxis !== "left") && fn(c);
|
|
1848
|
+
return r.some((e, i) => mn(t, r, i) !== "none" || u(e) || pn(n, String(e.dataKey))) ? null : i;
|
|
1849
|
+
}
|
|
1850
|
+
function Cn(e) {
|
|
1851
|
+
let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = Array.isArray(e.series) ? e.series : [];
|
|
1852
|
+
if (t === void 0 || !Kn.has(t) || n.length === 0 || r.length === 0) return null;
|
|
1853
|
+
let i = Array.from(new Set(r.map((e) => e.dataKey)));
|
|
1854
|
+
return i.every((e) => typeof e == "string" && /^[^.[]+$/.test(e) && !n.some((t) => typeof t == "object" && !!t && e in t)) ? i : null;
|
|
1855
|
+
}
|
|
1856
|
+
function wn({ keys: e, className: t }) {
|
|
1857
|
+
return /* @__PURE__ */ D(Q, {
|
|
1858
|
+
code: "missing-series-key",
|
|
1859
|
+
className: t,
|
|
1860
|
+
children: [
|
|
1861
|
+
"This chart cannot plot its series: no row has a",
|
|
1862
|
+
" ",
|
|
1863
|
+
e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? " or " : "", /* @__PURE__ */ E("code", {
|
|
1864
|
+
className: "font-mono",
|
|
1865
|
+
children: e
|
|
1866
|
+
})] }, `${t}-${e}`)),
|
|
1867
|
+
" ",
|
|
1868
|
+
"field."
|
|
1869
|
+
]
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
function Q({ code: e, className: t, children: n }) {
|
|
1873
|
+
return /* @__PURE__ */ E("div", {
|
|
1874
|
+
className: `flex h-full min-h-[120px] w-full items-center justify-center p-4 text-center text-sm text-muted-foreground ${t ?? ""}`,
|
|
1875
|
+
role: "status",
|
|
1876
|
+
"data-chart-error": e,
|
|
1877
|
+
children: /* @__PURE__ */ E("span", { children: n })
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
function Tn(e) {
|
|
1881
|
+
let t = bn(e), n = t ? null : xn(e), r = t || n ? null : Cn(e), i = t || n || r ? null : Sn(e), a = e.xAxisKey ?? "name", o = _.useMemo(() => Object.keys((Array.isArray(e.data) ? e.data[0] : void 0) ?? {}), [e.data]), s = r ? JSON.stringify(r) : null, c = JSON.stringify(o);
|
|
1882
|
+
return _.useEffect(() => {
|
|
1883
|
+
t && console.warn(`[chart] no row has the category key "${a}" — rendering an explanatory placeholder instead of an empty axis. Row keys: ${JSON.stringify(o)}. A dataset query must PROJECT the dimension it groups by (framework#4033).`);
|
|
1268
1884
|
}, [
|
|
1269
1885
|
t,
|
|
1886
|
+
a,
|
|
1887
|
+
o
|
|
1888
|
+
]), _.useEffect(() => {
|
|
1889
|
+
if (n) {
|
|
1890
|
+
if (n === "undeclared") {
|
|
1891
|
+
console.warn(`[chart] no series binding was declared for the category axis "${a}" — rendering an explanatory placeholder instead of an empty frame. Row keys: ${JSON.stringify(o)}. A bar / line / area / combo chart draws only the columns its \`series\` (or \`categories\`, or a y-axis \`field\`) names (objectui#4695).`);
|
|
1892
|
+
return;
|
|
1893
|
+
}
|
|
1894
|
+
console.warn(`[chart] no series to plot against the category axis "${a}" — rendering an explanatory placeholder instead of an empty frame. Row keys: ${JSON.stringify(o)}. A grouped chart's SECOND dimension must be PROJECTED by the dataset query, and a chart with no measure selected has nothing to draw either (objectui#4683, framework#4033).`);
|
|
1895
|
+
}
|
|
1896
|
+
}, [
|
|
1270
1897
|
n,
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1898
|
+
a,
|
|
1899
|
+
o
|
|
1900
|
+
]), _.useEffect(() => {
|
|
1901
|
+
s && console.warn(`[chart] no row has the series key(s) ${s} — rendering an explanatory placeholder instead of an empty frame. Row keys: ${c}. A series \`dataKey\` must name a column the rows carry (objectui#10396).`);
|
|
1902
|
+
}, [s, c]), t ? /* @__PURE__ */ D(Q, {
|
|
1903
|
+
code: "missing-category-key",
|
|
1904
|
+
className: e.className,
|
|
1905
|
+
children: [
|
|
1277
1906
|
"This chart cannot plot its category axis: no row has a",
|
|
1278
1907
|
" ",
|
|
1279
1908
|
/* @__PURE__ */ E("code", {
|
|
1280
1909
|
className: "font-mono",
|
|
1281
|
-
children:
|
|
1910
|
+
children: a
|
|
1282
1911
|
}),
|
|
1283
1912
|
" field."
|
|
1284
|
-
]
|
|
1285
|
-
}) : /* @__PURE__ */
|
|
1913
|
+
]
|
|
1914
|
+
}) : n === "undeclared" ? /* @__PURE__ */ D(Q, {
|
|
1915
|
+
code: "no-plottable-series",
|
|
1916
|
+
className: e.className,
|
|
1917
|
+
children: [
|
|
1918
|
+
"This chart cannot plot any series: none was declared to draw against its",
|
|
1919
|
+
" ",
|
|
1920
|
+
/* @__PURE__ */ E("code", {
|
|
1921
|
+
className: "font-mono",
|
|
1922
|
+
children: a
|
|
1923
|
+
}),
|
|
1924
|
+
" axis."
|
|
1925
|
+
]
|
|
1926
|
+
}) : n === "empty" ? /* @__PURE__ */ D(Q, {
|
|
1927
|
+
code: "no-plottable-series",
|
|
1928
|
+
className: e.className,
|
|
1929
|
+
children: [
|
|
1930
|
+
"This chart cannot plot any series: no measure or group reached its",
|
|
1931
|
+
" ",
|
|
1932
|
+
/* @__PURE__ */ E("code", {
|
|
1933
|
+
className: "font-mono",
|
|
1934
|
+
children: a
|
|
1935
|
+
}),
|
|
1936
|
+
" axis."
|
|
1937
|
+
]
|
|
1938
|
+
}) : r ? /* @__PURE__ */ E(wn, {
|
|
1939
|
+
keys: r,
|
|
1940
|
+
className: e.className
|
|
1941
|
+
}) : i ? /* @__PURE__ */ E(hn, {
|
|
1942
|
+
keys: i,
|
|
1943
|
+
total: Array.isArray(e.data) ? e.data.length : 0,
|
|
1944
|
+
className: e.className
|
|
1945
|
+
}) : /* @__PURE__ */ E(vn, { ...e });
|
|
1286
1946
|
}
|
|
1287
|
-
var
|
|
1288
|
-
|
|
1947
|
+
var En, Dn, $, On, kn, An, jn, Mn, Nn, Pn, Fn, In, Ln, Rn, zn, Bn, Vn, Hn, Un, Wn, Gn, Kn, qn = V((() => {
|
|
1948
|
+
It(), Vt(), bt(), En = "hsl(var(--primary))", Dn = {
|
|
1289
1949
|
slate: "#64748b",
|
|
1290
1950
|
gray: "#6b7280",
|
|
1291
1951
|
zinc: "#71717a",
|
|
@@ -1308,11 +1968,34 @@ var Et, Dt, Q, Ot, kt, At = V((() => {
|
|
|
1308
1968
|
fuchsia: "#d946ef",
|
|
1309
1969
|
pink: "#ec4899",
|
|
1310
1970
|
rose: "#f43f5e"
|
|
1311
|
-
},
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1971
|
+
}, $ = (e) => Dn[e] || e, On = (e, t) => {
|
|
1972
|
+
let n = e?.variant === "comparison", r = t === "area" || t === "radar", i = typeof e?.opacity == "number" ? e.opacity : void 0;
|
|
1973
|
+
return {
|
|
1974
|
+
strokeOpacity: i ?? (n ? t === "line" ? .5 : r ? .6 : void 0 : void 0),
|
|
1975
|
+
fillOpacity: i ?? (n ? t === "bar" ? .4 : r ? .2 : .5 : void 0),
|
|
1976
|
+
strokeDasharray: e?.dashArray ?? (n && (t === "line" || r) ? "4 4" : void 0)
|
|
1977
|
+
};
|
|
1978
|
+
}, kn = (e, t) => {
|
|
1979
|
+
if (typeof e == "string" || typeof e == "number") {
|
|
1980
|
+
let t = String(e);
|
|
1981
|
+
if (t !== "") return t;
|
|
1982
|
+
}
|
|
1983
|
+
if (t.length === 1) {
|
|
1984
|
+
let e = t[0]?.dataKey;
|
|
1985
|
+
if (e != null && String(e) !== "") return String(e);
|
|
1986
|
+
}
|
|
1987
|
+
}, An = (e) => {
|
|
1988
|
+
if (e && typeof e == "object" && "nativeEvent" in e) return e.nativeEvent;
|
|
1989
|
+
}, jn = (e) => {
|
|
1990
|
+
for (let t = e.length - 1; t >= 0; --t) {
|
|
1991
|
+
let n = An(e[t]);
|
|
1992
|
+
if (n !== void 0) return n;
|
|
1993
|
+
}
|
|
1994
|
+
}, Mn = (e, t) => {
|
|
1995
|
+
if (e == null) return;
|
|
1996
|
+
let n = t.find((t) => String(t.dataKey) === e);
|
|
1997
|
+
return typeof n?.label == "string" ? n.label : void 0;
|
|
1998
|
+
}, Nn = /* @__PURE__ */ new Set([
|
|
1316
1999
|
"bar",
|
|
1317
2000
|
"horizontal-bar",
|
|
1318
2001
|
"line",
|
|
@@ -1322,14 +2005,38 @@ var Et, Dt, Q, Ot, kt, At = V((() => {
|
|
|
1322
2005
|
"radar",
|
|
1323
2006
|
"funnel",
|
|
1324
2007
|
"combo"
|
|
2008
|
+
]), Pn = 5, Fn = 12, In = Math.ceil(Math.sqrt(400 / Math.PI)), Ln = {
|
|
2009
|
+
left: In,
|
|
2010
|
+
right: In
|
|
2011
|
+
}, Rn = {
|
|
2012
|
+
top: In,
|
|
2013
|
+
bottom: In
|
|
2014
|
+
}, zn = {
|
|
2015
|
+
angle: -90,
|
|
2016
|
+
position: "insideLeft"
|
|
2017
|
+
}, Bn = {
|
|
2018
|
+
position: "insideBottom",
|
|
2019
|
+
offset: -4
|
|
2020
|
+
}, Vn = {
|
|
2021
|
+
position: "insideTop",
|
|
2022
|
+
offset: -4
|
|
2023
|
+
}, Hn = {
|
|
2024
|
+
angle: 90,
|
|
2025
|
+
position: "insideRight"
|
|
2026
|
+
}, Un = {}, Wn = { yAxisId: "left" }, Gn = { xAxisId: "left" }, Kn = /* @__PURE__ */ new Set([
|
|
2027
|
+
"bar",
|
|
2028
|
+
"horizontal-bar",
|
|
2029
|
+
"line",
|
|
2030
|
+
"area",
|
|
2031
|
+
"combo"
|
|
1325
2032
|
]);
|
|
1326
2033
|
}));
|
|
1327
2034
|
//#endregion
|
|
1328
2035
|
//#region src/ChartRenderer.tsx
|
|
1329
|
-
|
|
1330
|
-
var
|
|
1331
|
-
fallback: /* @__PURE__ */ E(
|
|
1332
|
-
children: /* @__PURE__ */ E(
|
|
2036
|
+
bt();
|
|
2037
|
+
var Jn = v.lazy(() => Promise.resolve().then(() => (Tt(), xt))), Yn = v.lazy(() => Promise.resolve().then(() => (qn(), Ht))), Xn = ({ schema: e }) => /* @__PURE__ */ E(y, {
|
|
2038
|
+
fallback: /* @__PURE__ */ E(we, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
2039
|
+
children: /* @__PURE__ */ E(Jn, {
|
|
1333
2040
|
data: e.data,
|
|
1334
2041
|
dataKey: e.dataKey,
|
|
1335
2042
|
xAxisKey: e.xAxisKey,
|
|
@@ -1337,70 +2044,85 @@ var jt = g.lazy(() => Promise.resolve().then(() => (it(), et))), Mt = g.lazy(()
|
|
|
1337
2044
|
className: e.className,
|
|
1338
2045
|
color: e.color
|
|
1339
2046
|
})
|
|
1340
|
-
}),
|
|
1341
|
-
let n =
|
|
1342
|
-
let t =
|
|
1343
|
-
if (
|
|
2047
|
+
}), Zn = ({ schema: e, onChartClick: t }) => {
|
|
2048
|
+
let { language: n } = Oe(), r = v.useMemo(() => {
|
|
2049
|
+
let t = ut(e, n), r = Array.isArray(e.series) ? e.series : void 0, i = t.series ?? r, a = e.xAxisKey ?? t.xAxisKey, o = e.config;
|
|
2050
|
+
if (!o && i) {
|
|
1344
2051
|
let t = e.colors || [
|
|
1345
2052
|
"hsl(var(--chart-1))",
|
|
1346
2053
|
"hsl(var(--chart-2))",
|
|
1347
2054
|
"hsl(var(--chart-3))"
|
|
1348
2055
|
], n = {};
|
|
1349
|
-
|
|
2056
|
+
i.forEach((e, r) => {
|
|
1350
2057
|
n[e.dataKey] = {
|
|
1351
2058
|
label: e.label || e.dataKey,
|
|
1352
2059
|
color: e.color || t[r % t.length]
|
|
1353
2060
|
};
|
|
1354
|
-
}),
|
|
2061
|
+
}), o = n;
|
|
1355
2062
|
}
|
|
1356
2063
|
return {
|
|
1357
2064
|
chartType: e.chartType ?? t.chartType,
|
|
1358
2065
|
data: Array.isArray(e.data) ? e.data : [],
|
|
1359
|
-
config:
|
|
1360
|
-
xAxisKey:
|
|
1361
|
-
series:
|
|
2066
|
+
config: o,
|
|
2067
|
+
xAxisKey: a,
|
|
2068
|
+
series: i,
|
|
1362
2069
|
className: e.className,
|
|
1363
2070
|
spec: t
|
|
1364
2071
|
};
|
|
1365
|
-
}, [e]);
|
|
1366
|
-
return /* @__PURE__ */ E(
|
|
1367
|
-
fallback: /* @__PURE__ */ E(
|
|
1368
|
-
children: /* @__PURE__ */ E(
|
|
1369
|
-
chartType:
|
|
1370
|
-
data:
|
|
1371
|
-
config:
|
|
1372
|
-
xAxisKey:
|
|
1373
|
-
series:
|
|
1374
|
-
className:
|
|
2072
|
+
}, [e, n]);
|
|
2073
|
+
return /* @__PURE__ */ E(y, {
|
|
2074
|
+
fallback: /* @__PURE__ */ E(we, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
2075
|
+
children: /* @__PURE__ */ E(Yn, {
|
|
2076
|
+
chartType: r.chartType,
|
|
2077
|
+
data: r.data,
|
|
2078
|
+
config: r.config,
|
|
2079
|
+
xAxisKey: r.xAxisKey,
|
|
2080
|
+
series: r.series,
|
|
2081
|
+
className: r.className,
|
|
1375
2082
|
colors: Array.isArray(e.colors) ? e.colors : void 0,
|
|
1376
2083
|
categoryColors: e.categoryColors,
|
|
1377
2084
|
categoryOrder: e.categoryOrder,
|
|
1378
2085
|
isAnimationActive: e.isAnimationActive,
|
|
1379
2086
|
onChartClick: t,
|
|
1380
|
-
xAxis:
|
|
1381
|
-
yAxes:
|
|
1382
|
-
showLegend:
|
|
1383
|
-
showDataLabels:
|
|
1384
|
-
title:
|
|
1385
|
-
subtitle:
|
|
1386
|
-
description:
|
|
1387
|
-
height:
|
|
1388
|
-
annotations:
|
|
1389
|
-
interaction:
|
|
2087
|
+
xAxis: r.spec.xAxis,
|
|
2088
|
+
yAxes: r.spec.yAxes,
|
|
2089
|
+
showLegend: r.spec.showLegend,
|
|
2090
|
+
showDataLabels: r.spec.showDataLabels,
|
|
2091
|
+
title: r.spec.title,
|
|
2092
|
+
subtitle: r.spec.subtitle,
|
|
2093
|
+
description: r.spec.description,
|
|
2094
|
+
height: r.spec.height ?? e.height,
|
|
2095
|
+
annotations: r.spec.annotations,
|
|
2096
|
+
interaction: r.spec.interaction
|
|
1390
2097
|
})
|
|
1391
2098
|
});
|
|
1392
2099
|
};
|
|
1393
2100
|
//#endregion
|
|
1394
2101
|
//#region src/ObjectChart.tsx
|
|
1395
|
-
|
|
1396
|
-
|
|
2102
|
+
bt();
|
|
2103
|
+
function Qn(e) {
|
|
2104
|
+
return a(e, e.function || "count");
|
|
2105
|
+
}
|
|
2106
|
+
var $n = [
|
|
2107
|
+
"aggregate.groupBy",
|
|
2108
|
+
"xAxisKey",
|
|
2109
|
+
"xAxis.field"
|
|
2110
|
+
];
|
|
2111
|
+
function er(e) {
|
|
2112
|
+
let t = e?.aggregate?.groupBy;
|
|
2113
|
+
if (t && typeof t == "object" && !Array.isArray(t)) {
|
|
2114
|
+
let e = t.field;
|
|
2115
|
+
return typeof e == "string" && e ? e : void 0;
|
|
2116
|
+
}
|
|
2117
|
+
return typeof t == "string" && t ? t : ut(e).xAxisKey;
|
|
1397
2118
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
2119
|
+
var tr = "__comparison";
|
|
2120
|
+
function nr(e) {
|
|
2121
|
+
let t = e?.groupBy;
|
|
2122
|
+
return t && typeof t == "object" && !Array.isArray(t) ? t.alias || t.field : typeof t == "string" ? t : void 0;
|
|
1400
2123
|
}
|
|
1401
|
-
|
|
1402
|
-
function
|
|
1403
|
-
let { field: n, function: r, groupBy: i } = t, a = Ft(t), o = {};
|
|
2124
|
+
function rr(e, t) {
|
|
2125
|
+
let { field: n, function: r, groupBy: i } = t, a = Qn(t), o = {};
|
|
1404
2126
|
for (let t of e) {
|
|
1405
2127
|
let e = String(t[i] ?? "Unknown");
|
|
1406
2128
|
o[e] || (o[e] = []), o[e].push(t);
|
|
@@ -1428,13 +2150,13 @@ function Lt(e, t) {
|
|
|
1428
2150
|
};
|
|
1429
2151
|
});
|
|
1430
2152
|
}
|
|
1431
|
-
async function
|
|
2153
|
+
async function ir(e, t, n, r, i) {
|
|
1432
2154
|
if (!e.length || !t) return e;
|
|
1433
2155
|
let a = i || ((e, t) => t), o = `__raw_${t}`, s = n?.fields?.[t];
|
|
1434
2156
|
if (!s) {
|
|
1435
2157
|
let n = /^\d{4}-\d{2}-\d{2}/;
|
|
1436
2158
|
return e.map((e) => {
|
|
1437
|
-
let r = e[t], i = String(r ?? ""), s = n.test(i) ? i :
|
|
2159
|
+
let r = e[t], i = String(r ?? ""), s = n.test(i) ? i : h(i);
|
|
1438
2160
|
return {
|
|
1439
2161
|
...e,
|
|
1440
2162
|
[t]: a(i, s),
|
|
@@ -1442,11 +2164,11 @@ async function Rt(e, t, n, r, i) {
|
|
|
1442
2164
|
};
|
|
1443
2165
|
});
|
|
1444
2166
|
}
|
|
1445
|
-
let
|
|
1446
|
-
if (
|
|
2167
|
+
let c = s.type;
|
|
2168
|
+
if (c === "select" || c === "picklist" || c === "dropdown") {
|
|
1447
2169
|
let n = s.options || [];
|
|
1448
2170
|
if (n.length === 0) return e.map((e) => {
|
|
1449
|
-
let n = e[t], r = String(n ?? ""), i =
|
|
2171
|
+
let n = e[t], r = String(n ?? ""), i = h(r);
|
|
1450
2172
|
return {
|
|
1451
2173
|
...e,
|
|
1452
2174
|
[t]: a(r, i),
|
|
@@ -1456,7 +2178,7 @@ async function Rt(e, t, n, r, i) {
|
|
|
1456
2178
|
let r = {};
|
|
1457
2179
|
for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
|
|
1458
2180
|
return e.map((e) => {
|
|
1459
|
-
let n = e[t], i = String(n ?? ""), s = r[i] ||
|
|
2181
|
+
let n = e[t], i = String(n ?? ""), s = r[i] || h(i);
|
|
1460
2182
|
return {
|
|
1461
2183
|
...e,
|
|
1462
2184
|
[t]: a(i, s),
|
|
@@ -1464,8 +2186,8 @@ async function Rt(e, t, n, r, i) {
|
|
|
1464
2186
|
};
|
|
1465
2187
|
});
|
|
1466
2188
|
}
|
|
1467
|
-
if (
|
|
1468
|
-
let n = s.
|
|
2189
|
+
if (c === "lookup" || c === "master_detail") {
|
|
2190
|
+
let n = s.reference;
|
|
1469
2191
|
if (!n || !r || typeof r.find != "function") return e.map((e) => ({
|
|
1470
2192
|
...e,
|
|
1471
2193
|
[o]: e[t]
|
|
@@ -1477,19 +2199,19 @@ async function Rt(e, t, n, r, i) {
|
|
|
1477
2199
|
}));
|
|
1478
2200
|
let a = s.id_field || "id";
|
|
1479
2201
|
try {
|
|
1480
|
-
let
|
|
2202
|
+
let c = await r.find(n, {
|
|
1481
2203
|
$filter: { [a]: { $in: i } },
|
|
1482
2204
|
$top: i.length
|
|
1483
|
-
}),
|
|
1484
|
-
for (let e of
|
|
1485
|
-
let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[
|
|
1486
|
-
t && (
|
|
2205
|
+
}), l = m(c), u = s.displayField || s.reference_field || "name", d = {};
|
|
2206
|
+
for (let e of l) {
|
|
2207
|
+
let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[u] || e.name || e.label || e.title || t;
|
|
2208
|
+
t && (d[t] = String(n));
|
|
1487
2209
|
}
|
|
1488
2210
|
return e.map((e) => {
|
|
1489
2211
|
let n = e[t], r = String(n ?? "");
|
|
1490
2212
|
return {
|
|
1491
2213
|
...e,
|
|
1492
|
-
[t]:
|
|
2214
|
+
[t]: d[r] || r,
|
|
1493
2215
|
[o]: n
|
|
1494
2216
|
};
|
|
1495
2217
|
});
|
|
@@ -1500,284 +2222,308 @@ async function Rt(e, t, n, r, i) {
|
|
|
1500
2222
|
}));
|
|
1501
2223
|
}
|
|
1502
2224
|
}
|
|
1503
|
-
if (
|
|
2225
|
+
if (c === "date" || c === "datetime" || c === "date_time" || c === "timestamp" || c === "time") return e.map((e) => ({
|
|
1504
2226
|
...e,
|
|
1505
2227
|
[o]: e[t]
|
|
1506
2228
|
}));
|
|
1507
|
-
let
|
|
2229
|
+
let l = /^\d{4}-\d{2}-\d{2}/;
|
|
1508
2230
|
return e.map((e) => {
|
|
1509
2231
|
let n = e[t], r = String(n ?? "");
|
|
1510
2232
|
return {
|
|
1511
2233
|
...e,
|
|
1512
|
-
[t]:
|
|
2234
|
+
[t]: l.test(r) ? r : h(r),
|
|
1513
2235
|
[o]: n
|
|
1514
2236
|
};
|
|
1515
2237
|
});
|
|
1516
2238
|
}
|
|
1517
|
-
var
|
|
1518
|
-
let { schema:
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
let [me, k] = b([]), [he, ge] = b(null), [_e, ve] = b(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [ye, be] = b(null), [A, j] = b(null), [xe, Se] = b(null), { openRecordList: Ce } = Ve(), we = z(), Te = v(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Ee = v(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), De = v(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), Oe = v(() => t.dataset ? JSON.stringify({
|
|
1523
|
-
d: t.dataset,
|
|
1524
|
-
dim: t.dimensions ?? [],
|
|
1525
|
-
val: t.values ?? []
|
|
2239
|
+
var ar = (e) => {
|
|
2240
|
+
let { schema: n } = e, a = e.onSegmentClick, o = x(rt), p = e.dataSource || o?.dataSource, h = o?.apiFetch, te = I(n.bind), { fieldOptionLabel: ue } = ke(), [de, _] = w([]), [y, we] = w(null), [De, T] = w(void 0), [je, Me] = w(() => !(Array.isArray(n.data) && n.data.length > 0) && (!!n.objectName || !!n.dataset)), [Ne, Pe] = w(null), [Fe, O] = w(null), [Ie, Le] = w(null), { openRecordList: Re } = L(), k = Ae(), { t: ze, language: Be } = Oe(), Ve = C(() => ut(n, Be).chartType, [n, Be]), He = C(() => n.aggregate ? JSON.stringify(n.aggregate) : "", [n.aggregate]), Ue = C(() => n.filter ? JSON.stringify(n.filter) : "", [n.filter]), We = C(() => n.compareTo ? JSON.stringify(n.compareTo) : "", [n.compareTo]), Ge = C(() => n.dataset ? JSON.stringify({
|
|
2241
|
+
d: n.dataset,
|
|
2242
|
+
dim: n.dimensions ?? [],
|
|
2243
|
+
val: n.values ?? []
|
|
1526
2244
|
}) : "", [
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
])
|
|
1531
|
-
|
|
2245
|
+
n.dataset,
|
|
2246
|
+
n.dimensions,
|
|
2247
|
+
n.values
|
|
2248
|
+
]);
|
|
2249
|
+
S(() => {
|
|
1532
2250
|
let e = !1;
|
|
1533
2251
|
return (async () => {
|
|
1534
2252
|
try {
|
|
1535
|
-
let
|
|
2253
|
+
let t = h ?? fetch, r = {
|
|
1536
2254
|
headers: { accept: "application/json" },
|
|
1537
2255
|
credentials: "include"
|
|
1538
|
-
}, i =
|
|
1539
|
-
if (i) a =
|
|
1540
|
-
else if (
|
|
1541
|
-
let e = Array.isArray(
|
|
2256
|
+
}, i = n.objectName, a, o = null;
|
|
2257
|
+
if (i) a = er(n);
|
|
2258
|
+
else if (n.dataset) {
|
|
2259
|
+
let e = Array.isArray(n.dimensions) && n.dimensions.length ? n.dimensions[0] : void 0, s = await (await t(`/api/v1/meta/dataset/${encodeURIComponent(n.dataset)}`, r)).json().catch(() => null);
|
|
1542
2260
|
o = s?.item ?? s?.data ?? s, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
|
|
1543
2261
|
}
|
|
1544
2262
|
if (!i || !a) {
|
|
1545
|
-
e ||
|
|
2263
|
+
e || Le(null);
|
|
1546
2264
|
return;
|
|
1547
2265
|
}
|
|
1548
|
-
let
|
|
1549
|
-
let
|
|
1550
|
-
return
|
|
1551
|
-
},
|
|
1552
|
-
if (
|
|
1553
|
-
let
|
|
1554
|
-
e ||
|
|
1555
|
-
metaByPath:
|
|
2266
|
+
let s = async (e) => {
|
|
2267
|
+
let n = await (await t(`/api/v1/meta/object/${encodeURIComponent(e)}`, r)).json().catch(() => null);
|
|
2268
|
+
return n?.item ?? n?.data ?? n;
|
|
2269
|
+
}, c = {};
|
|
2270
|
+
if (n.dataset && Array.isArray(n.dimensions)) for (let e of n.dimensions) c[e] = (o?.dimensions || []).find((t) => t?.name === e)?.field ?? e;
|
|
2271
|
+
let l = await re(s, i, [a, ...Object.values(c)]);
|
|
2272
|
+
e || Le({
|
|
2273
|
+
metaByPath: l,
|
|
1556
2274
|
colorPath: a,
|
|
1557
|
-
fieldByDim:
|
|
2275
|
+
fieldByDim: n.dataset && Array.isArray(n.dimensions) ? c : null
|
|
1558
2276
|
});
|
|
1559
2277
|
} catch {
|
|
1560
|
-
e ||
|
|
2278
|
+
e || Le(null);
|
|
1561
2279
|
}
|
|
1562
2280
|
})(), () => {
|
|
1563
2281
|
e = !0;
|
|
1564
2282
|
};
|
|
1565
2283
|
}, [
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
2284
|
+
n.objectName,
|
|
2285
|
+
n.dataset,
|
|
2286
|
+
Ge,
|
|
2287
|
+
He,
|
|
2288
|
+
n.xAxisKey,
|
|
2289
|
+
h
|
|
1572
2290
|
]);
|
|
1573
|
-
let { fieldOptionColors:
|
|
1574
|
-
if (!
|
|
2291
|
+
let { fieldOptionColors: Ke, dimensionLabels: qe } = C(() => {
|
|
2292
|
+
if (!Ie) return {
|
|
1575
2293
|
fieldOptionColors: null,
|
|
1576
2294
|
dimensionLabels: null
|
|
1577
2295
|
};
|
|
1578
|
-
let { metaByPath: e, colorPath: t, fieldByDim: n } =
|
|
2296
|
+
let { metaByPath: e, colorPath: t, fieldByDim: n } = Ie, r = ie(e[t]?.options, f(e[t], ue)), a = d(e, n ? Object.entries(n).map(([e, t]) => ({
|
|
1579
2297
|
dim: e,
|
|
1580
2298
|
path: t
|
|
1581
|
-
})) : null,
|
|
2299
|
+
})) : null, ue);
|
|
1582
2300
|
return {
|
|
1583
|
-
fieldOptionColors: r
|
|
2301
|
+
fieldOptionColors: i(r),
|
|
1584
2302
|
dimensionLabels: a
|
|
1585
2303
|
};
|
|
1586
|
-
}, [
|
|
1587
|
-
if (
|
|
1588
|
-
let r =
|
|
1589
|
-
if (
|
|
1590
|
-
let i =
|
|
1591
|
-
|
|
1592
|
-
alias: Ft(t.aggregate)
|
|
1593
|
-
};
|
|
1594
|
-
a !== "count" && i && (o.field = i);
|
|
1595
|
-
let s = await e.aggregate(t.objectName, {
|
|
1596
|
-
groupBy: [r],
|
|
1597
|
-
aggregations: [o],
|
|
1598
|
-
where: n
|
|
1599
|
-
});
|
|
1600
|
-
return Array.isArray(s) ? s : [];
|
|
2304
|
+
}, [Ie, ue]), Je = b(async (e, t) => {
|
|
2305
|
+
if (n.aggregate && typeof e.aggregate == "function") {
|
|
2306
|
+
let r = n.aggregate.groupBy;
|
|
2307
|
+
if (ne(r)) {
|
|
2308
|
+
let i = await e.aggregate(n.objectName, ae(n.aggregate, r, t));
|
|
2309
|
+
return Array.isArray(i) ? i : [];
|
|
1601
2310
|
}
|
|
1602
|
-
let i = await e.aggregate(
|
|
1603
|
-
field:
|
|
1604
|
-
function:
|
|
2311
|
+
let i = await e.aggregate(n.objectName, {
|
|
2312
|
+
field: n.aggregate.field,
|
|
2313
|
+
function: n.aggregate.function,
|
|
1605
2314
|
groupBy: r,
|
|
1606
|
-
filter:
|
|
2315
|
+
filter: t
|
|
1607
2316
|
});
|
|
1608
2317
|
return Array.isArray(i) ? i : [];
|
|
1609
2318
|
}
|
|
1610
2319
|
if (typeof e.find == "function") {
|
|
1611
|
-
let r = await e.find(
|
|
1612
|
-
return
|
|
2320
|
+
let r = await e.find(n.objectName, { $filter: t }), i = m(r), a = nr(n.aggregate);
|
|
2321
|
+
return n.aggregate && a && i.length > 0 && (i = rr(i, {
|
|
2322
|
+
...n.aggregate,
|
|
2323
|
+
groupBy: a
|
|
2324
|
+
})), i;
|
|
1613
2325
|
}
|
|
1614
2326
|
return [];
|
|
1615
|
-
}, [
|
|
1616
|
-
if (!e || !
|
|
1617
|
-
|
|
2327
|
+
}, [n.objectName, He]), Ye = R(), Xe = b(async (e, t) => {
|
|
2328
|
+
if (!e || !n.objectName && !n.dataset) {
|
|
2329
|
+
t.current && Me(!1);
|
|
1618
2330
|
return;
|
|
1619
2331
|
}
|
|
1620
|
-
|
|
2332
|
+
t.current && (Me(!0), Pe(null));
|
|
1621
2333
|
try {
|
|
1622
|
-
if (
|
|
1623
|
-
let r =
|
|
1624
|
-
dimensions: Array.isArray(
|
|
1625
|
-
measures: Array.isArray(
|
|
2334
|
+
if (n.dataset && typeof e.queryDataset == "function") {
|
|
2335
|
+
let r = g(n.filter, Ye), i = await e.queryDataset(n.dataset, {
|
|
2336
|
+
dimensions: Array.isArray(n.dimensions) ? n.dimensions : [],
|
|
2337
|
+
measures: Array.isArray(n.values) ? n.values : [],
|
|
1626
2338
|
...r ? { runtimeFilter: r } : {}
|
|
1627
2339
|
});
|
|
1628
|
-
|
|
2340
|
+
t.current && (_(Array.isArray(i?.rows) ? i.rows : []), we(Array.isArray(i?.fields) ? i.fields : null), T(typeof i?.object == "string" && i.object ? i.object : void 0));
|
|
1629
2341
|
return;
|
|
1630
2342
|
}
|
|
1631
|
-
let r =
|
|
1632
|
-
if (a &&
|
|
1633
|
-
let e =
|
|
1634
|
-
if (
|
|
2343
|
+
let r = g(n.filter, Ye), i = n.compareTo, a = !!i && !s(Ve), o = a ? se(le(n.filter, i), Ye) : null, [c, l] = await Promise.all([Je(e, r), o ? Je(e, o) : Promise.resolve([])]), u = c, d = nr(n.aggregate) || n.xAxisKey;
|
|
2344
|
+
if (a && l.length > 0 && n.aggregate) {
|
|
2345
|
+
let e = n.aggregate.field, t = n.aggregate.function, r = Qn(n.aggregate), i = (n) => {
|
|
2346
|
+
if (n == null) return null;
|
|
1635
2347
|
if (e) {
|
|
1636
|
-
let r = `${e}_${
|
|
1637
|
-
if (r in
|
|
1638
|
-
if (
|
|
2348
|
+
let r = `${e}_${t}`;
|
|
2349
|
+
if (r in n) return Number(n[r]);
|
|
2350
|
+
if (t === "count" && `${e}_count` in n) return Number(n[`${e}_count`]);
|
|
1639
2351
|
}
|
|
1640
|
-
return r in
|
|
1641
|
-
}, a = `${r}${
|
|
1642
|
-
if (o &&
|
|
2352
|
+
return r in n ? Number(n[r]) : "value" in n ? Number(n.value) : "count" in n ? Number(n.count) : null;
|
|
2353
|
+
}, a = `${r}${tr}`, o = d;
|
|
2354
|
+
if (o && u.some((e) => e[o] != null) && l.some((e) => e[o] != null)) {
|
|
1643
2355
|
let e = /* @__PURE__ */ new Map();
|
|
1644
|
-
for (let t of
|
|
2356
|
+
for (let t of l) {
|
|
1645
2357
|
let n = String(t[o] ?? "");
|
|
1646
2358
|
e.set(n, i(t));
|
|
1647
2359
|
}
|
|
1648
|
-
|
|
2360
|
+
u = u.map((t) => {
|
|
1649
2361
|
let n = String(t[o] ?? ""), r = e.get(n);
|
|
1650
2362
|
return r == null ? t : {
|
|
1651
2363
|
...t,
|
|
1652
2364
|
[a]: r
|
|
1653
2365
|
};
|
|
1654
2366
|
});
|
|
1655
|
-
let t = new Set(
|
|
1656
|
-
for (let e of
|
|
2367
|
+
let t = new Set(u.map((e) => String(e[o] ?? "")));
|
|
2368
|
+
for (let e of l) {
|
|
1657
2369
|
let n = String(e[o] ?? "");
|
|
1658
|
-
t.has(n) ||
|
|
2370
|
+
t.has(n) || u.push({
|
|
1659
2371
|
[o]: n,
|
|
1660
2372
|
[a]: i(e)
|
|
1661
2373
|
});
|
|
1662
2374
|
}
|
|
1663
2375
|
} else {
|
|
1664
|
-
let e = Math.max(
|
|
2376
|
+
let e = Math.max(u.length, l.length), t = [];
|
|
1665
2377
|
for (let n = 0; n < e; n++) {
|
|
1666
|
-
let e =
|
|
2378
|
+
let e = u[n] || {}, r = l[n];
|
|
1667
2379
|
t.push(r ? {
|
|
1668
2380
|
...e,
|
|
1669
2381
|
[a]: i(r)
|
|
1670
2382
|
} : e);
|
|
1671
2383
|
}
|
|
1672
|
-
|
|
2384
|
+
u = t;
|
|
1673
2385
|
}
|
|
1674
2386
|
}
|
|
1675
|
-
if (d && typeof e.getObjectSchema == "function")
|
|
1676
|
-
let
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
2387
|
+
if (d && n.objectName && typeof e.getObjectSchema == "function") {
|
|
2388
|
+
let t = n.objectName;
|
|
2389
|
+
try {
|
|
2390
|
+
let n = await e.getObjectSchema(t);
|
|
2391
|
+
u = await ir(u, d, n, e, (e, n) => ue(t, d, e, n));
|
|
2392
|
+
} catch {}
|
|
2393
|
+
}
|
|
2394
|
+
t.current && _(u);
|
|
1680
2395
|
} catch (e) {
|
|
1681
|
-
console.error("[ObjectChart] Fetch error:", e),
|
|
2396
|
+
console.error("[ObjectChart] Fetch error:", e), t.current && Pe(e instanceof Error ? e.message : "Failed to load chart data");
|
|
1682
2397
|
} finally {
|
|
1683
|
-
|
|
2398
|
+
t.current && Me(!1);
|
|
1684
2399
|
}
|
|
1685
2400
|
}, [
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
2401
|
+
n.objectName,
|
|
2402
|
+
Ge,
|
|
2403
|
+
He,
|
|
2404
|
+
Ue,
|
|
2405
|
+
We,
|
|
2406
|
+
n.xAxisKey,
|
|
2407
|
+
Ve,
|
|
2408
|
+
Je,
|
|
2409
|
+
Ye,
|
|
2410
|
+
ue
|
|
2411
|
+
]), Ze = !!(n.objectName || n.dataset) && !te && !n.data, Qe = F(Ze ? n.dataset ? De : n.objectName : void 0);
|
|
2412
|
+
S(() => {
|
|
1697
2413
|
let e = { current: !0 };
|
|
1698
|
-
return
|
|
2414
|
+
return Ze ? Xe(p, e) : e.current && Me(!1), () => {
|
|
1699
2415
|
e.current = !1;
|
|
1700
2416
|
};
|
|
1701
2417
|
}, [
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
2418
|
+
n.objectName,
|
|
2419
|
+
Ge,
|
|
2420
|
+
p,
|
|
2421
|
+
te,
|
|
2422
|
+
n.data,
|
|
2423
|
+
Ue,
|
|
2424
|
+
He,
|
|
2425
|
+
We,
|
|
2426
|
+
Xe,
|
|
2427
|
+
Qe
|
|
1711
2428
|
]);
|
|
1712
|
-
let
|
|
1713
|
-
if (!
|
|
1714
|
-
let e = /* @__PURE__ */ new Map(), t = `__raw_${
|
|
1715
|
-
for (let n of
|
|
1716
|
-
let r = n?.[
|
|
2429
|
+
let $e = te || n.data || de, A = Array.isArray($e) ? $e : [], j = n.drillDown, M = nr(n.aggregate) || n.xAxisKey, et = C(() => {
|
|
2430
|
+
if (!M) return /* @__PURE__ */ new Map();
|
|
2431
|
+
let e = /* @__PURE__ */ new Map(), t = `__raw_${M}`;
|
|
2432
|
+
for (let n of A) {
|
|
2433
|
+
let r = n?.[M];
|
|
1717
2434
|
if (r == null) continue;
|
|
1718
2435
|
let i = t in (n || {}) ? n[t] : r;
|
|
1719
2436
|
e.set(String(r), i);
|
|
1720
2437
|
}
|
|
1721
2438
|
return e;
|
|
1722
|
-
}, [
|
|
1723
|
-
if (
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
2439
|
+
}, [A, M]), N = C(() => {
|
|
2440
|
+
if (Fe) try {
|
|
2441
|
+
return {
|
|
2442
|
+
ok: !0,
|
|
2443
|
+
filter: l(n.filter, u(j, Fe, { groupByField: M }))
|
|
2444
|
+
};
|
|
2445
|
+
} catch (e) {
|
|
2446
|
+
if (!(e instanceof t)) throw e;
|
|
2447
|
+
return {
|
|
2448
|
+
ok: !1,
|
|
2449
|
+
refusal: e
|
|
2450
|
+
};
|
|
2451
|
+
}
|
|
1727
2452
|
}, [
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
]),
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
}, [
|
|
1736
|
-
let
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
2453
|
+
Fe,
|
|
2454
|
+
j,
|
|
2455
|
+
M,
|
|
2456
|
+
Ue
|
|
2457
|
+
]), P = N?.ok ? N.filter : void 0, tt = N?.ok === !1, B = N?.ok === !1 ? N.refusal.message : void 0;
|
|
2458
|
+
S(() => {
|
|
2459
|
+
B && console.warn(`[ObjectChart] drill-down refused — the drilled list cannot be scoped: ${B}`);
|
|
2460
|
+
}, [B]);
|
|
2461
|
+
let V = !a && !!Fe && !tt && !!n.objectName && j?.target === "navigate" && !!Re;
|
|
2462
|
+
S(() => {
|
|
2463
|
+
V && (Re(n.objectName, P), O(null));
|
|
2464
|
+
}, [V]);
|
|
2465
|
+
let ot = n.compareTo, H = n.aggregate ? Qn(n.aggregate) : void 0, U = H ? `${H}${tr}` : void 0, st = !!ot && !s(Ve) && !!U && A.some((e) => e[U] != null), ct = C(() => {
|
|
2466
|
+
let e = Array.isArray(n.series) ? n.series : null;
|
|
2467
|
+
if (!st) return e;
|
|
2468
|
+
let t = e || [{ dataKey: H }], r = {
|
|
1740
2469
|
vsLastWeek: "Previous week",
|
|
1741
2470
|
vsLastMonth: "Previous month",
|
|
1742
2471
|
vsLastQuarter: "Previous quarter",
|
|
1743
2472
|
vsLastYear: "Previous year",
|
|
1744
2473
|
vsYesterday: "Yesterday",
|
|
1745
2474
|
vsPreviousPeriod: "Previous period"
|
|
1746
|
-
}[
|
|
1747
|
-
return [...
|
|
2475
|
+
}[c(ot, n.filter)] || "Previous period";
|
|
2476
|
+
return [...t.map((e) => ({
|
|
1748
2477
|
...e,
|
|
1749
2478
|
variant: e.variant || "current"
|
|
1750
2479
|
})), {
|
|
1751
|
-
dataKey:
|
|
2480
|
+
dataKey: U,
|
|
1752
2481
|
label: r,
|
|
1753
2482
|
variant: "comparison"
|
|
1754
2483
|
}];
|
|
1755
2484
|
}, [
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
V,
|
|
2485
|
+
st,
|
|
2486
|
+
n.series,
|
|
1759
2487
|
H,
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
2488
|
+
U,
|
|
2489
|
+
n.filter,
|
|
2490
|
+
ot
|
|
2491
|
+
]), lt = n.dataset ? r(oe(A, qe), n.dimensions, n.values, y, {
|
|
2492
|
+
nullCategoryLabel: k("chart.nullCategory", "(None)"),
|
|
2493
|
+
builtinAggregateLabels: Te(k)
|
|
2494
|
+
}) : null, dt = !!te || Array.isArray(n.data), ft = !!n.objectName && !n.dataset && !dt, W = ft && !ut(n, Be).xAxisKey ? nr(n.aggregate) : void 0, pt = lt ? {
|
|
2495
|
+
...n,
|
|
2496
|
+
data: lt.data,
|
|
2497
|
+
xAxisKey: lt.xAxisKey,
|
|
2498
|
+
series: lt.series
|
|
1767
2499
|
} : {
|
|
1768
|
-
...
|
|
1769
|
-
data:
|
|
1770
|
-
...W ? {
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
...
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
2500
|
+
...n,
|
|
2501
|
+
data: A,
|
|
2502
|
+
...W ? { xAxisKey: W } : {},
|
|
2503
|
+
...ct ? { series: ct } : {}
|
|
2504
|
+
}, G = n.colors && !Array.isArray(n.colors) && typeof n.colors == "object" ? n.colors : null, mt = Array.isArray(n.colors) ? n.colors : void 0, ht = Ke || G ? {
|
|
2505
|
+
...Ke || {},
|
|
2506
|
+
...G || {}
|
|
2507
|
+
} : void 0, gt = {
|
|
2508
|
+
...pt,
|
|
2509
|
+
colors: mt,
|
|
2510
|
+
...ht ? { categoryColors: ht } : {}
|
|
1778
2511
|
};
|
|
1779
|
-
if (
|
|
1780
|
-
className: "p-
|
|
2512
|
+
if (ft && !er(n)) return /* @__PURE__ */ D("div", {
|
|
2513
|
+
className: "p-4 text-destructive " + (n.className || ""),
|
|
2514
|
+
"data-testid": "chart-missing-category-axis",
|
|
2515
|
+
role: "alert",
|
|
2516
|
+
children: [
|
|
2517
|
+
k("chart.unconfigured.noCategoryAxis", "Chart category axis required — an object-bound chart will not invent one. Declare one of:"),
|
|
2518
|
+
" ",
|
|
2519
|
+
$n.map((e, t) => /* @__PURE__ */ D(v.Fragment, { children: [t > 0 ? ", " : "", /* @__PURE__ */ E("code", {
|
|
2520
|
+
className: "font-mono",
|
|
2521
|
+
children: e
|
|
2522
|
+
})] }, e))
|
|
2523
|
+
]
|
|
2524
|
+
});
|
|
2525
|
+
if (je && A.length === 0) return /* @__PURE__ */ D("div", {
|
|
2526
|
+
className: "p-2 " + (n.className || ""),
|
|
1781
2527
|
"data-testid": "chart-loading",
|
|
1782
2528
|
role: "status",
|
|
1783
2529
|
"aria-busy": "true",
|
|
@@ -1785,49 +2531,70 @@ var zt = (e) => {
|
|
|
1785
2531
|
children: [/* @__PURE__ */ E("span", {
|
|
1786
2532
|
className: "sr-only",
|
|
1787
2533
|
children: "Loading chart data…"
|
|
1788
|
-
}), /* @__PURE__ */ E(
|
|
2534
|
+
}), /* @__PURE__ */ E(pe, { className: "h-full" })]
|
|
1789
2535
|
});
|
|
1790
|
-
if (
|
|
1791
|
-
className: "flex flex-col items-center justify-center gap-2 p-4 " + (
|
|
2536
|
+
if (Ne) return /* @__PURE__ */ D("div", {
|
|
2537
|
+
className: "flex flex-col items-center justify-center gap-2 p-4 " + (n.className || ""),
|
|
1792
2538
|
"data-testid": "chart-error",
|
|
1793
2539
|
role: "alert",
|
|
1794
2540
|
children: [
|
|
1795
|
-
/* @__PURE__ */ E(
|
|
2541
|
+
/* @__PURE__ */ E(z, { className: "h-6 w-6 text-destructive opacity-60" }),
|
|
1796
2542
|
/* @__PURE__ */ E("p", {
|
|
1797
2543
|
className: "text-xs text-destructive font-medium",
|
|
1798
2544
|
children: "Failed to load chart data"
|
|
1799
2545
|
}),
|
|
1800
2546
|
/* @__PURE__ */ E("p", {
|
|
1801
2547
|
className: "text-xs text-muted-foreground max-w-xs text-center",
|
|
1802
|
-
children:
|
|
2548
|
+
children: Ne
|
|
1803
2549
|
})
|
|
1804
2550
|
]
|
|
1805
2551
|
});
|
|
1806
|
-
if (!
|
|
1807
|
-
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (
|
|
2552
|
+
if (!p && n.objectName && A.length === 0) return /* @__PURE__ */ D("div", {
|
|
2553
|
+
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (n.className || ""),
|
|
1808
2554
|
"data-testid": "chart-no-datasource",
|
|
1809
2555
|
children: [
|
|
1810
2556
|
"No data source available for “",
|
|
1811
|
-
|
|
2557
|
+
n.objectName,
|
|
1812
2558
|
"”"
|
|
1813
2559
|
]
|
|
1814
2560
|
});
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
2561
|
+
if ((n.objectName || n.dataset) && !te && !n.data && A.length === 0) return /* @__PURE__ */ E(me, {
|
|
2562
|
+
role: "status",
|
|
2563
|
+
"data-testid": "chart-empty-state",
|
|
2564
|
+
className: "h-full w-full gap-2 p-4 [&>h3]:text-sm [&>h3]:font-medium [&>p]:text-xs " + (n.className || ""),
|
|
2565
|
+
icon: /* @__PURE__ */ E(at, { className: "h-5 w-5 text-muted-foreground/70" }),
|
|
2566
|
+
iconWrapperClassName: "flex size-9 items-center justify-center rounded-lg bg-muted",
|
|
2567
|
+
title: k("dashboard.empty.title", "No data yet"),
|
|
2568
|
+
description: k("dashboard.empty.message", "This widget loaded successfully and its query returned no records yet."),
|
|
2569
|
+
children: /* @__PURE__ */ D("p", {
|
|
2570
|
+
className: "text-xs text-muted-foreground/80",
|
|
2571
|
+
"data-testid": "chart-empty-source",
|
|
2572
|
+
children: [
|
|
2573
|
+
/* @__PURE__ */ E("span", { children: k("dashboard.empty.sourceLabel", "Source:") }),
|
|
2574
|
+
" ",
|
|
2575
|
+
/* @__PURE__ */ E("span", {
|
|
2576
|
+
className: "font-mono",
|
|
2577
|
+
children: n.dataset || n.objectName
|
|
2578
|
+
})
|
|
2579
|
+
]
|
|
2580
|
+
})
|
|
2581
|
+
});
|
|
2582
|
+
let _t = ee(j) ? (e) => {
|
|
2583
|
+
let t = e.category, n = t != null && et.has(String(t)) ? et.get(String(t)) : t;
|
|
2584
|
+
O({
|
|
1818
2585
|
...e,
|
|
1819
2586
|
category: n,
|
|
1820
2587
|
categoryLabel: t,
|
|
1821
2588
|
scope: "cell"
|
|
1822
2589
|
});
|
|
1823
|
-
} : void 0,
|
|
1824
|
-
let e =
|
|
2590
|
+
} : void 0, vt = a ?? _t, K = !a && Fe && !tt && n.objectName && !V ? (() => {
|
|
2591
|
+
let e = P ?? {}, t = ce(j, Fe, Ee(n.title, Be) || "Details"), r = j?.target ?? "drawer", i = {
|
|
1825
2592
|
type: "object-data-table",
|
|
1826
|
-
objectName:
|
|
2593
|
+
objectName: n.objectName,
|
|
1827
2594
|
filter: e,
|
|
1828
2595
|
pagination: !0,
|
|
1829
|
-
pageSize:
|
|
1830
|
-
columns:
|
|
2596
|
+
pageSize: j?.maxRows,
|
|
2597
|
+
columns: j?.columns?.map((e) => ({
|
|
1831
2598
|
accessorKey: e,
|
|
1832
2599
|
header: e
|
|
1833
2600
|
})),
|
|
@@ -1839,39 +2606,39 @@ var zt = (e) => {
|
|
|
1839
2606
|
}, a = /* @__PURE__ */ E("div", {
|
|
1840
2607
|
className: "overflow-auto",
|
|
1841
2608
|
"data-testid": "chart-drill-body",
|
|
1842
|
-
children: /* @__PURE__ */ E(
|
|
2609
|
+
children: /* @__PURE__ */ E(nt, {
|
|
1843
2610
|
schema: i,
|
|
1844
|
-
dataSource:
|
|
2611
|
+
dataSource: p
|
|
1845
2612
|
})
|
|
1846
|
-
}), o =
|
|
2613
|
+
}), o = Re && n.objectName ? /* @__PURE__ */ D(fe, {
|
|
1847
2614
|
type: "button",
|
|
1848
2615
|
variant: "ghost",
|
|
1849
2616
|
size: "sm",
|
|
1850
2617
|
"data-testid": "drill-open-in-list",
|
|
1851
2618
|
onClick: () => {
|
|
1852
|
-
|
|
2619
|
+
Re(n.objectName, e), O(null);
|
|
1853
2620
|
},
|
|
1854
|
-
children: [
|
|
2621
|
+
children: [k("dashboard.openInList", "Open in list"), /* @__PURE__ */ E(it, { className: "ml-1 h-3.5 w-3.5" })]
|
|
1855
2622
|
}) : null;
|
|
1856
|
-
return r === "dialog" ? /* @__PURE__ */ E(
|
|
2623
|
+
return r === "dialog" ? /* @__PURE__ */ E(he, {
|
|
1857
2624
|
open: !0,
|
|
1858
|
-
onOpenChange: (e) => !e &&
|
|
1859
|
-
children: /* @__PURE__ */ D(
|
|
2625
|
+
onOpenChange: (e) => !e && O(null),
|
|
2626
|
+
children: /* @__PURE__ */ D(ge, {
|
|
1860
2627
|
className: "max-w-4xl",
|
|
1861
|
-
children: [/* @__PURE__ */ D(
|
|
2628
|
+
children: [/* @__PURE__ */ D(_e, {
|
|
1862
2629
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1863
|
-
children: [/* @__PURE__ */ E(
|
|
2630
|
+
children: [/* @__PURE__ */ E(ve, { children: t }), o]
|
|
1864
2631
|
}), a]
|
|
1865
2632
|
})
|
|
1866
|
-
}) : /* @__PURE__ */ E(
|
|
2633
|
+
}) : /* @__PURE__ */ E(be, {
|
|
1867
2634
|
open: !0,
|
|
1868
|
-
onOpenChange: (e) => !e &&
|
|
1869
|
-
children: /* @__PURE__ */ D(
|
|
2635
|
+
onOpenChange: (e) => !e && O(null),
|
|
2636
|
+
children: /* @__PURE__ */ D(xe, {
|
|
1870
2637
|
side: "right",
|
|
1871
2638
|
className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
|
|
1872
|
-
children: [/* @__PURE__ */ D(
|
|
2639
|
+
children: [/* @__PURE__ */ D(Se, {
|
|
1873
2640
|
className: "flex-row items-center justify-between gap-4 pr-8",
|
|
1874
|
-
children: [/* @__PURE__ */ E(
|
|
2641
|
+
children: [/* @__PURE__ */ E(Ce, { children: t }), o]
|
|
1875
2642
|
}), /* @__PURE__ */ E("div", {
|
|
1876
2643
|
className: "flex-1 overflow-hidden mt-2",
|
|
1877
2644
|
children: a
|
|
@@ -1880,31 +2647,34 @@ var zt = (e) => {
|
|
|
1880
2647
|
});
|
|
1881
2648
|
})() : null;
|
|
1882
2649
|
return /* @__PURE__ */ D("div", {
|
|
1883
|
-
className: "relative",
|
|
2650
|
+
className: "relative h-full",
|
|
1884
2651
|
children: [
|
|
1885
|
-
/* @__PURE__ */ E(
|
|
1886
|
-
|
|
2652
|
+
/* @__PURE__ */ E(ye, {
|
|
2653
|
+
active: je && A.length > 0,
|
|
2654
|
+
ariaLabel: ze("chart.refreshing")
|
|
2655
|
+
}),
|
|
2656
|
+
/* @__PURE__ */ E(Zn, {
|
|
1887
2657
|
...e,
|
|
1888
|
-
schema:
|
|
1889
|
-
onChartClick:
|
|
2658
|
+
schema: gt,
|
|
2659
|
+
onChartClick: vt
|
|
1890
2660
|
}),
|
|
1891
|
-
|
|
2661
|
+
K
|
|
1892
2662
|
]
|
|
1893
2663
|
});
|
|
1894
|
-
},
|
|
2664
|
+
}, or = { filter: !0 }, sr = p((e) => /* @__PURE__ */ E(tt, {
|
|
1895
2665
|
schema: e.schema,
|
|
1896
|
-
mapping:
|
|
2666
|
+
mapping: or,
|
|
1897
2667
|
dataSource: e.dataSource,
|
|
1898
2668
|
testId: "object-chart",
|
|
1899
2669
|
errorTitle: "This chart’s data source could not be resolved",
|
|
1900
|
-
children: (t) => /* @__PURE__ */ E(
|
|
2670
|
+
children: (t) => /* @__PURE__ */ E(ar, {
|
|
1901
2671
|
...e,
|
|
1902
2672
|
schema: t
|
|
1903
2673
|
})
|
|
1904
|
-
});
|
|
2674
|
+
}));
|
|
1905
2675
|
//#endregion
|
|
1906
2676
|
//#region src/index.tsx
|
|
1907
|
-
e.register("object-chart",
|
|
2677
|
+
e.register("object-chart", sr, {
|
|
1908
2678
|
namespace: "plugin-charts",
|
|
1909
2679
|
label: "Object Chart",
|
|
1910
2680
|
category: "view",
|
|
@@ -1912,39 +2682,34 @@ e.register("object-chart", Vt, {
|
|
|
1912
2682
|
{
|
|
1913
2683
|
name: "objectName",
|
|
1914
2684
|
type: "string",
|
|
1915
|
-
label: "Object Name",
|
|
1916
2685
|
required: !0
|
|
1917
2686
|
},
|
|
1918
2687
|
{
|
|
1919
2688
|
name: "data",
|
|
1920
2689
|
type: "array",
|
|
1921
|
-
label: "Data",
|
|
1922
2690
|
description: "Optional static data"
|
|
1923
2691
|
},
|
|
1924
2692
|
{
|
|
1925
2693
|
name: "filter",
|
|
1926
|
-
type: "array"
|
|
1927
|
-
label: "Filter"
|
|
2694
|
+
type: "array"
|
|
1928
2695
|
},
|
|
1929
2696
|
{
|
|
1930
2697
|
name: "aggregate",
|
|
1931
2698
|
type: "object",
|
|
1932
|
-
label: "Aggregate",
|
|
1933
2699
|
description: "Aggregation config: { field, function, groupBy }"
|
|
1934
2700
|
},
|
|
1935
2701
|
{
|
|
1936
2702
|
name: "drillDown",
|
|
1937
2703
|
type: "object",
|
|
1938
|
-
label: "Drill-down",
|
|
1939
2704
|
description: "Segment drill config: { enabled?, filter?, title?, target?: 'drawer' | 'dialog', columns?, maxRows? }. Present = on; {} is enough. Clicking a segment opens the underlying records filtered by the clicked category."
|
|
1940
2705
|
}
|
|
1941
2706
|
]
|
|
1942
|
-
}),
|
|
1943
|
-
var
|
|
1944
|
-
"bar-chart":
|
|
1945
|
-
chart:
|
|
2707
|
+
}), bt();
|
|
2708
|
+
var cr = {
|
|
2709
|
+
"bar-chart": Xn,
|
|
2710
|
+
chart: Zn
|
|
1946
2711
|
};
|
|
1947
|
-
e.register("bar-chart",
|
|
2712
|
+
e.register("bar-chart", Xn, {
|
|
1948
2713
|
namespace: "plugin-charts",
|
|
1949
2714
|
label: "Bar Chart",
|
|
1950
2715
|
category: "plugin",
|
|
@@ -1952,32 +2717,23 @@ e.register("bar-chart", Nt, {
|
|
|
1952
2717
|
{
|
|
1953
2718
|
name: "data",
|
|
1954
2719
|
type: "array",
|
|
1955
|
-
label: "Data",
|
|
1956
2720
|
required: !0
|
|
1957
2721
|
},
|
|
1958
2722
|
{
|
|
1959
2723
|
name: "dataKey",
|
|
1960
|
-
type: "string"
|
|
1961
|
-
label: "Data Key",
|
|
1962
|
-
defaultValue: "value"
|
|
2724
|
+
type: "string"
|
|
1963
2725
|
},
|
|
1964
2726
|
{
|
|
1965
2727
|
name: "xAxisKey",
|
|
1966
|
-
type: "string"
|
|
1967
|
-
label: "X-Axis Key",
|
|
1968
|
-
defaultValue: "name"
|
|
2728
|
+
type: "string"
|
|
1969
2729
|
},
|
|
1970
2730
|
{
|
|
1971
2731
|
name: "height",
|
|
1972
|
-
type: "number"
|
|
1973
|
-
label: "Height",
|
|
1974
|
-
defaultValue: 400
|
|
2732
|
+
type: "number"
|
|
1975
2733
|
},
|
|
1976
2734
|
{
|
|
1977
2735
|
name: "color",
|
|
1978
|
-
type: "color"
|
|
1979
|
-
label: "Color",
|
|
1980
|
-
defaultValue: "#8884d8"
|
|
2736
|
+
type: "color"
|
|
1981
2737
|
}
|
|
1982
2738
|
],
|
|
1983
2739
|
defaultProps: {
|
|
@@ -2008,7 +2764,7 @@ e.register("bar-chart", Nt, {
|
|
|
2008
2764
|
height: 400,
|
|
2009
2765
|
color: "#8884d8"
|
|
2010
2766
|
}
|
|
2011
|
-
}), e.register("chart",
|
|
2767
|
+
}), e.register("chart", sr, {
|
|
2012
2768
|
namespace: "view",
|
|
2013
2769
|
category: "view",
|
|
2014
2770
|
label: "Chart",
|
|
@@ -2017,26 +2773,22 @@ e.register("bar-chart", Nt, {
|
|
|
2017
2773
|
{
|
|
2018
2774
|
name: "objectName",
|
|
2019
2775
|
type: "string",
|
|
2020
|
-
label: "Object Name",
|
|
2021
2776
|
required: !0
|
|
2022
2777
|
},
|
|
2023
2778
|
{
|
|
2024
2779
|
name: "type",
|
|
2025
|
-
type: "string"
|
|
2026
|
-
label: "Chart Type"
|
|
2780
|
+
type: "string"
|
|
2027
2781
|
},
|
|
2028
2782
|
{
|
|
2029
2783
|
name: "categoryField",
|
|
2030
|
-
type: "string"
|
|
2031
|
-
label: "Category Field"
|
|
2784
|
+
type: "string"
|
|
2032
2785
|
},
|
|
2033
2786
|
{
|
|
2034
2787
|
name: "valueField",
|
|
2035
|
-
type: "string"
|
|
2036
|
-
label: "Value Field"
|
|
2788
|
+
type: "string"
|
|
2037
2789
|
}
|
|
2038
2790
|
]
|
|
2039
|
-
}), e.register("chart",
|
|
2791
|
+
}), e.register("chart", Zn, {
|
|
2040
2792
|
namespace: "plugin-charts",
|
|
2041
2793
|
label: "Chart",
|
|
2042
2794
|
category: "plugin",
|
|
@@ -2044,7 +2796,6 @@ e.register("bar-chart", Nt, {
|
|
|
2044
2796
|
{
|
|
2045
2797
|
name: "chartType",
|
|
2046
2798
|
type: "enum",
|
|
2047
|
-
label: "Chart Type",
|
|
2048
2799
|
enum: [
|
|
2049
2800
|
{
|
|
2050
2801
|
label: "Bar",
|
|
@@ -2074,36 +2825,29 @@ e.register("bar-chart", Nt, {
|
|
|
2074
2825
|
label: "Scatter",
|
|
2075
2826
|
value: "scatter"
|
|
2076
2827
|
}
|
|
2077
|
-
]
|
|
2078
|
-
defaultValue: "bar"
|
|
2828
|
+
]
|
|
2079
2829
|
},
|
|
2080
2830
|
{
|
|
2081
2831
|
name: "data",
|
|
2082
2832
|
type: "code",
|
|
2083
|
-
label: "Data (JSON)",
|
|
2084
2833
|
required: !0
|
|
2085
2834
|
},
|
|
2086
2835
|
{
|
|
2087
2836
|
name: "config",
|
|
2088
|
-
type: "code"
|
|
2089
|
-
label: "Config (JSON)"
|
|
2837
|
+
type: "code"
|
|
2090
2838
|
},
|
|
2091
2839
|
{
|
|
2092
2840
|
name: "xAxisKey",
|
|
2093
|
-
type: "string"
|
|
2094
|
-
label: "X Axis Key",
|
|
2095
|
-
defaultValue: "name"
|
|
2841
|
+
type: "string"
|
|
2096
2842
|
},
|
|
2097
2843
|
{
|
|
2098
2844
|
name: "series",
|
|
2099
2845
|
type: "code",
|
|
2100
|
-
label: "Series (JSON Array)",
|
|
2101
2846
|
required: !0
|
|
2102
2847
|
},
|
|
2103
2848
|
{
|
|
2104
2849
|
name: "className",
|
|
2105
|
-
type: "string"
|
|
2106
|
-
label: "CSS Class"
|
|
2850
|
+
type: "string"
|
|
2107
2851
|
}
|
|
2108
2852
|
],
|
|
2109
2853
|
defaultProps: {
|
|
@@ -2148,31 +2892,10 @@ e.register("bar-chart", Nt, {
|
|
|
2148
2892
|
xAxisKey: "name",
|
|
2149
2893
|
series: [{ dataKey: "sales" }, { dataKey: "revenue" }]
|
|
2150
2894
|
}
|
|
2151
|
-
}), e.register("chart:bar",
|
|
2895
|
+
}), e.register("chart:bar", Zn, {
|
|
2152
2896
|
namespace: "plugin-charts",
|
|
2153
2897
|
label: "Bar Chart (Alias)",
|
|
2154
|
-
category: "plugin"
|
|
2155
|
-
defaultProps: { chartType: "bar" }
|
|
2156
|
-
}), e.register("pie-chart", $, {
|
|
2157
|
-
namespace: "plugin-charts",
|
|
2158
|
-
label: "Pie Chart",
|
|
2159
|
-
category: "plugin",
|
|
2160
|
-
defaultProps: { chartType: "pie" }
|
|
2161
|
-
}), e.register("donut-chart", $, {
|
|
2162
|
-
namespace: "plugin-charts",
|
|
2163
|
-
label: "Donut Chart",
|
|
2164
|
-
category: "plugin",
|
|
2165
|
-
defaultProps: { chartType: "donut" }
|
|
2166
|
-
}), e.register("radar-chart", $, {
|
|
2167
|
-
namespace: "plugin-charts",
|
|
2168
|
-
label: "Radar Chart",
|
|
2169
|
-
category: "plugin",
|
|
2170
|
-
defaultProps: { chartType: "radar" }
|
|
2171
|
-
}), e.register("scatter-chart", $, {
|
|
2172
|
-
namespace: "plugin-charts",
|
|
2173
|
-
label: "Scatter Chart",
|
|
2174
|
-
category: "plugin",
|
|
2175
|
-
defaultProps: { chartType: "scatter" }
|
|
2898
|
+
category: "plugin"
|
|
2176
2899
|
});
|
|
2177
2900
|
//#endregion
|
|
2178
|
-
export {
|
|
2901
|
+
export { Xn as ChartBarRenderer, Zn as ChartRenderer, ar as ObjectChart, sr as ObjectChartBlock, cr as chartComponents, ut as normalizeChartSchema };
|