index2.79dddce1.js 28 KB

1
  1. var Vl=Object.defineProperty,$l=Object.defineProperties;var kl=Object.getOwnPropertyDescriptors;var rl=Object.getOwnPropertySymbols;var Ml=Object.prototype.hasOwnProperty,Dl=Object.prototype.propertyIsEnumerable;var ul=(e,l,o)=>l in e?Vl(e,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[l]=o,xe=(e,l)=>{for(var o in l||(l={}))Ml.call(l,o)&&ul(e,o,l[o]);if(rl)for(var o of rl(l))Dl.call(l,o)&&ul(e,o,l[o]);return e},dl=(e,l)=>$l(e,kl(l));import{O as Bl,P as Cl,Q as Pl,R as oe,j as m,S as z,w as q,U as Sl,A as ll,W as nl,d as Le,s as ie,r as Te,X as tl,g as zl,n as $,_ as Ee,Y as ve,Z as ol,t as b,v as k,y as te,x as D,$ as J,z as h,D as G,e as A,o as il,a0 as Ol,H as ne,a1 as al,a2 as cl,a3 as ql,a4 as Fl,q as Kl,a5 as pl,a6 as Wl,a7 as pe,a8 as _e,a9 as fl,aa as vl,ab as X,ac as Al,ad as Rl,ae as Hl,af as wl,L as Nl,ag as jl,ah as Ql,E as Gl,ai as Ul,aj as Jl,ak as Xl,al as Yl,p as Il,k as ee,am as Zl,c as fe,C as E,B as W,F as el,an as ml,G as B,T as xl,ao as P,ap as _l,aq as en,ar as bl,J as ln,as as Ll}from"./index.06cf5f04.js";import{E as nn,t as tn}from"./index2.5509e6d7.js";const on=(e="")=>e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),an=e=>Bl[e||"default"],sn=e=>({focus:()=>{var l,o;(o=(l=e.value)==null?void 0:l.focus)==null||o.call(l)}}),U=new Map;let hl;Cl&&(document.addEventListener("mousedown",e=>hl=e),document.addEventListener("mouseup",e=>{for(const l of U.values())for(const{documentHandler:o}of l)o(e,hl)}));function gl(e,l){let o=[];return Array.isArray(l.arg)?o=l.arg:Pl(l.arg)&&o.push(l.arg),function(p,c){const u=l.instance.popperRef,a=p.target,d=c==null?void 0:c.target,y=!l||!l.instance,S=!a||!d,f=e.contains(a)||e.contains(d),C=e===a,I=o.length&&o.some(i=>i==null?void 0:i.contains(a))||o.length&&o.includes(d),L=u&&(u.contains(a)||u.contains(d));y||S||f||C||I||L||l.value(p,c)}}const rn={beforeMount(e,l){U.has(e)||U.set(e,[]),U.get(e).push({documentHandler:gl(e,l),bindingFn:l.value})},updated(e,l){U.has(e)||U.set(e,[]);const o=U.get(e),p=o.findIndex(u=>u.bindingFn===l.oldValue),c={documentHandler:gl(e,l),bindingFn:l.value};p>=0?o.splice(p,1,c):o.push(c)},unmounted(e){U.delete(e)}},Tl="ElSelectGroup",Ve="ElSelect";function un(e,l){const o=oe(Ve),p=oe(Tl,{disabled:!1}),c=m(()=>Object.prototype.toString.call(e.value).toLowerCase()==="[object object]"),u=m(()=>o.props.multiple?C(o.props.modelValue,e.value):I(e.value,o.props.modelValue)),a=m(()=>{if(o.props.multiple){const v=o.props.modelValue||[];return!u.value&&v.length>=o.props.multipleLimit&&o.props.multipleLimit>0}else return!1}),d=m(()=>e.label||(c.value?"":e.value)),y=m(()=>e.value||e.label||""),S=m(()=>e.disabled||l.groupDisabled||a.value),f=nl(),C=(v=[],g)=>{if(c.value){const O=o.props.valueKey;return v&&v.some(F=>z(F,O)===z(g,O))}else return v&&v.includes(g)},I=(v,g)=>{if(c.value){const{valueKey:O}=o.props;return z(v,O)===z(g,O)}else return v===g},L=()=>{!e.disabled&&!p.disabled&&(o.hoverIndex=o.optionsArray.indexOf(f.proxy))};q(()=>d.value,()=>{!e.created&&!o.props.remote&&o.setSelected()}),q(()=>e.value,(v,g)=>{const{remote:O,valueKey:F}=o.props;if(!e.created&&!O){if(F&&typeof v=="object"&&typeof g=="object"&&v[F]===g[F])return;o.setSelected()}}),q(()=>p.disabled,()=>{l.groupDisabled=p.disabled},{immediate:!0});const{queryChange:i}=Sl(o);return q(i,v=>{const{query:g}=ll(v),O=new RegExp(on(g),"i");l.visible=O.test(d.value)||e.created,l.visible||o.filteredOptionsCount--}),{select:o,currentLabel:d,currentValue:y,itemSelected:u,isDisabled:S,hoverItem:L}}const dn=Le({name:"ElOption",componentName:"ElOption",props:{value:{required:!0,type:[String,Number,Boolean,Object]},label:[String,Number],created:Boolean,disabled:{type:Boolean,default:!1}},setup(e){const l=ie("select"),o=Te({index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}),{currentLabel:p,itemSelected:c,isDisabled:u,select:a,hoverItem:d}=un(e,o),{visible:y,hover:S}=tl(o),f=nl().proxy,C=f.value;a.onOptionCreate(f),zl(()=>{const{selected:L}=a,v=(a.props.multiple?L:[L]).some(g=>g.value===f.value);a.cachedOptions.get(C)===f&&!v&&$(()=>{a.cachedOptions.delete(C)}),a.onOptionDestroy(C,f)});function I(){e.disabled!==!0&&o.groupDisabled!==!0&&a.handleOptionSelect(f,!0)}return{ns:l,currentLabel:p,itemSelected:c,isDisabled:u,select:a,hoverItem:d,visible:y,hover:S,selectOptionClick:I,states:o}}});function cn(e,l,o,p,c,u){return ve((b(),k("li",{class:h([e.ns.be("dropdown","item"),e.ns.is("disabled",e.isDisabled),{selected:e.itemSelected,hover:e.hover}]),onMouseenter:l[0]||(l[0]=(...a)=>e.hoverItem&&e.hoverItem(...a)),onClick:l[1]||(l[1]=G((...a)=>e.selectOptionClick&&e.selectOptionClick(...a),["stop"]))},[te(e.$slots,"default",{},()=>[D("span",null,J(e.currentLabel),1)])],34)),[[ol,e.visible]])}var sl=Ee(dn,[["render",cn],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);const pn=Le({name:"ElSelectDropdown",componentName:"ElSelectDropdown",setup(){const e=oe(Ve),l=ie("select"),o=m(()=>e.props.popperClass),p=m(()=>e.props.multiple),c=m(()=>e.props.fitInputWidth),u=A("");function a(){var d;u.value=`${(d=e.selectWrapper)==null?void 0:d.getBoundingClientRect().width}px`}return il(()=>{a(),Ol(e.selectWrapper,a)}),{ns:l,minWidth:u,popperClass:o,isMultiple:p,isFitInputWidth:c}}});function fn(e,l,o,p,c,u){return b(),k("div",{class:h([e.ns.b("dropdown"),e.ns.is("multiple",e.isMultiple),e.popperClass]),style:ne({[e.isFitInputWidth?"width":"minWidth"]:e.minWidth})},[te(e.$slots,"default")],6)}var vn=Ee(pn,[["render",fn],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);function mn(e){const{t:l}=al();return Te({options:new Map,cachedOptions:new Map,createdLabel:null,createdSelected:!1,selected:e.multiple?[]:{},inputLength:20,inputWidth:0,optionsCount:0,filteredOptionsCount:0,visible:!1,softFocus:!1,selectedLabel:"",hoverIndex:-1,query:"",previousQuery:null,inputHovering:!1,cachedPlaceHolder:"",currentPlaceholder:l("el.select.placeholder"),menuVisibleOnFocus:!1,isOnComposition:!1,isSilentBlur:!1,prefixWidth:11,tagInMultiLine:!1})}const bn=(e,l,o)=>{const{t:p}=al(),c=ie("select"),u=A(null),a=A(null),d=A(null),y=A(null),S=A(null),f=A(null),C=A(-1),I=cl({query:""}),L=cl(""),i=oe(ql,{}),v=oe(Fl,{}),g=m(()=>!e.filterable||e.multiple||!l.visible),O=m(()=>e.disabled||i.disabled),F=m(()=>{const n=e.multiple?Array.isArray(e.modelValue)&&e.modelValue.length>0:e.modelValue!==void 0&&e.modelValue!==null&&e.modelValue!=="";return e.clearable&&!O.value&&l.inputHovering&&n}),ae=m(()=>e.remote&&e.filterable?"":e.suffixIcon),$e=m(()=>c.is("reverse",ae.value&&l.visible)),me=m(()=>e.remote?300:0),se=m(()=>e.loading?e.loadingText||p("el.select.loading"):e.remote&&l.query===""&&l.options.size===0?!1:e.filterable&&l.query&&l.options.size>0&&l.filteredOptionsCount===0?e.noMatchText||p("el.select.noMatch"):l.options.size===0?e.noDataText||p("el.select.noData"):null),T=m(()=>Array.from(l.options.values())),ke=m(()=>Array.from(l.cachedOptions.values())),Me=m(()=>{const n=T.value.filter(t=>!t.created).some(t=>t.currentLabel===l.query);return e.filterable&&e.allowCreate&&l.query!==""&&!n}),le=Kl(),De=m(()=>["small"].includes(le.value)?"small":"default"),Be=m({get(){return l.visible&&se.value!==!1},set(n){l.visible=n}});q([()=>O.value,()=>le.value,()=>i.size],()=>{$(()=>{K()})}),q(()=>e.placeholder,n=>{l.cachedPlaceHolder=l.currentPlaceholder=n}),q(()=>e.modelValue,(n,t)=>{var s;e.multiple&&(K(),n&&n.length>0||a.value&&l.query!==""?l.currentPlaceholder="":l.currentPlaceholder=l.cachedPlaceHolder,e.filterable&&!e.reserveKeyword&&(l.query="",H(l.query))),re(),e.filterable&&!e.multiple&&(l.inputLength=20),pl(n,t)||(s=v.validate)==null||s.call(v,"change").catch(r=>Wl())},{flush:"post",deep:!0}),q(()=>l.visible,n=>{var t,s,r;n?((s=(t=d.value)==null?void 0:t.updatePopper)==null||s.call(t),e.filterable&&(l.filteredOptionsCount=l.optionsCount,l.query=e.remote?"":l.selectedLabel,e.multiple?(r=a.value)==null||r.focus():l.selectedLabel&&(l.currentPlaceholder=`${l.selectedLabel}`,l.selectedLabel=""),H(l.query),!e.multiple&&!e.remote&&(I.value.query="",pe(I),pe(L)))):(a.value&&a.value.blur(),l.query="",l.previousQuery=null,l.selectedLabel="",l.inputLength=20,l.menuVisibleOnFocus=!1,Pe(),$(()=>{a.value&&a.value.value===""&&l.selected.length===0&&(l.currentPlaceholder=l.cachedPlaceHolder)}),e.multiple||(l.selected&&(e.filterable&&e.allowCreate&&l.createdSelected&&l.createdLabel?l.selectedLabel=l.createdLabel:l.selectedLabel=l.selected.currentLabel,e.filterable&&(l.query=l.selectedLabel)),e.filterable&&(l.currentPlaceholder=l.cachedPlaceHolder))),o.emit("visible-change",n)}),q(()=>l.options.entries(),()=>{var n,t,s;if(!Cl)return;(t=(n=d.value)==null?void 0:n.updatePopper)==null||t.call(n),e.multiple&&K();const r=((s=S.value)==null?void 0:s.querySelectorAll("input"))||[];Array.from(r).includes(document.activeElement)||re(),e.defaultFirstOption&&(e.filterable||e.remote)&&l.filteredOptionsCount&&he()},{flush:"post"}),q(()=>l.hoverIndex,n=>{typeof n=="number"&&n>-1&&(C.value=T.value[n]||{}),T.value.forEach(t=>{t.hover=C.value===t})});const K=()=>{e.collapseTags&&!e.filterable||$(()=>{var n,t;if(!u.value)return;const s=u.value.$el.querySelector("input"),r=y.value,w=an(le.value||i.size);s.style.height=`${l.selected.length===0?w:Math.max(r?r.clientHeight+(r.clientHeight>w?6:0):0,w)-2}px`,l.tagInMultiLine=Number.parseFloat(s.style.height)>=w,l.visible&&se.value!==!1&&((t=(n=d.value)==null?void 0:n.updatePopper)==null||t.call(n))})},H=n=>{if(!(l.previousQuery===n||l.isOnComposition)){if(l.previousQuery===null&&(typeof e.filterMethod=="function"||typeof e.remoteMethod=="function")){l.previousQuery=n;return}l.previousQuery=n,$(()=>{var t,s;l.visible&&((s=(t=d.value)==null?void 0:t.updatePopper)==null||s.call(t))}),l.hoverIndex=-1,e.multiple&&e.filterable&&$(()=>{const t=a.value.value.length*15+20;l.inputLength=e.collapseTags?Math.min(50,t):t,be(),K()}),e.remote&&typeof e.remoteMethod=="function"?(l.hoverIndex=-1,e.remoteMethod(n)):typeof e.filterMethod=="function"?(e.filterMethod(n),pe(L)):(l.filteredOptionsCount=l.optionsCount,I.value.query=n,pe(I),pe(L)),e.defaultFirstOption&&(e.filterable||e.remote)&&l.filteredOptionsCount&&he()}},be=()=>{l.currentPlaceholder!==""&&(l.currentPlaceholder=a.value.value?"":l.cachedPlaceHolder)},he=()=>{const n=T.value.filter(r=>r.visible&&!r.disabled&&!r.states.groupDisabled),t=n.find(r=>r.created),s=n[0];l.hoverIndex=ue(T.value,t||s)},re=()=>{var n;if(e.multiple)l.selectedLabel="";else{const s=ge(e.modelValue);(n=s.props)!=null&&n.created?(l.createdLabel=s.props.value,l.createdSelected=!0):l.createdSelected=!1,l.selectedLabel=s.currentLabel,l.selected=s,e.filterable&&(l.query=l.selectedLabel);return}const t=[];Array.isArray(e.modelValue)&&e.modelValue.forEach(s=>{t.push(ge(s))}),l.selected=t,$(()=>{K()})},ge=n=>{let t;const s=_e(n).toLowerCase()==="object",r=_e(n).toLowerCase()==="null",w=_e(n).toLowerCase()==="undefined";for(let R=l.cachedOptions.size-1;R>=0;R--){const M=ke.value[R];if(s?z(M.value,e.valueKey)===z(n,e.valueKey):M.value===n){t={value:n,currentLabel:M.currentLabel,isDisabled:M.isDisabled};break}}if(t)return t;const j=s?n.label:!r&&!w?n:"",Q={value:n,currentLabel:j};return e.multiple&&(Q.hitState=!1),Q},Pe=()=>{setTimeout(()=>{const n=e.valueKey;e.multiple?l.selected.length>0?l.hoverIndex=Math.min.apply(null,l.selected.map(t=>T.value.findIndex(s=>z(s,n)===z(t,n)))):l.hoverIndex=-1:l.hoverIndex=T.value.findIndex(t=>x(t)===x(l.selected))},300)},ze=()=>{var n,t;qe(),(t=(n=d.value)==null?void 0:n.updatePopper)==null||t.call(n),e.multiple&&!e.filterable&&K()},qe=()=>{var n;l.inputWidth=(n=u.value)==null?void 0:n.$el.getBoundingClientRect().width},Fe=()=>{e.filterable&&l.query!==l.selectedLabel&&(l.query=l.selectedLabel,H(l.query))},Ke=fl(()=>{Fe()},me.value),We=fl(n=>{H(n.target.value)},me.value),Y=n=>{pl(e.modelValue,n)||o.emit(wl,n)},Ae=n=>{if(n.target.value.length<=0&&!de()){const t=e.modelValue.slice();t.pop(),o.emit(X,t),Y(t)}n.target.value.length===1&&e.modelValue.length===0&&(l.currentPlaceholder=l.cachedPlaceHolder)},Re=(n,t)=>{const s=l.selected.indexOf(t);if(s>-1&&!O.value){const r=e.modelValue.slice();r.splice(s,1),o.emit(X,r),Y(r),o.emit("remove-tag",t.value)}n.stopPropagation()},Z=n=>{n.stopPropagation();const t=e.multiple?[]:"";if(typeof t!="string")for(const s of l.selected)s.isDisabled&&t.push(s.value);o.emit(X,t),Y(t),l.visible=!1,o.emit("clear")},ye=(n,t)=>{var s;if(e.multiple){const r=(e.modelValue||[]).slice(),w=ue(r,n.value);w>-1?r.splice(w,1):(e.multipleLimit<=0||r.length<e.multipleLimit)&&r.push(n.value),o.emit(X,r),Y(r),n.created&&(l.query="",H(""),l.inputLength=20),e.filterable&&((s=a.value)==null||s.focus())}else o.emit(X,n.value),Y(n.value),l.visible=!1;l.isSilentBlur=t,He(),!l.visible&&$(()=>{N(n)})},ue=(n=[],t)=>{if(!vl(t))return n.indexOf(t);const s=e.valueKey;let r=-1;return n.some((w,j)=>z(w,s)===z(t,s)?(r=j,!0):!1),r},He=()=>{l.softFocus=!0;const n=a.value||u.value;n&&(n==null||n.focus())},N=n=>{var t,s,r,w,j;const Q=Array.isArray(n)?n[0]:n;let R=null;if(Q!=null&&Q.value){const M=T.value.filter(V=>V.value===Q.value);M.length>0&&(R=M[0].$el)}if(d.value&&R){const M=(w=(r=(s=(t=d.value)==null?void 0:t.popperRef)==null?void 0:s.contentRef)==null?void 0:r.querySelector)==null?void 0:w.call(r,`.${c.be("dropdown","wrap")}`);M&&Al(M,R)}(j=f.value)==null||j.handleScroll()},Ne=n=>{l.optionsCount++,l.filteredOptionsCount++,l.options.set(n.value,n),l.cachedOptions.set(n.value,n)},je=(n,t)=>{l.options.get(n)===t&&(l.optionsCount--,l.filteredOptionsCount--,l.options.delete(n))},Qe=n=>{n.code!==Rl.backspace&&de(!1),l.inputLength=a.value.value.length*15+20,K()},de=n=>{if(!Array.isArray(l.selected))return;const t=l.selected[l.selected.length-1];if(!!t)return n===!0||n===!1?(t.hitState=n,n):(t.hitState=!t.hitState,t.hitState)},ce=n=>{const t=n.target.value;if(n.type==="compositionend")l.isOnComposition=!1,$(()=>H(t));else{const s=t[t.length-1]||"";l.isOnComposition=!Hl(s)}},Ce=()=>{$(()=>N(l.selected))},Ge=n=>{l.softFocus?l.softFocus=!1:((e.automaticDropdown||e.filterable)&&(e.filterable&&!l.visible&&(l.menuVisibleOnFocus=!0),l.visible=!0),o.emit("focus",n))},Se=()=>{var n;l.visible=!1,(n=u.value)==null||n.blur()},Ue=n=>{$(()=>{l.isSilentBlur?l.isSilentBlur=!1:o.emit("blur",n)}),l.softFocus=!1},Je=n=>{Z(n)},Xe=()=>{l.visible=!1},Oe=n=>{l.visible&&(n.preventDefault(),n.stopPropagation(),l.visible=!1)},we=()=>{var n;e.automaticDropdown||O.value||(l.menuVisibleOnFocus?l.menuVisibleOnFocus=!1:l.visible=!l.visible,l.visible&&((n=a.value||u.value)==null||n.focus()))},Ye=()=>{l.visible?T.value[l.hoverIndex]&&ye(T.value[l.hoverIndex],void 0):we()},x=n=>vl(n.value)?z(n.value,e.valueKey):n.value,Ze=m(()=>T.value.filter(n=>n.visible).every(n=>n.disabled)),Ie=n=>{if(!l.visible){l.visible=!0;return}if(!(l.options.size===0||l.filteredOptionsCount===0)&&!l.isOnComposition&&!Ze.value){n==="next"?(l.hoverIndex++,l.hoverIndex===l.options.size&&(l.hoverIndex=0)):n==="prev"&&(l.hoverIndex--,l.hoverIndex<0&&(l.hoverIndex=l.options.size-1));const t=T.value[l.hoverIndex];(t.disabled===!0||t.states.groupDisabled===!0||!t.visible)&&Ie(n),$(()=>N(C.value))}};return{optionsArray:T,selectSize:le,handleResize:ze,debouncedOnInputChange:Ke,debouncedQueryChange:We,deletePrevTag:Ae,deleteTag:Re,deleteSelected:Z,handleOptionSelect:ye,scrollToOption:N,readonly:g,resetInputHeight:K,showClose:F,iconComponent:ae,iconReverse:$e,showNewOption:Me,collapseTagSize:De,setSelected:re,managePlaceholder:be,selectDisabled:O,emptyText:se,toggleLastOptionHitState:de,resetInputState:Qe,handleComposition:ce,onOptionCreate:Ne,onOptionDestroy:je,handleMenuEnter:Ce,handleFocus:Ge,blur:Se,handleBlur:Ue,handleClearClick:Je,handleClose:Xe,handleKeydownEscape:Oe,toggleMenu:we,selectOption:Ye,getValueKey:x,navigateOptions:Ie,dropMenuVisible:Be,queryChange:I,groupQueryChange:L,reference:u,input:a,tooltipRef:d,tags:y,selectWrapper:S,scrollbar:f}},yl="ElSelect",hn=Le({name:yl,componentName:yl,components:{ElInput:Nl,ElSelectMenu:vn,ElOption:sl,ElTag:nn,ElScrollbar:jl,ElTooltip:Ql,ElIcon:Gl},directives:{ClickOutside:rn},props:{name:String,id:String,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},autocomplete:{type:String,default:"off"},automaticDropdown:Boolean,size:{type:String,validator:Ul},effect:{type:String,default:"light"},disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:{type:String,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:{type:Boolean,default:!1},teleported:Jl.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:[String,Object],default:Xl},fitInputWidth:{type:Boolean,default:!1},suffixIcon:{type:[String,Object],default:Yl},tagType:dl(xe({},tn.type),{default:"info"})},emits:[X,wl,"remove-tag","clear","visible-change","focus","blur"],setup(e,l){const o=ie("select"),p=ie("input"),{t:c}=al(),u=mn(e),{optionsArray:a,selectSize:d,readonly:y,handleResize:S,collapseTagSize:f,debouncedOnInputChange:C,debouncedQueryChange:I,deletePrevTag:L,deleteTag:i,deleteSelected:v,handleOptionSelect:g,scrollToOption:O,setSelected:F,resetInputHeight:ae,managePlaceholder:$e,showClose:me,selectDisabled:se,iconComponent:T,iconReverse:ke,showNewOption:Me,emptyText:le,toggleLastOptionHitState:De,resetInputState:Be,handleComposition:K,onOptionCreate:H,onOptionDestroy:be,handleMenuEnter:he,handleFocus:re,blur:ge,handleBlur:Pe,handleClearClick:ze,handleClose:qe,handleKeydownEscape:Fe,toggleMenu:Ke,selectOption:We,getValueKey:Y,navigateOptions:Ae,dropMenuVisible:Re,reference:Z,input:ye,tooltipRef:ue,tags:He,selectWrapper:N,scrollbar:Ne,queryChange:je,groupQueryChange:Qe}=bn(e,u,l),{focus:de}=sn(Z),{inputWidth:ce,selected:Ce,inputLength:Ge,filteredOptionsCount:Se,visible:Ue,softFocus:Je,selectedLabel:Xe,hoverIndex:Oe,query:we,inputHovering:Ye,currentPlaceholder:x,menuVisibleOnFocus:Ze,isOnComposition:Ie,isSilentBlur:n,options:t,cachedOptions:s,optionsCount:r,prefixWidth:w,tagInMultiLine:j}=tl(u),Q=m(()=>{const V=[o.b()],_=ll(d);return _&&V.push(o.m(_)),e.disabled&&V.push(o.m("disabled")),V}),R=m(()=>({maxWidth:`${ll(ce)-32}px`,width:"100%"}));Il(Ve,Te({props:e,options:t,optionsArray:a,cachedOptions:s,optionsCount:r,filteredOptionsCount:Se,hoverIndex:Oe,handleOptionSelect:g,onOptionCreate:H,onOptionDestroy:be,selectWrapper:N,selected:Ce,setSelected:F,queryChange:je,groupQueryChange:Qe})),il(()=>{u.cachedPlaceHolder=x.value=e.placeholder||c("el.select.placeholder"),e.multiple&&Array.isArray(e.modelValue)&&e.modelValue.length>0&&(x.value=""),Ol(N,S),e.remote&&e.multiple&&ae(),$(()=>{const V=Z.value&&Z.value.$el;if(!!V&&(ce.value=V.getBoundingClientRect().width,l.slots.prefix)){const _=V.querySelector(`.${p.e("prefix")}`);w.value=Math.max(_.getBoundingClientRect().width+5,30)}}),F()}),e.multiple&&!Array.isArray(e.modelValue)&&l.emit(X,[]),!e.multiple&&Array.isArray(e.modelValue)&&l.emit(X,"");const M=m(()=>{var V,_;return(_=(V=ue.value)==null?void 0:V.popperRef)==null?void 0:_.contentRef});return{tagInMultiLine:j,prefixWidth:w,selectSize:d,readonly:y,handleResize:S,collapseTagSize:f,debouncedOnInputChange:C,debouncedQueryChange:I,deletePrevTag:L,deleteTag:i,deleteSelected:v,handleOptionSelect:g,scrollToOption:O,inputWidth:ce,selected:Ce,inputLength:Ge,filteredOptionsCount:Se,visible:Ue,softFocus:Je,selectedLabel:Xe,hoverIndex:Oe,query:we,inputHovering:Ye,currentPlaceholder:x,menuVisibleOnFocus:Ze,isOnComposition:Ie,isSilentBlur:n,options:t,resetInputHeight:ae,managePlaceholder:$e,showClose:me,selectDisabled:se,iconComponent:T,iconReverse:ke,showNewOption:Me,emptyText:le,toggleLastOptionHitState:De,resetInputState:Be,handleComposition:K,handleMenuEnter:he,handleFocus:re,blur:ge,handleBlur:Pe,handleClearClick:ze,handleClose:qe,handleKeydownEscape:Fe,toggleMenu:Ke,selectOption:We,getValueKey:Y,navigateOptions:Ae,dropMenuVisible:Re,focus:de,reference:Z,input:ye,tooltipRef:ue,popperPaneRef:M,tags:He,selectWrapper:N,scrollbar:Ne,wrapperKls:Q,selectTagsStyle:R,nsSelect:o}}}),gn={class:"select-trigger"},yn=["disabled","autocomplete"],Cn={style:{height:"100%",display:"flex","justify-content":"center","align-items":"center"}};function Sn(e,l,o,p,c,u){const a=ee("el-tag"),d=ee("el-tooltip"),y=ee("el-icon"),S=ee("el-input"),f=ee("el-option"),C=ee("el-scrollbar"),I=ee("el-select-menu"),L=Zl("click-outside");return ve((b(),k("div",{ref:"selectWrapper",class:h(e.wrapperKls),onClick:l[23]||(l[23]=G((...i)=>e.toggleMenu&&e.toggleMenu(...i),["stop"]))},[fe(d,{ref:"tooltipRef",visible:e.dropMenuVisible,"onUpdate:visible":l[22]||(l[22]=i=>e.dropMenuVisible=i),placement:"bottom-start",teleported:e.teleported,"popper-class":[e.nsSelect.e("popper"),e.popperClass],"fallback-placements":["bottom-start","top-start","right","left"],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,onShow:e.handleMenuEnter},{default:E(()=>[D("div",gn,[e.multiple?(b(),k("div",{key:0,ref:"tags",class:h(e.nsSelect.e("tags")),style:ne(e.selectTagsStyle)},[e.collapseTags&&e.selected.length?(b(),k("span",{key:0,class:h([e.nsSelect.b("tags-wrapper"),{"has-prefix":e.prefixWidth&&e.selected.length}])},[fe(a,{closable:!e.selectDisabled&&!e.selected[0].isDisabled,size:e.collapseTagSize,hit:e.selected[0].hitState,type:e.tagType,"disable-transitions":"",onClose:l[0]||(l[0]=i=>e.deleteTag(i,e.selected[0]))},{default:E(()=>[D("span",{class:h(e.nsSelect.e("tags-text")),style:ne({maxWidth:e.inputWidth-123+"px"})},J(e.selected[0].currentLabel),7)]),_:1},8,["closable","size","hit","type"]),e.selected.length>1?(b(),W(a,{key:0,closable:!1,size:e.collapseTagSize,type:e.tagType,"disable-transitions":""},{default:E(()=>[e.collapseTagsTooltip?(b(),W(d,{key:0,disabled:e.dropMenuVisible,"fallback-placements":["bottom","top","right","left"],effect:e.effect,placement:"bottom",teleported:!1},{default:E(()=>[D("span",{class:h(e.nsSelect.e("tags-text"))},"+ "+J(e.selected.length-1),3)]),content:E(()=>[D("div",{class:h(e.nsSelect.e("collapse-tags"))},[(b(!0),k(el,null,ml(e.selected,(i,v)=>(b(),k("div",{key:v,class:h(e.nsSelect.e("collapse-tag"))},[(b(),W(a,{key:e.getValueKey(i),class:"in-tooltip",closable:!e.selectDisabled&&!i.isDisabled,size:e.collapseTagSize,hit:i.hitState,type:e.tagType,"disable-transitions":"",style:{margin:"2px"},onClose:g=>e.deleteTag(g,i)},{default:E(()=>[D("span",{class:h(e.nsSelect.e("tags-text")),style:ne({maxWidth:e.inputWidth-75+"px"})},J(i.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"]))],2))),128))],2)]),_:1},8,["disabled","effect"])):(b(),k("span",{key:1,class:h(e.nsSelect.e("tags-text"))},"+ "+J(e.selected.length-1),3))]),_:1},8,["size","type"])):B("v-if",!0)],2)):B("v-if",!0),B(" <div> "),e.collapseTags?B("v-if",!0):(b(),W(xl,{key:1,onAfterLeave:e.resetInputHeight},{default:E(()=>[D("span",{class:h([e.nsSelect.b("tags-wrapper"),{"has-prefix":e.prefixWidth&&e.selected.length}])},[(b(!0),k(el,null,ml(e.selected,i=>(b(),W(a,{key:e.getValueKey(i),closable:!e.selectDisabled&&!i.isDisabled,size:e.collapseTagSize,hit:i.hitState,type:e.tagType,"disable-transitions":"",onClose:v=>e.deleteTag(v,i)},{default:E(()=>[D("span",{class:h(e.nsSelect.e("tags-text")),style:ne({maxWidth:e.inputWidth-75+"px"})},J(i.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"]))),128))],2)]),_:1},8,["onAfterLeave"])),B(" </div> "),e.filterable?ve((b(),k("input",{key:2,ref:"input","onUpdate:modelValue":l[1]||(l[1]=i=>e.query=i),type:"text",class:h([e.nsSelect.e("input"),e.nsSelect.is(e.selectSize)]),disabled:e.selectDisabled,autocomplete:e.autocomplete,style:ne({marginLeft:e.prefixWidth&&!e.selected.length||e.tagInMultiLine?`${e.prefixWidth}px`:"",flexGrow:1,width:`${e.inputLength/(e.inputWidth-32)}%`,maxWidth:`${e.inputWidth-42}px`}),onFocus:l[2]||(l[2]=(...i)=>e.handleFocus&&e.handleFocus(...i)),onBlur:l[3]||(l[3]=(...i)=>e.handleBlur&&e.handleBlur(...i)),onKeyup:l[4]||(l[4]=(...i)=>e.managePlaceholder&&e.managePlaceholder(...i)),onKeydown:[l[5]||(l[5]=(...i)=>e.resetInputState&&e.resetInputState(...i)),l[6]||(l[6]=P(G(i=>e.navigateOptions("next"),["prevent"]),["down"])),l[7]||(l[7]=P(G(i=>e.navigateOptions("prev"),["prevent"]),["up"])),l[8]||(l[8]=P((...i)=>e.handleKeydownEscape&&e.handleKeydownEscape(...i),["esc"])),l[9]||(l[9]=P(G((...i)=>e.selectOption&&e.selectOption(...i),["stop","prevent"]),["enter"])),l[10]||(l[10]=P((...i)=>e.deletePrevTag&&e.deletePrevTag(...i),["delete"])),l[11]||(l[11]=P(i=>e.visible=!1,["tab"]))],onCompositionstart:l[12]||(l[12]=(...i)=>e.handleComposition&&e.handleComposition(...i)),onCompositionupdate:l[13]||(l[13]=(...i)=>e.handleComposition&&e.handleComposition(...i)),onCompositionend:l[14]||(l[14]=(...i)=>e.handleComposition&&e.handleComposition(...i)),onInput:l[15]||(l[15]=(...i)=>e.debouncedQueryChange&&e.debouncedQueryChange(...i))},null,46,yn)),[[_l,e.query]]):B("v-if",!0)],6)):B("v-if",!0),fe(S,{id:e.id,ref:"reference",modelValue:e.selectedLabel,"onUpdate:modelValue":l[16]||(l[16]=i=>e.selectedLabel=i),type:"text",placeholder:e.currentPlaceholder,name:e.name,autocomplete:e.autocomplete,size:e.selectSize,disabled:e.selectDisabled,readonly:e.readonly,"validate-event":!1,class:h([e.nsSelect.is("focus",e.visible)]),tabindex:e.multiple&&e.filterable?-1:void 0,onFocus:e.handleFocus,onBlur:e.handleBlur,onInput:e.debouncedOnInputChange,onPaste:e.debouncedOnInputChange,onCompositionstart:e.handleComposition,onCompositionupdate:e.handleComposition,onCompositionend:e.handleComposition,onKeydown:[l[17]||(l[17]=P(G(i=>e.navigateOptions("next"),["stop","prevent"]),["down"])),l[18]||(l[18]=P(G(i=>e.navigateOptions("prev"),["stop","prevent"]),["up"])),P(G(e.selectOption,["stop","prevent"]),["enter"]),P(e.handleKeydownEscape,["esc"]),l[19]||(l[19]=P(i=>e.visible=!1,["tab"]))],onMouseenter:l[20]||(l[20]=i=>e.inputHovering=!0),onMouseleave:l[21]||(l[21]=i=>e.inputHovering=!1)},en({suffix:E(()=>[e.iconComponent&&!e.showClose?(b(),W(y,{key:0,class:h([e.nsSelect.e("caret"),e.nsSelect.e("icon"),e.iconReverse])},{default:E(()=>[(b(),W(bl(e.iconComponent)))]),_:1},8,["class"])):B("v-if",!0),e.showClose&&e.clearIcon?(b(),W(y,{key:1,class:h([e.nsSelect.e("caret"),e.nsSelect.e("icon")]),onClick:e.handleClearClick},{default:E(()=>[(b(),W(bl(e.clearIcon)))]),_:1},8,["class","onClick"])):B("v-if",!0)]),_:2},[e.$slots.prefix?{name:"prefix",fn:E(()=>[D("div",Cn,[te(e.$slots,"prefix")])])}:void 0]),1032,["id","modelValue","placeholder","name","autocomplete","size","disabled","readonly","class","tabindex","onFocus","onBlur","onInput","onPaste","onCompositionstart","onCompositionupdate","onCompositionend","onKeydown"])])]),content:E(()=>[fe(I,null,{default:E(()=>[ve(fe(C,{ref:"scrollbar",tag:"ul","wrap-class":e.nsSelect.be("dropdown","wrap"),"view-class":e.nsSelect.be("dropdown","list"),class:h([e.nsSelect.is("empty",!e.allowCreate&&Boolean(e.query)&&e.filteredOptionsCount===0)])},{default:E(()=>[e.showNewOption?(b(),W(f,{key:0,value:e.query,created:!0},null,8,["value"])):B("v-if",!0),te(e.$slots,"default")]),_:3},8,["wrap-class","view-class","class"]),[[ol,e.options.size>0&&!e.loading]]),e.emptyText&&(!e.allowCreate||e.loading||e.allowCreate&&e.options.size===0)?(b(),k(el,{key:0},[e.$slots.empty?te(e.$slots,"empty",{key:0}):(b(),k("p",{key:1,class:h(e.nsSelect.be("dropdown","empty"))},J(e.emptyText),3))],64)):B("v-if",!0)]),_:3})]),_:3},8,["visible","teleported","popper-class","effect","transition","persistent","onShow"])],2)),[[L,e.handleClose,e.popperPaneRef]])}var On=Ee(hn,[["render",Sn],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);const wn=Le({name:"ElOptionGroup",componentName:"ElOptionGroup",props:{label:String,disabled:{type:Boolean,default:!1}},setup(e){const l=ie("select"),o=A(!0),p=nl(),c=A([]);Il(Tl,Te(xe({},tl(e))));const u=oe(Ve);il(()=>{c.value=a(p.subTree)});const a=y=>{const S=[];return Array.isArray(y.children)&&y.children.forEach(f=>{var C;f.type&&f.type.name==="ElOption"&&f.component&&f.component.proxy?S.push(f.component.proxy):(C=f.children)!=null&&C.length&&S.push(...a(f))}),S},{groupQueryChange:d}=Sl(u);return q(d,()=>{o.value=c.value.some(y=>y.visible===!0)}),{visible:o,ns:l}}});function In(e,l,o,p,c,u){return ve((b(),k("ul",{class:h(e.ns.be("group","wrap"))},[D("li",{class:h(e.ns.be("group","title"))},J(e.label),3),D("li",null,[D("ul",{class:h(e.ns.b("group"))},[te(e.$slots,"default")],2)])],2)),[[ol,e.visible]])}var El=Ee(wn,[["render",In],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);const Vn=ln(On,{Option:sl,OptionGroup:El}),$n=Ll(sl),kn=Ll(El);export{rn as C,Vn as E,$n as a,kn as b};