2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
|
this.primereact=this.primereact||{},this.primereact.ripple=function(t,e,n,r){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=o(e),u=o(r);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t,e){return l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},l(t,e)}function f(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&&l(t,e)}function p(t){return p="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},p(t)}function h(t,e){if(e&&("object"===p(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function d(){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 m=function(t){f(v,t);var e,r,o,l,p,m=(e=v,r=d(),function(){var t,n=y(e);if(r){var o=y(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return h(this,t)});function v(t){var e;return a(this,v),(e=m.call(this,t)).onMouseDown=e.onMouseDown.bind(c(e)),e}return o=v,(l=[{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.DomHandler.removeClass(this.ink,"p-ink-active"),!n.DomHandler.getHeight(this.ink)&&!n.DomHandler.getWidth(this.ink)){var e=Math.max(n.DomHandler.getOuterWidth(this.target),n.DomHandler.getOuterHeight(this.target));this.ink.style.height=e+"px",this.ink.style.width=e+"px"}var r=n.DomHandler.getOffset(this.target),o=t.pageX-r.left+document.body.scrollTop-n.DomHandler.getWidth(this.ink)/2,i=t.pageY-r.top+document.body.scrollLeft-n.DomHandler.getHeight(this.ink)/2;this.ink.style.top=i+"px",this.ink.style.left=o+"px",n.DomHandler.addClass(this.ink,"p-ink-active")}}},{key:"onAnimationEnd",value:function(t){n.DomHandler.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 t=this;return u.default.ripple?i.default.createElement("span",{ref:function(e){return t.ink=e},className:"p-ink",onAnimationEnd:this.onAnimationEnd}):null}}])&&s(o.prototype,l),p&&s(o,p),Object.defineProperty(o,"prototype",{writable:!1}),v}(e.Component);return t.Ripple=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.api);
|