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.

2756 lines
89 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["rc-dialog"] = factory(require("react"), require("react-dom"));
else
root["rc-dialog"] = factory(root["React"], root["ReactDOM"]);
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_1__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 23);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var util = {
isAppearSupported: function isAppearSupported(props) {
return props.transitionName && props.transitionAppear || props.animation.appear;
},
isEnterSupported: function isEnterSupported(props) {
return props.transitionName && props.transitionEnter || props.animation.enter;
},
isLeaveSupported: function isLeaveSupported(props) {
return props.transitionName && props.transitionLeave || props.animation.leave;
},
allowAppearCallback: function allowAppearCallback(props) {
return props.transitionAppear || props.animation.appear;
},
allowEnterCallback: function allowEnterCallback(props) {
return props.transitionEnter || props.animation.enter;
},
allowLeaveCallback: function allowLeaveCallback(props) {
return props.transitionLeave || props.animation.leave;
}
};
/* harmony default export */ __webpack_exports__["a"] = (util);
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/**
* Easy to set element style, return previous style
* IE browser compatible(IE browser doesn't merge overflow style, need to set it separately)
* https://github.com/ant-design/ant-design/issues/19393
*
*/
function setStyle(style) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$element = options.element,
element = _options$element === void 0 ? document.body : _options$element;
var oldStyle = {};
var styleKeys = Object.keys(style); // IE browser compatible
styleKeys.forEach(function (key) {
oldStyle[key] = element.style[key];
});
styleKeys.forEach(function (key) {
element.style[key] = style[key];
});
return oldStyle;
}
/* harmony default export */ __webpack_exports__["a"] = (setStyle);
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__(5);
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Dialog__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rc_util_es_PortalWrapper__ = __webpack_require__(16);
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; };
// 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.
* */
/* harmony default export */ __webpack_exports__["default"] = (function (props) {
var visible = props.visible,
getContainer = props.getContainer,
forceRender = props.forceRender;
// 渲染在当前 dom 里;
if (getContainer === false) {
return __WEBPACK_IMPORTED_MODULE_0_react__["createElement"](__WEBPACK_IMPORTED_MODULE_1__Dialog__["a" /* default */], _extends({}, props, { getOpenCount: function getOpenCount() {
return 2;
} }));
}
return __WEBPACK_IMPORTED_MODULE_0_react__["createElement"](__WEBPACK_IMPORTED_MODULE_2_rc_util_es_PortalWrapper__["a" /* default */], { visible: visible, forceRender: forceRender, getContainer: getContainer }, function (childProps) {
return __WEBPACK_IMPORTED_MODULE_0_react__["createElement"](__WEBPACK_IMPORTED_MODULE_1__Dialog__["a" /* default */], _extends({}, props, childProps));
});
});
/***/ }),
/* 6 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react_dom__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rc_util_es_KeyCode__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rc_util_es_Dom_contains__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rc_animate__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__LazyRenderBox__ = __webpack_require__(15);
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; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var uuid = 0;
/* eslint react/no-is-mounted:0 */
function getScroll(w, top) {
var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
var method = 'scroll' + (top ? 'Top' : 'Left');
if (typeof ret !== 'number') {
var d = w.document;
ret = d.documentElement[method];
if (typeof ret !== 'number') {
ret = d.body[method];
}
}
return ret;
}
function setTransformOrigin(node, value) {
var style = node.style;
['Webkit', 'Moz', 'Ms', 'ms'].forEach(function (prefix) {
style[prefix + 'TransformOrigin'] = value;
});
style['transformOrigin'] = value;
}
function offset(el) {
var rect = el.getBoundingClientRect();
var pos = {
left: rect.left,
top: rect.top
};
var doc = el.ownerDocument;
var w = doc.defaultView || doc.parentWindow;
pos.left += getScroll(w);
pos.top += getScroll(w, true);
return pos;
}
var Dialog = function (_React$Component) {
_inherits(Dialog, _React$Component);
function Dialog(props) {
_classCallCheck(this, Dialog);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
_this.inTransition = false;
_this.onAnimateLeave = function () {
var _this$props = _this.props,
afterClose = _this$props.afterClose,
getOpenCount = _this$props.getOpenCount;
// need demo?
// https://github.com/react-component/dialog/pull/28
if (_this.wrap) {
_this.wrap.style.display = 'none';
}
_this.inTransition = false;
// 如果没有打开的状态,则清除 effect 和 overflow: hidden;
// https://github.com/ant-design/ant-design/issues/21539
if (!getOpenCount()) {
_this.switchScrollingEffect();
}
if (afterClose) {
afterClose();
}
};
_this.onDialogMouseDown = function () {
_this.dialogMouseDown = true;
};
_this.onMaskMouseUp = function () {
if (_this.dialogMouseDown) {
_this.timeoutId = setTimeout(function () {
_this.dialogMouseDown = false;
}, 0);
}
};
_this.onMaskClick = function (e) {
// android trigger click on open (fastclick??)
if (Date.now() - _this.openTime < 300) {
return;
}
if (e.target === e.currentTarget && !_this.dialogMouseDown) {
_this.close(e);
}
};
_this.onKeyDown = function (e) {
var props = _this.props;
if (props.keyboard && e.keyCode === __WEBPACK_IMPORTED_MODULE_2_rc_util_es_KeyCode__["a" /* default */].ESC) {
e.stopPropagation();
_this.close(e);
return;
}
// keep focus inside dialog
if (props.visible) {
if (e.keyCode === __WEBPACK_IMPORTED_MODULE_2_rc_util_es_KeyCode__["a" /* default */].TAB) {
var activeElement = document.activeElement;
var sentinelStart = _this.sentinelStart;
if (e.shiftKey) {
if (activeElement === sentinelStart) {
_this.sentinelEnd.focus();
}
} else if (activeElement === _this.sentinelEnd) {
sentinelStart.focus();
}
}
}
};
_this.getDialogElement = function () {
var props = _this.props;
var closable = props.closable;
var prefixCls = props.prefixCls;
var dest = {};
if (props.width !== undefined) {
dest.width = props.width;
}
if (props.height !== undefined) {
dest.height = props.height;
}
var footer = void 0;
if (props.footer) {
footer = __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", { className: prefixCls + '-footer', ref: _this.saveRef('footer') }, props.footer);
}
var header = void 0;
if (props.title) {
header = __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", { className: prefixCls + '-header', ref: _this.saveRef('header') }, __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", { className: prefixCls + '-title', id: _this.titleId }, props.title));
}
var closer = void 0;
if (closable) {
closer = __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("button", { type: "button", onClick: _this.close, "aria-label": "Close", className: prefixCls + '-close' }, props.closeIcon || __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("span", { className: prefixCls + '-close-x' }));
}
var style = _extends({}, props.style, dest);
var sentinelStyle = { width: 0, height: 0, overflow: 'hidden', outline: 'none' };
var transitionName = _this.getTransitionName();
var dialogElement = __WEBPACK_IMPORTED_MODULE_0_react__["createElement"](__WEBPACK_IMPORTED_MODULE_5__LazyRenderBox__["a" /* default */], { key: "dialog-element", role: "document", ref: _this.saveRef('dialog'), style: style, className: prefixCls + ' ' + (props.className || ''), visible: props.visible, forceRender: props.forceRender, onMouseDown: _this.onDialogMouseDown }, __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", { tabIndex: 0, ref: _this.saveRef('sentinelStart'), style: sentinelStyle, "aria-hidden": "true" }), __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", { className: prefixCls + '-content' }, closer, header, __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", _extends({ className: prefixCls + '-body', style: props.bodyStyle, ref: _this.saveRef('body') }, props.bodyProps), props.children), footer), __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", { tabIndex: 0, ref: _this.saveRef('sentinelEnd'), style: sentinelStyle, "aria-hidden": "true" }));
return __WEBPACK_IMPORTED_MODULE_0_react__["createElement"](__WEBPACK_IMPORTED_MODULE_4_rc_animate__["a" /* default */], { key: "dialog", showProp: "visible", onLeave: _this.onAnimateLeave, transitionName: transitionName, component: "", transitionAppear: true }, props.visible || !props.destroyOnClose ? dialogElement : null);
};
_this.getZIndexStyle = function () {
var style = {};
var props = _this.props;
if (props.zIndex !== undefined) {
style.zIndex = props.zIndex;
}
return style;
};
_this.getWrapStyle = function () {
return _extends({}, _this.getZIndexStyle(), _this.props.wrapStyle);
};
_this.getMaskStyle = function () {
return _extends({}, _this.getZIndexStyle(), _this.props.maskStyle);
};
_this.getMaskElement = function () {
var props = _this.props;
var maskElement = void 0;
if (props.mask) {
var maskTransition = _this.getMaskTransitionName();
maskElement = __WEBPACK_IMPORTED_MODULE_0_react__["createElement"](__WEBPACK_IMPORTED_MODULE_5__LazyRenderBox__["a" /* default */], _extends({ style: _this.getMaskStyle(), key: "mask", className: props.prefixCls + '-mask', hiddenClassName: props.prefixCls + '-mask-hidden', visible: props.visible }, props.maskProps));
if (maskTransition) {
maskElement = __WEBPACK_IMPORTED_MODULE_0_react__["createElement"](__WEBPACK_IMPORTED_MODULE_4_rc_animate__["a" /* default */], { key: "mask", showProp: "visible", transitionAppear: true, component: "", transitionName: maskTransition }, maskElement);
}
}
return maskElement;
};
_this.getMaskTransitionName = function () {
var props = _this.props;
var transitionName = props.maskTransitionName;
var animation = props.maskAnimation;
if (!transitionName && animation) {
transitionName = props.prefixCls + '-' + animation;
}
return transitionName;
};
_this.getTransitionName = function () {
var props = _this.props;
var transitionName = props.transitionName;
var animation = props.animation;
if (!transitionName && animation) {
transitionName = props.prefixCls + '-' + animation;
}
return transitionName;
};
_this.close = function (e) {
var onClose = _this.props.onClose;
if (onClose) {
onClose(e);
}
};
_this.saveRef = function (name) {
return function (node) {
_this[name] = node;
};
};
_this.titleId = 'rcDialogTitle' + uuid++;
_this.switchScrollingEffect = props.switchScrollingEffect || function () {};
return _this;
}
Dialog.prototype.componentDidMount = function componentDidMount() {
this.componentDidUpdate({});
// if forceRender is true, set element style display to be none;
if ((this.props.forceRender || this.props.getContainer === false && !this.props.visible) && this.wrap) {
this.wrap.style.display = 'none';
}
};
Dialog.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
var _props = this.props,
visible = _props.visible,
mask = _props.mask,
focusTriggerAfterClose = _props.focusTriggerAfterClose;
var mousePosition = this.props.mousePosition;
if (visible) {
// first show
if (!prevProps.visible) {
this.openTime = Date.now();
this.switchScrollingEffect();
this.tryFocus();
var dialogNode = __WEBPACK_IMPORTED_MODULE_1_react_dom__["findDOMNode"](this.dialog);
if (mousePosition) {
var elOffset = offset(dialogNode);
setTransformOrigin(dialogNode, mousePosition.x - elOffset.left + 'px ' + (mousePosition.y - elOffset.top) + 'px');
} else {
setTransformOrigin(dialogNode, '');
}
}
} else if (prevProps.visible) {
this.inTransition = true;
if (mask && this.lastOutSideFocusNode && focusTriggerAfterClose) {
try {
this.lastOutSideFocusNode.focus();
} catch (e) {
this.lastOutSideFocusNode = null;
}
this.lastOutSideFocusNode = null;
}
}
};
Dialog.prototype.componentWillUnmount = function componentWillUnmount() {
var _props2 = this.props,
visible = _props2.visible,
getOpenCount = _props2.getOpenCount;
if ((visible || this.inTransition) && !getOpenCount()) {
this.switchScrollingEffect();
}
clearTimeout(this.timeoutId);
};
Dialog.prototype.tryFocus = function tryFocus() {
if (!Object(__WEBPACK_IMPORTED_MODULE_3_rc_util_es_Dom_contains__["a" /* default */])(this.wrap, document.activeElement)) {
this.lastOutSideFocusNode = document.activeElement;
this.sentinelStart.focus();
}
};
Dialog.prototype.render = function render() {
var props = this.props;
var prefixCls = props.prefixCls,
maskClosable = props.maskClosable;
var style = this.getWrapStyle();
// clear hide display
// and only set display after async anim, not here for hide
if (props.visible) {
style.display = null;
}
return __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", { className: prefixCls + '-root' }, this.getMaskElement(), __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", _extends({ tabIndex: -1, onKeyDown: this.onKeyDown, className: prefixCls + '-wrap ' + (props.wrapClassName || ''), ref: this.saveRef('wrap'), onClick: maskClosable ? this.onMaskClick : null, onMouseUp: maskClosable ? this.onMaskMouseUp : null, role: "dialog", "aria-labelledby": props.title ? this.titleId : null, style: style }, props.wrapProps), this.getDialogElement()));
};
return Dialog;
}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]);
/* harmony default export */ __webpack_exports__["a"] = (Dialog);
Dialog.defaultProps = {
className: '',
mask: true,
visible: false,
keyboard: true,
closable: true,
maskClosable: true,
destroyOnClose: false,
prefixCls: 'rc-dialog',
focusTriggerAfterClose: true
};
/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/**
* @ignore
* some key-codes definition and utils from closure-library
* @author yiminghe@gmail.com
*/
var KeyCode = {
/**
* MAC_ENTER
*/
MAC_ENTER: 3,
/**
* BACKSPACE
*/
BACKSPACE: 8,
/**
* TAB
*/
TAB: 9,
/**
* NUMLOCK on FF/Safari Mac
*/
NUM_CENTER: 12,
/**
* ENTER
*/
ENTER: 13,
/**
* SHIFT
*/
SHIFT: 16,
/**
* CTRL
*/
CTRL: 17,
/**
* ALT
*/
ALT: 18,
/**
* PAUSE
*/
PAUSE: 19,
/**
* CAPS_LOCK
*/
CAPS_LOCK: 20,
/**
* ESC
*/
ESC: 27,
/**
* SPACE
*/
SPACE: 32,
/**
* PAGE_UP
*/
PAGE_UP: 33,
/**
* PAGE_DOWN
*/
PAGE_DOWN: 34,
/**
* END
*/
END: 35,
/**
* HOME
*/
HOME: 36,
/**
* LEFT
*/
LEFT: 37,
/**
* UP
*/
UP: 38,
/**
* RIGHT
*/
RIGHT: 39,
/**
* DOWN
*/
DOWN: 40,
/**
* PRINT_SCREEN
*/
PRINT_SCREEN: 44,
/**
* INSERT
*/
INSERT: 45,
/**
* DELETE
*/
DELETE: 46,
/**
* ZERO
*/
ZERO: 48,
/**
* ONE
*/
ONE: 49,
/**
* TWO
*/
TWO: 50,
/**
* THREE
*/
THREE: 51,
/**
* FOUR
*/
FOUR: 52,
/**
* FIVE
*/
FIVE: 53,
/**
* SIX
*/
SIX: 54,
/**
* SEVEN
*/
SEVEN: 55,
/**
* EIGHT
*/
EIGHT: 56,
/**
* NINE
*/
NINE: 57,
/**
* QUESTION_MARK
*/
QUESTION_MARK: 63,
/**
* A
*/
A: 65,
/**
* B
*/
B: 66,
/**
* C
*/
C: 67,
/**
* D
*/
D: 68,
/**
* E
*/
E: 69,
/**
* F
*/
F: 70,
/**
* G
*/
G: 71,
/**
* H
*/
H: 72,
/**
* I
*/
I: 73,
/**
* J
*/
J: 74,
/**
* K
*/
K: 75,
/**
* L
*/
L: 76,
/**
* M
*/
M: 77,
/**
* N
*/
N: 78,
/**
* O
*/
O: 79,
/**
* P
*/
P: 80,
/**
* Q
*/
Q: 81,
/**
* R
*/
R: 82,
/**
* S
*/
S: 83,
/**
* T
*/
T: 84,
/**
* U
*/
U: 85,
/**
* V
*/
V: 86,
/**
* W
*/
W: 87,
/**
* X
*/
X: 88,
/**
* Y
*/
Y: 89,
/**
* Z
*/
Z: 90,
/**
* META
*/
META: 91,
/**
* WIN_KEY_RIGHT
*/
WIN_KEY_RIGHT: 92,
/**
* CONTEXT_MENU
*/
CONTEXT_MENU: 93,
/**
* NUM_ZERO
*/
NUM_ZERO: 96,
/**
* NUM_ONE
*/
NUM_ONE: 97,
/**
* NUM_TWO
*/
NUM_TWO: 98,
/**
* NUM_THREE
*/
NUM_THREE: 99,
/**
* NUM_FOUR
*/
NUM_FOUR: 100,
/**
* NUM_FIVE
*/
NUM_FIVE: 101,
/**
* NUM_SIX
*/
NUM_SIX: 102,
/**
* NUM_SEVEN
*/
NUM_SEVEN: 103,
/**
* NUM_EIGHT
*/
NUM_EIGHT: 104,
/**
* NUM_NINE
*/
NUM_NINE: 105,
/**
* NUM_MULTIPLY
*/
NUM_MULTIPLY: 106,
/**
* NUM_PLUS
*/
NUM_PLUS: 107,
/**
* NUM_MINUS
*/
NUM_MINUS: 109,
/**
* NUM_PERIOD
*/
NUM_PERIOD: 110,
/**
* NUM_DIVISION
*/
NUM_DIVISION: 111,
/**
* F1
*/
F1: 112,
/**
* F2
*/
F2: 113,
/**
* F3
*/
F3: 114,
/**
* F4
*/
F4: 115,
/**
* F5
*/
F5: 116,
/**
* F6
*/
F6: 117,
/**
* F7
*/
F7: 118,
/**
* F8
*/
F8: 119,
/**
* F9
*/
F9: 120,
/**
* F10
*/
F10: 121,
/**
* F11
*/
F11: 122,
/**
* F12
*/
F12: 123,
/**
* NUMLOCK
*/
NUMLOCK: 144,
/**
* SEMICOLON
*/
SEMICOLON: 186,
/**
* DASH
*/
DASH: 189,
/**
* EQUALS
*/
EQUALS: 187,
/**
* COMMA
*/
COMMA: 188,
/**
* PERIOD
*/
PERIOD: 190,
/**
* SLASH
*/
SLASH: 191,
/**
* APOSTROPHE
*/
APOSTROPHE: 192,
/**
* SINGLE_QUOTE
*/
SINGLE_QUOTE: 222,
/**
* OPEN_SQUARE_BRACKET
*/
OPEN_SQUARE_BRACKET: 219,
/**
* BACKSLASH
*/
BACKSLASH: 220,
/**
* CLOSE_SQUARE_BRACKET
*/
CLOSE_SQUARE_BRACKET: 221,
/**
* WIN_KEY
*/
WIN_KEY: 224,
/**
* MAC_FF_META
*/
MAC_FF_META: 224,
/**
* WIN_IME
*/
WIN_IME: 229,
// ======================== Function ========================
/**
* whether text and modified key is entered at the same time.
*/
isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) {
var keyCode = e.keyCode;
if (e.altKey && !e.ctrlKey || e.metaKey || // Function keys don't generate text
keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
return false;
} // The following keys are quite harmless, even in combination with
// CTRL, ALT or SHIFT.
switch (keyCode) {
case KeyCode.ALT:
case KeyCode.CAPS_LOCK:
case KeyCode.CONTEXT_MENU:
case KeyCode.CTRL:
case KeyCode.DOWN:
case KeyCode.END:
case KeyCode.ESC:
case KeyCode.HOME:
case KeyCode.INSERT:
case KeyCode.LEFT:
case KeyCode.MAC_FF_META:
case KeyCode.META:
case KeyCode.NUMLOCK:
case KeyCode.NUM_CENTER:
case KeyCode.PAGE_DOWN:
case KeyCode.PAGE_UP:
case KeyCode.PAUSE:
case KeyCode.PRINT_SCREEN:
case KeyCode.RIGHT:
case KeyCode.SHIFT:
case KeyCode.UP:
case KeyCode.WIN_KEY:
case KeyCode.WIN_KEY_RIGHT:
return false;
default:
return true;
}
},
/**
* whether character is entered.
*/
isCharacterKey: function isCharacterKey(keyCode) {
if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
return true;
}
if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
return true;
}
if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
return true;
} // Safari sends zero key code for non-latin characters.
if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
return true;
}
switch (keyCode) {
case KeyCode.SPACE:
case KeyCode.QUESTION_MARK:
case KeyCode.NUM_PLUS:
case KeyCode.NUM_MINUS:
case KeyCode.NUM_PERIOD:
case KeyCode.NUM_DIVISION:
case KeyCode.SEMICOLON:
case KeyCode.DASH:
case KeyCode.EQUALS:
case KeyCode.COMMA:
case KeyCode.PERIOD:
case KeyCode.SLASH:
case KeyCode.APOSTROPHE:
case KeyCode.SINGLE_QUOTE:
case KeyCode.OPEN_SQUARE_BRACKET:
case KeyCode.BACKSLASH:
case KeyCode.CLOSE_SQUARE_BRACKET:
return true;
default:
return false;
}
}
};
/* harmony default export */ __webpack_exports__["a"] = (KeyCode);
/***/ }),
/* 8 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
function contains(root, n) {
var node = n;
while (node) {
if (node === root) {
return true;
}
node = node.parentNode;
}
return false;
}
/***/ }),
/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rc_util_es_unsafeLifecyclesPolyfill__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__AnimateChild__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_animate__ = __webpack_require__(2);
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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/* eslint react/prop-types: 0 */
var defaultKey = 'rc_animate_' + Date.now();
function getChildrenFromProps(props) {
var children = props.children;
if (__WEBPACK_IMPORTED_MODULE_0_react___default.a.isValidElement(children)) {
if (!children.key) {
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.cloneElement(children, {
key: defaultKey
});
}
}
return children;
}
function noop() {}
var Animate = function (_React$Component) {
_inherits(Animate, _React$Component);
function Animate(props) {
_classCallCheck(this, Animate);
var _this = _possibleConstructorReturn(this, (Animate.__proto__ || Object.getPrototypeOf(Animate)).call(this, props));
_initialiseProps.call(_this);
_this.currentlyAnimatingKeys = {};
_this.keysToEnter = [];
_this.keysToLeave = [];
_this.state = {
children: Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["e" /* toArrayChildren */])(getChildrenFromProps(props))
};
_this.childrenRefs = {};
return _this;
} // eslint-disable-line
_createClass(Animate, [{
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
var showProp = this.props.showProp;
var children = this.state.children;
if (showProp) {
children = children.filter(function (child) {
return !!child.props[showProp];
});
}
children.forEach(function (child) {
if (child) {
_this2.performAppear(child.key);
}
});
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
var _this3 = this;
this.nextProps = nextProps;
var nextChildren = Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["e" /* toArrayChildren */])(getChildrenFromProps(nextProps));
var props = this.props;
// exclusive needs immediate response
if (props.exclusive) {
Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
_this3.stop(key);
});
}
var showProp = props.showProp;
var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
// last props children if exclusive
var currentChildren = props.exclusive ? Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["e" /* toArrayChildren */])(getChildrenFromProps(props)) : this.state.children;
// in case destroy in showProp mode
var newChildren = [];
if (showProp) {
currentChildren.forEach(function (currentChild) {
var nextChild = currentChild && Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["a" /* findChildInChildrenByKey */])(nextChildren, currentChild.key);
var newChild = void 0;
if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
newChild = __WEBPACK_IMPORTED_MODULE_0_react___default.a.cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));
} else {
newChild = nextChild;
}
if (newChild) {
newChildren.push(newChild);
}
});
nextChildren.forEach(function (nextChild) {
if (!nextChild || !Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["a" /* findChildInChildrenByKey */])(currentChildren, nextChild.key)) {
newChildren.push(nextChild);
}
});
} else {
newChildren = Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["d" /* mergeChildren */])(currentChildren, nextChildren);
}
// need render to avoid update
this.setState({
children: newChildren
});
nextChildren.forEach(function (child) {
var key = child && child.key;
if (child && currentlyAnimatingKeys[key]) {
return;
}
var hasPrev = child && Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["a" /* findChildInChildrenByKey */])(currentChildren, key);
if (showProp) {
var showInNext = child.props[showProp];
if (hasPrev) {
var showInNow = Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["b" /* findShownChildInChildrenByKey */])(currentChildren, key, showProp);
if (!showInNow && showInNext) {
_this3.keysToEnter.push(key);
}
} else if (showInNext) {
_this3.keysToEnter.push(key);
}
} else if (!hasPrev) {
_this3.keysToEnter.push(key);
}
});
currentChildren.forEach(function (child) {
var key = child && child.key;
if (child && currentlyAnimatingKeys[key]) {
return;
}
var hasNext = child && Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["a" /* findChildInChildrenByKey */])(nextChildren, key);
if (showProp) {
var showInNow = child.props[showProp];
if (hasNext) {
var showInNext = Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["b" /* findShownChildInChildrenByKey */])(nextChildren, key, showProp);
if (!showInNext && showInNow) {
_this3.keysToLeave.push(key);
}
} else if (showInNow) {
_this3.keysToLeave.push(key);
}
} else if (!hasNext) {
_this3.keysToLeave.push(key);
}
});
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
}
}, {
key: 'isValidChildByKey',
value: function isValidChildByKey(currentChildren, key) {
var showProp = this.props.showProp;
if (showProp) {
return Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["b" /* findShownChildInChildrenByKey */])(currentChildren, key, showProp);
}
return Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["a" /* findChildInChildrenByKey */])(currentChildren, key);
}
}, {
key: 'stop',
value: function stop(key) {
delete this.currentlyAnimatingKeys[key];
var component = this.childrenRefs[key];
if (component) {
component.stop();
}
}
}, {
key: 'render',
value: function render() {
var _this4 = this;
var props = this.props;
this.nextProps = props;
var stateChildren = this.state.children;
var children = null;
if (stateChildren) {
children = stateChildren.map(function (child) {
if (child === null || child === undefined) {
return child;
}
if (!child.key) {
throw new Error('must set key for <rc-animate> children');
}
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
__WEBPACK_IMPORTED_MODULE_3__AnimateChild__["a" /* default */],
{
key: child.key,
ref: function ref(node) {
_this4.childrenRefs[child.key] = node;
},
animation: props.animation,
transitionName: props.transitionName,
transitionEnter: props.transitionEnter,
transitionAppear: props.transitionAppear,
transitionLeave: props.transitionLeave
},
child
);
});
}
var Component = props.component;
if (Component) {
var passedProps = props;
if (typeof Component === 'string') {
passedProps = _extends({
className: props.className,
style: props.style
}, props.componentProps);
}
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
Component,
passedProps,
children
);
}
return children[0] || null;
}
}]);
return Animate;
}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component);
Animate.isAnimate = true;
Animate.defaultProps = {
animation: {},
component: 'span',
componentProps: {},
transitionEnter: true,
transitionLeave: true,
transitionAppear: false,
onEnd: noop,
onEnter: noop,
onLeave: noop,
onAppear: noop
};
var _initialiseProps = function _initialiseProps() {
var _this5 = this;
this.performEnter = function (key) {
// may already remove by exclusive
if (_this5.childrenRefs[key]) {
_this5.currentlyAnimatingKeys[key] = true;
_this5.childrenRefs[key].componentWillEnter(_this5.handleDoneAdding.bind(_this5, key, 'enter'));
}
};
this.performAppear = function (key) {
if (_this5.childrenRefs[key]) {
_this5.currentlyAnimatingKeys[key] = true;
_this5.childrenRefs[key].componentWillAppear(_this5.handleDoneAdding.bind(_this5, key, 'appear'));
}
};
this.handleDoneAdding = function (key, type) {
var props = _this5.props;
delete _this5.currentlyAnimatingKeys[key];
// if update on exclusive mode, skip check
if (props.exclusive && props !== _this5.nextProps) {
return;
}
var currentChildren = Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["e" /* toArrayChildren */])(getChildrenFromProps(props));
if (!_this5.isValidChildByKey(currentChildren, key)) {
// exclusive will not need this
_this5.performLeave(key);
} else if (type === 'appear') {
if (__WEBPACK_IMPORTED_MODULE_4__util_animate__["a" /* default */].allowAppearCallback(props)) {
props.onAppear(key);
props.onEnd(key, true);
}
} else if (__WEBPACK_IMPORTED_MODULE_4__util_animate__["a" /* default */].allowEnterCallback(props)) {
props.onEnter(key);
props.onEnd(key, true);
}
};
this.performLeave = function (key) {
// may already remove by exclusive
if (_this5.childrenRefs[key]) {
_this5.currentlyAnimatingKeys[key] = true;
_this5.childrenRefs[key].componentWillLeave(_this5.handleDoneLeaving.bind(_this5, key));
}
};
this.handleDoneLeaving = function (key) {
var props = _this5.props;
delete _this5.currentlyAnimatingKeys[key];
// if update on exclusive mode, skip check
if (props.exclusive && props !== _this5.nextProps) {
return;
}
var currentChildren = Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["e" /* toArrayChildren */])(getChildrenFromProps(props));
// in case state change is too fast
if (_this5.isValidChildByKey(currentChildren, key)) {
_this5.performEnter(key);
} else {
var end = function end() {
if (__WEBPACK_IMPORTED_MODULE_4__util_animate__["a" /* default */].allowLeaveCallback(props)) {
props.onLeave(key);
props.onEnd(key, false);
}
};
if (!Object(__WEBPACK_IMPORTED_MODULE_2__ChildrenUtils__["c" /* isSameChildren */])(_this5.state.children, currentChildren, props.showProp)) {
_this5.setState({
children: currentChildren
}, end);
} else {
end();
}
}
};
};
/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1_rc_util_es_unsafeLifecyclesPolyfill__["a" /* default */])(Animate));
/***/ }),
/* 10 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
var unsafeLifecyclesPolyfill = function unsafeLifecyclesPolyfill(Component) {
var prototype = Component.prototype;
if (!prototype || !prototype.isReactComponent) {
throw new Error('Can only polyfill class components');
} // only handle componentWillReceiveProps
if (typeof prototype.componentWillReceiveProps !== 'function') {
return Component;
} // In React 16.9, React.Profiler was introduced together with UNSAFE_componentWillReceiveProps
// https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#performance-measurements-with-reactprofiler
if (!__WEBPACK_IMPORTED_MODULE_0_react___default.a.Profiler) {
return Component;
} // Here polyfill get started
prototype.UNSAFE_componentWillReceiveProps = prototype.componentWillReceiveProps;
delete prototype.componentWillReceiveProps;
return Component;
};
/* harmony default export */ __webpack_exports__["a"] = (unsafeLifecyclesPolyfill);
/***/ }),
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["e"] = toArrayChildren;
/* harmony export (immutable) */ __webpack_exports__["a"] = findChildInChildrenByKey;
/* harmony export (immutable) */ __webpack_exports__["b"] = findShownChildInChildrenByKey;
/* unused harmony export findHiddenChildInChildrenByKey */
/* harmony export (immutable) */ __webpack_exports__["c"] = isSameChildren;
/* harmony export (immutable) */ __webpack_exports__["d"] = mergeChildren;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
function toArrayChildren(children) {
var ret = [];
__WEBPACK_IMPORTED_MODULE_0_react___default.a.Children.forEach(children, function (child) {
ret.push(child);
});
return ret;
}
function findChildInChildrenByKey(children, key) {
var ret = null;
if (children) {
children.forEach(function (child) {
if (ret) {
return;
}
if (child && child.key === key) {
ret = child;
}
});
}
return ret;
}
function findShownChildInChildrenByKey(children, key, showProp) {
var ret = null;
if (children) {
children.forEach(function (child) {
if (child && child.key === key && child.props[showProp]) {
if (ret) {
throw new Error('two child with same key for <rc-animate> children');
}
ret = child;
}
});
}
return ret;
}
function findHiddenChildInChildrenByKey(children, key, showProp) {
var found = 0;
if (children) {
children.forEach(function (child) {
if (found) {
return;
}
found = child && child.key === key && !child.props[showProp];
});
}
return found;
}
function isSameChildren(c1, c2, showProp) {
var same = c1.length === c2.length;
if (same) {
c1.forEach(function (child, index) {
var child2 = c2[index];
if (child && child2) {
if (child && !child2 || !child && child2) {
same = false;
} else if (child.key !== child2.key) {
same = false;
} else if (showProp && child.props[showProp] !== child2.props[showProp]) {
same = false;
}
}
});
}
return same;
}
function mergeChildren(prev, next) {
var ret = [];
// For each key of `next`, the list of keys to insert before that key in
// the combined list
var nextChildrenPending = {};
var pendingChildren = [];
prev.forEach(function (child) {
if (child && findChildInChildrenByKey(next, child.key)) {
if (pendingChildren.length) {
nextChildrenPending[child.key] = pendingChildren;
pendingChildren = [];
}
} else {
pendingChildren.push(child);
}
});
next.forEach(function (child) {
if (child && Object.prototype.hasOwnProperty.call(nextChildrenPending, child.key)) {
ret = ret.concat(nextChildrenPending[child.key]);
}
ret.push(child);
});
ret = ret.concat(pendingChildren);
return ret;
}
/***/ }),
/* 12 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react_dom__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ant_design_css_animation__ = __webpack_require__(13);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_animate__ = __webpack_require__(2);
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/* eslint react/prop-types: 0 */
var transitionMap = {
enter: 'transitionEnter',
appear: 'transitionAppear',
leave: 'transitionLeave'
};
var AnimateChild = function (_React$Component) {
_inherits(AnimateChild, _React$Component);
function AnimateChild() {
_classCallCheck(this, AnimateChild);
return _possibleConstructorReturn(this, (AnimateChild.__proto__ || Object.getPrototypeOf(AnimateChild)).apply(this, arguments));
}
_createClass(AnimateChild, [{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.stop();
}
}, {
key: 'componentWillEnter',
value: function componentWillEnter(done) {
if (__WEBPACK_IMPORTED_MODULE_3__util_animate__["a" /* default */].isEnterSupported(this.props)) {
this.transition('enter', done);
} else {
done();
}
}
}, {
key: 'componentWillAppear',
value: function componentWillAppear(done) {
if (__WEBPACK_IMPORTED_MODULE_3__util_animate__["a" /* default */].isAppearSupported(this.props)) {
this.transition('appear', done);
} else {
done();
}
}
}, {
key: 'componentWillLeave',
value: function componentWillLeave(done) {
if (__WEBPACK_IMPORTED_MODULE_3__util_animate__["a" /* default */].isLeaveSupported(this.props)) {
this.transition('leave', done);
} else {
// always sync, do not interupt with react component life cycle
// update hidden -> animate hidden ->
// didUpdate -> animate leave -> unmount (if animate is none)
done();
}
}
}, {
key: 'transition',
value: function transition(animationType, finishCallback) {
var _this2 = this;
var node = __WEBPACK_IMPORTED_MODULE_1_react_dom___default.a.findDOMNode(this);
var props = this.props;
var transitionName = props.transitionName;
var nameIsObj = typeof transitionName === 'object';
this.stop();
var end = function end() {
_this2.stopper = null;
finishCallback();
};
if ((__WEBPACK_IMPORTED_MODULE_2__ant_design_css_animation__["b" /* isCssAnimationSupported */] || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
var activeName = name + '-active';
if (nameIsObj && transitionName[animationType + 'Active']) {
activeName = transitionName[animationType + 'Active'];
}
this.stopper = Object(__WEBPACK_IMPORTED_MODULE_2__ant_design_css_animation__["a" /* default */])(node, {
name: name,
active: activeName
}, end);
} else {
this.stopper = props.animation[animationType](node, end);
}
}
}, {
key: 'stop',
value: function stop() {
var stopper = this.stopper;
if (stopper) {
this.stopper = null;
stopper.stop();
}
}
}, {
key: 'render',
value: function render() {
return this.props.children;
}
}]);
return AnimateChild;
}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component);
/* harmony default export */ __webpack_exports__["a"] = (AnimateChild);
/***/ }),
/* 13 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isCssAnimationSupported; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Event__ = __webpack_require__(14);
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var isCssAnimationSupported = __WEBPACK_IMPORTED_MODULE_0__Event__["a" /* default */].endEvents.length !== 0;
var capitalPrefixes = ['Webkit', 'Moz', 'O',
// ms is special .... !
'ms'];
var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
function getStyleProperty(node, name) {
// old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
var style = window.getComputedStyle(node, null);
var ret = '';
for (var i = 0; i < prefixes.length; i++) {
ret = style.getPropertyValue(prefixes[i] + name);
if (ret) {
break;
}
}
return ret;
}
function fixBrowserByTimeout(node) {
if (isCssAnimationSupported) {
var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
// sometimes, browser bug
node.rcEndAnimTimeout = setTimeout(function () {
node.rcEndAnimTimeout = null;
if (node.rcEndListener) {
node.rcEndListener();
}
}, time * 1000 + 200);
}
}
function clearBrowserBugTimeout(node) {
if (node.rcEndAnimTimeout) {
clearTimeout(node.rcEndAnimTimeout);
node.rcEndAnimTimeout = null;
}
}
var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
var className = nameIsObj ? transitionName.name : transitionName;
var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
var end = endCallback;
var start = void 0;
var active = void 0;
if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
end = endCallback.end;
start = endCallback.start;
active = endCallback.active;
}
if (node.rcEndListener) {
node.rcEndListener();
}
node.rcEndListener = function (e) {
if (e && e.target !== node) {
return;
}
if (node.rcAnimTimeout) {
clearTimeout(node.rcAnimTimeout);
node.rcAnimTimeout = null;
}
clearBrowserBugTimeout(node);
node.classList.remove(className);
node.classList.remove(activeClassName);
__WEBPACK_IMPORTED_MODULE_0__Event__["a" /* default */].removeEndEventListener(node, node.rcEndListener);
node.rcEndListener = null;
// Usually this optional end is used for informing an owner of
// a leave animation and telling it to remove the child.
if (end) {
end();
}
};
__WEBPACK_IMPORTED_MODULE_0__Event__["a" /* default */].addEndEventListener(node, node.rcEndListener);
if (start) {
start();
}
node.classList.add(className);
node.rcAnimTimeout = setTimeout(function () {
node.rcAnimTimeout = null;
node.classList.add(activeClassName);
if (active) {
setTimeout(active, 0);
}
fixBrowserByTimeout(node);
// 30ms for firefox
}, 30);
return {
stop: function stop() {
if (node.rcEndListener) {
node.rcEndListener();
}
}
};
};
cssAnimation.style = function (node, style, callback) {
if (node.rcEndListener) {
node.rcEndListener();
}
node.rcEndListener = function (e) {
if (e && e.target !== node) {
return;
}
if (node.rcAnimTimeout) {
clearTimeout(node.rcAnimTimeout);
node.rcAnimTimeout = null;
}
clearBrowserBugTimeout(node);
__WEBPACK_IMPORTED_MODULE_0__Event__["a" /* default */].removeEndEventListener(node, node.rcEndListener);
node.rcEndListener = null;
// Usually this optional callback is used for informing an owner of
// a leave animation and telling it to remove the child.
if (callback) {
callback();
}
};
__WEBPACK_IMPORTED_MODULE_0__Event__["a" /* default */].addEndEventListener(node, node.rcEndListener);
node.rcAnimTimeout = setTimeout(function () {
for (var s in style) {
if (style.hasOwnProperty(s)) {
node.style[s] = style[s];
}
}
node.rcAnimTimeout = null;
fixBrowserByTimeout(node);
}, 0);
};
cssAnimation.setTransition = function (node, p, value) {
var property = p;
var v = value;
if (value === undefined) {
v = property;
property = '';
}
property = property || '';
capitalPrefixes.forEach(function (prefix) {
node.style[prefix + 'Transition' + property] = v;
});
};
cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
/* harmony default export */ __webpack_exports__["a"] = (cssAnimation);
/***/ }),
/* 14 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var START_EVENT_NAME_MAP = {
transitionstart: {
transition: 'transitionstart',
WebkitTransition: 'webkitTransitionStart',
MozTransition: 'mozTransitionStart',
OTransition: 'oTransitionStart',
msTransition: 'MSTransitionStart'
},
animationstart: {
animation: 'animationstart',
WebkitAnimation: 'webkitAnimationStart',
MozAnimation: 'mozAnimationStart',
OAnimation: 'oAnimationStart',
msAnimation: 'MSAnimationStart'
}
};
var END_EVENT_NAME_MAP = {
transitionend: {
transition: 'transitionend',
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'mozTransitionEnd',
OTransition: 'oTransitionEnd',
msTransition: 'MSTransitionEnd'
},
animationend: {
animation: 'animationend',
WebkitAnimation: 'webkitAnimationEnd',
MozAnimation: 'mozAnimationEnd',
OAnimation: 'oAnimationEnd',
msAnimation: 'MSAnimationEnd'
}
};
var startEvents = [];
var endEvents = [];
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
if (!('AnimationEvent' in window)) {
delete START_EVENT_NAME_MAP.animationstart.animation;
delete END_EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete START_EVENT_NAME_MAP.transitionstart.transition;
delete END_EVENT_NAME_MAP.transitionend.transition;
}
function process(EVENT_NAME_MAP, events) {
for (var baseEventName in EVENT_NAME_MAP) {
if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
events.push(baseEvents[styleName]);
break;
}
}
}
}
}
process(START_EVENT_NAME_MAP, startEvents);
process(END_EVENT_NAME_MAP, endEvents);
}
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
detectEvents();
}
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var TransitionEvents = {
// Start events
startEvents: startEvents,
addStartEventListener: function addStartEventListener(node, eventListener) {
if (startEvents.length === 0) {
window.setTimeout(eventListener, 0);
return;
}
startEvents.forEach(function (startEvent) {
addEventListener(node, startEvent, eventListener);
});
},
removeStartEventListener: function removeStartEventListener(node, eventListener) {
if (startEvents.length === 0) {
return;
}
startEvents.forEach(function (startEvent) {
removeEventListener(node, startEvent, eventListener);
});
},
// End events
endEvents: endEvents,
addEndEventListener: function addEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
window.setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function (endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener: function removeEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
/* harmony default export */ __webpack_exports__["a"] = (TransitionEvents);
/***/ }),
/* 15 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
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; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
}if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
}return t;
};
var LazyRenderBox = function (_React$Component) {
_inherits(LazyRenderBox, _React$Component);
function LazyRenderBox() {
_classCallCheck(this, LazyRenderBox);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
LazyRenderBox.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
if (nextProps.forceRender) {
return true;
}
return !!nextProps.hiddenClassName || !!nextProps.visible;
};
LazyRenderBox.prototype.render = function render() {
var _a = this.props,
className = _a.className,
hiddenClassName = _a.hiddenClassName,
visible = _a.visible,
forceRender = _a.forceRender,
restProps = __rest(_a, ["className", "hiddenClassName", "visible", "forceRender"]);
var useClassName = className;
if (!!hiddenClassName && !visible) {
useClassName += " " + hiddenClassName;
}
return __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", _extends({}, restProps, { className: useClassName }));
};
return LazyRenderBox;
}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]);
/* harmony default export */ __webpack_exports__["a"] = (LazyRenderBox);
/***/ }),
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react_dom__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ContainerRender__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Portal__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__switchScrollingEffect__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__setStyle__ = __webpack_require__(3);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/* eslint-disable no-underscore-dangle,react/require-default-props */
var openCount = 0;
var windowIsUndefined = !(typeof window !== 'undefined' && window.document && window.document.createElement);
var IS_REACT_16 = ('createPortal' in __WEBPACK_IMPORTED_MODULE_1_react_dom___default.a); // https://github.com/ant-design/ant-design/issues/19340
// https://github.com/ant-design/ant-design/issues/19332
var cacheOverflow = {};
var getParent = function getParent(getContainer) {
if (windowIsUndefined) {
return null;
}
if (getContainer) {
if (typeof getContainer === 'string') {
return document.querySelectorAll(getContainer)[0];
}
if (typeof getContainer === 'function') {
return getContainer();
}
if (_typeof(getContainer) === 'object' && getContainer instanceof window.HTMLElement) {
return getContainer;
}
}
return document.body;
};
var PortalWrapper = /*#__PURE__*/function (_React$Component) {
_inherits(PortalWrapper, _React$Component);
var _super = _createSuper(PortalWrapper);
function PortalWrapper(props) {
var _this;
_classCallCheck(this, PortalWrapper);
_this = _super.call(this, props);
_this.getContainer = function () {
if (windowIsUndefined) {
return null;
}
if (!_this.container) {
_this.container = document.createElement('div');
var parent = getParent(_this.props.getContainer);
if (parent) {
parent.appendChild(_this.container);
}
}
_this.setWrapperClassName();
return _this.container;
};
_this.setWrapperClassName = function () {
var wrapperClassName = _this.props.wrapperClassName;
if (_this.container && wrapperClassName && wrapperClassName !== _this.container.className) {
_this.container.className = wrapperClassName;
}
};
_this.savePortal = function (c) {
// Warning: don't rename _component
// https://github.com/react-component/util/pull/65#discussion_r352407916
_this._component = c;
};
_this.removeCurrentContainer = function (visible) {
_this.container = null;
_this._component = null;
if (!IS_REACT_16) {
if (visible) {
_this.renderComponent({
afterClose: _this.removeContainer,
onClose: function onClose() {},
visible: false
});
} else {
_this.removeContainer();
}
}
};
_this.switchScrollingEffect = function () {
if (openCount === 1 && !Object.keys(cacheOverflow).length) {
Object(__WEBPACK_IMPORTED_MODULE_4__switchScrollingEffect__["a" /* default */])(); // Must be set after switchScrollingEffect
cacheOverflow = Object(__WEBPACK_IMPORTED_MODULE_5__setStyle__["a" /* default */])({
overflow: 'hidden',
overflowX: 'hidden',
overflowY: 'hidden'
});
} else if (!openCount) {
Object(__WEBPACK_IMPORTED_MODULE_5__setStyle__["a" /* default */])(cacheOverflow);
cacheOverflow = {};
Object(__WEBPACK_IMPORTED_MODULE_4__switchScrollingEffect__["a" /* default */])(true);
}
};
var _visible = props.visible,
getContainer = props.getContainer;
if (!windowIsUndefined && getParent(getContainer) === document.body) {
openCount = _visible ? openCount + 1 : openCount;
}
_this.state = {
_self: _assertThisInitialized(_this)
};
return _this;
}
_createClass(PortalWrapper, [{
key: "componentDidUpdate",
value: function componentDidUpdate() {
this.setWrapperClassName();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
var _this$props = this.props,
visible = _this$props.visible,
getContainer = _this$props.getContainer;
if (!windowIsUndefined && getParent(getContainer) === document.body) {
// 离开时不会 render 导到离开时数值不变,改用 func 。。
openCount = visible && openCount ? openCount - 1 : openCount;
}
this.removeCurrentContainer(visible);
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props2 = this.props,
children = _this$props2.children,
forceRender = _this$props2.forceRender,
visible = _this$props2.visible;
var portal = null;
var childProps = {
getOpenCount: function getOpenCount() {
return openCount;
},
getContainer: this.getContainer,
switchScrollingEffect: this.switchScrollingEffect
}; // suppport react15
if (!IS_REACT_16) {
return /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_2__ContainerRender__["a" /* default */], {
parent: this,
visible: visible,
autoDestroy: false,
getComponent: function getComponent() {
var extra = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return children(_objectSpread(_objectSpread(_objectSpread({}, extra), childProps), {}, {
ref: _this2.savePortal
}));
},
getContainer: this.getContainer,
forceRender: forceRender
}, function (_ref) {
var renderComponent = _ref.renderComponent,
removeContainer = _ref.removeContainer;
_this2.renderComponent = renderComponent;
_this2.removeContainer = removeContainer;
return null;
});
}
if (forceRender || visible || this._component) {
portal = /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_3__Portal__["a" /* default */], {
getContainer: this.getContainer,
ref: this.savePortal
}, children(childProps));
}
return portal;
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props, _ref2) {
var prevProps = _ref2.prevProps,
_self = _ref2._self;
var visible = props.visible,
getContainer = props.getContainer;
if (prevProps) {
var prevVisible = prevProps.visible,
prevGetContainer = prevProps.getContainer;
if (visible !== prevVisible && !windowIsUndefined && getParent(getContainer) === document.body) {
openCount = visible && !prevVisible ? openCount + 1 : openCount - 1;
}
var getContainerIsFunc = typeof getContainer === 'function' && typeof prevGetContainer === 'function';
if (getContainerIsFunc ? getContainer.toString() !== prevGetContainer.toString() : getContainer !== prevGetContainer) {
_self.removeCurrentContainer(false);
}
}
return {
prevProps: props
};
}
}]);
return PortalWrapper;
}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component);
/* harmony default export */ __webpack_exports__["a"] = (PortalWrapper);
/***/ }),
/* 17 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ContainerRender; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react_dom__);
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var ContainerRender = /*#__PURE__*/function (_React$Component) {
_inherits(ContainerRender, _React$Component);
var _super = _createSuper(ContainerRender);
function ContainerRender() {
var _this;
_classCallCheck(this, ContainerRender);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.removeContainer = function () {
if (_this.container) {
__WEBPACK_IMPORTED_MODULE_1_react_dom___default.a.unmountComponentAtNode(_this.container);
_this.container.parentNode.removeChild(_this.container);
_this.container = null;
}
};
_this.renderComponent = function (props, ready) {
var _this$props = _this.props,
visible = _this$props.visible,
getComponent = _this$props.getComponent,
forceRender = _this$props.forceRender,
getContainer = _this$props.getContainer,
parent = _this$props.parent;
if (visible || parent._component || forceRender) {
if (!_this.container) {
_this.container = getContainer();
}
__WEBPACK_IMPORTED_MODULE_1_react_dom___default.a.unstable_renderSubtreeIntoContainer(parent, getComponent(props), _this.container, function callback() {
if (ready) {
ready.call(this);
}
});
}
};
return _this;
}
_createClass(ContainerRender, [{
key: "componentDidMount",
value: function componentDidMount() {
if (this.props.autoMount) {
this.renderComponent();
}
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
if (this.props.autoMount) {
this.renderComponent();
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.props.autoDestroy) {
this.removeContainer();
}
}
}, {
key: "render",
value: function render() {
return this.props.children({
renderComponent: this.renderComponent,
removeContainer: this.removeContainer
});
}
}]);
return ContainerRender;
}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component);
ContainerRender.defaultProps = {
autoMount: true,
autoDestroy: true,
forceRender: false
};
/***/ }),
/* 18 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Portal; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react_dom__);
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var Portal = /*#__PURE__*/function (_React$Component) {
_inherits(Portal, _React$Component);
var _super = _createSuper(Portal);
function Portal() {
_classCallCheck(this, Portal);
return _super.apply(this, arguments);
}
_createClass(Portal, [{
key: "componentDidMount",
value: function componentDidMount() {
this.createContainer();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var didUpdate = this.props.didUpdate;
if (didUpdate) {
didUpdate(prevProps);
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.removeContainer();
}
}, {
key: "createContainer",
value: function createContainer() {
this._container = this.props.getContainer();
this.forceUpdate();
}
}, {
key: "removeContainer",
value: function removeContainer() {
if (this._container) {
this._container.parentNode.removeChild(this._container);
}
}
}, {
key: "render",
value: function render() {
if (this._container) {
return __WEBPACK_IMPORTED_MODULE_1_react_dom___default.a.createPortal(this.props.children, this._container);
}
return null;
}
}]);
return Portal;
}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component);
/***/ }),
/* 19 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getScrollBarSize__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setStyle__ = __webpack_require__(3);
function isBodyOverflowing() {
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
}
var cacheStyle = {};
/* harmony default export */ __webpack_exports__["a"] = (function (close) {
if (!isBodyOverflowing() && !close) {
return;
} // https://github.com/ant-design/ant-design/issues/19729
var scrollingEffectClassName = 'ant-scrolling-effect';
var scrollingEffectClassNameReg = new RegExp("".concat(scrollingEffectClassName), 'g');
var bodyClassName = document.body.className;
if (close) {
if (!scrollingEffectClassNameReg.test(bodyClassName)) return;
Object(__WEBPACK_IMPORTED_MODULE_1__setStyle__["a" /* default */])(cacheStyle);
cacheStyle = {};
document.body.className = bodyClassName.replace(scrollingEffectClassNameReg, '').trim();
return;
}
var scrollBarSize = Object(__WEBPACK_IMPORTED_MODULE_0__getScrollBarSize__["a" /* default */])();
if (scrollBarSize) {
cacheStyle = Object(__WEBPACK_IMPORTED_MODULE_1__setStyle__["a" /* default */])({
position: 'relative',
width: "calc(100% - ".concat(scrollBarSize, "px)")
});
if (!scrollingEffectClassNameReg.test(bodyClassName)) {
var addClassName = "".concat(bodyClassName, " ").concat(scrollingEffectClassName);
document.body.className = addClassName.trim();
}
}
});
/***/ }),
/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = getScrollBarSize;
var cached;
function getScrollBarSize(fresh) {
if (typeof document === 'undefined') {
return 0;
}
if (fresh || cached === undefined) {
var inner = document.createElement('div');
inner.style.width = '100%';
inner.style.height = '200px';
var outer = document.createElement('div');
var outerStyle = outer.style;
outerStyle.position = 'absolute';
outerStyle.top = 0;
outerStyle.left = 0;
outerStyle.pointerEvents = 'none';
outerStyle.visibility = 'hidden';
outerStyle.width = '200px';
outerStyle.height = '150px';
outerStyle.overflow = 'hidden';
outer.appendChild(inner);
document.body.appendChild(outer);
var widthContained = inner.offsetWidth;
outer.style.overflow = 'scroll';
var widthScroll = inner.offsetWidth;
if (widthContained === widthScroll) {
widthScroll = outer.clientWidth;
}
document.body.removeChild(outer);
cached = widthContained - widthScroll;
}
return cached;
}
/***/ }),
/* 21 */,
/* 22 */,
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(4);
module.exports = __webpack_require__(24);
/***/ }),
/* 24 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ])["default"];
});
//# sourceMappingURL=rc-dialog-bootstrap.js.map