katoikia-app/web-ui/web-react/node_modules/primereact/ripple/ripple.esm.min.js

2 lines
3.4 KiB
JavaScript

import t,{Component as e}from"react";import{DomHandler as n}from"primereact/utils";import o from"primereact/api";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t,e){return s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},s(t,e)}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return u(t)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var h=function(s){a(g,e);var c,h,y,d,m,v=(c=g,h=p(),function(){var t,e=l(c);if(h){var n=l(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return f(this,t)});function g(t){var e;return i(this,g),(e=v.call(this,t)).onMouseDown=e.onMouseDown.bind(u(e)),e}return y=g,(d=[{key:"getTarget",value:function(){return this.ink&&this.ink.parentElement}},{key:"bindEvents",value:function(){this.target&&this.target.addEventListener("mousedown",this.onMouseDown)}},{key:"unbindEvents",value:function(){this.target&&this.target.removeEventListener("mousedown",this.onMouseDown)}},{key:"onMouseDown",value:function(t){if(this.ink&&"none"!==getComputedStyle(this.ink,null).display){if(n.removeClass(this.ink,"p-ink-active"),!n.getHeight(this.ink)&&!n.getWidth(this.ink)){var e=Math.max(n.getOuterWidth(this.target),n.getOuterHeight(this.target));this.ink.style.height=e+"px",this.ink.style.width=e+"px"}var o=n.getOffset(this.target),i=t.pageX-o.left+document.body.scrollTop-n.getWidth(this.ink)/2,r=t.pageY-o.top+document.body.scrollLeft-n.getHeight(this.ink)/2;this.ink.style.top=r+"px",this.ink.style.left=i+"px",n.addClass(this.ink,"p-ink-active")}}},{key:"onAnimationEnd",value:function(t){n.removeClass(t.currentTarget,"p-ink-active")}},{key:"componentDidMount",value:function(){this.ink&&(this.target=this.getTarget(),this.bindEvents())}},{key:"componentDidUpdate",value:function(){this.ink&&!this.target&&(this.target=this.getTarget(),this.bindEvents())}},{key:"componentWillUnmount",value:function(){this.ink&&(this.target=null,this.unbindEvents())}},{key:"render",value:function(){var e=this;return o.ripple?t.createElement("span",{ref:function(t){return e.ink=t},className:"p-ink",onAnimationEnd:this.onAnimationEnd}):null}}])&&r(y.prototype,d),m&&r(y,m),Object.defineProperty(y,"prototype",{writable:!1}),g}();export{h as Ripple};