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