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

2 lines
6.3 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.styleclass=function(e,t,n){"use strict";function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t){if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}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(e){return!1}}var m,h,d,f=function(e){a(d,e);var t,i,o,l,m,h=(t=d,i=p(),function(){var e,n=u(t);if(i){var s=u(this).constructor;e=Reflect.construct(n,arguments,s)}else e=n.apply(this,arguments);return c(this,e)});function d(){return s(this,d),h.apply(this,arguments)}return o=d,(l=[{key:"enter",value:function(){var e=this;this.props.enterActiveClassName?this.animating||(this.animating=!0,"slidedown"===this.props.enterActiveClassName&&(this.target.style.height="0px",n.DomHandler.removeClass(this.target,"hidden"),this.target.style.maxHeight=this.target.scrollHeight+"px",n.DomHandler.addClass(this.target,"hidden"),this.target.style.height=""),n.DomHandler.addClass(this.target,this.props.enterActiveClassName),this.props.enterClassName&&n.DomHandler.removeClass(this.target,this.props.enterClassName),this.enterListener=function(){n.DomHandler.removeClass(e.target,e.props.enterActiveClassName),e.props.enterToClassName&&n.DomHandler.addClass(e.target,e.props.enterToClassName),e.target.removeEventListener("animationend",e.enterListener),"slidedown"===e.props.enterActiveClassName&&(e.target.style.maxHeight=""),e.animating=!1},this.target.addEventListener("animationend",this.enterListener)):(this.props.enterClassName&&n.DomHandler.removeClass(this.target,this.props.enterClassName),this.props.enterToClassName&&n.DomHandler.addClass(this.target,this.props.enterToClassName)),this.props.hideOnOutsideClick&&this.bindDocumentListener()}},{key:"leave",value:function(){var e=this;this.props.leaveActiveClassName?this.animating||(this.animating=!0,n.DomHandler.addClass(this.target,this.props.leaveActiveClassName),this.props.leaveClassName&&n.DomHandler.removeClass(this.target,this.props.leaveClassName),this.leaveListener=function(){n.DomHandler.removeClass(e.target,e.props.leaveActiveClassName),e.props.leaveToClassName&&n.DomHandler.addClass(e.target,e.props.leaveToClassName),e.target.removeEventListener("animationend",e.leaveListener),e.animating=!1},this.target.addEventListener("animationend",this.leaveListener)):(this.props.leaveClassName&&n.DomHandler.removeClass(this.target,this.props.leaveClassName),this.props.leaveToClassName&&n.DomHandler.addClass(this.target,this.props.leaveToClassName)),this.props.hideOnOutsideClick&&this.unbindDocumentListener()}},{key:"resolveTarget",value:function(){if(this.target)return this.target;switch(this.props.selector){case"@next":return this.el.nextElementSibling;case"@prev":return this.el.previousElementSibling;case"@parent":return this.el.parentElement;case"@grandparent":return this.el.parentElement.parentElement;default:return document.querySelector(this.props.selector)}}},{key:"bindDocumentListener",value:function(){var e=this;this.documentListener||(this.documentListener=function(t){"static"===getComputedStyle(e.target).getPropertyValue("position")?e.unbindDocumentListener():e.el.isSameNode(t.target)||e.el.contains(t.target)||e.target.contains(t.target)||e.leave()},this.el.ownerDocument.addEventListener("click",this.documentListener))}},{key:"unbindDocumentListener",value:function(){this.documentListener&&(this.el.ownerDocument.removeEventListener("click",this.documentListener),this.documentListener=null)}},{key:"bindEvents",value:function(){var e=this;this.clickListener=function(){e.target=e.resolveTarget(),e.props.toggleClassName?n.DomHandler.hasClass(e.target,e.props.toggleClassName)?n.DomHandler.removeClass(e.target,e.props.toggleClassName):n.DomHandler.addClass(e.target,e.props.toggleClassName):null===e.target.offsetParent?e.enter():e.leave()},this.el.addEventListener("click",this.clickListener)}},{key:"unbindEvents",value:function(){this.clickListener&&(this.el.removeEventListener("click",this.clickListener),this.clickListener=null)}},{key:"el",get:function(){return n.ObjectUtils.getRefElement(this.props.nodeRef)}},{key:"init",value:function(){this.el&&this.bindEvents()}},{key:"destroy",value:function(){this.unbindEvents(),this.unbindDocumentListener(),this.target=null}},{key:"componentDidMount",value:function(){this.init()}},{key:"componentDidUpdate",value:function(e,t){e.nodeRef!==this.props.nodeRef&&(this.destroy(),this.init())}},{key:"componentWillUnmount",value:function(){this.destroy()}},{key:"render",value:function(){return this.props.children}}])&&r(o.prototype,l),m&&r(o,m),Object.defineProperty(o,"prototype",{writable:!1}),d}(t.Component);return d={nodeRef:null,selector:null,enterClassName:null,enterActiveClassName:null,enterToClassName:null,leaveClassName:null,leaveActiveClassName:null,leaveToClassName:null,hideOnOutsideClick:!1,toggleClassName:null},(h="defaultProps")in(m=f)?Object.defineProperty(m,h,{value:d,enumerable:!0,configurable:!0,writable:!0}):m[h]=d,e.StyleClass=f,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils);