adverich-kun-ui 0.1.367 → 0.1.368
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,20 +1,20 @@
|
|
|
1
1
|
import { ref as o, computed as M, watch as H, nextTick as F } from "vue";
|
|
2
|
-
import { isArray as j, isObject as
|
|
3
|
-
function U(t,
|
|
4
|
-
const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e),
|
|
5
|
-
function
|
|
2
|
+
import { isArray as j, isObject as h, fullCopy as L } from "../../../../utils/utils.js";
|
|
3
|
+
function U(t, x, i, s) {
|
|
4
|
+
const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), B = M(() => l.value ? j(l.value) ? l.value.length ? O(l.value, t.itemTitle, "hasDefault") : t.placeholderText : h(l.value) ? O(l.value, t.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? t.placeholderText : t.textNoItems), R = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
|
|
5
|
+
function O(e, n, u) {
|
|
6
6
|
var r;
|
|
7
|
-
if (
|
|
7
|
+
if (h(e)) {
|
|
8
8
|
if (n) {
|
|
9
9
|
if (j(n))
|
|
10
|
-
return n.map((
|
|
10
|
+
return n.map((c) => e[c] ?? "No definido").join(" - ");
|
|
11
11
|
if (n.includes(","))
|
|
12
|
-
return n.split(",").map((
|
|
12
|
+
return n.split(",").map((c) => e[c]).join(" - ");
|
|
13
13
|
if (n.includes(".")) {
|
|
14
|
-
const
|
|
14
|
+
const c = n.split(".");
|
|
15
15
|
let a = e;
|
|
16
|
-
for (const
|
|
17
|
-
a = a[
|
|
16
|
+
for (const b of c)
|
|
17
|
+
a = a[b];
|
|
18
18
|
return a;
|
|
19
19
|
}
|
|
20
20
|
return !t.returnObject && typeof e[n] == "number" || e[n] !== void 0 && e[n] !== null ? e[n].toString() : "";
|
|
@@ -22,30 +22,30 @@ function U(t, h, c, s) {
|
|
|
22
22
|
if (u)
|
|
23
23
|
return Object.values(e)[0];
|
|
24
24
|
}
|
|
25
|
-
return j(e) ? t.returnObject ? e.map((
|
|
25
|
+
return j(e) ? t.returnObject ? e.map((c) => c[n]).join(" - ") : e.map((c) => c).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function V(e) {
|
|
28
28
|
try {
|
|
29
29
|
let n = null;
|
|
30
30
|
if (l.value = L(e), !t.multiple)
|
|
31
|
-
t.returnObject ? n = e :
|
|
31
|
+
t.returnObject ? n = e : h(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1, g();
|
|
32
32
|
else if (S(e))
|
|
33
|
-
e &&
|
|
33
|
+
e && I(e);
|
|
34
34
|
else {
|
|
35
|
-
const u = t.returnObject ? e :
|
|
36
|
-
n = [...
|
|
35
|
+
const u = t.returnObject ? e : h(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
|
|
36
|
+
n = [...i.value || [], u];
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
i.value === n ? x("update:modelValue", n) : i.value = n, x("selectedItem", l.value);
|
|
39
39
|
} catch (n) {
|
|
40
40
|
console.log(n);
|
|
41
41
|
} finally {
|
|
42
42
|
F(() => {
|
|
43
|
-
|
|
43
|
+
T();
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
H(
|
|
48
|
-
[() =>
|
|
48
|
+
[() => i.value, () => s.value],
|
|
49
49
|
([e]) => {
|
|
50
50
|
const n = C(e);
|
|
51
51
|
JSON.stringify(l.value) !== JSON.stringify(n) && (l.value = n);
|
|
@@ -58,23 +58,24 @@ function U(t, h, c, s) {
|
|
|
58
58
|
) ?? e;
|
|
59
59
|
}
|
|
60
60
|
function S(e) {
|
|
61
|
-
return
|
|
61
|
+
return i.value === null ? !1 : e ? i.value.some(
|
|
62
62
|
(n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
|
|
63
63
|
) : !0;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
let n =
|
|
65
|
+
function I(e) {
|
|
66
|
+
let n = [...i.value];
|
|
67
67
|
if (t.returnObject) {
|
|
68
|
-
const u = n.
|
|
69
|
-
(
|
|
70
|
-
)
|
|
71
|
-
n.splice(
|
|
68
|
+
const u = n.findIndex(
|
|
69
|
+
(r) => r[t.itemValue] === e[t.itemValue]
|
|
70
|
+
);
|
|
71
|
+
u !== -1 && n.splice(u, 1);
|
|
72
72
|
} else {
|
|
73
73
|
const u = n.indexOf(e[t.itemValue]);
|
|
74
|
-
n.splice(u, 1);
|
|
74
|
+
u !== -1 && n.splice(u, 1);
|
|
75
75
|
}
|
|
76
|
+
i.value = n;
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function T(e) {
|
|
78
79
|
t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && g();
|
|
79
80
|
}
|
|
80
81
|
function A() {
|
|
@@ -101,20 +102,20 @@ function U(t, h, c, s) {
|
|
|
101
102
|
var r;
|
|
102
103
|
const u = (r = d.value) == null ? void 0 : r.inputField;
|
|
103
104
|
if (u) {
|
|
104
|
-
const
|
|
105
|
-
u.value =
|
|
105
|
+
const c = u.selectionStart, a = u.selectionEnd, b = u.value, E = e.key.length === 1 ? e.key : "";
|
|
106
|
+
u.value = b.slice(0, c) + E + b.slice(a), u.selectionStart = u.selectionEnd = c + E.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
106
107
|
}
|
|
107
108
|
}));
|
|
108
109
|
}
|
|
109
110
|
function q() {
|
|
110
|
-
f.value = !1,
|
|
111
|
+
f.value = !1, x("createItem");
|
|
111
112
|
}
|
|
112
113
|
function z(e) {
|
|
113
|
-
let n =
|
|
114
|
-
|
|
114
|
+
let n = i.value.indexOf(e);
|
|
115
|
+
i.value.splice(n, 1);
|
|
115
116
|
}
|
|
116
117
|
function w() {
|
|
117
|
-
console.log(
|
|
118
|
+
console.log(i.value), v.value !== "" && (v.value = ""), i.value !== null && (i.value = null), l.value !== null && (l.value = null);
|
|
118
119
|
}
|
|
119
120
|
function G(e) {
|
|
120
121
|
return !!e.disabled;
|
|
@@ -126,13 +127,13 @@ function U(t, h, c, s) {
|
|
|
126
127
|
menuModel: f,
|
|
127
128
|
search: v,
|
|
128
129
|
getItemText: N,
|
|
129
|
-
placeholder:
|
|
130
|
-
textArr:
|
|
131
|
-
itemToString:
|
|
132
|
-
getSelectedItem:
|
|
130
|
+
placeholder: B,
|
|
131
|
+
textArr: R,
|
|
132
|
+
itemToString: O,
|
|
133
|
+
getSelectedItem: V,
|
|
133
134
|
checkIfValueExist: S,
|
|
134
|
-
removeFromArray:
|
|
135
|
-
lightReset:
|
|
135
|
+
removeFromArray: I,
|
|
136
|
+
lightReset: T,
|
|
136
137
|
openMenu: A,
|
|
137
138
|
closeMenu: D,
|
|
138
139
|
toggleMenu: J,
|