UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Discord Chat](https://img.shields.io/discord/55794023

2 lines (1 loc) 1.52 kB
this.primevue=this.primevue||{},this.primevue.ripple=function(e){"use strict";let t;function n(e){let t=l(e);t&&(!function(e){e.removeEventListener("mousedown",i)}(e),t.removeEventListener("animationend",r),t.remove())}function i(n){let i=n.currentTarget,r=l(i);if(!r||"none"===getComputedStyle(r,null).display)return;if(e.DomHandler.removeClass(r,"p-ink-active"),!e.DomHandler.getHeight(r)&&!e.DomHandler.getWidth(r)){let t=Math.max(e.DomHandler.getOuterWidth(i),e.DomHandler.getOuterHeight(i));r.style.height=t+"px",r.style.width=t+"px"}let o=e.DomHandler.getOffset(i),a=n.pageX-o.left+document.body.scrollTop-e.DomHandler.getWidth(r)/2,d=n.pageY-o.top+document.body.scrollLeft-e.DomHandler.getHeight(r)/2;r.style.top=d+"px",r.style.left=a+"px",e.DomHandler.addClass(r,"p-ink-active"),t=setTimeout((()=>{r&&e.DomHandler.removeClass(r,"p-ink-active")}),401)}function r(n){t&&clearTimeout(t),e.DomHandler.removeClass(n.currentTarget,"p-ink-active")}function l(e){for(let t=0;t<e.children.length;t++)if("string"==typeof e.children[t].className&&-1!==e.children[t].className.indexOf("p-ink"))return e.children[t];return null}return{mounted(e,t){t.instance.$primevue&&t.instance.$primevue.config&&t.instance.$primevue.config.ripple&&(function(e){let t=document.createElement("span");t.className="p-ink",t.setAttribute("role","presentation"),t.setAttribute("aria-hidden","true"),e.appendChild(t),t.addEventListener("animationend",r)}(e),function(e){e.addEventListener("mousedown",i)}(e))},unmounted(e){n(e)}}}(primevue.utils);