adverich-kun-ui 0.1.291 → 0.1.293
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,19 +1,19 @@
|
|
|
1
|
-
import { ref as a, computed as
|
|
2
|
-
import { isArray as
|
|
1
|
+
import { ref as a, computed as E, watch as G, nextTick as M } from "vue";
|
|
2
|
+
import { isArray as b, isObject as v, fullCopy as H } from "../../../../utils/utils.js";
|
|
3
3
|
function Q(n, h, c, o) {
|
|
4
|
-
const i = a(null), s = a(null), g = a(null), r = a(!1), d = a(""), F = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e),
|
|
4
|
+
const i = a(null), s = a(null), g = a(null), r = a(!1), d = a(""), F = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e), N = E(() => i.value ? b(i.value) ? i.value.length ? x(i.value, n.itemTitle, "hasDefault") : n.placeholderText : v(i.value) ? x(i.value, n.itemTitle, "hasDefault") : i.value.toString() : o.value.length ? n.placeholderText : n.textNoItems), V = E(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
|
|
5
5
|
function x(e, t, u) {
|
|
6
6
|
if (v(e)) {
|
|
7
7
|
if (t) {
|
|
8
|
-
if (
|
|
8
|
+
if (b(t))
|
|
9
9
|
return t.map((l) => e[l] ?? "No definido").join(" - ");
|
|
10
10
|
if (t.includes(","))
|
|
11
11
|
return t.split(",").map((l) => e[l]).join(" - ");
|
|
12
12
|
if (t.includes(".")) {
|
|
13
13
|
const l = t.split(".");
|
|
14
14
|
let f = e;
|
|
15
|
-
for (const
|
|
16
|
-
f = f[
|
|
15
|
+
for (const O of l)
|
|
16
|
+
f = f[O];
|
|
17
17
|
return f;
|
|
18
18
|
}
|
|
19
19
|
return !n.returnObject && typeof e[t] == "number" || e[t] !== void 0 && e[t] !== null ? e[t].toString() : "";
|
|
@@ -21,12 +21,12 @@ function Q(n, h, c, o) {
|
|
|
21
21
|
if (u)
|
|
22
22
|
return Object.values(e)[0];
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return b(e) ? n.returnObject ? e.map((l) => l[t]).join(" - ") : e.map((l) => l).join(" - ") : u && typeof e != "number" && e.includes(",") ? e.split(",") : e;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function B(e) {
|
|
27
27
|
try {
|
|
28
28
|
let t = null;
|
|
29
|
-
if (i.value =
|
|
29
|
+
if (i.value = H(e), !n.multiple)
|
|
30
30
|
n.returnObject ? t = e : v(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e, r.value = !1;
|
|
31
31
|
else if (j(e))
|
|
32
32
|
e && y(e);
|
|
@@ -38,15 +38,20 @@ function Q(n, h, c, o) {
|
|
|
38
38
|
} catch (t) {
|
|
39
39
|
console.log(t);
|
|
40
40
|
} finally {
|
|
41
|
-
|
|
41
|
+
M(() => {
|
|
42
42
|
S();
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
G(
|
|
47
|
+
[() => c.value, () => o.value],
|
|
48
|
+
([e]) => {
|
|
49
|
+
const t = R(e);
|
|
50
|
+
JSON.stringify(i.value) !== JSON.stringify(t) && (i.value = t);
|
|
51
|
+
},
|
|
52
|
+
{ immediate: !0 }
|
|
53
|
+
);
|
|
54
|
+
function R(e) {
|
|
50
55
|
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;
|
|
51
56
|
}
|
|
52
57
|
function j(e) {
|
|
@@ -72,10 +77,10 @@ function Q(n, h, c, o) {
|
|
|
72
77
|
function T() {
|
|
73
78
|
r.value || (r.value = !0);
|
|
74
79
|
}
|
|
75
|
-
function
|
|
80
|
+
function C() {
|
|
76
81
|
r.value && (r.value = !1);
|
|
77
82
|
}
|
|
78
|
-
function
|
|
83
|
+
function D() {
|
|
79
84
|
r.value = !r.value;
|
|
80
85
|
}
|
|
81
86
|
function I(e) {
|
|
@@ -84,31 +89,31 @@ function Q(n, h, c, o) {
|
|
|
84
89
|
function m() {
|
|
85
90
|
s.value.inputField.focus();
|
|
86
91
|
}
|
|
87
|
-
function
|
|
92
|
+
function J() {
|
|
88
93
|
r.value = !0, g.value && s.value.$el.focus();
|
|
89
94
|
}
|
|
90
|
-
function
|
|
95
|
+
function K(e) {
|
|
91
96
|
const t = e.key;
|
|
92
|
-
(I(t) || t === "Backspace") && (T(), m(),
|
|
97
|
+
(I(t) || t === "Backspace") && (T(), m(), M(() => {
|
|
93
98
|
var l;
|
|
94
99
|
const u = (l = s.value) == null ? void 0 : l.inputField;
|
|
95
100
|
if (u) {
|
|
96
|
-
const f = u.selectionStart,
|
|
97
|
-
u.value = k.slice(0, f) +
|
|
101
|
+
const f = u.selectionStart, O = u.selectionEnd, k = u.value, w = e.key.length === 1 ? e.key : "";
|
|
102
|
+
u.value = k.slice(0, f) + w + k.slice(O), u.selectionStart = u.selectionEnd = f + w.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
98
103
|
}
|
|
99
104
|
}));
|
|
100
105
|
}
|
|
101
|
-
function
|
|
106
|
+
function $() {
|
|
102
107
|
r.value = !1, h("createItem");
|
|
103
108
|
}
|
|
104
|
-
function
|
|
109
|
+
function q(e) {
|
|
105
110
|
let t = c.value.indexOf(e);
|
|
106
111
|
c.value.splice(t, 1);
|
|
107
112
|
}
|
|
108
113
|
function A() {
|
|
109
114
|
console.log(c.value), d.value !== "" && (d.value = ""), c.value !== null && (c.value = null), i.value !== null && (i.value = null);
|
|
110
115
|
}
|
|
111
|
-
function
|
|
116
|
+
function z(e) {
|
|
112
117
|
return !!e.disabled;
|
|
113
118
|
}
|
|
114
119
|
return {
|
|
@@ -118,22 +123,22 @@ function Q(n, h, c, o) {
|
|
|
118
123
|
menuModel: r,
|
|
119
124
|
search: d,
|
|
120
125
|
getItemText: F,
|
|
121
|
-
placeholder:
|
|
122
|
-
textArr:
|
|
126
|
+
placeholder: N,
|
|
127
|
+
textArr: V,
|
|
123
128
|
itemToString: x,
|
|
124
|
-
getSelectedItem:
|
|
129
|
+
getSelectedItem: B,
|
|
125
130
|
checkIfValueExist: j,
|
|
126
131
|
removeFromArray: y,
|
|
127
132
|
lightReset: S,
|
|
128
133
|
openMenu: T,
|
|
129
|
-
closeMenu:
|
|
130
|
-
toggleMenu:
|
|
131
|
-
focusOnMenu:
|
|
132
|
-
onMenuKeydown:
|
|
133
|
-
createItem:
|
|
134
|
-
removeItem:
|
|
134
|
+
closeMenu: C,
|
|
135
|
+
toggleMenu: D,
|
|
136
|
+
focusOnMenu: J,
|
|
137
|
+
onMenuKeydown: K,
|
|
138
|
+
createItem: $,
|
|
139
|
+
removeItem: q,
|
|
135
140
|
clearSelection: A,
|
|
136
|
-
checkDisabled:
|
|
141
|
+
checkDisabled: z,
|
|
137
142
|
isAlphanumeric: I
|
|
138
143
|
};
|
|
139
144
|
}
|