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