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