el-select-BmEit5oM.js 25 KB

1
  1. import{s as lt,i as I,c as r,aH as U,as as al,a7 as ye,aE as tt,aA as K,ag as Y,ah as nt,br as J,V as j,ab as ke,c6 as at,al as Se,d as re,D as ae,R as Re,a as w,o as b,U as T,b as V,t as B,ao as L,Y as c,an as oe,aI as sl,e as Ve,aw as Me,j as ie,aF as st,O as z,M as R,ar as ge,k as $e,b7 as ot,c7 as it,bT as rt,aa as ut,aj as dt,bV as ct,ae as N,c8 as pt,ai as ft,a8 as he,c9 as Je,ac as Xe,bm as vt,a2 as mt,T as bt,aC as ne,ca as ht,bs as gt,cb as yt,a6 as Q,b$ as St,ad as ol,a1 as Ct,a4 as Ot,bP as wt,bt as Ze,at as le,bQ as It,bw as Vt,b6 as _e,bR as Et,a5 as Tt,cc as kt,B as A,C as Rt,m as H,w as $,H as P,F as xe,r as el,q as ll,n as te,cd as Mt,aq as Ee,ce as $t,bu as Dt,S as Lt,bo as Bt,bx as Nt,au as il,cf as Wt,bq as Ft,ax as Pt,ay as rl}from"./index-DxXX42ml.js";import{t as tl,E as zt}from"./index-BCy9SLE4.js";import{s as Ce,a as ul}from"./token-DI9FKtlJ.js";import{i as se}from"./isEqual-CSVjcqMI.js";import{b as Kt}from"./el-tag-BbPp_kf6.js";function At(e,o,a,v){e.length;for(var s=a+1;s--;)if(o(e[s],s,e))return s;return-1}function Ht(e,o,a){var v=e==null?0:e.length;if(!v)return-1;var s=v-1;return At(e,Kt(o),s)}function Ut(){const e=lt(),o=I(0),a=11,v=r(()=>({minWidth:`${Math.max(o.value,a)}px`}));return U(e,()=>{var g,t;o.value=(t=(g=e.value)==null?void 0:g.getBoundingClientRect().width)!=null?t:0}),{calculatorRef:e,calculatorWidth:o,inputStyle:v}}const Te="ElOption",jt=al({value:{type:[String,Number,Boolean,Object],required:!0},label:{type:[String,Number]},created:Boolean,disabled:Boolean});function qt(e,o){const a=ye(Ce);a||tt(Te,"usage: <el-select><el-option /></el-select/>");const v=ye(ul,{disabled:!1}),s=r(()=>d(K(a.props.modelValue),e.value)),g=r(()=>{var f;if(a.props.multiple){const C=K((f=a.props.modelValue)!=null?f:[]);return!s.value&&C.length>=a.props.multipleLimit&&a.props.multipleLimit>0}else return!1}),t=r(()=>e.label||(Y(e.value)?"":e.value)),h=r(()=>e.value||e.label||""),p=r(()=>e.disabled||o.groupDisabled||g.value),m=ke(),d=(f=[],C)=>{if(Y(e.value)){const E=a.props.valueKey;return f&&f.some(D=>nt(J(D,E))===J(C,E))}else return f&&f.includes(C)},u=()=>{!e.disabled&&!v.disabled&&(a.states.hoveringIndex=a.optionsArray.indexOf(m.proxy))},y=f=>{const C=new RegExp(at(f),"i");o.visible=C.test(String(t.value))||e.created};return j(()=>t.value,()=>{!e.created&&!a.props.remote&&a.setSelected()}),j(()=>e.value,(f,C)=>{const{remote:E,valueKey:D}=a.props;if((E?f!==C:!se(f,C))&&(a.onOptionDestroy(C,m.proxy),a.onOptionCreate(m.proxy)),!e.created&&!E){if(D&&Y(f)&&Y(C)&&f[D]===C[D])return;a.setSelected()}}),j(()=>v.disabled,()=>{o.groupDisabled=v.disabled},{immediate:!0}),{select:a,currentLabel:t,currentValue:h,itemSelected:s,isDisabled:p,hoverItem:u,updateOption:y}}const Gt=re({name:Te,componentName:Te,props:jt,setup(e){const o=oe("select"),a=sl(),v=r(()=>[o.be("dropdown","item"),o.is("disabled",Ve(h)),o.is("selected",Ve(t)),o.is("hovering",Ve(y))]),s=ie({index:-1,groupDisabled:!1,visible:!0,hover:!1}),{currentLabel:g,itemSelected:t,isDisabled:h,select:p,hoverItem:m,updateOption:d}=qt(e,s),{visible:u,hover:y}=Me(s),f=ke().proxy;p.onOptionCreate(f),st(()=>{const E=f.value,{selected:D}=p.states,q=D.some(ue=>ue.value===f.value);z(()=>{p.states.cachedOptions.get(E)===f&&!q&&p.states.cachedOptions.delete(E)}),p.onOptionDestroy(E,f)});function C(){h.value||p.handleOptionSelect(f)}return{ns:o,id:a,containerKls:v,currentLabel:g,itemSelected:t,isDisabled:h,select:p,visible:u,hover:y,states:s,hoverItem:m,updateOption:d,selectOptionClick:C}}});function Qt(e,o){return ae((b(),w("li",{id:e.id,class:c(e.containerKls),role:"option","aria-disabled":e.isDisabled||void 0,"aria-selected":e.itemSelected,onMousemove:e.hoverItem,onClick:L(e.selectOptionClick,["stop"])},[T(e.$slots,"default",{},()=>[V("span",null,B(e.currentLabel),1)])],42,["id","aria-disabled","aria-selected","onMousemove","onClick"])),[[Re,e.visible]])}var De=Se(Gt,[["render",Qt],["__file","option.vue"]]);const Yt=re({name:"ElSelectDropdown",componentName:"ElSelectDropdown",setup(){const e=ye(Ce),o=oe("select"),a=r(()=>e.props.popperClass),v=r(()=>e.props.multiple),s=r(()=>e.props.fitInputWidth),g=I("");function t(){var h;g.value=`${(h=e.selectRef)==null?void 0:h.offsetWidth}px`}return $e(()=>{t(),U(e.selectRef,t)}),{ns:o,minWidth:g,popperClass:a,isMultiple:v,isFitInputWidth:s}}});function Jt(e,o,a,v,s,g){return b(),w("div",{class:c([e.ns.b("dropdown"),e.ns.is("multiple",e.isMultiple),e.popperClass]),style:ge({[e.isFitInputWidth?"width":"minWidth"]:e.minWidth})},[e.$slots.header?(b(),w("div",{key:0,class:c(e.ns.be("dropdown","header"))},[T(e.$slots,"header")],2)):R("v-if",!0),T(e.$slots,"default"),e.$slots.footer?(b(),w("div",{key:1,class:c(e.ns.be("dropdown","footer"))},[T(e.$slots,"footer")],2)):R("v-if",!0)],6)}var Xt=Se(Yt,[["render",Jt],["__file","select-dropdown.vue"]]);const Zt=(e,o)=>{const{t:a}=ot(),v=sl(),s=oe("select"),g=oe("input"),t=ie({inputValue:"",options:new Map,cachedOptions:new Map,optionValues:[],selected:[],selectionWidth:0,collapseItemWidth:0,selectedLabel:"",hoveringIndex:-1,previousQuery:null,inputHovering:!1,menuVisibleOnFocus:!1,isBeforeHide:!1}),h=I(),p=I(),m=I(),d=I(),u=I(),y=I(),f=I(),C=I(),E=I(),D=I(),q=I(),{isComposing:ue,handleCompositionStart:cl,handleCompositionUpdate:pl,handleCompositionEnd:fl}=it({afterComposition:l=>He(l)}),{wrapperRef:Le,isFocused:Be,handleBlur:vl}=rt(u,{beforeFocus(){return Z.value},afterFocus(){e.automaticDropdown&&!S.value&&(S.value=!0,t.menuVisibleOnFocus=!0)},beforeBlur(l){var n,i;return((n=m.value)==null?void 0:n.isFocusInsideContent(l))||((i=d.value)==null?void 0:i.isFocusInsideContent(l))},afterBlur(){var l;S.value=!1,t.menuVisibleOnFocus=!1,e.validateEvent&&((l=W==null?void 0:W.validate)==null||l.call(W,"blur").catch(n=>Xe()))}}),S=I(!1),X=I(),{form:de,formItem:W}=ut(),{inputId:ml}=dt(e,{formItemContext:W}),{valueOnClear:bl,isEmptyValue:hl}=ct(e),Z=r(()=>e.disabled||(de==null?void 0:de.disabled)),Oe=r(()=>N(e.modelValue)?e.modelValue.length>0:!hl(e.modelValue)),gl=r(()=>{var l;return(l=de==null?void 0:de.statusIcon)!=null?l:!1}),yl=r(()=>e.clearable&&!Z.value&&t.inputHovering&&Oe.value),Ne=r(()=>e.remote&&e.filterable&&!e.remoteShowSuffix?"":e.suffixIcon),Sl=r(()=>s.is("reverse",!!(Ne.value&&S.value))),we=r(()=>(W==null?void 0:W.validateState)||""),Cl=r(()=>we.value&&pt[we.value]),Ol=r(()=>e.remote?300:0),wl=r(()=>e.remote&&!t.inputValue&&t.options.size===0),Il=r(()=>e.loading?e.loadingText||a("el.select.loading"):e.filterable&&t.inputValue&&t.options.size>0&&_.value===0?e.noMatchText||a("el.select.noMatch"):t.options.size===0?e.noDataText||a("el.select.noData"):null),_=r(()=>k.value.filter(l=>l.visible).length),k=r(()=>{const l=Array.from(t.options.values()),n=[];return t.optionValues.forEach(i=>{const O=l.findIndex(M=>M.value===i);O>-1&&n.push(l[O])}),n.length>=l.length?n:l}),Vl=r(()=>Array.from(t.cachedOptions.values())),El=r(()=>{const l=k.value.filter(n=>!n.created).some(n=>n.currentLabel===t.inputValue);return e.filterable&&e.allowCreate&&t.inputValue!==""&&!l}),We=()=>{e.filterable&&ne(e.filterMethod)||e.filterable&&e.remote&&ne(e.remoteMethod)||k.value.forEach(l=>{var n;(n=l.updateOption)==null||n.call(l,t.inputValue)})},Fe=ft(),Tl=r(()=>["small"].includes(Fe.value)?"small":"default"),kl=r({get(){return S.value&&!wl.value},set(l){S.value=l}}),Rl=r(()=>{if(e.multiple&&!he(e.modelValue))return K(e.modelValue).length===0&&!t.inputValue;const l=N(e.modelValue)?e.modelValue[0]:e.modelValue;return e.filterable||he(l)?!t.inputValue:!0}),Ml=r(()=>{var l;const n=(l=e.placeholder)!=null?l:a("el.select.placeholder");return e.multiple||!Oe.value?n:t.selectedLabel}),$l=r(()=>Je?null:"mouseenter");j(()=>e.modelValue,(l,n)=>{e.multiple&&e.filterable&&!e.reserveKeyword&&(t.inputValue="",ce("")),pe(),!se(l,n)&&e.validateEvent&&(W==null||W.validate("change").catch(i=>Xe()))},{flush:"post",deep:!0}),j(()=>S.value,l=>{l?ce(t.inputValue):(t.inputValue="",t.previousQuery=null,t.isBeforeHide=!0),o("visible-change",l)}),j(()=>t.options.entries(),()=>{vt&&(pe(),e.defaultFirstOption&&(e.filterable||e.remote)&&_.value&&Pe())},{flush:"post"}),j([()=>t.hoveringIndex,k],([l])=>{mt(l)&&l>-1?X.value=k.value[l]||{}:X.value={},k.value.forEach(n=>{n.hover=X.value===n})}),bt(()=>{t.isBeforeHide||We()});const ce=l=>{t.previousQuery===l||ue.value||(t.previousQuery=l,e.filterable&&ne(e.filterMethod)?e.filterMethod(l):e.filterable&&e.remote&&ne(e.remoteMethod)&&e.remoteMethod(l),e.defaultFirstOption&&(e.filterable||e.remote)&&_.value?z(Pe):z(Dl))},Pe=()=>{const l=k.value.filter(M=>M.visible&&!M.disabled&&!M.states.groupDisabled),n=l.find(M=>M.created),i=l[0],O=k.value.map(M=>M.value);t.hoveringIndex=Ge(O,n||i)},pe=()=>{if(e.multiple)t.selectedLabel="";else{const n=N(e.modelValue)?e.modelValue[0]:e.modelValue,i=ze(n);t.selectedLabel=i.currentLabel,t.selected=[i];return}const l=[];he(e.modelValue)||K(e.modelValue).forEach(n=>{l.push(ze(n))}),t.selected=l},ze=l=>{let n;const i=ht(l);for(let G=t.cachedOptions.size-1;G>=0;G--){const F=Vl.value[G];if(i?J(F.value,e.valueKey)===J(l,e.valueKey):F.value===l){n={value:l,currentLabel:F.currentLabel,get isDisabled(){return F.isDisabled}};break}}if(n)return n;const O=i?l.label:l??"";return{value:l,currentLabel:O}},Dl=()=>{t.hoveringIndex=k.value.findIndex(l=>t.selected.some(n=>me(n)===me(l)))},Ll=()=>{t.selectionWidth=Number.parseFloat(window.getComputedStyle(p.value).width)},Bl=()=>{t.collapseItemWidth=D.value.getBoundingClientRect().width},Ie=()=>{var l,n;(n=(l=m.value)==null?void 0:l.updatePopper)==null||n.call(l)},Ke=()=>{var l,n;(n=(l=d.value)==null?void 0:l.updatePopper)==null||n.call(l)},Ae=()=>{t.inputValue.length>0&&!S.value&&(S.value=!0),ce(t.inputValue)},He=l=>{if(t.inputValue=l.target.value,e.remote)Ue();else return Ae()},Ue=gt(()=>{Ae()},Ol.value),x=l=>{se(e.modelValue,l)||o(ol,l)},Nl=l=>Ht(l,n=>{const i=t.cachedOptions.get(n);return i&&!i.disabled&&!i.states.groupDisabled}),Wl=l=>{if(e.multiple&&l.code!==St.delete&&l.target.value.length<=0){const n=K(e.modelValue).slice(),i=Nl(n);if(i<0)return;const O=n[i];n.splice(i,1),o(Q,n),x(n),o("remove-tag",O)}},Fl=(l,n)=>{const i=t.selected.indexOf(n);if(i>-1&&!Z.value){const O=K(e.modelValue).slice();O.splice(i,1),o(Q,O),x(O),o("remove-tag",n.value)}l.stopPropagation(),ve()},je=l=>{l.stopPropagation();const n=e.multiple?[]:bl.value;if(e.multiple)for(const i of t.selected)i.isDisabled&&n.push(i.value);o(Q,n),x(n),t.hoveringIndex=-1,S.value=!1,o("clear"),ve()},qe=l=>{var n;if(e.multiple){const i=K((n=e.modelValue)!=null?n:[]).slice(),O=Ge(i,l);O>-1?i.splice(O,1):(e.multipleLimit<=0||i.length<e.multipleLimit)&&i.push(l.value),o(Q,i),x(i),l.created&&ce(""),e.filterable&&!e.reserveKeyword&&(t.inputValue="")}else o(Q,l.value),x(l.value),S.value=!1;ve(),!S.value&&z(()=>{fe(l)})},Ge=(l,n)=>he(n)?-1:Y(n.value)?l.findIndex(i=>se(J(i,e.valueKey),me(n))):l.indexOf(n.value),fe=l=>{var n,i,O,M,G;const F=N(l)?l[0]:l;let be=null;if(F!=null&&F.value){const ee=k.value.filter(et=>et.value===F.value);ee.length>0&&(be=ee[0].$el)}if(m.value&&be){const ee=(M=(O=(i=(n=m.value)==null?void 0:n.popperRef)==null?void 0:i.contentRef)==null?void 0:O.querySelector)==null?void 0:M.call(O,`.${s.be("dropdown","wrap")}`);ee&&yt(ee,be)}(G=q.value)==null||G.handleScroll()},Pl=l=>{t.options.set(l.value,l),t.cachedOptions.set(l.value,l)},zl=(l,n)=>{t.options.get(l)===n&&t.options.delete(l)},Kl=r(()=>{var l,n;return(n=(l=m.value)==null?void 0:l.popperRef)==null?void 0:n.contentRef}),Al=()=>{t.isBeforeHide=!1,z(()=>{var l;(l=q.value)==null||l.update(),fe(t.selected)})},ve=()=>{var l;(l=u.value)==null||l.focus()},Hl=()=>{var l;if(S.value){S.value=!1,z(()=>{var n;return(n=u.value)==null?void 0:n.blur()});return}(l=u.value)==null||l.blur()},Ul=l=>{je(l)},jl=l=>{if(S.value=!1,Be.value){const n=new FocusEvent("focus",l);z(()=>vl(n))}},ql=()=>{t.inputValue.length>0?t.inputValue="":S.value=!1},Qe=()=>{Z.value||(Je&&(t.inputHovering=!0),t.menuVisibleOnFocus?t.menuVisibleOnFocus=!1:S.value=!S.value)},Gl=()=>{if(!S.value)Qe();else{const l=k.value[t.hoveringIndex];l&&!l.isDisabled&&qe(l)}},me=l=>Y(l.value)?J(l.value,e.valueKey):l.value,Ql=r(()=>k.value.filter(l=>l.visible).every(l=>l.isDisabled)),Yl=r(()=>e.multiple?e.collapseTags?t.selected.slice(0,e.maxCollapseTags):t.selected:[]),Jl=r(()=>e.multiple?e.collapseTags?t.selected.slice(e.maxCollapseTags):[]:[]),Ye=l=>{if(!S.value){S.value=!0;return}if(!(t.options.size===0||_.value===0||ue.value)&&!Ql.value){l==="next"?(t.hoveringIndex++,t.hoveringIndex===t.options.size&&(t.hoveringIndex=0)):l==="prev"&&(t.hoveringIndex--,t.hoveringIndex<0&&(t.hoveringIndex=t.options.size-1));const n=k.value[t.hoveringIndex];(n.isDisabled||!n.visible)&&Ye(l),z(()=>fe(X.value))}},Xl=()=>{if(!p.value)return 0;const l=window.getComputedStyle(p.value);return Number.parseFloat(l.gap||"6px")},Zl=r(()=>{const l=Xl();return{maxWidth:`${D.value&&e.maxCollapseTags===1?t.selectionWidth-t.collapseItemWidth-l:t.selectionWidth}px`}}),_l=r(()=>({maxWidth:`${t.selectionWidth}px`})),xl=l=>{o("popup-scroll",l)};return U(p,Ll),U(C,Ie),U(Le,Ie),U(E,Ke),U(D,Bl),$e(()=>{pe()}),{inputId:ml,contentId:v,nsSelect:s,nsInput:g,states:t,isFocused:Be,expanded:S,optionsArray:k,hoverOption:X,selectSize:Fe,filteredOptionsCount:_,updateTooltip:Ie,updateTagTooltip:Ke,debouncedOnInputChange:Ue,onInput:He,deletePrevTag:Wl,deleteTag:Fl,deleteSelected:je,handleOptionSelect:qe,scrollToOption:fe,hasModelValue:Oe,shouldShowPlaceholder:Rl,currentPlaceholder:Ml,mouseEnterEventName:$l,needStatusIcon:gl,showClose:yl,iconComponent:Ne,iconReverse:Sl,validateState:we,validateIcon:Cl,showNewOption:El,updateOptions:We,collapseTagSize:Tl,setSelected:pe,selectDisabled:Z,emptyText:Il,handleCompositionStart:cl,handleCompositionUpdate:pl,handleCompositionEnd:fl,onOptionCreate:Pl,onOptionDestroy:zl,handleMenuEnter:Al,focus:ve,blur:Hl,handleClearClick:Ul,handleClickOutside:jl,handleEsc:ql,toggleMenu:Qe,selectOption:Gl,getValueKey:me,navigateOptions:Ye,dropdownMenuVisible:kl,showTagList:Yl,collapseTagList:Jl,popupScroll:xl,tagStyle:Zl,collapseTagStyle:_l,popperRef:Kl,inputRef:u,tooltipRef:m,tagTooltipRef:d,prefixRef:y,suffixRef:f,selectRef:h,wrapperRef:Le,selectionRef:p,scrollbarRef:q,menuRef:C,tagMenuRef:E,collapseItemRef:D}};var _t=re({name:"ElOptions",setup(e,{slots:o}){const a=ye(Ce);let v=[];return()=>{var s,g;const t=(s=o.default)==null?void 0:s.call(o),h=[];function p(m){N(m)&&m.forEach(d=>{var u,y,f,C;const E=(u=(d==null?void 0:d.type)||{})==null?void 0:u.name;E==="ElOptionGroup"?p(!Ct(d.children)&&!N(d.children)&&ne((y=d.children)==null?void 0:y.default)?(f=d.children)==null?void 0:f.default():d.children):E==="ElOption"?h.push((C=d.props)==null?void 0:C.value):N(d.children)&&p(d.children)})}return t.length&&p((g=t[0])==null?void 0:g.children),se(h,v)||(v=h,a&&(a.states.optionValues=h)),t}}});const xt=al({name:String,id:String,modelValue:{type:le([Array,String,Number,Boolean,Object]),default:void 0},autocomplete:{type:String,default:"off"},automaticDropdown:Boolean,size:Tt,effect:{type:le(String),default:"light"},disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:{type:String,default:""},popperOptions:{type:le(Object),default:()=>({})},remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String},defaultFirstOption:Boolean,reserveKeyword:{type:Boolean,default:!0},valueKey:{type:String,default:"value"},collapseTags:Boolean,collapseTagsTooltip:Boolean,maxCollapseTags:{type:Number,default:1},teleported:Ze.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:_e,default:Et},fitInputWidth:Boolean,suffixIcon:{type:_e,default:Vt},tagType:{...tl.type,default:"info"},tagEffect:{...tl.effect,default:"light"},validateEvent:{type:Boolean,default:!0},remoteShowSuffix:Boolean,showArrow:{type:Boolean,default:!0},offset:{type:Number,default:12},placement:{type:le(String),values:It,default:"bottom-start"},fallbackPlacements:{type:le(Array),default:["bottom-start","top-start","right","left"]},tabindex:{type:[String,Number],default:0},appendTo:Ze.appendTo,...wt,...Ot(["ariaLabel"])});kt.scroll;const nl="ElSelect",en=re({name:nl,componentName:nl,components:{ElSelectMenu:Xt,ElOption:De,ElOptions:_t,ElTag:zt,ElScrollbar:Nt,ElTooltip:Bt,ElIcon:Lt},directives:{ClickOutside:Dt},props:xt,emits:[Q,ol,"remove-tag","clear","visible-change","focus","blur","popup-scroll"],setup(e,{emit:o}){const a=r(()=>{const{modelValue:p,multiple:m}=e,d=m?[]:void 0;return N(p)?m?p:d:m?d:p}),v=ie({...Me(e),modelValue:a}),s=Zt(v,o),{calculatorRef:g,inputStyle:t}=Ut();il(Ce,ie({props:v,states:s.states,selectRef:s.selectRef,optionsArray:s.optionsArray,setSelected:s.setSelected,handleOptionSelect:s.handleOptionSelect,onOptionCreate:s.onOptionCreate,onOptionDestroy:s.onOptionDestroy}));const h=r(()=>e.multiple?s.states.selected.map(p=>p.currentLabel):s.states.selectedLabel);return{...s,modelValue:a,selectedLabel:h,calculatorRef:g,inputStyle:t}}});function ln(e,o){const a=A("el-tag"),v=A("el-tooltip"),s=A("el-icon"),g=A("el-option"),t=A("el-options"),h=A("el-scrollbar"),p=A("el-select-menu"),m=Rt("click-outside");return ae((b(),w("div",{ref:"selectRef",class:c([e.nsSelect.b(),e.nsSelect.m(e.selectSize)]),[$t(e.mouseEnterEventName)]:d=>e.states.inputHovering=!0,onMouseleave:d=>e.states.inputHovering=!1},[H(v,{ref:"tooltipRef",visible:e.dropdownMenuVisible,placement:e.placement,teleported:e.teleported,"popper-class":[e.nsSelect.e("popper"),e.popperClass],"popper-options":e.popperOptions,"fallback-placements":e.fallbackPlacements,effect:e.effect,pure:"",trigger:"click",transition:`${e.nsSelect.namespace.value}-zoom-in-top`,"stop-popper-mouse-event":!1,"gpu-acceleration":!1,persistent:e.persistent,"append-to":e.appendTo,"show-arrow":e.showArrow,offset:e.offset,onBeforeShow:e.handleMenuEnter,onHide:d=>e.states.isBeforeHide=!1},{default:$(()=>{var d;return[V("div",{ref:"wrapperRef",class:c([e.nsSelect.e("wrapper"),e.nsSelect.is("focused",e.isFocused),e.nsSelect.is("hovering",e.states.inputHovering),e.nsSelect.is("filterable",e.filterable),e.nsSelect.is("disabled",e.selectDisabled)]),onClick:L(e.toggleMenu,["prevent"])},[e.$slots.prefix?(b(),w("div",{key:0,ref:"prefixRef",class:c(e.nsSelect.e("prefix"))},[T(e.$slots,"prefix")],2)):R("v-if",!0),V("div",{ref:"selectionRef",class:c([e.nsSelect.e("selection"),e.nsSelect.is("near",e.multiple&&!e.$slots.prefix&&!!e.states.selected.length)])},[e.multiple?T(e.$slots,"tag",{key:0},()=>[(b(!0),w(xe,null,el(e.showTagList,u=>(b(),w("div",{key:e.getValueKey(u),class:c(e.nsSelect.e("selected-item"))},[H(a,{closable:!e.selectDisabled&&!u.isDisabled,size:e.collapseTagSize,type:e.tagType,effect:e.tagEffect,"disable-transitions":"",style:ge(e.tagStyle),onClose:y=>e.deleteTag(y,u)},{default:$(()=>[V("span",{class:c(e.nsSelect.e("tags-text"))},[T(e.$slots,"label",{label:u.currentLabel,value:u.value},()=>[ll(B(u.currentLabel),1)])],2)]),_:2},1032,["closable","size","type","effect","style","onClose"])],2))),128)),e.collapseTags&&e.states.selected.length>e.maxCollapseTags?(b(),P(v,{key:0,ref:"tagTooltipRef",disabled:e.dropdownMenuVisible||!e.collapseTagsTooltip,"fallback-placements":["bottom","top","right","left"],effect:e.effect,placement:"bottom",teleported:e.teleported},{default:$(()=>[V("div",{ref:"collapseItemRef",class:c(e.nsSelect.e("selected-item"))},[H(a,{closable:!1,size:e.collapseTagSize,type:e.tagType,effect:e.tagEffect,"disable-transitions":"",style:ge(e.collapseTagStyle)},{default:$(()=>[V("span",{class:c(e.nsSelect.e("tags-text"))}," + "+B(e.states.selected.length-e.maxCollapseTags),3)]),_:1},8,["size","type","effect","style"])],2)]),content:$(()=>[V("div",{ref:"tagMenuRef",class:c(e.nsSelect.e("selection"))},[(b(!0),w(xe,null,el(e.collapseTagList,u=>(b(),w("div",{key:e.getValueKey(u),class:c(e.nsSelect.e("selected-item"))},[H(a,{class:"in-tooltip",closable:!e.selectDisabled&&!u.isDisabled,size:e.collapseTagSize,type:e.tagType,effect:e.tagEffect,"disable-transitions":"",onClose:y=>e.deleteTag(y,u)},{default:$(()=>[V("span",{class:c(e.nsSelect.e("tags-text"))},[T(e.$slots,"label",{label:u.currentLabel,value:u.value},()=>[ll(B(u.currentLabel),1)])],2)]),_:2},1032,["closable","size","type","effect","onClose"])],2))),128))],2)]),_:3},8,["disabled","effect","teleported"])):R("v-if",!0)]):R("v-if",!0),V("div",{class:c([e.nsSelect.e("selected-item"),e.nsSelect.e("input-wrapper"),e.nsSelect.is("hidden",!e.filterable)])},[ae(V("input",{id:e.inputId,ref:"inputRef","onUpdate:modelValue":u=>e.states.inputValue=u,type:"text",name:e.name,class:c([e.nsSelect.e("input"),e.nsSelect.is(e.selectSize)]),disabled:e.selectDisabled,autocomplete:e.autocomplete,style:ge(e.inputStyle),tabindex:e.tabindex,role:"combobox",readonly:!e.filterable,spellcheck:"false","aria-activedescendant":((d=e.hoverOption)==null?void 0:d.id)||"","aria-controls":e.contentId,"aria-expanded":e.dropdownMenuVisible,"aria-label":e.ariaLabel,"aria-autocomplete":"none","aria-haspopup":"listbox",onKeydown:[te(L(u=>e.navigateOptions("next"),["stop","prevent"]),["down"]),te(L(u=>e.navigateOptions("prev"),["stop","prevent"]),["up"]),te(L(e.handleEsc,["stop","prevent"]),["esc"]),te(L(e.selectOption,["stop","prevent"]),["enter"]),te(L(e.deletePrevTag,["stop"]),["delete"])],onCompositionstart:e.handleCompositionStart,onCompositionupdate:e.handleCompositionUpdate,onCompositionend:e.handleCompositionEnd,onInput:e.onInput,onClick:L(e.toggleMenu,["stop"])},null,46,["id","onUpdate:modelValue","name","disabled","autocomplete","tabindex","readonly","aria-activedescendant","aria-controls","aria-expanded","aria-label","onKeydown","onCompositionstart","onCompositionupdate","onCompositionend","onInput","onClick"]),[[Mt,e.states.inputValue]]),e.filterable?(b(),w("span",{key:0,ref:"calculatorRef","aria-hidden":"true",class:c(e.nsSelect.e("input-calculator")),textContent:B(e.states.inputValue)},null,10,["textContent"])):R("v-if",!0)],2),e.shouldShowPlaceholder?(b(),w("div",{key:1,class:c([e.nsSelect.e("selected-item"),e.nsSelect.e("placeholder"),e.nsSelect.is("transparent",!e.hasModelValue||e.expanded&&!e.states.inputValue)])},[e.hasModelValue?T(e.$slots,"label",{key:0,label:e.currentPlaceholder,value:e.modelValue},()=>[V("span",null,B(e.currentPlaceholder),1)]):(b(),w("span",{key:1},B(e.currentPlaceholder),1))],2)):R("v-if",!0)],2),V("div",{ref:"suffixRef",class:c(e.nsSelect.e("suffix"))},[e.iconComponent&&!e.showClose?(b(),P(s,{key:0,class:c([e.nsSelect.e("caret"),e.nsSelect.e("icon"),e.iconReverse])},{default:$(()=>[(b(),P(Ee(e.iconComponent)))]),_:1},8,["class"])):R("v-if",!0),e.showClose&&e.clearIcon?(b(),P(s,{key:1,class:c([e.nsSelect.e("caret"),e.nsSelect.e("icon"),e.nsSelect.e("clear")]),onClick:e.handleClearClick},{default:$(()=>[(b(),P(Ee(e.clearIcon)))]),_:1},8,["class","onClick"])):R("v-if",!0),e.validateState&&e.validateIcon&&e.needStatusIcon?(b(),P(s,{key:2,class:c([e.nsInput.e("icon"),e.nsInput.e("validateIcon"),e.nsInput.is("loading",e.validateState==="validating")])},{default:$(()=>[(b(),P(Ee(e.validateIcon)))]),_:1},8,["class"])):R("v-if",!0)],2)],10,["onClick"])]}),content:$(()=>[H(p,{ref:"menuRef"},{default:$(()=>[e.$slots.header?(b(),w("div",{key:0,class:c(e.nsSelect.be("dropdown","header")),onClick:L(()=>{},["stop"])},[T(e.$slots,"header")],10,["onClick"])):R("v-if",!0),ae(H(h,{id:e.contentId,ref:"scrollbarRef",tag:"ul","wrap-class":e.nsSelect.be("dropdown","wrap"),"view-class":e.nsSelect.be("dropdown","list"),class:c([e.nsSelect.is("empty",e.filteredOptionsCount===0)]),role:"listbox","aria-label":e.ariaLabel,"aria-orientation":"vertical",onScroll:e.popupScroll},{default:$(()=>[e.showNewOption?(b(),P(g,{key:0,value:e.states.inputValue,created:!0},null,8,["value"])):R("v-if",!0),H(t,null,{default:$(()=>[T(e.$slots,"default")]),_:3})]),_:3},8,["id","wrap-class","view-class","class","aria-label","onScroll"]),[[Re,e.states.options.size>0&&!e.loading]]),e.$slots.loading&&e.loading?(b(),w("div",{key:1,class:c(e.nsSelect.be("dropdown","loading"))},[T(e.$slots,"loading")],2)):e.loading||e.filteredOptionsCount===0?(b(),w("div",{key:2,class:c(e.nsSelect.be("dropdown","empty"))},[T(e.$slots,"empty",{},()=>[V("span",null,B(e.emptyText),1)])],2)):R("v-if",!0),e.$slots.footer?(b(),w("div",{key:3,class:c(e.nsSelect.be("dropdown","footer")),onClick:L(()=>{},["stop"])},[T(e.$slots,"footer")],10,["onClick"])):R("v-if",!0)]),_:3},512)]),_:3},8,["visible","placement","teleported","popper-class","popper-options","fallback-placements","effect","transition","persistent","append-to","show-arrow","offset","onBeforeShow","onHide"])],16,["onMouseleave"])),[[m,e.handleClickOutside,e.popperRef]])}var tn=Se(en,[["render",ln],["__file","select.vue"]]);const nn=re({name:"ElOptionGroup",componentName:"ElOptionGroup",props:{label:String,disabled:Boolean},setup(e){const o=oe("select"),a=I(),v=ke(),s=I([]);il(ul,ie({...Me(e)}));const g=r(()=>s.value.some(m=>m.visible===!0)),t=m=>{var d;return m.type.name==="ElOption"&&!!((d=m.component)!=null&&d.proxy)},h=m=>{const d=K(m),u=[];return d.forEach(y=>{var f;Ft(y)&&(t(y)?u.push(y.component.proxy):N(y.children)&&y.children.length?u.push(...h(y.children)):(f=y.component)!=null&&f.subTree&&u.push(...h(y.component.subTree)))}),u},p=()=>{s.value=h(v.subTree)};return $e(()=>{p()}),Wt(a,p,{attributes:!0,subtree:!0,childList:!0}),{groupRef:a,visible:g,ns:o}}});function an(e,o,a,v,s,g){return ae((b(),w("ul",{ref:"groupRef",class:c(e.ns.be("group","wrap"))},[V("li",{class:c(e.ns.be("group","title"))},B(e.label),3),V("li",null,[V("ul",{class:c(e.ns.b("group"))},[T(e.$slots,"default")],2)])],2)),[[Re,e.visible]])}var dl=Se(nn,[["render",an],["__file","option-group.vue"]]);const cn=Pt(tn,{Option:De,OptionGroup:dl}),pn=rl(De);rl(dl);export{cn as E,pn as a};