1 |
- import{az as Pe,aA as q,ct as Me,bY as y,aD as M,d as G,r as F,aO as E,J as k,aU as J,cp as Ge,aG as A,a as T,K as ae,bI as Le,aC as $,cu as S,aj as h,o as B,q as z,w as g,f as C,aH as ze,cv as Oe,cw as ie,am as Ae,B as se,bn as He,cx as Ne,b5 as Je,cy as Ue,aS as de,cz as Ye,cA as We,al as ue,aB as V,aW as je,c0 as qe,cB as Ve,aw as Xe,bD as Qe,c as U,aX as Ze,ai as H,Y as X,O as Q,cC as ce,cD as en,cE as nn,g as on,L as tn,aR as Z,F as ln,cF as pe,cG as rn,cH as ve,cI as an,cJ as sn,cK as dn,at as un,cL as cn,cM as pn,aE as vn,aI as fe,__tla as fn}from"./index-2eab2d23.js";let me,ge,be,mn=Promise.all([(()=>{try{return fn}catch{}})()]).then(async()=>{const we=Pe({style:{type:q([String,Array,Object])},currentTabId:{type:q(String)},defaultCurrentTabId:String,loop:Boolean,dir:{type:String,values:["ltr","rtl"],default:"ltr"},orientation:{type:q(String)},onBlur:Function,onFocus:Function,onMousedown:Function}),{ElCollection:he,ElCollectionItem:Ie,COLLECTION_INJECTION_KEY:Y,COLLECTION_ITEM_INJECTION_KEY:ye}=Me("RovingFocusGroup"),W=Symbol("elRovingFocusGroup"),ee=Symbol("elRovingFocusGroupItem"),Ee={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"},ke=(e,n,c)=>{const a=((d,u)=>{if(u!=="rtl")return d;switch(d){case y.right:return y.left;case y.left:return y.right;default:return d}})(e.key,c);if(!(n==="vertical"&&[y.left,y.right].includes(a)||n==="horizontal"&&[y.up,y.down].includes(a)))return Ee[a]},j=e=>{const{activeElement:n}=document;for(const c of e)if(c===n||(c.focus(),n!==document.activeElement))return},ne="currentTabIdChange",oe="rovingFocusGroup.entryFocus",Fe={bubbles:!1,cancelable:!0},Ce=G({name:"ElRovingFocusGroupImpl",inheritAttrs:!1,props:we,emits:[ne,"entryFocus"],setup(e,{emit:n}){var c;const a=F((c=e.currentTabId||e.defaultCurrentTabId)!=null?c:null),d=F(!1),u=F(!1),i=F(null),{getItems:r}=E(Y,void 0),v=k(()=>[{outline:"none"},e.style]),b=S(l=>{var s;(s=e.onMousedown)==null||s.call(e,l)},()=>{u.value=!0}),w=S(l=>{var s;(s=e.onFocus)==null||s.call(e,l)},l=>{const s=!T(u),{target:f,currentTarget:I}=l;if(f===I&&s&&!T(d)){const K=new Event(oe,Fe);if(I==null||I.dispatchEvent(K),!K.defaultPrevented){const _=r().filter(m=>m.focusable),x=[_.find(m=>m.active),_.find(m=>m.id===T(a)),..._].filter(Boolean).map(m=>m.ref);j(x)}}u.value=!1}),t=S(l=>{var s;(s=e.onBlur)==null||s.call(e,l)},()=>{d.value=!1});J(W,{currentTabbedId:Ge(a),loop:A(e,"loop"),tabIndex:k(()=>T(d)?-1:0),rovingFocusGroupRef:i,rovingFocusGroupRootStyle:v,orientation:A(e,"orientation"),dir:A(e,"dir"),onItemFocus:l=>{n(ne,l)},onItemShiftTab:()=>{d.value=!0},onBlur:t,onFocus:w,onMousedown:b}),ae(()=>e.currentTabId,l=>{a.value=l??null}),Le(i,oe,(...l)=>{n("entryFocus",...l)})}});var _e=M(G({name:"ElRovingFocusGroup",components:{ElFocusGroupCollection:he,ElRovingFocusGroupImpl:M(Ce,[["render",function(e,n,c,a,d,u){return $(e.$slots,"default")}],["__file","/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-group-impl.vue"]])}}),[["render",function(e,n,c,a,d,u){const i=h("el-roving-focus-group-impl"),r=h("el-focus-group-collection");return B(),z(r,null,{default:g(()=>[C(i,ze(Oe(e.$attrs)),{default:g(()=>[$(e.$slots,"default")]),_:3},16)]),_:3})}],["__file","/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-group.vue"]]),Re=M(G({components:{ElRovingFocusCollectionItem:Ie},props:{focusable:{type:Boolean,default:!0},active:{type:Boolean,default:!1}},emits:["mousedown","focus","keydown"],setup(e,{emit:n}){const{currentTabbedId:c,loop:a,onItemFocus:d,onItemShiftTab:u}=E(W,void 0),{getItems:i}=E(Y,void 0),r=ie(),v=F(null),b=S(s=>{n("mousedown",s)},s=>{e.focusable?d(T(r)):s.preventDefault()}),w=S(s=>{n("focus",s)},()=>{d(T(r))}),t=S(s=>{n("keydown",s)},s=>{const{key:f,shiftKey:I,target:K,currentTarget:_}=s;if(f===y.tab&&I)return void u();if(K!==_)return;const x=ke(s);if(x){s.preventDefault();let o=i().filter(p=>p.focusable).map(p=>p.ref);switch(x){case"last":o.reverse();break;case"prev":case"next":{x==="prev"&&o.reverse();const p=o.indexOf(_);o=a.value?(D=p+1,(m=o).map((R,P)=>m[(P+D)%m.length])):o.slice(p+1);break}}Ae(()=>{j(o)})}var m,D}),l=k(()=>c.value===T(r));return J(ee,{rovingFocusGroupItemRef:v,tabIndex:k(()=>T(l)?0:-1),handleMousedown:b,handleFocus:w,handleKeydown:t}),{id:r,handleKeydown:t,handleFocus:w,handleMousedown:b}}}),[["render",function(e,n,c,a,d,u){const i=h("el-roving-focus-collection-item");return B(),z(i,{id:e.id,focusable:e.focusable,active:e.active},{default:g(()=>[$(e.$slots,"default")]),_:3},8,["id","focusable","active"])}],["__file","/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-item.vue"]]);const N=Symbol("elDropdown"),{ButtonGroup:Te}=se;var Se=M(G({name:"ElDropdown",components:{ElButton:se,ElButtonGroup:Te,ElScrollbar:He,ElDropdownCollection:Ne,ElTooltip:Je,ElRovingFocusGroup:_e,ElOnlyChild:Ue,ElIcon:de,ArrowDown:Ye},props:We,emits:["visible-change","click","command"],setup(e,{emit:n}){const c=ue(),a=V("dropdown"),{t:d}=je(),u=F(),i=F(),r=F(null),v=F(null),b=F(null),w=F(null),t=F(!1),l=[y.enter,y.space,y.down],s=k(()=>({maxHeight:qe(e.maxHeight)})),f=k(()=>[a.m(m.value)]),I=k(()=>Ve(e.trigger)),K=ie().value,_=k(()=>e.id||K);function x(){var o;(o=r.value)==null||o.onClose()}ae([u,I],([o,p],[R])=>{var P,O,L;(P=R==null?void 0:R.$el)!=null&&P.removeEventListener&&R.$el.removeEventListener("pointerenter",D),(O=o==null?void 0:o.$el)!=null&&O.removeEventListener&&o.$el.removeEventListener("pointerenter",D),(L=o==null?void 0:o.$el)!=null&&L.addEventListener&&p.includes("hover")&&o.$el.addEventListener("pointerenter",D)},{immediate:!0}),Xe(()=>{var o,p;(p=(o=u.value)==null?void 0:o.$el)!=null&&p.removeEventListener&&u.value.$el.removeEventListener("pointerenter",D)});const m=Qe();function D(){var o,p;(p=(o=u.value)==null?void 0:o.$el)==null||p.focus()}return J(N,{contentRef:v,role:k(()=>e.role),triggerId:_,isUsingKeyboard:t,onItemEnter:function(){},onItemLeave:function(){const o=T(v);I.value.includes("hover")&&(o==null||o.focus()),w.value=null}}),J("elDropdown",{instance:c,dropdownSize:m,handleClick:function(){x()},commandHandler:function(...o){n("command",...o)},trigger:A(e,"trigger"),hideOnClick:A(e,"hideOnClick")}),{t:d,ns:a,scrollbar:b,wrapStyle:s,dropdownTriggerKls:f,dropdownSize:m,triggerId:_,triggerKeys:l,currentTabId:w,handleCurrentTabIdChange:function(o){w.value=o},handlerMainButtonClick:o=>{n("click",o)},handleEntryFocus:function(o){t.value||(o.preventDefault(),o.stopImmediatePropagation())},handleClose:x,handleOpen:function(){var o;(o=r.value)==null||o.onOpen()},handleBeforeShowTooltip:function(){n("visible-change",!0)},handleShowTooltip:function(o){(o==null?void 0:o.type)==="keydown"&&v.value.focus()},handleBeforeHideTooltip:function(){n("visible-change",!1)},onFocusAfterTrapped:o=>{var p,R;o.preventDefault(),(R=(p=v.value)==null?void 0:p.focus)==null||R.call(p,{preventScroll:!0})},popperRef:r,contentRef:v,triggeringElementRef:u,referenceElementRef:i}}}),[["render",function(e,n,c,a,d,u){var i;const r=h("el-dropdown-collection"),v=h("el-roving-focus-group"),b=h("el-scrollbar"),w=h("el-only-child"),t=h("el-tooltip"),l=h("el-button"),s=h("arrow-down"),f=h("el-icon"),I=h("el-button-group");return B(),U("div",{class:X([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":(i=e.referenceElementRef)==null?void 0:i.$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},Ze({content:g(()=>[C(b,{ref:"scrollbar","wrap-style":e.wrapStyle,tag:"div","view-class":e.ns.e("list")},{default:g(()=>[C(v,{loop:e.loop,"current-tab-id":e.currentTabId,orientation:"horizontal",onCurrentTabIdChange:e.handleCurrentTabIdChange,onEntryFocus:e.handleEntryFocus},{default:g(()=>[C(r,null,{default:g(()=>[$(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:g(()=>[C(w,{id:e.triggerId,ref:"triggeringElementRef",role:"button",tabindex:e.tabindex},{default:g(()=>[$(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?(B(),z(I,{key:0},{default:g(()=>[C(l,H({ref:"referenceElementRef"},e.buttonProps,{size:e.dropdownSize,type:e.type,disabled:e.disabled,tabindex:e.tabindex,onClick:e.handlerMainButtonClick}),{default:g(()=>[$(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:g(()=>[C(f,{class:X(e.ns.e("icon"))},{default:g(()=>[C(s)]),_:1},8,["class"])]),_:1},16,["id","size","type","class","disabled","tabindex","aria-label"])]),_:3})):Q("v-if",!0)],2)}],["__file","/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown.vue"]]);const xe=G({name:"DropdownItemImpl",components:{ElIcon:de},props:ce,emits:["pointermove","pointerleave","click","clickimpl"],setup(e,{emit:n}){const c=V("dropdown"),{role:a}=E(N,void 0),{collectionItemRef:d}=E(en,void 0),{collectionItemRef:u}=E(ye,void 0),{rovingFocusGroupItemRef:i,tabIndex:r,handleFocus:v,handleKeydown:b,handleMousedown:w}=E(ee,void 0),t=pe(d,u,i),l=k(()=>a.value==="menu"?"menuitem":a.value==="navigation"?"link":"button"),s=S(f=>{const{code:I}=f;if(I===y.enter||I===y.space)return f.preventDefault(),f.stopImmediatePropagation(),n("clickimpl",f),!0},b);return{ns:c,itemRef:t,dataset:{[nn]:""},role:l,tabIndex:r,handleFocus:v,handleKeydown:s,handleMousedown:w}}}),Be=["aria-disabled","tabindex","role"],te=()=>{const e=E("elDropdown",{}),n=k(()=>e==null?void 0:e.dropdownSize);return{elDropdown:e,_elDropdownSize:n}},De=G({name:"ElDropdownItem",components:{ElDropdownCollectionItem:rn,ElRovingFocusItem:Re,ElDropdownItemImpl:M(xe,[["render",function(e,n,c,a,d,u){const i=h("el-icon");return B(),U(ln,null,[e.divided?(B(),U("li",H({key:0,role:"separator",class:e.ns.bem("menu","item","divided")},e.$attrs),null,16)):Q("v-if",!0),on("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:n[0]||(n[0]=r=>e.$emit("clickimpl",r)),onFocus:n[1]||(n[1]=(...r)=>e.handleFocus&&e.handleFocus(...r)),onKeydown:n[2]||(n[2]=Z((...r)=>e.handleKeydown&&e.handleKeydown(...r),["self"])),onMousedown:n[3]||(n[3]=(...r)=>e.handleMousedown&&e.handleMousedown(...r)),onPointermove:n[4]||(n[4]=r=>e.$emit("pointermove",r)),onPointerleave:n[5]||(n[5]=r=>e.$emit("pointerleave",r))}),[e.icon?(B(),z(i,{key:0},{default:g(()=>[(B(),z(tn(e.icon)))]),_:1})):Q("v-if",!0),$(e.$slots,"default")],16,Be)],64)}],["__file","/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-item-impl.vue"]])},inheritAttrs:!1,props:ce,emits:["pointermove","pointerleave","click"],setup(e,{emit:n,attrs:c}){const{elDropdown:a}=te(),d=ue(),u=F(null),i=k(()=>{var t,l;return(l=(t=T(u))==null?void 0:t.textContent)!=null?l:""}),{onItemEnter:r,onItemLeave:v}=E(N,void 0),b=S(t=>(n("pointermove",t),t.defaultPrevented),ve(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=S(t=>(n("pointerleave",t),t.defaultPrevented),ve(t=>{v(t)}));return{handleClick:S(t=>{if(!e.disabled)return n("click",t),t.type!=="keydown"&&t.defaultPrevented},t=>{var l,s,f;e.disabled?t.stopImmediatePropagation():((l=a==null?void 0:a.hideOnClick)!=null&&l.value&&((s=a.handleClick)==null||s.call(a)),(f=a.commandHandler)==null||f.call(a,e.command,d,t))}),handlePointerMove:b,handlePointerLeave:w,textContent:i,propsAndAttrs:k(()=>({...e,...c}))}}});var le=M(De,[["render",function(e,n,c,a,d,u){var i;const r=h("el-dropdown-item-impl"),v=h("el-roving-focus-item"),b=h("el-dropdown-collection-item");return B(),z(b,{disabled:e.disabled,"text-value":(i=e.textValue)!=null?i:e.textContent},{default:g(()=>[C(v,{focusable:!e.disabled},{default:g(()=>[C(r,H(e.propsAndAttrs,{onPointerleave:e.handlePointerLeave,onPointermove:e.handlePointerMove,onClickimpl:e.handleClick}),{default:g(()=>[$(e.$slots,"default")]),_:3},16,["onPointerleave","onPointermove","onClickimpl"])]),_:3},8,["focusable"])]),_:3},8,["disabled","text-value"])}],["__file","/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-item.vue"]]);const $e=G({name:"ElDropdownMenu",props:an,setup(e){const n=V("dropdown"),{_elDropdownSize:c}=te(),a=c.value,{focusTrapRef:d,onKeydown:u}=E(sn,void 0),{contentRef:i,role:r,triggerId:v}=E(N,void 0),{collectionRef:b,getItems:w}=E(dn,void 0),{rovingFocusGroupRef:t,rovingFocusGroupRootStyle:l,tabIndex:s,onBlur:f,onFocus:I,onMousedown:K}=E(W,void 0),{collectionRef:_}=E(Y,void 0),x=k(()=>[n.b("menu"),n.bm("menu",a==null?void 0:a.value)]),m=pe(i,b,d,t,_),D=S(o=>{var p;(p=e.onKeydown)==null||p.call(e,o)},o=>{const{currentTarget:p,code:R,target:P}=o;if(p.contains(P),y.tab===R&&o.stopImmediatePropagation(),o.preventDefault(),P!==T(i)||!cn.includes(R))return;const O=w().filter(L=>!L.disabled).map(L=>L.ref);pn.includes(R)&&O.reverse(),j(O)});return{size:a,rovingFocusGroupRootStyle:l,tabIndex:s,dropdownKls:x,role:r,triggerId:v,dropdownListWrapperRef:m,handleKeydown:o=>{D(o),u(o)},onBlur:f,onFocus:I,onMousedown:K}}}),Ke=["role","aria-labelledby"];var re=M($e,[["render",function(e,n,c,a,d,u){return B(),U("ul",{ref:e.dropdownListWrapperRef,class:X(e.dropdownKls),style:un(e.rovingFocusGroupRootStyle),tabindex:-1,role:e.role,"aria-labelledby":e.triggerId,onBlur:n[0]||(n[0]=(...i)=>e.onBlur&&e.onBlur(...i)),onFocus:n[1]||(n[1]=(...i)=>e.onFocus&&e.onFocus(...i)),onKeydown:n[2]||(n[2]=Z((...i)=>e.handleKeydown&&e.handleKeydown(...i),["self"])),onMousedown:n[3]||(n[3]=Z((...i)=>e.onMousedown&&e.onMousedown(...i),["self"]))},[$(e.$slots,"default")],46,Ke)}],["__file","/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-menu.vue"]]);be=vn(Se,{DropdownItem:le,DropdownMenu:re}),me=fe(le),ge=fe(re)});export{me as E,mn as __tla,ge as a,be as b};
|