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