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.21 kB
import{DomHandler as e}from"primevue/utils";function t(e){let t=o(e);t&&(!function(e){e.removeEventListener("mousedown",n)}(e),t.removeEventListener("animationend",i),t.remove())}function n(t){let n=t.currentTarget,i=o(n);if(!i||"none"===getComputedStyle(i,null).display)return;if(e.removeClass(i,"p-ink-active"),!e.getHeight(i)&&!e.getWidth(i)){let t=Math.max(e.getOuterWidth(n),e.getOuterHeight(n));i.style.height=t+"px",i.style.width=t+"px"}let r=e.getOffset(n),l=t.pageX-r.left+document.body.scrollTop-e.getWidth(i)/2,a=t.pageY-r.top+document.body.scrollLeft-e.getHeight(i)/2;i.style.top=a+"px",i.style.left=l+"px",e.addClass(i,"p-ink-active")}function i(t){e.removeClass(t.currentTarget,"p-ink-active")}function o(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}const r={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",e.appendChild(t),t.addEventListener("animationend",i)}(e),function(e){e.addEventListener("mousedown",n)}(e))},unmounted(e){t(e)}};export default r;