@vueform/multiselect
Advanced tools
Comparing version 2.5.6 to 2.5.7
@@ -0,1 +1,14 @@ | ||
## v2.5.7 | ||
> `2022-11-21` | ||
### 🎉 Feature | ||
- **BREAKING**: added a wrapper `div` and related classes inside the main container next to the dropdown container. | ||
- Accessibility improvements. | ||
### 🐞 Bug Fixes | ||
- Don't select new tag on IME enter #226. | ||
- Removed `v-html` from option & single label for XSS security #278. | ||
- Arrow left should not throw error when not using tags #271. | ||
## v2.5.6 | ||
@@ -2,0 +15,0 @@ |
@@ -1,1 +0,1 @@ | ||
var VueformMultiselect=function(e){"use strict";function a(e){return-1!==[null,void 0].indexOf(e)}function l(l,t,n){const{object:u,valueProp:r,mode:i}=e.toRefs(l),o=e.getCurrentInstance().proxy,s=n.iv,c=e=>u.value||a(e)?e:Array.isArray(e)?e.map((e=>e[r.value])):e[r.value],d=e=>a(e)?"single"===i.value?{}:[]:e;return{update:e=>{s.value=d(e);const a=c(e);t.emit("change",a,o),t.emit("input",a),t.emit("update:modelValue",a)}}}function t(a,l){const{value:t,modelValue:n,mode:u,valueProp:r}=e.toRefs(a),i=e.ref("single"!==u.value?[]:{}),o=n&&void 0!==n.value?n:t,s=e.computed((()=>"single"===u.value?i.value[r.value]:i.value.map((e=>e[r.value])))),c=e.computed((()=>"single"!==u.value?i.value.map((e=>e[r.value])).join(","):i.value[r.value]));return{iv:i,internalValue:i,ev:o,externalValue:o,textValue:c,plainValue:s}}function n(a,l,t){const{regex:n}=e.toRefs(a),u=e.getCurrentInstance().proxy,r=t.isOpen,i=t.open,o=e.ref(null),s=e.ref(null);return e.watch(o,(e=>{!r.value&&e&&i(),l.emit("search-change",e,u)})),{search:o,input:s,clearSearch:()=>{o.value=""},handleSearchInput:e=>{o.value=e.target.value},handleKeypress:e=>{if(n&&n.value){let a=n.value;"string"==typeof a&&(a=new RegExp(a)),e.key.match(a)||e.preventDefault()}},handlePaste:e=>{if(n&&n.value){let a=(e.clipboardData||window.clipboardData).getData("Text"),l=n.value;"string"==typeof l&&(l=new RegExp(l)),a.split("").every((e=>!!e.match(l)))||e.preventDefault()}l.emit("paste",e,u)}}}function u(a,l,t){const{groupSelect:n,mode:u,groups:r,disabledProp:i}=e.toRefs(a),o=e.ref(null),s=e=>{void 0===e||null!==e&&e[i.value]||r.value&&e&&e.group&&("single"===u.value||!n.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:()=>{s(null)}}}function r(e,a=!0){return a?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}function i(l,t,n){const{options:u,mode:i,trackBy:o,limit:s,hideSelected:c,createTag:d,createOption:v,label:p,appendNewTag:m,appendNewOption:f,multipleLabel:g,object:h,loading:b,delay:y,resolveOnLoad:S,minChars:k,filterResults:L,clearOnSearch:O,clearOnSelect:C,valueProp:w,canDeselect:E,max:T,strict:V,closeOnSelect:x,groups:B,reverse:q,infinite:P,groupOptions:N,groupHideEmpty:_,groupSelect:I,onCreate:R,disabledProp:D,searchStart:M}=e.toRefs(l),A=e.getCurrentInstance().proxy,z=n.iv,j=n.ev,H=n.search,K=n.clearSearch,$=n.update,F=n.pointer,G=n.clearPointer,W=n.focus,U=n.deactivate,J=n.close,Q=e.ref([]),X=e.ref([]),Y=e.ref(!1),Z=e.ref(null),ee=e.ref(P.value&&-1===s.value?10:s.value),ae=e.computed((()=>d.value||v.value||!1)),le=e.computed((()=>void 0!==m.value?m.value:void 0===f.value||f.value)),te=e.computed((()=>{if(B.value){let e=X.value||[],a=[];return e.forEach((e=>{Pe(e[N.value]).forEach((l=>{a.push(Object.assign({},l,e[D.value]?{[D.value]:!0}:{}))}))})),a}{let e=Pe(X.value||[]);return Q.value.length&&(e=e.concat(Q.value)),e}})),ne=e.computed((()=>B.value?Be((X.value||[]).map(((e,a)=>{const l=Pe(e[N.value]);return{...e,index:a,group:!0,[N.value]:qe(l,!1).map((a=>Object.assign({},a,e[D.value]?{[D.value]:!0}:{}))),__VISIBLE__:qe(l).map((a=>Object.assign({},a,e[D.value]?{[D.value]:!0}:{})))}}))):[])),ue=e.computed((()=>{let e=te.value;return q.value&&(e=e.reverse()),de.value.length&&(e=de.value.concat(e)),qe(e)})),re=e.computed((()=>{let e=ue.value;return ee.value>0&&(e=e.slice(0,ee.value)),e})),ie=e.computed((()=>{switch(i.value){case"single":return!a(z.value[w.value]);case"multiple":case"tags":return!a(z.value)&&z.value.length>0}})),oe=e.computed((()=>void 0!==g&&void 0!==g.value?g.value(z.value,A):z.value&&z.value.length>1?`${z.value.length} options selected`:"1 option selected")),se=e.computed((()=>!te.value.length&&!Y.value&&!de.value.length)),ce=e.computed((()=>te.value.length>0&&0==re.value.length&&(H.value&&B.value||!B.value))),de=e.computed((()=>!1!==ae.value&&H.value?-1!==Ve(H.value)?[]:[{[w.value]:H.value,[p.value]:H.value,[ve.value]:H.value,__CREATE__:!0}]:[])),ve=e.computed((()=>o.value||p.value)),pe=e.computed((()=>{switch(i.value){case"single":return null;case"multiple":case"tags":return[]}})),me=e.computed((()=>b.value||Y.value)),fe=e=>{switch("object"!=typeof e&&(e=Te(e)),i.value){case"single":$(e);break;case"multiple":case"tags":$(z.value.concat(e))}t.emit("select",he(e),e,A)},ge=e=>{switch("object"!=typeof e&&(e=Te(e)),i.value){case"single":ye();break;case"tags":case"multiple":$(Array.isArray(e)?z.value.filter((a=>-1===e.map((e=>e[w.value])).indexOf(a[w.value]))):z.value.filter((a=>a[w.value]!=e[w.value])))}t.emit("deselect",he(e),e,A)},he=e=>h.value?e:e[w.value],be=e=>{ge(e)},ye=()=>{t.emit("clear",A),$(pe.value)},Se=e=>{if(void 0!==e.group)return"single"!==i.value&&(Ee(e[N.value])&&e[N.value].length);switch(i.value){case"single":return!a(z.value)&&z.value[w.value]==e[w.value];case"tags":case"multiple":return!a(z.value)&&-1!==z.value.map((e=>e[w.value])).indexOf(e[w.value])}},ke=e=>!0===e[D.value],Le=()=>!(void 0===T||-1===T.value||!ie.value&&T.value>0)&&z.value.length>=T.value,Oe=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,i.value){case"single":if(e&&Se(e))return void(E.value&&ge(e));e&&Ce(e),C.value&&K(),x.value&&(G(),J()),e&&fe(e);break;case"multiple":if(e&&Se(e))return void ge(e);if(Le())return;e&&(Ce(e),fe(e)),C.value&&K(),c.value&&G(),x.value&&J();break;case"tags":if(e&&Se(e))return void ge(e);if(Le())return;e&&Ce(e),C.value&&K(),e&&fe(e),c.value&&G(),x.value&&J()}x.value||W()},Ce=e=>{void 0===Te(e[w.value])&&ae.value&&(t.emit("tag",e[w.value],A),t.emit("option",e[w.value],A),le.value&&xe(e),K())},we=e=>void 0===e.find((e=>!Se(e)&&!e[D.value])),Ee=e=>void 0===e.find((e=>!Se(e))),Te=e=>te.value[te.value.map((e=>String(e[w.value]))).indexOf(String(e))],Ve=(e,a=!0)=>te.value.map((e=>parseInt(e[ve.value])==e[ve.value]?parseInt(e[ve.value]):e[ve.value])).indexOf(parseInt(e)==e?parseInt(e):e),xe=e=>{Q.value.push(e)},Be=e=>_.value?e.filter((e=>H.value?e.__VISIBLE__.length:e[N.value].length)):e.filter((e=>!H.value||e.__VISIBLE__.length)),qe=(e,a=!0)=>{let l=e;return H.value&&L.value&&(l=l.filter((e=>M.value?r(e[ve.value],V.value).startsWith(r(H.value,V.value)):-1!==r(e[ve.value],V.value).indexOf(r(H.value,V.value))))),c.value&&a&&(l=l.filter((e=>!(e=>-1!==["tags","multiple"].indexOf(i.value)&&c.value&&Se(e))(e)))),l},Pe=e=>{let a=e;var l;return l=a,"[object Object]"===Object.prototype.toString.call(l)&&(a=Object.keys(a).map((e=>{let l=a[e];return{[w.value]:e,[ve.value]:l,[p.value]:l}}))),a=a.map((e=>"object"==typeof e?e:{[w.value]:e,[ve.value]:e,[p.value]:e})),a},Ne=()=>{a(j.value)||(z.value=Re(j.value))},_e=e=>(Y.value=!0,new Promise(((a,l)=>{u.value(H.value,A).then((a=>{X.value=a||[],"function"==typeof e&&e(a),Y.value=!1})).catch((e=>{console.error(e),X.value=[],Y.value=!1})).finally((()=>{a()}))}))),Ie=()=>{if(ie.value)if("single"===i.value){let e=Te(z.value[w.value]);if(void 0!==e){let a=e[p.value];z.value[p.value]=a,h.value&&(j.value[p.value]=a)}}else z.value.forEach(((e,a)=>{let l=Te(z.value[a][w.value]);if(void 0!==l){let e=l[p.value];z.value[a][p.value]=e,h.value&&(j.value[a][p.value]=e)}}))},Re=e=>a(e)?"single"===i.value?{}:[]:h.value?e:"single"===i.value?Te(e)||{}:e.filter((e=>!!Te(e))).map((e=>Te(e))),De=()=>{Z.value=e.watch(H,(e=>{e.length<k.value||!e&&0!==k.value||(Y.value=!0,O.value&&(X.value=[]),setTimeout((()=>{e==H.value&&u.value(H.value,A).then((a=>{e!=H.value&&H.value||(X.value=a,F.value=re.value.filter((e=>!0!==e[D.value]))[0]||null,Y.value=!1)})).catch((e=>{console.error(e)}))}),y.value))}),{flush:"sync"})};if("single"!==i.value&&!a(j.value)&&!Array.isArray(j.value))throw new Error(`v-model must be an array when using "${i.value}" mode`);return u&&"function"==typeof u.value?S.value?_e(Ne):1==h.value&&Ne():(X.value=u.value,Ne()),y.value>-1&&De(),e.watch(y,((e,a)=>{Z.value&&Z.value(),e>=0&&De()})),e.watch(j,(e=>{if(a(e))z.value=Re(e);else switch(i.value){case"single":(h.value?e[w.value]!=z.value[w.value]:e!=z.value[w.value])&&(z.value=Re(e));break;case"multiple":case"tags":(function(e,a){const l=a.slice().sort();return e.length===a.length&&e.slice().sort().every((function(e,a){return e===l[a]}))})(h.value?e.map((e=>e[w.value])):e,z.value.map((e=>e[w.value])))||(z.value=Re(e))}}),{deep:!0}),e.watch(u,((e,a)=>{"function"==typeof l.options?S.value&&(!a||e&&e.toString()!==a.toString())&&_e():(X.value=l.options,Object.keys(z.value).length||Ne(),Ie())})),e.watch(p,Ie),{pfo:ue,fo:re,filteredOptions:re,hasSelected:ie,multipleLabelText:oe,eo:te,extendedOptions:te,fg:ne,filteredGroups:ne,noOptions:se,noResults:ce,resolving:Y,busy:me,offset:ee,select:fe,deselect:ge,remove:be,selectAll:()=>{"single"!==i.value&&fe(re.value)},clear:ye,isSelected:Se,isDisabled:ke,isMax:Le,getOption:Te,handleOptionClick:e=>{if(!ke(e))return R&&R.value&&!Se(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=R.value(e,A))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Oe(e)}))):void Oe(e)},handleGroupClick:e=>{if(!ke(e)&&"single"!==i.value&&I.value){switch(i.value){case"multiple":case"tags":we(e[N.value])?ge(e[N.value]):fe(e[N.value].filter((e=>-1===z.value.map((e=>e[w.value])).indexOf(e[w.value]))).filter((e=>!e[D.value])).filter(((e,a)=>z.value.length+1+a<=T.value||-1===T.value)))}x.value&&U()}},handleTagRemove:(e,a)=>{0===a.button?be(e):a.preventDefault()},refreshOptions:e=>{_e(e)},resolveOptions:_e,refreshLabels:Ie}}function o(a,l,t){const{valueProp:n,showOptions:u,searchable:r,groupLabel:i,groups:o,mode:s,groupSelect:c,disabledProp:d}=e.toRefs(a),v=t.fo,p=t.fg,m=t.handleOptionClick,f=t.handleGroupClick,g=t.search,h=t.pointer,b=t.setPointer,y=t.clearPointer,S=t.multiselect,k=t.isOpen,L=e.computed((()=>v.value.filter((e=>!e[d.value])))),O=e.computed((()=>p.value.filter((e=>!e[d.value])))),C=e.computed((()=>"single"!==s.value&&c.value)),w=e.computed((()=>h.value&&h.value.group)),E=e.computed((()=>R(h.value))),T=e.computed((()=>{const e=w.value?h.value:R(h.value),a=O.value.map((e=>e[i.value])).indexOf(e[i.value]);let l=O.value[a-1];return void 0===l&&(l=x.value),l})),V=e.computed((()=>{let e=O.value.map((e=>e.label)).indexOf(w.value?h.value[i.value]:R(h.value)[i.value])+1;return O.value.length<=e&&(e=0),O.value[e]})),x=e.computed((()=>[...O.value].slice(-1)[0])),B=e.computed((()=>h.value.__VISIBLE__.filter((e=>!e[d.value]))[0])),q=e.computed((()=>{const e=E.value.__VISIBLE__.filter((e=>!e[d.value]));return e[e.map((e=>e[n.value])).indexOf(h.value[n.value])-1]})),P=e.computed((()=>{const e=R(h.value).__VISIBLE__.filter((e=>!e[d.value]));return e[e.map((e=>e[n.value])).indexOf(h.value[n.value])+1]})),N=e.computed((()=>[...T.value.__VISIBLE__.filter((e=>!e[d.value]))].slice(-1)[0])),_=e.computed((()=>[...x.value.__VISIBLE__.filter((e=>!e[d.value]))].slice(-1)[0])),I=()=>{b(L.value[0]||null)},R=e=>O.value.find((a=>-1!==a.__VISIBLE__.map((e=>e[n.value])).indexOf(e[n.value]))),D=()=>{let e=S.value.querySelector("[data-pointed]");if(!e)return;let a=e.parentElement.parentElement;o.value&&(a=w.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>a.clientHeight+a.scrollTop&&(a.scrollTop=e.offsetTop+e.offsetHeight-a.clientHeight),e.offsetTop<a.scrollTop&&(a.scrollTop=e.offsetTop)};return e.watch(g,(e=>{r.value&&(e.length&&u.value?I():y())})),e.watch(k,(a=>{if(a){let a=S.value.querySelectorAll("[data-selected]")[0];if(!a)return;let l=a.parentElement.parentElement;e.nextTick((()=>{l.scrollTop>0||(l.scrollTop=a.offsetTop)}))}})),{pointer:h,canPointGroups:C,isPointed:e=>!(!h.value||!(!e.group&&h.value[n.value]==e[n.value]||void 0!==e.group&&h.value[i.value]==e[i.value]))||void 0,setPointerFirst:I,selectPointer:()=>{h.value&&!0!==h.value[d.value]&&(w.value?f(h.value):m(h.value))},forwardPointer:()=>{if(null===h.value)b((o.value&&C.value?O.value[0]:L.value[0])||null);else if(o.value&&C.value){let e=w.value?B.value:P.value;void 0===e&&(e=V.value),b(e||null)}else{let e=L.value.map((e=>e[n.value])).indexOf(h.value[n.value])+1;L.value.length<=e&&(e=0),b(L.value[e]||null)}e.nextTick((()=>{D()}))},backwardPointer:()=>{if(null===h.value){let e=L.value[L.value.length-1];o.value&&C.value&&(e=_.value,void 0===e&&(e=x.value)),b(e||null)}else if(o.value&&C.value){let e=w.value?N.value:q.value;void 0===e&&(e=w.value?T.value:E.value),b(e||null)}else{let e=L.value.map((e=>e[n.value])).indexOf(h.value[n.value])-1;e<0&&(e=L.value.length-1),b(L.value[e]||null)}e.nextTick((()=>{D()}))}}}function s(a,l,t){const{disabled:n}=e.toRefs(a),u=e.getCurrentInstance().proxy,r=e.ref(!1);return{isOpen:r,open:()=>{r.value||n.value||(r.value=!0,l.emit("open",u))},close:()=>{r.value&&(r.value=!1,l.emit("close",u))}}}function c(a,l,t){const{searchable:n,disabled:u}=e.toRefs(a),r=t.input,i=t.open,o=t.close,s=t.clearSearch,c=t.isOpen,d=e.ref(null),v=e.ref(null),p=e.ref(!1),m=e.ref(!1),f=e.computed((()=>n.value||u.value?-1:0)),g=()=>{n.value&&r.value.blur(),d.value.blur()},h=(e=!0)=>{u.value||(p.value=!0,e&&i())},b=()=>{p.value=!1,setTimeout((()=>{p.value||(o(),s())}),1)};return{multiselect:d,tags:v,tabindex:f,isActive:p,mouseClicked:m,blur:g,focus:()=>{n.value&&!u.value&&r.value.focus()},activate:h,deactivate:b,handleFocusIn:()=>{h(m.value)},handleFocusOut:()=>{b()},handleCaretClick:()=>{b(),g()},handleMousedown:e=>{m.value=!0,c.value&&(e.target.isEqualNode(d.value)||e.target.isEqualNode(v.value))?setTimeout((()=>{b()}),0):document.activeElement.isEqualNode(d.value)&&!c.value&&h(),setTimeout((()=>{m.value=!1}),0)}}}function d(a,l,t){const{mode:n,addTagOn:u,openDirection:r,searchable:i,showOptions:o,valueProp:s,groups:c,addOptionOn:d,createTag:v,createOption:p,reverse:m}=e.toRefs(a),f=e.getCurrentInstance().proxy,g=t.iv,h=t.update,b=t.search,y=t.setPointer,S=t.selectPointer,k=t.backwardPointer,L=t.forwardPointer,O=t.multiselect,C=t.tags,w=t.isOpen,E=t.open,T=t.blur,V=t.fo,x=e.computed((()=>v.value||p.value||!1)),B=e.computed((()=>void 0!==u.value?u.value:void 0!==d.value?d.value:["enter"])),q=()=>{"tags"===n.value&&!o.value&&x.value&&i.value&&!c.value&&y(V.value[V.value.map((e=>e[s.value])).indexOf(b.value)])};return{handleKeydown:e=>{let a,t;switch(l.emit("keydown",e,f),-1!==["ArrowLeft","ArrowRight","Enter"].indexOf(e.key)&&"tags"===n.value&&(a=[...O.value.querySelectorAll("[data-tags] > *")].filter((e=>e!==C.value)),t=a.findIndex((e=>e===document.activeElement))),e.key){case"Backspace":if("single"===n.value)return;if(i.value&&-1===[null,""].indexOf(b.value))return;if(0===g.value.length)return;h([...g.value].slice(0,-1));break;case"Enter":if(e.preventDefault(),-1!==t&&void 0!==t)return h([...g.value].filter(((e,a)=>a!==t))),void(t===a.length-1&&(a.length-1?a[a.length-2].focus():i.value?C.value.querySelector("input").focus():O.value.focus()));if(-1===B.value.indexOf("enter")&&x.value)return;q(),S();break;case" ":if(!x.value&&!i.value)return e.preventDefault(),q(),void S();if(!x.value)return!1;if(-1===B.value.indexOf("space")&&x.value)return;e.preventDefault(),q(),S();break;case"Tab":case";":case",":if(-1===B.value.indexOf(e.key.toLowerCase())||!x.value)return;q(),S(),e.preventDefault();break;case"Escape":T();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;w.value||E(),k();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;w.value||E(),L();break;case"ArrowLeft":if(i.value&&C.value.querySelector("input").selectionStart||e.shiftKey||"tags"!==n.value||!g.value||!g.value.length)return;e.preventDefault(),-1===t?a[a.length-1].focus():t>0&&a[t-1].focus();break;case"ArrowRight":if(-1===t||e.shiftKey||"tags"!==n.value||!g.value||!g.value.length)return;e.preventDefault(),a.length>t+1?a[t+1].focus():i.value?C.value.querySelector("input").focus():i.value||O.value.focus()}},handleKeyup:e=>{l.emit("keyup",e,f)},preparePointer:q}}function v(a,l,t){const{classes:n,disabled:u,openDirection:r,showOptions:i}=e.toRefs(a),o=t.isOpen,s=t.isPointed,c=t.isSelected,d=t.isDisabled,v=t.isActive,p=t.canPointGroups,m=t.resolving,f=t.fo,g=e.computed((()=>({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",singleLabel:"multiselect-single-label",singleLabelText:"multiselect-single-label-text",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",inifinite:"multiselect-inifite",inifiniteSpinner:"multiselect-inifite-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",spacer:"multiselect-spacer",...n.value}))),h=e.computed((()=>!!(o.value&&i.value&&(!m.value||m.value&&f.value.length))));return{classList:e.computed((()=>{const e=g.value;return{container:[e.container].concat(u.value?e.containerDisabled:[]).concat(h.value&&"top"===r.value?e.containerOpenTop:[]).concat(h.value&&"top"!==r.value?e.containerOpen:[]).concat(v.value?e.containerActive:[]),spacer:e.spacer,singleLabel:e.singleLabel,singleLabelText:e.singleLabelText,multipleLabel:e.multipleLabel,search:e.search,tags:e.tags,tag:[e.tag].concat(u.value?e.tagDisabled:[]),tagRemove:e.tagRemove,tagRemoveIcon:e.tagRemoveIcon,tagsSearchWrapper:e.tagsSearchWrapper,tagsSearch:e.tagsSearch,tagsSearchCopy:e.tagsSearchCopy,placeholder:e.placeholder,caret:[e.caret].concat(o.value?e.caretOpen:[]),clear:e.clear,clearIcon:e.clearIcon,spinner:e.spinner,inifinite:e.inifinite,inifiniteSpinner:e.inifiniteSpinner,dropdown:[e.dropdown].concat("top"===r.value?e.dropdownTop:[]).concat(o.value&&i.value&&h.value?[]:e.dropdownHidden),options:[e.options].concat("top"===r.value?e.optionsTop:[]),group:e.group,groupLabel:a=>{let l=[e.groupLabel];return s(a)?l.push(c(a)?e.groupLabelSelectedPointed:e.groupLabelPointed):c(a)&&p.value?l.push(d(a)?e.groupLabelSelectedDisabled:e.groupLabelSelected):d(a)&&l.push(e.groupLabelDisabled),p.value&&l.push(e.groupLabelPointable),l},groupOptions:e.groupOptions,option:(a,l)=>{let t=[e.option];return s(a)?t.push(c(a)?e.optionSelectedPointed:e.optionPointed):c(a)?t.push(d(a)?e.optionSelectedDisabled:e.optionSelected):(d(a)||l&&d(l))&&t.push(e.optionDisabled),t},noOptions:e.noOptions,noResults:e.noResults,fakeInput:e.fakeInput}})),showDropdown:h}}function p(a,l,t){const{limit:n,infinite:u}=e.toRefs(a),r=t.isOpen,i=t.offset,o=t.search,s=t.pfo,c=t.eo,d=e.ref(null),v=e.ref(null),p=e.computed((()=>i.value<s.value.length)),m=a=>{const{isIntersecting:l,target:t}=a[0];if(l){const a=t.offsetParent,l=a.scrollTop;i.value+=-1==n.value?10:n.value,e.nextTick((()=>{a.scrollTop=l}))}},f=()=>{r.value&&i.value<s.value.length?d.value.observe(v.value):!r.value&&d.value&&d.value.disconnect()};return e.watch(r,(()=>{u.value&&f()})),e.watch(o,(()=>{u.value&&(i.value=n.value,f())}),{flush:"post"}),e.watch(c,(()=>{u.value&&f()}),{immediate:!1,flush:"post"}),e.onMounted((()=>{window&&window.IntersectionObserver&&(d.value=new IntersectionObserver(m))})),{hasMore:p,infiniteLoader:v}}function m(a,l,t){const{placeholder:n,id:u,valueProp:r,label:i,mode:o,groupLabel:s}=e.toRefs(a),c=t.pointer;t.iv,t.hasSelected,t.multipleLabelText,t.isOpen;const d=e.ref(null),v=e.computed((()=>{let e=[];return u&&u.value&&e.push(u.value),e.push("multiselect-options"),e.join("-")})),p=e.computed((()=>{let e=[];if(u&&u.value&&e.push(u.value),c.value)return e.push(c.value.group?"multiselect-group":"multiselect-option"),e.push(c.value.group?c.value.index:c.value[r.value]),e.join("-")})),m=e.computed((()=>n.value)),f=e.computed((()=>"single"!==o.value));return e.onMounted((()=>{if(u&&u.value&&document&&document.querySelector){let e=document.querySelector(`[for="${u.value}"]`);d.value=e?e.innerText:null}})),{ariaOwns:v,ariaPlaceholder:m,ariaMultiselectable:f,ariaActiveDescendant:p,ariaOptionId:e=>{let a=[];return u&&u.value&&a.push(u.value),a.push("multiselect-option"),a.push(e[r.value]),a.join("-")},ariaOptionLabel:e=>{let a=[];return a.push(e[i.value]),a.join(" ")},ariaGroupId:e=>{let a=[];return u&&u.value&&a.push(u.value),a.push("multiselect-group"),a.push(e.index),a.join("-")},ariaGroupLabel:e=>{let a=[];return a.push(e[s.value]),a.join(" ")},ariaTagLabel:e=>`${e} ❎`}}var f={name:"Multiselect",emits:["paste","open","close","select","deselect","input","search-change","tag","option","update:modelValue","change","clear","keydown","keyup"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},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:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"},attrs:{required:!1,type:Object,default:()=>({})},onCreate:{required:!1,type:Function},disabledProp:{type:String,required:!1,default:"disabled"},searchStart:{type:Boolean,required:!1,default:!1},reverse:{type:Boolean,required:!1,default:!1},regex:{type:[Object,String,RegExp],required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},infinite:{type:Boolean,required:!1,default:!1},aria:{required:!1,type:Object,default:()=>({})}},setup:(e,a)=>function(e,a,l,t={}){return l.forEach((l=>{l&&(t={...t,...l(e,a,t)})})),t}(e,a,[t,u,s,n,l,c,i,p,o,d,v,m])};const g=["tabindex","id","dir","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable","role"],h=["type","modelValue","value","autocomplete","id","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable"],b=["onKeyup","aria-label"],y=["onClick"],S=["type","modelValue","value","id","autocomplete","aria-owns","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable"],k=["innerHTML"],L=["innerHTML"],O=["id"],C=["id","aria-label","aria-selected"],w=["data-pointed","onMouseenter","onClick"],E=["innerHTML"],T=["aria-label"],V=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],x=["innerHTML"],B=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],q=["innerHTML"],P=["innerHTML"],N=["innerHTML"],_=["value"],I=["name","value"],R=["name","value"];return f.render=function(a,l,t,n,u,r){return e.openBlock(),e.createElementBlock("div",e.mergeProps({ref:"multiselect",tabindex:a.tabindex,class:a.classList.container,id:t.searchable?void 0:t.id,dir:t.rtl?"rtl":void 0,onFocusin:l[9]||(l[9]=(...e)=>a.handleFocusIn&&a.handleFocusIn(...e)),onFocusout:l[10]||(l[10]=(...e)=>a.handleFocusOut&&a.handleFocusOut(...e)),onKeydown:l[11]||(l[11]=(...e)=>a.handleKeydown&&a.handleKeydown(...e)),onKeyup:l[12]||(l[12]=(...e)=>a.handleKeyup&&a.handleKeyup(...e)),onMousedown:l[13]||(l[13]=(...e)=>a.handleMousedown&&a.handleMousedown(...e)),"aria-owns":t.searchable?void 0:a.ariaOwns,"aria-placeholder":t.searchable?void 0:a.ariaPlaceholder,"aria-expanded":t.searchable?void 0:a.isOpen,"aria-activedescendant":t.searchable?void 0:a.ariaActiveDescendant,"aria-multiselectable":t.searchable?void 0:a.ariaMultiselectable,role:t.searchable?void 0:"listbox"},t.searchable?{}:t.aria),[e.createCommentVNode(" Search "),"tags"!==t.mode&&t.searchable&&!t.disabled?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,type:t.inputType,modelValue:a.search,value:a.search,class:a.classList.search,autocomplete:t.autocomplete,id:t.searchable?t.id:void 0,onInput:l[0]||(l[0]=(...e)=>a.handleSearchInput&&a.handleSearchInput(...e)),onKeypress:l[1]||(l[1]=(...e)=>a.handleKeypress&&a.handleKeypress(...e)),onPaste:l[2]||(l[2]=e.withModifiers(((...e)=>a.handlePaste&&a.handlePaste(...e)),["stop"])),ref:"input","aria-owns":a.ariaOwns,"aria-placeholder":a.ariaPlaceholder,"aria-expanded":a.isOpen,"aria-activedescendant":a.ariaActiveDescendant,"aria-multiselectable":a.ariaMultiselectable,role:"listbox"},{...t.attrs,...t.aria}),null,16,h)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Tags (with search) "),"tags"==t.mode?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(a.classList.tags),"data-tags":""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.iv,((l,n,u)=>e.renderSlot(a.$slots,"tag",{option:l,handleTagRemove:a.handleTagRemove,disabled:t.disabled},(()=>[(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(a.classList.tag),tabindex:"-1",onKeyup:e.withKeys((e=>a.handleTagRemove(l,e)),["enter"]),key:u,"aria-label":a.ariaTagLabel(l[t.label])},[e.createTextVNode(e.toDisplayString(l[t.label])+" ",1),t.disabled?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(a.classList.tagRemove),onClick:e=>a.handleTagRemove(l,e)},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.tagRemoveIcon)},null,2)],10,y))],42,b))])))),256)),e.createElementVNode("div",{class:e.normalizeClass(a.classList.tagsSearchWrapper),ref:"tags"},[e.createCommentVNode(" Used for measuring search width "),e.createElementVNode("span",{class:e.normalizeClass(a.classList.tagsSearchCopy)},e.toDisplayString(a.search),3),e.createCommentVNode(" Actual search input "),t.searchable&&!t.disabled?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,type:t.inputType,modelValue:a.search,value:a.search,class:a.classList.tagsSearch,id:t.searchable?t.id:void 0,autocomplete:t.autocomplete,onInput:l[3]||(l[3]=(...e)=>a.handleSearchInput&&a.handleSearchInput(...e)),onKeypress:l[4]||(l[4]=(...e)=>a.handleKeypress&&a.handleKeypress(...e)),onPaste:l[5]||(l[5]=e.withModifiers(((...e)=>a.handlePaste&&a.handlePaste(...e)),["stop"])),ref:"input","aria-owns":a.ariaOwns,"aria-placeholder":a.ariaPlaceholder,"aria-expanded":a.isOpen,"aria-activedescendant":a.ariaActiveDescendant,"aria-multiselectable":a.ariaMultiselectable,role:"listbox"},{...t.attrs,...t.aria}),null,16,S)):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Single label "),"single"==t.mode&&a.hasSelected&&!a.search&&a.iv?e.renderSlot(a.$slots,"singlelabel",{key:2,value:a.iv},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.singleLabel),"aria-hidden":"true"},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.singleLabelText),innerHTML:a.iv[t.label]},null,10,k)],2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Multiple label "),"multiple"==t.mode&&a.hasSelected&&!a.search?e.renderSlot(a.$slots,"multiplelabel",{key:3,values:a.iv},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.multipleLabel),innerHTML:a.multipleLabelText,"aria-hidden":"true"},null,10,L)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Placeholder "),!t.placeholder||a.hasSelected||a.search?e.createCommentVNode("v-if",!0):e.renderSlot(a.$slots,"placeholder",{key:4},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.placeholder),"aria-hidden":"true"},e.toDisplayString(t.placeholder),3)])),e.createCommentVNode(" Spinner "),t.loading||a.resolving?e.renderSlot(a.$slots,"spinner",{key:5},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.spinner),"aria-hidden":"true"},null,2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Clear "),a.hasSelected&&!t.disabled&&t.canClear&&!a.busy?e.renderSlot(a.$slots,"clear",{key:6,clear:a.clear},(()=>[e.createElementVNode("span",{tabindex:"0",role:"button","aria-label":"❎",class:e.normalizeClass(a.classList.clear),onClick:l[6]||(l[6]=(...e)=>a.clear&&a.clear(...e)),onKeyup:l[7]||(l[7]=e.withKeys(((...e)=>a.clear&&a.clear(...e)),["enter"]))},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.clearIcon)},null,2)],34)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Caret "),t.caret&&t.showOptions?e.renderSlot(a.$slots,"caret",{key:7},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.caret),onClick:l[8]||(l[8]=(...e)=>a.handleCaretClick&&a.handleCaretClick(...e)),"aria-hidden":"true"},null,2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Options "),e.createElementVNode("div",{class:e.normalizeClass(a.classList.dropdown),tabindex:"-1"},[e.renderSlot(a.$slots,"beforelist",{options:a.fo}),e.createElementVNode("ul",{class:e.normalizeClass(a.classList.options),id:a.ariaOwns},[t.groups?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(a.fg,((l,n,u)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.group),key:u,id:a.ariaGroupId(l),"aria-label":a.ariaGroupLabel(l),"aria-selected":a.isSelected(l),role:"option"},[e.createElementVNode("div",{class:e.normalizeClass(a.classList.groupLabel(l)),"data-pointed":a.isPointed(l),onMouseenter:e=>a.setPointer(l,n),onClick:e=>a.handleGroupClick(l)},[e.renderSlot(a.$slots,"grouplabel",{group:l,isSelected:a.isSelected,isPointed:a.isPointed},(()=>[e.createElementVNode("span",{innerHTML:l[t.groupLabel]},null,8,E)]))],42,w),e.createElementVNode("ul",{class:e.normalizeClass(a.classList.groupOptions),"aria-label":a.ariaGroupLabel(l),role:"group"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.__VISIBLE__,((n,u,r)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.option(n,l)),"data-pointed":a.isPointed(n),"data-selected":a.isSelected(n)||void 0,key:r,onMouseenter:e=>a.setPointer(n),onClick:e=>a.handleOptionClick(n),id:a.ariaOptionId(n),"aria-selected":a.isSelected(n),"aria-label":a.ariaOptionLabel(n),role:"option"},[e.renderSlot(a.$slots,"option",{option:n,isSelected:a.isSelected,isPointed:a.isPointed,search:a.search},(()=>[e.createElementVNode("span",{innerHTML:n[t.label]},null,8,x)]))],42,V)))),128))],10,T)],10,C)))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.fo,((l,n,u)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.option(l)),"data-pointed":a.isPointed(l),"data-selected":a.isSelected(l)||void 0,key:u,onMouseenter:e=>a.setPointer(l),onClick:e=>a.handleOptionClick(l),id:a.ariaOptionId(l),"aria-selected":a.isSelected(l),"aria-label":a.ariaOptionLabel(l),role:"option"},[e.renderSlot(a.$slots,"option",{option:l,isSelected:a.isSelected,isPointed:a.isPointed,search:a.search},(()=>[e.createElementVNode("span",{innerHTML:l[t.label]},null,8,q)]))],42,B)))),128))],10,O),a.noOptions?e.renderSlot(a.$slots,"nooptions",{key:0},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.noOptions),innerHTML:t.noOptionsText},null,10,P)])):e.createCommentVNode("v-if",!0),a.noResults?e.renderSlot(a.$slots,"noresults",{key:1},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.noResults),innerHTML:t.noResultsText},null,10,N)])):e.createCommentVNode("v-if",!0),t.infinite&&a.hasMore?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(a.classList.inifinite),ref:"infiniteLoader"},[e.renderSlot(a.$slots,"infinite",{},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.inifiniteSpinner)},null,2)]))],2)):e.createCommentVNode("v-if",!0),e.renderSlot(a.$slots,"afterlist",{options:a.fo})],2),e.createCommentVNode(" Hacky input element to show HTML5 required warning "),t.required?(e.openBlock(),e.createElementBlock("input",{key:8,class:e.normalizeClass(a.classList.fakeInput),tabindex:"-1",value:a.textValue,required:""},null,10,_)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Native input support "),t.nativeSupport?(e.openBlock(),e.createElementBlock(e.Fragment,{key:9},["single"==t.mode?(e.openBlock(),e.createElementBlock("input",{key:0,type:"hidden",name:t.name,value:void 0!==a.plainValue?a.plainValue:""},null,8,I)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.plainValue,((a,l)=>(e.openBlock(),e.createElementBlock("input",{type:"hidden",name:`${t.name}[]`,value:a,key:l},null,8,R)))),128))],64)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Create height for empty input "),e.createElementVNode("div",{class:e.normalizeClass(a.classList.spacer)},null,2)],16,g)},f.__file="src/Multiselect.vue",f}(Vue); | ||
var VueformMultiselect=function(e){"use strict";function a(e){return-1!==[null,void 0].indexOf(e)}function l(l,t,r){const{object:u,valueProp:n,mode:i}=e.toRefs(l),o=e.getCurrentInstance().proxy,s=r.iv,c=e=>u.value||a(e)?e:Array.isArray(e)?e.map((e=>e[n.value])):e[n.value],d=e=>a(e)?"single"===i.value?{}:[]:e;return{update:e=>{s.value=d(e);const a=c(e);t.emit("change",a,o),t.emit("input",a),t.emit("update:modelValue",a)}}}function t(a,l){const{value:t,modelValue:r,mode:u,valueProp:n}=e.toRefs(a),i=e.ref("single"!==u.value?[]:{}),o=r&&void 0!==r.value?r:t,s=e.computed((()=>"single"===u.value?i.value[n.value]:i.value.map((e=>e[n.value])))),c=e.computed((()=>"single"!==u.value?i.value.map((e=>e[n.value])).join(","):i.value[n.value]));return{iv:i,internalValue:i,ev:o,externalValue:o,textValue:c,plainValue:s}}function r(a,l,t){const{regex:r}=e.toRefs(a),u=e.getCurrentInstance().proxy,n=t.isOpen,i=t.open,o=e.ref(null),s=e.ref(null);return e.watch(o,(e=>{!n.value&&e&&i(),l.emit("search-change",e,u)})),{search:o,input:s,clearSearch:()=>{o.value=""},handleSearchInput:e=>{o.value=e.target.value},handleKeypress:e=>{if(r&&r.value){let a=r.value;"string"==typeof a&&(a=new RegExp(a)),e.key.match(a)||e.preventDefault()}},handlePaste:e=>{if(r&&r.value){let a=(e.clipboardData||window.clipboardData).getData("Text"),l=r.value;"string"==typeof l&&(l=new RegExp(l)),a.split("").every((e=>!!e.match(l)))||e.preventDefault()}l.emit("paste",e,u)}}}function u(a,l,t){const{groupSelect:r,mode:u,groups:n,disabledProp:i}=e.toRefs(a),o=e.ref(null),s=e=>{void 0===e||null!==e&&e[i.value]||n.value&&e&&e.group&&("single"===u.value||!r.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:()=>{s(null)}}}function n(e,a=!0){return a?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}function i(l,t,r){const{options:u,mode:i,trackBy:o,limit:s,hideSelected:c,createTag:d,createOption:v,label:p,appendNewTag:m,appendNewOption:f,multipleLabel:g,object:h,loading:b,delay:y,resolveOnLoad:S,minChars:k,filterResults:C,clearOnSearch:L,clearOnSelect:O,valueProp:w,canDeselect:E,max:V,strict:x,closeOnSelect:B,groups:T,reverse:q,infinite:N,groupOptions:P,groupHideEmpty:_,groupSelect:I,onCreate:D,disabledProp:R,searchStart:A}=e.toRefs(l),M=e.getCurrentInstance().proxy,z=r.iv,j=r.ev,$=r.search,K=r.clearSearch,F=r.update,H=r.pointer,G=r.clearPointer,W=r.focus,U=r.deactivate,J=r.close,Q=e.ref([]),X=e.ref([]),Y=e.ref(!1),Z=e.ref(null),ee=e.ref(N.value&&-1===s.value?10:s.value),ae=e.computed((()=>d.value||v.value||!1)),le=e.computed((()=>void 0!==m.value?m.value:void 0===f.value||f.value)),te=e.computed((()=>{if(T.value){let e=X.value||[],a=[];return e.forEach((e=>{Ne(e[P.value]).forEach((l=>{a.push(Object.assign({},l,e[R.value]?{[R.value]:!0}:{}))}))})),a}{let e=Ne(X.value||[]);return Q.value.length&&(e=e.concat(Q.value)),e}})),re=e.computed((()=>T.value?Te((X.value||[]).map(((e,a)=>{const l=Ne(e[P.value]);return{...e,index:a,group:!0,[P.value]:qe(l,!1).map((a=>Object.assign({},a,e[R.value]?{[R.value]:!0}:{}))),__VISIBLE__:qe(l).map((a=>Object.assign({},a,e[R.value]?{[R.value]:!0}:{})))}}))):[])),ue=e.computed((()=>{let e=te.value;return q.value&&(e=e.reverse()),de.value.length&&(e=de.value.concat(e)),qe(e)})),ne=e.computed((()=>{let e=ue.value;return ee.value>0&&(e=e.slice(0,ee.value)),e})),ie=e.computed((()=>{switch(i.value){case"single":return!a(z.value[w.value]);case"multiple":case"tags":return!a(z.value)&&z.value.length>0}})),oe=e.computed((()=>void 0!==g&&void 0!==g.value?g.value(z.value,M):z.value&&z.value.length>1?`${z.value.length} options selected`:"1 option selected")),se=e.computed((()=>!te.value.length&&!Y.value&&!de.value.length)),ce=e.computed((()=>te.value.length>0&&0==ne.value.length&&($.value&&T.value||!T.value))),de=e.computed((()=>!1!==ae.value&&$.value?-1!==xe($.value)?[]:[{[w.value]:$.value,[p.value]:$.value,[ve.value]:$.value,__CREATE__:!0}]:[])),ve=e.computed((()=>o.value||p.value)),pe=e.computed((()=>{switch(i.value){case"single":return null;case"multiple":case"tags":return[]}})),me=e.computed((()=>b.value||Y.value)),fe=e=>{switch("object"!=typeof e&&(e=Ve(e)),i.value){case"single":F(e);break;case"multiple":case"tags":F(z.value.concat(e))}t.emit("select",he(e),e,M)},ge=e=>{switch("object"!=typeof e&&(e=Ve(e)),i.value){case"single":ye();break;case"tags":case"multiple":F(Array.isArray(e)?z.value.filter((a=>-1===e.map((e=>e[w.value])).indexOf(a[w.value]))):z.value.filter((a=>a[w.value]!=e[w.value])))}t.emit("deselect",he(e),e,M)},he=e=>h.value?e:e[w.value],be=e=>{ge(e)},ye=()=>{t.emit("clear",M),F(pe.value)},Se=e=>{if(void 0!==e.group)return"single"!==i.value&&(Ee(e[P.value])&&e[P.value].length);switch(i.value){case"single":return!a(z.value)&&z.value[w.value]==e[w.value];case"tags":case"multiple":return!a(z.value)&&-1!==z.value.map((e=>e[w.value])).indexOf(e[w.value])}},ke=e=>!0===e[R.value],Ce=()=>!(void 0===V||-1===V.value||!ie.value&&V.value>0)&&z.value.length>=V.value,Le=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,i.value){case"single":if(e&&Se(e))return void(E.value&&ge(e));e&&Oe(e),O.value&&K(),B.value&&(G(),J()),e&&fe(e);break;case"multiple":if(e&&Se(e))return void ge(e);if(Ce())return;e&&(Oe(e),fe(e)),O.value&&K(),c.value&&G(),B.value&&J();break;case"tags":if(e&&Se(e))return void ge(e);if(Ce())return;e&&Oe(e),O.value&&K(),e&&fe(e),c.value&&G(),B.value&&J()}B.value||W()},Oe=e=>{void 0===Ve(e[w.value])&&ae.value&&(t.emit("tag",e[w.value],M),t.emit("option",e[w.value],M),le.value&&Be(e),K())},we=e=>void 0===e.find((e=>!Se(e)&&!e[R.value])),Ee=e=>void 0===e.find((e=>!Se(e))),Ve=e=>te.value[te.value.map((e=>String(e[w.value]))).indexOf(String(e))],xe=(e,a=!0)=>te.value.map((e=>parseInt(e[ve.value])==e[ve.value]?parseInt(e[ve.value]):e[ve.value])).indexOf(parseInt(e)==e?parseInt(e):e),Be=e=>{Q.value.push(e)},Te=e=>_.value?e.filter((e=>$.value?e.__VISIBLE__.length:e[P.value].length)):e.filter((e=>!$.value||e.__VISIBLE__.length)),qe=(e,a=!0)=>{let l=e;return $.value&&C.value&&(l=l.filter((e=>A.value?n(e[ve.value],x.value).startsWith(n($.value,x.value)):-1!==n(e[ve.value],x.value).indexOf(n($.value,x.value))))),c.value&&a&&(l=l.filter((e=>!(e=>-1!==["tags","multiple"].indexOf(i.value)&&c.value&&Se(e))(e)))),l},Ne=e=>{let a=e;var l;return l=a,"[object Object]"===Object.prototype.toString.call(l)&&(a=Object.keys(a).map((e=>{let l=a[e];return{[w.value]:e,[ve.value]:l,[p.value]:l}}))),a=a.map((e=>"object"==typeof e?e:{[w.value]:e,[ve.value]:e,[p.value]:e})),a},Pe=()=>{a(j.value)||(z.value=De(j.value))},_e=e=>(Y.value=!0,new Promise(((a,l)=>{u.value($.value,M).then((a=>{X.value=a||[],"function"==typeof e&&e(a),Y.value=!1})).catch((e=>{console.error(e),X.value=[],Y.value=!1})).finally((()=>{a()}))}))),Ie=()=>{if(ie.value)if("single"===i.value){let e=Ve(z.value[w.value]);if(void 0!==e){let a=e[p.value];z.value[p.value]=a,h.value&&(j.value[p.value]=a)}}else z.value.forEach(((e,a)=>{let l=Ve(z.value[a][w.value]);if(void 0!==l){let e=l[p.value];z.value[a][p.value]=e,h.value&&(j.value[a][p.value]=e)}}))},De=e=>a(e)?"single"===i.value?{}:[]:h.value?e:"single"===i.value?Ve(e)||{}:e.filter((e=>!!Ve(e))).map((e=>Ve(e))),Re=()=>{Z.value=e.watch($,(e=>{e.length<k.value||!e&&0!==k.value||(Y.value=!0,L.value&&(X.value=[]),setTimeout((()=>{e==$.value&&u.value($.value,M).then((a=>{e!=$.value&&$.value||(X.value=a,H.value=ne.value.filter((e=>!0!==e[R.value]))[0]||null,Y.value=!1)})).catch((e=>{console.error(e)}))}),y.value))}),{flush:"sync"})};if("single"!==i.value&&!a(j.value)&&!Array.isArray(j.value))throw new Error(`v-model must be an array when using "${i.value}" mode`);return u&&"function"==typeof u.value?S.value?_e(Pe):1==h.value&&Pe():(X.value=u.value,Pe()),y.value>-1&&Re(),e.watch(y,((e,a)=>{Z.value&&Z.value(),e>=0&&Re()})),e.watch(j,(e=>{if(a(e))z.value=De(e);else switch(i.value){case"single":(h.value?e[w.value]!=z.value[w.value]:e!=z.value[w.value])&&(z.value=De(e));break;case"multiple":case"tags":(function(e,a){const l=a.slice().sort();return e.length===a.length&&e.slice().sort().every((function(e,a){return e===l[a]}))})(h.value?e.map((e=>e[w.value])):e,z.value.map((e=>e[w.value])))||(z.value=De(e))}}),{deep:!0}),e.watch(u,((e,a)=>{"function"==typeof l.options?S.value&&(!a||e&&e.toString()!==a.toString())&&_e():(X.value=l.options,Object.keys(z.value).length||Pe(),Ie())})),e.watch(p,Ie),{pfo:ue,fo:ne,filteredOptions:ne,hasSelected:ie,multipleLabelText:oe,eo:te,extendedOptions:te,fg:re,filteredGroups:re,noOptions:se,noResults:ce,resolving:Y,busy:me,offset:ee,select:fe,deselect:ge,remove:be,selectAll:()=>{"single"!==i.value&&fe(ne.value)},clear:ye,isSelected:Se,isDisabled:ke,isMax:Ce,getOption:Ve,handleOptionClick:e=>{if(!ke(e))return D&&D.value&&!Se(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=D.value(e,M))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Le(e)}))):void Le(e)},handleGroupClick:e=>{if(!ke(e)&&"single"!==i.value&&I.value){switch(i.value){case"multiple":case"tags":we(e[P.value])?ge(e[P.value]):fe(e[P.value].filter((e=>-1===z.value.map((e=>e[w.value])).indexOf(e[w.value]))).filter((e=>!e[R.value])).filter(((e,a)=>z.value.length+1+a<=V.value||-1===V.value)))}B.value&&U()}},handleTagRemove:(e,a)=>{0===a.button?be(e):a.preventDefault()},refreshOptions:e=>{_e(e)},resolveOptions:_e,refreshLabels:Ie}}function o(a,l,t){const{valueProp:r,showOptions:u,searchable:n,groupLabel:i,groups:o,mode:s,groupSelect:c,disabledProp:d}=e.toRefs(a),v=t.fo,p=t.fg,m=t.handleOptionClick,f=t.handleGroupClick,g=t.search,h=t.pointer,b=t.setPointer,y=t.clearPointer,S=t.multiselect,k=t.isOpen,C=e.computed((()=>v.value.filter((e=>!e[d.value])))),L=e.computed((()=>p.value.filter((e=>!e[d.value])))),O=e.computed((()=>"single"!==s.value&&c.value)),w=e.computed((()=>h.value&&h.value.group)),E=e.computed((()=>D(h.value))),V=e.computed((()=>{const e=w.value?h.value:D(h.value),a=L.value.map((e=>e[i.value])).indexOf(e[i.value]);let l=L.value[a-1];return void 0===l&&(l=B.value),l})),x=e.computed((()=>{let e=L.value.map((e=>e.label)).indexOf(w.value?h.value[i.value]:D(h.value)[i.value])+1;return L.value.length<=e&&(e=0),L.value[e]})),B=e.computed((()=>[...L.value].slice(-1)[0])),T=e.computed((()=>h.value.__VISIBLE__.filter((e=>!e[d.value]))[0])),q=e.computed((()=>{const e=E.value.__VISIBLE__.filter((e=>!e[d.value]));return e[e.map((e=>e[r.value])).indexOf(h.value[r.value])-1]})),N=e.computed((()=>{const e=D(h.value).__VISIBLE__.filter((e=>!e[d.value]));return e[e.map((e=>e[r.value])).indexOf(h.value[r.value])+1]})),P=e.computed((()=>[...V.value.__VISIBLE__.filter((e=>!e[d.value]))].slice(-1)[0])),_=e.computed((()=>[...B.value.__VISIBLE__.filter((e=>!e[d.value]))].slice(-1)[0])),I=()=>{b(C.value[0]||null)},D=e=>L.value.find((a=>-1!==a.__VISIBLE__.map((e=>e[r.value])).indexOf(e[r.value]))),R=()=>{let e=S.value.querySelector("[data-pointed]");if(!e)return;let a=e.parentElement.parentElement;o.value&&(a=w.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>a.clientHeight+a.scrollTop&&(a.scrollTop=e.offsetTop+e.offsetHeight-a.clientHeight),e.offsetTop<a.scrollTop&&(a.scrollTop=e.offsetTop)};return e.watch(g,(e=>{n.value&&(e.length&&u.value?I():y())})),e.watch(k,(a=>{if(a){let a=S.value.querySelectorAll("[data-selected]")[0];if(!a)return;let l=a.parentElement.parentElement;e.nextTick((()=>{l.scrollTop>0||(l.scrollTop=a.offsetTop)}))}})),{pointer:h,canPointGroups:O,isPointed:e=>!(!h.value||!(!e.group&&h.value[r.value]==e[r.value]||void 0!==e.group&&h.value[i.value]==e[i.value]))||void 0,setPointerFirst:I,selectPointer:()=>{h.value&&!0!==h.value[d.value]&&(w.value?f(h.value):m(h.value))},forwardPointer:()=>{if(null===h.value)b((o.value&&O.value?L.value[0]:C.value[0])||null);else if(o.value&&O.value){let e=w.value?T.value:N.value;void 0===e&&(e=x.value),b(e||null)}else{let e=C.value.map((e=>e[r.value])).indexOf(h.value[r.value])+1;C.value.length<=e&&(e=0),b(C.value[e]||null)}e.nextTick((()=>{R()}))},backwardPointer:()=>{if(null===h.value){let e=C.value[C.value.length-1];o.value&&O.value&&(e=_.value,void 0===e&&(e=B.value)),b(e||null)}else if(o.value&&O.value){let e=w.value?P.value:q.value;void 0===e&&(e=w.value?V.value:E.value),b(e||null)}else{let e=C.value.map((e=>e[r.value])).indexOf(h.value[r.value])-1;e<0&&(e=C.value.length-1),b(C.value[e]||null)}e.nextTick((()=>{R()}))}}}function s(a,l,t){const{disabled:r}=e.toRefs(a),u=e.getCurrentInstance().proxy,n=e.ref(!1);return{isOpen:n,open:()=>{n.value||r.value||(n.value=!0,l.emit("open",u))},close:()=>{n.value&&(n.value=!1,l.emit("close",u))}}}function c(a,l,t){const{searchable:r,disabled:u}=e.toRefs(a),n=t.input,i=t.open,o=t.close,s=t.clearSearch,c=t.isOpen,d=e.ref(null),v=e.ref(null),p=e.ref(null),m=e.ref(!1),f=e.ref(!1),g=e.computed((()=>r.value||u.value?-1:0)),h=()=>{r.value&&n.value.blur(),v.value.blur()},b=(e=!0)=>{u.value||(m.value=!0,e&&i())},y=()=>{m.value=!1,setTimeout((()=>{m.value||(o(),s())}),1)};return{multiselect:d,wrapper:v,tags:p,tabindex:g,isActive:m,mouseClicked:f,blur:h,focus:()=>{r.value&&!u.value&&n.value.focus()},activate:b,deactivate:y,handleFocusIn:e=>{e.target.closest("[data-tags]")||e.target.closest("[data-clear]")||b(f.value)},handleFocusOut:()=>{y()},handleCaretClick:()=>{y(),h()},handleMousedown:e=>{f.value=!0,c.value&&(e.target.isEqualNode(v.value)||e.target.isEqualNode(p.value))?setTimeout((()=>{y()}),0):document.activeElement.isEqualNode(v.value)&&!c.value&&(console.log(e.target.closest("[data-tags]")),b()),setTimeout((()=>{f.value=!1}),0)}}}function d(a,l,t){const{mode:r,addTagOn:u,openDirection:n,searchable:i,showOptions:o,valueProp:s,groups:c,addOptionOn:d,createTag:v,createOption:p,reverse:m}=e.toRefs(a),f=e.getCurrentInstance().proxy,g=t.iv,h=t.update,b=t.search,y=t.setPointer,S=t.selectPointer,k=t.backwardPointer,C=t.forwardPointer,L=t.multiselect,O=t.wrapper,w=t.tags,E=t.isOpen,V=t.open,x=t.blur,B=t.fo,T=e.computed((()=>v.value||p.value||!1)),q=e.computed((()=>void 0!==u.value?u.value:void 0!==d.value?d.value:["enter"])),N=()=>{"tags"===r.value&&!o.value&&T.value&&i.value&&!c.value&&y(B.value[B.value.map((e=>e[s.value])).indexOf(b.value)])};return{handleKeydown:e=>{let a,t;switch(l.emit("keydown",e,f),-1!==["ArrowLeft","ArrowRight","Enter"].indexOf(e.key)&&"tags"===r.value&&(a=[...L.value.querySelectorAll("[data-tags] > *")].filter((e=>e!==w.value)),t=a.findIndex((e=>e===document.activeElement))),e.key){case"Backspace":if("single"===r.value)return;if(i.value&&-1===[null,""].indexOf(b.value))return;if(0===g.value.length)return;h([...g.value].slice(0,-1));break;case"Enter":if(e.preventDefault(),229===e.keyCode)return;if(-1!==t&&void 0!==t)return h([...g.value].filter(((e,a)=>a!==t))),void(t===a.length-1&&(a.length-1?a[a.length-2].focus():i.value?w.value.querySelector("input").focus():O.value.focus()));if(-1===q.value.indexOf("enter")&&T.value)return;N(),S();break;case" ":if(!T.value&&!i.value)return e.preventDefault(),N(),void S();if(!T.value)return!1;if(-1===q.value.indexOf("space")&&T.value)return;e.preventDefault(),N(),S();break;case"Tab":case";":case",":if(-1===q.value.indexOf(e.key.toLowerCase())||!T.value)return;N(),S(),e.preventDefault();break;case"Escape":x();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;E.value||V(),k();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;E.value||V(),C();break;case"ArrowLeft":if(i.value&&w.value&&w.value.querySelector("input").selectionStart||e.shiftKey||"tags"!==r.value||!g.value||!g.value.length)return;e.preventDefault(),-1===t?a[a.length-1].focus():t>0&&a[t-1].focus();break;case"ArrowRight":if(-1===t||e.shiftKey||"tags"!==r.value||!g.value||!g.value.length)return;e.preventDefault(),a.length>t+1?a[t+1].focus():i.value?w.value.querySelector("input").focus():i.value||O.value.focus()}},handleKeyup:e=>{l.emit("keyup",e,f)},preparePointer:N}}function v(a,l,t){const{classes:r,disabled:u,openDirection:n,showOptions:i}=e.toRefs(a),o=t.isOpen,s=t.isPointed,c=t.isSelected,d=t.isDisabled,v=t.isActive,p=t.canPointGroups,m=t.resolving,f=t.fo,g=e.computed((()=>({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",wrapper:"multiselect-wrapper",singleLabel:"multiselect-single-label",singleLabelText:"multiselect-single-label-text",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",inifinite:"multiselect-inifite",inifiniteSpinner:"multiselect-inifite-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",assist:"multiselect-assistive-text",spacer:"multiselect-spacer",...r.value}))),h=e.computed((()=>!!(o.value&&i.value&&(!m.value||m.value&&f.value.length))));return{classList:e.computed((()=>{const e=g.value;return{container:[e.container].concat(u.value?e.containerDisabled:[]).concat(h.value&&"top"===n.value?e.containerOpenTop:[]).concat(h.value&&"top"!==n.value?e.containerOpen:[]).concat(v.value?e.containerActive:[]),wrapper:e.wrapper,spacer:e.spacer,singleLabel:e.singleLabel,singleLabelText:e.singleLabelText,multipleLabel:e.multipleLabel,search:e.search,tags:e.tags,tag:[e.tag].concat(u.value?e.tagDisabled:[]),tagRemove:e.tagRemove,tagRemoveIcon:e.tagRemoveIcon,tagsSearchWrapper:e.tagsSearchWrapper,tagsSearch:e.tagsSearch,tagsSearchCopy:e.tagsSearchCopy,placeholder:e.placeholder,caret:[e.caret].concat(o.value?e.caretOpen:[]),clear:e.clear,clearIcon:e.clearIcon,spinner:e.spinner,inifinite:e.inifinite,inifiniteSpinner:e.inifiniteSpinner,dropdown:[e.dropdown].concat("top"===n.value?e.dropdownTop:[]).concat(o.value&&i.value&&h.value?[]:e.dropdownHidden),options:[e.options].concat("top"===n.value?e.optionsTop:[]),group:e.group,groupLabel:a=>{let l=[e.groupLabel];return s(a)?l.push(c(a)?e.groupLabelSelectedPointed:e.groupLabelPointed):c(a)&&p.value?l.push(d(a)?e.groupLabelSelectedDisabled:e.groupLabelSelected):d(a)&&l.push(e.groupLabelDisabled),p.value&&l.push(e.groupLabelPointable),l},groupOptions:e.groupOptions,option:(a,l)=>{let t=[e.option];return s(a)?t.push(c(a)?e.optionSelectedPointed:e.optionPointed):c(a)?t.push(d(a)?e.optionSelectedDisabled:e.optionSelected):(d(a)||l&&d(l))&&t.push(e.optionDisabled),t},noOptions:e.noOptions,noResults:e.noResults,assist:e.assist,fakeInput:e.fakeInput}})),showDropdown:h}}function p(a,l,t){const{limit:r,infinite:u}=e.toRefs(a),n=t.isOpen,i=t.offset,o=t.search,s=t.pfo,c=t.eo,d=e.ref(null),v=e.ref(null),p=e.computed((()=>i.value<s.value.length)),m=a=>{const{isIntersecting:l,target:t}=a[0];if(l){const a=t.offsetParent,l=a.scrollTop;i.value+=-1==r.value?10:r.value,e.nextTick((()=>{a.scrollTop=l}))}},f=()=>{n.value&&i.value<s.value.length?d.value.observe(v.value):!n.value&&d.value&&d.value.disconnect()};return e.watch(n,(()=>{u.value&&f()})),e.watch(o,(()=>{u.value&&(i.value=r.value,f())}),{flush:"post"}),e.watch(c,(()=>{u.value&&f()}),{immediate:!1,flush:"post"}),e.onMounted((()=>{window&&window.IntersectionObserver&&(d.value=new IntersectionObserver(m))})),{hasMore:p,infiniteLoader:v}}function m(a,l,t){const{placeholder:r,id:u,valueProp:n,label:i,mode:o,groupLabel:s,aria:c,searchable:d}=e.toRefs(a),v=t.pointer,p=t.iv,m=t.hasSelected,f=t.multipleLabelText,g=e.ref(null),h=e.computed((()=>{let e=[];return u&&u.value&&e.push(u.value),e.push("assist"),e.join("-")})),b=e.computed((()=>{let e=[];return u&&u.value&&e.push(u.value),e.push("multiselect-options"),e.join("-")})),y=e.computed((()=>{let e=[];if(u&&u.value&&e.push(u.value),v.value)return e.push(v.value.group?"multiselect-group":"multiselect-option"),e.push(v.value.group?v.value.index:v.value[n.value]),e.join("-")})),S=e.computed((()=>r.value)),k=e.computed((()=>"single"!==o.value)),C=e.computed((()=>{let e="";return"single"===o.value&&m.value&&(e+=p.value[i.value]),"multiple"===o.value&&m.value&&(e+=f.value),"tags"===o.value&&m.value&&(e+=p.value.map((e=>e[i.value])).join(", ")),e})),L=e.computed((()=>{let e={...c.value};return d.value&&(e["aria-labelledby"]=e["aria-labelledby"]?`${h.value} ${e["aria-labelledby"]}`:h.value,C.value&&e["aria-label"]&&(e["aria-label"]=`${C.value}, ${e["aria-label"]}`)),e}));return e.onMounted((()=>{if(u&&u.value&&document&&document.querySelector){let e=document.querySelector(`[for="${u.value}"]`);g.value=e?e.innerText:null}})),{arias:L,ariaLabel:C,ariaAssist:h,ariaControls:b,ariaPlaceholder:S,ariaMultiselectable:k,ariaActiveDescendant:y,ariaOptionId:e=>{let a=[];return u&&u.value&&a.push(u.value),a.push("multiselect-option"),a.push(e[n.value]),a.join("-")},ariaOptionLabel:e=>{let a=[];return a.push(e[i.value]),a.join(" ")},ariaGroupId:e=>{let a=[];return u&&u.value&&a.push(u.value),a.push("multiselect-group"),a.push(e.index),a.join("-")},ariaGroupLabel:e=>{let a=[];return a.push(e[s.value]),a.join(" ")},ariaTagLabel:e=>`${e} ❎`}}var f={name:"Multiselect",emits:["paste","open","close","select","deselect","input","search-change","tag","option","update:modelValue","change","clear","keydown","keyup"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},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:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"},attrs:{required:!1,type:Object,default:()=>({})},onCreate:{required:!1,type:Function},disabledProp:{type:String,required:!1,default:"disabled"},searchStart:{type:Boolean,required:!1,default:!1},reverse:{type:Boolean,required:!1,default:!1},regex:{type:[Object,String,RegExp],required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},infinite:{type:Boolean,required:!1,default:!1},aria:{required:!1,type:Object,default:()=>({})}},setup:(e,a)=>function(e,a,l,t={}){return l.forEach((l=>{l&&(t={...t,...l(e,a,t)})})),t}(e,a,[t,u,s,r,l,c,i,p,o,d,v,m])};const g=["id","dir"],h=["tabindex","aria-controls","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable","role"],b=["type","modelValue","value","autocomplete","id","aria-controls","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable"],y=["onKeyup","aria-label"],S=["onClick"],k=["type","modelValue","value","id","autocomplete","aria-controls","aria-placeholder","aria-expanded","aria-activedescendant","aria-multiselectable"],C=["innerHTML"],L=["id"],O=["id","aria-label","aria-selected"],w=["data-pointed","onMouseenter","onClick"],E=["innerHTML"],V=["aria-label"],x=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],B=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],T=["innerHTML"],q=["innerHTML"],N=["value"],P=["name","value"],_=["name","value"],I=["id"];return f.render=function(a,l,t,r,u,n){return e.openBlock(),e.createElementBlock("div",{ref:"multiselect",class:e.normalizeClass(a.classList.container),id:t.searchable?void 0:t.id,dir:t.rtl?"rtl":void 0,onFocusin:l[10]||(l[10]=(...e)=>a.handleFocusIn&&a.handleFocusIn(...e)),onFocusout:l[11]||(l[11]=(...e)=>a.handleFocusOut&&a.handleFocusOut(...e)),onKeyup:l[12]||(l[12]=(...e)=>a.handleKeyup&&a.handleKeyup(...e)),onKeydown:l[13]||(l[13]=(...e)=>a.handleKeydown&&a.handleKeydown(...e))},[e.createElementVNode("div",e.mergeProps({class:a.classList.wrapper,onMousedown:l[9]||(l[9]=(...e)=>a.handleMousedown&&a.handleMousedown(...e)),ref:"wrapper",tabindex:a.tabindex,"aria-controls":t.searchable?void 0:a.ariaControls,"aria-placeholder":t.searchable?void 0:a.ariaPlaceholder,"aria-expanded":t.searchable?void 0:a.isOpen,"aria-activedescendant":t.searchable?void 0:a.ariaActiveDescendant,"aria-multiselectable":t.searchable?void 0:a.ariaMultiselectable,role:t.searchable?void 0:"combobox"},t.searchable?{}:a.arias),[e.createCommentVNode(" Search "),"tags"!==t.mode&&t.searchable&&!t.disabled?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,type:t.inputType,modelValue:a.search,value:a.search,class:a.classList.search,autocomplete:t.autocomplete,id:t.searchable?t.id:void 0,onInput:l[0]||(l[0]=(...e)=>a.handleSearchInput&&a.handleSearchInput(...e)),onKeypress:l[1]||(l[1]=(...e)=>a.handleKeypress&&a.handleKeypress(...e)),onPaste:l[2]||(l[2]=e.withModifiers(((...e)=>a.handlePaste&&a.handlePaste(...e)),["stop"])),ref:"input","aria-controls":a.ariaControls,"aria-placeholder":a.ariaPlaceholder,"aria-expanded":a.isOpen,"aria-activedescendant":a.ariaActiveDescendant,"aria-multiselectable":a.ariaMultiselectable,role:"combobox"},{...t.attrs,...a.arias}),null,16,b)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Tags (with search) "),"tags"==t.mode?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(a.classList.tags),"data-tags":""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.iv,((l,r,u)=>e.renderSlot(a.$slots,"tag",{option:l,handleTagRemove:a.handleTagRemove,disabled:t.disabled},(()=>[(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(a.classList.tag),tabindex:"-1",onKeyup:e.withKeys((e=>a.handleTagRemove(l,e)),["enter"]),key:u,"aria-label":a.ariaTagLabel(l[t.label])},[e.createTextVNode(e.toDisplayString(l[t.label])+" ",1),t.disabled?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(a.classList.tagRemove),onClick:e=>a.handleTagRemove(l,e)},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.tagRemoveIcon)},null,2)],10,S))],42,y))])))),256)),e.createElementVNode("div",{class:e.normalizeClass(a.classList.tagsSearchWrapper),ref:"tags"},[e.createCommentVNode(" Used for measuring search width "),e.createElementVNode("span",{class:e.normalizeClass(a.classList.tagsSearchCopy)},e.toDisplayString(a.search),3),e.createCommentVNode(" Actual search input "),t.searchable&&!t.disabled?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,type:t.inputType,modelValue:a.search,value:a.search,class:a.classList.tagsSearch,id:t.searchable?t.id:void 0,autocomplete:t.autocomplete,onInput:l[3]||(l[3]=(...e)=>a.handleSearchInput&&a.handleSearchInput(...e)),onKeypress:l[4]||(l[4]=(...e)=>a.handleKeypress&&a.handleKeypress(...e)),onPaste:l[5]||(l[5]=e.withModifiers(((...e)=>a.handlePaste&&a.handlePaste(...e)),["stop"])),ref:"input","aria-controls":a.ariaControls,"aria-placeholder":a.ariaPlaceholder,"aria-expanded":a.isOpen,"aria-activedescendant":a.ariaActiveDescendant,"aria-multiselectable":a.ariaMultiselectable,role:"combobox"},{...t.attrs,...a.arias}),null,16,k)):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Single label "),"single"==t.mode&&a.hasSelected&&!a.search&&a.iv?e.renderSlot(a.$slots,"singlelabel",{key:2,value:a.iv},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.singleLabel)},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.singleLabelText)},e.toDisplayString(a.iv[t.label]),3)],2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Multiple label "),"multiple"==t.mode&&a.hasSelected&&!a.search?e.renderSlot(a.$slots,"multiplelabel",{key:3,values:a.iv},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.multipleLabel),innerHTML:a.multipleLabelText},null,10,C)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Placeholder "),!t.placeholder||a.hasSelected||a.search?e.createCommentVNode("v-if",!0):e.renderSlot(a.$slots,"placeholder",{key:4},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.placeholder),"aria-hidden":"true"},e.toDisplayString(t.placeholder),3)])),e.createCommentVNode(" Spinner "),t.loading||a.resolving?e.renderSlot(a.$slots,"spinner",{key:5},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.spinner),"aria-hidden":"true"},null,2)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Clear "),a.hasSelected&&!t.disabled&&t.canClear&&!a.busy?e.renderSlot(a.$slots,"clear",{key:6,clear:a.clear},(()=>[e.createElementVNode("span",{"aria-hidden":"true",tabindex:"0",role:"button","data-clear":"","aria-roledescription":"❎",class:e.normalizeClass(a.classList.clear),onClick:l[6]||(l[6]=(...e)=>a.clear&&a.clear(...e)),onKeyup:l[7]||(l[7]=e.withKeys(((...e)=>a.clear&&a.clear(...e)),["enter"]))},[e.createElementVNode("span",{class:e.normalizeClass(a.classList.clearIcon)},null,2)],34)])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Caret "),t.caret&&t.showOptions?e.renderSlot(a.$slots,"caret",{key:7},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.caret),onClick:l[8]||(l[8]=(...e)=>a.handleCaretClick&&a.handleCaretClick(...e)),"aria-hidden":"true"},null,2)])):e.createCommentVNode("v-if",!0)],16,h),e.createCommentVNode(" Options "),e.createElementVNode("div",{class:e.normalizeClass(a.classList.dropdown),tabindex:"-1"},[e.renderSlot(a.$slots,"beforelist",{options:a.fo}),e.createElementVNode("ul",{class:e.normalizeClass(a.classList.options),id:a.ariaControls,role:"listbox"},[t.groups?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(a.fg,((l,r,u)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.group),key:u,id:a.ariaGroupId(l),"aria-label":a.ariaGroupLabel(l),"aria-selected":a.isSelected(l),role:"option"},[e.createElementVNode("div",{class:e.normalizeClass(a.classList.groupLabel(l)),"data-pointed":a.isPointed(l),onMouseenter:e=>a.setPointer(l,r),onClick:e=>a.handleGroupClick(l)},[e.renderSlot(a.$slots,"grouplabel",{group:l,isSelected:a.isSelected,isPointed:a.isPointed},(()=>[e.createElementVNode("span",{innerHTML:l[t.groupLabel]},null,8,E)]))],42,w),e.createElementVNode("ul",{class:e.normalizeClass(a.classList.groupOptions),"aria-label":a.ariaGroupLabel(l),role:"group"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.__VISIBLE__,((r,u,n)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.option(r,l)),"data-pointed":a.isPointed(r),"data-selected":a.isSelected(r)||void 0,key:n,onMouseenter:e=>a.setPointer(r),onClick:e=>a.handleOptionClick(r),id:a.ariaOptionId(r),"aria-selected":a.isSelected(r),"aria-label":a.ariaOptionLabel(r),role:"option"},[e.renderSlot(a.$slots,"option",{option:r,isSelected:a.isSelected,isPointed:a.isPointed,search:a.search},(()=>[e.createElementVNode("span",null,e.toDisplayString(r[t.label]),1)]))],42,x)))),128))],10,V)],10,O)))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.fo,((l,r,u)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(a.classList.option(l)),"data-pointed":a.isPointed(l),"data-selected":a.isSelected(l)||void 0,key:u,onMouseenter:e=>a.setPointer(l),onClick:e=>a.handleOptionClick(l),id:a.ariaOptionId(l),"aria-selected":a.isSelected(l),"aria-label":a.ariaOptionLabel(l),role:"option"},[e.renderSlot(a.$slots,"option",{option:l,isSelected:a.isSelected,isPointed:a.isPointed,search:a.search},(()=>[e.createElementVNode("span",null,e.toDisplayString(l[t.label]),1)]))],42,B)))),128))],10,L),a.noOptions?e.renderSlot(a.$slots,"nooptions",{key:0},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.noOptions),innerHTML:t.noOptionsText},null,10,T)])):e.createCommentVNode("v-if",!0),a.noResults?e.renderSlot(a.$slots,"noresults",{key:1},(()=>[e.createElementVNode("div",{class:e.normalizeClass(a.classList.noResults),innerHTML:t.noResultsText},null,10,q)])):e.createCommentVNode("v-if",!0),t.infinite&&a.hasMore?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(a.classList.inifinite),ref:"infiniteLoader"},[e.renderSlot(a.$slots,"infinite",{},(()=>[e.createElementVNode("span",{class:e.normalizeClass(a.classList.inifiniteSpinner)},null,2)]))],2)):e.createCommentVNode("v-if",!0),e.renderSlot(a.$slots,"afterlist",{options:a.fo})],2),e.createCommentVNode(" Hacky input element to show HTML5 required warning "),t.required?(e.openBlock(),e.createElementBlock("input",{key:0,class:e.normalizeClass(a.classList.fakeInput),tabindex:"-1",value:a.textValue,required:""},null,10,N)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Native input support "),t.nativeSupport?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},["single"==t.mode?(e.openBlock(),e.createElementBlock("input",{key:0,type:"hidden",name:t.name,value:void 0!==a.plainValue?a.plainValue:""},null,8,P)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.plainValue,((a,l)=>(e.openBlock(),e.createElementBlock("input",{type:"hidden",name:`${t.name}[]`,value:a,key:l},null,8,_)))),128))],64)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Screen reader assistive text "),t.searchable&&a.hasSelected?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(a.classList.assist),id:a.ariaAssist,"aria-hidden":"true"},e.toDisplayString(a.ariaLabel),11,I)):e.createCommentVNode("v-if",!0),e.createCommentVNode(" Create height for empty input "),e.createElementVNode("div",{class:e.normalizeClass(a.classList.spacer)},null,2)],42,g)},f.__file="src/Multiselect.vue",f}(Vue); |
@@ -1,1 +0,1 @@ | ||
var VueformMultiselect=function(e){"use strict";function a(e){return-1!==[null,void 0].indexOf(e)}function l(l,t,u){const{object:n,valueProp:i,mode:r}=e.toRefs(l),o=e.getCurrentInstance().proxy,s=u.iv,c=e=>n.value||a(e)?e:Array.isArray(e)?e.map((e=>e[i.value])):e[i.value],v=e=>a(e)?"single"===r.value?{}:[]:e;return{update:e=>{s.value=v(e);const a=c(e);t.emit("change",a,o),t.emit("input",a),t.emit("update:modelValue",a)}}}function t(a,l){const{value:t,modelValue:u,mode:n,valueProp:i}=e.toRefs(a),r=e.ref("single"!==n.value?[]:{}),o=u&&void 0!==u.value?u:t,s=e.computed((()=>"single"===n.value?r.value[i.value]:r.value.map((e=>e[i.value])))),c=e.computed((()=>"single"!==n.value?r.value.map((e=>e[i.value])).join(","):r.value[i.value]));return{iv:r,internalValue:r,ev:o,externalValue:o,textValue:c,plainValue:s}}function u(a,l,t){const{regex:u}=e.toRefs(a),n=e.getCurrentInstance().proxy,i=t.isOpen,r=t.open,o=e.ref(null),s=e.ref(null);return e.watch(o,(e=>{!i.value&&e&&r(),l.emit("search-change",e,n)})),{search:o,input:s,clearSearch:()=>{o.value=""},handleSearchInput:e=>{o.value=e.target.value},handleKeypress:e=>{if(u&&u.value){let a=u.value;"string"==typeof a&&(a=new RegExp(a)),e.key.match(a)||e.preventDefault()}},handlePaste:e=>{if(u&&u.value){let a=(e.clipboardData||window.clipboardData).getData("Text"),l=u.value;"string"==typeof l&&(l=new RegExp(l)),a.split("").every((e=>!!e.match(l)))||e.preventDefault()}l.emit("paste",e,n)}}}function n(a,l,t){const{groupSelect:u,mode:n,groups:i,disabledProp:r}=e.toRefs(a),o=e.ref(null),s=e=>{void 0===e||null!==e&&e[r.value]||i.value&&e&&e.group&&("single"===n.value||!u.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:()=>{s(null)}}}function i(e,a=!0){return a?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}function r(l,t,u){const{options:n,mode:r,trackBy:o,limit:s,hideSelected:c,createTag:v,createOption:d,label:p,appendNewTag:f,appendNewOption:g,multipleLabel:h,object:m,loading:b,delay:y,resolveOnLoad:_,minChars:O,filterResults:S,clearOnSearch:L,clearOnSelect:w,valueProp:x,canDeselect:P,max:T,strict:k,closeOnSelect:q,groups:E,reverse:I,infinite:R,groupOptions:C,groupHideEmpty:B,groupSelect:D,onCreate:A,disabledProp:j,searchStart:V}=e.toRefs(l),M=e.getCurrentInstance().proxy,N=u.iv,H=u.ev,F=u.search,G=u.clearSearch,$=u.update,K=u.pointer,W=u.clearPointer,U=u.focus,X=u.deactivate,z=u.close,J=e.ref([]),Q=e.ref([]),Y=e.ref(!1),Z=e.ref(null),ee=e.ref(R.value&&-1===s.value?10:s.value),ae=e.computed((()=>v.value||d.value||!1)),le=e.computed((()=>void 0!==f.value?f.value:void 0===g.value||g.value)),te=e.computed((()=>{if(E.value){let e=Q.value||[],a=[];return e.forEach((e=>{Re(e[C.value]).forEach((l=>{a.push(Object.assign({},l,e[j.value]?{[j.value]:!0}:{}))}))})),a}{let e=Re(Q.value||[]);return J.value.length&&(e=e.concat(J.value)),e}})),ue=e.computed((()=>E.value?Ee((Q.value||[]).map(((e,a)=>{const l=Re(e[C.value]);return{...e,index:a,group:!0,[C.value]:Ie(l,!1).map((a=>Object.assign({},a,e[j.value]?{[j.value]:!0}:{}))),__VISIBLE__:Ie(l).map((a=>Object.assign({},a,e[j.value]?{[j.value]:!0}:{})))}}))):[])),ne=e.computed((()=>{let e=te.value;return I.value&&(e=e.reverse()),ve.value.length&&(e=ve.value.concat(e)),Ie(e)})),ie=e.computed((()=>{let e=ne.value;return ee.value>0&&(e=e.slice(0,ee.value)),e})),re=e.computed((()=>{switch(r.value){case"single":return!a(N.value[x.value]);case"multiple":case"tags":return!a(N.value)&&N.value.length>0}})),oe=e.computed((()=>void 0!==h&&void 0!==h.value?h.value(N.value,M):N.value&&N.value.length>1?`${N.value.length} options selected`:"1 option selected")),se=e.computed((()=>!te.value.length&&!Y.value&&!ve.value.length)),ce=e.computed((()=>te.value.length>0&&0==ie.value.length&&(F.value&&E.value||!E.value))),ve=e.computed((()=>!1!==ae.value&&F.value?-1!==ke(F.value)?[]:[{[x.value]:F.value,[p.value]:F.value,[de.value]:F.value,__CREATE__:!0}]:[])),de=e.computed((()=>o.value||p.value)),pe=e.computed((()=>{switch(r.value){case"single":return null;case"multiple":case"tags":return[]}})),fe=e.computed((()=>b.value||Y.value)),ge=e=>{switch("object"!=typeof e&&(e=Te(e)),r.value){case"single":$(e);break;case"multiple":case"tags":$(N.value.concat(e))}t.emit("select",me(e),e,M)},he=e=>{switch("object"!=typeof e&&(e=Te(e)),r.value){case"single":ye();break;case"tags":case"multiple":$(Array.isArray(e)?N.value.filter((a=>-1===e.map((e=>e[x.value])).indexOf(a[x.value]))):N.value.filter((a=>a[x.value]!=e[x.value])))}t.emit("deselect",me(e),e,M)},me=e=>m.value?e:e[x.value],be=e=>{he(e)},ye=()=>{t.emit("clear",M),$(pe.value)},_e=e=>{if(void 0!==e.group)return"single"!==r.value&&(Pe(e[C.value])&&e[C.value].length);switch(r.value){case"single":return!a(N.value)&&N.value[x.value]==e[x.value];case"tags":case"multiple":return!a(N.value)&&-1!==N.value.map((e=>e[x.value])).indexOf(e[x.value])}},Oe=e=>!0===e[j.value],Se=()=>!(void 0===T||-1===T.value||!re.value&&T.value>0)&&N.value.length>=T.value,Le=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,r.value){case"single":if(e&&_e(e))return void(P.value&&he(e));e&&we(e),w.value&&G(),q.value&&(W(),z()),e&&ge(e);break;case"multiple":if(e&&_e(e))return void he(e);if(Se())return;e&&(we(e),ge(e)),w.value&&G(),c.value&&W(),q.value&&z();break;case"tags":if(e&&_e(e))return void he(e);if(Se())return;e&&we(e),w.value&&G(),e&&ge(e),c.value&&W(),q.value&&z()}q.value||U()},we=e=>{void 0===Te(e[x.value])&&ae.value&&(t.emit("tag",e[x.value],M),t.emit("option",e[x.value],M),le.value&&qe(e),G())},xe=e=>void 0===e.find((e=>!_e(e)&&!e[j.value])),Pe=e=>void 0===e.find((e=>!_e(e))),Te=e=>te.value[te.value.map((e=>String(e[x.value]))).indexOf(String(e))],ke=(e,a=!0)=>te.value.map((e=>parseInt(e[de.value])==e[de.value]?parseInt(e[de.value]):e[de.value])).indexOf(parseInt(e)==e?parseInt(e):e),qe=e=>{J.value.push(e)},Ee=e=>B.value?e.filter((e=>F.value?e.__VISIBLE__.length:e[C.value].length)):e.filter((e=>!F.value||e.__VISIBLE__.length)),Ie=(e,a=!0)=>{let l=e;return F.value&&S.value&&(l=l.filter((e=>V.value?i(e[de.value],k.value).startsWith(i(F.value,k.value)):-1!==i(e[de.value],k.value).indexOf(i(F.value,k.value))))),c.value&&a&&(l=l.filter((e=>!(e=>-1!==["tags","multiple"].indexOf(r.value)&&c.value&&_e(e))(e)))),l},Re=e=>{let a=e;var l;return l=a,"[object Object]"===Object.prototype.toString.call(l)&&(a=Object.keys(a).map((e=>{let l=a[e];return{[x.value]:e,[de.value]:l,[p.value]:l}}))),a=a.map((e=>"object"==typeof e?e:{[x.value]:e,[de.value]:e,[p.value]:e})),a},Ce=()=>{a(H.value)||(N.value=Ae(H.value))},Be=e=>(Y.value=!0,new Promise(((a,l)=>{n.value(F.value,M).then((a=>{Q.value=a||[],"function"==typeof e&&e(a),Y.value=!1})).catch((e=>{console.error(e),Q.value=[],Y.value=!1})).finally((()=>{a()}))}))),De=()=>{if(re.value)if("single"===r.value){let e=Te(N.value[x.value]);if(void 0!==e){let a=e[p.value];N.value[p.value]=a,m.value&&(H.value[p.value]=a)}}else N.value.forEach(((e,a)=>{let l=Te(N.value[a][x.value]);if(void 0!==l){let e=l[p.value];N.value[a][p.value]=e,m.value&&(H.value[a][p.value]=e)}}))},Ae=e=>a(e)?"single"===r.value?{}:[]:m.value?e:"single"===r.value?Te(e)||{}:e.filter((e=>!!Te(e))).map((e=>Te(e))),je=()=>{Z.value=e.watch(F,(e=>{e.length<O.value||!e&&0!==O.value||(Y.value=!0,L.value&&(Q.value=[]),setTimeout((()=>{e==F.value&&n.value(F.value,M).then((a=>{e!=F.value&&F.value||(Q.value=a,K.value=ie.value.filter((e=>!0!==e[j.value]))[0]||null,Y.value=!1)})).catch((e=>{console.error(e)}))}),y.value))}),{flush:"sync"})};if("single"!==r.value&&!a(H.value)&&!Array.isArray(H.value))throw new Error(`v-model must be an array when using "${r.value}" mode`);return n&&"function"==typeof n.value?_.value?Be(Ce):1==m.value&&Ce():(Q.value=n.value,Ce()),y.value>-1&&je(),e.watch(y,((e,a)=>{Z.value&&Z.value(),e>=0&&je()})),e.watch(H,(e=>{if(a(e))N.value=Ae(e);else switch(r.value){case"single":(m.value?e[x.value]!=N.value[x.value]:e!=N.value[x.value])&&(N.value=Ae(e));break;case"multiple":case"tags":(function(e,a){const l=a.slice().sort();return e.length===a.length&&e.slice().sort().every((function(e,a){return e===l[a]}))})(m.value?e.map((e=>e[x.value])):e,N.value.map((e=>e[x.value])))||(N.value=Ae(e))}}),{deep:!0}),e.watch(n,((e,a)=>{"function"==typeof l.options?_.value&&(!a||e&&e.toString()!==a.toString())&&Be():(Q.value=l.options,Object.keys(N.value).length||Ce(),De())})),e.watch(p,De),{pfo:ne,fo:ie,filteredOptions:ie,hasSelected:re,multipleLabelText:oe,eo:te,extendedOptions:te,fg:ue,filteredGroups:ue,noOptions:se,noResults:ce,resolving:Y,busy:fe,offset:ee,select:ge,deselect:he,remove:be,selectAll:()=>{"single"!==r.value&&ge(ie.value)},clear:ye,isSelected:_e,isDisabled:Oe,isMax:Se,getOption:Te,handleOptionClick:e=>{if(!Oe(e))return A&&A.value&&!_e(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=A.value(e,M))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Le(e)}))):void Le(e)},handleGroupClick:e=>{if(!Oe(e)&&"single"!==r.value&&D.value){switch(r.value){case"multiple":case"tags":xe(e[C.value])?he(e[C.value]):ge(e[C.value].filter((e=>-1===N.value.map((e=>e[x.value])).indexOf(e[x.value]))).filter((e=>!e[j.value])).filter(((e,a)=>N.value.length+1+a<=T.value||-1===T.value)))}q.value&&X()}},handleTagRemove:(e,a)=>{0===a.button?be(e):a.preventDefault()},refreshOptions:e=>{Be(e)},resolveOptions:Be,refreshLabels:De}}function o(a,l,t){const{valueProp:u,showOptions:n,searchable:i,groupLabel:r,groups:o,mode:s,groupSelect:c,disabledProp:v}=e.toRefs(a),d=t.fo,p=t.fg,f=t.handleOptionClick,g=t.handleGroupClick,h=t.search,m=t.pointer,b=t.setPointer,y=t.clearPointer,_=t.multiselect,O=t.isOpen,S=e.computed((()=>d.value.filter((e=>!e[v.value])))),L=e.computed((()=>p.value.filter((e=>!e[v.value])))),w=e.computed((()=>"single"!==s.value&&c.value)),x=e.computed((()=>m.value&&m.value.group)),P=e.computed((()=>A(m.value))),T=e.computed((()=>{const e=x.value?m.value:A(m.value),a=L.value.map((e=>e[r.value])).indexOf(e[r.value]);let l=L.value[a-1];return void 0===l&&(l=q.value),l})),k=e.computed((()=>{let e=L.value.map((e=>e.label)).indexOf(x.value?m.value[r.value]:A(m.value)[r.value])+1;return L.value.length<=e&&(e=0),L.value[e]})),q=e.computed((()=>[...L.value].slice(-1)[0])),E=e.computed((()=>m.value.__VISIBLE__.filter((e=>!e[v.value]))[0])),I=e.computed((()=>{const e=P.value.__VISIBLE__.filter((e=>!e[v.value]));return e[e.map((e=>e[u.value])).indexOf(m.value[u.value])-1]})),R=e.computed((()=>{const e=A(m.value).__VISIBLE__.filter((e=>!e[v.value]));return e[e.map((e=>e[u.value])).indexOf(m.value[u.value])+1]})),C=e.computed((()=>[...T.value.__VISIBLE__.filter((e=>!e[v.value]))].slice(-1)[0])),B=e.computed((()=>[...q.value.__VISIBLE__.filter((e=>!e[v.value]))].slice(-1)[0])),D=()=>{b(S.value[0]||null)},A=e=>L.value.find((a=>-1!==a.__VISIBLE__.map((e=>e[u.value])).indexOf(e[u.value]))),j=()=>{let e=_.value.querySelector("[data-pointed]");if(!e)return;let a=e.parentElement.parentElement;o.value&&(a=x.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>a.clientHeight+a.scrollTop&&(a.scrollTop=e.offsetTop+e.offsetHeight-a.clientHeight),e.offsetTop<a.scrollTop&&(a.scrollTop=e.offsetTop)};return e.watch(h,(e=>{i.value&&(e.length&&n.value?D():y())})),e.watch(O,(a=>{if(a){let a=_.value.querySelectorAll("[data-selected]")[0];if(!a)return;let l=a.parentElement.parentElement;e.nextTick((()=>{l.scrollTop>0||(l.scrollTop=a.offsetTop)}))}})),{pointer:m,canPointGroups:w,isPointed:e=>!(!m.value||!(!e.group&&m.value[u.value]==e[u.value]||void 0!==e.group&&m.value[r.value]==e[r.value]))||void 0,setPointerFirst:D,selectPointer:()=>{m.value&&!0!==m.value[v.value]&&(x.value?g(m.value):f(m.value))},forwardPointer:()=>{if(null===m.value)b((o.value&&w.value?L.value[0]:S.value[0])||null);else if(o.value&&w.value){let e=x.value?E.value:R.value;void 0===e&&(e=k.value),b(e||null)}else{let e=S.value.map((e=>e[u.value])).indexOf(m.value[u.value])+1;S.value.length<=e&&(e=0),b(S.value[e]||null)}e.nextTick((()=>{j()}))},backwardPointer:()=>{if(null===m.value){let e=S.value[S.value.length-1];o.value&&w.value&&(e=B.value,void 0===e&&(e=q.value)),b(e||null)}else if(o.value&&w.value){let e=x.value?C.value:I.value;void 0===e&&(e=x.value?T.value:P.value),b(e||null)}else{let e=S.value.map((e=>e[u.value])).indexOf(m.value[u.value])-1;e<0&&(e=S.value.length-1),b(S.value[e]||null)}e.nextTick((()=>{j()}))}}}function s(a,l,t){const{disabled:u}=e.toRefs(a),n=e.getCurrentInstance().proxy,i=e.ref(!1);return{isOpen:i,open:()=>{i.value||u.value||(i.value=!0,l.emit("open",n))},close:()=>{i.value&&(i.value=!1,l.emit("close",n))}}}function c(a,l,t){const{searchable:u,disabled:n}=e.toRefs(a),i=t.input,r=t.open,o=t.close,s=t.clearSearch,c=t.isOpen,v=e.ref(null),d=e.ref(null),p=e.ref(!1),f=e.ref(!1),g=e.computed((()=>u.value||n.value?-1:0)),h=()=>{u.value&&i.value.blur(),v.value.blur()},m=(e=!0)=>{n.value||(p.value=!0,e&&r())},b=()=>{p.value=!1,setTimeout((()=>{p.value||(o(),s())}),1)};return{multiselect:v,tags:d,tabindex:g,isActive:p,mouseClicked:f,blur:h,focus:()=>{u.value&&!n.value&&i.value.focus()},activate:m,deactivate:b,handleFocusIn:()=>{m(f.value)},handleFocusOut:()=>{b()},handleCaretClick:()=>{b(),h()},handleMousedown:e=>{f.value=!0,c.value&&(e.target.isEqualNode(v.value)||e.target.isEqualNode(d.value))?setTimeout((()=>{b()}),0):document.activeElement.isEqualNode(v.value)&&!c.value&&m(),setTimeout((()=>{f.value=!1}),0)}}}function v(a,l,t){const{mode:u,addTagOn:n,openDirection:i,searchable:r,showOptions:o,valueProp:s,groups:c,addOptionOn:v,createTag:d,createOption:p,reverse:f}=e.toRefs(a),g=e.getCurrentInstance().proxy,h=t.iv,m=t.update,b=t.search,y=t.setPointer,_=t.selectPointer,O=t.backwardPointer,S=t.forwardPointer,L=t.multiselect,w=t.tags,x=t.isOpen,P=t.open,T=t.blur,k=t.fo,q=e.computed((()=>d.value||p.value||!1)),E=e.computed((()=>void 0!==n.value?n.value:void 0!==v.value?v.value:["enter"])),I=()=>{"tags"===u.value&&!o.value&&q.value&&r.value&&!c.value&&y(k.value[k.value.map((e=>e[s.value])).indexOf(b.value)])};return{handleKeydown:e=>{let a,t;switch(l.emit("keydown",e,g),-1!==["ArrowLeft","ArrowRight","Enter"].indexOf(e.key)&&"tags"===u.value&&(a=[...L.value.querySelectorAll("[data-tags] > *")].filter((e=>e!==w.value)),t=a.findIndex((e=>e===document.activeElement))),e.key){case"Backspace":if("single"===u.value)return;if(r.value&&-1===[null,""].indexOf(b.value))return;if(0===h.value.length)return;m([...h.value].slice(0,-1));break;case"Enter":if(e.preventDefault(),-1!==t&&void 0!==t)return m([...h.value].filter(((e,a)=>a!==t))),void(t===a.length-1&&(a.length-1?a[a.length-2].focus():r.value?w.value.querySelector("input").focus():L.value.focus()));if(-1===E.value.indexOf("enter")&&q.value)return;I(),_();break;case" ":if(!q.value&&!r.value)return e.preventDefault(),I(),void _();if(!q.value)return!1;if(-1===E.value.indexOf("space")&&q.value)return;e.preventDefault(),I(),_();break;case"Tab":case";":case",":if(-1===E.value.indexOf(e.key.toLowerCase())||!q.value)return;I(),_(),e.preventDefault();break;case"Escape":T();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;x.value||P(),O();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;x.value||P(),S();break;case"ArrowLeft":if(r.value&&w.value.querySelector("input").selectionStart||e.shiftKey||"tags"!==u.value||!h.value||!h.value.length)return;e.preventDefault(),-1===t?a[a.length-1].focus():t>0&&a[t-1].focus();break;case"ArrowRight":if(-1===t||e.shiftKey||"tags"!==u.value||!h.value||!h.value.length)return;e.preventDefault(),a.length>t+1?a[t+1].focus():r.value?w.value.querySelector("input").focus():r.value||L.value.focus()}},handleKeyup:e=>{l.emit("keyup",e,g)},preparePointer:I}}function d(a,l,t){const{classes:u,disabled:n,openDirection:i,showOptions:r}=e.toRefs(a),o=t.isOpen,s=t.isPointed,c=t.isSelected,v=t.isDisabled,d=t.isActive,p=t.canPointGroups,f=t.resolving,g=t.fo,h=e.computed((()=>({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",singleLabel:"multiselect-single-label",singleLabelText:"multiselect-single-label-text",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",inifinite:"multiselect-inifite",inifiniteSpinner:"multiselect-inifite-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",spacer:"multiselect-spacer",...u.value}))),m=e.computed((()=>!!(o.value&&r.value&&(!f.value||f.value&&g.value.length))));return{classList:e.computed((()=>{const e=h.value;return{container:[e.container].concat(n.value?e.containerDisabled:[]).concat(m.value&&"top"===i.value?e.containerOpenTop:[]).concat(m.value&&"top"!==i.value?e.containerOpen:[]).concat(d.value?e.containerActive:[]),spacer:e.spacer,singleLabel:e.singleLabel,singleLabelText:e.singleLabelText,multipleLabel:e.multipleLabel,search:e.search,tags:e.tags,tag:[e.tag].concat(n.value?e.tagDisabled:[]),tagRemove:e.tagRemove,tagRemoveIcon:e.tagRemoveIcon,tagsSearchWrapper:e.tagsSearchWrapper,tagsSearch:e.tagsSearch,tagsSearchCopy:e.tagsSearchCopy,placeholder:e.placeholder,caret:[e.caret].concat(o.value?e.caretOpen:[]),clear:e.clear,clearIcon:e.clearIcon,spinner:e.spinner,inifinite:e.inifinite,inifiniteSpinner:e.inifiniteSpinner,dropdown:[e.dropdown].concat("top"===i.value?e.dropdownTop:[]).concat(o.value&&r.value&&m.value?[]:e.dropdownHidden),options:[e.options].concat("top"===i.value?e.optionsTop:[]),group:e.group,groupLabel:a=>{let l=[e.groupLabel];return s(a)?l.push(c(a)?e.groupLabelSelectedPointed:e.groupLabelPointed):c(a)&&p.value?l.push(v(a)?e.groupLabelSelectedDisabled:e.groupLabelSelected):v(a)&&l.push(e.groupLabelDisabled),p.value&&l.push(e.groupLabelPointable),l},groupOptions:e.groupOptions,option:(a,l)=>{let t=[e.option];return s(a)?t.push(c(a)?e.optionSelectedPointed:e.optionPointed):c(a)?t.push(v(a)?e.optionSelectedDisabled:e.optionSelected):(v(a)||l&&v(l))&&t.push(e.optionDisabled),t},noOptions:e.noOptions,noResults:e.noResults,fakeInput:e.fakeInput}})),showDropdown:m}}function p(a,l,t){const{limit:u,infinite:n}=e.toRefs(a),i=t.isOpen,r=t.offset,o=t.search,s=t.pfo,c=t.eo,v=e.ref(null),d=e.ref(null),p=e.computed((()=>r.value<s.value.length)),f=a=>{const{isIntersecting:l,target:t}=a[0];if(l){const a=t.offsetParent,l=a.scrollTop;r.value+=-1==u.value?10:u.value,e.nextTick((()=>{a.scrollTop=l}))}},g=()=>{i.value&&r.value<s.value.length?v.value.observe(d.value):!i.value&&v.value&&v.value.disconnect()};return e.watch(i,(()=>{n.value&&g()})),e.watch(o,(()=>{n.value&&(r.value=u.value,g())}),{flush:"post"}),e.watch(c,(()=>{n.value&&g()}),{immediate:!1,flush:"post"}),e.onMounted((()=>{window&&window.IntersectionObserver&&(v.value=new IntersectionObserver(f))})),{hasMore:p,infiniteLoader:d}}function f(a,l,t){const{placeholder:u,id:n,valueProp:i,label:r,mode:o,groupLabel:s}=e.toRefs(a),c=t.pointer;t.iv,t.hasSelected,t.multipleLabelText,t.isOpen;const v=e.ref(null),d=e.computed((()=>{let e=[];return n&&n.value&&e.push(n.value),e.push("multiselect-options"),e.join("-")})),p=e.computed((()=>{let e=[];if(n&&n.value&&e.push(n.value),c.value)return e.push(c.value.group?"multiselect-group":"multiselect-option"),e.push(c.value.group?c.value.index:c.value[i.value]),e.join("-")})),f=e.computed((()=>u.value)),g=e.computed((()=>"single"!==o.value));return e.onMounted((()=>{if(n&&n.value&&document&&document.querySelector){let e=document.querySelector(`[for="${n.value}"]`);v.value=e?e.innerText:null}})),{ariaOwns:d,ariaPlaceholder:f,ariaMultiselectable:g,ariaActiveDescendant:p,ariaOptionId:e=>{let a=[];return n&&n.value&&a.push(n.value),a.push("multiselect-option"),a.push(e[i.value]),a.join("-")},ariaOptionLabel:e=>{let a=[];return a.push(e[r.value]),a.join(" ")},ariaGroupId:e=>{let a=[];return n&&n.value&&a.push(n.value),a.push("multiselect-group"),a.push(e.index),a.join("-")},ariaGroupLabel:e=>{let a=[];return a.push(e[s.value]),a.join(" ")},ariaTagLabel:e=>`${e} ❎`}}function g(e,a,l,t,u,n,i,r,o,s){"boolean"!=typeof i&&(o=r,r=i,i=!1);const c="function"==typeof l?l.options:l;let v;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,u&&(c.functional=!0)),t&&(c._scopeId=t),n?(v=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__),a&&a.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(n)},c._ssrRegister=v):a&&(v=i?function(e){a.call(this,s(e,this.$root.$options.shadowRoot))}:function(e){a.call(this,r(e))}),v)if(c.functional){const e=c.render;c.render=function(a,l){return v.call(l),e(a,l)}}else{const e=c.beforeCreate;c.beforeCreate=e?[].concat(e,v):[v]}return l}const h={name:"Multiselect",emits:["paste","open","close","select","deselect","input","search-change","tag","option","update:modelValue","change","clear","keydown","keyup"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},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:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"},attrs:{required:!1,type:Object,default:()=>({})},onCreate:{required:!1,type:Function},disabledProp:{type:String,required:!1,default:"disabled"},searchStart:{type:Boolean,required:!1,default:!1},reverse:{type:Boolean,required:!1,default:!1},regex:{type:[Object,String,RegExp],required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},infinite:{type:Boolean,required:!1,default:!1},aria:{required:!1,type:Object,default:()=>({})}},setup:(e,a)=>function(e,a,l,t={}){return l.forEach((l=>{l&&(t={...t,...l(e,a,t)})})),t}(e,a,[t,n,s,u,l,c,r,p,o,v,d,f])};var m=function(){var e=this,a=e.$createElement,l=e._self._c||a;return l("div",e._b({ref:"multiselect",class:e.classList.container,attrs:{tabindex:e.tabindex,id:e.searchable?void 0:e.id,dir:e.rtl?"rtl":void 0,"aria-owns":e.searchable?void 0:e.ariaOwns,"aria-placeholder":e.searchable?void 0:e.ariaPlaceholder,"aria-expanded":e.searchable?void 0:e.isOpen,"aria-activedescendant":e.searchable?void 0:e.ariaActiveDescendant,"aria-multiselectable":e.searchable?void 0:e.ariaMultiselectable,role:e.searchable?void 0:"listbox"},on:{focusin:e.handleFocusIn,focusout:e.handleFocusOut,keydown:e.handleKeydown,keyup:e.handleKeyup,mousedown:e.handleMousedown}},"div",e.searchable?{}:e.aria,!1),["tags"!==e.mode&&e.searchable&&!e.disabled?[l("input",e._b({ref:"input",class:e.classList.search,attrs:{type:e.inputType,modelValue:e.search,autocomplete:e.autocomplete,id:e.searchable?e.id:void 0,"aria-owns":e.ariaOwns,"aria-placeholder":e.ariaPlaceholder,"aria-expanded":e.isOpen,"aria-activedescendant":e.ariaActiveDescendant,"aria-multiselectable":e.ariaMultiselectable,role:"listbox"},domProps:{value:e.search},on:{input:e.handleSearchInput,keypress:e.handleKeypress,paste:function(a){return a.stopPropagation(),e.handlePaste.apply(null,arguments)}}},"input",Object.assign({},e.attrs,e.aria),!1))]:e._e(),e._v(" "),"tags"==e.mode?[l("div",{class:e.classList.tags,attrs:{"data-tags":""}},[e._l(e.iv,(function(a,t,u){return e._t("tag",(function(){return[l("span",{key:u,class:e.classList.tag,attrs:{tabindex:"-1","aria-label":e.ariaTagLabel(a[e.label])},on:{keyup:function(l){return!l.type.indexOf("key")&&e._k(l.keyCode,"enter",13,l.key,"Enter")?null:e.handleTagRemove(a,l)}}},[e._v("\n "+e._s(a[e.label])+"\n "),e.disabled?e._e():l("span",{class:e.classList.tagRemove,on:{click:function(l){return e.handleTagRemove(a,l)}}},[l("span",{class:e.classList.tagRemoveIcon})])])]}),{option:a,handleTagRemove:e.handleTagRemove,disabled:e.disabled})})),e._v(" "),l("div",{ref:"tags",class:e.classList.tagsSearchWrapper},[l("span",{class:e.classList.tagsSearchCopy},[e._v(e._s(e.search))]),e._v(" "),e.searchable&&!e.disabled?l("input",e._b({ref:"input",class:e.classList.tagsSearch,attrs:{type:e.inputType,modelValue:e.search,id:e.searchable?e.id:void 0,autocomplete:e.autocomplete,"aria-owns":e.ariaOwns,"aria-placeholder":e.ariaPlaceholder,"aria-expanded":e.isOpen,"aria-activedescendant":e.ariaActiveDescendant,"aria-multiselectable":e.ariaMultiselectable,role:"listbox"},domProps:{value:e.search},on:{input:e.handleSearchInput,keypress:e.handleKeypress,paste:function(a){return a.stopPropagation(),e.handlePaste.apply(null,arguments)}}},"input",Object.assign({},e.attrs,e.aria),!1)):e._e()])],2)]:e._e(),e._v(" "),"single"==e.mode&&e.hasSelected&&!e.search&&e.iv?[e._t("singlelabel",(function(){return[l("div",{class:e.classList.singleLabel,attrs:{"aria-hidden":"true"}},[l("span",{class:e.classList.singleLabelText,domProps:{innerHTML:e._s(e.iv[e.label])}})])]}),{value:e.iv})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",(function(){return[l("div",{class:e.classList.multipleLabel,attrs:{"aria-hidden":"true"},domProps:{innerHTML:e._s(e.multipleLabelText)}})]}),{values:e.iv})]:e._e(),e._v(" "),!e.placeholder||e.hasSelected||e.search?e._e():[e._t("placeholder",(function(){return[l("div",{class:e.classList.placeholder,attrs:{"aria-hidden":"true"}},[e._v("\n "+e._s(e.placeholder)+"\n ")])]}))],e._v(" "),e.loading||e.resolving?e._t("spinner",(function(){return[l("span",{class:e.classList.spinner,attrs:{"aria-hidden":"true"}})]})):e._e(),e._v(" "),e.hasSelected&&!e.disabled&&e.canClear&&!e.busy?e._t("clear",(function(){return[l("span",{class:e.classList.clear,attrs:{tabindex:"0",role:"button","aria-label":"❎"},on:{click:e.clear,keyup:function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.clear.apply(null,arguments)}}},[l("span",{class:e.classList.clearIcon})])]}),{clear:e.clear}):e._e(),e._v(" "),e.caret&&e.showOptions?e._t("caret",(function(){return[l("span",{class:e.classList.caret,attrs:{"aria-hidden":"true"},on:{click:e.handleCaretClick}})]})):e._e(),e._v(" "),l("div",{class:e.classList.dropdown,attrs:{tabindex:"-1"}},[e._t("beforelist",null,{options:e.fo}),e._v(" "),l("ul",{class:e.classList.options,attrs:{id:e.ariaOwns}},[e.groups?e._l(e.fg,(function(a,t,u){return l("li",{key:u,class:e.classList.group,attrs:{id:e.ariaGroupId(a),"aria-label":e.ariaGroupLabel(a),"aria-selected":e.isSelected(a),role:"option"}},[l("div",{class:e.classList.groupLabel(a),attrs:{"data-pointed":e.isPointed(a)},on:{mouseenter:function(l){return e.setPointer(a,t)},click:function(l){return e.handleGroupClick(a)}}},[e._t("grouplabel",(function(){return[l("span",{domProps:{innerHTML:e._s(a[e.groupLabel])}})]}),{group:a,isSelected:e.isSelected,isPointed:e.isPointed})],2),e._v(" "),l("ul",{class:e.classList.groupOptions,attrs:{"aria-label":e.ariaGroupLabel(a),role:"group"}},e._l(a.__VISIBLE__,(function(t,u,n){return l("li",{key:n,class:e.classList.option(t,a),attrs:{"data-pointed":e.isPointed(t),"data-selected":e.isSelected(t)||void 0,id:e.ariaOptionId(t),"aria-selected":e.isSelected(t),"aria-label":e.ariaOptionLabel(t),role:"option"},on:{mouseenter:function(a){return e.setPointer(t)},click:function(a){return e.handleOptionClick(t)}}},[e._t("option",(function(){return[l("span",{domProps:{innerHTML:e._s(t[e.label])}})]}),{option:t,isSelected:e.isSelected,isPointed:e.isPointed,search:e.search})],2)})),0)])})):e._l(e.fo,(function(a,t,u){return l("li",{key:u,class:e.classList.option(a),attrs:{"data-pointed":e.isPointed(a),"data-selected":e.isSelected(a)||void 0,id:e.ariaOptionId(a),"aria-selected":e.isSelected(a),"aria-label":e.ariaOptionLabel(a),role:"option"},on:{mouseenter:function(l){return e.setPointer(a)},click:function(l){return e.handleOptionClick(a)}}},[e._t("option",(function(){return[l("span",{domProps:{innerHTML:e._s(a[e.label])}})]}),{option:a,isSelected:e.isSelected,isPointed:e.isPointed,search:e.search})],2)}))],2),e._v(" "),e.noOptions?e._t("nooptions",(function(){return[l("div",{class:e.classList.noOptions,domProps:{innerHTML:e._s(e.noOptionsText)}})]})):e._e(),e._v(" "),e.noResults?e._t("noresults",(function(){return[l("div",{class:e.classList.noResults,domProps:{innerHTML:e._s(e.noResultsText)}})]})):e._e(),e._v(" "),e.infinite&&e.hasMore?l("div",{ref:"infiniteLoader",class:e.classList.inifinite},[e._t("infinite",(function(){return[l("span",{class:e.classList.inifiniteSpinner})]}))],2):e._e(),e._v(" "),e._t("afterlist",null,{options:e.fo})],2),e._v(" "),e.required?l("input",{class:e.classList.fakeInput,attrs:{tabindex:"-1",required:""},domProps:{value:e.textValue}}):e._e(),e._v(" "),e.nativeSupport?["single"==e.mode?l("input",{attrs:{type:"hidden",name:e.name},domProps:{value:void 0!==e.plainValue?e.plainValue:""}}):e._l(e.plainValue,(function(a,t){return l("input",{key:t,attrs:{type:"hidden",name:e.name+"[]"},domProps:{value:a}})}))]:e._e(),e._v(" "),l("div",{class:e.classList.spacer})],2)};m._withStripped=!0;return g({render:m,staticRenderFns:[]},undefined,h,undefined,false,undefined,!1,void 0,void 0,void 0)}(Vue); | ||
var VueformMultiselect=function(e){"use strict";function a(e){return-1!==[null,void 0].indexOf(e)}function l(l,t,u){const{object:i,valueProp:r,mode:n}=e.toRefs(l),o=e.getCurrentInstance().proxy,s=u.iv,c=e=>i.value||a(e)?e:Array.isArray(e)?e.map((e=>e[r.value])):e[r.value],v=e=>a(e)?"single"===n.value?{}:[]:e;return{update:e=>{s.value=v(e);const a=c(e);t.emit("change",a,o),t.emit("input",a),t.emit("update:modelValue",a)}}}function t(a,l){const{value:t,modelValue:u,mode:i,valueProp:r}=e.toRefs(a),n=e.ref("single"!==i.value?[]:{}),o=u&&void 0!==u.value?u:t,s=e.computed((()=>"single"===i.value?n.value[r.value]:n.value.map((e=>e[r.value])))),c=e.computed((()=>"single"!==i.value?n.value.map((e=>e[r.value])).join(","):n.value[r.value]));return{iv:n,internalValue:n,ev:o,externalValue:o,textValue:c,plainValue:s}}function u(a,l,t){const{regex:u}=e.toRefs(a),i=e.getCurrentInstance().proxy,r=t.isOpen,n=t.open,o=e.ref(null),s=e.ref(null);return e.watch(o,(e=>{!r.value&&e&&n(),l.emit("search-change",e,i)})),{search:o,input:s,clearSearch:()=>{o.value=""},handleSearchInput:e=>{o.value=e.target.value},handleKeypress:e=>{if(u&&u.value){let a=u.value;"string"==typeof a&&(a=new RegExp(a)),e.key.match(a)||e.preventDefault()}},handlePaste:e=>{if(u&&u.value){let a=(e.clipboardData||window.clipboardData).getData("Text"),l=u.value;"string"==typeof l&&(l=new RegExp(l)),a.split("").every((e=>!!e.match(l)))||e.preventDefault()}l.emit("paste",e,i)}}}function i(a,l,t){const{groupSelect:u,mode:i,groups:r,disabledProp:n}=e.toRefs(a),o=e.ref(null),s=e=>{void 0===e||null!==e&&e[n.value]||r.value&&e&&e.group&&("single"===i.value||!u.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:()=>{s(null)}}}function r(e,a=!0){return a?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}function n(l,t,u){const{options:i,mode:n,trackBy:o,limit:s,hideSelected:c,createTag:v,createOption:p,label:d,appendNewTag:f,appendNewOption:g,multipleLabel:m,object:h,loading:b,delay:y,resolveOnLoad:_,minChars:S,filterResults:O,clearOnSearch:L,clearOnSelect:w,valueProp:x,canDeselect:k,max:q,strict:P,closeOnSelect:T,groups:E,reverse:I,infinite:R,groupOptions:C,groupHideEmpty:B,groupSelect:D,onCreate:A,disabledProp:j,searchStart:V}=e.toRefs(l),M=e.getCurrentInstance().proxy,N=u.iv,$=u.ev,F=u.search,H=u.clearSearch,G=u.update,K=u.pointer,W=u.clearPointer,U=u.focus,X=u.deactivate,z=u.close,J=e.ref([]),Q=e.ref([]),Y=e.ref(!1),Z=e.ref(null),ee=e.ref(R.value&&-1===s.value?10:s.value),ae=e.computed((()=>v.value||p.value||!1)),le=e.computed((()=>void 0!==f.value?f.value:void 0===g.value||g.value)),te=e.computed((()=>{if(E.value){let e=Q.value||[],a=[];return e.forEach((e=>{Re(e[C.value]).forEach((l=>{a.push(Object.assign({},l,e[j.value]?{[j.value]:!0}:{}))}))})),a}{let e=Re(Q.value||[]);return J.value.length&&(e=e.concat(J.value)),e}})),ue=e.computed((()=>E.value?Ee((Q.value||[]).map(((e,a)=>{const l=Re(e[C.value]);return{...e,index:a,group:!0,[C.value]:Ie(l,!1).map((a=>Object.assign({},a,e[j.value]?{[j.value]:!0}:{}))),__VISIBLE__:Ie(l).map((a=>Object.assign({},a,e[j.value]?{[j.value]:!0}:{})))}}))):[])),ie=e.computed((()=>{let e=te.value;return I.value&&(e=e.reverse()),ve.value.length&&(e=ve.value.concat(e)),Ie(e)})),re=e.computed((()=>{let e=ie.value;return ee.value>0&&(e=e.slice(0,ee.value)),e})),ne=e.computed((()=>{switch(n.value){case"single":return!a(N.value[x.value]);case"multiple":case"tags":return!a(N.value)&&N.value.length>0}})),oe=e.computed((()=>void 0!==m&&void 0!==m.value?m.value(N.value,M):N.value&&N.value.length>1?`${N.value.length} options selected`:"1 option selected")),se=e.computed((()=>!te.value.length&&!Y.value&&!ve.value.length)),ce=e.computed((()=>te.value.length>0&&0==re.value.length&&(F.value&&E.value||!E.value))),ve=e.computed((()=>!1!==ae.value&&F.value?-1!==Pe(F.value)?[]:[{[x.value]:F.value,[d.value]:F.value,[pe.value]:F.value,__CREATE__:!0}]:[])),pe=e.computed((()=>o.value||d.value)),de=e.computed((()=>{switch(n.value){case"single":return null;case"multiple":case"tags":return[]}})),fe=e.computed((()=>b.value||Y.value)),ge=e=>{switch("object"!=typeof e&&(e=qe(e)),n.value){case"single":G(e);break;case"multiple":case"tags":G(N.value.concat(e))}t.emit("select",he(e),e,M)},me=e=>{switch("object"!=typeof e&&(e=qe(e)),n.value){case"single":ye();break;case"tags":case"multiple":G(Array.isArray(e)?N.value.filter((a=>-1===e.map((e=>e[x.value])).indexOf(a[x.value]))):N.value.filter((a=>a[x.value]!=e[x.value])))}t.emit("deselect",he(e),e,M)},he=e=>h.value?e:e[x.value],be=e=>{me(e)},ye=()=>{t.emit("clear",M),G(de.value)},_e=e=>{if(void 0!==e.group)return"single"!==n.value&&(ke(e[C.value])&&e[C.value].length);switch(n.value){case"single":return!a(N.value)&&N.value[x.value]==e[x.value];case"tags":case"multiple":return!a(N.value)&&-1!==N.value.map((e=>e[x.value])).indexOf(e[x.value])}},Se=e=>!0===e[j.value],Oe=()=>!(void 0===q||-1===q.value||!ne.value&&q.value>0)&&N.value.length>=q.value,Le=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,n.value){case"single":if(e&&_e(e))return void(k.value&&me(e));e&&we(e),w.value&&H(),T.value&&(W(),z()),e&&ge(e);break;case"multiple":if(e&&_e(e))return void me(e);if(Oe())return;e&&(we(e),ge(e)),w.value&&H(),c.value&&W(),T.value&&z();break;case"tags":if(e&&_e(e))return void me(e);if(Oe())return;e&&we(e),w.value&&H(),e&&ge(e),c.value&&W(),T.value&&z()}T.value||U()},we=e=>{void 0===qe(e[x.value])&&ae.value&&(t.emit("tag",e[x.value],M),t.emit("option",e[x.value],M),le.value&&Te(e),H())},xe=e=>void 0===e.find((e=>!_e(e)&&!e[j.value])),ke=e=>void 0===e.find((e=>!_e(e))),qe=e=>te.value[te.value.map((e=>String(e[x.value]))).indexOf(String(e))],Pe=(e,a=!0)=>te.value.map((e=>parseInt(e[pe.value])==e[pe.value]?parseInt(e[pe.value]):e[pe.value])).indexOf(parseInt(e)==e?parseInt(e):e),Te=e=>{J.value.push(e)},Ee=e=>B.value?e.filter((e=>F.value?e.__VISIBLE__.length:e[C.value].length)):e.filter((e=>!F.value||e.__VISIBLE__.length)),Ie=(e,a=!0)=>{let l=e;return F.value&&O.value&&(l=l.filter((e=>V.value?r(e[pe.value],P.value).startsWith(r(F.value,P.value)):-1!==r(e[pe.value],P.value).indexOf(r(F.value,P.value))))),c.value&&a&&(l=l.filter((e=>!(e=>-1!==["tags","multiple"].indexOf(n.value)&&c.value&&_e(e))(e)))),l},Re=e=>{let a=e;var l;return l=a,"[object Object]"===Object.prototype.toString.call(l)&&(a=Object.keys(a).map((e=>{let l=a[e];return{[x.value]:e,[pe.value]:l,[d.value]:l}}))),a=a.map((e=>"object"==typeof e?e:{[x.value]:e,[pe.value]:e,[d.value]:e})),a},Ce=()=>{a($.value)||(N.value=Ae($.value))},Be=e=>(Y.value=!0,new Promise(((a,l)=>{i.value(F.value,M).then((a=>{Q.value=a||[],"function"==typeof e&&e(a),Y.value=!1})).catch((e=>{console.error(e),Q.value=[],Y.value=!1})).finally((()=>{a()}))}))),De=()=>{if(ne.value)if("single"===n.value){let e=qe(N.value[x.value]);if(void 0!==e){let a=e[d.value];N.value[d.value]=a,h.value&&($.value[d.value]=a)}}else N.value.forEach(((e,a)=>{let l=qe(N.value[a][x.value]);if(void 0!==l){let e=l[d.value];N.value[a][d.value]=e,h.value&&($.value[a][d.value]=e)}}))},Ae=e=>a(e)?"single"===n.value?{}:[]:h.value?e:"single"===n.value?qe(e)||{}:e.filter((e=>!!qe(e))).map((e=>qe(e))),je=()=>{Z.value=e.watch(F,(e=>{e.length<S.value||!e&&0!==S.value||(Y.value=!0,L.value&&(Q.value=[]),setTimeout((()=>{e==F.value&&i.value(F.value,M).then((a=>{e!=F.value&&F.value||(Q.value=a,K.value=re.value.filter((e=>!0!==e[j.value]))[0]||null,Y.value=!1)})).catch((e=>{console.error(e)}))}),y.value))}),{flush:"sync"})};if("single"!==n.value&&!a($.value)&&!Array.isArray($.value))throw new Error(`v-model must be an array when using "${n.value}" mode`);return i&&"function"==typeof i.value?_.value?Be(Ce):1==h.value&&Ce():(Q.value=i.value,Ce()),y.value>-1&&je(),e.watch(y,((e,a)=>{Z.value&&Z.value(),e>=0&&je()})),e.watch($,(e=>{if(a(e))N.value=Ae(e);else switch(n.value){case"single":(h.value?e[x.value]!=N.value[x.value]:e!=N.value[x.value])&&(N.value=Ae(e));break;case"multiple":case"tags":(function(e,a){const l=a.slice().sort();return e.length===a.length&&e.slice().sort().every((function(e,a){return e===l[a]}))})(h.value?e.map((e=>e[x.value])):e,N.value.map((e=>e[x.value])))||(N.value=Ae(e))}}),{deep:!0}),e.watch(i,((e,a)=>{"function"==typeof l.options?_.value&&(!a||e&&e.toString()!==a.toString())&&Be():(Q.value=l.options,Object.keys(N.value).length||Ce(),De())})),e.watch(d,De),{pfo:ie,fo:re,filteredOptions:re,hasSelected:ne,multipleLabelText:oe,eo:te,extendedOptions:te,fg:ue,filteredGroups:ue,noOptions:se,noResults:ce,resolving:Y,busy:fe,offset:ee,select:ge,deselect:me,remove:be,selectAll:()=>{"single"!==n.value&&ge(re.value)},clear:ye,isSelected:_e,isDisabled:Se,isMax:Oe,getOption:qe,handleOptionClick:e=>{if(!Se(e))return A&&A.value&&!_e(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=A.value(e,M))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Le(e)}))):void Le(e)},handleGroupClick:e=>{if(!Se(e)&&"single"!==n.value&&D.value){switch(n.value){case"multiple":case"tags":xe(e[C.value])?me(e[C.value]):ge(e[C.value].filter((e=>-1===N.value.map((e=>e[x.value])).indexOf(e[x.value]))).filter((e=>!e[j.value])).filter(((e,a)=>N.value.length+1+a<=q.value||-1===q.value)))}T.value&&X()}},handleTagRemove:(e,a)=>{0===a.button?be(e):a.preventDefault()},refreshOptions:e=>{Be(e)},resolveOptions:Be,refreshLabels:De}}function o(a,l,t){const{valueProp:u,showOptions:i,searchable:r,groupLabel:n,groups:o,mode:s,groupSelect:c,disabledProp:v}=e.toRefs(a),p=t.fo,d=t.fg,f=t.handleOptionClick,g=t.handleGroupClick,m=t.search,h=t.pointer,b=t.setPointer,y=t.clearPointer,_=t.multiselect,S=t.isOpen,O=e.computed((()=>p.value.filter((e=>!e[v.value])))),L=e.computed((()=>d.value.filter((e=>!e[v.value])))),w=e.computed((()=>"single"!==s.value&&c.value)),x=e.computed((()=>h.value&&h.value.group)),k=e.computed((()=>A(h.value))),q=e.computed((()=>{const e=x.value?h.value:A(h.value),a=L.value.map((e=>e[n.value])).indexOf(e[n.value]);let l=L.value[a-1];return void 0===l&&(l=T.value),l})),P=e.computed((()=>{let e=L.value.map((e=>e.label)).indexOf(x.value?h.value[n.value]:A(h.value)[n.value])+1;return L.value.length<=e&&(e=0),L.value[e]})),T=e.computed((()=>[...L.value].slice(-1)[0])),E=e.computed((()=>h.value.__VISIBLE__.filter((e=>!e[v.value]))[0])),I=e.computed((()=>{const e=k.value.__VISIBLE__.filter((e=>!e[v.value]));return e[e.map((e=>e[u.value])).indexOf(h.value[u.value])-1]})),R=e.computed((()=>{const e=A(h.value).__VISIBLE__.filter((e=>!e[v.value]));return e[e.map((e=>e[u.value])).indexOf(h.value[u.value])+1]})),C=e.computed((()=>[...q.value.__VISIBLE__.filter((e=>!e[v.value]))].slice(-1)[0])),B=e.computed((()=>[...T.value.__VISIBLE__.filter((e=>!e[v.value]))].slice(-1)[0])),D=()=>{b(O.value[0]||null)},A=e=>L.value.find((a=>-1!==a.__VISIBLE__.map((e=>e[u.value])).indexOf(e[u.value]))),j=()=>{let e=_.value.querySelector("[data-pointed]");if(!e)return;let a=e.parentElement.parentElement;o.value&&(a=x.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>a.clientHeight+a.scrollTop&&(a.scrollTop=e.offsetTop+e.offsetHeight-a.clientHeight),e.offsetTop<a.scrollTop&&(a.scrollTop=e.offsetTop)};return e.watch(m,(e=>{r.value&&(e.length&&i.value?D():y())})),e.watch(S,(a=>{if(a){let a=_.value.querySelectorAll("[data-selected]")[0];if(!a)return;let l=a.parentElement.parentElement;e.nextTick((()=>{l.scrollTop>0||(l.scrollTop=a.offsetTop)}))}})),{pointer:h,canPointGroups:w,isPointed:e=>!(!h.value||!(!e.group&&h.value[u.value]==e[u.value]||void 0!==e.group&&h.value[n.value]==e[n.value]))||void 0,setPointerFirst:D,selectPointer:()=>{h.value&&!0!==h.value[v.value]&&(x.value?g(h.value):f(h.value))},forwardPointer:()=>{if(null===h.value)b((o.value&&w.value?L.value[0]:O.value[0])||null);else if(o.value&&w.value){let e=x.value?E.value:R.value;void 0===e&&(e=P.value),b(e||null)}else{let e=O.value.map((e=>e[u.value])).indexOf(h.value[u.value])+1;O.value.length<=e&&(e=0),b(O.value[e]||null)}e.nextTick((()=>{j()}))},backwardPointer:()=>{if(null===h.value){let e=O.value[O.value.length-1];o.value&&w.value&&(e=B.value,void 0===e&&(e=T.value)),b(e||null)}else if(o.value&&w.value){let e=x.value?C.value:I.value;void 0===e&&(e=x.value?q.value:k.value),b(e||null)}else{let e=O.value.map((e=>e[u.value])).indexOf(h.value[u.value])-1;e<0&&(e=O.value.length-1),b(O.value[e]||null)}e.nextTick((()=>{j()}))}}}function s(a,l,t){const{disabled:u}=e.toRefs(a),i=e.getCurrentInstance().proxy,r=e.ref(!1);return{isOpen:r,open:()=>{r.value||u.value||(r.value=!0,l.emit("open",i))},close:()=>{r.value&&(r.value=!1,l.emit("close",i))}}}function c(a,l,t){const{searchable:u,disabled:i}=e.toRefs(a),r=t.input,n=t.open,o=t.close,s=t.clearSearch,c=t.isOpen,v=e.ref(null),p=e.ref(null),d=e.ref(null),f=e.ref(!1),g=e.ref(!1),m=e.computed((()=>u.value||i.value?-1:0)),h=()=>{u.value&&r.value.blur(),p.value.blur()},b=(e=!0)=>{i.value||(f.value=!0,e&&n())},y=()=>{f.value=!1,setTimeout((()=>{f.value||(o(),s())}),1)};return{multiselect:v,wrapper:p,tags:d,tabindex:m,isActive:f,mouseClicked:g,blur:h,focus:()=>{u.value&&!i.value&&r.value.focus()},activate:b,deactivate:y,handleFocusIn:e=>{e.target.closest("[data-tags]")||e.target.closest("[data-clear]")||b(g.value)},handleFocusOut:()=>{y()},handleCaretClick:()=>{y(),h()},handleMousedown:e=>{g.value=!0,c.value&&(e.target.isEqualNode(p.value)||e.target.isEqualNode(d.value))?setTimeout((()=>{y()}),0):document.activeElement.isEqualNode(p.value)&&!c.value&&(console.log(e.target.closest("[data-tags]")),b()),setTimeout((()=>{g.value=!1}),0)}}}function v(a,l,t){const{mode:u,addTagOn:i,openDirection:r,searchable:n,showOptions:o,valueProp:s,groups:c,addOptionOn:v,createTag:p,createOption:d,reverse:f}=e.toRefs(a),g=e.getCurrentInstance().proxy,m=t.iv,h=t.update,b=t.search,y=t.setPointer,_=t.selectPointer,S=t.backwardPointer,O=t.forwardPointer,L=t.multiselect,w=t.wrapper,x=t.tags,k=t.isOpen,q=t.open,P=t.blur,T=t.fo,E=e.computed((()=>p.value||d.value||!1)),I=e.computed((()=>void 0!==i.value?i.value:void 0!==v.value?v.value:["enter"])),R=()=>{"tags"===u.value&&!o.value&&E.value&&n.value&&!c.value&&y(T.value[T.value.map((e=>e[s.value])).indexOf(b.value)])};return{handleKeydown:e=>{let a,t;switch(l.emit("keydown",e,g),-1!==["ArrowLeft","ArrowRight","Enter"].indexOf(e.key)&&"tags"===u.value&&(a=[...L.value.querySelectorAll("[data-tags] > *")].filter((e=>e!==x.value)),t=a.findIndex((e=>e===document.activeElement))),e.key){case"Backspace":if("single"===u.value)return;if(n.value&&-1===[null,""].indexOf(b.value))return;if(0===m.value.length)return;h([...m.value].slice(0,-1));break;case"Enter":if(e.preventDefault(),229===e.keyCode)return;if(-1!==t&&void 0!==t)return h([...m.value].filter(((e,a)=>a!==t))),void(t===a.length-1&&(a.length-1?a[a.length-2].focus():n.value?x.value.querySelector("input").focus():w.value.focus()));if(-1===I.value.indexOf("enter")&&E.value)return;R(),_();break;case" ":if(!E.value&&!n.value)return e.preventDefault(),R(),void _();if(!E.value)return!1;if(-1===I.value.indexOf("space")&&E.value)return;e.preventDefault(),R(),_();break;case"Tab":case";":case",":if(-1===I.value.indexOf(e.key.toLowerCase())||!E.value)return;R(),_(),e.preventDefault();break;case"Escape":P();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;k.value||q(),S();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;k.value||q(),O();break;case"ArrowLeft":if(n.value&&x.value&&x.value.querySelector("input").selectionStart||e.shiftKey||"tags"!==u.value||!m.value||!m.value.length)return;e.preventDefault(),-1===t?a[a.length-1].focus():t>0&&a[t-1].focus();break;case"ArrowRight":if(-1===t||e.shiftKey||"tags"!==u.value||!m.value||!m.value.length)return;e.preventDefault(),a.length>t+1?a[t+1].focus():n.value?x.value.querySelector("input").focus():n.value||w.value.focus()}},handleKeyup:e=>{l.emit("keyup",e,g)},preparePointer:R}}function p(a,l,t){const{classes:u,disabled:i,openDirection:r,showOptions:n}=e.toRefs(a),o=t.isOpen,s=t.isPointed,c=t.isSelected,v=t.isDisabled,p=t.isActive,d=t.canPointGroups,f=t.resolving,g=t.fo,m=e.computed((()=>({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",wrapper:"multiselect-wrapper",singleLabel:"multiselect-single-label",singleLabelText:"multiselect-single-label-text",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",inifinite:"multiselect-inifite",inifiniteSpinner:"multiselect-inifite-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",assist:"multiselect-assistive-text",spacer:"multiselect-spacer",...u.value}))),h=e.computed((()=>!!(o.value&&n.value&&(!f.value||f.value&&g.value.length))));return{classList:e.computed((()=>{const e=m.value;return{container:[e.container].concat(i.value?e.containerDisabled:[]).concat(h.value&&"top"===r.value?e.containerOpenTop:[]).concat(h.value&&"top"!==r.value?e.containerOpen:[]).concat(p.value?e.containerActive:[]),wrapper:e.wrapper,spacer:e.spacer,singleLabel:e.singleLabel,singleLabelText:e.singleLabelText,multipleLabel:e.multipleLabel,search:e.search,tags:e.tags,tag:[e.tag].concat(i.value?e.tagDisabled:[]),tagRemove:e.tagRemove,tagRemoveIcon:e.tagRemoveIcon,tagsSearchWrapper:e.tagsSearchWrapper,tagsSearch:e.tagsSearch,tagsSearchCopy:e.tagsSearchCopy,placeholder:e.placeholder,caret:[e.caret].concat(o.value?e.caretOpen:[]),clear:e.clear,clearIcon:e.clearIcon,spinner:e.spinner,inifinite:e.inifinite,inifiniteSpinner:e.inifiniteSpinner,dropdown:[e.dropdown].concat("top"===r.value?e.dropdownTop:[]).concat(o.value&&n.value&&h.value?[]:e.dropdownHidden),options:[e.options].concat("top"===r.value?e.optionsTop:[]),group:e.group,groupLabel:a=>{let l=[e.groupLabel];return s(a)?l.push(c(a)?e.groupLabelSelectedPointed:e.groupLabelPointed):c(a)&&d.value?l.push(v(a)?e.groupLabelSelectedDisabled:e.groupLabelSelected):v(a)&&l.push(e.groupLabelDisabled),d.value&&l.push(e.groupLabelPointable),l},groupOptions:e.groupOptions,option:(a,l)=>{let t=[e.option];return s(a)?t.push(c(a)?e.optionSelectedPointed:e.optionPointed):c(a)?t.push(v(a)?e.optionSelectedDisabled:e.optionSelected):(v(a)||l&&v(l))&&t.push(e.optionDisabled),t},noOptions:e.noOptions,noResults:e.noResults,assist:e.assist,fakeInput:e.fakeInput}})),showDropdown:h}}function d(a,l,t){const{limit:u,infinite:i}=e.toRefs(a),r=t.isOpen,n=t.offset,o=t.search,s=t.pfo,c=t.eo,v=e.ref(null),p=e.ref(null),d=e.computed((()=>n.value<s.value.length)),f=a=>{const{isIntersecting:l,target:t}=a[0];if(l){const a=t.offsetParent,l=a.scrollTop;n.value+=-1==u.value?10:u.value,e.nextTick((()=>{a.scrollTop=l}))}},g=()=>{r.value&&n.value<s.value.length?v.value.observe(p.value):!r.value&&v.value&&v.value.disconnect()};return e.watch(r,(()=>{i.value&&g()})),e.watch(o,(()=>{i.value&&(n.value=u.value,g())}),{flush:"post"}),e.watch(c,(()=>{i.value&&g()}),{immediate:!1,flush:"post"}),e.onMounted((()=>{window&&window.IntersectionObserver&&(v.value=new IntersectionObserver(f))})),{hasMore:d,infiniteLoader:p}}function f(a,l,t){const{placeholder:u,id:i,valueProp:r,label:n,mode:o,groupLabel:s,aria:c,searchable:v}=e.toRefs(a),p=t.pointer,d=t.iv,f=t.hasSelected,g=t.multipleLabelText,m=e.ref(null),h=e.computed((()=>{let e=[];return i&&i.value&&e.push(i.value),e.push("assist"),e.join("-")})),b=e.computed((()=>{let e=[];return i&&i.value&&e.push(i.value),e.push("multiselect-options"),e.join("-")})),y=e.computed((()=>{let e=[];if(i&&i.value&&e.push(i.value),p.value)return e.push(p.value.group?"multiselect-group":"multiselect-option"),e.push(p.value.group?p.value.index:p.value[r.value]),e.join("-")})),_=e.computed((()=>u.value)),S=e.computed((()=>"single"!==o.value)),O=e.computed((()=>{let e="";return"single"===o.value&&f.value&&(e+=d.value[n.value]),"multiple"===o.value&&f.value&&(e+=g.value),"tags"===o.value&&f.value&&(e+=d.value.map((e=>e[n.value])).join(", ")),e})),L=e.computed((()=>{let e={...c.value};return v.value&&(e["aria-labelledby"]=e["aria-labelledby"]?`${h.value} ${e["aria-labelledby"]}`:h.value,O.value&&e["aria-label"]&&(e["aria-label"]=`${O.value}, ${e["aria-label"]}`)),e}));return e.onMounted((()=>{if(i&&i.value&&document&&document.querySelector){let e=document.querySelector(`[for="${i.value}"]`);m.value=e?e.innerText:null}})),{arias:L,ariaLabel:O,ariaAssist:h,ariaControls:b,ariaPlaceholder:_,ariaMultiselectable:S,ariaActiveDescendant:y,ariaOptionId:e=>{let a=[];return i&&i.value&&a.push(i.value),a.push("multiselect-option"),a.push(e[r.value]),a.join("-")},ariaOptionLabel:e=>{let a=[];return a.push(e[n.value]),a.join(" ")},ariaGroupId:e=>{let a=[];return i&&i.value&&a.push(i.value),a.push("multiselect-group"),a.push(e.index),a.join("-")},ariaGroupLabel:e=>{let a=[];return a.push(e[s.value]),a.join(" ")},ariaTagLabel:e=>`${e} ❎`}}function g(e,a,l,t,u,i,r,n,o,s){"boolean"!=typeof r&&(o=n,n=r,r=!1);const c="function"==typeof l?l.options:l;let v;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,u&&(c.functional=!0)),t&&(c._scopeId=t),i?(v=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__),a&&a.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},c._ssrRegister=v):a&&(v=r?function(e){a.call(this,s(e,this.$root.$options.shadowRoot))}:function(e){a.call(this,n(e))}),v)if(c.functional){const e=c.render;c.render=function(a,l){return v.call(l),e(a,l)}}else{const e=c.beforeCreate;c.beforeCreate=e?[].concat(e,v):[v]}return l}const m={name:"Multiselect",emits:["paste","open","close","select","deselect","input","search-change","tag","option","update:modelValue","change","clear","keydown","keyup"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},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:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"},attrs:{required:!1,type:Object,default:()=>({})},onCreate:{required:!1,type:Function},disabledProp:{type:String,required:!1,default:"disabled"},searchStart:{type:Boolean,required:!1,default:!1},reverse:{type:Boolean,required:!1,default:!1},regex:{type:[Object,String,RegExp],required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},infinite:{type:Boolean,required:!1,default:!1},aria:{required:!1,type:Object,default:()=>({})}},setup:(e,a)=>function(e,a,l,t={}){return l.forEach((l=>{l&&(t={...t,...l(e,a,t)})})),t}(e,a,[t,i,s,u,l,c,n,d,o,v,p,f])};var h=function(){var e=this,a=e.$createElement,l=e._self._c||a;return l("div",{ref:"multiselect",class:e.classList.container,attrs:{id:e.searchable?void 0:e.id,dir:e.rtl?"rtl":void 0},on:{focusin:e.handleFocusIn,focusout:e.handleFocusOut,keyup:e.handleKeyup,keydown:e.handleKeydown}},[l("div",e._b({ref:"wrapper",class:e.classList.wrapper,attrs:{tabindex:e.tabindex,"aria-controls":e.searchable?void 0:e.ariaControls,"aria-placeholder":e.searchable?void 0:e.ariaPlaceholder,"aria-expanded":e.searchable?void 0:e.isOpen,"aria-activedescendant":e.searchable?void 0:e.ariaActiveDescendant,"aria-multiselectable":e.searchable?void 0:e.ariaMultiselectable,role:e.searchable?void 0:"combobox"},on:{mousedown:e.handleMousedown}},"div",e.searchable?{}:e.arias,!1),["tags"!==e.mode&&e.searchable&&!e.disabled?[l("input",e._b({ref:"input",class:e.classList.search,attrs:{type:e.inputType,modelValue:e.search,autocomplete:e.autocomplete,id:e.searchable?e.id:void 0,"aria-controls":e.ariaControls,"aria-placeholder":e.ariaPlaceholder,"aria-expanded":e.isOpen,"aria-activedescendant":e.ariaActiveDescendant,"aria-multiselectable":e.ariaMultiselectable,role:"combobox"},domProps:{value:e.search},on:{input:e.handleSearchInput,keypress:e.handleKeypress,paste:function(a){return a.stopPropagation(),e.handlePaste.apply(null,arguments)}}},"input",Object.assign({},e.attrs,e.arias),!1))]:e._e(),e._v(" "),"tags"==e.mode?[l("div",{class:e.classList.tags,attrs:{"data-tags":""}},[e._l(e.iv,(function(a,t,u){return e._t("tag",(function(){return[l("span",{key:u,class:e.classList.tag,attrs:{tabindex:"-1","aria-label":e.ariaTagLabel(a[e.label])},on:{keyup:function(l){return!l.type.indexOf("key")&&e._k(l.keyCode,"enter",13,l.key,"Enter")?null:e.handleTagRemove(a,l)}}},[e._v("\n "+e._s(a[e.label])+"\n "),e.disabled?e._e():l("span",{class:e.classList.tagRemove,on:{click:function(l){return e.handleTagRemove(a,l)}}},[l("span",{class:e.classList.tagRemoveIcon})])])]}),{option:a,handleTagRemove:e.handleTagRemove,disabled:e.disabled})})),e._v(" "),l("div",{ref:"tags",class:e.classList.tagsSearchWrapper},[l("span",{class:e.classList.tagsSearchCopy},[e._v(e._s(e.search))]),e._v(" "),e.searchable&&!e.disabled?l("input",e._b({ref:"input",class:e.classList.tagsSearch,attrs:{type:e.inputType,modelValue:e.search,id:e.searchable?e.id:void 0,autocomplete:e.autocomplete,"aria-controls":e.ariaControls,"aria-placeholder":e.ariaPlaceholder,"aria-expanded":e.isOpen,"aria-activedescendant":e.ariaActiveDescendant,"aria-multiselectable":e.ariaMultiselectable,role:"combobox"},domProps:{value:e.search},on:{input:e.handleSearchInput,keypress:e.handleKeypress,paste:function(a){return a.stopPropagation(),e.handlePaste.apply(null,arguments)}}},"input",Object.assign({},e.attrs,e.arias),!1)):e._e()])],2)]:e._e(),e._v(" "),"single"==e.mode&&e.hasSelected&&!e.search&&e.iv?[e._t("singlelabel",(function(){return[l("div",{class:e.classList.singleLabel},[l("span",{class:e.classList.singleLabelText},[e._v(e._s(e.iv[e.label]))])])]}),{value:e.iv})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",(function(){return[l("div",{class:e.classList.multipleLabel,domProps:{innerHTML:e._s(e.multipleLabelText)}})]}),{values:e.iv})]:e._e(),e._v(" "),!e.placeholder||e.hasSelected||e.search?e._e():[e._t("placeholder",(function(){return[l("div",{class:e.classList.placeholder,attrs:{"aria-hidden":"true"}},[e._v("\n "+e._s(e.placeholder)+"\n ")])]}))],e._v(" "),e.loading||e.resolving?e._t("spinner",(function(){return[l("span",{class:e.classList.spinner,attrs:{"aria-hidden":"true"}})]})):e._e(),e._v(" "),e.hasSelected&&!e.disabled&&e.canClear&&!e.busy?e._t("clear",(function(){return[l("span",{class:e.classList.clear,attrs:{"aria-hidden":"true",tabindex:"0",role:"button","data-clear":"","aria-roledescription":"❎"},on:{click:e.clear,keyup:function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.clear.apply(null,arguments)}}},[l("span",{class:e.classList.clearIcon})])]}),{clear:e.clear}):e._e(),e._v(" "),e.caret&&e.showOptions?e._t("caret",(function(){return[l("span",{class:e.classList.caret,attrs:{"aria-hidden":"true"},on:{click:e.handleCaretClick}})]})):e._e()],2),e._v(" "),l("div",{class:e.classList.dropdown,attrs:{tabindex:"-1"}},[e._t("beforelist",null,{options:e.fo}),e._v(" "),l("ul",{class:e.classList.options,attrs:{id:e.ariaControls,role:"listbox"}},[e.groups?e._l(e.fg,(function(a,t,u){return l("li",{key:u,class:e.classList.group,attrs:{id:e.ariaGroupId(a),"aria-label":e.ariaGroupLabel(a),"aria-selected":e.isSelected(a),role:"option"}},[l("div",{class:e.classList.groupLabel(a),attrs:{"data-pointed":e.isPointed(a)},on:{mouseenter:function(l){return e.setPointer(a,t)},click:function(l){return e.handleGroupClick(a)}}},[e._t("grouplabel",(function(){return[l("span",{domProps:{innerHTML:e._s(a[e.groupLabel])}})]}),{group:a,isSelected:e.isSelected,isPointed:e.isPointed})],2),e._v(" "),l("ul",{class:e.classList.groupOptions,attrs:{"aria-label":e.ariaGroupLabel(a),role:"group"}},e._l(a.__VISIBLE__,(function(t,u,i){return l("li",{key:i,class:e.classList.option(t,a),attrs:{"data-pointed":e.isPointed(t),"data-selected":e.isSelected(t)||void 0,id:e.ariaOptionId(t),"aria-selected":e.isSelected(t),"aria-label":e.ariaOptionLabel(t),role:"option"},on:{mouseenter:function(a){return e.setPointer(t)},click:function(a){return e.handleOptionClick(t)}}},[e._t("option",(function(){return[l("span",[e._v(e._s(t[e.label]))])]}),{option:t,isSelected:e.isSelected,isPointed:e.isPointed,search:e.search})],2)})),0)])})):e._l(e.fo,(function(a,t,u){return l("li",{key:u,class:e.classList.option(a),attrs:{"data-pointed":e.isPointed(a),"data-selected":e.isSelected(a)||void 0,id:e.ariaOptionId(a),"aria-selected":e.isSelected(a),"aria-label":e.ariaOptionLabel(a),role:"option"},on:{mouseenter:function(l){return e.setPointer(a)},click:function(l){return e.handleOptionClick(a)}}},[e._t("option",(function(){return[l("span",[e._v(e._s(a[e.label]))])]}),{option:a,isSelected:e.isSelected,isPointed:e.isPointed,search:e.search})],2)}))],2),e._v(" "),e.noOptions?e._t("nooptions",(function(){return[l("div",{class:e.classList.noOptions,domProps:{innerHTML:e._s(e.noOptionsText)}})]})):e._e(),e._v(" "),e.noResults?e._t("noresults",(function(){return[l("div",{class:e.classList.noResults,domProps:{innerHTML:e._s(e.noResultsText)}})]})):e._e(),e._v(" "),e.infinite&&e.hasMore?l("div",{ref:"infiniteLoader",class:e.classList.inifinite},[e._t("infinite",(function(){return[l("span",{class:e.classList.inifiniteSpinner})]}))],2):e._e(),e._v(" "),e._t("afterlist",null,{options:e.fo})],2),e._v(" "),e.required?l("input",{class:e.classList.fakeInput,attrs:{tabindex:"-1",required:""},domProps:{value:e.textValue}}):e._e(),e._v(" "),e.nativeSupport?["single"==e.mode?l("input",{attrs:{type:"hidden",name:e.name},domProps:{value:void 0!==e.plainValue?e.plainValue:""}}):e._l(e.plainValue,(function(a,t){return l("input",{key:t,attrs:{type:"hidden",name:e.name+"[]"},domProps:{value:a}})}))]:e._e(),e._v(" "),e.searchable&&e.hasSelected?l("div",{class:e.classList.assist,attrs:{id:e.ariaAssist,"aria-hidden":"true"}},[e._v("\n "+e._s(e.ariaLabel)+"\n ")]):e._e(),e._v(" "),l("div",{class:e.classList.spacer})],2)};h._withStripped=!0;return g({render:h,staticRenderFns:[]},undefined,m,undefined,false,undefined,!1,void 0,void 0,void 0)}(Vue); |
{ | ||
"name": "@vueform/multiselect", | ||
"version": "2.5.6", | ||
"version": "2.5.7", | ||
"private": false, | ||
@@ -45,3 +45,3 @@ "description": "Vue 3 multiselect component with single select, multiselect and tagging options.", | ||
"jest-environment-jsdom-sixteen": "^1.0.3", | ||
"node-sass": "^5.0.0", | ||
"node-sass": "^7.0.0", | ||
"postcss": "^8.2.1", | ||
@@ -57,3 +57,2 @@ "rollup": "^2.34.2", | ||
"vue-prev": "npm:vue@^2.7.8", | ||
"vue-prev-composition-api": "npm:@vue/composition-api@^1.2.4", | ||
"vue-prev-jest": "npm:@vue/vue2-jest@^27.0.0-alpha.2", | ||
@@ -60,0 +59,0 @@ "vue-prev-rollup-plugin-vue": "npm:rollup-plugin-vue@^5.1.9", |
@@ -290,7 +290,7 @@ <div align="center"> | ||
| **reverse** | `boolean` | `false` | Whether the option list should be reversed. | | ||
| **regex** | `regex|string` | `undefined` | The regex that search input should be tested against when `searchable: true`. | | ||
| **regex** | `regex\|string` | `undefined` | The regex that search input should be tested against when `searchable: true`. | | ||
| **strict** | `boolean` | `true` | Whether should regard accents/diacritics in search. | | ||
| **searchStart** | `boolean` | `false` | Whether the search should match the start of the options' `trackBy`s. | | ||
| **aria** | `object` | | An object containing aria attributes to be added for the multiselect. | | ||
| **classes** | `object` | | An object of class names that gets merged with the default values. Default: `{`<br> `container: 'multiselect',`<br> `containerDisabled: 'is-disabled',`<br> `containerOpen: 'is-open',`<br> `containerOpenTop: 'is-open-top',`<br> `containerActive: 'is-active',`<br> `singleLabel: 'multiselect-single-label',`<br> `singleLabelText: 'multiselect-single-label-text',`<br> `multipleLabel: 'multiselect-multiple-label',`<br> `search: 'multiselect-search',`<br> `tags: 'multiselect-tags',`<br> `tag: 'multiselect-tag',`<br> `tagDisabled: 'is-disabled',`<br> `tagRemove: 'multiselect-tag-remove',`<br> `tagRemoveIcon: 'multiselect-tag-remove-icon',`<br> `tagsSearchWrapper: 'multiselect-tags-search-wrapper',`<br> `tagsSearch: 'multiselect-tags-search',`<br> `tagsSearchCopy: 'multiselect-tags-search-copy',`<br> `placeholder: 'multiselect-placeholder',`<br> `caret: 'multiselect-caret',`<br> `caretOpen: 'is-open',`<br> `clear: 'multiselect-clear',`<br> `clearIcon: 'multiselect-clear-icon',`<br> `spinner: 'multiselect-spinner',`<br> `dropdown: 'multiselect-dropdown',`<br> `dropdownTop: 'is-top',`<br> `dropdownHidden: 'is-hidden',`<br> `options: 'multiselect-options',`<br> `optionsTop: 'is-top',`<br> `group: 'multiselect-group',`<br> `groupLabel: 'multiselect-group-label',`<br> `groupLabelPointable: 'is-pointable',`<br> `groupLabelPointed: 'is-pointed',`<br> `groupLabelSelected: 'is-selected',`<br> `groupLabelDisabled: 'is-disabled',`<br> `groupLabelSelectedPointed: 'is-selected is-pointed',`<br> `groupLabelSelectedDisabled: 'is-selected is-disabled',`<br> `groupOptions: 'multiselect-group-options',`<br> `option: 'multiselect-option',`<br> `optionPointed: 'is-pointed',`<br> `optionSelected: 'is-selected',`<br> `optionDisabled: 'is-disabled',`<br> `optionSelectedPointed: 'is-selected is-pointed',`<br> `optionSelectedDisabled: 'is-selected is-disabled',`<br> `noOptions: 'multiselect-no-options',`<br> `noResults: 'multiselect-no-results',`<br> `fakeInput: 'multiselect-fake-input',`<br> `spacer: 'multiselect-spacer'`<br>`}` | | ||
| **classes** | `object` | | An object of class names that gets merged with the default values. Default: `{`<br> `container: 'multiselect',`<br> `containerDisabled: 'is-disabled',`<br> `containerOpen: 'is-open',`<br> `containerOpenTop: 'is-open-top',`<br> `containerActive: 'is-active',`<br> `wrapper: 'multiselect-wrapper',`<br> `singleLabel: 'multiselect-single-label',`<br> `singleLabelText: 'multiselect-single-label-text',`<br> `multipleLabel: 'multiselect-multiple-label',`<br> `search: 'multiselect-search',`<br> `tags: 'multiselect-tags',`<br> `tag: 'multiselect-tag',`<br> `tagDisabled: 'is-disabled',`<br> `tagRemove: 'multiselect-tag-remove',`<br> `tagRemoveIcon: 'multiselect-tag-remove-icon',`<br> `tagsSearchWrapper: 'multiselect-tags-search-wrapper',`<br> `tagsSearch: 'multiselect-tags-search',`<br> `tagsSearchCopy: 'multiselect-tags-search-copy',`<br> `placeholder: 'multiselect-placeholder',`<br> `caret: 'multiselect-caret',`<br> `caretOpen: 'is-open',`<br> `clear: 'multiselect-clear',`<br> `clearIcon: 'multiselect-clear-icon',`<br> `spinner: 'multiselect-spinner',`<br> `dropdown: 'multiselect-dropdown',`<br> `dropdownTop: 'is-top',`<br> `dropdownHidden: 'is-hidden',`<br> `options: 'multiselect-options',`<br> `optionsTop: 'is-top',`<br> `group: 'multiselect-group',`<br> `groupLabel: 'multiselect-group-label',`<br> `groupLabelPointable: 'is-pointable',`<br> `groupLabelPointed: 'is-pointed',`<br> `groupLabelSelected: 'is-selected',`<br> `groupLabelDisabled: 'is-disabled',`<br> `groupLabelSelectedPointed: 'is-selected is-pointed',`<br> `groupLabelSelectedDisabled: 'is-selected is-disabled',`<br> `groupOptions: 'multiselect-group-options',`<br> `option: 'multiselect-option',`<br> `optionPointed: 'is-pointed',`<br> `optionSelected: 'is-selected',`<br> `optionDisabled: 'is-disabled',`<br> `optionSelectedPointed: 'is-selected is-pointed',`<br> `optionSelectedDisabled: 'is-selected is-disabled',`<br> `noOptions: 'multiselect-no-options',`<br> `noResults: 'multiselect-no-results',`<br> `fakeInput: 'multiselect-fake-input',`<br> `assist: 'multiselect-assistive-text'`<br> `spacer: 'multiselect-spacer'`<br>`}` | | ||
@@ -1065,2 +1065,2 @@ <a href="https://vueform.com?ref=ghb"> | ||
[MIT](https://github.com/vueform/multiselect/blob/main/LICENSE.md) | ||
[MIT](https://github.com/vueform/multiselect/blob/main/LICENSE.md) |
@@ -5,3 +5,5 @@ import { toRefs, onMounted, ref, computed } from 'vue' | ||
{ | ||
const { placeholder, id, valueProp, label: labelProp, mode, groupLabel } = toRefs(props) | ||
const { | ||
placeholder, id, valueProp, label: labelProp, mode, groupLabel, aria, searchable , | ||
} = toRefs(props) | ||
@@ -14,3 +16,2 @@ // ============ DEPENDENCIES ============ | ||
const multipleLabelText = dep.multipleLabelText | ||
const isOpen = dep.isOpen | ||
@@ -23,3 +24,3 @@ // ================ DATA ================ | ||
const ariaOwns = computed(() => { | ||
const ariaAssist = computed(() => { | ||
let texts = [] | ||
@@ -31,2 +32,14 @@ | ||
texts.push('assist') | ||
return texts.join('-') | ||
}) | ||
const ariaControls = computed(() => { | ||
let texts = [] | ||
if (id && id.value) { | ||
texts.push(id.value) | ||
} | ||
texts.push('multiselect-options') | ||
@@ -63,2 +76,38 @@ | ||
const ariaLabel = computed(() => { | ||
let ariaLabel = '' | ||
if (mode.value === 'single' && hasSelected.value) { | ||
ariaLabel += iv.value[labelProp.value] | ||
} | ||
if (mode.value === 'multiple' && hasSelected.value) { | ||
ariaLabel += multipleLabelText.value | ||
} | ||
if (mode.value === 'tags' && hasSelected.value) { | ||
ariaLabel += iv.value.map(v => v[labelProp.value]).join(', ') | ||
} | ||
return ariaLabel | ||
}) | ||
const arias = computed(() => { | ||
let arias = { ...aria.value } | ||
// Need to add manually because focusing | ||
// the input won't read the selected value | ||
if (searchable.value) { | ||
arias['aria-labelledby'] = arias['aria-labelledby'] | ||
? `${ariaAssist.value} ${arias['aria-labelledby']}` | ||
: ariaAssist.value | ||
if (ariaLabel.value && arias['aria-label']) { | ||
arias['aria-label'] = `${ariaLabel.value}, ${arias['aria-label']}` | ||
} | ||
} | ||
return arias | ||
}) | ||
// =============== METHODS ============== | ||
@@ -125,3 +174,6 @@ | ||
return { | ||
ariaOwns, | ||
arias, | ||
ariaLabel, | ||
ariaAssist, | ||
ariaControls, | ||
ariaPlaceholder, | ||
@@ -128,0 +180,0 @@ ariaMultiselectable, |
@@ -25,2 +25,3 @@ import { computed, toRefs } from 'vue' | ||
containerActive: 'is-active', | ||
wrapper: 'multiselect-wrapper', | ||
singleLabel: 'multiselect-single-label', | ||
@@ -69,2 +70,3 @@ singleLabelText: 'multiselect-single-label-text', | ||
fakeInput: 'multiselect-fake-input', | ||
assist: 'multiselect-assistive-text', | ||
spacer: 'multiselect-spacer', | ||
@@ -89,2 +91,3 @@ ...classes_.value, | ||
.concat(isActive.value ? c.containerActive : []), | ||
wrapper: c.wrapper, | ||
spacer: c.spacer, | ||
@@ -150,2 +153,3 @@ singleLabel: c.singleLabel, | ||
noResults: c.noResults, | ||
assist: c.assist, | ||
fakeInput: c.fakeInput, | ||
@@ -152,0 +156,0 @@ } |
@@ -24,2 +24,3 @@ import { toRefs, computed, getCurrentInstance } from 'vue' | ||
const multiselect = dep.multiselect | ||
const wrapper = dep.wrapper | ||
const tags = dep.tags | ||
@@ -88,3 +89,3 @@ const isOpen = dep.isOpen | ||
} | ||
update([...iv.value].slice(0,-1)) | ||
@@ -96,2 +97,7 @@ break | ||
if (e.keyCode === 229) { | ||
// ignore IME confirmation | ||
return | ||
} | ||
if (activeIndex !== -1 && activeIndex !== undefined) { | ||
@@ -106,3 +112,3 @@ update([...iv.value].filter((v, k) => k !== activeIndex)) | ||
} else { | ||
multiselect.value.focus() | ||
wrapper.value.focus() | ||
} | ||
@@ -191,3 +197,6 @@ } | ||
case 'ArrowLeft': | ||
if ((searchable.value && tags.value.querySelector('input').selectionStart) || e.shiftKey || mode.value !== 'tags' || !iv.value || !iv.value.length) { | ||
if ( | ||
(searchable.value && tags.value && tags.value.querySelector('input').selectionStart) | ||
|| e.shiftKey || mode.value !== 'tags' || !iv.value || !iv.value.length | ||
) { | ||
return | ||
@@ -221,3 +230,3 @@ } | ||
else if (!searchable.value) { | ||
multiselect.value.focus() | ||
wrapper.value.focus() | ||
} | ||
@@ -224,0 +233,0 @@ |
@@ -18,2 +18,4 @@ import { ref, toRefs, computed, nextTick } from 'vue' | ||
const multiselect = ref(null) | ||
const wrapper = ref(null) | ||
@@ -39,3 +41,3 @@ const tags = ref(null) | ||
multiselect.value.blur() | ||
wrapper.value.blur() | ||
} | ||
@@ -72,3 +74,7 @@ | ||
const handleFocusIn = () => { | ||
const handleFocusIn = (e) => { | ||
if (e.target.closest('[data-tags]') || e.target.closest('[data-clear]')) { | ||
return | ||
} | ||
activate(mouseClicked.value) | ||
@@ -90,7 +96,8 @@ } | ||
if (isOpen.value && (e.target.isEqualNode(multiselect.value) || e.target.isEqualNode(tags.value))) { | ||
if (isOpen.value && (e.target.isEqualNode(wrapper.value) || e.target.isEqualNode(tags.value))) { | ||
setTimeout(() => { | ||
deactivate() | ||
}, 0) | ||
} else if (document.activeElement.isEqualNode(multiselect.value) && !isOpen.value) { | ||
} else if (document.activeElement.isEqualNode(wrapper.value) && !isOpen.value) { | ||
console.log(e.target.closest('[data-tags]')) | ||
activate() | ||
@@ -106,2 +113,3 @@ } | ||
multiselect, | ||
wrapper, | ||
tags, | ||
@@ -108,0 +116,0 @@ tabindex, |
import { ref, getCurrentInstance, watch, toRefs } from 'vue' | ||
export default function useSearch (props, context, dep) | ||
{7 | ||
{ | ||
const { regex } = toRefs(props) | ||
@@ -81,2 +81,2 @@ | ||
} | ||
} | ||
} |
@@ -87,5 +87,10 @@ import Vue,{ VNode } from 'vue'; | ||
infinite: VNode[]; | ||
nooptions: VNode[]; | ||
noresults: VNode[]; | ||
caret: VNode[]; | ||
clear: VNode[]; | ||
spinner: VNode[]; | ||
}; | ||
} | ||
export default Multiselect; | ||
export default Multiselect; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
407053
30
7194
1065