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