adverich-kun-ui 0.1.494 → 0.1.496
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
|
|
1
|
+
import { mergeModels as $, useModel as x, onMounted as se, ref as z, watch as ue, nextTick as A, createElementBlock as y, openBlock as d, createVNode as i, unref as t, withKeys as de, withModifiers as E, isRef as _, createSlots as ce, withCtx as n, createCommentVNode as g, normalizeClass as me, createTextVNode as b, toDisplayString as V, 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 R, isArray as O } 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 B from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
|
+
import F 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" }, Ke = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "sticky top-0 z-10 p-2 border-b bg-select-background"
|
|
22
22
|
}, je = {
|
|
@@ -28,32 +28,32 @@ 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"), f = x(w, "items"), u = w, m =
|
|
31
|
+
setup(w, { expose: T, emit: N }) {
|
|
32
|
+
const s = x(w, "modelValue"), f = x(w, "items"), u = w, m = N, {
|
|
33
33
|
textFieldRef: k,
|
|
34
34
|
listRef: D,
|
|
35
35
|
menuModel: c,
|
|
36
36
|
search: r,
|
|
37
|
-
removeItem:
|
|
38
|
-
clearSelection:
|
|
39
|
-
lightReset:
|
|
37
|
+
removeItem: U,
|
|
38
|
+
clearSelection: j,
|
|
39
|
+
lightReset: H,
|
|
40
40
|
openMenu: S,
|
|
41
|
-
closeMenu:
|
|
42
|
-
toggleMenu:
|
|
43
|
-
onMenuKeydown:
|
|
41
|
+
closeMenu: q,
|
|
42
|
+
toggleMenu: P,
|
|
43
|
+
onMenuKeydown: W,
|
|
44
44
|
getSelectedItem: I,
|
|
45
|
-
textArr:
|
|
46
|
-
getArrayText:
|
|
47
|
-
isAlphanumeric:
|
|
48
|
-
createItem:
|
|
49
|
-
checkDisabled:
|
|
50
|
-
itemToString:
|
|
51
|
-
placeholder:
|
|
45
|
+
textArr: G,
|
|
46
|
+
getArrayText: J,
|
|
47
|
+
isAlphanumeric: Q,
|
|
48
|
+
createItem: X,
|
|
49
|
+
checkDisabled: Y,
|
|
50
|
+
itemToString: K,
|
|
51
|
+
placeholder: Z
|
|
52
52
|
} = be(u, m, s, f);
|
|
53
|
-
|
|
53
|
+
se(() => {
|
|
54
54
|
u.focusOnRender && k.value.focus();
|
|
55
55
|
});
|
|
56
|
-
const
|
|
56
|
+
const L = z(null), h = z(""), M = (e) => {
|
|
57
57
|
for (const o of u.rules) {
|
|
58
58
|
const l = o(e);
|
|
59
59
|
if (l !== !0)
|
|
@@ -61,34 +61,34 @@ const De = {
|
|
|
61
61
|
}
|
|
62
62
|
return h.value = "", m("validation", !0), !0;
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
ue(() => s.value, (e, o) => {
|
|
65
|
+
R(u.rules) && M(e);
|
|
66
66
|
});
|
|
67
|
-
function
|
|
67
|
+
function ee() {
|
|
68
68
|
var e;
|
|
69
69
|
c.value = !1, (e = k.value.inputField) == null || e.focus();
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function le(e) {
|
|
72
72
|
var l, a;
|
|
73
73
|
const o = e.key;
|
|
74
74
|
if (o === "Tab" || o === "Shift" || o === "Escape") {
|
|
75
|
-
|
|
75
|
+
q(), m("keyDown", o);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
(
|
|
78
|
+
(Q(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
|
|
80
|
+
function te(e) {
|
|
81
81
|
m("search", r);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function oe() {
|
|
84
84
|
M(s);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
86
|
+
function ne(e) {
|
|
87
|
+
W(e);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function re() {
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function ae(e) {
|
|
92
92
|
if (!r.value) return;
|
|
93
93
|
let o = null;
|
|
94
94
|
u.returnObject ? o = f.value.find(
|
|
@@ -103,7 +103,7 @@ const De = {
|
|
|
103
103
|
m("keyDownEnter", e);
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
return
|
|
106
|
+
return T({
|
|
107
107
|
focus: () => A(() => {
|
|
108
108
|
var e;
|
|
109
109
|
return (e = k.value) == null ? void 0 : e.focus();
|
|
@@ -111,13 +111,13 @@ const De = {
|
|
|
111
111
|
}), (e, o) => (d(), y("div", {
|
|
112
112
|
class: "w-full h-fit",
|
|
113
113
|
ref_key: "parentRef",
|
|
114
|
-
ref:
|
|
114
|
+
ref: L
|
|
115
115
|
}, [
|
|
116
116
|
i(we, {
|
|
117
117
|
modelValue: t(r),
|
|
118
118
|
"onUpdate:modelValue": [
|
|
119
|
-
o[1] || (o[1] = (l) =>
|
|
120
|
-
|
|
119
|
+
o[1] || (o[1] = (l) => _(r) ? r.value = l : null),
|
|
120
|
+
te
|
|
121
121
|
],
|
|
122
122
|
label: e.label,
|
|
123
123
|
dirty: "",
|
|
@@ -126,34 +126,34 @@ const De = {
|
|
|
126
126
|
ref_key: "textFieldRef",
|
|
127
127
|
ref: k,
|
|
128
128
|
autocomplete: "off",
|
|
129
|
-
onFocusInput:
|
|
130
|
-
onHandleClick: t(
|
|
129
|
+
onFocusInput: oe,
|
|
130
|
+
onHandleClick: t(P),
|
|
131
131
|
rounded: t(c) ? "rounded-t" : "rounded",
|
|
132
|
-
onBlur:
|
|
132
|
+
onBlur: re,
|
|
133
133
|
onKeyDown: [
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
le,
|
|
135
|
+
de(E(ae, ["prevent"]), ["enter"])
|
|
136
136
|
],
|
|
137
|
-
placeholder: u.multiple && t(
|
|
137
|
+
placeholder: u.multiple && t(O)(s.value) && s.value.length ? "" : t(Z),
|
|
138
138
|
error: !!h.value,
|
|
139
139
|
"error-messages": h.value
|
|
140
|
-
},
|
|
140
|
+
}, ce({
|
|
141
141
|
"prepend-input-content": n(() => [
|
|
142
|
-
t(
|
|
143
|
-
(d(!0), y(
|
|
142
|
+
t(O)(s.value) && t(R)(s.value) ? (d(), y("div", De, [
|
|
143
|
+
(d(!0), y(fe, null, pe(s.value, (l) => (d(), p(Ve, {
|
|
144
144
|
key: l.id ?? l.name,
|
|
145
145
|
size: "small",
|
|
146
146
|
variant: "pill"
|
|
147
147
|
}, {
|
|
148
148
|
default: n(() => [
|
|
149
|
-
|
|
150
|
-
b(V(t(
|
|
149
|
+
ve("div", Ie, [
|
|
150
|
+
b(V(t(J)(l)) + " ", 1),
|
|
151
151
|
i(C, {
|
|
152
152
|
color: "error",
|
|
153
153
|
icon: t(v).close,
|
|
154
154
|
size: "small",
|
|
155
155
|
class: "ml-1",
|
|
156
|
-
onClick: (a) => t(
|
|
156
|
+
onClick: (a) => t(U)(l)
|
|
157
157
|
}, null, 8, ["icon", "onClick"])
|
|
158
158
|
])
|
|
159
159
|
]),
|
|
@@ -164,14 +164,14 @@ const De = {
|
|
|
164
164
|
default: n(() => [
|
|
165
165
|
i(ge, {
|
|
166
166
|
transition: "fade",
|
|
167
|
-
"onClick:outside": t(
|
|
167
|
+
"onClick:outside": t(H),
|
|
168
168
|
modelValue: t(c),
|
|
169
|
-
"onUpdate:modelValue": o[0] || (o[0] = (l) =>
|
|
169
|
+
"onUpdate:modelValue": o[0] || (o[0] = (l) => _(c) ? c.value = l : null),
|
|
170
170
|
activator: "parent",
|
|
171
171
|
"z-index": e.zIndex,
|
|
172
|
-
"parent-ref":
|
|
172
|
+
"parent-ref": L.value,
|
|
173
173
|
origin: e.menuOrigin,
|
|
174
|
-
onHandleEscape:
|
|
174
|
+
onHandleEscape: ee,
|
|
175
175
|
bgColor: e.bgMenuColor,
|
|
176
176
|
"close-on-content-click": e.closeOnSelect,
|
|
177
177
|
width: "w-full",
|
|
@@ -179,11 +179,11 @@ const De = {
|
|
|
179
179
|
"hide-details": e.hideDetails
|
|
180
180
|
}, {
|
|
181
181
|
default: n(() => [
|
|
182
|
-
e.hasCreateItem ? (d(), y("div",
|
|
182
|
+
e.hasCreateItem ? (d(), y("div", Ke, [
|
|
183
183
|
i(Se, {
|
|
184
|
-
onClick: t(
|
|
184
|
+
onClick: t(X),
|
|
185
185
|
bgColor: e.btnCreateBg,
|
|
186
|
-
class:
|
|
186
|
+
class: me(e.btnCreateClass)
|
|
187
187
|
}, {
|
|
188
188
|
default: n(() => [
|
|
189
189
|
b(V(e.btnCreateText), 1)
|
|
@@ -195,7 +195,7 @@ const De = {
|
|
|
195
195
|
"onClick:select": t(I),
|
|
196
196
|
ref_key: "listRef",
|
|
197
197
|
ref: D,
|
|
198
|
-
onKeyDown:
|
|
198
|
+
onKeyDown: ne,
|
|
199
199
|
selectable: !0
|
|
200
200
|
}, {
|
|
201
201
|
default: n(() => [
|
|
@@ -208,12 +208,12 @@ const De = {
|
|
|
208
208
|
enabled: t(c),
|
|
209
209
|
"item-height": 48
|
|
210
210
|
}, {
|
|
211
|
-
default: n(({ item: l, index: a, empty:
|
|
212
|
-
!
|
|
211
|
+
default: n(({ item: l, index: a, empty: ie }) => [
|
|
212
|
+
!ie && l != null ? (d(), p(B, {
|
|
213
213
|
value: l,
|
|
214
214
|
key: `kun-list-${a + 1}`,
|
|
215
215
|
id: `kun-item-${a + 1}`,
|
|
216
|
-
disabled: t(
|
|
216
|
+
disabled: t(Y)(l),
|
|
217
217
|
"bg-items": e.bgItemListColor,
|
|
218
218
|
"hover-bg": e.hoverItemListColor,
|
|
219
219
|
activeClass: e.selectedItemListColor,
|
|
@@ -221,23 +221,23 @@ const De = {
|
|
|
221
221
|
selectable: !0
|
|
222
222
|
}, {
|
|
223
223
|
default: n(() => [
|
|
224
|
-
i(
|
|
224
|
+
i(F, { class: "text-wrap" }, {
|
|
225
225
|
default: n(() => [
|
|
226
|
-
b(V(t(
|
|
226
|
+
b(V(t(K)(l, e.itemTitle ?? t(G), "hasDefault")), 1)
|
|
227
227
|
]),
|
|
228
228
|
_: 2
|
|
229
229
|
}, 1024),
|
|
230
230
|
i(ye, {
|
|
231
|
-
text: e.itemSubtitle ? t(
|
|
231
|
+
text: e.itemSubtitle ? t(K)(l, e.itemSubtitle) : ""
|
|
232
232
|
}, null, 8, ["text"])
|
|
233
233
|
]),
|
|
234
234
|
_: 2
|
|
235
|
-
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (d(), p(
|
|
235
|
+
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (d(), p(B, {
|
|
236
236
|
key: 1,
|
|
237
237
|
disabled: ""
|
|
238
238
|
}, {
|
|
239
239
|
default: n(() => [
|
|
240
|
-
i(
|
|
240
|
+
i(F, { class: "text-center w-full text-gray-500" }, {
|
|
241
241
|
default: n(() => o[2] || (o[2] = [
|
|
242
242
|
b(" No hay elementos disponibles ")
|
|
243
243
|
])),
|
|
@@ -264,7 +264,7 @@ const De = {
|
|
|
264
264
|
fn: n(() => [
|
|
265
265
|
e.clearable && s.value ? (d(), p(C, {
|
|
266
266
|
key: 0,
|
|
267
|
-
onClick: t(
|
|
267
|
+
onClick: t(j),
|
|
268
268
|
size: "small",
|
|
269
269
|
color: "error",
|
|
270
270
|
icon: t(v).close,
|
|
@@ -275,7 +275,7 @@ const De = {
|
|
|
275
275
|
size: "large",
|
|
276
276
|
class: "cursor-pointer",
|
|
277
277
|
icon: t(c) ? t(v).menuUpOutline : t(v).menuDownOutline,
|
|
278
|
-
onClick:
|
|
278
|
+
onClick: E(t(S), ["stop"])
|
|
279
279
|
}, null, 8, ["icon", "onClick"]),
|
|
280
280
|
e.required ? (d(), p(C, {
|
|
281
281
|
key: 1,
|
|
@@ -287,7 +287,7 @@ const De = {
|
|
|
287
287
|
]),
|
|
288
288
|
key: "0"
|
|
289
289
|
} : void 0
|
|
290
|
-
]), 1032, ["modelValue", "label", "hide-details", "density", "onHandleClick", "rounded", "placeholder", "error", "error-messages"])
|
|
290
|
+
]), 1032, ["modelValue", "label", "hide-details", "density", "onHandleClick", "rounded", "onKeyDown", "placeholder", "error", "error-messages"])
|
|
291
291
|
], 512));
|
|
292
292
|
}
|
|
293
293
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as a, inject as V, computed as E, watch as
|
|
1
|
+
import { ref as a, inject as V, computed as E, watch as g, onUnmounted as T } from "vue";
|
|
2
2
|
import { debounce as j } from "../../../../utils/utils.js";
|
|
3
3
|
function R(u, r) {
|
|
4
|
-
const l = a(u.modelValue ?? ""), o = a(!1), t = a(""), n = a(!1),
|
|
4
|
+
const l = a(u.modelValue ?? ""), o = a(!1), t = a(""), n = a(!1), F = a(null), h = a(null), s = a(!1), d = V("registerField", null), v = V("unregisterField", null), b = E(() => u.error || !!t.value && n.value), c = async () => {
|
|
5
5
|
for (const e of u.rules) {
|
|
6
6
|
const m = await Promise.resolve(e(l.value));
|
|
7
7
|
if (m !== !0) return m;
|
|
@@ -11,16 +11,16 @@ function R(u, r) {
|
|
|
11
11
|
const e = await c();
|
|
12
12
|
t.value = e === !0 ? "" : e;
|
|
13
13
|
}, u.debounce ?? 300);
|
|
14
|
-
|
|
14
|
+
g(() => u.modelValue, (e) => {
|
|
15
15
|
e !== l.value && (s.value = !0, l.value = e ?? "");
|
|
16
|
-
}),
|
|
16
|
+
}), g(l, () => {
|
|
17
17
|
if (s.value) {
|
|
18
18
|
s.value = !1;
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
n.value = !0, r("update:modelValue", l.value), u.validateOnBlur || f();
|
|
22
22
|
});
|
|
23
|
-
const
|
|
23
|
+
const y = (e) => {
|
|
24
24
|
l.value = e.target.value;
|
|
25
25
|
}, w = async () => {
|
|
26
26
|
if (o.value = !1, u.validateOnBlur) {
|
|
@@ -29,7 +29,7 @@ function R(u, r) {
|
|
|
29
29
|
}
|
|
30
30
|
r("blur");
|
|
31
31
|
}, B = () => {
|
|
32
|
-
o.value = !0, r("focus");
|
|
32
|
+
console.log("deberia hacer el focus"), o.value = !0, r("focus");
|
|
33
33
|
}, I = () => {
|
|
34
34
|
l.value = "", r("update:modelValue", ""), n.value = !0, u.validateOnBlur || f();
|
|
35
35
|
}, i = async () => {
|
|
@@ -44,13 +44,13 @@ function R(u, r) {
|
|
|
44
44
|
return d && d({ validate: i }), T(() => {
|
|
45
45
|
v && v({ validate: i });
|
|
46
46
|
}), {
|
|
47
|
-
inputField:
|
|
47
|
+
inputField: F,
|
|
48
48
|
inputValue: l,
|
|
49
49
|
rootRef: h,
|
|
50
50
|
inputFocused: o,
|
|
51
51
|
validationError: t,
|
|
52
|
-
hasError:
|
|
53
|
-
handleInput:
|
|
52
|
+
hasError: b,
|
|
53
|
+
handleInput: y,
|
|
54
54
|
handleBlur: w,
|
|
55
55
|
focusInput: B,
|
|
56
56
|
validate: i,
|