princess-python-editor 0.1.3 → 0.2.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/dist/index.cjs.js +4 -4
- package/dist/index.es.js +502 -495
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var Ps = Object.defineProperty;
|
|
2
2
|
var Os = (a, n, s) => n in a ? Ps(a, n, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[n] = s;
|
|
3
3
|
var ae = (a, n, s) => Os(a, typeof n != "symbol" ? n + "" : n, s);
|
|
4
|
-
import { h as
|
|
4
|
+
import { h as Dn, defineComponent as Ms, ref as C, reactive as zn, computed as U, onMounted as Ns, onBeforeUnmount as Ts, watch as oe, nextTick as jn, openBlock as m, createElementBlock as g, normalizeStyle as Vn, normalizeClass as ie, createElementVNode as l, createVNode as j, unref as B, createCommentVNode as N, createBlock as Qn, withDirectives as J, vModelText as he, Fragment as A, toDisplayString as _, renderList as le, vModelSelect as St, withModifiers as Kn, withKeys as Ls, createTextVNode as Qt, onScopeDispose as $s } from "vue";
|
|
5
5
|
import { EditorState as Yt, StateEffect as Fs, StateField as Rs, Compartment as Kt } from "@codemirror/state";
|
|
6
|
-
import { EditorView as $e, keymap as
|
|
6
|
+
import { EditorView as $e, keymap as Jn, lineNumbers as _s, highlightActiveLineGutter as Is, highlightActiveLine as Hs, drawSelection as Bs, placeholder as Us, Decoration as Xt } from "@codemirror/view";
|
|
7
7
|
import { linter as As, forceLinting as Ds } from "@codemirror/lint";
|
|
8
8
|
import { autocompletion as zs, closeBrackets as js, closeBracketsKeymap as Vs } from "@codemirror/autocomplete";
|
|
9
9
|
import { history as Qs, defaultKeymap as Ks, historyKeymap as Js, indentWithTab as Zs } from "@codemirror/commands";
|
|
10
10
|
import { syntaxHighlighting as Gs, HighlightStyle as Ws, indentUnit as Ys, bracketMatching as Xs } from "@codemirror/language";
|
|
11
|
-
import { python as
|
|
11
|
+
import { python as pr } from "@codemirror/lang-python";
|
|
12
12
|
import { javascript as ea } from "@codemirror/lang-javascript";
|
|
13
13
|
import { json as ta } from "@codemirror/lang-json";
|
|
14
14
|
import { sql as na } from "@codemirror/lang-sql";
|
|
@@ -148,10 +148,10 @@ ct.none = new ct(
|
|
|
148
148
|
8
|
|
149
149
|
/* NodeFlag.Anonymous */
|
|
150
150
|
);
|
|
151
|
-
var
|
|
151
|
+
var Zn;
|
|
152
152
|
(function(a) {
|
|
153
153
|
a[a.ExcludeBuffers = 1] = "ExcludeBuffers", a[a.IncludeAnonymous = 2] = "IncludeAnonymous", a[a.IgnoreMounts = 4] = "IgnoreMounts", a[a.IgnoreOverlays = 8] = "IgnoreOverlays", a[a.EnterBracketed = 16] = "EnterBracketed";
|
|
154
|
-
})(
|
|
154
|
+
})(Zn || (Zn = {}));
|
|
155
155
|
new K({ perNode: !0 });
|
|
156
156
|
let aa = 0;
|
|
157
157
|
class ue {
|
|
@@ -281,7 +281,7 @@ function ua(a, n) {
|
|
|
281
281
|
scope: o
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
|
-
const v = ue.define, xt = v(), Te = v(),
|
|
284
|
+
const v = ue.define, xt = v(), Te = v(), Gn = v(Te), Wn = v(Te), Le = v(), Et = v(Le), Jt = v(Le), we = v(), Be = v(we), be = v(), ke = v(), tn = v(), it = v(tn), qt = v(), d = {
|
|
285
285
|
/**
|
|
286
286
|
A comment.
|
|
287
287
|
*/
|
|
@@ -309,19 +309,19 @@ const v = ue.define, xt = v(), Te = v(), Zn = v(Te), Gn = v(Te), Le = v(), Et =
|
|
|
309
309
|
/**
|
|
310
310
|
A type [name](#highlight.tags.name).
|
|
311
311
|
*/
|
|
312
|
-
typeName:
|
|
312
|
+
typeName: Gn,
|
|
313
313
|
/**
|
|
314
314
|
A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
|
|
315
315
|
*/
|
|
316
|
-
tagName: v(
|
|
316
|
+
tagName: v(Gn),
|
|
317
317
|
/**
|
|
318
318
|
A property or field [name](#highlight.tags.name).
|
|
319
319
|
*/
|
|
320
|
-
propertyName:
|
|
320
|
+
propertyName: Wn,
|
|
321
321
|
/**
|
|
322
322
|
An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
|
|
323
323
|
*/
|
|
324
|
-
attributeName: v(
|
|
324
|
+
attributeName: v(Wn),
|
|
325
325
|
/**
|
|
326
326
|
The [name](#highlight.tags.name) of a class.
|
|
327
327
|
*/
|
|
@@ -786,7 +786,7 @@ const ca = {
|
|
|
786
786
|
function pa(a) {
|
|
787
787
|
return [$e.theme(ca, { dark: a }), Gs(da)];
|
|
788
788
|
}
|
|
789
|
-
const fa = "'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
|
|
789
|
+
const fa = "'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace", fr = Fs.define();
|
|
790
790
|
function va(a, n) {
|
|
791
791
|
const s = a.filter((o) => Number.isFinite(o) && o >= 1 && o <= n.lines).sort((o, i) => o - i);
|
|
792
792
|
return Xt.set(
|
|
@@ -798,7 +798,7 @@ const ma = Rs.define({
|
|
|
798
798
|
update: (a, n) => {
|
|
799
799
|
let s = a;
|
|
800
800
|
for (const o of n.effects)
|
|
801
|
-
o.is(
|
|
801
|
+
o.is(fr) && (s = va(o.value, n.state.doc));
|
|
802
802
|
return n.docChanged && (s = s.map(n.changes)), s;
|
|
803
803
|
},
|
|
804
804
|
provide: (a) => $e.decorations.from(a)
|
|
@@ -817,7 +817,7 @@ const ma = Rs.define({
|
|
|
817
817
|
function ya(a, n) {
|
|
818
818
|
const s = $e.updateListener.of((p) => {
|
|
819
819
|
p.docChanged && n.onDocChange(p.state.doc.toString());
|
|
820
|
-
}), o =
|
|
820
|
+
}), o = Jn.of([
|
|
821
821
|
{
|
|
822
822
|
key: "Mod-Enter",
|
|
823
823
|
preventDefault: !0,
|
|
@@ -833,7 +833,7 @@ function ya(a, n) {
|
|
|
833
833
|
Bs(),
|
|
834
834
|
Qs(),
|
|
835
835
|
Ys.of(" "),
|
|
836
|
-
n.language ??
|
|
836
|
+
n.language ?? pr(),
|
|
837
837
|
pa(n.dark),
|
|
838
838
|
zs(),
|
|
839
839
|
js(),
|
|
@@ -842,7 +842,7 @@ function ya(a, n) {
|
|
|
842
842
|
Us(n.placeholderText),
|
|
843
843
|
ma,
|
|
844
844
|
o,
|
|
845
|
-
|
|
845
|
+
Jn.of([...Vs, ...Ks, ...Js, Zs]),
|
|
846
846
|
...n.extensions,
|
|
847
847
|
s
|
|
848
848
|
]
|
|
@@ -1224,7 +1224,7 @@ self.onmessage = async function (ev) {
|
|
|
1224
1224
|
};
|
|
1225
1225
|
`;
|
|
1226
1226
|
}
|
|
1227
|
-
const
|
|
1227
|
+
const vr = "https://cdn.jsdelivr.net/pyodide/v0.27.2/full/";
|
|
1228
1228
|
class Sa {
|
|
1229
1229
|
constructor(n = {}) {
|
|
1230
1230
|
ae(this, "status", "idle");
|
|
@@ -1239,7 +1239,7 @@ class Sa {
|
|
|
1239
1239
|
ae(this, "statusHandlers", /* @__PURE__ */ new Set());
|
|
1240
1240
|
ae(this, "outputHandlers", /* @__PURE__ */ new Set());
|
|
1241
1241
|
ae(this, "initErrorHandlers", /* @__PURE__ */ new Set());
|
|
1242
|
-
this.pyodideUrl = n.pyodideUrl ||
|
|
1242
|
+
this.pyodideUrl = n.pyodideUrl || vr;
|
|
1243
1243
|
}
|
|
1244
1244
|
on(n, s) {
|
|
1245
1245
|
if (n === "status") {
|
|
@@ -1463,7 +1463,7 @@ class Sa {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
let Zt = null;
|
|
1465
1465
|
function rn(a) {
|
|
1466
|
-
return Zt ? a != null && a.pyodideUrl && a.pyodideUrl !==
|
|
1466
|
+
return Zt ? a != null && a.pyodideUrl && a.pyodideUrl !== vr && console.warn(
|
|
1467
1467
|
"[princess-python-editor] Pyodide 运行器已初始化,后续传入的 pyodideUrl 将被忽略。"
|
|
1468
1468
|
) : Zt = new Sa(a), Zt;
|
|
1469
1469
|
}
|
|
@@ -1531,7 +1531,7 @@ function sn(a) {
|
|
|
1531
1531
|
throw new Error("未配置 Python 服务端点(pythonEndpoint)");
|
|
1532
1532
|
return n;
|
|
1533
1533
|
}
|
|
1534
|
-
function
|
|
1534
|
+
function mr(a, n) {
|
|
1535
1535
|
if (a && typeof a == "object") {
|
|
1536
1536
|
const s = a, o = Number(s.line);
|
|
1537
1537
|
return {
|
|
@@ -1543,7 +1543,7 @@ function vr(a, n) {
|
|
|
1543
1543
|
}
|
|
1544
1544
|
return { type: "PythonError", message: n };
|
|
1545
1545
|
}
|
|
1546
|
-
async function
|
|
1546
|
+
async function Zi(a, n, s = {}) {
|
|
1547
1547
|
var R;
|
|
1548
1548
|
const o = sn(a), i = performance.now(), p = new AbortController(), b = setTimeout(() => p.abort(), s.timeoutMs ?? Ma), E = () => p.abort();
|
|
1549
1549
|
s.signal && (s.signal.aborted ? p.abort() : s.signal.addEventListener("abort", E));
|
|
@@ -1593,7 +1593,7 @@ async function Vi(a, n, s = {}) {
|
|
|
1593
1593
|
stderr: typeof x.stderr == "string" ? x.stderr : "",
|
|
1594
1594
|
exitCode: Number.isFinite(ve) ? Math.trunc(ve) : void 0,
|
|
1595
1595
|
durationMs: Number.isFinite(G) && G >= 0 ? G : F,
|
|
1596
|
-
error: q ? void 0 :
|
|
1596
|
+
error: q ? void 0 : mr(x.error, "服务端 Python 执行失败")
|
|
1597
1597
|
};
|
|
1598
1598
|
} finally {
|
|
1599
1599
|
clearTimeout(b), (R = s.signal) == null || R.removeEventListener("abort", E);
|
|
@@ -1645,7 +1645,7 @@ async function an(a, n, s, o, i) {
|
|
|
1645
1645
|
stderr: typeof q.stderr == "string" ? q.stderr : "",
|
|
1646
1646
|
exitCode: Number.isFinite(ve) ? Math.trunc(ve) : void 0,
|
|
1647
1647
|
durationMs: Number.isFinite(O) ? O : G,
|
|
1648
|
-
error: q.error ?
|
|
1648
|
+
error: q.error ? mr(q.error, "服务端 Python 执行失败") : void 0
|
|
1649
1649
|
};
|
|
1650
1650
|
} finally {
|
|
1651
1651
|
clearTimeout(R), (T = o.signal) == null || T.removeEventListener("abort", P);
|
|
@@ -1685,7 +1685,7 @@ function $a(a, n, s, o = {}) {
|
|
|
1685
1685
|
2e4
|
|
1686
1686
|
);
|
|
1687
1687
|
}
|
|
1688
|
-
async function
|
|
1688
|
+
async function Yn(a, n, s = {}) {
|
|
1689
1689
|
const o = sn(a);
|
|
1690
1690
|
try {
|
|
1691
1691
|
await fetch(`${o}/sessions/${encodeURIComponent(n)}/interrupt`, {
|
|
@@ -1704,16 +1704,16 @@ const ut = [
|
|
|
1704
1704
|
{ value: "oracle", label: "Oracle", defaultPort: 1521 },
|
|
1705
1705
|
{ value: "clickhouse", label: "ClickHouse", defaultPort: 8123 },
|
|
1706
1706
|
{ value: "other", label: "其他" }
|
|
1707
|
-
],
|
|
1707
|
+
], Gi = {
|
|
1708
1708
|
mode: "sqlite",
|
|
1709
1709
|
connection: { dialect: "sqlite", database: ":memory:" },
|
|
1710
1710
|
maxRows: 200,
|
|
1711
1711
|
timeoutMs: 3e4
|
|
1712
|
-
},
|
|
1712
|
+
}, gr = 200, Ot = 3e4;
|
|
1713
1713
|
function Fa(a) {
|
|
1714
1714
|
return ut.some((n) => n.value === a);
|
|
1715
1715
|
}
|
|
1716
|
-
function
|
|
1716
|
+
function Xn(a, n, s, o) {
|
|
1717
1717
|
const i = typeof a == "number" ? a : Number(a);
|
|
1718
1718
|
return Number.isFinite(i) ? Math.min(Math.max(Math.trunc(i), s), o) : n;
|
|
1719
1719
|
}
|
|
@@ -1723,7 +1723,7 @@ function Ra(a) {
|
|
|
1723
1723
|
if (!(!Number.isFinite(n) || n <= 0))
|
|
1724
1724
|
return Math.min(Math.trunc(n), 65535);
|
|
1725
1725
|
}
|
|
1726
|
-
function
|
|
1726
|
+
function D(a = {}) {
|
|
1727
1727
|
var p, b, E, R, P, T, x;
|
|
1728
1728
|
const n = a.mode === "http" ? "http" : "sqlite", s = (p = a.connection) == null ? void 0 : p.dialect, o = Fa(s) ? s : n === "http" ? "mysql" : "sqlite", i = (b = a.connection) == null ? void 0 : b.database;
|
|
1729
1729
|
return {
|
|
@@ -1740,11 +1740,11 @@ function A(a = {}) {
|
|
|
1740
1740
|
},
|
|
1741
1741
|
endpoint: a.endpoint ?? "",
|
|
1742
1742
|
headers: a.headers ? { ...a.headers } : void 0,
|
|
1743
|
-
maxRows:
|
|
1744
|
-
timeoutMs:
|
|
1743
|
+
maxRows: Xn(a.maxRows, gr, 1, 1e5),
|
|
1744
|
+
timeoutMs: Xn(a.timeoutMs, Ot, 1e3, 6e5)
|
|
1745
1745
|
};
|
|
1746
1746
|
}
|
|
1747
|
-
function
|
|
1747
|
+
function er(a) {
|
|
1748
1748
|
if (a == null) return null;
|
|
1749
1749
|
const n = typeof a;
|
|
1750
1750
|
if (n === "string" || n === "number" || n === "boolean")
|
|
@@ -1756,7 +1756,7 @@ function Xn(a) {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
}
|
|
1758
1758
|
function nn(a) {
|
|
1759
|
-
const n = a ?? {}, s = Array.isArray(n.columns) ? n.columns.map((i) => String(i)) : [], o = Array.isArray(n.rows) ? n.rows.map((i) => Array.isArray(i) ? i.map(
|
|
1759
|
+
const n = a ?? {}, s = Array.isArray(n.columns) ? n.columns.map((i) => String(i)) : [], o = Array.isArray(n.rows) ? n.rows.map((i) => Array.isArray(i) ? i.map(er) : [er(i)]) : [];
|
|
1760
1760
|
return {
|
|
1761
1761
|
columns: s,
|
|
1762
1762
|
rows: o,
|
|
@@ -1778,7 +1778,7 @@ function on(a, n) {
|
|
|
1778
1778
|
function _a(a) {
|
|
1779
1779
|
return a instanceof DOMException && a.name === "AbortError" || a instanceof Error && a.name === "AbortError";
|
|
1780
1780
|
}
|
|
1781
|
-
function
|
|
1781
|
+
function tr(a, n) {
|
|
1782
1782
|
if (!a || typeof a != "object")
|
|
1783
1783
|
return {
|
|
1784
1784
|
ok: !1,
|
|
@@ -1847,7 +1847,7 @@ async function Ia(a, n, s, o) {
|
|
|
1847
1847
|
};
|
|
1848
1848
|
}
|
|
1849
1849
|
if (!T.ok) {
|
|
1850
|
-
const q = F ?
|
|
1850
|
+
const q = F ? tr(F, performance.now() - p) : null;
|
|
1851
1851
|
return {
|
|
1852
1852
|
ok: !1,
|
|
1853
1853
|
results: [],
|
|
@@ -1858,7 +1858,7 @@ async function Ia(a, n, s, o) {
|
|
|
1858
1858
|
durationMs: performance.now() - p
|
|
1859
1859
|
};
|
|
1860
1860
|
}
|
|
1861
|
-
return
|
|
1861
|
+
return tr(F, performance.now() - p);
|
|
1862
1862
|
} catch (T) {
|
|
1863
1863
|
if (E)
|
|
1864
1864
|
return {
|
|
@@ -1875,7 +1875,7 @@ async function Ia(a, n, s, o) {
|
|
|
1875
1875
|
clearTimeout(R), o == null || o.removeEventListener("abort", P);
|
|
1876
1876
|
}
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function nr(a, n) {
|
|
1879
1879
|
if (!a || typeof a != "object")
|
|
1880
1880
|
return {
|
|
1881
1881
|
ok: !1,
|
|
@@ -1895,8 +1895,8 @@ function tr(a, n) {
|
|
|
1895
1895
|
durationMs: s
|
|
1896
1896
|
};
|
|
1897
1897
|
}
|
|
1898
|
-
async function
|
|
1899
|
-
const o =
|
|
1898
|
+
async function yr(a, n, s = {}) {
|
|
1899
|
+
const o = D(a), i = o.maxRows ?? gr, p = performance.now();
|
|
1900
1900
|
if (!n.trim())
|
|
1901
1901
|
return {
|
|
1902
1902
|
ok: !1,
|
|
@@ -1910,7 +1910,7 @@ async function gr(a, n, s = {}) {
|
|
|
1910
1910
|
{ sql: n, connection: o.connection, maxRows: i },
|
|
1911
1911
|
{ signal: s.signal }
|
|
1912
1912
|
);
|
|
1913
|
-
return
|
|
1913
|
+
return nr(E, performance.now() - p);
|
|
1914
1914
|
}
|
|
1915
1915
|
if (o.mode === "http")
|
|
1916
1916
|
return await Ia(o, n, i, s.signal);
|
|
@@ -1919,7 +1919,7 @@ async function gr(a, n, s = {}) {
|
|
|
1919
1919
|
database: o.connection.database || ":memory:",
|
|
1920
1920
|
maxRows: i
|
|
1921
1921
|
});
|
|
1922
|
-
return
|
|
1922
|
+
return nr(b, performance.now() - p);
|
|
1923
1923
|
} catch (b) {
|
|
1924
1924
|
return _a(b) ? {
|
|
1925
1925
|
ok: !1,
|
|
@@ -1934,13 +1934,13 @@ async function gr(a, n, s = {}) {
|
|
|
1934
1934
|
};
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
|
-
function
|
|
1937
|
+
function rr(a) {
|
|
1938
1938
|
var n;
|
|
1939
1939
|
return (n = ut.find((s) => s.value === a)) == null ? void 0 : n.defaultPort;
|
|
1940
1940
|
}
|
|
1941
1941
|
async function Ha(a, n = {}) {
|
|
1942
1942
|
var o;
|
|
1943
|
-
const s = await
|
|
1943
|
+
const s = await yr(a, "SELECT 1", n);
|
|
1944
1944
|
return s.ok ? {
|
|
1945
1945
|
ok: !0,
|
|
1946
1946
|
message: `连接成功(${Math.max(1, Math.round(s.durationMs))}ms)`,
|
|
@@ -1953,7 +1953,7 @@ async function Ha(a, n = {}) {
|
|
|
1953
1953
|
}
|
|
1954
1954
|
async function ln(a, n, s, o = {}) {
|
|
1955
1955
|
var P, T;
|
|
1956
|
-
const i =
|
|
1956
|
+
const i = D(a), p = (i.endpoint ?? "").trim().replace(/\/+$/, "");
|
|
1957
1957
|
if (!p)
|
|
1958
1958
|
throw new Error("未配置 SQL 服务端点");
|
|
1959
1959
|
const b = new AbortController(), E = setTimeout(() => b.abort(), i.timeoutMs ?? Ot), R = () => b.abort();
|
|
@@ -1993,7 +1993,7 @@ function Ua(a, n, s, o = {}) {
|
|
|
1993
1993
|
o
|
|
1994
1994
|
);
|
|
1995
1995
|
}
|
|
1996
|
-
async function
|
|
1996
|
+
async function sr(a, n, s = {}) {
|
|
1997
1997
|
await ln(
|
|
1998
1998
|
a,
|
|
1999
1999
|
`/connections/${encodeURIComponent(n)}`,
|
|
@@ -2020,10 +2020,10 @@ function Gt(a) {
|
|
|
2020
2020
|
return ta();
|
|
2021
2021
|
case "python":
|
|
2022
2022
|
default:
|
|
2023
|
-
return
|
|
2023
|
+
return pr();
|
|
2024
2024
|
}
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function ar(a) {
|
|
2027
2027
|
const n = a.lastIndexOf(".");
|
|
2028
2028
|
if (n < 0) return "python";
|
|
2029
2029
|
switch (a.slice(n + 1).toLowerCase()) {
|
|
@@ -2041,7 +2041,7 @@ function sr(a) {
|
|
|
2041
2041
|
return "python";
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
|
-
const
|
|
2044
|
+
const or = [
|
|
2045
2045
|
{ value: "light", label: "明亮", dark: !1 },
|
|
2046
2046
|
{ value: "dark", label: "深色", dark: !0 },
|
|
2047
2047
|
{ value: "github-light", label: "GitHub 浅色", dark: !1 },
|
|
@@ -2052,14 +2052,14 @@ const ar = [
|
|
|
2052
2052
|
{ value: "monokai", label: "Monokai", dark: !0 }
|
|
2053
2053
|
];
|
|
2054
2054
|
function Aa(a) {
|
|
2055
|
-
return
|
|
2055
|
+
return or.find((n) => n.value === a) ?? or[0];
|
|
2056
2056
|
}
|
|
2057
|
-
function
|
|
2057
|
+
function ir(a) {
|
|
2058
2058
|
return Aa(a).dark;
|
|
2059
2059
|
}
|
|
2060
2060
|
function Z(a) {
|
|
2061
2061
|
const n = Array.isArray(a) ? a : [a];
|
|
2062
|
-
return () =>
|
|
2062
|
+
return () => Dn(
|
|
2063
2063
|
"svg",
|
|
2064
2064
|
{
|
|
2065
2065
|
viewBox: "0 0 24 24",
|
|
@@ -2068,20 +2068,20 @@ function Z(a) {
|
|
|
2068
2068
|
fill: "currentColor",
|
|
2069
2069
|
"aria-hidden": "true"
|
|
2070
2070
|
},
|
|
2071
|
-
n.map((s) =>
|
|
2071
|
+
n.map((s) => Dn("path", { d: s }))
|
|
2072
2072
|
);
|
|
2073
2073
|
}
|
|
2074
2074
|
const Da = Z(
|
|
2075
2075
|
"M8 5.14v13.72a1 1 0 0 0 1.54.84l10.3-6.86a1 1 0 0 0 0-1.68L9.54 4.3A1 1 0 0 0 8 5.14Z"
|
|
2076
|
-
), za = Z("M6 6h12v12H6Z"),
|
|
2076
|
+
), za = Z("M6 6h12v12H6Z"), lr = Z(
|
|
2077
2077
|
"M9 3h6a1 1 0 0 1 1 1v1h4a1 1 0 1 1 0 2h-1.06l-.87 12.13A2 2 0 0 1 16.08 21H7.92a2 2 0 0 1-1.99-1.87L5.06 7H4a1 1 0 0 1 0-2h4V4a1 1 0 0 1 1-1Zm1 2h4V5h-4v0Zm-2.92 2h9.84l-.85 12.07a.5.5 0 0 1-.5.43H7.93a.5.5 0 0 1-.5-.43Z"
|
|
2078
2078
|
), ja = Z(
|
|
2079
2079
|
"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"
|
|
2080
2080
|
), Va = Z(
|
|
2081
2081
|
"M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"
|
|
2082
|
-
),
|
|
2082
|
+
), ur = Z(
|
|
2083
2083
|
"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"
|
|
2084
|
-
),
|
|
2084
|
+
), cr = Z("M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"), Qa = Z(
|
|
2085
2085
|
"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"
|
|
2086
2086
|
), Ka = Z("M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"), lt = Z(
|
|
2087
2087
|
"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12 5.7 16.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4Z"
|
|
@@ -2095,87 +2095,84 @@ const Da = Z(
|
|
|
2095
2095
|
]), Ya = {
|
|
2096
2096
|
key: 0,
|
|
2097
2097
|
class: "vpe-toolbar"
|
|
2098
|
-
}, Xa = ["title", "disabled"],
|
|
2098
|
+
}, Xa = { class: "vpe-toolbar-main" }, eo = ["title", "disabled"], to = ["disabled"], no = ["disabled"], ro = ["title", "disabled"], so = ["title", "aria-label"], ao = { key: 2 }, oo = { key: 3 }, io = ["disabled"], lo = {
|
|
2099
2099
|
class: "vpe-file",
|
|
2100
2100
|
title: "当前文件名(下载时使用)"
|
|
2101
|
-
},
|
|
2101
|
+
}, uo = { class: "vpe-toolbar-end" }, co = ["disabled"], po = {
|
|
2102
2102
|
value: "",
|
|
2103
2103
|
disabled: ""
|
|
2104
|
-
},
|
|
2105
|
-
key: 6,
|
|
2106
|
-
class: "vpe-runtime-group"
|
|
2107
|
-
}, fo = ["value", "disabled"], vo = ["value"], mo = ["aria-selected", "data-file-id", "title", "onClick", "onKeydown"], go = { class: "vpe-tab-name" }, yo = ["title", "aria-label", "disabled", "onClick"], ho = ["disabled"], bo = { class: "vpe-output-head" }, ko = { class: "vpe-output-main" }, wo = {
|
|
2104
|
+
}, fo = ["value"], vo = { class: "vpe-toolbar-chips" }, mo = ["title"], go = { class: "vpe-status-text" }, yo = ["value", "disabled"], ho = ["value"], bo = ["aria-selected", "data-file-id", "title", "onClick", "onKeydown"], ko = { class: "vpe-tab-name" }, wo = ["title", "aria-label", "disabled", "onClick"], So = ["disabled"], xo = { class: "vpe-output-head" }, Eo = { class: "vpe-output-main" }, qo = {
|
|
2108
2105
|
key: 0,
|
|
2109
2106
|
class: "vpe-sql-results"
|
|
2110
|
-
},
|
|
2107
|
+
}, Co = { class: "vpe-sql-result-head" }, Po = {
|
|
2111
2108
|
key: 0,
|
|
2112
2109
|
class: "vpe-sql-table-wrap"
|
|
2113
|
-
},
|
|
2110
|
+
}, Oo = { class: "vpe-sql-table" }, Mo = {
|
|
2114
2111
|
key: 0,
|
|
2115
2112
|
class: "vpe-sql-empty"
|
|
2116
|
-
},
|
|
2113
|
+
}, No = {
|
|
2117
2114
|
key: 1,
|
|
2118
2115
|
class: "vpe-sql-affected"
|
|
2119
|
-
},
|
|
2116
|
+
}, To = {
|
|
2120
2117
|
key: 1,
|
|
2121
2118
|
class: "vpe-empty"
|
|
2122
|
-
},
|
|
2119
|
+
}, Lo = {
|
|
2123
2120
|
key: 0,
|
|
2124
2121
|
class: "vpe-terminal-input"
|
|
2125
|
-
},
|
|
2122
|
+
}, $o = ["onKeydown"], Fo = {
|
|
2126
2123
|
key: 4,
|
|
2127
2124
|
class: "vpe-fs-panel",
|
|
2128
2125
|
role: "dialog",
|
|
2129
2126
|
"aria-label": "虚拟文件"
|
|
2130
|
-
},
|
|
2127
|
+
}, Ro = { class: "vpe-fs-head" }, _o = ["disabled"], Io = { class: "vpe-fs-body" }, Ho = {
|
|
2131
2128
|
key: 0,
|
|
2132
2129
|
class: "vpe-fs-empty"
|
|
2133
|
-
},
|
|
2130
|
+
}, Bo = {
|
|
2134
2131
|
key: 0,
|
|
2135
2132
|
class: "vpe-fs-empty"
|
|
2136
|
-
},
|
|
2133
|
+
}, Uo = ["title"], Ao = { class: "vpe-fs-size" }, Do = ["title", "aria-label", "onClick"], zo = {
|
|
2137
2134
|
key: 5,
|
|
2138
2135
|
class: "vpe-fs-panel",
|
|
2139
2136
|
role: "dialog",
|
|
2140
2137
|
"aria-label": "服务端文件"
|
|
2141
|
-
},
|
|
2138
|
+
}, jo = { class: "vpe-fs-head" }, Vo = ["disabled"], Qo = { class: "vpe-fs-body" }, Ko = {
|
|
2142
2139
|
key: 0,
|
|
2143
2140
|
class: "vpe-fs-empty"
|
|
2144
|
-
},
|
|
2141
|
+
}, Jo = {
|
|
2145
2142
|
key: 0,
|
|
2146
2143
|
class: "vpe-fs-empty"
|
|
2147
|
-
},
|
|
2144
|
+
}, Zo = ["title"], Go = ["title"], Wo = ["title", "disabled", "onClick"], Yo = ["title", "disabled", "onClick"], Xo = {
|
|
2148
2145
|
key: 1,
|
|
2149
2146
|
class: "vpe-sql-hint vpe-sql-hint--error"
|
|
2150
|
-
},
|
|
2147
|
+
}, ei = {
|
|
2151
2148
|
key: 6,
|
|
2152
2149
|
class: "vpe-sql-panel",
|
|
2153
2150
|
role: "dialog",
|
|
2154
2151
|
"aria-label": "SQL 连接配置"
|
|
2155
|
-
},
|
|
2152
|
+
}, ti = { class: "vpe-fs-head" }, ni = { class: "vpe-fs-title" }, ri = { class: "vpe-sql-body" }, si = { class: "vpe-sql-field" }, ai = { class: "vpe-sql-field" }, oi = { class: "vpe-sql-field" }, ii = { class: "vpe-sql-field" }, li = ["value"], ui = { class: "vpe-sql-row" }, ci = { class: "vpe-sql-field vpe-sql-field--grow" }, di = { class: "vpe-sql-field vpe-sql-field--grow" }, pi = { class: "vpe-sql-row" }, fi = { class: "vpe-sql-field vpe-sql-field--grow" }, vi = { class: "vpe-sql-field vpe-sql-field--grow" }, mi = ["placeholder"], gi = { class: "vpe-sql-field" }, yi = {
|
|
2156
2153
|
key: 0,
|
|
2157
2154
|
class: "vpe-sql-field"
|
|
2158
|
-
},
|
|
2155
|
+
}, hi = {
|
|
2159
2156
|
key: 1,
|
|
2160
2157
|
class: "vpe-sql-hint"
|
|
2161
|
-
},
|
|
2158
|
+
}, bi = { class: "vpe-sql-actions" }, ki = ["disabled"], wi = ["disabled"], Si = ["disabled"], xi = {
|
|
2162
2159
|
key: 3,
|
|
2163
2160
|
class: "vpe-sql-test vpe-sql-test--err"
|
|
2164
|
-
},
|
|
2161
|
+
}, Ei = {
|
|
2165
2162
|
key: 7,
|
|
2166
2163
|
class: "vpe-sql-manager-panel",
|
|
2167
2164
|
role: "dialog",
|
|
2168
2165
|
"aria-label": "连接管理"
|
|
2169
|
-
},
|
|
2166
|
+
}, qi = { class: "vpe-fs-head" }, Ci = ["disabled"], Pi = { class: "vpe-sql-manager-body" }, Oi = {
|
|
2170
2167
|
key: 0,
|
|
2171
2168
|
class: "vpe-fs-empty"
|
|
2172
|
-
},
|
|
2169
|
+
}, Mi = {
|
|
2173
2170
|
key: 0,
|
|
2174
2171
|
class: "vpe-fs-empty"
|
|
2175
|
-
},
|
|
2172
|
+
}, Ni = { class: "vpe-sql-manager-main" }, Ti = ["title"], Li = { class: "vpe-sql-manager-meta" }, $i = ["onClick"], Fi = ["disabled", "onClick"], Ri = {
|
|
2176
2173
|
key: 1,
|
|
2177
2174
|
class: "vpe-sql-hint vpe-sql-hint--error"
|
|
2178
|
-
}, Wt = 1,
|
|
2175
|
+
}, Wt = 1, dr = 80, _i = /* @__PURE__ */ Ms({
|
|
2179
2176
|
__name: "PythonEditor",
|
|
2180
2177
|
props: {
|
|
2181
2178
|
modelValue: { default: "" },
|
|
@@ -2211,7 +2208,7 @@ const Da = Z(
|
|
|
2211
2208
|
},
|
|
2212
2209
|
emits: ["update:modelValue", "ready", "statusChange", "runStart", "runOutput", "runError", "runFinish", "loadError", "update:fileName", "update:language", "newFile", "fileClose", "fileSwitch", "copy", "download", "fileOpen", "fsDownload", "update:sqlConfig", "update:runtime", "sqlResult", "sqlError"],
|
|
2213
2210
|
setup(a, { expose: n, emit: s }) {
|
|
2214
|
-
const o = a, i = s, p = C(), b = C(), E = C(), R = C(), P = C(), T = C(), x = C(null), F = C(!1), q =
|
|
2211
|
+
const o = a, i = s, p = C(), b = C(), E = C(), R = C(), P = C(), T = C(), x = C(null), F = C(!1), q = zn(/* @__PURE__ */ new Map()), G = U(() => pe().lines), ve = U(() => pe().sqlResults), O = zn(/* @__PURE__ */ new Map()), V = U(() => O.get(w.value.id) ?? null), Ue = U(() => {
|
|
2215
2212
|
var e;
|
|
2216
2213
|
return !!((e = V.value) != null && e.busy);
|
|
2217
2214
|
}), Ae = U(() => {
|
|
@@ -2226,10 +2223,10 @@ const Da = Z(
|
|
|
2226
2223
|
const t = V.value;
|
|
2227
2224
|
t && (t.input = e);
|
|
2228
2225
|
}
|
|
2229
|
-
}), k = C(null), I = C("idle"), Q = C(o.runtime), me = C(!1), qe = C(!1), Ye = C(!1), Xe = C([]), Se = C(!1), dt = C(!1), et = C([]), De = C(""), W = C(!1), Fe = C(!1), xe = C(!1), Re = C(!1), tt = C(""), pt = C(!1), f = C(
|
|
2230
|
-
let Tt = !1, vt, un = !1, Lt = !1, cn = !1, M = null,
|
|
2226
|
+
}), k = C(null), I = C("idle"), Q = C(o.runtime), me = C(!1), qe = C(!1), Ye = C(!1), Xe = C([]), Se = C(!1), dt = C(!1), et = C([]), De = C(""), W = C(!1), Fe = C(!1), xe = C(!1), Re = C(!1), tt = C(""), pt = C(!1), f = C(D(o.sqlConfig)), Ce = C([]), ze = C(!1), Pe = C(""), ee = C(""), te = C(!1), ne = C(""), je = C(!1), _e = C(!1), Ve = C(""), ft = C(!1);
|
|
2227
|
+
let Tt = !1, vt, un = !1, Lt = !1, cn = !1, M = null, hr = 0, br = 0, mt = null, gt = null, $t, ce = null, Y = null, re = null, se = null, kr = 0, nt = 0;
|
|
2231
2228
|
function Qe(e, t, r) {
|
|
2232
|
-
return { id: ++
|
|
2229
|
+
return { id: ++br, name: e, language: t, code: r };
|
|
2233
2230
|
}
|
|
2234
2231
|
const L = C([Qe(o.fileName, o.language, o.modelValue)]), Ee = C(L.value[0].id), w = U(
|
|
2235
2232
|
() => L.value.find((e) => e.id === Ee.value) ?? L.value[0]
|
|
@@ -2239,18 +2236,18 @@ const Da = Z(
|
|
|
2239
2236
|
const t = w.value;
|
|
2240
2237
|
t.name !== e && (t.name = e, i("update:fileName", e));
|
|
2241
2238
|
}
|
|
2242
|
-
}), dn = new Kt(), Ft = new Kt(), Rt = new Kt(), z = rn(o.pyodideUrl ? { pyodideUrl: o.pyodideUrl } : void 0),
|
|
2239
|
+
}), dn = new Kt(), Ft = new Kt(), Rt = new Kt(), z = rn(o.pyodideUrl ? { pyodideUrl: o.pyodideUrl } : void 0), wr = U(() => ({
|
|
2243
2240
|
height: typeof o.height == "number" ? `${o.height}px` : o.height
|
|
2244
|
-
})),
|
|
2241
|
+
})), Sr = U(() => [
|
|
2245
2242
|
`vpe-theme-${o.theme}`,
|
|
2246
|
-
|
|
2243
|
+
ir(o.theme) ? "vpe-dark" : ""
|
|
2247
2244
|
]);
|
|
2248
2245
|
let pn = 0, _t = 0, Ke = null;
|
|
2249
|
-
const
|
|
2246
|
+
const xr = U(
|
|
2250
2247
|
() => x.value !== null ? `${x.value}px` : typeof o.outputHeight == "number" ? `${o.outputHeight}px` : o.outputHeight
|
|
2251
2248
|
), de = U(() => w.value.language === "sql"), fn = U(() => w.value.language === "python"), yt = U(() => !!(o.pythonEndpoint ?? "").trim()), Je = U(
|
|
2252
2249
|
() => fn.value && yt.value && Q.value === "server"
|
|
2253
|
-
), Oe = U(() => !!(o.filesEndpoint ?? "").trim()), It = U(() => Ue.value || xe.value && k.value === w.value.id ? !0 : I.value === "running" && k.value === w.value.id),
|
|
2250
|
+
), Oe = U(() => !!(o.filesEndpoint ?? "").trim()), It = U(() => Ue.value || xe.value && k.value === w.value.id ? !0 : I.value === "running" && k.value === w.value.id), vn = U(() => de.value && f.value.mode === "http" ? xe.value && k.value === w.value.id ? "查询中" : "外部服务" : Je.value ? Ue.value ? Ae.value ? "等待输入" : "执行中" : "服务端" : I.value === "running" && k.value !== w.value.id ? "就绪" : {
|
|
2254
2251
|
idle: "未加载",
|
|
2255
2252
|
loading: "正在加载 Pyodide…",
|
|
2256
2253
|
ready: "就绪",
|
|
@@ -2264,7 +2261,7 @@ const Da = Z(
|
|
|
2264
2261
|
return t || (t = { lines: [], sqlResults: [] }, q.set(e, t)), t;
|
|
2265
2262
|
}
|
|
2266
2263
|
function ge(e, t, r) {
|
|
2267
|
-
pe(r).lines.push({ id: ++
|
|
2264
|
+
pe(r).lines.push({ id: ++hr, stream: e, text: t });
|
|
2268
2265
|
}
|
|
2269
2266
|
function h(e, t) {
|
|
2270
2267
|
ge("system", e, t);
|
|
@@ -2299,7 +2296,7 @@ const Da = Z(
|
|
|
2299
2296
|
const t = L.value[e.activeIndex] ?? L.value[0];
|
|
2300
2297
|
Ee.value = t.id, h(`已恢复上次编辑内容(${L.value.length} 个文件)`), i("update:modelValue", t.code), i("update:fileName", t.name), i("update:language", t.language);
|
|
2301
2298
|
}
|
|
2302
|
-
function
|
|
2299
|
+
function mn() {
|
|
2303
2300
|
if (!(!Tt || Lt || !o.storageKey || typeof window > "u"))
|
|
2304
2301
|
try {
|
|
2305
2302
|
const e = {
|
|
@@ -2320,7 +2317,7 @@ const Da = Z(
|
|
|
2320
2317
|
}
|
|
2321
2318
|
}
|
|
2322
2319
|
function Tr() {
|
|
2323
|
-
!Tt || !o.storageKey || typeof window > "u" || (Lt = !1, window.clearTimeout(vt), vt = window.setTimeout(
|
|
2320
|
+
!Tt || !o.storageKey || typeof window > "u" || (Lt = !1, window.clearTimeout(vt), vt = window.setTimeout(mn, 400));
|
|
2324
2321
|
}
|
|
2325
2322
|
function Lr() {
|
|
2326
2323
|
if (!(!o.storageKey || typeof window > "u")) {
|
|
@@ -2335,7 +2332,7 @@ const Da = Z(
|
|
|
2335
2332
|
function Me(e) {
|
|
2336
2333
|
if (!M) return;
|
|
2337
2334
|
const t = e ? [e] : [];
|
|
2338
|
-
M.dispatch({ effects:
|
|
2335
|
+
M.dispatch({ effects: fr.of(t) });
|
|
2339
2336
|
}
|
|
2340
2337
|
function $r() {
|
|
2341
2338
|
const e = o.modelValue;
|
|
@@ -2379,14 +2376,14 @@ const Da = Z(
|
|
|
2379
2376
|
const u = e.trim().replace(/[\\/:*?"<>|]+/g, "_").replace(/\.+$/, "") || "untitled";
|
|
2380
2377
|
return /\.[^.\\/]+$/.test(u) ? u : `${u}.${Ct(t).extension}`;
|
|
2381
2378
|
}
|
|
2382
|
-
function
|
|
2379
|
+
function gn(e) {
|
|
2383
2380
|
const t = Ct(e).extension, r = new Set(L.value.map((y) => y.name));
|
|
2384
2381
|
let u = `untitled.${t}`, c = 2;
|
|
2385
2382
|
for (; r.has(u); )
|
|
2386
2383
|
u = `untitled-${c}.${t}`, c += 1;
|
|
2387
2384
|
return u;
|
|
2388
2385
|
}
|
|
2389
|
-
function
|
|
2386
|
+
function yn(e) {
|
|
2390
2387
|
if (!L.value.some((S) => S.name === e)) return e;
|
|
2391
2388
|
const t = e.lastIndexOf("."), r = t > 0 ? e.slice(0, t) : e, u = t > 0 ? e.slice(t) : "";
|
|
2392
2389
|
let c = 2, y = `${r}-${c}${u}`;
|
|
@@ -2416,39 +2413,39 @@ const Da = Z(
|
|
|
2416
2413
|
}
|
|
2417
2414
|
function ye() {
|
|
2418
2415
|
rt(), ne.value = "";
|
|
2419
|
-
const e =
|
|
2420
|
-
f.value = e, i("update:sqlConfig",
|
|
2416
|
+
const e = D(f.value);
|
|
2417
|
+
f.value = e, i("update:sqlConfig", D(e));
|
|
2421
2418
|
}
|
|
2422
2419
|
function _r() {
|
|
2423
2420
|
_e.value = !1, Fe.value = !0, fe();
|
|
2424
2421
|
}
|
|
2425
2422
|
function Ir() {
|
|
2426
|
-
f.value.mode !== "http" && (f.value =
|
|
2423
|
+
f.value.mode !== "http" && (f.value = D({ ...f.value, mode: "http" }), i("update:sqlConfig", D(f.value))), Fe.value = !1, _e.value = !0, Ve.value = "", ft.value = !1, fe();
|
|
2427
2424
|
}
|
|
2428
2425
|
function Hr() {
|
|
2429
2426
|
const e = f.value.connection.dialect, t = e === "sqlite" ? "mysql" : e;
|
|
2430
|
-
f.value =
|
|
2427
|
+
f.value = D({
|
|
2431
2428
|
mode: "http",
|
|
2432
2429
|
endpoint: f.value.endpoint,
|
|
2433
2430
|
headers: f.value.headers,
|
|
2434
2431
|
maxRows: f.value.maxRows,
|
|
2435
2432
|
timeoutMs: f.value.timeoutMs,
|
|
2436
|
-
connection: { dialect: t, port:
|
|
2437
|
-
}), ee.value = "", ne.value = "", Pe.value = "", rt(), i("update:sqlConfig",
|
|
2433
|
+
connection: { dialect: t, port: rr(t) }
|
|
2434
|
+
}), ee.value = "", ne.value = "", Pe.value = "", rt(), i("update:sqlConfig", D(f.value)), _e.value = !1, Fe.value = !0, fe();
|
|
2438
2435
|
}
|
|
2439
|
-
function
|
|
2436
|
+
function hn() {
|
|
2440
2437
|
Fe.value = !1;
|
|
2441
2438
|
}
|
|
2442
2439
|
function Br() {
|
|
2443
2440
|
const e = f.value;
|
|
2444
|
-
e.mode === "sqlite" ? (e.connectionId = void 0, e.connection.dialect = "sqlite", e.connection.database || (e.connection.database = ":memory:"), ee.value = "") : (e.connection.dialect === "sqlite" && (e.connection.dialect = "mysql", e.connection.port =
|
|
2441
|
+
e.mode === "sqlite" ? (e.connectionId = void 0, e.connection.dialect = "sqlite", e.connection.database || (e.connection.database = ":memory:"), ee.value = "") : (e.connection.dialect === "sqlite" && (e.connection.dialect = "mysql", e.connection.port = rr("mysql")), e.connection.database === ":memory:" && (e.connection.database = "")), ye(), e.mode === "http" && fe();
|
|
2445
2442
|
}
|
|
2446
2443
|
function Ur() {
|
|
2447
2444
|
const e = f.value.connection, t = ut.find((u) => u.value === e.dialect), r = ut.map((u) => u.defaultPort);
|
|
2448
2445
|
t != null && t.defaultPort && (!e.port || r.includes(e.port)) && (e.port = t.defaultPort), ye();
|
|
2449
2446
|
}
|
|
2450
2447
|
async function fe() {
|
|
2451
|
-
const e =
|
|
2448
|
+
const e = D(f.value);
|
|
2452
2449
|
if (!e.endpoint) {
|
|
2453
2450
|
Ce.value = [], Pe.value = "";
|
|
2454
2451
|
return;
|
|
@@ -2469,8 +2466,8 @@ const Da = Z(
|
|
|
2469
2466
|
re === t && (re = null, ze.value = !1);
|
|
2470
2467
|
}
|
|
2471
2468
|
}
|
|
2472
|
-
function
|
|
2473
|
-
f.value =
|
|
2469
|
+
function bn(e) {
|
|
2470
|
+
f.value = D({
|
|
2474
2471
|
mode: "http",
|
|
2475
2472
|
endpoint: f.value.endpoint,
|
|
2476
2473
|
headers: f.value.headers,
|
|
@@ -2486,7 +2483,7 @@ const Da = Z(
|
|
|
2486
2483
|
database: e.database ?? "",
|
|
2487
2484
|
options: e.options
|
|
2488
2485
|
}
|
|
2489
|
-
}), ee.value = e.name, ne.value = "", rt(), i("update:sqlConfig",
|
|
2486
|
+
}), ee.value = e.name, ne.value = "", rt(), i("update:sqlConfig", D(f.value));
|
|
2490
2487
|
}
|
|
2491
2488
|
function Ar() {
|
|
2492
2489
|
Fe.value = !1, _e.value = !1;
|
|
@@ -2495,10 +2492,10 @@ const Da = Z(
|
|
|
2495
2492
|
f.value.connectionId = void 0, f.value.connection.password = "", ee.value = "", ye();
|
|
2496
2493
|
return;
|
|
2497
2494
|
}
|
|
2498
|
-
|
|
2495
|
+
bn(e);
|
|
2499
2496
|
}
|
|
2500
2497
|
function Dr(e) {
|
|
2501
|
-
|
|
2498
|
+
bn(e), _e.value = !1, Fe.value = !0;
|
|
2502
2499
|
}
|
|
2503
2500
|
async function zr() {
|
|
2504
2501
|
if (te.value) return;
|
|
@@ -2507,7 +2504,7 @@ const Da = Z(
|
|
|
2507
2504
|
je.value = !1, ne.value = "请先填写连接名称";
|
|
2508
2505
|
return;
|
|
2509
2506
|
}
|
|
2510
|
-
const t =
|
|
2507
|
+
const t = D(f.value), r = {
|
|
2511
2508
|
name: e,
|
|
2512
2509
|
dialect: t.connection.dialect,
|
|
2513
2510
|
host: t.connection.host,
|
|
@@ -2520,11 +2517,11 @@ const Da = Z(
|
|
|
2520
2517
|
te.value = !0, ne.value = "";
|
|
2521
2518
|
try {
|
|
2522
2519
|
const u = await Ua(t, r, t.connectionId);
|
|
2523
|
-
f.value =
|
|
2520
|
+
f.value = D({
|
|
2524
2521
|
...t,
|
|
2525
2522
|
connectionId: u.id,
|
|
2526
2523
|
connection: { ...t.connection, password: "" }
|
|
2527
|
-
}), ee.value = u.name, je.value = !0, ne.value = "连接已保存", i("update:sqlConfig",
|
|
2524
|
+
}), ee.value = u.name, je.value = !0, ne.value = "连接已保存", i("update:sqlConfig", D(f.value)), await fe();
|
|
2528
2525
|
} catch (u) {
|
|
2529
2526
|
je.value = !1, ne.value = u instanceof Error ? u.message : String(u);
|
|
2530
2527
|
} finally {
|
|
@@ -2536,7 +2533,7 @@ const Da = Z(
|
|
|
2536
2533
|
if (!(!e || te.value) && !(typeof window < "u" && !window.confirm("确定删除该连接配置?"))) {
|
|
2537
2534
|
te.value = !0, ne.value = "";
|
|
2538
2535
|
try {
|
|
2539
|
-
await
|
|
2536
|
+
await sr(f.value, e), f.value.connectionId = void 0, ee.value = "", je.value = !0, ne.value = "连接已删除", i("update:sqlConfig", D(f.value)), await fe();
|
|
2540
2537
|
} catch (t) {
|
|
2541
2538
|
je.value = !1, ne.value = t instanceof Error ? t.message : String(t);
|
|
2542
2539
|
} finally {
|
|
@@ -2548,7 +2545,7 @@ const Da = Z(
|
|
|
2548
2545
|
if (!te.value && !(typeof window < "u" && !window.confirm(`确定删除连接“${e.name}”?`))) {
|
|
2549
2546
|
te.value = !0, Ve.value = "";
|
|
2550
2547
|
try {
|
|
2551
|
-
await
|
|
2548
|
+
await sr(f.value, e.id), f.value.connectionId === e.id && (f.value.connectionId = void 0, f.value.connection.password = "", ee.value = "", i("update:sqlConfig", D(f.value))), ft.value = !0, Ve.value = `已删除连接“${e.name}”`, await fe();
|
|
2552
2549
|
} catch (t) {
|
|
2553
2550
|
ft.value = !1, Ve.value = t instanceof Error ? t.message : String(t);
|
|
2554
2551
|
} finally {
|
|
@@ -2562,7 +2559,7 @@ const Da = Z(
|
|
|
2562
2559
|
const e = new AbortController();
|
|
2563
2560
|
Y = e;
|
|
2564
2561
|
try {
|
|
2565
|
-
const t = await Ha(
|
|
2562
|
+
const t = await Ha(D(f.value), {
|
|
2566
2563
|
executor: o.sqlExecutor,
|
|
2567
2564
|
signal: e.signal
|
|
2568
2565
|
});
|
|
@@ -2581,23 +2578,23 @@ const Da = Z(
|
|
|
2581
2578
|
function Jr(e) {
|
|
2582
2579
|
return e.columns.length ? `${e.rows.length} 行${e.truncated ? "(已截断)" : ""}` : `影响 ${e.affectedRows ?? 0} 行`;
|
|
2583
2580
|
}
|
|
2584
|
-
function
|
|
2581
|
+
function kn(e) {
|
|
2585
2582
|
if (e)
|
|
2586
2583
|
return { type: e.type, message: e.message, traceback: "" };
|
|
2587
2584
|
}
|
|
2588
|
-
async function
|
|
2585
|
+
async function wn() {
|
|
2589
2586
|
if (xe.value)
|
|
2590
2587
|
return k.value !== w.value.id && h("另一个 SQL 正在执行,请等待或停止后再试"), null;
|
|
2591
2588
|
const e = Ne();
|
|
2592
2589
|
if (!e.trim())
|
|
2593
2590
|
return h("SQL 内容为空,请输入要执行的语句"), null;
|
|
2594
|
-
const t =
|
|
2591
|
+
const t = D(f.value), r = ++nt, u = w.value.id;
|
|
2595
2592
|
xe.value = !0, k.value = u, ce = new AbortController(), Me(void 0), o.clearOutputOnRun && (pe(u).lines = [], pe(u).sqlResults = []), h(
|
|
2596
2593
|
`开始执行 SQL(${t.mode === "sqlite" ? "浏览器内 SQLite" : "HTTP 服务"})`,
|
|
2597
2594
|
u
|
|
2598
2595
|
), i("runStart");
|
|
2599
2596
|
try {
|
|
2600
|
-
const c = await
|
|
2597
|
+
const c = await yr(t, e, {
|
|
2601
2598
|
executor: o.sqlExecutor,
|
|
2602
2599
|
signal: ce.signal
|
|
2603
2600
|
});
|
|
@@ -2615,20 +2612,20 @@ const Da = Z(
|
|
|
2615
2612
|
return i("sqlResult", c), i("runFinish", {
|
|
2616
2613
|
ok: c.ok,
|
|
2617
2614
|
durationMs: c.durationMs,
|
|
2618
|
-
error: c.ok ? void 0 :
|
|
2615
|
+
error: c.ok ? void 0 : kn(c.error)
|
|
2619
2616
|
}), c;
|
|
2620
2617
|
} catch (c) {
|
|
2621
2618
|
if (r !== nt) return null;
|
|
2622
2619
|
const y = c instanceof Error ? c.message : String(c);
|
|
2623
2620
|
h(`SQL 执行失败:${y}`, u);
|
|
2624
2621
|
const S = { type: "SqlError", message: y };
|
|
2625
|
-
return i("sqlError", S), i("runFinish", { ok: !1, durationMs: 0, error:
|
|
2622
|
+
return i("sqlError", S), i("runFinish", { ok: !1, durationMs: 0, error: kn(S) }), null;
|
|
2626
2623
|
} finally {
|
|
2627
2624
|
r === nt && (xe.value = !1, ce = null, k.value === u && (k.value = null));
|
|
2628
2625
|
}
|
|
2629
2626
|
}
|
|
2630
2627
|
async function Zr(e) {
|
|
2631
|
-
return e !== void 0 && (ht(e), w.value.language !== "sql" && Bt("sql")), w.value.language !== "sql" ? (h("当前文件不是 SQL,无法执行"), null) :
|
|
2628
|
+
return e !== void 0 && (ht(e), w.value.language !== "sql" && Bt("sql")), w.value.language !== "sql" ? (h("当前文件不是 SQL,无法执行"), null) : wn();
|
|
2632
2629
|
}
|
|
2633
2630
|
function Gr(e) {
|
|
2634
2631
|
const t = e.target.value === "server" ? "server" : "browser";
|
|
@@ -2637,7 +2634,7 @@ const Da = Z(
|
|
|
2637
2634
|
st(r, !1);
|
|
2638
2635
|
Q.value = t, i("update:runtime", t), h(t === "server" ? "已切换到服务端 Python 环境" : "已切换到浏览器 Python 环境");
|
|
2639
2636
|
}
|
|
2640
|
-
function
|
|
2637
|
+
function Sn(e, t, r, u) {
|
|
2641
2638
|
if (!u) return;
|
|
2642
2639
|
const c = u.replace(/\r\n/g, `
|
|
2643
2640
|
`);
|
|
@@ -2649,11 +2646,11 @@ const Da = Z(
|
|
|
2649
2646
|
for (const X of S)
|
|
2650
2647
|
ge(r, X, e), i("runOutput", { stream: r, text: X });
|
|
2651
2648
|
}
|
|
2652
|
-
function
|
|
2649
|
+
function xn(e, t) {
|
|
2653
2650
|
t.stdoutBuffer && (ge("stdout", t.stdoutBuffer, e), i("runOutput", { stream: "stdout", text: t.stdoutBuffer }), t.stdoutBuffer = ""), t.stderrBuffer && (ge("stderr", t.stderrBuffer, e), i("runOutput", { stream: "stderr", text: t.stderrBuffer }), t.stderrBuffer = "");
|
|
2654
2651
|
}
|
|
2655
2652
|
function bt(e, t, r) {
|
|
2656
|
-
window.clearTimeout(t.pollTimer),
|
|
2653
|
+
window.clearTimeout(t.pollTimer), xn(e, t);
|
|
2657
2654
|
const u = O.get(e);
|
|
2658
2655
|
if (u && u.token === t.token && O.delete(e), r.error) {
|
|
2659
2656
|
h(`执行出错:${r.error.type}`, e), e === w.value.id && Me(r.error.line);
|
|
@@ -2672,11 +2669,11 @@ const Da = Z(
|
|
|
2672
2669
|
function At(e, t, r, u) {
|
|
2673
2670
|
const c = O.get(e);
|
|
2674
2671
|
if (!(!c || c.token !== u)) {
|
|
2675
|
-
if (
|
|
2672
|
+
if (Sn(e, t, "stdout", r.stdout), Sn(e, t, "stderr", r.stderr), r.state === "exited") {
|
|
2676
2673
|
bt(e, t, r);
|
|
2677
2674
|
return;
|
|
2678
2675
|
}
|
|
2679
|
-
if (
|
|
2676
|
+
if (xn(e, t), r.state === "waiting") {
|
|
2680
2677
|
t.waiting = !0;
|
|
2681
2678
|
return;
|
|
2682
2679
|
}
|
|
@@ -2721,7 +2718,7 @@ const Da = Z(
|
|
|
2721
2718
|
h("代码为空,请输入要执行的 Python 代码");
|
|
2722
2719
|
return;
|
|
2723
2720
|
}
|
|
2724
|
-
const r = ++
|
|
2721
|
+
const r = ++kr, u = {
|
|
2725
2722
|
sessionId: "",
|
|
2726
2723
|
busy: !0,
|
|
2727
2724
|
waiting: !1,
|
|
@@ -2742,7 +2739,7 @@ const Da = Z(
|
|
|
2742
2739
|
signal: c.abort.signal
|
|
2743
2740
|
}), $ = O.get(e);
|
|
2744
2741
|
if (!$ || $.token !== r) {
|
|
2745
|
-
S.sessionId &&
|
|
2742
|
+
S.sessionId && Yn(o.pythonEndpoint, S.sessionId, {
|
|
2746
2743
|
headers: o.pythonHeaders
|
|
2747
2744
|
});
|
|
2748
2745
|
return;
|
|
@@ -2758,7 +2755,7 @@ const Da = Z(
|
|
|
2758
2755
|
});
|
|
2759
2756
|
}
|
|
2760
2757
|
}
|
|
2761
|
-
async function
|
|
2758
|
+
async function En() {
|
|
2762
2759
|
var u, c;
|
|
2763
2760
|
const e = w.value.id, t = O.get(e);
|
|
2764
2761
|
if (!t || !t.waiting || !t.sessionId) return;
|
|
@@ -2783,14 +2780,14 @@ const Da = Z(
|
|
|
2783
2780
|
function st(e, t = !0) {
|
|
2784
2781
|
var u;
|
|
2785
2782
|
const r = O.get(e);
|
|
2786
|
-
r && (window.clearTimeout(r.pollTimer), O.delete(e), (u = r.abort) == null || u.abort(), r.sessionId &&
|
|
2783
|
+
r && (window.clearTimeout(r.pollTimer), O.delete(e), (u = r.abort) == null || u.abort(), r.sessionId && Yn(o.pythonEndpoint, r.sessionId, {
|
|
2787
2784
|
headers: o.pythonHeaders
|
|
2788
2785
|
}), t && h("执行已中断", e));
|
|
2789
2786
|
}
|
|
2790
|
-
async function
|
|
2787
|
+
async function qn() {
|
|
2791
2788
|
var c, y, S;
|
|
2792
2789
|
if (w.value.language === "sql") {
|
|
2793
|
-
await
|
|
2790
|
+
await wn();
|
|
2794
2791
|
return;
|
|
2795
2792
|
}
|
|
2796
2793
|
if (Je.value) {
|
|
@@ -2865,14 +2862,14 @@ const Da = Z(
|
|
|
2865
2862
|
try {
|
|
2866
2863
|
M = ya(e, {
|
|
2867
2864
|
value: w.value.code,
|
|
2868
|
-
dark:
|
|
2865
|
+
dark: ir(o.theme),
|
|
2869
2866
|
placeholderText: o.placeholder,
|
|
2870
2867
|
language: Ft.of(Gt(w.value.language)),
|
|
2871
2868
|
extensions: t,
|
|
2872
2869
|
onDocChange: (r) => {
|
|
2873
2870
|
w.value.code = r, r !== o.modelValue && i("update:modelValue", r);
|
|
2874
2871
|
},
|
|
2875
|
-
onRunShortcut:
|
|
2872
|
+
onRunShortcut: qn
|
|
2876
2873
|
});
|
|
2877
2874
|
} catch (r) {
|
|
2878
2875
|
const u = r instanceof Error ? r.message : String(r);
|
|
@@ -2892,7 +2889,7 @@ const Da = Z(
|
|
|
2892
2889
|
mt == null || mt(), gt == null || gt(), at(), Ke == null || Ke.disconnect(), Ke = null, ce == null || ce.abort(), ce = null, Y == null || Y.abort(), Y = null, re == null || re.abort(), re = null, se == null || se.abort(), se = null;
|
|
2893
2890
|
for (const e of [...O.keys()])
|
|
2894
2891
|
st(e, !1);
|
|
2895
|
-
window.clearTimeout($t), window.clearTimeout(vt),
|
|
2892
|
+
window.clearTimeout($t), window.clearTimeout(vt), mn(), M == null || M.destroy(), M = null;
|
|
2896
2893
|
}), oe(
|
|
2897
2894
|
() => o.modelValue,
|
|
2898
2895
|
() => $r()
|
|
@@ -2945,7 +2942,7 @@ const Da = Z(
|
|
|
2945
2942
|
() => o.sqlConfig,
|
|
2946
2943
|
(e) => {
|
|
2947
2944
|
if (!e) return;
|
|
2948
|
-
const t =
|
|
2945
|
+
const t = D(e);
|
|
2949
2946
|
JSON.stringify(t) !== JSON.stringify(f.value) && (f.value = t), de.value && fe();
|
|
2950
2947
|
},
|
|
2951
2948
|
{ deep: !0 }
|
|
@@ -2954,15 +2951,15 @@ const Da = Z(
|
|
|
2954
2951
|
}), oe(
|
|
2955
2952
|
() => G.value.length,
|
|
2956
2953
|
async () => {
|
|
2957
|
-
await
|
|
2954
|
+
await jn();
|
|
2958
2955
|
const e = R.value;
|
|
2959
2956
|
e && (e.scrollTop = e.scrollHeight);
|
|
2960
2957
|
}
|
|
2961
2958
|
), oe([L, Ee], () => Tr(), { deep: !0 });
|
|
2962
|
-
function qn() {
|
|
2963
|
-
En();
|
|
2964
|
-
}
|
|
2965
2959
|
function Cn() {
|
|
2960
|
+
qn();
|
|
2961
|
+
}
|
|
2962
|
+
function Pn() {
|
|
2966
2963
|
var t;
|
|
2967
2964
|
const e = w.value.id;
|
|
2968
2965
|
if (Re.value) {
|
|
@@ -2974,42 +2971,42 @@ const Da = Z(
|
|
|
2974
2971
|
return;
|
|
2975
2972
|
}
|
|
2976
2973
|
if (xe.value && k.value === e) {
|
|
2977
|
-
|
|
2974
|
+
On();
|
|
2978
2975
|
return;
|
|
2979
2976
|
}
|
|
2980
|
-
I.value === "running" && k.value === e &&
|
|
2977
|
+
I.value === "running" && k.value === e && Mn();
|
|
2981
2978
|
}
|
|
2982
|
-
function
|
|
2979
|
+
function On(e = !0) {
|
|
2983
2980
|
const t = k.value;
|
|
2984
2981
|
nt += 1, xe.value = !1, k.value = null, ce == null || ce.abort(), ce = null, !o.sqlExecutor && f.value.mode === "sqlite" && z.interrupt(), e && h("执行已中断", t ?? void 0);
|
|
2985
2982
|
}
|
|
2986
|
-
function
|
|
2983
|
+
function Mn(e = !0) {
|
|
2987
2984
|
const t = k.value;
|
|
2988
2985
|
Ge += 1, k.value = null, z.interrupt(), e && h("执行已中断", t ?? void 0);
|
|
2989
2986
|
}
|
|
2990
|
-
function
|
|
2987
|
+
function Nn() {
|
|
2991
2988
|
pe().lines = [], pe().sqlResults = [];
|
|
2992
2989
|
}
|
|
2993
|
-
function
|
|
2990
|
+
function Tn() {
|
|
2994
2991
|
var e;
|
|
2995
2992
|
return ((e = E.value) == null ? void 0 : e.getBoundingClientRect().height) ?? 180;
|
|
2996
2993
|
}
|
|
2997
2994
|
function ts() {
|
|
2998
2995
|
var t;
|
|
2999
2996
|
const e = ((t = p.value) == null ? void 0 : t.clientHeight) ?? 0;
|
|
3000
|
-
return Math.max(
|
|
2997
|
+
return Math.max(dr, e ? e - 180 : 600);
|
|
3001
2998
|
}
|
|
3002
2999
|
function Dt(e) {
|
|
3003
|
-
x.value = Math.round(Math.max(
|
|
3000
|
+
x.value = Math.round(Math.max(dr, Math.min(e, ts())));
|
|
3004
3001
|
}
|
|
3005
3002
|
function ns(e) {
|
|
3006
|
-
e.button === 0 && (e.preventDefault(), F.value = !0, pn = e.clientY, _t =
|
|
3003
|
+
e.button === 0 && (e.preventDefault(), F.value = !0, pn = e.clientY, _t = Tn(), x.value = Math.round(_t), document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", window.addEventListener("pointermove", Ln), window.addEventListener("pointerup", at), window.addEventListener("pointercancel", at));
|
|
3007
3004
|
}
|
|
3008
|
-
function
|
|
3005
|
+
function Ln(e) {
|
|
3009
3006
|
F.value && Dt(_t + (pn - e.clientY));
|
|
3010
3007
|
}
|
|
3011
3008
|
function at() {
|
|
3012
|
-
F.value && (F.value = !1, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove",
|
|
3009
|
+
F.value && (F.value = !1, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove", Ln), window.removeEventListener("pointerup", at), window.removeEventListener("pointercancel", at));
|
|
3013
3010
|
}
|
|
3014
3011
|
function rs() {
|
|
3015
3012
|
x.value = null;
|
|
@@ -3017,12 +3014,12 @@ const Da = Z(
|
|
|
3017
3014
|
function ss(e) {
|
|
3018
3015
|
if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
|
|
3019
3016
|
e.preventDefault();
|
|
3020
|
-
const t = x.value ??
|
|
3017
|
+
const t = x.value ?? Tn();
|
|
3021
3018
|
Dt(t + (e.key === "ArrowUp" ? 16 : -16));
|
|
3022
3019
|
}
|
|
3023
3020
|
function zt() {
|
|
3024
3021
|
if (o.readOnly) return;
|
|
3025
|
-
const e = w.value.language, t = Qe(
|
|
3022
|
+
const e = w.value.language, t = Qe(gn(e), e, "");
|
|
3026
3023
|
L.value.push(t), He(t.id), i("newFile", Ze(t));
|
|
3027
3024
|
}
|
|
3028
3025
|
function He(e) {
|
|
@@ -3034,9 +3031,9 @@ const Da = Z(
|
|
|
3034
3031
|
t && (Ee.value = e, jt(t));
|
|
3035
3032
|
}
|
|
3036
3033
|
function as(e) {
|
|
3037
|
-
st(e, !1), xe.value && k.value === e &&
|
|
3034
|
+
st(e, !1), xe.value && k.value === e && On(!1), I.value === "running" && k.value === e && Mn(!1);
|
|
3038
3035
|
}
|
|
3039
|
-
function
|
|
3036
|
+
function $n(e) {
|
|
3040
3037
|
if (o.readOnly) return;
|
|
3041
3038
|
const t = L.value.findIndex((c) => c.id === e);
|
|
3042
3039
|
if (t === -1) return;
|
|
@@ -3044,7 +3041,7 @@ const Da = Z(
|
|
|
3044
3041
|
const r = L.value.splice(t, 1)[0];
|
|
3045
3042
|
if (!r) return;
|
|
3046
3043
|
if (q.delete(e), i("fileClose", Ze(r)), !L.value.length) {
|
|
3047
|
-
const c = Qe(
|
|
3044
|
+
const c = Qe(gn(r.language), r.language, "");
|
|
3048
3045
|
L.value.push(c), Ee.value = c.id, jt(c), i("newFile", Ze(c));
|
|
3049
3046
|
return;
|
|
3050
3047
|
}
|
|
@@ -3060,10 +3057,10 @@ const Da = Z(
|
|
|
3060
3057
|
]
|
|
3061
3058
|
}), i("update:fileName", e.name), i("update:language", e.language), i("fileSwitch", Ze(e)), wt();
|
|
3062
3059
|
}
|
|
3063
|
-
function
|
|
3060
|
+
function Fn() {
|
|
3064
3061
|
o.readOnly || (Me(void 0), ht(""), wt());
|
|
3065
3062
|
}
|
|
3066
|
-
async function
|
|
3063
|
+
async function Rn() {
|
|
3067
3064
|
var r;
|
|
3068
3065
|
const e = Ne();
|
|
3069
3066
|
let t = !1;
|
|
@@ -3087,7 +3084,7 @@ const Da = Z(
|
|
|
3087
3084
|
}
|
|
3088
3085
|
return t.remove(), r;
|
|
3089
3086
|
}
|
|
3090
|
-
function
|
|
3087
|
+
function _n() {
|
|
3091
3088
|
const e = w.value, t = Ut(e.name, e.language);
|
|
3092
3089
|
Ie.value = t;
|
|
3093
3090
|
const r = new Blob([Ne()], {
|
|
@@ -3096,9 +3093,9 @@ const Da = Z(
|
|
|
3096
3093
|
return c.href = u, c.download = t, c.style.display = "none", document.body.appendChild(c), c.click(), c.remove(), window.setTimeout(() => URL.revokeObjectURL(u), 1e3), i("download", t), t;
|
|
3097
3094
|
}
|
|
3098
3095
|
function is() {
|
|
3099
|
-
qe.value = !qe.value, qe.value && (Se.value = !1,
|
|
3096
|
+
qe.value = !qe.value, qe.value && (Se.value = !1, In());
|
|
3100
3097
|
}
|
|
3101
|
-
async function
|
|
3098
|
+
async function In() {
|
|
3102
3099
|
var e;
|
|
3103
3100
|
if (!Ye.value) {
|
|
3104
3101
|
Ye.value = !0;
|
|
@@ -3136,7 +3133,7 @@ const Da = Z(
|
|
|
3136
3133
|
function Vt(e) {
|
|
3137
3134
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
3138
3135
|
}
|
|
3139
|
-
async function
|
|
3136
|
+
async function Hn(e) {
|
|
3140
3137
|
var t;
|
|
3141
3138
|
try {
|
|
3142
3139
|
const r = await z.readFile(e);
|
|
@@ -3189,7 +3186,7 @@ const Da = Z(
|
|
|
3189
3186
|
se === e && (se = null, dt.value = !1);
|
|
3190
3187
|
}
|
|
3191
3188
|
}
|
|
3192
|
-
async function
|
|
3189
|
+
async function Bn() {
|
|
3193
3190
|
if (!Oe.value)
|
|
3194
3191
|
return h("未配置文件服务端点(filesEndpoint)"), null;
|
|
3195
3192
|
if (W.value) return null;
|
|
@@ -3214,7 +3211,7 @@ const Da = Z(
|
|
|
3214
3211
|
try {
|
|
3215
3212
|
const t = await Pa(o.filesEndpoint, e.id, {
|
|
3216
3213
|
headers: o.filesHeaders
|
|
3217
|
-
}), r =
|
|
3214
|
+
}), r = ar(t.name), u = Qe(yn(t.name), r, t.content);
|
|
3218
3215
|
return L.value.push(u), He(u.id), h(`已从服务端打开文件:${t.name}`), i("fileOpen", { name: u.name, code: t.content, language: r }), !0;
|
|
3219
3216
|
} catch (t) {
|
|
3220
3217
|
return h(`打开服务端文件失败:${kt(t)}`), !1;
|
|
@@ -3234,7 +3231,7 @@ const Da = Z(
|
|
|
3234
3231
|
}
|
|
3235
3232
|
}
|
|
3236
3233
|
}
|
|
3237
|
-
function
|
|
3234
|
+
function Un() {
|
|
3238
3235
|
var e;
|
|
3239
3236
|
(e = T.value) == null || e.click();
|
|
3240
3237
|
}
|
|
@@ -3247,7 +3244,7 @@ const Da = Z(
|
|
|
3247
3244
|
return;
|
|
3248
3245
|
}
|
|
3249
3246
|
try {
|
|
3250
|
-
const c = await r.text(), y =
|
|
3247
|
+
const c = await r.text(), y = ar(r.name), S = Qe(yn(r.name), y, c);
|
|
3251
3248
|
L.value.push(S), He(S.id), h(`已打开文件:${S.name}`), i("fileOpen", { name: S.name, code: c, language: y });
|
|
3252
3249
|
} catch (c) {
|
|
3253
3250
|
const y = c instanceof Error ? c.message : String(c);
|
|
@@ -3264,14 +3261,14 @@ const Da = Z(
|
|
|
3264
3261
|
function bs(e) {
|
|
3265
3262
|
Bt(e.target.value);
|
|
3266
3263
|
}
|
|
3267
|
-
async function
|
|
3264
|
+
async function An(e) {
|
|
3268
3265
|
var t, r;
|
|
3269
|
-
await
|
|
3266
|
+
await jn(), (r = (t = P.value) == null ? void 0 : t.querySelector(`[data-file-id="${e}"]`)) == null || r.focus();
|
|
3270
3267
|
}
|
|
3271
3268
|
function ks(e, t) {
|
|
3272
3269
|
if (e.target !== e.currentTarget) return;
|
|
3273
3270
|
if (e.key === "Enter" || e.key === " ") {
|
|
3274
|
-
e.preventDefault(), He(t.id),
|
|
3271
|
+
e.preventDefault(), He(t.id), An(t.id);
|
|
3275
3272
|
return;
|
|
3276
3273
|
}
|
|
3277
3274
|
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
@@ -3279,7 +3276,7 @@ const Da = Z(
|
|
|
3279
3276
|
const r = L.value.findIndex((y) => y.id === t.id);
|
|
3280
3277
|
if (r < 0) return;
|
|
3281
3278
|
const u = e.key === "ArrowLeft" ? -1 : 1, c = L.value[(r + u + L.value.length) % L.value.length];
|
|
3282
|
-
c && (He(c.id),
|
|
3279
|
+
c && (He(c.id), An(c.id));
|
|
3283
3280
|
}
|
|
3284
3281
|
function wt() {
|
|
3285
3282
|
M == null || M.focus();
|
|
@@ -3302,7 +3299,7 @@ const Da = Z(
|
|
|
3302
3299
|
return z.checkSyntax(Ne());
|
|
3303
3300
|
}
|
|
3304
3301
|
function xs() {
|
|
3305
|
-
return
|
|
3302
|
+
return D(f.value);
|
|
3306
3303
|
}
|
|
3307
3304
|
function Es() {
|
|
3308
3305
|
return M;
|
|
@@ -3314,23 +3311,23 @@ const Da = Z(
|
|
|
3314
3311
|
return Ze(w.value);
|
|
3315
3312
|
}
|
|
3316
3313
|
return n({
|
|
3317
|
-
run:
|
|
3318
|
-
stop:
|
|
3319
|
-
clearOutput:
|
|
3320
|
-
clearCode:
|
|
3314
|
+
run: Cn,
|
|
3315
|
+
stop: Pn,
|
|
3316
|
+
clearOutput: Nn,
|
|
3317
|
+
clearCode: Fn,
|
|
3321
3318
|
newFile: zt,
|
|
3322
3319
|
switchFile: He,
|
|
3323
|
-
closeFile:
|
|
3324
|
-
copyCode:
|
|
3325
|
-
download:
|
|
3326
|
-
openFile:
|
|
3320
|
+
closeFile: $n,
|
|
3321
|
+
copyCode: Rn,
|
|
3322
|
+
download: _n,
|
|
3323
|
+
openFile: Un,
|
|
3327
3324
|
focus: wt,
|
|
3328
3325
|
install: ws,
|
|
3329
3326
|
checkSyntax: Ss,
|
|
3330
3327
|
executeSql: Zr,
|
|
3331
3328
|
getSqlConfig: xs,
|
|
3332
3329
|
openSqlConfig: _r,
|
|
3333
|
-
closeSqlConfig:
|
|
3330
|
+
closeSqlConfig: hn,
|
|
3334
3331
|
getEditorView: Es,
|
|
3335
3332
|
getCode: Ne,
|
|
3336
3333
|
setCode: ht,
|
|
@@ -3339,222 +3336,232 @@ const Da = Z(
|
|
|
3339
3336
|
writeFile: us,
|
|
3340
3337
|
readFile: cs,
|
|
3341
3338
|
listFiles: ds,
|
|
3342
|
-
downloadFile:
|
|
3343
|
-
saveToServer:
|
|
3339
|
+
downloadFile: Hn,
|
|
3340
|
+
saveToServer: Bn,
|
|
3344
3341
|
refreshServerFiles: We,
|
|
3345
3342
|
clearPersistedState: Lr
|
|
3346
3343
|
}), (e, t) => (m(), g("div", {
|
|
3347
3344
|
ref_key: "rootEl",
|
|
3348
3345
|
ref: p,
|
|
3349
|
-
class: ie(["vpe-root",
|
|
3350
|
-
style:
|
|
3346
|
+
class: ie(["vpe-root", Sr.value]),
|
|
3347
|
+
style: Vn(wr.value)
|
|
3351
3348
|
}, [
|
|
3352
3349
|
a.showToolbar ? (m(), g("div", Ya, [
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
j(B(za)),
|
|
3361
|
-
t[19] || (t[19] = l("span", null, "停止", -1))
|
|
3362
|
-
])) : (m(), g("button", {
|
|
3363
|
-
key: 0,
|
|
3364
|
-
class: "vpe-btn vpe-btn--primary",
|
|
3365
|
-
type: "button",
|
|
3366
|
-
title: qr.value,
|
|
3367
|
-
disabled: Cr.value,
|
|
3368
|
-
onClick: qn
|
|
3369
|
-
}, [
|
|
3370
|
-
j(B(Da)),
|
|
3371
|
-
t[18] || (t[18] = l("span", null, "运行", -1))
|
|
3372
|
-
], 8, Xa)),
|
|
3373
|
-
t[31] || (t[31] = l("span", {
|
|
3374
|
-
class: "vpe-divider",
|
|
3375
|
-
"aria-hidden": "true"
|
|
3376
|
-
}, null, -1)),
|
|
3377
|
-
l("button", {
|
|
3378
|
-
class: "vpe-btn",
|
|
3379
|
-
type: "button",
|
|
3380
|
-
title: "新建文件",
|
|
3381
|
-
"aria-label": "新建文件",
|
|
3382
|
-
disabled: a.readOnly,
|
|
3383
|
-
onClick: zt
|
|
3384
|
-
}, [
|
|
3385
|
-
j(B(ja)),
|
|
3386
|
-
t[20] || (t[20] = l("span", null, "新建", -1))
|
|
3387
|
-
], 8, eo),
|
|
3388
|
-
l("button", {
|
|
3389
|
-
class: "vpe-btn",
|
|
3390
|
-
type: "button",
|
|
3391
|
-
title: "打开本地文件",
|
|
3392
|
-
"aria-label": "打开本地文件",
|
|
3393
|
-
disabled: a.readOnly,
|
|
3394
|
-
onClick: Bn
|
|
3395
|
-
}, [
|
|
3396
|
-
j(B(Va)),
|
|
3397
|
-
t[21] || (t[21] = l("span", null, "本地文件", -1))
|
|
3398
|
-
], 8, to),
|
|
3399
|
-
l("button", {
|
|
3400
|
-
class: "vpe-btn",
|
|
3401
|
-
type: "button",
|
|
3402
|
-
title: "下载当前文件",
|
|
3403
|
-
"aria-label": "下载当前文件",
|
|
3404
|
-
onClick: Rn
|
|
3405
|
-
}, [
|
|
3406
|
-
j(B(ur)),
|
|
3407
|
-
t[22] || (t[22] = l("span", null, "下载", -1))
|
|
3408
|
-
]),
|
|
3409
|
-
l("button", {
|
|
3410
|
-
class: "vpe-btn",
|
|
3411
|
-
type: "button",
|
|
3412
|
-
title: "虚拟文件(下载 Python 生成的文件)",
|
|
3413
|
-
"aria-label": "虚拟文件",
|
|
3414
|
-
onClick: is
|
|
3415
|
-
}, [
|
|
3416
|
-
j(B(lr)),
|
|
3417
|
-
t[23] || (t[23] = l("span", null, "虚拟文件", -1))
|
|
3418
|
-
]),
|
|
3419
|
-
Oe.value ? (m(), g("button", {
|
|
3420
|
-
key: 2,
|
|
3421
|
-
class: "vpe-btn",
|
|
3422
|
-
type: "button",
|
|
3423
|
-
title: W.value ? "正在处理服务端文件…" : "保存当前文件到服务端",
|
|
3424
|
-
"aria-label": "保存到服务端",
|
|
3425
|
-
disabled: W.value,
|
|
3426
|
-
onClick: Hn
|
|
3427
|
-
}, [
|
|
3428
|
-
j(B(Ga)),
|
|
3429
|
-
t[24] || (t[24] = l("span", null, "保存", -1))
|
|
3430
|
-
], 8, no)) : N("", !0),
|
|
3431
|
-
Oe.value ? (m(), g("button", {
|
|
3432
|
-
key: 3,
|
|
3433
|
-
class: "vpe-btn",
|
|
3434
|
-
type: "button",
|
|
3435
|
-
title: "查询服务端已保存文件",
|
|
3436
|
-
"aria-label": "已保存文件",
|
|
3437
|
-
onClick: fs
|
|
3438
|
-
}, [
|
|
3439
|
-
j(B(Wa)),
|
|
3440
|
-
t[25] || (t[25] = l("span", null, "已保存文件", -1))
|
|
3441
|
-
])) : N("", !0),
|
|
3442
|
-
a.showSqlConfig && de.value ? (m(), g("button", {
|
|
3443
|
-
key: 4,
|
|
3444
|
-
class: "vpe-btn",
|
|
3445
|
-
type: "button",
|
|
3446
|
-
title: "新建连接",
|
|
3447
|
-
"aria-label": "新建连接",
|
|
3448
|
-
onClick: Hr
|
|
3449
|
-
}, [
|
|
3450
|
-
j(B(Za)),
|
|
3451
|
-
t[26] || (t[26] = l("span", null, "新建连接", -1))
|
|
3452
|
-
])) : N("", !0),
|
|
3453
|
-
l("button", {
|
|
3454
|
-
class: ie(["vpe-btn", { "vpe-btn--copied": me.value }]),
|
|
3455
|
-
type: "button",
|
|
3456
|
-
title: me.value ? "已复制" : "复制代码",
|
|
3457
|
-
"aria-label": me.value ? "已复制" : "复制代码",
|
|
3458
|
-
onClick: Fn
|
|
3459
|
-
}, [
|
|
3460
|
-
me.value ? (m(), Vn(B(Ka), { key: 0 })) : (m(), Vn(B(Qa), { key: 1 })),
|
|
3461
|
-
me.value ? (m(), g("span", so, "已复制")) : (m(), g("span", ao, "复制"))
|
|
3462
|
-
], 10, ro),
|
|
3463
|
-
l("button", {
|
|
3464
|
-
class: "vpe-btn",
|
|
3465
|
-
type: "button",
|
|
3466
|
-
title: "清空当前文件",
|
|
3467
|
-
"aria-label": "清空当前文件",
|
|
3468
|
-
disabled: a.readOnly,
|
|
3469
|
-
onClick: $n
|
|
3470
|
-
}, [
|
|
3471
|
-
j(B(ir)),
|
|
3472
|
-
t[27] || (t[27] = l("span", null, "清空", -1))
|
|
3473
|
-
], 8, oo),
|
|
3474
|
-
t[32] || (t[32] = l("span", {
|
|
3475
|
-
class: "vpe-divider",
|
|
3476
|
-
"aria-hidden": "true"
|
|
3477
|
-
}, null, -1)),
|
|
3478
|
-
l("label", io, [
|
|
3479
|
-
j(B(lr)),
|
|
3480
|
-
J(l("input", {
|
|
3481
|
-
"onUpdate:modelValue": t[0] || (t[0] = (r) => Ie.value = r),
|
|
3482
|
-
class: "vpe-file-input",
|
|
3483
|
-
type: "text",
|
|
3484
|
-
spellcheck: "false",
|
|
3485
|
-
"aria-label": "文件名",
|
|
3486
|
-
onBlur: ys,
|
|
3487
|
-
onKeydown: hs
|
|
3488
|
-
}, null, 544), [
|
|
3489
|
-
[he, Ie.value]
|
|
3490
|
-
])
|
|
3491
|
-
]),
|
|
3492
|
-
t[33] || (t[33] = l("span", {
|
|
3493
|
-
class: "vpe-spacer",
|
|
3494
|
-
"aria-hidden": "true"
|
|
3495
|
-
}, null, -1)),
|
|
3496
|
-
a.showSqlConfig && de.value && (f.value.mode === "http" || f.value.endpoint) ? (m(), g(D, { key: 5 }, [
|
|
3497
|
-
J(l("select", {
|
|
3498
|
-
"onUpdate:modelValue": t[1] || (t[1] = (r) => f.value.connectionId = r),
|
|
3499
|
-
class: "vpe-lang vpe-sql-connection",
|
|
3500
|
-
title: "切换已保存连接",
|
|
3501
|
-
"aria-label": "切换已保存连接",
|
|
3502
|
-
disabled: ze.value,
|
|
3503
|
-
onChange: Ar
|
|
3350
|
+
l("div", Xa, [
|
|
3351
|
+
It.value ? (m(), g("button", {
|
|
3352
|
+
key: 1,
|
|
3353
|
+
class: "vpe-btn vpe-btn--stop",
|
|
3354
|
+
type: "button",
|
|
3355
|
+
title: "中断执行",
|
|
3356
|
+
onClick: Pn
|
|
3504
3357
|
}, [
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3358
|
+
j(B(za)),
|
|
3359
|
+
t[19] || (t[19] = l("span", null, "停止", -1))
|
|
3360
|
+
])) : (m(), g("button", {
|
|
3361
|
+
key: 0,
|
|
3362
|
+
class: "vpe-btn vpe-btn--primary",
|
|
3363
|
+
type: "button",
|
|
3364
|
+
title: qr.value,
|
|
3365
|
+
disabled: Cr.value,
|
|
3366
|
+
onClick: Cn
|
|
3367
|
+
}, [
|
|
3368
|
+
j(B(Da)),
|
|
3369
|
+
t[18] || (t[18] = l("span", null, "运行", -1))
|
|
3370
|
+
], 8, eo)),
|
|
3371
|
+
t[28] || (t[28] = l("span", {
|
|
3372
|
+
class: "vpe-divider",
|
|
3373
|
+
"aria-hidden": "true"
|
|
3374
|
+
}, null, -1)),
|
|
3375
|
+
l("button", {
|
|
3376
|
+
class: "vpe-btn",
|
|
3377
|
+
type: "button",
|
|
3378
|
+
title: "新建文件",
|
|
3379
|
+
"aria-label": "新建文件",
|
|
3380
|
+
disabled: a.readOnly,
|
|
3381
|
+
onClick: zt
|
|
3382
|
+
}, [
|
|
3383
|
+
j(B(ja)),
|
|
3384
|
+
t[20] || (t[20] = l("span", null, "新建", -1))
|
|
3385
|
+
], 8, to),
|
|
3386
|
+
l("button", {
|
|
3387
|
+
class: "vpe-btn",
|
|
3388
|
+
type: "button",
|
|
3389
|
+
title: "打开本地文件",
|
|
3390
|
+
"aria-label": "打开本地文件",
|
|
3391
|
+
disabled: a.readOnly,
|
|
3392
|
+
onClick: Un
|
|
3393
|
+
}, [
|
|
3394
|
+
j(B(Va)),
|
|
3395
|
+
t[21] || (t[21] = l("span", null, "本地文件", -1))
|
|
3396
|
+
], 8, no),
|
|
3397
|
+
l("button", {
|
|
3398
|
+
class: "vpe-btn",
|
|
3399
|
+
type: "button",
|
|
3400
|
+
title: "下载当前文件",
|
|
3401
|
+
"aria-label": "下载当前文件",
|
|
3402
|
+
onClick: _n
|
|
3403
|
+
}, [
|
|
3404
|
+
j(B(cr)),
|
|
3405
|
+
t[22] || (t[22] = l("span", null, "下载", -1))
|
|
3512
3406
|
]),
|
|
3513
3407
|
l("button", {
|
|
3514
|
-
class: "vpe-btn
|
|
3408
|
+
class: "vpe-btn",
|
|
3515
3409
|
type: "button",
|
|
3516
|
-
title: "
|
|
3517
|
-
"aria-label": "
|
|
3518
|
-
onClick:
|
|
3519
|
-
},
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
class: "vpe-
|
|
3526
|
-
|
|
3527
|
-
"
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
[
|
|
3534
|
-
])
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3410
|
+
title: "虚拟文件(下载 Python 生成的文件)",
|
|
3411
|
+
"aria-label": "虚拟文件",
|
|
3412
|
+
onClick: is
|
|
3413
|
+
}, [
|
|
3414
|
+
j(B(ur)),
|
|
3415
|
+
t[23] || (t[23] = l("span", null, "虚拟文件", -1))
|
|
3416
|
+
]),
|
|
3417
|
+
Oe.value ? (m(), g("button", {
|
|
3418
|
+
key: 2,
|
|
3419
|
+
class: "vpe-btn",
|
|
3420
|
+
type: "button",
|
|
3421
|
+
title: W.value ? "正在处理服务端文件…" : "保存当前文件到服务端",
|
|
3422
|
+
"aria-label": "保存到服务端",
|
|
3423
|
+
disabled: W.value,
|
|
3424
|
+
onClick: Bn
|
|
3425
|
+
}, [
|
|
3426
|
+
j(B(Ga)),
|
|
3427
|
+
t[24] || (t[24] = l("span", null, "保存", -1))
|
|
3428
|
+
], 8, ro)) : N("", !0),
|
|
3429
|
+
Oe.value ? (m(), g("button", {
|
|
3430
|
+
key: 3,
|
|
3431
|
+
class: "vpe-btn",
|
|
3432
|
+
type: "button",
|
|
3433
|
+
title: "查询服务端已保存文件",
|
|
3434
|
+
"aria-label": "已保存文件",
|
|
3435
|
+
onClick: fs
|
|
3436
|
+
}, [
|
|
3437
|
+
j(B(Wa)),
|
|
3438
|
+
t[25] || (t[25] = l("span", null, "已保存文件", -1))
|
|
3439
|
+
])) : N("", !0),
|
|
3440
|
+
a.showSqlConfig && de.value ? (m(), g("button", {
|
|
3441
|
+
key: 4,
|
|
3442
|
+
class: "vpe-btn",
|
|
3443
|
+
type: "button",
|
|
3444
|
+
title: "新建连接",
|
|
3445
|
+
"aria-label": "新建连接",
|
|
3446
|
+
onClick: Hr
|
|
3447
|
+
}, [
|
|
3448
|
+
j(B(Za)),
|
|
3449
|
+
t[26] || (t[26] = l("span", null, "新建连接", -1))
|
|
3450
|
+
])) : N("", !0),
|
|
3451
|
+
l("button", {
|
|
3452
|
+
class: ie(["vpe-btn", { "vpe-btn--copied": me.value }]),
|
|
3453
|
+
type: "button",
|
|
3454
|
+
title: me.value ? "已复制" : "复制代码",
|
|
3455
|
+
"aria-label": me.value ? "已复制" : "复制代码",
|
|
3456
|
+
onClick: Rn
|
|
3457
|
+
}, [
|
|
3458
|
+
me.value ? (m(), Qn(B(Ka), { key: 0 })) : (m(), Qn(B(Qa), { key: 1 })),
|
|
3459
|
+
me.value ? (m(), g("span", ao, "已复制")) : (m(), g("span", oo, "复制"))
|
|
3460
|
+
], 10, so),
|
|
3461
|
+
l("button", {
|
|
3462
|
+
class: "vpe-btn",
|
|
3463
|
+
type: "button",
|
|
3464
|
+
title: "清空当前文件",
|
|
3465
|
+
"aria-label": "清空当前文件",
|
|
3466
|
+
disabled: a.readOnly,
|
|
3467
|
+
onClick: Fn
|
|
3468
|
+
}, [
|
|
3469
|
+
j(B(lr)),
|
|
3470
|
+
t[27] || (t[27] = l("span", null, "清空", -1))
|
|
3471
|
+
], 8, io),
|
|
3472
|
+
t[29] || (t[29] = l("span", {
|
|
3473
|
+
class: "vpe-divider",
|
|
3541
3474
|
"aria-hidden": "true"
|
|
3542
3475
|
}, null, -1)),
|
|
3543
|
-
l("
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
],
|
|
3476
|
+
l("label", lo, [
|
|
3477
|
+
j(B(ur)),
|
|
3478
|
+
J(l("input", {
|
|
3479
|
+
"onUpdate:modelValue": t[0] || (t[0] = (r) => Ie.value = r),
|
|
3480
|
+
class: "vpe-file-input",
|
|
3481
|
+
type: "text",
|
|
3482
|
+
spellcheck: "false",
|
|
3483
|
+
"aria-label": "文件名",
|
|
3484
|
+
onBlur: ys,
|
|
3485
|
+
onKeydown: hs
|
|
3486
|
+
}, null, 544), [
|
|
3487
|
+
[he, Ie.value]
|
|
3488
|
+
])
|
|
3489
|
+
])
|
|
3490
|
+
]),
|
|
3491
|
+
l("div", uo, [
|
|
3492
|
+
a.showSqlConfig && de.value && (f.value.mode === "http" || f.value.endpoint) ? (m(), g(A, { key: 0 }, [
|
|
3493
|
+
J(l("select", {
|
|
3494
|
+
"onUpdate:modelValue": t[1] || (t[1] = (r) => f.value.connectionId = r),
|
|
3495
|
+
class: "vpe-select vpe-sql-connection",
|
|
3496
|
+
title: "切换已保存连接",
|
|
3497
|
+
"aria-label": "切换已保存连接",
|
|
3498
|
+
disabled: ze.value,
|
|
3499
|
+
onChange: Ar
|
|
3500
|
+
}, [
|
|
3501
|
+
l("option", po, _(ze.value ? "加载中…" : Ce.value.length ? "选择连接" : "暂无已保存连接"), 1),
|
|
3502
|
+
(m(!0), g(A, null, le(Ce.value, (r) => (m(), g("option", {
|
|
3503
|
+
key: r.id,
|
|
3504
|
+
value: r.id
|
|
3505
|
+
}, _(r.name), 9, fo))), 128))
|
|
3506
|
+
], 40, co), [
|
|
3507
|
+
[St, f.value.connectionId]
|
|
3508
|
+
]),
|
|
3509
|
+
l("button", {
|
|
3510
|
+
class: "vpe-btn vpe-btn--sm vpe-sql-manage",
|
|
3511
|
+
type: "button",
|
|
3512
|
+
title: "管理连接配置",
|
|
3513
|
+
"aria-label": "管理连接配置",
|
|
3514
|
+
onClick: Ir
|
|
3515
|
+
}, " 管理 ")
|
|
3516
|
+
], 64)) : N("", !0),
|
|
3517
|
+
l("div", vo, [
|
|
3518
|
+
l("span", {
|
|
3519
|
+
class: ie(["vpe-status", `vpe-status--${Er.value}`]),
|
|
3520
|
+
title: vn.value
|
|
3521
|
+
}, [
|
|
3522
|
+
t[30] || (t[30] = l("span", {
|
|
3523
|
+
class: "vpe-status-dot",
|
|
3524
|
+
"aria-hidden": "true"
|
|
3525
|
+
}, null, -1)),
|
|
3526
|
+
l("span", go, _(vn.value), 1)
|
|
3527
|
+
], 10, mo),
|
|
3528
|
+
yt.value && fn.value ? (m(), g(A, { key: 0 }, [
|
|
3529
|
+
t[32] || (t[32] = l("span", {
|
|
3530
|
+
class: "vpe-chips-divider",
|
|
3531
|
+
"aria-hidden": "true"
|
|
3532
|
+
}, null, -1)),
|
|
3533
|
+
J(l("select", {
|
|
3534
|
+
"onUpdate:modelValue": t[2] || (t[2] = (r) => Q.value = r),
|
|
3535
|
+
class: "vpe-toolbar-select",
|
|
3536
|
+
title: "Python 运行环境",
|
|
3537
|
+
"aria-label": "Python 运行环境",
|
|
3538
|
+
onChange: Gr
|
|
3539
|
+
}, [...t[31] || (t[31] = [
|
|
3540
|
+
l("option", { value: "browser" }, "浏览器", -1),
|
|
3541
|
+
l("option", { value: "server" }, "服务端", -1)
|
|
3542
|
+
])], 544), [
|
|
3543
|
+
[St, Q.value]
|
|
3544
|
+
])
|
|
3545
|
+
], 64)) : N("", !0),
|
|
3546
|
+
t[33] || (t[33] = l("span", {
|
|
3547
|
+
class: "vpe-chips-divider",
|
|
3548
|
+
"aria-hidden": "true"
|
|
3549
|
+
}, null, -1)),
|
|
3550
|
+
l("select", {
|
|
3551
|
+
class: "vpe-toolbar-select",
|
|
3552
|
+
value: w.value.language,
|
|
3553
|
+
title: "编辑器语言",
|
|
3554
|
+
"aria-label": "编辑器语言",
|
|
3555
|
+
disabled: a.readOnly,
|
|
3556
|
+
onChange: bs
|
|
3557
|
+
}, [
|
|
3558
|
+
(m(!0), g(A, null, le(B(Mt), (r) => (m(), g("option", {
|
|
3559
|
+
key: r.value,
|
|
3560
|
+
value: r.value
|
|
3561
|
+
}, _(r.label), 9, ho))), 128))
|
|
3562
|
+
], 40, yo)
|
|
3563
|
+
])
|
|
3564
|
+
])
|
|
3558
3565
|
])) : N("", !0),
|
|
3559
3566
|
a.showTabs ? (m(), g("div", {
|
|
3560
3567
|
key: 1,
|
|
@@ -3564,7 +3571,7 @@ const Da = Z(
|
|
|
3564
3571
|
role: "tablist",
|
|
3565
3572
|
"aria-label": "文件"
|
|
3566
3573
|
}, [
|
|
3567
|
-
(m(!0), g(
|
|
3574
|
+
(m(!0), g(A, null, le(L.value, (r) => (m(), g("div", {
|
|
3568
3575
|
key: r.id,
|
|
3569
3576
|
class: ie(["vpe-tab", { "vpe-tab--active": r.id === w.value.id }]),
|
|
3570
3577
|
role: "tab",
|
|
@@ -3579,18 +3586,18 @@ const Da = Z(
|
|
|
3579
3586
|
class: ie(["vpe-tab-dot", `vpe-tab-dot--${r.language}`]),
|
|
3580
3587
|
"aria-hidden": "true"
|
|
3581
3588
|
}, null, 2),
|
|
3582
|
-
l("span",
|
|
3589
|
+
l("span", ko, _(r.name), 1),
|
|
3583
3590
|
l("button", {
|
|
3584
3591
|
class: "vpe-tab-close",
|
|
3585
3592
|
type: "button",
|
|
3586
3593
|
title: `关闭 ${r.name}`,
|
|
3587
3594
|
"aria-label": `关闭 ${r.name}`,
|
|
3588
3595
|
disabled: a.readOnly,
|
|
3589
|
-
onClick:
|
|
3596
|
+
onClick: Kn((u) => $n(r.id), ["stop"])
|
|
3590
3597
|
}, [
|
|
3591
3598
|
j(B(lt))
|
|
3592
|
-
], 8,
|
|
3593
|
-
], 42,
|
|
3599
|
+
], 8, wo)
|
|
3600
|
+
], 42, bo))), 128)),
|
|
3594
3601
|
l("button", {
|
|
3595
3602
|
class: "vpe-tabs-add",
|
|
3596
3603
|
type: "button",
|
|
@@ -3600,7 +3607,7 @@ const Da = Z(
|
|
|
3600
3607
|
onClick: zt
|
|
3601
3608
|
}, [
|
|
3602
3609
|
j(B(Ja))
|
|
3603
|
-
], 8,
|
|
3610
|
+
], 8, So)
|
|
3604
3611
|
], 512)) : N("", !0),
|
|
3605
3612
|
l("input", {
|
|
3606
3613
|
ref_key: "fileInputEl",
|
|
@@ -3632,47 +3639,47 @@ const Da = Z(
|
|
|
3632
3639
|
ref_key: "outputPanelEl",
|
|
3633
3640
|
ref: E,
|
|
3634
3641
|
class: "vpe-output",
|
|
3635
|
-
style:
|
|
3642
|
+
style: Vn({ height: xr.value })
|
|
3636
3643
|
}, [
|
|
3637
|
-
l("div",
|
|
3644
|
+
l("div", xo, [
|
|
3638
3645
|
t[34] || (t[34] = l("span", null, "输出", -1)),
|
|
3639
3646
|
l("button", {
|
|
3640
3647
|
class: "vpe-btn vpe-btn--sm",
|
|
3641
3648
|
type: "button",
|
|
3642
3649
|
title: "清空输出",
|
|
3643
|
-
onClick:
|
|
3650
|
+
onClick: Nn
|
|
3644
3651
|
}, [
|
|
3645
|
-
j(B(
|
|
3652
|
+
j(B(lr))
|
|
3646
3653
|
])
|
|
3647
3654
|
]),
|
|
3648
|
-
l("div",
|
|
3649
|
-
ve.value.length ? (m(), g("div",
|
|
3650
|
-
(m(!0), g(
|
|
3655
|
+
l("div", Eo, [
|
|
3656
|
+
ve.value.length ? (m(), g("div", qo, [
|
|
3657
|
+
(m(!0), g(A, null, le(ve.value, (r, u) => (m(), g("section", {
|
|
3651
3658
|
key: u,
|
|
3652
3659
|
class: "vpe-sql-result"
|
|
3653
3660
|
}, [
|
|
3654
|
-
l("div",
|
|
3661
|
+
l("div", Co, [
|
|
3655
3662
|
l("span", null, "结果 " + _(u + 1), 1),
|
|
3656
3663
|
l("span", null, _(Jr(r)), 1)
|
|
3657
3664
|
]),
|
|
3658
|
-
r.columns.length ? (m(), g("div",
|
|
3659
|
-
l("table",
|
|
3665
|
+
r.columns.length ? (m(), g("div", Po, [
|
|
3666
|
+
l("table", Oo, [
|
|
3660
3667
|
l("thead", null, [
|
|
3661
3668
|
l("tr", null, [
|
|
3662
|
-
(m(!0), g(
|
|
3669
|
+
(m(!0), g(A, null, le(r.columns, (c, y) => (m(), g("th", { key: y }, _(c), 1))), 128))
|
|
3663
3670
|
])
|
|
3664
3671
|
]),
|
|
3665
3672
|
l("tbody", null, [
|
|
3666
|
-
(m(!0), g(
|
|
3667
|
-
(m(!0), g(
|
|
3673
|
+
(m(!0), g(A, null, le(r.rows, (c, y) => (m(), g("tr", { key: y }, [
|
|
3674
|
+
(m(!0), g(A, null, le(c, (S, $) => (m(), g("td", {
|
|
3668
3675
|
key: $,
|
|
3669
3676
|
class: ie({ "vpe-sql-null": S === null })
|
|
3670
3677
|
}, _(Kr(S)), 3))), 128))
|
|
3671
3678
|
]))), 128))
|
|
3672
3679
|
])
|
|
3673
3680
|
]),
|
|
3674
|
-
r.rows.length ? N("", !0) : (m(), g("div",
|
|
3675
|
-
])) : (m(), g("div",
|
|
3681
|
+
r.rows.length ? N("", !0) : (m(), g("div", Mo, "查询无数据"))
|
|
3682
|
+
])) : (m(), g("div", No, "影响 " + _(r.affectedRows ?? 0) + " 行", 1))
|
|
3676
3683
|
]))), 128))
|
|
3677
3684
|
])) : N("", !0),
|
|
3678
3685
|
l("pre", {
|
|
@@ -3680,14 +3687,14 @@ const Da = Z(
|
|
|
3680
3687
|
ref: R,
|
|
3681
3688
|
class: "vpe-output-body"
|
|
3682
3689
|
}, [
|
|
3683
|
-
G.value.length ? (m(!0), g(
|
|
3690
|
+
G.value.length ? (m(!0), g(A, { key: 0 }, le(G.value, (r) => (m(), g("span", {
|
|
3684
3691
|
key: r.id,
|
|
3685
3692
|
class: ie(["vpe-line", `vpe-line--${r.stream}`])
|
|
3686
3693
|
}, _(r.text) + `
|
|
3687
|
-
`, 3))), 128)) : (m(), g("span",
|
|
3694
|
+
`, 3))), 128)) : (m(), g("span", To, "暂无输出,点击“运行”或按 Ctrl+Enter 执行代码"))
|
|
3688
3695
|
], 512)
|
|
3689
3696
|
]),
|
|
3690
|
-
Je.value && Ae.value && It.value ? (m(), g("div",
|
|
3697
|
+
Je.value && Ae.value && It.value ? (m(), g("div", Lo, [
|
|
3691
3698
|
t[35] || (t[35] = l("span", {
|
|
3692
3699
|
class: "vpe-terminal-prompt",
|
|
3693
3700
|
"aria-hidden": "true"
|
|
@@ -3699,19 +3706,19 @@ const Da = Z(
|
|
|
3699
3706
|
spellcheck: "false",
|
|
3700
3707
|
placeholder: "输入后按 Enter 发送给 input()",
|
|
3701
3708
|
"aria-label": "标准输入",
|
|
3702
|
-
onKeydown: Ls(
|
|
3703
|
-
}, null, 40,
|
|
3709
|
+
onKeydown: Ls(Kn(En, ["prevent"]), ["enter"])
|
|
3710
|
+
}, null, 40, $o), [
|
|
3704
3711
|
[he, H.value]
|
|
3705
3712
|
]),
|
|
3706
3713
|
l("button", {
|
|
3707
3714
|
class: "vpe-btn vpe-btn--sm",
|
|
3708
3715
|
type: "button",
|
|
3709
|
-
onClick:
|
|
3716
|
+
onClick: En
|
|
3710
3717
|
}, " 发送 ")
|
|
3711
3718
|
])) : N("", !0)
|
|
3712
3719
|
], 4)) : N("", !0),
|
|
3713
|
-
qe.value ? (m(), g("div",
|
|
3714
|
-
l("div",
|
|
3720
|
+
qe.value ? (m(), g("div", Fo, [
|
|
3721
|
+
l("div", Ro, [
|
|
3715
3722
|
t[36] || (t[36] = l("span", { class: "vpe-fs-title" }, "虚拟文件", -1)),
|
|
3716
3723
|
t[37] || (t[37] = l("span", {
|
|
3717
3724
|
class: "vpe-spacer",
|
|
@@ -3722,8 +3729,8 @@ const Da = Z(
|
|
|
3722
3729
|
type: "button",
|
|
3723
3730
|
title: "刷新文件列表",
|
|
3724
3731
|
disabled: Ye.value,
|
|
3725
|
-
onClick:
|
|
3726
|
-
}, " 刷新 ", 8,
|
|
3732
|
+
onClick: In
|
|
3733
|
+
}, " 刷新 ", 8, _o),
|
|
3727
3734
|
l("button", {
|
|
3728
3735
|
class: "vpe-btn vpe-btn--sm",
|
|
3729
3736
|
type: "button",
|
|
@@ -3734,34 +3741,34 @@ const Da = Z(
|
|
|
3734
3741
|
j(B(lt))
|
|
3735
3742
|
])
|
|
3736
3743
|
]),
|
|
3737
|
-
l("div",
|
|
3738
|
-
Ye.value ? (m(), g("div",
|
|
3739
|
-
Xe.value.length ? N("", !0) : (m(), g("div",
|
|
3740
|
-
(m(!0), g(
|
|
3744
|
+
l("div", Io, [
|
|
3745
|
+
Ye.value ? (m(), g("div", Ho, "正在读取虚拟文件…")) : (m(), g(A, { key: 1 }, [
|
|
3746
|
+
Xe.value.length ? N("", !0) : (m(), g("div", Bo, " 暂无文件。运行 Python 代码创建文件后再刷新。 ")),
|
|
3747
|
+
(m(!0), g(A, null, le(Xe.value, (r) => (m(), g("div", {
|
|
3741
3748
|
key: r.path,
|
|
3742
3749
|
class: ie(["vpe-fs-item", { "vpe-fs-item--dir": r.isDirectory }])
|
|
3743
3750
|
}, [
|
|
3744
3751
|
l("span", {
|
|
3745
3752
|
class: "vpe-fs-name",
|
|
3746
3753
|
title: r.path
|
|
3747
|
-
}, _(r.path), 9,
|
|
3748
|
-
l("span",
|
|
3754
|
+
}, _(r.path), 9, Uo),
|
|
3755
|
+
l("span", Ao, _(r.isDirectory ? "目录" : Vt(r.size)), 1),
|
|
3749
3756
|
r.isDirectory ? N("", !0) : (m(), g("button", {
|
|
3750
3757
|
key: 0,
|
|
3751
3758
|
class: "vpe-btn vpe-btn--sm",
|
|
3752
3759
|
type: "button",
|
|
3753
3760
|
title: `下载 ${r.name}`,
|
|
3754
3761
|
"aria-label": `下载 ${r.name}`,
|
|
3755
|
-
onClick: (u) =>
|
|
3762
|
+
onClick: (u) => Hn(r.path)
|
|
3756
3763
|
}, [
|
|
3757
|
-
j(B(
|
|
3758
|
-
], 8,
|
|
3764
|
+
j(B(cr))
|
|
3765
|
+
], 8, Do))
|
|
3759
3766
|
], 2))), 128))
|
|
3760
3767
|
], 64))
|
|
3761
3768
|
])
|
|
3762
3769
|
])) : N("", !0),
|
|
3763
|
-
Se.value && Oe.value ? (m(), g("div",
|
|
3764
|
-
l("div",
|
|
3770
|
+
Se.value && Oe.value ? (m(), g("div", zo, [
|
|
3771
|
+
l("div", jo, [
|
|
3765
3772
|
t[38] || (t[38] = l("span", { class: "vpe-fs-title" }, "服务端文件", -1)),
|
|
3766
3773
|
t[39] || (t[39] = l("span", {
|
|
3767
3774
|
class: "vpe-spacer",
|
|
@@ -3773,7 +3780,7 @@ const Da = Z(
|
|
|
3773
3780
|
title: "刷新文件列表",
|
|
3774
3781
|
disabled: dt.value,
|
|
3775
3782
|
onClick: t[5] || (t[5] = (r) => We())
|
|
3776
|
-
}, " 刷新 ", 8,
|
|
3783
|
+
}, " 刷新 ", 8, Vo),
|
|
3777
3784
|
l("button", {
|
|
3778
3785
|
class: "vpe-btn vpe-btn--sm",
|
|
3779
3786
|
type: "button",
|
|
@@ -3784,43 +3791,43 @@ const Da = Z(
|
|
|
3784
3791
|
j(B(lt))
|
|
3785
3792
|
])
|
|
3786
3793
|
]),
|
|
3787
|
-
l("div",
|
|
3788
|
-
dt.value ? (m(), g("div",
|
|
3789
|
-
!et.value.length && !De.value ? (m(), g("div",
|
|
3790
|
-
(m(!0), g(
|
|
3794
|
+
l("div", Qo, [
|
|
3795
|
+
dt.value ? (m(), g("div", Ko, "正在读取服务端文件…")) : (m(), g(A, { key: 1 }, [
|
|
3796
|
+
!et.value.length && !De.value ? (m(), g("div", Jo, " 暂无已保存文件。点击工具栏“保存”按钮把当前文件保存到服务端。 ")) : N("", !0),
|
|
3797
|
+
(m(!0), g(A, null, le(et.value, (r) => (m(), g("div", {
|
|
3791
3798
|
key: r.id,
|
|
3792
3799
|
class: "vpe-fs-item"
|
|
3793
3800
|
}, [
|
|
3794
3801
|
l("span", {
|
|
3795
3802
|
class: "vpe-fs-name",
|
|
3796
3803
|
title: r.name
|
|
3797
|
-
}, _(r.name), 9,
|
|
3804
|
+
}, _(r.name), 9, Zo),
|
|
3798
3805
|
l("span", {
|
|
3799
3806
|
class: "vpe-fs-size",
|
|
3800
3807
|
title: ps(r.updatedAt)
|
|
3801
|
-
}, _(Vt(r.size)), 9,
|
|
3808
|
+
}, _(Vt(r.size)), 9, Go),
|
|
3802
3809
|
l("button", {
|
|
3803
3810
|
class: "vpe-btn vpe-btn--sm",
|
|
3804
3811
|
type: "button",
|
|
3805
3812
|
title: `打开 ${r.name}`,
|
|
3806
3813
|
disabled: W.value,
|
|
3807
3814
|
onClick: (u) => vs(r)
|
|
3808
|
-
}, " 打开 ", 8,
|
|
3815
|
+
}, " 打开 ", 8, Wo),
|
|
3809
3816
|
l("button", {
|
|
3810
3817
|
class: "vpe-btn vpe-btn--sm",
|
|
3811
3818
|
type: "button",
|
|
3812
3819
|
title: `删除 ${r.name}`,
|
|
3813
3820
|
disabled: W.value,
|
|
3814
3821
|
onClick: (u) => ms(r)
|
|
3815
|
-
}, " 删除 ", 8,
|
|
3822
|
+
}, " 删除 ", 8, Yo)
|
|
3816
3823
|
]))), 128)),
|
|
3817
|
-
De.value ? (m(), g("p",
|
|
3824
|
+
De.value ? (m(), g("p", Xo, _(De.value), 1)) : N("", !0)
|
|
3818
3825
|
], 64))
|
|
3819
3826
|
])
|
|
3820
3827
|
])) : N("", !0),
|
|
3821
|
-
Fe.value && de.value ? (m(), g("div",
|
|
3822
|
-
l("div",
|
|
3823
|
-
l("span",
|
|
3828
|
+
Fe.value && de.value ? (m(), g("div", ei, [
|
|
3829
|
+
l("div", ti, [
|
|
3830
|
+
l("span", ni, _(Pr.value), 1),
|
|
3824
3831
|
t[40] || (t[40] = l("span", {
|
|
3825
3832
|
class: "vpe-spacer",
|
|
3826
3833
|
"aria-hidden": "true"
|
|
@@ -3830,13 +3837,13 @@ const Da = Z(
|
|
|
3830
3837
|
type: "button",
|
|
3831
3838
|
title: "关闭 SQL 连接配置",
|
|
3832
3839
|
"aria-label": "关闭 SQL 连接配置",
|
|
3833
|
-
onClick:
|
|
3840
|
+
onClick: hn
|
|
3834
3841
|
}, [
|
|
3835
3842
|
j(B(lt))
|
|
3836
3843
|
])
|
|
3837
3844
|
]),
|
|
3838
|
-
l("div",
|
|
3839
|
-
l("label",
|
|
3845
|
+
l("div", ri, [
|
|
3846
|
+
l("label", si, [
|
|
3840
3847
|
t[42] || (t[42] = l("span", { class: "vpe-sql-label" }, "执行方式", -1)),
|
|
3841
3848
|
J(l("select", {
|
|
3842
3849
|
"onUpdate:modelValue": t[7] || (t[7] = (r) => f.value.mode = r),
|
|
@@ -3849,8 +3856,8 @@ const Da = Z(
|
|
|
3849
3856
|
[St, f.value.mode]
|
|
3850
3857
|
])
|
|
3851
3858
|
]),
|
|
3852
|
-
f.value.mode === "sqlite" ? (m(), g(
|
|
3853
|
-
l("label",
|
|
3859
|
+
f.value.mode === "sqlite" ? (m(), g(A, { key: 0 }, [
|
|
3860
|
+
l("label", ai, [
|
|
3854
3861
|
t[43] || (t[43] = l("span", { class: "vpe-sql-label" }, "数据库文件", -1)),
|
|
3855
3862
|
J(l("input", {
|
|
3856
3863
|
"onUpdate:modelValue": t[8] || (t[8] = (r) => f.value.connection.database = r),
|
|
@@ -3864,8 +3871,8 @@ const Da = Z(
|
|
|
3864
3871
|
])
|
|
3865
3872
|
]),
|
|
3866
3873
|
t[44] || (t[44] = l("p", { class: "vpe-sql-hint" }, " SQLite 在浏览器内运行,数据仅保存在当前页面内存;“停止”或刷新后会丢失。 ", -1))
|
|
3867
|
-
], 64)) : (m(), g(
|
|
3868
|
-
l("label",
|
|
3874
|
+
], 64)) : (m(), g(A, { key: 1 }, [
|
|
3875
|
+
l("label", oi, [
|
|
3869
3876
|
t[45] || (t[45] = l("span", { class: "vpe-sql-label" }, "连接名称", -1)),
|
|
3870
3877
|
J(l("input", {
|
|
3871
3878
|
"onUpdate:modelValue": t[9] || (t[9] = (r) => ee.value = r),
|
|
@@ -3877,23 +3884,23 @@ const Da = Z(
|
|
|
3877
3884
|
[he, ee.value]
|
|
3878
3885
|
])
|
|
3879
3886
|
]),
|
|
3880
|
-
l("label",
|
|
3887
|
+
l("label", ii, [
|
|
3881
3888
|
t[46] || (t[46] = l("span", { class: "vpe-sql-label" }, "数据库类型", -1)),
|
|
3882
3889
|
J(l("select", {
|
|
3883
3890
|
"onUpdate:modelValue": t[10] || (t[10] = (r) => f.value.connection.dialect = r),
|
|
3884
3891
|
class: "vpe-sql-input",
|
|
3885
3892
|
onChange: Ur
|
|
3886
3893
|
}, [
|
|
3887
|
-
(m(!0), g(
|
|
3894
|
+
(m(!0), g(A, null, le(B(ut), (r) => (m(), g("option", {
|
|
3888
3895
|
key: r.value,
|
|
3889
3896
|
value: r.value
|
|
3890
|
-
}, _(r.label), 9,
|
|
3897
|
+
}, _(r.label), 9, li))), 128))
|
|
3891
3898
|
], 544), [
|
|
3892
3899
|
[St, f.value.connection.dialect]
|
|
3893
3900
|
])
|
|
3894
3901
|
]),
|
|
3895
|
-
l("div",
|
|
3896
|
-
l("label",
|
|
3902
|
+
l("div", ui, [
|
|
3903
|
+
l("label", ci, [
|
|
3897
3904
|
t[47] || (t[47] = l("span", { class: "vpe-sql-label" }, "主机", -1)),
|
|
3898
3905
|
J(l("input", {
|
|
3899
3906
|
"onUpdate:modelValue": t[11] || (t[11] = (r) => f.value.connection.host = r),
|
|
@@ -3906,7 +3913,7 @@ const Da = Z(
|
|
|
3906
3913
|
[he, f.value.connection.host]
|
|
3907
3914
|
])
|
|
3908
3915
|
]),
|
|
3909
|
-
l("label",
|
|
3916
|
+
l("label", di, [
|
|
3910
3917
|
t[48] || (t[48] = l("span", { class: "vpe-sql-label" }, "端口", -1)),
|
|
3911
3918
|
J(l("input", {
|
|
3912
3919
|
"onUpdate:modelValue": t[12] || (t[12] = (r) => f.value.connection.port = r),
|
|
@@ -3926,8 +3933,8 @@ const Da = Z(
|
|
|
3926
3933
|
])
|
|
3927
3934
|
])
|
|
3928
3935
|
]),
|
|
3929
|
-
l("div",
|
|
3930
|
-
l("label",
|
|
3936
|
+
l("div", pi, [
|
|
3937
|
+
l("label", fi, [
|
|
3931
3938
|
t[49] || (t[49] = l("span", { class: "vpe-sql-label" }, "用户名", -1)),
|
|
3932
3939
|
J(l("input", {
|
|
3933
3940
|
"onUpdate:modelValue": t[13] || (t[13] = (r) => f.value.connection.user = r),
|
|
@@ -3940,7 +3947,7 @@ const Da = Z(
|
|
|
3940
3947
|
[he, f.value.connection.user]
|
|
3941
3948
|
])
|
|
3942
3949
|
]),
|
|
3943
|
-
l("label",
|
|
3950
|
+
l("label", vi, [
|
|
3944
3951
|
t[50] || (t[50] = l("span", { class: "vpe-sql-label" }, "密码", -1)),
|
|
3945
3952
|
J(l("input", {
|
|
3946
3953
|
"onUpdate:modelValue": t[14] || (t[14] = (r) => f.value.connection.password = r),
|
|
@@ -3949,12 +3956,12 @@ const Da = Z(
|
|
|
3949
3956
|
autocomplete: "new-password",
|
|
3950
3957
|
placeholder: f.value.connectionId ? "已保存(留空不修改)" : "",
|
|
3951
3958
|
onChange: ye
|
|
3952
|
-
}, null, 40,
|
|
3959
|
+
}, null, 40, mi), [
|
|
3953
3960
|
[he, f.value.connection.password]
|
|
3954
3961
|
])
|
|
3955
3962
|
])
|
|
3956
3963
|
]),
|
|
3957
|
-
l("label",
|
|
3964
|
+
l("label", gi, [
|
|
3958
3965
|
t[51] || (t[51] = l("span", { class: "vpe-sql-label" }, "数据库名", -1)),
|
|
3959
3966
|
J(l("input", {
|
|
3960
3967
|
"onUpdate:modelValue": t[15] || (t[15] = (r) => f.value.connection.database = r),
|
|
@@ -3967,7 +3974,7 @@ const Da = Z(
|
|
|
3967
3974
|
[he, f.value.connection.database]
|
|
3968
3975
|
])
|
|
3969
3976
|
]),
|
|
3970
|
-
a.sqlEndpointLocked ? N("", !0) : (m(), g("label",
|
|
3977
|
+
a.sqlEndpointLocked ? N("", !0) : (m(), g("label", yi, [
|
|
3971
3978
|
t[52] || (t[52] = l("span", { class: "vpe-sql-label" }, "服务端点", -1)),
|
|
3972
3979
|
J(l("input", {
|
|
3973
3980
|
"onUpdate:modelValue": t[16] || (t[16] = (r) => f.value.endpoint = r),
|
|
@@ -3980,35 +3987,35 @@ const Da = Z(
|
|
|
3980
3987
|
[he, f.value.endpoint]
|
|
3981
3988
|
])
|
|
3982
3989
|
])),
|
|
3983
|
-
a.sqlEndpointLocked ? (m(), g("p",
|
|
3990
|
+
a.sqlEndpointLocked ? (m(), g("p", hi, "服务端点由系统预置,无需填写。")) : N("", !0),
|
|
3984
3991
|
t[53] || (t[53] = l("p", { class: "vpe-sql-hint" }, " 执行时会把连接信息与 SQL POST 到该端点,由后端网关连接真实数据库。建议使用 HTTPS,并避免在前端配置高权限账号。 ", -1))
|
|
3985
3992
|
], 64)),
|
|
3986
|
-
l("div",
|
|
3993
|
+
l("div", bi, [
|
|
3987
3994
|
l("button", {
|
|
3988
3995
|
class: "vpe-btn vpe-btn--primary",
|
|
3989
3996
|
type: "button",
|
|
3990
3997
|
disabled: Re.value,
|
|
3991
3998
|
onClick: Qr
|
|
3992
|
-
}, _(Re.value ? "测试中…" : "测试连接"), 9,
|
|
3999
|
+
}, _(Re.value ? "测试中…" : "测试连接"), 9, ki),
|
|
3993
4000
|
f.value.mode === "http" ? (m(), g("button", {
|
|
3994
4001
|
key: 0,
|
|
3995
4002
|
class: "vpe-btn",
|
|
3996
4003
|
type: "button",
|
|
3997
4004
|
disabled: te.value,
|
|
3998
4005
|
onClick: zr
|
|
3999
|
-
}, " 保存 ", 8,
|
|
4006
|
+
}, " 保存 ", 8, wi)) : N("", !0),
|
|
4000
4007
|
f.value.mode === "http" && f.value.connectionId ? (m(), g("button", {
|
|
4001
4008
|
key: 1,
|
|
4002
4009
|
class: "vpe-btn",
|
|
4003
4010
|
type: "button",
|
|
4004
4011
|
disabled: te.value,
|
|
4005
4012
|
onClick: jr
|
|
4006
|
-
}, " 删除 ", 8,
|
|
4013
|
+
}, " 删除 ", 8, Si)) : N("", !0),
|
|
4007
4014
|
tt.value ? (m(), g("span", {
|
|
4008
4015
|
key: 2,
|
|
4009
4016
|
class: ie(["vpe-sql-test", pt.value ? "vpe-sql-test--ok" : "vpe-sql-test--err"])
|
|
4010
4017
|
}, _(tt.value), 3)) : N("", !0),
|
|
4011
|
-
f.value.mode === "http" && Pe.value ? (m(), g("span",
|
|
4018
|
+
f.value.mode === "http" && Pe.value ? (m(), g("span", xi, _(Pe.value), 1)) : N("", !0),
|
|
4012
4019
|
f.value.mode === "http" && ne.value ? (m(), g("span", {
|
|
4013
4020
|
key: 4,
|
|
4014
4021
|
class: ie(["vpe-sql-test", je.value ? "vpe-sql-test--ok" : "vpe-sql-test--err"])
|
|
@@ -4016,8 +4023,8 @@ const Da = Z(
|
|
|
4016
4023
|
])
|
|
4017
4024
|
])
|
|
4018
4025
|
])) : N("", !0),
|
|
4019
|
-
_e.value && de.value ? (m(), g("div",
|
|
4020
|
-
l("div",
|
|
4026
|
+
_e.value && de.value ? (m(), g("div", Ei, [
|
|
4027
|
+
l("div", qi, [
|
|
4021
4028
|
t[54] || (t[54] = l("span", { class: "vpe-fs-title" }, "连接管理", -1)),
|
|
4022
4029
|
t[55] || (t[55] = l("span", {
|
|
4023
4030
|
class: "vpe-spacer",
|
|
@@ -4029,7 +4036,7 @@ const Da = Z(
|
|
|
4029
4036
|
title: "刷新连接列表",
|
|
4030
4037
|
disabled: ze.value,
|
|
4031
4038
|
onClick: fe
|
|
4032
|
-
}, " 刷新 ", 8,
|
|
4039
|
+
}, " 刷新 ", 8, Ci),
|
|
4033
4040
|
l("button", {
|
|
4034
4041
|
class: "vpe-btn vpe-btn--sm",
|
|
4035
4042
|
type: "button",
|
|
@@ -4040,24 +4047,24 @@ const Da = Z(
|
|
|
4040
4047
|
j(B(lt))
|
|
4041
4048
|
])
|
|
4042
4049
|
]),
|
|
4043
|
-
l("div",
|
|
4044
|
-
ze.value ? (m(), g("div",
|
|
4045
|
-
Ce.value.length ? N("", !0) : (m(), g("div",
|
|
4046
|
-
(m(!0), g(
|
|
4050
|
+
l("div", Pi, [
|
|
4051
|
+
ze.value ? (m(), g("div", Oi, "正在读取连接…")) : (m(), g(A, { key: 1 }, [
|
|
4052
|
+
Ce.value.length ? N("", !0) : (m(), g("div", Mi, " 暂无已保存连接,点击工具栏“新建连接”创建。 ")),
|
|
4053
|
+
(m(!0), g(A, null, le(Ce.value, (r) => (m(), g("div", {
|
|
4047
4054
|
key: r.id,
|
|
4048
4055
|
class: "vpe-sql-manager-item"
|
|
4049
4056
|
}, [
|
|
4050
|
-
l("div",
|
|
4057
|
+
l("div", Ni, [
|
|
4051
4058
|
l("span", {
|
|
4052
4059
|
class: "vpe-sql-manager-name",
|
|
4053
4060
|
title: r.name
|
|
4054
|
-
}, _(r.name), 9,
|
|
4055
|
-
l("span",
|
|
4061
|
+
}, _(r.name), 9, Ti),
|
|
4062
|
+
l("span", Li, [
|
|
4056
4063
|
Qt(_(r.dialect), 1),
|
|
4057
|
-
r.database ? (m(), g(
|
|
4064
|
+
r.database ? (m(), g(A, { key: 0 }, [
|
|
4058
4065
|
Qt(" · " + _(r.database), 1)
|
|
4059
4066
|
], 64)) : N("", !0),
|
|
4060
|
-
r.host ? (m(), g(
|
|
4067
|
+
r.host ? (m(), g(A, { key: 1 }, [
|
|
4061
4068
|
Qt(" · " + _(r.host), 1)
|
|
4062
4069
|
], 64)) : N("", !0)
|
|
4063
4070
|
])
|
|
@@ -4067,16 +4074,16 @@ const Da = Z(
|
|
|
4067
4074
|
type: "button",
|
|
4068
4075
|
title: "编辑连接",
|
|
4069
4076
|
onClick: (u) => Dr(r)
|
|
4070
|
-
}, " 编辑 ", 8,
|
|
4077
|
+
}, " 编辑 ", 8, $i),
|
|
4071
4078
|
l("button", {
|
|
4072
4079
|
class: "vpe-btn vpe-btn--sm",
|
|
4073
4080
|
type: "button",
|
|
4074
4081
|
title: "删除连接",
|
|
4075
4082
|
disabled: te.value,
|
|
4076
4083
|
onClick: (u) => Vr(r)
|
|
4077
|
-
}, " 删除 ", 8,
|
|
4084
|
+
}, " 删除 ", 8, Fi)
|
|
4078
4085
|
]))), 128)),
|
|
4079
|
-
Pe.value ? (m(), g("p",
|
|
4086
|
+
Pe.value ? (m(), g("p", Ri, _(Pe.value), 1)) : N("", !0),
|
|
4080
4087
|
Ve.value ? (m(), g("p", {
|
|
4081
4088
|
key: 2,
|
|
4082
4089
|
class: ie(["vpe-sql-hint", ft.value ? "vpe-sql-hint--ok" : "vpe-sql-hint--error"])
|
|
@@ -4087,7 +4094,7 @@ const Da = Z(
|
|
|
4087
4094
|
], 6));
|
|
4088
4095
|
}
|
|
4089
4096
|
});
|
|
4090
|
-
function
|
|
4097
|
+
function Wi(a = {}) {
|
|
4091
4098
|
var Ae;
|
|
4092
4099
|
const n = rn(a.pyodideUrl ? { pyodideUrl: a.pyodideUrl } : void 0), s = C(n.status), o = C(""), i = C([]);
|
|
4093
4100
|
let p = 0;
|
|
@@ -4177,37 +4184,37 @@ function Ki(a = {}) {
|
|
|
4177
4184
|
ready: () => n.waitReady()
|
|
4178
4185
|
};
|
|
4179
4186
|
}
|
|
4180
|
-
const
|
|
4187
|
+
const Yi = _i;
|
|
4181
4188
|
export {
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4189
|
+
vr as DEFAULT_PYODIDE_URL,
|
|
4190
|
+
Gi as DEFAULT_SQL_CONFIG,
|
|
4191
|
+
or as EDITOR_THEMES,
|
|
4185
4192
|
fa as MONO_FONT_STACK,
|
|
4186
4193
|
Sa as PyodideRunner,
|
|
4187
|
-
|
|
4194
|
+
Yi as PythonEditor,
|
|
4188
4195
|
ut as SQL_DIALECT_OPTIONS,
|
|
4189
4196
|
ya as createEditor,
|
|
4190
4197
|
Ta as createPythonSession,
|
|
4191
|
-
|
|
4198
|
+
_i as default,
|
|
4192
4199
|
Oa as deleteServerFile,
|
|
4193
|
-
|
|
4194
|
-
|
|
4200
|
+
sr as deleteSqlConnection,
|
|
4201
|
+
rr as getDefaultSqlPort,
|
|
4195
4202
|
rn as getRunner,
|
|
4196
4203
|
Aa as getThemeOption,
|
|
4197
|
-
|
|
4198
|
-
|
|
4204
|
+
Yn as interruptPythonSession,
|
|
4205
|
+
ir as isDarkTheme,
|
|
4199
4206
|
qa as listServerFiles,
|
|
4200
4207
|
Ba as listSqlConnections,
|
|
4201
4208
|
ha as makePythonLinter,
|
|
4202
|
-
|
|
4209
|
+
D as normalizeSqlConfig,
|
|
4203
4210
|
La as pollPythonSession,
|
|
4204
4211
|
Pa as readServerFile,
|
|
4205
|
-
|
|
4206
|
-
|
|
4212
|
+
Zi as runPythonOnServer,
|
|
4213
|
+
yr as runSql,
|
|
4207
4214
|
Ca as saveServerFile,
|
|
4208
4215
|
Ua as saveSqlConnection,
|
|
4209
4216
|
$a as sendPythonSessionInput,
|
|
4210
|
-
|
|
4217
|
+
fr as setErrorLines,
|
|
4211
4218
|
Ha as testSqlConnection,
|
|
4212
|
-
|
|
4219
|
+
Wi as usePyodide
|
|
4213
4220
|
};
|