-
Notifications
You must be signed in to change notification settings - Fork 11
/
chunk-7HQXT7RK.js
4 lines (4 loc) · 4.37 KB
/
chunk-7HQXT7RK.js
1
2
3
4
import{ya as p}from"./chunk-BYER7FCH.js";import{Na as g,Pa as m,Ua as f,Va as v,Wa as E,ha as d,ja as l,ma as s,nb as o,sa as h,ta as u,va as c}from"./chunk-U274QCT3.js";var a=class{get waveAttributeName(){return this.insertExtraNode?"ant-click-animating":"ant-click-animating-without-extra-node"}constructor(e,t,r,n,N){this.triggerElement=e,this.ngZone=t,this.insertExtraNode=r,this.platformId=n,this.cspNonce=N,this.waveTransitionDuration=400,this.styleForPseudo=null,this.extraNode=null,this.lastTime=0,this.onClick=y=>{!this.triggerElement||!this.triggerElement.getAttribute||this.triggerElement.getAttribute("disabled")||y.target.tagName==="INPUT"||this.triggerElement.className.indexOf("disabled")>=0||this.fadeOutWave()},this.platform=new p(this.platformId),this.clickHandler=this.onClick.bind(this),this.bindTriggerEvent()}bindTriggerEvent(){this.platform.isBrowser&&this.ngZone.runOutsideAngular(()=>{this.removeTriggerEvent(),this.triggerElement&&this.triggerElement.addEventListener("click",this.clickHandler,!0)})}removeTriggerEvent(){this.triggerElement&&this.triggerElement.removeEventListener("click",this.clickHandler,!0)}removeStyleAndExtraNode(){this.styleForPseudo&&document.body.contains(this.styleForPseudo)&&(document.body.removeChild(this.styleForPseudo),this.styleForPseudo=null),this.insertExtraNode&&this.triggerElement.contains(this.extraNode)&&this.triggerElement.removeChild(this.extraNode)}destroy(){this.removeTriggerEvent(),this.removeStyleAndExtraNode()}fadeOutWave(){let e=this.triggerElement,t=this.getWaveColor(e);e.setAttribute(this.waveAttributeName,"true"),!(Date.now()<this.lastTime+this.waveTransitionDuration)&&(this.isValidColor(t)&&(this.styleForPseudo||(this.styleForPseudo=document.createElement("style"),this.cspNonce&&(this.styleForPseudo.nonce=this.cspNonce)),this.styleForPseudo.innerHTML=`
[ant-click-animating-without-extra-node='true']::after, .ant-click-animating-node {
--antd-wave-shadow-color: ${t};
}`,document.body.appendChild(this.styleForPseudo)),this.insertExtraNode&&(this.extraNode||(this.extraNode=document.createElement("div")),this.extraNode.className="ant-click-animating-node",e.appendChild(this.extraNode)),this.lastTime=Date.now(),this.runTimeoutOutsideZone(()=>{e.removeAttribute(this.waveAttributeName),this.removeStyleAndExtraNode()},this.waveTransitionDuration))}isValidColor(e){return!!e&&e!=="#ffffff"&&e!=="rgb(255, 255, 255)"&&this.isNotGrey(e)&&!/rgba\(\d*, \d*, \d*, 0\)/.test(e)&&e!=="transparent"}isNotGrey(e){let t=e.match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/);return t&&t[1]&&t[2]&&t[3]?!(t[1]===t[2]&&t[2]===t[3]):!0}getWaveColor(e){let t=getComputedStyle(e);return t.getPropertyValue("border-top-color")||t.getPropertyValue("border-color")||t.getPropertyValue("background-color")}runTimeoutOutsideZone(e,t){this.ngZone.runOutsideAngular(()=>setTimeout(e,t))}},w={disabled:!1},b=new l("nz-wave-global-options");function T(i){return c([{provide:b,useValue:i}])}var k=(()=>{let e=class e{get disabled(){return this.waveDisabled}get rendererRef(){return this.waveRenderer}constructor(r,n){this.ngZone=r,this.elementRef=n,this.nzWaveExtraNode=!1,this.waveDisabled=!1,this.cspNonce=s(E,{optional:!0}),this.platformId=s(f),this.config=s(b,{optional:!0}),this.animationType=s(v,{optional:!0}),this.waveDisabled=this.isConfigDisabled()}isConfigDisabled(){let r=!1;return this.config&&typeof this.config.disabled=="boolean"&&(r=this.config.disabled),this.animationType==="NoopAnimations"&&(r=!0),r}ngOnDestroy(){this.waveRenderer&&this.waveRenderer.destroy()}ngOnInit(){this.renderWaveIfEnabled()}renderWaveIfEnabled(){!this.waveDisabled&&this.elementRef.nativeElement&&(this.waveRenderer=new a(this.elementRef.nativeElement,this.ngZone,this.nzWaveExtraNode,this.platformId,this.cspNonce))}disable(){this.waveDisabled=!0,this.waveRenderer&&(this.waveRenderer.removeTriggerEvent(),this.waveRenderer.removeStyleAndExtraNode())}enable(){this.waveDisabled=this.isConfigDisabled()||!1,this.waveRenderer&&this.waveRenderer.bindTriggerEvent()}};e.\u0275fac=function(n){return new(n||e)(o(g),o(m))},e.\u0275dir=u({type:e,selectors:[["","nz-wave",""],["button","nz-button","",3,"nzType","link",3,"nzType","text"]],inputs:{nzWaveExtraNode:"nzWaveExtraNode"},exportAs:["nzWave"],standalone:!0});let i=e;return i})(),F=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=h({type:e}),e.\u0275inj=d({providers:[T(w)]});let i=e;return i})();export{k as a,F as b};