全栈小学生 0e47055ccb v1.0.0-beta.1
2023-04-15 17:12:49 +08:00

2 lines
3.0 KiB
JavaScript

import{B as i,a0 as u,F as S,aF as C,X as b,al as N,i as M,aJ as A,w as O,ay as w,N as p,d as L,q as _,g as f,P as x}from"./runtime-core.esm-bundler-7c3fd514.js";import{u as T,m as E,$ as R,x as Y,y as k,b as D,d as y}from"./plugin-vue_export-helper-edbdb6f8.js";import{t as I}from"./error-492b6a5b.js";import{a as H}from"./focus-trap-bb1e8c7a.js";import{i as B}from"./index-f02197a7.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 z(e){return u(e)&&e.type===S}function G(e){return u(e)&&e.type===C}function Q(e){return u(e)&&!z(e)&&!G(e)}const Z=e=>{if(!u(e))return{};const n=e.props||{},o=(u(e.type)?e.type.props:void 0)||{},t={};return Object.keys(o).forEach(s=>{b(o[s],"default")&&(t[s]=o[s].default)}),Object.keys(n).forEach(s=>{t[N(s)]=n[s]}),t},g=e=>{if(!i(e)||e.length>1)throw new Error("expect to receive a single Vue element child");return e[0]},c=e=>{const n=i(e)?e:[e],o=[];return n.forEach(t=>{var s;i(t)?o.push(...c(t)):u(t)&&i(t.children)?o.push(...c(t.children)):(o.push(t),u(t)&&((s=t.component)!=null&&s.subTree)&&o.push(...c(t.component.subTree)))}),o},h=e=>{M(e)||I("[useLockscreen]","You need to pass a ref param to this function");const n=T("popup"),o=A(()=>n.bm("parent","hidden"));if(!B||E(document.body,o.value))return;let t=0,s=!1,a="0";const r=()=>{setTimeout(()=>{k(document.body,o.value),s&&(document.body.style.width=a)},200)};O(e,l=>{if(!l){r();return}s=!E(document.body,o.value),s&&(a=document.body.style.width),t=H(n.namespace.value);const m=document.documentElement.clientHeight<document.body.scrollHeight,v=R(document.body,"overflowY");t>0&&(m||v==="scroll")&&s&&(document.body.style.width=`calc(100% - ${t}px)`),Y(document.body,o.value)}),w(()=>r())},V=e=>{if(!e)return{onClick:p,onMousedown:p,onMouseup:p};let n=!1,o=!1;return{onClick:r=>{n&&o&&e(r),n=o=!1},onMousedown:r=>{n=r.target===r.currentTarget},onMouseup:r=>{o=r.target===r.currentTarget}}},K=D({mask:{type:Boolean,default:!0},customMaskEvent:{type:Boolean,default:!1},overlayClass:{type:y([String,Array,Object])},zIndex:{type:y([String,Number])}}),U={click:e=>e instanceof MouseEvent};var j=L({name:"ElOverlay",props:K,emits:U,setup(e,{slots:n,emit:o}){const t=T("overlay"),s=m=>{o("click",m)},{onClick:a,onMousedown:r,onMouseup:l}=V(e.customMaskEvent?void 0:s);return()=>e.mask?_("div",{class:[t.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:a,onMousedown:r,onMouseup:l},[f(n,"default")],d.STYLE|d.CLASS|d.PROPS,["onClick","onMouseup","onMousedown"]):x("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[f(n,"default")])}});const P=j;export{P as E,d as P,Q as a,h as b,g as e,c as f,Z as g,z as i,V as u};