adverich-kun-ui 0.1.460 → 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,170 +1,175 @@
|
|
|
1
|
-
import { mergeModels as $, useModel as z, onMounted as
|
|
2
|
-
import { icons as
|
|
3
|
-
import { isNotEmpty as x, isArray as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
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
|
+
import { icons as v } from "../../../../icons/index.js";
|
|
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
8
|
import he from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
|
-
import
|
|
10
|
-
import { useAutocomplete as
|
|
11
|
-
import { KunAutocompleteProps as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
const
|
|
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
|
-
emits: /* @__PURE__ */ $(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
31
|
-
setup(
|
|
32
|
-
const i = z(
|
|
33
|
-
textFieldRef:
|
|
34
|
-
listRef:
|
|
30
|
+
emits: /* @__PURE__ */ $(["update:modelValue", "selectedItem", "createItem", "validation", "search", "keyDown", "keyDownEnter"], ["update:modelValue", "update:items"]),
|
|
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
|
+
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:
|
|
44
|
-
getSelectedItem:
|
|
45
|
-
textArr:
|
|
46
|
-
getArrayText:
|
|
47
|
-
isAlphanumeric:
|
|
48
|
-
createItem:
|
|
49
|
-
checkDisabled:
|
|
50
|
-
itemToString:
|
|
51
|
-
placeholder:
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
s.focusOnRender &&
|
|
41
|
+
closeMenu: H,
|
|
42
|
+
toggleMenu: q,
|
|
43
|
+
onMenuKeydown: P,
|
|
44
|
+
getSelectedItem: I,
|
|
45
|
+
textArr: W,
|
|
46
|
+
getArrayText: G,
|
|
47
|
+
isAlphanumeric: J,
|
|
48
|
+
createItem: Q,
|
|
49
|
+
checkDisabled: X,
|
|
50
|
+
itemToString: K,
|
|
51
|
+
placeholder: Y
|
|
52
|
+
} = ge(s, c, i, f);
|
|
53
|
+
ie(() => {
|
|
54
|
+
s.focusOnRender && k.value.focus();
|
|
55
55
|
});
|
|
56
|
-
const
|
|
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 h.value = l,
|
|
60
|
+
return h.value = l, c("validation", !1), !1;
|
|
61
61
|
}
|
|
62
|
-
return h.value = "",
|
|
62
|
+
return h.value = "", c("validation", !0), !0;
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
se(() => i.value, (e, o) => {
|
|
65
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
|
|
72
|
-
var l,
|
|
71
|
+
function ee(e) {
|
|
72
|
+
var l, m;
|
|
73
73
|
const o = e.key;
|
|
74
|
-
if (
|
|
75
|
-
|
|
74
|
+
if (o === "Tab" || o === "Shift" || o === "Escape") {
|
|
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
|
|
81
|
-
|
|
80
|
+
function le(e) {
|
|
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
|
-
s.returnObject ? e =
|
|
94
|
+
s.returnObject ? e = f.value.find(
|
|
95
95
|
(o) => Object.values(o).some(
|
|
96
96
|
(l) => String(l).toLowerCase() === String(r.value).toLowerCase()
|
|
97
97
|
)
|
|
98
|
-
) : s.itemValue ? e =
|
|
98
|
+
) : s.itemValue ? e = f.value.find(
|
|
99
99
|
(o) => String(o[s.itemValue]).toLowerCase() === String(r.value).toLowerCase()
|
|
100
|
-
) : e =
|
|
100
|
+
) : e = f.value.find(
|
|
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
|
-
), e &&
|
|
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
|
-
ref:
|
|
112
|
+
ref: L
|
|
108
113
|
}, [
|
|
109
|
-
a(
|
|
114
|
+
a(Ce, {
|
|
110
115
|
modelValue: t(r),
|
|
111
116
|
"onUpdate:modelValue": [
|
|
112
|
-
o[1] || (o[1] = (l) =>
|
|
113
|
-
|
|
117
|
+
o[1] || (o[1] = (l) => _(r) ? r.value = l : null),
|
|
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(
|
|
135
|
+
placeholder: s.multiple && t(R)(i.value) && i.value.length ? "" : t(Y),
|
|
131
136
|
error: !!h.value,
|
|
132
137
|
"error-messages": h.value
|
|
133
|
-
},
|
|
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
|
-
icon: t(
|
|
151
|
+
icon: t(v).close,
|
|
147
152
|
size: "small",
|
|
148
153
|
class: "ml-1",
|
|
149
|
-
onClick: (
|
|
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
|
-
"onUpdate:modelValue": o[0] || (o[0] = (l) =>
|
|
167
|
+
"onUpdate:modelValue": o[0] || (o[0] = (l) => _(d) ? d.value = l : null),
|
|
163
168
|
activator: "parent",
|
|
164
169
|
"z-index": e.zIndex,
|
|
165
|
-
"parent-ref":
|
|
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,28 +177,28 @@ 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(
|
|
188
|
-
"onClick:select": t(
|
|
191
|
+
])) : g("", !0),
|
|
192
|
+
a(ke, {
|
|
193
|
+
"onClick:select": t(I),
|
|
189
194
|
ref_key: "listRef",
|
|
190
|
-
ref:
|
|
191
|
-
onKeyDown:
|
|
195
|
+
ref: D,
|
|
196
|
+
onKeyDown: oe,
|
|
192
197
|
selectable: !0
|
|
193
198
|
}, {
|
|
194
199
|
default: n(() => [
|
|
195
|
-
a(
|
|
196
|
-
items:
|
|
200
|
+
a(ve, {
|
|
201
|
+
items: f.value,
|
|
197
202
|
search: t(r),
|
|
198
203
|
"searchable-keys": s.searchableKeys,
|
|
199
204
|
virtual: !1,
|
|
@@ -201,12 +206,12 @@ const Se = {
|
|
|
201
206
|
enabled: t(d),
|
|
202
207
|
"item-height": 48
|
|
203
208
|
}, {
|
|
204
|
-
default: n(({ item: l, index:
|
|
205
|
-
!
|
|
209
|
+
default: n(({ item: l, index: m, empty: ae }) => [
|
|
210
|
+
!ae && l != null ? (u(), p(O, {
|
|
206
211
|
value: l,
|
|
207
|
-
key: `kun-list-${
|
|
208
|
-
id: `kun-item-${
|
|
209
|
-
disabled: t(
|
|
212
|
+
key: `kun-list-${m + 1}`,
|
|
213
|
+
id: `kun-item-${m + 1}`,
|
|
214
|
+
disabled: t(X)(l),
|
|
210
215
|
"bg-items": e.bgItemListColor,
|
|
211
216
|
"hover-bg": e.hoverItemListColor,
|
|
212
217
|
activeClass: e.selectedItemListColor,
|
|
@@ -216,23 +221,23 @@ 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
228
|
a(he, {
|
|
224
|
-
text: e.itemSubtitle ? t(
|
|
229
|
+
text: e.itemSubtitle ? t(K)(l, e.itemSubtitle) : ""
|
|
225
230
|
}, null, 8, ["text"])
|
|
226
231
|
]),
|
|
227
232
|
_: 2
|
|
228
|
-
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (u(),
|
|
233
|
+
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (u(), p(O, {
|
|
229
234
|
key: 1,
|
|
230
235
|
disabled: ""
|
|
231
236
|
}, {
|
|
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(),
|
|
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
|
-
icon: t(
|
|
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
|
-
icon: t(d) ? t(
|
|
271
|
-
onClick:
|
|
275
|
+
icon: t(d) ? t(v).menuUpOutline : t(v).menuDownOutline,
|
|
276
|
+
onClick: E(t(S), ["stop"])
|
|
272
277
|
}, null, 8, ["icon", "onClick"]),
|
|
273
|
-
e.required ? (u(),
|
|
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
|
-
icon: t(
|
|
279
|
-
}, null, 8, ["icon"])) :
|
|
283
|
+
icon: t(v).asterisk
|
|
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
|
};
|