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) • 2.84 kB
JavaScript
import{DomHandler as t}from"primevue/utils";import e from"primevue/basedirective";import n from"primevue/ripple/style";function i(){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 r(t,e){if(t){if("string"==typeof t)return s(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)?s(t,e):void 0}}function o(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function a(t){if(Array.isArray(t))return s(t)}function s(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}var u=e.extend({style:n}).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.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.removeClass(r,"p-ink-active"),r.setAttribute("data-p-ink-active","false"),!t.getHeight(r)&&!t.getWidth(r)){var o=Math.max(t.getOuterWidth(i),t.getOuterHeight(i));r.style.height=o+"px",r.style.width=o+"px"}var a=t.getOffset(i),s=e.pageX-a.left+document.body.scrollTop-t.getWidth(r)/2,u=e.pageY-a.top+document.body.scrollLeft-t.getHeight(r)/2;r.style.top=u+"px",r.style.left=s+"px",!this.isUnstyled()&&t.addClass(r,"p-ink-active"),r.setAttribute("data-p-ink-active","true"),this.timeout=setTimeout((function(){r&&(!n.isUnstyled()&&t.removeClass(r,"p-ink-active"),r.setAttribute("data-p-ink-active","false"))}),401)}},onAnimationEnd:function(e){this.timeout&&clearTimeout(this.timeout),!this.isUnstyled()&&t.removeClass(e.currentTarget,"p-ink-active"),e.currentTarget.setAttribute("data-p-ink-active","false")},getInk:function(e){return e&&e.children?(n=e.children,a(n)||o(n)||r(n)||i()).find((function(e){return"ripple"===t.getAttribute(e,"data-pc-name")})):void 0;var n}}});export{u as default};