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.1.0 to 1.1.1

src/index.js

7

CHANGELOG.md

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

## v1.1.1
> `2020-12-19`
### 🐞 Bug Fixes
- RuntimeRegenerator added to esm builds
## v1.1.0

@@ -2,0 +9,0 @@

2

dist/multiselect.js

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

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

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

function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?e(Object(a),!0).forEach((function(e){n(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}import{toRefs as r,ref as a,computed as l,watch as u,nextTick as i}from"@vue/composition-api";function o(e){return String(e).toLowerCase().trim()}function c(e,t,n,r,a,l,u){try{var i=e[l](u),o=i.value}catch(e){return void n(e)}i.done?t(o):Promise.resolve(o).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var l=e.apply(t,n);function u(e){c(l,r,a,u,i,"next",e)}function i(e){c(l,r,a,u,i,"throw",e)}u(void 0)}))}}function d(e){return(d="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 v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t,n){var i,c=r(e),p=c.options,f=c.mode,y=c.trackBy,m=c.limit,h=c.hideSelectedTag,b=c.createTag,g=c.label,k=c.appendNewTag,O=c.multipleLabel,w=c.object,_=c.loading,x=c.delay,S=c.resolveOnLoad,P=c.minChars,C=c.filterResults,q=c.clearOnSearch,j=c.clearOnSelect,V=n.internalValue,T=n.externalValue,E=n.search,B=n.blurSearch,D=n.clearSearch,A=n.update,R=n.blurInput,N=a([]),L=a([]),I=a(!1),H=l((function(){var e,t=L.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var n,r=t[e];return v(n={value:e},y.value,r),v(n,g.value,r),n}))),t=t.map((function(e,t){var n;return"object"===d(e)?e:(v(n={value:t},y.value,e),v(n,g.value,e),n)})),N.value.length&&(t=t.concat(N.value)),t})),U=l((function(){var e=H.value;return X.value.length&&(e=X.value.concat(e)),E.value&&C.value&&(e=e.filter((function(e){return-1!==o(e[y.value]).indexOf(o(E.value))}))),h.value&&(e=e.filter((function(e){return!re(e)}))),m.value>0&&(e=e.slice(0,m.value)),e})),$=l((function(){switch(f.value){case"single":return!G.value;case"multiple":case"tags":return!G.value&&V.value.length>0}})),F=l((function(){return void 0!==O&&void 0!==O.value?O.value(V.value):V.value&&V.value.length>1?"".concat(V.value.length," options selected"):"1 option selected"})),M=l((function(){return!H.value.length})),W=l((function(){return H.value.length>0&&0==U.value.length})),X=l((function(){var e;return!1!==b.value&&E.value?-1!==ne(E.value)?[]:[(e={},v(e,g.value,E.value),v(e,y.value,E.value),v(e,"value",E.value),e)]:[]})),z=l((function(){switch(f.value){case"single":return null;case"multiple":case"tags":return[]}})),G=l((function(){return-1!==[null,void 0,!1].indexOf(V.value)})),J=l((function(){return _.value||I.value})),K=function(e){switch("object"!==d(e)&&(e=te(e)),f.value){case"single":A(e);break;case"multiple":case"tags":A((V.value||[]).concat(e))}t.emit("select",Y(e))},Q=function(e){switch("object"!==d(e)&&(e=te(e)),f.value){case"single":Z();break;case"tags":case"multiple":A(V.value.filter((function(t){return t.value!=e.value})))}t.emit("deselect",Y(e))},Y=function(e){return w.value?e:e.value},Z=function(e){A(z.value)},ee=function(e){switch(f.value){case"single":return!G.value&&V.value.value==e.value;case"tags":case"multiple":return!G.value&&-1!==V.value.map((function(e){return e.value})).indexOf(e.value)}},te=function(e){return H.value[H.value.map((function(e){return e.value})).indexOf(e)]},ne=function(e){return H.value.map((function(e){return o(e[y.value])})).indexOf(o(e))},re=function(e){return"tags"===f.value&&h.value&&ee(e)},ae=function(e){N.value.push(e)},le=function(){var e=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.value=!0,e.next=3,p.value(E.value);case 3:L.value=e.sent,I.value=!1;case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if("single"!==f.value&&-1===[null,void 0,!1].indexOf(T.value)&&!Array.isArray(T.value))throw new Error('v-model must be an array when using "'.concat(f.value,'" mode'));return p&&"function"==typeof p.value?S.value&&le():L.value=p&&p.value?p.value:[],-1===[null,!1,void 0].indexOf(T.value)&&(V.value=(i=T.value,w.value?i:Array.isArray(i)?i.map((function(e){return te(e)})):te(i))),x.value>-1&&u(E,(function(e){e.length<P.value||(q.value&&(L.value=[]),setTimeout(s(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e==E.value){t.next=2;break}return t.abrupt("return");case 2:return I.value=!0,t.next=5,p.value(E.value);case 5:n=t.sent,e==E.value&&(L.value=n),I.value=!1;case 8:case"end":return t.stop()}}),t)}))),x.value))}),{flush:"sync"}),{filteredOptions:U,hasSelected:$,multipleLabelText:F,extendedOptions:H,noOptions:M,noResults:W,busy:J,select:K,deselect:Q,remove:function(e){Q(e)},clear:Z,isSelected:ee,getOption:te,handleOptionClick:function(e){switch(f.value){case"single":if(ee(e))return void Q(e);Z(),K(e),B(),R();break;case"multiple":if(ee(e))return void Q(e);K(e),j.value&&D();break;case"tags":if(ee(e))return void Q(e);void 0===te(e.value)&&b.value&&(t.emit("tag",e.value),k.value&&ae(e),D()),j.value&&D(),K(e)}}}}function f(e){return function(e){if(Array.isArray(e))return y(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 y(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 y(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 y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,a,l,u,i,o,c){"boolean"!=typeof u&&(o=i,i=u,u=!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,a&&(d.functional=!0)),r&&(d._scopeId=r),l?(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(l)},d._ssrRegister=s):t&&(s=u?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 p=d.beforeCreate;d.beforeCreate=p?[].concat(p,s):[s]}return n}var h={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue"],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"},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},hideSelectedTag:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0}},setup:function(e,n){var o,c,s,d,v,y=function(e,t){var n=r(e),u=n.value,i=n.modelValue,o=n.mode;return{internalValue:a("single"!==o.value?[]:null),externalValue:l((function(){return void 0!==t.expose?i.value:u.value}))}}(e,n),m=function(e,t,n){var a=r(e).object,l=n.internalValue,u=function(e){return a.value||-1!==[null,!1,void 0].indexOf(e)?e:Array.isArray(e)?e.map((function(e){return e.value})):e.value};return{update:function(e){l.value=e,t.emit("input",u(e)),t.emit("update:modelValue",u(e))}}}(e,n,{internalValue:y.internalValue}),h=function(e,t,n){var i=r(e),o=i.searchable,c=i.mode,s=n.internalValue,d=a(null),v=a(null),p=l((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 u(d,(function(e){t.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()}}}(e,n,{internalValue:y.internalValue}),b=function(e,t,n){var u=r(e),i=u.maxHeight,o=u.disabled,c=a(!1),s=l((function(){return"".concat(i.value,"px")}));return{isOpen:c,contentMaxHeight:s,open:function(){o.value||(c.value=!0,t.emit("open"))},close:function(){c.value=!1,t.emit("close")}}}(e,n),g=function(e,t,n){var u=r(e),i=u.searchable,o=u.id;return{multiselect:a(null),tabindex:l((function(){return i.value?-1:0})),blurInput:function(){document.getElementById(o.value).querySelector(".multiselect-input").blur()}}}(e),k=p(e,n,{externalValue:y.externalValue,internalValue:y.internalValue,search:h.search,blurSearch:h.blurSearch,clearSearch:h.clearSearch,update:m.update,blurInput:g.blurInput}),O=function(e,t,n){var l=r(e).id,o=n.filteredOptions,c=n.handleOptionClick,s=n.search,d=a(null),v=function(e){d.value=e},p=function(){d.value=o.value[0]||null},f=function(){d.value=null},y=function(){var e=document.getElementById(l.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 u(s,(function(e){p()})),{pointer:d,isPointed:function(e){return!!d.value&&d.value.value==e.value},setPointer:v,setPointerFirst:p,clearPointer:f,selectPointer:function(){d.value&&(c(d.value),f())},forwardPointer:function(e){if(null===d.value)v(o.value[0]);else{var t=o.value.map((function(e){return e.value})).indexOf(d.value.value)+1;o.value.length<=t&&(t=0),v(o.value[t])}i((function(){y()}))},backwardPointer:function(){if(null===d.value)v(o.value[o.value.length-1]);else{var e=o.value.map((function(e){return e.value})).indexOf(d.value.value)-1;e<0&&(e=o.value.length-1),v(o.value[e])}i((function(){y()}))}}}(e,0,{filteredOptions:k.filteredOptions,handleOptionClick:k.handleOptionClick,search:h.search}),w=(o={internalValue:y.internalValue,update:m.update,close:b.close,clearPointer:O.clearPointer},c=o.internalValue,s=o.update,d=o.close,v=o.clearPointer,{handleBackspace:function(e){s(f(c.value).slice(0,-1))},handleEsc:function(e){d(),v(),e.target.blur()}});return t(t(t(t(t(t(t(t({},y),m),h),b),g),k),O),w)}},b=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,r,a){return n("span",{key:a},[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,r,a){return n("a",{key:a,staticClass:"multiselect-option",class:{"is-pointed":e.isPointed(t),"is-selected":e.isSelected(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)};b._withStripped=!0;var g=m({render:b,staticRenderFns:[]},undefined,h,undefined,false,undefined,!1,void 0,void 0,void 0);export default g;
import e from"@babel/runtime/regenerator";import t from"@babel/runtime/helpers/typeof";function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function a(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?n(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):n(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}import{toRefs as l,ref as u,computed as i,watch as o,nextTick as c}from"@vue/composition-api";function s(e){return String(e).toLowerCase().trim()}function d(e,t,n,a,r,l,u){try{var i=e[l](u),o=i.value}catch(e){return void n(e)}i.done?t(o):Promise.resolve(o).then(a,r)}function v(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var l=e.apply(t,n);function u(e){d(l,a,r,u,i,"next",e)}function i(e){d(l,a,r,u,i,"throw",e)}u(void 0)}))}}function p(e){return(p="function"==typeof Symbol&&"symbol"==t(Symbol.iterator)?function(e){return t(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":t(e)})(e)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(t,n,a){var r,c=l(t),d=c.options,y=c.mode,m=c.trackBy,h=c.limit,b=c.hideSelectedTag,g=c.createTag,k=c.label,O=c.appendNewTag,w=c.multipleLabel,_=c.object,x=c.loading,S=c.delay,P=c.resolveOnLoad,C=c.minChars,q=c.filterResults,j=c.clearOnSearch,T=c.clearOnSelect,V=a.internalValue,E=a.externalValue,B=a.search,D=a.blurSearch,A=a.clearSearch,N=a.update,R=a.blurInput,L=u([]),I=u([]),H=u(!1),U=i((function(){var e,t=I.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var n,a=t[e];return f(n={value:e},m.value,a),f(n,k.value,a),n}))),t=t.map((function(e,t){var n;return"object"===p(e)?e:(f(n={value:t},m.value,e),f(n,k.value,e),n)})),L.value.length&&(t=t.concat(L.value)),t})),$=i((function(){var e=U.value;return z.value.length&&(e=z.value.concat(e)),B.value&&q.value&&(e=e.filter((function(e){return-1!==s(e[m.value]).indexOf(s(B.value))}))),b.value&&(e=e.filter((function(e){return!re(e)}))),h.value>0&&(e=e.slice(0,h.value)),e})),F=i((function(){switch(y.value){case"single":return!J.value;case"multiple":case"tags":return!J.value&&V.value.length>0}})),M=i((function(){return void 0!==w&&void 0!==w.value?w.value(V.value):V.value&&V.value.length>1?"".concat(V.value.length," options selected"):"1 option selected"})),W=i((function(){return!U.value.length})),X=i((function(){return U.value.length>0&&0==$.value.length})),z=i((function(){var e;return!1!==g.value&&B.value?-1!==ae(B.value)?[]:[(e={},f(e,k.value,B.value),f(e,m.value,B.value),f(e,"value",B.value),e)]:[]})),G=i((function(){switch(y.value){case"single":return null;case"multiple":case"tags":return[]}})),J=i((function(){return-1!==[null,void 0,!1].indexOf(V.value)})),K=i((function(){return x.value||H.value})),Q=function(e){switch("object"!==p(e)&&(e=ne(e)),y.value){case"single":N(e);break;case"multiple":case"tags":N((V.value||[]).concat(e))}n.emit("select",Z(e))},Y=function(e){switch("object"!==p(e)&&(e=ne(e)),y.value){case"single":ee();break;case"tags":case"multiple":N(V.value.filter((function(t){return t.value!=e.value})))}n.emit("deselect",Z(e))},Z=function(e){return _.value?e:e.value},ee=function(e){N(G.value)},te=function(e){switch(y.value){case"single":return!J.value&&V.value.value==e.value;case"tags":case"multiple":return!J.value&&-1!==V.value.map((function(e){return e.value})).indexOf(e.value)}},ne=function(e){return U.value[U.value.map((function(e){return e.value})).indexOf(e)]},ae=function(e){return U.value.map((function(e){return s(e[m.value])})).indexOf(s(e))},re=function(e){return"tags"===y.value&&b.value&&te(e)},le=function(){var t=v(e.mark((function t(){return e.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return H.value=!0,e.next=3,d.value(B.value);case 3:I.value=e.sent,H.value=!1;case 5:case"end":return e.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();if("single"!==y.value&&-1===[null,void 0,!1].indexOf(E.value)&&!Array.isArray(E.value))throw new Error('v-model must be an array when using "'.concat(y.value,'" mode'));return d&&"function"==typeof d.value?P.value&&le():I.value=d&&d.value?d.value:[],-1===[null,!1,void 0].indexOf(E.value)&&(V.value=(r=E.value,_.value?r:Array.isArray(r)?r.map((function(e){return ne(e)})):ne(r))),S.value>-1&&o(B,(function(t){t.length<C.value||(j.value&&(I.value=[]),setTimeout(v(e.mark((function n(){var a;return e.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t==B.value){e.next=2;break}return e.abrupt("return");case 2:return H.value=!0,e.next=5,d.value(B.value);case 5:a=e.sent,t==B.value&&(I.value=a),H.value=!1;case 8:case"end":return e.stop()}}),n)}))),S.value))}),{flush:"sync"}),{filteredOptions:$,hasSelected:F,multipleLabelText:M,extendedOptions:U,noOptions:W,noResults:X,busy:K,select:Q,deselect:Y,remove:function(e){Y(e)},clear:ee,isSelected:te,getOption:ne,handleOptionClick:function(e){switch(y.value){case"single":if(te(e))return void Y(e);ee(),Q(e),D(),R();break;case"multiple":if(te(e))return void Y(e);Q(e),T.value&&A();break;case"tags":if(te(e))return void Y(e);void 0===ne(e.value)&&g.value&&(n.emit("tag",e.value),O.value&&function(e){L.value.push(e)}(e),A()),T.value&&A(),Q(e)}}}}function m(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(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 h(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}var b={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue"],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"},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},hideSelectedTag:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0}},setup:function(e,t){var n,r,s,d,v,p=function(e,t){var n=l(e),a=n.value,r=n.modelValue,o=n.mode;return{internalValue:u("single"!==o.value?[]:null),externalValue:i((function(){return void 0!==t.expose?r.value:a.value}))}}(e,t),f=function(e,t,n){var a=l(e).object,r=n.internalValue,u=function(e){return a.value||-1!==[null,!1,void 0].indexOf(e)?e:Array.isArray(e)?e.map((function(e){return e.value})):e.value};return{update:function(e){r.value=e,t.emit("input",u(e)),t.emit("update:modelValue",u(e))}}}(e,t,{internalValue:p.internalValue}),h=function(e,t,n){var a=l(e),r=a.searchable,c=a.mode,s=n.internalValue,d=u(null),v=u(null),p=i((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 o(d,(function(e){t.emit("search-change",e)})),{search:d,input:v,tagsSearchWidth:p,clearSearch:function(){d.value=""},blurSearch:function(){r.value&&v.value.blur()},handleSearchBackspace:function(e){""!==d.value&&e.stopPropagation()}}}(e,t,{internalValue:p.internalValue}),b=function(e,t,n){var a=l(e),r=a.maxHeight,o=a.disabled,c=u(!1),s=i((function(){return"".concat(r.value,"px")}));return{isOpen:c,contentMaxHeight:s,open:function(){o.value||(c.value=!0,t.emit("open"))},close:function(){c.value=!1,t.emit("close")}}}(e,t),g=function(e,t,n){var a=l(e),r=a.searchable,o=a.id;return{multiselect:u(null),tabindex:i((function(){return r.value?-1:0})),blurInput:function(){document.getElementById(o.value).querySelector(".multiselect-input").blur()}}}(e),k=y(e,t,{externalValue:p.externalValue,internalValue:p.internalValue,search:h.search,blurSearch:h.blurSearch,clearSearch:h.clearSearch,update:f.update,blurInput:g.blurInput}),O=function(e,t,n){var a=l(e).id,r=n.filteredOptions,i=n.handleOptionClick,s=n.search,d=u(null),v=function(e){d.value=e},p=function(){d.value=r.value[0]||null},f=function(){d.value=null},y=function(){var e=document.getElementById(a.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 o(s,(function(e){p()})),{pointer:d,isPointed:function(e){return!!d.value&&d.value.value==e.value},setPointer:v,setPointerFirst:p,clearPointer:f,selectPointer:function(){d.value&&(i(d.value),f())},forwardPointer:function(e){if(null===d.value)v(r.value[0]);else{var t=r.value.map((function(e){return e.value})).indexOf(d.value.value)+1;r.value.length<=t&&(t=0),v(r.value[t])}c((function(){y()}))},backwardPointer:function(){if(null===d.value)v(r.value[r.value.length-1]);else{var e=r.value.map((function(e){return e.value})).indexOf(d.value.value)-1;e<0&&(e=r.value.length-1),v(r.value[e])}c((function(){y()}))}}}(e,0,{filteredOptions:k.filteredOptions,handleOptionClick:k.handleOptionClick,search:h.search}),w=(n={internalValue:p.internalValue,update:f.update,close:b.close,clearPointer:O.clearPointer},r=n.internalValue,s=n.update,d=n.close,v=n.clearPointer,{handleBackspace:function(e){s(m(r.value).slice(0,-1))},handleEsc:function(e){d(),v(),e.target.blur()}});return a(a(a(a(a(a(a(a({},p),f),h),b),g),k),O),w)}},g=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,r){return n("span",{key:r},[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,r){return n("a",{key:r,staticClass:"multiselect-option",class:{"is-pointed":e.isPointed(t),"is-selected":e.isSelected(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)};g._withStripped=!0;var k=function(e,t,n,a,r,l,u,i,o,c){"boolean"!=typeof u&&(o=i,i=u,u=!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,r&&(d.functional=!0)),a&&(d._scopeId=a),l?(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(l)},d._ssrRegister=s):t&&(s=u?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 p=d.beforeCreate;d.beforeCreate=p?[].concat(p,s):[s]}return n}({render:g,staticRenderFns:[]},void 0,b,void 0,!1,void 0,!1,void 0,void 0,void 0);export default k;

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

!function(e,t){if("function"==typeof define&&define.amd)define("VueFormMultiselect",["exports","composition-api"],t);else if("undefined"!=typeof exports)t(exports,require("composition-api"));else{var n={exports:{}};t(n.exports,e.VueCompositionAPI),e.VueFormMultiselect=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e,t){function n(e){return(n="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){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return 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 String(e).toLowerCase().trim()}function o(e,t,n,r,a,l,u){try{var o=e[l](u),i=o.value}catch(e){return void n(e)}o.done?t(i):Promise.resolve(i).then(r,a)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var l=e.apply(t,n);function u(e){o(l,r,a,u,i,"next",e)}function i(e){o(l,r,a,u,i,"throw",e)}u(void 0)}))}}function c(e){return(c="function"==typeof Symbol&&"symbol"==n(Symbol.iterator)?function(e){return n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)})(e)}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,n,r){var a,l=(0,t.toRefs)(e),o=l.options,d=l.mode,f=l.trackBy,p=l.limit,v=l.hideSelectedTag,y=l.createTag,m=l.label,h=l.appendNewTag,b=l.multipleLabel,g=l.object,k=l.loading,O=l.delay,w=l.resolveOnLoad,_=l.minChars,x=l.filterResults,S=l.clearOnSearch,P=l.clearOnSelect,C=r.internalValue,q=r.externalValue,T=r.search,V=r.blurSearch,j=r.clearSearch,E=r.update,R=r.blurInput,B=(0,t.ref)([]),D=(0,t.ref)([]),A=(0,t.ref)(!1),N=(0,t.computed)((function(){var e,t=D.value||[];return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(t=Object.keys(t).map((function(e){var n,r=t[e];return s(n={value:e},f.value,r),s(n,m.value,r),n}))),t=t.map((function(e,t){var n;return"object"===c(e)?e:(s(n={value:t},f.value,e),s(n,m.value,e),n)})),B.value.length&&(t=t.concat(B.value)),t})),I=(0,t.computed)((function(){var e=N.value;return $.value.length&&(e=$.value.concat(e)),T.value&&x.value&&(e=e.filter((function(e){return-1!==u(e[f.value]).indexOf(u(T.value))}))),v.value&&(e=e.filter((function(e){return!ee(e)}))),p.value>0&&(e=e.slice(0,p.value)),e})),L=(0,t.computed)((function(){switch(d.value){case"single":return!W.value;case"multiple":case"tags":return!W.value&&C.value.length>0}})),H=(0,t.computed)((function(){return void 0!==b&&void 0!==b.value?b.value(C.value):C.value&&C.value.length>1?"".concat(C.value.length," options selected"):"1 option selected"})),U=(0,t.computed)((function(){return!N.value.length})),F=(0,t.computed)((function(){return N.value.length>0&&0==I.value.length})),$=(0,t.computed)((function(){var e;return!1!==y.value&&T.value?-1!==Z(T.value)?[]:[(e={},s(e,m.value,T.value),s(e,f.value,T.value),s(e,"value",T.value),e)]:[]})),M=(0,t.computed)((function(){switch(d.value){case"single":return null;case"multiple":case"tags":return[]}})),W=(0,t.computed)((function(){return-1!==[null,void 0,!1].indexOf(C.value)})),X=(0,t.computed)((function(){return k.value||A.value})),z=function(e){switch("object"!==c(e)&&(e=Y(e)),d.value){case"single":E(e);break;case"multiple":case"tags":E((C.value||[]).concat(e))}n.emit("select",J(e))},G=function(e){switch("object"!==c(e)&&(e=Y(e)),d.value){case"single":K();break;case"tags":case"multiple":E(C.value.filter((function(t){return t.value!=e.value})))}n.emit("deselect",J(e))},J=function(e){return g.value?e:e.value},K=function(e){E(M.value)},Q=function(e){switch(d.value){case"single":return!W.value&&C.value.value==e.value;case"tags":case"multiple":return!W.value&&-1!==C.value.map((function(e){return e.value})).indexOf(e.value)}},Y=function(e){return N.value[N.value.map((function(e){return e.value})).indexOf(e)]},Z=function(e){return N.value.map((function(e){return u(e[f.value])})).indexOf(u(e))},ee=function(e){return"tags"===d.value&&v.value&&Q(e)},te=function(){var e=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return A.value=!0,e.next=3,o.value(T.value);case 3:D.value=e.sent,A.value=!1;case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if("single"!==d.value&&-1===[null,void 0,!1].indexOf(q.value)&&!Array.isArray(q.value))throw new Error('v-model must be an array when using "'.concat(d.value,'" mode'));return o&&"function"==typeof o.value?w.value&&te():D.value=o&&o.value?o.value:[],-1===[null,!1,void 0].indexOf(q.value)&&(C.value=(a=q.value,g.value?a:Array.isArray(a)?a.map((function(e){return Y(e)})):Y(a))),O.value>-1&&(0,t.watch)(T,(function(e){e.length<_.value||(S.value&&(D.value=[]),setTimeout(i(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e==T.value){t.next=2;break}return t.abrupt("return");case 2:return A.value=!0,t.next=5,o.value(T.value);case 5:n=t.sent,e==T.value&&(D.value=n),A.value=!1;case 8:case"end":return t.stop()}}),t)}))),O.value))}),{flush:"sync"}),{filteredOptions:I,hasSelected:L,multipleLabelText:H,extendedOptions:N,noOptions:U,noResults:F,busy:X,select:z,deselect:G,remove:function(e){G(e)},clear:K,isSelected:Q,getOption:Y,handleOptionClick:function(e){switch(d.value){case"single":if(Q(e))return void G(e);K(),z(e),V(),R();break;case"multiple":if(Q(e))return void G(e);z(e),P.value&&j();break;case"tags":if(Q(e))return void G(e);void 0===Y(e.value)&&y.value&&(n.emit("tag",e.value),h.value&&function(e){B.value.push(e)}(e),j()),P.value&&j(),z(e)}}}}function f(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(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 p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var v={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue"],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"},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},hideSelectedTag:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0}},setup:function(e,n){var r,l,u,o,i,c=function(e,n){var r=(0,t.toRefs)(e),a=r.value,l=r.modelValue,u=r.mode;return{internalValue:(0,t.ref)("single"!==u.value?[]:null),externalValue:(0,t.computed)((function(){return void 0!==n.expose?l.value:a.value}))}}(e,n),s=function(e,n,r){var a=(0,t.toRefs)(e).object,l=r.internalValue,u=function(e){return a.value||-1!==[null,!1,void 0].indexOf(e)?e:Array.isArray(e)?e.map((function(e){return e.value})):e.value};return{update:function(e){l.value=e,n.emit("input",u(e)),n.emit("update:modelValue",u(e))}}}(e,n,{internalValue:c.internalValue}),p=function(e,n,r){var a=(0,t.toRefs)(e),l=a.searchable,u=a.mode,o=r.internalValue,i=(0,t.ref)(null),c=(0,t.ref)(null),s=(0,t.computed)((function(){return i.value?"".concat(i.value.length,"ch"):"tags"===u.value&&-1===[null,void 0].indexOf(o.value)&&o.value.length?"1ch":"100%"}));return(0,t.watch)(i,(function(e){n.emit("search-change",e)})),{search:i,input:c,tagsSearchWidth:s,clearSearch:function(){i.value=""},blurSearch:function(){l.value&&c.value.blur()},handleSearchBackspace:function(e){""!==i.value&&e.stopPropagation()}}}(e,n,{internalValue:c.internalValue}),v=function(e,n,r){var a=(0,t.toRefs)(e),l=a.maxHeight,u=a.disabled,o=(0,t.ref)(!1),i=(0,t.computed)((function(){return"".concat(l.value,"px")}));return{isOpen:o,contentMaxHeight:i,open:function(){u.value||(o.value=!0,n.emit("open"))},close:function(){o.value=!1,n.emit("close")}}}(e,n),y=function(e,n,r){var a=(0,t.toRefs)(e),l=a.searchable,u=a.id;return{multiselect:(0,t.ref)(null),tabindex:(0,t.computed)((function(){return l.value?-1:0})),blurInput:function(){document.getElementById(u.value).querySelector(".multiselect-input").blur()}}}(e),m=d(e,n,{externalValue:c.externalValue,internalValue:c.internalValue,search:p.search,blurSearch:p.blurSearch,clearSearch:p.clearSearch,update:s.update,blurInput:y.blurInput}),h=function(e,n,r){var a=(0,t.toRefs)(e).id,l=r.filteredOptions,u=r.handleOptionClick,o=r.search,i=(0,t.ref)(null),c=function(e){i.value=e},s=function(){i.value=l.value[0]||null},d=function(){i.value=null},f=function(){var e=document.getElementById(a.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(0,t.watch)(o,(function(e){s()})),{pointer:i,isPointed:function(e){return!!i.value&&i.value.value==e.value},setPointer:c,setPointerFirst:s,clearPointer:d,selectPointer:function(){i.value&&(u(i.value),d())},forwardPointer:function(e){if(null===i.value)c(l.value[0]);else{var n=l.value.map((function(e){return e.value})).indexOf(i.value.value)+1;l.value.length<=n&&(n=0),c(l.value[n])}(0,t.nextTick)((function(){f()}))},backwardPointer:function(){if(null===i.value)c(l.value[l.value.length-1]);else{var e=l.value.map((function(e){return e.value})).indexOf(i.value.value)-1;e<0&&(e=l.value.length-1),c(l.value[e])}(0,t.nextTick)((function(){f()}))}}}(e,0,{filteredOptions:m.filteredOptions,handleOptionClick:m.handleOptionClick,search:p.search}),b=(r={internalValue:c.internalValue,update:s.update,close:v.close,clearPointer:h.clearPointer},l=r.internalValue,u=r.update,o=r.close,i=r.clearPointer,{handleBackspace:function(e){u(f(l.value).slice(0,-1))},handleEsc:function(e){o(),i(),e.target.blur()}});return a(a(a(a(a(a(a(a({},c),s),p),v),y),m),h),b)}},y=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,r,a){return n("span",{key:a},[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,r,a){return n("a",{key:a,staticClass:"multiselect-option",class:{"is-pointed":e.isPointed(t),"is-selected":e.isSelected(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)};y._withStripped=!0;var m=function(e,t,n,r,a,l,u,o,i,c){"boolean"!=typeof u&&(i=o,o=u,u=!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,a&&(d.functional=!0)),r&&(d._scopeId=r),l?(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,i(e)),e&&e._registeredComponents&&e._registeredComponents.add(l)},d._ssrRegister=s):t&&(s=u?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,o(e))}),s)if(d.functional){var f=d.render;d.render=function(e,t){return s.call(t),f(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,s):[s]}return n}({render:y,staticRenderFns:[]},void 0,v,void 0,!1,void 0,!1,void 0,void 0,void 0);e.default=m}));
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define("VueFormMultiselect", ["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.VueFormMultiselect = mod.exports;
}
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.default = void 0;
function n(n, e, r, t, o, u, i) {
try {
var a = n[u](i),
c = a.value;
} catch (n) {
return void r(n);
}
a.done ? e(c) : Promise.resolve(c).then(t, o);
}
var e = function () {
var e,
r = (e = regeneratorRuntime.mark(function n() {
return regeneratorRuntime.wrap(function (n) {
for (;;) {
switch (n.prev = n.next) {
case 0:
return n.next = 2, new Promise(function (n, e) {
setTimeout(function () {
alert("Hello");
}, 100);
});
case 2:
return n.abrupt("return", n.sent);
case 3:
case "end":
return n.stop();
}
}
}, n);
}), function () {
var r = this,
t = arguments;
return new Promise(function (o, u) {
var i = e.apply(r, t);
function a(e) {
n(i, o, u, a, c, "next", e);
}
function c(e) {
n(i, o, u, a, c, "throw", e);
}
a(void 0);
});
});
return function () {
return r.apply(this, arguments);
};
}();
var _default = e;
_exports.default = _default;
});
{
"name": "@vueform/multiselect",
"version": "1.1.0",
"version": "1.1.1",
"private": false,

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

<div align="center">
<img alt="CircleCI" src="https://img.shields.io/circleci/build/github/vueform/multiselect">
<a href="https://codecov.io/gh/vueform/multiselect" target="_blank">

@@ -7,3 +8,5 @@ <img src="https://img.shields.io/codecov/c/github/vueform/multiselect"/>

<img alt="npm bundle size (scoped version)" src="https://img.shields.io/bundlephobia/minzip/@vueform/multiselect/1.0.1?color=53ca2f">
<a href="https://www.npmjs.com/package/@vueform/multiselect" target="_blank">
<img alt="npm bundle size (scoped version)" src="https://img.shields.io/bundlephobia/minzip/@vueform/multiselect?color=53ca2f">
</a>

@@ -18,3 +21,5 @@ <a href="https://github.com/vueform/multiselect/blob/main/LICENSE.md" target="_blank">

<img alt="npm" src="https://img.shields.io/npm/v/@vueform/multiselect">
<a href="https://www.npmjs.com/package/@vueform/multiselect" target="_blank">
<img alt="npm" src="https://img.shields.io/npm/v/@vueform/multiselect">
</a>

@@ -24,6 +29,10 @@ <h1>Vue 3 multiselect by <a href="https://vueform.com?r=github" target="_blank">Vueform</a></h1>

<a href="https://vueform.com" target="_blank">
<img align="center" src="https://github.com/vueform/multiselect/raw/main//assets/logo.svg" width="120">
<br>
<img align="center" src="https://github.com/vueform/multiselect/raw/main//assets/logo.svg" width="110">
<br>
</a>
<br>
<br>
<a href="https://www.npmjs.com/package/@vueform/multiselect" target="_blank">

@@ -43,3 +52,3 @@ <img align="center" src="https://github.com/vueform/multiselect/raw/main//assets/screenshot.png">

* No dependencies
* Lightweight (~4.5 kB gzipped)
* Lightweight (~5 kB gzipped)
* 100% coverage

@@ -46,0 +55,0 @@ * ESM support

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