@volverjs/ui-vue 0.0.8-beta.1 → 0.0.8-beta.11
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/auto-imports.d.ts +1 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +4 -3
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +555 -106
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +3 -0
- package/dist/components/VvCombobox/index.d.ts +1 -0
- package/dist/components/VvDropdown/VvDropdown.es.js +56 -28
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +11 -2
- package/dist/components/VvDropdown/index.d.ts +7 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +4 -3
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +4 -3
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/index.es.js +110 -58
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/stories/Combobox/ComboboxOptions.stories.d.ts +1 -0
- package/package.json +32 -28
- 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/VvCombobox/VvCombobox.vue +48 -26
- package/src/components/VvCombobox/index.ts +1 -0
- package/src/components/VvDropdown/VvDropdown.vue +59 -26
- package/src/components/VvDropdown/index.ts +8 -2
- package/src/composables/useOptions.ts +4 -3
- package/src/stories/Combobox/Combobox.settings.ts +22 -1
- package/src/stories/Combobox/Combobox.test.ts +5 -6
- package/src/stories/Combobox/ComboboxOptions.stories.ts +18 -0
- package/src/stories/Select/Select.test.ts +3 -3
- package/src/stories/Tooltip/Tooltip.test.ts +3 -1
|
@@ -2,6 +2,7 @@ import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, creat
|
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { nanoid } from "nanoid";
|
|
4
4
|
import { useFocus, useElementVisibility } from "@vueuse/core";
|
|
5
|
+
import { get } from "ts-dot-prop";
|
|
5
6
|
const VvIconProps = {
|
|
6
7
|
/**
|
|
7
8
|
* Color
|
|
@@ -766,18 +767,18 @@ function useOptions(props) {
|
|
|
766
767
|
if (typeof option !== "object" && option !== null)
|
|
767
768
|
return option;
|
|
768
769
|
return String(
|
|
769
|
-
typeof labelKey.value === "function" ? labelKey.value(option) : option
|
|
770
|
+
typeof labelKey.value === "function" ? labelKey.value(option) : get(option, labelKey.value)
|
|
770
771
|
);
|
|
771
772
|
};
|
|
772
773
|
const getOptionValue = (option) => {
|
|
773
774
|
if (typeof option !== "object" && option !== null)
|
|
774
775
|
return option;
|
|
775
|
-
return typeof valueKey.value === "function" ? valueKey.value(option) : option
|
|
776
|
+
return typeof valueKey.value === "function" ? valueKey.value(option) : get(option, valueKey.value);
|
|
776
777
|
};
|
|
777
778
|
const getOptionDisabled = (option) => {
|
|
778
779
|
if (typeof option !== "object" && option !== null)
|
|
779
780
|
return false;
|
|
780
|
-
return typeof disabledKey.value === "function" ? disabledKey.value(option) : option
|
|
781
|
+
return typeof disabledKey.value === "function" ? disabledKey.value(option) : get(option, disabledKey.value);
|
|
781
782
|
};
|
|
782
783
|
const getOptionGrouped = (option) => {
|
|
783
784
|
if (typeof option !== "object" && option !== null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@iconify/vue"),require("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","nanoid","@vueuse/core"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvSelect=l(e.vue,e.vue$1,e.nanoid,e.core)}(this,(function(e,l,o,t){"use strict";const n={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{});const u=Symbol.for("volver");function d(l,o,t){return e.computed((()=>{const n={[l]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((o=>{n[`${l}--${o}`]=e.unref(t.value[o])})),n}))}const s=e.defineComponent({name:"VvIcon",props:n,setup(o){const t=o,n=e.computed((()=>"string"==typeof t.rotate?parseFloat(t.rotate):t.rotate)),a=e.ref(!0),i=e.inject(u),{modifiers:r}=e.toRefs(t),s=d("vv-icon",r),c=e.computed((()=>t.provider||(null==i?void 0:i.iconsProvider))),v=e.computed((()=>{const e=t.name??"",o=`@${c.value}:${t.prefix}:${e}`;if(l.iconExists(o))return o;const n=null==i?void 0:i.iconsCollections.find((o=>{const t=`@${c.value}:${o.prefix}:${e}`;return l.iconExists(t)}));return n?`@${c.value}:${n.prefix}:${e}`:e}));function p(e){const o=function(e){let l;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");l=(new e).window}return(l?new l.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),n=(null==o?void 0:o.innerHTML.trim())||"";o&&n&&l.addIcon(`@${c.value}:${t.prefix}:${t.name}`,{body:n,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&t.src&&!l.iconExists(`@${c.value}:${t.prefix}:${t.name}`)&&(a.value=!1,i.fetchIcon(t.src).then((e=>{e&&(p(e),a.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),t.svg&&p(t.svg),(o,t)=>e.unref(a)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(s)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:e.unref(n),color:o.color,onLoad:o.onLoad,icon:e.unref(v)}),null,16,["class"])):e.createCommentVNode("",!0)}});function c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}const v={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},f={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},m={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),b={readonly:Boolean},h={modifiers:[String,Array]},y={hintLabel:{type:String,default:""}},S={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},B={icon:{type:[String,Object]},iconPosition:{type:String,default:i.before,validation:e=>Object.values(i).includes(e)}},k={tabindex:{type:[String,Number],default:0}},L={floating:Boolean},$={unselectable:{type:Boolean,default:!0}},V={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const O={...V,name:{type:String,required:!0}},w={autofocus:Boolean},E={autocomplete:{type:String,default:"off"}};r.button;const x={...O,...w,...E,...k,...v,...p,...y,...f,...m,...b,...h,...S,...B,...L,...$,...g,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},placeholder:String};const P=["for"],I={class:"vv-select__wrapper"},N={key:0,class:"vv-select__input-before"},_={class:"vv-select__inner"},A=["id"],C=["disabled","hidden"],F=["disabled","value"],j=["disabled","label"],z=["disabled","value"],q={key:1,class:"vv-select__input-after"};return e.defineComponent({name:"VvSelect",props:x,emits:["update:modelValue","focus","blur"],setup(l,{emit:n}){const r=l,u=e.useSlots(),v=e.ref(),{HintSlot:p,hasHintLabelOrSlot:f,hasInvalidLabelOrSlot:m,hintSlotScope:g}=function(l,o){const t=e.computed((()=>c(l.invalidLabel))),n=e.computed((()=>c(l.validLabel))),a=e.computed((()=>l.loadingLabel)),i=e.computed((()=>l.hintLabel)),r=e.computed((()=>Boolean(l.loading&&(o.loading||a.value)))),u=e.computed((()=>!r.value&&Boolean(l.invalid&&(o.invalid||t.value)))),d=e.computed((()=>!r.value&&!u.value&&Boolean(l.valid&&(o.valid||n.value)))),s=e.computed((()=>!r.value&&!u.value&&!d.value&&Boolean(o.hint||i.value))),v=e.computed((()=>u.value||d.value||r.value||s.value)),p=e.computed((()=>({modelValue:l.modelValue,valid:l.valid,invalid:l.invalid,loading:l.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:t,validLabel:n,loadingLabel:a,hintLabel:i,hasInvalidLabelOrSlot:u,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:r,hasHintLabelOrSlot:s}),render(){var l,o,t,n,a,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(l=this.$slots).loading)?void 0:o.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(t=this.$slots).invalid)?void 0:n.call(t))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(a=this.$slots).valid)?void 0:i.call(a))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:u,hasHintLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:r,hintSlotScope:p,HintSlot:f}}(r,u),{id:b,modifiers:h,disabled:y,readonly:S,loading:B,icon:k,iconPosition:L,invalid:$,valid:V,floating:O,multiple:w}=e.toRefs(r),E=(l=>e.computed((()=>String((null==l?void 0:l.value)||o.nanoid()))))(b),x=e.computed((()=>`${E.value}-hint`)),{focused:D}=function(l,o){const{focused:n}=t.useFocus(l);return e.watch(n,(t=>{o(t?"focus":"blur",e.unref(l))})),{focused:n}}(v,n),R=t.useElementVisibility(v);e.watch(R,(e=>{e&&r.autofocus&&(D.value=!0)}));const{hasIcon:H,hasIconBefore:K,hasIconAfter:M}=function(l,o){const t=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===i.before))),n=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===i.after))),r=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===a.left))),u=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===a.right))),d=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===a.top))),s=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===a.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==l?void 0:l.value)?{name:null==l?void 0:l.value}:null==l?void 0:l.value)),hasIconLeft:r,hasIconRight:u,hasIconTop:d,hasIconBottom:s,hasIconBefore:t,hasIconAfter:n}}(k,L),T=e.computed((()=>{return l=r.modelValue,!(null==(o=e.unref(l))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var l,o})),G=e.computed((()=>r.disabled||r.readonly)),J=e.computed((()=>G.value?-1:r.tabindex)),U=e.computed((()=>!0===r.invalid||!0!==r.valid&&void 0)),Q=d("vv-select",h,e.computed((()=>({valid:V.value,invalid:$.value,loading:B.value,disabled:y.value,readonly:S.value,"icon-before":K.value,"icon-after":M.value,dirty:T.value,focus:D.value,floating:O.value,multiple:w.value})))),W=e.computed((()=>({name:r.name,tabindex:J.value,disabled:G.value,required:r.required,size:r.size,autocomplete:r.autocomplete,multiple:r.multiple,"aria-invalid":U.value,"aria-describedby":f.value?x.value:void 0,"aria-errormessage":m.value?x.value:void 0}))),X=e.computed((()=>({valid:r.valid,invalid:r.invalid,modelValue:r.modelValue}))),{getOptionLabel:Y,getOptionValue:Z,getOptionDisabled:ee,getOptionGrouped:le}=function(l){const{options:o,labelKey:t,valueKey:n,disabledKey:a}=e.toRefs(l);return{options:o,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof t.value?t.value(e):e[t.value]),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):e[n.value],getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof a.value?a.value(e):e[a.value]),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(r),oe=e.computed({get:()=>r.modelValue,set:e=>{Array.isArray(e)&&(e=e.filter((e=>void 0!==e))),n("update:modelValue",e)}}),te=e=>"string"!=typeof e&&(e&&e.options&&e.options.length>0);return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(Q))},[l.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(E)},e.toDisplayString(l.label),9,P)):e.createCommentVNode("",!0),e.createElementVNode("div",I,[l.$slots.before?(e.openBlock(),e.createElementBlock("div",N,[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.createElementVNode("div",_,[e.unref(K)?(e.openBlock(),e.createBlock(s,e.mergeProps({key:0,class:"vv-select__icon"},e.unref(H)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(E),ref_key:"select",ref:v,"onUpdate:modelValue":o[0]||(o[0]=l=>e.isRef(oe)?oe.value=l:null)},e.unref(W)),[l.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!l.unselectable,hidden:!l.unselectable},e.toDisplayString(l.placeholder),9,C)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,((l,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[te(l)?(e.openBlock(),e.createElementBlock("optgroup",{key:`group-${o}`,disabled:e.unref(ee)(l),label:e.unref(Y)(l)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(le)(l),((l,t)=>(e.openBlock(),e.createElementBlock("option",{key:`group-${o}-item-${t}`,disabled:e.unref(ee)(l),value:e.unref(Z)(l)},e.toDisplayString(e.unref(Y)(l)),9,z)))),128))],8,j)):(e.openBlock(),e.createElementBlock("option",{key:o,disabled:e.unref(ee)(l),value:e.unref(Z)(l)},e.toDisplayString(e.unref(Y)(l)),9,F))],64)))),256))],16,A),[[e.vModelSelect,e.unref(oe)]]),e.unref(M)?(e.openBlock(),e.createBlock(s,e.mergeProps({key:1,class:"vv-select__icon vv-select__icon-after"},e.unref(H)),null,16)):e.createCommentVNode("",!0)]),l.$slots.after?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(l.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(p),{id:e.unref(x),class:"vv-select__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(g))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(g))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(g))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(g))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@iconify/vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","nanoid","@vueuse/core","ts-dot-prop"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvSelect=l(e.vue,e.vue$1,e.nanoid,e.core,e.tsDotProp)}(this,(function(e,l,o,t,n){"use strict";const a={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var i=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(i||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{});const d=Symbol.for("volver");function s(l,o,t){return e.computed((()=>{const n={[l]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((o=>{n[`${l}--${o}`]=e.unref(t.value[o])})),n}))}const c=e.defineComponent({name:"VvIcon",props:a,setup(o){const t=o,n=e.computed((()=>"string"==typeof t.rotate?parseFloat(t.rotate):t.rotate)),a=e.ref(!0),i=e.inject(d),{modifiers:r}=e.toRefs(t),u=s("vv-icon",r),c=e.computed((()=>t.provider||(null==i?void 0:i.iconsProvider))),v=e.computed((()=>{const e=t.name??"",o=`@${c.value}:${t.prefix}:${e}`;if(l.iconExists(o))return o;const n=null==i?void 0:i.iconsCollections.find((o=>{const t=`@${c.value}:${o.prefix}:${e}`;return l.iconExists(t)}));return n?`@${c.value}:${n.prefix}:${e}`:e}));function p(e){const o=function(e){let l;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");l=(new e).window}return(l?new l.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),n=(null==o?void 0:o.innerHTML.trim())||"";o&&n&&l.addIcon(`@${c.value}:${t.prefix}:${t.name}`,{body:n,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&t.src&&!l.iconExists(`@${c.value}:${t.prefix}:${t.name}`)&&(a.value=!1,i.fetchIcon(t.src).then((e=>{e&&(p(e),a.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),t.svg&&p(t.svg),(o,t)=>e.unref(a)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:e.unref(n),color:o.color,onLoad:o.onLoad,icon:e.unref(v)}),null,16,["class"])):e.createCommentVNode("",!0)}});function v(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}const p={valid:Boolean,validLabel:[String,Array]},f={invalid:Boolean,invalidLabel:[String,Array]},m={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),h={readonly:Boolean},y={modifiers:[String,Array]},S={hintLabel:{type:String,default:""}},B={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},k={icon:{type:[String,Object]},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},L={tabindex:{type:[String,Number],default:0}},$={floating:Boolean},V={unselectable:{type:Boolean,default:!0}},O={id:[String,Number]};i.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const w={...O,name:{type:String,required:!0}},E={autofocus:Boolean},P={autocomplete:{type:String,default:"off"}};u.button;const x={...w,...E,...P,...L,...p,...f,...S,...m,...g,...h,...y,...B,...k,...$,...V,...b,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},placeholder:String};const I=["for"],N={class:"vv-select__wrapper"},_={key:0,class:"vv-select__input-before"},A={class:"vv-select__inner"},C=["id"],F=["disabled","hidden"],j=["disabled","value"],z=["disabled","label"],q=["disabled","value"],D={key:1,class:"vv-select__input-after"};return e.defineComponent({name:"VvSelect",props:x,emits:["update:modelValue","focus","blur"],setup(l,{emit:a}){const u=l,d=e.useSlots(),p=e.ref(),{HintSlot:f,hasHintLabelOrSlot:m,hasInvalidLabelOrSlot:g,hintSlotScope:b}=function(l,o){const t=e.computed((()=>v(l.invalidLabel))),n=e.computed((()=>v(l.validLabel))),a=e.computed((()=>l.loadingLabel)),i=e.computed((()=>l.hintLabel)),r=e.computed((()=>Boolean(l.loading&&(o.loading||a.value)))),u=e.computed((()=>!r.value&&Boolean(l.invalid&&(o.invalid||t.value)))),d=e.computed((()=>!r.value&&!u.value&&Boolean(l.valid&&(o.valid||n.value)))),s=e.computed((()=>!r.value&&!u.value&&!d.value&&Boolean(o.hint||i.value))),c=e.computed((()=>u.value||d.value||r.value||s.value)),p=e.computed((()=>({modelValue:l.modelValue,valid:l.valid,invalid:l.invalid,loading:l.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:t,validLabel:n,loadingLabel:a,hintLabel:i,hasInvalidLabelOrSlot:u,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:r,hasHintLabelOrSlot:s}),render(){var l,o,t,n,a,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(l=this.$slots).loading)?void 0:o.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(t=this.$slots).invalid)?void 0:n.call(t))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(a=this.$slots).valid)?void 0:i.call(a))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:u,hasHintLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:r,hintSlotScope:p,HintSlot:f}}(u,d),{id:h,modifiers:y,disabled:S,readonly:B,loading:k,icon:L,iconPosition:$,invalid:V,valid:O,floating:w,multiple:E}=e.toRefs(u),P=(l=>e.computed((()=>String((null==l?void 0:l.value)||o.nanoid()))))(h),x=e.computed((()=>`${P.value}-hint`)),{focused:R}=function(l,o){const{focused:n}=t.useFocus(l);return e.watch(n,(t=>{o(t?"focus":"blur",e.unref(l))})),{focused:n}}(p,a),H=t.useElementVisibility(p);e.watch(H,(e=>{e&&u.autofocus&&(R.value=!0)}));const{hasIcon:K,hasIconBefore:M,hasIconAfter:T}=function(l,o){const t=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===r.before))),n=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===r.after))),a=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===i.left))),u=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===i.right))),d=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===i.top))),s=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===i.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==l?void 0:l.value)?{name:null==l?void 0:l.value}:null==l?void 0:l.value)),hasIconLeft:a,hasIconRight:u,hasIconTop:d,hasIconBottom:s,hasIconBefore:t,hasIconAfter:n}}(L,$),G=e.computed((()=>{return l=u.modelValue,!(null==(o=e.unref(l))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var l,o})),J=e.computed((()=>u.disabled||u.readonly)),U=e.computed((()=>J.value?-1:u.tabindex)),Q=e.computed((()=>!0===u.invalid||!0!==u.valid&&void 0)),W=s("vv-select",y,e.computed((()=>({valid:O.value,invalid:V.value,loading:k.value,disabled:S.value,readonly:B.value,"icon-before":M.value,"icon-after":T.value,dirty:G.value,focus:R.value,floating:w.value,multiple:E.value})))),X=e.computed((()=>({name:u.name,tabindex:U.value,disabled:J.value,required:u.required,size:u.size,autocomplete:u.autocomplete,multiple:u.multiple,"aria-invalid":Q.value,"aria-describedby":m.value?x.value:void 0,"aria-errormessage":g.value?x.value:void 0}))),Y=e.computed((()=>({valid:u.valid,invalid:u.invalid,modelValue:u.modelValue}))),{getOptionLabel:Z,getOptionValue:ee,getOptionDisabled:le,getOptionGrouped:oe}=function(l){const{options:o,labelKey:t,valueKey:a,disabledKey:i}=e.toRefs(l);return{options:o,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof t.value?t.value(e):n.get(e,t.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof a.value?a.value(e):n.get(e,a.value),getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):n.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(u),te=e.computed({get:()=>u.modelValue,set:e=>{Array.isArray(e)&&(e=e.filter((e=>void 0!==e))),a("update:modelValue",e)}}),ne=e=>"string"!=typeof e&&(e&&e.options&&e.options.length>0);return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(W))},[l.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(P)},e.toDisplayString(l.label),9,I)):e.createCommentVNode("",!0),e.createElementVNode("div",N,[l.$slots.before?(e.openBlock(),e.createElementBlock("div",_,[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(Y))))])):e.createCommentVNode("",!0),e.createElementVNode("div",A,[e.unref(M)?(e.openBlock(),e.createBlock(c,e.mergeProps({key:0,class:"vv-select__icon"},e.unref(K)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(P),ref_key:"select",ref:p,"onUpdate:modelValue":o[0]||(o[0]=l=>e.isRef(te)?te.value=l:null)},e.unref(X)),[l.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!l.unselectable,hidden:!l.unselectable},e.toDisplayString(l.placeholder),9,F)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,((l,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[ne(l)?(e.openBlock(),e.createElementBlock("optgroup",{key:`group-${o}`,disabled:e.unref(le)(l),label:e.unref(Z)(l)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(oe)(l),((l,t)=>(e.openBlock(),e.createElementBlock("option",{key:`group-${o}-item-${t}`,disabled:e.unref(le)(l),value:e.unref(ee)(l)},e.toDisplayString(e.unref(Z)(l)),9,q)))),128))],8,z)):(e.openBlock(),e.createElementBlock("option",{key:o,disabled:e.unref(le)(l),value:e.unref(ee)(l)},e.toDisplayString(e.unref(Z)(l)),9,j))],64)))),256))],16,C),[[e.vModelSelect,e.unref(te)]]),e.unref(T)?(e.openBlock(),e.createBlock(c,e.mergeProps({key:1,class:"vv-select__icon vv-select__icon-after"},e.unref(K)),null,16)):e.createCommentVNode("",!0)]),l.$slots.after?(e.openBlock(),e.createElementBlock("div",D,[e.renderSlot(l.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(Y))))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(f),{id:e.unref(x),class:"vv-select__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { unref, inject, computed, toRef, toRefs, defineComponent, useAttrs, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, isRef, provide, watchEffect, watch, Fragment, renderList, createBlock, mergeProps, withCtx, resolveDynamicComponent, createCommentVNode, useSlots, h, onMounted, withDirectives, vModelCheckbox, createVNode, createSlots, nextTick, Transition, toHandlers, normalizeStyle, vShow, vModelSelect, vModelText, vModelDynamic, vModelRadio } from "vue";
|
|
2
2
|
import { nanoid } from "nanoid";
|
|
3
|
-
import { useToggle, useStorage, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced } from "@vueuse/core";
|
|
3
|
+
import { useToggle, useStorage, useVModel, useMutationObserver, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced } from "@vueuse/core";
|
|
4
4
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
5
|
+
import { get } from "ts-dot-prop";
|
|
5
6
|
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
6
7
|
import mitt from "mitt";
|
|
7
8
|
import { Mask } from "maska";
|
|
@@ -2082,18 +2083,18 @@ function useOptions(props) {
|
|
|
2082
2083
|
if (typeof option !== "object" && option !== null)
|
|
2083
2084
|
return option;
|
|
2084
2085
|
return String(
|
|
2085
|
-
typeof labelKey.value === "function" ? labelKey.value(option) : option
|
|
2086
|
+
typeof labelKey.value === "function" ? labelKey.value(option) : get(option, labelKey.value)
|
|
2086
2087
|
);
|
|
2087
2088
|
};
|
|
2088
2089
|
const getOptionValue = (option) => {
|
|
2089
2090
|
if (typeof option !== "object" && option !== null)
|
|
2090
2091
|
return option;
|
|
2091
|
-
return typeof valueKey.value === "function" ? valueKey.value(option) : option
|
|
2092
|
+
return typeof valueKey.value === "function" ? valueKey.value(option) : get(option, valueKey.value);
|
|
2092
2093
|
};
|
|
2093
2094
|
const getOptionDisabled = (option) => {
|
|
2094
2095
|
if (typeof option !== "object" && option !== null)
|
|
2095
2096
|
return false;
|
|
2096
|
-
return typeof disabledKey.value === "function" ? disabledKey.value(option) : option
|
|
2097
|
+
return typeof disabledKey.value === "function" ? disabledKey.value(option) : get(option, disabledKey.value);
|
|
2097
2098
|
};
|
|
2098
2099
|
const getOptionGrouped = (option) => {
|
|
2099
2100
|
if (typeof option !== "object" && option !== null)
|
|
@@ -2311,7 +2312,8 @@ const VvComboboxProps = {
|
|
|
2311
2312
|
* Dropdown modifiers
|
|
2312
2313
|
*/
|
|
2313
2314
|
dropdownModifiers: {
|
|
2314
|
-
type: [String, Array]
|
|
2315
|
+
type: [String, Array],
|
|
2316
|
+
default: "mobile"
|
|
2315
2317
|
},
|
|
2316
2318
|
/**
|
|
2317
2319
|
* Open dropdown on focus
|
|
@@ -2330,8 +2332,14 @@ const VvComboboxProps = {
|
|
|
2330
2332
|
};
|
|
2331
2333
|
const VvDropdownProps = {
|
|
2332
2334
|
...IdProps,
|
|
2333
|
-
...ModifiersProps,
|
|
2334
2335
|
...DropdownProps,
|
|
2336
|
+
/**
|
|
2337
|
+
* Component BEM modifiers
|
|
2338
|
+
*/
|
|
2339
|
+
modifiers: {
|
|
2340
|
+
type: [String, Array],
|
|
2341
|
+
default: "mobile"
|
|
2342
|
+
},
|
|
2335
2343
|
/**
|
|
2336
2344
|
* Show / hide dropdown programmatically
|
|
2337
2345
|
*/
|
|
@@ -2427,7 +2435,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2427
2435
|
const maxWidth = ref("auto");
|
|
2428
2436
|
const maxHeight = ref("auto");
|
|
2429
2437
|
const localReferenceEl = ref(null);
|
|
2430
|
-
const floatingEl = ref(
|
|
2438
|
+
const floatingEl = ref();
|
|
2431
2439
|
const arrowEl = ref(null);
|
|
2432
2440
|
const listEl = ref(null);
|
|
2433
2441
|
const referenceEl = computed({
|
|
@@ -2436,6 +2444,17 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2436
2444
|
localReferenceEl.value = newValue;
|
|
2437
2445
|
}
|
|
2438
2446
|
});
|
|
2447
|
+
const dropdownCustomPosition = ref();
|
|
2448
|
+
const onChangeDropdownCustomPosition = () => {
|
|
2449
|
+
var _a;
|
|
2450
|
+
dropdownCustomPosition.value = (_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim();
|
|
2451
|
+
};
|
|
2452
|
+
onMounted(() => {
|
|
2453
|
+
useMutationObserver(floatingEl.value, onChangeDropdownCustomPosition, {
|
|
2454
|
+
attributeFilter: ["style"],
|
|
2455
|
+
window
|
|
2456
|
+
});
|
|
2457
|
+
});
|
|
2439
2458
|
const middleware = computed(() => {
|
|
2440
2459
|
const toReturn = [];
|
|
2441
2460
|
if (props.autoPlacement) {
|
|
@@ -2510,14 +2529,19 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2510
2529
|
middleware
|
|
2511
2530
|
}
|
|
2512
2531
|
);
|
|
2513
|
-
const dropdownPlacement = computed(() =>
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2532
|
+
const dropdownPlacement = computed(() => {
|
|
2533
|
+
if ((dropdownCustomPosition == null ? void 0 : dropdownCustomPosition.value) === "true") {
|
|
2534
|
+
return {};
|
|
2535
|
+
}
|
|
2536
|
+
return {
|
|
2537
|
+
position: strategy.value,
|
|
2538
|
+
top: `${y.value ?? 0}px`,
|
|
2539
|
+
left: `${x.value ?? 0}px`,
|
|
2540
|
+
maxWidth: maxWidth.value,
|
|
2541
|
+
maxHeight: maxHeight.value,
|
|
2542
|
+
width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
|
|
2543
|
+
};
|
|
2544
|
+
});
|
|
2521
2545
|
const side = computed(() => placement.value.split("-")[0]);
|
|
2522
2546
|
const staticSide = computed(
|
|
2523
2547
|
() => ({
|
|
@@ -2529,6 +2553,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2529
2553
|
);
|
|
2530
2554
|
const arrowPlacement = computed(() => {
|
|
2531
2555
|
var _a, _b, _c, _d;
|
|
2556
|
+
if ((dropdownCustomPosition == null ? void 0 : dropdownCustomPosition.value) === "true") {
|
|
2557
|
+
return {};
|
|
2558
|
+
}
|
|
2532
2559
|
if (["bottom", "top"].includes(staticSide.value)) {
|
|
2533
2560
|
return {
|
|
2534
2561
|
right: `${((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) ?? 0}px`,
|
|
@@ -2564,7 +2591,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2564
2591
|
const init = (el) => {
|
|
2565
2592
|
referenceEl.value = el;
|
|
2566
2593
|
};
|
|
2567
|
-
__expose({ toggle, show, hide, init });
|
|
2594
|
+
__expose({ toggle, show, hide, init, dropdownCustomPosition });
|
|
2568
2595
|
watch(expanded, (newValue) => {
|
|
2569
2596
|
if (newValue && props.autofocusFirst) {
|
|
2570
2597
|
nextTick(() => {
|
|
@@ -2572,7 +2599,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2572
2599
|
floatingEl.value
|
|
2573
2600
|
);
|
|
2574
2601
|
if (focusableElements.length > 0) {
|
|
2575
|
-
focusableElements[0].focus(
|
|
2602
|
+
focusableElements[0].focus({
|
|
2603
|
+
preventScroll: true
|
|
2604
|
+
});
|
|
2576
2605
|
}
|
|
2577
2606
|
});
|
|
2578
2607
|
}
|
|
@@ -2637,9 +2666,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2637
2666
|
document.activeElement
|
|
2638
2667
|
);
|
|
2639
2668
|
if (activeElementIndex < focusableElements.length - 1) {
|
|
2640
|
-
focusableElements[activeElementIndex + 1].focus(
|
|
2669
|
+
focusableElements[activeElementIndex + 1].focus({
|
|
2670
|
+
preventScroll: true
|
|
2671
|
+
});
|
|
2641
2672
|
} else {
|
|
2642
|
-
focusableElements[0].focus(
|
|
2673
|
+
focusableElements[0].focus({
|
|
2674
|
+
preventScroll: true
|
|
2675
|
+
});
|
|
2643
2676
|
}
|
|
2644
2677
|
}
|
|
2645
2678
|
});
|
|
@@ -2657,9 +2690,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2657
2690
|
document.activeElement
|
|
2658
2691
|
);
|
|
2659
2692
|
if (activeElementIndex > 0) {
|
|
2660
|
-
focusableElements[activeElementIndex - 1].focus(
|
|
2693
|
+
focusableElements[activeElementIndex - 1].focus({
|
|
2694
|
+
preventScroll: true
|
|
2695
|
+
});
|
|
2661
2696
|
} else {
|
|
2662
|
-
focusableElements[focusableElements.length - 1].focus(
|
|
2697
|
+
focusableElements[focusableElements.length - 1].focus({
|
|
2698
|
+
preventScroll: true
|
|
2699
|
+
});
|
|
2663
2700
|
}
|
|
2664
2701
|
}
|
|
2665
2702
|
});
|
|
@@ -2683,10 +2720,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2683
2720
|
}
|
|
2684
2721
|
});
|
|
2685
2722
|
onKeyStroke([" ", "Enter"], (e) => {
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
activeElement.click();
|
|
2723
|
+
const htmlEl = e.target;
|
|
2724
|
+
if (expanded.value && focused.value && htmlEl) {
|
|
2725
|
+
htmlEl == null ? void 0 : htmlEl.click();
|
|
2690
2726
|
}
|
|
2691
2727
|
});
|
|
2692
2728
|
const onTransitionBeforeEnter = () => {
|
|
@@ -3254,7 +3290,12 @@ const _hoisted_9 = {
|
|
|
3254
3290
|
};
|
|
3255
3291
|
const __default__$6 = {
|
|
3256
3292
|
name: "VvCombobox",
|
|
3257
|
-
components: {
|
|
3293
|
+
components: {
|
|
3294
|
+
VvDropdown: _sfc_main$b,
|
|
3295
|
+
VvDropdownOption: _sfc_main$9,
|
|
3296
|
+
VvDropdownOptgroup: _sfc_main$8,
|
|
3297
|
+
VvButton: _sfc_main$g
|
|
3298
|
+
}
|
|
3258
3299
|
};
|
|
3259
3300
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
3260
3301
|
...__default__$6,
|
|
@@ -3330,7 +3371,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3330
3371
|
const onAfterExpand = () => {
|
|
3331
3372
|
if (searchable.value) {
|
|
3332
3373
|
if (inputSearchEl.value) {
|
|
3333
|
-
inputSearchEl.value.focus(
|
|
3374
|
+
inputSearchEl.value.focus({
|
|
3375
|
+
preventScroll: true
|
|
3376
|
+
});
|
|
3334
3377
|
}
|
|
3335
3378
|
}
|
|
3336
3379
|
};
|
|
@@ -3357,6 +3400,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3357
3400
|
const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
|
|
3358
3401
|
const hasSearchId = computed(() => `${hasId.value}-search`);
|
|
3359
3402
|
const hasLabelId = computed(() => `${hasId.value}-label`);
|
|
3403
|
+
const dropdownEl = ref();
|
|
3360
3404
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
3361
3405
|
icon,
|
|
3362
3406
|
iconPosition
|
|
@@ -3470,33 +3514,33 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3470
3514
|
loadingLabel: propsDefaults.value.loadingLabel,
|
|
3471
3515
|
disabled: disabled.value,
|
|
3472
3516
|
readonly: readonly.value,
|
|
3473
|
-
modifiers:
|
|
3474
|
-
options:
|
|
3475
|
-
labelKey:
|
|
3476
|
-
valueKey:
|
|
3477
|
-
icon:
|
|
3478
|
-
iconPosition:
|
|
3479
|
-
floating:
|
|
3480
|
-
unselectable:
|
|
3481
|
-
multiple:
|
|
3482
|
-
label:
|
|
3483
|
-
placeholder:
|
|
3517
|
+
modifiers: propsDefaults.value.modifiers,
|
|
3518
|
+
options: propsDefaults.value.options,
|
|
3519
|
+
labelKey: propsDefaults.value.labelKey,
|
|
3520
|
+
valueKey: propsDefaults.value.valueKey,
|
|
3521
|
+
icon: propsDefaults.value.icon,
|
|
3522
|
+
iconPosition: propsDefaults.value.iconPosition,
|
|
3523
|
+
floating: propsDefaults.value.floating,
|
|
3524
|
+
unselectable: propsDefaults.value.unselectable,
|
|
3525
|
+
multiple: propsDefaults.value.multiple,
|
|
3526
|
+
label: propsDefaults.value.label,
|
|
3527
|
+
placeholder: propsDefaults.value.placeholder,
|
|
3484
3528
|
modelValue: props.modelValue
|
|
3485
3529
|
}));
|
|
3486
3530
|
const dropdownProps = computed(() => ({
|
|
3487
3531
|
id: hasDropdownId.value,
|
|
3488
3532
|
reference: wrapperEl.value,
|
|
3489
|
-
placement:
|
|
3490
|
-
strategy:
|
|
3491
|
-
transitionName:
|
|
3492
|
-
offset:
|
|
3493
|
-
shift:
|
|
3494
|
-
flip:
|
|
3495
|
-
autoPlacement:
|
|
3496
|
-
arrow:
|
|
3497
|
-
autofocusFirst: searchable.value ? false :
|
|
3498
|
-
triggerWidth:
|
|
3499
|
-
modifiers:
|
|
3533
|
+
placement: propsDefaults.value.placement,
|
|
3534
|
+
strategy: propsDefaults.value.strategy,
|
|
3535
|
+
transitionName: propsDefaults.value.transitionName,
|
|
3536
|
+
offset: propsDefaults.value.offset,
|
|
3537
|
+
shift: propsDefaults.value.shift,
|
|
3538
|
+
flip: propsDefaults.value.flip,
|
|
3539
|
+
autoPlacement: propsDefaults.value.autoPlacement,
|
|
3540
|
+
arrow: propsDefaults.value.arrow,
|
|
3541
|
+
autofocusFirst: searchable.value ? false : propsDefaults.value.autofocusFirst,
|
|
3542
|
+
triggerWidth: propsDefaults.value.triggerWidth,
|
|
3543
|
+
modifiers: propsDefaults.value.dropdownModifiers
|
|
3500
3544
|
}));
|
|
3501
3545
|
const slotProps = computed(() => ({
|
|
3502
3546
|
valid: props.valid,
|
|
@@ -3534,8 +3578,10 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3534
3578
|
class: "vv-select__wrapper"
|
|
3535
3579
|
}, [
|
|
3536
3580
|
createVNode(_sfc_main$b, mergeProps({
|
|
3581
|
+
ref_key: "dropdownEl",
|
|
3582
|
+
ref: dropdownEl,
|
|
3537
3583
|
modelValue: unref(expanded),
|
|
3538
|
-
"onUpdate:modelValue": _cache[
|
|
3584
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(expanded) ? expanded.value = $event : null)
|
|
3539
3585
|
}, unref(dropdownProps), {
|
|
3540
3586
|
role: unref(DropdownRole).listbox,
|
|
3541
3587
|
onAfterExpand,
|
|
@@ -3679,6 +3725,19 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3679
3725
|
_: 3
|
|
3680
3726
|
}))
|
|
3681
3727
|
]),
|
|
3728
|
+
after: withCtx(() => [
|
|
3729
|
+
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
3730
|
+
var _a;
|
|
3731
|
+
return [
|
|
3732
|
+
((_a = unref(dropdownEl)) == null ? void 0 : _a.dropdownCustomPosition) === "true" ? (openBlock(), createBlock(_sfc_main$g, {
|
|
3733
|
+
key: 0,
|
|
3734
|
+
label: "Close",
|
|
3735
|
+
modifiers: "secondary",
|
|
3736
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(dropdownEl).hide())
|
|
3737
|
+
})) : createCommentVNode("", true)
|
|
3738
|
+
];
|
|
3739
|
+
})
|
|
3740
|
+
]),
|
|
3682
3741
|
_: 2
|
|
3683
3742
|
}, [
|
|
3684
3743
|
unref(searchable) || _ctx.$slots["dropdown::before"] ? {
|
|
@@ -3704,13 +3763,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3704
3763
|
]) : createCommentVNode("", true)
|
|
3705
3764
|
]),
|
|
3706
3765
|
key: "0"
|
|
3707
|
-
} : void 0,
|
|
3708
|
-
_ctx.$slots["dropdown::after"] ? {
|
|
3709
|
-
name: "after",
|
|
3710
|
-
fn: withCtx(() => [
|
|
3711
|
-
renderSlot(_ctx.$slots, "dropdown::after")
|
|
3712
|
-
]),
|
|
3713
|
-
key: "1"
|
|
3714
3766
|
} : void 0
|
|
3715
3767
|
]), 1040, ["modelValue", "role"])
|
|
3716
3768
|
], 512),
|
|
@@ -3748,7 +3800,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3748
3800
|
} : void 0
|
|
3749
3801
|
]), 1032, ["id"])
|
|
3750
3802
|
], 10, _hoisted_1$5)) : (openBlock(), createBlock(_sfc_main$7, mergeProps({ key: 1 }, unref(selectProps), {
|
|
3751
|
-
"onUpdate:modelValue": _cache[
|
|
3803
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => emit("update:modelValue", $event))
|
|
3752
3804
|
}), null, 16));
|
|
3753
3805
|
};
|
|
3754
3806
|
}
|