index-f513b2db.js 3.44 KB
import{d as W,a8 as D,x as M,_ as L,a9 as X,aa as Y,v as A,$ as S,E as q}from"./vue-5a35c3f5.js";import{P as F}from"./index-f532aa07.js";import{_ as H}from"./index.js";import"./useContentViewHeight-d0a5c58e.js";import"./useWindowSizeFn-cc2fb57c.js";import"./onMountedOrActivated-52afb7a7.js";import"./antd-6b087f69.js";const m={event:"mousedown",transition:400},x={beforeMount:(e,t)=>{if(t.value===!1)return;const o=e.getAttribute("ripple-background");V(Object.keys(t.modifiers),m);const s=o||x.background,r=x.zIndex;e.addEventListener(m.event,d=>{I({event:d,el:e,background:s,zIndex:r})})},updated(e,t){var s,r;if(!t.value){(s=e==null?void 0:e.clearRipple)==null||s.call(e);return}const o=e.getAttribute("ripple-background");(r=e==null?void 0:e.setBackground)==null||r.call(e,o)}};function I({event:e,el:t,zIndex:o,background:s}){var w,R;const r=parseInt(getComputedStyle(t).borderWidth.replace("px","")),d=e.clientX||e.touches[0].clientX,f=e.clientY||e.touches[0].clientY,g=t.getBoundingClientRect(),{left:C,top:T}=g,{offsetWidth:_,offsetHeight:b}=t,{transition:B}=m,l=d-C,u=f-T,y=Math.max(l,_-l),$=Math.max(u,b-u),N=window.getComputedStyle(t),h=Math.sqrt(y*y+$*$),E=r>0?r:0,a=document.createElement("div"),n=document.createElement("div");a.className="ripple",Object.assign((w=a.style)!=null?w:{},{marginTop:"0px",marginLeft:"0px",width:"1px",height:"1px",transition:`all ${B}ms cubic-bezier(0.4, 0, 0.2, 1)`,borderRadius:"50%",pointerEvents:"none",position:"relative",zIndex:o!=null?o:"9999",backgroundColor:s!=null?s:"rgba(0, 0, 0, 0.12)"}),n.className="ripple-container",Object.assign((R=n.style)!=null?R:{},{position:"absolute",left:`${0-E}px`,top:`${0-E}px`,height:"0",width:"0",pointerEvents:"none",overflow:"hidden"});const v=t.style.position.length>0?t.style.position:getComputedStyle(t).position;v!=="relative"&&(t.style.position="relative"),n.appendChild(a),t.appendChild(n),Object.assign(a.style,{marginTop:`${u}px`,marginLeft:`${l}px`});const{borderTopLeftRadius:k,borderTopRightRadius:P,borderBottomLeftRadius:j,borderBottomRightRadius:O}=N;Object.assign(n.style,{width:`${_}px`,height:`${b}px`,direction:"ltr",borderTopLeftRadius:k,borderTopRightRadius:P,borderBottomLeftRadius:j,borderBottomRightRadius:O}),setTimeout(()=>{var p;const i=`${h*2}px`;Object.assign((p=a.style)!=null?p:{},{width:i,height:i,marginLeft:`${l-h}px`,marginTop:`${u-h}px`})},0);function c(){setTimeout(()=>{a.style.backgroundColor="rgba(0, 0, 0, 0)"},250),setTimeout(()=>{var i;(i=n==null?void 0:n.parentNode)==null||i.removeChild(n)},850),t.removeEventListener("mouseup",c,!1),t.removeEventListener("mouseleave",c,!1),t.removeEventListener("dragstart",c,!1),setTimeout(()=>{let i=!0;for(let p=0;p<t.childNodes.length;p++)t.childNodes[p].className==="ripple-container"&&(i=!1);i&&(t.style.position=v!=="static"?v:"")},m.transition+260)}e.type==="mousedown"?(t.addEventListener("mouseup",c,!1),t.addEventListener("mouseleave",c,!1),t.addEventListener("dragstart",c,!1)):c(),t.setBackground=i=>{i&&(a.style.backgroundColor=i)}}function V(e,t){e.forEach(o=>{isNaN(Number(o))?t.event=o:t.transition=o})}const z=x,G=W({components:{PageWrapper:F},directives:{Ripple:z}});const J={class:"demo-box"};function K(e,t,o,s,r,d){const f=D("PageWrapper"),g=M("ripple");return L(),X(f,{title:"Ripple示例"},{default:Y(()=>[A((L(),S("div",J,[q("content")])),[[g]])]),_:1})}const st=H(G,[["render",K],["__scopeId","data-v-4e32ff81"],["__file","E:/allcode/erp/test7901/order-erp-front/src/views/demo/feat/ripple/index.vue"]]);export{st as default};