123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', { value: true });
-
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
-
- var _rollupPluginBabelHelpers = require('../_rollupPluginBabelHelpers-3469b70d.js');
- var React = require('react');
- var React__default = _interopDefault(React);
- require('../style-inject.es-dcee06b6.js');
- var reactDom = require('react-dom');
- var reactDom__default = _interopDefault(reactDom);
- var Modal$1 = require('../Modal-1001074b.js');
-
- var Modal =
- /*#__PURE__*/
- function (_React$PureComponent) {
- _rollupPluginBabelHelpers._inherits(Modal, _React$PureComponent);
-
- function Modal() {
- _rollupPluginBabelHelpers._classCallCheck(this, Modal);
-
- return _rollupPluginBabelHelpers._possibleConstructorReturn(this, _rollupPluginBabelHelpers._getPrototypeOf(Modal).apply(this, arguments));
- }
-
- _rollupPluginBabelHelpers._createClass(Modal, [{
- key: "render",
- value: function render() {
- if (!Modal$1.isBrowser()) return null; // 服务端无需渲染下列代码,渲染也会出错
-
- var DEFAULT_CONTAINER = document.getElementById('container');
- var _this$props = this.props,
- children = _this$props.children,
- visible = _this$props.visible,
- onCancel = _this$props.onCancel,
- _this$props$container = _this$props.container,
- container = _this$props$container === void 0 ? DEFAULT_CONTAINER : _this$props$container;
- var finalMountContainer = document.body;
-
- if (!container) {
- if (!DEFAULT_CONTAINER) {
- if (!Modal.hasShowWarning) {
- Modal.hasShowWarning = true;
- }
-
- finalMountContainer = document.body;
- } else {
- if (!Modal.hasShowWarning) {
- Modal.hasShowWarning = true;
- }
-
- finalMountContainer = DEFAULT_CONTAINER;
- }
- }
-
- return visible && reactDom.createPortal(React__default.createElement("div", {
- className: Modal$1.styles.wrapper
- }, React__default.createElement("div", {
- className: Modal$1.styles.overlay,
- onClick: onCancel
- }), React__default.createElement("div", {
- className: Modal$1.styles.container
- }, children)), finalMountContainer);
- }
- }]);
-
- return Modal;
- }(React__default.PureComponent);
-
- _rollupPluginBabelHelpers._defineProperty(Modal, "hasShowWarning", false);
-
- exports.Modal = Modal;
- exports.default = Modal;
- //# sourceMappingURL=index.js.map
|