@volverjs/ui-vue 0.0.1-beta.6 → 0.0.1-beta.8
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/README.md +61 -2
- package/dist/components/VvButton/vv-button.es.js +56 -58
- package/dist/components/VvButton/vv-button.umd.js +1 -1
- package/dist/components/VvCheckGroup/vv-check-group.es.js +221 -203
- package/dist/components/VvCheckGroup/vv-check-group.umd.js +2 -2
- package/dist/components/VvInputText/VvInputText.d.ts +14 -0
- package/dist/components/VvInputText/VvInputText.vue.d.ts +36 -1
- package/dist/components/VvInputText/VvInputTextActions.d.ts +3 -0
- package/dist/components/VvInputText/vv-input-text.es.js +509 -380
- package/dist/components/VvInputText/vv-input-text.umd.js +2 -2
- package/dist/components/VvNativeSelect/vv-native-select.es.js +180 -161
- package/dist/components/VvNativeSelect/vv-native-select.umd.js +2 -2
- package/dist/components/VvRadioGroup/vv-radio-group.es.js +211 -193
- package/dist/components/VvRadioGroup/vv-radio-group.umd.js +2 -2
- package/dist/components/VvSelect/vv-select.es.js +189 -171
- package/dist/components/VvSelect/vv-select.umd.js +2 -2
- package/dist/components/VvTextarea/VvTextarea.d.ts +43 -22
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +140 -85
- package/dist/components/VvTextarea/vv-textarea.es.js +364 -288
- package/dist/components/VvTextarea/vv-textarea.umd.js +2 -2
- package/dist/composables/debouncedInput/useDebouncedInput.d.ts +2 -0
- package/dist/composables/icons/useComponentIcons.d.ts +6 -0
- package/dist/composables/textLimit/useTextLimit.d.ts +14 -0
- package/dist/composables/useModifiers.d.ts +3 -2
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +42 -0
- package/dist/stories/utils.d.ts +5 -0
- package/dist/ui-vue.es.js +417 -401
- package/dist/ui-vue.umd.js +2 -2
- package/package.json +3 -1
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvButton/VvButton.vue +1 -2
- package/src/components/VvInputText/VvInputText.ts +19 -2
- package/src/components/VvInputText/VvInputText.vue +123 -149
- package/src/components/VvInputText/VvInputTextActions.ts +151 -0
- package/src/components/VvTextarea/VvTextarea.ts +25 -16
- package/src/components/VvTextarea/VvTextarea.vue +89 -93
- package/src/components/common/HintSlot.ts +31 -13
- package/src/composables/debouncedInput/useDebouncedInput.ts +19 -0
- package/src/composables/icons/useComponentIcons.ts +35 -0
- package/src/composables/textLimit/useTextLimit.ts +44 -0
- package/src/composables/useModifiers.ts +47 -1
- package/src/props/index.ts +39 -0
- package/src/stories/InputText/InputTextMaxLength.stories.mdx +21 -0
- package/src/stories/Textarea/Textarea.stories.mdx +33 -51
- package/src/stories/Textarea/TextareaAutoclear.stories.mdx +23 -0
- package/src/stories/Textarea/TextareaAutocomplete.stories.mdx +10 -2
- package/src/stories/Textarea/TextareaAutofocus.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaDebounce.stories.mdx +23 -0
- package/src/stories/Textarea/TextareaDisabled.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaError.stories.mdx +6 -3
- package/src/stories/Textarea/TextareaErrorLabel.stories.mdx +37 -0
- package/src/stories/Textarea/TextareaFloating.stories.mdx +7 -2
- package/src/stories/Textarea/TextareaHintLabel.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaIcon.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaIconPosition.stories.mdx +9 -1
- package/src/stories/Textarea/TextareaId.stories.mdx +19 -0
- package/src/stories/Textarea/TextareaLabel.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaLimit.stories.mdx +50 -0
- package/src/stories/Textarea/TextareaLoading.stories.mdx +6 -3
- package/src/stories/Textarea/TextareaLoadingLabel.stories.mdx +23 -0
- package/src/stories/Textarea/TextareaMaxLength.stories.mdx +6 -2
- package/src/stories/Textarea/TextareaMinLength.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaModifiers.stories.mdx +24 -0
- package/src/stories/Textarea/TextareaName.stories.mdx +23 -0
- package/src/stories/Textarea/TextareaPlaceholder.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaReadonly.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaRequired.stories.mdx +22 -0
- package/src/stories/Textarea/TextareaResizable.stories.mdx +22 -0
- package/src/stories/Textarea/TextareaRowsCols.stories.mdx +9 -1
- package/src/stories/Textarea/TextareaValid.stories.mdx +7 -4
- package/src/stories/Textarea/TextareaValidLabel.stories.mdx +35 -0
- package/src/stories/stories.scss +11 -0
- package/src/stories/utils.ts +12 -0
- package/src/stories/volver-ui-vue.stories.mdx +7 -1
- package/dist/components/VvInputText/useInputNumber.d.ts +0 -16
- package/dist/components/VvInputText/useInputPassword.d.ts +0 -16
- package/src/components/VvInputText/useInputNumber.ts +0 -40
- package/src/components/VvInputText/useInputPassword.ts +0 -38
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(r,
|
|
2
|
-
`+n:n,""):e}function Z(e,t){return{name:"HintSlot",setup(){const
|
|
1
|
+
(function(r,O){typeof exports=="object"&&typeof module<"u"?module.exports=O(require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["vue","@vueuse/core"],O):(r=typeof globalThis<"u"?globalThis:r||self,r.VvRadioGroup=O(r.vue,r.core))})(this,function(r,O){"use strict";const E={valid:Boolean,validLabel:[String,Array]},j={error:Boolean,errorLabel:[String,Array]},I={hintLabel:{type:String,default:""}},P={options:{type:Array,default:()=>[]},optionLabel:{type:[String,Function],default:()=>"label"},optionValue:{type:[String,Function],default:()=>"value"}},F=["update:modelValue"],q={...E,...j,...P,...I,modelValue:null,label:{type:String,default:""},name:{type:String,default:"",required:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},vertical:{type:Boolean,default:!1}};function D(e){if(Object.keys(e).some(t=>t!=="key"&&!r.isRef(e[t])))throw Error("One or more groupState props aren't ref.");console.log("PRovide - ",e),r.provide(e.key,r.computed(()=>e))}function G(e){const{options:t,optionLabel:n,optionValue:o}=r.toRefs(e);return{options:t,getOptionLabel:l=>typeof l!="object"&&l!==null?l:typeof n.value=="function"?n.value(l):l[n.value],getOptionValue:l=>typeof l!="object"&&l!==null?l:typeof o.value=="function"?o.value(l):l[o.value]}}const h={equals(e,t,n){return n?this.resolveFieldData(e,n)===this.resolveFieldData(t,n):this.deepEquals(e,t)},deepEquals(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){const n=Array.isArray(e),o=Array.isArray(t);let s,i,l;if(n&&o){if(i=e.length,i!=t.length)return!1;for(s=i;s--!==0;)if(!this.deepEquals(e[s],t[s]))return!1;return!0}if(n!=o)return!1;const u=e instanceof Date,a=t instanceof Date;if(u!=a)return!1;if(u&&a)return e.getTime()==t.getTime();const p=e instanceof RegExp,y=t instanceof RegExp;if(p!=y)return!1;if(p&&y)return e.toString()==t.toString();const f=Object.keys(e);if(i=f.length,i!==Object.keys(t).length)return!1;for(s=i;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,f[s]))return!1;for(s=i;s--!==0;)if(l=f[s],!this.deepEquals(e[l],t[l]))return!1;return!0}return e!==e&&t!==t},resolveFieldData(e,t){if(e&&Object.keys(e).length&&t){if(t.indexOf(".")===-1)return e[t];{const n=t.split(".");let o=e;for(let s=0,i=n.length;s<i;++s){if(e==null)return null;o=o[n[s]]}return o}}else return null},isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},findIndexInList(e,t){let n=-1;if(t){for(let o=0;o<t.length;o++)if(this.equals(t[o],e)){n=o;break}}return n},contains(e,t){if(e!=null&&t&&t.length){for(const n of t)if(this.equals(e,n))return!0}return!1},isEmpty(e){return e==null||e===""||Array.isArray(e)&&e.length===0||!(e instanceof Date)&&typeof e=="object"&&Object.keys(e).length===0},isNotEmpty(e){return!this.isEmpty(e)},pickBy(e,t){return Object.fromEntries(Object.entries(e).filter(([n])=>t(n)))},removeFromList(e,t){const n=this.findIndexInList(e,t);return n>-1?t.filter((o,s)=>s!==n):t},isString(e){return typeof e=="string"||e instanceof String},propsToObject(e){return Object.keys(e).reduce((t,n)=>{var o,s,i,l,u;return this.isFunction(e[n])?t[n]=e[n]():Array.isArray(e[n])?t[n]=e[n][0]():(o=e[n])!=null&&o.type&&(Array.isArray(e[n].type)?t[n]=((s=e[n])==null?void 0:s.default)||((i=e[n])==null?void 0:i.type[0]()):t[n]=((l=e[n])==null?void 0:l.default)||((u=e[n])==null?void 0:u.type())),t},{})},filterArray(e,t,n){return e.filter(o=>t.some(s=>typeof s=="string"?o[n]==s:this.equals(o[n],s[n])))},kebabCase(e){var t,n;if(e)return(n=(t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:t.join("-"))==null?void 0:n.toLowerCase()}};function B(e,t){const n={[`${e}`]:!0};return{bemCssClasses:r.computed(()=>Object.keys(t).reduce((s,i)=>{const l=r.unref(t[i])||!1;if(!l)return s;if(i==="modifiers"){const u=Array.isArray(l)?l:[l];return{...s,...u.reduce((a,p)=>({...a,[`${e}--${h.kebabCase(p)}`]:!0}),{})}}else return{...s,[`${e}--${h.kebabCase(i)}`]:l}},n)||{})}}const S=Symbol("VV_RADIO_GROUP"),$={...E,...j,value:null,modelValue:{type:[Object,Number,Boolean,String]},label:{type:String,default:""},disabled:Boolean,readonly:Boolean},N=["click","update:modelValue","change","focus","blur"];function w(e){const t=r.inject(e,void 0);console.log("Inject - ",t);const n=r.computed(()=>h.isNotEmpty(t));function o(s,i,l){if(t!=null&&t.value){const u=r.unref(t.value)[s];return r.computed({get(){return u==null?void 0:u.value},set(a){u.value=a}})}else{const u=r.toRef(i,s);return r.computed({get(){return u.value},set(a){l&&l(`update:${s}`,a)}})}}return{group:t,isInGroup:n,getGroupOrLocalRef:o}}function x(e,t){const{group:n,isInGroup:o,getGroupOrLocalRef:s}=w(S),{valid:i,error:l}=r.toRefs(e),u=s("modelValue",e,t),a=s("readonly",e),p=s("disabled",e);return{group:n,isInGroup:o,valid:i,error:l,modelValue:u,readonly:a,disabled:p}}function H(e,t){const{focused:n}=O.useFocus(e);return r.watch(n,o=>{t(o?"focus":"blur",e.value)}),{focused:n}}const T={inheritAttrs:!1},z=r.defineComponent({...T,__name:"VvRadio",props:$,emits:N,setup(e,{emit:t}){const n=e,o=r.useAttrs(),{disabled:s,readonly:i,modelValue:l,valid:u,error:a}=x(n,t),p=r.ref(),y=r.computed(()=>Array.isArray(l.value)?h.contains(n.value,l.value):h.equals(n.value,l.value)),{focused:f}=H(p,t),{bemCssClasses:k}=B("vv-input-radio",{valid:u,invalid:a}),{bemCssClasses:c}=B("vv-input-radio__input",{checked:y,disabled:s,readonly:i}),d=r.computed(()=>{const{class:g}=o;return{class:g,...k.value}}),A=r.computed(()=>({"focus-visible":f.value,...c.value})),m=r.computed(()=>{const{id:g,name:_,style:v}=o,J=h.pickBy(o,K=>K.startsWith("data-"));return{for:g||_,style:v,...J}}),b=r.computed(()=>{const{id:g="",name:_=""}=o;return{type:"radio",id:g||_,name:_,value:n.value,disabled:s.value,readonly:i.value,checked:y.value,...R.value}}),R=r.computed(()=>{const{name:g}=o,_=h.pickBy(o,v=>v.startsWith("aria-"));return{"aria-label":g,"aria-checked":y.value,..._}});function C(){y.value||t("change",n.value),l.value=n.value}function W(g){s.value||(t("click",g),f.value=!0)}return(g,_)=>(r.openBlock(),r.createElementBlock("label",r.mergeProps({class:r.unref(d)},r.unref(m),{onClick:W}),[r.createElementVNode("input",r.mergeProps({ref_key:"input",ref:p,class:r.unref(A)},r.unref(b),{onInput:C}),null,16),r.renderSlot(g.$slots,"default",{value:r.unref(l)},()=>[r.createTextVNode(r.toDisplayString(g.label),1)])],16))}});function V(e){return Array.isArray(e)?e.filter(t=>h.isString(t)).reduce((t,n)=>t.length>0?t+`
|
|
2
|
+
`+n:n,""):e}function Z(e,t){return{name:"HintSlot",props:{params:{type:Object,default:()=>{}}},setup(n){const o=r.toRefs(e),{error:s,valid:i,hint:l,loading:u}=t,{hintLabel:a,modelValue:p,valid:y,validLabel:f,error:k,errorLabel:c}=o,d=h.resolveFieldData(o,"loading"),A=h.resolveFieldData(o,"loadingLabel"),m=r.computed(()=>k.value?!!(k.value&&s||(c==null?void 0:c.value)&&Array.isArray(c.value)&&c.value.length>0||(c==null?void 0:c.value)&&h.isNotEmpty(c.value)):!1),b=r.computed(()=>!!(a&&a.value||l||i||f&&f.value||m.value||(d==null?void 0:d.value)&&u||(d==null?void 0:d.value)&&(A==null?void 0:A.value))),R=r.computed(()=>{const C=O.toReactive({hintLabel:a,modelValue:p,valid:y,validLabel:f,error:k,errorLabel:c,loading:d,loadingLabel:A,...n.params});return k!=null&&k.value?(s==null?void 0:s(C))||V(c==null?void 0:c.value)||(a==null?void 0:a.value):y!=null&&y.value?(i==null?void 0:i(C))||V(f==null?void 0:f.value)||(a==null?void 0:a.value):d!=null&&d.value?(u==null?void 0:u(C))||V(A==null?void 0:A.value)||(a==null?void 0:a.value):(l==null?void 0:l(C))||V(a==null?void 0:a.value)||(a==null?void 0:a.value)});return{hasHint:b,hintContent:R}},render(){if(this.hasHint)return r.h("pre",{style:{"white-space":"pre"}},this.hintContent)}}}const M=["textContent"],U={class:"vv-input-radio-group__wrapper"};return r.defineComponent({__name:"VvRadioGroup",props:q,emits:F,setup(e,{emit:t}){const n=e,o=r.useSlots(),s=O.useVModel(n,"modelValue",t),{disabled:i,readonly:l,vertical:u,valid:a,error:p}=r.toRefs(n);D({key:S,modelValue:s,disabled:i,readonly:l});const{getOptionLabel:f,getOptionValue:k}=G(n),{bemCssClasses:c}=B("vv-input-radio-group",{horizontal:r.computed(()=>!u.value),valid:a,invalid:p});function d(m,b){return{id:`${n.name}_opt${b}`,name:n.name,label:f(m),value:k(m)}}const A=Z(n,o);return(m,b)=>(r.openBlock(),r.createElementBlock("fieldset",{class:r.normalizeClass(r.unref(c))},[m.label?(r.openBlock(),r.createElementBlock("legend",{key:0,textContent:r.toDisplayString(m.label)},null,8,M)):r.createCommentVNode("",!0),r.createElementVNode("div",U,[m.options.length>0?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(m.options,(R,C)=>(r.openBlock(),r.createBlock(z,r.mergeProps({key:C},d(R,C)),null,16))),128)):r.renderSlot(m.$slots,"default",{key:1})]),r.createVNode(r.unref(A),{class:"vv-input-radio-group__hint"})],2))}})});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { toRefs as
|
|
2
|
-
import { useFocus as
|
|
3
|
-
import { v4 as
|
|
1
|
+
import { toRefs as K, computed as S, h as W, unref as v, defineComponent as q, openBlock as j, createElementBlock as C, normalizeClass as F, createElementVNode as B, toDisplayString as N, createCommentVNode as x, Fragment as R, renderList as X, createTextVNode as T, useSlots as Y, ref as E, watch as ee, withKeys as P, withDirectives as te, vModelText as re, createVNode as $, mergeProps as ne } from "vue";
|
|
2
|
+
import { toReactive as se, useFocus as le, refDebounced as oe, onClickOutside as ae } from "@vueuse/core";
|
|
3
|
+
import { v4 as H } from "uuid";
|
|
4
4
|
const m = {
|
|
5
5
|
equals(t, r, e) {
|
|
6
6
|
return e ? this.resolveFieldData(t, e) === this.resolveFieldData(r, e) : this.deepEquals(t, r);
|
|
@@ -9,9 +9,9 @@ const m = {
|
|
|
9
9
|
if (t === r)
|
|
10
10
|
return !0;
|
|
11
11
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
12
|
-
const e = Array.isArray(t),
|
|
13
|
-
let n, s,
|
|
14
|
-
if (e &&
|
|
12
|
+
const e = Array.isArray(t), u = Array.isArray(r);
|
|
13
|
+
let n, s, i;
|
|
14
|
+
if (e && u) {
|
|
15
15
|
if (s = t.length, s != r.length)
|
|
16
16
|
return !1;
|
|
17
17
|
for (n = s; n-- !== 0; )
|
|
@@ -19,17 +19,17 @@ const m = {
|
|
|
19
19
|
return !1;
|
|
20
20
|
return !0;
|
|
21
21
|
}
|
|
22
|
-
if (e !=
|
|
22
|
+
if (e != u)
|
|
23
23
|
return !1;
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
24
|
+
const p = t instanceof Date, o = r instanceof Date;
|
|
25
|
+
if (p != o)
|
|
26
26
|
return !1;
|
|
27
|
-
if (
|
|
27
|
+
if (p && o)
|
|
28
28
|
return t.getTime() == r.getTime();
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
29
|
+
const g = t instanceof RegExp, b = r instanceof RegExp;
|
|
30
|
+
if (g != b)
|
|
31
31
|
return !1;
|
|
32
|
-
if (
|
|
32
|
+
if (g && b)
|
|
33
33
|
return t.toString() == r.toString();
|
|
34
34
|
const l = Object.keys(t);
|
|
35
35
|
if (s = l.length, s !== Object.keys(r).length)
|
|
@@ -38,7 +38,7 @@ const m = {
|
|
|
38
38
|
if (!Object.prototype.hasOwnProperty.call(r, l[n]))
|
|
39
39
|
return !1;
|
|
40
40
|
for (n = s; n-- !== 0; )
|
|
41
|
-
if (
|
|
41
|
+
if (i = l[n], !this.deepEquals(t[i], r[i]))
|
|
42
42
|
return !1;
|
|
43
43
|
return !0;
|
|
44
44
|
}
|
|
@@ -50,13 +50,13 @@ const m = {
|
|
|
50
50
|
return t[r];
|
|
51
51
|
{
|
|
52
52
|
const e = r.split(".");
|
|
53
|
-
let
|
|
53
|
+
let u = t;
|
|
54
54
|
for (let n = 0, s = e.length; n < s; ++n) {
|
|
55
55
|
if (t == null)
|
|
56
56
|
return null;
|
|
57
|
-
|
|
57
|
+
u = u[e[n]];
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return u;
|
|
60
60
|
}
|
|
61
61
|
} else
|
|
62
62
|
return null;
|
|
@@ -67,9 +67,9 @@ const m = {
|
|
|
67
67
|
findIndexInList(t, r) {
|
|
68
68
|
let e = -1;
|
|
69
69
|
if (r) {
|
|
70
|
-
for (let
|
|
71
|
-
if (this.equals(r[
|
|
72
|
-
e =
|
|
70
|
+
for (let u = 0; u < r.length; u++)
|
|
71
|
+
if (this.equals(r[u], t)) {
|
|
72
|
+
e = u;
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -96,20 +96,20 @@ const m = {
|
|
|
96
96
|
},
|
|
97
97
|
removeFromList(t, r) {
|
|
98
98
|
const e = this.findIndexInList(t, r);
|
|
99
|
-
return e > -1 ? r.filter((
|
|
99
|
+
return e > -1 ? r.filter((u, n) => n !== e) : r;
|
|
100
100
|
},
|
|
101
101
|
isString(t) {
|
|
102
102
|
return typeof t == "string" || t instanceof String;
|
|
103
103
|
},
|
|
104
104
|
propsToObject(t) {
|
|
105
105
|
return Object.keys(t).reduce((r, e) => {
|
|
106
|
-
var
|
|
107
|
-
return this.isFunction(t[e]) ? r[e] = t[e]() : Array.isArray(t[e]) ? r[e] = t[e][0]() : (
|
|
106
|
+
var u, n, s, i, p;
|
|
107
|
+
return this.isFunction(t[e]) ? r[e] = t[e]() : Array.isArray(t[e]) ? r[e] = t[e][0]() : (u = t[e]) != null && u.type && (Array.isArray(t[e].type) ? r[e] = ((n = t[e]) == null ? void 0 : n.default) || ((s = t[e]) == null ? void 0 : s.type[0]()) : r[e] = ((i = t[e]) == null ? void 0 : i.default) || ((p = t[e]) == null ? void 0 : p.type())), r;
|
|
108
108
|
}, {});
|
|
109
109
|
},
|
|
110
110
|
filterArray(t, r, e) {
|
|
111
|
-
return t.filter((
|
|
112
|
-
|
|
111
|
+
return t.filter((u) => r.some((n) => typeof n == "string" ? u[e] == n : this.equals(
|
|
112
|
+
u[e],
|
|
113
113
|
n[e]
|
|
114
114
|
)));
|
|
115
115
|
},
|
|
@@ -120,31 +120,31 @@ const m = {
|
|
|
120
120
|
/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
|
|
121
121
|
)) == null ? void 0 : r.join("-")) == null ? void 0 : e.toLowerCase();
|
|
122
122
|
}
|
|
123
|
-
},
|
|
123
|
+
}, ue = {
|
|
124
124
|
valid: Boolean,
|
|
125
125
|
validLabel: [String, Array]
|
|
126
|
-
},
|
|
126
|
+
}, ie = {
|
|
127
127
|
error: Boolean,
|
|
128
128
|
errorLabel: [String, Array]
|
|
129
|
-
},
|
|
129
|
+
}, ce = {
|
|
130
130
|
loading: Boolean,
|
|
131
131
|
loadingLabel: String
|
|
132
|
-
},
|
|
132
|
+
}, I = {
|
|
133
133
|
disabled: Boolean
|
|
134
|
-
},
|
|
134
|
+
}, de = {
|
|
135
135
|
readonly: Boolean
|
|
136
|
-
},
|
|
136
|
+
}, M = {
|
|
137
137
|
modifiers: [String, Array]
|
|
138
|
-
},
|
|
138
|
+
}, fe = {
|
|
139
139
|
hintLabel: { type: String, default: "" }
|
|
140
|
-
},
|
|
141
|
-
...oe,
|
|
142
|
-
...ae,
|
|
143
|
-
...ce,
|
|
140
|
+
}, pe = {
|
|
144
141
|
...ue,
|
|
145
|
-
...H,
|
|
146
142
|
...ie,
|
|
143
|
+
...fe,
|
|
144
|
+
...ce,
|
|
147
145
|
...I,
|
|
146
|
+
...de,
|
|
147
|
+
...M,
|
|
148
148
|
modelValue: [String, Array, Object],
|
|
149
149
|
label: String,
|
|
150
150
|
labelNoResult: { type: String, default: "No results" },
|
|
@@ -168,60 +168,78 @@ const m = {
|
|
|
168
168
|
iconLeft: String,
|
|
169
169
|
iconRight: String
|
|
170
170
|
};
|
|
171
|
-
function
|
|
171
|
+
function D(t) {
|
|
172
172
|
return Array.isArray(t) ? t.filter((r) => m.isString(r)).reduce((r, e) => r.length > 0 ? r + `
|
|
173
173
|
` + e : e, "") : t;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function ye(t, r) {
|
|
176
176
|
return {
|
|
177
177
|
name: "HintSlot",
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
props: {
|
|
179
|
+
params: { type: Object, default: () => {
|
|
180
|
+
} }
|
|
181
|
+
},
|
|
182
|
+
setup(e) {
|
|
183
|
+
const u = K(t), {
|
|
184
|
+
error: n,
|
|
185
|
+
valid: s,
|
|
186
|
+
hint: i,
|
|
187
|
+
loading: p
|
|
184
188
|
} = r, {
|
|
185
|
-
hintLabel:
|
|
189
|
+
hintLabel: o,
|
|
186
190
|
modelValue: g,
|
|
187
|
-
valid:
|
|
188
|
-
validLabel:
|
|
189
|
-
error:
|
|
190
|
-
errorLabel:
|
|
191
|
-
} =
|
|
192
|
-
|
|
191
|
+
valid: b,
|
|
192
|
+
validLabel: l,
|
|
193
|
+
error: h,
|
|
194
|
+
errorLabel: a
|
|
195
|
+
} = u, d = m.resolveFieldData(u, "loading"), y = m.resolveFieldData(
|
|
196
|
+
u,
|
|
193
197
|
"loadingLabel"
|
|
194
|
-
),
|
|
195
|
-
const
|
|
196
|
-
|
|
198
|
+
), V = S(() => h.value ? !!(h.value && n || (a == null ? void 0 : a.value) && Array.isArray(a.value) && a.value.length > 0 || (a == null ? void 0 : a.value) && m.isNotEmpty(a.value)) : !1), k = S(() => !!(o && o.value || i || s || l && l.value || V.value || (d == null ? void 0 : d.value) && p || (d == null ? void 0 : d.value) && (y == null ? void 0 : y.value))), _ = S(() => {
|
|
199
|
+
const O = se({
|
|
200
|
+
hintLabel: o,
|
|
201
|
+
modelValue: g,
|
|
202
|
+
valid: b,
|
|
203
|
+
validLabel: l,
|
|
204
|
+
error: h,
|
|
205
|
+
errorLabel: a,
|
|
206
|
+
loading: d,
|
|
207
|
+
loadingLabel: y,
|
|
208
|
+
...e.params
|
|
209
|
+
});
|
|
210
|
+
return h != null && h.value ? (n == null ? void 0 : n(O)) || D(a == null ? void 0 : a.value) || (o == null ? void 0 : o.value) : b != null && b.value ? (s == null ? void 0 : s(O)) || D(l == null ? void 0 : l.value) || (o == null ? void 0 : o.value) : d != null && d.value ? (p == null ? void 0 : p(O)) || D(y == null ? void 0 : y.value) || (o == null ? void 0 : o.value) : (i == null ? void 0 : i(O)) || D(o == null ? void 0 : o.value) || (o == null ? void 0 : o.value);
|
|
197
211
|
});
|
|
198
212
|
return {
|
|
199
|
-
hasHint:
|
|
200
|
-
hintContent:
|
|
213
|
+
hasHint: k,
|
|
214
|
+
hintContent: _
|
|
201
215
|
};
|
|
202
216
|
},
|
|
203
217
|
render() {
|
|
204
218
|
if (this.hasHint)
|
|
205
|
-
return W(
|
|
219
|
+
return W(
|
|
220
|
+
"pre",
|
|
221
|
+
{ style: { "white-space": "pre" } },
|
|
222
|
+
this.hintContent
|
|
223
|
+
);
|
|
206
224
|
}
|
|
207
225
|
};
|
|
208
226
|
}
|
|
209
227
|
function Z(t, r) {
|
|
210
228
|
const e = { [`${t}`]: !0 };
|
|
211
229
|
return {
|
|
212
|
-
bemCssClasses:
|
|
213
|
-
const
|
|
214
|
-
if (!
|
|
230
|
+
bemCssClasses: S(() => Object.keys(r).reduce((n, s) => {
|
|
231
|
+
const i = v(r[s]) || !1;
|
|
232
|
+
if (!i)
|
|
215
233
|
return n;
|
|
216
234
|
if (s === "modifiers") {
|
|
217
|
-
const
|
|
235
|
+
const p = Array.isArray(i) ? i : [i];
|
|
218
236
|
return {
|
|
219
237
|
...n,
|
|
220
|
-
...
|
|
221
|
-
(
|
|
222
|
-
...
|
|
238
|
+
...p.reduce(
|
|
239
|
+
(o, g) => ({
|
|
240
|
+
...o,
|
|
223
241
|
[`${t}--${m.kebabCase(
|
|
224
|
-
|
|
242
|
+
g
|
|
225
243
|
)}`]: !0
|
|
226
244
|
}),
|
|
227
245
|
{}
|
|
@@ -230,14 +248,14 @@ function Z(t, r) {
|
|
|
230
248
|
} else
|
|
231
249
|
return {
|
|
232
250
|
...n,
|
|
233
|
-
[`${t}--${m.kebabCase(s)}`]:
|
|
251
|
+
[`${t}--${m.kebabCase(s)}`]: i
|
|
234
252
|
};
|
|
235
253
|
}, e) || {})
|
|
236
254
|
};
|
|
237
255
|
}
|
|
238
|
-
const
|
|
239
|
-
...H,
|
|
256
|
+
const me = {
|
|
240
257
|
...I,
|
|
258
|
+
...M,
|
|
241
259
|
modelValue: [String, Array, Object],
|
|
242
260
|
labelNoResult: { type: String, default: "No results" },
|
|
243
261
|
options: {
|
|
@@ -249,179 +267,179 @@ const ye = {
|
|
|
249
267
|
maxValues: [Number, String],
|
|
250
268
|
labelKey: { type: String, default: "label" },
|
|
251
269
|
valueKey: { type: String, default: "value" }
|
|
252
|
-
},
|
|
270
|
+
}, ge = { key: 0 }, he = ["for"], ve = ["id", "type", "value", "checked", "disabled"], be = /* @__PURE__ */ q({
|
|
253
271
|
__name: "VvDropdown",
|
|
254
|
-
props:
|
|
272
|
+
props: me,
|
|
255
273
|
emits: ["update:modelValue"],
|
|
256
274
|
setup(t, { emit: r }) {
|
|
257
|
-
const e = t,
|
|
275
|
+
const e = t, u = H(), { modifiers: n, disabled: s } = K(e), { bemCssClasses: i } = Z("vv-dropdown", {
|
|
258
276
|
modifiers: n,
|
|
259
277
|
disabled: s
|
|
260
278
|
});
|
|
261
|
-
function
|
|
262
|
-
return Array.isArray(e.modelValue) ? m.contains(l, e.modelValue) || m.contains(
|
|
279
|
+
function p(l) {
|
|
280
|
+
return Array.isArray(e.modelValue) ? m.contains(l, e.modelValue) || m.contains(o(l), e.modelValue) : m.equals(l, e.modelValue) || m.equals(o(l), e.modelValue);
|
|
263
281
|
}
|
|
264
|
-
function
|
|
282
|
+
function o(l) {
|
|
265
283
|
return typeof l == "string" ? l : String(l[e.valueKey]);
|
|
266
284
|
}
|
|
267
|
-
function
|
|
285
|
+
function g(l) {
|
|
268
286
|
return typeof l == "string" ? l : l[e.labelKey];
|
|
269
287
|
}
|
|
270
|
-
function
|
|
271
|
-
var
|
|
272
|
-
const
|
|
273
|
-
let
|
|
274
|
-
if (
|
|
275
|
-
(
|
|
276
|
-
) : null) ||
|
|
277
|
-
if (typeof e.maxValues < "u" && e.maxValues >= 0 && ((V = e.modelValue) == null ? void 0 : V.length) >= e.maxValues && (Array.isArray(e.modelValue) && !m.contains(
|
|
278
|
-
|
|
288
|
+
function b(l) {
|
|
289
|
+
var y, V;
|
|
290
|
+
const h = l.target;
|
|
291
|
+
let a = h.value;
|
|
292
|
+
if (a = (e.useObject ? (y = e.options) == null ? void 0 : y.find(
|
|
293
|
+
(k) => k[e.valueKey] == a
|
|
294
|
+
) : null) || a, e.multiple) {
|
|
295
|
+
if (typeof e.maxValues < "u" && e.maxValues >= 0 && ((V = e.modelValue) == null ? void 0 : V.length) >= e.maxValues && (Array.isArray(e.modelValue) && !m.contains(a, e.modelValue) || e.maxValues == 0)) {
|
|
296
|
+
h.checked = !1;
|
|
279
297
|
return;
|
|
280
298
|
}
|
|
281
|
-
Array.isArray(e.modelValue) ?
|
|
299
|
+
Array.isArray(e.modelValue) ? a = m.contains(a, e.modelValue) ? m.removeFromList(a, e.modelValue) : [...e.modelValue, a] : a = [a];
|
|
282
300
|
}
|
|
283
|
-
r("update:modelValue",
|
|
301
|
+
r("update:modelValue", a);
|
|
284
302
|
}
|
|
285
|
-
return (l,
|
|
286
|
-
var
|
|
287
|
-
return
|
|
288
|
-
class:
|
|
303
|
+
return (l, h) => {
|
|
304
|
+
var a;
|
|
305
|
+
return j(), C("ul", {
|
|
306
|
+
class: F(v(i)),
|
|
289
307
|
role: "listbox"
|
|
290
308
|
}, [
|
|
291
|
-
(
|
|
292
|
-
|
|
309
|
+
(a = l.options) != null && a.length ? x("", !0) : (j(), C("li", ge, [
|
|
310
|
+
B("label", null, N(l.labelNoResult), 1)
|
|
293
311
|
])),
|
|
294
|
-
(
|
|
312
|
+
(j(!0), C(R, null, X(l.options, (d, y) => {
|
|
295
313
|
var V;
|
|
296
|
-
return
|
|
297
|
-
|
|
298
|
-
for: `dropdown-${
|
|
314
|
+
return j(), C("li", { key: y }, [
|
|
315
|
+
B("label", {
|
|
316
|
+
for: `dropdown-${y}-${v(u)}`
|
|
299
317
|
}, [
|
|
300
|
-
|
|
301
|
-
id: `dropdown-${
|
|
318
|
+
B("input", {
|
|
319
|
+
id: `dropdown-${y}-${v(u)}`,
|
|
302
320
|
type: l.multiple ? "checkbox" : "radio",
|
|
303
|
-
value:
|
|
304
|
-
checked:
|
|
305
|
-
disabled: typeof
|
|
306
|
-
onInput:
|
|
321
|
+
value: o(d),
|
|
322
|
+
checked: p(d),
|
|
323
|
+
disabled: typeof d == "object" ? (V = d.disabled) != null ? V : v(s) : v(s),
|
|
324
|
+
onInput: b
|
|
307
325
|
}, null, 40, ve),
|
|
308
|
-
|
|
309
|
-
], 8,
|
|
326
|
+
T(" " + N(g(d)), 1)
|
|
327
|
+
], 8, he)
|
|
310
328
|
]);
|
|
311
329
|
}), 128))
|
|
312
330
|
], 2);
|
|
313
331
|
};
|
|
314
332
|
}
|
|
315
|
-
}),
|
|
333
|
+
}), Ve = ["id"], Ae = {
|
|
316
334
|
key: 0,
|
|
317
335
|
for: "select"
|
|
318
|
-
},
|
|
336
|
+
}, Se = ["placeholder"], ke = /* @__PURE__ */ q({
|
|
319
337
|
__name: "VvSelect",
|
|
320
|
-
props:
|
|
338
|
+
props: pe,
|
|
321
339
|
emits: ["update:modelValue", "change:search"],
|
|
322
340
|
setup(t, { emit: r }) {
|
|
323
|
-
const e = t,
|
|
324
|
-
|
|
325
|
-
const
|
|
326
|
-
|
|
341
|
+
const e = t, u = Y(), n = ye(e, u), s = E(), i = E();
|
|
342
|
+
le(i, { initialValue: !0 });
|
|
343
|
+
const p = H(), o = E(""), g = oe(
|
|
344
|
+
o,
|
|
327
345
|
Number(e.debounceSearch)
|
|
328
|
-
),
|
|
346
|
+
), b = E(!1), {
|
|
329
347
|
modifiers: l,
|
|
330
|
-
disabled:
|
|
331
|
-
readonly:
|
|
332
|
-
loading:
|
|
333
|
-
iconLeft:
|
|
348
|
+
disabled: h,
|
|
349
|
+
readonly: a,
|
|
350
|
+
loading: d,
|
|
351
|
+
iconLeft: y,
|
|
334
352
|
iconRight: V,
|
|
335
|
-
valid:
|
|
336
|
-
error:
|
|
337
|
-
} =
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
() => r("change:search",
|
|
353
|
+
valid: k,
|
|
354
|
+
error: _
|
|
355
|
+
} = K(e);
|
|
356
|
+
ee(
|
|
357
|
+
g,
|
|
358
|
+
() => r("change:search", g.value)
|
|
341
359
|
);
|
|
342
|
-
const { bemCssClasses:
|
|
360
|
+
const { bemCssClasses: O } = Z("vv-select", {
|
|
343
361
|
modifiers: l,
|
|
344
|
-
disabled:
|
|
345
|
-
loading:
|
|
346
|
-
readonly:
|
|
347
|
-
iconLeft:
|
|
362
|
+
disabled: h,
|
|
363
|
+
loading: d,
|
|
364
|
+
readonly: a,
|
|
365
|
+
iconLeft: y,
|
|
348
366
|
iconRight: V,
|
|
349
|
-
valid:
|
|
350
|
-
invalid:
|
|
351
|
-
dirty:
|
|
352
|
-
}), z =
|
|
367
|
+
valid: k,
|
|
368
|
+
invalid: _,
|
|
369
|
+
dirty: S(() => m.isNotEmpty(e.modelValue))
|
|
370
|
+
}), z = S(
|
|
353
371
|
() => {
|
|
354
|
-
var
|
|
355
|
-
return (
|
|
372
|
+
var c;
|
|
373
|
+
return (c = e.options) == null ? void 0 : c.every((f) => typeof f == "object");
|
|
356
374
|
}
|
|
357
|
-
),
|
|
358
|
-
() => e.searchable ?
|
|
359
|
-
),
|
|
360
|
-
var
|
|
361
|
-
return (
|
|
362
|
-
}), G =
|
|
363
|
-
var f,
|
|
375
|
+
), U = S(
|
|
376
|
+
() => e.searchable ? L.value : e.options
|
|
377
|
+
), L = S(() => {
|
|
378
|
+
var c;
|
|
379
|
+
return (c = e.options) == null ? void 0 : c.filter((f) => typeof f == "string" ? f.toLowerCase().includes(g.value.toLowerCase().trim()) : f[e.labelKey].toLowerCase().includes(g.value.toLowerCase().trim()));
|
|
380
|
+
}), G = S(() => {
|
|
381
|
+
var f, A;
|
|
364
382
|
if (e.multiple && ((f = e.modelValue) == null ? void 0 : f.length) && Array.isArray(e.modelValue))
|
|
365
383
|
return z.value ? m.filterArray(
|
|
366
384
|
e.options,
|
|
367
385
|
e.modelValue,
|
|
368
386
|
e.valueKey
|
|
369
387
|
).map((w) => w[e.labelKey]).join(e.separator) : e.modelValue.join(e.separator);
|
|
370
|
-
const
|
|
388
|
+
const c = e.useObject ? e.modelValue : (A = e.options) == null ? void 0 : A.find(
|
|
371
389
|
(w) => typeof w == "object" ? w[e.valueKey] == e.modelValue : w == e.modelValue
|
|
372
390
|
);
|
|
373
|
-
return typeof
|
|
391
|
+
return typeof c == "object" ? c == null ? void 0 : c[e.labelKey] : c;
|
|
374
392
|
});
|
|
375
|
-
|
|
393
|
+
ae(s, () => {
|
|
376
394
|
s.value.open = !1;
|
|
377
395
|
});
|
|
378
|
-
function J(
|
|
379
|
-
const f =
|
|
380
|
-
|
|
396
|
+
function J(c) {
|
|
397
|
+
const f = c.target;
|
|
398
|
+
b.value = f.open;
|
|
381
399
|
}
|
|
382
|
-
function Q(
|
|
383
|
-
s.value && !e.multiple && (s.value.open = !1), r("update:modelValue",
|
|
400
|
+
function Q(c) {
|
|
401
|
+
s.value && !e.multiple && (s.value.open = !1), r("update:modelValue", c);
|
|
384
402
|
}
|
|
385
|
-
return (
|
|
386
|
-
id:
|
|
387
|
-
class:
|
|
403
|
+
return (c, f) => (j(), C("div", {
|
|
404
|
+
id: v(p),
|
|
405
|
+
class: F(v(O))
|
|
388
406
|
}, [
|
|
389
|
-
|
|
390
|
-
|
|
407
|
+
c.label ? (j(), C("label", Ae, N(c.label), 1)) : x("", !0),
|
|
408
|
+
B("details", {
|
|
391
409
|
ref_key: "dropdown",
|
|
392
410
|
ref: s,
|
|
393
411
|
role: "list",
|
|
394
412
|
class: "vv-select__wrapper",
|
|
395
|
-
onClick: f[2] || (f[2] = (
|
|
396
|
-
onKeyup: f[3] || (f[3] =
|
|
413
|
+
onClick: f[2] || (f[2] = (A) => v(h) || v(a) ? A.preventDefault() : null),
|
|
414
|
+
onKeyup: f[3] || (f[3] = P((A) => s.value.open = !1, ["esc"])),
|
|
397
415
|
onToggle: J
|
|
398
416
|
}, [
|
|
399
|
-
|
|
417
|
+
B("summary", {
|
|
400
418
|
class: "vv-select__input",
|
|
401
419
|
"aria-haspopup": "listbox",
|
|
402
|
-
onKeyup: f[1] || (f[1] =
|
|
420
|
+
onKeyup: f[1] || (f[1] = P((A) => c.searchable ? A.preventDefault() : null, ["space"]))
|
|
403
421
|
}, [
|
|
404
|
-
|
|
422
|
+
c.searchable && b.value ? te((j(), C("input", {
|
|
405
423
|
key: 0,
|
|
406
424
|
ref_key: "inputSearch",
|
|
407
|
-
ref:
|
|
408
|
-
"onUpdate:modelValue": f[0] || (f[0] = (
|
|
409
|
-
placeholder:
|
|
410
|
-
}, null, 8,
|
|
411
|
-
[
|
|
412
|
-
]) : (
|
|
413
|
-
|
|
425
|
+
ref: i,
|
|
426
|
+
"onUpdate:modelValue": f[0] || (f[0] = (A) => o.value = A),
|
|
427
|
+
placeholder: c.searchPlaceholder
|
|
428
|
+
}, null, 8, Se)), [
|
|
429
|
+
[re, o.value]
|
|
430
|
+
]) : (j(), C(R, { key: 1 }, [
|
|
431
|
+
T(N(v(G) || c.placeholder), 1)
|
|
414
432
|
], 64))
|
|
415
433
|
], 32),
|
|
416
|
-
|
|
434
|
+
$(be, ne({
|
|
417
435
|
...e,
|
|
418
|
-
options:
|
|
436
|
+
options: v(U)
|
|
419
437
|
}, { "onUpdate:modelValue": Q }), null, 16)
|
|
420
438
|
], 544),
|
|
421
|
-
|
|
422
|
-
], 10,
|
|
439
|
+
$(v(n), { class: "vv-select__hint" })
|
|
440
|
+
], 10, Ve));
|
|
423
441
|
}
|
|
424
442
|
});
|
|
425
443
|
export {
|
|
426
|
-
|
|
444
|
+
ke as default
|
|
427
445
|
};
|