primevue
Version:
PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBloc
2 lines (1 loc) • 3.08 kB
JavaScript
this.primevue=this.primevue||{},this.primevue.ripple=function(t,e,n){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(t,e){if(t){if("string"==typeof t)return d(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}function a(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function s(t){if(Array.isArray(t))return d(t)}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}return i(e).default.extend({style:i(n).default}).extend("ripple",{mounted:function(t){var e,n=null==t||null===(e=t.$instance)||void 0===e?void 0:e.$config;n&&n.ripple&&(this.create(t),this.bindEvents(t),t.setAttribute("data-pd-ripple",!0))},unmounted:function(t){this.remove(t)},timeout:void 0,methods:{bindEvents:function(t){t.addEventListener("mousedown",this.onMouseDown.bind(this))},unbindEvents:function(t){t.removeEventListener("mousedown",this.onMouseDown.bind(this))},create:function(e){var n=t.DomHandler.createElement("span",{role:"presentation","aria-hidden":!0,"data-p-ink":!0,"data-p-ink-active":!1,class:!this.isUnstyled()&&this.cx("root"),onAnimationEnd:this.onAnimationEnd.bind(this),"p-bind":this.ptm("root")});e.appendChild(n),this.$el=n},remove:function(t){var e=this.getInk(t);e&&(this.unbindEvents(t),e.removeEventListener("animationend",this.onAnimationEnd),e.remove())},onMouseDown:function(e){var n=this,i=e.currentTarget,r=this.getInk(i);if(r&&"none"!==getComputedStyle(r,null).display){if(!this.isUnstyled()&&t.DomHandler.removeClass(r,"p-ink-active"),r.setAttribute("data-p-ink-active","false"),!t.DomHandler.getHeight(r)&&!t.DomHandler.getWidth(r)){var o=Math.max(t.DomHandler.getOuterWidth(i),t.DomHandler.getOuterHeight(i));r.style.height=o+"px",r.style.width=o+"px"}var a=t.DomHandler.getOffset(i),s=e.pageX-a.left+document.body.scrollTop-t.DomHandler.getWidth(r)/2,d=e.pageY-a.top+document.body.scrollLeft-t.DomHandler.getHeight(r)/2;r.style.top=d+"px",r.style.left=s+"px",!this.isUnstyled()&&t.DomHandler.addClass(r,"p-ink-active"),r.setAttribute("data-p-ink-active","true"),this.timeout=setTimeout((function(){r&&(!n.isUnstyled()&&t.DomHandler.removeClass(r,"p-ink-active"),r.setAttribute("data-p-ink-active","false"))}),401)}},onAnimationEnd:function(e){this.timeout&&clearTimeout(this.timeout),!this.isUnstyled()&&t.DomHandler.removeClass(e.currentTarget,"p-ink-active"),e.currentTarget.setAttribute("data-p-ink-active","false")},getInk:function(e){return e&&e.children?(n=e.children,s(n)||a(n)||o(n)||r()).find((function(e){return"ripple"===t.DomHandler.getAttribute(e,"data-pc-name")})):void 0;var n}}})}(primevue.utils,primevue.basedirective,primevue.ripple.style);