adverich-kun-ui 0.1.29 → 0.1.30
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/_virtual/_plugin-vue_export-helper.js +1 -9
- package/dist/components/KunAlert/src/components/KunAlert.vue.js +1 -49
- package/dist/components/KunAppbar/src/components/KunAppbar.vue.js +1 -127
- package/dist/components/KunAppbarTitle/src/components/KunAppbarTitle.vue.js +1 -31
- package/dist/components/KunAutocomplete/src/components/KunAutocomplete.vue.js +1 -140
- package/dist/components/KunAutocomplete/src/composables/KunAutocompleteProps.js +1 -104
- package/dist/components/KunAutocomplete/src/composables/useAutocomplete.js +1 -119
- package/dist/components/KunAutocomplete/src/utils/helpers.js +1 -10
- package/dist/components/KunBtn/src/components/KunBtn.vue.js +1 -98
- package/dist/components/KunBudge/src/components/KunBudge.vue.js +1 -43
- package/dist/components/KunCard/src/components/KunCard.vue.js +1 -53
- package/dist/components/KunCardText/src/components/KunCardText.vue.js +1 -59
- package/dist/components/KunCurrency/src/components/KunCurrency.vue.js +1 -105
- package/dist/components/KunIcon/src/components/KunIcon.vue.js +1 -54
- package/dist/components/KunList/src/components/KunList.vue.js +1 -9
- package/dist/components/KunSpacer/src/components/KunSpacer.vue.js +1 -25
- package/dist/components/KunTextField/src/components/KunTextField.vue.js +1 -75
- package/dist/components/KunTextField/src/composables/KunTextFieldProps.js +1 -33
- package/dist/components/KunToolbar/src/components/KunToolbar.vue.js +1 -29
- package/dist/index.js +1 -51
- package/package.json +1 -1
|
@@ -1,49 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const c = {
|
|
3
|
-
class: "h-svh top-0 left-0 bg-grey-900 w-full overflow-y-auto opacity-90",
|
|
4
|
-
style: { position: "fixed", "z-index": "2500" }
|
|
5
|
-
}, r = { class: "rounded-lg px-16 py-14" }, u = { class: "flex justify-center py-4" }, m = { class: "rounded-full bg-red-200 p-6" }, _ = { class: "text-center flex flex-col justify-center items-center bg-red-500 rounded-lg p-4" }, f = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "my-4 text-center text-3xl font-semibold"
|
|
8
|
-
}, p = { class: "text-xl font-normal" }, v = {
|
|
9
|
-
__name: "KunAlert",
|
|
10
|
-
props: {
|
|
11
|
-
modelValue: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: !1
|
|
14
|
-
},
|
|
15
|
-
title: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: "Congratulation !!"
|
|
18
|
-
},
|
|
19
|
-
message: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: "Your order have been taken and is being attended to"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
emits: ["update:modelValue"],
|
|
25
|
-
setup(t, { emit: x }) {
|
|
26
|
-
return (y, g) => {
|
|
27
|
-
const l = i("KunIcon");
|
|
28
|
-
return n(), o("div", c, [
|
|
29
|
-
e("div", r, [
|
|
30
|
-
e("div", u, [
|
|
31
|
-
e("div", m, [
|
|
32
|
-
d(l, {
|
|
33
|
-
icon: "exclamation",
|
|
34
|
-
size: "text-9xl"
|
|
35
|
-
})
|
|
36
|
-
])
|
|
37
|
-
]),
|
|
38
|
-
e("div", _, [
|
|
39
|
-
t.title ? (n(), o("div", f, s(t.title), 1)) : a("", !0),
|
|
40
|
-
e("div", p, s(t.message), 1)
|
|
41
|
-
])
|
|
42
|
-
])
|
|
43
|
-
]);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
v as default
|
|
49
|
-
};
|
|
1
|
+
"use strict";const e=require("vue"),n={class:"h-svh top-0 left-0 bg-grey-900 w-full overflow-y-auto opacity-90",style:{position:"fixed","z-index":"2500"}},l={class:"rounded-lg px-16 py-14"},s={class:"flex justify-center py-4"},c={class:"rounded-full bg-red-200 p-6"},i={class:"text-center flex flex-col justify-center items-center bg-red-500 rounded-lg p-4"},a={key:0,class:"my-4 text-center text-3xl font-semibold"},d={class:"text-xl font-normal"},r={__name:"KunAlert",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:"Congratulation !!"},message:{type:String,default:"Your order have been taken and is being attended to"}},emits:["update:modelValue"],setup(t,{emit:u}){return(m,_)=>{const o=e.resolveComponent("KunIcon");return e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",l,[e.createElementVNode("div",s,[e.createElementVNode("div",c,[e.createVNode(o,{icon:"exclamation",size:"text-9xl"})])]),e.createElementVNode("div",i,[t.title?(e.openBlock(),e.createElementBlock("div",a,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",d,e.toDisplayString(t.message),1)])])])}}};module.exports=r;
|
|
@@ -1,127 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import d from "../../../KunAppbarTitle/src/components/KunAppbarTitle.vue.js";
|
|
3
|
-
const y = { class: "flex items-center gap-2" }, S = {
|
|
4
|
-
key: 0,
|
|
5
|
-
class: "flex-1 flex justify-center"
|
|
6
|
-
}, w = {
|
|
7
|
-
key: 1,
|
|
8
|
-
class: "flex-1 flex justify-end"
|
|
9
|
-
}, x = { class: "flex items-center gap-2 ml-auto" }, z = {
|
|
10
|
-
__name: "KunAppbar",
|
|
11
|
-
props: {
|
|
12
|
-
bgColor: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: "bg-green-700"
|
|
15
|
-
},
|
|
16
|
-
title: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: ""
|
|
19
|
-
},
|
|
20
|
-
titleImage: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: ""
|
|
23
|
-
},
|
|
24
|
-
titleSize: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: "text-base"
|
|
27
|
-
},
|
|
28
|
-
titleWeight: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: "font-medium"
|
|
31
|
-
},
|
|
32
|
-
titlePosition: {
|
|
33
|
-
type: String,
|
|
34
|
-
default: "center",
|
|
35
|
-
validator: (t) => ["left", "center", "right"].includes(t)
|
|
36
|
-
},
|
|
37
|
-
density: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "default"
|
|
40
|
-
},
|
|
41
|
-
elevation: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: "md"
|
|
44
|
-
},
|
|
45
|
-
bordered: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: !1
|
|
48
|
-
},
|
|
49
|
-
showDrawerButton: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: !0
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
setup(t) {
|
|
55
|
-
const l = t, f = u(() => {
|
|
56
|
-
switch (l.density) {
|
|
57
|
-
case "comfortable":
|
|
58
|
-
return "h-12 py-1";
|
|
59
|
-
case "compact":
|
|
60
|
-
return "h-10 py-0.5";
|
|
61
|
-
default:
|
|
62
|
-
return "h-14 py-2";
|
|
63
|
-
}
|
|
64
|
-
}), c = u(() => {
|
|
65
|
-
const e = ["sm", "md", "lg", "xl", "2xl"];
|
|
66
|
-
return l.elevation === "none" || !e.includes(l.elevation) ? "" : `shadow-${l.elevation}`;
|
|
67
|
-
});
|
|
68
|
-
return (e, n) => (i(), o("header", {
|
|
69
|
-
class: m(["flex items-center px-4 w-full", [f.value, t.bgColor, c.value, t.bordered ? "border-b border-gray-200" : ""]])
|
|
70
|
-
}, [
|
|
71
|
-
a("div", y, [
|
|
72
|
-
s(e.$slots, "appbarButton", {}, () => [
|
|
73
|
-
t.showDrawerButton ? (i(), o("button", {
|
|
74
|
-
key: 0,
|
|
75
|
-
class: "p-2 rounded-md hover:bg-white/10 transition",
|
|
76
|
-
onClick: n[0] || (n[0] = (v) => e.$emit("toggle-drawer"))
|
|
77
|
-
}, n[1] || (n[1] = [
|
|
78
|
-
a("svg", {
|
|
79
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
80
|
-
class: "h-5 w-5 text-white",
|
|
81
|
-
fill: "none",
|
|
82
|
-
viewBox: "0 0 24 24",
|
|
83
|
-
stroke: "currentColor"
|
|
84
|
-
}, [
|
|
85
|
-
a("path", {
|
|
86
|
-
"stroke-linecap": "round",
|
|
87
|
-
"stroke-linejoin": "round",
|
|
88
|
-
"stroke-width": "2",
|
|
89
|
-
d: "M4 6h16M4 12h16M4 18h16"
|
|
90
|
-
})
|
|
91
|
-
], -1)
|
|
92
|
-
]))) : r("", !0)
|
|
93
|
-
]),
|
|
94
|
-
s(e.$slots, "prepend"),
|
|
95
|
-
t.title && t.titlePosition === "left" ? (i(), h(d, {
|
|
96
|
-
key: 0,
|
|
97
|
-
title: t.title,
|
|
98
|
-
titleImage: t.titleImage,
|
|
99
|
-
textSize: t.titleSize,
|
|
100
|
-
fontWeight: t.titleWeight
|
|
101
|
-
}, null, 8, ["title", "titleImage", "textSize", "fontWeight"])) : r("", !0)
|
|
102
|
-
]),
|
|
103
|
-
t.title && t.titlePosition === "center" ? (i(), o("div", S, [
|
|
104
|
-
g(d, {
|
|
105
|
-
title: t.title,
|
|
106
|
-
titleImage: t.titleImage,
|
|
107
|
-
textSize: t.titleSize,
|
|
108
|
-
fontWeight: t.titleWeight
|
|
109
|
-
}, null, 8, ["title", "titleImage", "textSize", "fontWeight"])
|
|
110
|
-
])) : r("", !0),
|
|
111
|
-
t.title && t.titlePosition === "right" ? (i(), o("div", w, [
|
|
112
|
-
g(d, {
|
|
113
|
-
title: t.title,
|
|
114
|
-
titleImage: t.titleImage,
|
|
115
|
-
textSize: t.titleSize,
|
|
116
|
-
fontWeight: t.titleWeight
|
|
117
|
-
}, null, 8, ["title", "titleImage", "textSize", "fontWeight"])
|
|
118
|
-
])) : r("", !0),
|
|
119
|
-
a("div", x, [
|
|
120
|
-
s(e.$slots, "actions")
|
|
121
|
-
])
|
|
122
|
-
], 2));
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
export {
|
|
126
|
-
z as default
|
|
127
|
-
};
|
|
1
|
+
"use strict";const e=require("vue"),o=require("../../../KunAppbarTitle/src/components/KunAppbarTitle.vue.js"),d={class:"flex items-center gap-2"},s={key:0,class:"flex-1 flex justify-center"},c={key:1,class:"flex-1 flex justify-end"},u={class:"flex items-center gap-2 ml-auto"},g={__name:"KunAppbar",props:{bgColor:{type:String,default:"bg-green-700"},title:{type:String,default:""},titleImage:{type:String,default:""},titleSize:{type:String,default:"text-base"},titleWeight:{type:String,default:"font-medium"},titlePosition:{type:String,default:"center",validator:t=>["left","center","right"].includes(t)},density:{type:String,default:"default"},elevation:{type:String,default:"md"},bordered:{type:Boolean,default:!1},showDrawerButton:{type:Boolean,default:!0}},setup(t){const i=t,a=e.computed(()=>{switch(i.density){case"comfortable":return"h-12 py-1";case"compact":return"h-10 py-0.5";default:return"h-14 py-2"}}),r=e.computed(()=>{const l=["sm","md","lg","xl","2xl"];return i.elevation==="none"||!l.includes(i.elevation)?"":`shadow-${i.elevation}`});return(l,n)=>(e.openBlock(),e.createElementBlock("header",{class:e.normalizeClass(["flex items-center px-4 w-full",[a.value,t.bgColor,r.value,t.bordered?"border-b border-gray-200":""]])},[e.createElementVNode("div",d,[e.renderSlot(l.$slots,"appbarButton",{},()=>[t.showDrawerButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"p-2 rounded-md hover:bg-white/10 transition",onClick:n[0]||(n[0]=m=>l.$emit("toggle-drawer"))},n[1]||(n[1]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 12h16M4 18h16"})],-1)]))):e.createCommentVNode("",!0)]),e.renderSlot(l.$slots,"prepend"),t.title&&t.titlePosition==="left"?(e.openBlock(),e.createBlock(o,{key:0,title:t.title,titleImage:t.titleImage,textSize:t.titleSize,fontWeight:t.titleWeight},null,8,["title","titleImage","textSize","fontWeight"])):e.createCommentVNode("",!0)]),t.title&&t.titlePosition==="center"?(e.openBlock(),e.createElementBlock("div",s,[e.createVNode(o,{title:t.title,titleImage:t.titleImage,textSize:t.titleSize,fontWeight:t.titleWeight},null,8,["title","titleImage","textSize","fontWeight"])])):e.createCommentVNode("",!0),t.title&&t.titlePosition==="right"?(e.openBlock(),e.createElementBlock("div",c,[e.createVNode(o,{title:t.title,titleImage:t.titleImage,textSize:t.titleSize,fontWeight:t.titleWeight},null,8,["title","titleImage","textSize","fontWeight"])])):e.createCommentVNode("",!0),e.createElementVNode("div",u,[e.renderSlot(l.$slots,"actions")])],2))}};module.exports=g;
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const l = ["src"], c = { key: 1 }, m = {
|
|
3
|
-
__name: "KunAppbarTitle",
|
|
4
|
-
props: {
|
|
5
|
-
title: String,
|
|
6
|
-
titleImage: String,
|
|
7
|
-
textSize: {
|
|
8
|
-
type: String,
|
|
9
|
-
default: "text-base"
|
|
10
|
-
},
|
|
11
|
-
fontWeight: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: "font-medium"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
setup(t) {
|
|
17
|
-
return (o, s) => (i(), e("div", {
|
|
18
|
-
class: n(["flex items-center min-w-0 truncate", [t.textSize, t.fontWeight]])
|
|
19
|
-
}, [
|
|
20
|
-
t.titleImage ? (i(), e("img", {
|
|
21
|
-
key: 0,
|
|
22
|
-
src: t.titleImage,
|
|
23
|
-
alt: "Logo",
|
|
24
|
-
class: "h-6 object-contain"
|
|
25
|
-
}, null, 8, l)) : (i(), e("span", c, a(t.title), 1))
|
|
26
|
-
], 2));
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
m as default
|
|
31
|
-
};
|
|
1
|
+
"use strict";const e=require("vue"),n=["src"],i={key:1},c={__name:"KunAppbarTitle",props:{title:String,titleImage:String,textSize:{type:String,default:"text-base"},fontWeight:{type:String,default:"font-medium"}},setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex items-center min-w-0 truncate",[t.textSize,t.fontWeight]])},[t.titleImage?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.titleImage,alt:"Logo",class:"h-6 object-contain"},null,8,n)):(e.openBlock(),e.createElementBlock("span",i,e.toDisplayString(t.title),1))],2))}};module.exports=c;
|
|
@@ -1,140 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Q from "../composables/KunAutocompleteProps.js";
|
|
3
|
-
import { useAutocomplete as W } from "../composables/useAutocomplete.js";
|
|
4
|
-
/* empty css */
|
|
5
|
-
import X from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
-
const Y = { class: "relative" }, Z = ["close-on-content-click", "max-height"], ee = { class: "w-full px-2 py-1" }, te = {
|
|
7
|
-
__name: "KunAutocomplete",
|
|
8
|
-
props: /* @__PURE__ */ K(Q, {
|
|
9
|
-
modelValue: { default: null },
|
|
10
|
-
modelModifiers: {},
|
|
11
|
-
items: { default: [], type: Array },
|
|
12
|
-
itemsModifiers: {}
|
|
13
|
-
}),
|
|
14
|
-
emits: /* @__PURE__ */ K(["createItem"], ["update:modelValue", "update:items"]),
|
|
15
|
-
setup(d, { emit: b }) {
|
|
16
|
-
const V = d;
|
|
17
|
-
$(0);
|
|
18
|
-
const l = g(d, "modelValue"), y = g(d, "items"), w = b, {
|
|
19
|
-
selectedItem: n,
|
|
20
|
-
textFieldRef: E,
|
|
21
|
-
menuModel: s,
|
|
22
|
-
search: r,
|
|
23
|
-
isCloseOnSelect: M,
|
|
24
|
-
setSelectedItemValue: N,
|
|
25
|
-
placeholder: S,
|
|
26
|
-
openMenu: _,
|
|
27
|
-
closeMenu: h,
|
|
28
|
-
focusOnMenu: k,
|
|
29
|
-
createItem: B,
|
|
30
|
-
clearSelection: F
|
|
31
|
-
} = W(V, w, l, y);
|
|
32
|
-
D(() => {
|
|
33
|
-
isObject(l.value) && !isNotEmpty(l.value) && (n.value = {}), isArray(l.value) && !isNotEmpty(l.value) && (n.value = []), l.value === null && (n.value = null), N();
|
|
34
|
-
});
|
|
35
|
-
function z(t) {
|
|
36
|
-
r.value = "", l.value = t, h();
|
|
37
|
-
}
|
|
38
|
-
return (t, o) => {
|
|
39
|
-
const p = u("KunIcon"), A = u("KunTextField"), O = u("KunBtn"), P = u("KunListItem"), R = u("KunVirtualScroller");
|
|
40
|
-
return a(), x(H, null, [
|
|
41
|
-
e(s) ? (a(), x("div", {
|
|
42
|
-
key: 0,
|
|
43
|
-
class: "fixed opacity-10 w-svw inset-0 h-svh",
|
|
44
|
-
onClick: o[0] || (o[0] = (i) => s.value = !1)
|
|
45
|
-
})) : f("", !0),
|
|
46
|
-
v("div", Y, [
|
|
47
|
-
c(A, {
|
|
48
|
-
modelValue: e(r),
|
|
49
|
-
"onUpdate:modelValue": o[2] || (o[2] = (i) => j(r) ? r.value = i : null),
|
|
50
|
-
ref_key: "textFieldRef",
|
|
51
|
-
ref: E,
|
|
52
|
-
placeholder: t.isArray(e(n)) && e(n).length ? "" : e(S),
|
|
53
|
-
onKeyup: U(e(k), ["down"]),
|
|
54
|
-
onClickInput: e(_),
|
|
55
|
-
onPressEsc: e(h),
|
|
56
|
-
onChange: o[3] || (o[3] = (i) => console.log("change")),
|
|
57
|
-
onFocusInput: e(k)
|
|
58
|
-
}, C({ _: 2 }, [
|
|
59
|
-
t.hasIcons ? {
|
|
60
|
-
name: "append-inner",
|
|
61
|
-
fn: m(() => [
|
|
62
|
-
t.clearable && e(n) ? (a(), I(p, {
|
|
63
|
-
key: 0,
|
|
64
|
-
onClick: e(F),
|
|
65
|
-
size: "text-xl",
|
|
66
|
-
color: "text-error",
|
|
67
|
-
icon: "close",
|
|
68
|
-
class: q(["mr-1", t.isNotEmpty(e(n)) ? "cursor-pointer" : "cursor-default"]),
|
|
69
|
-
disabled: !t.isNotEmpty(e(n))
|
|
70
|
-
}, null, 8, ["onClick", "class", "disabled"])) : f("", !0),
|
|
71
|
-
c(p, {
|
|
72
|
-
color: "text-accent-button",
|
|
73
|
-
size: "text-xl",
|
|
74
|
-
class: "cursor-pointer",
|
|
75
|
-
icon: e(s) ? "menuUp" : "menuDown",
|
|
76
|
-
onClick: o[1] || (o[1] = (i) => s.value = !e(s))
|
|
77
|
-
}, null, 8, ["icon"]),
|
|
78
|
-
t.required ? (a(), I(p, {
|
|
79
|
-
key: 1,
|
|
80
|
-
color: "text-red-900",
|
|
81
|
-
size: "text-lg",
|
|
82
|
-
class: "mb-3",
|
|
83
|
-
icon: "asterisk"
|
|
84
|
-
})) : f("", !0)
|
|
85
|
-
]),
|
|
86
|
-
key: "0"
|
|
87
|
-
} : void 0
|
|
88
|
-
]), 1032, ["modelValue", "placeholder", "onKeyup", "onClickInput", "onPressEsc", "onFocusInput"]),
|
|
89
|
-
L(v("div", {
|
|
90
|
-
class: "absolute h-fit left-0 w-full z-50 bg-surface rounded-b border border-field-border-focus ring-1 focus:ring-field-ring-focus",
|
|
91
|
-
"close-on-content-click": e(M),
|
|
92
|
-
"max-height": t.maxHeight
|
|
93
|
-
}, [
|
|
94
|
-
c(R, {
|
|
95
|
-
items: y.value,
|
|
96
|
-
search: e(r),
|
|
97
|
-
searchBy: "name",
|
|
98
|
-
maxHeight: 250
|
|
99
|
-
}, C({
|
|
100
|
-
default: m(({ item: i, itemKey: T }) => [
|
|
101
|
-
c(P, {
|
|
102
|
-
item: i,
|
|
103
|
-
itemKey: T,
|
|
104
|
-
title: "name",
|
|
105
|
-
cursor: "cursor-pointer",
|
|
106
|
-
onSelect: z
|
|
107
|
-
}, null, 8, ["item", "itemKey"])
|
|
108
|
-
]),
|
|
109
|
-
_: 2
|
|
110
|
-
}, [
|
|
111
|
-
t.hasCreateItem ? {
|
|
112
|
-
name: "topButton",
|
|
113
|
-
fn: m(() => [
|
|
114
|
-
v("div", ee, [
|
|
115
|
-
c(O, {
|
|
116
|
-
onClick: e(B),
|
|
117
|
-
class: "w-full rounded-md bg-accent-button",
|
|
118
|
-
size: "xs"
|
|
119
|
-
}, {
|
|
120
|
-
default: m(() => o[4] || (o[4] = [
|
|
121
|
-
G("Crear item")
|
|
122
|
-
])),
|
|
123
|
-
_: 1
|
|
124
|
-
}, 8, ["onClick"])
|
|
125
|
-
])
|
|
126
|
-
]),
|
|
127
|
-
key: "0"
|
|
128
|
-
} : void 0
|
|
129
|
-
]), 1032, ["items", "search"])
|
|
130
|
-
], 8, Z), [
|
|
131
|
-
[J, e(s)]
|
|
132
|
-
])
|
|
133
|
-
])
|
|
134
|
-
], 64);
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}, re = /* @__PURE__ */ X(te, [["__scopeId", "data-v-c3a2b846"]]);
|
|
138
|
-
export {
|
|
139
|
-
re as default
|
|
140
|
-
};
|
|
1
|
+
"use strict";const e=require("vue"),E=require("../composables/KunAutocompleteProps.js"),M=require("../composables/useAutocomplete.js");;/* empty css */const S=require("../../../../_virtual/_plugin-vue_export-helper.js"),A={class:"relative"},_=["close-on-content-click","max-height"],F={class:"w-full px-2 py-1"},q={__name:"KunAutocomplete",props:e.mergeModels(E,{modelValue:{default:null},modelModifiers:{},items:{default:[],type:Array},itemsModifiers:{}}),emits:e.mergeModels(["createItem"],["update:modelValue","update:items"]),setup(c,{emit:f}){const p=c;e.ref(0);const l=e.useModel(c,"modelValue"),a=e.useModel(c,"items"),v=f,{selectedItem:n,textFieldRef:k,menuModel:r,search:u,isCloseOnSelect:C,setSelectedItemValue:h,placeholder:V,openMenu:y,closeMenu:m,focusOnMenu:d,createItem:x,clearSelection:g}=M.useAutocomplete(p,v,l,a);e.watchEffect(()=>{isObject(l.value)&&!isNotEmpty(l.value)&&(n.value={}),isArray(l.value)&&!isNotEmpty(l.value)&&(n.value=[]),l.value===null&&(n.value=null),h()});function K(t){u.value="",l.value=t,m()}return(t,o)=>{const i=e.resolveComponent("KunIcon"),I=e.resolveComponent("KunTextField"),N=e.resolveComponent("KunBtn"),b=e.resolveComponent("KunListItem"),w=e.resolveComponent("KunVirtualScroller");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed opacity-10 w-svw inset-0 h-svh",onClick:o[0]||(o[0]=s=>r.value=!1)})):e.createCommentVNode("",!0),e.createElementVNode("div",A,[e.createVNode(I,{modelValue:e.unref(u),"onUpdate:modelValue":o[2]||(o[2]=s=>e.isRef(u)?u.value=s:null),ref_key:"textFieldRef",ref:k,placeholder:t.isArray(e.unref(n))&&e.unref(n).length?"":e.unref(V),onKeyup:e.withKeys(e.unref(d),["down"]),onClickInput:e.unref(y),onPressEsc:e.unref(m),onChange:o[3]||(o[3]=s=>console.log("change")),onFocusInput:e.unref(d)},e.createSlots({_:2},[t.hasIcons?{name:"append-inner",fn:e.withCtx(()=>[t.clearable&&e.unref(n)?(e.openBlock(),e.createBlock(i,{key:0,onClick:e.unref(g),size:"text-xl",color:"text-error",icon:"close",class:e.normalizeClass(["mr-1",t.isNotEmpty(e.unref(n))?"cursor-pointer":"cursor-default"]),disabled:!t.isNotEmpty(e.unref(n))},null,8,["onClick","class","disabled"])):e.createCommentVNode("",!0),e.createVNode(i,{color:"text-accent-button",size:"text-xl",class:"cursor-pointer",icon:e.unref(r)?"menuUp":"menuDown",onClick:o[1]||(o[1]=s=>r.value=!e.unref(r))},null,8,["icon"]),t.required?(e.openBlock(),e.createBlock(i,{key:1,color:"text-red-900",size:"text-lg",class:"mb-3",icon:"asterisk"})):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1032,["modelValue","placeholder","onKeyup","onClickInput","onPressEsc","onFocusInput"]),e.withDirectives(e.createElementVNode("div",{class:"absolute h-fit left-0 w-full z-50 bg-surface rounded-b border border-field-border-focus ring-1 focus:ring-field-ring-focus","close-on-content-click":e.unref(C),"max-height":t.maxHeight},[e.createVNode(w,{items:a.value,search:e.unref(u),searchBy:"name",maxHeight:250},e.createSlots({default:e.withCtx(({item:s,itemKey:B})=>[e.createVNode(b,{item:s,itemKey:B,title:"name",cursor:"cursor-pointer",onSelect:K},null,8,["item","itemKey"])]),_:2},[t.hasCreateItem?{name:"topButton",fn:e.withCtx(()=>[e.createElementVNode("div",F,[e.createVNode(N,{onClick:e.unref(x),class:"w-full rounded-md bg-accent-button",size:"xs"},{default:e.withCtx(()=>o[4]||(o[4]=[e.createTextVNode("Crear item")])),_:1},8,["onClick"])])]),key:"0"}:void 0]),1032,["items","search"])],8,_),[[e.vShow,e.unref(r)]])])],64)}}},z=S(q,[["__scopeId","data-v-c3a2b846"]]);module.exports=z;
|
|
@@ -1,104 +1 @@
|
|
|
1
|
-
const e
|
|
2
|
-
label: {
|
|
3
|
-
type: String
|
|
4
|
-
},
|
|
5
|
-
itemValue: {
|
|
6
|
-
type: String,
|
|
7
|
-
default: ""
|
|
8
|
-
},
|
|
9
|
-
itemTitle: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: ""
|
|
12
|
-
},
|
|
13
|
-
itemText: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: ""
|
|
16
|
-
},
|
|
17
|
-
itemSubtitle: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: ""
|
|
20
|
-
},
|
|
21
|
-
returnObject: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: !1
|
|
24
|
-
},
|
|
25
|
-
searchableKeys: {
|
|
26
|
-
type: Array,
|
|
27
|
-
default: []
|
|
28
|
-
},
|
|
29
|
-
focusOnSelect: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: !1
|
|
32
|
-
},
|
|
33
|
-
clearable: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: !1
|
|
36
|
-
},
|
|
37
|
-
clearOnSelect: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: !1
|
|
40
|
-
},
|
|
41
|
-
clearSearchOnSelect: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: !0
|
|
44
|
-
},
|
|
45
|
-
closeOnSelect: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: !0
|
|
48
|
-
},
|
|
49
|
-
startEmtpy: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: !1
|
|
52
|
-
},
|
|
53
|
-
placeholderText: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: "Seleccionar"
|
|
56
|
-
},
|
|
57
|
-
textNoItems: {
|
|
58
|
-
type: String,
|
|
59
|
-
default: "No hay elementos"
|
|
60
|
-
},
|
|
61
|
-
hasCreateItem: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
default: !1
|
|
64
|
-
},
|
|
65
|
-
multiple: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
default: !1
|
|
68
|
-
},
|
|
69
|
-
required: {
|
|
70
|
-
type: Boolean,
|
|
71
|
-
default: !1
|
|
72
|
-
},
|
|
73
|
-
// ***** STYLE ***** //
|
|
74
|
-
maxHeight: {
|
|
75
|
-
default: 500
|
|
76
|
-
},
|
|
77
|
-
density: {
|
|
78
|
-
type: String,
|
|
79
|
-
default: "comfortable"
|
|
80
|
-
},
|
|
81
|
-
hideDetails: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
default: !0
|
|
84
|
-
},
|
|
85
|
-
hasIcons: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: !0
|
|
88
|
-
},
|
|
89
|
-
bgItemListColor: {
|
|
90
|
-
type: String,
|
|
91
|
-
default: "bg-transparent"
|
|
92
|
-
},
|
|
93
|
-
selectedColor: {
|
|
94
|
-
type: String,
|
|
95
|
-
default: "bg-primary"
|
|
96
|
-
},
|
|
97
|
-
attach: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
default: !1
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
export {
|
|
103
|
-
e as default
|
|
104
|
-
};
|
|
1
|
+
"use strict";const e={label:{type:String},itemValue:{type:String,default:""},itemTitle:{type:String,default:""},itemText:{type:String,default:""},itemSubtitle:{type:String,default:""},returnObject:{type:Boolean,default:!1},searchableKeys:{type:Array,default:[]},focusOnSelect:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},clearOnSelect:{type:Boolean,default:!1},clearSearchOnSelect:{type:Boolean,default:!0},closeOnSelect:{type:Boolean,default:!0},startEmtpy:{type:Boolean,default:!1},placeholderText:{type:String,default:"Seleccionar"},textNoItems:{type:String,default:"No hay elementos"},hasCreateItem:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},required:{type:Boolean,default:!1},maxHeight:{default:500},density:{type:String,default:"comfortable"},hideDetails:{type:Boolean,default:!0},hasIcons:{type:Boolean,default:!0},bgItemListColor:{type:String,default:"bg-transparent"},selectedColor:{type:String,default:"bg-primary"},attach:{type:Boolean,default:!1}};module.exports=e;
|
|
@@ -1,119 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { isArray as b, isObject as i } from "../utils/helpers.js";
|
|
3
|
-
function J(t, T, l, h) {
|
|
4
|
-
const n = O(null), o = O(null), y = O(null), v = O(!1), f = O(""), I = r(() => !t.searchableKeys.length), j = r(() => t.clearOnSelect);
|
|
5
|
-
r(() => t.clearSearchOnSelect), r(() => t.focusOnSelect);
|
|
6
|
-
const m = r(() => t.closeOnSelect);
|
|
7
|
-
function d() {
|
|
8
|
-
b(l.value) && (l.value.length ? n.value = h.value.filter(
|
|
9
|
-
(e) => i(e) ? l.value.some(
|
|
10
|
-
(u) => u[t.itemTitle].includes(e[t.itemTitle])
|
|
11
|
-
) : l.value.some((u) => u.includes(e))
|
|
12
|
-
) : n.value = []), (i(l.value) && Object.keys(l.value).length || typeof l.value == "number" && l.value || typeof l.value == "string" && l.value || typeof l.value == "boolean") && (n.value = h.value.find(
|
|
13
|
-
(e) => i(e) ? t.returnObject ? t.itemValue ? e[t.itemValue] === l.value[t.itemValue] : e[t.itemTitle] === l.value[t.itemTitle] : e[t.itemValue] === l.value : e === l.value
|
|
14
|
-
));
|
|
15
|
-
}
|
|
16
|
-
const C = r(() => n.value ? b(n.value) ? n.value.length ? S(n.value, t.itemTitle, "hasDefault") : t.placeholderText : i(n.value) ? S(n.value, t.itemTitle, "hasDefault") : n.value.toString() : h.value.length ? t.placeholderText : t.textNoItems), K = r(() => t.startEmtpy && f.value.length < 3 ? [] : h.value.filter((u) => {
|
|
17
|
-
if (i(u)) {
|
|
18
|
-
const s = Object.values(u).filter((c) => {
|
|
19
|
-
if (!i(c) && !b(c))
|
|
20
|
-
return c;
|
|
21
|
-
}), a = [u].reduce((c, B) => t.searchableKeys.map((q) => B[q]), []), x = I.value ? s : a;
|
|
22
|
-
return x ? x.some(
|
|
23
|
-
(c) => c ? c.toString().toLowerCase().includes(f.value.toLowerCase()) : ""
|
|
24
|
-
) : f.value ? u == f.value : u;
|
|
25
|
-
}
|
|
26
|
-
return u.toString().toLowerCase().includes(f.value.toLowerCase());
|
|
27
|
-
}).slice(0, currentBatchStep.value)), k = r(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
|
|
28
|
-
function S(e, u, s) {
|
|
29
|
-
if (i(e)) {
|
|
30
|
-
if (u)
|
|
31
|
-
return b(u) ? u.map((a) => e[a] ?? "No definido").join(" - ") : u.includes(",") ? u.split(",").map((a) => e[a]).join(" - ") : !t.returnObject && typeof e[u] == "number" || e[u] ? e[u].toString() : "";
|
|
32
|
-
if (s)
|
|
33
|
-
return Object.values(e)[0];
|
|
34
|
-
}
|
|
35
|
-
return b(e) ? t.returnObject ? e.map((a) => a[u]).join(" - ") : e.map((a) => a).join(" - ") : s && typeof e != "number" && e.includes(",") ? e.split(",") : e;
|
|
36
|
-
}
|
|
37
|
-
function w(e) {
|
|
38
|
-
let u = e[0];
|
|
39
|
-
if (!t.multiple)
|
|
40
|
-
n.value = e[0], t.returnObject && (l.value = u), !t.returnObject && i(u) && (t.itemValue ? l.value = u[t.itemValue] : l.value = Object.values(u)[0]), i(u) || (l.value = u), v.value = !1;
|
|
41
|
-
else if (n.value || (n.value = []), A(u))
|
|
42
|
-
F(u), l.value = n.value;
|
|
43
|
-
else {
|
|
44
|
-
if (t.returnObject && n.value.push(u), !t.returnObject && i(u))
|
|
45
|
-
if (t.itemValue)
|
|
46
|
-
n.value.push(u[t.itemValue]);
|
|
47
|
-
else {
|
|
48
|
-
l.value = n.value.push(Object.values(u)[0]);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
l.value = n.value;
|
|
52
|
-
}
|
|
53
|
-
j.value && g(), o.value.focus();
|
|
54
|
-
}
|
|
55
|
-
function A(e) {
|
|
56
|
-
return n.value === null ? !1 : n.value.some(
|
|
57
|
-
(u) => t.returnObject ? u[t.itemValue] === e[t.itemValue] : u === e[t.itemValue]
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
function F(e) {
|
|
61
|
-
if (t.returnObject) {
|
|
62
|
-
let u = n.value.find(
|
|
63
|
-
(a) => a[t.itemValue] === e[t.itemValue]
|
|
64
|
-
), s = n.value.indexOf(u);
|
|
65
|
-
n.value.splice(s, 1);
|
|
66
|
-
} else {
|
|
67
|
-
let u = n.value.indexOf(e[t.itemValue]);
|
|
68
|
-
n.value.splice(u, 1);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function L(e) {
|
|
72
|
-
e.key !== "Tab" && (v.value = !0);
|
|
73
|
-
}
|
|
74
|
-
function M(e) {
|
|
75
|
-
j.value && (v.value = !1);
|
|
76
|
-
}
|
|
77
|
-
function E() {
|
|
78
|
-
v.value = !0, y.value && y.value.focus();
|
|
79
|
-
}
|
|
80
|
-
function D() {
|
|
81
|
-
v.value = !1, T("createItem");
|
|
82
|
-
}
|
|
83
|
-
function N(e) {
|
|
84
|
-
let u = n.value.indexOf(e);
|
|
85
|
-
n.value.splice(u, 1), l.value = n.value;
|
|
86
|
-
}
|
|
87
|
-
function g() {
|
|
88
|
-
f.value = "", b(l.value) && (n.value = []), i(l.value) && (n.value = {}), typeof l.value == "number" && l.value && (n.value = 0), typeof l.value == "string" && l.value && (n.value = ""), typeof l.value == "boolean" && (n.value = !1), l.value = n.value;
|
|
89
|
-
}
|
|
90
|
-
function R(e) {
|
|
91
|
-
if (!e.disabledItem) return !1;
|
|
92
|
-
if (e.disabledItem) return !0;
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
selectedItem: n,
|
|
96
|
-
textFieldRef: o,
|
|
97
|
-
listRef: y,
|
|
98
|
-
menuModel: v,
|
|
99
|
-
search: f,
|
|
100
|
-
isCloseOnSelect: m,
|
|
101
|
-
isClearOnSelect: j,
|
|
102
|
-
setSelectedItemValue: d,
|
|
103
|
-
placeholder: C,
|
|
104
|
-
filteredItems: K,
|
|
105
|
-
textArr: k,
|
|
106
|
-
itemToString: S,
|
|
107
|
-
getSelectedItem: w,
|
|
108
|
-
openMenu: L,
|
|
109
|
-
closeMenu: M,
|
|
110
|
-
focusOnMenu: E,
|
|
111
|
-
createItem: D,
|
|
112
|
-
removeItem: N,
|
|
113
|
-
clearSelection: g,
|
|
114
|
-
isDisabled: R
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
export {
|
|
118
|
-
J as useAutocomplete
|
|
119
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),i=require("../utils/helpers.js");function R(t,g,l,b){const n=a.ref(null),y=a.ref(null),O=a.ref(null),v=a.ref(!1),c=a.ref(""),d=a.computed(()=>!t.searchableKeys.length),j=a.computed(()=>t.clearOnSelect);a.computed(()=>t.clearSearchOnSelect),a.computed(()=>t.focusOnSelect);const x=a.computed(()=>t.closeOnSelect);function T(){i.isArray(l.value)&&(l.value.length?n.value=b.value.filter(e=>i.isObject(e)?l.value.some(u=>u[t.itemTitle].includes(e[t.itemTitle])):l.value.some(u=>u.includes(e))):n.value=[]),(i.isObject(l.value)&&Object.keys(l.value).length||typeof l.value=="number"&&l.value||typeof l.value=="string"&&l.value||typeof l.value=="boolean")&&(n.value=b.value.find(e=>i.isObject(e)?t.returnObject?t.itemValue?e[t.itemValue]===l.value[t.itemValue]:e[t.itemTitle]===l.value[t.itemTitle]:e[t.itemValue]===l.value:e===l.value))}const m=a.computed(()=>n.value?i.isArray(n.value)?n.value.length?o(n.value,t.itemTitle,"hasDefault"):t.placeholderText:i.isObject(n.value)?o(n.value,t.itemTitle,"hasDefault"):n.value.toString():b.value.length?t.placeholderText:t.textNoItems),I=a.computed(()=>t.startEmtpy&&c.value.length<3?[]:b.value.filter(u=>{if(i.isObject(u)){const s=Object.values(u).filter(f=>{if(!i.isObject(f)&&!i.isArray(f))return f}),r=[u].reduce((f,D)=>t.searchableKeys.map(N=>D[N]),[]),S=d.value?s:r;return S?S.some(f=>f?f.toString().toLowerCase().includes(c.value.toLowerCase()):""):c.value?u==c.value:u}return u.toString().toLowerCase().includes(c.value.toLowerCase())}).slice(0,currentBatchStep.value)),A=a.computed(()=>t.itemText.includes(",")?t.itemText.split(","):t.itemText);function o(e,u,s){if(i.isObject(e)){if(u)return i.isArray(u)?u.map(r=>e[r]??"No definido").join(" - "):u.includes(",")?u.split(",").map(r=>e[r]).join(" - "):!t.returnObject&&typeof e[u]=="number"||e[u]?e[u].toString():"";if(s)return Object.values(e)[0]}return i.isArray(e)?t.returnObject?e.map(r=>r[u]).join(" - "):e.map(r=>r).join(" - "):s&&typeof e!="number"&&e.includes(",")?e.split(","):e}function C(e){let u=e[0];if(!t.multiple)n.value=e[0],t.returnObject&&(l.value=u),!t.returnObject&&i.isObject(u)&&(t.itemValue?l.value=u[t.itemValue]:l.value=Object.values(u)[0]),i.isObject(u)||(l.value=u),v.value=!1;else if(n.value||(n.value=[]),K(u))M(u),l.value=n.value;else{if(t.returnObject&&n.value.push(u),!t.returnObject&&i.isObject(u))if(t.itemValue)n.value.push(u[t.itemValue]);else{l.value=n.value.push(Object.values(u)[0]);return}l.value=n.value}j.value&&h(),y.value.focus()}function K(e){return n.value===null?!1:n.value.some(u=>t.returnObject?u[t.itemValue]===e[t.itemValue]:u===e[t.itemValue])}function M(e){if(t.returnObject){let u=n.value.find(r=>r[t.itemValue]===e[t.itemValue]),s=n.value.indexOf(u);n.value.splice(s,1)}else{let u=n.value.indexOf(e[t.itemValue]);n.value.splice(u,1)}}function k(e){e.key!=="Tab"&&(v.value=!0)}function w(e){j.value&&(v.value=!1)}function F(){v.value=!0,O.value&&O.value.focus()}function L(){v.value=!1,g("createItem")}function E(e){let u=n.value.indexOf(e);n.value.splice(u,1),l.value=n.value}function h(){c.value="",i.isArray(l.value)&&(n.value=[]),i.isObject(l.value)&&(n.value={}),typeof l.value=="number"&&l.value&&(n.value=0),typeof l.value=="string"&&l.value&&(n.value=""),typeof l.value=="boolean"&&(n.value=!1),l.value=n.value}function q(e){if(!e.disabledItem)return!1;if(e.disabledItem)return!0}return{selectedItem:n,textFieldRef:y,listRef:O,menuModel:v,search:c,isCloseOnSelect:x,isClearOnSelect:j,setSelectedItemValue:T,placeholder:m,filteredItems:I,textArr:A,itemToString:o,getSelectedItem:C,openMenu:k,closeMenu:w,focusOnMenu:F,createItem:L,removeItem:E,clearSelection:h,isDisabled:q}}exports.useAutocomplete=R;
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
function t(r) {
|
|
2
|
-
return r !== null && typeof r == "object" && !Array.isArray(r);
|
|
3
|
-
}
|
|
4
|
-
function n(r) {
|
|
5
|
-
return Array.isArray(r);
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
n as isArray,
|
|
9
|
-
t as isObject
|
|
10
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function e(r){return Array.isArray(r)}exports.isArray=e;exports.isObject=t;
|