2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
|
import{Component as t}from"react";import e from"react-dom";import n from"primereact/api";import{DomHandler as o}from"primereact/utils";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(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 i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}function c(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&&i(t,e)}function f(t){return f="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},f(t)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e){if(e&&("object"===f(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function s(){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 y,m,b,d=function(i){c(h,t);var f,l,y,m,b,d=(f=h,l=s(),function(){var t,e=a(f);if(l){var n=a(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return p(this,t)});function h(t){var e;r(this,h),e=d.call(this,t);var n=t.visible&&o.hasDOM();return e.state={mounted:n},e}return y=h,(m=[{key:"componentDidMount",value:function(){o.hasDOM()&&!this.state.mounted&&this.setState({mounted:!0},this.props.onMounted)}},{key:"componentWillUnmount",value:function(){this.props.onUnmounted&&this.props.onUnmounted()}},{key:"render",value:function(){var t=this.props.element||this.props.children;if(t&&this.state.mounted){var o=this.props.appendTo||n.appendTo||document.body;return"self"===o?t:e.createPortal(t,o)}return null}}])&&u(y.prototype,m),b&&u(y,b),Object.defineProperty(y,"prototype",{writable:!1}),h}();b={element:null,appendTo:null,visible:!1,onMounted:null,onUnmounted:null},(m="defaultProps")in(y=d)?Object.defineProperty(y,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):y[m]=b;export{d as Portal};
|