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