adverich-kun-ui 0.1.406 → 0.1.408
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.
|
@@ -43,9 +43,9 @@ const be = { class: "relative" }, ye = {
|
|
|
43
43
|
var T;
|
|
44
44
|
if (!o.jsonMode) return;
|
|
45
45
|
e.preventDefault();
|
|
46
|
-
const
|
|
47
|
-
` + g +
|
|
48
|
-
|
|
46
|
+
const n = e.target, t = n.selectionStart, g = ((T = n.value.substring(0, t).match(/(^|\n)(\s*)[^\n]*$/)) == null ? void 0 : T[2]) ?? "", M = n.value.slice(0, t) + `
|
|
47
|
+
` + g + n.value.slice(t);
|
|
48
|
+
n.value = M, z(M), ve(() => n.setSelectionRange(t + 1 + g.length, t + 1 + g.length));
|
|
49
49
|
}, Q = () => {
|
|
50
50
|
c.value = !0, C("update:focused", !0);
|
|
51
51
|
}, U = () => {
|
|
@@ -98,9 +98,9 @@ const be = { class: "relative" }, ye = {
|
|
|
98
98
|
}, blur: () => {
|
|
99
99
|
var e;
|
|
100
100
|
return (e = p.value) == null ? void 0 : e.blur();
|
|
101
|
-
}, props: o }, oe = R,
|
|
102
|
-
const { class: e, ...
|
|
103
|
-
return
|
|
101
|
+
}, props: o }, oe = R, ne = R, te = a(() => {
|
|
102
|
+
const { class: e, ...n } = K;
|
|
103
|
+
return n;
|
|
104
104
|
});
|
|
105
105
|
return G({
|
|
106
106
|
validate: j,
|
|
@@ -113,11 +113,11 @@ const be = { class: "relative" }, ye = {
|
|
|
113
113
|
var e;
|
|
114
114
|
return (e = p.value) == null ? void 0 : e.focus();
|
|
115
115
|
}
|
|
116
|
-
}), (e,
|
|
116
|
+
}), (e, n) => (r(), l("div", E({
|
|
117
117
|
class: X.value,
|
|
118
118
|
ref_key: "rootRef",
|
|
119
119
|
ref: B
|
|
120
|
-
},
|
|
120
|
+
}, te.value), [
|
|
121
121
|
i(e.$slots, "label", E({ for: N }, ee), () => [
|
|
122
122
|
e.label ? (r(), l("label", {
|
|
123
123
|
key: 0,
|
|
@@ -128,7 +128,7 @@ const be = { class: "relative" }, ye = {
|
|
|
128
128
|
e.prependIcon || e.$slots.prepend ? (r(), l("div", ye, [
|
|
129
129
|
i(e.$slots, "prepend", S(V(s(oe))), () => [
|
|
130
130
|
d("div", {
|
|
131
|
-
onClick:
|
|
131
|
+
onClick: n[0] || (n[0] = (t) => e.handleIconClick(t, "prepend"))
|
|
132
132
|
}, [
|
|
133
133
|
(r(), m(h(s(k)(e.prependIcon))))
|
|
134
134
|
])
|
|
@@ -137,7 +137,7 @@ const be = { class: "relative" }, ye = {
|
|
|
137
137
|
e.prependInnerIcon || e.$slots["prepend-inner"] ? (r(), l("div", me, [
|
|
138
138
|
i(e.$slots, "prepend-inner", {}, () => [
|
|
139
139
|
d("div", {
|
|
140
|
-
onClick:
|
|
140
|
+
onClick: n[1] || (n[1] = (t) => e.handleIconClick(t, "prependInner"))
|
|
141
141
|
}, [
|
|
142
142
|
(r(), m(h(s(k)(e.prependInnerIcon))))
|
|
143
143
|
])
|
|
@@ -147,7 +147,7 @@ const be = { class: "relative" }, ye = {
|
|
|
147
147
|
ref_key: "textareaRef",
|
|
148
148
|
ref: p,
|
|
149
149
|
value: s(v),
|
|
150
|
-
rows: e.autoGrow ?
|
|
150
|
+
rows: e.autoGrow ? void 0 : e.rows,
|
|
151
151
|
disabled: e.disabled,
|
|
152
152
|
readonly: e.readonly,
|
|
153
153
|
placeholder: e.placeholder,
|
|
@@ -157,8 +157,8 @@ const be = { class: "relative" }, ye = {
|
|
|
157
157
|
onKeydown: ae(O, ["enter"]),
|
|
158
158
|
onFocus: Q,
|
|
159
159
|
onBlur: U,
|
|
160
|
-
onClick:
|
|
161
|
-
onMousedown:
|
|
160
|
+
onClick: n[2] || (n[2] = (t) => e.$emit("click:control", t)),
|
|
161
|
+
onMousedown: n[3] || (n[3] = (t) => e.$emit("mousedown:control", t))
|
|
162
162
|
}, null, 42, he),
|
|
163
163
|
e.clearable && s(v) ? (r(), l("div", {
|
|
164
164
|
key: 2,
|
|
@@ -167,7 +167,7 @@ const be = { class: "relative" }, ye = {
|
|
|
167
167
|
i(e.$slots, "clear", S(V(R)), () => [
|
|
168
168
|
d("button", {
|
|
169
169
|
type: "button",
|
|
170
|
-
onClick:
|
|
170
|
+
onClick: n[4] || (n[4] = (...t) => s(D) && s(D)(...t)),
|
|
171
171
|
class: "text-gray-500 hover:text-gray-700"
|
|
172
172
|
}, [
|
|
173
173
|
(r(), m(h(s(k)(e.clearIcon))))
|
|
@@ -177,16 +177,16 @@ const be = { class: "relative" }, ye = {
|
|
|
177
177
|
e.appendInnerIcon || e.$slots["append-inner"] ? (r(), l("div", ke, [
|
|
178
178
|
i(e.$slots, "append-inner", {}, () => [
|
|
179
179
|
d("div", {
|
|
180
|
-
onClick:
|
|
180
|
+
onClick: n[5] || (n[5] = (t) => e.handleIconClick(t, "appendInner"))
|
|
181
181
|
}, [
|
|
182
182
|
(r(), m(h(s(k)(e.appendInnerIcon))))
|
|
183
183
|
])
|
|
184
184
|
])
|
|
185
185
|
])) : u("", !0),
|
|
186
186
|
e.appendIcon || e.$slots.append ? (r(), l("div", Ce, [
|
|
187
|
-
i(e.$slots, "append", S(V(s(
|
|
187
|
+
i(e.$slots, "append", S(V(s(ne))), () => [
|
|
188
188
|
d("div", {
|
|
189
|
-
onClick:
|
|
189
|
+
onClick: n[6] || (n[6] = (t) => e.handleIconClick(t, "append"))
|
|
190
190
|
}, [
|
|
191
191
|
(r(), m(h(s(k)(e.appendIcon))))
|
|
192
192
|
])
|
|
@@ -210,11 +210,11 @@ const be = { class: "relative" }, ye = {
|
|
|
210
210
|
class: b(["text-xs mt-1 space-y-1", { "text-red-500": s(f), "text-gray-500": !s(f) }])
|
|
211
211
|
}, [
|
|
212
212
|
i(e.$slots, "details", {}, () => [
|
|
213
|
-
s(f) ? (r(!0), l(ie, { key: 0 }, de(s(w), (
|
|
213
|
+
s(f) ? (r(!0), l(ie, { key: 0 }, de(s(w), (t, g) => i(e.$slots, "message", {
|
|
214
214
|
key: g,
|
|
215
|
-
message:
|
|
215
|
+
message: t
|
|
216
216
|
}, () => [
|
|
217
|
-
d("div", null, y(
|
|
217
|
+
d("div", null, y(t), 1)
|
|
218
218
|
])), 128)) : e.hint ? i(e.$slots, "hint", {
|
|
219
219
|
key: 1,
|
|
220
220
|
hint: e.hint
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ref as l, computed as m, watch as
|
|
1
|
+
import { ref as l, computed as m, watch as R, nextTick as i, onMounted as T, onBeforeUnmount as $ } from "vue";
|
|
2
2
|
function F(t, v) {
|
|
3
|
-
const c = l(null), o = l(""), f = l(t.modelValue),
|
|
3
|
+
const c = l(null), o = l(""), f = l(t.modelValue), H = l(!1), s = l([]), y = l(null), d = m(() => t.formatModel === "json" || t.formatModel === "auto" && typeof t.modelValue == "object");
|
|
4
4
|
function M(e) {
|
|
5
5
|
if (d.value && e != null)
|
|
6
6
|
try {
|
|
@@ -19,11 +19,11 @@ function F(t, v) {
|
|
|
19
19
|
}
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function O(e) {
|
|
23
23
|
const n = S(e);
|
|
24
24
|
f.value = n, v("update:modelValue", n), v("change", n);
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
R(() => t.modelValue, (e) => {
|
|
27
27
|
const n = JSON.stringify(e), u = JSON.stringify(f.value);
|
|
28
28
|
n !== u && (f.value = e, o.value = M(e), t.autoGrow && i(g));
|
|
29
29
|
});
|
|
@@ -31,24 +31,24 @@ function F(t, v) {
|
|
|
31
31
|
const e = c.value;
|
|
32
32
|
!e || !t.autoGrow || i(() => {
|
|
33
33
|
e.style.height = "auto";
|
|
34
|
-
const n =
|
|
35
|
-
e.style.height = `${Math.
|
|
34
|
+
const n = t.maxHeight || 9999, u = e.scrollHeight;
|
|
35
|
+
e.style.height = `${Math.min(u, n)}px`;
|
|
36
36
|
const r = e.selectionStart;
|
|
37
37
|
e.setSelectionRange(r, r);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
T(() => {
|
|
41
41
|
o.value = M(t.modelValue), i(() => {
|
|
42
42
|
t.autoGrow && g();
|
|
43
43
|
});
|
|
44
|
-
}),
|
|
44
|
+
}), $(() => {
|
|
45
45
|
y.value && cancelAnimationFrame(y.value);
|
|
46
46
|
});
|
|
47
47
|
const V = m(() => {
|
|
48
48
|
var e;
|
|
49
49
|
return !!(s.value.length || (e = t.errorMessages) != null && e.length);
|
|
50
|
-
}),
|
|
51
|
-
function
|
|
50
|
+
}), E = m(() => V.value ? [...t.errorMessages || [], ...s.value].slice(0, t.maxErrors) : []);
|
|
51
|
+
function I() {
|
|
52
52
|
const e = t.rules || [], n = t.required && !o.value ? null : S(o.value), u = [];
|
|
53
53
|
for (const r of e) {
|
|
54
54
|
const a = typeof r == "function" ? r(n) : r;
|
|
@@ -60,27 +60,27 @@ function F(t, v) {
|
|
|
60
60
|
s.value = [];
|
|
61
61
|
}
|
|
62
62
|
function j(e) {
|
|
63
|
-
var
|
|
63
|
+
var w;
|
|
64
64
|
if (!d.value || e.key !== "Enter") return;
|
|
65
65
|
const n = c.value;
|
|
66
66
|
if (!n) return;
|
|
67
|
-
const u = n.selectionStart, r = o.value, a = " ", h = r.slice(0, u), A = r.slice(u),
|
|
68
|
-
`) + 1,
|
|
69
|
-
${((
|
|
70
|
-
o.value = h +
|
|
71
|
-
const
|
|
72
|
-
n.setSelectionRange(
|
|
67
|
+
const u = n.selectionStart, r = o.value, a = " ", h = r.slice(0, u), A = r.slice(u), G = h.lastIndexOf(`
|
|
68
|
+
`) + 1, x = `
|
|
69
|
+
${((w = h.slice(G).match(/^\s*/)) == null ? void 0 : w[0]) ?? ""}${a}`;
|
|
70
|
+
o.value = h + x + A, i(() => {
|
|
71
|
+
const J = u + x.length;
|
|
72
|
+
n.setSelectionRange(J, J);
|
|
73
73
|
}), e.preventDefault();
|
|
74
74
|
}
|
|
75
75
|
return {
|
|
76
76
|
inputRef: c,
|
|
77
77
|
internalValue: o,
|
|
78
|
-
isFocused:
|
|
78
|
+
isFocused: H,
|
|
79
79
|
hasError: V,
|
|
80
|
-
displayedMessages:
|
|
81
|
-
validate:
|
|
80
|
+
displayedMessages: E,
|
|
81
|
+
validate: I,
|
|
82
82
|
resetValidation: N,
|
|
83
|
-
updateModel:
|
|
83
|
+
updateModel: O,
|
|
84
84
|
adjustHeight: g,
|
|
85
85
|
handleJsonEnter: j
|
|
86
86
|
};
|