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