2 lines
4.4 KiB
JavaScript
2 lines
4.4 KiB
JavaScript
|
this.primereact=this.primereact||{},this.primereact.blockui=function(e,t,n,o,r){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=l(t),c=l(r);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}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(e){f(v,e);var t,r,l,p,d,h=(t=v,r=y(),function(){var e,n=m(t);if(r){var o=m(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return b(this,e)});function v(e){var t;return u(this,v),(t=h.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 l=v,(p=[{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&&n.DomHandler.removeClass(document.body,"p-overflow-hidden"),e.props.onUnblocked&&e.props.onUnblocked()}))};this.mask?(n.DomHandler.addClass(this.mask,"p-component-overlay-leave"),this.mask.addEventListener("animationend",(function(){n.ZIndexUtils.clear(e.mask),t()}))):t()}},{key:"onPortalMounted",value:function(){if(this.props.fullScreen&&(n.DomHandler.addClass(document.body,"p-overflow-hidden"),document.activeElement.blur()),this.props.autoZIndex){var e=this.props.fullScreen?"modal":"overlay";n.ZIndexUtils.set(e,this.mask,c.default.autoZIndex,this.props.baseZIndex||c.default.zIndex[e])}this.props.onBlocked&&this.props.onBlocked()}},{key:"renderMask",value:function(){var e=this;if(this.state.visible){var t=n.classNames("p-blockui p-component-overlay p-component-overlay-enter",{"p-blockui-document":this.props.fullScreen},this.props.className),r=this.props.template?n.ObjectUtils.getJSXElement(this.props.template,this.props):null;return i.default.createElement(o.Portal,{element:i.default.createElement("div",{ref:function(t){return e.mask=t},className:t,style:this.props.style},r),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&&n.DomHandler.removeClass(document.body,"p-overflow-hidden"),n.ZIndexUtils.clear(this.mask)}},{key:"render",value:function(){var e=this,t=this.renderMask();return i.default.createElement("div",{ref:function(t){return e.container=t},id:this.props.id,className:"p-blockui-container"},this.props.children,t)}}])&&s(l.prototype,p
|