adverich-kun-ui 0.1.353 → 0.1.354
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,40 +1,43 @@
|
|
|
1
|
-
import { mergeModels as
|
|
1
|
+
import { mergeModels as A, useModel as R, onMounted as ie, ref as $, watch as ae, createElementBlock as v, openBlock as a, createVNode as i, unref as t, isRef as B, createSlots as re, withCtx as n, createCommentVNode as k, Fragment as se, renderList as ue, createBlock as c, createElementVNode as de, createTextVNode as y, toDisplayString as V, normalizeClass as ce, withModifiers as me } from "vue";
|
|
2
2
|
import { icons as m } from "../../../../icons/index.js";
|
|
3
|
-
import { isNotEmpty as fe, isArray as
|
|
3
|
+
import { isNotEmpty as fe, isArray as F } from "../../../../utils/utils.js";
|
|
4
4
|
import pe from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
5
|
import he from "../../../KunList/src/components/KunList.vue.js";
|
|
6
|
-
import
|
|
6
|
+
import T from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
7
|
import x from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import ve from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
|
+
import ke from "../../../KunMenu/src/components/KunMenu.vue.js";
|
|
10
10
|
import { useAutocomplete as ye } from "../composables/useAutocomplete.js";
|
|
11
11
|
import { KunAutocompleteProps as be } from "../composables/KunAutocompleteProps.js";
|
|
12
12
|
import ge from "../../../KunTextField/src/components/KunTextField.vue.js";
|
|
13
13
|
import Ce from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
14
14
|
import we from "../../../KunChip/src/components/KunChip.vue.js";
|
|
15
|
-
import
|
|
15
|
+
import b from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
16
16
|
const Ve = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "flex justify-center align-center"
|
|
19
|
-
}, Ie = { class: "flex justify-center align-center" },
|
|
19
|
+
}, Ie = { class: "flex justify-center align-center" }, Se = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "p-2"
|
|
22
|
+
}, Ue = {
|
|
20
23
|
__name: "KunAutocomplete",
|
|
21
|
-
props: /* @__PURE__ */
|
|
24
|
+
props: /* @__PURE__ */ A(be, {
|
|
22
25
|
modelValue: { default: null },
|
|
23
26
|
modelModifiers: {},
|
|
24
27
|
items: { default: [], type: Array, required: !0 },
|
|
25
28
|
itemsModifiers: {}
|
|
26
29
|
}),
|
|
27
|
-
emits: /* @__PURE__ */
|
|
28
|
-
setup(
|
|
29
|
-
const r =
|
|
30
|
-
textFieldRef:
|
|
31
|
-
listRef:
|
|
30
|
+
emits: /* @__PURE__ */ A(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
31
|
+
setup(g, { emit: E }) {
|
|
32
|
+
const r = R(g, "modelValue"), I = R(g, "items"), u = g, f = E, {
|
|
33
|
+
textFieldRef: C,
|
|
34
|
+
listRef: S,
|
|
32
35
|
menuModel: s,
|
|
33
|
-
search:
|
|
36
|
+
search: d,
|
|
34
37
|
removeItem: N,
|
|
35
38
|
clearSelection: L,
|
|
36
39
|
lightReset: U,
|
|
37
|
-
openMenu:
|
|
40
|
+
openMenu: w,
|
|
38
41
|
closeMenu: H,
|
|
39
42
|
toggleMenu: O,
|
|
40
43
|
onMenuKeydown: j,
|
|
@@ -44,13 +47,13 @@ const Ve = {
|
|
|
44
47
|
isAlphanumeric: G,
|
|
45
48
|
createItem: J,
|
|
46
49
|
checkDisabled: Q,
|
|
47
|
-
itemToString:
|
|
50
|
+
itemToString: D,
|
|
48
51
|
placeholder: X
|
|
49
|
-
} = ye(u, f, r,
|
|
50
|
-
|
|
51
|
-
u.focusOnRender &&
|
|
52
|
+
} = ye(u, f, r, I);
|
|
53
|
+
ie(() => {
|
|
54
|
+
u.focusOnRender && C.value.focus();
|
|
52
55
|
});
|
|
53
|
-
const
|
|
56
|
+
const K = $(null), p = $(""), M = (e) => {
|
|
54
57
|
for (const o of u.rules) {
|
|
55
58
|
const l = o(e);
|
|
56
59
|
if (l !== !0)
|
|
@@ -58,12 +61,12 @@ const Ve = {
|
|
|
58
61
|
}
|
|
59
62
|
return p.value = "", f("validation", !0), !0;
|
|
60
63
|
};
|
|
61
|
-
|
|
62
|
-
fe(u.rules) &&
|
|
64
|
+
ae(() => r.value, (e, o) => {
|
|
65
|
+
fe(u.rules) && M(e);
|
|
63
66
|
});
|
|
64
67
|
function Y() {
|
|
65
68
|
var e;
|
|
66
|
-
s.value = !1, (e =
|
|
69
|
+
s.value = !1, (e = C.value.inputField) == null || e.focus();
|
|
67
70
|
}
|
|
68
71
|
function Z(e) {
|
|
69
72
|
var l, h;
|
|
@@ -72,28 +75,28 @@ const Ve = {
|
|
|
72
75
|
H();
|
|
73
76
|
return;
|
|
74
77
|
}
|
|
75
|
-
(G(o) || o === "Backspace") &&
|
|
78
|
+
(G(o) || o === "Backspace") && w(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), s.value || w(), (h = (l = S.value) == null ? void 0 : l.focusWithKey) == null || h.call(l, o));
|
|
76
79
|
}
|
|
77
80
|
function ee(e) {
|
|
78
|
-
f("search",
|
|
81
|
+
f("search", d);
|
|
79
82
|
}
|
|
80
83
|
function le() {
|
|
81
|
-
|
|
84
|
+
M(r);
|
|
82
85
|
}
|
|
83
86
|
function te(e) {
|
|
84
87
|
j(e);
|
|
85
88
|
}
|
|
86
89
|
function oe() {
|
|
87
90
|
}
|
|
88
|
-
return (e, o) => (
|
|
91
|
+
return (e, o) => (a(), v("div", {
|
|
89
92
|
class: "w-full h-fit",
|
|
90
93
|
ref_key: "parentRef",
|
|
91
|
-
ref:
|
|
94
|
+
ref: K
|
|
92
95
|
}, [
|
|
93
|
-
|
|
94
|
-
modelValue: t(
|
|
96
|
+
i(ge, {
|
|
97
|
+
modelValue: t(d),
|
|
95
98
|
"onUpdate:modelValue": [
|
|
96
|
-
o[1] || (o[1] = (l) =>
|
|
99
|
+
o[1] || (o[1] = (l) => B(d) ? d.value = l : null),
|
|
97
100
|
ee
|
|
98
101
|
],
|
|
99
102
|
label: e.label,
|
|
@@ -101,28 +104,28 @@ const Ve = {
|
|
|
101
104
|
"hide-details": e.hideDetails,
|
|
102
105
|
density: e.density,
|
|
103
106
|
ref_key: "textFieldRef",
|
|
104
|
-
ref:
|
|
107
|
+
ref: C,
|
|
105
108
|
autocomplete: "off",
|
|
106
109
|
onFocusInput: le,
|
|
107
110
|
onHandleClick: t(O),
|
|
108
111
|
rounded: t(s) ? "rounded-t" : "rounded",
|
|
109
112
|
onBlur: oe,
|
|
110
113
|
onKeyDown: Z,
|
|
111
|
-
placeholder: u.multiple && t(
|
|
114
|
+
placeholder: u.multiple && t(F)(r.value) && r.value.length ? "" : t(X),
|
|
112
115
|
error: !!p.value,
|
|
113
116
|
"error-messages": p.value
|
|
114
117
|
}, re({
|
|
115
118
|
default: n(() => [
|
|
116
|
-
t(
|
|
117
|
-
(
|
|
119
|
+
t(F)(r.value) ? (a(), v("div", Ve, [
|
|
120
|
+
(a(!0), v(se, null, ue(r.value, (l) => (a(), c(we, {
|
|
118
121
|
key: l.id ?? l.name,
|
|
119
122
|
size: "small",
|
|
120
123
|
class: "ml-1"
|
|
121
124
|
}, {
|
|
122
125
|
default: n(() => [
|
|
123
126
|
de("div", Ie, [
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
y(V(t(W)(l, e.itemTitle)) + " ", 1),
|
|
128
|
+
i(b, {
|
|
126
129
|
color: "error",
|
|
127
130
|
icon: t(m).close,
|
|
128
131
|
size: "small",
|
|
@@ -134,14 +137,14 @@ const Ve = {
|
|
|
134
137
|
_: 2
|
|
135
138
|
}, 1024))), 128))
|
|
136
139
|
])) : k("", !0),
|
|
137
|
-
|
|
140
|
+
i(ke, {
|
|
138
141
|
transition: "fade",
|
|
139
142
|
"onClick:outside": t(U),
|
|
140
143
|
modelValue: t(s),
|
|
141
|
-
"onUpdate:modelValue": o[0] || (o[0] = (l) =>
|
|
144
|
+
"onUpdate:modelValue": o[0] || (o[0] = (l) => B(s) ? s.value = l : null),
|
|
142
145
|
activator: "parent",
|
|
143
146
|
"z-index": e.zIndex,
|
|
144
|
-
"parent-ref":
|
|
147
|
+
"parent-ref": K.value,
|
|
145
148
|
location: "bottom",
|
|
146
149
|
origin: "bottom left",
|
|
147
150
|
onHandleEscape: Y,
|
|
@@ -151,32 +154,29 @@ const Ve = {
|
|
|
151
154
|
"hide-details": e.hideDetails
|
|
152
155
|
}, {
|
|
153
156
|
default: n(() => [
|
|
154
|
-
|
|
157
|
+
i(he, {
|
|
155
158
|
"onClick:select": t(q),
|
|
156
159
|
ref_key: "listRef",
|
|
157
|
-
ref:
|
|
160
|
+
ref: S,
|
|
158
161
|
onKeyDown: te,
|
|
159
162
|
selectable: !0
|
|
160
163
|
}, {
|
|
161
164
|
default: n(() => [
|
|
162
|
-
e.hasCreateItem ? (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
a(pe, {
|
|
178
|
-
items: S.value,
|
|
179
|
-
search: t(c),
|
|
165
|
+
e.hasCreateItem ? (a(), v("div", Se, [
|
|
166
|
+
i(Ce, {
|
|
167
|
+
onClick: t(J),
|
|
168
|
+
bgColor: e.btnCreateBg,
|
|
169
|
+
class: ce(e.btnCreateClass)
|
|
170
|
+
}, {
|
|
171
|
+
default: n(() => [
|
|
172
|
+
y(V(e.btnCreateText), 1)
|
|
173
|
+
]),
|
|
174
|
+
_: 1
|
|
175
|
+
}, 8, ["onClick", "bgColor", "class"])
|
|
176
|
+
])) : k("", !0),
|
|
177
|
+
i(pe, {
|
|
178
|
+
items: I.value,
|
|
179
|
+
search: t(d),
|
|
180
180
|
"searchable-keys": u.searchableKeys,
|
|
181
181
|
virtual: !1,
|
|
182
182
|
"items-per-intersection": 10,
|
|
@@ -184,39 +184,39 @@ const Ve = {
|
|
|
184
184
|
"item-height": 48
|
|
185
185
|
}, {
|
|
186
186
|
default: n(({ item: l, index: h, empty: ne }) => {
|
|
187
|
-
var
|
|
187
|
+
var _, z;
|
|
188
188
|
return [
|
|
189
|
-
!ne && l ? (
|
|
189
|
+
!ne && l ? (a(), c(T, {
|
|
190
190
|
value: l,
|
|
191
|
-
key: ((
|
|
191
|
+
key: ((_ = l.id) == null ? void 0 : _.toString()) ?? l.name,
|
|
192
192
|
disabled: t(Q)(l),
|
|
193
193
|
"bg-items": e.bgItemListColor,
|
|
194
194
|
"hover-bg": e.hoverItemListColor,
|
|
195
195
|
activeClass: e.selectedItemListColor,
|
|
196
196
|
density: e.density,
|
|
197
|
-
id: ((
|
|
197
|
+
id: ((z = l.id) == null ? void 0 : z.toString()) ?? l.name,
|
|
198
198
|
selectable: !0
|
|
199
199
|
}, {
|
|
200
200
|
default: n(() => [
|
|
201
|
-
|
|
201
|
+
i(x, { class: "text-wrap" }, {
|
|
202
202
|
default: n(() => [
|
|
203
|
-
|
|
203
|
+
y(V(t(D)(l, e.itemTitle ?? t(P), "hasDefault")), 1)
|
|
204
204
|
]),
|
|
205
205
|
_: 2
|
|
206
206
|
}, 1024),
|
|
207
|
-
|
|
208
|
-
text: e.itemSubtitle ? t(
|
|
207
|
+
i(ve, {
|
|
208
|
+
text: e.itemSubtitle ? t(D)(l, e.itemSubtitle) : ""
|
|
209
209
|
}, null, 8, ["text"])
|
|
210
210
|
]),
|
|
211
211
|
_: 2
|
|
212
|
-
}, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (
|
|
212
|
+
}, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (a(), c(T, {
|
|
213
213
|
key: 1,
|
|
214
214
|
disabled: ""
|
|
215
215
|
}, {
|
|
216
216
|
default: n(() => [
|
|
217
|
-
|
|
217
|
+
i(x, { class: "text-center w-full text-gray-500" }, {
|
|
218
218
|
default: n(() => o[2] || (o[2] = [
|
|
219
|
-
|
|
219
|
+
y(" No hay elementos disponibles ")
|
|
220
220
|
])),
|
|
221
221
|
_: 1,
|
|
222
222
|
__: [2]
|
|
@@ -240,7 +240,7 @@ const Ve = {
|
|
|
240
240
|
e.hasIcons ? {
|
|
241
241
|
name: "append-inner",
|
|
242
242
|
fn: n(() => [
|
|
243
|
-
e.clearable && r.value ? (
|
|
243
|
+
e.clearable && r.value ? (a(), c(b, {
|
|
244
244
|
key: 0,
|
|
245
245
|
onClick: t(L),
|
|
246
246
|
size: "small",
|
|
@@ -248,14 +248,14 @@ const Ve = {
|
|
|
248
248
|
icon: t(m).close,
|
|
249
249
|
class: "mr-1 mt-1"
|
|
250
250
|
}, null, 8, ["onClick", "icon"])) : k("", !0),
|
|
251
|
-
|
|
251
|
+
i(b, {
|
|
252
252
|
color: "teal-darken-1",
|
|
253
253
|
size: "large",
|
|
254
254
|
class: "cursor-pointer",
|
|
255
255
|
icon: t(s) ? t(m).menuUpOutline : t(m).menuDownOutline,
|
|
256
|
-
onClick: me(t(
|
|
256
|
+
onClick: me(t(w), ["stop"])
|
|
257
257
|
}, null, 8, ["icon", "onClick"]),
|
|
258
|
-
e.required ? (
|
|
258
|
+
e.required ? (a(), c(b, {
|
|
259
259
|
key: 1,
|
|
260
260
|
color: "teal-darken-1",
|
|
261
261
|
size: "x-small",
|
|
@@ -270,5 +270,5 @@ const Ve = {
|
|
|
270
270
|
}
|
|
271
271
|
};
|
|
272
272
|
export {
|
|
273
|
-
|
|
273
|
+
Ue as default
|
|
274
274
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ref as o, computed as M, watch as H, nextTick as F } from "vue";
|
|
2
|
-
import { isArray as
|
|
2
|
+
import { isArray as j, isObject as b, fullCopy as L } from "../../../../utils/utils.js";
|
|
3
3
|
function U(t, h, c, s) {
|
|
4
|
-
const l = o(null), d = o(null),
|
|
4
|
+
const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), V = M(() => l.value ? j(l.value) ? l.value.length ? x(l.value, t.itemTitle, "hasDefault") : t.placeholderText : b(l.value) ? x(l.value, t.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? t.placeholderText : t.textNoItems), B = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
|
|
5
5
|
function x(e, n, u) {
|
|
6
6
|
var r;
|
|
7
7
|
if (b(e)) {
|
|
8
8
|
if (n) {
|
|
9
|
-
if (
|
|
9
|
+
if (j(n))
|
|
10
10
|
return n.map((i) => e[i] ?? "No definido").join(" - ");
|
|
11
11
|
if (n.includes(","))
|
|
12
12
|
return n.split(",").map((i) => e[i]).join(" - ");
|
|
@@ -22,15 +22,15 @@ function U(t, h, c, s) {
|
|
|
22
22
|
if (u)
|
|
23
23
|
return Object.values(e)[0];
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return j(e) ? t.returnObject ? e.map((i) => i[n]).join(" - ") : e.map((i) => i).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
|
|
26
26
|
}
|
|
27
27
|
function R(e) {
|
|
28
28
|
try {
|
|
29
29
|
let n = null;
|
|
30
30
|
if (l.value = L(e), !t.multiple)
|
|
31
|
-
t.returnObject ? n = e : b(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1;
|
|
32
|
-
else if (
|
|
33
|
-
e &&
|
|
31
|
+
t.returnObject ? n = e : b(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1, g();
|
|
32
|
+
else if (S(e))
|
|
33
|
+
e && T(e);
|
|
34
34
|
else {
|
|
35
35
|
const u = t.returnObject ? e : b(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
|
|
36
36
|
n = [...c.value || [], u];
|
|
@@ -40,7 +40,7 @@ function U(t, h, c, s) {
|
|
|
40
40
|
console.log(n);
|
|
41
41
|
} finally {
|
|
42
42
|
F(() => {
|
|
43
|
-
|
|
43
|
+
I();
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -57,12 +57,12 @@ function U(t, h, c, s) {
|
|
|
57
57
|
(u) => typeof u == "object" ? u[t.itemValue] === e : u === e
|
|
58
58
|
) ?? e;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function S(e) {
|
|
61
61
|
return c.value === null ? !1 : e ? c.value.some(
|
|
62
62
|
(n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
|
|
63
63
|
) : !0;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function T(e) {
|
|
66
66
|
let n = c.value;
|
|
67
67
|
if (t.returnObject) {
|
|
68
68
|
const u = n.find(
|
|
@@ -74,10 +74,10 @@ function U(t, h, c, s) {
|
|
|
74
74
|
n.splice(u, 1);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect &&
|
|
77
|
+
function I(e) {
|
|
78
|
+
t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && g();
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function A() {
|
|
81
81
|
f.value || (f.value = !0);
|
|
82
82
|
}
|
|
83
83
|
function D() {
|
|
@@ -86,18 +86,18 @@ function U(t, h, c, s) {
|
|
|
86
86
|
function J() {
|
|
87
87
|
f.value = !f.value;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function k(e) {
|
|
90
90
|
return e.length === 1 && e.match(/\w/);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function g() {
|
|
93
93
|
d.value.inputField.focus();
|
|
94
94
|
}
|
|
95
95
|
function K() {
|
|
96
|
-
f.value = !0,
|
|
96
|
+
f.value = !0, y.value && d.value.$el.focus();
|
|
97
97
|
}
|
|
98
98
|
function $(e) {
|
|
99
99
|
const n = e.key;
|
|
100
|
-
(
|
|
100
|
+
(k(n) || n === "Backspace") && (A(), g(), F(() => {
|
|
101
101
|
var r;
|
|
102
102
|
const u = (r = d.value) == null ? void 0 : r.inputField;
|
|
103
103
|
if (u) {
|
|
@@ -122,7 +122,7 @@ function U(t, h, c, s) {
|
|
|
122
122
|
return {
|
|
123
123
|
selectedItem: l,
|
|
124
124
|
textFieldRef: d,
|
|
125
|
-
listRef:
|
|
125
|
+
listRef: y,
|
|
126
126
|
menuModel: f,
|
|
127
127
|
search: v,
|
|
128
128
|
getItemText: N,
|
|
@@ -130,10 +130,10 @@ function U(t, h, c, s) {
|
|
|
130
130
|
textArr: B,
|
|
131
131
|
itemToString: x,
|
|
132
132
|
getSelectedItem: R,
|
|
133
|
-
checkIfValueExist:
|
|
134
|
-
removeFromArray:
|
|
135
|
-
lightReset:
|
|
136
|
-
openMenu:
|
|
133
|
+
checkIfValueExist: S,
|
|
134
|
+
removeFromArray: T,
|
|
135
|
+
lightReset: I,
|
|
136
|
+
openMenu: A,
|
|
137
137
|
closeMenu: D,
|
|
138
138
|
toggleMenu: J,
|
|
139
139
|
focusOnMenu: K,
|
|
@@ -142,7 +142,7 @@ function U(t, h, c, s) {
|
|
|
142
142
|
removeItem: z,
|
|
143
143
|
clearSelection: w,
|
|
144
144
|
checkDisabled: G,
|
|
145
|
-
isAlphanumeric:
|
|
145
|
+
isAlphanumeric: k
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
export {
|