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.2 to 1.2.3

7

CHANGELOG.md

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

## v1.2.3
> `2020-12-29`
### 🐞 Bug Fixes
- `v-model` deep sync
## v1.2.2

@@ -2,0 +9,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=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);
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=re(M.value))},ae=function(e){R.value=!0,c.value(q.value).then((function(t){A.value=t,R.value=!1,e()}))},re=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?ae(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=re(e);else switch(s.value){case"single":(b.value?e[N.value]!=P.value[N.value]:e!=P.value[N.value])&&(P.value=re(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=re(e))}}),{deep:!0}),{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)}},resolveOptions:ae}}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:void 0!==l.expose?r:a}}(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 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;
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=oe(C.value))},ie=function(e){K.value=!0,o.value(E.value).then((function(l){N.value=l,K.value=!1,e()}))},oe=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?ie(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=oe(e);else switch(c.value){case"single":(b.value?e[T.value]!=A.value[T.value]:e!=A.value[T.value])&&(A.value=oe(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=oe(e))}}),{deep:!0}),{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)}},resolveOptions:ie}}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(t,n){var a=e(t),u=a.value,r=a.modelValue,i=a.mode;return{internalValue:l("single"!==i.value?[]:{}),externalValue:void 0!==n.expose?r:u}}(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=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);
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=ue(V.value))},le=function(e){j.value=!0,c.value(T.value).then((function(t){N.value=t,j.value=!1,e()}))},ue=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?le(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=ue(e);else switch(s.value){case"single":(g.value?e[C.value]!=q.value[C.value]:e!=q.value[C.value])&&(q.value=ue(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=ue(e))}}),{deep:!0}),{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)}},resolveOptions:le}}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:void 0!==n.expose?u:l}}(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,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;
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=oe(D.value))},ie=function(e){U.value=!0,v.value(E.value).then((function(t){H.value=t,U.value=!1,e()}))},oe=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?ie(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=oe(e);else switch(p.value){case"single":(_.value?e[V.value]!=T.value[V.value]:e!=T.value[V.value])&&(T.value=oe(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=oe(e))}}),{deep:!0}),{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)}},resolveOptions:ie}}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(n,a){var l=e(n),u=l.value,r=l.modelValue,i=l.mode;return{internalValue:t("single"!==i.value?[]:{}),externalValue:void 0!==a.expose?r:u}}(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.2",
"version": "1.2.3",
"private": false,

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

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

<a href="https://discord.gg/vYAyYmqJ" target="_blank">
<a href="https://discord.gg/WhX2nG6GTQ" target="_blank">
<img alt="Discord" src="https://img.shields.io/discord/787237947635793940">

@@ -120,3 +120,3 @@ </a>

Join our [Discord channel](https://discord.gg/vYAyYmqJ) or [open an issue](https://github.com/vueform/multiselect/issues).
Join our [Discord channel](https://discord.gg/WhX2nG6GTQ) or [open an issue](https://github.com/vueform/multiselect/issues).

@@ -123,0 +123,0 @@ ## Basic props

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

// no export
const resolveOptions = () => {
const resolveOptions = (callback) => {
resolving.value = true

@@ -301,3 +300,3 @@

initInternalValue()
callback()
})

@@ -329,3 +328,3 @@ }

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

@@ -391,3 +390,3 @@ initInternalValue()

}
})
}, { deep: true })

@@ -410,3 +409,4 @@ return {

handleOptionClick,
resolveOptions,
}
}

@@ -14,5 +14,3 @@ import { computed, toRefs, ref } from 'composition-api'

/* istanbul ignore next */
const externalValue = computed(() => {
return context.expose !== undefined ? modelValue.value : value.value
})
const externalValue = context.expose !== undefined ? modelValue : value

@@ -19,0 +17,0 @@ return {

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