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