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