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