@thebuoyant-tsdev/mui-ts-library 3.28.1 → 4.0.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 +1 -19
- package/README.md +1 -19
- package/dist/components/sql-editor/SqlEditor.js +37 -65
- package/dist/components/sql-editor/SqlEditorContent.d.ts +1 -2
- package/dist/components/sql-editor/SqlEditorContent.js +60 -66
- package/dist/components/sql-editor/SqlEditorToolbar.js +4 -4
- package/dist/index.cjs +2 -2
- package/package.json +1 -1
package/README.de.md
CHANGED
|
@@ -191,7 +191,7 @@ import { RichTextEditor } from '@thebuoyant-tsdev/mui-ts-library';
|
|
|
191
191
|
|
|
192
192
|
### SqlEditor
|
|
193
193
|
|
|
194
|
-
SQL-Code-Editor mit Syntax-Highlighting, dialektbewusstem Autocomplete und Inline-Linting. Konzipiert für Developer-Tools, Datenbank-Clients und Admin-Panels — mit `Cmd+Enter
|
|
194
|
+
SQL-Code-Editor mit Syntax-Highlighting, dialektbewusstem Autocomplete und Inline-Linting. Konzipiert für Developer-Tools, Datenbank-Clients und Admin-Panels — mit `Cmd+Enter`-Shortcut, Multi-Dialekt-Support (MySQL, PostgreSQL, SQLite, MSSQL) und Schema-basiertem Autocomplete.
|
|
195
195
|
|
|
196
196
|
```tsx
|
|
197
197
|
import { SqlEditor } from '@thebuoyant-tsdev/mui-ts-library';
|
|
@@ -483,24 +483,6 @@ Dieses Projekt folgt [Semantic Versioning](https://semver.org/):
|
|
|
483
483
|
|
|
484
484
|
## Changelog
|
|
485
485
|
|
|
486
|
-
### [Unveröffentlicht]
|
|
487
|
-
|
|
488
|
-
---
|
|
489
|
-
|
|
490
|
-
### [3.28.1] — 2026-07-15
|
|
491
|
-
|
|
492
|
-
**Behoben**
|
|
493
|
-
- Release-Script: `[Unveröffentlicht]`-Überschriften werden jetzt vor dem Publish automatisch auf die Versionsnummer umbenannt — damit npm immer den korrekten Changelog-Eintrag anzeigt.
|
|
494
|
-
|
|
495
|
-
---
|
|
496
|
-
|
|
497
|
-
### [3.28.0] — 2026-07-15
|
|
498
|
-
|
|
499
|
-
**Hinzugefügt**
|
|
500
|
-
- `SqlEditor`: `Shift+Alt+F` Tastenkürzel — löst den vorhandenen SQL-Format-Button direkt aus dem Editor heraus aus (respektiert `readonly` und `toolbarConfig.showFormat`). Keine API-Änderung.
|
|
501
|
-
|
|
502
|
-
---
|
|
503
|
-
|
|
504
486
|
### [3.27.1] — 2026-07-14
|
|
505
487
|
|
|
506
488
|
**Behoben**
|
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ import { RichTextEditor } from '@thebuoyant-tsdev/mui-ts-library';
|
|
|
191
191
|
|
|
192
192
|
### SqlEditor
|
|
193
193
|
|
|
194
|
-
SQL code editor with syntax highlighting, dialect-aware autocomplete, and inline linting. Designed for developer tools, database clients, and admin panels where users write and execute SQL queries — with `Cmd+Enter`
|
|
194
|
+
SQL code editor with syntax highlighting, dialect-aware autocomplete, and inline linting. Designed for developer tools, database clients, and admin panels where users write and execute SQL queries — with `Cmd+Enter` shortcut, multi-dialect support (MySQL, PostgreSQL, SQLite, MSSQL), and schema-based autocomplete.
|
|
195
195
|
|
|
196
196
|
```tsx
|
|
197
197
|
import { SqlEditor } from '@thebuoyant-tsdev/mui-ts-library';
|
|
@@ -483,24 +483,6 @@ This project follows [Semantic Versioning](https://semver.org/):
|
|
|
483
483
|
|
|
484
484
|
## Changelog
|
|
485
485
|
|
|
486
|
-
### [Unreleased]
|
|
487
|
-
|
|
488
|
-
---
|
|
489
|
-
|
|
490
|
-
### [3.28.1] — 2026-07-15
|
|
491
|
-
|
|
492
|
-
**Fixed**
|
|
493
|
-
- Release script: `[Unreleased]` headings are now automatically renamed to the version number before publishing — so npm always shows the correct changelog entry.
|
|
494
|
-
|
|
495
|
-
---
|
|
496
|
-
|
|
497
|
-
### [3.28.0] — 2026-07-15
|
|
498
|
-
|
|
499
|
-
**Added**
|
|
500
|
-
- `SqlEditor`: `Shift+Alt+F` keyboard shortcut — triggers the existing SQL Format button directly from the editor (respects `readonly` and `toolbarConfig.showFormat`). No API change.
|
|
501
|
-
|
|
502
|
-
---
|
|
503
|
-
|
|
504
486
|
### [3.27.1] — 2026-07-14
|
|
505
487
|
|
|
506
488
|
**Fixed**
|
|
@@ -2,105 +2,78 @@ import { normalizeSize as e } from "../shared/normalizeSize.js";
|
|
|
2
2
|
import { DEFAULT_SQL_EDITOR_TOOLBAR_CONFIG as t, DEFAULT_SQL_EDITOR_TRANSLATION as n } from "./SqlEditor.types.js";
|
|
3
3
|
import { SqlEditorContent as r } from "./SqlEditorContent.js";
|
|
4
4
|
import { SqlEditorToolbar as i } from "./SqlEditorToolbar.js";
|
|
5
|
-
import { SqlEditorFooter as
|
|
6
|
-
import { useSqlQueryHistory as
|
|
7
|
-
import { useCallback as
|
|
8
|
-
import { Box as u, Divider as d, Paper as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { format as h } from "sql-formatter";
|
|
5
|
+
import { SqlEditorFooter as a } from "./SqlEditorFooter.js";
|
|
6
|
+
import { useSqlQueryHistory as o } from "./useSqlQueryHistory.js";
|
|
7
|
+
import { useCallback as s, useRef as c, useState as l } from "react";
|
|
8
|
+
import { Box as u, Divider as d, Paper as f } from "@mui/material";
|
|
9
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
10
|
//#region src/components/sql-editor/SqlEditor.tsx
|
|
12
|
-
|
|
13
|
-
standard: "sql",
|
|
14
|
-
mysql: "mysql",
|
|
15
|
-
postgresql: "postgresql",
|
|
16
|
-
sqlite: "sqlite",
|
|
17
|
-
mssql: "tsql"
|
|
18
|
-
};
|
|
19
|
-
function g({ value: g, onChange: _, placeholder: re, height: v, width: y, disabled: b = !1, readonly: x = !1, error: S = !1, helperText: C, name: w, dialect: T = "standard", showLineNumbers: E = !0, showLineColumn: D = !0, showErrorCount: O = !1, toolbarConfig: k, translation: A, highlightColors: j, schema: M, queryHistoryKey: N = "sql-editor-query-history", queryHistoryMaxEntries: P = 20, onExecute: F, onLint: I, onBlur: L, onFocus: R }) {
|
|
11
|
+
function g({ value: g, onChange: _, placeholder: ee, height: v, width: y, disabled: b = !1, readonly: x = !1, error: S = !1, helperText: C, name: w, dialect: T = "standard", showLineNumbers: E = !0, showLineColumn: D = !0, showErrorCount: O = !1, toolbarConfig: k, translation: A, highlightColors: j, schema: M, queryHistoryKey: N = "sql-editor-query-history", queryHistoryMaxEntries: P = 20, onExecute: F, onLint: I, onBlur: L, onFocus: R }) {
|
|
20
12
|
let z = {
|
|
21
13
|
...n,
|
|
22
14
|
...A
|
|
23
15
|
}, B = {
|
|
24
16
|
...t,
|
|
25
17
|
...k
|
|
26
|
-
}, { history:
|
|
18
|
+
}, { history: te, addEntry: V, clearHistory: H } = o(N, P), U = e(v), W = e(y), G = U === "auto", K = G ? void 0 : U ?? 300, q = c(null), [J, Y] = l(null), [X, Z] = l({
|
|
27
19
|
line: 1,
|
|
28
20
|
col: 1
|
|
29
|
-
}), [
|
|
30
|
-
|
|
31
|
-
}, []),
|
|
32
|
-
|
|
21
|
+
}), [Q, ne] = l(0), re = s((e) => {
|
|
22
|
+
q.current = e, Y(e);
|
|
23
|
+
}, []), ie = s((e, t) => {
|
|
24
|
+
Z({
|
|
33
25
|
line: e,
|
|
34
26
|
col: t
|
|
35
27
|
});
|
|
36
|
-
}, []),
|
|
37
|
-
|
|
28
|
+
}, []), ae = s((e) => {
|
|
29
|
+
ne(e);
|
|
38
30
|
}, []), $ = F ? (e) => {
|
|
39
|
-
|
|
40
|
-
} : void 0,
|
|
41
|
-
|
|
42
|
-
let e = J.current;
|
|
43
|
-
if (!e) return;
|
|
44
|
-
let t = e.state.doc.toString();
|
|
45
|
-
try {
|
|
46
|
-
let n = h(t, { language: ne[T] });
|
|
47
|
-
e.dispatch({ changes: {
|
|
48
|
-
from: 0,
|
|
49
|
-
to: e.state.doc.length,
|
|
50
|
-
insert: n
|
|
51
|
-
} });
|
|
52
|
-
} catch {}
|
|
53
|
-
e.focus();
|
|
54
|
-
};
|
|
55
|
-
}, [
|
|
56
|
-
T,
|
|
57
|
-
x,
|
|
58
|
-
B.showFormat
|
|
59
|
-
]), ue = o((e) => {
|
|
60
|
-
let t = J.current;
|
|
31
|
+
V(e), F(e);
|
|
32
|
+
} : void 0, oe = s((e) => {
|
|
33
|
+
let t = q.current;
|
|
61
34
|
t && (t.dispatch({ changes: {
|
|
62
35
|
from: 0,
|
|
63
36
|
to: t.state.doc.length,
|
|
64
37
|
insert: e
|
|
65
38
|
} }), t.focus()), _?.(e);
|
|
66
|
-
}, [_]),
|
|
67
|
-
return /* @__PURE__ */
|
|
39
|
+
}, [_]), se = D || O || !!C;
|
|
40
|
+
return /* @__PURE__ */ h(u, {
|
|
68
41
|
sx: {
|
|
69
|
-
width:
|
|
70
|
-
...
|
|
42
|
+
width: W ?? "100%",
|
|
43
|
+
...G ? {
|
|
71
44
|
display: "flex",
|
|
72
45
|
flexDirection: "column",
|
|
73
46
|
flex: 1
|
|
74
47
|
} : {}
|
|
75
48
|
},
|
|
76
49
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ h(f, {
|
|
78
51
|
variant: "outlined",
|
|
79
52
|
sx: {
|
|
80
53
|
display: "flex",
|
|
81
54
|
flexDirection: "column",
|
|
82
55
|
overflow: "hidden",
|
|
83
|
-
...
|
|
56
|
+
...G ? { flex: 1 } : { height: K },
|
|
84
57
|
borderColor: S ? "error.main" : void 0,
|
|
85
58
|
"&:focus-within": {
|
|
86
59
|
borderColor: S ? "error.main" : "primary.main",
|
|
87
60
|
borderWidth: 2
|
|
88
61
|
}
|
|
89
62
|
},
|
|
90
|
-
children: [!x && /* @__PURE__ */
|
|
91
|
-
editorView:
|
|
63
|
+
children: [!x && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(i, {
|
|
64
|
+
editorView: J,
|
|
92
65
|
toolbarConfig: B,
|
|
93
66
|
translation: z,
|
|
94
67
|
dialect: T,
|
|
95
68
|
disabled: b,
|
|
96
69
|
onExecute: $,
|
|
97
|
-
queryHistory:
|
|
98
|
-
onSelectHistoryEntry:
|
|
99
|
-
onClearHistory:
|
|
100
|
-
}), /* @__PURE__ */
|
|
70
|
+
queryHistory: te,
|
|
71
|
+
onSelectHistoryEntry: oe,
|
|
72
|
+
onClearHistory: H
|
|
73
|
+
}), /* @__PURE__ */ m(d, {})] }), /* @__PURE__ */ m(r, {
|
|
101
74
|
value: g,
|
|
102
75
|
onChange: _,
|
|
103
|
-
placeholder:
|
|
76
|
+
placeholder: ee,
|
|
104
77
|
disabled: b,
|
|
105
78
|
readonly: x,
|
|
106
79
|
showLineNumbers: E,
|
|
@@ -110,26 +83,25 @@ function g({ value: g, onChange: _, placeholder: re, height: v, width: y, disabl
|
|
|
110
83
|
identifierColor: j?.identifier,
|
|
111
84
|
schema: M,
|
|
112
85
|
onExecute: $,
|
|
113
|
-
onFormat: le,
|
|
114
86
|
onLint: I,
|
|
115
|
-
onDiagnosticsChange: I ?
|
|
116
|
-
onViewReady:
|
|
117
|
-
onCursorChange:
|
|
87
|
+
onDiagnosticsChange: I ? ae : void 0,
|
|
88
|
+
onViewReady: re,
|
|
89
|
+
onCursorChange: ie,
|
|
118
90
|
onBlur: L,
|
|
119
91
|
onFocus: R
|
|
120
92
|
})]
|
|
121
93
|
}),
|
|
122
|
-
|
|
94
|
+
se && /* @__PURE__ */ m(a, {
|
|
123
95
|
helperText: C,
|
|
124
96
|
error: S,
|
|
125
97
|
showLineColumn: D,
|
|
126
98
|
showErrorCount: O,
|
|
127
|
-
diagnosticsCount:
|
|
128
|
-
cursorLine:
|
|
129
|
-
cursorCol:
|
|
99
|
+
diagnosticsCount: Q,
|
|
100
|
+
cursorLine: X.line,
|
|
101
|
+
cursorCol: X.col,
|
|
130
102
|
translation: z
|
|
131
103
|
}),
|
|
132
|
-
w && /* @__PURE__ */
|
|
104
|
+
w && /* @__PURE__ */ m("input", {
|
|
133
105
|
type: "hidden",
|
|
134
106
|
name: w,
|
|
135
107
|
value: g ?? ""
|
|
@@ -13,7 +13,6 @@ type SqlEditorContentProps = {
|
|
|
13
13
|
identifierColor?: string;
|
|
14
14
|
schema?: SqlSchema;
|
|
15
15
|
onExecute?: (sql: string) => void;
|
|
16
|
-
onFormat?: () => void;
|
|
17
16
|
onLint?: (sql: string) => Promise<SqlLintError[]> | SqlLintError[];
|
|
18
17
|
onDiagnosticsChange?: (count: number) => void;
|
|
19
18
|
onViewReady: (view: EditorView | null) => void;
|
|
@@ -21,5 +20,5 @@ type SqlEditorContentProps = {
|
|
|
21
20
|
onBlur?: () => void;
|
|
22
21
|
onFocus?: () => void;
|
|
23
22
|
};
|
|
24
|
-
export declare function SqlEditorContent({ value, onChange, placeholder, disabled, readonly, showLineNumbers, dialect, keywordColor, stringColor, identifierColor, schema, onExecute,
|
|
23
|
+
export declare function SqlEditorContent({ value, onChange, placeholder, disabled, readonly, showLineNumbers, dialect, keywordColor, stringColor, identifierColor, schema, onExecute, onLint, onDiagnosticsChange, onViewReady, onCursorChange, onBlur, onFocus, }: SqlEditorContentProps): import("react/jsx-runtime").JSX.Element;
|
|
25
24
|
export {};
|
|
@@ -1,45 +1,43 @@
|
|
|
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 o, highlightActiveLineGutter as s, keymap as c, lineNumbers as l, placeholder as u } from "@codemirror/view";
|
|
5
|
+
import { Compartment as d, EditorState as f } from "@codemirror/state";
|
|
6
|
+
import { defaultKeymap as p, history as m, historyKeymap as ee } from "@codemirror/commands";
|
|
7
|
+
import { HighlightStyle as te, syntaxHighlighting as ne } 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 C } from "@codemirror/lang-sql";
|
|
11
|
+
import { autocompletion as re, completionKeymap as w } from "@codemirror/autocomplete";
|
|
12
12
|
//#region src/components/sql-editor/SqlEditorContent.tsx
|
|
13
|
-
var
|
|
13
|
+
var T = {
|
|
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
|
|
20
|
+
function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly: S = !1, showLineNumbers: E = !0, dialect: D = "standard", keywordColor: O, stringColor: k, identifierColor: A, schema: j, onExecute: M, onLint: N, onDiagnosticsChange: P, onViewReady: F, onCursorChange: I, onBlur: L, onFocus: R }) {
|
|
21
|
+
let z = t(null), B = t(null), V = t(y), H = t(I), U = t(L), W = t(R), G = t(F), K = t(M), q = t(N), J = t(P), Y = t(new d()), X = t(new d()), Z = r(), Q = Z.palette.mode === "dark", $ = !!N, ie = JSON.stringify(j);
|
|
22
22
|
return e(() => {
|
|
23
|
-
|
|
23
|
+
V.current = y;
|
|
24
24
|
}, [y]), e(() => {
|
|
25
|
-
V.current = F;
|
|
26
|
-
}, [F]), e(() => {
|
|
27
25
|
H.current = I;
|
|
28
26
|
}, [I]), e(() => {
|
|
29
27
|
U.current = L;
|
|
30
28
|
}, [L]), e(() => {
|
|
31
|
-
W.current =
|
|
32
|
-
}, [
|
|
33
|
-
G.current =
|
|
34
|
-
}, [
|
|
35
|
-
K.current =
|
|
36
|
-
}, [j]), e(() => {
|
|
37
|
-
q.current = M;
|
|
29
|
+
W.current = R;
|
|
30
|
+
}, [R]), e(() => {
|
|
31
|
+
G.current = F;
|
|
32
|
+
}, [F]), e(() => {
|
|
33
|
+
K.current = M;
|
|
38
34
|
}, [M]), e(() => {
|
|
39
|
-
|
|
35
|
+
q.current = N;
|
|
40
36
|
}, [N]), e(() => {
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
J.current = P;
|
|
38
|
+
}, [P]), e(() => {
|
|
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([
|
|
43
41
|
{
|
|
44
42
|
tag: _.keyword,
|
|
45
43
|
color: t,
|
|
@@ -80,7 +78,7 @@ function w({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
80
78
|
color: Z.palette.error.main,
|
|
81
79
|
textDecoration: "underline wavy"
|
|
82
80
|
}
|
|
83
|
-
]),
|
|
81
|
+
]), d = a.theme({
|
|
84
82
|
"&": {
|
|
85
83
|
height: "100%",
|
|
86
84
|
fontFamily: "'Fira Code', 'JetBrains Mono', 'Consolas', monospace",
|
|
@@ -141,11 +139,11 @@ function w({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
141
139
|
".cm-diagnostic-error": { borderLeft: `3px solid ${Z.palette.error.main}` },
|
|
142
140
|
".cm-diagnostic-warning": { borderLeft: `3px solid ${Z.palette.warning.main}` },
|
|
143
141
|
".cm-diagnostic-info": { borderLeft: `3px solid ${Z.palette.info.main}` }
|
|
144
|
-
}, { dark: Q }), y =
|
|
142
|
+
}, { dark: Q }), y = j ? Object.fromEntries(j.tables.map((e) => [e.name, (e.columns ?? []).map((e) => ({
|
|
145
143
|
label: e.name,
|
|
146
144
|
detail: e.type,
|
|
147
145
|
type: "property"
|
|
148
|
-
}))])) : void 0,
|
|
146
|
+
}))])) : void 0, M = async (e) => {
|
|
149
147
|
let t = q.current;
|
|
150
148
|
if (!t) return [];
|
|
151
149
|
let n = e.state.doc.toString();
|
|
@@ -163,67 +161,63 @@ function w({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
163
161
|
} catch {
|
|
164
162
|
return [];
|
|
165
163
|
}
|
|
166
|
-
},
|
|
164
|
+
}, N = c.of([{
|
|
167
165
|
key: "Mod-Enter",
|
|
168
|
-
run: (e) => (
|
|
169
|
-
}]),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
m(i),
|
|
175
|
-
re({
|
|
176
|
-
dialect: C[T],
|
|
166
|
+
run: (e) => (K.current?.(e.state.doc.toString()), !0)
|
|
167
|
+
}]), P = [
|
|
168
|
+
d,
|
|
169
|
+
ne(i),
|
|
170
|
+
C({
|
|
171
|
+
dialect: T[D],
|
|
177
172
|
schema: y
|
|
178
173
|
}),
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
...
|
|
185
|
-
...
|
|
186
|
-
...ae
|
|
174
|
+
m(),
|
|
175
|
+
re(),
|
|
176
|
+
N,
|
|
177
|
+
c.of([
|
|
178
|
+
...p,
|
|
179
|
+
...ee,
|
|
180
|
+
...w
|
|
187
181
|
]),
|
|
188
182
|
Y.current.of(a.editable.of(!x && !S)),
|
|
189
|
-
X.current.of(
|
|
190
|
-
|
|
191
|
-
...
|
|
192
|
-
...b ? [
|
|
193
|
-
...$ ? [h(), g(
|
|
183
|
+
X.current.of(f.readOnly.of(S)),
|
|
184
|
+
o(),
|
|
185
|
+
...E ? [l(), s()] : [],
|
|
186
|
+
...b ? [u(b)] : [],
|
|
187
|
+
...$ ? [h(), g(M, { delay: 600 })] : [],
|
|
194
188
|
a.updateListener.of((e) => {
|
|
195
|
-
e.docChanged &&
|
|
189
|
+
e.docChanged && V.current?.(e.state.doc.toString());
|
|
196
190
|
let t = e.state.selection.main.head, n = e.state.doc.lineAt(t);
|
|
197
|
-
|
|
191
|
+
H.current(n.number, t - n.from + 1);
|
|
198
192
|
}),
|
|
199
193
|
a.domEventHandlers({
|
|
200
194
|
blur: () => {
|
|
201
|
-
|
|
195
|
+
U.current?.();
|
|
202
196
|
},
|
|
203
197
|
focus: () => {
|
|
204
|
-
|
|
198
|
+
W.current?.();
|
|
205
199
|
}
|
|
206
200
|
})
|
|
207
|
-
],
|
|
208
|
-
state:
|
|
201
|
+
], F = new a({
|
|
202
|
+
state: f.create({
|
|
209
203
|
doc: e,
|
|
210
|
-
extensions:
|
|
204
|
+
extensions: P
|
|
211
205
|
}),
|
|
212
|
-
parent:
|
|
206
|
+
parent: z.current
|
|
213
207
|
});
|
|
214
|
-
return
|
|
215
|
-
|
|
208
|
+
return B.current = F, G.current(F), () => {
|
|
209
|
+
G.current(null), F.destroy(), B.current = null;
|
|
216
210
|
};
|
|
217
211
|
}, [
|
|
218
212
|
Q,
|
|
219
|
-
T,
|
|
220
|
-
$,
|
|
221
|
-
E,
|
|
222
213
|
D,
|
|
214
|
+
$,
|
|
223
215
|
O,
|
|
224
|
-
|
|
216
|
+
k,
|
|
217
|
+
A,
|
|
218
|
+
ie
|
|
225
219
|
]), e(() => {
|
|
226
|
-
let e =
|
|
220
|
+
let e = B.current;
|
|
227
221
|
if (!e) return;
|
|
228
222
|
let t = e.state.doc.toString();
|
|
229
223
|
t !== (v ?? "") && e.dispatch({ changes: {
|
|
@@ -232,9 +226,9 @@ function w({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
232
226
|
insert: v ?? ""
|
|
233
227
|
} });
|
|
234
228
|
}, [v]), e(() => {
|
|
235
|
-
|
|
229
|
+
B.current?.dispatch({ effects: [Y.current.reconfigure(a.editable.of(!x && !S)), X.current.reconfigure(f.readOnly.of(S))] });
|
|
236
230
|
}, [x, S]), /* @__PURE__ */ i(n, {
|
|
237
|
-
ref:
|
|
231
|
+
ref: z,
|
|
238
232
|
sx: {
|
|
239
233
|
flex: 1,
|
|
240
234
|
overflow: "hidden",
|
|
@@ -251,4 +245,4 @@ function w({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
|
|
|
251
245
|
});
|
|
252
246
|
}
|
|
253
247
|
//#endregion
|
|
254
|
-
export {
|
|
248
|
+
export { E 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
|
|
14
|
-
import _ from "
|
|
13
|
+
import g from "@mui/icons-material/PlayArrow";
|
|
14
|
+
import { format as _ } from "sql-formatter";
|
|
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 = _(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(g, { fontSize: "small" }),
|
|
155
155
|
onClick: I,
|
|
156
156
|
disabled: A
|
|
157
157
|
})] }),
|