adverich-kun-ui 0.1.124 → 0.1.125
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.
- package/dist/adverich-kun-ui.css +1 -1
- package/dist/components/KunAutocomplete/src/components/KunAutocomplete.vue.js +235 -210
- package/dist/components/KunAutocomplete/src/composables/KunAutocompleteProps.js +5 -11
- package/dist/components/KunAutocomplete/src/composables/useAutocomplete.js +95 -93
- package/dist/components/KunAvatar/src/components/KunAvatar.vue.js +26 -26
- package/dist/components/KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js +41 -30
- package/dist/components/KunNumberField/src/components/KunNumberField.vue.js +135 -137
- package/dist/components/KunTextField/src/components/KunTextField.vue.js +62 -56
- package/dist/components/KunTextField/src/composables/useKunTextFieldComposable.js +25 -24
- package/dist/components/kunMenu/src/components/kunMenu.vue.js +35 -34
- package/dist/components/kunMenu/src/composables/kunMenuProps.js +21 -5
- package/dist/components/kunMenu/src/composables/useKunMenuStyles.js +29 -31
- package/dist/icons/IconAccountOutline.vue.js +20 -0
- package/dist/icons/IconClose.vue.js +14 -10
- package/dist/icons/index.js +14 -12
- package/package.json +1 -1
|
@@ -1,133 +1,135 @@
|
|
|
1
|
-
import { ref as a, computed as
|
|
2
|
-
import { isArray as
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
7
|
-
if (
|
|
8
|
-
if (
|
|
9
|
-
return
|
|
10
|
-
if (
|
|
11
|
-
return
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
1
|
+
import { ref as a, computed as m, nextTick as G } from "vue";
|
|
2
|
+
import { isArray as O, isObject as d } from "../../../../utils/utils.js";
|
|
3
|
+
function L(n, s, c, w) {
|
|
4
|
+
const i = a(null), o = a(null), g = a(null), r = a(!1), v = a(""), A = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e), F = m(() => i.value ? O(i.value) ? i.value.length ? h(i.value, n.itemTitle, "hasDefault") : n.placeholderText : d(i.value) ? h(i.value, n.itemTitle, "hasDefault") : i.value.toString() : w.value.length ? n.placeholderText : n.textNoItems), V = m(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
|
|
5
|
+
function h(e, t, u) {
|
|
6
|
+
if (d(e)) {
|
|
7
|
+
if (t) {
|
|
8
|
+
if (O(t))
|
|
9
|
+
return t.map((l) => e[l] ?? "No definido").join(" - ");
|
|
10
|
+
if (t.includes(","))
|
|
11
|
+
return t.split(",").map((l) => e[l]).join(" - ");
|
|
12
|
+
if (t.includes(".")) {
|
|
13
|
+
const l = t.split(".");
|
|
14
14
|
let f = e;
|
|
15
|
-
for (const
|
|
16
|
-
f = f[
|
|
15
|
+
for (const b of l)
|
|
16
|
+
f = f[b];
|
|
17
17
|
return f;
|
|
18
18
|
}
|
|
19
|
-
return !
|
|
19
|
+
return !n.returnObject && typeof e[t] == "number" || e[t] ? e[t].toString() : "";
|
|
20
20
|
}
|
|
21
|
-
if (
|
|
21
|
+
if (u)
|
|
22
22
|
return Object.values(e)[0];
|
|
23
23
|
}
|
|
24
|
-
return
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (j.value = !1, i.value = e, !n.multiple)
|
|
29
|
+
n.returnObject ? c.value = e : d(e) ? n.itemValue ? c.value = e[n.itemValue] : c.value = Object.values(e)[0] : c.value = e, r.value = !1;
|
|
30
|
+
else if (S(e))
|
|
31
|
+
e && T(e);
|
|
32
|
+
else {
|
|
33
|
+
const t = n.returnObject ? e : d(e) ? n.itemValue ? e[n.itemValue] : Object.values(e)[0] : e, u = [...c.value || [], t];
|
|
34
|
+
s("update:modelValue", u);
|
|
35
|
+
}
|
|
36
|
+
s("selectedItem", i.value), n.clearOnSelect && M(), j.value = !0;
|
|
37
|
+
} catch (t) {
|
|
38
|
+
console.log(t);
|
|
31
39
|
} finally {
|
|
32
|
-
|
|
40
|
+
x();
|
|
33
41
|
}
|
|
34
42
|
}
|
|
35
|
-
const
|
|
36
|
-
m(() => u.value, (e) => {
|
|
37
|
-
x.value && (r.value = I(e));
|
|
38
|
-
}, { immediate: !0 }), m(() => s.value, () => {
|
|
39
|
-
r.value = I(u.value);
|
|
40
|
-
}, { immediate: !0 });
|
|
41
|
-
function I(e) {
|
|
42
|
-
return e ? t.returnObject ? e : t.multiple && Array.isArray(e) ? e.map((l) => s.value.find((i) => i[t.itemValue] === l)).filter(Boolean) : s.value.find((l) => l[t.itemValue] === e) || null : null;
|
|
43
|
-
}
|
|
43
|
+
const j = a(!0);
|
|
44
44
|
function S(e) {
|
|
45
|
-
return
|
|
46
|
-
(
|
|
45
|
+
return c.value === null ? !1 : e ? c.value.some(
|
|
46
|
+
(t) => n.returnObject ? t[n.itemValue] === e[n.itemValue] : t === e[n.itemValue]
|
|
47
47
|
) : !0;
|
|
48
48
|
}
|
|
49
49
|
function T(e) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
let t = c.value;
|
|
51
|
+
if (n.returnObject) {
|
|
52
|
+
const u = t.find(
|
|
53
|
+
(f) => f[n.itemValue] === e[n.itemValue]
|
|
54
|
+
), l = t.indexOf(u);
|
|
55
|
+
t.splice(l, 1);
|
|
55
56
|
} else {
|
|
56
|
-
const
|
|
57
|
-
|
|
57
|
+
const u = t.indexOf(e[n.itemValue]);
|
|
58
|
+
t.splice(u, 1);
|
|
58
59
|
}
|
|
60
|
+
s("update:modelValue", t);
|
|
59
61
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
+
function D(e) {
|
|
63
|
+
n.clearSearchOnSelect && (v.value = ""), n.focusOnSelect && x();
|
|
62
64
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
+
function y() {
|
|
66
|
+
r.value || (r.value = !0);
|
|
65
67
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
+
function N() {
|
|
69
|
+
r.value && (r.value = !1);
|
|
68
70
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
+
function B() {
|
|
72
|
+
r.value = !r.value;
|
|
71
73
|
}
|
|
72
|
-
function
|
|
74
|
+
function I(e) {
|
|
73
75
|
return e.length === 1 && e.match(/\w/);
|
|
74
76
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
+
function x() {
|
|
78
|
+
o.value.inputField.focus();
|
|
77
79
|
}
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
+
function C() {
|
|
81
|
+
r.value = !0, g.value && o.value.$el.focus();
|
|
80
82
|
}
|
|
81
|
-
function
|
|
82
|
-
const
|
|
83
|
-
(
|
|
84
|
-
var
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
const f =
|
|
88
|
-
|
|
83
|
+
function K(e) {
|
|
84
|
+
const t = e.key;
|
|
85
|
+
(I(t) || t === "Backspace") && (y(), x(), G(() => {
|
|
86
|
+
var l;
|
|
87
|
+
const u = (l = o.value) == null ? void 0 : l.inputField;
|
|
88
|
+
if (u) {
|
|
89
|
+
const f = u.selectionStart, b = u.selectionEnd, k = u.value, E = e.key.length === 1 ? e.key : "";
|
|
90
|
+
u.value = k.slice(0, f) + E + k.slice(b), u.selectionStart = u.selectionEnd = f + E.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
89
91
|
}
|
|
90
92
|
}));
|
|
91
93
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
+
function $() {
|
|
95
|
+
r.value = !1, s("createItem");
|
|
94
96
|
}
|
|
95
|
-
function
|
|
96
|
-
let
|
|
97
|
-
|
|
97
|
+
function q(e) {
|
|
98
|
+
let t = c.value.indexOf(e);
|
|
99
|
+
c.value.splice(t, 1);
|
|
98
100
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
+
function M() {
|
|
102
|
+
v.value = "", c.value = null, i.value = null;
|
|
101
103
|
}
|
|
102
|
-
function
|
|
103
|
-
return !!e.
|
|
104
|
+
function z(e) {
|
|
105
|
+
return !!e.disabled;
|
|
104
106
|
}
|
|
105
107
|
return {
|
|
106
|
-
selectedItem:
|
|
107
|
-
textFieldRef:
|
|
108
|
-
listRef:
|
|
109
|
-
menuModel:
|
|
110
|
-
search:
|
|
111
|
-
getItemText:
|
|
112
|
-
placeholder:
|
|
113
|
-
textArr:
|
|
114
|
-
itemToString:
|
|
115
|
-
getSelectedItem:
|
|
108
|
+
selectedItem: i,
|
|
109
|
+
textFieldRef: o,
|
|
110
|
+
listRef: g,
|
|
111
|
+
menuModel: r,
|
|
112
|
+
search: v,
|
|
113
|
+
getItemText: A,
|
|
114
|
+
placeholder: F,
|
|
115
|
+
textArr: V,
|
|
116
|
+
itemToString: h,
|
|
117
|
+
getSelectedItem: R,
|
|
116
118
|
checkIfValueExist: S,
|
|
117
119
|
removeFromArray: T,
|
|
118
|
-
lightReset:
|
|
119
|
-
openMenu:
|
|
120
|
-
closeMenu:
|
|
121
|
-
toggleMenu:
|
|
122
|
-
focusOnMenu:
|
|
123
|
-
onMenuKeydown:
|
|
124
|
-
createItem:
|
|
125
|
-
removeItem:
|
|
126
|
-
clearSelection:
|
|
127
|
-
checkDisabled:
|
|
128
|
-
isAlphanumeric:
|
|
120
|
+
lightReset: D,
|
|
121
|
+
openMenu: y,
|
|
122
|
+
closeMenu: N,
|
|
123
|
+
toggleMenu: B,
|
|
124
|
+
focusOnMenu: C,
|
|
125
|
+
onMenuKeydown: K,
|
|
126
|
+
createItem: $,
|
|
127
|
+
removeItem: q,
|
|
128
|
+
clearSelection: M,
|
|
129
|
+
checkDisabled: z,
|
|
130
|
+
isAlphanumeric: I
|
|
129
131
|
};
|
|
130
132
|
}
|
|
131
133
|
export {
|
|
132
|
-
|
|
134
|
+
L as useAutocomplete
|
|
133
135
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed as
|
|
1
|
+
import { computed as l, createBlock as x, openBlock as r, resolveDynamicComponent as y, mergeProps as b, withCtx as v, createElementBlock as s, createCommentVNode as u, renderSlot as S, normalizeClass as a, toDisplayString as d } from "vue";
|
|
2
2
|
const k = ["src", "alt"], w = {
|
|
3
3
|
__name: "KunAvatar",
|
|
4
4
|
props: {
|
|
@@ -19,48 +19,48 @@ const k = ["src", "alt"], w = {
|
|
|
19
19
|
variant: { type: String, default: "flat" }
|
|
20
20
|
},
|
|
21
21
|
emits: ["click", "hover", "contextmenu", "focus"],
|
|
22
|
-
setup(
|
|
23
|
-
const i = {
|
|
22
|
+
setup(m) {
|
|
23
|
+
const e = m, i = {
|
|
24
24
|
"x-small": "w-6 h-6 text-xs",
|
|
25
25
|
small: "w-8 h-8 text-sm",
|
|
26
26
|
default: "w-12 h-12 text-base",
|
|
27
27
|
large: "w-16 h-16 text-lg",
|
|
28
28
|
"x-large": "w-24 h-24 text-xl"
|
|
29
|
-
},
|
|
29
|
+
}, c = l(() => [
|
|
30
30
|
"relative flex items-center justify-center overflow-hidden cursor-pointer transition-all",
|
|
31
|
-
i[size] || i.default,
|
|
32
|
-
rounded ? "rounded-full" : tile ? "rounded-none" : "rounded",
|
|
33
|
-
border ? `border border-${border}` : "",
|
|
34
|
-
color ? `bg-${color}` : "bg-gray-200",
|
|
35
|
-
density === "compact" ? "p-1" : density === "comfortable" ? "p-2" : "p-3",
|
|
36
|
-
start ? "ms-2" : "",
|
|
37
|
-
end ? "me-2" : ""
|
|
38
|
-
]),
|
|
31
|
+
i[e.size] || i.default,
|
|
32
|
+
e.rounded ? "rounded-full" : e.tile ? "rounded-none" : "rounded",
|
|
33
|
+
e.border ? `border border-${e.border}` : "",
|
|
34
|
+
e.color ? `bg-${e.color}` : "bg-gray-200",
|
|
35
|
+
e.density === "compact" ? "p-1" : e.density === "comfortable" ? "p-2" : "p-3",
|
|
36
|
+
e.start ? "ms-2" : "",
|
|
37
|
+
e.end ? "me-2" : ""
|
|
38
|
+
]), f = l(() => [
|
|
39
39
|
"w-full h-full object-cover"
|
|
40
|
-
]),
|
|
40
|
+
]), p = l(() => [
|
|
41
41
|
"absolute text-white text-xl"
|
|
42
|
-
]), g =
|
|
42
|
+
]), g = l(() => [
|
|
43
43
|
"text-center font-semibold"
|
|
44
44
|
]);
|
|
45
|
-
return (n, t) => (
|
|
46
|
-
class:
|
|
47
|
-
onClick: t[0] || (t[0] = (
|
|
48
|
-
onMouseover: t[1] || (t[1] = (
|
|
49
|
-
onContextmenu: t[2] || (t[2] = (
|
|
50
|
-
onFocus: t[3] || (t[3] = (
|
|
45
|
+
return (n, t) => (r(), x(y(e.tag), b(n.$attrs, {
|
|
46
|
+
class: c.value,
|
|
47
|
+
onClick: t[0] || (t[0] = (o) => n.$emit("click", o)),
|
|
48
|
+
onMouseover: t[1] || (t[1] = (o) => n.$emit("hover", o)),
|
|
49
|
+
onContextmenu: t[2] || (t[2] = (o) => n.$emit("contextmenu", o)),
|
|
50
|
+
onFocus: t[3] || (t[3] = (o) => n.$emit("focus", o))
|
|
51
51
|
}), {
|
|
52
52
|
default: v(() => [
|
|
53
|
-
e.image ? (
|
|
53
|
+
e.image ? (r(), s("img", {
|
|
54
54
|
key: 0,
|
|
55
55
|
src: e.image,
|
|
56
56
|
alt: e.alt,
|
|
57
|
-
class:
|
|
58
|
-
}, null, 10, k)) : e.icon ? (
|
|
57
|
+
class: a(f.value)
|
|
58
|
+
}, null, 10, k)) : e.icon ? (r(), s("span", {
|
|
59
59
|
key: 1,
|
|
60
|
-
class:
|
|
61
|
-
}, d(e.icon), 3)) : e.text ? (
|
|
60
|
+
class: a(p.value)
|
|
61
|
+
}, d(e.icon), 3)) : e.text ? (r(), s("span", {
|
|
62
62
|
key: 2,
|
|
63
|
-
class:
|
|
63
|
+
class: a(g.value)
|
|
64
64
|
}, d(e.text), 3)) : u("", !0),
|
|
65
65
|
!e.image && !e.icon && !e.text ? S(n.$slots, "default", { key: 3 }) : u("", !0)
|
|
66
66
|
]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useIntersectionObserver as
|
|
3
|
-
import { useKunInfiniteScroll as
|
|
1
|
+
import { ref as c, computed as f, onMounted as v, createElementBlock as a, openBlock as o, createBlock as I, createElementVNode as g, resolveDynamicComponent as b, unref as t, withCtx as k, renderSlot as u, Fragment as d, renderList as x } from "vue";
|
|
2
|
+
import { useIntersectionObserver as S } from "../composables/useIntersectionObserver.js";
|
|
3
|
+
import { useKunInfiniteScroll as _ } from "../composables/useKunInfiniteScroll.js";
|
|
4
4
|
import B from "../../../KunVirtualScroller/src/components/KunVirtualScroller.vue.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import K from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
@@ -39,49 +39,60 @@ const N = {
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
emits: ["update:items"],
|
|
42
|
-
setup(
|
|
43
|
-
const
|
|
44
|
-
visibleItems:
|
|
45
|
-
loadNextBatch:
|
|
46
|
-
lastBatchReached:
|
|
47
|
-
} =
|
|
48
|
-
items:
|
|
49
|
-
search:
|
|
50
|
-
searchableKeys:
|
|
51
|
-
itemsPerIntersection:
|
|
42
|
+
setup(r, { emit: w }) {
|
|
43
|
+
const n = r, m = c(null), h = c(null), {
|
|
44
|
+
visibleItems: e,
|
|
45
|
+
loadNextBatch: p,
|
|
46
|
+
lastBatchReached: y
|
|
47
|
+
} = _({
|
|
48
|
+
items: f(() => n.items),
|
|
49
|
+
search: f(() => n.search),
|
|
50
|
+
searchableKeys: n.searchableKeys,
|
|
51
|
+
itemsPerIntersection: n.itemsPerIntersection
|
|
52
52
|
});
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
return v(() => {
|
|
54
|
+
S(m.value, ([l]) => {
|
|
55
|
+
l.isIntersecting && (y.value || p());
|
|
56
56
|
});
|
|
57
|
-
}), (
|
|
57
|
+
}), (l, C) => (o(), a("div", {
|
|
58
58
|
class: "w-full h-full overflow-auto",
|
|
59
59
|
ref_key: "scrollContainer",
|
|
60
|
-
ref:
|
|
60
|
+
ref: h
|
|
61
61
|
}, [
|
|
62
|
-
|
|
62
|
+
r.virtual ? (o(), I(b(B), {
|
|
63
63
|
key: 0,
|
|
64
|
-
items:
|
|
65
|
-
"estimated-item-height":
|
|
66
|
-
"scroll-to-index":
|
|
64
|
+
items: t(e).length ? t(e) : [{}],
|
|
65
|
+
"estimated-item-height": r.itemSize,
|
|
66
|
+
"scroll-to-index": r.scrollToIndex,
|
|
67
67
|
class: "virtual-list"
|
|
68
68
|
}, {
|
|
69
|
-
default:
|
|
70
|
-
|
|
71
|
-
item:
|
|
72
|
-
index:
|
|
69
|
+
default: k(({ item: i, index: s }) => [
|
|
70
|
+
u(l.$slots, "default", {
|
|
71
|
+
item: t(e).length ? i : null,
|
|
72
|
+
index: t(e).length ? s : null,
|
|
73
|
+
empty: !t(e).length
|
|
73
74
|
}, void 0, !0)
|
|
74
75
|
]),
|
|
75
76
|
_: 3
|
|
76
|
-
}, 8, ["items", "estimated-item-height", "scroll-to-index"])) : (
|
|
77
|
-
|
|
77
|
+
}, 8, ["items", "estimated-item-height", "scroll-to-index"])) : (o(), a(d, { key: 1 }, [
|
|
78
|
+
t(e).length ? (o(!0), a(d, { key: 0 }, x(t(e), (i, s) => u(l.$slots, "default", {
|
|
79
|
+
key: i.id ?? s,
|
|
80
|
+
item: i,
|
|
81
|
+
index: s,
|
|
82
|
+
visibleItems: t(e)
|
|
83
|
+
}, void 0, !0)), 128)) : u(l.$slots, "default", {
|
|
84
|
+
key: 1,
|
|
85
|
+
visibleItems: t(e)
|
|
86
|
+
}, void 0, !0)
|
|
87
|
+
], 64)),
|
|
88
|
+
g("div", {
|
|
78
89
|
ref_key: "sentinel",
|
|
79
|
-
ref:
|
|
90
|
+
ref: m,
|
|
80
91
|
class: "w-full h-1"
|
|
81
92
|
}, null, 512)
|
|
82
93
|
], 512));
|
|
83
94
|
}
|
|
84
|
-
}, T = /* @__PURE__ */ K(N, [["__scopeId", "data-v-
|
|
95
|
+
}, T = /* @__PURE__ */ K(N, [["__scopeId", "data-v-ecaa5fae"]]);
|
|
85
96
|
export {
|
|
86
97
|
T as default
|
|
87
98
|
};
|