adverich-kun-ui 0.1.100 → 0.1.102
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,45 +1,50 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { isArray as
|
|
3
|
-
function J(t, M, u,
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
1
|
+
import { ref as f, computed as A, watch as z } from "vue";
|
|
2
|
+
import { isArray as b, isObject as o } from "../../../../utils/utils.js";
|
|
3
|
+
function J(t, M, u, a, C) {
|
|
4
|
+
const r = f(null), s = f(null), j = f(null), c = f(!1), v = f(""), w = (e, n) => n.split(".").reduce((i, l) => i && i[l] !== void 0 ? i[l] : null, e), F = A(() => r.value ? b(r.value) ? r.value.length ? g(r.value, t.itemTitle, "hasDefault") : t.placeholderText : o(r.value) ? g(r.value, t.itemTitle, "hasDefault") : r.value.toString() : a.value.length ? t.placeholderText : t.textNoItems), k = A(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
|
|
5
|
+
function g(e, n, i) {
|
|
6
|
+
if (o(e)) {
|
|
7
7
|
if (n) {
|
|
8
|
-
if (
|
|
9
|
-
return n.map((
|
|
8
|
+
if (b(n))
|
|
9
|
+
return n.map((l) => e[l] ?? "No definido").join(" - ");
|
|
10
10
|
if (n.includes(","))
|
|
11
|
-
return n.split(",").map((
|
|
11
|
+
return n.split(",").map((l) => e[l]).join(" - ");
|
|
12
12
|
if (n.includes(".")) {
|
|
13
|
-
const
|
|
14
|
-
let
|
|
15
|
-
for (const q of
|
|
16
|
-
|
|
17
|
-
return
|
|
13
|
+
const l = n.split(".");
|
|
14
|
+
let O = e;
|
|
15
|
+
for (const q of l)
|
|
16
|
+
O = O[q];
|
|
17
|
+
return O;
|
|
18
18
|
}
|
|
19
19
|
return !t.returnObject && typeof e[n] == "number" || e[n] ? e[n].toString() : "";
|
|
20
20
|
}
|
|
21
|
-
if (
|
|
21
|
+
if (i)
|
|
22
22
|
return Object.values(e)[0];
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return b(e) ? t.returnObject ? e.map((l) => l[n]).join(" - ") : e.map((l) => l).join(" - ") : i && typeof e != "number" && e.includes(",") ? e.split(",") : e;
|
|
25
25
|
}
|
|
26
26
|
function B(e) {
|
|
27
27
|
try {
|
|
28
|
-
|
|
28
|
+
h.value = !1, r.value = e, t.multiple ? (u.value || (u.value = []), d(e) ? e && I(e) : t.returnObject ? u.value.push(e) : o(e) ? t.itemValue ? u.value.push(e[t.itemValue]) : u.value.push(Object.values(e)[0]) : u.value.push(e)) : (t.returnObject ? u.value = e : o(e) ? t.itemValue ? u.value = e[t.itemValue] : u.value = Object.values(e)[0] : u.value = e, c.value = !1), t.clearOnSelect && T(), h.value = !0;
|
|
29
29
|
} catch (n) {
|
|
30
30
|
console.log(n);
|
|
31
31
|
} finally {
|
|
32
|
-
|
|
32
|
+
x();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const h = f(!0);
|
|
36
36
|
z(() => u.value, (e) => {
|
|
37
|
-
|
|
37
|
+
console.log("a"), console.log(u.value), h.value && (r.value = R(e));
|
|
38
38
|
}, { immediate: !0 });
|
|
39
39
|
function R(e) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (!e) return null;
|
|
41
|
+
if (console.log("b"), console.log(e), t.returnObject) return e;
|
|
42
|
+
if (t.multiple && Array.isArray(e)) return e.map((i) => a.value.find((l) => l[t.itemValue] === i)).filter(Boolean);
|
|
43
|
+
console.log("c"), console.log(a);
|
|
44
|
+
const n = a.value.find((i) => i[t.itemValue] === e) || null;
|
|
45
|
+
return console.log(t.itemValue), console.log(n), n;
|
|
46
|
+
}
|
|
47
|
+
function d(e) {
|
|
43
48
|
return u.value === null ? !1 : e ? u.value.some(
|
|
44
49
|
(n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
|
|
45
50
|
) : !0;
|
|
@@ -47,61 +52,61 @@ function J(t, M, u, s, C) {
|
|
|
47
52
|
function I(e) {
|
|
48
53
|
if (t.returnObject) {
|
|
49
54
|
const n = u.value.find(
|
|
50
|
-
(
|
|
51
|
-
),
|
|
52
|
-
u.value.splice(
|
|
55
|
+
(l) => l[t.itemValue] === e[t.itemValue]
|
|
56
|
+
), i = u.value.indexOf(n);
|
|
57
|
+
u.value.splice(i, 1);
|
|
53
58
|
} else {
|
|
54
59
|
const n = u.value.indexOf(e[t.itemValue]);
|
|
55
60
|
u.value.splice(n, 1);
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
function m(e) {
|
|
59
|
-
t.clearSearchOnSelect && (
|
|
64
|
+
t.clearSearchOnSelect && (v.value = ""), t.focusOnSelect && x();
|
|
60
65
|
}
|
|
61
66
|
function y() {
|
|
62
|
-
|
|
67
|
+
c.value || (c.value = !0);
|
|
63
68
|
}
|
|
64
69
|
function D() {
|
|
65
|
-
|
|
70
|
+
c.value = !c.value;
|
|
66
71
|
}
|
|
67
72
|
function S(e) {
|
|
68
73
|
return e.length === 1 && e.match(/\w/);
|
|
69
74
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
75
|
+
function x() {
|
|
76
|
+
s.value.inputField.focus();
|
|
72
77
|
}
|
|
73
78
|
function N() {
|
|
74
|
-
|
|
79
|
+
c.value = !0, j.value && s.value.$el.focus();
|
|
75
80
|
}
|
|
76
81
|
function E(e) {
|
|
77
82
|
const n = e.key;
|
|
78
|
-
(S(n) || n === "Backspace") && (y(),
|
|
83
|
+
(S(n) || n === "Backspace") && (y(), x());
|
|
79
84
|
}
|
|
80
85
|
function K() {
|
|
81
|
-
|
|
86
|
+
c.value = !1, M("createItem");
|
|
82
87
|
}
|
|
83
88
|
function P(e) {
|
|
84
89
|
let n = u.value.indexOf(e);
|
|
85
90
|
u.value.splice(n, 1);
|
|
86
91
|
}
|
|
87
92
|
function T() {
|
|
88
|
-
|
|
93
|
+
v.value = "", u.value = null, r.value = null;
|
|
89
94
|
}
|
|
90
95
|
function $(e) {
|
|
91
96
|
return !!e.disabledItem;
|
|
92
97
|
}
|
|
93
98
|
return {
|
|
94
|
-
selectedItem:
|
|
95
|
-
textFieldRef:
|
|
99
|
+
selectedItem: r,
|
|
100
|
+
textFieldRef: s,
|
|
96
101
|
listRef: j,
|
|
97
|
-
menuModel:
|
|
98
|
-
search:
|
|
102
|
+
menuModel: c,
|
|
103
|
+
search: v,
|
|
99
104
|
getItemText: w,
|
|
100
105
|
placeholder: F,
|
|
101
106
|
textArr: k,
|
|
102
|
-
itemToString:
|
|
107
|
+
itemToString: g,
|
|
103
108
|
getSelectedItem: B,
|
|
104
|
-
checkIfValueExist:
|
|
109
|
+
checkIfValueExist: d,
|
|
105
110
|
removeFromArray: I,
|
|
106
111
|
lightReset: m,
|
|
107
112
|
openMenu: y,
|