@thebuoyant-tsdev/mui-ts-library 2.4.0 → 2.6.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/README.de.md +11 -1
- package/README.md +11 -1
- package/dist/components/chord-chart/ChordChart.d.ts +1 -1
- package/dist/components/chord-chart/ChordChart.types.d.ts +15 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.d.ts +5 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.types.d.ts +104 -0
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.d.ts +5 -0
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.d.ts +95 -0
- package/dist/components/radial-tree-chart/RadialTreeChart.types.d.ts +6 -0
- package/dist/components/sunburst-chart/SunburstChart.types.d.ts +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +966 -80
- package/package.json +62 -24
package/dist/index.js
CHANGED
|
@@ -5916,6 +5916,7 @@ function Kr({ data: e, size: n = 500, showSegmentLabels: r = !0, innerRadius: i
|
|
|
5916
5916
|
]), [P, F] = c(M), [I, L] = c(M);
|
|
5917
5917
|
I !== M && (L(M), F(M));
|
|
5918
5918
|
let R = o(() => M.children?.map((e) => e.data.name) ?? [M.data.name], [M]), B = o(() => Z.scaleOrdinal().domain(R).range(j), [j, R]), H = (e) => {
|
|
5919
|
+
if (e.data.colorConfig?.fill) return e.data.colorConfig.fill;
|
|
5919
5920
|
let t = e;
|
|
5920
5921
|
for (; t.depth > 1;) t = t.parent;
|
|
5921
5922
|
return B(t.data.name);
|
|
@@ -6208,19 +6209,19 @@ function Xr({ sourceName: e, targetName: t, sourceValue: n, targetValue: r, dire
|
|
|
6208
6209
|
]
|
|
6209
6210
|
});
|
|
6210
6211
|
}
|
|
6211
|
-
function Zr({ data: e, size: n = 500, innerRadius: r, ringThickness: i = 20, padAngle: l, ribbonPadAngle: u, sortSubgroups: f = "descending", sortChords: p = "descending", chartColors: m,
|
|
6212
|
-
let
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
],
|
|
6220
|
-
b,
|
|
6212
|
+
function Zr({ data: e, size: n = 500, innerRadius: r, ringThickness: i = 20, padAngle: l, ribbonPadAngle: u, sortSubgroups: f = "descending", sortChords: p = "descending", chartColors: m, groupColorConfigs: h, showGroupLabels: g = !0, labelOffset: _ = 8, ribbonOpacity: v = .75, ribbonBlendMode: y = "multiply", directed: b = !0, valueDecimalCount: x = 0, valueDecimalSeparator: S = ".", valueThousandsSeparator: C = ",", onGroupClick: w, onChordClick: T, zoomable: E = !1, disabled: D = !1 }) {
|
|
6213
|
+
let O = V(), k = [
|
|
6214
|
+
O.palette.primary.main,
|
|
6215
|
+
O.palette.secondary.main,
|
|
6216
|
+
O.palette.error.main,
|
|
6217
|
+
O.palette.warning.main,
|
|
6218
|
+
O.palette.success.main,
|
|
6219
|
+
O.palette.info.main
|
|
6220
|
+
], A = m && m.length > 0 ? m : k, j = r ?? Math.min(n, n) * .5 - 90, M = Math.max(10, j), N = M + Math.max(1, i), P = l ?? 10 / M, F = u ?? 1 / M, I = t((e) => Jr(e, x, S, C), [
|
|
6221
6221
|
x,
|
|
6222
|
-
S
|
|
6223
|
-
|
|
6222
|
+
S,
|
|
6223
|
+
C
|
|
6224
|
+
]), { names: L, matrix: R } = o(() => {
|
|
6224
6225
|
let t = Z.sort(Z.union(e.map((e) => e.source), e.map((e) => e.target))), n = new Map(t.map((e, t) => [e, t])), r = Array.from({ length: t.length }, () => Array(t.length).fill(0));
|
|
6225
6226
|
for (let { source: t, target: i, value: a } of e) {
|
|
6226
6227
|
let e = n.get(t), o = n.get(i);
|
|
@@ -6230,152 +6231,174 @@ function Zr({ data: e, size: n = 500, innerRadius: r, ringThickness: i = 20, pad
|
|
|
6230
6231
|
names: t,
|
|
6231
6232
|
matrix: r
|
|
6232
6233
|
};
|
|
6233
|
-
}, [e]),
|
|
6234
|
-
let e = (
|
|
6235
|
-
return f === "ascending" && (e = e.sortSubgroups(Z.ascending)), f === "descending" && (e = e.sortSubgroups(Z.descending)), p === "ascending" && (e = e.sortChords(Z.ascending)), p === "descending" && (e = e.sortChords(Z.descending)), e(
|
|
6234
|
+
}, [e]), B = o(() => {
|
|
6235
|
+
let e = (b ? Z.chordDirected() : Z.chord()).padAngle(P);
|
|
6236
|
+
return f === "ascending" && (e = e.sortSubgroups(Z.ascending)), f === "descending" && (e = e.sortSubgroups(Z.descending)), p === "ascending" && (e = e.sortChords(Z.ascending)), p === "descending" && (e = e.sortChords(Z.descending)), e(R);
|
|
6236
6237
|
}, [
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6238
|
+
R,
|
|
6239
|
+
P,
|
|
6240
|
+
b,
|
|
6240
6241
|
f,
|
|
6241
6242
|
p
|
|
6242
|
-
]),
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
]),
|
|
6243
|
+
]), H = o(() => Z.arc().innerRadius(M).outerRadius(N), [M, N]), U = o(() => (b ? Z.ribbonArrow() : Z.ribbon()).radius(M - 1).padAngle(F), [
|
|
6244
|
+
M,
|
|
6245
|
+
F,
|
|
6246
|
+
b
|
|
6247
|
+
]), W = t((e) => U({
|
|
6247
6248
|
source: {
|
|
6248
6249
|
startAngle: e.source.startAngle,
|
|
6249
6250
|
endAngle: e.source.endAngle,
|
|
6250
|
-
radius:
|
|
6251
|
+
radius: M - 1
|
|
6251
6252
|
},
|
|
6252
6253
|
target: {
|
|
6253
6254
|
startAngle: e.target.startAngle,
|
|
6254
6255
|
endAngle: e.target.endAngle,
|
|
6255
|
-
radius:
|
|
6256
|
+
radius: M - 1
|
|
6256
6257
|
}
|
|
6257
|
-
}) ?? "", [
|
|
6258
|
+
}) ?? "", [U, M]), ee = o(() => Z.scaleOrdinal().domain(Z.range(L.length)).range(A.length >= L.length ? A : [...Array(Math.ceil(L.length / A.length))].flatMap(() => A).slice(0, L.length)), [A, L.length]), G = t((e) => h?.[L[e]]?.fill ?? ee(e), [
|
|
6259
|
+
h,
|
|
6260
|
+
L,
|
|
6261
|
+
ee
|
|
6262
|
+
]), J = s(null), [te, ne] = c(`-${n / 2} -${n / 2} ${n} ${n}`), [re, ie] = c(1), ae = o(() => {
|
|
6263
|
+
if (re === 1) return te;
|
|
6264
|
+
let [e, t, n, r] = te.split(" ").map(Number), i = n / re, a = r / re;
|
|
6265
|
+
return `${e + (n - i) / 2} ${t + (r - a) / 2} ${i} ${a}`;
|
|
6266
|
+
}, [te, re]);
|
|
6258
6267
|
a(() => {
|
|
6259
|
-
let e =
|
|
6268
|
+
let e = J.current;
|
|
6260
6269
|
if (!e) return;
|
|
6261
6270
|
let t = requestAnimationFrame(() => {
|
|
6262
6271
|
try {
|
|
6263
6272
|
let t = e.getBBox();
|
|
6264
|
-
|
|
6273
|
+
ne(`${t.x - 8} ${t.y - 8} ${t.width + 16} ${t.height + 16}`);
|
|
6265
6274
|
} catch {
|
|
6266
|
-
|
|
6275
|
+
ne(`-${n / 2} -${n / 2} ${n} ${n}`);
|
|
6267
6276
|
}
|
|
6268
6277
|
});
|
|
6269
6278
|
return () => cancelAnimationFrame(t);
|
|
6270
6279
|
}, [
|
|
6271
6280
|
n,
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6281
|
+
M,
|
|
6282
|
+
N,
|
|
6283
|
+
L.length,
|
|
6284
|
+
B
|
|
6276
6285
|
]);
|
|
6277
|
-
let [
|
|
6278
|
-
name:
|
|
6286
|
+
let [Y, oe] = c(null), se = t((e) => ({
|
|
6287
|
+
name: L[e.index],
|
|
6279
6288
|
index: e.index,
|
|
6280
|
-
valueOut: Z.sum(
|
|
6281
|
-
valueIn: Z.sum(
|
|
6282
|
-
}), [
|
|
6289
|
+
valueOut: Z.sum(B, (t) => t.source.index === e.index ? t.source.value : 0),
|
|
6290
|
+
valueIn: Z.sum(B, (t) => t.target.index === e.index ? t.source.value : 0)
|
|
6291
|
+
}), [L, B]), ce = t((e) => ({
|
|
6283
6292
|
source: {
|
|
6284
|
-
name:
|
|
6293
|
+
name: L[e.source.index],
|
|
6285
6294
|
index: e.source.index,
|
|
6286
6295
|
value: e.source.value
|
|
6287
6296
|
},
|
|
6288
6297
|
target: {
|
|
6289
|
-
name:
|
|
6298
|
+
name: L[e.target.index],
|
|
6290
6299
|
index: e.target.index,
|
|
6291
6300
|
value: e.target.value
|
|
6292
6301
|
}
|
|
6293
|
-
}), [
|
|
6302
|
+
}), [L]), le = (e) => {
|
|
6294
6303
|
let t = (e.startAngle + e.endAngle) / 2, n = t * 180 / Math.PI - 90, r = t > Math.PI ? " rotate(180)" : "";
|
|
6295
|
-
return `rotate(${n}) translate(${
|
|
6296
|
-
},
|
|
6304
|
+
return `rotate(${n}) translate(${N + _})${r}`;
|
|
6305
|
+
}, ue = (e) => (e.startAngle + e.endAngle) / 2 > Math.PI ? "end" : "start", de = t((e) => {
|
|
6306
|
+
if (!E || D || !e.ctrlKey) return;
|
|
6307
|
+
e.preventDefault();
|
|
6308
|
+
let t = e.deltaY < 0 ? 1.15 : 1 / 1.15;
|
|
6309
|
+
ie((e) => Math.max(.25, Math.min(8, e * t)));
|
|
6310
|
+
}, [E, D]);
|
|
6311
|
+
a(() => {
|
|
6312
|
+
if (!E) return;
|
|
6313
|
+
let e = (e) => {
|
|
6314
|
+
e.key === "Escape" && ie(1);
|
|
6315
|
+
};
|
|
6316
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
6317
|
+
}, [E]);
|
|
6318
|
+
let fe = {
|
|
6297
6319
|
followCursor: !0,
|
|
6298
6320
|
enterDelay: 50,
|
|
6299
6321
|
enterNextDelay: 0,
|
|
6300
|
-
disableHoverListener:
|
|
6322
|
+
disableHoverListener: D,
|
|
6301
6323
|
slotProps: { tooltip: { sx: { maxWidth: 240 } } }
|
|
6302
|
-
},
|
|
6324
|
+
}, pe = O.palette.text.primary, me = O.typography.fontFamily;
|
|
6303
6325
|
return /* @__PURE__ */ K(d, {
|
|
6304
6326
|
sx: {
|
|
6305
6327
|
display: "inline-flex",
|
|
6306
|
-
opacity:
|
|
6307
|
-
cursor:
|
|
6328
|
+
opacity: D ? .5 : 1,
|
|
6329
|
+
cursor: D ? "not-allowed" : "default",
|
|
6308
6330
|
userSelect: "none"
|
|
6309
6331
|
},
|
|
6310
6332
|
children: /* @__PURE__ */ K("svg", {
|
|
6311
6333
|
width: n,
|
|
6312
6334
|
height: n,
|
|
6313
|
-
viewBox:
|
|
6335
|
+
viewBox: ae,
|
|
6336
|
+
onWheel: de,
|
|
6314
6337
|
style: {
|
|
6315
|
-
fontFamily:
|
|
6316
|
-
overflow: "visible"
|
|
6338
|
+
fontFamily: me ?? "sans-serif",
|
|
6339
|
+
overflow: E && re > 1 ? "hidden" : "visible"
|
|
6317
6340
|
},
|
|
6318
6341
|
role: "img",
|
|
6319
6342
|
"aria-label": "Chord chart",
|
|
6320
6343
|
children: /* @__PURE__ */ q("g", {
|
|
6321
|
-
ref:
|
|
6322
|
-
children: [/* @__PURE__ */ K("g", { children:
|
|
6323
|
-
let t =
|
|
6344
|
+
ref: J,
|
|
6345
|
+
children: [/* @__PURE__ */ K("g", { children: B.groups.map((e) => {
|
|
6346
|
+
let t = se(e), n = Y === e.index, r = Y !== null && !n;
|
|
6324
6347
|
return /* @__PURE__ */ K(z, {
|
|
6325
|
-
...
|
|
6348
|
+
...fe,
|
|
6326
6349
|
title: /* @__PURE__ */ K(Yr, {
|
|
6327
6350
|
name: t.name,
|
|
6328
6351
|
valueOut: t.valueOut,
|
|
6329
6352
|
valueIn: t.valueIn,
|
|
6330
|
-
fmt:
|
|
6353
|
+
fmt: I
|
|
6331
6354
|
}),
|
|
6332
6355
|
children: /* @__PURE__ */ q("g", {
|
|
6333
|
-
style: { cursor:
|
|
6334
|
-
onMouseEnter: () => !
|
|
6335
|
-
onMouseLeave: () =>
|
|
6336
|
-
onClick: (e) => !
|
|
6356
|
+
style: { cursor: D ? "not-allowed" : "pointer" },
|
|
6357
|
+
onMouseEnter: () => !D && oe(e.index),
|
|
6358
|
+
onMouseLeave: () => oe(null),
|
|
6359
|
+
onClick: (e) => !D && w?.(t, e),
|
|
6337
6360
|
children: [/* @__PURE__ */ K("path", {
|
|
6338
|
-
d:
|
|
6339
|
-
fill:
|
|
6340
|
-
stroke:
|
|
6361
|
+
d: H(e) || "",
|
|
6362
|
+
fill: G(e.index),
|
|
6363
|
+
stroke: O.palette.divider,
|
|
6341
6364
|
opacity: r ? .35 : 1,
|
|
6342
6365
|
style: { transition: "opacity 0.15s" }
|
|
6343
|
-
}),
|
|
6366
|
+
}), g && /* @__PURE__ */ K("text", {
|
|
6344
6367
|
dy: "0.35em",
|
|
6345
6368
|
fontSize: 11,
|
|
6346
|
-
fill:
|
|
6347
|
-
transform:
|
|
6348
|
-
textAnchor:
|
|
6369
|
+
fill: pe,
|
|
6370
|
+
transform: le(e),
|
|
6371
|
+
textAnchor: ue(e),
|
|
6349
6372
|
pointerEvents: "none",
|
|
6350
|
-
children:
|
|
6373
|
+
children: L[e.index]
|
|
6351
6374
|
})]
|
|
6352
6375
|
})
|
|
6353
6376
|
}, `grp-tt-${e.index}`);
|
|
6354
6377
|
}) }), /* @__PURE__ */ K("g", {
|
|
6355
|
-
fillOpacity:
|
|
6356
|
-
style: { mixBlendMode:
|
|
6357
|
-
children:
|
|
6358
|
-
let n =
|
|
6378
|
+
fillOpacity: v,
|
|
6379
|
+
style: { mixBlendMode: y },
|
|
6380
|
+
children: B.map((e, t) => {
|
|
6381
|
+
let n = ce(e), r = Y === null || e.source.index === Y || e.target.index === Y;
|
|
6359
6382
|
return /* @__PURE__ */ K(z, {
|
|
6360
|
-
...
|
|
6383
|
+
...fe,
|
|
6361
6384
|
title: /* @__PURE__ */ K(Xr, {
|
|
6362
6385
|
sourceName: n.source.name,
|
|
6363
6386
|
targetName: n.target.name,
|
|
6364
6387
|
sourceValue: n.source.value,
|
|
6365
6388
|
targetValue: n.target.value,
|
|
6366
|
-
directed:
|
|
6367
|
-
fmt:
|
|
6389
|
+
directed: b,
|
|
6390
|
+
fmt: I
|
|
6368
6391
|
}),
|
|
6369
6392
|
children: /* @__PURE__ */ K("path", {
|
|
6370
|
-
d:
|
|
6371
|
-
fill:
|
|
6393
|
+
d: W(e),
|
|
6394
|
+
fill: G(e.target.index),
|
|
6372
6395
|
stroke: "none",
|
|
6373
6396
|
opacity: r ? 1 : .12,
|
|
6374
6397
|
style: {
|
|
6375
|
-
cursor:
|
|
6398
|
+
cursor: D ? "not-allowed" : "pointer",
|
|
6376
6399
|
transition: "opacity 0.15s"
|
|
6377
6400
|
},
|
|
6378
|
-
onClick: (e) => !
|
|
6401
|
+
onClick: (e) => !D && T?.(n, e)
|
|
6379
6402
|
})
|
|
6380
6403
|
}, `chord-tt-${t}`);
|
|
6381
6404
|
})
|
|
@@ -6491,7 +6514,7 @@ function ri({ data: e, size: n = 600, autoFit: r = !0, sortBy: i = "name", showL
|
|
|
6491
6514
|
p,
|
|
6492
6515
|
m,
|
|
6493
6516
|
h
|
|
6494
|
-
]), L = t((e) => F[e.depth % F.length], [F]), [R, H] = c([e]), U = R[R.length - 1], [W, ee] = c(e);
|
|
6517
|
+
]), L = t((e) => e.data.colorConfig?.fill ?? F[e.depth % F.length], [F]), [R, H] = c([e]), U = R[R.length - 1], [W, ee] = c(e);
|
|
6495
6518
|
W !== e && (ee(e), H([e]));
|
|
6496
6519
|
let G = Math.max(1, n / 2 - 70), J = o(() => {
|
|
6497
6520
|
let e = Z.hierarchy(U);
|
|
@@ -6831,4 +6854,867 @@ function ri({ data: e, size: n = 600, autoFit: r = !0, sortBy: i = "name", showL
|
|
|
6831
6854
|
}
|
|
6832
6855
|
ri.displayName = "RadialTreeChart";
|
|
6833
6856
|
//#endregion
|
|
6834
|
-
|
|
6857
|
+
//#region src/components/circle-packing-chart/CirclePackingChart.tsx
|
|
6858
|
+
var ii = .56;
|
|
6859
|
+
function ai(e, t, n) {
|
|
6860
|
+
return e.length * n * ii <= t ? e : t >= 3 * n * ii + n * 2 ? "…" : "";
|
|
6861
|
+
}
|
|
6862
|
+
function oi({ data: e, size: n = 600, padding: r = 3, sortBy: i = "value", showLabels: l = !0, showAllLabels: u = !1, labelFontSize: f = 13, innerLabelFontSize: p = 9, labelColor: m, chartColors: h, depthColorStart: g, depthColorEnd: _, background: v, duration: y = 750, zoomable: b = !1, disabled: x = !1, onCircleClick: S, onZoomChange: C }) {
|
|
6863
|
+
let w = V(), T = [
|
|
6864
|
+
w.palette.primary.main,
|
|
6865
|
+
w.palette.secondary.main,
|
|
6866
|
+
w.palette.error.main,
|
|
6867
|
+
w.palette.warning.main,
|
|
6868
|
+
w.palette.success.main,
|
|
6869
|
+
w.palette.info.main
|
|
6870
|
+
], E = m ?? w.palette.text.primary, D = v ?? w.palette.background.default, O = w.typography.fontFamily, k = o(() => {
|
|
6871
|
+
let t = Z.hierarchy(e).sum((e) => e.value ?? 0);
|
|
6872
|
+
return i === "value" ? t.sort((e, t) => (t.value ?? 0) - (e.value ?? 0)) : t.sort((e, t) => String(e.data.name).localeCompare(String(t.data.name), void 0, {
|
|
6873
|
+
numeric: !0,
|
|
6874
|
+
sensitivity: "base"
|
|
6875
|
+
})), Z.pack().size([n, n]).padding(r)(t);
|
|
6876
|
+
}, [
|
|
6877
|
+
e,
|
|
6878
|
+
n,
|
|
6879
|
+
r,
|
|
6880
|
+
i
|
|
6881
|
+
]), A = k.descendants(), j = o(() => Z.max(A, (e) => e.depth) ?? 0, [A]), M = !!(g && _), N = o(() => M ? Z.scaleSequential(Z.interpolateHcl(g, _)).domain([0, Math.max(1, j)]) : null, [
|
|
6882
|
+
M,
|
|
6883
|
+
g,
|
|
6884
|
+
_,
|
|
6885
|
+
j
|
|
6886
|
+
]), P = h && h.length > 0 ? h : T, F = t((e) => e.data.colorConfig?.fill ? e.data.colorConfig.fill : M && N ? e.children ? N(e.depth) : w.palette.background.paper : P[e.depth % P.length], [
|
|
6887
|
+
M,
|
|
6888
|
+
N,
|
|
6889
|
+
P,
|
|
6890
|
+
w
|
|
6891
|
+
]), [I, L] = c(1), R = t((e) => {
|
|
6892
|
+
if (!b || x || !e.ctrlKey) return;
|
|
6893
|
+
e.preventDefault();
|
|
6894
|
+
let t = e.deltaY < 0 ? 1.15 : 1 / 1.15;
|
|
6895
|
+
L((e) => Math.max(.25, Math.min(8, e * t)));
|
|
6896
|
+
}, [b, x]);
|
|
6897
|
+
a(() => {
|
|
6898
|
+
if (!b) return;
|
|
6899
|
+
let e = (e) => {
|
|
6900
|
+
e.key === "Escape" && L(1);
|
|
6901
|
+
};
|
|
6902
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
6903
|
+
}, [b]);
|
|
6904
|
+
let H = o(() => {
|
|
6905
|
+
let e = `${-n / 2} ${-n / 2} ${n} ${n}`;
|
|
6906
|
+
if (I === 1) return e;
|
|
6907
|
+
let t = n / I, r = (n - t) / 2;
|
|
6908
|
+
return `${-n / 2 + r} ${-n / 2 + r} ${t} ${t}`;
|
|
6909
|
+
}, [n, I]), U = t((e) => {
|
|
6910
|
+
let t = e.value ?? 0, n = k.value ?? 0;
|
|
6911
|
+
return {
|
|
6912
|
+
id: e.data.id ?? null,
|
|
6913
|
+
name: e.data.name,
|
|
6914
|
+
value: t || null,
|
|
6915
|
+
percentage: n > 0 ? Math.round(t / n * 1e4) / 100 : 0,
|
|
6916
|
+
depth: e.depth,
|
|
6917
|
+
path: e.ancestors().map((e) => e.data.name).reverse(),
|
|
6918
|
+
childrenCount: e.children?.length ?? 0,
|
|
6919
|
+
data: e.data
|
|
6920
|
+
};
|
|
6921
|
+
}, [k]), W = s(null), ee = s([
|
|
6922
|
+
k.x,
|
|
6923
|
+
k.y,
|
|
6924
|
+
k.r * 2
|
|
6925
|
+
]), G = s(k), [J, te] = c(k), ne = t((e) => {
|
|
6926
|
+
G.current = e, te(e);
|
|
6927
|
+
}, []), [re, ie] = c(e);
|
|
6928
|
+
re !== e && (ie(e), ne(k), G.current = k);
|
|
6929
|
+
let ae = t((e) => {
|
|
6930
|
+
let t = W.current;
|
|
6931
|
+
if (!t) return;
|
|
6932
|
+
ee.current = e;
|
|
6933
|
+
let r = n / e[2], i = G.current, a = t.querySelectorAll("g[data-role='nodes'] > g"), o = t.querySelectorAll("g[data-role='nodes'] > g > circle");
|
|
6934
|
+
for (let t = 0; t < A.length; t++) {
|
|
6935
|
+
let n = A[t], i = a[t];
|
|
6936
|
+
i && i.setAttribute("transform", `translate(${(n.x - e[0]) * r},${(n.y - e[1]) * r})`);
|
|
6937
|
+
let s = t - 1;
|
|
6938
|
+
s >= 0 && o[s] && o[s].setAttribute("r", String(n.r * r));
|
|
6939
|
+
}
|
|
6940
|
+
if (l) {
|
|
6941
|
+
let n = t.querySelectorAll("g[data-role='labels'] > text");
|
|
6942
|
+
for (let t = 0; t < A.length; t++) {
|
|
6943
|
+
let i = A[t], a = n[t];
|
|
6944
|
+
a && (a.setAttribute("transform", `translate(${(i.x - e[0]) * r},${(i.y - e[1]) * r})`), a.setAttribute("font-weight", i.children ? "bold" : "normal"));
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
if (u) {
|
|
6948
|
+
let n = t.querySelectorAll("g[data-role='inner-labels'] > text");
|
|
6949
|
+
for (let t = 0; t < A.length; t++) {
|
|
6950
|
+
let a = A[t], o = n[t];
|
|
6951
|
+
if (!o) continue;
|
|
6952
|
+
let s = a.r * r, c = s * 1.6, l = i === k ? a !== k : a.ancestors().includes(i), u = a.parent === i;
|
|
6953
|
+
if (l && !u && s >= 14) {
|
|
6954
|
+
let t = ai(a.data.name, c, p);
|
|
6955
|
+
t ? (o.textContent = t, o.setAttribute("transform", `translate(${(a.x - e[0]) * r},${(a.y - e[1]) * r})`), o.setAttribute("font-weight", a.children ? "bold" : "normal"), o.style.display = "inline") : o.style.display = "none";
|
|
6956
|
+
} else o.style.display = "none";
|
|
6957
|
+
}
|
|
6958
|
+
}
|
|
6959
|
+
}, [
|
|
6960
|
+
A,
|
|
6961
|
+
n,
|
|
6962
|
+
l,
|
|
6963
|
+
u,
|
|
6964
|
+
p,
|
|
6965
|
+
k
|
|
6966
|
+
]);
|
|
6967
|
+
a(() => {
|
|
6968
|
+
ae([
|
|
6969
|
+
J.x,
|
|
6970
|
+
J.y,
|
|
6971
|
+
J.r * 2
|
|
6972
|
+
]);
|
|
6973
|
+
}, [
|
|
6974
|
+
k,
|
|
6975
|
+
n,
|
|
6976
|
+
J,
|
|
6977
|
+
ae
|
|
6978
|
+
]);
|
|
6979
|
+
let Y = t((e, t) => {
|
|
6980
|
+
let n = W.current;
|
|
6981
|
+
if (!n) return;
|
|
6982
|
+
let r = J, i = ee.current, a = [
|
|
6983
|
+
e.x,
|
|
6984
|
+
e.y,
|
|
6985
|
+
e.r * 2
|
|
6986
|
+
];
|
|
6987
|
+
ne(e), Z.select(n).transition().duration(t).ease(Z.easeCubic).tween("zoom", () => {
|
|
6988
|
+
let e = Z.interpolateZoom(i, a);
|
|
6989
|
+
return (t) => ae(e(t));
|
|
6990
|
+
});
|
|
6991
|
+
let o = n.querySelectorAll("g[data-role='labels'] > text");
|
|
6992
|
+
Z.selectAll(o).transition().duration(t).ease(Z.easeCubic).style("fill-opacity", (t, n) => +(A[n].parent === e)).on("start", function(t, n) {
|
|
6993
|
+
A[n].parent === e && (this.style.display = "inline");
|
|
6994
|
+
}).on("end", function(t, n) {
|
|
6995
|
+
A[n].parent !== e && (this.style.display = "none");
|
|
6996
|
+
}), C?.({
|
|
6997
|
+
previousName: r.data.name,
|
|
6998
|
+
currentName: e.data.name,
|
|
6999
|
+
currentDepth: e.depth,
|
|
7000
|
+
isRoot: e === k
|
|
7001
|
+
});
|
|
7002
|
+
}, [
|
|
7003
|
+
J,
|
|
7004
|
+
A,
|
|
7005
|
+
k,
|
|
7006
|
+
ae,
|
|
7007
|
+
C,
|
|
7008
|
+
ne
|
|
7009
|
+
]), oe = s(null), se = (e) => {
|
|
7010
|
+
oe.current &&= (clearTimeout(oe.current), null), oe.current = setTimeout(() => {
|
|
7011
|
+
e(), oe.current = null;
|
|
7012
|
+
}, 250);
|
|
7013
|
+
}, ce = () => {
|
|
7014
|
+
oe.current &&= (clearTimeout(oe.current), null);
|
|
7015
|
+
};
|
|
7016
|
+
a(() => {
|
|
7017
|
+
if (x) return;
|
|
7018
|
+
let e = (e) => {
|
|
7019
|
+
e.key === "Escape" && (ce(), Y(k, y));
|
|
7020
|
+
};
|
|
7021
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
7022
|
+
}, [
|
|
7023
|
+
x,
|
|
7024
|
+
k,
|
|
7025
|
+
y
|
|
7026
|
+
]);
|
|
7027
|
+
let le = (e) => {
|
|
7028
|
+
if (x || !(e.ctrlKey || e.metaKey)) return;
|
|
7029
|
+
ce(), e.preventDefault();
|
|
7030
|
+
let t = J.parent ?? k;
|
|
7031
|
+
t !== J && Y(t, e.altKey ? Math.max(250, y * 10) : y);
|
|
7032
|
+
}, ue = {
|
|
7033
|
+
followCursor: !0,
|
|
7034
|
+
enterDelay: 50,
|
|
7035
|
+
enterNextDelay: 0,
|
|
7036
|
+
disableHoverListener: x,
|
|
7037
|
+
slotProps: { tooltip: { sx: { maxWidth: 220 } } }
|
|
7038
|
+
};
|
|
7039
|
+
return /* @__PURE__ */ q(d, {
|
|
7040
|
+
sx: {
|
|
7041
|
+
display: "inline-flex",
|
|
7042
|
+
position: "relative",
|
|
7043
|
+
opacity: x ? .5 : 1,
|
|
7044
|
+
cursor: x ? "not-allowed" : "default",
|
|
7045
|
+
userSelect: "none"
|
|
7046
|
+
},
|
|
7047
|
+
children: [/* @__PURE__ */ q("svg", {
|
|
7048
|
+
ref: W,
|
|
7049
|
+
width: n,
|
|
7050
|
+
height: n,
|
|
7051
|
+
viewBox: H,
|
|
7052
|
+
onWheel: R,
|
|
7053
|
+
style: {
|
|
7054
|
+
display: "block",
|
|
7055
|
+
background: D,
|
|
7056
|
+
fontFamily: O ?? "sans-serif",
|
|
7057
|
+
overflow: b && I > 1 ? "hidden" : "visible"
|
|
7058
|
+
},
|
|
7059
|
+
role: "img",
|
|
7060
|
+
"aria-label": e.name,
|
|
7061
|
+
onDoubleClick: le,
|
|
7062
|
+
children: [
|
|
7063
|
+
/* @__PURE__ */ K("g", {
|
|
7064
|
+
"data-role": "nodes",
|
|
7065
|
+
children: A.map((e, t) => {
|
|
7066
|
+
let r = U(e), i = /* @__PURE__ */ q(d, {
|
|
7067
|
+
sx: {
|
|
7068
|
+
py: .5,
|
|
7069
|
+
minWidth: 160
|
|
7070
|
+
},
|
|
7071
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7072
|
+
variant: "caption",
|
|
7073
|
+
sx: {
|
|
7074
|
+
fontWeight: "bold",
|
|
7075
|
+
display: "block",
|
|
7076
|
+
fontSize: "0.8rem"
|
|
7077
|
+
},
|
|
7078
|
+
children: e.data.name
|
|
7079
|
+
}), (e.value ?? 0) > 0 && /* @__PURE__ */ q(d, {
|
|
7080
|
+
sx: {
|
|
7081
|
+
mt: .75,
|
|
7082
|
+
borderTop: "1px solid rgba(255,255,255,0.2)",
|
|
7083
|
+
pt: .75
|
|
7084
|
+
},
|
|
7085
|
+
children: [
|
|
7086
|
+
/* @__PURE__ */ q(d, {
|
|
7087
|
+
sx: {
|
|
7088
|
+
display: "flex",
|
|
7089
|
+
justifyContent: "space-between",
|
|
7090
|
+
gap: 2
|
|
7091
|
+
},
|
|
7092
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7093
|
+
variant: "caption",
|
|
7094
|
+
sx: { opacity: .6 },
|
|
7095
|
+
children: "Value"
|
|
7096
|
+
}), /* @__PURE__ */ K(B, {
|
|
7097
|
+
variant: "caption",
|
|
7098
|
+
children: e.value?.toLocaleString()
|
|
7099
|
+
})]
|
|
7100
|
+
}),
|
|
7101
|
+
/* @__PURE__ */ q(d, {
|
|
7102
|
+
sx: {
|
|
7103
|
+
display: "flex",
|
|
7104
|
+
justifyContent: "space-between",
|
|
7105
|
+
gap: 2
|
|
7106
|
+
},
|
|
7107
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7108
|
+
variant: "caption",
|
|
7109
|
+
sx: { opacity: .6 },
|
|
7110
|
+
children: "Share"
|
|
7111
|
+
}), /* @__PURE__ */ q(B, {
|
|
7112
|
+
variant: "caption",
|
|
7113
|
+
children: [r.percentage, "%"]
|
|
7114
|
+
})]
|
|
7115
|
+
}),
|
|
7116
|
+
e.children && /* @__PURE__ */ q(d, {
|
|
7117
|
+
sx: {
|
|
7118
|
+
display: "flex",
|
|
7119
|
+
justifyContent: "space-between",
|
|
7120
|
+
gap: 2
|
|
7121
|
+
},
|
|
7122
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7123
|
+
variant: "caption",
|
|
7124
|
+
sx: { opacity: .6 },
|
|
7125
|
+
children: "Children"
|
|
7126
|
+
}), /* @__PURE__ */ K(B, {
|
|
7127
|
+
variant: "caption",
|
|
7128
|
+
children: e.children.length
|
|
7129
|
+
})]
|
|
7130
|
+
})
|
|
7131
|
+
]
|
|
7132
|
+
})]
|
|
7133
|
+
});
|
|
7134
|
+
return /* @__PURE__ */ K("g", {
|
|
7135
|
+
transform: `translate(${e.x - n / 2},${e.y - n / 2})`,
|
|
7136
|
+
children: t === 0 ? null : /* @__PURE__ */ K(z, {
|
|
7137
|
+
...ue,
|
|
7138
|
+
title: i,
|
|
7139
|
+
children: /* @__PURE__ */ K("circle", {
|
|
7140
|
+
r: e.r,
|
|
7141
|
+
fill: F(e),
|
|
7142
|
+
stroke: e.data.colorConfig?.stroke ?? w.palette.background.paper,
|
|
7143
|
+
strokeWidth: .75,
|
|
7144
|
+
style: {
|
|
7145
|
+
cursor: x ? "not-allowed" : e.children ? "pointer" : "default",
|
|
7146
|
+
transition: "stroke-width 0.1s"
|
|
7147
|
+
},
|
|
7148
|
+
onMouseEnter: (e) => {
|
|
7149
|
+
x || (e.currentTarget.style.strokeWidth = "2");
|
|
7150
|
+
},
|
|
7151
|
+
onMouseLeave: (e) => {
|
|
7152
|
+
e.currentTarget.style.strokeWidth = "0.75";
|
|
7153
|
+
},
|
|
7154
|
+
onClick: (t) => {
|
|
7155
|
+
if (!x) {
|
|
7156
|
+
if (t.ctrlKey || t.metaKey) {
|
|
7157
|
+
if (e.children) {
|
|
7158
|
+
let n = t.altKey ? Math.max(250, y * 10) : y;
|
|
7159
|
+
se(() => Y(e, n));
|
|
7160
|
+
}
|
|
7161
|
+
return;
|
|
7162
|
+
}
|
|
7163
|
+
S?.(r, t);
|
|
7164
|
+
}
|
|
7165
|
+
},
|
|
7166
|
+
onDoubleClick: (e) => {
|
|
7167
|
+
if (!x && (e.ctrlKey || e.metaKey)) {
|
|
7168
|
+
ce(), e.preventDefault(), e.stopPropagation();
|
|
7169
|
+
let t = J.parent ?? k;
|
|
7170
|
+
t !== J && Y(t, e.altKey ? Math.max(250, y * 10) : y);
|
|
7171
|
+
}
|
|
7172
|
+
}
|
|
7173
|
+
})
|
|
7174
|
+
})
|
|
7175
|
+
}, `n-${t}`);
|
|
7176
|
+
})
|
|
7177
|
+
}),
|
|
7178
|
+
l && /* @__PURE__ */ K("g", {
|
|
7179
|
+
"data-role": "labels",
|
|
7180
|
+
textAnchor: "middle",
|
|
7181
|
+
dominantBaseline: "middle",
|
|
7182
|
+
pointerEvents: "none",
|
|
7183
|
+
fontSize: f,
|
|
7184
|
+
fill: E,
|
|
7185
|
+
children: A.map((e, t) => /* @__PURE__ */ K("text", {
|
|
7186
|
+
transform: `translate(${e.x - n / 2},${e.y - n / 2})`,
|
|
7187
|
+
style: {
|
|
7188
|
+
display: e.parent === k ? "inline" : "none",
|
|
7189
|
+
fillOpacity: +(e.parent === k)
|
|
7190
|
+
},
|
|
7191
|
+
children: e.data.name
|
|
7192
|
+
}, `lbl-${t}`))
|
|
7193
|
+
}),
|
|
7194
|
+
u && /* @__PURE__ */ K("g", {
|
|
7195
|
+
"data-role": "inner-labels",
|
|
7196
|
+
textAnchor: "middle",
|
|
7197
|
+
dominantBaseline: "middle",
|
|
7198
|
+
pointerEvents: "none",
|
|
7199
|
+
fontSize: p,
|
|
7200
|
+
fill: E,
|
|
7201
|
+
children: A.map((e, t) => /* @__PURE__ */ K("text", {
|
|
7202
|
+
transform: `translate(${e.x - n / 2},${e.y - n / 2})`,
|
|
7203
|
+
style: { display: "none" }
|
|
7204
|
+
}, `inner-lbl-${t}`))
|
|
7205
|
+
})
|
|
7206
|
+
]
|
|
7207
|
+
}), J !== k && !x && /* @__PURE__ */ K(d, {
|
|
7208
|
+
sx: {
|
|
7209
|
+
position: "absolute",
|
|
7210
|
+
bottom: 6,
|
|
7211
|
+
left: 0,
|
|
7212
|
+
right: 0,
|
|
7213
|
+
display: "flex",
|
|
7214
|
+
justifyContent: "center",
|
|
7215
|
+
pointerEvents: "none"
|
|
7216
|
+
},
|
|
7217
|
+
children: /* @__PURE__ */ q(B, {
|
|
7218
|
+
variant: "caption",
|
|
7219
|
+
sx: {
|
|
7220
|
+
bgcolor: "action.hover",
|
|
7221
|
+
borderRadius: 1,
|
|
7222
|
+
px: 1,
|
|
7223
|
+
py: .25,
|
|
7224
|
+
color: "text.secondary",
|
|
7225
|
+
fontSize: "0.7rem"
|
|
7226
|
+
},
|
|
7227
|
+
children: [J.ancestors().map((e) => e.data.name).reverse().join(" › "), " · Ctrl / Cmd ⌘+DblClick to zoom out · Escape to reset"]
|
|
7228
|
+
})
|
|
7229
|
+
})]
|
|
7230
|
+
});
|
|
7231
|
+
}
|
|
7232
|
+
oi.displayName = "CirclePackingChart";
|
|
7233
|
+
//#endregion
|
|
7234
|
+
//#region src/components/circle-packing-chart/CirclePackingChart.types.ts
|
|
7235
|
+
var si = { noData: "No data" }, ci = {
|
|
7236
|
+
noData: "No data",
|
|
7237
|
+
specialValueA: "Value A",
|
|
7238
|
+
specialValueB: "Value B"
|
|
7239
|
+
}, li = {
|
|
7240
|
+
folder: "M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z",
|
|
7241
|
+
person: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
|
|
7242
|
+
};
|
|
7243
|
+
function ui({ path: e, size: t }) {
|
|
7244
|
+
let n = t / 2;
|
|
7245
|
+
return /* @__PURE__ */ K("g", {
|
|
7246
|
+
transform: `translate(${-n},${-n})`,
|
|
7247
|
+
pointerEvents: "none",
|
|
7248
|
+
children: /* @__PURE__ */ K("svg", {
|
|
7249
|
+
width: t,
|
|
7250
|
+
height: t,
|
|
7251
|
+
viewBox: "0 0 24 24",
|
|
7252
|
+
overflow: "visible",
|
|
7253
|
+
children: /* @__PURE__ */ K("path", {
|
|
7254
|
+
d: e,
|
|
7255
|
+
fill: "white"
|
|
7256
|
+
})
|
|
7257
|
+
})
|
|
7258
|
+
});
|
|
7259
|
+
}
|
|
7260
|
+
function di({ info: e, labelA: t, labelB: n }) {
|
|
7261
|
+
return /* @__PURE__ */ q(d, {
|
|
7262
|
+
sx: {
|
|
7263
|
+
p: 2,
|
|
7264
|
+
minWidth: 200,
|
|
7265
|
+
maxWidth: 280
|
|
7266
|
+
},
|
|
7267
|
+
children: [/* @__PURE__ */ q(d, {
|
|
7268
|
+
sx: {
|
|
7269
|
+
display: "flex",
|
|
7270
|
+
alignItems: "center",
|
|
7271
|
+
gap: 1.5,
|
|
7272
|
+
mb: 1.5
|
|
7273
|
+
},
|
|
7274
|
+
children: [/* @__PURE__ */ K(u, {
|
|
7275
|
+
sx: {
|
|
7276
|
+
bgcolor: "primary.main",
|
|
7277
|
+
width: 40,
|
|
7278
|
+
height: 40
|
|
7279
|
+
},
|
|
7280
|
+
children: e.name.charAt(0).toUpperCase()
|
|
7281
|
+
}), /* @__PURE__ */ q(d, { children: [/* @__PURE__ */ K(B, {
|
|
7282
|
+
variant: "body2",
|
|
7283
|
+
sx: { fontWeight: "bold" },
|
|
7284
|
+
children: e.name
|
|
7285
|
+
}), e.subname && /* @__PURE__ */ K(B, {
|
|
7286
|
+
variant: "caption",
|
|
7287
|
+
color: "text.secondary",
|
|
7288
|
+
children: e.subname
|
|
7289
|
+
})] })]
|
|
7290
|
+
}), (e.specialValueA != null || e.specialValueB != null) && /* @__PURE__ */ q(G, { children: [
|
|
7291
|
+
/* @__PURE__ */ K(b, { sx: { mb: 1.5 } }),
|
|
7292
|
+
e.specialValueA != null && /* @__PURE__ */ q(d, {
|
|
7293
|
+
sx: {
|
|
7294
|
+
display: "flex",
|
|
7295
|
+
justifyContent: "space-between",
|
|
7296
|
+
mb: .5
|
|
7297
|
+
},
|
|
7298
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7299
|
+
variant: "caption",
|
|
7300
|
+
color: "text.secondary",
|
|
7301
|
+
children: t
|
|
7302
|
+
}), /* @__PURE__ */ K(B, {
|
|
7303
|
+
variant: "caption",
|
|
7304
|
+
children: String(e.specialValueA)
|
|
7305
|
+
})]
|
|
7306
|
+
}),
|
|
7307
|
+
e.specialValueB != null && /* @__PURE__ */ q(d, {
|
|
7308
|
+
sx: {
|
|
7309
|
+
display: "flex",
|
|
7310
|
+
justifyContent: "space-between"
|
|
7311
|
+
},
|
|
7312
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7313
|
+
variant: "caption",
|
|
7314
|
+
color: "text.secondary",
|
|
7315
|
+
children: n
|
|
7316
|
+
}), /* @__PURE__ */ K(B, {
|
|
7317
|
+
variant: "caption",
|
|
7318
|
+
children: String(e.specialValueB)
|
|
7319
|
+
})]
|
|
7320
|
+
})
|
|
7321
|
+
] })]
|
|
7322
|
+
});
|
|
7323
|
+
}
|
|
7324
|
+
function fi({ data: e, orientation: n = "LR", width: r = 800, height: i = 500, levelSpacing: l = 200, nodeRadius: u = 10, sortBy: f = "name", showLabels: p = !0, labelFontSize: m = 12, labelColor: h, showIcons: g = !0, chartColors: _, linkStrokeOpacity: v = .4, linkStrokeWidth: y = 1.5, linkColor: b, zoomable: x = !1, drillable: S = !1, onFocusChange: C, showNodePopover: w = !1, renderNodePopoverContent: T, onNodeClick: E, disabled: D = !1, translation: O }) {
|
|
7325
|
+
let k = V(), A = {
|
|
7326
|
+
...ci,
|
|
7327
|
+
...O
|
|
7328
|
+
}, j = [
|
|
7329
|
+
k.palette.primary.main,
|
|
7330
|
+
k.palette.secondary.main,
|
|
7331
|
+
k.palette.error.main,
|
|
7332
|
+
k.palette.warning.main,
|
|
7333
|
+
k.palette.success.main,
|
|
7334
|
+
k.palette.info.main
|
|
7335
|
+
], M = _ && _.length > 0 ? _ : j, P = h ?? k.palette.text.primary, F = b ?? k.palette.text.secondary, I = k.palette.background.paper, L = k.typography.fontFamily, R = n === "TB" || n === "BT", H = R ? i : r, U = R ? r : i, [W, ee] = c([e]), G = W[W.length - 1], [J, te] = c(e);
|
|
7336
|
+
J !== e && (te(e), ee([e]));
|
|
7337
|
+
let ne = o(() => {
|
|
7338
|
+
let e = Z.hierarchy(G);
|
|
7339
|
+
f === "value" ? (e.sum((e) => e.value ?? 0), e.sort((e, t) => (t.value ?? 0) - (e.value ?? 0))) : e.sort((e, t) => Z.ascending(String(e.data.name), String(t.data.name)));
|
|
7340
|
+
let t = Z.max(e.descendants(), (e) => e.depth) ?? 1;
|
|
7341
|
+
return Z.tree().size([H * .8, Math.min(t * l, U * .85)])(e);
|
|
7342
|
+
}, [
|
|
7343
|
+
G,
|
|
7344
|
+
f,
|
|
7345
|
+
H,
|
|
7346
|
+
U,
|
|
7347
|
+
l
|
|
7348
|
+
]), re = ne.descendants(), ie = ne.links(), ae = t((e) => e.data.colorConfig?.fill ?? M[e.depth % M.length], [M]), Y = t((e) => {
|
|
7349
|
+
switch (n) {
|
|
7350
|
+
case "LR": return {
|
|
7351
|
+
x: e.y,
|
|
7352
|
+
y: e.x - H * .4
|
|
7353
|
+
};
|
|
7354
|
+
case "RL": return {
|
|
7355
|
+
x: U * .85 - e.y,
|
|
7356
|
+
y: e.x - H * .4
|
|
7357
|
+
};
|
|
7358
|
+
case "TB": return {
|
|
7359
|
+
x: e.x - H * .4,
|
|
7360
|
+
y: e.y
|
|
7361
|
+
};
|
|
7362
|
+
case "BT": return {
|
|
7363
|
+
x: e.x - H * .4,
|
|
7364
|
+
y: U * .85 - e.y
|
|
7365
|
+
};
|
|
7366
|
+
}
|
|
7367
|
+
}, [
|
|
7368
|
+
n,
|
|
7369
|
+
H,
|
|
7370
|
+
U
|
|
7371
|
+
]), oe = t((e) => {
|
|
7372
|
+
let t = Y(e.source), r = Y(e.target);
|
|
7373
|
+
if (n === "LR" || n === "RL") {
|
|
7374
|
+
let e = (t.x + r.x) / 2;
|
|
7375
|
+
return `M${t.x},${t.y} C${e},${t.y} ${e},${r.y} ${r.x},${r.y}`;
|
|
7376
|
+
}
|
|
7377
|
+
let i = (t.y + r.y) / 2;
|
|
7378
|
+
return `M${t.x},${t.y} C${t.x},${i} ${r.x},${i} ${r.x},${r.y}`;
|
|
7379
|
+
}, [Y, n]), se = t((e) => ({
|
|
7380
|
+
id: e.data.id ?? null,
|
|
7381
|
+
name: e.data.name,
|
|
7382
|
+
subname: e.data.subname ?? null,
|
|
7383
|
+
value: e.value ?? e.data.value ?? null,
|
|
7384
|
+
specialValueA: e.data.specialValueA ?? null,
|
|
7385
|
+
specialValueB: e.data.specialValueB ?? null,
|
|
7386
|
+
depth: e.depth,
|
|
7387
|
+
path: e.ancestors().map((e) => e.data.name).reverse(),
|
|
7388
|
+
childrenCount: e.children?.length ?? 0,
|
|
7389
|
+
data: e.data
|
|
7390
|
+
}), []), [ce, le] = c(`0 -${i / 2} ${r} ${i}`), [ue, de] = c(1), fe = s(null), pe = o(() => {
|
|
7391
|
+
if (ue === 1) return ce;
|
|
7392
|
+
let [e, t, n, r] = ce.split(" ").map(Number), i = n / ue, a = r / ue;
|
|
7393
|
+
return `${e + (n - i) / 2} ${t + (r - a) / 2} ${i} ${a}`;
|
|
7394
|
+
}, [ce, ue]);
|
|
7395
|
+
a(() => {
|
|
7396
|
+
let e = fe.current;
|
|
7397
|
+
if (!e) return;
|
|
7398
|
+
let t = requestAnimationFrame(() => {
|
|
7399
|
+
try {
|
|
7400
|
+
let t = e.getBBox();
|
|
7401
|
+
le(`${t.x - 24} ${t.y - 24} ${t.width + 48} ${t.height + 48}`);
|
|
7402
|
+
} catch {
|
|
7403
|
+
le(`0 -${i / 2} ${r} ${i}`);
|
|
7404
|
+
}
|
|
7405
|
+
});
|
|
7406
|
+
return () => cancelAnimationFrame(t);
|
|
7407
|
+
}, [
|
|
7408
|
+
ne,
|
|
7409
|
+
r,
|
|
7410
|
+
i,
|
|
7411
|
+
n
|
|
7412
|
+
]);
|
|
7413
|
+
let me = t((e) => {
|
|
7414
|
+
if (!x || D || !e.ctrlKey) return;
|
|
7415
|
+
e.preventDefault();
|
|
7416
|
+
let t = e.deltaY < 0 ? 1.15 : 1 / 1.15;
|
|
7417
|
+
de((e) => Math.max(.25, Math.min(8, e * t)));
|
|
7418
|
+
}, [x, D]), he = s(null), ge = (e) => {
|
|
7419
|
+
he.current &&= (clearTimeout(he.current), null), he.current = setTimeout(() => {
|
|
7420
|
+
e(), he.current = null;
|
|
7421
|
+
}, 250);
|
|
7422
|
+
}, _e = () => {
|
|
7423
|
+
he.current &&= (clearTimeout(he.current), null);
|
|
7424
|
+
}, X = t(() => {
|
|
7425
|
+
ee((e) => {
|
|
7426
|
+
if (e.length <= 1) return e;
|
|
7427
|
+
let t = e.slice(0, -1);
|
|
7428
|
+
return C?.({
|
|
7429
|
+
focusedNode: {
|
|
7430
|
+
id: t[t.length - 1].id ?? null,
|
|
7431
|
+
name: t[t.length - 1].name,
|
|
7432
|
+
subname: t[t.length - 1].subname ?? null,
|
|
7433
|
+
value: null,
|
|
7434
|
+
specialValueA: null,
|
|
7435
|
+
specialValueB: null,
|
|
7436
|
+
depth: t.length - 1,
|
|
7437
|
+
path: t.map((e) => e.name),
|
|
7438
|
+
childrenCount: t[t.length - 1].children?.length ?? 0,
|
|
7439
|
+
data: t[t.length - 1]
|
|
7440
|
+
},
|
|
7441
|
+
isRoot: t.length <= 1
|
|
7442
|
+
}), t;
|
|
7443
|
+
});
|
|
7444
|
+
}, [C]);
|
|
7445
|
+
a(() => {
|
|
7446
|
+
if (!x && !S) return;
|
|
7447
|
+
let t = (t) => {
|
|
7448
|
+
t.key === "Escape" && (x && de(1), S && (ee([e]), C?.({
|
|
7449
|
+
focusedNode: {
|
|
7450
|
+
id: e.id ?? null,
|
|
7451
|
+
name: e.name,
|
|
7452
|
+
subname: e.subname ?? null,
|
|
7453
|
+
value: null,
|
|
7454
|
+
specialValueA: null,
|
|
7455
|
+
specialValueB: null,
|
|
7456
|
+
depth: 0,
|
|
7457
|
+
path: [e.name],
|
|
7458
|
+
childrenCount: e.children?.length ?? 0,
|
|
7459
|
+
data: e
|
|
7460
|
+
},
|
|
7461
|
+
isRoot: !0
|
|
7462
|
+
})));
|
|
7463
|
+
};
|
|
7464
|
+
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
7465
|
+
}, [
|
|
7466
|
+
x,
|
|
7467
|
+
S,
|
|
7468
|
+
e,
|
|
7469
|
+
C
|
|
7470
|
+
]);
|
|
7471
|
+
let ve = s(null), ye = s(null), [be, xe] = c(!1), [Se, Ce] = c(null), [we, Te] = c({
|
|
7472
|
+
left: 0,
|
|
7473
|
+
top: 0
|
|
7474
|
+
}), [Ee, De] = c(null), Oe = (e, t) => {
|
|
7475
|
+
if (D) return;
|
|
7476
|
+
let n = se(e);
|
|
7477
|
+
if ((t.ctrlKey || t.metaKey) && S && e.children) {
|
|
7478
|
+
ge(() => {
|
|
7479
|
+
ee((t) => [...t, e.data]), C?.({
|
|
7480
|
+
focusedNode: n,
|
|
7481
|
+
isRoot: !1
|
|
7482
|
+
});
|
|
7483
|
+
});
|
|
7484
|
+
return;
|
|
7485
|
+
}
|
|
7486
|
+
if ((t.ctrlKey || t.metaKey) && S) {
|
|
7487
|
+
_e(), X();
|
|
7488
|
+
return;
|
|
7489
|
+
}
|
|
7490
|
+
if (w) {
|
|
7491
|
+
let e = ve.current?.getBoundingClientRect();
|
|
7492
|
+
Te({
|
|
7493
|
+
left: e ? t.clientX - e.left : t.clientX,
|
|
7494
|
+
top: e ? t.clientY - e.top : t.clientY
|
|
7495
|
+
}), Ce(ye.current), De(n), xe(!0);
|
|
7496
|
+
}
|
|
7497
|
+
E?.(n, t);
|
|
7498
|
+
}, ke = (e, t) => {
|
|
7499
|
+
D || !S || (t.ctrlKey || t.metaKey) && (_e(), X());
|
|
7500
|
+
}, Ae = {
|
|
7501
|
+
followCursor: !0,
|
|
7502
|
+
enterDelay: 50,
|
|
7503
|
+
enterNextDelay: 0,
|
|
7504
|
+
disableHoverListener: D,
|
|
7505
|
+
slotProps: { tooltip: { sx: { maxWidth: 240 } } }
|
|
7506
|
+
}, je = Math.round(u * 1.3);
|
|
7507
|
+
return /* @__PURE__ */ q(d, {
|
|
7508
|
+
ref: ve,
|
|
7509
|
+
sx: {
|
|
7510
|
+
display: "inline-flex",
|
|
7511
|
+
position: "relative",
|
|
7512
|
+
opacity: D ? .5 : 1,
|
|
7513
|
+
cursor: D ? "not-allowed" : "default",
|
|
7514
|
+
userSelect: "none"
|
|
7515
|
+
},
|
|
7516
|
+
children: [
|
|
7517
|
+
/* @__PURE__ */ K(d, {
|
|
7518
|
+
ref: ye,
|
|
7519
|
+
sx: {
|
|
7520
|
+
position: "absolute",
|
|
7521
|
+
left: we.left,
|
|
7522
|
+
top: we.top,
|
|
7523
|
+
width: 0,
|
|
7524
|
+
height: 0
|
|
7525
|
+
}
|
|
7526
|
+
}),
|
|
7527
|
+
S && W.length > 1 && /* @__PURE__ */ K(d, {
|
|
7528
|
+
sx: {
|
|
7529
|
+
position: "absolute",
|
|
7530
|
+
top: 4,
|
|
7531
|
+
left: 0,
|
|
7532
|
+
right: 0,
|
|
7533
|
+
display: "flex",
|
|
7534
|
+
justifyContent: "center",
|
|
7535
|
+
pointerEvents: "none",
|
|
7536
|
+
zIndex: 1
|
|
7537
|
+
},
|
|
7538
|
+
children: /* @__PURE__ */ K(B, {
|
|
7539
|
+
variant: "caption",
|
|
7540
|
+
sx: {
|
|
7541
|
+
bgcolor: "action.hover",
|
|
7542
|
+
borderRadius: 1,
|
|
7543
|
+
px: 1,
|
|
7544
|
+
py: .25,
|
|
7545
|
+
color: "text.secondary",
|
|
7546
|
+
fontSize: "0.7rem"
|
|
7547
|
+
},
|
|
7548
|
+
children: W.map((e) => e.name).join(" › ")
|
|
7549
|
+
})
|
|
7550
|
+
}),
|
|
7551
|
+
/* @__PURE__ */ K("svg", {
|
|
7552
|
+
width: r,
|
|
7553
|
+
height: i,
|
|
7554
|
+
viewBox: pe,
|
|
7555
|
+
onWheel: me,
|
|
7556
|
+
style: {
|
|
7557
|
+
fontFamily: L ?? "sans-serif",
|
|
7558
|
+
overflow: x && ue > 1 ? "hidden" : "visible"
|
|
7559
|
+
},
|
|
7560
|
+
role: "img",
|
|
7561
|
+
"aria-label": e.name,
|
|
7562
|
+
children: /* @__PURE__ */ q("g", {
|
|
7563
|
+
ref: fe,
|
|
7564
|
+
children: [/* @__PURE__ */ K("g", {
|
|
7565
|
+
fill: "none",
|
|
7566
|
+
stroke: F,
|
|
7567
|
+
strokeOpacity: v,
|
|
7568
|
+
strokeWidth: y,
|
|
7569
|
+
children: ie.map((e, t) => /* @__PURE__ */ K("path", { d: oe(e) }, `link-${t}`))
|
|
7570
|
+
}), re.map((e, t) => {
|
|
7571
|
+
let r = Y(e), i = ae(e), a = se(e), o = e.children ? li.folder : li.person, s = n === "LR", c = n === "RL", l = s ? u + 6 : c ? -(u + 6) : 0, f = !s && !c ? n === "TB" ? u + 16 : -(u + 6) : 0, h = s ? "start" : c ? "end" : "middle", _ = /* @__PURE__ */ q(d, {
|
|
7572
|
+
sx: {
|
|
7573
|
+
py: .5,
|
|
7574
|
+
minWidth: 140
|
|
7575
|
+
},
|
|
7576
|
+
children: [
|
|
7577
|
+
/* @__PURE__ */ K(B, {
|
|
7578
|
+
variant: "caption",
|
|
7579
|
+
sx: {
|
|
7580
|
+
fontWeight: "bold",
|
|
7581
|
+
display: "block",
|
|
7582
|
+
fontSize: "0.8rem"
|
|
7583
|
+
},
|
|
7584
|
+
children: e.data.name
|
|
7585
|
+
}),
|
|
7586
|
+
e.data.subname && /* @__PURE__ */ K(B, {
|
|
7587
|
+
variant: "caption",
|
|
7588
|
+
sx: {
|
|
7589
|
+
display: "block",
|
|
7590
|
+
opacity: .85
|
|
7591
|
+
},
|
|
7592
|
+
children: e.data.subname
|
|
7593
|
+
}),
|
|
7594
|
+
(a.specialValueA != null || a.specialValueB != null || e.children) && /* @__PURE__ */ q(d, {
|
|
7595
|
+
sx: {
|
|
7596
|
+
mt: .75,
|
|
7597
|
+
borderTop: "1px solid rgba(255,255,255,0.2)",
|
|
7598
|
+
pt: .75
|
|
7599
|
+
},
|
|
7600
|
+
children: [
|
|
7601
|
+
a.specialValueA != null && /* @__PURE__ */ q(d, {
|
|
7602
|
+
sx: {
|
|
7603
|
+
display: "flex",
|
|
7604
|
+
justifyContent: "space-between",
|
|
7605
|
+
gap: 2
|
|
7606
|
+
},
|
|
7607
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7608
|
+
variant: "caption",
|
|
7609
|
+
sx: { opacity: .6 },
|
|
7610
|
+
children: A.specialValueA ?? "A"
|
|
7611
|
+
}), /* @__PURE__ */ K(B, {
|
|
7612
|
+
variant: "caption",
|
|
7613
|
+
children: String(a.specialValueA)
|
|
7614
|
+
})]
|
|
7615
|
+
}),
|
|
7616
|
+
a.specialValueB != null && /* @__PURE__ */ q(d, {
|
|
7617
|
+
sx: {
|
|
7618
|
+
display: "flex",
|
|
7619
|
+
justifyContent: "space-between",
|
|
7620
|
+
gap: 2
|
|
7621
|
+
},
|
|
7622
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7623
|
+
variant: "caption",
|
|
7624
|
+
sx: { opacity: .6 },
|
|
7625
|
+
children: A.specialValueB ?? "B"
|
|
7626
|
+
}), /* @__PURE__ */ K(B, {
|
|
7627
|
+
variant: "caption",
|
|
7628
|
+
children: String(a.specialValueB)
|
|
7629
|
+
})]
|
|
7630
|
+
}),
|
|
7631
|
+
e.children && /* @__PURE__ */ q(d, {
|
|
7632
|
+
sx: {
|
|
7633
|
+
display: "flex",
|
|
7634
|
+
justifyContent: "space-between",
|
|
7635
|
+
gap: 2
|
|
7636
|
+
},
|
|
7637
|
+
children: [/* @__PURE__ */ K(B, {
|
|
7638
|
+
variant: "caption",
|
|
7639
|
+
sx: { opacity: .6 },
|
|
7640
|
+
children: "Reports"
|
|
7641
|
+
}), /* @__PURE__ */ K(B, {
|
|
7642
|
+
variant: "caption",
|
|
7643
|
+
children: e.children.length
|
|
7644
|
+
})]
|
|
7645
|
+
})
|
|
7646
|
+
]
|
|
7647
|
+
})
|
|
7648
|
+
]
|
|
7649
|
+
});
|
|
7650
|
+
return /* @__PURE__ */ K(z, {
|
|
7651
|
+
...Ae,
|
|
7652
|
+
title: _,
|
|
7653
|
+
children: /* @__PURE__ */ q("g", {
|
|
7654
|
+
transform: `translate(${r.x},${r.y})`,
|
|
7655
|
+
onClick: (t) => Oe(e, t),
|
|
7656
|
+
onDoubleClick: (t) => ke(e, t),
|
|
7657
|
+
style: { cursor: D ? "not-allowed" : "pointer" },
|
|
7658
|
+
children: [
|
|
7659
|
+
/* @__PURE__ */ K("circle", {
|
|
7660
|
+
r: u + 8,
|
|
7661
|
+
fill: "transparent"
|
|
7662
|
+
}),
|
|
7663
|
+
/* @__PURE__ */ K("circle", {
|
|
7664
|
+
r: u + 2,
|
|
7665
|
+
fill: i,
|
|
7666
|
+
fillOpacity: .15
|
|
7667
|
+
}),
|
|
7668
|
+
/* @__PURE__ */ K("circle", {
|
|
7669
|
+
r: u,
|
|
7670
|
+
fill: i
|
|
7671
|
+
}),
|
|
7672
|
+
g && /* @__PURE__ */ K(ui, {
|
|
7673
|
+
path: o,
|
|
7674
|
+
size: je
|
|
7675
|
+
}),
|
|
7676
|
+
p && /* @__PURE__ */ K("text", {
|
|
7677
|
+
x: l,
|
|
7678
|
+
y: f,
|
|
7679
|
+
dy: "0.35em",
|
|
7680
|
+
textAnchor: h,
|
|
7681
|
+
fontSize: m,
|
|
7682
|
+
fontWeight: e.children ? "bold" : "normal",
|
|
7683
|
+
fill: e.data.colorConfig?.textColor ?? P,
|
|
7684
|
+
paintOrder: "stroke",
|
|
7685
|
+
stroke: I,
|
|
7686
|
+
strokeWidth: 3,
|
|
7687
|
+
pointerEvents: "none",
|
|
7688
|
+
children: e.data.name
|
|
7689
|
+
})
|
|
7690
|
+
]
|
|
7691
|
+
})
|
|
7692
|
+
}, `node-${t}`);
|
|
7693
|
+
})]
|
|
7694
|
+
})
|
|
7695
|
+
}),
|
|
7696
|
+
w && /* @__PURE__ */ K(N, {
|
|
7697
|
+
open: be,
|
|
7698
|
+
anchorEl: Se,
|
|
7699
|
+
onClose: () => xe(!1),
|
|
7700
|
+
anchorOrigin: {
|
|
7701
|
+
vertical: "top",
|
|
7702
|
+
horizontal: "right"
|
|
7703
|
+
},
|
|
7704
|
+
transformOrigin: {
|
|
7705
|
+
vertical: "top",
|
|
7706
|
+
horizontal: "left"
|
|
7707
|
+
},
|
|
7708
|
+
slotProps: { paper: { elevation: 4 } },
|
|
7709
|
+
children: Ee && (T ? T(Ee) : /* @__PURE__ */ K(di, {
|
|
7710
|
+
info: Ee,
|
|
7711
|
+
labelA: A.specialValueA ?? "Value A",
|
|
7712
|
+
labelB: A.specialValueB ?? "Value B"
|
|
7713
|
+
}))
|
|
7714
|
+
})
|
|
7715
|
+
]
|
|
7716
|
+
});
|
|
7717
|
+
}
|
|
7718
|
+
fi.displayName = "HorizontalTreeChart";
|
|
7719
|
+
//#endregion
|
|
7720
|
+
export { Zr as ChordChart, oi as CirclePackingChart, Mt as ConfirmDialogProvider, tr as DEFAULT_CHECK_COLORS, Qr as DEFAULT_CHORD_CHART_TRANSLATION, si as DEFAULT_CIRCLE_PACKING_TRANSLATION, Dt as DEFAULT_CONFIRM_DIALOG_TRANSLATION, dn as DEFAULT_GANTT_TRANSLATIONS, ci as DEFAULT_HORIZONTAL_TREE_TRANSLATION, Pt as DEFAULT_JSON_EDITOR_TOOLBAR_CONFIG, Ft as DEFAULT_JSON_EDITOR_TRANSLATION, er as DEFAULT_METER_COLORS, $n as DEFAULT_PASSWORD_TRANSLATIONS, $r as DEFAULT_RADIAL_TREE_CHART_TRANSLATION, mr as DEFAULT_RICH_TEXT_EDITOR_TOOLBAR_CONFIG, hr as DEFAULT_RICH_TEXT_EDITOR_TRANSLATION, jr as DEFAULT_SQL_EDITOR_TOOLBAR_CONFIG, Mr as DEFAULT_SQL_EDITOR_TRANSLATION, qr as DEFAULT_SUNBURST_CHART_TRANSLATION, lr as DEFAULT_TAG_SELECTION_TRANSLATION, Yn as GanttChart, fi as HorizontalTreeChart, Vt as JsonEditor, rr as PasswordStrengthMeter, ri as RadialTreeChart, Ar as RichTextEditor, Rr as SqlEditor, Kr as SunburstChart, pr as TagSelection, Nt as useConfirm, $ as useGanttChartStore, Wn as useGanttTheme, Hn as useGanttTranslations, Bn as useRawGanttChartStore };
|