antd
Version:
An enterprise-class UI design language and React components implementation
1,215 lines (1,002 loc) • 5.79 MB
JavaScript
/*!
*
* antd v3.23.0
*
* Copyright 2015-present, Alipay, Inc.
* All rights reserved.
*
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("moment"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "moment", "react-dom"], factory);
else if(typeof exports === 'object')
exports["antd"] = factory(require("react"), require("moment"), require("react-dom"));
else
root["antd"] = factory(root["React"], root["moment"], root["ReactDOM"]);
})(window, function(__WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_moment__, __WEBPACK_EXTERNAL_MODULE_react_dom__) {
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, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // 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 = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./components sync recursive ^\\.\\/[^_][\\w-]+\\/style\\/index\\.tsx?$":
/*!**************************************************************!*\
!*** ./components sync ^\.\/[^_][\w-]+\/style\/index\.tsx?$ ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var map = {
"./affix/style/index.tsx": "./components/affix/style/index.tsx",
"./alert/style/index.tsx": "./components/alert/style/index.tsx",
"./anchor/style/index.tsx": "./components/anchor/style/index.tsx",
"./auto-complete/style/index.tsx": "./components/auto-complete/style/index.tsx",
"./avatar/style/index.tsx": "./components/avatar/style/index.tsx",
"./back-top/style/index.tsx": "./components/back-top/style/index.tsx",
"./badge/style/index.tsx": "./components/badge/style/index.tsx",
"./breadcrumb/style/index.tsx": "./components/breadcrumb/style/index.tsx",
"./button/style/index.tsx": "./components/button/style/index.tsx",
"./calendar/style/index.tsx": "./components/calendar/style/index.tsx",
"./card/style/index.tsx": "./components/card/style/index.tsx",
"./carousel/style/index.tsx": "./components/carousel/style/index.tsx",
"./cascader/style/index.tsx": "./components/cascader/style/index.tsx",
"./checkbox/style/index.tsx": "./components/checkbox/style/index.tsx",
"./col/style/index.tsx": "./components/col/style/index.tsx",
"./collapse/style/index.tsx": "./components/collapse/style/index.tsx",
"./comment/style/index.tsx": "./components/comment/style/index.tsx",
"./config-provider/style/index.tsx": "./components/config-provider/style/index.tsx",
"./date-picker/style/index.tsx": "./components/date-picker/style/index.tsx",
"./descriptions/style/index.tsx": "./components/descriptions/style/index.tsx",
"./divider/style/index.tsx": "./components/divider/style/index.tsx",
"./drawer/style/index.tsx": "./components/drawer/style/index.tsx",
"./dropdown/style/index.tsx": "./components/dropdown/style/index.tsx",
"./empty/style/index.tsx": "./components/empty/style/index.tsx",
"./form/style/index.tsx": "./components/form/style/index.tsx",
"./grid/style/index.tsx": "./components/grid/style/index.tsx",
"./icon/style/index.tsx": "./components/icon/style/index.tsx",
"./input-number/style/index.tsx": "./components/input-number/style/index.tsx",
"./input/style/index.tsx": "./components/input/style/index.tsx",
"./layout/style/index.tsx": "./components/layout/style/index.tsx",
"./list/style/index.tsx": "./components/list/style/index.tsx",
"./locale-provider/style/index.tsx": "./components/locale-provider/style/index.tsx",
"./mention/style/index.tsx": "./components/mention/style/index.tsx",
"./mentions/style/index.tsx": "./components/mentions/style/index.tsx",
"./menu/style/index.tsx": "./components/menu/style/index.tsx",
"./message/style/index.tsx": "./components/message/style/index.tsx",
"./modal/style/index.tsx": "./components/modal/style/index.tsx",
"./notification/style/index.tsx": "./components/notification/style/index.tsx",
"./page-header/style/index.tsx": "./components/page-header/style/index.tsx",
"./pagination/style/index.tsx": "./components/pagination/style/index.tsx",
"./popconfirm/style/index.tsx": "./components/popconfirm/style/index.tsx",
"./popover/style/index.tsx": "./components/popover/style/index.tsx",
"./progress/style/index.tsx": "./components/progress/style/index.tsx",
"./radio/style/index.tsx": "./components/radio/style/index.tsx",
"./rate/style/index.tsx": "./components/rate/style/index.tsx",
"./result/style/index.tsx": "./components/result/style/index.tsx",
"./row/style/index.tsx": "./components/row/style/index.tsx",
"./select/style/index.tsx": "./components/select/style/index.tsx",
"./skeleton/style/index.tsx": "./components/skeleton/style/index.tsx",
"./slider/style/index.tsx": "./components/slider/style/index.tsx",
"./spin/style/index.tsx": "./components/spin/style/index.tsx",
"./statistic/style/index.tsx": "./components/statistic/style/index.tsx",
"./steps/style/index.tsx": "./components/steps/style/index.tsx",
"./switch/style/index.tsx": "./components/switch/style/index.tsx",
"./table/style/index.tsx": "./components/table/style/index.tsx",
"./tabs/style/index.tsx": "./components/tabs/style/index.tsx",
"./tag/style/index.tsx": "./components/tag/style/index.tsx",
"./time-picker/style/index.tsx": "./components/time-picker/style/index.tsx",
"./timeline/style/index.tsx": "./components/timeline/style/index.tsx",
"./tooltip/style/index.tsx": "./components/tooltip/style/index.tsx",
"./transfer/style/index.tsx": "./components/transfer/style/index.tsx",
"./tree-select/style/index.tsx": "./components/tree-select/style/index.tsx",
"./tree/style/index.tsx": "./components/tree/style/index.tsx",
"./typography/style/index.tsx": "./components/typography/style/index.tsx",
"./upload/style/index.tsx": "./components/upload/style/index.tsx",
"./version/style/index.tsx": "./components/version/style/index.tsx"
};
function webpackContext(req) {
var id = webpackContextResolve(req);
return __webpack_require__(id);
}
function webpackContextResolve(req) {
if(!__webpack_require__.o(map, req)) {
var e = new Error("Cannot find module '" + req + "'");
e.code = 'MODULE_NOT_FOUND';
throw e;
}
return map[req];
}
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = "./components sync recursive ^\\.\\/[^_][\\w-]+\\/style\\/index\\.tsx?$";
/***/ }),
/***/ "./components/_util/colors.ts":
/*!************************************!*\
!*** ./components/_util/colors.ts ***!
\************************************/
/*! exports provided: PresetColorTypes */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PresetColorTypes", function() { return PresetColorTypes; });
/* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./components/_util/type.ts");
// eslint-disable-next-line import/prefer-default-export
var PresetColorTypes = Object(_type__WEBPACK_IMPORTED_MODULE_0__["tuple"])('pink', 'red', 'yellow', 'orange', 'cyan', 'green', 'blue', 'purple', 'geekblue', 'magenta', 'volcano', 'gold', 'lime');
/***/ }),
/***/ "./components/_util/easings.ts":
/*!*************************************!*\
!*** ./components/_util/easings.ts ***!
\*************************************/
/*! exports provided: easeInOutCubic */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "easeInOutCubic", function() { return easeInOutCubic; });
// eslint-disable-next-line import/prefer-default-export
function easeInOutCubic(t, b, c, d) {
var cc = c - b;
t /= d / 2;
if (t < 1) {
return cc / 2 * t * t * t + b;
}
return cc / 2 * ((t -= 2) * t * t + 2) + b;
}
/***/ }),
/***/ "./components/_util/getDataOrAriaProps.ts":
/*!************************************************!*\
!*** ./components/_util/getDataOrAriaProps.ts ***!
\************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getDataOrAriaProps; });
function getDataOrAriaProps(props) {
return Object.keys(props).reduce(function (prev, key) {
if ((key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') && key.substr(0, 7) !== 'data-__') {
prev[key] = props[key];
}
return prev;
}, {});
}
/***/ }),
/***/ "./components/_util/getScroll.tsx":
/*!****************************************!*\
!*** ./components/_util/getScroll.tsx ***!
\****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getScroll; });
function getScroll(target, top) {
if (typeof window === 'undefined') {
return 0;
}
var prop = top ? 'pageYOffset' : 'pageXOffset';
var method = top ? 'scrollTop' : 'scrollLeft';
var isWindow = target === window;
var ret = isWindow ? target[prop] : target[method]; // ie6,7,8 standard mode
if (isWindow && typeof ret !== 'number') {
ret = document.documentElement[method];
}
return ret;
}
/***/ }),
/***/ "./components/_util/interopDefault.ts":
/*!********************************************!*\
!*** ./components/_util/interopDefault.ts ***!
\********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return interopDefault; });
// https://github.com/moment/moment/issues/3650
// since we are using ts 3.5.1, it should be safe to remove.
function interopDefault(m) {
return m["default"] || m;
}
/***/ }),
/***/ "./components/_util/isNumeric.ts":
/*!***************************************!*\
!*** ./components/_util/isNumeric.ts ***!
\***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
var isNumeric = function isNumeric(value) {
return !isNaN(parseFloat(value)) && isFinite(value);
};
/* harmony default export */ __webpack_exports__["default"] = (isNumeric);
/***/ }),
/***/ "./components/_util/motion.tsx":
/*!*************************************!*\
!*** ./components/_util/motion.tsx ***!
\*************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// ================== Collapse Motion ==================
var getCollapsedHeight = function getCollapsedHeight() {
return {
height: 0,
opacity: 0
};
};
var getRealHeight = function getRealHeight(node) {
return {
height: node.scrollHeight,
opacity: 1
};
};
var getCurrentHeight = function getCurrentHeight(node) {
return {
height: node.offsetHeight
};
};
var collapseMotion = {
motionName: 'ant-motion-collapse',
onAppearStart: getCollapsedHeight,
onEnterStart: getCollapsedHeight,
onAppearActive: getRealHeight,
onEnterActive: getRealHeight,
onLeaveStart: getCurrentHeight,
onLeaveActive: getCollapsedHeight
};
/* harmony default export */ __webpack_exports__["default"] = (collapseMotion);
/***/ }),
/***/ "./components/_util/openAnimation.tsx":
/*!********************************************!*\
!*** ./components/_util/openAnimation.tsx ***!
\********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var css_animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! css-animation */ "./node_modules/css-animation/es/index.js");
/* harmony import */ var raf__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! raf */ "./node_modules/raf/index.js");
/* harmony import */ var raf__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(raf__WEBPACK_IMPORTED_MODULE_1__);
/**
* Deprecated. We should replace the animation with pure react motion instead of modify style directly.
* If you are creating new component with animation, please use `./motion`.
*/
function animate(node, show, done) {
var height;
var requestAnimationFrameId;
return Object(css_animation__WEBPACK_IMPORTED_MODULE_0__["default"])(node, 'ant-motion-collapse-legacy', {
start: function start() {
if (!show) {
node.style.height = "".concat(node.offsetHeight, "px");
node.style.opacity = '1';
} else {
height = node.offsetHeight;
node.style.height = '0px';
node.style.opacity = '0';
}
},
active: function active() {
if (requestAnimationFrameId) {
raf__WEBPACK_IMPORTED_MODULE_1___default.a.cancel(requestAnimationFrameId);
}
requestAnimationFrameId = raf__WEBPACK_IMPORTED_MODULE_1___default()(function () {
node.style.height = "".concat(show ? height : 0, "px");
node.style.opacity = show ? '1' : '0';
});
},
end: function end() {
if (requestAnimationFrameId) {
raf__WEBPACK_IMPORTED_MODULE_1___default.a.cancel(requestAnimationFrameId);
}
node.style.height = '';
node.style.opacity = '';
done();
}
});
}
var animation = {
enter: function enter(node, done) {
return animate(node, true, done);
},
leave: function leave(node, done) {
return animate(node, false, done);
},
appear: function appear(node, done) {
return animate(node, true, done);
}
};
/* harmony default export */ __webpack_exports__["default"] = (animation);
/***/ }),
/***/ "./components/_util/raf.ts":
/*!*********************************!*\
!*** ./components/_util/raf.ts ***!
\*********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return wrapperRaf; });
/* harmony import */ var raf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! raf */ "./node_modules/raf/index.js");
/* harmony import */ var raf__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(raf__WEBPACK_IMPORTED_MODULE_0__);
var id = 0;
var ids = {}; // Support call raf with delay specified frame
function wrapperRaf(callback) {
var delayFrames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var myId = id++;
var restFrames = delayFrames;
function internalCallback() {
restFrames -= 1;
if (restFrames <= 0) {
callback();
delete ids[myId];
} else {
ids[myId] = raf__WEBPACK_IMPORTED_MODULE_0___default()(internalCallback);
}
}
ids[myId] = raf__WEBPACK_IMPORTED_MODULE_0___default()(internalCallback);
return myId;
}
wrapperRaf.cancel = function cancel(pid) {
if (pid === undefined) return;
raf__WEBPACK_IMPORTED_MODULE_0___default.a.cancel(ids[pid]);
delete ids[pid];
};
wrapperRaf.ids = ids; // export this for test usage
/***/ }),
/***/ "./components/_util/reactNode.ts":
/*!***************************************!*\
!*** ./components/_util/reactNode.ts ***!
\***************************************/
/*! exports provided: cloneElement */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneElement", function() { return cloneElement; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
// eslint-disable-next-line import/prefer-default-export
function cloneElement(element) {
if (!react__WEBPACK_IMPORTED_MODULE_0__["isValidElement"](element)) return element;
for (var _len = arguments.length, restArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
restArgs[_key - 1] = arguments[_key];
}
return react__WEBPACK_IMPORTED_MODULE_0__["cloneElement"].apply(react__WEBPACK_IMPORTED_MODULE_0__, [element].concat(restArgs));
}
/***/ }),
/***/ "./components/_util/resizeObserver.tsx":
/*!*********************************************!*\
!*** ./components/_util/resizeObserver.tsx ***!
\*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "react-dom");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! resize-observer-polyfill */ "./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js");
function _typeof(obj) { 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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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); }
var ReactResizeObserver =
/*#__PURE__*/
function (_React$Component) {
_inherits(ReactResizeObserver, _React$Component);
function ReactResizeObserver() {
var _this;
_classCallCheck(this, ReactResizeObserver);
_this = _possibleConstructorReturn(this, _getPrototypeOf(ReactResizeObserver).apply(this, arguments));
_this.resizeObserver = null;
_this.state = {
width: 0,
height: 0
};
_this.onResize = function (entries) {
var onResize = _this.props.onResize;
var target = entries[0].target;
var _target$getBoundingCl = target.getBoundingClientRect(),
width = _target$getBoundingCl.width,
height = _target$getBoundingCl.height;
/**
* Resize observer trigger when content size changed.
* In most case we just care about element size,
* let's use `boundary` instead of `contentRect` here to avoid shaking.
*/
var fixedWidth = Math.floor(width);
var fixedHeight = Math.floor(height);
if (_this.state.width !== fixedWidth || _this.state.height !== fixedHeight) {
_this.setState({
width: fixedWidth,
height: fixedHeight
});
if (onResize) {
onResize();
}
}
};
return _this;
}
_createClass(ReactResizeObserver, [{
key: "componentDidMount",
value: function componentDidMount() {
this.onComponentUpdated();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
this.onComponentUpdated();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.destroyObserver();
}
}, {
key: "onComponentUpdated",
value: function onComponentUpdated() {
var disabled = this.props.disabled;
var element = Object(react_dom__WEBPACK_IMPORTED_MODULE_1__["findDOMNode"])(this);
if (!this.resizeObserver && !disabled && element) {
// Add resize observer
this.resizeObserver = new resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_2__["default"](this.onResize);
this.resizeObserver.observe(element);
} else if (disabled) {
// Remove resize observer
this.destroyObserver();
}
}
}, {
key: "destroyObserver",
value: function destroyObserver() {
if (this.resizeObserver) {
this.resizeObserver.disconnect();
this.resizeObserver = null;
}
}
}, {
key: "render",
value: function render() {
var _this$props$children = this.props.children,
children = _this$props$children === void 0 ? null : _this$props$children;
return children;
}
}]);
return ReactResizeObserver;
}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]);
/* harmony default export */ __webpack_exports__["default"] = (ReactResizeObserver);
/***/ }),
/***/ "./components/_util/responsiveObserve.ts":
/*!***********************************************!*\
!*** ./components/_util/responsiveObserve.ts ***!
\***********************************************/
/*! exports provided: responsiveArray, responsiveMap, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "responsiveArray", function() { return responsiveArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "responsiveMap", function() { return responsiveMap; });
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 _extends() { _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; }; return _extends.apply(this, arguments); }
// matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82
var enquire;
if (typeof window !== 'undefined') {
var matchMediaPolyfill = function matchMediaPolyfill(mediaQuery) {
return {
media: mediaQuery,
matches: false,
addListener: function addListener() {},
removeListener: function removeListener() {}
};
};
window.matchMedia = window.matchMedia || matchMediaPolyfill; // eslint-disable-next-line global-require
enquire = __webpack_require__(/*! enquire.js */ "./node_modules/enquire.js/src/index.js");
}
var responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
var responsiveMap = {
xs: '(max-width: 575px)',
sm: '(min-width: 576px)',
md: '(min-width: 768px)',
lg: '(min-width: 992px)',
xl: '(min-width: 1200px)',
xxl: '(min-width: 1600px)'
};
var subscribers = [];
var subUid = -1;
var screens = {};
var responsiveObserve = {
dispatch: function dispatch(pointMap) {
screens = pointMap;
if (subscribers.length < 1) {
return false;
}
subscribers.forEach(function (item) {
item.func(screens);
});
return true;
},
subscribe: function subscribe(func) {
if (subscribers.length === 0) {
this.register();
}
var token = (++subUid).toString();
subscribers.push({
token: token,
func: func
});
func(screens);
return token;
},
unsubscribe: function unsubscribe(token) {
subscribers = subscribers.filter(function (item) {
return item.token !== token;
});
if (subscribers.length === 0) {
this.unregister();
}
},
unregister: function unregister() {
Object.keys(responsiveMap).map(function (screen) {
return enquire.unregister(responsiveMap[screen]);
});
},
register: function register() {
var _this = this;
Object.keys(responsiveMap).map(function (screen) {
return enquire.register(responsiveMap[screen], {
match: function match() {
var pointMap = _extends(_extends({}, screens), _defineProperty({}, screen, true));
_this.dispatch(pointMap);
},
unmatch: function unmatch() {
var pointMap = _extends(_extends({}, screens), _defineProperty({}, screen, false));
_this.dispatch(pointMap);
},
// Keep a empty destory to avoid triggering unmatch when unregister
destroy: function destroy() {}
});
});
}
};
/* harmony default export */ __webpack_exports__["default"] = (responsiveObserve);
/***/ }),
/***/ "./components/_util/scrollTo.ts":
/*!**************************************!*\
!*** ./components/_util/scrollTo.ts ***!
\**************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return scrollTo; });
/* harmony import */ var raf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! raf */ "./node_modules/raf/index.js");
/* harmony import */ var raf__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(raf__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _getScroll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getScroll */ "./components/_util/getScroll.tsx");
/* harmony import */ var _easings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./easings */ "./components/_util/easings.ts");
function scrollTo(y) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$getContainer = options.getContainer,
getContainer = _options$getContainer === void 0 ? function () {
return window;
} : _options$getContainer,
callback = options.callback,
_options$duration = options.duration,
duration = _options$duration === void 0 ? 450 : _options$duration;
var container = getContainer();
var scrollTop = Object(_getScroll__WEBPACK_IMPORTED_MODULE_1__["default"])(container, true);
var startTime = Date.now();
var frameFunc = function frameFunc() {
var timestamp = Date.now();
var time = timestamp - startTime;
var nextScrollTop = Object(_easings__WEBPACK_IMPORTED_MODULE_2__["easeInOutCubic"])(time > duration ? duration : time, scrollTop, y, duration);
if (container === window) {
window.scrollTo(window.pageXOffset, nextScrollTop);
} else {
container.scrollTop = nextScrollTop;
}
if (time < duration) {
raf__WEBPACK_IMPORTED_MODULE_0___default()(frameFunc);
} else if (typeof callback === 'function') {
callback();
}
};
raf__WEBPACK_IMPORTED_MODULE_0___default()(frameFunc);
}
/***/ }),
/***/ "./components/_util/styleChecker.tsx":
/*!*******************************************!*\
!*** ./components/_util/styleChecker.tsx ***!
\*******************************************/
/*! exports provided: isFlexSupported, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFlexSupported", function() { return isFlexSupported; });
var isStyleSupport = function isStyleSupport(styleName) {
if (typeof window !== 'undefined' && window.document && window.document.documentElement) {
var styleNameList = Array.isArray(styleName) ? styleName : [styleName];
var documentElement = window.document.documentElement;
return styleNameList.some(function (name) {
return name in documentElement.style;
});
}
return false;
};
var isFlexSupported = isStyleSupport(['flex', 'webkitFlex', 'Flex', 'msFlex']);
/* harmony default export */ __webpack_exports__["default"] = (isStyleSupport);
/***/ }),
/***/ "./components/_util/throttleByAnimationFrame.tsx":
/*!*******************************************************!*\
!*** ./components/_util/throttleByAnimationFrame.tsx ***!
\*******************************************************/
/*! exports provided: default, throttleByAnimationFrameDecorator */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return throttleByAnimationFrame; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throttleByAnimationFrameDecorator", function() { return throttleByAnimationFrameDecorator; });
/* harmony import */ var raf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! raf */ "./node_modules/raf/index.js");
/* harmony import */ var raf__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(raf__WEBPACK_IMPORTED_MODULE_0__);
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function throttleByAnimationFrame(fn) {
var requestId;
var later = function later(args) {
return function () {
requestId = null;
fn.apply(void 0, _toConsumableArray(args));
};
};
var throttled = function throttled() {
if (requestId == null) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
requestId = raf__WEBPACK_IMPORTED_MODULE_0___default()(later(args));
}
};
throttled.cancel = function () {
return raf__WEBPACK_IMPORTED_MODULE_0___default.a.cancel(requestId);
};
return throttled;
}
function throttleByAnimationFrameDecorator() {
// eslint-disable-next-line func-names
return function (target, key, descriptor) {
var fn = descriptor.value;
var definingProperty = false;
return {
configurable: true,
get: function get() {
// eslint-disable-next-line no-prototype-builtins
if (definingProperty || this === target.prototype || this.hasOwnProperty(key)) {
return fn;
}
var boundFn = throttleByAnimationFrame(fn.bind(this));
definingProperty = true;
Object.defineProperty(this, key, {
value: boundFn,
configurable: true,
writable: true
});
definingProperty = false;
return boundFn;
}
};
};
}
/***/ }),
/***/ "./components/_util/transButton.tsx":
/*!******************************************!*\
!*** ./components/_util/transButton.tsx ***!
\******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var rc_util_es_KeyCode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rc-util/es/KeyCode */ "./node_modules/rc-util/es/KeyCode.js");
function _typeof(obj) { 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 _extends() { _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; }; return _extends.apply(this, arguments); }
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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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); }
var __rest = undefined && undefined.__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 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
/**
* Wrap of sub component which need use as Button capacity (like Icon component).
* This helps accessibility reader to tread as a interactive button to operation.
*/
var inlineStyle = {
border: 0,
background: 'transparent',
padding: 0,
lineHeight: 'inherit',
display: 'inline-block'
};
var TransButton =
/*#__PURE__*/
function (_React$Component) {
_inherits(TransButton, _React$Component);
function TransButton() {
var _this;
_classCallCheck(this, TransButton);
_this = _possibleConstructorReturn(this, _getPrototypeOf(TransButton).apply(this, arguments));
_this.onKeyDown = function (event) {
var keyCode = event.keyCode;
if (keyCode === rc_util_es_KeyCode__WEBPACK_IMPORTED_MODULE_1__["default"].ENTER) {
event.preventDefault();
}
};
_this.onKeyUp = function (event) {
var keyCode = event.keyCode;
var onClick = _this.props.onClick;
if (keyCode === rc_util_es_KeyCode__WEBPACK_IMPORTED_MODULE_1__["default"].ENTER && onClick) {
onClick();
}
};
_this.setRef = function (btn) {
_this.div = btn;
};
return _this;
}
_createClass(TransButton, [{
key: "focus",
value: function focus() {
if (this.div) {
this.div.focus();
}
}
}, {
key: "blur",
value: function blur() {
if (this.div) {
this.div.blur();
}
}
}, {
key: "render",
value: function render() {
var _a = this.props,
style = _a.style,
noStyle = _a.noStyle,
restProps = __rest(_a, ["style", "noStyle"]);
return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", _extends({
role: "button",
tabIndex: 0,
ref: this.setRef
}, restProps, {
onKeyDown: this.onKeyDown,
onKeyUp: this.onKeyUp,
style: _extends(_extends({}, !noStyle ? inlineStyle : null), style)
}));
}
}]);
return TransButton;
}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]);
/* harmony default export */ __webpack_exports__["default"] = (TransButton);
/***/ }),
/***/ "./components/_util/triggerEvent.tsx":
/*!*******************************************!*\
!*** ./components/_util/triggerEvent.tsx ***!
\*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return triggerEvent; });
function triggerEvent(el, type) {
if ('createEvent' in document) {
// modern browsers, IE9+
var e = document.createEvent('HTMLEvents');
e.initEvent(type, false, true);
el.dispatchEvent(e);
}
}
/***/ }),
/***/ "./components/_util/type.ts":
/*!**********************************!*\
!*** ./components/_util/type.ts ***!
\**********************************/
/*! exports provided: tuple, tupleNum */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tuple", function() { return tuple; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tupleNum", function() { return tupleNum; });
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
var tuple = function tuple() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args;
};
var tupleNum = function tupleNum() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return args;
};
/***/ }),
/***/ "./components/_util/warning.ts":
/*!*************************************!*\
!*** ./components/_util/warning.ts ***!
\*************************************/
/*! exports provided: resetWarned, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var rc_util_es_warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rc-util/es/warning */ "./node_modules/rc-util/es/warning.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resetWarned", function() { return rc_util_es_warning__WEBPACK_IMPORTED_MODULE_0__["resetWarned"]; });
/* harmony default export */ __webpack_exports__["default"] = (function (valid, component, message) {
Object(rc_util_es_warning__WEBPACK_IMPORTED_MODULE_0__["default"])(valid, "[antd: ".concat(component, "] ").concat(message));
});
/***/ }),
/***/ "./components/_util/wave.tsx":
/*!***********************************!*\
!*** ./components/_util/wave.tsx ***!
\***********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Wave; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "react-dom");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var css_animation_es_Event__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! css-animation/es/Event */ "./node_modules/css-animation/es/Event.js");
/* harmony import */ var _raf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./raf */ "./components/_util/raf.ts");
/* harmony import */ var _config_provider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../config-provider */ "./components/config-provider/index.tsx");
function _typeof(obj) { 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 _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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); }
var styleForPesudo; // Where el is the DOM element you'd like to test for visibility
function isHidden(element) {
if (false) {}
return !element || element.offsetParent === null;
}
function isNotGrey(color) {
// eslint-disable-next-line no-useless-escape
var match = (color || '').match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/);
if (match && match[1] && match[2] && match[3]) {
return !(match[1] === match[2] && match[2] === match[3]);
}
return true;
}
var Wave =
/*#__PURE__*/
function (_React$Component) {
_inherits(Wave, _React$Component);
function Wave() {
var _this;
_classCallCheck(this, Wave);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Wave).apply(this, arguments));
_this.animationStart = false;
_this.destroy = false;
_this.onClick = function (node, waveColor) {
if (!node || isHidden(node) || node.className.indexOf('-leave') >= 0) {
return;
}
var insertExtraNode = _this.props.insertExtraNode;
_this.extraNode = document.createElement('div');
var _assertThisInitialize = _assertThisInitialized(_this),
extraNode = _assertThisInitialize.extraNode;
extraNode.className = 'ant-click-animatin