Latest updates from IceHrmPro
This commit is contained in:
10
web/node_modules/rc-util/es/Children/mapSelf.js
generated
vendored
Normal file
10
web/node_modules/rc-util/es/Children/mapSelf.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
|
||||
function mirror(o) {
|
||||
return o;
|
||||
}
|
||||
|
||||
export default function mapSelf(children) {
|
||||
// return ReactFragment
|
||||
return React.Children.map(children, mirror);
|
||||
}
|
||||
2
web/node_modules/rc-util/es/Children/toArray.d.ts
generated
vendored
Normal file
2
web/node_modules/rc-util/es/Children/toArray.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import React from 'react';
|
||||
export default function toArray(children: React.ReactNode): React.ReactElement[];
|
||||
19
web/node_modules/rc-util/es/Children/toArray.js
generated
vendored
Normal file
19
web/node_modules/rc-util/es/Children/toArray.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import { isFragment } from 'react-is';
|
||||
export default function toArray(children) {
|
||||
var ret = [];
|
||||
React.Children.forEach(children, function (child) {
|
||||
if (child === undefined || child === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Array.isArray(child)) {
|
||||
ret = ret.concat(toArray(child));
|
||||
} else if (isFragment(child) && child.props) {
|
||||
ret = ret.concat(toArray(child.props.children));
|
||||
} else {
|
||||
ret.push(child);
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
126
web/node_modules/rc-util/es/ContainerRender.js
generated
vendored
Normal file
126
web/node_modules/rc-util/es/ContainerRender.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
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 _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { 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 _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); }
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
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) {
|
||||
ReactDOM.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();
|
||||
}
|
||||
|
||||
ReactDOM.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;
|
||||
}(React.Component);
|
||||
|
||||
ContainerRender.propTypes = {
|
||||
autoMount: PropTypes.bool,
|
||||
autoDestroy: PropTypes.bool,
|
||||
visible: PropTypes.bool,
|
||||
forceRender: PropTypes.bool,
|
||||
parent: PropTypes.any,
|
||||
getComponent: PropTypes.func.isRequired,
|
||||
getContainer: PropTypes.func.isRequired,
|
||||
children: PropTypes.func.isRequired
|
||||
};
|
||||
ContainerRender.defaultProps = {
|
||||
autoMount: true,
|
||||
autoDestroy: true,
|
||||
forceRender: false
|
||||
};
|
||||
export { ContainerRender as default };
|
||||
9
web/node_modules/rc-util/es/Dom/addEventListener.js
generated
vendored
Normal file
9
web/node_modules/rc-util/es/Dom/addEventListener.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import addDOMEventListener from 'add-dom-event-listener';
|
||||
import ReactDOM from 'react-dom';
|
||||
export default function addEventListenerWrap(target, eventType, cb, option) {
|
||||
/* eslint camelcase: 2 */
|
||||
var callback = ReactDOM.unstable_batchedUpdates ? function run(e) {
|
||||
ReactDOM.unstable_batchedUpdates(cb, e);
|
||||
} : cb;
|
||||
return addDOMEventListener(target, eventType, callback, option);
|
||||
}
|
||||
3
web/node_modules/rc-util/es/Dom/canUseDom.js
generated
vendored
Normal file
3
web/node_modules/rc-util/es/Dom/canUseDom.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function canUseDom() {
|
||||
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
}
|
||||
27
web/node_modules/rc-util/es/Dom/class.js
generated
vendored
Normal file
27
web/node_modules/rc-util/es/Dom/class.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export function hasClass(node, className) {
|
||||
if (node.classList) {
|
||||
return node.classList.contains(className);
|
||||
}
|
||||
|
||||
var originClass = node.className;
|
||||
return " ".concat(originClass, " ").indexOf(" ".concat(className, " ")) > -1;
|
||||
}
|
||||
export function addClass(node, className) {
|
||||
if (node.classList) {
|
||||
node.classList.add(className);
|
||||
} else {
|
||||
if (!hasClass(node, className)) {
|
||||
node.className = "".concat(node.className, " ").concat(className);
|
||||
}
|
||||
}
|
||||
}
|
||||
export function removeClass(node, className) {
|
||||
if (node.classList) {
|
||||
node.classList.remove(className);
|
||||
} else {
|
||||
if (hasClass(node, className)) {
|
||||
var originClass = node.className;
|
||||
node.className = " ".concat(originClass, " ").replace(" ".concat(className, " "), ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
13
web/node_modules/rc-util/es/Dom/contains.js
generated
vendored
Normal file
13
web/node_modules/rc-util/es/Dom/contains.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export default function contains(root, n) {
|
||||
var node = n;
|
||||
|
||||
while (node) {
|
||||
if (node === root) {
|
||||
return true;
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
109
web/node_modules/rc-util/es/Dom/css.js
generated
vendored
Normal file
109
web/node_modules/rc-util/es/Dom/css.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
var PIXEL_PATTERN = /margin|padding|width|height|max|min|offset/;
|
||||
var removePixel = {
|
||||
left: true,
|
||||
top: true
|
||||
};
|
||||
var floatMap = {
|
||||
cssFloat: 1,
|
||||
styleFloat: 1,
|
||||
float: 1
|
||||
};
|
||||
|
||||
function getComputedStyle(node) {
|
||||
return node.nodeType === 1 ? node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
|
||||
}
|
||||
|
||||
function getStyleValue(node, type, value) {
|
||||
type = type.toLowerCase();
|
||||
|
||||
if (value === 'auto') {
|
||||
if (type === 'height') {
|
||||
return node.offsetHeight;
|
||||
}
|
||||
|
||||
if (type === 'width') {
|
||||
return node.offsetWidth;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(type in removePixel)) {
|
||||
removePixel[type] = PIXEL_PATTERN.test(type);
|
||||
}
|
||||
|
||||
return removePixel[type] ? parseFloat(value) || 0 : value;
|
||||
}
|
||||
|
||||
export function get(node, name) {
|
||||
var length = arguments.length;
|
||||
var style = getComputedStyle(node);
|
||||
name = floatMap[name] ? 'cssFloat' in node.style ? 'cssFloat' : 'styleFloat' : name;
|
||||
return length === 1 ? style : getStyleValue(node, name, style[name] || node.style[name]);
|
||||
}
|
||||
export function set(node, name, value) {
|
||||
var length = arguments.length;
|
||||
name = floatMap[name] ? 'cssFloat' in node.style ? 'cssFloat' : 'styleFloat' : name;
|
||||
|
||||
if (length === 3) {
|
||||
if (typeof value === 'number' && PIXEL_PATTERN.test(name)) {
|
||||
value = "".concat(value, "px");
|
||||
}
|
||||
|
||||
node.style[name] = value; // Number
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
for (var x in name) {
|
||||
if (name.hasOwnProperty(x)) {
|
||||
set(node, x, name[x]);
|
||||
}
|
||||
}
|
||||
|
||||
return getComputedStyle(node);
|
||||
}
|
||||
export function getOuterWidth(el) {
|
||||
if (el === document.body) {
|
||||
return document.documentElement.clientWidth;
|
||||
}
|
||||
|
||||
return el.offsetWidth;
|
||||
}
|
||||
export function getOuterHeight(el) {
|
||||
if (el === document.body) {
|
||||
return window.innerHeight || document.documentElement.clientHeight;
|
||||
}
|
||||
|
||||
return el.offsetHeight;
|
||||
}
|
||||
export function getDocSize() {
|
||||
var width = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth);
|
||||
var height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
|
||||
return {
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
export function getClientSize() {
|
||||
var width = document.documentElement.clientWidth;
|
||||
var height = window.innerHeight || document.documentElement.clientHeight;
|
||||
return {
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
export function getScroll() {
|
||||
return {
|
||||
scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
|
||||
scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
|
||||
};
|
||||
}
|
||||
export function getOffset(node) {
|
||||
var box = node.getBoundingClientRect();
|
||||
var docElem = document.documentElement; // < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
|
||||
|
||||
return {
|
||||
left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
|
||||
top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
|
||||
};
|
||||
}
|
||||
5
web/node_modules/rc-util/es/Dom/findDOMNode.d.ts
generated
vendored
Normal file
5
web/node_modules/rc-util/es/Dom/findDOMNode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/// <reference types="react" />
|
||||
/**
|
||||
* Return if a node is a DOM node. Else will return by `findDOMNode`
|
||||
*/
|
||||
export default function findDOMNode<T = Element | Text>(node: React.ReactInstance | HTMLElement): T;
|
||||
12
web/node_modules/rc-util/es/Dom/findDOMNode.js
generated
vendored
Normal file
12
web/node_modules/rc-util/es/Dom/findDOMNode.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import ReactDOM from 'react-dom';
|
||||
/**
|
||||
* Return if a node is a DOM node. Else will return by `findDOMNode`
|
||||
*/
|
||||
|
||||
export default function findDOMNode(node) {
|
||||
if (node instanceof HTMLElement) {
|
||||
return node;
|
||||
}
|
||||
|
||||
return ReactDOM.findDOMNode(node);
|
||||
}
|
||||
79
web/node_modules/rc-util/es/Dom/focus.js
generated
vendored
Normal file
79
web/node_modules/rc-util/es/Dom/focus.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
function hidden(node) {
|
||||
return node.style.display === 'none';
|
||||
}
|
||||
|
||||
function visible(node) {
|
||||
while (node) {
|
||||
if (node === document.body) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (hidden(node)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function focusable(node) {
|
||||
var nodeName = node.nodeName.toLowerCase();
|
||||
var tabIndex = parseInt(node.getAttribute('tabindex'), 10);
|
||||
var hasTabIndex = !isNaN(tabIndex) && tabIndex > -1;
|
||||
|
||||
if (visible(node)) {
|
||||
if (['input', 'select', 'textarea', 'button'].indexOf(nodeName) > -1) {
|
||||
return !node.disabled;
|
||||
} else if (nodeName === 'a') {
|
||||
return node.getAttribute('href') || hasTabIndex;
|
||||
}
|
||||
|
||||
return node.isContentEditable || hasTabIndex;
|
||||
}
|
||||
}
|
||||
|
||||
export function getFocusNodeList(node) {
|
||||
var res = [].slice.call(node.querySelectorAll('*'), 0).filter(function (child) {
|
||||
return focusable(child);
|
||||
});
|
||||
|
||||
if (focusable(node)) {
|
||||
res.unshift(node);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
var lastFocusElement = null;
|
||||
export function saveLastFocusNode() {
|
||||
lastFocusElement = document.activeElement;
|
||||
}
|
||||
export function clearLastFocusNode() {
|
||||
lastFocusElement = null;
|
||||
}
|
||||
export function backLastFocusNode() {
|
||||
if (lastFocusElement) {
|
||||
try {
|
||||
// 元素可能已经被移动了
|
||||
lastFocusElement.focus();
|
||||
/* eslint-disable no-empty */
|
||||
} catch (e) {} // empty
|
||||
|
||||
/* eslint-enable no-empty */
|
||||
|
||||
}
|
||||
}
|
||||
export function limitTabRange(node, e) {
|
||||
if (e.keyCode === 9) {
|
||||
var tabNodeList = getFocusNodeList(node);
|
||||
var lastTabNode = tabNodeList[e.shiftKey ? 0 : tabNodeList.length - 1];
|
||||
var leavingTab = lastTabNode === document.activeElement || node === document.activeElement;
|
||||
|
||||
if (leavingTab) {
|
||||
var target = tabNodeList[e.shiftKey ? tabNodeList.length - 1 : 0];
|
||||
target.focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
web/node_modules/rc-util/es/Dom/support.js
generated
vendored
Normal file
28
web/node_modules/rc-util/es/Dom/support.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import canUseDOM from './canUseDom';
|
||||
var animationEndEventNames = {
|
||||
WebkitAnimation: 'webkitAnimationEnd',
|
||||
OAnimation: 'oAnimationEnd',
|
||||
animation: 'animationend'
|
||||
};
|
||||
var transitionEventNames = {
|
||||
WebkitTransition: 'webkitTransitionEnd',
|
||||
OTransition: 'oTransitionEnd',
|
||||
transition: 'transitionend'
|
||||
};
|
||||
|
||||
function supportEnd(names) {
|
||||
var el = document.createElement('div');
|
||||
|
||||
for (var name in names) {
|
||||
if (names.hasOwnProperty(name) && el.style[name] !== undefined) {
|
||||
return {
|
||||
end: names[name]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export var animation = canUseDOM() && supportEnd(animationEndEventNames);
|
||||
export var transition = canUseDOM() && supportEnd(transitionEventNames);
|
||||
436
web/node_modules/rc-util/es/KeyCode.d.ts
generated
vendored
Normal file
436
web/node_modules/rc-util/es/KeyCode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,436 @@
|
||||
/**
|
||||
* @ignore
|
||||
* some key-codes definition and utils from closure-library
|
||||
* @author yiminghe@gmail.com
|
||||
*/
|
||||
declare const KeyCode: {
|
||||
/**
|
||||
* MAC_ENTER
|
||||
*/
|
||||
MAC_ENTER: number;
|
||||
/**
|
||||
* BACKSPACE
|
||||
*/
|
||||
BACKSPACE: number;
|
||||
/**
|
||||
* TAB
|
||||
*/
|
||||
TAB: number;
|
||||
/**
|
||||
* NUMLOCK on FF/Safari Mac
|
||||
*/
|
||||
NUM_CENTER: number;
|
||||
/**
|
||||
* ENTER
|
||||
*/
|
||||
ENTER: number;
|
||||
/**
|
||||
* SHIFT
|
||||
*/
|
||||
SHIFT: number;
|
||||
/**
|
||||
* CTRL
|
||||
*/
|
||||
CTRL: number;
|
||||
/**
|
||||
* ALT
|
||||
*/
|
||||
ALT: number;
|
||||
/**
|
||||
* PAUSE
|
||||
*/
|
||||
PAUSE: number;
|
||||
/**
|
||||
* CAPS_LOCK
|
||||
*/
|
||||
CAPS_LOCK: number;
|
||||
/**
|
||||
* ESC
|
||||
*/
|
||||
ESC: number;
|
||||
/**
|
||||
* SPACE
|
||||
*/
|
||||
SPACE: number;
|
||||
/**
|
||||
* PAGE_UP
|
||||
*/
|
||||
PAGE_UP: number;
|
||||
/**
|
||||
* PAGE_DOWN
|
||||
*/
|
||||
PAGE_DOWN: number;
|
||||
/**
|
||||
* END
|
||||
*/
|
||||
END: number;
|
||||
/**
|
||||
* HOME
|
||||
*/
|
||||
HOME: number;
|
||||
/**
|
||||
* LEFT
|
||||
*/
|
||||
LEFT: number;
|
||||
/**
|
||||
* UP
|
||||
*/
|
||||
UP: number;
|
||||
/**
|
||||
* RIGHT
|
||||
*/
|
||||
RIGHT: number;
|
||||
/**
|
||||
* DOWN
|
||||
*/
|
||||
DOWN: number;
|
||||
/**
|
||||
* PRINT_SCREEN
|
||||
*/
|
||||
PRINT_SCREEN: number;
|
||||
/**
|
||||
* INSERT
|
||||
*/
|
||||
INSERT: number;
|
||||
/**
|
||||
* DELETE
|
||||
*/
|
||||
DELETE: number;
|
||||
/**
|
||||
* ZERO
|
||||
*/
|
||||
ZERO: number;
|
||||
/**
|
||||
* ONE
|
||||
*/
|
||||
ONE: number;
|
||||
/**
|
||||
* TWO
|
||||
*/
|
||||
TWO: number;
|
||||
/**
|
||||
* THREE
|
||||
*/
|
||||
THREE: number;
|
||||
/**
|
||||
* FOUR
|
||||
*/
|
||||
FOUR: number;
|
||||
/**
|
||||
* FIVE
|
||||
*/
|
||||
FIVE: number;
|
||||
/**
|
||||
* SIX
|
||||
*/
|
||||
SIX: number;
|
||||
/**
|
||||
* SEVEN
|
||||
*/
|
||||
SEVEN: number;
|
||||
/**
|
||||
* EIGHT
|
||||
*/
|
||||
EIGHT: number;
|
||||
/**
|
||||
* NINE
|
||||
*/
|
||||
NINE: number;
|
||||
/**
|
||||
* QUESTION_MARK
|
||||
*/
|
||||
QUESTION_MARK: number;
|
||||
/**
|
||||
* A
|
||||
*/
|
||||
A: number;
|
||||
/**
|
||||
* B
|
||||
*/
|
||||
B: number;
|
||||
/**
|
||||
* C
|
||||
*/
|
||||
C: number;
|
||||
/**
|
||||
* D
|
||||
*/
|
||||
D: number;
|
||||
/**
|
||||
* E
|
||||
*/
|
||||
E: number;
|
||||
/**
|
||||
* F
|
||||
*/
|
||||
F: number;
|
||||
/**
|
||||
* G
|
||||
*/
|
||||
G: number;
|
||||
/**
|
||||
* H
|
||||
*/
|
||||
H: number;
|
||||
/**
|
||||
* I
|
||||
*/
|
||||
I: number;
|
||||
/**
|
||||
* J
|
||||
*/
|
||||
J: number;
|
||||
/**
|
||||
* K
|
||||
*/
|
||||
K: number;
|
||||
/**
|
||||
* L
|
||||
*/
|
||||
L: number;
|
||||
/**
|
||||
* M
|
||||
*/
|
||||
M: number;
|
||||
/**
|
||||
* N
|
||||
*/
|
||||
N: number;
|
||||
/**
|
||||
* O
|
||||
*/
|
||||
O: number;
|
||||
/**
|
||||
* P
|
||||
*/
|
||||
P: number;
|
||||
/**
|
||||
* Q
|
||||
*/
|
||||
Q: number;
|
||||
/**
|
||||
* R
|
||||
*/
|
||||
R: number;
|
||||
/**
|
||||
* S
|
||||
*/
|
||||
S: number;
|
||||
/**
|
||||
* T
|
||||
*/
|
||||
T: number;
|
||||
/**
|
||||
* U
|
||||
*/
|
||||
U: number;
|
||||
/**
|
||||
* V
|
||||
*/
|
||||
V: number;
|
||||
/**
|
||||
* W
|
||||
*/
|
||||
W: number;
|
||||
/**
|
||||
* X
|
||||
*/
|
||||
X: number;
|
||||
/**
|
||||
* Y
|
||||
*/
|
||||
Y: number;
|
||||
/**
|
||||
* Z
|
||||
*/
|
||||
Z: number;
|
||||
/**
|
||||
* META
|
||||
*/
|
||||
META: number;
|
||||
/**
|
||||
* WIN_KEY_RIGHT
|
||||
*/
|
||||
WIN_KEY_RIGHT: number;
|
||||
/**
|
||||
* CONTEXT_MENU
|
||||
*/
|
||||
CONTEXT_MENU: number;
|
||||
/**
|
||||
* NUM_ZERO
|
||||
*/
|
||||
NUM_ZERO: number;
|
||||
/**
|
||||
* NUM_ONE
|
||||
*/
|
||||
NUM_ONE: number;
|
||||
/**
|
||||
* NUM_TWO
|
||||
*/
|
||||
NUM_TWO: number;
|
||||
/**
|
||||
* NUM_THREE
|
||||
*/
|
||||
NUM_THREE: number;
|
||||
/**
|
||||
* NUM_FOUR
|
||||
*/
|
||||
NUM_FOUR: number;
|
||||
/**
|
||||
* NUM_FIVE
|
||||
*/
|
||||
NUM_FIVE: number;
|
||||
/**
|
||||
* NUM_SIX
|
||||
*/
|
||||
NUM_SIX: number;
|
||||
/**
|
||||
* NUM_SEVEN
|
||||
*/
|
||||
NUM_SEVEN: number;
|
||||
/**
|
||||
* NUM_EIGHT
|
||||
*/
|
||||
NUM_EIGHT: number;
|
||||
/**
|
||||
* NUM_NINE
|
||||
*/
|
||||
NUM_NINE: number;
|
||||
/**
|
||||
* NUM_MULTIPLY
|
||||
*/
|
||||
NUM_MULTIPLY: number;
|
||||
/**
|
||||
* NUM_PLUS
|
||||
*/
|
||||
NUM_PLUS: number;
|
||||
/**
|
||||
* NUM_MINUS
|
||||
*/
|
||||
NUM_MINUS: number;
|
||||
/**
|
||||
* NUM_PERIOD
|
||||
*/
|
||||
NUM_PERIOD: number;
|
||||
/**
|
||||
* NUM_DIVISION
|
||||
*/
|
||||
NUM_DIVISION: number;
|
||||
/**
|
||||
* F1
|
||||
*/
|
||||
F1: number;
|
||||
/**
|
||||
* F2
|
||||
*/
|
||||
F2: number;
|
||||
/**
|
||||
* F3
|
||||
*/
|
||||
F3: number;
|
||||
/**
|
||||
* F4
|
||||
*/
|
||||
F4: number;
|
||||
/**
|
||||
* F5
|
||||
*/
|
||||
F5: number;
|
||||
/**
|
||||
* F6
|
||||
*/
|
||||
F6: number;
|
||||
/**
|
||||
* F7
|
||||
*/
|
||||
F7: number;
|
||||
/**
|
||||
* F8
|
||||
*/
|
||||
F8: number;
|
||||
/**
|
||||
* F9
|
||||
*/
|
||||
F9: number;
|
||||
/**
|
||||
* F10
|
||||
*/
|
||||
F10: number;
|
||||
/**
|
||||
* F11
|
||||
*/
|
||||
F11: number;
|
||||
/**
|
||||
* F12
|
||||
*/
|
||||
F12: number;
|
||||
/**
|
||||
* NUMLOCK
|
||||
*/
|
||||
NUMLOCK: number;
|
||||
/**
|
||||
* SEMICOLON
|
||||
*/
|
||||
SEMICOLON: number;
|
||||
/**
|
||||
* DASH
|
||||
*/
|
||||
DASH: number;
|
||||
/**
|
||||
* EQUALS
|
||||
*/
|
||||
EQUALS: number;
|
||||
/**
|
||||
* COMMA
|
||||
*/
|
||||
COMMA: number;
|
||||
/**
|
||||
* PERIOD
|
||||
*/
|
||||
PERIOD: number;
|
||||
/**
|
||||
* SLASH
|
||||
*/
|
||||
SLASH: number;
|
||||
/**
|
||||
* APOSTROPHE
|
||||
*/
|
||||
APOSTROPHE: number;
|
||||
/**
|
||||
* SINGLE_QUOTE
|
||||
*/
|
||||
SINGLE_QUOTE: number;
|
||||
/**
|
||||
* OPEN_SQUARE_BRACKET
|
||||
*/
|
||||
OPEN_SQUARE_BRACKET: number;
|
||||
/**
|
||||
* BACKSLASH
|
||||
*/
|
||||
BACKSLASH: number;
|
||||
/**
|
||||
* CLOSE_SQUARE_BRACKET
|
||||
*/
|
||||
CLOSE_SQUARE_BRACKET: number;
|
||||
/**
|
||||
* WIN_KEY
|
||||
*/
|
||||
WIN_KEY: number;
|
||||
/**
|
||||
* MAC_FF_META
|
||||
*/
|
||||
MAC_FF_META: number;
|
||||
/**
|
||||
* WIN_IME
|
||||
*/
|
||||
WIN_IME: number;
|
||||
/**
|
||||
* whether text and modified key is entered at the same time.
|
||||
*/
|
||||
isTextModifyingKeyEvent: (e: KeyboardEvent) => boolean;
|
||||
/**
|
||||
* whether character is entered.
|
||||
*/
|
||||
isCharacterKey: (keyCode: number) => boolean;
|
||||
};
|
||||
export default KeyCode;
|
||||
623
web/node_modules/rc-util/es/KeyCode.js
generated
vendored
Normal file
623
web/node_modules/rc-util/es/KeyCode.js
generated
vendored
Normal file
@@ -0,0 +1,623 @@
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
};
|
||||
export default KeyCode;
|
||||
89
web/node_modules/rc-util/es/Portal.js
generated
vendored
Normal file
89
web/node_modules/rc-util/es/Portal.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
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 _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { 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 _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); }
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
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 ReactDOM.createPortal(this.props.children, this._container);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Portal;
|
||||
}(React.Component);
|
||||
|
||||
Portal.propTypes = {
|
||||
getContainer: PropTypes.func.isRequired,
|
||||
children: PropTypes.node.isRequired,
|
||||
didUpdate: PropTypes.func
|
||||
};
|
||||
export { Portal as default };
|
||||
253
web/node_modules/rc-util/es/PortalWrapper.js
generated
vendored
Normal file
253
web/node_modules/rc-util/es/PortalWrapper.js
generated
vendored
Normal file
@@ -0,0 +1,253 @@
|
||||
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 _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 _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { 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 _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); }
|
||||
|
||||
/* eslint-disable no-underscore-dangle,react/require-default-props */
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import { polyfill } from 'react-lifecycles-compat';
|
||||
import ContainerRender from './ContainerRender';
|
||||
import Portal from './Portal';
|
||||
import switchScrollingEffect from './switchScrollingEffect';
|
||||
import setStyle from './setStyle';
|
||||
var openCount = 0;
|
||||
var windowIsUndefined = !(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
var IS_REACT_16 = ('createPortal' in ReactDOM); // https://github.com/ant-design/ant-design/issues/19340
|
||||
// https://github.com/ant-design/ant-design/issues/19332
|
||||
|
||||
var cacheOverflow = {};
|
||||
|
||||
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.getParent = function () {
|
||||
var getContainer = _this.props.getContainer;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
_this.getContainer = function () {
|
||||
if (windowIsUndefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!_this.container) {
|
||||
_this.container = document.createElement('div');
|
||||
|
||||
var parent = _this.getParent();
|
||||
|
||||
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) {
|
||||
switchScrollingEffect(); // Must be set after switchScrollingEffect
|
||||
|
||||
cacheOverflow = setStyle({
|
||||
overflow: 'hidden',
|
||||
overflowX: 'hidden',
|
||||
overflowY: 'hidden'
|
||||
});
|
||||
} else if (!openCount) {
|
||||
setStyle(cacheOverflow);
|
||||
cacheOverflow = {};
|
||||
switchScrollingEffect(true);
|
||||
}
|
||||
};
|
||||
|
||||
var _visible = props.visible;
|
||||
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 visible = this.props.visible; // 离开时不会 render, 导到离开时数值不变,改用 func 。。
|
||||
|
||||
openCount = visible && openCount ? openCount - 1 : openCount;
|
||||
this.removeCurrentContainer(visible);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _this$props = this.props,
|
||||
children = _this$props.children,
|
||||
forceRender = _this$props.forceRender,
|
||||
visible = _this$props.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__*/React.createElement(ContainerRender, {
|
||||
parent: this,
|
||||
visible: visible,
|
||||
autoDestroy: false,
|
||||
getComponent: function getComponent() {
|
||||
var extra = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
return children(_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__*/React.createElement(Portal, {
|
||||
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) {
|
||||
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;
|
||||
}(React.Component);
|
||||
|
||||
PortalWrapper.propTypes = {
|
||||
wrapperClassName: PropTypes.string,
|
||||
forceRender: PropTypes.bool,
|
||||
getContainer: PropTypes.any,
|
||||
children: PropTypes.func,
|
||||
visible: PropTypes.bool
|
||||
};
|
||||
export default polyfill(PortalWrapper);
|
||||
49
web/node_modules/rc-util/es/PureRenderMixin.js
generated
vendored
Normal file
49
web/node_modules/rc-util/es/PureRenderMixin.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule ReactComponentWithPureRenderMixin
|
||||
*/
|
||||
var shallowEqual = require('shallowequal');
|
||||
|
||||
function shallowCompare(instance, nextProps, nextState) {
|
||||
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
|
||||
}
|
||||
/**
|
||||
* If your React component's render function is "pure", e.g. it will render the
|
||||
* same result given the same props and state, provide this mixin for a
|
||||
* considerable performance boost.
|
||||
*
|
||||
* Most React components have pure render functions.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* var ReactComponentWithPureRenderMixin =
|
||||
* require('ReactComponentWithPureRenderMixin');
|
||||
* React.createClass({
|
||||
* mixins: [ReactComponentWithPureRenderMixin],
|
||||
*
|
||||
* render: function() {
|
||||
* return <div className={this.props.className}>foo</div>;
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Note: This only checks shallow equality for props and state. If these contain
|
||||
* complex data structures this mixin may have false-negatives for deeper
|
||||
* differences. Only mixin to components which have simple props and state, or
|
||||
* use `forceUpdate()` when you know deep data structures have changed.
|
||||
*
|
||||
* See https://facebook.github.io/react/docs/pure-render-mixin.html
|
||||
*/
|
||||
|
||||
|
||||
var ReactComponentWithPureRenderMixin = {
|
||||
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
|
||||
return shallowCompare(this, nextProps, nextState);
|
||||
}
|
||||
};
|
||||
module.exports = ReactComponentWithPureRenderMixin;
|
||||
23
web/node_modules/rc-util/es/createChainedFunction.js
generated
vendored
Normal file
23
web/node_modules/rc-util/es/createChainedFunction.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Safe chained function
|
||||
*
|
||||
* Will only create a new function if needed,
|
||||
* otherwise will pass back existing functions or null.
|
||||
*
|
||||
* @returns {function|null}
|
||||
*/
|
||||
export default function createChainedFunction() {
|
||||
var args = [].slice.call(arguments, 0);
|
||||
|
||||
if (args.length === 1) {
|
||||
return args[0];
|
||||
}
|
||||
|
||||
return function chainedFunction() {
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (args[i] && args[i].apply) {
|
||||
args[i].apply(this, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
86
web/node_modules/rc-util/es/debug/diff.js
generated
vendored
Normal file
86
web/node_modules/rc-util/es/debug/diff.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
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; }
|
||||
|
||||
/* eslint no-proto: 0 */
|
||||
function createArray() {
|
||||
var arr = [];
|
||||
arr.__proto__ = new Array();
|
||||
|
||||
arr.__proto__.format = function toString() {
|
||||
return this.map(function (obj) {
|
||||
return _objectSpread({}, obj, {
|
||||
path: obj.path.join(' > ')
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
arr.__proto__.toString = function toString() {
|
||||
return JSON.stringify(this.format(), null, 2);
|
||||
};
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
export default function diff(obj1, obj2) {
|
||||
var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
|
||||
var path = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
||||
var diffList = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : createArray();
|
||||
if (depth <= 0) return diffList;
|
||||
var keys = new Set([].concat(_toConsumableArray(Object.keys(obj1)), _toConsumableArray(Object.keys(obj2))));
|
||||
keys.forEach(function (key) {
|
||||
var value1 = obj1[key];
|
||||
var value2 = obj2[key]; // Same value
|
||||
|
||||
if (value1 === value2) return;
|
||||
|
||||
var type1 = _typeof(value1);
|
||||
|
||||
var type2 = _typeof(value2); // Diff type
|
||||
|
||||
|
||||
if (type1 !== type2) {
|
||||
diffList.push({
|
||||
path: path.concat(key),
|
||||
value1: value1,
|
||||
value2: value2
|
||||
});
|
||||
return;
|
||||
} // NaN
|
||||
|
||||
|
||||
if (Number.isNaN(value1) && Number.isNaN(value2)) {
|
||||
return;
|
||||
} // Object & Array
|
||||
|
||||
|
||||
if (type1 === 'object' && value1 !== null && value2 !== null) {
|
||||
diff(value1, value2, depth - 1, path.concat(key), diffList);
|
||||
return;
|
||||
} // Rest
|
||||
|
||||
|
||||
diffList.push({
|
||||
path: path.concat(key),
|
||||
value1: value1,
|
||||
value2: value2
|
||||
});
|
||||
});
|
||||
return diffList;
|
||||
}
|
||||
5
web/node_modules/rc-util/es/deprecated.js
generated
vendored
Normal file
5
web/node_modules/rc-util/es/deprecated.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default function deprecated(props, instead, component) {
|
||||
if (typeof window !== 'undefined' && window.console && window.console.error) {
|
||||
window.console.error("Warning: ".concat(props, " is deprecated at [ ").concat(component, " ], ") + "use [ ".concat(instead, " ] instead of it."));
|
||||
}
|
||||
}
|
||||
94
web/node_modules/rc-util/es/getContainerRenderMixin.js
generated
vendored
Normal file
94
web/node_modules/rc-util/es/getContainerRenderMixin.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
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; }
|
||||
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
function defaultGetContainer() {
|
||||
var container = document.createElement('div');
|
||||
document.body.appendChild(container);
|
||||
return container;
|
||||
}
|
||||
|
||||
export default function getContainerRenderMixin(config) {
|
||||
var _config$autoMount = config.autoMount,
|
||||
autoMount = _config$autoMount === void 0 ? true : _config$autoMount,
|
||||
_config$autoDestroy = config.autoDestroy,
|
||||
autoDestroy = _config$autoDestroy === void 0 ? true : _config$autoDestroy,
|
||||
isVisible = config.isVisible,
|
||||
isForceRender = config.isForceRender,
|
||||
getComponent = config.getComponent,
|
||||
_config$getContainer = config.getContainer,
|
||||
getContainer = _config$getContainer === void 0 ? defaultGetContainer : _config$getContainer;
|
||||
var mixin;
|
||||
|
||||
function _renderComponent(instance, componentArg, ready) {
|
||||
if (!isVisible || instance._component || isVisible(instance) || isForceRender && isForceRender(instance)) {
|
||||
if (!instance._container) {
|
||||
instance._container = getContainer(instance);
|
||||
}
|
||||
|
||||
var component;
|
||||
|
||||
if (instance.getComponent) {
|
||||
component = instance.getComponent(componentArg);
|
||||
} else {
|
||||
component = getComponent(instance, componentArg);
|
||||
}
|
||||
|
||||
ReactDOM.unstable_renderSubtreeIntoContainer(instance, component, instance._container, function callback() {
|
||||
instance._component = this;
|
||||
|
||||
if (ready) {
|
||||
ready.call(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (autoMount) {
|
||||
mixin = _objectSpread({}, mixin, {
|
||||
componentDidMount: function componentDidMount() {
|
||||
_renderComponent(this);
|
||||
},
|
||||
componentDidUpdate: function componentDidUpdate() {
|
||||
_renderComponent(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!autoMount || !autoDestroy) {
|
||||
mixin = _objectSpread({}, mixin, {
|
||||
renderComponent: function renderComponent(componentArg, ready) {
|
||||
_renderComponent(this, componentArg, ready);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _removeContainer(instance) {
|
||||
if (instance._container) {
|
||||
var container = instance._container;
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
container.parentNode.removeChild(container);
|
||||
instance._container = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (autoDestroy) {
|
||||
mixin = _objectSpread({}, mixin, {
|
||||
componentWillUnmount: function componentWillUnmount() {
|
||||
_removeContainer(this);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mixin = _objectSpread({}, mixin, {
|
||||
removeContainer: function removeContainer() {
|
||||
_removeContainer(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mixin;
|
||||
}
|
||||
36
web/node_modules/rc-util/es/getScrollBarSize.js
generated
vendored
Normal file
36
web/node_modules/rc-util/es/getScrollBarSize.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
var cached;
|
||||
export default 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;
|
||||
}
|
||||
4
web/node_modules/rc-util/es/guid.js
generated
vendored
Normal file
4
web/node_modules/rc-util/es/guid.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var seed = 0;
|
||||
export default function guid() {
|
||||
return "".concat(Date.now(), "_").concat(seed++);
|
||||
}
|
||||
2
web/node_modules/rc-util/es/hooks/useEffect.d.ts
generated
vendored
Normal file
2
web/node_modules/rc-util/es/hooks/useEffect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/** As `React.useEffect` but pass origin value in callback and not need care deps length change. */
|
||||
export default function useEffect(callback: (prevDeps: any[]) => void, deps: any[]): void;
|
||||
15
web/node_modules/rc-util/es/hooks/useEffect.js
generated
vendored
Normal file
15
web/node_modules/rc-util/es/hooks/useEffect.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import * as React from 'react';
|
||||
/** As `React.useEffect` but pass origin value in callback and not need care deps length change. */
|
||||
|
||||
export default function useEffect(callback, deps) {
|
||||
var prevRef = React.useRef(deps);
|
||||
React.useEffect(function () {
|
||||
if (deps.length !== prevRef.current.length || deps.some(function (dep, index) {
|
||||
return dep !== prevRef.current[index];
|
||||
})) {
|
||||
callback(prevRef.current);
|
||||
}
|
||||
|
||||
prevRef.current = deps;
|
||||
});
|
||||
}
|
||||
1
web/node_modules/rc-util/es/hooks/useMemo.d.ts
generated
vendored
Normal file
1
web/node_modules/rc-util/es/hooks/useMemo.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function useMemo<Value, Condition = any[]>(getValue: () => Value, condition: Condition, shouldUpdate: (prev: Condition, next: Condition) => boolean): Value;
|
||||
11
web/node_modules/rc-util/es/hooks/useMemo.js
generated
vendored
Normal file
11
web/node_modules/rc-util/es/hooks/useMemo.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as React from 'react';
|
||||
export default function useMemo(getValue, condition, shouldUpdate) {
|
||||
var cacheRef = React.useRef({});
|
||||
|
||||
if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
||||
cacheRef.current.value = getValue();
|
||||
cacheRef.current.condition = condition;
|
||||
}
|
||||
|
||||
return cacheRef.current.value;
|
||||
}
|
||||
6
web/node_modules/rc-util/es/hooks/useMergedState.d.ts
generated
vendored
Normal file
6
web/node_modules/rc-util/es/hooks/useMergedState.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export default function useControlledState<T, R = T>(defaultStateValue: T | (() => T), option?: {
|
||||
defaultValue?: T | (() => T);
|
||||
value?: T;
|
||||
onChange?: (value: T, prevValue: T) => void;
|
||||
postState?: (value: T) => T;
|
||||
}): [R, (value: T) => void];
|
||||
51
web/node_modules/rc-util/es/hooks/useMergedState.js
generated
vendored
Normal file
51
web/node_modules/rc-util/es/hooks/useMergedState.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import * as React from 'react';
|
||||
export default function useControlledState(defaultStateValue, option) {
|
||||
var _ref = option || {},
|
||||
defaultValue = _ref.defaultValue,
|
||||
value = _ref.value,
|
||||
onChange = _ref.onChange,
|
||||
postState = _ref.postState;
|
||||
|
||||
var _React$useState = React.useState(function () {
|
||||
if (value !== undefined) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (defaultValue !== undefined) {
|
||||
return typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
||||
}
|
||||
|
||||
return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue;
|
||||
}),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
innerValue = _React$useState2[0],
|
||||
setInnerValue = _React$useState2[1];
|
||||
|
||||
var mergedValue = value !== undefined ? value : innerValue;
|
||||
|
||||
if (postState) {
|
||||
mergedValue = postState(mergedValue);
|
||||
}
|
||||
|
||||
function triggerChange(newValue) {
|
||||
setInnerValue(newValue);
|
||||
|
||||
if (mergedValue !== newValue && onChange) {
|
||||
onChange(newValue, mergedValue);
|
||||
}
|
||||
}
|
||||
|
||||
return [mergedValue, triggerChange];
|
||||
}
|
||||
29
web/node_modules/rc-util/es/pickAttrs.js
generated
vendored
Normal file
29
web/node_modules/rc-util/es/pickAttrs.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable max-len */
|
||||
var attributes = "accept acceptCharset accessKey action allowFullScreen allowTransparency\n alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n charSet checked classID className colSpan cols content contentEditable contextMenu\n controls coords crossOrigin data dateTime default defer dir disabled download draggable\n encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n mediaGroup method min minLength multiple muted name noValidate nonce open\n optimum pattern placeholder poster preload radioGroup readOnly rel required\n reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n summary tabIndex target title type useMap value width wmode wrap".replace(/\s+/g, ' ').replace(/\t|\n|\r/g, '').split(' ');
|
||||
var eventsName = "onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError".replace(/\s+/g, ' ').replace(/\t|\n|\r/g, '').split(' ');
|
||||
/* eslint-enable max-len */
|
||||
|
||||
var attrsPrefix = ['data', 'aria'];
|
||||
export default function pickAttrs(props) {
|
||||
var attrs = {};
|
||||
|
||||
var _loop = function _loop(key) {
|
||||
if (attributes.indexOf(key) > -1 || eventsName.indexOf(key) > -1) {
|
||||
attrs[key] = props[key];
|
||||
/* eslint-disable no-loop-func */
|
||||
} else if (attrsPrefix.map(function (prefix) {
|
||||
return new RegExp("^".concat(prefix));
|
||||
}).some(function (reg) {
|
||||
return key.replace(reg, '') !== key;
|
||||
})) {
|
||||
/* eslint-enable no-loop-func */
|
||||
attrs[key] = props[key];
|
||||
}
|
||||
};
|
||||
|
||||
for (var key in props) {
|
||||
_loop(key);
|
||||
}
|
||||
|
||||
return attrs;
|
||||
}
|
||||
7
web/node_modules/rc-util/es/ref.d.ts
generated
vendored
Normal file
7
web/node_modules/rc-util/es/ref.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as React from 'react';
|
||||
export declare function fillRef<T>(ref: React.Ref<T>, node: T): void;
|
||||
/**
|
||||
* Merge refs into one ref function to support ref passing.
|
||||
*/
|
||||
export declare function composeRef<T>(...refs: React.Ref<T>[]): React.Ref<T>;
|
||||
export declare function supportRef(nodeOrComponent: any): boolean;
|
||||
38
web/node_modules/rc-util/es/ref.js
generated
vendored
Normal file
38
web/node_modules/rc-util/es/ref.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
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); }
|
||||
|
||||
export function fillRef(ref, node) {
|
||||
if (typeof ref === 'function') {
|
||||
ref(node);
|
||||
} else if (_typeof(ref) === 'object' && ref && 'current' in ref) {
|
||||
ref.current = node;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge refs into one ref function to support ref passing.
|
||||
*/
|
||||
|
||||
export function composeRef() {
|
||||
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
refs[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return function (node) {
|
||||
refs.forEach(function (ref) {
|
||||
fillRef(ref, node);
|
||||
});
|
||||
};
|
||||
}
|
||||
export function supportRef(nodeOrComponent) {
|
||||
// Function component node
|
||||
if (nodeOrComponent.type && nodeOrComponent.type.prototype && !nodeOrComponent.type.prototype.render) {
|
||||
return false;
|
||||
} // Class component
|
||||
|
||||
|
||||
if (typeof nodeOrComponent === 'function' && nodeOrComponent.prototype && !nodeOrComponent.prototype.render) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/* eslint-enable */
|
||||
12
web/node_modules/rc-util/es/setStyle.d.ts
generated
vendored
Normal file
12
web/node_modules/rc-util/es/setStyle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
export interface SetStyleOptions {
|
||||
element?: HTMLElement;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
declare function setStyle(style: React.CSSProperties, options?: SetStyleOptions): React.CSSProperties;
|
||||
export default setStyle;
|
||||
23
web/node_modules/rc-util/es/setStyle.js
generated
vendored
Normal file
23
web/node_modules/rc-util/es/setStyle.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
export default setStyle;
|
||||
40
web/node_modules/rc-util/es/switchScrollingEffect.js
generated
vendored
Normal file
40
web/node_modules/rc-util/es/switchScrollingEffect.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import getScrollBarSize from './getScrollBarSize';
|
||||
import setStyle from './setStyle';
|
||||
|
||||
function isBodyOverflowing() {
|
||||
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
|
||||
}
|
||||
|
||||
var cacheStyle = {};
|
||||
export default (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;
|
||||
setStyle(cacheStyle);
|
||||
cacheStyle = {};
|
||||
document.body.className = bodyClassName.replace(scrollingEffectClassNameReg, '').trim();
|
||||
return;
|
||||
}
|
||||
|
||||
var scrollBarSize = getScrollBarSize();
|
||||
|
||||
if (scrollBarSize) {
|
||||
cacheStyle = setStyle({
|
||||
position: 'relative',
|
||||
width: "calc(100% - ".concat(scrollBarSize, "px)")
|
||||
});
|
||||
|
||||
if (!scrollingEffectClassNameReg.test(bodyClassName)) {
|
||||
var addClassName = "".concat(bodyClassName, " ").concat(scrollingEffectClassName);
|
||||
document.body.className = addClassName.trim();
|
||||
}
|
||||
}
|
||||
});
|
||||
8
web/node_modules/rc-util/es/test/domHook.d.ts
generated
vendored
Normal file
8
web/node_modules/rc-util/es/test/domHook.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export declare type ElementClass = Function;
|
||||
export declare type Property = PropertyDescriptor | Function;
|
||||
export declare function spyElementPrototypes<T extends ElementClass>(elementClass: T, properties: Record<string, Property>): {
|
||||
mockRestore(): void;
|
||||
};
|
||||
export declare function spyElementPrototype(Element: ElementClass, propName: string, property: Property): {
|
||||
mockRestore(): void;
|
||||
};
|
||||
68
web/node_modules/rc-util/es/test/domHook.js
generated
vendored
Normal file
68
web/node_modules/rc-util/es/test/domHook.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
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; }
|
||||
|
||||
/* eslint-disable no-param-reassign */
|
||||
var NO_EXIST = {
|
||||
__NOT_EXIST: true
|
||||
};
|
||||
export function spyElementPrototypes(elementClass, properties) {
|
||||
var propNames = Object.keys(properties);
|
||||
var originDescriptors = {};
|
||||
propNames.forEach(function (propName) {
|
||||
var originDescriptor = Object.getOwnPropertyDescriptor(elementClass.prototype, propName);
|
||||
originDescriptors[propName] = originDescriptor || NO_EXIST;
|
||||
var spyProp = properties[propName];
|
||||
|
||||
if (typeof spyProp === 'function') {
|
||||
// If is a function
|
||||
elementClass.prototype[propName] = function spyFunc() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return spyProp.call.apply(spyProp, [this, originDescriptor].concat(args));
|
||||
};
|
||||
} else {
|
||||
// Otherwise tread as a property
|
||||
Object.defineProperty(elementClass.prototype, propName, _objectSpread({}, spyProp, {
|
||||
set: function set(value) {
|
||||
if (spyProp.set) {
|
||||
return spyProp.set.call(this, originDescriptor, value);
|
||||
}
|
||||
|
||||
return originDescriptor.set(value);
|
||||
},
|
||||
get: function get() {
|
||||
if (spyProp.get) {
|
||||
return spyProp.get.call(this, originDescriptor);
|
||||
}
|
||||
|
||||
return originDescriptor.get();
|
||||
},
|
||||
configurable: true
|
||||
}));
|
||||
}
|
||||
});
|
||||
return {
|
||||
mockRestore: function mockRestore() {
|
||||
propNames.forEach(function (propName) {
|
||||
var originDescriptor = originDescriptors[propName];
|
||||
|
||||
if (originDescriptor === NO_EXIST) {
|
||||
delete elementClass.prototype[propName];
|
||||
} else if (typeof originDescriptor === 'function') {
|
||||
elementClass.prototype[propName] = originDescriptor;
|
||||
} else {
|
||||
Object.defineProperty(elementClass.prototype, propName, originDescriptor);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
export function spyElementPrototype(Element, propName, property) {
|
||||
return spyElementPrototypes(Element, _defineProperty({}, propName, property));
|
||||
}
|
||||
/* eslint-enable */
|
||||
27
web/node_modules/rc-util/es/unsafeLifecyclesPolyfill.js
generated
vendored
Normal file
27
web/node_modules/rc-util/es/unsafeLifecyclesPolyfill.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from '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 (!React.Profiler) {
|
||||
return Component;
|
||||
} // Here polyfill get started
|
||||
|
||||
|
||||
prototype.UNSAFE_componentWillReceiveProps = prototype.componentWillReceiveProps;
|
||||
delete prototype.componentWillReceiveProps;
|
||||
return Component;
|
||||
};
|
||||
|
||||
export default unsafeLifecyclesPolyfill;
|
||||
1
web/node_modules/rc-util/es/utils/get.d.ts
generated
vendored
Normal file
1
web/node_modules/rc-util/es/utils/get.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function get<T = any>(entity: any, path: (string | number)[]): any;
|
||||
13
web/node_modules/rc-util/es/utils/get.js
generated
vendored
Normal file
13
web/node_modules/rc-util/es/utils/get.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export default function get(entity, path) {
|
||||
var current = entity;
|
||||
|
||||
for (var i = 0; i < path.length; i += 1) {
|
||||
if (current === null || current === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
current = current[path[i]];
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
1
web/node_modules/rc-util/es/utils/set.d.ts
generated
vendored
Normal file
1
web/node_modules/rc-util/es/utils/set.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function set<Entity = any, Output = Entity, Value = any>(entity: Entity, paths: (string | number)[], value: Value): Output;
|
||||
46
web/node_modules/rc-util/es/utils/set.js
generated
vendored
Normal file
46
web/node_modules/rc-util/es/utils/set.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
export default function set(entity, paths, value) {
|
||||
if (!paths.length) {
|
||||
return value;
|
||||
}
|
||||
|
||||
var _paths = _toArray(paths),
|
||||
path = _paths[0],
|
||||
restPath = _paths.slice(1);
|
||||
|
||||
var clone;
|
||||
|
||||
if (!entity && typeof path === 'number') {
|
||||
clone = [];
|
||||
} else if (Array.isArray(entity)) {
|
||||
clone = _toConsumableArray(entity);
|
||||
} else {
|
||||
clone = _objectSpread({}, entity);
|
||||
}
|
||||
|
||||
clone[path] = set(clone[path], restPath, value);
|
||||
return clone;
|
||||
}
|
||||
7
web/node_modules/rc-util/es/warn.js
generated
vendored
Normal file
7
web/node_modules/rc-util/es/warn.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export default function warn(msg) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof console !== 'undefined' && console.warn) {
|
||||
console.warn(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
7
web/node_modules/rc-util/es/warning.d.ts
generated
vendored
Normal file
7
web/node_modules/rc-util/es/warning.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export declare function warning(valid: boolean, message: string): void;
|
||||
export declare function note(valid: boolean, message: string): void;
|
||||
export declare function resetWarned(): void;
|
||||
export declare function call(method: (valid: boolean, message: string) => void, valid: boolean, message: string): void;
|
||||
export declare function warningOnce(valid: boolean, message: string): void;
|
||||
export declare function noteOnce(valid: boolean, message: string): void;
|
||||
export default warningOnce;
|
||||
31
web/node_modules/rc-util/es/warning.js
generated
vendored
Normal file
31
web/node_modules/rc-util/es/warning.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/* eslint-disable no-console */
|
||||
var warned = {};
|
||||
export function warning(valid, message) {
|
||||
// Support uglify
|
||||
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
||||
console.error("Warning: ".concat(message));
|
||||
}
|
||||
}
|
||||
export function note(valid, message) {
|
||||
// Support uglify
|
||||
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
||||
console.warn("Note: ".concat(message));
|
||||
}
|
||||
}
|
||||
export function resetWarned() {
|
||||
warned = {};
|
||||
}
|
||||
export function call(method, valid, message) {
|
||||
if (!valid && !warned[message]) {
|
||||
method(false, message);
|
||||
warned[message] = true;
|
||||
}
|
||||
}
|
||||
export function warningOnce(valid, message) {
|
||||
call(warning, valid, message);
|
||||
}
|
||||
export function noteOnce(valid, message) {
|
||||
call(note, valid, message);
|
||||
}
|
||||
export default warningOnce;
|
||||
/* eslint-enable */
|
||||
Reference in New Issue
Block a user