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

2 lines
4.2 KiB
JavaScript

import e,{Component as t}from"react";import{DomHandler as o,ZIndexUtils as n,classNames as r,ObjectUtils as i}from"primereact/utils";import{Portal as l}from"primereact/portal";import c from"primereact/api";function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function f(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&&p(e,t)}function d(e){return d="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},d(e)}function b(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function y(){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 h,v,k,w=function(p){f(O,t);var d,h,v,k,w,S=(d=O,h=y(),function(){var e,t=m(d);if(h){var o=m(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return b(this,e)});function O(e){var t;return u(this,O),(t=S.call(this,e)).state={visible:e.blocked},t.block=t.block.bind(a(t)),t.unblock=t.unblock.bind(a(t)),t.onPortalMounted=t.onPortalMounted.bind(a(t)),t}return v=O,(k=[{key:"block",value:function(){this.setState({visible:!0})}},{key:"unblock",value:function(){var e=this,t=function(){e.setState({visible:!1},(function(){e.props.fullScreen&&o.removeClass(document.body,"p-overflow-hidden"),e.props.onUnblocked&&e.props.onUnblocked()}))};this.mask?(o.addClass(this.mask,"p-component-overlay-leave"),this.mask.addEventListener("animationend",(function(){n.clear(e.mask),t()}))):t()}},{key:"onPortalMounted",value:function(){if(this.props.fullScreen&&(o.addClass(document.body,"p-overflow-hidden"),document.activeElement.blur()),this.props.autoZIndex){var e=this.props.fullScreen?"modal":"overlay";n.set(e,this.mask,c.autoZIndex,this.props.baseZIndex||c.zIndex[e])}this.props.onBlocked&&this.props.onBlocked()}},{key:"renderMask",value:function(){var t=this;if(this.state.visible){var o=r("p-blockui p-component-overlay p-component-overlay-enter",{"p-blockui-document":this.props.fullScreen},this.props.className),n=this.props.template?i.getJSXElement(this.props.template,this.props):null;return e.createElement(l,{element:e.createElement("div",{ref:function(e){return t.mask=e},className:o,style:this.props.style},n),appendTo:this.props.fullScreen?document.body:"self",onMounted:this.onPortalMounted})}return null}},{key:"componentDidMount",value:function(){this.state.visible&&this.block()}},{key:"componentDidUpdate",value:function(e,t){e.blocked!==this.props.blocked&&(this.props.blocked?this.block():this.unblock())}},{key:"componentWillUnmount",value:function(){this.props.fullScreen&&o.removeClass(document.body,"p-overflow-hidden"),n.clear(this.mask)}},{key:"render",value:function(){var t=this,o=this.renderMask();return e.createElement("div",{ref:function(e){return t.container=e},id:this.props.id,className:"p-blockui-container"},this.props.children,o)}}])&&s(v.prototype,k),w&&s(v,w),Object.defineProperty(v,"prototype",{writable:!1}),O}();k={id:null,blocked:!1,fullScreen:!1,baseZIndex:0,autoZIndex:!0,style:null,className:null,template:null,onBlocked:null,onUnblocked:null},(v="defaultProps")in(h=w)?Object.defineProperty(h,v,{value:k,enumerable:!0,configurable:!0,writable:!0}):h[v]=k;export{w as BlockUI};