From 2179065d0995559a1e611e29b5fb4cd4f0d9d861 Mon Sep 17 00:00:00 2001 From: Adam Berecz Date: Fri, 18 Nov 2022 15:00:49 +0100 Subject: [PATCH] chore: build, changelog, version --- CHANGELOG.md | 13 ++++++ dist/multiselect.global.js | 2 +- dist/multiselect.js | 79 +++++++++++++++++---------------- dist/multiselect.vue2.global.js | 2 +- dist/multiselect.vue2.js | 34 +++++++------- package.json | 2 +- 6 files changed, 74 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a026e8c..668cd31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## 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 > `2022-09-28` diff --git a/dist/multiselect.global.js b/dist/multiselect.global.js index 4522788..0671ed9 100644 --- a/dist/multiselect.global.js +++ b/dist/multiselect.global.js @@ -1 +1 @@ -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:L,clearOnSearch:C,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:M}=e.toRefs(l),A=e.getCurrentInstance().proxy,z=r.iv,j=r.ev,H=r.search,$=r.clearSearch,K=r.update,F=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,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==ne.value.length&&(H.value&&T.value||!T.value))),de=e.computed((()=>!1!==ae.value&&H.value?-1!==xe(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=Ve(e)),i.value){case"single":K(e);break;case"multiple":case"tags":K(z.value.concat(e))}t.emit("select",he(e),e,A)},ge=e=>{switch("object"!=typeof e&&(e=Ve(e)),i.value){case"single":ye();break;case"tags":case"multiple":K(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),K(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],Le=()=>!(void 0===V||-1===V.value||!ie.value&&V.value>0)&&z.value.length>=V.value,Ce=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&&$(),B.value&&(G(),J()),e&&fe(e);break;case"multiple":if(e&&Se(e))return void ge(e);if(Le())return;e&&(Oe(e),fe(e)),O.value&&$(),c.value&&G(),B.value&&J();break;case"tags":if(e&&Se(e))return void ge(e);if(Le())return;e&&Oe(e),O.value&&$(),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],A),t.emit("option",e[w.value],A),le.value&&Be(e),$())},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=>H.value?e.__VISIBLE__.length:e[P.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?n(e[ve.value],x.value).startsWith(n(H.value,x.value)):-1!==n(e[ve.value],x.value).indexOf(n(H.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(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=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(H,(e=>{e.length{e==H.value&&u.value(H.value,A).then((a=>{e!=H.value&&H.value||(X.value=a,F.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:Le,getOption:Ve,handleOptionClick:e=>{if(!ke(e))return D&&D.value&&!Se(e)&&e.__CREATE__&&(delete(e={...e}).__CREATE__,(e=D.value(e,A))instanceof Promise)?(Y.value=!0,void e.then((e=>{Y.value=!1,Ce(e)}))):void Ce(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,L=e.computed((()=>v.value.filter((e=>!e[d.value])))),C=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=C.value.map((e=>e[i.value])).indexOf(e[i.value]);let l=C.value[a-1];return void 0===l&&(l=B.value),l})),x=e.computed((()=>{let e=C.value.map((e=>e.label)).indexOf(w.value?h.value[i.value]:D(h.value)[i.value])+1;return C.value.length<=e&&(e=0),C.value[e]})),B=e.computed((()=>[...C.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(L.value[0]||null)},D=e=>C.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{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?C.value[0]:L.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=L.value.map((e=>e[r.value])).indexOf(h.value[r.value])+1;L.value.length<=e&&(e=0),b(L.value[e]||null)}e.nextTick((()=>{R()}))},backwardPointer:()=>{if(null===h.value){let e=L.value[L.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=L.value.map((e=>e[r.value])).indexOf(h.value[r.value])-1;e<0&&(e=L.value.length-1),b(L.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,L=t.forwardPointer,C=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=[...C.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(),-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(),L();break;case"ArrowLeft":if(i.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{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{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)),L=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})),C=e.computed((()=>{let e={...c.value};return d.value&&(e["aria-labelledby"]=e["aria-labelledby"]?`${h.value} ${e["aria-labelledby"]}`:h.value,L.value&&e["aria-label"]&&(e["aria-label"]=`${L.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:C,ariaLabel:L,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"],L=["innerHTML"],C=["innerHTML"],O=["id"],w=["id","aria-label","aria-selected"],E=["data-pointed","onMouseenter","onClick"],V=["innerHTML"],x=["aria-label"],B=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],T=["innerHTML"],q=["data-pointed","data-selected","onMouseenter","onClick","id","aria-selected","aria-label"],N=["innerHTML"],P=["innerHTML"],_=["innerHTML"],I=["value"],D=["name","value"],R=["name","value"],M=["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),innerHTML:a.iv[t.label]},null,10,L)],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,V)]))],42,E),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",{innerHTML:r[t.label]},null,8,T)]))],42,B)))),128))],10,x)],10,w)))),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",{innerHTML:l[t.label]},null,8,N)]))],42,q)))),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,_)])):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,I)):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,D)):(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(" 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,M)):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); +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{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{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{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{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); diff --git a/dist/multiselect.js b/dist/multiselect.js index f3b8a98..70f29db 100644 --- a/dist/multiselect.js +++ b/dist/multiselect.js @@ -95,7 +95,8 @@ function useValue (props, context) } function useSearch (props, context, dep) -{ const { regex } = toRefs(props); +{ + const { regex } = toRefs(props); const $this = getCurrentInstance().proxy; @@ -1501,6 +1502,11 @@ function useKeyboard (props, context, dep) case 'Enter': e.preventDefault(); + if (e.keyCode === 229) { + // ignore IME confirmation + return + } + if (activeIndex !== -1 && activeIndex !== undefined) { update([...iv.value].filter((v, k) => k !== activeIndex)); @@ -1594,7 +1600,10 @@ function useKeyboard (props, context, dep) break 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 } @@ -2410,22 +2419,19 @@ const _hoisted_4 = ["onKeyup", "aria-label"]; const _hoisted_5 = ["onClick"]; const _hoisted_6 = ["type", "modelValue", "value", "id", "autocomplete", "aria-controls", "aria-placeholder", "aria-expanded", "aria-activedescendant", "aria-multiselectable"]; const _hoisted_7 = ["innerHTML"]; -const _hoisted_8 = ["innerHTML"]; -const _hoisted_9 = ["id"]; -const _hoisted_10 = ["id", "aria-label", "aria-selected"]; -const _hoisted_11 = ["data-pointed", "onMouseenter", "onClick"]; -const _hoisted_12 = ["innerHTML"]; -const _hoisted_13 = ["aria-label"]; +const _hoisted_8 = ["id"]; +const _hoisted_9 = ["id", "aria-label", "aria-selected"]; +const _hoisted_10 = ["data-pointed", "onMouseenter", "onClick"]; +const _hoisted_11 = ["innerHTML"]; +const _hoisted_12 = ["aria-label"]; +const _hoisted_13 = ["data-pointed", "data-selected", "onMouseenter", "onClick", "id", "aria-selected", "aria-label"]; const _hoisted_14 = ["data-pointed", "data-selected", "onMouseenter", "onClick", "id", "aria-selected", "aria-label"]; const _hoisted_15 = ["innerHTML"]; -const _hoisted_16 = ["data-pointed", "data-selected", "onMouseenter", "onClick", "id", "aria-selected", "aria-label"]; -const _hoisted_17 = ["innerHTML"]; -const _hoisted_18 = ["innerHTML"]; -const _hoisted_19 = ["innerHTML"]; -const _hoisted_20 = ["value"]; -const _hoisted_21 = ["name", "value"]; -const _hoisted_22 = ["name", "value"]; -const _hoisted_23 = ["id"]; +const _hoisted_16 = ["innerHTML"]; +const _hoisted_17 = ["value"]; +const _hoisted_18 = ["name", "value"]; +const _hoisted_19 = ["name", "value"]; +const _hoisted_20 = ["id"]; function render(_ctx, _cache, $props, $setup, $data, $options) { return (openBlock(), createElementBlock("div", { @@ -2556,9 +2562,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { class: normalizeClass(_ctx.classList.singleLabel) }, [ createElementVNode("span", { - class: normalizeClass(_ctx.classList.singleLabelText), - innerHTML: _ctx.iv[$props.label] - }, null, 10 /* CLASS, PROPS */, _hoisted_7) + class: normalizeClass(_ctx.classList.singleLabelText) + }, toDisplayString(_ctx.iv[$props.label]), 3 /* TEXT, CLASS */) ], 2 /* CLASS */) ]) : createCommentVNode("v-if", true), @@ -2571,7 +2576,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { createElementVNode("div", { class: normalizeClass(_ctx.classList.multipleLabel), innerHTML: _ctx.multipleLabelText - }, null, 10 /* CLASS, PROPS */, _hoisted_8) + }, null, 10 /* CLASS, PROPS */, _hoisted_7) ]) : createCommentVNode("v-if", true), createCommentVNode(" Placeholder "), @@ -2659,9 +2664,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { }, () => [ createElementVNode("span", { innerHTML: group[$props.groupLabel] - }, null, 8 /* PROPS */, _hoisted_12) + }, null, 8 /* PROPS */, _hoisted_11) ]) - ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11), + ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_10), createElementVNode("ul", { class: normalizeClass(_ctx.classList.groupOptions), "aria-label": _ctx.ariaGroupLabel(group), @@ -2686,14 +2691,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { isPointed: _ctx.isPointed, search: _ctx.search }, () => [ - createElementVNode("span", { - innerHTML: option[$props.label] - }, null, 8 /* PROPS */, _hoisted_15) + createElementVNode("span", null, toDisplayString(option[$props.label]), 1 /* TEXT */) ]) - ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14)) + ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13)) }), 128 /* KEYED_FRAGMENT */)) - ], 10 /* CLASS, PROPS */, _hoisted_13) - ], 10 /* CLASS, PROPS */, _hoisted_10)) + ], 10 /* CLASS, PROPS */, _hoisted_12) + ], 10 /* CLASS, PROPS */, _hoisted_9)) }), 128 /* KEYED_FRAGMENT */)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.fo, (option, i, key) => { return (openBlock(), createElementBlock("li", { @@ -2714,19 +2717,17 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { isPointed: _ctx.isPointed, search: _ctx.search }, () => [ - createElementVNode("span", { - innerHTML: option[$props.label] - }, null, 8 /* PROPS */, _hoisted_17) + createElementVNode("span", null, toDisplayString(option[$props.label]), 1 /* TEXT */) ]) - ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_16)) + ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14)) }), 128 /* KEYED_FRAGMENT */)) - ], 10 /* CLASS, PROPS */, _hoisted_9), + ], 10 /* CLASS, PROPS */, _hoisted_8), (_ctx.noOptions) ? renderSlot(_ctx.$slots, "nooptions", { key: 0 }, () => [ createElementVNode("div", { class: normalizeClass(_ctx.classList.noOptions), innerHTML: $props.noOptionsText - }, null, 10 /* CLASS, PROPS */, _hoisted_18) + }, null, 10 /* CLASS, PROPS */, _hoisted_15) ]) : createCommentVNode("v-if", true), (_ctx.noResults) @@ -2734,7 +2735,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { createElementVNode("div", { class: normalizeClass(_ctx.classList.noResults), innerHTML: $props.noResultsText - }, null, 10 /* CLASS, PROPS */, _hoisted_19) + }, null, 10 /* CLASS, PROPS */, _hoisted_16) ]) : createCommentVNode("v-if", true), ($props.infinite && _ctx.hasMore) @@ -2760,7 +2761,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { tabindex: "-1", value: _ctx.textValue, required: "" - }, null, 10 /* CLASS, PROPS */, _hoisted_20)) + }, null, 10 /* CLASS, PROPS */, _hoisted_17)) : createCommentVNode("v-if", true), createCommentVNode(" Native input support "), ($props.nativeSupport) @@ -2771,14 +2772,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { type: "hidden", name: $props.name, value: _ctx.plainValue !== undefined ? _ctx.plainValue : '' - }, null, 8 /* PROPS */, _hoisted_21)) + }, null, 8 /* PROPS */, _hoisted_18)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.plainValue, (v, i) => { return (openBlock(), createElementBlock("input", { type: "hidden", name: `${$props.name}[]`, value: v, key: i - }, null, 8 /* PROPS */, _hoisted_22)) + }, null, 8 /* PROPS */, _hoisted_19)) }), 128 /* KEYED_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */)) : createCommentVNode("v-if", true), @@ -2789,7 +2790,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { class: normalizeClass(_ctx.classList.assist), id: _ctx.ariaAssist, "aria-hidden": "true" - }, toDisplayString(_ctx.ariaLabel), 11 /* TEXT, CLASS, PROPS */, _hoisted_23)) + }, toDisplayString(_ctx.ariaLabel), 11 /* TEXT, CLASS, PROPS */, _hoisted_20)) : createCommentVNode("v-if", true), createCommentVNode(" Create height for empty input "), createElementVNode("div", { diff --git a/dist/multiselect.vue2.global.js b/dist/multiselect.vue2.global.js index 9147718..1fcd878 100644 --- a/dist/multiselect.vue2.global.js +++ b/dist/multiselect.vue2.global.js @@ -1 +1 @@ -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: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,$=u.search,F=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&&($.value&&E.value||!E.value))),ve=e.computed((()=>!1!==ae.value&&$.value?-1!==ke($.value)?[]:[{[x.value]:$.value,[d.value]:$.value,[pe.value]:$.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=Te(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=Te(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&&(Pe(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===T||-1===T.value||!ne.value&&T.value>0)&&N.value.length>=T.value,Le=e=>{switch(e.__CREATE__&&delete(e={...e}).__CREATE__,n.value){case"single":if(e&&_e(e))return void(P.value&&me(e));e&&we(e),w.value&&F(),q.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&&F(),c.value&&W(),q.value&&z();break;case"tags":if(e&&_e(e))return void me(e);if(Oe())return;e&&we(e),w.value&&F(),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),F())},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[pe.value])==e[pe.value]?parseInt(e[pe.value]):e[pe.value])).indexOf(parseInt(e)==e?parseInt(e):e),qe=e=>{J.value.push(e)},Ee=e=>B.value?e.filter((e=>$.value?e.__VISIBLE__.length:e[C.value].length)):e.filter((e=>!$.value||e.__VISIBLE__.length)),Ie=(e,a=!0)=>{let l=e;return $.value&&O.value&&(l=l.filter((e=>V.value?r(e[pe.value],k.value).startsWith(r($.value,k.value)):-1!==r(e[pe.value],k.value).indexOf(r($.value,k.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(H.value)||(N.value=Ae(H.value))},Be=e=>(Y.value=!0,new Promise(((a,l)=>{i.value($.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=Te(N.value[x.value]);if(void 0!==e){let a=e[d.value];N.value[d.value]=a,h.value&&(H.value[d.value]=a)}}else N.value.forEach(((e,a)=>{let l=Te(N.value[a][x.value]);if(void 0!==l){let e=l[d.value];N.value[a][d.value]=e,h.value&&(H.value[a][d.value]=e)}}))},Ae=e=>a(e)?"single"===n.value?{}:[]:h.value?e:"single"===n.value?Te(e)||{}:e.filter((e=>!!Te(e))).map((e=>Te(e))),je=()=>{Z.value=e.watch($,(e=>{e.length{e==$.value&&i.value($.value,M).then((a=>{e!=$.value&&$.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(H.value)&&!Array.isArray(H.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(H,(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:Te,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<=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: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)),P=e.computed((()=>A(h.value))),T=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=q.value),l})),k=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]})),q=e.computed((()=>[...L.value].slice(-1)[0])),E=e.computed((()=>h.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(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((()=>[...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(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{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=k.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=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=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,P=t.isOpen,T=t.open,k=t.blur,q=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(q.value[q.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(),-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":k();break;case"ArrowUp":if(e.preventDefault(),!o.value)return;P.value||T(),S();break;case"ArrowDown":if(e.preventDefault(),!o.value)return;P.value||T(),O();break;case"ArrowLeft":if(n.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{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{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,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,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",{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(" "),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); +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{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{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{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{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); diff --git a/dist/multiselect.vue2.js b/dist/multiselect.vue2.js index 9106712..af44085 100644 --- a/dist/multiselect.vue2.js +++ b/dist/multiselect.vue2.js @@ -95,7 +95,8 @@ function useValue (props, context) } function useSearch (props, context, dep) -{ const { regex } = toRefs(props); +{ + const { regex } = toRefs(props); const $this = getCurrentInstance().proxy; @@ -1501,6 +1502,11 @@ function useKeyboard (props, context, dep) case 'Enter': e.preventDefault(); + if (e.keyCode === 229) { + // ignore IME confirmation + return + } + if (activeIndex !== -1 && activeIndex !== undefined) { update([...iv.value].filter((v, k) => k !== activeIndex)); @@ -1594,7 +1600,10 @@ function useKeyboard (props, context, dep) break 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 } @@ -2713,10 +2722,9 @@ var __vue_render__ = function () { function () { return [ _c("div", { class: _vm.classList.singleLabel }, [ - _c("span", { - class: _vm.classList.singleLabelText, - domProps: { innerHTML: _vm._s(_vm.iv[_vm.label]) }, - }), + _c("span", { class: _vm.classList.singleLabelText }, [ + _vm._v(_vm._s(_vm.iv[_vm.label])), + ]), ]), ] }, @@ -2936,11 +2944,9 @@ var __vue_render__ = function () { "option", function () { return [ - _c("span", { - domProps: { - innerHTML: _vm._s(option[_vm.label]), - }, - }), + _c("span", [ + _vm._v(_vm._s(option[_vm.label])), + ]), ] }, { @@ -2987,11 +2993,7 @@ var __vue_render__ = function () { "option", function () { return [ - _c("span", { - domProps: { - innerHTML: _vm._s(option[_vm.label]), - }, - }), + _c("span", [_vm._v(_vm._s(option[_vm.label]))]), ] }, { diff --git a/package.json b/package.json index 74ba7d3..2dc3cfa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vueform/multiselect", - "version": "2.5.6", + "version": "2.5.7", "private": false, "description": "Vue 3 multiselect component with single select, multiselect and tagging options.", "license": "MIT",