314507
|
1 |
import{e as O,dk as H,dl as M,d as w,bT as j,dm as N,ad as y,r as F,f as U,aZ as W,dn as Z,bw as G,o as l,g as J,k as r,B as c,P as K,a as e,dp as Q,dq as V,C as L,m as X,aW as Y,n as s,c as d,j as u,D as ee,h as o,b1 as ae,dr as te,ae as se,ab as le,b8 as oe,_ as re,q as de}from"./index-BP6bNRoi.js";const ie=O({...H,direction:{type:String,default:"rtl",values:["ltr","rtl","ttb","btt"]},size:{type:[String,Number],default:"30%"},withHeader:{type:Boolean,default:!0},modalFade:{type:Boolean,default:!0},headerAriaLevel:{type:String,default:"2"}}),ne=M,fe=["aria-label","aria-labelledby","aria-describedby"],ce=["id","aria-level"],ue=["aria-label"],pe=["id"],be=w({name:"ElDrawer",inheritAttrs:!1}),ve=de(re(w({...be,props:ie,emits:ne,setup(R,{expose:E}){const i=R,_=j();N({scope:"el-drawer",from:"the title slot",replacement:"the header slot",version:"3.0.0",ref:"https://element-plus.org/en-US/component/drawer.html#slots"},y(()=>!!_.title));const p=F(),h=F(),t=U("drawer"),{t:g}=W(),{afterEnter:m,afterLeave:k,beforeLeave:$,visible:b,rendered:T,titleId:v,bodyId:A,zIndex:x,onModalClick:z,onOpenAutoFocus:B,onCloseAutoFocus:P,onFocusoutPrevented:S,onCloseRequested:q,handleClose:n}=Z(i,p),D=y(()=>i.direction==="rtl"||i.direction==="ltr"),C=y(()=>G(i.size));return E({handleClose:n,afterEnter:m,afterLeave:k}),(a,f)=>(l(),J(oe,{to:"body",disabled:!a.appendToBody},[r(le,{name:e(t).b("fade"),onAfterEnter:e(m),onAfterLeave:e(k),onBeforeLeave:e($),persisted:""},{default:c(()=>[K(r(e(Q),{mask:a.modal,"overlay-class":a.modalClass,"z-index":e(x),onClick:e(z)},{default:c(()=>[r(e(V),{loop:"",trapped:e(b),"focus-trap-el":p.value,"focus-start-el":h.value,onFocusAfterTrapped:e(B),onFocusAfterReleased:e(P),onFocusoutPrevented:e(S),onReleaseRequested:e(q)},{default:c(()=>[L("div",X({ref_key:"drawerRef",ref:p,"aria-modal":"true","aria-label":a.title||void 0,"aria-labelledby":a.title?void 0:e(v),"aria-describedby":e(A)},a.$attrs,{class:[e(t).b(),a.direction,e(b)&&"open"],style:e(D)?"width: "+e(C):"height: "+e(C),role:"dialog",onClick:f[1]||(f[1]=Y(()=>{},["stop"]))}),[L("span",{ref_key:"focusStartRef",ref:h,class:s(e(t).e("sr-focus")),tabindex:"-1"},null,2),a.withHeader?(l(),d("header",{key:0,class:s(e(t).e("header"))},[a.$slots.title?u(a.$slots,"title",{key:1},()=>[o(" DEPRECATED SLOT ")]):u(a.$slots,"header",{key:0,close:e(n),titleId:e(v),titleClass:e(t).e("title")},()=>[a.$slots.title?o("v-if",!0):(l(),d("span",{key:0,id:e(v),role:"heading","aria-level":a.headerAriaLevel,class:s(e(t).e("title"))},ee(a.title),11,ce))]),a.showClose?(l(),d("button",{key:2,"aria-label":e(g)("el.drawer.close"),class:s(e(t).e("close-btn")),type:"button",onClick:f[0]||(f[0]=(...I)=>e(n)&&e(n)(...I))},[r(e(ae),{class:s(e(t).e("close"))},{default:c(()=>[r(e(te))]),_:1},8,["class"])],10,ue)):o("v-if",!0)],2)):o("v-if",!0),e(T)?(l(),d("div",{key:1,id:e(A),class:s(e(t).e("body"))},[u(a.$slots,"default")],10,pe)):o("v-if",!0),a.$slots.footer?(l(),d("div",{key:2,class:s(e(t).e("footer"))},[u(a.$slots,"footer")],2)):o("v-if",!0)],16,fe)]),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusoutPrevented","onReleaseRequested"])]),_:3},8,["mask","overlay-class","z-index","onClick"]),[[se,e(b)]])]),_:3},8,["name","onAfterEnter","onAfterLeave","onBeforeLeave"])],8,["disabled"]))}}),[["__file","drawer.vue"]]));export{ve as E}; |