| 1 |
- var Rl=Object.defineProperty,ql=Object.defineProperties;var Kl=Object.getOwnPropertyDescriptors;var gl=Object.getOwnPropertySymbols;var Fl=Object.prototype.hasOwnProperty,Nl=Object.prototype.propertyIsEnumerable;var yl=(e,l,n)=>l in e?Rl(e,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[l]=n,De=(e,l)=>{for(var n in l||(l={}))Fl.call(l,n)&&yl(e,n,l[n]);if(gl)for(var n of gl(l))Nl.call(l,n)&&yl(e,n,l[n]);return e},il=(e,l)=>ql(e,Kl(l));import{t as jl,u as Ql,v as dl,d as ve,x as fe,y as ie,z as Gl,e as L,j as y,g as $l,A as sl,B as Sl,C as S,D as q,G as $,H as ge,I as We,J as W,K as C,L as A,M as J,T as Pl,_ as me,N as cl,O as H,c as ce,F as He,P as Ul,Q as he,R as Cl,w as K,S as pl,n as D,p as fl,r as Le,o as Ae,f as Xl,U as pe,V as rl,W as j,X as ul,Y as Ml,Z as Yl,$ as U,a0 as Bl,a1 as vl,a2 as ml,a3 as ne,a4 as le,a5 as hl,a6 as wl,a7 as Jl,a8 as Zl,a9 as xl,aa as Ol,ab as _l,ac as Ee,ad as al,ae as El,af as oe,ag as et,ah as lt,ai as tt,aj as Vl,E as nt,ak as ot,m as it,al as at,am as st,an as rt,k as de,ao as ut,ap as Ll,aq as G,ar as dt,as as ct,at as Dl}from"./index.f06d32fc.js";import{E as pt,t as ft}from"./index2.d2718ad2.js";const vt=(e="")=>e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),mt=e=>jl[e||"default"],ht=e=>["",...Ql].includes(e),Hl=Symbol("scrollbarContextKey"),bt=e=>({focus:()=>{var l,n;(n=(l=e.value)==null?void 0:l.focus)==null||n.call(l)}}),be=4,gt={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},yt=({move:e,size:l,bar:n})=>({[n.size]:l,transform:`translate${n.axis}(${e}%)`}),St=dl({vertical:Boolean,size:String,move:Number,ratio:{type:Number,required:!0},always:Boolean}),Ct=ve({__name:"thumb",props:St,setup(e){const l=e,n="Thumb",s=fe(Hl),v=ie("scrollbar");s||Gl(n,"can not inject scrollbar context");const u=L(),i=L(),f=L({}),d=L(!1);let w=!1,b=!1,O=cl?document.onselectstart:null;const c=y(()=>gt[l.vertical?"vertical":"horizontal"]),z=y(()=>yt({size:l.size,move:l.move,bar:c.value})),a=y(()=>u.value[c.value.offset]**2/s.wrapElement[c.value.scrollSize]/l.ratio/i.value[c.value.offset]),g=h=>{var P;if(h.stopPropagation(),h.ctrlKey||[1,2].includes(h.button))return;(P=window.getSelection())==null||P.removeAllRanges(),T(h);const M=h.currentTarget;!M||(f.value[c.value.axis]=M[c.value.offset]-(h[c.value.client]-M.getBoundingClientRect()[c.value.direction]))},E=h=>{if(!i.value||!u.value||!s.wrapElement)return;const P=Math.abs(h.target.getBoundingClientRect()[c.value.direction]-h[c.value.client]),M=i.value[c.value.offset]/2,V=(P-M)*100*a.value/u.value[c.value.offset];s.wrapElement[c.value.scroll]=V*s.wrapElement[c.value.scrollSize]/100},T=h=>{h.stopImmediatePropagation(),w=!0,document.addEventListener("mousemove",B),document.addEventListener("mouseup",Q),O=document.onselectstart,document.onselectstart=()=>!1},B=h=>{if(!u.value||!i.value||w===!1)return;const P=f.value[c.value.axis];if(!P)return;const M=(u.value.getBoundingClientRect()[c.value.direction]-h[c.value.client])*-1,V=i.value[c.value.offset]-P,ye=(M-V)*100*a.value/u.value[c.value.offset];s.wrapElement[c.value.scroll]=ye*s.wrapElement[c.value.scrollSize]/100},Q=()=>{w=!1,f.value[c.value.axis]=0,document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",Q),I(),b&&(d.value=!1)},F=()=>{b=!1,d.value=!!l.size},p=()=>{b=!0,d.value=w};$l(()=>{I(),document.removeEventListener("mouseup",Q)});const I=()=>{document.onselectstart!==O&&(document.onselectstart=O)};return sl(Sl(s,"scrollbarElement"),"mousemove",F),sl(Sl(s,"scrollbarElement"),"mouseleave",p),(h,P)=>(S(),q(Pl,{name:A(v).b("fade"),persisted:""},{default:$(()=>[ge(W("div",{ref_key:"instance",ref:u,class:C([A(v).e("bar"),A(v).is(A(c).key)]),onMousedown:E},[W("div",{ref_key:"thumb",ref:i,class:C(A(v).e("thumb")),style:J(A(z)),onMousedown:g},null,38)],34),[[We,h.always||d.value]])]),_:1},8,["name"]))}});var Tl=me(Ct,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);const wt=dl({always:{type:Boolean,default:!0},width:String,height:String,ratioX:{type:Number,default:1},ratioY:{type:Number,default:1}}),Ot=ve({__name:"bar",props:wt,setup(e,{expose:l}){const n=e,s=L(0),v=L(0);return l({handleScroll:i=>{if(i){const f=i.offsetHeight-be,d=i.offsetWidth-be;v.value=i.scrollTop*100/f*n.ratioY,s.value=i.scrollLeft*100/d*n.ratioX}}}),(i,f)=>(S(),H(He,null,[ce(Tl,{move:s.value,ratio:i.ratioX,size:i.width,always:i.always},null,8,["move","ratio","size","always"]),ce(Tl,{move:v.value,ratio:i.ratioY,size:i.height,vertical:"",always:i.always},null,8,["move","ratio","size","always"])],64))}});var Et=me(Ot,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);const Lt=dl({height:{type:[String,Number],default:""},maxHeight:{type:[String,Number],default:""},native:Boolean,wrapStyle:{type:Ul([String,Object,Array]),default:""},wrapClass:{type:[String,Array],default:""},viewClass:{type:[String,Array],default:""},viewStyle:{type:[String,Array,Object],default:""},noresize:Boolean,tag:{type:String,default:"div"},always:Boolean,minSize:{type:Number,default:20}}),Tt={scroll:({scrollTop:e,scrollLeft:l})=>he(e)&&he(l)},zt={name:"ElScrollbar"},It=ve(il(De({},zt),{props:Lt,emits:Tt,setup(e,{expose:l,emit:n}){const s=e,v=ie("scrollbar");let u,i;const f=L(),d=L(),w=L(),b=L("0"),O=L("0"),c=L(),z=L(1),a=L(1),g=y(()=>{const p={};return s.height&&(p.height=Cl(s.height)),s.maxHeight&&(p.maxHeight=Cl(s.maxHeight)),[s.wrapStyle,p]}),E=()=>{var p;d.value&&((p=c.value)==null||p.handleScroll(d.value),n("scroll",{scrollTop:d.value.scrollTop,scrollLeft:d.value.scrollLeft}))};function T(p,I){ul(p)?d.value.scrollTo(p):he(p)&&he(I)&&d.value.scrollTo(p,I)}const B=p=>{!he(p)||(d.value.scrollTop=p)},Q=p=>{!he(p)||(d.value.scrollLeft=p)},F=()=>{if(!d.value)return;const p=d.value.offsetHeight-be,I=d.value.offsetWidth-be,h=p**2/d.value.scrollHeight,P=I**2/d.value.scrollWidth,M=Math.max(h,s.minSize),V=Math.max(P,s.minSize);z.value=h/(p-h)/(M/(p-M)),a.value=P/(I-P)/(V/(I-V)),O.value=M+be<p?`${M}px`:"",b.value=V+be<I?`${V}px`:""};return K(()=>s.noresize,p=>{p?(u==null||u(),i==null||i()):({stop:u}=pl(w,F),i=sl("resize",F))},{immediate:!0}),K(()=>[s.maxHeight,s.height],()=>{s.native||D(()=>{var p;F(),d.value&&((p=c.value)==null||p.handleScroll(d.value))})}),fl(Hl,Le({scrollbarElement:f,wrapElement:d})),Ae(()=>{s.native||D(()=>F())}),Xl(()=>F()),l({wrap$:d,update:F,scrollTo:T,setScrollTop:B,setScrollLeft:Q,handleScroll:E}),(p,I)=>(S(),H("div",{ref_key:"scrollbar$",ref:f,class:C(A(v).b())},[W("div",{ref_key:"wrap$",ref:d,class:C([p.wrapClass,A(v).e("wrap"),{[A(v).em("wrap","hidden-default")]:!p.native}]),style:J(A(g)),onScroll:E},[(S(),q(rl(p.tag),{ref_key:"resize$",ref:w,class:C([A(v).e("view"),p.viewClass]),style:J(p.viewStyle)},{default:$(()=>[pe(p.$slots,"default")]),_:3},8,["class","style"]))],38),p.native?j("v-if",!0):(S(),q(Et,{key:0,ref_key:"barRef",ref:c,height:O.value,width:b.value,always:p.always,"ratio-x":a.value,"ratio-y":z.value},null,8,["height","width","always","ratio-x","ratio-y"]))],2))}}));var kt=me(It,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);const $t=Ml(kt),te=new Map;let zl;cl&&(document.addEventListener("mousedown",e=>zl=e),document.addEventListener("mouseup",e=>{for(const l of te.values())for(const{documentHandler:n}of l)n(e,zl)}));function Il(e,l){let n=[];return Array.isArray(l.arg)?n=l.arg:Yl(l.arg)&&n.push(l.arg),function(s,v){const u=l.instance.popperRef,i=s.target,f=v==null?void 0:v.target,d=!l||!l.instance,w=!i||!f,b=e.contains(i)||e.contains(f),O=e===i,c=n.length&&n.some(a=>a==null?void 0:a.contains(i))||n.length&&n.includes(f),z=u&&(u.contains(i)||u.contains(f));d||w||b||O||c||z||l.value(s,v)}}const Pt={beforeMount(e,l){te.has(e)||te.set(e,[]),te.get(e).push({documentHandler:Il(e,l),bindingFn:l.value})},updated(e,l){te.has(e)||te.set(e,[]);const n=te.get(e),s=n.findIndex(u=>u.bindingFn===l.oldValue),v={documentHandler:Il(e,l),bindingFn:l.value};s>=0?n.splice(s,1,v):n.push(v)},unmounted(e){te.delete(e)}},Wl="ElSelectGroup",Re="ElSelect";function Mt(e,l){const n=fe(Re),s=fe(Wl,{disabled:!1}),v=y(()=>Object.prototype.toString.call(e.value).toLowerCase()==="[object object]"),u=y(()=>n.props.multiple?O(n.props.modelValue,e.value):c(e.value,n.props.modelValue)),i=y(()=>{if(n.props.multiple){const g=n.props.modelValue||[];return!u.value&&g.length>=n.props.multipleLimit&&n.props.multipleLimit>0}else return!1}),f=y(()=>e.label||(v.value?"":e.value)),d=y(()=>e.value||e.label||""),w=y(()=>e.disabled||l.groupDisabled||i.value),b=vl(),O=(g=[],E)=>{if(v.value){const T=n.props.valueKey;return g&&g.some(B=>U(B,T)===U(E,T))}else return g&&g.includes(E)},c=(g,E)=>{if(v.value){const{valueKey:T}=n.props;return U(g,T)===U(E,T)}else return g===E},z=()=>{!e.disabled&&!s.disabled&&(n.hoverIndex=n.optionsArray.indexOf(b.proxy))};K(()=>f.value,()=>{!e.created&&!n.props.remote&&n.setSelected()}),K(()=>e.value,(g,E)=>{const{remote:T,valueKey:B}=n.props;if(!e.created&&!T){if(B&&typeof g=="object"&&typeof E=="object"&&g[B]===E[B])return;n.setSelected()}}),K(()=>s.disabled,()=>{l.groupDisabled=s.disabled},{immediate:!0});const{queryChange:a}=Bl(n);return K(a,g=>{const{query:E}=A(g),T=new RegExp(vt(E),"i");l.visible=T.test(f.value)||e.created,l.visible||n.filteredOptionsCount--}),{select:n,currentLabel:f,currentValue:d,itemSelected:u,isDisabled:w,hoverItem:z}}const Bt=ve({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"),n=Le({index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}),{currentLabel:s,itemSelected:v,isDisabled:u,select:i,hoverItem:f}=Mt(e,n),{visible:d,hover:w}=ml(n),b=vl().proxy,O=b.value;i.onOptionCreate(b),$l(()=>{const{selected:z}=i,g=(i.props.multiple?z:[z]).some(E=>E.value===b.value);i.cachedOptions.get(O)===b&&!g&&D(()=>{i.cachedOptions.delete(O)}),i.onOptionDestroy(O,b)});function c(){e.disabled!==!0&&n.groupDisabled!==!0&&i.handleOptionSelect(b,!0)}return{ns:l,currentLabel:s,itemSelected:v,isDisabled:u,select:i,hoverItem:f,visible:d,hover:w,selectOptionClick:c,states:n}}});function Vt(e,l,n,s,v,u){return ge((S(),H("li",{class:C([e.ns.be("dropdown","item"),e.ns.is("disabled",e.isDisabled),{selected:e.itemSelected,hover:e.hover}]),onMouseenter:l[0]||(l[0]=(...i)=>e.hoverItem&&e.hoverItem(...i)),onClick:l[1]||(l[1]=le((...i)=>e.selectOptionClick&&e.selectOptionClick(...i),["stop"]))},[pe(e.$slots,"default",{},()=>[W("span",null,ne(e.currentLabel),1)])],34)),[[We,e.visible]])}var bl=me(Bt,[["render",Vt],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);const Dt=ve({name:"ElSelectDropdown",componentName:"ElSelectDropdown",setup(){const e=fe(Re),l=ie("select"),n=y(()=>e.props.popperClass),s=y(()=>e.props.multiple),v=y(()=>e.props.fitInputWidth),u=L("");function i(){var f;u.value=`${(f=e.selectWrapper)==null?void 0:f.getBoundingClientRect().width}px`}return Ae(()=>{i(),pl(e.selectWrapper,i)}),{ns:l,minWidth:u,popperClass:n,isMultiple:s,isFitInputWidth:v}}});function Ht(e,l,n,s,v,u){return S(),H("div",{class:C([e.ns.b("dropdown"),e.ns.is("multiple",e.isMultiple),e.popperClass]),style:J({[e.isFitInputWidth?"width":"minWidth"]:e.minWidth})},[pe(e.$slots,"default")],6)}var Wt=me(Dt,[["render",Ht],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);function At(e){const{t:l}=hl();return Le({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 Rt=(e,l,n)=>{const{t:s}=hl(),v=ie("select"),u=L(null),i=L(null),f=L(null),d=L(null),w=L(null),b=L(null),O=L(-1),c=wl({query:""}),z=wl(""),a=fe(Jl,{}),g=fe(Zl,{}),E=y(()=>!e.filterable||e.multiple||!l.visible),T=y(()=>e.disabled||a.disabled),B=y(()=>{const t=e.multiple?Array.isArray(e.modelValue)&&e.modelValue.length>0:e.modelValue!==void 0&&e.modelValue!==null&&e.modelValue!=="";return e.clearable&&!T.value&&l.inputHovering&&t}),Q=y(()=>e.remote&&e.filterable?"":e.suffixIcon),F=y(()=>v.is("reverse",Q.value&&l.visible)),p=y(()=>e.remote?300:0),I=y(()=>e.loading?e.loadingText||s("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||s("el.select.noMatch"):l.options.size===0?e.noDataText||s("el.select.noData"):null),h=y(()=>Array.from(l.options.values())),P=y(()=>Array.from(l.cachedOptions.values())),M=y(()=>{const t=h.value.filter(o=>!o.created).some(o=>o.currentLabel===l.query);return e.filterable&&e.allowCreate&&l.query!==""&&!t}),V=xl(),ye=y(()=>["small"].includes(V.value)?"small":"default"),qe=y({get(){return l.visible&&I.value!==!1},set(t){l.visible=t}});K([()=>T.value,()=>V.value,()=>a.size],()=>{D(()=>{X()})}),K(()=>e.placeholder,t=>{l.cachedPlaceHolder=l.currentPlaceholder=t}),K(()=>e.modelValue,(t,o)=>{var r;e.multiple&&(X(),t&&t.length>0||i.value&&l.query!==""?l.currentPlaceholder="":l.currentPlaceholder=l.cachedPlaceHolder,e.filterable&&!e.reserveKeyword&&(l.query="",Z(l.query))),Se(),e.filterable&&!e.multiple&&(l.inputLength=20),Ol(t,o)||(r=g.validate)==null||r.call(g,"change").catch(m=>_l())},{flush:"post",deep:!0}),K(()=>l.visible,t=>{var o,r,m;t?((r=(o=f.value)==null?void 0:o.updatePopper)==null||r.call(o),e.filterable&&(l.filteredOptionsCount=l.optionsCount,l.query=e.remote?"":l.selectedLabel,e.multiple?(m=i.value)==null||m.focus():l.selectedLabel&&(l.currentPlaceholder=`${l.selectedLabel}`,l.selectedLabel=""),Z(l.query),!e.multiple&&!e.remote&&(c.value.query="",Ee(c),Ee(z)))):(i.value&&i.value.blur(),l.query="",l.previousQuery=null,l.selectedLabel="",l.inputLength=20,l.menuVisibleOnFocus=!1,Ke(),D(()=>{i.value&&i.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))),n.emit("visible-change",t)}),K(()=>l.options.entries(),()=>{var t,o,r;if(!cl)return;(o=(t=f.value)==null?void 0:t.updatePopper)==null||o.call(t),e.multiple&&X();const m=((r=w.value)==null?void 0:r.querySelectorAll("input"))||[];Array.from(m).includes(document.activeElement)||Se(),e.defaultFirstOption&&(e.filterable||e.remote)&&l.filteredOptionsCount&&ze()},{flush:"post"}),K(()=>l.hoverIndex,t=>{typeof t=="number"&&t>-1&&(O.value=h.value[t]||{}),h.value.forEach(o=>{o.hover=O.value===o})});const X=()=>{e.collapseTags&&!e.filterable||D(()=>{var t,o;if(!u.value)return;const r=u.value.$el.querySelector("input"),m=d.value,k=mt(V.value||a.size);r.style.height=`${l.selected.length===0?k:Math.max(m?m.clientHeight+(m.clientHeight>k?6:0):0,k)-2}px`,l.tagInMultiLine=Number.parseFloat(r.style.height)>=k,l.visible&&I.value!==!1&&((o=(t=f.value)==null?void 0:t.updatePopper)==null||o.call(t))})},Z=t=>{if(!(l.previousQuery===t||l.isOnComposition)){if(l.previousQuery===null&&(typeof e.filterMethod=="function"||typeof e.remoteMethod=="function")){l.previousQuery=t;return}l.previousQuery=t,D(()=>{var o,r;l.visible&&((r=(o=f.value)==null?void 0:o.updatePopper)==null||r.call(o))}),l.hoverIndex=-1,e.multiple&&e.filterable&&D(()=>{const o=i.value.value.length*15+20;l.inputLength=e.collapseTags?Math.min(50,o):o,Te(),X()}),e.remote&&typeof e.remoteMethod=="function"?(l.hoverIndex=-1,e.remoteMethod(t)):typeof e.filterMethod=="function"?(e.filterMethod(t),Ee(z)):(l.filteredOptionsCount=l.optionsCount,c.value.query=t,Ee(c),Ee(z)),e.defaultFirstOption&&(e.filterable||e.remote)&&l.filteredOptionsCount&&ze()}},Te=()=>{l.currentPlaceholder!==""&&(l.currentPlaceholder=i.value.value?"":l.cachedPlaceHolder)},ze=()=>{const t=h.value.filter(m=>m.visible&&!m.disabled&&!m.states.groupDisabled),o=t.find(m=>m.created),r=t[0];l.hoverIndex=Ce(h.value,o||r)},Se=()=>{var t;if(e.multiple)l.selectedLabel="";else{const r=Ie(e.modelValue);(t=r.props)!=null&&t.created?(l.createdLabel=r.props.value,l.createdSelected=!0):l.createdSelected=!1,l.selectedLabel=r.currentLabel,l.selected=r,e.filterable&&(l.query=l.selectedLabel);return}const o=[];Array.isArray(e.modelValue)&&e.modelValue.forEach(r=>{o.push(Ie(r))}),l.selected=o,D(()=>{X()})},Ie=t=>{let o;const r=al(t).toLowerCase()==="object",m=al(t).toLowerCase()==="null",k=al(t).toLowerCase()==="undefined";for(let Y=l.cachedOptions.size-1;Y>=0;Y--){const N=P.value[Y];if(r?U(N.value,e.valueKey)===U(t,e.valueKey):N.value===t){o={value:t,currentLabel:N.currentLabel,isDisabled:N.isDisabled};break}}if(o)return o;const _=r?t.label:!m&&!k?t:"",ee={value:t,currentLabel:_};return e.multiple&&(ee.hitState=!1),ee},Ke=()=>{setTimeout(()=>{const t=e.valueKey;e.multiple?l.selected.length>0?l.hoverIndex=Math.min.apply(null,l.selected.map(o=>h.value.findIndex(r=>U(r,t)===U(o,t)))):l.hoverIndex=-1:l.hoverIndex=h.value.findIndex(o=>re(o)===re(l.selected))},300)},Fe=()=>{var t,o;Ne(),(o=(t=f.value)==null?void 0:t.updatePopper)==null||o.call(t),e.multiple&&!e.filterable&&X()},Ne=()=>{var t;l.inputWidth=(t=u.value)==null?void 0:t.$el.getBoundingClientRect().width},je=()=>{e.filterable&&l.query!==l.selectedLabel&&(l.query=l.selectedLabel,Z(l.query))},Qe=El(()=>{je()},p.value),Ge=El(t=>{Z(t.target.value)},p.value),ae=t=>{Ol(e.modelValue,t)||n.emit(Vl,t)},Ue=t=>{if(t.target.value.length<=0&&!we()){const o=e.modelValue.slice();o.pop(),n.emit(oe,o),ae(o)}t.target.value.length===1&&e.modelValue.length===0&&(l.currentPlaceholder=l.cachedPlaceHolder)},Xe=(t,o)=>{const r=l.selected.indexOf(o);if(r>-1&&!T.value){const m=e.modelValue.slice();m.splice(r,1),n.emit(oe,m),ae(m),n.emit("remove-tag",o.value)}t.stopPropagation()},se=t=>{t.stopPropagation();const o=e.multiple?[]:"";if(typeof o!="string")for(const r of l.selected)r.isDisabled&&o.push(r.value);n.emit(oe,o),ae(o),l.visible=!1,n.emit("clear")},ke=(t,o)=>{var r;if(e.multiple){const m=(e.modelValue||[]).slice(),k=Ce(m,t.value);k>-1?m.splice(k,1):(e.multipleLimit<=0||m.length<e.multipleLimit)&&m.push(t.value),n.emit(oe,m),ae(m),t.created&&(l.query="",Z(""),l.inputLength=20),e.filterable&&((r=i.value)==null||r.focus())}else n.emit(oe,t.value),ae(t.value),l.visible=!1;l.isSilentBlur=o,Ye(),!l.visible&&D(()=>{x(t)})},Ce=(t=[],o)=>{if(!ul(o))return t.indexOf(o);const r=e.valueKey;let m=-1;return t.some((k,_)=>U(k,r)===U(o,r)?(m=_,!0):!1),m},Ye=()=>{l.softFocus=!0;const t=i.value||u.value;t&&(t==null||t.focus())},x=t=>{var o,r,m,k,_;const ee=Array.isArray(t)?t[0]:t;let Y=null;if(ee!=null&&ee.value){const N=h.value.filter(R=>R.value===ee.value);N.length>0&&(Y=N[0].$el)}if(f.value&&Y){const N=(k=(m=(r=(o=f.value)==null?void 0:o.popperRef)==null?void 0:r.contentRef)==null?void 0:m.querySelector)==null?void 0:k.call(m,`.${v.be("dropdown","wrap")}`);N&&et(N,Y)}(_=b.value)==null||_.handleScroll()},Je=t=>{l.optionsCount++,l.filteredOptionsCount++,l.options.set(t.value,t),l.cachedOptions.set(t.value,t)},Ze=(t,o)=>{l.options.get(t)===o&&(l.optionsCount--,l.filteredOptionsCount--,l.options.delete(t))},xe=t=>{t.code!==lt.backspace&&we(!1),l.inputLength=i.value.value.length*15+20,X()},we=t=>{if(!Array.isArray(l.selected))return;const o=l.selected[l.selected.length-1];if(!!o)return t===!0||t===!1?(o.hitState=t,t):(o.hitState=!o.hitState,o.hitState)},Oe=t=>{const o=t.target.value;if(t.type==="compositionend")l.isOnComposition=!1,D(()=>Z(o));else{const r=o[o.length-1]||"";l.isOnComposition=!tt(r)}},$e=()=>{D(()=>x(l.selected))},_e=t=>{l.softFocus?l.softFocus=!1:((e.automaticDropdown||e.filterable)&&(e.filterable&&!l.visible&&(l.menuVisibleOnFocus=!0),l.visible=!0),n.emit("focus",t))},Pe=()=>{var t;l.visible=!1,(t=u.value)==null||t.blur()},el=t=>{D(()=>{l.isSilentBlur?l.isSilentBlur=!1:n.emit("blur",t)}),l.softFocus=!1},ll=t=>{se(t)},tl=()=>{l.visible=!1},Me=t=>{l.visible&&(t.preventDefault(),t.stopPropagation(),l.visible=!1)},Be=()=>{var t;e.automaticDropdown||T.value||(l.menuVisibleOnFocus?l.menuVisibleOnFocus=!1:l.visible=!l.visible,l.visible&&((t=i.value||u.value)==null||t.focus()))},nl=()=>{l.visible?h.value[l.hoverIndex]&&ke(h.value[l.hoverIndex],void 0):Be()},re=t=>ul(t.value)?U(t.value,e.valueKey):t.value,ol=y(()=>h.value.filter(t=>t.visible).every(t=>t.disabled)),Ve=t=>{if(!l.visible){l.visible=!0;return}if(!(l.options.size===0||l.filteredOptionsCount===0)&&!l.isOnComposition&&!ol.value){t==="next"?(l.hoverIndex++,l.hoverIndex===l.options.size&&(l.hoverIndex=0)):t==="prev"&&(l.hoverIndex--,l.hoverIndex<0&&(l.hoverIndex=l.options.size-1));const o=h.value[l.hoverIndex];(o.disabled===!0||o.states.groupDisabled===!0||!o.visible)&&Ve(t),D(()=>x(O.value))}};return{optionsArray:h,selectSize:V,handleResize:Fe,debouncedOnInputChange:Qe,debouncedQueryChange:Ge,deletePrevTag:Ue,deleteTag:Xe,deleteSelected:se,handleOptionSelect:ke,scrollToOption:x,readonly:E,resetInputHeight:X,showClose:B,iconComponent:Q,iconReverse:F,showNewOption:M,collapseTagSize:ye,setSelected:Se,managePlaceholder:Te,selectDisabled:T,emptyText:I,toggleLastOptionHitState:we,resetInputState:xe,handleComposition:Oe,onOptionCreate:Je,onOptionDestroy:Ze,handleMenuEnter:$e,handleFocus:_e,blur:Pe,handleBlur:el,handleClearClick:ll,handleClose:tl,handleKeydownEscape:Me,toggleMenu:Be,selectOption:nl,getValueKey:re,navigateOptions:Ve,dropMenuVisible:qe,queryChange:c,groupQueryChange:z,reference:u,input:i,tooltipRef:f,tags:d,selectWrapper:w,scrollbar:b}},kl="ElSelect",qt=ve({name:kl,componentName:kl,components:{ElInput:nt,ElSelectMenu:Wt,ElOption:bl,ElTag:pt,ElScrollbar:$t,ElTooltip:ot,ElIcon:it},directives:{ClickOutside:Pt},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:ht},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:at.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:[String,Object],default:st},fitInputWidth:{type:Boolean,default:!1},suffixIcon:{type:[String,Object],default:rt},tagType:il(De({},ft.type),{default:"info"})},emits:[oe,Vl,"remove-tag","clear","visible-change","focus","blur"],setup(e,l){const n=ie("select"),s=ie("input"),{t:v}=hl(),u=At(e),{optionsArray:i,selectSize:f,readonly:d,handleResize:w,collapseTagSize:b,debouncedOnInputChange:O,debouncedQueryChange:c,deletePrevTag:z,deleteTag:a,deleteSelected:g,handleOptionSelect:E,scrollToOption:T,setSelected:B,resetInputHeight:Q,managePlaceholder:F,showClose:p,selectDisabled:I,iconComponent:h,iconReverse:P,showNewOption:M,emptyText:V,toggleLastOptionHitState:ye,resetInputState:qe,handleComposition:X,onOptionCreate:Z,onOptionDestroy:Te,handleMenuEnter:ze,handleFocus:Se,blur:Ie,handleBlur:Ke,handleClearClick:Fe,handleClose:Ne,handleKeydownEscape:je,toggleMenu:Qe,selectOption:Ge,getValueKey:ae,navigateOptions:Ue,dropMenuVisible:Xe,reference:se,input:ke,tooltipRef:Ce,tags:Ye,selectWrapper:x,scrollbar:Je,queryChange:Ze,groupQueryChange:xe}=Rt(e,u,l),{focus:we}=bt(se),{inputWidth:Oe,selected:$e,inputLength:_e,filteredOptionsCount:Pe,visible:el,softFocus:ll,selectedLabel:tl,hoverIndex:Me,query:Be,inputHovering:nl,currentPlaceholder:re,menuVisibleOnFocus:ol,isOnComposition:Ve,isSilentBlur:t,options:o,cachedOptions:r,optionsCount:m,prefixWidth:k,tagInMultiLine:_}=ml(u),ee=y(()=>{const R=[n.b()],ue=A(f);return ue&&R.push(n.m(ue)),e.disabled&&R.push(n.m("disabled")),R}),Y=y(()=>({maxWidth:`${A(Oe)-32}px`,width:"100%"}));fl(Re,Le({props:e,options:o,optionsArray:i,cachedOptions:r,optionsCount:m,filteredOptionsCount:Pe,hoverIndex:Me,handleOptionSelect:E,onOptionCreate:Z,onOptionDestroy:Te,selectWrapper:x,selected:$e,setSelected:B,queryChange:Ze,groupQueryChange:xe})),Ae(()=>{u.cachedPlaceHolder=re.value=e.placeholder||v("el.select.placeholder"),e.multiple&&Array.isArray(e.modelValue)&&e.modelValue.length>0&&(re.value=""),pl(x,w),e.remote&&e.multiple&&Q(),D(()=>{const R=se.value&&se.value.$el;if(!!R&&(Oe.value=R.getBoundingClientRect().width,l.slots.prefix)){const ue=R.querySelector(`.${s.e("prefix")}`);k.value=Math.max(ue.getBoundingClientRect().width+5,30)}}),B()}),e.multiple&&!Array.isArray(e.modelValue)&&l.emit(oe,[]),!e.multiple&&Array.isArray(e.modelValue)&&l.emit(oe,"");const N=y(()=>{var R,ue;return(ue=(R=Ce.value)==null?void 0:R.popperRef)==null?void 0:ue.contentRef});return{tagInMultiLine:_,prefixWidth:k,selectSize:f,readonly:d,handleResize:w,collapseTagSize:b,debouncedOnInputChange:O,debouncedQueryChange:c,deletePrevTag:z,deleteTag:a,deleteSelected:g,handleOptionSelect:E,scrollToOption:T,inputWidth:Oe,selected:$e,inputLength:_e,filteredOptionsCount:Pe,visible:el,softFocus:ll,selectedLabel:tl,hoverIndex:Me,query:Be,inputHovering:nl,currentPlaceholder:re,menuVisibleOnFocus:ol,isOnComposition:Ve,isSilentBlur:t,options:o,resetInputHeight:Q,managePlaceholder:F,showClose:p,selectDisabled:I,iconComponent:h,iconReverse:P,showNewOption:M,emptyText:V,toggleLastOptionHitState:ye,resetInputState:qe,handleComposition:X,handleMenuEnter:ze,handleFocus:Se,blur:Ie,handleBlur:Ke,handleClearClick:Fe,handleClose:Ne,handleKeydownEscape:je,toggleMenu:Qe,selectOption:Ge,getValueKey:ae,navigateOptions:Ue,dropMenuVisible:Xe,focus:we,reference:se,input:ke,tooltipRef:Ce,popperPaneRef:N,tags:Ye,selectWrapper:x,scrollbar:Je,wrapperKls:ee,selectTagsStyle:Y,nsSelect:n}}}),Kt={class:"select-trigger"},Ft=["disabled","autocomplete"],Nt={style:{height:"100%",display:"flex","justify-content":"center","align-items":"center"}};function jt(e,l,n,s,v,u){const i=de("el-tag"),f=de("el-tooltip"),d=de("el-icon"),w=de("el-input"),b=de("el-option"),O=de("el-scrollbar"),c=de("el-select-menu"),z=ut("click-outside");return ge((S(),H("div",{ref:"selectWrapper",class:C(e.wrapperKls),onClick:l[23]||(l[23]=le((...a)=>e.toggleMenu&&e.toggleMenu(...a),["stop"]))},[ce(f,{ref:"tooltipRef",visible:e.dropMenuVisible,"onUpdate:visible":l[22]||(l[22]=a=>e.dropMenuVisible=a),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:$(()=>[W("div",Kt,[e.multiple?(S(),H("div",{key:0,ref:"tags",class:C(e.nsSelect.e("tags")),style:J(e.selectTagsStyle)},[e.collapseTags&&e.selected.length?(S(),H("span",{key:0,class:C([e.nsSelect.b("tags-wrapper"),{"has-prefix":e.prefixWidth&&e.selected.length}])},[ce(i,{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]=a=>e.deleteTag(a,e.selected[0]))},{default:$(()=>[W("span",{class:C(e.nsSelect.e("tags-text")),style:J({maxWidth:e.inputWidth-123+"px"})},ne(e.selected[0].currentLabel),7)]),_:1},8,["closable","size","hit","type"]),e.selected.length>1?(S(),q(i,{key:0,closable:!1,size:e.collapseTagSize,type:e.tagType,"disable-transitions":""},{default:$(()=>[e.collapseTagsTooltip?(S(),q(f,{key:0,disabled:e.dropMenuVisible,"fallback-placements":["bottom","top","right","left"],effect:e.effect,placement:"bottom",teleported:!1},{default:$(()=>[W("span",{class:C(e.nsSelect.e("tags-text"))},"+ "+ne(e.selected.length-1),3)]),content:$(()=>[W("div",{class:C(e.nsSelect.e("collapse-tags"))},[(S(!0),H(He,null,Ll(e.selected,(a,g)=>(S(),H("div",{key:g,class:C(e.nsSelect.e("collapse-tag"))},[(S(),q(i,{key:e.getValueKey(a),class:"in-tooltip",closable:!e.selectDisabled&&!a.isDisabled,size:e.collapseTagSize,hit:a.hitState,type:e.tagType,"disable-transitions":"",style:{margin:"2px"},onClose:E=>e.deleteTag(E,a)},{default:$(()=>[W("span",{class:C(e.nsSelect.e("tags-text")),style:J({maxWidth:e.inputWidth-75+"px"})},ne(a.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"]))],2))),128))],2)]),_:1},8,["disabled","effect"])):(S(),H("span",{key:1,class:C(e.nsSelect.e("tags-text"))},"+ "+ne(e.selected.length-1),3))]),_:1},8,["size","type"])):j("v-if",!0)],2)):j("v-if",!0),j(" <div> "),e.collapseTags?j("v-if",!0):(S(),q(Pl,{key:1,onAfterLeave:e.resetInputHeight},{default:$(()=>[W("span",{class:C([e.nsSelect.b("tags-wrapper"),{"has-prefix":e.prefixWidth&&e.selected.length}])},[(S(!0),H(He,null,Ll(e.selected,a=>(S(),q(i,{key:e.getValueKey(a),closable:!e.selectDisabled&&!a.isDisabled,size:e.collapseTagSize,hit:a.hitState,type:e.tagType,"disable-transitions":"",onClose:g=>e.deleteTag(g,a)},{default:$(()=>[W("span",{class:C(e.nsSelect.e("tags-text")),style:J({maxWidth:e.inputWidth-75+"px"})},ne(a.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"]))),128))],2)]),_:1},8,["onAfterLeave"])),j(" </div> "),e.filterable?ge((S(),H("input",{key:2,ref:"input","onUpdate:modelValue":l[1]||(l[1]=a=>e.query=a),type:"text",class:C([e.nsSelect.e("input"),e.nsSelect.is(e.selectSize)]),disabled:e.selectDisabled,autocomplete:e.autocomplete,style:J({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]=(...a)=>e.handleFocus&&e.handleFocus(...a)),onBlur:l[3]||(l[3]=(...a)=>e.handleBlur&&e.handleBlur(...a)),onKeyup:l[4]||(l[4]=(...a)=>e.managePlaceholder&&e.managePlaceholder(...a)),onKeydown:[l[5]||(l[5]=(...a)=>e.resetInputState&&e.resetInputState(...a)),l[6]||(l[6]=G(le(a=>e.navigateOptions("next"),["prevent"]),["down"])),l[7]||(l[7]=G(le(a=>e.navigateOptions("prev"),["prevent"]),["up"])),l[8]||(l[8]=G((...a)=>e.handleKeydownEscape&&e.handleKeydownEscape(...a),["esc"])),l[9]||(l[9]=G(le((...a)=>e.selectOption&&e.selectOption(...a),["stop","prevent"]),["enter"])),l[10]||(l[10]=G((...a)=>e.deletePrevTag&&e.deletePrevTag(...a),["delete"])),l[11]||(l[11]=G(a=>e.visible=!1,["tab"]))],onCompositionstart:l[12]||(l[12]=(...a)=>e.handleComposition&&e.handleComposition(...a)),onCompositionupdate:l[13]||(l[13]=(...a)=>e.handleComposition&&e.handleComposition(...a)),onCompositionend:l[14]||(l[14]=(...a)=>e.handleComposition&&e.handleComposition(...a)),onInput:l[15]||(l[15]=(...a)=>e.debouncedQueryChange&&e.debouncedQueryChange(...a))},null,46,Ft)),[[dt,e.query]]):j("v-if",!0)],6)):j("v-if",!0),ce(w,{id:e.id,ref:"reference",modelValue:e.selectedLabel,"onUpdate:modelValue":l[16]||(l[16]=a=>e.selectedLabel=a),type:"text",placeholder:e.currentPlaceholder,name:e.name,autocomplete:e.autocomplete,size:e.selectSize,disabled:e.selectDisabled,readonly:e.readonly,"validate-event":!1,class:C([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]=G(le(a=>e.navigateOptions("next"),["stop","prevent"]),["down"])),l[18]||(l[18]=G(le(a=>e.navigateOptions("prev"),["stop","prevent"]),["up"])),G(le(e.selectOption,["stop","prevent"]),["enter"]),G(e.handleKeydownEscape,["esc"]),l[19]||(l[19]=G(a=>e.visible=!1,["tab"]))],onMouseenter:l[20]||(l[20]=a=>e.inputHovering=!0),onMouseleave:l[21]||(l[21]=a=>e.inputHovering=!1)},ct({suffix:$(()=>[e.iconComponent&&!e.showClose?(S(),q(d,{key:0,class:C([e.nsSelect.e("caret"),e.nsSelect.e("icon"),e.iconReverse])},{default:$(()=>[(S(),q(rl(e.iconComponent)))]),_:1},8,["class"])):j("v-if",!0),e.showClose&&e.clearIcon?(S(),q(d,{key:1,class:C([e.nsSelect.e("caret"),e.nsSelect.e("icon")]),onClick:e.handleClearClick},{default:$(()=>[(S(),q(rl(e.clearIcon)))]),_:1},8,["class","onClick"])):j("v-if",!0)]),_:2},[e.$slots.prefix?{name:"prefix",fn:$(()=>[W("div",Nt,[pe(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:$(()=>[ce(c,null,{default:$(()=>[ge(ce(O,{ref:"scrollbar",tag:"ul","wrap-class":e.nsSelect.be("dropdown","wrap"),"view-class":e.nsSelect.be("dropdown","list"),class:C([e.nsSelect.is("empty",!e.allowCreate&&Boolean(e.query)&&e.filteredOptionsCount===0)])},{default:$(()=>[e.showNewOption?(S(),q(b,{key:0,value:e.query,created:!0},null,8,["value"])):j("v-if",!0),pe(e.$slots,"default")]),_:3},8,["wrap-class","view-class","class"]),[[We,e.options.size>0&&!e.loading]]),e.emptyText&&(!e.allowCreate||e.loading||e.allowCreate&&e.options.size===0)?(S(),H(He,{key:0},[e.$slots.empty?pe(e.$slots,"empty",{key:0}):(S(),H("p",{key:1,class:C(e.nsSelect.be("dropdown","empty"))},ne(e.emptyText),3))],64)):j("v-if",!0)]),_:3})]),_:3},8,["visible","teleported","popper-class","effect","transition","persistent","onShow"])],2)),[[z,e.handleClose,e.popperPaneRef]])}var Qt=me(qt,[["render",jt],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);const Gt=ve({name:"ElOptionGroup",componentName:"ElOptionGroup",props:{label:String,disabled:{type:Boolean,default:!1}},setup(e){const l=ie("select"),n=L(!0),s=vl(),v=L([]);fl(Wl,Le(De({},ml(e))));const u=fe(Re);Ae(()=>{v.value=i(s.subTree)});const i=d=>{const w=[];return Array.isArray(d.children)&&d.children.forEach(b=>{var O;b.type&&b.type.name==="ElOption"&&b.component&&b.component.proxy?w.push(b.component.proxy):(O=b.children)!=null&&O.length&&w.push(...i(b))}),w},{groupQueryChange:f}=Bl(u);return K(f,()=>{n.value=v.value.some(d=>d.visible===!0)}),{visible:n,ns:l}}});function Ut(e,l,n,s,v,u){return ge((S(),H("ul",{class:C(e.ns.be("group","wrap"))},[W("li",{class:C(e.ns.be("group","title"))},ne(e.label),3),W("li",null,[W("ul",{class:C(e.ns.b("group"))},[pe(e.$slots,"default")],2)])],2)),[[We,e.visible]])}var Al=me(Gt,[["render",Ut],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);const Zt=Ml(Qt,{Option:bl,OptionGroup:Al}),xt=Dl(bl),_t=Dl(Al);export{Pt as C,Zt as E,xt as a,$t as b,_t as c,ht as i};
|