mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-14 08:44:06 +00:00
2 lines
27 KiB
JavaScript
2 lines
27 KiB
JavaScript
import{bn as x,f as M,k as O,z as re,bo as Ie,Z as We,r as qe,o as I,m as Je,w as Ze,a as Qe,c as q,J as w,q as de,K as E,N as le,O as ne,a2 as C,p as Ue,t as J,b as P}from"./main-pPEsZPea.js";function H(e){return[null,void 0,!1].indexOf(e)!==-1}function Xe(e,u,a){const{object:i,valueProp:o,mode:v}=x(e),f=a.iv,g=p=>{f.value=c(p);const b=t(p);u.emit("change",b),u.emit("input",b),u.emit("update:modelValue",b)},t=p=>i.value||H(p)?p:Array.isArray(p)?p.map(b=>b[o.value]):p[o.value],c=p=>H(p)?v.value==="single"?{}:[]:p;return{update:g}}function Ye(e,u){const{value:a,modelValue:i,mode:o,valueProp:v}=x(e),f=M(o.value!=="single"?[]:{}),g=u.expose!==void 0?i:a,t=O(()=>o.value==="single"?f.value[v.value]:f.value.map(p=>p[v.value])),c=O(()=>o.value!=="single"?f.value.map(p=>p[v.value]).join(","):f.value[v.value]);return{iv:f,internalValue:f,ev:g,externalValue:g,textValue:c,plainValue:t}}function $e(e,u,a){const{preserveSearch:i}=x(e),o=M(e.initialSearch)||M(null),v=M(null),f=()=>{i.value||(o.value="")},g=c=>{o.value=c.target.value},t=c=>{u.emit("paste",c)};return re(o,c=>{u.emit("search-change",c)}),{search:o,input:v,clearSearch:f,handleSearchInput:g,handlePaste:t}}function _e(e,u,a){const{groupSelect:i,mode:o,groups:v}=x(e),f=M(null),g=c=>{c===void 0||c!==null&&c.disabled||v.value&&c&&c.group&&(o.value==="single"||!i.value)||(f.value=c)};return{pointer:f,setPointer:g,clearPointer:()=>{g(null)}}}function Be(e,u=!0){return u?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim()}function el(e){return Object.prototype.toString.call(e)==="[object Object]"}function ll(e,u){const a=u.slice().sort();return e.length===u.length&&e.slice().sort().every(function(i,o){return i===a[o]})}function al(e,u,a){const{options:i,mode:o,trackBy:v,limit:f,hideSelected:g,createTag:t,label:c,appendNewTag:p,multipleLabel:b,object:B,loading:V,delay:D,resolveOnLoad:h,minChars:r,filterResults:j,clearOnSearch:X,clearOnSelect:k,valueProp:d,canDeselect:R,max:L,strict:Z,closeOnSelect:Q,groups:Y,groupLabel:se,groupOptions:A,groupHideEmpty:ve,groupSelect:pe}=x(e),S=a.iv,F=a.ev,T=a.search,$=a.clearSearch,_=a.update,fe=a.pointer,ue=a.clearPointer,K=a.blur,ae=a.deactivate,n=M([]),m=M([]),G=M(!1),N=O(()=>{if(Y.value){let l=m.value||[],s=[];return l.forEach(y=>{Se(y[A.value]).forEach(W=>{s.push(Object.assign({},W,y.disabled?{disabled:!0}:{}))})}),s}else{let l=Se(m.value||[]);return n.value.length&&(l=l.concat(n.value)),l}}),Oe=O(()=>Y.value?Fe((m.value||[]).map(l=>{const s=Se(l[A.value]);return{...l,group:!0,[A.value]:ye(s,!1).map(y=>Object.assign({},y,l.disabled?{disabled:!0}:{})),__VISIBLE__:ye(s).map(y=>Object.assign({},y,l.disabled?{disabled:!0}:{}))}})):[]),oe=O(()=>{let l=N.value;return be.value.length&&(l=be.value.concat(l)),l=ye(l),f.value>0&&(l=l.slice(0,f.value)),l}),ge=O(()=>{switch(o.value){case"single":return!H(S.value[d.value]);case"multiple":case"tags":return!H(S.value)&&S.value.length>0}}),Te=O(()=>b!==void 0&&b.value!==void 0?b.value(S.value):S.value&&S.value.length>1?`${S.value.length} options selected`:"1 option selected"),Ce=O(()=>!N.value.length&&!G.value&&!be.value.length),De=O(()=>N.value.length>0&&oe.value.length==0&&(T.value&&Y.value||!Y.value)),be=O(()=>t.value===!1||!T.value?[]:Ne(T.value)!==-1?[]:[{[d.value]:T.value,[c.value]:T.value,[v.value]:T.value}]),Ee=O(()=>{switch(o.value){case"single":return null;case"multiple":case"tags":return[]}}),Ve=O(()=>V.value||G.value),te=l=>{switch(typeof l!="object"&&(l=z(l)),o.value){case"single":_(l);break;case"multiple":case"tags":_(S.value.concat(l));break}u.emit("select",we(l),l)},ee=l=>{switch(typeof l!="object"&&(l=z(l)),o.value){case"single":Pe();break;case"tags":case"multiple":_(Array.isArray(l)?S.value.filter(s=>l.map(y=>y[d.value]).indexOf(s[d.value])===-1):S.value.filter(s=>s[d.value]!=l[d.value]));break}u.emit("deselect",we(l),l)},we=l=>B.value?l:l[d.value],Le=l=>{ee(l)},Re=(l,s)=>{if(s.button!==0){s.preventDefault();return}Le(l)},Pe=()=>{u.emit("clear"),_(Ee.value)},U=l=>{if(l.group!==void 0)return o.value==="single"?!1:Me(l[A.value])&&l[A.value].length;switch(o.value){case"single":return!H(S.value)&&S.value[d.value]==l[d.value];case"tags":case"multiple":return!H(S.value)&&S.value.map(s=>s[d.value]).indexOf(l[d.value])!==-1}},he=l=>l.disabled===!0,me=()=>L===void 0||L.value===-1||!ge.value&&L.value>0?!1:S.value.length>=L.value,Ge=l=>{if(!he(l)){switch(o.value){case"single":if(U(l)){R.value&&ee(l);return}K(),te(l);break;case"multiple":if(U(l)){ee(l);return}if(me())return;te(l),k.value&&$(),g.value&&ue(),Q.value&&K();break;case"tags":if(U(l)){ee(l);return}if(me())return;z(l[d.value])===void 0&&t.value&&(u.emit("tag",l[d.value]),p.value&&xe(l),$()),k.value&&$(),te(l),g.value&&ue(),Q.value&&K();break}Q.value&&ae()}},je=l=>{if(!(he(l)||o.value==="single"||!pe.value)){switch(o.value){case"multiple":case"tags":Ae(l[A.value])?ee(l[A.value]):te(l[A.value].filter(s=>S.value.map(y=>y[d.value]).indexOf(s[d.value])===-1).filter(s=>!s.disabled).filter((s,y)=>S.value.length+1+y<=L.value||L.value===-1));break}Q.value&&ae()}},Ae=l=>l.find(s=>!U(s)&&!s.disabled)===void 0,Me=l=>l.find(s=>!U(s))===void 0,z=l=>N.value[N.value.map(s=>String(s[d.value])).indexOf(String(l))],Ne=(l,s=!0)=>N.value.map(y=>y[v.value]).indexOf(l),He=l=>["tags","multiple"].indexOf(o.value)!==-1&&g.value&&U(l),xe=l=>{n.value.push(l)},Fe=l=>ve.value?l.filter(s=>T.value?s.__VISIBLE__.length:s[A.value].length):l.filter(s=>T.value?s.__VISIBLE__.length:!0),ye=(l,s=!0)=>{let y=l;return T.value&&j.value&&(y=y.filter(W=>Be(W[v.value],Z.value).indexOf(Be(T.value,Z.value))!==-1)),g.value&&s&&(y=y.filter(W=>!He(W))),y},Se=l=>{let s=l;return el(s)&&(s=Object.keys(s).map(y=>{let W=s[y];return{[d.value]:y,[v.value]:W,[c.value]:W}})),s=s.map(y=>typeof y=="object"?y:{[d.value]:y,[v.value]:y,[c.value]:y}),s},ie=()=>{H(F.value)||(S.value=ce(F.value))},ke=l=>{G.value=!0,i.value(T.value).then(s=>{m.value=s,typeof l=="function"&&l(s),G.value=!1})},ze=()=>{if(ge.value)if(o.value==="single"){let l=z(S.value[d.value])[c.value];S.value[c.value]=l,B.value&&(F.value[c.value]=l)}else S.value.forEach((l,s)=>{let y=z(S.value[s][d.value])[c.value];S.value[s][c.value]=y,B.value&&(F.value[s][c.value]=y)})},Ke=l=>{ke(l)},ce=l=>H(l)?o.value==="single"?{}:[]:B.value?l:o.value==="single"?z(l)||{}:l.filter(s=>!!z(s)).map(s=>z(s));if(o.value!=="single"&&!H(F.value)&&!Array.isArray(F.value))throw new Error(`v-model must be an array when using "${o.value}" mode`);return i&&typeof i.value=="function"?h.value?ke(ie):B.value==!0&&ie():(m.value=i.value,ie()),D.value>-1&&re(T,l=>{l.length<r.value||(G.value=!0,X.value&&(m.value=[]),setTimeout(()=>{l==T.value&&i.value(T.value).then(s=>{l==T.value&&(m.value=s,fe.value=oe.value.filter(y=>y.disabled!==!0)[0]||null,G.value=!1)})},D.value))},{flush:"sync"}),re(F,l=>{if(H(l)){S.value=ce(l);return}switch(o.value){case"single":(B.value?l[d.value]!=S.value[d.value]:l!=S.value[d.value])&&(S.value=ce(l));break;case"multiple":case"tags":ll(B.value?l.map(s=>s[d.value]):l,S.value.map(s=>s[d.value]))||(S.value=ce(l));break}},{deep:!0}),typeof e.options!="function"&&re(i,(l,s)=>{m.value=e.options,Object.keys(S.value).length||ie(),ze()}),{fo:oe,filteredOptions:oe,hasSelected:ge,multipleLabelText:Te,eo:N,extendedOptions:N,fg:Oe,filteredGroups:Oe,noOptions:Ce,noResults:De,resolving:G,busy:Ve,select:te,deselect:ee,remove:Le,clear:Pe,isSelected:U,isDisabled:he,isMax:me,getOption:z,handleOptionClick:Ge,handleGroupClick:je,handleTagRemove:Re,refreshOptions:Ke,resolveOptions:ke}}function tl(e,u,a){const{valueProp:i,showOptions:o,searchable:v,groupLabel:f,groups:g,mode:t,groupSelect:c}=x(e),p=a.fo,b=a.fg,B=a.handleOptionClick,V=a.handleGroupClick,D=a.search,h=a.pointer,r=a.setPointer,j=a.clearPointer,X=a.multiselect,k=O(()=>p.value.filter(n=>!n.disabled)),d=O(()=>b.value.filter(n=>!n.disabled)),R=O(()=>t.value!=="single"&&c.value),L=O(()=>h.value&&h.value.group),Z=O(()=>K(h.value)),Q=O(()=>{const n=L.value?h.value:K(h.value),m=d.value.map(N=>N[f.value]).indexOf(n[f.value]);let G=d.value[m-1];return G===void 0&&(G=se.value),G}),Y=O(()=>{let n=d.value.map(m=>m.label).indexOf(L.value?h.value[f.value]:K(h.value)[f.value])+1;return d.value.length<=n&&(n=0),d.value[n]}),se=O(()=>[...d.value].slice(-1)[0]),A=O(()=>h.value.__VISIBLE__.filter(n=>!n.disabled)[0]),ve=O(()=>{const n=Z.value.__VISIBLE__.filter(m=>!m.disabled);return n[n.map(m=>m[i.value]).indexOf(h.value[i.value])-1]}),pe=O(()=>{const n=K(h.value).__VISIBLE__.filter(m=>!m.disabled);return n[n.map(m=>m[i.value]).indexOf(h.value[i.value])+1]}),S=O(()=>[...Q.value.__VISIBLE__.filter(n=>!n.disabled)].slice(-1)[0]),F=O(()=>[...se.value.__VISIBLE__.filter(n=>!n.disabled)].slice(-1)[0]),T=n=>{if(h.value)return n.group?h.value[f.value]==n[f.value]:h.value[i.value]==n[i.value]},$=()=>{r(k.value[0]||null)},_=()=>{!h.value||h.value.disabled===!0||(L.value?V(h.value):B(h.value))},fe=()=>{if(h.value===null)r((g.value&&R.value?d.value[0]:k.value[0])||null);else if(g.value&&R.value){let n=L.value?A.value:pe.value;n===void 0&&(n=Y.value),r(n||null)}else{let n=k.value.map(m=>m[i.value]).indexOf(h.value[i.value])+1;k.value.length<=n&&(n=0),r(k.value[n]||null)}Ie(()=>{ae()})},ue=()=>{if(h.value===null){let n=k.value[k.value.length-1];g.value&&R.value&&(n=F.value,n===void 0&&(n=se.value)),r(n||null)}else if(g.value&&R.value){let n=L.value?S.value:ve.value;n===void 0&&(n=L.value?Q.value:Z.value),r(n||null)}else{let n=k.value.map(m=>m[i.value]).indexOf(h.value[i.value])-1;n<0&&(n=k.value.length-1),r(k.value[n]||null)}Ie(()=>{ae()})},K=n=>d.value.find(m=>m.__VISIBLE__.map(G=>G[i.value]).indexOf(n[i.value])!==-1),ae=()=>{let n=X.value.querySelector("[data-pointed]");if(!n)return;let m=n.parentElement.parentElement;g.value&&(m=L.value?n.parentElement.parentElement.parentElement:n.parentElement.parentElement.parentElement.parentElement),n.offsetTop+n.offsetHeight>m.clientHeight+m.scrollTop&&(m.scrollTop=n.offsetTop+n.offsetHeight-m.clientHeight),n.offsetTop<m.scrollTop&&(m.scrollTop=n.offsetTop)};return re(D,n=>{v.value&&(n.length&&o.value?$():j())}),{pointer:h,canPointGroups:R,isPointed:T,setPointerFirst:$,selectPointer:_,forwardPointer:fe,backwardPointer:ue}}function nl(e,u,a){const{disabled:i}=x(e),o=M(!1);return{isOpen:o,open:()=>{o.value||i.value||(o.value=!0,u.emit("open"))},close:()=>{o.value&&(o.value=!1,u.emit("close"))}}}function rl(e,u,a){const{searchable:i,disabled:o}=x(e),v=a.input,f=a.open,g=a.close,t=a.clearSearch,c=M(null),p=M(!1),b=O(()=>i.value||o.value?-1:0),B=()=>{i.value&&v.value.blur(),c.value.blur()},V=()=>{i.value&&!o.value&&v.value.focus()},D=()=>{o.value||(p.value=!0,f())},h=()=>{p.value=!1,setTimeout(()=>{p.value||(g(),t())},1)};return{multiselect:c,tabindex:b,isActive:p,blur:B,handleFocus:V,activate:D,deactivate:h,handleCaretClick:()=>{p.value?(h(),B()):D()}}}function sl(e,u,a){const{mode:i,addTagOn:o,createTag:v,openDirection:f,searchable:g,showOptions:t,valueProp:c,groups:p}=x(e),b=a.iv,B=a.update,V=a.search,D=a.setPointer,h=a.selectPointer,r=a.backwardPointer,j=a.forwardPointer,X=a.blur,k=a.fo,d=()=>{i.value==="tags"&&!t.value&&v.value&&g.value&&!p.value&&D(k.value[k.value.map(L=>L[c.value]).indexOf(V.value)])};return{handleKeydown:L=>{switch(L.keyCode){case 8:if(i.value==="single"||g.value&&[null,""].indexOf(V.value)===-1||b.value.length===0)return;B([...b.value].slice(0,-1));break;case 13:if(L.preventDefault(),i.value==="tags"&&o.value.indexOf("enter")===-1&&v.value)return;d(),h();break;case 32:if(g.value&&i.value!=="tags"&&!v.value||i.value==="tags"&&(o.value.indexOf("space")===-1&&v.value||!v.value))return;L.preventDefault(),d(),h();break;case 9:case 186:case 188:if(i.value!=="tags")return;const Z={9:"tab",186:";",188:","};if(o.value.indexOf(Z[L.keyCode])===-1||!v.value)return;d(),h(),L.preventDefault();break;case 27:X();break;case 38:if(L.preventDefault(),!t.value)return;f.value==="top"?j():r();break;case 40:if(L.preventDefault(),!t.value)return;f.value==="top"?r():j();break}},preparePointer:d}}function ul(e,u,a){const i=x(e),{disabled:o,openDirection:v,showOptions:f,invalid:g}=i,t=a.isOpen,c=a.isPointed,p=a.isSelected,b=a.isDisabled,B=a.isActive,V=a.canPointGroups,D=a.resolving,h=a.fo,r={container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",containerInvalid:"is-invalid",containerInvalidActive:"is-invalid-active",singleLabel:"multiselect-single-label",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",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",spacer:"multiselect-spacer",...i.classes.value},j=O(()=>!!(t.value&&f.value&&(!D.value||D.value&&h.value.length)));return{classList:O(()=>({container:[r.container].concat(o.value?r.containerDisabled:[]).concat(j.value&&v.value==="top"?r.containerOpenTop:[]).concat(j.value&&v.value!=="top"?r.containerOpen:[]).concat(B.value?r.containerActive:[]).concat(g.value?r.containerInvalid:[]),spacer:r.spacer,singleLabel:r.singleLabel,multipleLabel:r.multipleLabel,search:r.search,tags:r.tags,tag:[r.tag].concat(o.value?r.tagDisabled:[]),tagRemove:r.tagRemove,tagRemoveIcon:r.tagRemoveIcon,tagsSearchWrapper:r.tagsSearchWrapper,tagsSearch:r.tagsSearch,tagsSearchCopy:r.tagsSearchCopy,placeholder:r.placeholder,caret:[r.caret].concat(t.value?r.caretOpen:[]),clear:r.clear,clearIcon:r.clearIcon,spinner:r.spinner,dropdown:[r.dropdown].concat(v.value==="top"?r.dropdownTop:[]).concat(!t.value||!f.value||!j.value?r.dropdownHidden:[]),options:[r.options].concat(v.value==="top"?r.optionsTop:[]),group:r.group,groupLabel:k=>{let d=[r.groupLabel];return c(k)?d.push(p(k)?r.groupLabelSelectedPointed:r.groupLabelPointed):p(k)&&V.value?d.push(b(k)?r.groupLabelSelectedDisabled:r.groupLabelSelected):b(k)&&d.push(r.groupLabelDisabled),V.value&&d.push(r.groupLabelPointable),d},groupOptions:r.groupOptions,option:(k,d)=>{let R=[r.option];return c(k)?R.push(p(k)?r.optionSelectedPointed:r.optionPointed):p(k)?R.push(b(k)?r.optionSelectedDisabled:r.optionSelected):(b(k)||d&&b(d))&&R.push(r.optionDisabled),R},noOptions:r.noOptions,noResults:r.noResults,fakeInput:r.fakeInput})),showDropdown:j}}const ol={name:"BaseMultiselect",props:{preserveSearch:{type:Boolean,default:!1},initialSearch:{type:String,default:null},contentLoading:{type:Boolean,default:!1},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:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!1},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},addTagOn:{type:Array,required:!1,default:()=>["enter"]},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},invalid:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({container:"p-0 relative mx-auto w-full flex items-center justify-end box-border cursor-pointer border border-gray-200 rounded-md bg-white text-sm leading-snug outline-none max-h-10",containerDisabled:"cursor-default bg-gray-200 bg-opacity-50 !text-gray-400",containerOpen:"",containerOpenTop:"",containerActive:"ring-1 ring-primary-400 border-primary-400",containerInvalid:"border-red-400 ring-red-400 focus:ring-red-400 focus:border-red-400",containerInvalidActive:"ring-1 border-red-400 ring-red-400",singleLabel:"flex items-center h-full absolute left-0 top-0 pointer-events-none bg-transparent leading-snug pl-3.5",multipleLabel:"flex items-center h-full absolute left-0 top-0 pointer-events-none bg-transparent leading-snug pl-3.5",search:"w-full absolute inset-0 outline-none appearance-none box-border border-0 text-sm font-sans bg-white rounded-md pl-3.5",tags:"grow shrink flex flex-wrap mt-1 pl-2",tag:"bg-primary-500 text-white text-sm font-semibold py-0.5 pl-2 rounded mr-1 mb-1 flex items-center whitespace-nowrap",tagDisabled:"pr-2 !bg-gray-400 text-white",tagRemove:"flex items-center justify-center p-1 mx-0.5 rounded-sm hover:bg-black hover:bg-opacity-10 group",tagRemoveIcon:"bg-multiselect-remove text-white bg-center bg-no-repeat opacity-30 inline-block w-3 h-3 group-hover:opacity-60",tagsSearchWrapper:"inline-block relative mx-1 mb-1 grow shrink h-full",tagsSearch:"absolute inset-0 border-0 focus:outline-none !shadow-none !focus:shadow-none appearance-none p-0 text-sm font-sans box-border w-full",tagsSearchCopy:"invisible whitespace-pre-wrap inline-block h-px",placeholder:"flex items-center h-full absolute left-0 top-0 pointer-events-none bg-transparent leading-snug pl-3.5 text-gray-400 text-sm",caret:"bg-multiselect-caret bg-center bg-no-repeat w-5 h-5 py-px box-content z-5 relative mr-1 opacity-40 shrink-0 grow-0 transition-transform",caretOpen:"rotate-180 pointer-events-auto",clear:"pr-3.5 relative z-10 opacity-40 transition duration-300 shrink-0 grow-0 flex hover:opacity-80",clearIcon:"bg-multiselect-remove bg-center bg-no-repeat w-2.5 h-4 py-px box-content inline-block",spinner:"bg-multiselect-spinner bg-center bg-no-repeat w-4 h-4 z-10 mr-3.5 animate-spin shrink-0 grow-0",dropdown:"max-h-60 shadow-lg absolute -left-px -right-px -bottom-1 translate-y-full border border-gray-300 mt-1 overflow-y-auto z-50 bg-white flex flex-col rounded-md",dropdownTop:"-translate-y-full -top-2 bottom-auto flex-col-reverse rounded-md",dropdownHidden:"hidden",options:"flex flex-col p-0 m-0 list-none",optionsTop:"flex-col-reverse",group:"p-0 m-0",groupLabel:"flex text-sm box-border items-center justify-start text-left py-1 px-3 font-semibold bg-gray-200 cursor-default leading-normal",groupLabelPointable:"cursor-pointer",groupLabelPointed:"bg-gray-300 text-gray-700",groupLabelSelected:"bg-primary-600 text-white",groupLabelDisabled:"bg-gray-100 text-gray-300 cursor-not-allowed",groupLabelSelectedPointed:"bg-primary-600 text-white opacity-90",groupLabelSelectedDisabled:"text-primary-100 bg-primary-600 bg-opacity-50 cursor-not-allowed",groupOptions:"p-0 m-0",option:"flex items-center justify-start box-border text-left cursor-pointer text-sm leading-snug py-2 px-3",optionPointed:"text-gray-800 bg-gray-100",optionSelected:"text-white bg-primary-500",optionDisabled:"text-gray-300 cursor-not-allowed",optionSelectedPointed:"text-white bg-primary-500 opacity-90",optionSelectedDisabled:"text-primary-100 bg-primary-500 bg-opacity-50 cursor-not-allowed",noOptions:"py-2 px-3 text-gray-600 bg-white",noResults:"py-2 px-3 text-gray-600 bg-white",fakeInput:"bg-transparent absolute left-0 right-0 -bottom-px w-full h-px border-0 p-0 appearance-none outline-none text-transparent",spacer:"h-9 py-px box-content"})},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"}},emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change","clear"],setup(e,u){const a=Ye(e,u),i=_e(e),o=nl(e,u),v=$e(e,u),f=Xe(e,u,{iv:a.iv}),g=rl(e,u,{input:v.input,open:o.open,close:o.close,clearSearch:v.clearSearch}),t=al(e,u,{ev:a.ev,iv:a.iv,search:v.search,clearSearch:v.clearSearch,update:f.update,pointer:i.pointer,clearPointer:i.clearPointer,blur:g.blur,deactivate:g.deactivate}),c=tl(e,u,{fo:t.fo,fg:t.fg,handleOptionClick:t.handleOptionClick,handleGroupClick:t.handleGroupClick,search:v.search,pointer:i.pointer,setPointer:i.setPointer,clearPointer:i.clearPointer,multiselect:g.multiselect}),p=sl(e,u,{iv:a.iv,update:f.update,search:v.search,setPointer:i.setPointer,selectPointer:c.selectPointer,backwardPointer:c.backwardPointer,forwardPointer:c.forwardPointer,blur:g.blur,fo:t.fo}),b=ul(e,u,{isOpen:o.isOpen,isPointed:c.isPointed,canPointGroups:c.canPointGroups,isSelected:t.isSelected,isDisabled:t.isDisabled,isActive:g.isActive,resolving:t.resolving,fo:t.fo});return{...a,...o,...g,...i,...f,...v,...t,...c,...p,...b}}},il=["id","tabindex"],cl=["type","modelValue","value","autocomplete"],dl=["onMousedown"],vl=["type","modelValue","value","autocomplete"],pl={class:"w-full overflow-y-auto"},fl=["data-pointed","onMouseenter","onClick"],gl=["data-pointed","onMouseenter","onClick"],bl=["data-pointed","onMouseenter","onClick"],hl=["innerHTML"],ml=["innerHTML"],yl=["value"],Sl=["name","value"],kl=["name","value"];function Ol(e,u,a,i,o,v){const f=qe("BaseContentPlaceholdersBox"),g=qe("BaseContentPlaceholders");return a.contentLoading?(I(),Je(g,{key:0},{default:Ze(()=>[Qe(f,{rounded:!0,class:"w-full",style:{height:"40px"}})]),_:1})):(I(),q("div",{key:1,id:a.id,ref:"multiselect",tabindex:e.tabindex,class:w(e.classList.container),onFocusin:u[6]||(u[6]=(...t)=>e.activate&&e.activate(...t)),onFocusout:u[7]||(u[7]=(...t)=>e.deactivate&&e.deactivate(...t)),onKeydown:u[8]||(u[8]=(...t)=>e.handleKeydown&&e.handleKeydown(...t)),onFocus:u[9]||(u[9]=(...t)=>e.handleFocus&&e.handleFocus(...t))},[a.mode!=="tags"&&a.searchable&&!a.disabled?(I(),q("input",{key:0,ref:"input",type:a.inputType,modelValue:e.search,value:e.search,class:w(e.classList.search),autocomplete:a.autocomplete,onInput:u[0]||(u[0]=(...t)=>e.handleSearchInput&&e.handleSearchInput(...t)),onPaste:u[1]||(u[1]=de((...t)=>e.handlePaste&&e.handlePaste(...t),["stop"]))},null,42,cl)):E("",!0),a.mode=="tags"?(I(),q("div",{key:1,class:w(e.classList.tags)},[(I(!0),q(le,null,ne(e.iv,(t,c,p)=>C(e.$slots,"tag",{option:t,handleTagRemove:e.handleTagRemove,disabled:a.disabled},()=>[(I(),q("span",{key:p,class:w(e.classList.tag)},[Ue(J(t[a.label])+" ",1),a.disabled?E("",!0):(I(),q("span",{key:0,class:w(e.classList.tagRemove),onMousedown:de(b=>e.handleTagRemove(t,b),["stop"])},[P("span",{class:w(e.classList.tagRemoveIcon)},null,2)],42,dl))],2))])),256)),P("div",{class:w(e.classList.tagsSearchWrapper)},[P("span",{class:w(e.classList.tagsSearchCopy)},J(e.search),3),a.searchable&&!a.disabled?(I(),q("input",{key:0,ref:"input",type:a.inputType,modelValue:e.search,value:e.search,class:w(e.classList.tagsSearch),autocomplete:a.autocomplete,style:{"box-shadow":"none !important"},onInput:u[2]||(u[2]=(...t)=>e.handleSearchInput&&e.handleSearchInput(...t)),onPaste:u[3]||(u[3]=de((...t)=>e.handlePaste&&e.handlePaste(...t),["stop"]))},null,42,vl)):E("",!0)],2)],2)):E("",!0),a.mode=="single"&&e.hasSelected&&!e.search&&e.iv?C(e.$slots,"singlelabel",{key:2,value:e.iv},()=>[P("div",{class:w(e.classList.singleLabel)},J(e.iv[a.label]),3)]):E("",!0),a.mode=="multiple"&&e.hasSelected&&!e.search?C(e.$slots,"multiplelabel",{key:3,values:e.iv},()=>[P("div",{class:w(e.classList.multipleLabel)},J(e.multipleLabelText),3)]):E("",!0),a.placeholder&&!e.hasSelected&&!e.search?C(e.$slots,"placeholder",{key:4},()=>[P("div",{class:w(e.classList.placeholder)},J(a.placeholder),3)]):E("",!0),e.busy?C(e.$slots,"spinner",{key:5},()=>[P("span",{class:w(e.classList.spinner)},null,2)]):E("",!0),e.hasSelected&&!a.disabled&&a.canClear&&!e.busy?C(e.$slots,"clear",{key:6,clear:e.clear},()=>[P("span",{class:w(e.classList.clear),onMousedown:u[4]||(u[4]=(...t)=>e.clear&&e.clear(...t))},[P("span",{class:w(e.classList.clearIcon)},null,2)],34)]):E("",!0),a.caret?C(e.$slots,"caret",{key:7},()=>[P("span",{class:w(e.classList.caret),onMousedown:u[5]||(u[5]=de((...t)=>e.handleCaretClick&&e.handleCaretClick(...t),["prevent","stop"]))},null,34)]):E("",!0),P("div",{class:w(e.classList.dropdown),tabindex:"-1"},[P("div",pl,[C(e.$slots,"beforelist",{options:e.fo}),P("ul",{class:w(e.classList.options)},[a.groups?(I(!0),q(le,{key:0},ne(e.fg,(t,c,p)=>(I(),q("li",{key:p,class:w(e.classList.group)},[P("div",{class:w(e.classList.groupLabel(t)),"data-pointed":e.isPointed(t),onMouseenter:b=>e.setPointer(t),onClick:b=>e.handleGroupClick(t)},[C(e.$slots,"grouplabel",{group:t},()=>[P("span",null,J(t[a.groupLabel]),1)])],42,fl),P("ul",{class:w(e.classList.groupOptions)},[(I(!0),q(le,null,ne(t.__VISIBLE__,(b,B,V)=>(I(),q("li",{key:V,class:w(e.classList.option(b,t)),"data-pointed":e.isPointed(b),onMouseenter:D=>e.setPointer(b),onClick:D=>e.handleOptionClick(b)},[C(e.$slots,"option",{option:b,search:e.search},()=>[P("span",null,J(b[a.label]),1)])],42,gl))),128))],2)],2))),128)):(I(!0),q(le,{key:1},ne(e.fo,(t,c,p)=>(I(),q("li",{key:p,class:w(e.classList.option(t)),"data-pointed":e.isPointed(t),onMouseenter:b=>e.setPointer(t),onClick:b=>e.handleOptionClick(t)},[C(e.$slots,"option",{option:t,search:e.search},()=>[P("span",null,J(t[a.label]),1)])],42,bl))),128))],2),e.noOptions?C(e.$slots,"nooptions",{key:0},()=>[P("div",{class:w(e.classList.noOptions),innerHTML:a.noOptionsText},null,10,hl)]):E("",!0),e.noResults?C(e.$slots,"noresults",{key:1},()=>[P("div",{class:w(e.classList.noResults),innerHTML:a.noResultsText},null,10,ml)]):E("",!0),C(e.$slots,"afterlist",{options:e.fo})]),C(e.$slots,"action")],2),a.required?(I(),q("input",{key:8,class:w(e.classList.fakeInput),tabindex:"-1",value:e.textValue,required:""},null,10,yl)):E("",!0),a.nativeSupport?(I(),q(le,{key:9},[a.mode=="single"?(I(),q("input",{key:0,type:"hidden",name:a.name,value:e.plainValue!==void 0?e.plainValue:""},null,8,Sl)):(I(!0),q(le,{key:1},ne(e.plainValue,(t,c)=>(I(),q("input",{key:c,type:"hidden",name:`${a.name}[]`,value:t},null,8,kl))),128))],64)):E("",!0),P("div",{class:w(e.classList.spacer)},null,2)],42,il))}const Ll=We(ol,[["render",Ol]]);export{Ll as default};
|