@thebuoyant-tsdev/mui-ts-library 3.24.1 → 3.25.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 +26 -0
- package/README.md +26 -0
- package/dist/components/gantt-chart/GanttTaskPanel.js +187 -160
- package/dist/components/json-editor/JsonEditor.d.ts +1 -1
- package/dist/components/json-editor/JsonEditor.js +32 -31
- package/dist/components/json-editor/JsonEditor.types.d.ts +5 -0
- package/dist/components/json-editor/JsonEditor.types.js +3 -0
- package/dist/components/json-editor/JsonEditorToolbar.d.ts +2 -1
- package/dist/components/json-editor/JsonEditorToolbar.js +78 -61
- package/dist/index.cjs +2 -2
- package/package.json +2 -1
|
@@ -15,31 +15,31 @@ function h(e) {
|
|
|
15
15
|
return !1;
|
|
16
16
|
}
|
|
17
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, schema: O, showLineNumbers: k = !0, showLineColumn: A = !0, showMinimap: j = !1, showFolding: M = !0, showValidation: N = !1, enablePathFinder: P = !0,
|
|
19
|
-
let
|
|
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, schema: O, showLineNumbers: k = !0, showLineColumn: A = !0, showMinimap: j = !1, showFolding: M = !0, showValidation: N = !1, enablePathFinder: P = !0, downloadFilename: F = "file.json", toolbarConfig: I, translation: L, highlightColors: R, onBlur: ee, onFocus: z, onPathCopy: B }) {
|
|
19
|
+
let V = {
|
|
20
20
|
...t,
|
|
21
|
-
...
|
|
22
|
-
},
|
|
21
|
+
...L
|
|
22
|
+
}, H = {
|
|
23
23
|
...e,
|
|
24
|
-
...
|
|
25
|
-
},
|
|
24
|
+
...I
|
|
25
|
+
}, U = a(b), W = a(x), G = U === "auto", K = G ? void 0 : U ?? 300, q = s(null), [J, Y] = c(null), [X, Z] = c({
|
|
26
26
|
line: 1,
|
|
27
27
|
col: 1
|
|
28
|
-
}), [
|
|
29
|
-
|
|
30
|
-
}, []),
|
|
31
|
-
|
|
28
|
+
}), [Q, $] = c(() => h(g ?? "")), te = o((e) => {
|
|
29
|
+
q.current = e, Y(e);
|
|
30
|
+
}, []), ne = o((e, t) => {
|
|
31
|
+
Z({
|
|
32
32
|
line: e,
|
|
33
33
|
col: t
|
|
34
34
|
});
|
|
35
|
-
}, []),
|
|
35
|
+
}, []), re = o((e) => {
|
|
36
36
|
let t = h(e);
|
|
37
|
-
|
|
38
|
-
}, [_, v]),
|
|
37
|
+
$(t), v?.(t), _?.(e);
|
|
38
|
+
}, [_, v]), ie = A || N || !!T;
|
|
39
39
|
return /* @__PURE__ */ m(l, {
|
|
40
40
|
sx: {
|
|
41
|
-
width:
|
|
42
|
-
...
|
|
41
|
+
width: W ?? "100%",
|
|
42
|
+
...G ? {
|
|
43
43
|
display: "flex",
|
|
44
44
|
flexDirection: "column",
|
|
45
45
|
flex: 1
|
|
@@ -52,7 +52,7 @@ function g({ value: g, onChange: _, onValidChange: v, placeholder: y, height: b,
|
|
|
52
52
|
display: "flex",
|
|
53
53
|
flexDirection: "column",
|
|
54
54
|
overflow: "hidden",
|
|
55
|
-
...
|
|
55
|
+
...G ? { flex: 1 } : { height: K },
|
|
56
56
|
borderColor: w ? "error.main" : void 0,
|
|
57
57
|
"&:focus-within": {
|
|
58
58
|
borderColor: w ? "error.main" : "primary.main",
|
|
@@ -60,14 +60,15 @@ function g({ value: g, onChange: _, onValidChange: v, placeholder: y, height: b,
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
children: [!C && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(r, {
|
|
63
|
-
editorView:
|
|
64
|
-
toolbarConfig:
|
|
65
|
-
translation:
|
|
63
|
+
editorView: J,
|
|
64
|
+
toolbarConfig: H,
|
|
65
|
+
translation: V,
|
|
66
66
|
indent: D,
|
|
67
|
+
downloadFilename: F,
|
|
67
68
|
disabled: S
|
|
68
69
|
}), /* @__PURE__ */ p(u, {})] }), /* @__PURE__ */ p(n, {
|
|
69
70
|
value: g,
|
|
70
|
-
onChange:
|
|
71
|
+
onChange: re,
|
|
71
72
|
placeholder: y,
|
|
72
73
|
disabled: S,
|
|
73
74
|
readonly: C,
|
|
@@ -76,23 +77,23 @@ function g({ value: g, onChange: _, onValidChange: v, placeholder: y, height: b,
|
|
|
76
77
|
showMinimap: j,
|
|
77
78
|
showFolding: M,
|
|
78
79
|
enablePathFinder: P,
|
|
79
|
-
highlightColors:
|
|
80
|
-
onViewReady:
|
|
81
|
-
onCursorChange:
|
|
82
|
-
onBlur:
|
|
83
|
-
onFocus:
|
|
84
|
-
onPathCopy:
|
|
80
|
+
highlightColors: R,
|
|
81
|
+
onViewReady: te,
|
|
82
|
+
onCursorChange: ne,
|
|
83
|
+
onBlur: ee,
|
|
84
|
+
onFocus: z,
|
|
85
|
+
onPathCopy: B
|
|
85
86
|
})]
|
|
86
87
|
}),
|
|
87
|
-
|
|
88
|
+
ie && /* @__PURE__ */ p(i, {
|
|
88
89
|
helperText: T,
|
|
89
90
|
error: w,
|
|
90
91
|
showLineColumn: A,
|
|
91
92
|
showValidation: N,
|
|
92
|
-
isValid:
|
|
93
|
-
cursorLine:
|
|
94
|
-
cursorCol:
|
|
95
|
-
translation:
|
|
93
|
+
isValid: Q,
|
|
94
|
+
cursorLine: X.line,
|
|
95
|
+
cursorCol: X.col,
|
|
96
|
+
translation: V
|
|
96
97
|
}),
|
|
97
98
|
E && /* @__PURE__ */ p("input", {
|
|
98
99
|
type: "hidden",
|
|
@@ -2,6 +2,7 @@ export type JsonEditorToolbarConfig = {
|
|
|
2
2
|
showFormat?: boolean;
|
|
3
3
|
showCompact?: boolean;
|
|
4
4
|
showCopy?: boolean;
|
|
5
|
+
showDownload?: boolean;
|
|
5
6
|
showClear?: boolean;
|
|
6
7
|
showUndoRedo?: boolean;
|
|
7
8
|
};
|
|
@@ -11,6 +12,8 @@ export type JsonEditorTranslation = {
|
|
|
11
12
|
compact: string;
|
|
12
13
|
copy: string;
|
|
13
14
|
copySuccess: string;
|
|
15
|
+
download: string;
|
|
16
|
+
downloadSuccess: string;
|
|
14
17
|
clear: string;
|
|
15
18
|
undo: string;
|
|
16
19
|
redo: string;
|
|
@@ -72,6 +75,8 @@ export type JsonEditorProps = {
|
|
|
72
75
|
showFolding?: boolean;
|
|
73
76
|
/** Shows a Valid / Invalid JSON indicator in the footer. */
|
|
74
77
|
showValidation?: boolean;
|
|
78
|
+
/** Filename for the Download button export. Default: "file.json". */
|
|
79
|
+
downloadFilename?: string;
|
|
75
80
|
toolbarConfig?: JsonEditorToolbarConfig;
|
|
76
81
|
translation?: Partial<JsonEditorTranslation>;
|
|
77
82
|
value?: string;
|
|
@@ -3,6 +3,7 @@ var e = {
|
|
|
3
3
|
showFormat: !0,
|
|
4
4
|
showCompact: !0,
|
|
5
5
|
showCopy: !0,
|
|
6
|
+
showDownload: !0,
|
|
6
7
|
showClear: !0,
|
|
7
8
|
showUndoRedo: !0
|
|
8
9
|
}, t = {
|
|
@@ -10,6 +11,8 @@ var e = {
|
|
|
10
11
|
compact: "Compact JSON",
|
|
11
12
|
copy: "Copy",
|
|
12
13
|
copySuccess: "Copied!",
|
|
14
|
+
download: "Download",
|
|
15
|
+
downloadSuccess: "Downloaded!",
|
|
13
16
|
clear: "Clear",
|
|
14
17
|
undo: "Undo",
|
|
15
18
|
redo: "Redo",
|
|
@@ -5,7 +5,8 @@ type JsonEditorToolbarProps = {
|
|
|
5
5
|
toolbarConfig: Required<JsonEditorToolbarConfig>;
|
|
6
6
|
translation: JsonEditorTranslation;
|
|
7
7
|
indent: number;
|
|
8
|
+
downloadFilename: string;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
};
|
|
10
|
-
export declare function JsonEditorToolbar({ editorView, toolbarConfig: tc, translation: t, indent, disabled, }: JsonEditorToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function JsonEditorToolbar({ editorView, toolbarConfig: tc, translation: t, indent, downloadFilename, disabled, }: JsonEditorToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -4,21 +4,22 @@ import { Box as n, Divider as r } from "@mui/material";
|
|
|
4
4
|
import { redo as i, undo as a } from "@codemirror/commands";
|
|
5
5
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
import c from "@mui/icons-material/ContentCopy";
|
|
7
|
-
import l from "@mui/icons-material/
|
|
8
|
-
import u from "@mui/icons-material/
|
|
9
|
-
import d from "@mui/icons-material/
|
|
10
|
-
import f from "@mui/icons-material/
|
|
11
|
-
import p from "@mui/icons-material/
|
|
12
|
-
import m from "@mui/icons-material/
|
|
7
|
+
import l from "@mui/icons-material/Download";
|
|
8
|
+
import u from "@mui/icons-material/Check";
|
|
9
|
+
import d from "@mui/icons-material/Delete";
|
|
10
|
+
import f from "@mui/icons-material/Undo";
|
|
11
|
+
import p from "@mui/icons-material/Redo";
|
|
12
|
+
import m from "@mui/icons-material/AutoFixHigh";
|
|
13
|
+
import h from "@mui/icons-material/Compress";
|
|
13
14
|
//#region src/components/json-editor/JsonEditorToolbar.tsx
|
|
14
|
-
function
|
|
15
|
-
let [
|
|
16
|
-
function
|
|
17
|
-
let e =
|
|
15
|
+
function g({ editorView: g, toolbarConfig: _, translation: v, indent: y, downloadFilename: b, disabled: x }) {
|
|
16
|
+
let [S, C] = t(), [w, T] = t(), E = x || !g;
|
|
17
|
+
function D() {
|
|
18
|
+
let e = g;
|
|
18
19
|
if (!e) return;
|
|
19
20
|
let t = e.state.doc.toString();
|
|
20
21
|
try {
|
|
21
|
-
let n = JSON.stringify(JSON.parse(t), null,
|
|
22
|
+
let n = JSON.stringify(JSON.parse(t), null, y);
|
|
22
23
|
e.dispatch({ changes: {
|
|
23
24
|
from: 0,
|
|
24
25
|
to: e.state.doc.length,
|
|
@@ -27,8 +28,8 @@ function h({ editorView: h, toolbarConfig: g, translation: _, indent: v, disable
|
|
|
27
28
|
} catch {}
|
|
28
29
|
e.focus();
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
let e =
|
|
31
|
+
function O() {
|
|
32
|
+
let e = g;
|
|
32
33
|
if (!e) return;
|
|
33
34
|
let t = e.state.doc.toString();
|
|
34
35
|
try {
|
|
@@ -41,29 +42,33 @@ function h({ editorView: h, toolbarConfig: g, translation: _, indent: v, disable
|
|
|
41
42
|
} catch {}
|
|
42
43
|
e.focus();
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
let e =
|
|
45
|
+
function k() {
|
|
46
|
+
let e = g?.state.doc.toString() ?? "";
|
|
46
47
|
navigator.clipboard.writeText(e).then(() => {
|
|
47
|
-
|
|
48
|
+
C();
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
let e =
|
|
51
|
+
function A() {
|
|
52
|
+
let e = g?.state.doc.toString() ?? "", t = new Blob([e], { type: "application/json" }), n = URL.createObjectURL(t), r = document.createElement("a");
|
|
53
|
+
r.href = n, r.download = b, r.click(), URL.revokeObjectURL(n), T();
|
|
54
|
+
}
|
|
55
|
+
function j() {
|
|
56
|
+
let e = g;
|
|
52
57
|
e && (e.dispatch({ changes: {
|
|
53
58
|
from: 0,
|
|
54
59
|
to: e.state.doc.length,
|
|
55
60
|
insert: ""
|
|
56
61
|
} }), e.focus());
|
|
57
62
|
}
|
|
58
|
-
function
|
|
59
|
-
let e =
|
|
63
|
+
function M() {
|
|
64
|
+
let e = g;
|
|
60
65
|
e && (a(e), e.focus());
|
|
61
66
|
}
|
|
62
|
-
function
|
|
63
|
-
let e =
|
|
67
|
+
function N() {
|
|
68
|
+
let e = g;
|
|
64
69
|
e && (i(e), e.focus());
|
|
65
70
|
}
|
|
66
|
-
let
|
|
71
|
+
let P = _.showFormat || _.showCompact, F = _.showCopy || _.showDownload || _.showClear, I = _.showUndoRedo;
|
|
67
72
|
return /* @__PURE__ */ s(n, {
|
|
68
73
|
sx: {
|
|
69
74
|
display: "flex",
|
|
@@ -76,73 +81,85 @@ function h({ editorView: h, toolbarConfig: g, translation: _, indent: v, disable
|
|
|
76
81
|
role: "toolbar",
|
|
77
82
|
"aria-label": "JSON editor actions",
|
|
78
83
|
children: [
|
|
79
|
-
|
|
84
|
+
P && /* @__PURE__ */ s(n, {
|
|
80
85
|
sx: {
|
|
81
86
|
display: "flex",
|
|
82
87
|
gap: .25
|
|
83
88
|
},
|
|
84
|
-
children: [
|
|
85
|
-
label:
|
|
86
|
-
icon: /* @__PURE__ */ o(p, { fontSize: "small" }),
|
|
87
|
-
onClick: C,
|
|
88
|
-
disabled: S
|
|
89
|
-
}), g.showCompact && /* @__PURE__ */ o(e, {
|
|
90
|
-
label: _.compact,
|
|
89
|
+
children: [_.showFormat && /* @__PURE__ */ o(e, {
|
|
90
|
+
label: v.format,
|
|
91
91
|
icon: /* @__PURE__ */ o(m, { fontSize: "small" }),
|
|
92
|
-
onClick:
|
|
93
|
-
disabled:
|
|
92
|
+
onClick: D,
|
|
93
|
+
disabled: E
|
|
94
|
+
}), _.showCompact && /* @__PURE__ */ o(e, {
|
|
95
|
+
label: v.compact,
|
|
96
|
+
icon: /* @__PURE__ */ o(h, { fontSize: "small" }),
|
|
97
|
+
onClick: O,
|
|
98
|
+
disabled: E
|
|
94
99
|
})]
|
|
95
100
|
}),
|
|
96
|
-
|
|
101
|
+
P && (F || I) && /* @__PURE__ */ o(r, {
|
|
97
102
|
orientation: "vertical",
|
|
98
103
|
flexItem: !0,
|
|
99
104
|
sx: { mx: .5 }
|
|
100
105
|
}),
|
|
101
|
-
|
|
106
|
+
F && /* @__PURE__ */ s(n, {
|
|
102
107
|
sx: {
|
|
103
108
|
display: "flex",
|
|
104
109
|
gap: .25
|
|
105
110
|
},
|
|
106
|
-
children: [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
children: [
|
|
112
|
+
_.showCopy && /* @__PURE__ */ o(e, {
|
|
113
|
+
label: S ? v.copySuccess : v.copy,
|
|
114
|
+
icon: S ? /* @__PURE__ */ o(u, {
|
|
115
|
+
fontSize: "small",
|
|
116
|
+
color: "success"
|
|
117
|
+
}) : /* @__PURE__ */ o(c, { fontSize: "small" }),
|
|
118
|
+
onClick: k,
|
|
119
|
+
disabled: E
|
|
120
|
+
}),
|
|
121
|
+
_.showDownload && /* @__PURE__ */ o(e, {
|
|
122
|
+
label: w ? v.downloadSuccess : v.download,
|
|
123
|
+
icon: w ? /* @__PURE__ */ o(u, {
|
|
124
|
+
fontSize: "small",
|
|
125
|
+
color: "success"
|
|
126
|
+
}) : /* @__PURE__ */ o(l, { fontSize: "small" }),
|
|
127
|
+
onClick: A,
|
|
128
|
+
disabled: E
|
|
129
|
+
}),
|
|
130
|
+
_.showClear && /* @__PURE__ */ o(e, {
|
|
131
|
+
label: v.clear,
|
|
132
|
+
icon: /* @__PURE__ */ o(d, { fontSize: "small" }),
|
|
133
|
+
onClick: j,
|
|
134
|
+
disabled: E
|
|
135
|
+
})
|
|
136
|
+
]
|
|
120
137
|
}),
|
|
121
|
-
|
|
138
|
+
F && I && /* @__PURE__ */ o(r, {
|
|
122
139
|
orientation: "vertical",
|
|
123
140
|
flexItem: !0,
|
|
124
141
|
sx: { mx: .5 }
|
|
125
142
|
}),
|
|
126
|
-
|
|
143
|
+
I && /* @__PURE__ */ s(n, {
|
|
127
144
|
sx: {
|
|
128
145
|
display: "flex",
|
|
129
146
|
gap: .25
|
|
130
147
|
},
|
|
131
148
|
children: [/* @__PURE__ */ o(e, {
|
|
132
|
-
label:
|
|
133
|
-
icon: /* @__PURE__ */ o(d, { fontSize: "small" }),
|
|
134
|
-
onClick: D,
|
|
135
|
-
disabled: S
|
|
136
|
-
}), /* @__PURE__ */ o(e, {
|
|
137
|
-
label: _.redo,
|
|
149
|
+
label: v.undo,
|
|
138
150
|
icon: /* @__PURE__ */ o(f, { fontSize: "small" }),
|
|
139
|
-
onClick:
|
|
140
|
-
disabled:
|
|
151
|
+
onClick: M,
|
|
152
|
+
disabled: E
|
|
153
|
+
}), /* @__PURE__ */ o(e, {
|
|
154
|
+
label: v.redo,
|
|
155
|
+
icon: /* @__PURE__ */ o(p, { fontSize: "small" }),
|
|
156
|
+
onClick: N,
|
|
157
|
+
disabled: E
|
|
141
158
|
})]
|
|
142
159
|
}),
|
|
143
|
-
!
|
|
160
|
+
!P && !F && !I && /* @__PURE__ */ o(n, { sx: { height: 32 } })
|
|
144
161
|
]
|
|
145
162
|
});
|
|
146
163
|
}
|
|
147
164
|
//#endregion
|
|
148
|
-
export {
|
|
165
|
+
export { g as JsonEditorToolbar };
|