mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-29 01:40:16 +00:00
2 lines
3.8 KiB
JavaScript
2 lines
3.8 KiB
JavaScript
import{e as N,i as X,a3 as A,aA as z,a1 as G,a2 as U,b as W,d as O}from"./index-cf9a2dd7.js";import{G as l,a4 as a,F as V,ba as g,W as K,ag as j,o as $,a as q,K as J,i as Q,b as x,bl as Z,w as P,aF as F,N as v,d as ee,y as oe,h as Y,U as te}from"./plugin-vue_export-helper-85a4d40b.js";import{t as ne}from"./event-f85d77b0.js";import{a as se}from"./focus-trap-64c402c5.js";var d=(e=>(e[e.TEXT=1]="TEXT",e[e.CLASS=2]="CLASS",e[e.STYLE=4]="STYLE",e[e.PROPS=8]="PROPS",e[e.FULL_PROPS=16]="FULL_PROPS",e[e.HYDRATE_EVENTS=32]="HYDRATE_EVENTS",e[e.STABLE_FRAGMENT=64]="STABLE_FRAGMENT",e[e.KEYED_FRAGMENT=128]="KEYED_FRAGMENT",e[e.UNKEYED_FRAGMENT=256]="UNKEYED_FRAGMENT",e[e.NEED_PATCH=512]="NEED_PATCH",e[e.DYNAMIC_SLOTS=1024]="DYNAMIC_SLOTS",e[e.HOISTED=-1]="HOISTED",e[e.BAIL=-2]="BAIL",e))(d||{});function re(e){return a(e)&&e.type===V}function ue(e){return a(e)&&e.type===g}function Ee(e){return a(e)&&!re(e)&&!ue(e)}const ve=e=>{if(!a(e))return{};const s=e.props||{},t=(a(e.type)?e.type.props:void 0)||{},o={};return Object.keys(t).forEach(n=>{K(t[n],"default")&&(o[n]=t[n].default)}),Object.keys(s).forEach(n=>{o[j(n)]=s[n]}),o},ye=e=>{if(!l(e)||e.length>1)throw new Error("expect to receive a single Vue element child");return e[0]},y=e=>{const s=l(e)?e:[e],t=[];return s.forEach(o=>{var n;l(o)?t.push(...y(o)):a(o)&&l(o.children)?t.push(...y(o.children)):(t.push(o),a(o)&&((n=o.component)!=null&&n.subTree)&&t.push(...y(o.component.subTree)))}),t},Te=(e,s,t)=>{let o={offsetX:0,offsetY:0};const n=i=>{const c=i.clientX,f=i.clientY,{offsetX:p,offsetY:E}=o,m=e.value.getBoundingClientRect(),T=m.left,S=m.top,D=m.width,_=m.height,k=document.documentElement.clientWidth,H=document.documentElement.clientHeight,I=-T+p,B=-S+E,R=k-T-D+p,h=H-S-_+E,b=w=>{const C=Math.min(Math.max(p+w.clientX-c,I),R),L=Math.min(Math.max(E+w.clientY-f,B),h);o={offsetX:C,offsetY:L},e.value.style.transform=`translate(${N(C)}, ${N(L)})`},M=()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",M)};document.addEventListener("mousemove",b),document.addEventListener("mouseup",M)},u=()=>{s.value&&e.value&&s.value.addEventListener("mousedown",n)},r=()=>{s.value&&e.value&&s.value.removeEventListener("mousedown",n)};$(()=>{q(()=>{t.value?u():r()})}),J(()=>{r()})},Se=e=>{Q(e)||ne("[useLockscreen]","You need to pass a ref param to this function");const s=x("popup"),t=Z(()=>s.bm("parent","hidden"));if(!X||A(document.body,t.value))return;let o=0,n=!1,u="0";const r=()=>{setTimeout(()=>{U(document.body,t.value),n&&(document.body.style.width=u)},200)};P(e,i=>{if(!i){r();return}n=!A(document.body,t.value),n&&(u=document.body.style.width),o=se(s.namespace.value);const c=document.documentElement.clientHeight<document.body.scrollHeight,f=z(document.body,"overflowY");o>0&&(c||f==="scroll")&&n&&(document.body.style.width=`calc(100% - ${o}px)`),G(document.body,t.value)}),F(()=>r())},ae=e=>{if(!e)return{onClick:v,onMousedown:v,onMouseup:v};let s=!1,t=!1;return{onClick:r=>{s&&t&&e(r),s=t=!1},onMousedown:r=>{s=r.target===r.currentTarget},onMouseup:r=>{t=r.target===r.currentTarget}}},ie=W({mask:{type:Boolean,default:!0},customMaskEvent:{type:Boolean,default:!1},overlayClass:{type:O([String,Array,Object])},zIndex:{type:O([String,Number])}}),ce={click:e=>e instanceof MouseEvent};var me=ee({name:"ElOverlay",props:ie,emits:ce,setup(e,{slots:s,emit:t}){const o=x("overlay"),n=c=>{t("click",c)},{onClick:u,onMousedown:r,onMouseup:i}=ae(e.customMaskEvent?void 0:n);return()=>e.mask?oe("div",{class:[o.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:u,onMousedown:r,onMouseup:i},[Y(s,"default")],d.STYLE|d.CLASS|d.PROPS,["onClick","onMouseup","onMousedown"]):te("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[Y(s,"default")])}});const be=me;export{be as E,d as P,Ee as a,Se as b,ae as c,ye as e,y as f,ve as g,re as i,Te as u};
|