Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vueform/multiselect

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vueform/multiselect - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

12

CHANGELOG.md

@@ -0,1 +1,11 @@

## v1.2.2
> `2020-12-28`
### 🎉 Feature
- Added `canDeselect` option
### 🐞 Bug Fixes
- Set internalValue on init when using async options with `:object` `true` and `resolveOnLoad` `false`
## v1.2.1

@@ -5,3 +15,3 @@

### 🎉 Bug Fixes
### 🐞 Bug Fixes
- Changes in `v-model` will sync with multiselect value

@@ -8,0 +18,0 @@

2

dist/multiselect.global.js

@@ -1,1 +0,1 @@

var VueformMultiselect=function(e,t){"use strict";function l(e){return String(e).toLowerCase().trim()}function n(e){return-1!==[null,void 0,!1].indexOf(e)}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function u(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var l=Object.prototype.toString.call(e).slice(8,-1);"Object"===l&&e.constructor&&(l=e.constructor.name);if("Map"===l||"Set"===l)return Array.from(e);if("Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return i(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=new Array(t);l<t;l++)n[l]=e[l];return n}function o(t,u,i){var o=e.toRefs(t),c=o.options,s=o.mode,d=o.trackBy,v=o.limit,f=o.hideSelected,p=o.createTag,h=o.label,m=o.appendNewTag,y=o.multipleLabel,b=o.object,g=o.loading,w=o.delay,S=o.resolveOnLoad,V=o.minChars,k=o.filterResults,B=o.clearOnSearch,O=o.clearOnSelect,N=o.valueProp,x=i.internalValue,P=i.externalValue,M=i.search,q=i.blurSearch,T=i.clearSearch,C=i.update,K=i.blurInput,j=e.ref([]),D=e.ref([]),A=e.ref(!1),R=e.computed((function(){var e,t=D.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var l,n=t[e];return r(l={},N.value,e),r(l,d.value,n),r(l,h.value,n),l}))),t=t.map((function(e,t){var l;return"object"===a(e)?e:(r(l={},N.value,t),r(l,d.value,e),r(l,h.value,e),l)})),j.value.length&&(t=t.concat(j.value)),t})),E=e.computed((function(){var e=R.value;return F.value.length&&(e=F.value.concat(e)),M.value&&k.value&&(e=e.filter((function(e){return-1!==l(e[d.value]).indexOf(l(M.value))}))),f.value&&(e=e.filter((function(e){return!ee(e)}))),v.value>0&&(e=e.slice(0,v.value)),e})),L=e.computed((function(){switch(s.value){case"single":return!n(x.value.value);case"multiple":case"tags":return!n(x.value)&&x.value.length>0}})),$=e.computed((function(){return void 0!==y&&void 0!==y.value?y.value(x.value):x.value&&x.value.length>1?"".concat(x.value.length," options selected"):"1 option selected"})),H=e.computed((function(){return!R.value.length})),I=e.computed((function(){return R.value.length>0&&0==E.value.length})),F=e.computed((function(){var e;return!1!==p.value&&M.value?-1!==Z(M.value)?[]:[(e={},r(e,N.value,M.value),r(e,h.value,M.value),r(e,d.value,M.value),e)]:[]})),_=e.computed((function(){switch(s.value){case"single":return null;case"multiple":case"tags":return[]}})),U=e.computed((function(){return g.value||A.value})),W=function(e){switch("object"!==a(e)&&(e=Y(e)),s.value){case"single":C(e);break;case"multiple":case"tags":C(x.value.concat(e))}u.emit("select",G(e))},z=function(e){switch("object"!==a(e)&&(e=Y(e)),s.value){case"single":J();break;case"tags":case"multiple":C(x.value.filter((function(t){return t[N.value]!=e[N.value]})))}u.emit("deselect",G(e))},G=function(e){return b.value?e:e[N.value]},J=function(){C(_.value)},Q=function(e){switch(s.value){case"single":return!n(x.value)&&x.value[N.value]==e[N.value];case"tags":case"multiple":return!n(x.value)&&-1!==x.value.map((function(e){return e[N.value]})).indexOf(e[N.value])}},X=function(e){return!0===e.disabled},Y=function(e){return R.value[R.value.map((function(e){return e[N.value]})).indexOf(e)]},Z=function(e){return R.value.map((function(e){return l(e[d.value])})).indexOf(l(e))},ee=function(e){return"tags"===s.value&&f.value&&Q(e)},te=function(e){j.value.push(e)},le=function(e){return n(e)?"single"===s.value?{}:[]:b.value?e:"single"===s.value?Y(e)||{}:e.filter((function(e){return!!Y(e)})).map((function(e){return Y(e)}))};if("single"!==s.value&&!n(P.value)&&!Array.isArray(P.value))throw new Error('v-model must be an array when using "'.concat(s.value,'" mode'));return c&&"function"==typeof c.value?S.value&&(A.value=!0,c.value(M.value).then((function(e){D.value=e,A.value=!1,n(P.value)||(x.value=le(P.value))}))):(D.value=c&&c.value?c.value:[],n(P.value)||(x.value=le(P.value))),w.value>-1&&e.watch(M,(function(e){e.length<V.value||(B.value&&(D.value=[]),setTimeout((function(){e==M.value&&(A.value=!0,c.value(M.value).then((function(t){e==M.value&&(D.value=t),A.value=!1})))}),w.value))}),{flush:"sync"}),e.watch(P,(function(e){var t,l,a;if(n(e))x.value=le(e);else switch(s.value){case"single":(b.value?e[N.value]!=x.value[N.value]:e!=x.value[N.value])&&(x.value=le(e));break;case"multiple":case"tags":t=b.value?e.map((function(e){return e[N.value]})):e,l=x.value.map((function(e){return e[N.value]})),a=l.slice().sort(),t.length===l.length&&t.slice().sort().every((function(e,t){return e===a[t]}))||(x.value=le(e))}})),{filteredOptions:E,hasSelected:L,multipleLabelText:$,extendedOptions:R,noOptions:H,noResults:I,busy:U,select:W,deselect:z,remove:function(e){z(e)},clear:J,isSelected:Q,isDisabled:X,getOption:Y,handleOptionClick:function(e){if(!X(e))switch(s.value){case"single":if(Q(e))return void z(e);J(),W(e),q(),K();break;case"multiple":if(Q(e))return void z(e);W(e),O.value&&T();break;case"tags":if(Q(e))return void z(e);void 0===Y(e[N.value])&&p.value&&(u.emit("tag",e[N.value]),m.value&&te(e),T()),O.value&&T(),W(e)}}}}var c={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1},id:{type:[String,Number],required:!1,default:"multiselect"},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},maxHeight:{type:Number,required:!1,default:160},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0}},setup(t,l){const a=function(t,l){var n=e.toRefs(t),a=n.value,r=n.modelValue,u=n.mode;return{internalValue:e.ref("single"!==u.value?[]:{}),externalValue:e.computed((function(){return void 0!==l.expose?r.value:a.value}))}}(t,l),r=function(t,l,a){var r=e.toRefs(t),u=r.object,i=r.valueProp,o=r.mode,c=a.internalValue,s=function(e){return u.value||n(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},d=function(e){return n(e)?"single"===o.value?{}:[]:e};return{update:function(e){c.value=d(e);var t=s(e);l.emit("change",t),l.emit("input",t),l.emit("update:modelValue",t)}}}(t,l,{internalValue:a.internalValue}),i=function(t,l,n){var a=e.toRefs(t),r=a.searchable,u=a.mode,i=n.internalValue,o=e.ref(null),c=e.ref(null),s=e.computed((function(){return o.value?"".concat(o.value.length,"ch"):"tags"===u.value&&-1===[null,void 0].indexOf(i.value)&&i.value.length?"1ch":"100%"}));return e.watch(o,(function(e){l.emit("search-change",e)})),{search:o,input:c,tagsSearchWidth:s,clearSearch:function(){o.value=""},blurSearch:function(){r.value&&c.value.blur()},handleSearchBackspace:function(e){""!==o.value&&e.stopPropagation()}}}(t,l,{internalValue:a.internalValue}),c=function(t,l,n){var a=e.toRefs(t),r=a.maxHeight,u=a.disabled,i=e.ref(!1),o=e.computed((function(){return"".concat(r.value,"px")}));return{isOpen:i,contentMaxHeight:o,open:function(){u.value||(i.value=!0,l.emit("open"))},close:function(){i.value=!1,l.emit("close")}}}(t,l),s=function(t,l,n){var a=e.toRefs(t),r=a.searchable,u=a.id;return{multiselect:e.ref(null),tabindex:e.computed((function(){return r.value?-1:0})),blurInput:function(){document.getElementById(u.value).querySelector(".multiselect-input").blur()}}}(t),d=o(t,l,{externalValue:a.externalValue,internalValue:a.internalValue,search:i.search,blurSearch:i.blurSearch,clearSearch:i.clearSearch,update:r.update,blurInput:s.blurInput}),v=function(t,l,n){var a=e.toRefs(t),r=a.id,u=a.valueProp,i=n.filteredOptions,o=n.handleOptionClick,c=n.search,s=e.ref(null),d=e.computed((function(){return i.value.filter((function(e){return!0!==e.disabled}))})),v=function(e){s.value=e},f=function(){s.value=d.value[0]||null},p=function(){s.value=null},h=function(){var e=document.getElementById(r.value).querySelector(".is-pointed");if(e){var t=e.parentElement;e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop<t.scrollTop&&(t.scrollTop=e.offsetTop)}};return e.watch(c,(function(e){f()})),{pointer:s,isPointed:function(e){return!!s.value&&s.value[u.value]==e[u.value]},setPointer:v,setPointerFirst:f,clearPointer:p,selectPointer:function(){s.value&&!0!==s.value.disabled?(o(s.value),p()):p()},forwardPointer:function(){if(null===s.value)v(d.value[0]||null);else{var t=d.value.map((function(e){return e[u.value]})).indexOf(s.value[u.value])+1;d.value.length<=t&&(t=0),v(d.value[t]||null)}e.nextTick((function(){h()}))},backwardPointer:function(){if(null===s.value)v(d.value[d.value.length-1]||null);else{var t=d.value.map((function(e){return e[u.value]})).indexOf(s.value[u.value])-1;t<0&&(t=d.value.length-1),v(d.value[t]||null)}e.nextTick((function(){h()}))}}}(t,0,{filteredOptions:d.filteredOptions,handleOptionClick:d.handleOptionClick,search:i.search}),f=(p={internalValue:a.internalValue,update:r.update,close:c.close,clearPointer:v.clearPointer},h=p.internalValue,m=p.update,y=p.close,b=p.clearPointer,{handleBackspace:function(e){m(u(h.value).slice(0,-1))},handleEsc:function(e){y(),b(),e.target.blur()}});var p,h,m,y,b;return{...a,...r,...i,...c,...s,...d,...v,...f}}};const s={class:"multiselect-single-label"},d={class:"multiselect-multiple-label"},v={key:2,class:"multiselect-search"},f={key:3,class:"multiselect-tags"},p={class:"multiselect-tag"},h={class:"multiselect-spinner"},m={class:"multiselect-no-options"},y={class:"multiselect-no-results"};return c.render=function(e,l,n,a,r,u){return t.openBlock(),t.createBlock("div",{class:["multiselect",[`is-${n.mode}`,{"is-open":e.isOpen,"is-searchable":n.searchable,"is-disabled":n.disabled,"no-caret":!n.caret}]],id:n.id,onKeydown:l[26]||(l[26]=t.withKeys(t.withModifiers((()=>{}),["prevent"]),["enter"])),ref:"multiselect"},[t.createVNode("div",{class:"multiselect-input",tabindex:e.tabindex,onFocus:l[18]||(l[18]=(...t)=>e.open&&e.open(...t)),onBlur:l[19]||(l[19]=(...t)=>e.close&&e.close(...t)),onKeyup:[l[20]||(l[20]=t.withKeys(((...t)=>e.handleEsc&&e.handleEsc(...t)),["esc"])),l[21]||(l[21]=t.withKeys(((...t)=>e.selectPointer&&e.selectPointer(...t)),["enter"]))],onKeydown:[l[22]||(l[22]=t.withKeys(t.withModifiers(((...t)=>e.handleBackspace&&e.handleBackspace(...t)),["prevent"]),["delete"])),l[23]||(l[23]=t.withKeys(t.withModifiers(((...t)=>e.backwardPointer&&e.backwardPointer(...t)),["prevent"]),["up"])),l[24]||(l[24]=t.withKeys(t.withModifiers(((...t)=>e.forwardPointer&&e.forwardPointer(...t)),["prevent"]),["down"]))]},[t.createCommentVNode(" Single label "),"single"==n.mode&&e.hasSelected&&!e.search&&e.internalValue?t.renderSlot(e.$slots,"singlelabel",{key:0,value:e.internalValue},(()=>[t.createVNode("div",s,t.toDisplayString(e.internalValue[n.label]),1)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Multiple label "),"multiple"==n.mode&&e.hasSelected&&!e.search?t.renderSlot(e.$slots,"multiplelabel",{key:1,values:e.internalValue},(()=>[t.createVNode("div",d,t.toDisplayString(e.multipleLabelText),1)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Search "),"tags"!==n.mode&&n.searchable&&!n.disabled?(t.openBlock(),t.createBlock("div",v,[t.withDirectives(t.createVNode("input",{"onUpdate:modelValue":l[1]||(l[1]=t=>e.search=t),onFocus:l[2]||(l[2]=t.withModifiers(((...t)=>e.open&&e.open(...t)),["stop"])),onBlur:l[3]||(l[3]=t.withModifiers(((...t)=>e.close&&e.close(...t)),["stop"])),onKeyup:[l[4]||(l[4]=t.withKeys(t.withModifiers(((...t)=>e.handleEsc&&e.handleEsc(...t)),["stop"]),["esc"])),l[5]||(l[5]=t.withKeys(t.withModifiers(((...t)=>e.selectPointer&&e.selectPointer(...t)),["stop"]),["enter"]))],onKeydown:[l[6]||(l[6]=t.withKeys(((...t)=>e.handleSearchBackspace&&e.handleSearchBackspace(...t)),["delete"])),l[7]||(l[7]=t.withKeys(t.withModifiers(((...t)=>e.backwardPointer&&e.backwardPointer(...t)),["stop"]),["up"])),l[8]||(l[8]=t.withKeys(t.withModifiers(((...t)=>e.forwardPointer&&e.forwardPointer(...t)),["stop"]),["down"]))],ref:"input"},null,544),[[t.vModelText,e.search]])])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Tags (with search) "),"tags"==n.mode?(t.openBlock(),t.createBlock("div",f,[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(e.internalValue,((a,r,u)=>(t.openBlock(),t.createBlock("span",{key:u},[t.renderSlot(e.$slots,"tag",{option:a,remove:e.remove,disabled:n.disabled},(()=>[t.createVNode("div",p,[t.createTextVNode(t.toDisplayString(a[n.label])+" ",1),n.disabled?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock("i",{key:0,onClick:l[9]||(l[9]=t.withModifiers((()=>{}),["prevent"])),onMousedown:t.withModifiers((t=>e.remove(a)),["prevent"])},null,40,["onMousedown"]))])]))])))),128)),n.searchable&&!n.disabled?(t.openBlock(),t.createBlock("div",{key:0,class:"multiselect-search",style:{width:e.tagsSearchWidth}},[t.withDirectives(t.createVNode("input",{"onUpdate:modelValue":l[10]||(l[10]=t=>e.search=t),onFocus:l[11]||(l[11]=t.withModifiers(((...t)=>e.open&&e.open(...t)),["stop"])),onBlur:l[12]||(l[12]=t.withModifiers(((...t)=>e.close&&e.close(...t)),["stop"])),onKeyup:[l[13]||(l[13]=t.withKeys(t.withModifiers(((...t)=>e.handleEsc&&e.handleEsc(...t)),["stop"]),["esc"])),l[14]||(l[14]=t.withKeys(t.withModifiers(((...t)=>e.selectPointer&&e.selectPointer(...t)),["stop"]),["enter"]))],onKeydown:[l[15]||(l[15]=t.withKeys(((...t)=>e.handleSearchBackspace&&e.handleSearchBackspace(...t)),["delete"])),l[16]||(l[16]=t.withKeys(t.withModifiers(((...t)=>e.backwardPointer&&e.backwardPointer(...t)),["stop"]),["up"])),l[17]||(l[17]=t.withKeys(t.withModifiers(((...t)=>e.forwardPointer&&e.forwardPointer(...t)),["stop"]),["down"]))],style:{width:e.tagsSearchWidth},ref:"input"},null,36),[[t.vModelText,e.search]])],4)):t.createCommentVNode("v-if",!0)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Placeholder "),t.withDirectives(t.createVNode("div",{class:"multiselect-placeholder"},t.toDisplayString(n.placeholder),513),[[t.vShow,n.placeholder&&!e.hasSelected&&!e.search]]),t.createVNode(t.Transition,{name:"multiselect-loading"},{default:t.withCtx((()=>[t.withDirectives(t.createVNode("div",h,null,512),[[t.vShow,e.busy]])])),_:1})],40,["tabindex"]),t.createCommentVNode(" Options "),t.createVNode(t.Transition,{name:"multiselect",onAfterLeave:e.clearSearch},{default:t.withCtx((()=>[t.withDirectives(t.createVNode("div",{class:"multiselect-options",style:{maxHeight:e.contentMaxHeight}},[t.renderSlot(e.$slots,"beforelist"),(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(e.filteredOptions,((a,r,u)=>(t.openBlock(),t.createBlock("a",{href:"",class:["multiselect-option",{"is-pointed":e.isPointed(a),"is-selected":e.isSelected(a),"is-disabled":e.isDisabled(a)}],key:u,onMousedown:l[25]||(l[25]=t.withModifiers((()=>{}),["prevent"])),onMouseenter:t=>e.setPointer(a),onClick:t.withModifiers((t=>e.handleOptionClick(a)),["stop","prevent"])},[t.renderSlot(e.$slots,"option",{option:a,search:e.search},(()=>[t.createVNode("span",null,t.toDisplayString(a[n.label]),1)]))],42,["onMouseenter","onClick"])))),128)),t.withDirectives(t.createVNode("span",null,[t.renderSlot(e.$slots,"nooptions",{},(()=>[t.createVNode("div",m,t.toDisplayString(n.noOptionsText),1)]))],512),[[t.vShow,e.noOptions]]),t.withDirectives(t.createVNode("span",null,[t.renderSlot(e.$slots,"noresults",{},(()=>[t.createVNode("div",y,t.toDisplayString(n.noResultsText),1)]))],512),[[t.vShow,e.noResults]]),t.renderSlot(e.$slots,"afterlist")],4),[[t.vShow,e.isOpen]])])),_:3},8,["onAfterLeave"])],42,["id"])},c.__file="src/Multiselect.vue",c}(Vue,Vue);
var VueformMultiselect=function(e,t){"use strict";function l(e){return String(e).toLowerCase().trim()}function n(e){return-1!==[null,void 0,!1].indexOf(e)}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function u(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var l=Object.prototype.toString.call(e).slice(8,-1);"Object"===l&&e.constructor&&(l=e.constructor.name);if("Map"===l||"Set"===l)return Array.from(e);if("Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return i(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=new Array(t);l<t;l++)n[l]=e[l];return n}function o(t,u,i){var o=e.toRefs(t),c=o.options,s=o.mode,d=o.trackBy,v=o.limit,f=o.hideSelected,p=o.createTag,h=o.label,m=o.appendNewTag,y=o.multipleLabel,b=o.object,g=o.loading,w=o.delay,S=o.resolveOnLoad,V=o.minChars,k=o.filterResults,B=o.clearOnSearch,O=o.clearOnSelect,N=o.valueProp,x=o.canDeselect,P=i.internalValue,M=i.externalValue,q=i.search,T=i.blurSearch,C=i.clearSearch,K=i.update,D=i.blurInput,j=e.ref([]),A=e.ref([]),R=e.ref(!1),E=e.computed((function(){var e,t=A.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var l,n=t[e];return r(l={},N.value,e),r(l,d.value,n),r(l,h.value,n),l}))),t=t.map((function(e,t){var l;return"object"===a(e)?e:(r(l={},N.value,t),r(l,d.value,e),r(l,h.value,e),l)})),j.value.length&&(t=t.concat(j.value)),t})),L=e.computed((function(){var e=E.value;return _.value.length&&(e=_.value.concat(e)),q.value&&k.value&&(e=e.filter((function(e){return-1!==l(e[d.value]).indexOf(l(q.value))}))),f.value&&(e=e.filter((function(e){return!te(e)}))),v.value>0&&(e=e.slice(0,v.value)),e})),$=e.computed((function(){switch(s.value){case"single":return!n(P.value.value);case"multiple":case"tags":return!n(P.value)&&P.value.length>0}})),H=e.computed((function(){return void 0!==y&&void 0!==y.value?y.value(P.value):P.value&&P.value.length>1?"".concat(P.value.length," options selected"):"1 option selected"})),I=e.computed((function(){return!E.value.length})),F=e.computed((function(){return E.value.length>0&&0==L.value.length})),_=e.computed((function(){var e;return!1!==p.value&&q.value?-1!==ee(q.value)?[]:[(e={},r(e,N.value,q.value),r(e,h.value,q.value),r(e,d.value,q.value),e)]:[]})),U=e.computed((function(){switch(s.value){case"single":return null;case"multiple":case"tags":return[]}})),W=e.computed((function(){return g.value||R.value})),z=function(e){switch("object"!==a(e)&&(e=Z(e)),s.value){case"single":K(e);break;case"multiple":case"tags":K(P.value.concat(e))}u.emit("select",J(e))},G=function(e){switch("object"!==a(e)&&(e=Z(e)),s.value){case"single":Q();break;case"tags":case"multiple":K(P.value.filter((function(t){return t[N.value]!=e[N.value]})))}u.emit("deselect",J(e))},J=function(e){return b.value?e:e[N.value]},Q=function(){K(U.value)},X=function(e){switch(s.value){case"single":return!n(P.value)&&P.value[N.value]==e[N.value];case"tags":case"multiple":return!n(P.value)&&-1!==P.value.map((function(e){return e[N.value]})).indexOf(e[N.value])}},Y=function(e){return!0===e.disabled},Z=function(e){return E.value[E.value.map((function(e){return e[N.value]})).indexOf(e)]},ee=function(e){return E.value.map((function(e){return l(e[d.value])})).indexOf(l(e))},te=function(e){return"tags"===s.value&&f.value&&X(e)},le=function(e){j.value.push(e)},ne=function(){n(M.value)||(P.value=ae(M.value))},ae=function(e){return n(e)?"single"===s.value?{}:[]:b.value?e:"single"===s.value?Z(e)||{}:e.filter((function(e){return!!Z(e)})).map((function(e){return Z(e)}))};if("single"!==s.value&&!n(M.value)&&!Array.isArray(M.value))throw new Error('v-model must be an array when using "'.concat(s.value,'" mode'));return c&&"function"==typeof c.value?S.value?(R.value=!0,c.value(q.value).then((function(e){A.value=e,R.value=!1,ne()}))):1==b.value&&ne():(A.value=c&&c.value?c.value:[],ne()),w.value>-1&&e.watch(q,(function(e){e.length<V.value||(B.value&&(A.value=[]),setTimeout((function(){e==q.value&&(R.value=!0,c.value(q.value).then((function(t){e==q.value&&(A.value=t),R.value=!1})))}),w.value))}),{flush:"sync"}),e.watch(M,(function(e){var t,l,a;if(n(e))P.value=ae(e);else switch(s.value){case"single":(b.value?e[N.value]!=P.value[N.value]:e!=P.value[N.value])&&(P.value=ae(e));break;case"multiple":case"tags":t=b.value?e.map((function(e){return e[N.value]})):e,l=P.value.map((function(e){return e[N.value]})),a=l.slice().sort(),t.length===l.length&&t.slice().sort().every((function(e,t){return e===a[t]}))||(P.value=ae(e))}})),{filteredOptions:L,hasSelected:$,multipleLabelText:H,extendedOptions:E,noOptions:I,noResults:F,busy:W,select:z,deselect:G,remove:function(e){G(e)},clear:Q,isSelected:X,isDisabled:Y,getOption:Z,handleOptionClick:function(e){if(!Y(e))switch(s.value){case"single":if(X(e))return void(x.value&&G(e));Q(),z(e),T(),D();break;case"multiple":if(X(e))return void G(e);z(e),O.value&&C();break;case"tags":if(X(e))return void G(e);void 0===Z(e[N.value])&&p.value&&(u.emit("tag",e[N.value]),m.value&&le(e),C()),O.value&&C(),z(e)}}}}var c={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1},id:{type:[String,Number],required:!1,default:"multiselect"},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},maxHeight:{type:Number,required:!1,default:160},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0}},setup(t,l){const a=function(t,l){var n=e.toRefs(t),a=n.value,r=n.modelValue,u=n.mode;return{internalValue:e.ref("single"!==u.value?[]:{}),externalValue:e.computed((function(){return void 0!==l.expose?r.value:a.value}))}}(t,l),r=function(t,l,a){var r=e.toRefs(t),u=r.object,i=r.valueProp,o=r.mode,c=a.internalValue,s=function(e){return u.value||n(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},d=function(e){return n(e)?"single"===o.value?{}:[]:e};return{update:function(e){c.value=d(e);var t=s(e);l.emit("change",t),l.emit("input",t),l.emit("update:modelValue",t)}}}(t,l,{internalValue:a.internalValue}),i=function(t,l,n){var a=e.toRefs(t),r=a.searchable,u=a.mode,i=n.internalValue,o=e.ref(null),c=e.ref(null),s=e.computed((function(){return o.value?"".concat(o.value.length,"ch"):"tags"===u.value&&-1===[null,void 0].indexOf(i.value)&&i.value.length?"1ch":"100%"}));return e.watch(o,(function(e){l.emit("search-change",e)})),{search:o,input:c,tagsSearchWidth:s,clearSearch:function(){o.value=""},blurSearch:function(){r.value&&c.value.blur()},handleSearchBackspace:function(e){""!==o.value&&e.stopPropagation()}}}(t,l,{internalValue:a.internalValue}),c=function(t,l,n){var a=e.toRefs(t),r=a.maxHeight,u=a.disabled,i=e.ref(!1),o=e.computed((function(){return"".concat(r.value,"px")}));return{isOpen:i,contentMaxHeight:o,open:function(){u.value||(i.value=!0,l.emit("open"))},close:function(){i.value=!1,l.emit("close")}}}(t,l),s=function(t,l,n){var a=e.toRefs(t),r=a.searchable,u=a.id;return{multiselect:e.ref(null),tabindex:e.computed((function(){return r.value?-1:0})),blurInput:function(){document.getElementById(u.value).querySelector(".multiselect-input").blur()}}}(t),d=o(t,l,{externalValue:a.externalValue,internalValue:a.internalValue,search:i.search,blurSearch:i.blurSearch,clearSearch:i.clearSearch,update:r.update,blurInput:s.blurInput}),v=function(t,l,n){var a=e.toRefs(t),r=a.id,u=a.valueProp,i=n.filteredOptions,o=n.handleOptionClick,c=n.search,s=e.ref(null),d=e.computed((function(){return i.value.filter((function(e){return!0!==e.disabled}))})),v=function(e){s.value=e},f=function(){s.value=d.value[0]||null},p=function(){s.value=null},h=function(){var e=document.getElementById(r.value).querySelector(".is-pointed");if(e){var t=e.parentElement;e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop<t.scrollTop&&(t.scrollTop=e.offsetTop)}};return e.watch(c,(function(e){f()})),{pointer:s,isPointed:function(e){return!!s.value&&s.value[u.value]==e[u.value]},setPointer:v,setPointerFirst:f,clearPointer:p,selectPointer:function(){s.value&&!0!==s.value.disabled?(o(s.value),p()):p()},forwardPointer:function(){if(null===s.value)v(d.value[0]||null);else{var t=d.value.map((function(e){return e[u.value]})).indexOf(s.value[u.value])+1;d.value.length<=t&&(t=0),v(d.value[t]||null)}e.nextTick((function(){h()}))},backwardPointer:function(){if(null===s.value)v(d.value[d.value.length-1]||null);else{var t=d.value.map((function(e){return e[u.value]})).indexOf(s.value[u.value])-1;t<0&&(t=d.value.length-1),v(d.value[t]||null)}e.nextTick((function(){h()}))}}}(t,0,{filteredOptions:d.filteredOptions,handleOptionClick:d.handleOptionClick,search:i.search}),f=(p={internalValue:a.internalValue,update:r.update,close:c.close,clearPointer:v.clearPointer},h=p.internalValue,m=p.update,y=p.close,b=p.clearPointer,{handleBackspace:function(e){m(u(h.value).slice(0,-1))},handleEsc:function(e){y(),b(),e.target.blur()}});var p,h,m,y,b;return{...a,...r,...i,...c,...s,...d,...v,...f}}};const s={class:"multiselect-single-label"},d={class:"multiselect-multiple-label"},v={key:2,class:"multiselect-search"},f={key:3,class:"multiselect-tags"},p={class:"multiselect-tag"},h={class:"multiselect-spinner"},m={class:"multiselect-no-options"},y={class:"multiselect-no-results"};return c.render=function(e,l,n,a,r,u){return t.openBlock(),t.createBlock("div",{class:["multiselect",[`is-${n.mode}`,{"is-open":e.isOpen,"is-searchable":n.searchable,"is-disabled":n.disabled,"no-caret":!n.caret}]],id:n.id,onKeydown:l[26]||(l[26]=t.withKeys(t.withModifiers((()=>{}),["prevent"]),["enter"])),ref:"multiselect"},[t.createVNode("div",{class:"multiselect-input",tabindex:e.tabindex,onFocus:l[18]||(l[18]=(...t)=>e.open&&e.open(...t)),onBlur:l[19]||(l[19]=(...t)=>e.close&&e.close(...t)),onKeyup:[l[20]||(l[20]=t.withKeys(((...t)=>e.handleEsc&&e.handleEsc(...t)),["esc"])),l[21]||(l[21]=t.withKeys(((...t)=>e.selectPointer&&e.selectPointer(...t)),["enter"]))],onKeydown:[l[22]||(l[22]=t.withKeys(t.withModifiers(((...t)=>e.handleBackspace&&e.handleBackspace(...t)),["prevent"]),["delete"])),l[23]||(l[23]=t.withKeys(t.withModifiers(((...t)=>e.backwardPointer&&e.backwardPointer(...t)),["prevent"]),["up"])),l[24]||(l[24]=t.withKeys(t.withModifiers(((...t)=>e.forwardPointer&&e.forwardPointer(...t)),["prevent"]),["down"]))]},[t.createCommentVNode(" Single label "),"single"==n.mode&&e.hasSelected&&!e.search&&e.internalValue?t.renderSlot(e.$slots,"singlelabel",{key:0,value:e.internalValue},(()=>[t.createVNode("div",s,t.toDisplayString(e.internalValue[n.label]),1)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Multiple label "),"multiple"==n.mode&&e.hasSelected&&!e.search?t.renderSlot(e.$slots,"multiplelabel",{key:1,values:e.internalValue},(()=>[t.createVNode("div",d,t.toDisplayString(e.multipleLabelText),1)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Search "),"tags"!==n.mode&&n.searchable&&!n.disabled?(t.openBlock(),t.createBlock("div",v,[t.withDirectives(t.createVNode("input",{"onUpdate:modelValue":l[1]||(l[1]=t=>e.search=t),onFocus:l[2]||(l[2]=t.withModifiers(((...t)=>e.open&&e.open(...t)),["stop"])),onBlur:l[3]||(l[3]=t.withModifiers(((...t)=>e.close&&e.close(...t)),["stop"])),onKeyup:[l[4]||(l[4]=t.withKeys(t.withModifiers(((...t)=>e.handleEsc&&e.handleEsc(...t)),["stop"]),["esc"])),l[5]||(l[5]=t.withKeys(t.withModifiers(((...t)=>e.selectPointer&&e.selectPointer(...t)),["stop"]),["enter"]))],onKeydown:[l[6]||(l[6]=t.withKeys(((...t)=>e.handleSearchBackspace&&e.handleSearchBackspace(...t)),["delete"])),l[7]||(l[7]=t.withKeys(t.withModifiers(((...t)=>e.backwardPointer&&e.backwardPointer(...t)),["stop"]),["up"])),l[8]||(l[8]=t.withKeys(t.withModifiers(((...t)=>e.forwardPointer&&e.forwardPointer(...t)),["stop"]),["down"]))],ref:"input"},null,544),[[t.vModelText,e.search]])])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Tags (with search) "),"tags"==n.mode?(t.openBlock(),t.createBlock("div",f,[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(e.internalValue,((a,r,u)=>(t.openBlock(),t.createBlock("span",{key:u},[t.renderSlot(e.$slots,"tag",{option:a,remove:e.remove,disabled:n.disabled},(()=>[t.createVNode("div",p,[t.createTextVNode(t.toDisplayString(a[n.label])+" ",1),n.disabled?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock("i",{key:0,onClick:l[9]||(l[9]=t.withModifiers((()=>{}),["prevent"])),onMousedown:t.withModifiers((t=>e.remove(a)),["prevent"])},null,40,["onMousedown"]))])]))])))),128)),n.searchable&&!n.disabled?(t.openBlock(),t.createBlock("div",{key:0,class:"multiselect-search",style:{width:e.tagsSearchWidth}},[t.withDirectives(t.createVNode("input",{"onUpdate:modelValue":l[10]||(l[10]=t=>e.search=t),onFocus:l[11]||(l[11]=t.withModifiers(((...t)=>e.open&&e.open(...t)),["stop"])),onBlur:l[12]||(l[12]=t.withModifiers(((...t)=>e.close&&e.close(...t)),["stop"])),onKeyup:[l[13]||(l[13]=t.withKeys(t.withModifiers(((...t)=>e.handleEsc&&e.handleEsc(...t)),["stop"]),["esc"])),l[14]||(l[14]=t.withKeys(t.withModifiers(((...t)=>e.selectPointer&&e.selectPointer(...t)),["stop"]),["enter"]))],onKeydown:[l[15]||(l[15]=t.withKeys(((...t)=>e.handleSearchBackspace&&e.handleSearchBackspace(...t)),["delete"])),l[16]||(l[16]=t.withKeys(t.withModifiers(((...t)=>e.backwardPointer&&e.backwardPointer(...t)),["stop"]),["up"])),l[17]||(l[17]=t.withKeys(t.withModifiers(((...t)=>e.forwardPointer&&e.forwardPointer(...t)),["stop"]),["down"]))],style:{width:e.tagsSearchWidth},ref:"input"},null,36),[[t.vModelText,e.search]])],4)):t.createCommentVNode("v-if",!0)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Placeholder "),t.withDirectives(t.createVNode("div",{class:"multiselect-placeholder"},t.toDisplayString(n.placeholder),513),[[t.vShow,n.placeholder&&!e.hasSelected&&!e.search]]),t.createVNode(t.Transition,{name:"multiselect-loading"},{default:t.withCtx((()=>[t.withDirectives(t.createVNode("div",h,null,512),[[t.vShow,e.busy]])])),_:1})],40,["tabindex"]),t.createCommentVNode(" Options "),t.createVNode(t.Transition,{name:"multiselect",onAfterLeave:e.clearSearch},{default:t.withCtx((()=>[t.withDirectives(t.createVNode("div",{class:"multiselect-options",style:{maxHeight:e.contentMaxHeight}},[t.renderSlot(e.$slots,"beforelist"),(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(e.filteredOptions,((a,r,u)=>(t.openBlock(),t.createBlock("a",{href:"",class:["multiselect-option",{"is-pointed":e.isPointed(a),"is-selected":e.isSelected(a),"is-disabled":e.isDisabled(a)}],key:u,onMousedown:l[25]||(l[25]=t.withModifiers((()=>{}),["prevent"])),onMouseenter:t=>e.setPointer(a),onClick:t.withModifiers((t=>e.handleOptionClick(a)),["stop","prevent"])},[t.renderSlot(e.$slots,"option",{option:a,search:e.search},(()=>[t.createVNode("span",null,t.toDisplayString(a[n.label]),1)]))],42,["onMouseenter","onClick"])))),128)),t.withDirectives(t.createVNode("span",null,[t.renderSlot(e.$slots,"nooptions",{},(()=>[t.createVNode("div",m,t.toDisplayString(n.noOptionsText),1)]))],512),[[t.vShow,e.noOptions]]),t.withDirectives(t.createVNode("span",null,[t.renderSlot(e.$slots,"noresults",{},(()=>[t.createVNode("div",y,t.toDisplayString(n.noResultsText),1)]))],512),[[t.vShow,e.noResults]]),t.renderSlot(e.$slots,"afterlist")],4),[[t.vShow,e.isOpen]])])),_:3},8,["onAfterLeave"])],42,["id"])},c.__file="src/Multiselect.vue",c}(Vue,Vue);

@@ -1,1 +0,1 @@

import{toRefs as e,ref as l,computed as t,watch as n,nextTick as a,openBlock as u,createBlock as r,withKeys as i,withModifiers as o,createVNode as c,createCommentVNode as s,renderSlot as v,toDisplayString as d,withDirectives as p,vModelText as f,Fragment as h,renderList as m,createTextVNode as b,vShow as g,Transition as y,withCtx as S}from"vue";function w(e){return String(e).toLowerCase().trim()}function O(e){return-1!==[null,void 0,!1].indexOf(e)}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function P(e,l,t){return l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function q(a,u,r){var i=e(a),o=i.options,c=i.mode,s=i.trackBy,v=i.limit,d=i.hideSelected,p=i.createTag,f=i.label,h=i.appendNewTag,m=i.multipleLabel,b=i.object,g=i.loading,y=i.delay,S=i.resolveOnLoad,q=i.minChars,x=i.filterResults,V=i.clearOnSearch,B=i.clearOnSelect,T=i.valueProp,j=r.internalValue,A=r.externalValue,C=r.search,E=r.blurSearch,M=r.clearSearch,$=r.update,H=r.blurInput,I=l([]),L=l([]),N=l(!1),K=t((function(){var e,l=L.value||[];return e=l,"[object Object]"===Object.prototype.toString.call(e)&&(l=Object.keys(l).map((function(e){var t,n=l[e];return P(t={},T.value,e),P(t,s.value,n),P(t,f.value,n),t}))),l=l.map((function(e,l){var t;return"object"===k(e)?e:(P(t={},T.value,l),P(t,s.value,e),P(t,f.value,e),t)})),I.value.length&&(l=l.concat(I.value)),l})),F=t((function(){var e=K.value;return D.value.length&&(e=D.value.concat(e)),C.value&&x.value&&(e=e.filter((function(e){return-1!==w(e[s.value]).indexOf(w(C.value))}))),d.value&&(e=e.filter((function(e){return!ne(e)}))),v.value>0&&(e=e.slice(0,v.value)),e})),R=t((function(){switch(c.value){case"single":return!O(j.value.value);case"multiple":case"tags":return!O(j.value)&&j.value.length>0}})),_=t((function(){return void 0!==m&&void 0!==m.value?m.value(j.value):j.value&&j.value.length>1?"".concat(j.value.length," options selected"):"1 option selected"})),U=t((function(){return!K.value.length})),W=t((function(){return K.value.length>0&&0==F.value.length})),D=t((function(){var e;return!1!==p.value&&C.value?-1!==te(C.value)?[]:[(e={},P(e,T.value,C.value),P(e,f.value,C.value),P(e,s.value,C.value),e)]:[]})),z=t((function(){switch(c.value){case"single":return null;case"multiple":case"tags":return[]}})),G=t((function(){return g.value||N.value})),J=function(e){switch("object"!==k(e)&&(e=le(e)),c.value){case"single":$(e);break;case"multiple":case"tags":$(j.value.concat(e))}u.emit("select",X(e))},Q=function(e){switch("object"!==k(e)&&(e=le(e)),c.value){case"single":Y();break;case"tags":case"multiple":$(j.value.filter((function(l){return l[T.value]!=e[T.value]})))}u.emit("deselect",X(e))},X=function(e){return b.value?e:e[T.value]},Y=function(){$(z.value)},Z=function(e){switch(c.value){case"single":return!O(j.value)&&j.value[T.value]==e[T.value];case"tags":case"multiple":return!O(j.value)&&-1!==j.value.map((function(e){return e[T.value]})).indexOf(e[T.value])}},ee=function(e){return!0===e.disabled},le=function(e){return K.value[K.value.map((function(e){return e[T.value]})).indexOf(e)]},te=function(e){return K.value.map((function(e){return w(e[s.value])})).indexOf(w(e))},ne=function(e){return"tags"===c.value&&d.value&&Z(e)},ae=function(e){I.value.push(e)},ue=function(e){return O(e)?"single"===c.value?{}:[]:b.value?e:"single"===c.value?le(e)||{}:e.filter((function(e){return!!le(e)})).map((function(e){return le(e)}))};if("single"!==c.value&&!O(A.value)&&!Array.isArray(A.value))throw new Error('v-model must be an array when using "'.concat(c.value,'" mode'));return o&&"function"==typeof o.value?S.value&&(N.value=!0,o.value(C.value).then((function(e){L.value=e,N.value=!1,O(A.value)||(j.value=ue(A.value))}))):(L.value=o&&o.value?o.value:[],O(A.value)||(j.value=ue(A.value))),y.value>-1&&n(C,(function(e){e.length<q.value||(V.value&&(L.value=[]),setTimeout((function(){e==C.value&&(N.value=!0,o.value(C.value).then((function(l){e==C.value&&(L.value=l),N.value=!1})))}),y.value))}),{flush:"sync"}),n(A,(function(e){var l,t,n;if(O(e))j.value=ue(e);else switch(c.value){case"single":(b.value?e[T.value]!=j.value[T.value]:e!=j.value[T.value])&&(j.value=ue(e));break;case"multiple":case"tags":l=b.value?e.map((function(e){return e[T.value]})):e,t=j.value.map((function(e){return e[T.value]})),n=t.slice().sort(),l.length===t.length&&l.slice().sort().every((function(e,l){return e===n[l]}))||(j.value=ue(e))}})),{filteredOptions:F,hasSelected:R,multipleLabelText:_,extendedOptions:K,noOptions:U,noResults:W,busy:G,select:J,deselect:Q,remove:function(e){Q(e)},clear:Y,isSelected:Z,isDisabled:ee,getOption:le,handleOptionClick:function(e){if(!ee(e))switch(c.value){case"single":if(Z(e))return void Q(e);Y(),J(e),E(),H();break;case"multiple":if(Z(e))return void Q(e);J(e),B.value&&M();break;case"tags":if(Z(e))return void Q(e);void 0===le(e[T.value])&&p.value&&(u.emit("tag",e[T.value]),h.value&&ae(e),M()),B.value&&M(),J(e)}}}}function x(e){return function(e){if(Array.isArray(e))return V(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,l){if(!e)return;if("string"==typeof e)return V(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return V(e,l)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,n=new Array(l);t<l;t++)n[t]=e[t];return n}var B={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1},id:{type:[String,Number],required:!1,default:"multiselect"},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},maxHeight:{type:Number,required:!1,default:160},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0}},setup(u,r){const i=function(n,a){var u=e(n),r=u.value,i=u.modelValue,o=u.mode;return{internalValue:l("single"!==o.value?[]:{}),externalValue:t((function(){return void 0!==a.expose?i.value:r.value}))}}(u,r),o=function(l,t,n){var a=e(l),u=a.object,r=a.valueProp,i=a.mode,o=n.internalValue,c=function(e){return u.value||O(e)?e:Array.isArray(e)?e.map((function(e){return e[r.value]})):e[r.value]},s=function(e){return O(e)?"single"===i.value?{}:[]:e};return{update:function(e){o.value=s(e);var l=c(e);t.emit("change",l),t.emit("input",l),t.emit("update:modelValue",l)}}}(u,r,{internalValue:i.internalValue}),c=function(a,u,r){var i=e(a),o=i.searchable,c=i.mode,s=r.internalValue,v=l(null),d=l(null),p=t((function(){return v.value?"".concat(v.value.length,"ch"):"tags"===c.value&&-1===[null,void 0].indexOf(s.value)&&s.value.length?"1ch":"100%"}));return n(v,(function(e){u.emit("search-change",e)})),{search:v,input:d,tagsSearchWidth:p,clearSearch:function(){v.value=""},blurSearch:function(){o.value&&d.value.blur()},handleSearchBackspace:function(e){""!==v.value&&e.stopPropagation()}}}(u,r,{internalValue:i.internalValue}),s=function(n,a,u){var r=e(n),i=r.maxHeight,o=r.disabled,c=l(!1),s=t((function(){return"".concat(i.value,"px")}));return{isOpen:c,contentMaxHeight:s,open:function(){o.value||(c.value=!0,a.emit("open"))},close:function(){c.value=!1,a.emit("close")}}}(u,r),v=function(n,a,u){var r=e(n),i=r.searchable,o=r.id;return{multiselect:l(null),tabindex:t((function(){return i.value?-1:0})),blurInput:function(){document.getElementById(o.value).querySelector(".multiselect-input").blur()}}}(u),d=q(u,r,{externalValue:i.externalValue,internalValue:i.internalValue,search:c.search,blurSearch:c.blurSearch,clearSearch:c.clearSearch,update:o.update,blurInput:v.blurInput}),p=function(u,r,i){var o=e(u),c=o.id,s=o.valueProp,v=i.filteredOptions,d=i.handleOptionClick,p=i.search,f=l(null),h=t((function(){return v.value.filter((function(e){return!0!==e.disabled}))})),m=function(e){f.value=e},b=function(){f.value=h.value[0]||null},g=function(){f.value=null},y=function(){var e=document.getElementById(c.value).querySelector(".is-pointed");if(e){var l=e.parentElement;e.offsetTop+e.offsetHeight>l.clientHeight+l.scrollTop&&(l.scrollTop=e.offsetTop+e.offsetHeight-l.clientHeight),e.offsetTop<l.scrollTop&&(l.scrollTop=e.offsetTop)}};return n(p,(function(e){b()})),{pointer:f,isPointed:function(e){return!!f.value&&f.value[s.value]==e[s.value]},setPointer:m,setPointerFirst:b,clearPointer:g,selectPointer:function(){f.value&&!0!==f.value.disabled?(d(f.value),g()):g()},forwardPointer:function(){if(null===f.value)m(h.value[0]||null);else{var e=h.value.map((function(e){return e[s.value]})).indexOf(f.value[s.value])+1;h.value.length<=e&&(e=0),m(h.value[e]||null)}a((function(){y()}))},backwardPointer:function(){if(null===f.value)m(h.value[h.value.length-1]||null);else{var e=h.value.map((function(e){return e[s.value]})).indexOf(f.value[s.value])-1;e<0&&(e=h.value.length-1),m(h.value[e]||null)}a((function(){y()}))}}}(u,0,{filteredOptions:d.filteredOptions,handleOptionClick:d.handleOptionClick,search:c.search}),f=(h={internalValue:i.internalValue,update:o.update,close:s.close,clearPointer:p.clearPointer},m=h.internalValue,b=h.update,g=h.close,y=h.clearPointer,{handleBackspace:function(e){b(x(m.value).slice(0,-1))},handleEsc:function(e){g(),y(),e.target.blur()}});var h,m,b,g,y;return{...i,...o,...c,...s,...v,...d,...p,...f}}};const T={class:"multiselect-single-label"},j={class:"multiselect-multiple-label"},A={key:2,class:"multiselect-search"},C={key:3,class:"multiselect-tags"},E={class:"multiselect-tag"},M={class:"multiselect-spinner"},$={class:"multiselect-no-options"},H={class:"multiselect-no-results"};B.render=function(e,l,t,n,a,w){return u(),r("div",{class:["multiselect",[`is-${t.mode}`,{"is-open":e.isOpen,"is-searchable":t.searchable,"is-disabled":t.disabled,"no-caret":!t.caret}]],id:t.id,onKeydown:l[26]||(l[26]=i(o((()=>{}),["prevent"]),["enter"])),ref:"multiselect"},[c("div",{class:"multiselect-input",tabindex:e.tabindex,onFocus:l[18]||(l[18]=(...l)=>e.open&&e.open(...l)),onBlur:l[19]||(l[19]=(...l)=>e.close&&e.close(...l)),onKeyup:[l[20]||(l[20]=i(((...l)=>e.handleEsc&&e.handleEsc(...l)),["esc"])),l[21]||(l[21]=i(((...l)=>e.selectPointer&&e.selectPointer(...l)),["enter"]))],onKeydown:[l[22]||(l[22]=i(o(((...l)=>e.handleBackspace&&e.handleBackspace(...l)),["prevent"]),["delete"])),l[23]||(l[23]=i(o(((...l)=>e.backwardPointer&&e.backwardPointer(...l)),["prevent"]),["up"])),l[24]||(l[24]=i(o(((...l)=>e.forwardPointer&&e.forwardPointer(...l)),["prevent"]),["down"]))]},[s(" Single label "),"single"==t.mode&&e.hasSelected&&!e.search&&e.internalValue?v(e.$slots,"singlelabel",{key:0,value:e.internalValue},(()=>[c("div",T,d(e.internalValue[t.label]),1)])):s("v-if",!0),s(" Multiple label "),"multiple"==t.mode&&e.hasSelected&&!e.search?v(e.$slots,"multiplelabel",{key:1,values:e.internalValue},(()=>[c("div",j,d(e.multipleLabelText),1)])):s("v-if",!0),s(" Search "),"tags"!==t.mode&&t.searchable&&!t.disabled?(u(),r("div",A,[p(c("input",{"onUpdate:modelValue":l[1]||(l[1]=l=>e.search=l),onFocus:l[2]||(l[2]=o(((...l)=>e.open&&e.open(...l)),["stop"])),onBlur:l[3]||(l[3]=o(((...l)=>e.close&&e.close(...l)),["stop"])),onKeyup:[l[4]||(l[4]=i(o(((...l)=>e.handleEsc&&e.handleEsc(...l)),["stop"]),["esc"])),l[5]||(l[5]=i(o(((...l)=>e.selectPointer&&e.selectPointer(...l)),["stop"]),["enter"]))],onKeydown:[l[6]||(l[6]=i(((...l)=>e.handleSearchBackspace&&e.handleSearchBackspace(...l)),["delete"])),l[7]||(l[7]=i(o(((...l)=>e.backwardPointer&&e.backwardPointer(...l)),["stop"]),["up"])),l[8]||(l[8]=i(o(((...l)=>e.forwardPointer&&e.forwardPointer(...l)),["stop"]),["down"]))],ref:"input"},null,544),[[f,e.search]])])):s("v-if",!0),s(" Tags (with search) "),"tags"==t.mode?(u(),r("div",C,[(u(!0),r(h,null,m(e.internalValue,((n,a,i)=>(u(),r("span",{key:i},[v(e.$slots,"tag",{option:n,remove:e.remove,disabled:t.disabled},(()=>[c("div",E,[b(d(n[t.label])+" ",1),t.disabled?s("v-if",!0):(u(),r("i",{key:0,onClick:l[9]||(l[9]=o((()=>{}),["prevent"])),onMousedown:o((l=>e.remove(n)),["prevent"])},null,40,["onMousedown"]))])]))])))),128)),t.searchable&&!t.disabled?(u(),r("div",{key:0,class:"multiselect-search",style:{width:e.tagsSearchWidth}},[p(c("input",{"onUpdate:modelValue":l[10]||(l[10]=l=>e.search=l),onFocus:l[11]||(l[11]=o(((...l)=>e.open&&e.open(...l)),["stop"])),onBlur:l[12]||(l[12]=o(((...l)=>e.close&&e.close(...l)),["stop"])),onKeyup:[l[13]||(l[13]=i(o(((...l)=>e.handleEsc&&e.handleEsc(...l)),["stop"]),["esc"])),l[14]||(l[14]=i(o(((...l)=>e.selectPointer&&e.selectPointer(...l)),["stop"]),["enter"]))],onKeydown:[l[15]||(l[15]=i(((...l)=>e.handleSearchBackspace&&e.handleSearchBackspace(...l)),["delete"])),l[16]||(l[16]=i(o(((...l)=>e.backwardPointer&&e.backwardPointer(...l)),["stop"]),["up"])),l[17]||(l[17]=i(o(((...l)=>e.forwardPointer&&e.forwardPointer(...l)),["stop"]),["down"]))],style:{width:e.tagsSearchWidth},ref:"input"},null,36),[[f,e.search]])],4)):s("v-if",!0)])):s("v-if",!0),s(" Placeholder "),p(c("div",{class:"multiselect-placeholder"},d(t.placeholder),513),[[g,t.placeholder&&!e.hasSelected&&!e.search]]),c(y,{name:"multiselect-loading"},{default:S((()=>[p(c("div",M,null,512),[[g,e.busy]])])),_:1})],40,["tabindex"]),s(" Options "),c(y,{name:"multiselect",onAfterLeave:e.clearSearch},{default:S((()=>[p(c("div",{class:"multiselect-options",style:{maxHeight:e.contentMaxHeight}},[v(e.$slots,"beforelist"),(u(!0),r(h,null,m(e.filteredOptions,((n,a,i)=>(u(),r("a",{href:"",class:["multiselect-option",{"is-pointed":e.isPointed(n),"is-selected":e.isSelected(n),"is-disabled":e.isDisabled(n)}],key:i,onMousedown:l[25]||(l[25]=o((()=>{}),["prevent"])),onMouseenter:l=>e.setPointer(n),onClick:o((l=>e.handleOptionClick(n)),["stop","prevent"])},[v(e.$slots,"option",{option:n,search:e.search},(()=>[c("span",null,d(n[t.label]),1)]))],42,["onMouseenter","onClick"])))),128)),p(c("span",null,[v(e.$slots,"nooptions",{},(()=>[c("div",$,d(t.noOptionsText),1)]))],512),[[g,e.noOptions]]),p(c("span",null,[v(e.$slots,"noresults",{},(()=>[c("div",H,d(t.noResultsText),1)]))],512),[[g,e.noResults]]),v(e.$slots,"afterlist")],4),[[g,e.isOpen]])])),_:3},8,["onAfterLeave"])],42,["id"])},B.__file="src/Multiselect.vue";export default B;
import{toRefs as e,ref as l,computed as t,watch as n,nextTick as a,openBlock as u,createBlock as r,withKeys as i,withModifiers as o,createVNode as c,createCommentVNode as s,renderSlot as d,toDisplayString as v,withDirectives as p,vModelText as f,Fragment as h,renderList as m,createTextVNode as b,vShow as g,Transition as y,withCtx as S}from"vue";function w(e){return String(e).toLowerCase().trim()}function O(e){return-1!==[null,void 0,!1].indexOf(e)}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function P(e,l,t){return l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function q(a,u,r){var i=e(a),o=i.options,c=i.mode,s=i.trackBy,d=i.limit,v=i.hideSelected,p=i.createTag,f=i.label,h=i.appendNewTag,m=i.multipleLabel,b=i.object,g=i.loading,y=i.delay,S=i.resolveOnLoad,q=i.minChars,x=i.filterResults,B=i.clearOnSearch,V=i.clearOnSelect,T=i.valueProp,j=i.canDeselect,A=r.internalValue,C=r.externalValue,E=r.search,M=r.blurSearch,$=r.clearSearch,H=r.update,I=r.blurInput,L=l([]),N=l([]),K=l(!1),F=t((function(){var e,l=N.value||[];return e=l,"[object Object]"===Object.prototype.toString.call(e)&&(l=Object.keys(l).map((function(e){var t,n=l[e];return P(t={},T.value,e),P(t,s.value,n),P(t,f.value,n),t}))),l=l.map((function(e,l){var t;return"object"===k(e)?e:(P(t={},T.value,l),P(t,s.value,e),P(t,f.value,e),t)})),L.value.length&&(l=l.concat(L.value)),l})),R=t((function(){var e=F.value;return z.value.length&&(e=z.value.concat(e)),E.value&&x.value&&(e=e.filter((function(e){return-1!==w(e[s.value]).indexOf(w(E.value))}))),v.value&&(e=e.filter((function(e){return!ae(e)}))),d.value>0&&(e=e.slice(0,d.value)),e})),D=t((function(){switch(c.value){case"single":return!O(A.value.value);case"multiple":case"tags":return!O(A.value)&&A.value.length>0}})),_=t((function(){return void 0!==m&&void 0!==m.value?m.value(A.value):A.value&&A.value.length>1?"".concat(A.value.length," options selected"):"1 option selected"})),U=t((function(){return!F.value.length})),W=t((function(){return F.value.length>0&&0==R.value.length})),z=t((function(){var e;return!1!==p.value&&E.value?-1!==ne(E.value)?[]:[(e={},P(e,T.value,E.value),P(e,f.value,E.value),P(e,s.value,E.value),e)]:[]})),G=t((function(){switch(c.value){case"single":return null;case"multiple":case"tags":return[]}})),J=t((function(){return g.value||K.value})),Q=function(e){switch("object"!==k(e)&&(e=te(e)),c.value){case"single":H(e);break;case"multiple":case"tags":H(A.value.concat(e))}u.emit("select",Y(e))},X=function(e){switch("object"!==k(e)&&(e=te(e)),c.value){case"single":Z();break;case"tags":case"multiple":H(A.value.filter((function(l){return l[T.value]!=e[T.value]})))}u.emit("deselect",Y(e))},Y=function(e){return b.value?e:e[T.value]},Z=function(){H(G.value)},ee=function(e){switch(c.value){case"single":return!O(A.value)&&A.value[T.value]==e[T.value];case"tags":case"multiple":return!O(A.value)&&-1!==A.value.map((function(e){return e[T.value]})).indexOf(e[T.value])}},le=function(e){return!0===e.disabled},te=function(e){return F.value[F.value.map((function(e){return e[T.value]})).indexOf(e)]},ne=function(e){return F.value.map((function(e){return w(e[s.value])})).indexOf(w(e))},ae=function(e){return"tags"===c.value&&v.value&&ee(e)},ue=function(e){L.value.push(e)},re=function(){O(C.value)||(A.value=ie(C.value))},ie=function(e){return O(e)?"single"===c.value?{}:[]:b.value?e:"single"===c.value?te(e)||{}:e.filter((function(e){return!!te(e)})).map((function(e){return te(e)}))};if("single"!==c.value&&!O(C.value)&&!Array.isArray(C.value))throw new Error('v-model must be an array when using "'.concat(c.value,'" mode'));return o&&"function"==typeof o.value?S.value?(K.value=!0,o.value(E.value).then((function(e){N.value=e,K.value=!1,re()}))):1==b.value&&re():(N.value=o&&o.value?o.value:[],re()),y.value>-1&&n(E,(function(e){e.length<q.value||(B.value&&(N.value=[]),setTimeout((function(){e==E.value&&(K.value=!0,o.value(E.value).then((function(l){e==E.value&&(N.value=l),K.value=!1})))}),y.value))}),{flush:"sync"}),n(C,(function(e){var l,t,n;if(O(e))A.value=ie(e);else switch(c.value){case"single":(b.value?e[T.value]!=A.value[T.value]:e!=A.value[T.value])&&(A.value=ie(e));break;case"multiple":case"tags":l=b.value?e.map((function(e){return e[T.value]})):e,t=A.value.map((function(e){return e[T.value]})),n=t.slice().sort(),l.length===t.length&&l.slice().sort().every((function(e,l){return e===n[l]}))||(A.value=ie(e))}})),{filteredOptions:R,hasSelected:D,multipleLabelText:_,extendedOptions:F,noOptions:U,noResults:W,busy:J,select:Q,deselect:X,remove:function(e){X(e)},clear:Z,isSelected:ee,isDisabled:le,getOption:te,handleOptionClick:function(e){if(!le(e))switch(c.value){case"single":if(ee(e))return void(j.value&&X(e));Z(),Q(e),M(),I();break;case"multiple":if(ee(e))return void X(e);Q(e),V.value&&$();break;case"tags":if(ee(e))return void X(e);void 0===te(e[T.value])&&p.value&&(u.emit("tag",e[T.value]),h.value&&ue(e),$()),V.value&&$(),Q(e)}}}}function x(e){return function(e){if(Array.isArray(e))return B(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,l){if(!e)return;if("string"==typeof e)return B(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return B(e,l)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,n=new Array(l);t<l;t++)n[t]=e[t];return n}var V={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1},id:{type:[String,Number],required:!1,default:"multiselect"},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},maxHeight:{type:Number,required:!1,default:160},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0}},setup(u,r){const i=function(n,a){var u=e(n),r=u.value,i=u.modelValue,o=u.mode;return{internalValue:l("single"!==o.value?[]:{}),externalValue:t((function(){return void 0!==a.expose?i.value:r.value}))}}(u,r),o=function(l,t,n){var a=e(l),u=a.object,r=a.valueProp,i=a.mode,o=n.internalValue,c=function(e){return u.value||O(e)?e:Array.isArray(e)?e.map((function(e){return e[r.value]})):e[r.value]},s=function(e){return O(e)?"single"===i.value?{}:[]:e};return{update:function(e){o.value=s(e);var l=c(e);t.emit("change",l),t.emit("input",l),t.emit("update:modelValue",l)}}}(u,r,{internalValue:i.internalValue}),c=function(a,u,r){var i=e(a),o=i.searchable,c=i.mode,s=r.internalValue,d=l(null),v=l(null),p=t((function(){return d.value?"".concat(d.value.length,"ch"):"tags"===c.value&&-1===[null,void 0].indexOf(s.value)&&s.value.length?"1ch":"100%"}));return n(d,(function(e){u.emit("search-change",e)})),{search:d,input:v,tagsSearchWidth:p,clearSearch:function(){d.value=""},blurSearch:function(){o.value&&v.value.blur()},handleSearchBackspace:function(e){""!==d.value&&e.stopPropagation()}}}(u,r,{internalValue:i.internalValue}),s=function(n,a,u){var r=e(n),i=r.maxHeight,o=r.disabled,c=l(!1),s=t((function(){return"".concat(i.value,"px")}));return{isOpen:c,contentMaxHeight:s,open:function(){o.value||(c.value=!0,a.emit("open"))},close:function(){c.value=!1,a.emit("close")}}}(u,r),d=function(n,a,u){var r=e(n),i=r.searchable,o=r.id;return{multiselect:l(null),tabindex:t((function(){return i.value?-1:0})),blurInput:function(){document.getElementById(o.value).querySelector(".multiselect-input").blur()}}}(u),v=q(u,r,{externalValue:i.externalValue,internalValue:i.internalValue,search:c.search,blurSearch:c.blurSearch,clearSearch:c.clearSearch,update:o.update,blurInput:d.blurInput}),p=function(u,r,i){var o=e(u),c=o.id,s=o.valueProp,d=i.filteredOptions,v=i.handleOptionClick,p=i.search,f=l(null),h=t((function(){return d.value.filter((function(e){return!0!==e.disabled}))})),m=function(e){f.value=e},b=function(){f.value=h.value[0]||null},g=function(){f.value=null},y=function(){var e=document.getElementById(c.value).querySelector(".is-pointed");if(e){var l=e.parentElement;e.offsetTop+e.offsetHeight>l.clientHeight+l.scrollTop&&(l.scrollTop=e.offsetTop+e.offsetHeight-l.clientHeight),e.offsetTop<l.scrollTop&&(l.scrollTop=e.offsetTop)}};return n(p,(function(e){b()})),{pointer:f,isPointed:function(e){return!!f.value&&f.value[s.value]==e[s.value]},setPointer:m,setPointerFirst:b,clearPointer:g,selectPointer:function(){f.value&&!0!==f.value.disabled?(v(f.value),g()):g()},forwardPointer:function(){if(null===f.value)m(h.value[0]||null);else{var e=h.value.map((function(e){return e[s.value]})).indexOf(f.value[s.value])+1;h.value.length<=e&&(e=0),m(h.value[e]||null)}a((function(){y()}))},backwardPointer:function(){if(null===f.value)m(h.value[h.value.length-1]||null);else{var e=h.value.map((function(e){return e[s.value]})).indexOf(f.value[s.value])-1;e<0&&(e=h.value.length-1),m(h.value[e]||null)}a((function(){y()}))}}}(u,0,{filteredOptions:v.filteredOptions,handleOptionClick:v.handleOptionClick,search:c.search}),f=(h={internalValue:i.internalValue,update:o.update,close:s.close,clearPointer:p.clearPointer},m=h.internalValue,b=h.update,g=h.close,y=h.clearPointer,{handleBackspace:function(e){b(x(m.value).slice(0,-1))},handleEsc:function(e){g(),y(),e.target.blur()}});var h,m,b,g,y;return{...i,...o,...c,...s,...d,...v,...p,...f}}};const T={class:"multiselect-single-label"},j={class:"multiselect-multiple-label"},A={key:2,class:"multiselect-search"},C={key:3,class:"multiselect-tags"},E={class:"multiselect-tag"},M={class:"multiselect-spinner"},$={class:"multiselect-no-options"},H={class:"multiselect-no-results"};V.render=function(e,l,t,n,a,w){return u(),r("div",{class:["multiselect",[`is-${t.mode}`,{"is-open":e.isOpen,"is-searchable":t.searchable,"is-disabled":t.disabled,"no-caret":!t.caret}]],id:t.id,onKeydown:l[26]||(l[26]=i(o((()=>{}),["prevent"]),["enter"])),ref:"multiselect"},[c("div",{class:"multiselect-input",tabindex:e.tabindex,onFocus:l[18]||(l[18]=(...l)=>e.open&&e.open(...l)),onBlur:l[19]||(l[19]=(...l)=>e.close&&e.close(...l)),onKeyup:[l[20]||(l[20]=i(((...l)=>e.handleEsc&&e.handleEsc(...l)),["esc"])),l[21]||(l[21]=i(((...l)=>e.selectPointer&&e.selectPointer(...l)),["enter"]))],onKeydown:[l[22]||(l[22]=i(o(((...l)=>e.handleBackspace&&e.handleBackspace(...l)),["prevent"]),["delete"])),l[23]||(l[23]=i(o(((...l)=>e.backwardPointer&&e.backwardPointer(...l)),["prevent"]),["up"])),l[24]||(l[24]=i(o(((...l)=>e.forwardPointer&&e.forwardPointer(...l)),["prevent"]),["down"]))]},[s(" Single label "),"single"==t.mode&&e.hasSelected&&!e.search&&e.internalValue?d(e.$slots,"singlelabel",{key:0,value:e.internalValue},(()=>[c("div",T,v(e.internalValue[t.label]),1)])):s("v-if",!0),s(" Multiple label "),"multiple"==t.mode&&e.hasSelected&&!e.search?d(e.$slots,"multiplelabel",{key:1,values:e.internalValue},(()=>[c("div",j,v(e.multipleLabelText),1)])):s("v-if",!0),s(" Search "),"tags"!==t.mode&&t.searchable&&!t.disabled?(u(),r("div",A,[p(c("input",{"onUpdate:modelValue":l[1]||(l[1]=l=>e.search=l),onFocus:l[2]||(l[2]=o(((...l)=>e.open&&e.open(...l)),["stop"])),onBlur:l[3]||(l[3]=o(((...l)=>e.close&&e.close(...l)),["stop"])),onKeyup:[l[4]||(l[4]=i(o(((...l)=>e.handleEsc&&e.handleEsc(...l)),["stop"]),["esc"])),l[5]||(l[5]=i(o(((...l)=>e.selectPointer&&e.selectPointer(...l)),["stop"]),["enter"]))],onKeydown:[l[6]||(l[6]=i(((...l)=>e.handleSearchBackspace&&e.handleSearchBackspace(...l)),["delete"])),l[7]||(l[7]=i(o(((...l)=>e.backwardPointer&&e.backwardPointer(...l)),["stop"]),["up"])),l[8]||(l[8]=i(o(((...l)=>e.forwardPointer&&e.forwardPointer(...l)),["stop"]),["down"]))],ref:"input"},null,544),[[f,e.search]])])):s("v-if",!0),s(" Tags (with search) "),"tags"==t.mode?(u(),r("div",C,[(u(!0),r(h,null,m(e.internalValue,((n,a,i)=>(u(),r("span",{key:i},[d(e.$slots,"tag",{option:n,remove:e.remove,disabled:t.disabled},(()=>[c("div",E,[b(v(n[t.label])+" ",1),t.disabled?s("v-if",!0):(u(),r("i",{key:0,onClick:l[9]||(l[9]=o((()=>{}),["prevent"])),onMousedown:o((l=>e.remove(n)),["prevent"])},null,40,["onMousedown"]))])]))])))),128)),t.searchable&&!t.disabled?(u(),r("div",{key:0,class:"multiselect-search",style:{width:e.tagsSearchWidth}},[p(c("input",{"onUpdate:modelValue":l[10]||(l[10]=l=>e.search=l),onFocus:l[11]||(l[11]=o(((...l)=>e.open&&e.open(...l)),["stop"])),onBlur:l[12]||(l[12]=o(((...l)=>e.close&&e.close(...l)),["stop"])),onKeyup:[l[13]||(l[13]=i(o(((...l)=>e.handleEsc&&e.handleEsc(...l)),["stop"]),["esc"])),l[14]||(l[14]=i(o(((...l)=>e.selectPointer&&e.selectPointer(...l)),["stop"]),["enter"]))],onKeydown:[l[15]||(l[15]=i(((...l)=>e.handleSearchBackspace&&e.handleSearchBackspace(...l)),["delete"])),l[16]||(l[16]=i(o(((...l)=>e.backwardPointer&&e.backwardPointer(...l)),["stop"]),["up"])),l[17]||(l[17]=i(o(((...l)=>e.forwardPointer&&e.forwardPointer(...l)),["stop"]),["down"]))],style:{width:e.tagsSearchWidth},ref:"input"},null,36),[[f,e.search]])],4)):s("v-if",!0)])):s("v-if",!0),s(" Placeholder "),p(c("div",{class:"multiselect-placeholder"},v(t.placeholder),513),[[g,t.placeholder&&!e.hasSelected&&!e.search]]),c(y,{name:"multiselect-loading"},{default:S((()=>[p(c("div",M,null,512),[[g,e.busy]])])),_:1})],40,["tabindex"]),s(" Options "),c(y,{name:"multiselect",onAfterLeave:e.clearSearch},{default:S((()=>[p(c("div",{class:"multiselect-options",style:{maxHeight:e.contentMaxHeight}},[d(e.$slots,"beforelist"),(u(!0),r(h,null,m(e.filteredOptions,((n,a,i)=>(u(),r("a",{href:"",class:["multiselect-option",{"is-pointed":e.isPointed(n),"is-selected":e.isSelected(n),"is-disabled":e.isDisabled(n)}],key:i,onMousedown:l[25]||(l[25]=o((()=>{}),["prevent"])),onMouseenter:l=>e.setPointer(n),onClick:o((l=>e.handleOptionClick(n)),["stop","prevent"])},[d(e.$slots,"option",{option:n,search:e.search},(()=>[c("span",null,v(n[t.label]),1)]))],42,["onMouseenter","onClick"])))),128)),p(c("span",null,[d(e.$slots,"nooptions",{},(()=>[c("div",$,v(t.noOptionsText),1)]))],512),[[g,e.noOptions]]),p(c("span",null,[d(e.$slots,"noresults",{},(()=>[c("div",H,v(t.noResultsText),1)]))],512),[[g,e.noResults]]),d(e.$slots,"afterlist")],4),[[g,e.isOpen]])])),_:3},8,["onAfterLeave"])],42,["id"])},V.__file="src/Multiselect.vue";export default V;

@@ -1,1 +0,1 @@

var VueformMultiselect=function(e){"use strict";function t(e){return String(e).toLowerCase().trim()}function n(e){return-1!==[null,void 0,!1].indexOf(e)}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function i(u,r,i){var o=e.toRefs(u),c=o.options,s=o.mode,d=o.trackBy,v=o.limit,f=o.hideSelected,p=o.createTag,m=o.label,h=o.appendNewTag,y=o.multipleLabel,g=o.object,b=o.loading,k=o.delay,_=o.resolveOnLoad,w=o.minChars,O=o.filterResults,x=o.clearOnSearch,S=o.clearOnSelect,C=o.valueProp,P=i.internalValue,q=i.externalValue,V=i.search,T=i.blurSearch,B=i.clearSearch,E=i.update,D=i.blurInput,R=e.ref([]),A=e.ref([]),N=e.ref(!1),j=e.computed((function(){var e,t=A.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var n,a=t[e];return l(n={},C.value,e),l(n,d.value,a),l(n,m.value,a),n}))),t=t.map((function(e,t){var n;return"object"===a(e)?e:(l(n={},C.value,t),l(n,d.value,e),l(n,m.value,e),n)})),R.value.length&&(t=t.concat(R.value)),t})),I=e.computed((function(){var e=j.value;return F.value.length&&(e=F.value.concat(e)),V.value&&O.value&&(e=e.filter((function(e){return-1!==t(e[d.value]).indexOf(t(V.value))}))),f.value&&(e=e.filter((function(e){return!ee(e)}))),v.value>0&&(e=e.slice(0,v.value)),e})),H=e.computed((function(){switch(s.value){case"single":return!n(P.value.value);case"multiple":case"tags":return!n(P.value)&&P.value.length>0}})),U=e.computed((function(){return void 0!==y&&void 0!==y.value?y.value(P.value):P.value&&P.value.length>1?"".concat(P.value.length," options selected"):"1 option selected"})),$=e.computed((function(){return!j.value.length})),L=e.computed((function(){return j.value.length>0&&0==I.value.length})),F=e.computed((function(){var e;return!1!==p.value&&V.value?-1!==Z(V.value)?[]:[(e={},l(e,C.value,V.value),l(e,m.value,V.value),l(e,d.value,V.value),e)]:[]})),M=e.computed((function(){switch(s.value){case"single":return null;case"multiple":case"tags":return[]}})),W=e.computed((function(){return b.value||N.value})),X=function(e){switch("object"!==a(e)&&(e=Y(e)),s.value){case"single":E(e);break;case"multiple":case"tags":E(P.value.concat(e))}r.emit("select",G(e))},z=function(e){switch("object"!==a(e)&&(e=Y(e)),s.value){case"single":J();break;case"tags":case"multiple":E(P.value.filter((function(t){return t[C.value]!=e[C.value]})))}r.emit("deselect",G(e))},G=function(e){return g.value?e:e[C.value]},J=function(){E(M.value)},K=function(e){switch(s.value){case"single":return!n(P.value)&&P.value[C.value]==e[C.value];case"tags":case"multiple":return!n(P.value)&&-1!==P.value.map((function(e){return e[C.value]})).indexOf(e[C.value])}},Q=function(e){return!0===e.disabled},Y=function(e){return j.value[j.value.map((function(e){return e[C.value]})).indexOf(e)]},Z=function(e){return j.value.map((function(e){return t(e[d.value])})).indexOf(t(e))},ee=function(e){return"tags"===s.value&&f.value&&K(e)},te=function(e){R.value.push(e)},ne=function(e){return n(e)?"single"===s.value?{}:[]:g.value?e:"single"===s.value?Y(e)||{}:e.filter((function(e){return!!Y(e)})).map((function(e){return Y(e)}))};if("single"!==s.value&&!n(q.value)&&!Array.isArray(q.value))throw new Error('v-model must be an array when using "'.concat(s.value,'" mode'));return c&&"function"==typeof c.value?_.value&&(N.value=!0,c.value(V.value).then((function(e){A.value=e,N.value=!1,n(q.value)||(P.value=ne(q.value))}))):(A.value=c&&c.value?c.value:[],n(q.value)||(P.value=ne(q.value))),k.value>-1&&e.watch(V,(function(e){e.length<w.value||(x.value&&(A.value=[]),setTimeout((function(){e==V.value&&(N.value=!0,c.value(V.value).then((function(t){e==V.value&&(A.value=t),N.value=!1})))}),k.value))}),{flush:"sync"}),e.watch(q,(function(e){var t,a,l;if(n(e))P.value=ne(e);else switch(s.value){case"single":(g.value?e[C.value]!=P.value[C.value]:e!=P.value[C.value])&&(P.value=ne(e));break;case"multiple":case"tags":t=g.value?e.map((function(e){return e[C.value]})):e,a=P.value.map((function(e){return e[C.value]})),l=a.slice().sort(),t.length===a.length&&t.slice().sort().every((function(e,t){return e===l[t]}))||(P.value=ne(e))}})),{filteredOptions:I,hasSelected:H,multipleLabelText:U,extendedOptions:j,noOptions:$,noResults:L,busy:W,select:X,deselect:z,remove:function(e){z(e)},clear:J,isSelected:K,isDisabled:Q,getOption:Y,handleOptionClick:function(e){if(!Q(e))switch(s.value){case"single":if(K(e))return void z(e);J(),X(e),T(),D();break;case"multiple":if(K(e))return void z(e);X(e),S.value&&B();break;case"tags":if(K(e))return void z(e);void 0===Y(e[C.value])&&p.value&&(r.emit("tag",e[C.value]),h.value&&te(e),B()),S.value&&B(),X(e)}}}}function o(e,t,n,a,l,u,r,i,o,c){"boolean"!=typeof r&&(o=i,i=r,r=!1);var s,d="function"==typeof n?n.options:n;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,l&&(d.functional=!0)),a&&(d._scopeId=a),u?(s=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(u)},d._ssrRegister=s):t&&(s=r?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,i(e))}),s)if(d.functional){var v=d.render;d.render=function(e,t){return s.call(t),v(e,t)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,s):[s]}return n}const c={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1},id:{type:[String,Number],required:!1,default:"multiselect"},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},maxHeight:{type:Number,required:!1,default:160},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0}},setup(t,a){const l=function(t,n){var a=e.toRefs(t),l=a.value,u=a.modelValue,r=a.mode;return{internalValue:e.ref("single"!==r.value?[]:{}),externalValue:e.computed((function(){return void 0!==n.expose?u.value:l.value}))}}(t,a),r=function(t,a,l){var u=e.toRefs(t),r=u.object,i=u.valueProp,o=u.mode,c=l.internalValue,s=function(e){return r.value||n(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},d=function(e){return n(e)?"single"===o.value?{}:[]:e};return{update:function(e){c.value=d(e);var t=s(e);a.emit("change",t),a.emit("input",t),a.emit("update:modelValue",t)}}}(t,a,{internalValue:l.internalValue}),o=function(t,n,a){var l=e.toRefs(t),u=l.searchable,r=l.mode,i=a.internalValue,o=e.ref(null),c=e.ref(null),s=e.computed((function(){return o.value?"".concat(o.value.length,"ch"):"tags"===r.value&&-1===[null,void 0].indexOf(i.value)&&i.value.length?"1ch":"100%"}));return e.watch(o,(function(e){n.emit("search-change",e)})),{search:o,input:c,tagsSearchWidth:s,clearSearch:function(){o.value=""},blurSearch:function(){u.value&&c.value.blur()},handleSearchBackspace:function(e){""!==o.value&&e.stopPropagation()}}}(t,a,{internalValue:l.internalValue}),c=function(t,n,a){var l=e.toRefs(t),u=l.maxHeight,r=l.disabled,i=e.ref(!1),o=e.computed((function(){return"".concat(u.value,"px")}));return{isOpen:i,contentMaxHeight:o,open:function(){r.value||(i.value=!0,n.emit("open"))},close:function(){i.value=!1,n.emit("close")}}}(t,a),s=function(t,n,a){var l=e.toRefs(t),u=l.searchable,r=l.id;return{multiselect:e.ref(null),tabindex:e.computed((function(){return u.value?-1:0})),blurInput:function(){document.getElementById(r.value).querySelector(".multiselect-input").blur()}}}(t),d=i(t,a,{externalValue:l.externalValue,internalValue:l.internalValue,search:o.search,blurSearch:o.blurSearch,clearSearch:o.clearSearch,update:r.update,blurInput:s.blurInput}),v=function(t,n,a){var l=e.toRefs(t),u=l.id,r=l.valueProp,i=a.filteredOptions,o=a.handleOptionClick,c=a.search,s=e.ref(null),d=e.computed((function(){return i.value.filter((function(e){return!0!==e.disabled}))})),v=function(e){s.value=e},f=function(){s.value=d.value[0]||null},p=function(){s.value=null},m=function(){var e=document.getElementById(u.value).querySelector(".is-pointed");if(e){var t=e.parentElement;e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop<t.scrollTop&&(t.scrollTop=e.offsetTop)}};return e.watch(c,(function(e){f()})),{pointer:s,isPointed:function(e){return!!s.value&&s.value[r.value]==e[r.value]},setPointer:v,setPointerFirst:f,clearPointer:p,selectPointer:function(){s.value&&!0!==s.value.disabled?(o(s.value),p()):p()},forwardPointer:function(){if(null===s.value)v(d.value[0]||null);else{var t=d.value.map((function(e){return e[r.value]})).indexOf(s.value[r.value])+1;d.value.length<=t&&(t=0),v(d.value[t]||null)}e.nextTick((function(){m()}))},backwardPointer:function(){if(null===s.value)v(d.value[d.value.length-1]||null);else{var t=d.value.map((function(e){return e[r.value]})).indexOf(s.value[r.value])-1;t<0&&(t=d.value.length-1),v(d.value[t]||null)}e.nextTick((function(){m()}))}}}(t,0,{filteredOptions:d.filteredOptions,handleOptionClick:d.handleOptionClick,search:o.search}),f=(p={internalValue:l.internalValue,update:r.update,close:c.close,clearPointer:v.clearPointer},m=p.internalValue,h=p.update,y=p.close,g=p.clearPointer,{handleBackspace:function(e){h(u(m.value).slice(0,-1))},handleEsc:function(e){y(),g(),e.target.blur()}});var p,m,h,y,g;return{...l,...r,...o,...c,...s,...d,...v,...f}}};var s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:"multiselect",staticClass:"multiselect",class:["is-"+e.mode,{"is-open":e.isOpen,"is-searchable":e.searchable,"is-disabled":e.disabled,"no-caret":!e.caret}],attrs:{id:e.id},on:{keydown:function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;t.preventDefault()}}},[n("div",{staticClass:"multiselect-input",attrs:{tabindex:e.tabindex},on:{focus:e.open,blur:e.close,keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.handleEsc(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.selectPointer(t)}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.preventDefault(),e.handleBackspace(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),e.forwardPointer(t))}]}},["single"==e.mode&&e.hasSelected&&!e.search&&e.internalValue?[e._t("singlelabel",[n("div",{staticClass:"multiselect-single-label"},[e._v("\n "+e._s(e.internalValue[e.label])+"\n ")])],{value:e.internalValue})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",[n("div",{staticClass:"multiselect-multiple-label"},[e._v("\n "+e._s(e.multipleLabelText)+"\n ")])],{values:e.internalValue})]:e._e(),e._v(" "),"tags"!==e.mode&&e.searchable&&!e.disabled?[n("div",{staticClass:"multiselect-search"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],ref:"input",domProps:{value:e.search},on:{focus:function(t){return t.stopPropagation(),e.open(t)},blur:function(t){return t.stopPropagation(),e.close(t)},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),e.handleEsc(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),e.selectPointer(t))}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.handleSearchBackspace(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),e.forwardPointer(t))}],input:function(t){t.target.composing||(e.search=t.target.value)}}})])]:e._e(),e._v(" "),"tags"==e.mode?[n("div",{staticClass:"multiselect-tags"},[e._l(e.internalValue,(function(t,a,l){return n("span",{key:l},[e._t("tag",[n("div",{staticClass:"multiselect-tag"},[e._v("\n "+e._s(t[e.label])+"\n "),e.disabled?e._e():n("i",{on:{click:function(e){e.preventDefault()},mousedown:function(n){return n.preventDefault(),e.remove(t)}}})])],{option:t,remove:e.remove,disabled:e.disabled})],2)})),e._v(" "),e.searchable&&!e.disabled?n("div",{staticClass:"multiselect-search",style:{width:e.tagsSearchWidth}},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],ref:"input",style:{width:e.tagsSearchWidth},domProps:{value:e.search},on:{focus:function(t){return t.stopPropagation(),e.open(t)},blur:function(t){return t.stopPropagation(),e.close(t)},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),e.handleEsc(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),e.selectPointer(t))}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.handleSearchBackspace(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),e.forwardPointer(t))}],input:function(t){t.target.composing||(e.search=t.target.value)}}})]):e._e()],2)]:e._e(),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.placeholder&&!e.hasSelected&&!e.search,expression:"placeholder && !hasSelected && !search"}],staticClass:"multiselect-placeholder"},[e._v("\n "+e._s(e.placeholder)+"\n ")]),e._v(" "),n("transition",{attrs:{name:"multiselect-loading"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.busy,expression:"busy"}],staticClass:"multiselect-spinner"})])],2),e._v(" "),n("transition",{attrs:{name:"multiselect"},on:{"after-leave":e.clearSearch}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.isOpen,expression:"isOpen"}],staticClass:"multiselect-options",style:{maxHeight:e.contentMaxHeight}},[e._t("beforelist"),e._v(" "),e._l(e.filteredOptions,(function(t,a,l){return n("a",{key:l,staticClass:"multiselect-option",class:{"is-pointed":e.isPointed(t),"is-selected":e.isSelected(t),"is-disabled":e.isDisabled(t)},attrs:{href:""},on:{mousedown:function(e){e.preventDefault()},mouseenter:function(n){return e.setPointer(t)},click:function(n){return n.stopPropagation(),n.preventDefault(),e.handleOptionClick(t)}}},[e._t("option",[n("span",[e._v(e._s(t[e.label]))])],{option:t,search:e.search})],2)})),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.noOptions,expression:"noOptions"}]},[e._t("nooptions",[n("div",{staticClass:"multiselect-no-options"},[e._v(e._s(e.noOptionsText))])])],2),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.noResults,expression:"noResults"}]},[e._t("noresults",[n("div",{staticClass:"multiselect-no-results"},[e._v(e._s(e.noResultsText))])])],2),e._v(" "),e._t("afterlist")],2)])],1)};s._withStripped=!0;return o({render:s,staticRenderFns:[]},undefined,c,undefined,false,undefined,!1,void 0,void 0,void 0)}(VueCompositionAPI);
var VueformMultiselect=function(e){"use strict";function t(e){return String(e).toLowerCase().trim()}function n(e){return-1!==[null,void 0,!1].indexOf(e)}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function i(u,r,i){var o=e.toRefs(u),c=o.options,s=o.mode,d=o.trackBy,v=o.limit,f=o.hideSelected,p=o.createTag,m=o.label,h=o.appendNewTag,y=o.multipleLabel,g=o.object,b=o.loading,k=o.delay,_=o.resolveOnLoad,w=o.minChars,O=o.filterResults,x=o.clearOnSearch,S=o.clearOnSelect,C=o.valueProp,P=o.canDeselect,q=i.internalValue,V=i.externalValue,T=i.search,B=i.blurSearch,D=i.clearSearch,E=i.update,R=i.blurInput,A=e.ref([]),N=e.ref([]),j=e.ref(!1),I=e.computed((function(){var e,t=N.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var n,a=t[e];return l(n={},C.value,e),l(n,d.value,a),l(n,m.value,a),n}))),t=t.map((function(e,t){var n;return"object"===a(e)?e:(l(n={},C.value,t),l(n,d.value,e),l(n,m.value,e),n)})),A.value.length&&(t=t.concat(A.value)),t})),H=e.computed((function(){var e=I.value;return M.value.length&&(e=M.value.concat(e)),T.value&&O.value&&(e=e.filter((function(e){return-1!==t(e[d.value]).indexOf(t(T.value))}))),f.value&&(e=e.filter((function(e){return!te(e)}))),v.value>0&&(e=e.slice(0,v.value)),e})),U=e.computed((function(){switch(s.value){case"single":return!n(q.value.value);case"multiple":case"tags":return!n(q.value)&&q.value.length>0}})),$=e.computed((function(){return void 0!==y&&void 0!==y.value?y.value(q.value):q.value&&q.value.length>1?"".concat(q.value.length," options selected"):"1 option selected"})),L=e.computed((function(){return!I.value.length})),F=e.computed((function(){return I.value.length>0&&0==H.value.length})),M=e.computed((function(){var e;return!1!==p.value&&T.value?-1!==ee(T.value)?[]:[(e={},l(e,C.value,T.value),l(e,m.value,T.value),l(e,d.value,T.value),e)]:[]})),W=e.computed((function(){switch(s.value){case"single":return null;case"multiple":case"tags":return[]}})),X=e.computed((function(){return b.value||j.value})),z=function(e){switch("object"!==a(e)&&(e=Z(e)),s.value){case"single":E(e);break;case"multiple":case"tags":E(q.value.concat(e))}r.emit("select",J(e))},G=function(e){switch("object"!==a(e)&&(e=Z(e)),s.value){case"single":K();break;case"tags":case"multiple":E(q.value.filter((function(t){return t[C.value]!=e[C.value]})))}r.emit("deselect",J(e))},J=function(e){return g.value?e:e[C.value]},K=function(){E(W.value)},Q=function(e){switch(s.value){case"single":return!n(q.value)&&q.value[C.value]==e[C.value];case"tags":case"multiple":return!n(q.value)&&-1!==q.value.map((function(e){return e[C.value]})).indexOf(e[C.value])}},Y=function(e){return!0===e.disabled},Z=function(e){return I.value[I.value.map((function(e){return e[C.value]})).indexOf(e)]},ee=function(e){return I.value.map((function(e){return t(e[d.value])})).indexOf(t(e))},te=function(e){return"tags"===s.value&&f.value&&Q(e)},ne=function(e){A.value.push(e)},ae=function(){n(V.value)||(q.value=le(V.value))},le=function(e){return n(e)?"single"===s.value?{}:[]:g.value?e:"single"===s.value?Z(e)||{}:e.filter((function(e){return!!Z(e)})).map((function(e){return Z(e)}))};if("single"!==s.value&&!n(V.value)&&!Array.isArray(V.value))throw new Error('v-model must be an array when using "'.concat(s.value,'" mode'));return c&&"function"==typeof c.value?_.value?(j.value=!0,c.value(T.value).then((function(e){N.value=e,j.value=!1,ae()}))):1==g.value&&ae():(N.value=c&&c.value?c.value:[],ae()),k.value>-1&&e.watch(T,(function(e){e.length<w.value||(x.value&&(N.value=[]),setTimeout((function(){e==T.value&&(j.value=!0,c.value(T.value).then((function(t){e==T.value&&(N.value=t),j.value=!1})))}),k.value))}),{flush:"sync"}),e.watch(V,(function(e){var t,a,l;if(n(e))q.value=le(e);else switch(s.value){case"single":(g.value?e[C.value]!=q.value[C.value]:e!=q.value[C.value])&&(q.value=le(e));break;case"multiple":case"tags":t=g.value?e.map((function(e){return e[C.value]})):e,a=q.value.map((function(e){return e[C.value]})),l=a.slice().sort(),t.length===a.length&&t.slice().sort().every((function(e,t){return e===l[t]}))||(q.value=le(e))}})),{filteredOptions:H,hasSelected:U,multipleLabelText:$,extendedOptions:I,noOptions:L,noResults:F,busy:X,select:z,deselect:G,remove:function(e){G(e)},clear:K,isSelected:Q,isDisabled:Y,getOption:Z,handleOptionClick:function(e){if(!Y(e))switch(s.value){case"single":if(Q(e))return void(P.value&&G(e));K(),z(e),B(),R();break;case"multiple":if(Q(e))return void G(e);z(e),S.value&&D();break;case"tags":if(Q(e))return void G(e);void 0===Z(e[C.value])&&p.value&&(r.emit("tag",e[C.value]),h.value&&ne(e),D()),S.value&&D(),z(e)}}}}function o(e,t,n,a,l,u,r,i,o,c){"boolean"!=typeof r&&(o=i,i=r,r=!1);var s,d="function"==typeof n?n.options:n;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,l&&(d.functional=!0)),a&&(d._scopeId=a),u?(s=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(u)},d._ssrRegister=s):t&&(s=r?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,i(e))}),s)if(d.functional){var v=d.render;d.render=function(e,t){return s.call(t),v(e,t)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,s):[s]}return n}const c={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1},id:{type:[String,Number],required:!1,default:"multiselect"},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},maxHeight:{type:Number,required:!1,default:160},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0}},setup(t,a){const l=function(t,n){var a=e.toRefs(t),l=a.value,u=a.modelValue,r=a.mode;return{internalValue:e.ref("single"!==r.value?[]:{}),externalValue:e.computed((function(){return void 0!==n.expose?u.value:l.value}))}}(t,a),r=function(t,a,l){var u=e.toRefs(t),r=u.object,i=u.valueProp,o=u.mode,c=l.internalValue,s=function(e){return r.value||n(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},d=function(e){return n(e)?"single"===o.value?{}:[]:e};return{update:function(e){c.value=d(e);var t=s(e);a.emit("change",t),a.emit("input",t),a.emit("update:modelValue",t)}}}(t,a,{internalValue:l.internalValue}),o=function(t,n,a){var l=e.toRefs(t),u=l.searchable,r=l.mode,i=a.internalValue,o=e.ref(null),c=e.ref(null),s=e.computed((function(){return o.value?"".concat(o.value.length,"ch"):"tags"===r.value&&-1===[null,void 0].indexOf(i.value)&&i.value.length?"1ch":"100%"}));return e.watch(o,(function(e){n.emit("search-change",e)})),{search:o,input:c,tagsSearchWidth:s,clearSearch:function(){o.value=""},blurSearch:function(){u.value&&c.value.blur()},handleSearchBackspace:function(e){""!==o.value&&e.stopPropagation()}}}(t,a,{internalValue:l.internalValue}),c=function(t,n,a){var l=e.toRefs(t),u=l.maxHeight,r=l.disabled,i=e.ref(!1),o=e.computed((function(){return"".concat(u.value,"px")}));return{isOpen:i,contentMaxHeight:o,open:function(){r.value||(i.value=!0,n.emit("open"))},close:function(){i.value=!1,n.emit("close")}}}(t,a),s=function(t,n,a){var l=e.toRefs(t),u=l.searchable,r=l.id;return{multiselect:e.ref(null),tabindex:e.computed((function(){return u.value?-1:0})),blurInput:function(){document.getElementById(r.value).querySelector(".multiselect-input").blur()}}}(t),d=i(t,a,{externalValue:l.externalValue,internalValue:l.internalValue,search:o.search,blurSearch:o.blurSearch,clearSearch:o.clearSearch,update:r.update,blurInput:s.blurInput}),v=function(t,n,a){var l=e.toRefs(t),u=l.id,r=l.valueProp,i=a.filteredOptions,o=a.handleOptionClick,c=a.search,s=e.ref(null),d=e.computed((function(){return i.value.filter((function(e){return!0!==e.disabled}))})),v=function(e){s.value=e},f=function(){s.value=d.value[0]||null},p=function(){s.value=null},m=function(){var e=document.getElementById(u.value).querySelector(".is-pointed");if(e){var t=e.parentElement;e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop<t.scrollTop&&(t.scrollTop=e.offsetTop)}};return e.watch(c,(function(e){f()})),{pointer:s,isPointed:function(e){return!!s.value&&s.value[r.value]==e[r.value]},setPointer:v,setPointerFirst:f,clearPointer:p,selectPointer:function(){s.value&&!0!==s.value.disabled?(o(s.value),p()):p()},forwardPointer:function(){if(null===s.value)v(d.value[0]||null);else{var t=d.value.map((function(e){return e[r.value]})).indexOf(s.value[r.value])+1;d.value.length<=t&&(t=0),v(d.value[t]||null)}e.nextTick((function(){m()}))},backwardPointer:function(){if(null===s.value)v(d.value[d.value.length-1]||null);else{var t=d.value.map((function(e){return e[r.value]})).indexOf(s.value[r.value])-1;t<0&&(t=d.value.length-1),v(d.value[t]||null)}e.nextTick((function(){m()}))}}}(t,0,{filteredOptions:d.filteredOptions,handleOptionClick:d.handleOptionClick,search:o.search}),f=(p={internalValue:l.internalValue,update:r.update,close:c.close,clearPointer:v.clearPointer},m=p.internalValue,h=p.update,y=p.close,g=p.clearPointer,{handleBackspace:function(e){h(u(m.value).slice(0,-1))},handleEsc:function(e){y(),g(),e.target.blur()}});var p,m,h,y,g;return{...l,...r,...o,...c,...s,...d,...v,...f}}};var s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:"multiselect",staticClass:"multiselect",class:["is-"+e.mode,{"is-open":e.isOpen,"is-searchable":e.searchable,"is-disabled":e.disabled,"no-caret":!e.caret}],attrs:{id:e.id},on:{keydown:function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;t.preventDefault()}}},[n("div",{staticClass:"multiselect-input",attrs:{tabindex:e.tabindex},on:{focus:e.open,blur:e.close,keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.handleEsc(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.selectPointer(t)}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.preventDefault(),e.handleBackspace(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),e.forwardPointer(t))}]}},["single"==e.mode&&e.hasSelected&&!e.search&&e.internalValue?[e._t("singlelabel",[n("div",{staticClass:"multiselect-single-label"},[e._v("\n "+e._s(e.internalValue[e.label])+"\n ")])],{value:e.internalValue})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",[n("div",{staticClass:"multiselect-multiple-label"},[e._v("\n "+e._s(e.multipleLabelText)+"\n ")])],{values:e.internalValue})]:e._e(),e._v(" "),"tags"!==e.mode&&e.searchable&&!e.disabled?[n("div",{staticClass:"multiselect-search"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],ref:"input",domProps:{value:e.search},on:{focus:function(t){return t.stopPropagation(),e.open(t)},blur:function(t){return t.stopPropagation(),e.close(t)},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),e.handleEsc(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),e.selectPointer(t))}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.handleSearchBackspace(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),e.forwardPointer(t))}],input:function(t){t.target.composing||(e.search=t.target.value)}}})])]:e._e(),e._v(" "),"tags"==e.mode?[n("div",{staticClass:"multiselect-tags"},[e._l(e.internalValue,(function(t,a,l){return n("span",{key:l},[e._t("tag",[n("div",{staticClass:"multiselect-tag"},[e._v("\n "+e._s(t[e.label])+"\n "),e.disabled?e._e():n("i",{on:{click:function(e){e.preventDefault()},mousedown:function(n){return n.preventDefault(),e.remove(t)}}})])],{option:t,remove:e.remove,disabled:e.disabled})],2)})),e._v(" "),e.searchable&&!e.disabled?n("div",{staticClass:"multiselect-search",style:{width:e.tagsSearchWidth}},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],ref:"input",style:{width:e.tagsSearchWidth},domProps:{value:e.search},on:{focus:function(t){return t.stopPropagation(),e.open(t)},blur:function(t){return t.stopPropagation(),e.close(t)},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),e.handleEsc(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),e.selectPointer(t))}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.handleSearchBackspace(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),e.forwardPointer(t))}],input:function(t){t.target.composing||(e.search=t.target.value)}}})]):e._e()],2)]:e._e(),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.placeholder&&!e.hasSelected&&!e.search,expression:"placeholder && !hasSelected && !search"}],staticClass:"multiselect-placeholder"},[e._v("\n "+e._s(e.placeholder)+"\n ")]),e._v(" "),n("transition",{attrs:{name:"multiselect-loading"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.busy,expression:"busy"}],staticClass:"multiselect-spinner"})])],2),e._v(" "),n("transition",{attrs:{name:"multiselect"},on:{"after-leave":e.clearSearch}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.isOpen,expression:"isOpen"}],staticClass:"multiselect-options",style:{maxHeight:e.contentMaxHeight}},[e._t("beforelist"),e._v(" "),e._l(e.filteredOptions,(function(t,a,l){return n("a",{key:l,staticClass:"multiselect-option",class:{"is-pointed":e.isPointed(t),"is-selected":e.isSelected(t),"is-disabled":e.isDisabled(t)},attrs:{href:""},on:{mousedown:function(e){e.preventDefault()},mouseenter:function(n){return e.setPointer(t)},click:function(n){return n.stopPropagation(),n.preventDefault(),e.handleOptionClick(t)}}},[e._t("option",[n("span",[e._v(e._s(t[e.label]))])],{option:t,search:e.search})],2)})),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.noOptions,expression:"noOptions"}]},[e._t("nooptions",[n("div",{staticClass:"multiselect-no-options"},[e._v(e._s(e.noOptionsText))])])],2),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.noResults,expression:"noResults"}]},[e._t("noresults",[n("div",{staticClass:"multiselect-no-results"},[e._v(e._s(e.noResultsText))])])],2),e._v(" "),e._t("afterlist")],2)])],1)};s._withStripped=!0;return o({render:s,staticRenderFns:[]},undefined,c,undefined,false,undefined,!1,void 0,void 0,void 0)}(VueCompositionAPI);

@@ -1,1 +0,1 @@

import{toRefs as e,ref as t,computed as n,watch as a,nextTick as l}from"@vue/composition-api";function u(e){return String(e).toLowerCase().trim()}function r(e){return-1!==[null,void 0,!1].indexOf(e)}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(l,s,c){var d=e(l),v=d.options,p=d.mode,f=d.trackBy,y=d.limit,h=d.hideSelected,m=d.createTag,g=d.label,b=d.appendNewTag,k=d.multipleLabel,_=d.object,w=d.loading,O=d.delay,S=d.resolveOnLoad,x=d.minChars,C=d.filterResults,P=d.clearOnSearch,q=d.clearOnSelect,V=d.valueProp,T=c.internalValue,B=c.externalValue,E=c.search,D=c.blurSearch,A=c.clearSearch,N=c.update,j=c.blurInput,R=t([]),I=t([]),H=t(!1),U=n((function(){var e,t=I.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var n,a=t[e];return o(n={},V.value,e),o(n,f.value,a),o(n,g.value,a),n}))),t=t.map((function(e,t){var n;return"object"===i(e)?e:(o(n={},V.value,t),o(n,f.value,e),o(n,g.value,e),n)})),R.value.length&&(t=t.concat(R.value)),t})),$=n((function(){var e=U.value;return X.value.length&&(e=X.value.concat(e)),E.value&&C.value&&(e=e.filter((function(e){return-1!==u(e[f.value]).indexOf(u(E.value))}))),h.value&&(e=e.filter((function(e){return!ae(e)}))),y.value>0&&(e=e.slice(0,y.value)),e})),L=n((function(){switch(p.value){case"single":return!r(T.value.value);case"multiple":case"tags":return!r(T.value)&&T.value.length>0}})),F=n((function(){return void 0!==k&&void 0!==k.value?k.value(T.value):T.value&&T.value.length>1?"".concat(T.value.length," options selected"):"1 option selected"})),M=n((function(){return!U.value.length})),W=n((function(){return U.value.length>0&&0==$.value.length})),X=n((function(){var e;return!1!==m.value&&E.value?-1!==ne(E.value)?[]:[(e={},o(e,V.value,E.value),o(e,g.value,E.value),o(e,f.value,E.value),e)]:[]})),z=n((function(){switch(p.value){case"single":return null;case"multiple":case"tags":return[]}})),G=n((function(){return w.value||H.value})),J=function(e){switch("object"!==i(e)&&(e=te(e)),p.value){case"single":N(e);break;case"multiple":case"tags":N(T.value.concat(e))}s.emit("select",Q(e))},K=function(e){switch("object"!==i(e)&&(e=te(e)),p.value){case"single":Y();break;case"tags":case"multiple":N(T.value.filter((function(t){return t[V.value]!=e[V.value]})))}s.emit("deselect",Q(e))},Q=function(e){return _.value?e:e[V.value]},Y=function(){N(z.value)},Z=function(e){switch(p.value){case"single":return!r(T.value)&&T.value[V.value]==e[V.value];case"tags":case"multiple":return!r(T.value)&&-1!==T.value.map((function(e){return e[V.value]})).indexOf(e[V.value])}},ee=function(e){return!0===e.disabled},te=function(e){return U.value[U.value.map((function(e){return e[V.value]})).indexOf(e)]},ne=function(e){return U.value.map((function(e){return u(e[f.value])})).indexOf(u(e))},ae=function(e){return"tags"===p.value&&h.value&&Z(e)},le=function(e){R.value.push(e)},ue=function(e){return r(e)?"single"===p.value?{}:[]:_.value?e:"single"===p.value?te(e)||{}:e.filter((function(e){return!!te(e)})).map((function(e){return te(e)}))};if("single"!==p.value&&!r(B.value)&&!Array.isArray(B.value))throw new Error('v-model must be an array when using "'.concat(p.value,'" mode'));return v&&"function"==typeof v.value?S.value&&(H.value=!0,v.value(E.value).then((function(e){I.value=e,H.value=!1,r(B.value)||(T.value=ue(B.value))}))):(I.value=v&&v.value?v.value:[],r(B.value)||(T.value=ue(B.value))),O.value>-1&&a(E,(function(e){e.length<x.value||(P.value&&(I.value=[]),setTimeout((function(){e==E.value&&(H.value=!0,v.value(E.value).then((function(t){e==E.value&&(I.value=t),H.value=!1})))}),O.value))}),{flush:"sync"}),a(B,(function(e){var t,n,a;if(r(e))T.value=ue(e);else switch(p.value){case"single":(_.value?e[V.value]!=T.value[V.value]:e!=T.value[V.value])&&(T.value=ue(e));break;case"multiple":case"tags":t=_.value?e.map((function(e){return e[V.value]})):e,n=T.value.map((function(e){return e[V.value]})),a=n.slice().sort(),t.length===n.length&&t.slice().sort().every((function(e,t){return e===a[t]}))||(T.value=ue(e))}})),{filteredOptions:$,hasSelected:L,multipleLabelText:F,extendedOptions:U,noOptions:M,noResults:W,busy:G,select:J,deselect:K,remove:function(e){K(e)},clear:Y,isSelected:Z,isDisabled:ee,getOption:te,handleOptionClick:function(e){if(!ee(e))switch(p.value){case"single":if(Z(e))return void K(e);Y(),J(e),D(),j();break;case"multiple":if(Z(e))return void K(e);J(e),q.value&&A();break;case"tags":if(Z(e))return void K(e);void 0===te(e[V.value])&&m.value&&(s.emit("tag",e[V.value]),b.value&&le(e),A()),q.value&&A(),J(e)}}}}function c(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function v(e,t,n,a,l,u,r,i,o,s){"boolean"!=typeof r&&(o=i,i=r,r=!1);var c,d="function"==typeof n?n.options:n;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,l&&(d.functional=!0)),a&&(d._scopeId=a),u?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(u)},d._ssrRegister=c):t&&(c=r?function(e){t.call(this,s(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,i(e))}),c)if(d.functional){var v=d.render;d.render=function(e,t){return c.call(t),v(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,c):[c]}return n}const p={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1},id:{type:[String,Number],required:!1,default:"multiselect"},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},maxHeight:{type:Number,required:!1,default:160},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0}},setup(u,i){const o=function(a,l){var u=e(a),r=u.value,i=u.modelValue,o=u.mode;return{internalValue:t("single"!==o.value?[]:{}),externalValue:n((function(){return void 0!==l.expose?i.value:r.value}))}}(u,i),d=function(t,n,a){var l=e(t),u=l.object,i=l.valueProp,o=l.mode,s=a.internalValue,c=function(e){return u.value||r(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},d=function(e){return r(e)?"single"===o.value?{}:[]:e};return{update:function(e){s.value=d(e);var t=c(e);n.emit("change",t),n.emit("input",t),n.emit("update:modelValue",t)}}}(u,i,{internalValue:o.internalValue}),v=function(l,u,r){var i=e(l),o=i.searchable,s=i.mode,c=r.internalValue,d=t(null),v=t(null),p=n((function(){return d.value?"".concat(d.value.length,"ch"):"tags"===s.value&&-1===[null,void 0].indexOf(c.value)&&c.value.length?"1ch":"100%"}));return a(d,(function(e){u.emit("search-change",e)})),{search:d,input:v,tagsSearchWidth:p,clearSearch:function(){d.value=""},blurSearch:function(){o.value&&v.value.blur()},handleSearchBackspace:function(e){""!==d.value&&e.stopPropagation()}}}(u,i,{internalValue:o.internalValue}),p=function(a,l,u){var r=e(a),i=r.maxHeight,o=r.disabled,s=t(!1),c=n((function(){return"".concat(i.value,"px")}));return{isOpen:s,contentMaxHeight:c,open:function(){o.value||(s.value=!0,l.emit("open"))},close:function(){s.value=!1,l.emit("close")}}}(u,i),f=function(a,l,u){var r=e(a),i=r.searchable,o=r.id;return{multiselect:t(null),tabindex:n((function(){return i.value?-1:0})),blurInput:function(){document.getElementById(o.value).querySelector(".multiselect-input").blur()}}}(u),y=s(u,i,{externalValue:o.externalValue,internalValue:o.internalValue,search:v.search,blurSearch:v.blurSearch,clearSearch:v.clearSearch,update:d.update,blurInput:f.blurInput}),h=function(u,r,i){var o=e(u),s=o.id,c=o.valueProp,d=i.filteredOptions,v=i.handleOptionClick,p=i.search,f=t(null),y=n((function(){return d.value.filter((function(e){return!0!==e.disabled}))})),h=function(e){f.value=e},m=function(){f.value=y.value[0]||null},g=function(){f.value=null},b=function(){var e=document.getElementById(s.value).querySelector(".is-pointed");if(e){var t=e.parentElement;e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop<t.scrollTop&&(t.scrollTop=e.offsetTop)}};return a(p,(function(e){m()})),{pointer:f,isPointed:function(e){return!!f.value&&f.value[c.value]==e[c.value]},setPointer:h,setPointerFirst:m,clearPointer:g,selectPointer:function(){f.value&&!0!==f.value.disabled?(v(f.value),g()):g()},forwardPointer:function(){if(null===f.value)h(y.value[0]||null);else{var e=y.value.map((function(e){return e[c.value]})).indexOf(f.value[c.value])+1;y.value.length<=e&&(e=0),h(y.value[e]||null)}l((function(){b()}))},backwardPointer:function(){if(null===f.value)h(y.value[y.value.length-1]||null);else{var e=y.value.map((function(e){return e[c.value]})).indexOf(f.value[c.value])-1;e<0&&(e=y.value.length-1),h(y.value[e]||null)}l((function(){b()}))}}}(u,0,{filteredOptions:y.filteredOptions,handleOptionClick:y.handleOptionClick,search:v.search}),m=(g={internalValue:o.internalValue,update:d.update,close:p.close,clearPointer:h.clearPointer},b=g.internalValue,k=g.update,_=g.close,w=g.clearPointer,{handleBackspace:function(e){k(c(b.value).slice(0,-1))},handleEsc:function(e){_(),w(),e.target.blur()}});var g,b,k,_,w;return{...o,...d,...v,...p,...f,...y,...h,...m}}};var f=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:"multiselect",staticClass:"multiselect",class:["is-"+e.mode,{"is-open":e.isOpen,"is-searchable":e.searchable,"is-disabled":e.disabled,"no-caret":!e.caret}],attrs:{id:e.id},on:{keydown:function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;t.preventDefault()}}},[n("div",{staticClass:"multiselect-input",attrs:{tabindex:e.tabindex},on:{focus:e.open,blur:e.close,keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.handleEsc(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.selectPointer(t)}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.preventDefault(),e.handleBackspace(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),e.forwardPointer(t))}]}},["single"==e.mode&&e.hasSelected&&!e.search&&e.internalValue?[e._t("singlelabel",[n("div",{staticClass:"multiselect-single-label"},[e._v("\n "+e._s(e.internalValue[e.label])+"\n ")])],{value:e.internalValue})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",[n("div",{staticClass:"multiselect-multiple-label"},[e._v("\n "+e._s(e.multipleLabelText)+"\n ")])],{values:e.internalValue})]:e._e(),e._v(" "),"tags"!==e.mode&&e.searchable&&!e.disabled?[n("div",{staticClass:"multiselect-search"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],ref:"input",domProps:{value:e.search},on:{focus:function(t){return t.stopPropagation(),e.open(t)},blur:function(t){return t.stopPropagation(),e.close(t)},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),e.handleEsc(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),e.selectPointer(t))}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.handleSearchBackspace(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),e.forwardPointer(t))}],input:function(t){t.target.composing||(e.search=t.target.value)}}})])]:e._e(),e._v(" "),"tags"==e.mode?[n("div",{staticClass:"multiselect-tags"},[e._l(e.internalValue,(function(t,a,l){return n("span",{key:l},[e._t("tag",[n("div",{staticClass:"multiselect-tag"},[e._v("\n "+e._s(t[e.label])+"\n "),e.disabled?e._e():n("i",{on:{click:function(e){e.preventDefault()},mousedown:function(n){return n.preventDefault(),e.remove(t)}}})])],{option:t,remove:e.remove,disabled:e.disabled})],2)})),e._v(" "),e.searchable&&!e.disabled?n("div",{staticClass:"multiselect-search",style:{width:e.tagsSearchWidth}},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],ref:"input",style:{width:e.tagsSearchWidth},domProps:{value:e.search},on:{focus:function(t){return t.stopPropagation(),e.open(t)},blur:function(t){return t.stopPropagation(),e.close(t)},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),e.handleEsc(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),e.selectPointer(t))}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.handleSearchBackspace(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),e.forwardPointer(t))}],input:function(t){t.target.composing||(e.search=t.target.value)}}})]):e._e()],2)]:e._e(),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.placeholder&&!e.hasSelected&&!e.search,expression:"placeholder && !hasSelected && !search"}],staticClass:"multiselect-placeholder"},[e._v("\n "+e._s(e.placeholder)+"\n ")]),e._v(" "),n("transition",{attrs:{name:"multiselect-loading"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.busy,expression:"busy"}],staticClass:"multiselect-spinner"})])],2),e._v(" "),n("transition",{attrs:{name:"multiselect"},on:{"after-leave":e.clearSearch}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.isOpen,expression:"isOpen"}],staticClass:"multiselect-options",style:{maxHeight:e.contentMaxHeight}},[e._t("beforelist"),e._v(" "),e._l(e.filteredOptions,(function(t,a,l){return n("a",{key:l,staticClass:"multiselect-option",class:{"is-pointed":e.isPointed(t),"is-selected":e.isSelected(t),"is-disabled":e.isDisabled(t)},attrs:{href:""},on:{mousedown:function(e){e.preventDefault()},mouseenter:function(n){return e.setPointer(t)},click:function(n){return n.stopPropagation(),n.preventDefault(),e.handleOptionClick(t)}}},[e._t("option",[n("span",[e._v(e._s(t[e.label]))])],{option:t,search:e.search})],2)})),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.noOptions,expression:"noOptions"}]},[e._t("nooptions",[n("div",{staticClass:"multiselect-no-options"},[e._v(e._s(e.noOptionsText))])])],2),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.noResults,expression:"noResults"}]},[e._t("noresults",[n("div",{staticClass:"multiselect-no-results"},[e._v(e._s(e.noResultsText))])])],2),e._v(" "),e._t("afterlist")],2)])],1)};f._withStripped=!0;const y=v({render:f,staticRenderFns:[]},undefined,p,undefined,false,undefined,!1,void 0,void 0,void 0);export default y;
import{toRefs as e,ref as t,computed as n,watch as a,nextTick as l}from"@vue/composition-api";function u(e){return String(e).toLowerCase().trim()}function r(e){return-1!==[null,void 0,!1].indexOf(e)}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(l,s,c){var d=e(l),v=d.options,p=d.mode,f=d.trackBy,y=d.limit,h=d.hideSelected,m=d.createTag,g=d.label,b=d.appendNewTag,k=d.multipleLabel,_=d.object,w=d.loading,O=d.delay,S=d.resolveOnLoad,x=d.minChars,C=d.filterResults,P=d.clearOnSearch,q=d.clearOnSelect,V=d.valueProp,B=d.canDeselect,T=c.internalValue,D=c.externalValue,E=c.search,A=c.blurSearch,N=c.clearSearch,j=c.update,R=c.blurInput,I=t([]),H=t([]),U=t(!1),$=n((function(){var e,t=H.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var n,a=t[e];return o(n={},V.value,e),o(n,f.value,a),o(n,g.value,a),n}))),t=t.map((function(e,t){var n;return"object"===i(e)?e:(o(n={},V.value,t),o(n,f.value,e),o(n,g.value,e),n)})),I.value.length&&(t=t.concat(I.value)),t})),L=n((function(){var e=$.value;return z.value.length&&(e=z.value.concat(e)),E.value&&C.value&&(e=e.filter((function(e){return-1!==u(e[f.value]).indexOf(u(E.value))}))),h.value&&(e=e.filter((function(e){return!le(e)}))),y.value>0&&(e=e.slice(0,y.value)),e})),F=n((function(){switch(p.value){case"single":return!r(T.value.value);case"multiple":case"tags":return!r(T.value)&&T.value.length>0}})),M=n((function(){return void 0!==k&&void 0!==k.value?k.value(T.value):T.value&&T.value.length>1?"".concat(T.value.length," options selected"):"1 option selected"})),W=n((function(){return!$.value.length})),X=n((function(){return $.value.length>0&&0==L.value.length})),z=n((function(){var e;return!1!==m.value&&E.value?-1!==ae(E.value)?[]:[(e={},o(e,V.value,E.value),o(e,g.value,E.value),o(e,f.value,E.value),e)]:[]})),G=n((function(){switch(p.value){case"single":return null;case"multiple":case"tags":return[]}})),J=n((function(){return w.value||U.value})),K=function(e){switch("object"!==i(e)&&(e=ne(e)),p.value){case"single":j(e);break;case"multiple":case"tags":j(T.value.concat(e))}s.emit("select",Y(e))},Q=function(e){switch("object"!==i(e)&&(e=ne(e)),p.value){case"single":Z();break;case"tags":case"multiple":j(T.value.filter((function(t){return t[V.value]!=e[V.value]})))}s.emit("deselect",Y(e))},Y=function(e){return _.value?e:e[V.value]},Z=function(){j(G.value)},ee=function(e){switch(p.value){case"single":return!r(T.value)&&T.value[V.value]==e[V.value];case"tags":case"multiple":return!r(T.value)&&-1!==T.value.map((function(e){return e[V.value]})).indexOf(e[V.value])}},te=function(e){return!0===e.disabled},ne=function(e){return $.value[$.value.map((function(e){return e[V.value]})).indexOf(e)]},ae=function(e){return $.value.map((function(e){return u(e[f.value])})).indexOf(u(e))},le=function(e){return"tags"===p.value&&h.value&&ee(e)},ue=function(e){I.value.push(e)},re=function(){r(D.value)||(T.value=ie(D.value))},ie=function(e){return r(e)?"single"===p.value?{}:[]:_.value?e:"single"===p.value?ne(e)||{}:e.filter((function(e){return!!ne(e)})).map((function(e){return ne(e)}))};if("single"!==p.value&&!r(D.value)&&!Array.isArray(D.value))throw new Error('v-model must be an array when using "'.concat(p.value,'" mode'));return v&&"function"==typeof v.value?S.value?(U.value=!0,v.value(E.value).then((function(e){H.value=e,U.value=!1,re()}))):1==_.value&&re():(H.value=v&&v.value?v.value:[],re()),O.value>-1&&a(E,(function(e){e.length<x.value||(P.value&&(H.value=[]),setTimeout((function(){e==E.value&&(U.value=!0,v.value(E.value).then((function(t){e==E.value&&(H.value=t),U.value=!1})))}),O.value))}),{flush:"sync"}),a(D,(function(e){var t,n,a;if(r(e))T.value=ie(e);else switch(p.value){case"single":(_.value?e[V.value]!=T.value[V.value]:e!=T.value[V.value])&&(T.value=ie(e));break;case"multiple":case"tags":t=_.value?e.map((function(e){return e[V.value]})):e,n=T.value.map((function(e){return e[V.value]})),a=n.slice().sort(),t.length===n.length&&t.slice().sort().every((function(e,t){return e===a[t]}))||(T.value=ie(e))}})),{filteredOptions:L,hasSelected:F,multipleLabelText:M,extendedOptions:$,noOptions:W,noResults:X,busy:J,select:K,deselect:Q,remove:function(e){Q(e)},clear:Z,isSelected:ee,isDisabled:te,getOption:ne,handleOptionClick:function(e){if(!te(e))switch(p.value){case"single":if(ee(e))return void(B.value&&Q(e));Z(),K(e),A(),R();break;case"multiple":if(ee(e))return void Q(e);K(e),q.value&&N();break;case"tags":if(ee(e))return void Q(e);void 0===ne(e[V.value])&&m.value&&(s.emit("tag",e[V.value]),b.value&&ue(e),N()),q.value&&N(),K(e)}}}}function c(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function v(e,t,n,a,l,u,r,i,o,s){"boolean"!=typeof r&&(o=i,i=r,r=!1);var c,d="function"==typeof n?n.options:n;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,l&&(d.functional=!0)),a&&(d._scopeId=a),u?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(u)},d._ssrRegister=c):t&&(c=r?function(e){t.call(this,s(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,i(e))}),c)if(d.functional){var v=d.render;d.render=function(e,t){return c.call(t),v(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,c):[c]}return n}const p={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1},id:{type:[String,Number],required:!1,default:"multiselect"},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},maxHeight:{type:Number,required:!1,default:160},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0}},setup(u,i){const o=function(a,l){var u=e(a),r=u.value,i=u.modelValue,o=u.mode;return{internalValue:t("single"!==o.value?[]:{}),externalValue:n((function(){return void 0!==l.expose?i.value:r.value}))}}(u,i),d=function(t,n,a){var l=e(t),u=l.object,i=l.valueProp,o=l.mode,s=a.internalValue,c=function(e){return u.value||r(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},d=function(e){return r(e)?"single"===o.value?{}:[]:e};return{update:function(e){s.value=d(e);var t=c(e);n.emit("change",t),n.emit("input",t),n.emit("update:modelValue",t)}}}(u,i,{internalValue:o.internalValue}),v=function(l,u,r){var i=e(l),o=i.searchable,s=i.mode,c=r.internalValue,d=t(null),v=t(null),p=n((function(){return d.value?"".concat(d.value.length,"ch"):"tags"===s.value&&-1===[null,void 0].indexOf(c.value)&&c.value.length?"1ch":"100%"}));return a(d,(function(e){u.emit("search-change",e)})),{search:d,input:v,tagsSearchWidth:p,clearSearch:function(){d.value=""},blurSearch:function(){o.value&&v.value.blur()},handleSearchBackspace:function(e){""!==d.value&&e.stopPropagation()}}}(u,i,{internalValue:o.internalValue}),p=function(a,l,u){var r=e(a),i=r.maxHeight,o=r.disabled,s=t(!1),c=n((function(){return"".concat(i.value,"px")}));return{isOpen:s,contentMaxHeight:c,open:function(){o.value||(s.value=!0,l.emit("open"))},close:function(){s.value=!1,l.emit("close")}}}(u,i),f=function(a,l,u){var r=e(a),i=r.searchable,o=r.id;return{multiselect:t(null),tabindex:n((function(){return i.value?-1:0})),blurInput:function(){document.getElementById(o.value).querySelector(".multiselect-input").blur()}}}(u),y=s(u,i,{externalValue:o.externalValue,internalValue:o.internalValue,search:v.search,blurSearch:v.blurSearch,clearSearch:v.clearSearch,update:d.update,blurInput:f.blurInput}),h=function(u,r,i){var o=e(u),s=o.id,c=o.valueProp,d=i.filteredOptions,v=i.handleOptionClick,p=i.search,f=t(null),y=n((function(){return d.value.filter((function(e){return!0!==e.disabled}))})),h=function(e){f.value=e},m=function(){f.value=y.value[0]||null},g=function(){f.value=null},b=function(){var e=document.getElementById(s.value).querySelector(".is-pointed");if(e){var t=e.parentElement;e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop<t.scrollTop&&(t.scrollTop=e.offsetTop)}};return a(p,(function(e){m()})),{pointer:f,isPointed:function(e){return!!f.value&&f.value[c.value]==e[c.value]},setPointer:h,setPointerFirst:m,clearPointer:g,selectPointer:function(){f.value&&!0!==f.value.disabled?(v(f.value),g()):g()},forwardPointer:function(){if(null===f.value)h(y.value[0]||null);else{var e=y.value.map((function(e){return e[c.value]})).indexOf(f.value[c.value])+1;y.value.length<=e&&(e=0),h(y.value[e]||null)}l((function(){b()}))},backwardPointer:function(){if(null===f.value)h(y.value[y.value.length-1]||null);else{var e=y.value.map((function(e){return e[c.value]})).indexOf(f.value[c.value])-1;e<0&&(e=y.value.length-1),h(y.value[e]||null)}l((function(){b()}))}}}(u,0,{filteredOptions:y.filteredOptions,handleOptionClick:y.handleOptionClick,search:v.search}),m=(g={internalValue:o.internalValue,update:d.update,close:p.close,clearPointer:h.clearPointer},b=g.internalValue,k=g.update,_=g.close,w=g.clearPointer,{handleBackspace:function(e){k(c(b.value).slice(0,-1))},handleEsc:function(e){_(),w(),e.target.blur()}});var g,b,k,_,w;return{...o,...d,...v,...p,...f,...y,...h,...m}}};var f=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:"multiselect",staticClass:"multiselect",class:["is-"+e.mode,{"is-open":e.isOpen,"is-searchable":e.searchable,"is-disabled":e.disabled,"no-caret":!e.caret}],attrs:{id:e.id},on:{keydown:function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;t.preventDefault()}}},[n("div",{staticClass:"multiselect-input",attrs:{tabindex:e.tabindex},on:{focus:e.open,blur:e.close,keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.handleEsc(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.selectPointer(t)}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.preventDefault(),e.handleBackspace(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),e.forwardPointer(t))}]}},["single"==e.mode&&e.hasSelected&&!e.search&&e.internalValue?[e._t("singlelabel",[n("div",{staticClass:"multiselect-single-label"},[e._v("\n "+e._s(e.internalValue[e.label])+"\n ")])],{value:e.internalValue})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",[n("div",{staticClass:"multiselect-multiple-label"},[e._v("\n "+e._s(e.multipleLabelText)+"\n ")])],{values:e.internalValue})]:e._e(),e._v(" "),"tags"!==e.mode&&e.searchable&&!e.disabled?[n("div",{staticClass:"multiselect-search"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],ref:"input",domProps:{value:e.search},on:{focus:function(t){return t.stopPropagation(),e.open(t)},blur:function(t){return t.stopPropagation(),e.close(t)},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),e.handleEsc(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),e.selectPointer(t))}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.handleSearchBackspace(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),e.forwardPointer(t))}],input:function(t){t.target.composing||(e.search=t.target.value)}}})])]:e._e(),e._v(" "),"tags"==e.mode?[n("div",{staticClass:"multiselect-tags"},[e._l(e.internalValue,(function(t,a,l){return n("span",{key:l},[e._t("tag",[n("div",{staticClass:"multiselect-tag"},[e._v("\n "+e._s(t[e.label])+"\n "),e.disabled?e._e():n("i",{on:{click:function(e){e.preventDefault()},mousedown:function(n){return n.preventDefault(),e.remove(t)}}})])],{option:t,remove:e.remove,disabled:e.disabled})],2)})),e._v(" "),e.searchable&&!e.disabled?n("div",{staticClass:"multiselect-search",style:{width:e.tagsSearchWidth}},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],ref:"input",style:{width:e.tagsSearchWidth},domProps:{value:e.search},on:{focus:function(t){return t.stopPropagation(),e.open(t)},blur:function(t){return t.stopPropagation(),e.close(t)},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),e.handleEsc(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),e.selectPointer(t))}],keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.handleSearchBackspace(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),e.backwardPointer(t))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),e.forwardPointer(t))}],input:function(t){t.target.composing||(e.search=t.target.value)}}})]):e._e()],2)]:e._e(),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.placeholder&&!e.hasSelected&&!e.search,expression:"placeholder && !hasSelected && !search"}],staticClass:"multiselect-placeholder"},[e._v("\n "+e._s(e.placeholder)+"\n ")]),e._v(" "),n("transition",{attrs:{name:"multiselect-loading"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.busy,expression:"busy"}],staticClass:"multiselect-spinner"})])],2),e._v(" "),n("transition",{attrs:{name:"multiselect"},on:{"after-leave":e.clearSearch}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.isOpen,expression:"isOpen"}],staticClass:"multiselect-options",style:{maxHeight:e.contentMaxHeight}},[e._t("beforelist"),e._v(" "),e._l(e.filteredOptions,(function(t,a,l){return n("a",{key:l,staticClass:"multiselect-option",class:{"is-pointed":e.isPointed(t),"is-selected":e.isSelected(t),"is-disabled":e.isDisabled(t)},attrs:{href:""},on:{mousedown:function(e){e.preventDefault()},mouseenter:function(n){return e.setPointer(t)},click:function(n){return n.stopPropagation(),n.preventDefault(),e.handleOptionClick(t)}}},[e._t("option",[n("span",[e._v(e._s(t[e.label]))])],{option:t,search:e.search})],2)})),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.noOptions,expression:"noOptions"}]},[e._t("nooptions",[n("div",{staticClass:"multiselect-no-options"},[e._v(e._s(e.noOptionsText))])])],2),e._v(" "),n("span",{directives:[{name:"show",rawName:"v-show",value:e.noResults,expression:"noResults"}]},[e._t("noresults",[n("div",{staticClass:"multiselect-no-results"},[e._v(e._s(e.noResultsText))])])],2),e._v(" "),e._t("afterlist")],2)])],1)};f._withStripped=!0;const y=v({render:f,staticRenderFns:[]},undefined,p,undefined,false,undefined,!1,void 0,void 0,void 0);export default y;
{
"name": "@vueform/multiselect",
"version": "1.2.1",
"version": "1.2.2",
"private": false,

@@ -5,0 +5,0 @@ "description": "Vue 3 multiselect component with single select, multiselect and tagging options.",

@@ -66,3 +66,3 @@ <div align="center">

Check out our [demo](https://jsfiddle.net/z35wmd6u/).
Check out our [demo](https://jsfiddle.net/wLxfv2p5/).

@@ -149,2 +149,3 @@ ## Installation

| --- | --- | --- | --- |
| **canDeselect** | `boolean` | `true` | Whether a selected option can be deselected when using `single` mode. |
| **clearOnSearch** | `boolean` | `false` | Whether the option list should be cleared when a new character is typed before loading new options list, when using async options. |

@@ -186,2 +187,4 @@ | **clearOnSelect** | `boolean` | `true` | Whether the option list should be cleared upon selecting an option when using async options. |

> Note: we don't use camelCase because they are [normalized back to lowercase](https://github.com/vuejs/vue/issues/9449#issuecomment-461170017) when written in DOM.
## Examples

@@ -208,3 +211,3 @@

[JSFiddle - Example #1](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #1](https://jsfiddle.net/wLxfv2p5/)

@@ -225,3 +228,3 @@ ### Multiselect with object options

[JSFiddle - Example #2](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #2](https://jsfiddle.net/wLxfv2p5/)

@@ -242,3 +245,3 @@ ### Multiselect with disabled options

[JSFiddle - Example #3](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #3](https://jsfiddle.net/wLxfv2p5/)

@@ -261,3 +264,3 @@ ### Tags with search, create and array of objects options

[JSFiddle - Example #4](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #4](https://jsfiddle.net/wLxfv2p5/)

@@ -281,3 +284,3 @@ ### Autocomplete with async options

[JSFiddle - Example #5](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #5](https://jsfiddle.net/wLxfv2p5/)

@@ -302,3 +305,3 @@ ### Tags with async options

[JSFiddle - Example #6](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #6](https://jsfiddle.net/wLxfv2p5/)

@@ -331,3 +334,3 @@ ### Select with custom options slot

[JSFiddle - Example #7](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #7](https://jsfiddle.net/wLxfv2p5/)

@@ -356,3 +359,3 @@ ### Multiselect with custom label slot

[JSFiddle - Example #8](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #8](https://jsfiddle.net/wLxfv2p5/)

@@ -420,3 +423,3 @@ ### Tags with custom tags slot

[JSFiddle - Example #9](https://jsfiddle.net/z35wmd6u/)
[JSFiddle - Example #9](https://jsfiddle.net/wLxfv2p5/)

@@ -423,0 +426,0 @@ ## About Vueform

@@ -11,3 +11,4 @@ import { ref, toRefs, computed, watch } from 'composition-api'

appendNewTag, multipleLabel, object, loading, delay, resolveOnLoad,
minChars, filterResults, clearOnSearch, clearOnSelect, valueProp } = toRefs(props)
minChars, filterResults, clearOnSearch, clearOnSelect, valueProp,
canDeselect } = toRefs(props)

@@ -216,3 +217,5 @@ // ============ DEPENDENCIES ============

if (isSelected(option)) {
deselect(option)
if (canDeselect.value) {
deselect(option)
}
return

@@ -285,2 +288,9 @@ }

// no export
const initInternalValue = () => {
if (!isNullish(externalValue.value)) {
internalValue.value = makeInternal(externalValue.value)
}
}
// no export
const resolveOptions = () => {

@@ -293,5 +303,3 @@ resolving.value = true

if (!isNullish(externalValue.value)) {
internalValue.value = makeInternal(externalValue.value)
}
initInternalValue()
})

@@ -324,2 +332,4 @@ }

resolveOptions()
} else if (object.value == true) {
initInternalValue()
}

@@ -330,5 +340,3 @@ }

if (!isNullish(externalValue.value)) {
internalValue.value = makeInternal(externalValue.value)
}
initInternalValue()
}

@@ -335,0 +343,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc