adverich-kun-ui 0.1.518 → 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,9 +1,9 @@
|
|
|
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
|
-
import
|
|
6
|
+
import N from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
7
|
import T from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
8
|
import ge from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
9
|
import he from "../../../KunMenu/src/components/KunMenu.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);
|
|
@@ -89,32 +89,32 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
89
89
|
if (console.log(1), !n.value) return;
|
|
90
90
|
console.log(2);
|
|
91
91
|
let o = null;
|
|
92
|
-
|
|
92
|
+
u.returnObject ? o = f.value.find(
|
|
93
93
|
(l) => Object.values(l).some(
|
|
94
|
-
(
|
|
94
|
+
(a) => String(a).toLowerCase() === String(n.value).toLowerCase()
|
|
95
95
|
)
|
|
96
|
-
) :
|
|
97
|
-
(l) => String(l[
|
|
98
|
-
) : o =
|
|
99
|
-
(l) => typeof l == "object" ? Object.values(l).some((
|
|
100
|
-
), o ? K(o) : (console.log("No se encontró el elemento:", n.value),
|
|
101
|
-
|
|
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);
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
return _({
|
|
105
|
-
focus: () =>
|
|
105
|
+
focus: () => x(() => {
|
|
106
106
|
var e;
|
|
107
107
|
return (e = k.value) == null ? void 0 : e.focus();
|
|
108
108
|
})
|
|
109
|
-
}), (e, o) => (
|
|
109
|
+
}), (e, o) => (d(), g("div", {
|
|
110
110
|
class: "w-full h-fit",
|
|
111
111
|
ref_key: "parentRef",
|
|
112
112
|
ref: M
|
|
113
113
|
}, [
|
|
114
|
-
|
|
114
|
+
i(we, {
|
|
115
115
|
modelValue: t(n),
|
|
116
116
|
"onUpdate:modelValue": [
|
|
117
|
-
o[2] || (o[2] = (l) =>
|
|
117
|
+
o[2] || (o[2] = (l) => R(n) ? n.value = l : null),
|
|
118
118
|
te
|
|
119
119
|
],
|
|
120
120
|
label: e.label,
|
|
@@ -126,23 +126,23 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
126
126
|
autocomplete: "off",
|
|
127
127
|
onFocusInput: oe,
|
|
128
128
|
onHandleClick: t(V),
|
|
129
|
-
rounded: t(
|
|
129
|
+
rounded: t(c) ? "rounded-t" : "rounded",
|
|
130
130
|
onBlur: re,
|
|
131
131
|
onKeyDown: [
|
|
132
132
|
le,
|
|
133
|
-
de(
|
|
133
|
+
de(F(ae, ["prevent"]), ["enter"])
|
|
134
134
|
],
|
|
135
|
-
placeholder:
|
|
135
|
+
placeholder: u.multiple && t(B)(s.value) && s.value.length ? "" : t(Z),
|
|
136
136
|
error: !!y.value,
|
|
137
137
|
"error-messages": y.value
|
|
138
138
|
}, ce({
|
|
139
139
|
"prepend-input-content": r(() => [
|
|
140
|
-
t(
|
|
140
|
+
t(B)(s.value) && t(O)(s.value) ? (d(), g("div", {
|
|
141
141
|
key: 0,
|
|
142
142
|
class: "flex flex-nowrap items-center space-x-1 min-w-[calc(100%-56px)] overflow-x-auto overflow-y-hidden",
|
|
143
143
|
onClick: o[0] || (o[0] = (...l) => t(V) && t(V)(...l))
|
|
144
144
|
}, [
|
|
145
|
-
(
|
|
145
|
+
(d(!0), g(fe, null, pe(s.value, (l) => (d(), p(Ve, {
|
|
146
146
|
key: l.id ?? l.name,
|
|
147
147
|
size: "small",
|
|
148
148
|
variant: "pill"
|
|
@@ -150,12 +150,12 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
150
150
|
default: r(() => [
|
|
151
151
|
ve("div", De, [
|
|
152
152
|
C(D(t(J)(l)) + " ", 1),
|
|
153
|
-
|
|
153
|
+
i(b, {
|
|
154
154
|
color: "error",
|
|
155
155
|
icon: t(v).close,
|
|
156
156
|
size: "small",
|
|
157
157
|
class: "ml-1",
|
|
158
|
-
onClick: (
|
|
158
|
+
onClick: (a) => t(j)(l)
|
|
159
159
|
}, null, 8, ["icon", "onClick"])
|
|
160
160
|
])
|
|
161
161
|
]),
|
|
@@ -164,11 +164,11 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
164
164
|
])) : h("", !0)
|
|
165
165
|
]),
|
|
166
166
|
default: r(() => [
|
|
167
|
-
|
|
167
|
+
i(he, {
|
|
168
168
|
transition: "fade",
|
|
169
169
|
"onClick:outside": t(q),
|
|
170
|
-
modelValue: t(
|
|
171
|
-
"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),
|
|
172
172
|
activator: "parent",
|
|
173
173
|
"z-index": e.zIndex,
|
|
174
174
|
"parent-ref": M.value,
|
|
@@ -181,11 +181,11 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
181
181
|
"hide-details": e.hideDetails
|
|
182
182
|
}, {
|
|
183
183
|
default: r(() => [
|
|
184
|
-
e.hasCreateItem ? (
|
|
185
|
-
|
|
184
|
+
e.hasCreateItem ? (d(), g("div", Ie, [
|
|
185
|
+
i(Se, {
|
|
186
186
|
onClick: t(X),
|
|
187
187
|
bgColor: e.btnCreateBg,
|
|
188
|
-
class:
|
|
188
|
+
class: me(e.btnCreateClass)
|
|
189
189
|
}, {
|
|
190
190
|
default: r(() => [
|
|
191
191
|
C(D(e.btnCreateText), 1)
|
|
@@ -193,7 +193,7 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
193
193
|
_: 1
|
|
194
194
|
}, 8, ["onClick", "bgColor", "class"])
|
|
195
195
|
])) : h("", !0),
|
|
196
|
-
|
|
196
|
+
i(ye, {
|
|
197
197
|
"onClick:select": t(K),
|
|
198
198
|
ref_key: "listRef",
|
|
199
199
|
ref: I,
|
|
@@ -201,20 +201,20 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
201
201
|
selectable: !0
|
|
202
202
|
}, {
|
|
203
203
|
default: r(() => [
|
|
204
|
-
|
|
205
|
-
items:
|
|
204
|
+
i(ke, {
|
|
205
|
+
items: f.value,
|
|
206
206
|
search: t(n),
|
|
207
|
-
"searchable-keys":
|
|
207
|
+
"searchable-keys": u.searchableKeys,
|
|
208
208
|
virtual: !1,
|
|
209
209
|
"items-per-intersection": 10,
|
|
210
|
-
enabled: t(
|
|
210
|
+
enabled: t(c),
|
|
211
211
|
"item-height": 48
|
|
212
212
|
}, {
|
|
213
|
-
default: r(({ item: l, index:
|
|
214
|
-
!ie && l != null ? (
|
|
213
|
+
default: r(({ item: l, index: a, empty: ie }) => [
|
|
214
|
+
!ie && l != null ? (d(), p(N, {
|
|
215
215
|
value: l,
|
|
216
|
-
key: `kun-list-${
|
|
217
|
-
id: `kun-item-${
|
|
216
|
+
key: `kun-list-${a + 1}`,
|
|
217
|
+
id: `kun-item-${a + 1}`,
|
|
218
218
|
disabled: t(Y)(l),
|
|
219
219
|
"bg-items": e.bgItemListColor,
|
|
220
220
|
"hover-bg": e.hoverItemListColor,
|
|
@@ -223,23 +223,23 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
223
223
|
selectable: !0
|
|
224
224
|
}, {
|
|
225
225
|
default: r(() => [
|
|
226
|
-
|
|
226
|
+
i(T, { class: "text-wrap" }, {
|
|
227
227
|
default: r(() => [
|
|
228
228
|
C(D(t(L)(l, e.itemTitle ?? t(G), "hasDefault")), 1)
|
|
229
229
|
]),
|
|
230
230
|
_: 2
|
|
231
231
|
}, 1024),
|
|
232
|
-
|
|
232
|
+
i(ge, {
|
|
233
233
|
text: e.itemSubtitle ? t(L)(l, e.itemSubtitle) : ""
|
|
234
234
|
}, null, 8, ["text"])
|
|
235
235
|
]),
|
|
236
236
|
_: 2
|
|
237
|
-
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (
|
|
237
|
+
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (d(), p(N, {
|
|
238
238
|
key: 1,
|
|
239
239
|
disabled: ""
|
|
240
240
|
}, {
|
|
241
241
|
default: r(() => [
|
|
242
|
-
|
|
242
|
+
i(T, { class: "text-center w-full text-gray-500" }, {
|
|
243
243
|
default: r(() => o[3] || (o[3] = [
|
|
244
244
|
C(" No hay elementos disponibles ")
|
|
245
245
|
])),
|
|
@@ -264,7 +264,7 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
264
264
|
e.hasIcons ? {
|
|
265
265
|
name: "append-inner",
|
|
266
266
|
fn: r(() => [
|
|
267
|
-
e.clearable &&
|
|
267
|
+
e.clearable && s.value ? (d(), p(b, {
|
|
268
268
|
key: 0,
|
|
269
269
|
onClick: t(H),
|
|
270
270
|
size: "small",
|
|
@@ -272,14 +272,14 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
272
272
|
icon: t(v).close,
|
|
273
273
|
class: "mr-1 mt-1"
|
|
274
274
|
}, null, 8, ["onClick", "icon"])) : h("", !0),
|
|
275
|
-
|
|
275
|
+
i(b, {
|
|
276
276
|
color: "teal-darken-1",
|
|
277
277
|
size: "large",
|
|
278
278
|
class: "cursor-pointer",
|
|
279
|
-
icon: t(
|
|
280
|
-
onClick:
|
|
279
|
+
icon: t(c) ? t(v).menuUpOutline : t(v).menuDownOutline,
|
|
280
|
+
onClick: F(t(S), ["stop"])
|
|
281
281
|
}, null, 8, ["icon", "onClick"]),
|
|
282
|
-
e.required ? (
|
|
282
|
+
e.required ? (d(), p(b, {
|
|
283
283
|
key: 1,
|
|
284
284
|
color: "teal-darken-1",
|
|
285
285
|
size: "x-small",
|