2 lines
5.8 KiB
JavaScript
2 lines
5.8 KiB
JavaScript
|
import e,{Component as t}from"react";import r from"react-dom";import{DomHandler as n,classNames as o,ObjectUtils as i,IconUtils as c}from"primereact/utils";import{Dialog as a}from"primereact/dialog";import{Button as s}from"primereact/button";import{localeOption as p}from"primereact/api";import{Portal as l}from"primereact/portal";function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(this,arguments)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){return h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},h(e,t)}function y(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&&h(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 v(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 m(e)}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(){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}}function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function P(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function E(t){var o=t.appendTo||document.body,i=document.createDocumentFragment();n.appendChild(i,o),t=P(P({},t),{visible:void 0===t.visible||t.visible});var c=e.createElement(k,t);r.render(c,i);var a=function(n){t=P(P({},t),n),r.render(e.cloneElement(c,t),i)};return{_destroy:function(){r.unmountComponentAtNode(i)},show:function(){a({visible:!0,onHide:function(){a({visible:!1})}})},hide:function(){a({visible:!1})},update:function(e){a(e)}}}var k=function(r){y(E,t);var n,h,d,O,w,P=(n=E,h=g(),function(){var e,t=j(n);if(h){var r=j(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return v(this,e)});function E(e){var t;return f(this,E),(t=P.call(this,e)).state={visible:e.visible},t.reject=t.reject.bind(m(t)),t.accept=t.accept.bind(m(t)),t.hide=t.hide.bind(m(t)),t}return d=E,(O=[{key:"acceptLabel",value:function(){return this.props.acceptLabel||p("accept")}},{key:"rejectLabel",value:function(){return this.props.rejectLabel||p("reject")}},{key:"accept",value:function(){this.props.accept&&this.props.accept(),this.hide("accept")}},{key:"reject",value:function(){this.props.reject&&this.props.reject(),this.hide("reject")}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(e){var t=this;this.setState({visible:!1},(function(){t.props.on
|