You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
5.5 KiB

import{a2 as J,s as G,as as Z,X as Q,d as F,j as O,c as M,o as E,v as N,x as A,r as b,n as f,e,A as _,y as R,w as v,a as U,g as x,J as j,f as K,a5 as ee,u as oe,m as z,p as se,G as te,ab as ae,ar as ne,Y as le,Z as re,af as ie,h as de}from"./index-7f5d592d.js";import{e as ce,f as ue,d as me,b as fe,c as pe,E as ge,a as ve}from"./el-overlay-d6e2b504.js";import{b as q,E as be,_ as V,C as he}from"./axios-6c5b73fd.js";import{b as ye}from"./config-provider-c47d9507.js";import{F as Ce,c as Ee}from"./el-table-column-48a9e196.js";import{b as H}from"./el-button-da38b5f5.js";const ke=(...l)=>n=>{l.forEach(a=>{J(a)?a(n):a.value=n})},we=(l,n,a)=>{let h={offsetX:0,offsetY:0};const r=t=>{const g=t.clientX,C=t.clientY,{offsetX:c,offsetY:u}=h,s=l.value.getBoundingClientRect(),m=s.left,k=s.top,I=s.width,T=s.height,S=document.documentElement.clientWidth,$=document.documentElement.clientHeight,B=-m+c,Y=-k+u,X=S-m-I+c,P=$-k-T+u,D=L=>{const o=Math.min(Math.max(c+L.clientX-g,B),X),d=Math.min(Math.max(u+L.clientY-C,Y),P);h={offsetX:o,offsetY:d},l.value.style.transform=`translate(${q(o)}, ${q(d)})`},i=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",D),document.addEventListener("mouseup",i)},p=()=>{n.value&&l.value&&n.value.addEventListener("mousedown",r)},y=()=>{n.value&&l.value&&n.value.removeEventListener("mousedown",r)};G(()=>{Z(()=>{a.value?p():y()})}),Q(()=>{y()})},W=Symbol("dialogInjectionKey"),$e=["aria-label"],De=["id"],Le=F({name:"ElDialogContent"}),Me=F({...Le,props:ce,emits:ue,setup(l){const n=l,{t:a}=ye(),{Close:h}=he,{dialogRef:r,headerRef:p,bodyId:y,ns:t,style:g}=O(W),{focusTrapRef:C}=O(Ce),c=ke(C,r),u=M(()=>n.draggable);return we(r,p,u),(s,m)=>(E(),N("div",{ref:e(c),class:f([e(t).b(),e(t).is("fullscreen",s.fullscreen),e(t).is("draggable",e(u)),e(t).is("align-center",s.alignCenter),{[e(t).m("center")]:s.center},s.customClass]),style:K(e(g)),tabindex:"-1"},[A("header",{ref_key:"headerRef",ref:p,class:f(e(t).e("header"))},[b(s.$slots,"header",{},()=>[A("span",{role:"heading",class:f(e(t).e("title"))},_(s.title),3)]),s.showClose?(E(),N("button",{key:0,"aria-label":e(a)("el.dialog.close"),class:f(e(t).e("headerbtn")),type:"button",onClick:m[0]||(m[0]=k=>s.$emit("close"))},[R(e(be),{class:f(e(t).e("close"))},{default:v(()=>[(E(),U(x(s.closeIcon||e(h))))]),_:1},8,["class"])],10,$e)):j("v-if",!0)],2),A("div",{id:e(y),class:f(e(t).e("body"))},[b(s.$slots,"default")],10,De),s.$slots.footer?(E(),N("footer",{key:0,class:f(e(t).e("footer"))},[b(s.$slots,"footer")],2)):j("v-if",!0)],6))}});var Ae=V(Me,[["__file","/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);const Re=["aria-label","aria-labelledby","aria-describedby"],Fe=F({name:"ElDialog",inheritAttrs:!1}),Ie=F({...Fe,props:me,emits:fe,setup(l,{expose:n}){const a=l,h=ee();H({scope:"el-dialog",from:"the title slot",replacement:"the header slot",version:"3.0.0",ref:"https://element-plus.org/en-US/component/dialog.html#slots"},M(()=>!!h.title)),H({scope:"el-dialog",from:"custom-class",replacement:"class",version:"2.3.0",ref:"https://element-plus.org/en-US/component/dialog.html#attributes",type:"Attribute"},M(()=>!!a.customClass));const r=oe("dialog"),p=z(),y=z(),t=z(),{visible:g,titleId:C,bodyId:c,style:u,overlayDialogStyle:s,rendered:m,zIndex:k,afterEnter:I,afterLeave:T,beforeLeave:S,handleClose:$,onModalClick:B,onOpenAutoFocus:Y,onCloseAutoFocus:X,onCloseRequested:P,onFocusoutPrevented:D}=pe(a,p);se(W,{dialogRef:p,headerRef:y,bodyId:c,ns:r,rendered:m,style:u});const i=ve(B),L=M(()=>a.draggable&&!a.fullscreen);return n({visible:g,dialogContentRef:t}),(o,d)=>(E(),U(ie,{to:"body",disabled:!o.appendToBody},[R(re,{name:"dialog-fade",onAfterEnter:e(I),onAfterLeave:e(T),onBeforeLeave:e(S),persisted:""},{default:v(()=>[te(R(e(ge),{"custom-mask-event":"",mask:o.modal,"overlay-class":o.modalClass,"z-index":e(k)},{default:v(()=>[A("div",{role:"dialog","aria-modal":"true","aria-label":o.title||void 0,"aria-labelledby":o.title?void 0:e(C),"aria-describedby":e(c),class:f(`${e(r).namespace.value}-overlay-dialog`),style:K(e(s)),onClick:d[0]||(d[0]=(...w)=>e(i).onClick&&e(i).onClick(...w)),onMousedown:d[1]||(d[1]=(...w)=>e(i).onMousedown&&e(i).onMousedown(...w)),onMouseup:d[2]||(d[2]=(...w)=>e(i).onMouseup&&e(i).onMouseup(...w))},[R(e(Ee),{loop:"",trapped:e(g),"focus-start-el":"container",onFocusAfterTrapped:e(Y),onFocusAfterReleased:e(X),onFocusoutPrevented:e(D),onReleaseRequested:e(P)},{default:v(()=>[e(m)?(E(),U(Ae,ae({key:0,ref_key:"dialogContentRef",ref:t},o.$attrs,{"custom-class":o.customClass,center:o.center,"align-center":o.alignCenter,"close-icon":o.closeIcon,draggable:e(L),fullscreen:o.fullscreen,"show-close":o.showClose,title:o.title,onClose:e($)}),ne({header:v(()=>[o.$slots.title?b(o.$slots,"title",{key:1}):b(o.$slots,"header",{key:0,close:e($),titleId:e(C),titleClass:e(r).e("title")})]),default:v(()=>[b(o.$slots,"default")]),_:2},[o.$slots.footer?{name:"footer",fn:v(()=>[b(o.$slots,"footer")])}:void 0]),1040,["custom-class","center","align-center","close-icon","draggable","fullscreen","show-close","title","onClose"])):j("v-if",!0)]),_:3},8,["trapped","onFocusAfterTrapped","onFocusAfterReleased","onFocusoutPrevented","onReleaseRequested"])],46,Re)]),_:3},8,["mask","overlay-class","z-index"]),[[le,e(g)]])]),_:3},8,["onAfterEnter","onAfterLeave","onBeforeLeave"])],8,["disabled"]))}});var Te=V(Ie,[["__file","/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);const ze=de(Te);export{ze as E,we as u};