adverich-kun-ui 0.1.514 → 0.1.515
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as i, computed as h, watch as O, nextTick as
|
|
1
|
+
import { ref as i, computed as h, watch as O, nextTick as g, onMounted as A, onBeforeUnmount as F } from "vue";
|
|
2
2
|
function $(t, H, l) {
|
|
3
|
-
const s = i(""),
|
|
4
|
-
function
|
|
3
|
+
const s = i(""), m = i(t.modelValue), x = i(!1), a = i([]), c = h(() => t.formatModel === "json" || t.formatModel === "auto" && typeof t.modelValue == "object");
|
|
4
|
+
function v(e) {
|
|
5
5
|
if (c.value && e != null)
|
|
6
6
|
try {
|
|
7
7
|
return JSON.stringify(e, null, 2);
|
|
@@ -15,18 +15,18 @@ function $(t, H, l) {
|
|
|
15
15
|
try {
|
|
16
16
|
return JSON.parse(e);
|
|
17
17
|
} catch {
|
|
18
|
-
return
|
|
18
|
+
return e;
|
|
19
19
|
}
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
22
|
function I(e) {
|
|
23
23
|
const u = y(e);
|
|
24
|
-
|
|
24
|
+
m.value = u, H("update:modelValue", u);
|
|
25
25
|
}
|
|
26
26
|
O(
|
|
27
27
|
() => t.modelValue,
|
|
28
28
|
(e) => {
|
|
29
|
-
|
|
29
|
+
m.value = e, s.value = v(e), t.autoGrow && g(() => d());
|
|
30
30
|
},
|
|
31
31
|
{ immediate: !0, deep: !0 }
|
|
32
32
|
);
|
|
@@ -48,13 +48,13 @@ function $(t, H, l) {
|
|
|
48
48
|
const n = u.selectionStart, o = s.value, r = " ", f = o.slice(0, n), E = o.slice(n), N = f.lastIndexOf(`
|
|
49
49
|
`) + 1, w = `
|
|
50
50
|
${((V = f.slice(N).match(/^\s*/)) == null ? void 0 : V[0]) ?? ""}${r}`;
|
|
51
|
-
s.value = f + w + E,
|
|
51
|
+
s.value = f + w + E, g(() => {
|
|
52
52
|
const S = n + w.length;
|
|
53
53
|
u.setSelectionRange(S, S);
|
|
54
54
|
}), e.preventDefault();
|
|
55
55
|
}
|
|
56
56
|
A(() => {
|
|
57
|
-
s.value =
|
|
57
|
+
s.value = v(t.modelValue), g(() => {
|
|
58
58
|
t.autoGrow && d();
|
|
59
59
|
});
|
|
60
60
|
}), F(() => {
|