adverich-kun-ui 0.1.210 → 0.1.211
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 M, watch as G, nextTick as H } from "vue";
|
|
2
2
|
import { isArray as O, isObject as v, fullCopy as J } from "../../../../utils/utils.js";
|
|
3
|
-
function Q(n, g,
|
|
4
|
-
const i = a(null), s = a(null), j = a(null),
|
|
3
|
+
function Q(n, g, r, o) {
|
|
4
|
+
const i = a(null), s = a(null), j = a(null), c = a(!1), d = a(""), w = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e), F = M(() => i.value ? O(i.value) ? i.value.length ? h(i.value, n.itemTitle, "hasDefault") : n.placeholderText : v(i.value) ? h(i.value, n.itemTitle, "hasDefault") : i.value.toString() : o.value.length ? n.placeholderText : n.textNoItems), V = M(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
|
|
5
5
|
function h(e, t, u) {
|
|
6
6
|
if (v(e)) {
|
|
7
7
|
if (t) {
|
|
@@ -27,33 +27,33 @@ function Q(n, g, c, o) {
|
|
|
27
27
|
try {
|
|
28
28
|
let t = null;
|
|
29
29
|
if (i.value = J(e), !n.multiple)
|
|
30
|
-
n.returnObject ? t = e : v(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e,
|
|
30
|
+
n.returnObject ? t = e : v(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e, c.value = !1;
|
|
31
31
|
else if (y(e))
|
|
32
32
|
e && S(e);
|
|
33
33
|
else {
|
|
34
34
|
const u = n.returnObject ? e : v(e) ? n.itemValue ? e[n.itemValue] : Object.values(e)[0] : e;
|
|
35
|
-
t = [...
|
|
35
|
+
t = [...r.value || [], u];
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
r.value = t, g("selectedItem", i.value);
|
|
38
38
|
} catch (t) {
|
|
39
39
|
console.log(t);
|
|
40
40
|
} finally {
|
|
41
|
-
|
|
41
|
+
m(), x();
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
G(() => o.value, () => {
|
|
45
|
-
i.value = R(
|
|
45
|
+
i.value = R(r.value);
|
|
46
46
|
}, { immediate: !0 });
|
|
47
47
|
function R(e) {
|
|
48
48
|
return e == null ? null : n.returnObject ? e : n.multiple && Array.isArray(e) ? e.map((u) => o.value.find((l) => l[n.itemValue] === u)).filter(Boolean) : o.value.find((u) => u[n.itemValue] === e) || null;
|
|
49
49
|
}
|
|
50
50
|
function y(e) {
|
|
51
|
-
return
|
|
51
|
+
return r.value === null ? !1 : e ? r.value.some(
|
|
52
52
|
(t) => n.returnObject ? t[n.itemValue] === e[n.itemValue] : t === e[n.itemValue]
|
|
53
53
|
) : !0;
|
|
54
54
|
}
|
|
55
55
|
function S(e) {
|
|
56
|
-
let t =
|
|
56
|
+
let t = r.value;
|
|
57
57
|
if (n.returnObject) {
|
|
58
58
|
const u = t.find(
|
|
59
59
|
(f) => f[n.itemValue] === e[n.itemValue]
|
|
@@ -64,17 +64,17 @@ function Q(n, g, c, o) {
|
|
|
64
64
|
t.splice(u, 1);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function m(e) {
|
|
68
68
|
n.clearSearchOnSelect && (d.value = ""), n.clearOnSelect && A(), n.focusOnSelect && x();
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
70
|
+
function T() {
|
|
71
|
+
c.value || (c.value = !0);
|
|
72
72
|
}
|
|
73
73
|
function C() {
|
|
74
|
-
|
|
74
|
+
c.value && (c.value = !1);
|
|
75
75
|
}
|
|
76
76
|
function D() {
|
|
77
|
-
|
|
77
|
+
c.value = !c.value;
|
|
78
78
|
}
|
|
79
79
|
function I(e) {
|
|
80
80
|
return e.length === 1 && e.match(/\w/);
|
|
@@ -83,11 +83,11 @@ function Q(n, g, c, o) {
|
|
|
83
83
|
s.value.inputField.focus();
|
|
84
84
|
}
|
|
85
85
|
function N() {
|
|
86
|
-
|
|
86
|
+
c.value = !0, j.value && s.value.$el.focus();
|
|
87
87
|
}
|
|
88
88
|
function K(e) {
|
|
89
89
|
const t = e.key;
|
|
90
|
-
(I(t) || t === "Backspace") && (
|
|
90
|
+
(I(t) || t === "Backspace") && (T(), x(), H(() => {
|
|
91
91
|
var l;
|
|
92
92
|
const u = (l = s.value) == null ? void 0 : l.inputField;
|
|
93
93
|
if (u) {
|
|
@@ -97,14 +97,14 @@ function Q(n, g, c, o) {
|
|
|
97
97
|
}));
|
|
98
98
|
}
|
|
99
99
|
function $() {
|
|
100
|
-
|
|
100
|
+
c.value = !1, g("createItem");
|
|
101
101
|
}
|
|
102
102
|
function q(e) {
|
|
103
|
-
let t =
|
|
104
|
-
|
|
103
|
+
let t = r.value.indexOf(e);
|
|
104
|
+
r.value.splice(t, 1);
|
|
105
105
|
}
|
|
106
106
|
function A() {
|
|
107
|
-
d.value !== "" && (d.value = ""),
|
|
107
|
+
d.value !== "" && (d.value = ""), r.value !== null && (r.value = null), i.value !== null && (i.value = null);
|
|
108
108
|
}
|
|
109
109
|
function z(e) {
|
|
110
110
|
return !!e.disabled;
|
|
@@ -113,7 +113,7 @@ function Q(n, g, c, o) {
|
|
|
113
113
|
selectedItem: i,
|
|
114
114
|
textFieldRef: s,
|
|
115
115
|
listRef: j,
|
|
116
|
-
menuModel:
|
|
116
|
+
menuModel: c,
|
|
117
117
|
search: d,
|
|
118
118
|
getItemText: w,
|
|
119
119
|
placeholder: F,
|
|
@@ -122,8 +122,8 @@ function Q(n, g, c, o) {
|
|
|
122
122
|
getSelectedItem: B,
|
|
123
123
|
checkIfValueExist: y,
|
|
124
124
|
removeFromArray: S,
|
|
125
|
-
lightReset:
|
|
126
|
-
openMenu:
|
|
125
|
+
lightReset: m,
|
|
126
|
+
openMenu: T,
|
|
127
127
|
closeMenu: C,
|
|
128
128
|
toggleMenu: D,
|
|
129
129
|
focusOnMenu: N,
|