adverich-kun-ui 0.1.494 → 0.1.495
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 a, inject as V, computed as E, watch as
|
|
1
|
+
import { ref as a, inject as V, computed as E, watch as g, onUnmounted as T } from "vue";
|
|
2
2
|
import { debounce as j } from "../../../../utils/utils.js";
|
|
3
3
|
function R(u, r) {
|
|
4
|
-
const l = a(u.modelValue ?? ""), o = a(!1), t = a(""), n = a(!1),
|
|
4
|
+
const l = a(u.modelValue ?? ""), o = a(!1), t = a(""), n = a(!1), F = a(null), h = a(null), s = a(!1), d = V("registerField", null), v = V("unregisterField", null), b = E(() => u.error || !!t.value && n.value), c = async () => {
|
|
5
5
|
for (const e of u.rules) {
|
|
6
6
|
const m = await Promise.resolve(e(l.value));
|
|
7
7
|
if (m !== !0) return m;
|
|
@@ -11,16 +11,16 @@ function R(u, r) {
|
|
|
11
11
|
const e = await c();
|
|
12
12
|
t.value = e === !0 ? "" : e;
|
|
13
13
|
}, u.debounce ?? 300);
|
|
14
|
-
|
|
14
|
+
g(() => u.modelValue, (e) => {
|
|
15
15
|
e !== l.value && (s.value = !0, l.value = e ?? "");
|
|
16
|
-
}),
|
|
16
|
+
}), g(l, () => {
|
|
17
17
|
if (s.value) {
|
|
18
18
|
s.value = !1;
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
n.value = !0, r("update:modelValue", l.value), u.validateOnBlur || f();
|
|
22
22
|
});
|
|
23
|
-
const
|
|
23
|
+
const y = (e) => {
|
|
24
24
|
l.value = e.target.value;
|
|
25
25
|
}, w = async () => {
|
|
26
26
|
if (o.value = !1, u.validateOnBlur) {
|
|
@@ -29,7 +29,7 @@ function R(u, r) {
|
|
|
29
29
|
}
|
|
30
30
|
r("blur");
|
|
31
31
|
}, B = () => {
|
|
32
|
-
o.value = !0, r("focus");
|
|
32
|
+
console.log("deberia hacer el focus"), o.value = !0, r("focus");
|
|
33
33
|
}, I = () => {
|
|
34
34
|
l.value = "", r("update:modelValue", ""), n.value = !0, u.validateOnBlur || f();
|
|
35
35
|
}, i = async () => {
|
|
@@ -44,13 +44,13 @@ function R(u, r) {
|
|
|
44
44
|
return d && d({ validate: i }), T(() => {
|
|
45
45
|
v && v({ validate: i });
|
|
46
46
|
}), {
|
|
47
|
-
inputField:
|
|
47
|
+
inputField: F,
|
|
48
48
|
inputValue: l,
|
|
49
49
|
rootRef: h,
|
|
50
50
|
inputFocused: o,
|
|
51
51
|
validationError: t,
|
|
52
|
-
hasError:
|
|
53
|
-
handleInput:
|
|
52
|
+
hasError: b,
|
|
53
|
+
handleInput: y,
|
|
54
54
|
handleBlur: w,
|
|
55
55
|
focusInput: B,
|
|
56
56
|
validate: i,
|