primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 1.34 kB
JavaScript
import{DomHandler as e}from"primevue/utils";let t;function n(e){let t=r(e);t&&(!function(e){e.removeEventListener("mousedown",i)}(e),t.removeEventListener("animationend",o),t.remove())}function i(n){let i=n.currentTarget,o=r(i);if(!o||"none"===getComputedStyle(o,null).display)return;if(e.removeClass(o,"p-ink-active"),!e.getHeight(o)&&!e.getWidth(o)){let t=Math.max(e.getOuterWidth(i),e.getOuterHeight(i));o.style.height=t+"px",o.style.width=t+"px"}let l=e.getOffset(i),s=n.pageX-l.left+document.body.scrollTop-e.getWidth(o)/2,a=n.pageY-l.top+document.body.scrollLeft-e.getHeight(o)/2;o.style.top=a+"px",o.style.left=s+"px",e.addClass(o,"p-ink-active"),t=setTimeout((()=>{o&&e.removeClass(o,"p-ink-active")}),401)}function o(n){t&&clearTimeout(t),e.removeClass(n.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 l={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"),e.appendChild(t),t.addEventListener("animationend",o)}(e),function(e){e.addEventListener("mousedown",i)}(e))},unmounted(e){n(e)}};export{l as default};