adverich-kun-ui 0.1.209 → 0.1.211
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,39 +1,39 @@
|
|
|
1
|
-
import { mergeModels as
|
|
1
|
+
import { mergeModels as R, useModel as $, onMounted as ae, ref as B, watch as se, createElementBlock as V, openBlock as s, createVNode as a, unref as l, isRef as F, createSlots as ue, withCtx as i, createCommentVNode as y, Fragment as de, renderList as ce, createBlock as d, createElementVNode as me, createTextVNode as k, toDisplayString as w, normalizeClass as fe, withModifiers as pe } from "vue";
|
|
2
2
|
import { icons as m } from "../../../../icons/index.js";
|
|
3
|
-
import { isNotEmpty as ve, isArray as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import { isNotEmpty as ve, isArray as T } from "../../../../utils/utils.js";
|
|
4
|
+
import ye from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
|
+
import ke from "../../../KunList/src/components/KunList.vue.js";
|
|
6
|
+
import _ from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
|
+
import U from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
8
|
import he from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
9
|
import ge from "../../../kunMenu/src/components/kunMenu.vue.js";
|
|
10
10
|
import { useAutocomplete as Ce } from "../composables/useAutocomplete.js";
|
|
11
11
|
import { KunAutocompleteProps as be } from "../composables/KunAutocompleteProps.js";
|
|
12
12
|
import Ve from "../../../KunTextField/src/components/KunTextField.vue.js";
|
|
13
13
|
import we from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
14
|
-
import
|
|
14
|
+
import _e from "../../../KunChip/src/components/KunChip.vue.js";
|
|
15
15
|
import h from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
16
|
-
const
|
|
16
|
+
const Ie = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "flex justify-center align-center"
|
|
19
19
|
}, xe = { class: "flex justify-center align-center" }, He = {
|
|
20
20
|
__name: "KunAutocomplete",
|
|
21
|
-
props: /* @__PURE__ */
|
|
21
|
+
props: /* @__PURE__ */ R(be, {
|
|
22
22
|
modelValue: { default: null },
|
|
23
23
|
modelModifiers: {},
|
|
24
24
|
items: { default: [], type: Array, required: !0 },
|
|
25
25
|
itemsModifiers: {}
|
|
26
26
|
}),
|
|
27
|
-
emits: /* @__PURE__ */
|
|
28
|
-
setup(g, { emit:
|
|
29
|
-
const r =
|
|
27
|
+
emits: /* @__PURE__ */ R(["selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
28
|
+
setup(g, { emit: E }) {
|
|
29
|
+
const r = $(g, "modelValue"), I = $(g, "items"), n = g, f = E, {
|
|
30
30
|
textFieldRef: C,
|
|
31
31
|
listRef: x,
|
|
32
32
|
menuModel: u,
|
|
33
33
|
search: c,
|
|
34
|
-
removeItem:
|
|
35
|
-
clearSelection:
|
|
36
|
-
lightReset:
|
|
34
|
+
removeItem: L,
|
|
35
|
+
clearSelection: N,
|
|
36
|
+
lightReset: H,
|
|
37
37
|
openMenu: b,
|
|
38
38
|
closeMenu: O,
|
|
39
39
|
toggleMenu: j,
|
|
@@ -44,18 +44,18 @@ const _e = {
|
|
|
44
44
|
isAlphanumeric: J,
|
|
45
45
|
createItem: Q,
|
|
46
46
|
checkDisabled: X,
|
|
47
|
-
itemToString:
|
|
48
|
-
placeholder:
|
|
47
|
+
itemToString: K,
|
|
48
|
+
placeholder: M,
|
|
49
49
|
hasCreateItem: Y
|
|
50
|
-
} = Ce(n, f, r,
|
|
50
|
+
} = Ce(n, f, r, I);
|
|
51
51
|
ae(() => {
|
|
52
52
|
n.focusOnRender && C.value.focus();
|
|
53
53
|
});
|
|
54
|
-
const
|
|
54
|
+
const S = B(null);
|
|
55
55
|
function Z(e) {
|
|
56
|
-
return r.value === null || r.value === void 0 ? n.bgItemListColor : n.multiple ? r.value.find((o) => o[n.itemValue] === e[n.itemValue]) ? n.selectedColor : n.bgItemListColor :
|
|
56
|
+
return r.value === null || r.value === void 0 ? n.bgItemListColor : n.multiple ? r.value.find((o) => o[n.itemValue] === e[n.itemValue]) ? n.selectedColor : n.bgItemListColor : M.value === e[n.itemTitle] ? n.selectedColor : n.bgItemListColor;
|
|
57
57
|
}
|
|
58
|
-
const p =
|
|
58
|
+
const p = B(""), D = (e) => {
|
|
59
59
|
for (const o of n.rules) {
|
|
60
60
|
const t = o(e);
|
|
61
61
|
if (t !== !0)
|
|
@@ -64,7 +64,7 @@ const _e = {
|
|
|
64
64
|
return p.value = "", f("validation", !0), !0;
|
|
65
65
|
};
|
|
66
66
|
se(() => r.value, (e, o) => {
|
|
67
|
-
ve(n.rules) &&
|
|
67
|
+
ve(n.rules) && D(e);
|
|
68
68
|
});
|
|
69
69
|
function ee() {
|
|
70
70
|
var e;
|
|
@@ -83,7 +83,7 @@ const _e = {
|
|
|
83
83
|
f("search", c);
|
|
84
84
|
}
|
|
85
85
|
function oe() {
|
|
86
|
-
|
|
86
|
+
D(r);
|
|
87
87
|
}
|
|
88
88
|
function ne(e) {
|
|
89
89
|
q(e);
|
|
@@ -93,12 +93,12 @@ const _e = {
|
|
|
93
93
|
return (e, o) => (s(), V("div", {
|
|
94
94
|
class: "w-full h-fit",
|
|
95
95
|
ref_key: "parentRef",
|
|
96
|
-
ref:
|
|
96
|
+
ref: S
|
|
97
97
|
}, [
|
|
98
98
|
a(Ve, {
|
|
99
99
|
modelValue: l(c),
|
|
100
100
|
"onUpdate:modelValue": [
|
|
101
|
-
o[
|
|
101
|
+
o[1] || (o[1] = (t) => F(c) ? c.value = t : null),
|
|
102
102
|
le
|
|
103
103
|
],
|
|
104
104
|
label: e.label,
|
|
@@ -113,40 +113,40 @@ const _e = {
|
|
|
113
113
|
rounded: l(u) ? "rounded-t" : "rounded",
|
|
114
114
|
onBlur: ie,
|
|
115
115
|
onKeyDown: te,
|
|
116
|
-
placeholder: n.multiple && l(
|
|
116
|
+
placeholder: n.multiple && l(T)(r.value) && r.value.length ? "" : l(M),
|
|
117
117
|
error: !!p.value,
|
|
118
118
|
"error-messages": p.value
|
|
119
119
|
}, ue({
|
|
120
120
|
default: i(() => [
|
|
121
|
-
l(
|
|
122
|
-
(s(!0), V(de, null, ce(r.value, (t) => (s(), d(
|
|
121
|
+
l(T)(r.value) ? (s(), V("div", Ie, [
|
|
122
|
+
(s(!0), V(de, null, ce(r.value, (t) => (s(), d(_e, {
|
|
123
123
|
key: t.id ?? t.name,
|
|
124
124
|
size: "small",
|
|
125
125
|
class: "ml-1"
|
|
126
126
|
}, {
|
|
127
127
|
default: i(() => [
|
|
128
128
|
me("div", xe, [
|
|
129
|
-
|
|
129
|
+
k(w(l(G)(t, e.itemTitle)) + " ", 1),
|
|
130
130
|
a(h, {
|
|
131
131
|
color: "error",
|
|
132
132
|
icon: l(m).close,
|
|
133
133
|
size: "small",
|
|
134
134
|
class: "ml-1",
|
|
135
|
-
onClick: (v) => l(
|
|
135
|
+
onClick: (v) => l(L)(t)
|
|
136
136
|
}, null, 8, ["icon", "onClick"])
|
|
137
137
|
])
|
|
138
138
|
]),
|
|
139
139
|
_: 2
|
|
140
140
|
}, 1024))), 128))
|
|
141
|
-
])) :
|
|
141
|
+
])) : y("", !0),
|
|
142
142
|
a(ge, {
|
|
143
143
|
transition: "fade",
|
|
144
|
-
"onClick:outside": l(
|
|
144
|
+
"onClick:outside": l(H),
|
|
145
145
|
modelValue: l(u),
|
|
146
|
-
"onUpdate:modelValue": o[
|
|
146
|
+
"onUpdate:modelValue": o[0] || (o[0] = (t) => F(u) ? u.value = t : null),
|
|
147
147
|
activator: "parent",
|
|
148
148
|
"z-index": e.zIndex,
|
|
149
|
-
"parent-ref":
|
|
149
|
+
"parent-ref": S.value,
|
|
150
150
|
location: "bottom",
|
|
151
151
|
origin: "bottom left",
|
|
152
152
|
onHandleEscape: ee,
|
|
@@ -155,32 +155,31 @@ const _e = {
|
|
|
155
155
|
"hide-details": e.hideDetails
|
|
156
156
|
}, {
|
|
157
157
|
default: i(() => [
|
|
158
|
-
a(
|
|
158
|
+
a(ke, {
|
|
159
159
|
"onUpdate:selected": l(P),
|
|
160
|
-
"onClick:select": o[0] || (o[0] = (t) => l(K)()),
|
|
161
160
|
ref_key: "listRef",
|
|
162
161
|
ref: x,
|
|
163
162
|
onKeyDown: ne
|
|
164
163
|
}, {
|
|
165
164
|
default: i(() => [
|
|
166
|
-
l(Y) ? (s(), d(
|
|
165
|
+
l(Y) ? (s(), d(_, { key: 0 }, {
|
|
167
166
|
default: i(() => [
|
|
168
167
|
a(we, {
|
|
169
168
|
onClick: l(Q),
|
|
170
169
|
class: "w-full",
|
|
171
170
|
color: "bg-green-400"
|
|
172
171
|
}, {
|
|
173
|
-
default: i(() => o[
|
|
174
|
-
|
|
172
|
+
default: i(() => o[2] || (o[2] = [
|
|
173
|
+
k(" Crear item ")
|
|
175
174
|
])),
|
|
176
175
|
_: 1,
|
|
177
|
-
__: [
|
|
176
|
+
__: [2]
|
|
178
177
|
}, 8, ["onClick"])
|
|
179
178
|
]),
|
|
180
179
|
_: 1
|
|
181
|
-
})) :
|
|
182
|
-
a(
|
|
183
|
-
items:
|
|
180
|
+
})) : y("", !0),
|
|
181
|
+
a(ye, {
|
|
182
|
+
items: I.value,
|
|
184
183
|
search: l(c),
|
|
185
184
|
"searchable-keys": n.searchableKeys,
|
|
186
185
|
virtual: !1,
|
|
@@ -189,39 +188,39 @@ const _e = {
|
|
|
189
188
|
"item-height": 48
|
|
190
189
|
}, {
|
|
191
190
|
default: i(({ item: t, index: v, empty: re }) => {
|
|
192
|
-
var
|
|
191
|
+
var z, A;
|
|
193
192
|
return [
|
|
194
|
-
!re && t ? (s(), d(
|
|
193
|
+
!re && t ? (s(), d(_, {
|
|
195
194
|
value: t,
|
|
196
|
-
key: ((
|
|
195
|
+
key: ((z = t.id) == null ? void 0 : z.toString()) ?? t.name,
|
|
197
196
|
disabled: l(X)(t),
|
|
198
197
|
class: fe(Z(t)),
|
|
199
198
|
density: e.density,
|
|
200
|
-
id: ((
|
|
199
|
+
id: ((A = t.id) == null ? void 0 : A.toString()) ?? t.name
|
|
201
200
|
}, {
|
|
202
201
|
default: i(() => [
|
|
203
|
-
a(
|
|
202
|
+
a(U, { class: "text-wrap" }, {
|
|
204
203
|
default: i(() => [
|
|
205
|
-
|
|
204
|
+
k(w(l(K)(t, e.itemTitle ?? l(W), "hasDefault")), 1)
|
|
206
205
|
]),
|
|
207
206
|
_: 2
|
|
208
207
|
}, 1024),
|
|
209
208
|
a(he, {
|
|
210
|
-
textContent: w(e.itemSubtitle ? l(
|
|
209
|
+
textContent: w(e.itemSubtitle ? l(K)(t, e.itemSubtitle) : "")
|
|
211
210
|
}, null, 8, ["textContent"])
|
|
212
211
|
]),
|
|
213
212
|
_: 2
|
|
214
|
-
}, 1032, ["value", "disabled", "class", "density", "id"])) : (s(), d(
|
|
213
|
+
}, 1032, ["value", "disabled", "class", "density", "id"])) : (s(), d(_, {
|
|
215
214
|
key: 1,
|
|
216
215
|
disabled: ""
|
|
217
216
|
}, {
|
|
218
217
|
default: i(() => [
|
|
219
|
-
a(
|
|
220
|
-
default: i(() => o[
|
|
221
|
-
|
|
218
|
+
a(U, { class: "text-center w-full text-gray-500" }, {
|
|
219
|
+
default: i(() => o[3] || (o[3] = [
|
|
220
|
+
k(" No hay elementos disponibles ")
|
|
222
221
|
])),
|
|
223
222
|
_: 1,
|
|
224
|
-
__: [
|
|
223
|
+
__: [3]
|
|
225
224
|
})
|
|
226
225
|
]),
|
|
227
226
|
_: 1
|
|
@@ -244,12 +243,12 @@ const _e = {
|
|
|
244
243
|
fn: i(() => [
|
|
245
244
|
e.clearable && r.value ? (s(), d(h, {
|
|
246
245
|
key: 0,
|
|
247
|
-
onClick: l(
|
|
246
|
+
onClick: l(N),
|
|
248
247
|
size: "small",
|
|
249
248
|
color: "error",
|
|
250
249
|
icon: l(m).close,
|
|
251
250
|
class: "mr-1 mt-1"
|
|
252
|
-
}, null, 8, ["onClick", "icon"])) :
|
|
251
|
+
}, null, 8, ["onClick", "icon"])) : y("", !0),
|
|
253
252
|
a(h, {
|
|
254
253
|
color: "teal-darken-1",
|
|
255
254
|
size: "large",
|
|
@@ -263,7 +262,7 @@ const _e = {
|
|
|
263
262
|
size: "x-small",
|
|
264
263
|
class: "mb-4",
|
|
265
264
|
icon: l(m).asterisk
|
|
266
|
-
}, null, 8, ["icon"])) :
|
|
265
|
+
}, null, 8, ["icon"])) : y("", !0)
|
|
267
266
|
]),
|
|
268
267
|
key: "0"
|
|
269
268
|
} : void 0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as a, computed as
|
|
2
|
-
import { isArray as O, isObject as v } from "../../../../utils/utils.js";
|
|
3
|
-
function
|
|
4
|
-
const i = a(null), s = a(null), j = a(null), c = a(!1), d = a(""),
|
|
1
|
+
import { ref as a, computed as M, watch as G, nextTick as H } from "vue";
|
|
2
|
+
import { isArray as O, isObject as v, fullCopy as J } from "../../../../utils/utils.js";
|
|
3
|
+
function Q(n, g, r, o) {
|
|
4
|
+
const i = a(null), s = a(null), j = a(null), c = a(!1), d = a(""), w = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e), F = M(() => i.value ? O(i.value) ? i.value.length ? h(i.value, n.itemTitle, "hasDefault") : n.placeholderText : v(i.value) ? h(i.value, n.itemTitle, "hasDefault") : i.value.toString() : o.value.length ? n.placeholderText : n.textNoItems), V = M(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
|
|
5
5
|
function h(e, t, u) {
|
|
6
6
|
if (v(e)) {
|
|
7
7
|
if (t) {
|
|
@@ -23,10 +23,10 @@ function P(n, g, r, o) {
|
|
|
23
23
|
}
|
|
24
24
|
return O(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 = e, !n.multiple)
|
|
29
|
+
if (i.value = J(e), !n.multiple)
|
|
30
30
|
n.returnObject ? t = e : v(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e, c.value = !1;
|
|
31
31
|
else if (y(e))
|
|
32
32
|
e && S(e);
|
|
@@ -34,17 +34,17 @@ function P(n, g, r, o) {
|
|
|
34
34
|
const u = n.returnObject ? e : v(e) ? n.itemValue ? e[n.itemValue] : Object.values(e)[0] : e;
|
|
35
35
|
t = [...r.value || [], u];
|
|
36
36
|
}
|
|
37
|
-
r.value
|
|
37
|
+
r.value = t, g("selectedItem", i.value);
|
|
38
38
|
} catch (t) {
|
|
39
39
|
console.log(t);
|
|
40
40
|
} finally {
|
|
41
|
-
x();
|
|
41
|
+
m(), x();
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
G(() => o.value, () => {
|
|
45
|
-
i.value =
|
|
45
|
+
i.value = R(r.value);
|
|
46
46
|
}, { immediate: !0 });
|
|
47
|
-
function
|
|
47
|
+
function R(e) {
|
|
48
48
|
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;
|
|
49
49
|
}
|
|
50
50
|
function y(e) {
|
|
@@ -64,35 +64,35 @@ function P(n, g, r, o) {
|
|
|
64
64
|
t.splice(u, 1);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
n.clearSearchOnSelect && (d.value = ""), n.focusOnSelect && x();
|
|
67
|
+
function m(e) {
|
|
68
|
+
n.clearSearchOnSelect && (d.value = ""), n.clearOnSelect && A(), n.focusOnSelect && x();
|
|
69
69
|
}
|
|
70
70
|
function T() {
|
|
71
71
|
c.value || (c.value = !0);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function C() {
|
|
74
74
|
c.value && (c.value = !1);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function D() {
|
|
77
77
|
c.value = !c.value;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function I(e) {
|
|
80
80
|
return e.length === 1 && e.match(/\w/);
|
|
81
81
|
}
|
|
82
82
|
function x() {
|
|
83
83
|
s.value.inputField.focus();
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function N() {
|
|
86
86
|
c.value = !0, j.value && s.value.$el.focus();
|
|
87
87
|
}
|
|
88
88
|
function K(e) {
|
|
89
89
|
const t = e.key;
|
|
90
|
-
(
|
|
90
|
+
(I(t) || t === "Backspace") && (T(), x(), H(() => {
|
|
91
91
|
var l;
|
|
92
92
|
const u = (l = s.value) == null ? void 0 : l.inputField;
|
|
93
93
|
if (u) {
|
|
94
|
-
const f = u.selectionStart, b = u.selectionEnd,
|
|
95
|
-
u.value =
|
|
94
|
+
const f = u.selectionStart, b = u.selectionEnd, k = u.value, E = e.key.length === 1 ? e.key : "";
|
|
95
|
+
u.value = k.slice(0, f) + E + k.slice(b), u.selectionStart = u.selectionEnd = f + E.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
96
96
|
}
|
|
97
97
|
}));
|
|
98
98
|
}
|
|
@@ -103,7 +103,7 @@ function P(n, g, r, o) {
|
|
|
103
103
|
let t = r.value.indexOf(e);
|
|
104
104
|
r.value.splice(t, 1);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function A() {
|
|
107
107
|
d.value !== "" && (d.value = ""), r.value !== null && (r.value = null), i.value !== null && (i.value = null);
|
|
108
108
|
}
|
|
109
109
|
function z(e) {
|
|
@@ -115,26 +115,26 @@ function P(n, g, r, o) {
|
|
|
115
115
|
listRef: j,
|
|
116
116
|
menuModel: c,
|
|
117
117
|
search: d,
|
|
118
|
-
getItemText:
|
|
119
|
-
placeholder:
|
|
120
|
-
textArr:
|
|
118
|
+
getItemText: w,
|
|
119
|
+
placeholder: F,
|
|
120
|
+
textArr: V,
|
|
121
121
|
itemToString: h,
|
|
122
|
-
getSelectedItem:
|
|
122
|
+
getSelectedItem: B,
|
|
123
123
|
checkIfValueExist: y,
|
|
124
124
|
removeFromArray: S,
|
|
125
|
-
lightReset:
|
|
125
|
+
lightReset: m,
|
|
126
126
|
openMenu: T,
|
|
127
|
-
closeMenu:
|
|
128
|
-
toggleMenu:
|
|
129
|
-
focusOnMenu:
|
|
127
|
+
closeMenu: C,
|
|
128
|
+
toggleMenu: D,
|
|
129
|
+
focusOnMenu: N,
|
|
130
130
|
onMenuKeydown: K,
|
|
131
131
|
createItem: $,
|
|
132
132
|
removeItem: q,
|
|
133
|
-
clearSelection:
|
|
133
|
+
clearSelection: A,
|
|
134
134
|
checkDisabled: z,
|
|
135
|
-
isAlphanumeric:
|
|
135
|
+
isAlphanumeric: I
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
export {
|
|
139
|
-
|
|
139
|
+
Q as useAutocomplete
|
|
140
140
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as g, ref as w, useModel as
|
|
1
|
+
import { mergeModels as g, ref as w, useModel as D, provide as p, computed as B, createElementBlock as M, openBlock as S, mergeProps as I, withModifiers as E, renderSlot as L } from "vue";
|
|
2
2
|
const R = {
|
|
3
3
|
__name: "KunList",
|
|
4
4
|
props: /* @__PURE__ */ g({
|
|
@@ -28,11 +28,11 @@ const R = {
|
|
|
28
28
|
}),
|
|
29
29
|
emits: /* @__PURE__ */ g(["keyDown", "click:select", "update:selected"], ["update:selected"]),
|
|
30
30
|
setup(o, { expose: b, emit: y }) {
|
|
31
|
-
const u = o, a = y, f = w(null), c = w([]), s =
|
|
31
|
+
const u = o, a = y, f = w(null), c = w([]), s = D(o, "selected");
|
|
32
32
|
p("registerListItemRef", (e) => {
|
|
33
33
|
e && !c.value.includes(e) && c.value.push(e);
|
|
34
34
|
});
|
|
35
|
-
const m =
|
|
35
|
+
const m = B(() => u.selectable && u.selectionMode === "multiple");
|
|
36
36
|
function v(e) {
|
|
37
37
|
if (!(!u.selectable || e == null))
|
|
38
38
|
if (m.value) {
|
|
@@ -61,7 +61,7 @@ const R = {
|
|
|
61
61
|
}
|
|
62
62
|
if (t === "ArrowUp" || t === "ArrowDown") {
|
|
63
63
|
e.preventDefault();
|
|
64
|
-
const l = n.findIndex((
|
|
64
|
+
const l = n.findIndex((x) => x === document.activeElement);
|
|
65
65
|
let d = -1;
|
|
66
66
|
l === -1 ? d = t === "ArrowDown" ? 0 : n.length - 1 : t === "ArrowDown" ? d = (l + 1) % n.length : t === "ArrowUp" && (d = (l - 1 + n.length) % n.length);
|
|
67
67
|
const i = n[d];
|
|
@@ -70,17 +70,17 @@ const R = {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function h(e = "ArrowDown") {
|
|
74
74
|
var l;
|
|
75
75
|
const t = c.value.filter(Boolean);
|
|
76
76
|
if (!t.length) return;
|
|
77
77
|
const n = e === "ArrowDown" ? 0 : t.length - 1, r = t[n];
|
|
78
78
|
(l = r == null ? void 0 : r.focus) == null || l.call(r);
|
|
79
79
|
}
|
|
80
|
-
return b({ focusWithKey:
|
|
80
|
+
return b({ focusWithKey: h, focus: () => {
|
|
81
81
|
var e, t;
|
|
82
82
|
return (t = (e = f.value) == null ? void 0 : e.focus) == null ? void 0 : t.call(e);
|
|
83
|
-
} }), (e, t) => (
|
|
83
|
+
} }), (e, t) => (S(), M("ul", I({
|
|
84
84
|
ref_key: "ulRef",
|
|
85
85
|
ref: f,
|
|
86
86
|
role: "list",
|
|
@@ -96,8 +96,7 @@ const R = {
|
|
|
96
96
|
]],
|
|
97
97
|
tabindex: "-1",
|
|
98
98
|
onKeydown: E(A, ["prevent"]),
|
|
99
|
-
onSelect: t[0] || (t[0] = (n) => a("click:select", n.detail))
|
|
100
|
-
onSelected: t[1] || (t[1] = (n) => a("update:selected", n.detail))
|
|
99
|
+
onSelect: t[0] || (t[0] = (n) => a("click:select", n.detail))
|
|
101
100
|
}, e.$attrs), [
|
|
102
101
|
L(e.$slots, "default")
|
|
103
102
|
], 16));
|
package/dist/utils/utils.js
CHANGED
|
@@ -7,19 +7,23 @@ function o(t) {
|
|
|
7
7
|
function u(t) {
|
|
8
8
|
return typeof t == "string";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function f(t) {
|
|
11
11
|
return i(t) ? Object.keys(t).length > 0 : o(t) || u(t) ? t.length > 0 : !1;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function s(t, n = 100) {
|
|
14
14
|
let r;
|
|
15
15
|
return (...e) => {
|
|
16
16
|
clearTimeout(r), r = setTimeout(() => t(...e), n);
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
function c(t) {
|
|
20
|
+
return JSON.parse(JSON.stringify(t));
|
|
21
|
+
}
|
|
19
22
|
export {
|
|
20
|
-
|
|
23
|
+
s as debounce,
|
|
24
|
+
c as fullCopy,
|
|
21
25
|
o as isArray,
|
|
22
|
-
|
|
26
|
+
f as isNotEmpty,
|
|
23
27
|
i as isObject,
|
|
24
28
|
u as isString
|
|
25
29
|
};
|