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