@hybridcore/ui 1.6.28 → 1.6.29
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.
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import S from "dayjs";
|
|
2
2
|
import { c as k, g as q } from "../../../_commonjsHelpers-BkfeUUK-.js";
|
|
3
|
-
var
|
|
3
|
+
var E = { exports: {} };
|
|
4
4
|
(function(t, e) {
|
|
5
5
|
(function(r, n) {
|
|
6
6
|
t.exports = n();
|
|
7
7
|
})(k, function() {
|
|
8
8
|
return function(r, n, s) {
|
|
9
9
|
r = r || {};
|
|
10
|
-
var i = n.prototype,
|
|
10
|
+
var i = n.prototype, h = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
|
|
11
11
|
function d(o, c, m, f) {
|
|
12
12
|
return i.fromToBase(o, c, m, f);
|
|
13
13
|
}
|
|
14
|
-
s.en.relativeTime =
|
|
15
|
-
for (var N,
|
|
16
|
-
var u = D[
|
|
14
|
+
s.en.relativeTime = h, i.fromToBase = function(o, c, m, f, $) {
|
|
15
|
+
for (var N, p, M, y = m.$locale().relativeTime || h, D = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], L = D.length, b = 0; b < L; b += 1) {
|
|
16
|
+
var u = D[b];
|
|
17
17
|
u.d && (N = f ? s(o).diff(m, u.d, !0) : m.diff(o, u.d, !0));
|
|
18
18
|
var a = (r.rounding || Math.round)(Math.abs(N));
|
|
19
|
-
if (
|
|
20
|
-
a <= 1 &&
|
|
21
|
-
var
|
|
22
|
-
$ && (a = $("" + a)),
|
|
19
|
+
if (M = N > 0, a <= u.r || !u.r) {
|
|
20
|
+
a <= 1 && b > 0 && (u = D[b - 1]);
|
|
21
|
+
var x = y[u.l];
|
|
22
|
+
$ && (a = $("" + a)), p = typeof x == "string" ? x.replace("%d", a) : x(a, c, u.l, M);
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
if (c) return
|
|
27
|
-
var
|
|
28
|
-
return typeof
|
|
26
|
+
if (c) return p;
|
|
27
|
+
var w = M ? y.future : y.past;
|
|
28
|
+
return typeof w == "function" ? w(p) : w.replace("%s", p);
|
|
29
29
|
}, i.to = function(o, c) {
|
|
30
30
|
return d(o, c, this, !0);
|
|
31
31
|
}, i.from = function(o, c) {
|
|
@@ -41,10 +41,10 @@ var S = { exports: {} };
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
});
|
|
44
|
-
})(
|
|
45
|
-
var
|
|
46
|
-
const B = /* @__PURE__ */ q(
|
|
47
|
-
|
|
44
|
+
})(E);
|
|
45
|
+
var A = E.exports;
|
|
46
|
+
const B = /* @__PURE__ */ q(A);
|
|
47
|
+
S.extend(B);
|
|
48
48
|
const W = "—", j = (t) => {
|
|
49
49
|
const { decimals: e, notation: r } = t ?? {};
|
|
50
50
|
return r === "compact" ? new Intl.NumberFormat("en-US", {
|
|
@@ -56,7 +56,7 @@ const W = "—", j = (t) => {
|
|
|
56
56
|
"en-US",
|
|
57
57
|
e === void 0 ? { maximumFractionDigits: 2 } : { minimumFractionDigits: e, maximumFractionDigits: e }
|
|
58
58
|
);
|
|
59
|
-
},
|
|
59
|
+
}, C = (t) => {
|
|
60
60
|
if (typeof t == "boolean") return t;
|
|
61
61
|
if (typeof t == "number") return t === 1;
|
|
62
62
|
if (typeof t == "string") {
|
|
@@ -64,38 +64,47 @@ const W = "—", j = (t) => {
|
|
|
64
64
|
return e === "true" || e === "1";
|
|
65
65
|
}
|
|
66
66
|
return !1;
|
|
67
|
-
},
|
|
67
|
+
}, I = (t) => {
|
|
68
68
|
const e = t.toLowerCase();
|
|
69
69
|
return e.includes("year") ? "YYYY" : e.includes("month") ? "MMM YYYY" : e.includes("hour") || e.includes("minute") || e.includes("time") ? "DD MMM YYYY HH:mm" : "DD MMM YYYY";
|
|
70
|
-
},
|
|
71
|
-
const n =
|
|
72
|
-
return n.isValid() ? e === "relative" ? n.fromNow() : n.format(e ||
|
|
73
|
-
},
|
|
70
|
+
}, P = (t, e, r = "") => {
|
|
71
|
+
const n = S(t);
|
|
72
|
+
return n.isValid() ? e === "relative" ? n.fromNow() : n.format(e || I(r)) : String(t);
|
|
73
|
+
}, F = (t, e) => `${(t == null ? void 0 : t.prefix) ?? ""}${e}${(t == null ? void 0 : t.suffix) ?? ""}`, X = (t, e, r = W, n = "") => {
|
|
74
74
|
if (t == null || t === "") return r;
|
|
75
75
|
switch ((e == null ? void 0 : e.valueType) ?? (e != null && e.dateFormat ? "date" : "number")) {
|
|
76
76
|
case "date":
|
|
77
|
-
return
|
|
77
|
+
return P(t, e == null ? void 0 : e.dateFormat, n);
|
|
78
78
|
case "boolean":
|
|
79
|
-
return
|
|
79
|
+
return C(t) ? (e == null ? void 0 : e.trueLabel) ?? "true" : (e == null ? void 0 : e.falseLabel) ?? "false";
|
|
80
80
|
case "text":
|
|
81
|
-
return
|
|
81
|
+
return F(e, String(t));
|
|
82
82
|
case "number":
|
|
83
83
|
default: {
|
|
84
84
|
const i = Number(t);
|
|
85
|
-
return Number.isNaN(i) ?
|
|
85
|
+
return Number.isNaN(i) ? F(e, String(t)) : F(e, j(e).format(i));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
},
|
|
88
|
+
}, Z = (t) => {
|
|
89
89
|
if (!t) return;
|
|
90
90
|
const { prefix: e, suffix: r, decimals: n, notation: s } = t, i = s === "compact";
|
|
91
91
|
if (e === void 0 && r === void 0 && n === void 0 && !i)
|
|
92
92
|
return;
|
|
93
|
-
const
|
|
94
|
-
return `${d(e)}${
|
|
95
|
-
},
|
|
93
|
+
const h = i ? n === void 0 ? "#,###.#a" : n <= 0 ? "#,##0a" : `#,##0.${"0".repeat(n)}a` : n === void 0 ? "#,###.##" : n <= 0 ? "#,##0" : `#,##0.${"0".repeat(n)}`, d = (l) => l ? `'${l.replace(/'/g, "")}'` : "";
|
|
94
|
+
return `${d(e)}${h}${d(r)}`;
|
|
95
|
+
}, Y = 4, J = (t, e = 2) => {
|
|
96
|
+
if (!Number.isFinite(t)) return "";
|
|
97
|
+
const r = Math.max(0, Math.trunc(e)), n = t.toFixed(r);
|
|
98
|
+
if (Number(n) !== 0 || t === 0) return n;
|
|
99
|
+
for (let s = r + 1; s <= Y; s++) {
|
|
100
|
+
const i = t.toFixed(s);
|
|
101
|
+
if (Number(i) !== 0) return i;
|
|
102
|
+
}
|
|
103
|
+
return `<${(10 ** -Y).toFixed(Y)}`;
|
|
104
|
+
}, K = (t) => t && t.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase()), T = (t) => t instanceof Date ? t.getTime() : typeof t == "number" ? t : typeof t == "string" && t !== "" ? Date.parse(t) : NaN, v = (t, e) => {
|
|
96
105
|
const r = new Date(t), n = new Date(e);
|
|
97
106
|
return r.getFullYear() === n.getFullYear() && r.getMonth() === n.getMonth() && r.getDate() === n.getDate();
|
|
98
|
-
},
|
|
107
|
+
}, U = (t, e) => {
|
|
99
108
|
const r = Number(t);
|
|
100
109
|
if (Number.isNaN(r)) return !1;
|
|
101
110
|
const n = Number(e.value);
|
|
@@ -119,8 +128,8 @@ const W = "—", j = (t) => {
|
|
|
119
128
|
default:
|
|
120
129
|
return !1;
|
|
121
130
|
}
|
|
122
|
-
},
|
|
123
|
-
const r =
|
|
131
|
+
}, V = (t, e) => {
|
|
132
|
+
const r = T(t), n = T(e.value);
|
|
124
133
|
if (Number.isNaN(r) || Number.isNaN(n)) return !1;
|
|
125
134
|
switch (e.op) {
|
|
126
135
|
case "lt":
|
|
@@ -132,17 +141,17 @@ const W = "—", j = (t) => {
|
|
|
132
141
|
case "gte":
|
|
133
142
|
return r >= n;
|
|
134
143
|
case "eq":
|
|
135
|
-
return
|
|
144
|
+
return v(r, n);
|
|
136
145
|
case "neq":
|
|
137
|
-
return !
|
|
146
|
+
return !v(r, n);
|
|
138
147
|
case "between": {
|
|
139
|
-
const s =
|
|
148
|
+
const s = T(e.value2);
|
|
140
149
|
return !Number.isNaN(s) && r >= n && r <= s;
|
|
141
150
|
}
|
|
142
151
|
default:
|
|
143
152
|
return !1;
|
|
144
153
|
}
|
|
145
|
-
},
|
|
154
|
+
}, _ = (t, e) => {
|
|
146
155
|
const r = String(t ?? "").toLowerCase(), n = String(e.value ?? "").toLowerCase();
|
|
147
156
|
switch (e.op) {
|
|
148
157
|
case "eq":
|
|
@@ -164,44 +173,45 @@ const W = "—", j = (t) => {
|
|
|
164
173
|
default:
|
|
165
174
|
return !1;
|
|
166
175
|
}
|
|
167
|
-
},
|
|
176
|
+
}, z = (t, e) => {
|
|
168
177
|
switch (e.op) {
|
|
169
178
|
case "isTrue":
|
|
170
|
-
return
|
|
179
|
+
return C(t);
|
|
171
180
|
case "isFalse":
|
|
172
|
-
return !
|
|
181
|
+
return !C(t);
|
|
173
182
|
default:
|
|
174
183
|
return !1;
|
|
175
184
|
}
|
|
176
|
-
},
|
|
185
|
+
}, H = (t, e) => {
|
|
177
186
|
switch (e.type ?? "number") {
|
|
178
187
|
case "date":
|
|
179
|
-
return
|
|
188
|
+
return V(t, e);
|
|
180
189
|
case "text":
|
|
181
|
-
return
|
|
190
|
+
return _(t, e);
|
|
182
191
|
case "boolean":
|
|
183
|
-
return
|
|
192
|
+
return z(t, e);
|
|
184
193
|
case "number":
|
|
185
194
|
default:
|
|
186
|
-
return
|
|
195
|
+
return U(t, e);
|
|
187
196
|
}
|
|
188
|
-
}, g = (t) => t || void 0,
|
|
197
|
+
}, g = (t) => t || void 0, O = (t, e) => {
|
|
189
198
|
const r = {
|
|
190
199
|
color: g(e == null ? void 0 : e.color),
|
|
191
200
|
backgroundColor: g(e == null ? void 0 : e.backgroundColor)
|
|
192
201
|
}, n = e == null ? void 0 : e.conditionalRules;
|
|
193
202
|
if (!(n != null && n.length)) return r;
|
|
194
|
-
const s = n.find((i) =>
|
|
203
|
+
const s = n.find((i) => H(t, i));
|
|
195
204
|
return s ? {
|
|
196
205
|
color: g(s.color) ?? r.color,
|
|
197
206
|
backgroundColor: g(s.backgroundColor) ?? r.backgroundColor
|
|
198
207
|
} : r;
|
|
199
208
|
};
|
|
200
209
|
export {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
K as
|
|
210
|
+
Z as buildAmNumberFormat,
|
|
211
|
+
I as defaultDateFormat,
|
|
212
|
+
P as formatDateValue,
|
|
213
|
+
J as formatPercent,
|
|
214
|
+
X as formatValue,
|
|
215
|
+
K as humanizeLabel,
|
|
216
|
+
O as resolveConditionalStyle
|
|
207
217
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { buildAmNumberFormat as
|
|
2
|
-
import { C as
|
|
3
|
-
import { c as
|
|
4
|
-
const
|
|
1
|
+
import { buildAmNumberFormat as c, formatDateValue as m, formatPercent as s } from "./format.js";
|
|
2
|
+
import { C as l } from "../../../ColorSet-cyPmWGwh.js";
|
|
3
|
+
import { c as p } from "../../../Entity-BJCuhdq_.js";
|
|
4
|
+
const b = [
|
|
5
5
|
"#294D94",
|
|
6
6
|
"#375F97",
|
|
7
7
|
"#44729C",
|
|
@@ -12,30 +12,49 @@ const n = [
|
|
|
12
12
|
"#9FCFBF",
|
|
13
13
|
"#B9E1C9",
|
|
14
14
|
"#D6F1D5"
|
|
15
|
-
],
|
|
16
|
-
colors: e.map((
|
|
15
|
+
], v = (t, e = b) => l.new(t, {
|
|
16
|
+
colors: e.map((r) => p(r)),
|
|
17
17
|
reuse: !0
|
|
18
|
-
}),
|
|
18
|
+
}), F = [
|
|
19
19
|
{ number: 1e3, suffix: "K" },
|
|
20
20
|
{ number: 1e6, suffix: "M" },
|
|
21
21
|
{ number: 1e9, suffix: "B" },
|
|
22
22
|
{ number: 1e12, suffix: "T" }
|
|
23
|
-
],
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
e.type !== "date" || !e.dateFormat ||
|
|
23
|
+
], P = (t, e) => {
|
|
24
|
+
const r = c(e) ?? "#,###.##";
|
|
25
|
+
t.numberFormatter.set("numericFields", void 0), t.numberFormatter.set("numberFormat", r), (e == null ? void 0 : e.notation) === "compact" && t.numberFormatter.set("bigNumberPrefixes", F);
|
|
26
|
+
}, D = (t, e) => {
|
|
27
|
+
e.type !== "date" || !e.dateFormat || t.get("renderer").labels.template.adapters.add(
|
|
28
28
|
"text",
|
|
29
|
-
(
|
|
30
|
-
var
|
|
31
|
-
const
|
|
32
|
-
return typeof
|
|
29
|
+
(r, a) => {
|
|
30
|
+
var u;
|
|
31
|
+
const o = (u = a == null ? void 0 : a.dataItem) == null ? void 0 : u.get("value");
|
|
32
|
+
return typeof o == "number" ? m(o, e.dateFormat, e.value) : r;
|
|
33
33
|
}
|
|
34
34
|
);
|
|
35
|
+
}, n = (t) => {
|
|
36
|
+
const { percentDecimals: e, percent: r } = t, a = e <= 0 ? "0" : `0.${"0".repeat(e)}`;
|
|
37
|
+
return r === void 0 ? `{valuePercentTotal.formatNumber('${a}')}%` : `${s(r, e)}%`;
|
|
38
|
+
}, y = (t) => {
|
|
39
|
+
const { percentDecimals: e, showValueText: r, percent: a } = t, o = n({ percentDecimals: e, percent: a });
|
|
40
|
+
return r ? `{category}: ${o} ({value})` : `{category}: ${o}`;
|
|
41
|
+
}, d = (t) => {
|
|
42
|
+
var r;
|
|
43
|
+
const e = (r = t == null ? void 0 : t.dataItem) == null ? void 0 : r.get("valuePercentTotal");
|
|
44
|
+
return typeof e == "number" ? e : void 0;
|
|
45
|
+
}, A = (t, e) => {
|
|
46
|
+
t.valueLabels.template.set("text", n({ percentDecimals: e })), t.valueLabels.template.adapters.add("text", (r, a) => {
|
|
47
|
+
const o = d(a);
|
|
48
|
+
return o === void 0 ? r : n({ percentDecimals: e, percent: o });
|
|
49
|
+
});
|
|
35
50
|
};
|
|
36
51
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
b as DEFAULT_VIRIDIS_COOL,
|
|
53
|
+
D as applyDateAxisLabelFormat,
|
|
54
|
+
A as applyLegendPercentFormat,
|
|
55
|
+
P as applyValueFormat,
|
|
56
|
+
n as buildPercentText,
|
|
57
|
+
y as buildSliceText,
|
|
58
|
+
v as colorSetFromPalette,
|
|
59
|
+
d as readSharePercent
|
|
41
60
|
};
|
|
@@ -1,82 +1,120 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
import { useThemeProps as
|
|
3
|
-
import
|
|
4
|
-
import { useId as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { R as N, A as V } from "../../../AnimatedTheme-ktdO3Bel.js";
|
|
2
|
+
import { useThemeProps as z, useTheme as E } from "@mui/material";
|
|
3
|
+
import W from "dayjs";
|
|
4
|
+
import { useId as X, useRef as j, useEffect as H } from "react";
|
|
5
|
+
import { formatDateValue as O } from "../_common/format.js";
|
|
6
|
+
import { applyValueFormat as $, colorSetFromPalette as q, buildSliceText as k, applyLegendPercentFormat as G, readSharePercent as J } from "../_common/utils.js";
|
|
7
|
+
import { P as K, a as Q } from "../../../PieSeries-CMH0Z7pz.js";
|
|
8
|
+
import { p as c, c as d } from "../../../Entity-BJCuhdq_.js";
|
|
9
|
+
import { L as U } from "../../../Legend-CFvQiIfn.js";
|
|
10
|
+
import { L as Z } from "../../../Tooltip-vyZRZWih.js";
|
|
11
|
+
const de = (A) => {
|
|
12
|
+
const y = z({ props: A, name: "HCDonutChart" }), {
|
|
13
|
+
dimensions: a,
|
|
12
14
|
values: o,
|
|
13
|
-
data:
|
|
14
|
-
initDelay:
|
|
15
|
-
colors:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
data: m,
|
|
16
|
+
initDelay: P = 0,
|
|
17
|
+
colors: T,
|
|
18
|
+
showDimensionLabel: Y = !1,
|
|
19
|
+
showValueText: f = !0,
|
|
20
|
+
percentDecimals: p = 2,
|
|
21
|
+
sx: R,
|
|
22
|
+
...C
|
|
23
|
+
} = y, i = E(), w = `hc-donut-chart-${X().replace(/:/g, "")}`, g = j(null), l = o.length > 1;
|
|
24
|
+
let u = null;
|
|
25
|
+
o.length < 1 ? u = "Missing values config!" : !l && a.length < 1 && (u = "Missing dimensions config!"), H(() => {
|
|
26
|
+
if (u) return;
|
|
27
|
+
let v;
|
|
28
|
+
return v = setTimeout(() => {
|
|
29
|
+
var M, F;
|
|
30
|
+
const e = N.new(w);
|
|
31
|
+
g.current = e, $(e, (M = o == null ? void 0 : o[0]) == null ? void 0 : M.format), e.setThemes([V.new(e)]);
|
|
32
|
+
const x = e.container.children.push(
|
|
33
|
+
K.new(e, {
|
|
29
34
|
layout: e.verticalLayout,
|
|
30
|
-
innerRadius:
|
|
35
|
+
innerRadius: c(50)
|
|
31
36
|
})
|
|
32
37
|
);
|
|
33
38
|
e.interfaceColors.setAll({
|
|
34
|
-
text:
|
|
35
|
-
grid:
|
|
36
|
-
stroke:
|
|
39
|
+
text: d(i.palette.text.primary),
|
|
40
|
+
grid: d(i.palette.divider),
|
|
41
|
+
stroke: d(i.palette.divider),
|
|
37
42
|
// Drives the gap color between slices; tie it to the surface so the
|
|
38
43
|
// beveled edges read correctly in both light and dark mode.
|
|
39
|
-
background:
|
|
44
|
+
background: d(i.palette.background.paper)
|
|
40
45
|
});
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
const I = l ? o.map((r) => {
|
|
47
|
+
var s;
|
|
48
|
+
return {
|
|
49
|
+
category: r.label || r.name || r.fieldName,
|
|
50
|
+
value: (s = m[0]) == null ? void 0 : s[r.dataFieldName]
|
|
51
|
+
};
|
|
52
|
+
}) : m, t = x.series.push(
|
|
53
|
+
Q.new(e, {
|
|
54
|
+
valueField: l ? "value" : o[0].dataFieldName,
|
|
55
|
+
categoryField: l ? "category" : a[0].value
|
|
45
56
|
})
|
|
46
57
|
);
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
tooltipText:
|
|
51
|
-
stroke:
|
|
58
|
+
t.set("colors", q(e, T));
|
|
59
|
+
const b = k({ percentDecimals: p, showValueText: f });
|
|
60
|
+
t.slices.template.setAll({
|
|
61
|
+
tooltipText: b,
|
|
62
|
+
stroke: d(i.palette.background.paper),
|
|
52
63
|
strokeWidth: 2,
|
|
53
64
|
strokeOpacity: 1,
|
|
54
65
|
cornerRadius: 4
|
|
55
|
-
}),
|
|
56
|
-
text:
|
|
66
|
+
}), t.slices.template.states.create("hover", { scale: 1.04 }), t.set("radius", c(80)), t.labels.template.setAll({
|
|
67
|
+
text: b,
|
|
57
68
|
maxWidth: 140,
|
|
58
69
|
oversizedBehavior: "wrap"
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
});
|
|
71
|
+
const D = (r, s) => {
|
|
72
|
+
const S = J(s);
|
|
73
|
+
return S === void 0 ? r : k({ percentDecimals: p, showValueText: f, percent: S });
|
|
74
|
+
};
|
|
75
|
+
t.slices.template.adapters.add("tooltipText", D), t.labels.template.adapters.add("text", D), !l && a[0].type === "date" && m.forEach((r) => {
|
|
76
|
+
let s = "YYYY";
|
|
77
|
+
a[0].value.includes("month") ? s = "MMM YYYY" : a[0].value.includes("day") && (s = "DD MMM YYYY"), r[a[0].value] = W(r[a[0].value]).format(
|
|
78
|
+
s
|
|
63
79
|
);
|
|
64
|
-
}),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
}), t.data.setAll(I);
|
|
81
|
+
const L = x.children.push(
|
|
82
|
+
U.new(e, {
|
|
83
|
+
centerX: c(50),
|
|
84
|
+
x: c(50),
|
|
68
85
|
marginTop: 15,
|
|
69
86
|
marginBottom: 15
|
|
70
87
|
})
|
|
71
|
-
)
|
|
72
|
-
|
|
88
|
+
);
|
|
89
|
+
G(L, p), L.data.setAll(t.dataItems);
|
|
90
|
+
const n = a[0], h = n ? (F = m[0]) == null ? void 0 : F[n.value] : void 0;
|
|
91
|
+
Y && l && n && h != null && h !== "" && x.children.push(
|
|
92
|
+
Z.new(e, {
|
|
93
|
+
text: n.type === "date" ? O(h, n.dateFormat, n.value) : String(h),
|
|
94
|
+
centerX: c(50),
|
|
95
|
+
x: c(50),
|
|
96
|
+
fill: d(i.palette.text.secondary),
|
|
97
|
+
fontSize: 12,
|
|
98
|
+
paddingBottom: 8
|
|
99
|
+
})
|
|
100
|
+
), t.appear(1e3, 100);
|
|
101
|
+
}, P), () => {
|
|
73
102
|
var e;
|
|
74
|
-
|
|
103
|
+
v && clearTimeout(v), (e = g.current) == null || e.dispose(), g.current = null;
|
|
75
104
|
};
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
|
|
105
|
+
}, [
|
|
106
|
+
m,
|
|
107
|
+
a,
|
|
108
|
+
o,
|
|
109
|
+
i.palette.mode,
|
|
110
|
+
T,
|
|
111
|
+
Y,
|
|
112
|
+
f,
|
|
113
|
+
p
|
|
114
|
+
]);
|
|
115
|
+
const B = { ...y };
|
|
116
|
+
return { chartId: w, ownerState: B, sx: R, error: u, other: C };
|
|
79
117
|
};
|
|
80
118
|
export {
|
|
81
|
-
|
|
119
|
+
de as useDonutChartLogic
|
|
82
120
|
};
|
|
@@ -1,68 +1,106 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
import { useThemeProps as
|
|
3
|
-
import
|
|
4
|
-
import { useId as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { R as B, A as E } from "../../../AnimatedTheme-ktdO3Bel.js";
|
|
2
|
+
import { useThemeProps as X, useTheme as j } from "@mui/material";
|
|
3
|
+
import k from "dayjs";
|
|
4
|
+
import { useId as z, useRef as H, useEffect as $ } from "react";
|
|
5
|
+
import { formatDateValue as q } from "../_common/format.js";
|
|
6
|
+
import { applyValueFormat as G, colorSetFromPalette as J, buildSliceText as b, applyLegendPercentFormat as K, readSharePercent as O } from "../_common/utils.js";
|
|
7
|
+
import { P as Q, a as U } from "../../../PieSeries-CMH0Z7pz.js";
|
|
8
|
+
import { c as u, p as f } from "../../../Entity-BJCuhdq_.js";
|
|
9
|
+
import { L as W } from "../../../Legend-CFvQiIfn.js";
|
|
10
|
+
import { L as Z } from "../../../Tooltip-vyZRZWih.js";
|
|
11
|
+
const me = (A) => {
|
|
12
|
+
const v = X({ props: A, name: "HCPieChart" }), {
|
|
11
13
|
dimensions: t,
|
|
12
14
|
values: o,
|
|
13
|
-
data:
|
|
14
|
-
initDelay:
|
|
15
|
-
colors:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
data: n,
|
|
16
|
+
initDelay: C = 0,
|
|
17
|
+
colors: T,
|
|
18
|
+
showDimensionLabel: Y = !1,
|
|
19
|
+
showValueText: h = !0,
|
|
20
|
+
percentDecimals: m = 2,
|
|
21
|
+
sx: R,
|
|
22
|
+
...I
|
|
23
|
+
} = v, c = j(), w = `hc-pie-chart-${z().replace(/:/g, "")}`, g = H(null), i = o.length > 1;
|
|
24
|
+
let d = null;
|
|
25
|
+
o.length < 1 ? d = "Missing values config!" : !i && t.length < 1 && (d = "Missing dimensions config!"), $(() => {
|
|
26
|
+
if (d) return;
|
|
27
|
+
let x;
|
|
28
|
+
return x = setTimeout(() => {
|
|
29
|
+
var F, S;
|
|
30
|
+
const e = B.new(w);
|
|
31
|
+
g.current = e, G(e, (F = o == null ? void 0 : o[0]) == null ? void 0 : F.format), e.setThemes([E.new(e)]);
|
|
32
|
+
const y = e.container.children.push(
|
|
33
|
+
Q.new(e, {
|
|
29
34
|
layout: e.verticalLayout
|
|
30
35
|
})
|
|
31
36
|
);
|
|
32
37
|
e.interfaceColors.setAll({
|
|
33
|
-
text:
|
|
34
|
-
grid:
|
|
35
|
-
stroke:
|
|
38
|
+
text: u(c.palette.text.primary),
|
|
39
|
+
grid: u(c.palette.divider),
|
|
40
|
+
stroke: u(c.palette.divider)
|
|
36
41
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
const V = i ? o.map((a) => {
|
|
43
|
+
var s;
|
|
44
|
+
return {
|
|
45
|
+
category: a.label || a.name || a.fieldName,
|
|
46
|
+
value: (s = n[0]) == null ? void 0 : s[a.dataFieldName]
|
|
47
|
+
};
|
|
48
|
+
}) : n, r = y.series.push(
|
|
49
|
+
U.new(e, {
|
|
50
|
+
valueField: i ? "value" : o[0].dataFieldName,
|
|
51
|
+
categoryField: i ? "category" : t[0].value
|
|
41
52
|
})
|
|
42
53
|
);
|
|
43
|
-
r.set("colors",
|
|
44
|
-
const
|
|
45
|
-
r.slices.template.set("tooltipText",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
r.set("colors", J(e, T));
|
|
55
|
+
const L = b({ percentDecimals: m, showValueText: h });
|
|
56
|
+
r.slices.template.set("tooltipText", L), r.labels.template.set("text", L);
|
|
57
|
+
const M = (a, s) => {
|
|
58
|
+
const D = O(s);
|
|
59
|
+
return D === void 0 ? a : b({ percentDecimals: m, showValueText: h, percent: D });
|
|
60
|
+
};
|
|
61
|
+
r.slices.template.adapters.add("tooltipText", M), r.labels.template.adapters.add("text", M), !i && t[0].type === "date" && n.forEach((a) => {
|
|
62
|
+
let s = "YYYY";
|
|
63
|
+
t[0].value.includes("month") ? s = "MMM YYYY" : t[0].value.includes("day") && (s = "DD MMM YYYY"), a[t[0].value] = k(a[t[0].value]).format(
|
|
64
|
+
s
|
|
49
65
|
);
|
|
50
|
-
}), r.data.setAll(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
}), r.data.setAll(V);
|
|
67
|
+
const P = y.children.push(
|
|
68
|
+
W.new(e, {
|
|
69
|
+
centerX: f(50),
|
|
70
|
+
x: f(50),
|
|
54
71
|
marginTop: 15,
|
|
55
72
|
marginBottom: 15
|
|
56
73
|
})
|
|
57
|
-
)
|
|
58
|
-
|
|
74
|
+
);
|
|
75
|
+
K(P, m), P.data.setAll(r.dataItems);
|
|
76
|
+
const l = t[0], p = l ? (S = n[0]) == null ? void 0 : S[l.value] : void 0;
|
|
77
|
+
Y && i && l && p != null && p !== "" && y.children.push(
|
|
78
|
+
Z.new(e, {
|
|
79
|
+
text: l.type === "date" ? q(p, l.dateFormat, l.value) : String(p),
|
|
80
|
+
centerX: f(50),
|
|
81
|
+
x: f(50),
|
|
82
|
+
fill: u(c.palette.text.secondary),
|
|
83
|
+
fontSize: 12,
|
|
84
|
+
paddingBottom: 8
|
|
85
|
+
})
|
|
86
|
+
), r.appear(1e3, 100);
|
|
87
|
+
}, C), () => {
|
|
59
88
|
var e;
|
|
60
|
-
|
|
89
|
+
x && clearTimeout(x), (e = g.current) == null || e.dispose(), g.current = null;
|
|
61
90
|
};
|
|
62
|
-
}, [
|
|
63
|
-
|
|
64
|
-
|
|
91
|
+
}, [
|
|
92
|
+
n,
|
|
93
|
+
t,
|
|
94
|
+
o,
|
|
95
|
+
c.palette.mode,
|
|
96
|
+
T,
|
|
97
|
+
Y,
|
|
98
|
+
h,
|
|
99
|
+
m
|
|
100
|
+
]);
|
|
101
|
+
const N = { ...v };
|
|
102
|
+
return { chartId: w, ownerState: N, sx: R, error: d, other: I };
|
|
65
103
|
};
|
|
66
104
|
export {
|
|
67
|
-
|
|
105
|
+
me as usePieChartLogic
|
|
68
106
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -837,7 +837,31 @@ export declare type DonutChartComponentOverride<Theme = unknown> = {
|
|
|
837
837
|
styleOverrides?: ComponentsOverrides_2<Theme>["HCDonutChart"];
|
|
838
838
|
};
|
|
839
839
|
|
|
840
|
-
export declare
|
|
840
|
+
export declare interface DonutChartProps extends ChartProps {
|
|
841
|
+
/**
|
|
842
|
+
* Show the row's dimension value (e.g. which record the breakdown belongs to)
|
|
843
|
+
* as a caption under the legend. Only takes effect when more than one value is
|
|
844
|
+
* configured — each value then becomes a slice and the dimension labels
|
|
845
|
+
* nothing on the chart. Defaults to `false`.
|
|
846
|
+
*/
|
|
847
|
+
showDimensionLabel?: boolean;
|
|
848
|
+
/**
|
|
849
|
+
* Append the raw value to each slice's label and tooltip, after the
|
|
850
|
+
* percentage — "Up: 62.00% (0.62)". Turn it off for a percentage-only
|
|
851
|
+
* "Up: 62.00%", e.g. when the value and the percentage say the same thing.
|
|
852
|
+
* Defaults to `true`.
|
|
853
|
+
*/
|
|
854
|
+
showValueText?: boolean;
|
|
855
|
+
/**
|
|
856
|
+
* Decimal places for the percentage on slice labels and tooltips. Independent
|
|
857
|
+
* of a value's own `format.decimals`, which describes the measure's scale
|
|
858
|
+
* rather than its share of the total. Defaults to `2`.
|
|
859
|
+
*
|
|
860
|
+
* A share too small to survive this rounding is not reported as "0" — it
|
|
861
|
+
* escalates precision until a digit shows (see `formatPercent`).
|
|
862
|
+
*/
|
|
863
|
+
percentDecimals?: number;
|
|
864
|
+
}
|
|
841
865
|
|
|
842
866
|
export declare const DrillDownTreemap: (inProps: DrillDownTreemapProps) => JSX_2.Element;
|
|
843
867
|
|
|
@@ -1813,7 +1837,31 @@ export declare type PieChartComponentOverride<Theme = unknown> = {
|
|
|
1813
1837
|
styleOverrides?: ComponentsOverrides_2<Theme>["HCPieChart"];
|
|
1814
1838
|
};
|
|
1815
1839
|
|
|
1816
|
-
export declare
|
|
1840
|
+
export declare interface PieChartProps extends ChartProps {
|
|
1841
|
+
/**
|
|
1842
|
+
* Show the row's dimension value (e.g. which record the breakdown belongs to)
|
|
1843
|
+
* as a caption under the legend. Only takes effect when more than one value is
|
|
1844
|
+
* configured — each value then becomes a slice and the dimension labels
|
|
1845
|
+
* nothing on the chart. Defaults to `false`.
|
|
1846
|
+
*/
|
|
1847
|
+
showDimensionLabel?: boolean;
|
|
1848
|
+
/**
|
|
1849
|
+
* Append the raw value to each slice's label and tooltip, after the
|
|
1850
|
+
* percentage — "Up: 62.00% (0.62)". Turn it off for a percentage-only
|
|
1851
|
+
* "Up: 62.00%", e.g. when the value and the percentage say the same thing.
|
|
1852
|
+
* Defaults to `true`.
|
|
1853
|
+
*/
|
|
1854
|
+
showValueText?: boolean;
|
|
1855
|
+
/**
|
|
1856
|
+
* Decimal places for the percentage on slice labels and tooltips. Independent
|
|
1857
|
+
* of a value's own `format.decimals`, which describes the measure's scale
|
|
1858
|
+
* rather than its share of the total. Defaults to `2`.
|
|
1859
|
+
*
|
|
1860
|
+
* A share too small to survive this rounding is not reported as "0" — it
|
|
1861
|
+
* escalates precision until a digit shows (see `formatPercent`).
|
|
1862
|
+
*/
|
|
1863
|
+
percentDecimals?: number;
|
|
1864
|
+
}
|
|
1817
1865
|
|
|
1818
1866
|
export declare const Placeholder: (props: PlaceholderProps) => JSX_2.Element;
|
|
1819
1867
|
|