adverich-kun-ui 0.1.528 → 0.1.529
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,11 +1,11 @@
|
|
|
1
|
-
import { ref as d, computed as
|
|
2
|
-
import { isArray as S, isObject as O, fullCopy as
|
|
1
|
+
import { ref as d, computed as F, watch as L, nextTick as N } from "vue";
|
|
2
|
+
import { isArray as S, isObject as O, fullCopy as x } from "../../../../utils/utils.js";
|
|
3
3
|
function U(t, y, c, v) {
|
|
4
|
-
const l = d(null), b = d(null),
|
|
4
|
+
const l = d(null), b = d(null), T = d(null), i = d(!1), g = d(""), B = (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);
|
|
8
|
-
},
|
|
8
|
+
}, R = F(() => l.value !== null && l.value !== void 0 ? S(l.value) ? l.value.length ? s(l.value, t.itemTitle, "hasDefault") : t.placeholderText : O(l.value) ? s(l.value, t.itemTitle, "hasDefault") : l.value.toString() : v.value.length ? t.placeholderText : t.textNoItems), C = F(() => {
|
|
9
9
|
const e = t.itemText;
|
|
10
10
|
return typeof e == "string" && e.includes(",") ? e.split(",") : e;
|
|
11
11
|
});
|
|
@@ -40,73 +40,73 @@ function U(t, y, c, v) {
|
|
|
40
40
|
}
|
|
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
|
-
function
|
|
43
|
+
function D(e) {
|
|
44
44
|
try {
|
|
45
45
|
let n = null;
|
|
46
|
-
if (l.value =
|
|
47
|
-
t.returnObject ? n = e : O(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, i.value = !1, j();
|
|
48
|
-
else if (
|
|
49
|
-
e &&
|
|
46
|
+
if (l.value = x(e), !t.multiple)
|
|
47
|
+
t.returnObject ? n = x(e) : O(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, i.value = !1, j();
|
|
48
|
+
else if (I(e)) {
|
|
49
|
+
e && A(e);
|
|
50
50
|
return;
|
|
51
51
|
} else {
|
|
52
|
-
const u = t.returnObject ? e : O(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
|
|
52
|
+
const u = t.returnObject ? x(e) : O(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
|
|
53
53
|
n = [...c.value || [], u];
|
|
54
54
|
}
|
|
55
55
|
c.value === n ? y("update:modelValue", n) : c.value = n, y("selectedItem", l.value);
|
|
56
56
|
} catch (n) {
|
|
57
57
|
console.log(n);
|
|
58
58
|
} finally {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
N(() => {
|
|
60
|
+
k();
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
L(
|
|
65
65
|
[() => c.value, () => v.value],
|
|
66
66
|
([e]) => {
|
|
67
|
-
const n =
|
|
67
|
+
const n = J(e);
|
|
68
68
|
JSON.stringify(l.value) !== JSON.stringify(n) && (l.value = n);
|
|
69
69
|
},
|
|
70
70
|
{ immediate: !0 }
|
|
71
71
|
);
|
|
72
|
-
function
|
|
72
|
+
function J(e) {
|
|
73
73
|
return e == null ? null : t.multiple && Array.isArray(e) ? t.returnObject ? e : e.map((u) => v.value.find((f) => f[t.itemValue] === u)).filter(Boolean) : t.returnObject ? e : v.value.find(
|
|
74
74
|
(u) => typeof u == "object" ? u[t.itemValue] === e : u === e
|
|
75
75
|
) ?? e;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function I(e) {
|
|
78
78
|
if (!c.value || !e) return !1;
|
|
79
79
|
const n = t.returnObject ? e : e[t.itemValue];
|
|
80
80
|
return c.value.some((u) => u === n);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function A(e) {
|
|
83
83
|
const n = t.returnObject ? e : e[t.itemValue];
|
|
84
84
|
c.value = c.value.filter((u) => u !== n);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
t.clearSearchOnSelect && (g.value = ""), t.clearOnSelect &&
|
|
86
|
+
function k(e) {
|
|
87
|
+
t.clearSearchOnSelect && (g.value = ""), t.clearOnSelect && M(), t.focusOnSelect && j();
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function w() {
|
|
90
90
|
i.value || (i.value = !0);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function V() {
|
|
93
93
|
i.value && (i.value = !1);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function K() {
|
|
96
96
|
i.value = !i.value;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function E(e) {
|
|
99
99
|
return e.length === 1 && e.match(/\w/);
|
|
100
100
|
}
|
|
101
101
|
function j() {
|
|
102
102
|
b.value.inputField.focus();
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
i.value = !0,
|
|
104
|
+
function $() {
|
|
105
|
+
i.value = !0, T.value && b.value.$el.focus();
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function q(e) {
|
|
108
108
|
const n = e.key;
|
|
109
|
-
(
|
|
109
|
+
(E(n) || n === "Backspace") && (w(), j(), N(() => {
|
|
110
110
|
var f;
|
|
111
111
|
const u = (f = b.value) == null ? void 0 : f.inputField;
|
|
112
112
|
if (u) {
|
|
@@ -115,43 +115,43 @@ function U(t, y, c, v) {
|
|
|
115
115
|
}
|
|
116
116
|
}));
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function z() {
|
|
119
119
|
i.value = !1, y("createItem");
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function G(e) {
|
|
122
122
|
let n = c.value.indexOf(e);
|
|
123
123
|
c.value.splice(n, 1);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function M() {
|
|
126
126
|
g.value !== "" && (g.value = ""), c.value !== null && (c.value = null), l.value !== null && (l.value = null);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function H(e) {
|
|
129
129
|
return !!e.disabled;
|
|
130
130
|
}
|
|
131
131
|
return {
|
|
132
132
|
selectedItem: l,
|
|
133
133
|
textFieldRef: b,
|
|
134
|
-
listRef:
|
|
134
|
+
listRef: T,
|
|
135
135
|
menuModel: i,
|
|
136
136
|
search: g,
|
|
137
|
-
getArrayText:
|
|
138
|
-
placeholder:
|
|
139
|
-
textArr:
|
|
137
|
+
getArrayText: B,
|
|
138
|
+
placeholder: R,
|
|
139
|
+
textArr: C,
|
|
140
140
|
itemToString: s,
|
|
141
|
-
getSelectedItem:
|
|
142
|
-
checkIfValueExist:
|
|
143
|
-
removeFromArray:
|
|
144
|
-
lightReset:
|
|
145
|
-
openMenu:
|
|
146
|
-
closeMenu:
|
|
147
|
-
toggleMenu:
|
|
148
|
-
focusOnMenu:
|
|
149
|
-
onMenuKeydown:
|
|
150
|
-
createItem:
|
|
151
|
-
removeItem:
|
|
152
|
-
clearSelection:
|
|
153
|
-
checkDisabled:
|
|
154
|
-
isAlphanumeric:
|
|
141
|
+
getSelectedItem: D,
|
|
142
|
+
checkIfValueExist: I,
|
|
143
|
+
removeFromArray: A,
|
|
144
|
+
lightReset: k,
|
|
145
|
+
openMenu: w,
|
|
146
|
+
closeMenu: V,
|
|
147
|
+
toggleMenu: K,
|
|
148
|
+
focusOnMenu: $,
|
|
149
|
+
onMenuKeydown: q,
|
|
150
|
+
createItem: z,
|
|
151
|
+
removeItem: G,
|
|
152
|
+
clearSelection: M,
|
|
153
|
+
checkDisabled: H,
|
|
154
|
+
isAlphanumeric: E
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
export {
|