adverich-kun-ui 0.1.92 → 0.1.93
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 a, computed as S } from "vue";
|
|
2
2
|
import { isArray as o, isObject as c } from "../../../../utils/utils.js";
|
|
3
3
|
function z(u, O, r, T, P) {
|
|
4
|
-
const t = a(null),
|
|
4
|
+
const t = a(null), s = a(null), b = a(null), i = a(!1), v = a(""), A = (e, n) => n.split(".").reduce((f, l) => f && f[l] !== void 0 ? f[l] : null, e), M = S(() => t.value ? o(t.value) ? t.value.length ? d(t.value, u.itemTitle, "hasDefault") : u.placeholderText : c(t.value) ? d(t.value, u.itemTitle, "hasDefault") : t.value.toString() : T.value.length ? u.placeholderText : u.textNoItems), V = S(() => u.itemText.includes(",") ? u.itemText.split(",") : u.itemText);
|
|
5
5
|
function d(e, n, f) {
|
|
6
6
|
if (c(e)) {
|
|
7
7
|
if (n) {
|
|
@@ -25,19 +25,19 @@ function z(u, O, r, T, P) {
|
|
|
25
25
|
}
|
|
26
26
|
function F(e) {
|
|
27
27
|
try {
|
|
28
|
-
u.multiple ? (t.value || (t.value = []),
|
|
28
|
+
u.multiple ? (t.value || (t.value = []), g(e) ? e && j(e) : u.returnObject ? t.value.push(e) : c(e) ? u.itemValue ? t.value.push(e[u.itemValue]) : t.value.push(Object.values(e)[0]) : t.value.push(e)) : (u.returnObject ? t.value = e : c(e) ? u.itemValue ? t.value = e[u.itemValue] : t.value = Object.values(e)[0] : t.value = e, i.value = !1), O("update:model-value", t.value), u.clearOnSelect && I();
|
|
29
29
|
} catch (n) {
|
|
30
30
|
console.log(n);
|
|
31
31
|
} finally {
|
|
32
32
|
h();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function g(e) {
|
|
36
36
|
return t.value === null ? !1 : e ? t.value.some(
|
|
37
37
|
(n) => u.returnObject ? n[u.itemValue] === e[u.itemValue] : n === e[u.itemValue]
|
|
38
38
|
) : !0;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function j(e) {
|
|
41
41
|
if (u.returnObject) {
|
|
42
42
|
const n = t.value.find(
|
|
43
43
|
(l) => l[u.itemValue] === e[u.itemValue]
|
|
@@ -49,9 +49,9 @@ function z(u, O, r, T, P) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
function k(e) {
|
|
52
|
-
u.clearSearchOnSelect && (
|
|
52
|
+
u.clearSearchOnSelect && (v.value = ""), u.focusOnSelect && h();
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function m() {
|
|
55
55
|
i.value || (i.value = !0);
|
|
56
56
|
}
|
|
57
57
|
function R() {
|
|
@@ -61,14 +61,14 @@ function z(u, O, r, T, P) {
|
|
|
61
61
|
return e.length === 1 && e.match(/\w/);
|
|
62
62
|
}
|
|
63
63
|
function h() {
|
|
64
|
-
|
|
64
|
+
s.value.inputField.focus();
|
|
65
65
|
}
|
|
66
66
|
function w() {
|
|
67
|
-
i.value = !0, b.value &&
|
|
67
|
+
i.value = !0, b.value && s.value.$el.focus();
|
|
68
68
|
}
|
|
69
69
|
function D(e) {
|
|
70
70
|
const n = e.key;
|
|
71
|
-
(y(n) || n === "Backspace") && (
|
|
71
|
+
(y(n) || n === "Backspace") && (m(), h());
|
|
72
72
|
}
|
|
73
73
|
function N() {
|
|
74
74
|
i.value = !1, O("createItem");
|
|
@@ -78,26 +78,26 @@ function z(u, O, r, T, P) {
|
|
|
78
78
|
t.value.splice(n, 1);
|
|
79
79
|
}
|
|
80
80
|
function I() {
|
|
81
|
-
|
|
81
|
+
v.value = "", o(r.value) && (t.value = []), c(r.value) && (t.value = null), typeof r.value == "number" && r.value && (t.value = null), typeof r.value == "string" && r.value && (t.value = null), typeof r.value == "boolean" && (t.value = !1);
|
|
82
82
|
}
|
|
83
83
|
function E(e) {
|
|
84
84
|
return !!e.disabledItem;
|
|
85
85
|
}
|
|
86
86
|
return {
|
|
87
87
|
selectedItem: t,
|
|
88
|
-
textFieldRef:
|
|
88
|
+
textFieldRef: s,
|
|
89
89
|
listRef: b,
|
|
90
90
|
menuModel: i,
|
|
91
|
-
search:
|
|
91
|
+
search: v,
|
|
92
92
|
getItemText: A,
|
|
93
93
|
placeholder: M,
|
|
94
94
|
textArr: V,
|
|
95
95
|
itemToString: d,
|
|
96
96
|
getSelectedItem: F,
|
|
97
|
-
checkIfValueExist:
|
|
98
|
-
removeFromArray:
|
|
97
|
+
checkIfValueExist: g,
|
|
98
|
+
removeFromArray: j,
|
|
99
99
|
lightReset: k,
|
|
100
|
-
openMenu:
|
|
100
|
+
openMenu: m,
|
|
101
101
|
toggleMenu: R,
|
|
102
102
|
focusOnMenu: w,
|
|
103
103
|
onMenuKeydown: D,
|