@thebuoyant-tsdev/mui-ts-library 3.11.0 → 3.11.2
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 +14 -0
- package/README.md +14 -0
- package/dist/components/chord-chart/ChordChart.d.ts +1 -1
- package/dist/components/chord-chart/ChordChart.js +155 -137
- package/dist/components/chord-chart/ChordChart.types.d.ts +1 -1
- package/dist/components/circle-packing-chart/CirclePackingChart.d.ts +1 -1
- package/dist/components/circle-packing-chart/CirclePackingChart.js +134 -121
- package/dist/components/gantt-chart/hooks/useGanttDrag.js +44 -38
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +222 -206
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.d.ts +1 -1
- package/dist/components/json-editor/JsonEditorContent.js +134 -119
- package/dist/components/json-editor/JsonEditorToolbar.js +3 -3
- package/dist/components/password-strength-meter/PasswordStrengthMeter.js +131 -130
- package/dist/components/radial-tree-chart/RadialTreeChart.js +197 -186
- package/dist/components/rich-text-editor/RichTextEditor.js +1 -1
- package/dist/components/rich-text-editor/RichTextEditorMarkdownDialog.js +40 -39
- package/dist/components/shared/useTimedFlag.d.ts +6 -0
- package/dist/components/shared/useTimedFlag.js +14 -0
- package/dist/components/sql-editor/SqlEditorHistoryMenu.js +1 -1
- package/dist/components/sql-editor/useSqlQueryHistory.js +14 -12
- package/dist/components/sql-editor/util/sqlQueryHistory.util.d.ts +1 -0
- package/dist/components/sql-editor/util/sqlQueryHistory.util.js +21 -13
- package/dist/components/sunburst-chart/SunburstChart.d.ts +1 -1
- package/dist/components/sunburst-chart/SunburstChart.js +126 -115
- package/dist/components/tag-selection/TagSelectionAutocomplete.js +7 -5
- package/dist/index.cjs +2 -2
- package/dist/index.js +7 -7
- package/package.json +1 -1
|
@@ -1,60 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { DEFAULT_CIRCLE_PACKING_TRANSLATION as e } from "./CirclePackingChart.types.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useLayoutEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
3
|
+
import { Box as s, Tooltip as c, Typography as l, useTheme as u } from "@mui/material";
|
|
4
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
5
|
+
import * as p from "d3";
|
|
5
6
|
//#region src/components/circle-packing-chart/CirclePackingChart.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
return e.length * n *
|
|
7
|
+
var m = .56;
|
|
8
|
+
function ee(e, t, n) {
|
|
9
|
+
return e.length * n * m <= t ? e : t >= 3 * n * m + n * 2 ? "…" : "";
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
let A =
|
|
11
|
+
function h({ data: m, size: h = 600, padding: g = 3, sortBy: _ = "value", showLabels: v = !0, showAllLabels: y = !1, labelFontSize: te = 13, innerLabelFontSize: b = 9, labelColor: ne, chartColors: x, depthColorStart: S, depthColorEnd: C, background: w, duration: T = 750, zoomable: E = !1, disabled: D = !1, onCircleClick: O, onZoomChange: k, translation: re }) {
|
|
12
|
+
let A = u(), ie = {
|
|
13
|
+
...e,
|
|
14
|
+
...re
|
|
15
|
+
}, ae = !m.children?.length && !m.value, oe = [
|
|
12
16
|
A.palette.primary.main,
|
|
13
17
|
A.palette.secondary.main,
|
|
14
18
|
A.palette.error.main,
|
|
15
19
|
A.palette.warning.main,
|
|
16
20
|
A.palette.success.main,
|
|
17
21
|
A.palette.info.main
|
|
18
|
-
],
|
|
19
|
-
let e =
|
|
20
|
-
return
|
|
22
|
+
], j = ne || A.palette.text.primary, M = w || A.palette.background.default, se = A.typography.fontFamily, N = i(() => {
|
|
23
|
+
let e = p.hierarchy(m).sum((e) => e.value ?? 0);
|
|
24
|
+
return _ === "value" ? e.sort((e, t) => (t.value ?? 0) - (e.value ?? 0)) : e.sort((e, t) => String(e.data.name).localeCompare(String(t.data.name), void 0, {
|
|
21
25
|
numeric: !0,
|
|
22
26
|
sensitivity: "base"
|
|
23
|
-
})),
|
|
27
|
+
})), p.pack().size([h, h]).padding(g)(e);
|
|
24
28
|
}, [
|
|
25
|
-
f,
|
|
26
29
|
m,
|
|
27
30
|
h,
|
|
28
|
-
g
|
|
29
|
-
|
|
31
|
+
g,
|
|
32
|
+
_
|
|
33
|
+
]), P = N.descendants(), F = i(() => p.max(P, (e) => e.depth) ?? 0, [P]), I = !!(S && C), L = i(() => I ? p.scaleSequential(p.interpolateHcl(S, C)).domain([0, Math.max(1, F)]) : null, [
|
|
30
34
|
I,
|
|
31
35
|
S,
|
|
32
36
|
C,
|
|
33
37
|
F
|
|
34
|
-
]), R = x && x.length > 0 ? x :
|
|
38
|
+
]), R = x && x.length > 0 ? x : oe, ce = t((e) => e.data.colorConfig?.fill ? e.data.colorConfig.fill : I && L ? e.children ? L(e.depth) : A.palette.background.paper : R[e.depth % R.length], [
|
|
35
39
|
I,
|
|
36
40
|
L,
|
|
37
41
|
R,
|
|
38
42
|
A
|
|
39
|
-
]), [
|
|
43
|
+
]), [z, B] = o(1), V = t((e) => {
|
|
40
44
|
if (!E || D || !e.ctrlKey) return;
|
|
41
45
|
e.preventDefault();
|
|
42
46
|
let t = e.deltaY < 0 ? 1.15 : 1 / 1.15;
|
|
43
|
-
|
|
47
|
+
B((e) => Math.max(.25, Math.min(8, e * t)));
|
|
44
48
|
}, [E, D]);
|
|
45
|
-
|
|
49
|
+
r(() => {
|
|
46
50
|
if (!E) return;
|
|
47
51
|
let e = (e) => {
|
|
48
|
-
e.key === "Escape" &&
|
|
52
|
+
e.key === "Escape" && B(1);
|
|
49
53
|
};
|
|
50
54
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
51
55
|
}, [E]);
|
|
52
|
-
let
|
|
53
|
-
let e = `${-
|
|
54
|
-
if (
|
|
55
|
-
let t =
|
|
56
|
-
return `${-
|
|
57
|
-
}, [
|
|
56
|
+
let H = i(() => {
|
|
57
|
+
let e = `${-h / 2} ${-h / 2} ${h} ${h}`;
|
|
58
|
+
if (z === 1) return e;
|
|
59
|
+
let t = h / z, n = (h - t) / 2;
|
|
60
|
+
return `${-h / 2 + n} ${-h / 2 + n} ${t} ${t}`;
|
|
61
|
+
}, [h, z]), U = t((e) => {
|
|
58
62
|
let t = e.value ?? 0, n = N.value ?? 0;
|
|
59
63
|
return {
|
|
60
64
|
id: e.data.id ?? null,
|
|
@@ -66,78 +70,78 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
66
70
|
childrenCount: e.children?.length ?? 0,
|
|
67
71
|
data: e.data
|
|
68
72
|
};
|
|
69
|
-
}, [N]),
|
|
73
|
+
}, [N]), W = a(null), G = a([
|
|
70
74
|
N.x,
|
|
71
75
|
N.y,
|
|
72
76
|
N.r * 2
|
|
73
|
-
]),
|
|
74
|
-
|
|
75
|
-
}, []), [
|
|
76
|
-
|
|
77
|
-
let
|
|
78
|
-
let t =
|
|
77
|
+
]), K = a(N), [q, le] = o(N), J = t((e) => {
|
|
78
|
+
K.current = e, le(e);
|
|
79
|
+
}, []), [ue, de] = o(N);
|
|
80
|
+
ue !== N && (de(N), J(N), K.current = N);
|
|
81
|
+
let Y = t((e) => {
|
|
82
|
+
let t = W.current;
|
|
79
83
|
if (!t) return;
|
|
80
|
-
|
|
81
|
-
let n =
|
|
84
|
+
G.current = e;
|
|
85
|
+
let n = h / e[2], r = K.current, i = t.querySelectorAll("g[data-role='nodes'] > g"), a = t.querySelectorAll("g[data-role='nodes'] > g > circle");
|
|
82
86
|
for (let t = 0; t < P.length; t++) {
|
|
83
87
|
let r = P[t], o = i[t];
|
|
84
88
|
o && o.setAttribute("transform", `translate(${(r.x - e[0]) * n},${(r.y - e[1]) * n})`);
|
|
85
89
|
let s = t - 1;
|
|
86
90
|
s >= 0 && a[s] && a[s].setAttribute("r", String(r.r * n));
|
|
87
91
|
}
|
|
88
|
-
if (
|
|
92
|
+
if (v) {
|
|
89
93
|
let r = t.querySelectorAll("g[data-role='labels'] > text");
|
|
90
94
|
for (let t = 0; t < P.length; t++) {
|
|
91
95
|
let i = P[t], a = r[t];
|
|
92
96
|
a && (a.setAttribute("transform", `translate(${(i.x - e[0]) * n},${(i.y - e[1]) * n})`), a.setAttribute("font-weight", i.children ? "bold" : "normal"));
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
|
-
if (
|
|
99
|
+
if (y) {
|
|
96
100
|
let i = t.querySelectorAll("g[data-role='inner-labels'] > text");
|
|
97
101
|
for (let t = 0; t < P.length; t++) {
|
|
98
102
|
let a = P[t], o = i[t];
|
|
99
103
|
if (!o) continue;
|
|
100
104
|
let s = a.r * n, c = s * 1.6, l = r === N ? a !== N : a.ancestors().includes(r), u = a.parent === r;
|
|
101
105
|
if (l && !u && s >= 14) {
|
|
102
|
-
let t =
|
|
106
|
+
let t = ee(a.data.name, c, b);
|
|
103
107
|
t ? (o.textContent = t, o.setAttribute("transform", `translate(${(a.x - e[0]) * n},${(a.y - e[1]) * n})`), o.setAttribute("font-weight", a.children ? "bold" : "normal"), o.style.display = "inline") : o.style.display = "none";
|
|
104
108
|
} else o.style.display = "none";
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
}, [
|
|
108
112
|
P,
|
|
109
|
-
|
|
110
|
-
_,
|
|
113
|
+
h,
|
|
111
114
|
v,
|
|
115
|
+
y,
|
|
112
116
|
b,
|
|
113
117
|
N
|
|
114
118
|
]);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
r(() => {
|
|
120
|
+
Y([
|
|
121
|
+
q.x,
|
|
122
|
+
q.y,
|
|
123
|
+
q.r * 2
|
|
120
124
|
]);
|
|
121
125
|
}, [
|
|
122
126
|
N,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
h,
|
|
128
|
+
q,
|
|
129
|
+
Y
|
|
126
130
|
]);
|
|
127
|
-
let
|
|
128
|
-
let n =
|
|
131
|
+
let X = t((e, t) => {
|
|
132
|
+
let n = W.current;
|
|
129
133
|
if (!n) return;
|
|
130
|
-
let r =
|
|
134
|
+
let r = q, i = G.current, a = [
|
|
131
135
|
e.x,
|
|
132
136
|
e.y,
|
|
133
137
|
e.r * 2
|
|
134
138
|
];
|
|
135
|
-
|
|
136
|
-
let e =
|
|
137
|
-
return (t) =>
|
|
139
|
+
J(e), p.select(n).transition().duration(t).ease(p.easeCubic).tween("zoom", () => {
|
|
140
|
+
let e = p.interpolateZoom(i, a);
|
|
141
|
+
return (t) => Y(e(t));
|
|
138
142
|
});
|
|
139
143
|
let o = n.querySelectorAll("g[data-role='labels'] > text");
|
|
140
|
-
|
|
144
|
+
p.selectAll(o).transition().duration(t).ease(p.easeCubic).style("fill-opacity", (t, n) => +(P[n].parent === e)).on("start", function(t, n) {
|
|
141
145
|
P[n].parent === e && (this.style.display = "inline");
|
|
142
146
|
}).on("end", function(t, n) {
|
|
143
147
|
P[n].parent !== e && (this.style.display = "none");
|
|
@@ -148,23 +152,25 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
148
152
|
isRoot: e === N
|
|
149
153
|
});
|
|
150
154
|
}, [
|
|
151
|
-
|
|
155
|
+
q,
|
|
152
156
|
P,
|
|
153
157
|
N,
|
|
154
|
-
|
|
158
|
+
Y,
|
|
155
159
|
k,
|
|
156
|
-
|
|
157
|
-
]),
|
|
158
|
-
|
|
159
|
-
e(),
|
|
160
|
+
J
|
|
161
|
+
]), Z = a(null), fe = (e) => {
|
|
162
|
+
Z.current &&= (clearTimeout(Z.current), null), Z.current = setTimeout(() => {
|
|
163
|
+
e(), Z.current = null;
|
|
160
164
|
}, 250);
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
+
}, Q = () => {
|
|
166
|
+
Z.current &&= (clearTimeout(Z.current), null);
|
|
167
|
+
}, $ = a(X);
|
|
168
|
+
n(() => {
|
|
169
|
+
$.current = X;
|
|
170
|
+
}, [X]), r(() => {
|
|
165
171
|
if (D) return;
|
|
166
172
|
let e = (e) => {
|
|
167
|
-
e.key === "Escape" && (
|
|
173
|
+
e.key === "Escape" && (Q(), $.current(N, T));
|
|
168
174
|
};
|
|
169
175
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
170
176
|
}, [
|
|
@@ -172,19 +178,19 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
172
178
|
N,
|
|
173
179
|
T
|
|
174
180
|
]);
|
|
175
|
-
let
|
|
181
|
+
let pe = (e) => {
|
|
176
182
|
if (D || !(e.ctrlKey || e.metaKey)) return;
|
|
177
|
-
|
|
178
|
-
let t =
|
|
179
|
-
t !==
|
|
180
|
-
},
|
|
183
|
+
Q(), e.preventDefault();
|
|
184
|
+
let t = q.parent ?? N;
|
|
185
|
+
t !== q && X(t, e.altKey ? Math.max(250, T * 10) : T);
|
|
186
|
+
}, me = {
|
|
181
187
|
followCursor: !0,
|
|
182
188
|
enterDelay: 50,
|
|
183
189
|
enterNextDelay: 0,
|
|
184
190
|
disableHoverListener: D,
|
|
185
191
|
slotProps: { tooltip: { sx: { maxWidth: 220 } } }
|
|
186
192
|
};
|
|
187
|
-
return /* @__PURE__ */
|
|
193
|
+
return /* @__PURE__ */ f(s, {
|
|
188
194
|
sx: {
|
|
189
195
|
display: "inline-flex",
|
|
190
196
|
position: "relative",
|
|
@@ -192,31 +198,38 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
192
198
|
cursor: D ? "not-allowed" : "default",
|
|
193
199
|
userSelect: "none"
|
|
194
200
|
},
|
|
195
|
-
children: [/* @__PURE__ */
|
|
196
|
-
ref:
|
|
197
|
-
width:
|
|
198
|
-
height:
|
|
199
|
-
viewBox:
|
|
200
|
-
onWheel:
|
|
201
|
+
children: [/* @__PURE__ */ f("svg", {
|
|
202
|
+
ref: W,
|
|
203
|
+
width: h,
|
|
204
|
+
height: h,
|
|
205
|
+
viewBox: H,
|
|
206
|
+
onWheel: V,
|
|
201
207
|
style: {
|
|
202
208
|
display: "block",
|
|
203
|
-
background:
|
|
204
|
-
fontFamily:
|
|
205
|
-
overflow: E &&
|
|
209
|
+
background: M,
|
|
210
|
+
fontFamily: se ?? "sans-serif",
|
|
211
|
+
overflow: E && z > 1 ? "hidden" : "visible"
|
|
206
212
|
},
|
|
207
213
|
role: "img",
|
|
208
|
-
"aria-label":
|
|
209
|
-
onDoubleClick:
|
|
214
|
+
"aria-label": m.name,
|
|
215
|
+
onDoubleClick: pe,
|
|
210
216
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
217
|
+
ae && /* @__PURE__ */ d("text", {
|
|
218
|
+
textAnchor: "middle",
|
|
219
|
+
dy: "0.35em",
|
|
220
|
+
fontSize: 13,
|
|
221
|
+
fill: A.palette.text.secondary,
|
|
222
|
+
children: ie.noData
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ d("g", {
|
|
212
225
|
"data-role": "nodes",
|
|
213
226
|
children: P.map((e, t) => {
|
|
214
|
-
let n =
|
|
227
|
+
let n = U(e), r = /* @__PURE__ */ f(s, {
|
|
215
228
|
sx: {
|
|
216
229
|
py: .5,
|
|
217
230
|
minWidth: 160
|
|
218
231
|
},
|
|
219
|
-
children: [/* @__PURE__ */ l
|
|
232
|
+
children: [/* @__PURE__ */ d(l, {
|
|
220
233
|
variant: "caption",
|
|
221
234
|
sx: {
|
|
222
235
|
fontWeight: "bold",
|
|
@@ -224,54 +237,54 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
224
237
|
fontSize: "0.8rem"
|
|
225
238
|
},
|
|
226
239
|
children: e.data.name
|
|
227
|
-
}), (e.value ?? 0) > 0 && /* @__PURE__ */
|
|
240
|
+
}), (e.value ?? 0) > 0 && /* @__PURE__ */ f(s, {
|
|
228
241
|
sx: {
|
|
229
242
|
mt: .75,
|
|
230
243
|
borderTop: "1px solid rgba(255,255,255,0.2)",
|
|
231
244
|
pt: .75
|
|
232
245
|
},
|
|
233
246
|
children: [
|
|
234
|
-
/* @__PURE__ */
|
|
247
|
+
/* @__PURE__ */ f(s, {
|
|
235
248
|
sx: {
|
|
236
249
|
display: "flex",
|
|
237
250
|
justifyContent: "space-between",
|
|
238
251
|
gap: 2
|
|
239
252
|
},
|
|
240
|
-
children: [/* @__PURE__ */ l
|
|
253
|
+
children: [/* @__PURE__ */ d(l, {
|
|
241
254
|
variant: "caption",
|
|
242
255
|
sx: { opacity: .6 },
|
|
243
256
|
children: "Value"
|
|
244
|
-
}), /* @__PURE__ */ l
|
|
257
|
+
}), /* @__PURE__ */ d(l, {
|
|
245
258
|
variant: "caption",
|
|
246
259
|
children: e.value?.toLocaleString()
|
|
247
260
|
})]
|
|
248
261
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ f(s, {
|
|
250
263
|
sx: {
|
|
251
264
|
display: "flex",
|
|
252
265
|
justifyContent: "space-between",
|
|
253
266
|
gap: 2
|
|
254
267
|
},
|
|
255
|
-
children: [/* @__PURE__ */ l
|
|
268
|
+
children: [/* @__PURE__ */ d(l, {
|
|
256
269
|
variant: "caption",
|
|
257
270
|
sx: { opacity: .6 },
|
|
258
271
|
children: "Share"
|
|
259
|
-
}), /* @__PURE__ */
|
|
272
|
+
}), /* @__PURE__ */ f(l, {
|
|
260
273
|
variant: "caption",
|
|
261
274
|
children: [n.percentage, "%"]
|
|
262
275
|
})]
|
|
263
276
|
}),
|
|
264
|
-
e.children && /* @__PURE__ */
|
|
277
|
+
e.children && /* @__PURE__ */ f(s, {
|
|
265
278
|
sx: {
|
|
266
279
|
display: "flex",
|
|
267
280
|
justifyContent: "space-between",
|
|
268
281
|
gap: 2
|
|
269
282
|
},
|
|
270
|
-
children: [/* @__PURE__ */ l
|
|
283
|
+
children: [/* @__PURE__ */ d(l, {
|
|
271
284
|
variant: "caption",
|
|
272
285
|
sx: { opacity: .6 },
|
|
273
286
|
children: "Children"
|
|
274
|
-
}), /* @__PURE__ */ l
|
|
287
|
+
}), /* @__PURE__ */ d(l, {
|
|
275
288
|
variant: "caption",
|
|
276
289
|
children: e.children.length
|
|
277
290
|
})]
|
|
@@ -279,14 +292,14 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
279
292
|
]
|
|
280
293
|
})]
|
|
281
294
|
});
|
|
282
|
-
return /* @__PURE__ */
|
|
283
|
-
transform: `translate(${e.x -
|
|
284
|
-
children: t === 0 ? null : /* @__PURE__ */
|
|
285
|
-
...
|
|
295
|
+
return /* @__PURE__ */ d("g", {
|
|
296
|
+
transform: `translate(${e.x - h / 2},${e.y - h / 2})`,
|
|
297
|
+
children: t === 0 ? null : /* @__PURE__ */ d(c, {
|
|
298
|
+
...me,
|
|
286
299
|
title: r,
|
|
287
|
-
children: /* @__PURE__ */
|
|
300
|
+
children: /* @__PURE__ */ d("circle", {
|
|
288
301
|
r: e.r,
|
|
289
|
-
fill:
|
|
302
|
+
fill: ce(e),
|
|
290
303
|
stroke: e.data.colorConfig?.stroke ?? A.palette.background.paper,
|
|
291
304
|
strokeWidth: .75,
|
|
292
305
|
style: {
|
|
@@ -304,7 +317,7 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
304
317
|
if (t.ctrlKey || t.metaKey) {
|
|
305
318
|
if (e.children) {
|
|
306
319
|
let n = t.altKey ? Math.max(250, T * 10) : T;
|
|
307
|
-
|
|
320
|
+
fe(() => X(e, n));
|
|
308
321
|
}
|
|
309
322
|
return;
|
|
310
323
|
}
|
|
@@ -313,9 +326,9 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
313
326
|
},
|
|
314
327
|
onDoubleClick: (e) => {
|
|
315
328
|
if (!D && (e.ctrlKey || e.metaKey)) {
|
|
316
|
-
|
|
317
|
-
let t =
|
|
318
|
-
t !==
|
|
329
|
+
Q(), e.preventDefault(), e.stopPropagation();
|
|
330
|
+
let t = q.parent ?? N;
|
|
331
|
+
t !== q && X(t, e.altKey ? Math.max(250, T * 10) : T);
|
|
319
332
|
}
|
|
320
333
|
}
|
|
321
334
|
})
|
|
@@ -323,15 +336,15 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
323
336
|
}, `n-${t}`);
|
|
324
337
|
})
|
|
325
338
|
}),
|
|
326
|
-
|
|
339
|
+
v && /* @__PURE__ */ d("g", {
|
|
327
340
|
"data-role": "labels",
|
|
328
341
|
textAnchor: "middle",
|
|
329
342
|
dominantBaseline: "middle",
|
|
330
343
|
pointerEvents: "none",
|
|
331
|
-
fontSize:
|
|
332
|
-
fill:
|
|
333
|
-
children: P.map((e, t) => /* @__PURE__ */
|
|
334
|
-
transform: `translate(${e.x -
|
|
344
|
+
fontSize: te,
|
|
345
|
+
fill: j,
|
|
346
|
+
children: P.map((e, t) => /* @__PURE__ */ d("text", {
|
|
347
|
+
transform: `translate(${e.x - h / 2},${e.y - h / 2})`,
|
|
335
348
|
style: {
|
|
336
349
|
display: e.parent === N ? "inline" : "none",
|
|
337
350
|
fillOpacity: +(e.parent === N)
|
|
@@ -339,20 +352,20 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
339
352
|
children: e.data.name
|
|
340
353
|
}, `lbl-${t}`))
|
|
341
354
|
}),
|
|
342
|
-
|
|
355
|
+
y && /* @__PURE__ */ d("g", {
|
|
343
356
|
"data-role": "inner-labels",
|
|
344
357
|
textAnchor: "middle",
|
|
345
358
|
dominantBaseline: "middle",
|
|
346
359
|
pointerEvents: "none",
|
|
347
360
|
fontSize: b,
|
|
348
|
-
fill:
|
|
349
|
-
children: P.map((e, t) => /* @__PURE__ */
|
|
350
|
-
transform: `translate(${e.x -
|
|
361
|
+
fill: j,
|
|
362
|
+
children: P.map((e, t) => /* @__PURE__ */ d("text", {
|
|
363
|
+
transform: `translate(${e.x - h / 2},${e.y - h / 2})`,
|
|
351
364
|
style: { display: "none" }
|
|
352
365
|
}, `inner-lbl-${t}`))
|
|
353
366
|
})
|
|
354
367
|
]
|
|
355
|
-
}),
|
|
368
|
+
}), q !== N && !D && /* @__PURE__ */ d(s, {
|
|
356
369
|
sx: {
|
|
357
370
|
position: "absolute",
|
|
358
371
|
bottom: 6,
|
|
@@ -362,7 +375,7 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
362
375
|
justifyContent: "center",
|
|
363
376
|
pointerEvents: "none"
|
|
364
377
|
},
|
|
365
|
-
children: /* @__PURE__ */
|
|
378
|
+
children: /* @__PURE__ */ f(l, {
|
|
366
379
|
variant: "caption",
|
|
367
380
|
sx: {
|
|
368
381
|
bgcolor: "action.hover",
|
|
@@ -372,11 +385,11 @@ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLa
|
|
|
372
385
|
color: "text.secondary",
|
|
373
386
|
fontSize: "0.7rem"
|
|
374
387
|
},
|
|
375
|
-
children: [
|
|
388
|
+
children: [q.ancestors().map((e) => e.data.name).reverse().join(" › "), " · Ctrl / Cmd ⌘+DblClick to zoom out · Escape to reset"]
|
|
376
389
|
})
|
|
377
390
|
})]
|
|
378
391
|
});
|
|
379
392
|
}
|
|
380
|
-
|
|
393
|
+
h.displayName = "CirclePackingChart";
|
|
381
394
|
//#endregion
|
|
382
|
-
export {
|
|
395
|
+
export { h as CirclePackingChart };
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { addDays as e } from "../util/gantt-chart.util.js";
|
|
2
2
|
import { useGanttChartStore as t, useGanttTranslations as n, useRawGanttChartStore as r } from "../GanttChart.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect as i, useLayoutEffect as a, useRef as o, useState as s } from "react";
|
|
4
4
|
//#region src/components/gantt-chart/hooks/useGanttDrag.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
var c = 864e5;
|
|
6
|
+
function l({ totalWidth: l, displayRange: u, onTaskMoved: d, onTaskResized: f, onTasksChange: p }) {
|
|
7
|
+
let m = t((e) => e.updateTask), h = r(), g = n(), _ = o(1), v = o(d), y = o(f), b = o(p);
|
|
8
|
+
a(() => {
|
|
9
|
+
_.current = l > 0 ? l / ((u.end.getTime() - u.start.getTime()) / c) : 1, v.current = d, y.current = f, b.current = p;
|
|
10
10
|
});
|
|
11
|
-
let
|
|
12
|
-
return {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
let x = o(null), S = o(null), [C, w] = s(null), T = o(!1), E = o(null);
|
|
12
|
+
return i(() => () => {
|
|
13
|
+
E.current?.();
|
|
14
|
+
}, []), {
|
|
15
|
+
activeDrag: C,
|
|
16
|
+
suppressClickRef: T,
|
|
15
17
|
handleBarMouseDown: (t, n, r) => {
|
|
16
|
-
t.stopPropagation(),
|
|
18
|
+
t.stopPropagation(), T.current = !1, x.current = {
|
|
17
19
|
type: r,
|
|
18
20
|
taskId: n.id,
|
|
19
21
|
startX: t.clientX,
|
|
@@ -21,45 +23,47 @@ function c({ totalWidth: c, displayRange: l, onTaskMoved: u, onTaskResized: d, o
|
|
|
21
23
|
originalEnd: n.endDate
|
|
22
24
|
}, document.body.style.cursor = r === "resize" ? "ew-resize" : "grabbing";
|
|
23
25
|
let i = (e) => {
|
|
24
|
-
let t =
|
|
26
|
+
let t = x.current;
|
|
25
27
|
if (!t || t.type === "progress") return;
|
|
26
|
-
let n = e.clientX - t.startX, r = Math.round(n /
|
|
27
|
-
Math.abs(n) >= 5 && (
|
|
28
|
+
let n = e.clientX - t.startX, r = Math.round(n / _.current);
|
|
29
|
+
Math.abs(n) >= 5 && (T.current = !0);
|
|
28
30
|
let i = {
|
|
29
31
|
taskId: t.taskId,
|
|
30
32
|
type: t.type,
|
|
31
33
|
deltaDays: r
|
|
32
34
|
};
|
|
33
|
-
|
|
35
|
+
S.current = i, w(i);
|
|
34
36
|
}, a = () => {
|
|
35
37
|
document.body.style.cursor = "";
|
|
36
|
-
let t =
|
|
37
|
-
if (t && n &&
|
|
38
|
-
let r =
|
|
38
|
+
let t = x.current, n = S.current;
|
|
39
|
+
if (t && n && T.current && n.deltaDays !== 0) {
|
|
40
|
+
let r = h.getState().tasks.find((e) => e.id === t.taskId);
|
|
39
41
|
if (r) {
|
|
40
42
|
if (n.type === "move") {
|
|
41
43
|
let i = e(t.originalStart, n.deltaDays), a = e(t.originalEnd, n.deltaDays);
|
|
42
|
-
|
|
44
|
+
m({
|
|
43
45
|
...r,
|
|
44
46
|
startDate: i,
|
|
45
47
|
endDate: a
|
|
46
|
-
}),
|
|
48
|
+
}), v.current?.(r, i, a);
|
|
47
49
|
} else {
|
|
48
50
|
let i = e(t.originalEnd, n.deltaDays), a = i > t.originalStart ? i : e(t.originalStart, 1);
|
|
49
|
-
|
|
51
|
+
m({
|
|
50
52
|
...r,
|
|
51
53
|
endDate: a
|
|
52
|
-
}),
|
|
54
|
+
}), y.current?.(r, a);
|
|
53
55
|
}
|
|
54
|
-
|
|
56
|
+
b.current?.(h.getState().tasks);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
|
-
|
|
59
|
+
x.current = null, S.current = null, w(null), document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a), E.current = null;
|
|
60
|
+
};
|
|
61
|
+
document.addEventListener("mousemove", i), document.addEventListener("mouseup", a), E.current = () => {
|
|
62
|
+
document.body.style.cursor = "", document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a);
|
|
58
63
|
};
|
|
59
|
-
document.addEventListener("mousemove", i), document.addEventListener("mouseup", a);
|
|
60
64
|
},
|
|
61
65
|
handleProgressMouseDown: (e, t, n, r) => {
|
|
62
|
-
e.stopPropagation(),
|
|
66
|
+
e.stopPropagation(), T.current = !1, x.current = {
|
|
63
67
|
type: "progress",
|
|
64
68
|
taskId: t.id,
|
|
65
69
|
startX: e.clientX,
|
|
@@ -69,36 +73,38 @@ function c({ totalWidth: c, displayRange: l, onTaskMoved: u, onTaskResized: d, o
|
|
|
69
73
|
barWidthPx: r
|
|
70
74
|
}, document.body.style.cursor = "ew-resize";
|
|
71
75
|
let i = (e) => {
|
|
72
|
-
let t =
|
|
76
|
+
let t = x.current;
|
|
73
77
|
if (!t || t.type !== "progress") return;
|
|
74
78
|
let n = e.clientX - t.startX;
|
|
75
|
-
Math.abs(n) >= 5 && (
|
|
79
|
+
Math.abs(n) >= 5 && (T.current = !0);
|
|
76
80
|
let r = n / (t.barWidthPx ?? 1) * 100, i = Math.round(Math.max(0, Math.min(100, (t.initialProgress ?? 0) + r))), a = {
|
|
77
81
|
taskId: t.taskId,
|
|
78
82
|
type: "progress",
|
|
79
83
|
deltaDays: 0,
|
|
80
84
|
newProgress: i
|
|
81
85
|
};
|
|
82
|
-
|
|
86
|
+
S.current = a, w(a);
|
|
83
87
|
}, a = () => {
|
|
84
88
|
document.body.style.cursor = "";
|
|
85
|
-
let e =
|
|
86
|
-
if (e && t && t.type === "progress" && t.newProgress !== void 0 &&
|
|
87
|
-
let n =
|
|
88
|
-
n && (
|
|
89
|
+
let e = x.current, t = S.current;
|
|
90
|
+
if (e && t && t.type === "progress" && t.newProgress !== void 0 && T.current) {
|
|
91
|
+
let n = h.getState().tasks.find((t) => t.id === e.taskId);
|
|
92
|
+
n && (m({
|
|
89
93
|
...n,
|
|
90
94
|
progress: t.newProgress
|
|
91
|
-
}),
|
|
95
|
+
}), b.current?.(h.getState().tasks));
|
|
92
96
|
}
|
|
93
|
-
|
|
97
|
+
x.current = null, S.current = null, w(null), document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a), E.current = null;
|
|
98
|
+
};
|
|
99
|
+
document.addEventListener("mousemove", i), document.addEventListener("mouseup", a), E.current = () => {
|
|
100
|
+
document.body.style.cursor = "", document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", a);
|
|
94
101
|
};
|
|
95
|
-
document.addEventListener("mousemove", i), document.addEventListener("mouseup", a);
|
|
96
102
|
},
|
|
97
|
-
formatDragDate: (e) => e.toLocaleDateString(
|
|
103
|
+
formatDragDate: (e) => e.toLocaleDateString(g.dateLocale, {
|
|
98
104
|
day: "2-digit",
|
|
99
105
|
month: "short"
|
|
100
106
|
})
|
|
101
107
|
};
|
|
102
108
|
}
|
|
103
109
|
//#endregion
|
|
104
|
-
export {
|
|
110
|
+
export { l as useGanttDrag };
|