-
Notifications
You must be signed in to change notification settings - Fork 11
/
chunk-6AJOFIIP.js
4 lines (4 loc) · 4.33 KB
/
chunk-6AJOFIIP.js
1
2
3
4
import{ja as f}from"./chunk-YWVGY2C2.js";import{Jb as v,Kb as m,Ma as h,Qa as u,Wa as c,Xa as g,ja as a,la as d,oa as n,sa as l,sb as s}from"./chunk-GBKJFEQZ.js";var o=class{get waveAttributeName(){return this.insertExtraNode?"ant-click-animating":"ant-click-animating-without-extra-node"}constructor(t,e,r,N,b){this.triggerElement=t,this.ngZone=e,this.insertExtraNode=r,this.platform=N,this.cspNonce=b,this.waveTransitionDuration=400,this.styleForPseudo=null,this.extraNode=null,this.lastTime=0,this.onClick=p=>{!this.triggerElement||!this.triggerElement.getAttribute||this.triggerElement.getAttribute("disabled")||p.target.tagName==="INPUT"||this.triggerElement.className.indexOf("disabled")>=0||this.fadeOutWave()},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 t=this.triggerElement,e=this.getWaveColor(t);t.setAttribute(this.waveAttributeName,"true"),!(Date.now()<this.lastTime+this.waveTransitionDuration)&&(this.isValidColor(e)&&(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: ${e};
}`,document.body.appendChild(this.styleForPseudo)),this.insertExtraNode&&(this.extraNode||(this.extraNode=document.createElement("div")),this.extraNode.className="ant-click-animating-node",t.appendChild(this.extraNode)),this.lastTime=Date.now(),this.runTimeoutOutsideZone(()=>{t.removeAttribute(this.waveAttributeName),this.removeStyleAndExtraNode()},this.waveTransitionDuration))}isValidColor(t){return!!t&&t!=="#ffffff"&&t!=="rgb(255, 255, 255)"&&this.isNotGrey(t)&&!/rgba\(\d*, \d*, \d*, 0\)/.test(t)&&t!=="transparent"}isNotGrey(t){let e=t.match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/);return e&&e[1]&&e[2]&&e[3]?!(e[1]===e[2]&&e[2]===e[3]):!0}getWaveColor(t){let e=getComputedStyle(t);return e.getPropertyValue("border-top-color")||e.getPropertyValue("border-color")||e.getPropertyValue("background-color")}runTimeoutOutsideZone(t,e){this.ngZone.runOutsideAngular(()=>setTimeout(t,e))}},y={disabled:!1},E=new d("nz-wave-global-options");function w(i){return l([{provide:E,useValue:i}])}var O=(()=>{class i{get disabled(){return this.waveDisabled}get rendererRef(){return this.waveRenderer}constructor(e,r){this.ngZone=e,this.elementRef=r,this.nzWaveExtraNode=!1,this.waveDisabled=!1,this.cspNonce=n(g,{optional:!0}),this.platform=n(f),this.config=n(E,{optional:!0}),this.animationType=n(c,{optional:!0}),this.waveDisabled=this.isConfigDisabled()}isConfigDisabled(){let e=!1;return this.config&&typeof this.config.disabled=="boolean"&&(e=this.config.disabled),this.animationType==="NoopAnimations"&&(e=!0),e}ngOnDestroy(){this.waveRenderer&&this.waveRenderer.destroy()}ngOnInit(){this.renderWaveIfEnabled()}renderWaveIfEnabled(){!this.waveDisabled&&this.elementRef.nativeElement&&(this.waveRenderer=new o(this.elementRef.nativeElement,this.ngZone,this.nzWaveExtraNode,this.platform,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()}static{this.\u0275fac=function(r){return new(r||i)(s(h),s(u))}}static{this.\u0275dir=m({type:i,selectors:[["","nz-wave",""],["button","nz-button","",3,"nzType","link",3,"nzType","text"]],inputs:{nzWaveExtraNode:"nzWaveExtraNode"},exportAs:["nzWave"]})}}return i})(),F=(()=>{class i{static{this.\u0275fac=function(r){return new(r||i)}}static{this.\u0275mod=v({type:i})}static{this.\u0275inj=a({providers:[w(y)]})}}return i})();export{O as a,F as b};