@thebuoyant-tsdev/mui-ts-library 3.2.1 → 3.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 +31 -0
- package/README.md +31 -0
- package/dist/components/chord-chart/ChordChart.js +284 -0
- package/dist/components/chord-chart/ChordChart.types.js +4 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.js +382 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.types.js +4 -0
- package/dist/components/gantt-chart/GanttBarRow.js +202 -0
- package/dist/components/gantt-chart/GanttChart.constants.js +14 -0
- package/dist/components/gantt-chart/GanttChart.js +258 -0
- package/dist/components/gantt-chart/GanttChart.store.js +119 -0
- package/dist/components/gantt-chart/GanttChart.types.js +47 -0
- package/dist/components/gantt-chart/GanttDeleteDialog.js +30 -0
- package/dist/components/gantt-chart/GanttDependencyArrows.js +54 -0
- package/dist/components/gantt-chart/GanttStatusContextMenu.js +36 -0
- package/dist/components/gantt-chart/GanttTaskDialog.js +324 -0
- package/dist/components/gantt-chart/GanttTaskPanel.js +415 -0
- package/dist/components/gantt-chart/GanttTimeline.js +223 -0
- package/dist/components/gantt-chart/GanttTimelineHeader.js +90 -0
- package/dist/components/gantt-chart/GanttToolbar.js +157 -0
- package/dist/components/gantt-chart/GanttWeekendStrips.js +29 -0
- package/dist/components/gantt-chart/hooks/useGanttDrag.js +104 -0
- package/dist/components/gantt-chart/util/gantt-chart.util.js +150 -0
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +488 -0
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.js +8 -0
- package/dist/components/json-editor/JsonEditor.js +102 -0
- package/dist/components/json-editor/JsonEditor.types.js +21 -0
- package/dist/components/json-editor/JsonEditorContent.js +185 -0
- package/dist/components/json-editor/JsonEditorFooter.js +55 -0
- package/dist/components/json-editor/JsonEditorToolbar.js +148 -0
- package/dist/components/password-strength-meter/PasswordStrengthBar.js +66 -0
- package/dist/components/password-strength-meter/PasswordStrengthMeter.js +272 -0
- package/dist/components/password-strength-meter/PasswordStrengthMeter.types.js +27 -0
- package/dist/components/password-strength-meter/util/password-strength.util.js +38 -0
- package/dist/components/radial-tree-chart/RadialTreeChart.js +447 -0
- package/dist/components/radial-tree-chart/RadialTreeChart.types.js +8 -0
- package/dist/components/rich-text-editor/RichTextEditor.js +135 -0
- package/dist/components/rich-text-editor/RichTextEditor.types.js +74 -0
- package/dist/components/rich-text-editor/RichTextEditorColorPicker.js +185 -0
- package/dist/components/rich-text-editor/RichTextEditorContent.js +129 -0
- package/dist/components/rich-text-editor/RichTextEditorEmojiPicker.js +110 -0
- package/dist/components/rich-text-editor/RichTextEditorFooter.js +33 -0
- package/dist/components/rich-text-editor/RichTextEditorImageDialog.js +74 -0
- package/dist/components/rich-text-editor/RichTextEditorLinkDialog.js +70 -0
- package/dist/components/rich-text-editor/RichTextEditorTableMenu.js +97 -0
- package/dist/components/rich-text-editor/RichTextEditorToolbar.js +362 -0
- package/dist/components/rich-text-editor/util/emojis.js +739 -0
- package/dist/components/shared/ToolbarButton.js +22 -0
- package/dist/components/shared/normalizeSize.js +6 -0
- package/dist/components/sql-editor/SqlEditor.d.ts +1 -1
- package/dist/components/sql-editor/SqlEditor.js +113 -0
- package/dist/components/sql-editor/SqlEditor.types.d.ts +9 -0
- package/dist/components/sql-editor/SqlEditor.types.js +24 -0
- package/dist/components/sql-editor/SqlEditorContent.js +248 -0
- package/dist/components/sql-editor/SqlEditorFooter.js +45 -0
- package/dist/components/sql-editor/SqlEditorHistoryMenu.d.ts +11 -0
- package/dist/components/sql-editor/SqlEditorHistoryMenu.js +75 -0
- package/dist/components/sql-editor/SqlEditorToolbar.d.ts +5 -1
- package/dist/components/sql-editor/SqlEditorToolbar.js +163 -0
- package/dist/components/sql-editor/useSqlQueryHistory.d.ts +6 -0
- package/dist/components/sql-editor/useSqlQueryHistory.js +20 -0
- package/dist/components/sql-editor/util/sqlQueryHistory.util.d.ts +12 -0
- package/dist/components/sql-editor/util/sqlQueryHistory.util.js +28 -0
- package/dist/components/sunburst-chart/SunburstChart.js +292 -0
- package/dist/components/sunburst-chart/SunburstChart.types.js +4 -0
- package/dist/components/tag-selection/TagSelection.js +102 -0
- package/dist/components/tag-selection/TagSelection.store.js +40 -0
- package/dist/components/tag-selection/TagSelection.types.d.ts +2 -0
- package/dist/components/tag-selection/TagSelection.types.js +18 -0
- package/dist/components/tag-selection/TagSelectionAutocomplete.js +382 -0
- package/dist/components/tag-selection/TagSelectionChip.js +30 -0
- package/dist/components/tag-selection/TagSelectionSelectedTags.js +73 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +23 -8035
- package/package.json +1 -1
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { DEFAULT_HORIZONTAL_TREE_TRANSLATION as e } from "./HorizontalTreeChart.types.js";
|
|
2
|
+
import { useCallback as t, useLayoutEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
|
+
import { Avatar as o, Box as s, Divider as c, Popover as l, Tooltip as ee, Typography as u, useTheme as d } from "@mui/material";
|
|
4
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
5
|
+
import * as h from "d3";
|
|
6
|
+
//#region src/components/horizontal-tree-chart/HorizontalTreeChart.tsx
|
|
7
|
+
var g = {
|
|
8
|
+
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",
|
|
9
|
+
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"
|
|
10
|
+
};
|
|
11
|
+
function te({ path: e, size: t }) {
|
|
12
|
+
let n = t / 2;
|
|
13
|
+
return /* @__PURE__ */ p("g", {
|
|
14
|
+
transform: `translate(${-n},${-n})`,
|
|
15
|
+
pointerEvents: "none",
|
|
16
|
+
children: /* @__PURE__ */ p("svg", {
|
|
17
|
+
width: t,
|
|
18
|
+
height: t,
|
|
19
|
+
viewBox: "0 0 24 24",
|
|
20
|
+
overflow: "visible",
|
|
21
|
+
children: /* @__PURE__ */ p("path", {
|
|
22
|
+
d: e,
|
|
23
|
+
fill: "white"
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function _({ info: e, labelA: t, labelB: n }) {
|
|
29
|
+
return /* @__PURE__ */ m(s, {
|
|
30
|
+
sx: {
|
|
31
|
+
p: 2,
|
|
32
|
+
minWidth: 200,
|
|
33
|
+
maxWidth: 280
|
|
34
|
+
},
|
|
35
|
+
children: [/* @__PURE__ */ m(s, {
|
|
36
|
+
sx: {
|
|
37
|
+
display: "flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
gap: 1.5,
|
|
40
|
+
mb: 1.5
|
|
41
|
+
},
|
|
42
|
+
children: [/* @__PURE__ */ p(o, {
|
|
43
|
+
sx: {
|
|
44
|
+
bgcolor: "primary.main",
|
|
45
|
+
width: 40,
|
|
46
|
+
height: 40
|
|
47
|
+
},
|
|
48
|
+
children: e.name.charAt(0).toUpperCase()
|
|
49
|
+
}), /* @__PURE__ */ m(s, { children: [/* @__PURE__ */ p(u, {
|
|
50
|
+
variant: "body2",
|
|
51
|
+
sx: { fontWeight: "bold" },
|
|
52
|
+
children: e.name
|
|
53
|
+
}), e.subname && /* @__PURE__ */ p(u, {
|
|
54
|
+
variant: "caption",
|
|
55
|
+
color: "text.secondary",
|
|
56
|
+
children: e.subname
|
|
57
|
+
})] })]
|
|
58
|
+
}), (e.specialValueA != null || e.specialValueB != null) && /* @__PURE__ */ m(f, { children: [
|
|
59
|
+
/* @__PURE__ */ p(c, { sx: { mb: 1.5 } }),
|
|
60
|
+
e.specialValueA != null && /* @__PURE__ */ m(s, {
|
|
61
|
+
sx: {
|
|
62
|
+
display: "flex",
|
|
63
|
+
justifyContent: "space-between",
|
|
64
|
+
mb: .5
|
|
65
|
+
},
|
|
66
|
+
children: [/* @__PURE__ */ p(u, {
|
|
67
|
+
variant: "caption",
|
|
68
|
+
color: "text.secondary",
|
|
69
|
+
children: t
|
|
70
|
+
}), /* @__PURE__ */ p(u, {
|
|
71
|
+
variant: "caption",
|
|
72
|
+
children: String(e.specialValueA)
|
|
73
|
+
})]
|
|
74
|
+
}),
|
|
75
|
+
e.specialValueB != null && /* @__PURE__ */ m(s, {
|
|
76
|
+
sx: {
|
|
77
|
+
display: "flex",
|
|
78
|
+
justifyContent: "space-between"
|
|
79
|
+
},
|
|
80
|
+
children: [/* @__PURE__ */ p(u, {
|
|
81
|
+
variant: "caption",
|
|
82
|
+
color: "text.secondary",
|
|
83
|
+
children: n
|
|
84
|
+
}), /* @__PURE__ */ p(u, {
|
|
85
|
+
variant: "caption",
|
|
86
|
+
children: String(e.specialValueB)
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
] })]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function v({ data: o, orientation: c = "LR", width: f = 800, height: v = 500, levelSpacing: y = 200, nodeRadius: b = 10, sortBy: x = "name", showLabels: ne = !0, labelFontSize: re = 12, labelColor: ie, showIcons: ae = !0, chartColors: S, linkStrokeOpacity: oe = 1, linkStrokeWidth: se = 1.5, linkColor: ce, zoomable: C = !1, drillable: w = !1, onFocusChange: T, showNodePopover: E = !1, renderNodePopoverContent: D, onNodeClick: le, disabled: O = !1, translation: ue }) {
|
|
93
|
+
let k = d(), A = {
|
|
94
|
+
...e,
|
|
95
|
+
...ue
|
|
96
|
+
}, de = [
|
|
97
|
+
k.palette.primary.main,
|
|
98
|
+
k.palette.secondary.main,
|
|
99
|
+
k.palette.error.main,
|
|
100
|
+
k.palette.warning.main,
|
|
101
|
+
k.palette.success.main,
|
|
102
|
+
k.palette.info.main
|
|
103
|
+
], j = S && S.length > 0 ? S : de, fe = ie || k.palette.text.primary, pe = ce || k.palette.text.secondary, me = k.palette.background.paper, he = k.typography.fontFamily, M = c === "TB" || c === "BT", N = M ? v : f, P = M ? f : v, [F, I] = a([o]), L = F[F.length - 1], [ge, _e] = a(o);
|
|
104
|
+
ge !== o && (_e(o), I([o]));
|
|
105
|
+
let R = r(() => {
|
|
106
|
+
let e = h.hierarchy(L);
|
|
107
|
+
x === "value" ? (e.sum((e) => e.value ?? 0), e.sort((e, t) => (t.value ?? 0) - (e.value ?? 0))) : e.sort((e, t) => h.ascending(String(e.data.name), String(t.data.name)));
|
|
108
|
+
let t = h.max(e.descendants(), (e) => e.depth) ?? 1;
|
|
109
|
+
return h.tree().size([N * .8, Math.min(t * y, P * .85)])(e);
|
|
110
|
+
}, [
|
|
111
|
+
L,
|
|
112
|
+
x,
|
|
113
|
+
N,
|
|
114
|
+
P,
|
|
115
|
+
y
|
|
116
|
+
]), ve = R.descendants(), ye = R.links(), be = t((e) => e.data.colorConfig?.fill ?? j[e.depth % j.length], [j]), z = t((e) => {
|
|
117
|
+
switch (c) {
|
|
118
|
+
case "LR": return {
|
|
119
|
+
x: e.y,
|
|
120
|
+
y: e.x - N * .4
|
|
121
|
+
};
|
|
122
|
+
case "RL": return {
|
|
123
|
+
x: P * .85 - e.y,
|
|
124
|
+
y: e.x - N * .4
|
|
125
|
+
};
|
|
126
|
+
case "TB": return {
|
|
127
|
+
x: e.x - N * .4,
|
|
128
|
+
y: e.y
|
|
129
|
+
};
|
|
130
|
+
case "BT": return {
|
|
131
|
+
x: e.x - N * .4,
|
|
132
|
+
y: P * .85 - e.y
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}, [
|
|
136
|
+
c,
|
|
137
|
+
N,
|
|
138
|
+
P
|
|
139
|
+
]), xe = t((e) => {
|
|
140
|
+
let t = z(e.source), n = z(e.target);
|
|
141
|
+
if (c === "LR" || c === "RL") {
|
|
142
|
+
let e = (t.x + n.x) / 2;
|
|
143
|
+
return `M${t.x},${t.y} C${e},${t.y} ${e},${n.y} ${n.x},${n.y}`;
|
|
144
|
+
}
|
|
145
|
+
let r = (t.y + n.y) / 2;
|
|
146
|
+
return `M${t.x},${t.y} C${t.x},${r} ${n.x},${r} ${n.x},${n.y}`;
|
|
147
|
+
}, [z, c]), B = t((e) => ({
|
|
148
|
+
id: e.data.id ?? null,
|
|
149
|
+
name: e.data.name,
|
|
150
|
+
subname: e.data.subname ?? null,
|
|
151
|
+
value: e.value ?? e.data.value ?? null,
|
|
152
|
+
specialValueA: e.data.specialValueA ?? null,
|
|
153
|
+
specialValueB: e.data.specialValueB ?? null,
|
|
154
|
+
depth: e.depth,
|
|
155
|
+
path: e.ancestors().map((e) => e.data.name).reverse(),
|
|
156
|
+
childrenCount: e.children?.length ?? 0,
|
|
157
|
+
data: e.data
|
|
158
|
+
}), []), [V, H] = a(`0 -${v / 2} ${f} ${v}`), [U, W] = a(1), G = i(null), Se = r(() => {
|
|
159
|
+
if (U === 1) return V;
|
|
160
|
+
let [e, t, n, r] = V.split(" ").map(Number), i = n / U, a = r / U;
|
|
161
|
+
return `${e + (n - i) / 2} ${t + (r - a) / 2} ${i} ${a}`;
|
|
162
|
+
}, [V, U]);
|
|
163
|
+
n(() => {
|
|
164
|
+
let e = G.current;
|
|
165
|
+
if (!e) return;
|
|
166
|
+
let t = requestAnimationFrame(() => {
|
|
167
|
+
try {
|
|
168
|
+
let t = e.getBBox();
|
|
169
|
+
H(`${t.x - 24} ${t.y - 24} ${t.width + 48} ${t.height + 48}`);
|
|
170
|
+
} catch {
|
|
171
|
+
H(`0 -${v / 2} ${f} ${v}`);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
return () => cancelAnimationFrame(t);
|
|
175
|
+
}, [
|
|
176
|
+
R,
|
|
177
|
+
f,
|
|
178
|
+
v,
|
|
179
|
+
c
|
|
180
|
+
]);
|
|
181
|
+
let Ce = t((e) => {
|
|
182
|
+
if (!C || O || !e.ctrlKey) return;
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
let t = e.deltaY < 0 ? 1.15 : 1 / 1.15;
|
|
185
|
+
W((e) => Math.max(.25, Math.min(8, e * t)));
|
|
186
|
+
}, [C, O]), K = i(null), we = (e) => {
|
|
187
|
+
K.current &&= (clearTimeout(K.current), null), K.current = setTimeout(() => {
|
|
188
|
+
e(), K.current = null;
|
|
189
|
+
}, 250);
|
|
190
|
+
}, q = () => {
|
|
191
|
+
K.current &&= (clearTimeout(K.current), null);
|
|
192
|
+
}, J = t(() => {
|
|
193
|
+
I((e) => {
|
|
194
|
+
if (e.length <= 1) return e;
|
|
195
|
+
let t = e.slice(0, -1);
|
|
196
|
+
return T?.({
|
|
197
|
+
focusedNode: {
|
|
198
|
+
id: t[t.length - 1].id ?? null,
|
|
199
|
+
name: t[t.length - 1].name,
|
|
200
|
+
subname: t[t.length - 1].subname ?? null,
|
|
201
|
+
value: null,
|
|
202
|
+
specialValueA: null,
|
|
203
|
+
specialValueB: null,
|
|
204
|
+
depth: t.length - 1,
|
|
205
|
+
path: t.map((e) => e.name),
|
|
206
|
+
childrenCount: t[t.length - 1].children?.length ?? 0,
|
|
207
|
+
data: t[t.length - 1]
|
|
208
|
+
},
|
|
209
|
+
isRoot: t.length <= 1
|
|
210
|
+
}), t;
|
|
211
|
+
});
|
|
212
|
+
}, [T]);
|
|
213
|
+
n(() => {
|
|
214
|
+
if (!C && !w) return;
|
|
215
|
+
let e = (e) => {
|
|
216
|
+
e.key === "Escape" && (C && W(1), w && (I([o]), T?.({
|
|
217
|
+
focusedNode: {
|
|
218
|
+
id: o.id ?? null,
|
|
219
|
+
name: o.name,
|
|
220
|
+
subname: o.subname ?? null,
|
|
221
|
+
value: null,
|
|
222
|
+
specialValueA: null,
|
|
223
|
+
specialValueB: null,
|
|
224
|
+
depth: 0,
|
|
225
|
+
path: [o.name],
|
|
226
|
+
childrenCount: o.children?.length ?? 0,
|
|
227
|
+
data: o
|
|
228
|
+
},
|
|
229
|
+
isRoot: !0
|
|
230
|
+
})));
|
|
231
|
+
};
|
|
232
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
233
|
+
}, [
|
|
234
|
+
C,
|
|
235
|
+
w,
|
|
236
|
+
o,
|
|
237
|
+
T
|
|
238
|
+
]);
|
|
239
|
+
let Y = i(null), X = i(null), [Te, Z] = a(!1), [Ee, De] = a(null), [Q, Oe] = a({
|
|
240
|
+
left: 0,
|
|
241
|
+
top: 0
|
|
242
|
+
}), [$, ke] = a(null), Ae = (e, t) => {
|
|
243
|
+
if (O) return;
|
|
244
|
+
let n = B(e);
|
|
245
|
+
if ((t.ctrlKey || t.metaKey) && w && e.children) {
|
|
246
|
+
we(() => {
|
|
247
|
+
I((t) => [...t, e.data]), T?.({
|
|
248
|
+
focusedNode: n,
|
|
249
|
+
isRoot: !1
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if ((t.ctrlKey || t.metaKey) && w) {
|
|
255
|
+
q(), J();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (E) {
|
|
259
|
+
let e = Y.current?.getBoundingClientRect();
|
|
260
|
+
Oe({
|
|
261
|
+
left: e ? t.clientX - e.left : t.clientX,
|
|
262
|
+
top: e ? t.clientY - e.top : t.clientY
|
|
263
|
+
}), De(X.current), ke(n), Z(!0);
|
|
264
|
+
}
|
|
265
|
+
le?.(n, t);
|
|
266
|
+
}, je = (e, t) => {
|
|
267
|
+
O || !w || (t.ctrlKey || t.metaKey) && (q(), J());
|
|
268
|
+
}, Me = {
|
|
269
|
+
followCursor: !0,
|
|
270
|
+
enterDelay: 50,
|
|
271
|
+
enterNextDelay: 0,
|
|
272
|
+
disableHoverListener: O,
|
|
273
|
+
slotProps: { tooltip: { sx: { maxWidth: 240 } } }
|
|
274
|
+
}, Ne = Math.round(b * 1.3);
|
|
275
|
+
return /* @__PURE__ */ m(s, {
|
|
276
|
+
ref: Y,
|
|
277
|
+
sx: {
|
|
278
|
+
display: "inline-flex",
|
|
279
|
+
position: "relative",
|
|
280
|
+
opacity: O ? .5 : 1,
|
|
281
|
+
cursor: O ? "not-allowed" : "default",
|
|
282
|
+
userSelect: "none"
|
|
283
|
+
},
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ p(s, {
|
|
286
|
+
ref: X,
|
|
287
|
+
sx: {
|
|
288
|
+
position: "absolute",
|
|
289
|
+
left: Q.left,
|
|
290
|
+
top: Q.top,
|
|
291
|
+
width: 0,
|
|
292
|
+
height: 0
|
|
293
|
+
}
|
|
294
|
+
}),
|
|
295
|
+
w && F.length > 1 && /* @__PURE__ */ p(s, {
|
|
296
|
+
sx: {
|
|
297
|
+
position: "absolute",
|
|
298
|
+
top: 4,
|
|
299
|
+
left: 0,
|
|
300
|
+
right: 0,
|
|
301
|
+
display: "flex",
|
|
302
|
+
justifyContent: "center",
|
|
303
|
+
pointerEvents: "none",
|
|
304
|
+
zIndex: 1
|
|
305
|
+
},
|
|
306
|
+
children: /* @__PURE__ */ p(u, {
|
|
307
|
+
variant: "caption",
|
|
308
|
+
sx: {
|
|
309
|
+
bgcolor: "action.hover",
|
|
310
|
+
borderRadius: 1,
|
|
311
|
+
px: 1,
|
|
312
|
+
py: .25,
|
|
313
|
+
color: "text.secondary",
|
|
314
|
+
fontSize: "0.7rem"
|
|
315
|
+
},
|
|
316
|
+
children: F.map((e) => e.name).join(" › ")
|
|
317
|
+
})
|
|
318
|
+
}),
|
|
319
|
+
/* @__PURE__ */ p("svg", {
|
|
320
|
+
width: f,
|
|
321
|
+
height: v,
|
|
322
|
+
viewBox: Se,
|
|
323
|
+
onWheel: Ce,
|
|
324
|
+
style: {
|
|
325
|
+
fontFamily: he ?? "sans-serif",
|
|
326
|
+
overflow: C && U > 1 ? "hidden" : "visible"
|
|
327
|
+
},
|
|
328
|
+
role: "img",
|
|
329
|
+
"aria-label": o.name,
|
|
330
|
+
children: /* @__PURE__ */ m("g", {
|
|
331
|
+
ref: G,
|
|
332
|
+
children: [/* @__PURE__ */ p("g", {
|
|
333
|
+
fill: "none",
|
|
334
|
+
stroke: pe,
|
|
335
|
+
strokeOpacity: oe,
|
|
336
|
+
strokeWidth: se,
|
|
337
|
+
children: ye.map((e, t) => /* @__PURE__ */ p("path", { d: xe(e) }, `link-${t}`))
|
|
338
|
+
}), ve.map((e, t) => {
|
|
339
|
+
let n = z(e), r = be(e), i = B(e), a = e.children ? g.folder : g.person, o = c === "LR", l = c === "RL", d = o ? b + 6 : l ? -(b + 6) : 0, f = !o && !l ? c === "TB" ? b + 16 : -(b + 6) : 0, h = o ? "start" : l ? "end" : "middle", _ = /* @__PURE__ */ m(s, {
|
|
340
|
+
sx: {
|
|
341
|
+
py: .5,
|
|
342
|
+
minWidth: 140
|
|
343
|
+
},
|
|
344
|
+
children: [
|
|
345
|
+
/* @__PURE__ */ p(u, {
|
|
346
|
+
variant: "caption",
|
|
347
|
+
sx: {
|
|
348
|
+
fontWeight: "bold",
|
|
349
|
+
display: "block",
|
|
350
|
+
fontSize: "0.8rem"
|
|
351
|
+
},
|
|
352
|
+
children: e.data.name
|
|
353
|
+
}),
|
|
354
|
+
e.data.subname && /* @__PURE__ */ p(u, {
|
|
355
|
+
variant: "caption",
|
|
356
|
+
sx: {
|
|
357
|
+
display: "block",
|
|
358
|
+
opacity: .85
|
|
359
|
+
},
|
|
360
|
+
children: e.data.subname
|
|
361
|
+
}),
|
|
362
|
+
(i.specialValueA != null || i.specialValueB != null || e.children) && /* @__PURE__ */ m(s, {
|
|
363
|
+
sx: {
|
|
364
|
+
mt: .75,
|
|
365
|
+
borderTop: "1px solid rgba(255,255,255,0.2)",
|
|
366
|
+
pt: .75
|
|
367
|
+
},
|
|
368
|
+
children: [
|
|
369
|
+
i.specialValueA != null && /* @__PURE__ */ m(s, {
|
|
370
|
+
sx: {
|
|
371
|
+
display: "flex",
|
|
372
|
+
justifyContent: "space-between",
|
|
373
|
+
gap: 2
|
|
374
|
+
},
|
|
375
|
+
children: [/* @__PURE__ */ p(u, {
|
|
376
|
+
variant: "caption",
|
|
377
|
+
sx: { opacity: .6 },
|
|
378
|
+
children: A.specialValueA ?? "A"
|
|
379
|
+
}), /* @__PURE__ */ p(u, {
|
|
380
|
+
variant: "caption",
|
|
381
|
+
children: String(i.specialValueA)
|
|
382
|
+
})]
|
|
383
|
+
}),
|
|
384
|
+
i.specialValueB != null && /* @__PURE__ */ m(s, {
|
|
385
|
+
sx: {
|
|
386
|
+
display: "flex",
|
|
387
|
+
justifyContent: "space-between",
|
|
388
|
+
gap: 2
|
|
389
|
+
},
|
|
390
|
+
children: [/* @__PURE__ */ p(u, {
|
|
391
|
+
variant: "caption",
|
|
392
|
+
sx: { opacity: .6 },
|
|
393
|
+
children: A.specialValueB ?? "B"
|
|
394
|
+
}), /* @__PURE__ */ p(u, {
|
|
395
|
+
variant: "caption",
|
|
396
|
+
children: String(i.specialValueB)
|
|
397
|
+
})]
|
|
398
|
+
}),
|
|
399
|
+
e.children && /* @__PURE__ */ m(s, {
|
|
400
|
+
sx: {
|
|
401
|
+
display: "flex",
|
|
402
|
+
justifyContent: "space-between",
|
|
403
|
+
gap: 2
|
|
404
|
+
},
|
|
405
|
+
children: [/* @__PURE__ */ p(u, {
|
|
406
|
+
variant: "caption",
|
|
407
|
+
sx: { opacity: .6 },
|
|
408
|
+
children: "Reports"
|
|
409
|
+
}), /* @__PURE__ */ p(u, {
|
|
410
|
+
variant: "caption",
|
|
411
|
+
children: e.children.length
|
|
412
|
+
})]
|
|
413
|
+
})
|
|
414
|
+
]
|
|
415
|
+
})
|
|
416
|
+
]
|
|
417
|
+
});
|
|
418
|
+
return /* @__PURE__ */ p(ee, {
|
|
419
|
+
...Me,
|
|
420
|
+
title: _,
|
|
421
|
+
children: /* @__PURE__ */ m("g", {
|
|
422
|
+
transform: `translate(${n.x},${n.y})`,
|
|
423
|
+
onClick: (t) => Ae(e, t),
|
|
424
|
+
onDoubleClick: (t) => je(e, t),
|
|
425
|
+
style: { cursor: O ? "not-allowed" : "pointer" },
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ p("circle", {
|
|
428
|
+
r: b + 8,
|
|
429
|
+
fill: "transparent"
|
|
430
|
+
}),
|
|
431
|
+
/* @__PURE__ */ p("circle", {
|
|
432
|
+
r: b + 2,
|
|
433
|
+
fill: r,
|
|
434
|
+
fillOpacity: .15
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ p("circle", {
|
|
437
|
+
r: b,
|
|
438
|
+
fill: r
|
|
439
|
+
}),
|
|
440
|
+
ae && /* @__PURE__ */ p(te, {
|
|
441
|
+
path: a,
|
|
442
|
+
size: Ne
|
|
443
|
+
}),
|
|
444
|
+
ne && /* @__PURE__ */ p("text", {
|
|
445
|
+
x: d,
|
|
446
|
+
y: f,
|
|
447
|
+
dy: "0.35em",
|
|
448
|
+
textAnchor: h,
|
|
449
|
+
fontSize: re,
|
|
450
|
+
fontWeight: e.children ? "bold" : "normal",
|
|
451
|
+
fill: e.data.colorConfig?.textColor ?? fe,
|
|
452
|
+
paintOrder: "stroke",
|
|
453
|
+
stroke: me,
|
|
454
|
+
strokeWidth: 3,
|
|
455
|
+
pointerEvents: "none",
|
|
456
|
+
children: e.data.name
|
|
457
|
+
})
|
|
458
|
+
]
|
|
459
|
+
})
|
|
460
|
+
}, `node-${t}`);
|
|
461
|
+
})]
|
|
462
|
+
})
|
|
463
|
+
}),
|
|
464
|
+
E && /* @__PURE__ */ p(l, {
|
|
465
|
+
open: Te,
|
|
466
|
+
anchorEl: Ee,
|
|
467
|
+
onClose: () => Z(!1),
|
|
468
|
+
anchorOrigin: {
|
|
469
|
+
vertical: "top",
|
|
470
|
+
horizontal: "right"
|
|
471
|
+
},
|
|
472
|
+
transformOrigin: {
|
|
473
|
+
vertical: "top",
|
|
474
|
+
horizontal: "left"
|
|
475
|
+
},
|
|
476
|
+
slotProps: { paper: { elevation: 4 } },
|
|
477
|
+
children: $ && (D ? D($) : /* @__PURE__ */ p(_, {
|
|
478
|
+
info: $,
|
|
479
|
+
labelA: A.specialValueA ?? "Value A",
|
|
480
|
+
labelB: A.specialValueB ?? "Value B"
|
|
481
|
+
}))
|
|
482
|
+
})
|
|
483
|
+
]
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
v.displayName = "HorizontalTreeChart";
|
|
487
|
+
//#endregion
|
|
488
|
+
export { v as HorizontalTreeChart };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { DEFAULT_JSON_EDITOR_TOOLBAR_CONFIG as e, DEFAULT_JSON_EDITOR_TRANSLATION as t } from "./JsonEditor.types.js";
|
|
2
|
+
import { JsonEditorContent as n } from "./JsonEditorContent.js";
|
|
3
|
+
import { JsonEditorToolbar as r } from "./JsonEditorToolbar.js";
|
|
4
|
+
import { JsonEditorFooter as i } from "./JsonEditorFooter.js";
|
|
5
|
+
import { normalizeSize as a } from "../shared/normalizeSize.js";
|
|
6
|
+
import { useCallback as o, useRef as s, useState as c } from "react";
|
|
7
|
+
import { Box as l, Divider as u, Paper as d } from "@mui/material";
|
|
8
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/json-editor/JsonEditor.tsx
|
|
10
|
+
function h(e) {
|
|
11
|
+
if (!e.trim()) return !1;
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(e), !0;
|
|
14
|
+
} catch {
|
|
15
|
+
return !1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function g({ value: g, onChange: _, onValidChange: v, placeholder: y, height: b, width: x, disabled: S = !1, readonly: C = !1, error: w = !1, helperText: T, name: E, indent: D = 2, showLineNumbers: O = !0, showLineColumn: k = !0, showMinimap: A = !1, showValidation: j = !1, toolbarConfig: M, translation: N, highlightColors: P, onBlur: F, onFocus: I }) {
|
|
19
|
+
let L = {
|
|
20
|
+
...t,
|
|
21
|
+
...N
|
|
22
|
+
}, R = {
|
|
23
|
+
...e,
|
|
24
|
+
...M
|
|
25
|
+
}, z = a(b), B = a(x), V = z === "auto", H = V ? void 0 : z ?? 300, U = s(null), [W, G] = c(null), [K, q] = c({
|
|
26
|
+
line: 1,
|
|
27
|
+
col: 1
|
|
28
|
+
}), [J, Y] = c(() => h(g ?? "")), X = o((e) => {
|
|
29
|
+
U.current = e, G(e);
|
|
30
|
+
}, []), Z = o((e, t) => {
|
|
31
|
+
q({
|
|
32
|
+
line: e,
|
|
33
|
+
col: t
|
|
34
|
+
});
|
|
35
|
+
}, []), Q = o((e) => {
|
|
36
|
+
let t = h(e);
|
|
37
|
+
Y(t), v?.(t), _?.(e);
|
|
38
|
+
}, [_, v]), $ = k || j || !!T;
|
|
39
|
+
return /* @__PURE__ */ m(l, {
|
|
40
|
+
sx: {
|
|
41
|
+
width: B ?? "100%",
|
|
42
|
+
...V ? {
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "column",
|
|
45
|
+
flex: 1
|
|
46
|
+
} : {}
|
|
47
|
+
},
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ m(d, {
|
|
50
|
+
variant: "outlined",
|
|
51
|
+
sx: {
|
|
52
|
+
display: "flex",
|
|
53
|
+
flexDirection: "column",
|
|
54
|
+
overflow: "hidden",
|
|
55
|
+
...V ? { flex: 1 } : { height: H },
|
|
56
|
+
borderColor: w ? "error.main" : void 0,
|
|
57
|
+
"&:focus-within": {
|
|
58
|
+
borderColor: w ? "error.main" : "primary.main",
|
|
59
|
+
borderWidth: 2
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
children: [!C && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(r, {
|
|
63
|
+
editorView: W,
|
|
64
|
+
toolbarConfig: R,
|
|
65
|
+
translation: L,
|
|
66
|
+
indent: D,
|
|
67
|
+
disabled: S
|
|
68
|
+
}), /* @__PURE__ */ p(u, {})] }), /* @__PURE__ */ p(n, {
|
|
69
|
+
value: g,
|
|
70
|
+
onChange: Q,
|
|
71
|
+
placeholder: y,
|
|
72
|
+
disabled: S,
|
|
73
|
+
readonly: C,
|
|
74
|
+
showLineNumbers: O,
|
|
75
|
+
showMinimap: A,
|
|
76
|
+
highlightColors: P,
|
|
77
|
+
onViewReady: X,
|
|
78
|
+
onCursorChange: Z,
|
|
79
|
+
onBlur: F,
|
|
80
|
+
onFocus: I
|
|
81
|
+
})]
|
|
82
|
+
}),
|
|
83
|
+
$ && /* @__PURE__ */ p(i, {
|
|
84
|
+
helperText: T,
|
|
85
|
+
error: w,
|
|
86
|
+
showLineColumn: k,
|
|
87
|
+
showValidation: j,
|
|
88
|
+
isValid: J,
|
|
89
|
+
cursorLine: K.line,
|
|
90
|
+
cursorCol: K.col,
|
|
91
|
+
translation: L
|
|
92
|
+
}),
|
|
93
|
+
E && /* @__PURE__ */ p("input", {
|
|
94
|
+
type: "hidden",
|
|
95
|
+
name: E,
|
|
96
|
+
value: g ?? ""
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { g as JsonEditor };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/components/json-editor/JsonEditor.types.ts
|
|
2
|
+
var e = {
|
|
3
|
+
showFormat: !0,
|
|
4
|
+
showCompact: !0,
|
|
5
|
+
showCopy: !0,
|
|
6
|
+
showClear: !0,
|
|
7
|
+
showUndoRedo: !0
|
|
8
|
+
}, t = {
|
|
9
|
+
format: "Format JSON",
|
|
10
|
+
compact: "Compact JSON",
|
|
11
|
+
copy: "Copy",
|
|
12
|
+
copySuccess: "Copied!",
|
|
13
|
+
clear: "Clear",
|
|
14
|
+
undo: "Undo",
|
|
15
|
+
redo: "Redo",
|
|
16
|
+
lineColumn: "Ln {line}, Col {col}",
|
|
17
|
+
validJson: "Valid JSON",
|
|
18
|
+
invalidJson: "Invalid JSON"
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { e as DEFAULT_JSON_EDITOR_TOOLBAR_CONFIG, t as DEFAULT_JSON_EDITOR_TRANSLATION };
|