You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.0 KiB

'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = require('react');
var React = _interopRequireWildcard(_react);
var _Dialog = require('./Dialog');
var _Dialog2 = _interopRequireDefault(_Dialog);
var _PortalWrapper = require('rc-util/lib/PortalWrapper');
var _PortalWrapper2 = _interopRequireDefault(_PortalWrapper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
// fix issue #10656
/*
* getContainer remarks
* Custom container should not be return, because in the Portal component, it will remove the
* return container element here, if the custom container is the only child of it's component,
* like issue #10656, It will has a conflict with removeChild method in react-dom.
* So here should add a child (div element) to custom container.
* */
exports['default'] = function (props) {
var visible = props.visible,
getContainer = props.getContainer,
forceRender = props.forceRender;
// 渲染在当前 dom 里;
if (getContainer === false) {
return React.createElement(_Dialog2['default'], _extends({}, props, { getOpenCount: function getOpenCount() {
return 2;
} }));
}
return React.createElement(_PortalWrapper2['default'], { visible: visible, forceRender: forceRender, getContainer: getContainer }, function (childProps) {
return React.createElement(_Dialog2['default'], _extends({}, props, childProps));
});
};
module.exports = exports['default'];