import{e as me,a$ as W,bk as be,_ as K,d as M,r as F,b0 as I,ad as E,a_ as N,bl as ge,t as O,a as _,w as ee,bm as we,j as D,bn as T,aA as h,o as S,g as z,B as b,k as C,l as he,bo as ye,bp as ne,bq as G,aF as Ie,V as oe,b3 as Ee,br as Fe,bs as Ce,bt as Re,b1 as te,bu as ke,bv as _e,az as le,f as j,aZ as Te,bw as xe,bx as Se,by as Be,bz as De,c as J,bA as $e,m as H,n as q,h as V,bB as re,bC as Pe,bD as Ke,C as Me,aP as Ge,aW as Y,F as Le,bE as ae,bF as ze,bG as ie,bH as Ae,bI as Oe,bJ as He,aB as Ne,bK as Je,bL as Ue,q as We,s as se}from"./index-BP6bNRoi.js";const je=me({style:{type:W([String,Array,Object])},currentTabId:{type:W(String)},defaultCurrentTabId:String,loop:Boolean,dir:{type:String,values:["ltr","rtl"],default:"ltr"},orientation:{type:W(String)},onBlur:Function,onFocus:Function,onMousedown:Function}),{ElCollection:qe,ElCollectionItem:Ve,COLLECTION_INJECTION_KEY:Z,COLLECTION_ITEM_INJECTION_KEY:Ye}=be("RovingFocusGroup"),Q=Symbol("elRovingFocusGroup"),de=Symbol("elRovingFocusGroupItem"),Ze={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"},X=e=>{const{activeElement:o}=document;for(const c of e)if(c===o||(c.focus(),o!==document.activeElement))return},ue="currentTabIdChange",ce="rovingFocusGroup.entryFocus",Qe={bubbles:!1,cancelable:!0},Xe=M({name:"ElRovingFocusGroupImpl",inheritAttrs:!1,props:je,emits:[ue,"entryFocus"],setup(e,{emit:o}){var c;const s=F((c=e.currentTabId||e.defaultCurrentTabId)!=null?c:null),p=F(!1),u=F(!1),a=F(null),{getItems:r}=I(Z,void 0),v=E(()=>[{outline:"none"},e.style]),g=T(l=>{var i;(i=e.onMousedown)==null||i.call(e,l)},()=>{u.value=!0}),w=T(l=>{var i;(i=e.onFocus)==null||i.call(e,l)},l=>{const i=!_(u),{target:f,currentTarget:y}=l;if(f===y&&i&&!_(p)){const $=new Event(ce,Qe);if(y==null||y.dispatchEvent($),!$.defaultPrevented){const R=r().filter(m=>m.focusable),x=[R.find(m=>m.active),R.find(m=>m.id===_(s)),...R].filter(Boolean).map(m=>m.ref);X(x)}}u.value=!1}),t=T(l=>{var i;(i=e.onBlur)==null||i.call(e,l)},()=>{p.value=!1});N(Q,{currentTabbedId:ge(s),loop:O(e,"loop"),tabIndex:E(()=>_(p)?-1:0),rovingFocusGroupRef:a,rovingFocusGroupRootStyle:v,orientation:O(e,"orientation"),dir:O(e,"dir"),onItemFocus:l=>{o(ue,l)},onItemShiftTab:()=>{p.value=!0},onBlur:t,onFocus:w,onMousedown:g}),ee(()=>e.currentTabId,l=>{s.value=l??null}),we(a,ce,(...l)=>{o("entryFocus",...l)})}});var en=K(M({name:"ElRovingFocusGroup",components:{ElFocusGroupCollection:qe,ElRovingFocusGroupImpl:K(Xe,[["render",function(e,o,c,s,p,u){return D(e.$slots,"default")}],["__file","roving-focus-group-impl.vue"]])}}),[["render",function(e,o,c,s,p,u){const a=h("el-roving-focus-group-impl"),r=h("el-focus-group-collection");return S(),z(r,null,{default:b(()=>[C(a,he(ye(e.$attrs)),{default:b(()=>[D(e.$slots,"default")]),_:3},16)]),_:3})}],["__file","roving-focus-group.vue"]]),nn=K(M({components:{ElRovingFocusCollectionItem:Ve},props:{focusable:{type:Boolean,default:!0},active:{type:Boolean,default:!1}},emits:["mousedown","focus","keydown"],setup(e,{emit:o}){const{currentTabbedId:c,loop:s,onItemFocus:p,onItemShiftTab:u}=I(Q,void 0),{getItems:a}=I(Z,void 0),r=ne(),v=F(null),g=T(i=>{o("mousedown",i)},i=>{e.focusable?p(_(r)):i.preventDefault()}),w=T(i=>{o("focus",i)},()=>{p(_(r))}),t=T(i=>{o("keydown",i)},i=>{const{key:f,shiftKey:y,target:$,currentTarget:R}=i;if(f===G.tab&&y)return void u();if($!==R)return;const x=(n=>{const d=n.key;return Ze[d]})(i);if(x){i.preventDefault();let n=a().filter(d=>d.focusable).map(d=>d.ref);switch(x){case"last":n.reverse();break;case"prev":case"next":{x==="prev"&&n.reverse();const d=n.indexOf(R);n=s.value?(B=d+1,(m=n).map((k,P)=>m[(P+B)%m.length])):n.slice(d+1);break}}Ie(()=>{X(n)})}var m,B}),l=E(()=>c.value===_(r));return N(de,{rovingFocusGroupItemRef:v,tabIndex:E(()=>_(l)?0:-1),handleMousedown:g,handleFocus:w,handleKeydown:t}),{id:r,handleKeydown:t,handleFocus:w,handleMousedown:g}}}),[["render",function(e,o,c,s,p,u){const a=h("el-roving-focus-collection-item");return S(),z(a,{id:e.id,focusable:e.focusable,active:e.active},{default:b(()=>[D(e.$slots,"default")]),_:3},8,["id","focusable","active"])}],["__file","roving-focus-item.vue"]]);const U=Symbol("elDropdown"),{ButtonGroup:on}=oe;var tn=K(M({name:"ElDropdown",components:{ElButton:oe,ElButtonGroup:on,ElScrollbar:Ee,ElDropdownCollection:Fe,ElTooltip:Ce,ElRovingFocusGroup:en,ElOnlyChild:Re,ElIcon:te,ArrowDown:ke},props:_e,emits:["visible-change","click","command"],setup(e,{emit:o}){const c=le(),s=j("dropdown"),{t:p}=Te(),u=F(),a=F(),r=F(null),v=F(null),g=F(null),w=F(null),t=F(!1),l=[G.enter,G.space,G.down],i=E(()=>({maxHeight:xe(e.maxHeight)})),f=E(()=>[s.m(m.value)]),y=E(()=>Se(e.trigger)),$=ne().value,R=E(()=>e.id||$);function x(){var n;(n=r.value)==null||n.onClose()}ee([u,y],([n,d],[k])=>{var P,A,L;(P=k==null?void 0:k.$el)!=null&&P.removeEventListener&&k.$el.removeEventListener("pointerenter",B),(A=n==null?void 0:n.$el)!=null&&A.removeEventListener&&n.$el.removeEventListener("pointerenter",B),(L=n==null?void 0:n.$el)!=null&&L.addEventListener&&d.includes("hover")&&n.$el.addEventListener("pointerenter",B)},{immediate:!0}),Be(()=>{var n,d;(d=(n=u.value)==null?void 0:n.$el)!=null&&d.removeEventListener&&u.value.$el.removeEventListener("pointerenter",B)});const m=De();function B(){var n,d;(d=(n=u.value)==null?void 0:n.$el)==null||d.focus()}return N(U,{contentRef:v,role:E(()=>e.role),triggerId:R,isUsingKeyboard:t,onItemEnter:function(){},onItemLeave:function(){const n=_(v);y.value.includes("hover")&&(n==null||n.focus()),w.value=null}}),N("elDropdown",{instance:c,dropdownSize:m,handleClick:function(){x()},commandHandler:function(...n){o("command",...n)},trigger:O(e,"trigger"),hideOnClick:O(e,"hideOnClick")}),{t:p,ns:s,scrollbar:g,wrapStyle:i,dropdownTriggerKls:f,dropdownSize:m,triggerId:R,triggerKeys:l,currentTabId:w,handleCurrentTabIdChange:function(n){w.value=n},handlerMainButtonClick:n=>{o("click",n)},handleEntryFocus:function(n){t.value||(n.preventDefault(),n.stopImmediatePropagation())},handleClose:x,handleOpen:function(){var n;(n=r.value)==null||n.onOpen()},handleBeforeShowTooltip:function(){o("visible-change",!0)},handleShowTooltip:function(n){(n==null?void 0:n.type)==="keydown"&&v.value.focus()},handleBeforeHideTooltip:function(){o("visible-change",!1)},onFocusAfterTrapped:n=>{var d,k;n.preventDefault(),(k=(d=v.value)==null?void 0:d.focus)==null||k.call(d,{preventScroll:!0})},popperRef:r,contentRef:v,triggeringElementRef:u,referenceElementRef:a}}}),[["render",function(e,o,c,s,p,u){var a;const r=h("el-dropdown-collection"),v=h("el-roving-focus-group"),g=h("el-scrollbar"),w=h("el-only-child"),t=h("el-tooltip"),l=h("el-button"),i=h("arrow-down"),f=h("el-icon"),y=h("el-button-group");return S(),J("div",{class:q([e.ns.b(),e.ns.is("disabled",e.disabled)])},[C(t,{ref:"popperRef",role:e.role,effect:e.effect,"fallback-placements":["bottom","top"],"popper-options":e.popperOptions,"gpu-acceleration":!1,"hide-after":e.trigger==="hover"?e.hideTimeout:0,"manual-mode":!0,placement:e.placement,"popper-class":[e.ns.e("popper"),e.popperClass],"reference-element":(a=e.referenceElementRef)==null?void 0:a.$el,trigger:e.trigger,"trigger-keys":e.triggerKeys,"trigger-target-el":e.contentRef,"show-after":e.trigger==="hover"?e.showTimeout:0,"stop-popper-mouse-event":!1,"virtual-ref":e.triggeringElementRef,"virtual-triggering":e.splitButton,disabled:e.disabled,transition:`${e.ns.namespace.value}-zoom-in-top`,teleported:e.teleported,pure:"",persistent:"",onBeforeShow:e.handleBeforeShowTooltip,onShow:e.handleShowTooltip,onBeforeHide:e.handleBeforeHideTooltip},$e({content:b(()=>[C(g,{ref:"scrollbar","wrap-style":e.wrapStyle,tag:"div","view-class":e.ns.e("list")},{default:b(()=>[C(v,{loop:e.loop,"current-tab-id":e.currentTabId,orientation:"horizontal",onCurrentTabIdChange:e.handleCurrentTabIdChange,onEntryFocus:e.handleEntryFocus},{default:b(()=>[C(r,null,{default:b(()=>[D(e.$slots,"dropdown")]),_:3})]),_:3},8,["loop","current-tab-id","onCurrentTabIdChange","onEntryFocus"])]),_:3},8,["wrap-style","view-class"])]),_:2},[e.splitButton?void 0:{name:"default",fn:b(()=>[C(w,{id:e.triggerId,ref:"triggeringElementRef",role:"button",tabindex:e.tabindex},{default:b(()=>[D(e.$slots,"default")]),_:3},8,["id","tabindex"])])}]),1032,["role","effect","popper-options","hide-after","placement","popper-class","reference-element","trigger","trigger-keys","trigger-target-el","show-after","virtual-ref","virtual-triggering","disabled","transition","teleported","onBeforeShow","onShow","onBeforeHide"]),e.splitButton?(S(),z(y,{key:0},{default:b(()=>[C(l,H({ref:"referenceElementRef"},e.buttonProps,{size:e.dropdownSize,type:e.type,disabled:e.disabled,tabindex:e.tabindex,onClick:e.handlerMainButtonClick}),{default:b(()=>[D(e.$slots,"default")]),_:3},16,["size","type","disabled","tabindex","onClick"]),C(l,H({id:e.triggerId,ref:"triggeringElementRef"},e.buttonProps,{role:"button",size:e.dropdownSize,type:e.type,class:e.ns.e("caret-button"),disabled:e.disabled,tabindex:e.tabindex,"aria-label":e.t("el.dropdown.toggleDropdown")}),{default:b(()=>[C(f,{class:q(e.ns.e("icon"))},{default:b(()=>[C(i)]),_:1},8,["class"])]),_:1},16,["id","size","type","class","disabled","tabindex","aria-label"])]),_:3})):V("v-if",!0)],2)}],["__file","dropdown.vue"]]);const ln=M({name:"DropdownItemImpl",components:{ElIcon:te},props:re,emits:["pointermove","pointerleave","click","clickimpl"],setup(e,{emit:o}){const c=j("dropdown"),{role:s}=I(U,void 0),{collectionItemRef:p}=I(Pe,void 0),{collectionItemRef:u}=I(Ye,void 0),{rovingFocusGroupItemRef:a,tabIndex:r,handleFocus:v,handleKeydown:g,handleMousedown:w}=I(de,void 0),t=ae(p,u,a),l=E(()=>s.value==="menu"?"menuitem":s.value==="navigation"?"link":"button"),i=T(f=>{const{code:y}=f;if(y===G.enter||y===G.space)return f.preventDefault(),f.stopImmediatePropagation(),o("clickimpl",f),!0},g);return{ns:c,itemRef:t,dataset:{[Ke]:""},role:l,tabIndex:r,handleFocus:v,handleKeydown:i,handleMousedown:w}}}),rn=["aria-disabled","tabindex","role"],pe=()=>{const e=I("elDropdown",{}),o=E(()=>e==null?void 0:e.dropdownSize);return{elDropdown:e,_elDropdownSize:o}};var ve=K(M({name:"ElDropdownItem",components:{ElDropdownCollectionItem:ze,ElRovingFocusItem:nn,ElDropdownItemImpl:K(ln,[["render",function(e,o,c,s,p,u){const a=h("el-icon");return S(),J(Le,null,[e.divided?(S(),J("li",H({key:0,role:"separator",class:e.ns.bem("menu","item","divided")},e.$attrs),null,16)):V("v-if",!0),Me("li",H({ref:e.itemRef},{...e.dataset,...e.$attrs},{"aria-disabled":e.disabled,class:[e.ns.be("menu","item"),e.ns.is("disabled",e.disabled)],tabindex:e.tabIndex,role:e.role,onClick:o[0]||(o[0]=r=>e.$emit("clickimpl",r)),onFocus:o[1]||(o[1]=(...r)=>e.handleFocus&&e.handleFocus(...r)),onKeydown:o[2]||(o[2]=Y((...r)=>e.handleKeydown&&e.handleKeydown(...r),["self"])),onMousedown:o[3]||(o[3]=(...r)=>e.handleMousedown&&e.handleMousedown(...r)),onPointermove:o[4]||(o[4]=r=>e.$emit("pointermove",r)),onPointerleave:o[5]||(o[5]=r=>e.$emit("pointerleave",r))}),[e.icon?(S(),z(a,{key:0},{default:b(()=>[(S(),z(Ge(e.icon)))]),_:1})):V("v-if",!0),D(e.$slots,"default")],16,rn)],64)}],["__file","dropdown-item-impl.vue"]])},inheritAttrs:!1,props:re,emits:["pointermove","pointerleave","click"],setup(e,{emit:o,attrs:c}){const{elDropdown:s}=pe(),p=le(),u=F(null),a=E(()=>{var t,l;return(l=(t=_(u))==null?void 0:t.textContent)!=null?l:""}),{onItemEnter:r,onItemLeave:v}=I(U,void 0),g=T(t=>(o("pointermove",t),t.defaultPrevented),ie(t=>{if(e.disabled)return void v(t);const l=t.currentTarget;l===document.activeElement||l.contains(document.activeElement)||(r(t),t.defaultPrevented||l==null||l.focus())})),w=T(t=>(o("pointerleave",t),t.defaultPrevented),ie(t=>{v(t)}));return{handleClick:T(t=>{if(!e.disabled)return o("click",t),t.type!=="keydown"&&t.defaultPrevented},t=>{var l,i,f;e.disabled?t.stopImmediatePropagation():((l=s==null?void 0:s.hideOnClick)!=null&&l.value&&((i=s.handleClick)==null||i.call(s)),(f=s.commandHandler)==null||f.call(s,e.command,p,t))}),handlePointerMove:g,handlePointerLeave:w,textContent:a,propsAndAttrs:E(()=>({...e,...c}))}}}),[["render",function(e,o,c,s,p,u){var a;const r=h("el-dropdown-item-impl"),v=h("el-roving-focus-item"),g=h("el-dropdown-collection-item");return S(),z(g,{disabled:e.disabled,"text-value":(a=e.textValue)!=null?a:e.textContent},{default:b(()=>[C(v,{focusable:!e.disabled},{default:b(()=>[C(r,H(e.propsAndAttrs,{onPointerleave:e.handlePointerLeave,onPointermove:e.handlePointerMove,onClickimpl:e.handleClick}),{default:b(()=>[D(e.$slots,"default")]),_:3},16,["onPointerleave","onPointermove","onClickimpl"])]),_:3},8,["focusable"])]),_:3},8,["disabled","text-value"])}],["__file","dropdown-item.vue"]]);const an=M({name:"ElDropdownMenu",props:Ae,setup(e){const o=j("dropdown"),{_elDropdownSize:c}=pe(),s=c.value,{focusTrapRef:p,onKeydown:u}=I(Oe,void 0),{contentRef:a,role:r,triggerId:v}=I(U,void 0),{collectionRef:g,getItems:w}=I(He,void 0),{rovingFocusGroupRef:t,rovingFocusGroupRootStyle:l,tabIndex:i,onBlur:f,onFocus:y,onMousedown:$}=I(Q,void 0),{collectionRef:R}=I(Z,void 0),x=E(()=>[o.b("menu"),o.bm("menu",s==null?void 0:s.value)]),m=ae(a,g,p,t,R),B=T(n=>{var d;(d=e.onKeydown)==null||d.call(e,n)},n=>{const{currentTarget:d,code:k,target:P}=n;if(d.contains(P),G.tab===k&&n.stopImmediatePropagation(),n.preventDefault(),P!==_(a)||!Je.includes(k))return;const A=w().filter(L=>!L.disabled).map(L=>L.ref);Ue.includes(k)&&A.reverse(),X(A)});return{size:s,rovingFocusGroupRootStyle:l,tabIndex:i,dropdownKls:x,role:r,triggerId:v,dropdownListWrapperRef:m,handleKeydown:n=>{B(n),u(n)},onBlur:f,onFocus:y,onMousedown:$}}}),sn=["role","aria-labelledby"];var fe=K(an,[["render",function(e,o,c,s,p,u){return S(),J("ul",{ref:e.dropdownListWrapperRef,class:q(e.dropdownKls),style:Ne(e.rovingFocusGroupRootStyle),tabindex:-1,role:e.role,"aria-labelledby":e.triggerId,onBlur:o[0]||(o[0]=(...a)=>e.onBlur&&e.onBlur(...a)),onFocus:o[1]||(o[1]=(...a)=>e.onFocus&&e.onFocus(...a)),onKeydown:o[2]||(o[2]=Y((...a)=>e.handleKeydown&&e.handleKeydown(...a),["self"])),onMousedown:o[3]||(o[3]=Y((...a)=>e.onMousedown&&e.onMousedown(...a),["self"]))},[D(e.$slots,"default")],46,sn)}],["__file","dropdown-menu.vue"]]);const dn=We(tn,{DropdownItem:ve,DropdownMenu:fe}),un=se(ve),cn=se(fe);export{un as E,cn as a,dn as b};
|