adverich-kun-ui 0.1.461 → 0.1.462
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,94 +1,94 @@
|
|
|
1
|
-
import { mergeModels as $, useModel as z, onMounted as
|
|
1
|
+
import { mergeModels as $, useModel as z, onMounted as ie, ref as A, watch as se, createElementBlock as y, openBlock as u, createVNode as a, unref as t, withKeys as ue, withModifiers as E, isRef as _, createSlots as de, withCtx as n, createCommentVNode as g, normalizeClass as ce, createTextVNode as b, toDisplayString as V, createBlock as p, Fragment as me, renderList as fe, createElementVNode as pe } from "vue";
|
|
2
2
|
import { icons as v } from "../../../../icons/index.js";
|
|
3
|
-
import { isNotEmpty as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { isNotEmpty as x, isArray as R } from "../../../../utils/utils.js";
|
|
4
|
+
import ve from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
|
+
import ke from "../../../KunList/src/components/KunList.vue.js";
|
|
6
6
|
import O from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
7
|
import B from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { useAutocomplete as
|
|
11
|
-
import { KunAutocompleteProps as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
const
|
|
8
|
+
import he from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
|
+
import ye from "../../../KunMenu/src/components/KunMenu.vue.js";
|
|
10
|
+
import { useAutocomplete as ge } from "../composables/useAutocomplete.js";
|
|
11
|
+
import { KunAutocompleteProps as be } from "../composables/KunAutocompleteProps.js";
|
|
12
|
+
import Ce from "../../../KunTextField/src/components/KunTextField.vue.js";
|
|
13
|
+
import we from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
14
|
+
import Se from "../../../KunChip/src/components/KunChip.vue.js";
|
|
15
|
+
import C from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
16
|
+
const Ve = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "flex flex-nowrap items-center space-x-1 min-w-3xs max-w-full overflow-x-auto overflow-y-hidden"
|
|
19
|
-
},
|
|
19
|
+
}, De = { class: "flex items-center" }, Ie = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "sticky top-0 z-10 p-2 border-b bg-select-background"
|
|
22
|
-
},
|
|
22
|
+
}, Ue = {
|
|
23
23
|
__name: "KunAutocomplete",
|
|
24
|
-
props: /* @__PURE__ */ $(
|
|
24
|
+
props: /* @__PURE__ */ $(be, {
|
|
25
25
|
modelValue: { default: null },
|
|
26
26
|
modelModifiers: {},
|
|
27
27
|
items: { default: [], type: Array, required: !0 },
|
|
28
28
|
itemsModifiers: {}
|
|
29
29
|
}),
|
|
30
30
|
emits: /* @__PURE__ */ $(["update:modelValue", "selectedItem", "createItem", "validation", "search", "keyDown", "keyDownEnter"], ["update:modelValue", "update:items"]),
|
|
31
|
-
setup(
|
|
32
|
-
const i = z(
|
|
33
|
-
textFieldRef:
|
|
31
|
+
setup(w, { expose: F, emit: N }) {
|
|
32
|
+
const i = z(w, "modelValue"), f = z(w, "items"), s = w, c = N, {
|
|
33
|
+
textFieldRef: k,
|
|
34
34
|
listRef: D,
|
|
35
35
|
menuModel: d,
|
|
36
36
|
search: r,
|
|
37
|
-
removeItem:
|
|
38
|
-
clearSelection:
|
|
39
|
-
lightReset:
|
|
37
|
+
removeItem: T,
|
|
38
|
+
clearSelection: U,
|
|
39
|
+
lightReset: j,
|
|
40
40
|
openMenu: S,
|
|
41
|
-
closeMenu:
|
|
42
|
-
toggleMenu:
|
|
43
|
-
onMenuKeydown:
|
|
41
|
+
closeMenu: H,
|
|
42
|
+
toggleMenu: q,
|
|
43
|
+
onMenuKeydown: P,
|
|
44
44
|
getSelectedItem: I,
|
|
45
|
-
textArr:
|
|
46
|
-
getArrayText:
|
|
47
|
-
isAlphanumeric:
|
|
48
|
-
createItem:
|
|
49
|
-
checkDisabled:
|
|
45
|
+
textArr: W,
|
|
46
|
+
getArrayText: G,
|
|
47
|
+
isAlphanumeric: J,
|
|
48
|
+
createItem: Q,
|
|
49
|
+
checkDisabled: X,
|
|
50
50
|
itemToString: K,
|
|
51
|
-
placeholder:
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
s.focusOnRender &&
|
|
51
|
+
placeholder: Y
|
|
52
|
+
} = ge(s, c, i, f);
|
|
53
|
+
ie(() => {
|
|
54
|
+
s.focusOnRender && k.value.focus();
|
|
55
55
|
});
|
|
56
|
-
const L = A(null),
|
|
56
|
+
const L = A(null), h = A(""), M = (e) => {
|
|
57
57
|
for (const o of s.rules) {
|
|
58
58
|
const l = o(e);
|
|
59
59
|
if (l !== !0)
|
|
60
|
-
return
|
|
60
|
+
return h.value = l, c("validation", !1), !1;
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return h.value = "", c("validation", !0), !0;
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
se(() => i.value, (e, o) => {
|
|
65
|
+
x(s.rules) && M(e);
|
|
66
66
|
});
|
|
67
|
-
function
|
|
67
|
+
function Z() {
|
|
68
68
|
var e;
|
|
69
|
-
d.value = !1, (e =
|
|
69
|
+
d.value = !1, (e = k.value.inputField) == null || e.focus();
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function ee(e) {
|
|
72
72
|
var l, m;
|
|
73
73
|
const o = e.key;
|
|
74
74
|
if (o === "Tab" || o === "Shift" || o === "Escape") {
|
|
75
|
-
|
|
75
|
+
H(), c("keyDown", o);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
(
|
|
78
|
+
(J(o) || o === "Backspace") && S(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), d.value || S(), (m = (l = D.value) == null ? void 0 : l.focusWithKey) == null || m.call(l, o));
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function le(e) {
|
|
81
81
|
c("search", r);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function te() {
|
|
84
84
|
M(i);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
function oe() {
|
|
86
|
+
function oe(e) {
|
|
87
|
+
P(e);
|
|
90
88
|
}
|
|
91
89
|
function ne() {
|
|
90
|
+
}
|
|
91
|
+
function re() {
|
|
92
92
|
if (!r.value) return;
|
|
93
93
|
let e = null;
|
|
94
94
|
s.returnObject ? e = f.value.find(
|
|
@@ -101,70 +101,75 @@ const Se = {
|
|
|
101
101
|
(o) => typeof o == "object" ? Object.values(o).some((l) => String(l).toLowerCase() === String(r.value).toLowerCase()) : String(o).toLowerCase() === String(r.value).toLowerCase()
|
|
102
102
|
), e && I(e), c("keyDownEnter");
|
|
103
103
|
}
|
|
104
|
-
return (
|
|
104
|
+
return F({
|
|
105
|
+
focus: () => {
|
|
106
|
+
var e;
|
|
107
|
+
(e = k.value) == null || e.focus();
|
|
108
|
+
}
|
|
109
|
+
}), (e, o) => (u(), y("div", {
|
|
105
110
|
class: "w-full h-fit",
|
|
106
111
|
ref_key: "parentRef",
|
|
107
112
|
ref: L
|
|
108
113
|
}, [
|
|
109
|
-
a(
|
|
114
|
+
a(Ce, {
|
|
110
115
|
modelValue: t(r),
|
|
111
116
|
"onUpdate:modelValue": [
|
|
112
117
|
o[1] || (o[1] = (l) => _(r) ? r.value = l : null),
|
|
113
|
-
|
|
118
|
+
le
|
|
114
119
|
],
|
|
115
120
|
label: e.label,
|
|
116
121
|
dirty: "",
|
|
117
122
|
"hide-details": e.hideDetails,
|
|
118
123
|
density: e.density,
|
|
119
124
|
ref_key: "textFieldRef",
|
|
120
|
-
ref:
|
|
125
|
+
ref: k,
|
|
121
126
|
autocomplete: "off",
|
|
122
|
-
onFocusInput:
|
|
123
|
-
onHandleClick: t(
|
|
127
|
+
onFocusInput: te,
|
|
128
|
+
onHandleClick: t(q),
|
|
124
129
|
rounded: t(d) ? "rounded-t" : "rounded",
|
|
125
|
-
onBlur:
|
|
130
|
+
onBlur: ne,
|
|
126
131
|
onKeyDown: [
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
ee,
|
|
133
|
+
ue(E(re, ["prevent"]), ["enter"])
|
|
129
134
|
],
|
|
130
|
-
placeholder: s.multiple && t(
|
|
131
|
-
error: !!
|
|
132
|
-
"error-messages":
|
|
133
|
-
},
|
|
135
|
+
placeholder: s.multiple && t(R)(i.value) && i.value.length ? "" : t(Y),
|
|
136
|
+
error: !!h.value,
|
|
137
|
+
"error-messages": h.value
|
|
138
|
+
}, de({
|
|
134
139
|
"prepend-input-content": n(() => [
|
|
135
|
-
t(
|
|
136
|
-
(u(!0),
|
|
140
|
+
t(R)(i.value) && t(x)(i.value) ? (u(), y("div", Ve, [
|
|
141
|
+
(u(!0), y(me, null, fe(i.value, (l) => (u(), p(Se, {
|
|
137
142
|
key: l.id ?? l.name,
|
|
138
143
|
size: "small",
|
|
139
144
|
variant: "pill"
|
|
140
145
|
}, {
|
|
141
146
|
default: n(() => [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
a(
|
|
147
|
+
pe("div", De, [
|
|
148
|
+
b(V(t(G)(l)) + " ", 1),
|
|
149
|
+
a(C, {
|
|
145
150
|
color: "error",
|
|
146
151
|
icon: t(v).close,
|
|
147
152
|
size: "small",
|
|
148
153
|
class: "ml-1",
|
|
149
|
-
onClick: (m) => t(
|
|
154
|
+
onClick: (m) => t(T)(l)
|
|
150
155
|
}, null, 8, ["icon", "onClick"])
|
|
151
156
|
])
|
|
152
157
|
]),
|
|
153
158
|
_: 2
|
|
154
159
|
}, 1024))), 128))
|
|
155
|
-
])) :
|
|
160
|
+
])) : g("", !0)
|
|
156
161
|
]),
|
|
157
162
|
default: n(() => [
|
|
158
|
-
a(
|
|
163
|
+
a(ye, {
|
|
159
164
|
transition: "fade",
|
|
160
|
-
"onClick:outside": t(
|
|
165
|
+
"onClick:outside": t(j),
|
|
161
166
|
modelValue: t(d),
|
|
162
167
|
"onUpdate:modelValue": o[0] || (o[0] = (l) => _(d) ? d.value = l : null),
|
|
163
168
|
activator: "parent",
|
|
164
169
|
"z-index": e.zIndex,
|
|
165
170
|
"parent-ref": L.value,
|
|
166
171
|
origin: e.menuOrigin,
|
|
167
|
-
onHandleEscape:
|
|
172
|
+
onHandleEscape: Z,
|
|
168
173
|
bgColor: e.bgMenuColor,
|
|
169
174
|
"close-on-content-click": e.closeOnSelect,
|
|
170
175
|
width: "w-full",
|
|
@@ -172,27 +177,27 @@ const Se = {
|
|
|
172
177
|
"hide-details": e.hideDetails
|
|
173
178
|
}, {
|
|
174
179
|
default: n(() => [
|
|
175
|
-
e.hasCreateItem ? (u(),
|
|
176
|
-
a(
|
|
177
|
-
onClick: t(
|
|
180
|
+
e.hasCreateItem ? (u(), y("div", Ie, [
|
|
181
|
+
a(we, {
|
|
182
|
+
onClick: t(Q),
|
|
178
183
|
bgColor: e.btnCreateBg,
|
|
179
|
-
class:
|
|
184
|
+
class: ce(e.btnCreateClass)
|
|
180
185
|
}, {
|
|
181
186
|
default: n(() => [
|
|
182
|
-
|
|
187
|
+
b(V(e.btnCreateText), 1)
|
|
183
188
|
]),
|
|
184
189
|
_: 1
|
|
185
190
|
}, 8, ["onClick", "bgColor", "class"])
|
|
186
|
-
])) :
|
|
187
|
-
a(
|
|
191
|
+
])) : g("", !0),
|
|
192
|
+
a(ke, {
|
|
188
193
|
"onClick:select": t(I),
|
|
189
194
|
ref_key: "listRef",
|
|
190
195
|
ref: D,
|
|
191
|
-
onKeyDown:
|
|
196
|
+
onKeyDown: oe,
|
|
192
197
|
selectable: !0
|
|
193
198
|
}, {
|
|
194
199
|
default: n(() => [
|
|
195
|
-
a(
|
|
200
|
+
a(ve, {
|
|
196
201
|
items: f.value,
|
|
197
202
|
search: t(r),
|
|
198
203
|
"searchable-keys": s.searchableKeys,
|
|
@@ -201,12 +206,12 @@ const Se = {
|
|
|
201
206
|
enabled: t(d),
|
|
202
207
|
"item-height": 48
|
|
203
208
|
}, {
|
|
204
|
-
default: n(({ item: l, index: m, empty:
|
|
205
|
-
!
|
|
209
|
+
default: n(({ item: l, index: m, empty: ae }) => [
|
|
210
|
+
!ae && l != null ? (u(), p(O, {
|
|
206
211
|
value: l,
|
|
207
212
|
key: `kun-list-${m + 1}`,
|
|
208
213
|
id: `kun-item-${m + 1}`,
|
|
209
|
-
disabled: t(
|
|
214
|
+
disabled: t(X)(l),
|
|
210
215
|
"bg-items": e.bgItemListColor,
|
|
211
216
|
"hover-bg": e.hoverItemListColor,
|
|
212
217
|
activeClass: e.selectedItemListColor,
|
|
@@ -216,11 +221,11 @@ const Se = {
|
|
|
216
221
|
default: n(() => [
|
|
217
222
|
a(B, { class: "text-wrap" }, {
|
|
218
223
|
default: n(() => [
|
|
219
|
-
|
|
224
|
+
b(V(t(K)(l, e.itemTitle ?? t(W), "hasDefault")), 1)
|
|
220
225
|
]),
|
|
221
226
|
_: 2
|
|
222
227
|
}, 1024),
|
|
223
|
-
a(
|
|
228
|
+
a(he, {
|
|
224
229
|
text: e.itemSubtitle ? t(K)(l, e.itemSubtitle) : ""
|
|
225
230
|
}, null, 8, ["text"])
|
|
226
231
|
]),
|
|
@@ -232,7 +237,7 @@ const Se = {
|
|
|
232
237
|
default: n(() => [
|
|
233
238
|
a(B, { class: "text-center w-full text-gray-500" }, {
|
|
234
239
|
default: n(() => o[2] || (o[2] = [
|
|
235
|
-
|
|
240
|
+
b(" No hay elementos disponibles ")
|
|
236
241
|
])),
|
|
237
242
|
_: 1,
|
|
238
243
|
__: [2]
|
|
@@ -255,28 +260,28 @@ const Se = {
|
|
|
255
260
|
e.hasIcons ? {
|
|
256
261
|
name: "append-inner",
|
|
257
262
|
fn: n(() => [
|
|
258
|
-
e.clearable && i.value ? (u(), p(
|
|
263
|
+
e.clearable && i.value ? (u(), p(C, {
|
|
259
264
|
key: 0,
|
|
260
|
-
onClick: t(
|
|
265
|
+
onClick: t(U),
|
|
261
266
|
size: "small",
|
|
262
267
|
color: "error",
|
|
263
268
|
icon: t(v).close,
|
|
264
269
|
class: "mr-1 mt-1"
|
|
265
|
-
}, null, 8, ["onClick", "icon"])) :
|
|
266
|
-
a(
|
|
270
|
+
}, null, 8, ["onClick", "icon"])) : g("", !0),
|
|
271
|
+
a(C, {
|
|
267
272
|
color: "teal-darken-1",
|
|
268
273
|
size: "large",
|
|
269
274
|
class: "cursor-pointer",
|
|
270
275
|
icon: t(d) ? t(v).menuUpOutline : t(v).menuDownOutline,
|
|
271
276
|
onClick: E(t(S), ["stop"])
|
|
272
277
|
}, null, 8, ["icon", "onClick"]),
|
|
273
|
-
e.required ? (u(), p(
|
|
278
|
+
e.required ? (u(), p(C, {
|
|
274
279
|
key: 1,
|
|
275
280
|
color: "teal-darken-1",
|
|
276
281
|
size: "x-small",
|
|
277
282
|
class: "mb-4",
|
|
278
283
|
icon: t(v).asterisk
|
|
279
|
-
}, null, 8, ["icon"])) :
|
|
284
|
+
}, null, 8, ["icon"])) : g("", !0)
|
|
280
285
|
]),
|
|
281
286
|
key: "0"
|
|
282
287
|
} : void 0
|
|
@@ -285,5 +290,5 @@ const Se = {
|
|
|
285
290
|
}
|
|
286
291
|
};
|
|
287
292
|
export {
|
|
288
|
-
|
|
293
|
+
Ue as default
|
|
289
294
|
};
|