@thebuoyant-tsdev/mui-ts-library 3.27.0 → 3.28.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 +25 -1
- package/README.md +25 -1
- package/dist/components/gantt-chart/GanttChart.js +127 -127
- package/dist/components/gantt-chart/GanttTaskPanel.js +2 -0
- package/dist/components/sql-editor/SqlEditor.js +65 -37
- package/dist/components/sql-editor/SqlEditorContent.d.ts +2 -1
- package/dist/components/sql-editor/SqlEditorContent.js +66 -60
- package/dist/components/sql-editor/SqlEditorToolbar.js +4 -4
- package/dist/index.cjs +2 -2
- package/package.json +1 -1
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
import { useEffect as e, useRef as t } from "react";
|
|
2
2
|
import { Box as n, useTheme as r } from "@mui/material";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
|
-
import { EditorView as a, highlightActiveLine as
|
|
5
|
-
import { Compartment as
|
|
6
|
-
import { defaultKeymap as
|
|
7
|
-
import { HighlightStyle as
|
|
4
|
+
import { EditorView as a, highlightActiveLine as ee, highlightActiveLineGutter as te, keymap as o, lineNumbers as s, placeholder as c } from "@codemirror/view";
|
|
5
|
+
import { Compartment as l, EditorState as u } from "@codemirror/state";
|
|
6
|
+
import { defaultKeymap as ne, history as d, historyKeymap as f } from "@codemirror/commands";
|
|
7
|
+
import { HighlightStyle as p, syntaxHighlighting as m } from "@codemirror/language";
|
|
8
8
|
import { lintGutter as h, linter as g } from "@codemirror/lint";
|
|
9
9
|
import { tags as _ } from "@lezer/highlight";
|
|
10
|
-
import { MSSQL as v, MySQL as y, PostgreSQL as b, SQLite as x, StandardSQL as S, sql as
|
|
11
|
-
import { autocompletion as
|
|
10
|
+
import { MSSQL as v, MySQL as y, PostgreSQL as b, SQLite as x, StandardSQL as S, sql as re } from "@codemirror/lang-sql";
|
|
11
|
+
import { autocompletion as ie, completionKeymap as ae } from "@codemirror/autocomplete";
|
|
12
12
|
//#region src/components/sql-editor/SqlEditorContent.tsx
|
|
13
|
-
var
|
|
13
|
+
var C = {
|
|
14
14
|
standard: S,
|
|
15
15
|
mysql: y,
|
|
16
16
|
postgresql: b,
|
|
17
17
|
sqlite: x,
|
|
18
18
|
mssql: v
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
let z = t(null), B = t(
|
|
20
|
+
function w({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly: S = !1, showLineNumbers: w = !0, dialect: T = "standard", keywordColor: E, stringColor: D, identifierColor: O, schema: k, onExecute: A, onFormat: j, onLint: M, onDiagnosticsChange: N, onViewReady: P, onCursorChange: F, onBlur: I, onFocus: L }) {
|
|
21
|
+
let R = t(null), z = t(null), B = t(y), V = t(F), H = t(I), U = t(L), W = t(P), G = t(A), K = t(j), q = t(M), J = t(N), Y = t(new l()), X = t(new l()), Z = r(), Q = Z.palette.mode === "dark", $ = !!M, oe = JSON.stringify(k);
|
|
22
22
|
return e(() => {
|
|
23
|
-
|
|
23
|
+
B.current = y;
|
|
24
24
|
}, [y]), e(() => {
|
|
25
|
+
V.current = F;
|
|
26
|
+
}, [F]), e(() => {
|
|
25
27
|
H.current = I;
|
|
26
28
|
}, [I]), e(() => {
|
|
27
29
|
U.current = L;
|
|
28
30
|
}, [L]), e(() => {
|
|
29
|
-
W.current =
|
|
30
|
-
}, [
|
|
31
|
-
G.current =
|
|
32
|
-
}, [
|
|
33
|
-
K.current =
|
|
31
|
+
W.current = P;
|
|
32
|
+
}, [P]), e(() => {
|
|
33
|
+
G.current = A;
|
|
34
|
+
}, [A]), e(() => {
|
|
35
|
+
K.current = j;
|
|
36
|
+
}, [j]), e(() => {
|
|
37
|
+
q.current = M;
|
|
34
38
|
}, [M]), e(() => {
|
|
35
|
-
|
|
39
|
+
J.current = N;
|
|
36
40
|
}, [N]), e(() => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!z.current) return;
|
|
40
|
-
let e = B.current?.state.doc.toString() ?? v ?? "", t = O ?? Z.palette.primary.main, n = k ?? Z.palette.success.main, r = A ?? Z.palette.info.main, i = te.define([
|
|
41
|
+
if (!R.current) return;
|
|
42
|
+
let e = z.current?.state.doc.toString() ?? v ?? "", t = E ?? Z.palette.primary.main, n = D ?? Z.palette.success.main, r = O ?? Z.palette.info.main, i = p.define([
|
|
41
43
|
{
|
|
42
44
|
tag: _.keyword,
|
|
43
45
|
color: t,
|
|
@@ -78,7 +80,7 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
78
80
|
color: Z.palette.error.main,
|
|
79
81
|
textDecoration: "underline wavy"
|
|
80
82
|
}
|
|
81
|
-
]),
|
|
83
|
+
]), l = a.theme({
|
|
82
84
|
"&": {
|
|
83
85
|
height: "100%",
|
|
84
86
|
fontFamily: "'Fira Code', 'JetBrains Mono', 'Consolas', monospace",
|
|
@@ -139,11 +141,11 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
139
141
|
".cm-diagnostic-error": { borderLeft: `3px solid ${Z.palette.error.main}` },
|
|
140
142
|
".cm-diagnostic-warning": { borderLeft: `3px solid ${Z.palette.warning.main}` },
|
|
141
143
|
".cm-diagnostic-info": { borderLeft: `3px solid ${Z.palette.info.main}` }
|
|
142
|
-
}, { dark: Q }), y =
|
|
144
|
+
}, { dark: Q }), y = k ? Object.fromEntries(k.tables.map((e) => [e.name, (e.columns ?? []).map((e) => ({
|
|
143
145
|
label: e.name,
|
|
144
146
|
detail: e.type,
|
|
145
147
|
type: "property"
|
|
146
|
-
}))])) : void 0,
|
|
148
|
+
}))])) : void 0, A = async (e) => {
|
|
147
149
|
let t = q.current;
|
|
148
150
|
if (!t) return [];
|
|
149
151
|
let n = e.state.doc.toString();
|
|
@@ -161,63 +163,67 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
161
163
|
} catch {
|
|
162
164
|
return [];
|
|
163
165
|
}
|
|
164
|
-
},
|
|
166
|
+
}, j = o.of([{
|
|
165
167
|
key: "Mod-Enter",
|
|
166
|
-
run: (e) => (
|
|
167
|
-
}]),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
run: (e) => (G.current?.(e.state.doc.toString()), !0)
|
|
169
|
+
}]), M = o.of([{
|
|
170
|
+
key: "Shift-Alt-f",
|
|
171
|
+
run: () => (K.current?.(), !0)
|
|
172
|
+
}]), N = [
|
|
173
|
+
l,
|
|
174
|
+
m(i),
|
|
175
|
+
re({
|
|
176
|
+
dialect: C[T],
|
|
172
177
|
schema: y
|
|
173
178
|
}),
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
...
|
|
180
|
-
...
|
|
179
|
+
d(),
|
|
180
|
+
ie(),
|
|
181
|
+
j,
|
|
182
|
+
M,
|
|
183
|
+
o.of([
|
|
184
|
+
...ne,
|
|
185
|
+
...f,
|
|
186
|
+
...ae
|
|
181
187
|
]),
|
|
182
188
|
Y.current.of(a.editable.of(!x && !S)),
|
|
183
|
-
X.current.of(
|
|
184
|
-
|
|
185
|
-
...
|
|
186
|
-
...b ? [
|
|
187
|
-
...$ ? [h(), g(
|
|
189
|
+
X.current.of(u.readOnly.of(S)),
|
|
190
|
+
ee(),
|
|
191
|
+
...w ? [s(), te()] : [],
|
|
192
|
+
...b ? [c(b)] : [],
|
|
193
|
+
...$ ? [h(), g(A, { delay: 600 })] : [],
|
|
188
194
|
a.updateListener.of((e) => {
|
|
189
|
-
e.docChanged &&
|
|
195
|
+
e.docChanged && B.current?.(e.state.doc.toString());
|
|
190
196
|
let t = e.state.selection.main.head, n = e.state.doc.lineAt(t);
|
|
191
|
-
|
|
197
|
+
V.current(n.number, t - n.from + 1);
|
|
192
198
|
}),
|
|
193
199
|
a.domEventHandlers({
|
|
194
200
|
blur: () => {
|
|
195
|
-
|
|
201
|
+
H.current?.();
|
|
196
202
|
},
|
|
197
203
|
focus: () => {
|
|
198
|
-
|
|
204
|
+
U.current?.();
|
|
199
205
|
}
|
|
200
206
|
})
|
|
201
|
-
],
|
|
202
|
-
state:
|
|
207
|
+
], P = new a({
|
|
208
|
+
state: u.create({
|
|
203
209
|
doc: e,
|
|
204
|
-
extensions:
|
|
210
|
+
extensions: N
|
|
205
211
|
}),
|
|
206
|
-
parent:
|
|
212
|
+
parent: R.current
|
|
207
213
|
});
|
|
208
|
-
return
|
|
209
|
-
|
|
214
|
+
return z.current = P, W.current(P), () => {
|
|
215
|
+
W.current(null), P.destroy(), z.current = null;
|
|
210
216
|
};
|
|
211
217
|
}, [
|
|
212
218
|
Q,
|
|
213
|
-
|
|
219
|
+
T,
|
|
214
220
|
$,
|
|
221
|
+
E,
|
|
222
|
+
D,
|
|
215
223
|
O,
|
|
216
|
-
|
|
217
|
-
A,
|
|
218
|
-
ie
|
|
224
|
+
oe
|
|
219
225
|
]), e(() => {
|
|
220
|
-
let e =
|
|
226
|
+
let e = z.current;
|
|
221
227
|
if (!e) return;
|
|
222
228
|
let t = e.state.doc.toString();
|
|
223
229
|
t !== (v ?? "") && e.dispatch({ changes: {
|
|
@@ -226,9 +232,9 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
226
232
|
insert: v ?? ""
|
|
227
233
|
} });
|
|
228
234
|
}, [v]), e(() => {
|
|
229
|
-
|
|
235
|
+
z.current?.dispatch({ effects: [Y.current.reconfigure(a.editable.of(!x && !S)), X.current.reconfigure(u.readOnly.of(S))] });
|
|
230
236
|
}, [x, S]), /* @__PURE__ */ i(n, {
|
|
231
|
-
ref:
|
|
237
|
+
ref: R,
|
|
232
238
|
sx: {
|
|
233
239
|
flex: 1,
|
|
234
240
|
overflow: "hidden",
|
|
@@ -245,4 +251,4 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
245
251
|
});
|
|
246
252
|
}
|
|
247
253
|
//#endregion
|
|
248
|
-
export {
|
|
254
|
+
export { w as SqlEditorContent };
|
|
@@ -10,8 +10,8 @@ import f from "@mui/icons-material/Delete";
|
|
|
10
10
|
import p from "@mui/icons-material/Undo";
|
|
11
11
|
import m from "@mui/icons-material/Redo";
|
|
12
12
|
import h from "@mui/icons-material/AutoFixHigh";
|
|
13
|
-
import g from "
|
|
14
|
-
import
|
|
13
|
+
import { format as g } from "sql-formatter";
|
|
14
|
+
import _ from "@mui/icons-material/PlayArrow";
|
|
15
15
|
//#region src/components/sql-editor/SqlEditorToolbar.tsx
|
|
16
16
|
var v = {
|
|
17
17
|
standard: "sql",
|
|
@@ -49,7 +49,7 @@ function y({ editorView: y, toolbarConfig: b, translation: x, dialect: S, disabl
|
|
|
49
49
|
if (!e) return;
|
|
50
50
|
let t = e.state.doc.toString();
|
|
51
51
|
try {
|
|
52
|
-
let n =
|
|
52
|
+
let n = g(t, { language: v[S] });
|
|
53
53
|
e.dispatch({ changes: {
|
|
54
54
|
from: 0,
|
|
55
55
|
to: e.state.doc.length,
|
|
@@ -151,7 +151,7 @@ function y({ editorView: y, toolbarConfig: b, translation: x, dialect: S, disabl
|
|
|
151
151
|
sx: { mx: .5 }
|
|
152
152
|
}), /* @__PURE__ */ o(e, {
|
|
153
153
|
label: x.execute,
|
|
154
|
-
icon: /* @__PURE__ */ o(
|
|
154
|
+
icon: /* @__PURE__ */ o(_, { fontSize: "small" }),
|
|
155
155
|
onClick: I,
|
|
156
156
|
disabled: A
|
|
157
157
|
})] }),
|