adverich-kun-ui 0.1.498 → 0.1.499
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
1
|
import { ref as d, computed as M, watch as H, nextTick as F } from "vue";
|
|
2
2
|
import { isArray as S, isObject as O, fullCopy as L } from "../../../../utils/utils.js";
|
|
3
3
|
function U(t, y, c, v) {
|
|
4
|
-
const l = d(null),
|
|
4
|
+
const l = d(null), b = d(null), x = d(null), i = d(!1), g = d(""), N = (e, n) => {
|
|
5
5
|
if (t.returnObject) return s(e, t.itemTitle);
|
|
6
6
|
const u = l.value.find((f) => f[t.itemValue] === e);
|
|
7
7
|
return s(u, t.itemTitle);
|
|
@@ -41,7 +41,6 @@ function U(t, y, c, v) {
|
|
|
41
41
|
return S(e) ? t.returnObject ? e.map((r) => r[n]).join(" - ") : e.map((r) => r).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((f = e == null ? void 0 : e.toString) == null ? void 0 : f.call(e)) ?? "";
|
|
42
42
|
}
|
|
43
43
|
function C(e) {
|
|
44
|
-
console.log(e);
|
|
45
44
|
try {
|
|
46
45
|
let n = null;
|
|
47
46
|
if (l.value = L(e), !t.multiple)
|
|
@@ -85,7 +84,7 @@ function U(t, y, c, v) {
|
|
|
85
84
|
c.value = c.value.filter((u) => u !== n);
|
|
86
85
|
}
|
|
87
86
|
function A(e) {
|
|
88
|
-
t.clearSearchOnSelect && (
|
|
87
|
+
t.clearSearchOnSelect && (g.value = ""), t.clearOnSelect && E(), t.focusOnSelect && j();
|
|
89
88
|
}
|
|
90
89
|
function k() {
|
|
91
90
|
i.value || (i.value = !0);
|
|
@@ -100,16 +99,16 @@ function U(t, y, c, v) {
|
|
|
100
99
|
return e.length === 1 && e.match(/\w/);
|
|
101
100
|
}
|
|
102
101
|
function j() {
|
|
103
|
-
|
|
102
|
+
b.value.inputField.focus();
|
|
104
103
|
}
|
|
105
104
|
function K() {
|
|
106
|
-
i.value = !0, x.value &&
|
|
105
|
+
i.value = !0, x.value && b.value.$el.focus();
|
|
107
106
|
}
|
|
108
107
|
function $(e) {
|
|
109
108
|
const n = e.key;
|
|
110
109
|
(w(n) || n === "Backspace") && (k(), j(), F(() => {
|
|
111
110
|
var f;
|
|
112
|
-
const u = (f =
|
|
111
|
+
const u = (f = b.value) == null ? void 0 : f.inputField;
|
|
113
112
|
if (u) {
|
|
114
113
|
const r = u.selectionStart, o = u.selectionEnd, a = u.value, h = e.key.length === 1 ? e.key : "";
|
|
115
114
|
u.value = a.slice(0, r) + h + a.slice(o), u.selectionStart = u.selectionEnd = r + h.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
@@ -124,17 +123,17 @@ function U(t, y, c, v) {
|
|
|
124
123
|
c.value.splice(n, 1);
|
|
125
124
|
}
|
|
126
125
|
function E() {
|
|
127
|
-
|
|
126
|
+
g.value !== "" && (g.value = ""), c.value !== null && (c.value = null), l.value !== null && (l.value = null);
|
|
128
127
|
}
|
|
129
128
|
function G(e) {
|
|
130
129
|
return !!e.disabled;
|
|
131
130
|
}
|
|
132
131
|
return {
|
|
133
132
|
selectedItem: l,
|
|
134
|
-
textFieldRef:
|
|
133
|
+
textFieldRef: b,
|
|
135
134
|
listRef: x,
|
|
136
135
|
menuModel: i,
|
|
137
|
-
search:
|
|
136
|
+
search: g,
|
|
138
137
|
getArrayText: N,
|
|
139
138
|
placeholder: B,
|
|
140
139
|
textArr: R,
|
|
@@ -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 F, 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), g = a(null), h = a(null), s = a(!1), d = V("registerField", null), v = V("unregisterField", null), y = 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,9 +11,9 @@ function R(u, r) {
|
|
|
11
11
|
const e = await c();
|
|
12
12
|
t.value = e === !0 ? "" : e;
|
|
13
13
|
}, u.debounce ?? 300);
|
|
14
|
-
|
|
14
|
+
F(() => u.modelValue, (e) => {
|
|
15
15
|
e !== l.value && (s.value = !0, l.value = e ?? "");
|
|
16
|
-
}),
|
|
16
|
+
}), F(l, () => {
|
|
17
17
|
if (s.value) {
|
|
18
18
|
s.value = !1;
|
|
19
19
|
return;
|
|
@@ -29,7 +29,7 @@ function R(u, r) {
|
|
|
29
29
|
}
|
|
30
30
|
r("blur");
|
|
31
31
|
}, B = () => {
|
|
32
|
-
|
|
32
|
+
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,7 +44,7 @@ function R(u, r) {
|
|
|
44
44
|
return d && d({ validate: i }), T(() => {
|
|
45
45
|
v && v({ validate: i });
|
|
46
46
|
}), {
|
|
47
|
-
inputField:
|
|
47
|
+
inputField: g,
|
|
48
48
|
inputValue: l,
|
|
49
49
|
rootRef: h,
|
|
50
50
|
inputFocused: o,
|