Latest updates from IceHrmPro
This commit is contained in:
217
web/node_modules/rc-collapse/es/Collapse.js
generated
vendored
Normal file
217
web/node_modules/rc-collapse/es/Collapse.js
generated
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
import React, { Component, Children } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import CollapsePanel from './Panel';
|
||||
import openAnimationFactory from './openAnimationFactory';
|
||||
import classNames from 'classnames';
|
||||
import { isFragment } from 'react-is';
|
||||
import shallowEqual from 'shallowequal';
|
||||
import { polyfill } from 'react-lifecycles-compat';
|
||||
|
||||
function toArray(activeKey) {
|
||||
var currentActiveKey = activeKey;
|
||||
if (!Array.isArray(currentActiveKey)) {
|
||||
currentActiveKey = currentActiveKey ? [currentActiveKey] : [];
|
||||
}
|
||||
return currentActiveKey.map(function (key) {
|
||||
return String(key);
|
||||
});
|
||||
}
|
||||
|
||||
var Collapse = function (_Component) {
|
||||
_inherits(Collapse, _Component);
|
||||
|
||||
function Collapse(props) {
|
||||
_classCallCheck(this, Collapse);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (Collapse.__proto__ || Object.getPrototypeOf(Collapse)).call(this, props));
|
||||
|
||||
_initialiseProps.call(_this);
|
||||
|
||||
var activeKey = props.activeKey,
|
||||
defaultActiveKey = props.defaultActiveKey;
|
||||
|
||||
var currentActiveKey = defaultActiveKey;
|
||||
if ('activeKey' in props) {
|
||||
currentActiveKey = activeKey;
|
||||
}
|
||||
|
||||
_this.state = {
|
||||
openAnimation: props.openAnimation || openAnimationFactory(props.prefixCls),
|
||||
activeKey: toArray(currentActiveKey)
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Collapse, [{
|
||||
key: 'shouldComponentUpdate',
|
||||
value: function shouldComponentUpdate(nextProps, nextState) {
|
||||
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _classNames;
|
||||
|
||||
var _props = this.props,
|
||||
prefixCls = _props.prefixCls,
|
||||
className = _props.className,
|
||||
style = _props.style,
|
||||
accordion = _props.accordion;
|
||||
|
||||
var collapseClassName = classNames((_classNames = {}, _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, className, !!className), _classNames));
|
||||
return React.createElement(
|
||||
'div',
|
||||
{ className: collapseClassName, style: style, role: accordion ? 'tablist' : null },
|
||||
this.getItems()
|
||||
);
|
||||
}
|
||||
}], [{
|
||||
key: 'getDerivedStateFromProps',
|
||||
value: function getDerivedStateFromProps(nextProps) {
|
||||
var newState = {};
|
||||
if ('activeKey' in nextProps) {
|
||||
newState.activeKey = toArray(nextProps.activeKey);
|
||||
}
|
||||
if ('openAnimation' in nextProps) {
|
||||
newState.openAnimation = nextProps.openAnimation;
|
||||
}
|
||||
return newState.activeKey || newState.openAnimation ? newState : null;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Collapse;
|
||||
}(Component);
|
||||
|
||||
var _initialiseProps = function _initialiseProps() {
|
||||
var _this2 = this;
|
||||
|
||||
this.onClickItem = function (key) {
|
||||
var activeKey = _this2.state.activeKey;
|
||||
if (_this2.props.accordion) {
|
||||
activeKey = activeKey[0] === key ? [] : [key];
|
||||
} else {
|
||||
activeKey = [].concat(_toConsumableArray(activeKey));
|
||||
var index = activeKey.indexOf(key);
|
||||
var isActive = index > -1;
|
||||
if (isActive) {
|
||||
// remove active state
|
||||
activeKey.splice(index, 1);
|
||||
} else {
|
||||
activeKey.push(key);
|
||||
}
|
||||
}
|
||||
_this2.setActiveKey(activeKey);
|
||||
};
|
||||
|
||||
this.getNewChild = function (child, index) {
|
||||
if (!child) return null;
|
||||
|
||||
var activeKey = _this2.state.activeKey;
|
||||
var _props2 = _this2.props,
|
||||
prefixCls = _props2.prefixCls,
|
||||
accordion = _props2.accordion,
|
||||
destroyInactivePanel = _props2.destroyInactivePanel,
|
||||
expandIcon = _props2.expandIcon;
|
||||
// If there is no key provide, use the panel order as default key
|
||||
|
||||
var key = child.key || String(index);
|
||||
var _child$props = child.props,
|
||||
header = _child$props.header,
|
||||
headerClass = _child$props.headerClass,
|
||||
disabled = _child$props.disabled;
|
||||
|
||||
var isActive = false;
|
||||
if (accordion) {
|
||||
isActive = activeKey[0] === key;
|
||||
} else {
|
||||
isActive = activeKey.indexOf(key) > -1;
|
||||
}
|
||||
|
||||
var props = {
|
||||
key: key,
|
||||
panelKey: key,
|
||||
header: header,
|
||||
headerClass: headerClass,
|
||||
isActive: isActive,
|
||||
prefixCls: prefixCls,
|
||||
destroyInactivePanel: destroyInactivePanel,
|
||||
openAnimation: _this2.state.openAnimation,
|
||||
accordion: accordion,
|
||||
children: child.props.children,
|
||||
onItemClick: disabled ? null : _this2.onClickItem,
|
||||
expandIcon: expandIcon
|
||||
};
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/20479
|
||||
if (typeof child.type === 'string') {
|
||||
return child;
|
||||
}
|
||||
|
||||
return React.cloneElement(child, props);
|
||||
};
|
||||
|
||||
this.getItems = function () {
|
||||
var children = _this2.props.children;
|
||||
|
||||
var childList = isFragment(children) ? children.props.children : children;
|
||||
var newChildren = Children.map(childList, _this2.getNewChild);
|
||||
|
||||
// ref: https://github.com/ant-design/ant-design/issues/13884
|
||||
if (isFragment(children)) {
|
||||
return React.createElement(
|
||||
React.Fragment,
|
||||
null,
|
||||
newChildren
|
||||
);
|
||||
}
|
||||
|
||||
return newChildren;
|
||||
};
|
||||
|
||||
this.setActiveKey = function (activeKey) {
|
||||
if (!('activeKey' in _this2.props)) {
|
||||
_this2.setState({ activeKey: activeKey });
|
||||
}
|
||||
_this2.props.onChange(_this2.props.accordion ? activeKey[0] : activeKey);
|
||||
};
|
||||
};
|
||||
|
||||
Collapse.propTypes = {
|
||||
children: PropTypes.any,
|
||||
prefixCls: PropTypes.string,
|
||||
activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
|
||||
defaultActiveKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
|
||||
openAnimation: PropTypes.object,
|
||||
onChange: PropTypes.func,
|
||||
accordion: PropTypes.bool,
|
||||
className: PropTypes.string,
|
||||
style: PropTypes.object,
|
||||
destroyInactivePanel: PropTypes.bool,
|
||||
expandIcon: PropTypes.func
|
||||
};
|
||||
|
||||
Collapse.defaultProps = {
|
||||
prefixCls: 'rc-collapse',
|
||||
onChange: function onChange() {},
|
||||
|
||||
accordion: false,
|
||||
destroyInactivePanel: false
|
||||
};
|
||||
|
||||
Collapse.Panel = CollapsePanel;
|
||||
|
||||
polyfill(Collapse);
|
||||
|
||||
export default Collapse;
|
||||
161
web/node_modules/rc-collapse/es/Panel.js
generated
vendored
Normal file
161
web/node_modules/rc-collapse/es/Panel.js
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import PanelContent from './PanelContent';
|
||||
import Animate from 'rc-animate';
|
||||
import shallowEqual from 'shallowequal';
|
||||
|
||||
var CollapsePanel = function (_Component) {
|
||||
_inherits(CollapsePanel, _Component);
|
||||
|
||||
function CollapsePanel() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
_classCallCheck(this, CollapsePanel);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = CollapsePanel.__proto__ || Object.getPrototypeOf(CollapsePanel)).call.apply(_ref, [this].concat(args))), _this), _this.handleItemClick = function () {
|
||||
var _this$props = _this.props,
|
||||
onItemClick = _this$props.onItemClick,
|
||||
panelKey = _this$props.panelKey;
|
||||
|
||||
|
||||
if (typeof onItemClick === 'function') {
|
||||
onItemClick(panelKey);
|
||||
}
|
||||
}, _this.handleKeyPress = function (e) {
|
||||
if (e.key === 'Enter' || e.keyCode === 13 || e.which === 13) {
|
||||
_this.handleItemClick();
|
||||
}
|
||||
}, _temp), _possibleConstructorReturn(_this, _ret);
|
||||
}
|
||||
|
||||
_createClass(CollapsePanel, [{
|
||||
key: 'shouldComponentUpdate',
|
||||
value: function shouldComponentUpdate(nextProps) {
|
||||
return !shallowEqual(this.props, nextProps);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _classNames2;
|
||||
|
||||
var _props = this.props,
|
||||
className = _props.className,
|
||||
id = _props.id,
|
||||
style = _props.style,
|
||||
prefixCls = _props.prefixCls,
|
||||
header = _props.header,
|
||||
headerClass = _props.headerClass,
|
||||
children = _props.children,
|
||||
isActive = _props.isActive,
|
||||
showArrow = _props.showArrow,
|
||||
destroyInactivePanel = _props.destroyInactivePanel,
|
||||
disabled = _props.disabled,
|
||||
accordion = _props.accordion,
|
||||
forceRender = _props.forceRender,
|
||||
expandIcon = _props.expandIcon,
|
||||
extra = _props.extra;
|
||||
|
||||
var headerCls = classNames(prefixCls + '-header', _defineProperty({}, headerClass, headerClass));
|
||||
var itemCls = classNames((_classNames2 = {}, _defineProperty(_classNames2, prefixCls + '-item', true), _defineProperty(_classNames2, prefixCls + '-item-active', isActive), _defineProperty(_classNames2, prefixCls + '-item-disabled', disabled), _classNames2), className);
|
||||
|
||||
var icon = React.createElement('i', { className: 'arrow' });
|
||||
if (showArrow && typeof expandIcon === 'function') {
|
||||
icon = expandIcon(this.props);
|
||||
}
|
||||
return React.createElement(
|
||||
'div',
|
||||
{ className: itemCls, style: style, id: id },
|
||||
React.createElement(
|
||||
'div',
|
||||
{
|
||||
className: headerCls,
|
||||
onClick: this.handleItemClick,
|
||||
role: accordion ? 'tab' : 'button',
|
||||
tabIndex: disabled ? -1 : 0,
|
||||
'aria-expanded': '' + isActive,
|
||||
onKeyPress: this.handleKeyPress
|
||||
},
|
||||
showArrow && icon,
|
||||
header,
|
||||
extra && React.createElement(
|
||||
'div',
|
||||
{ className: prefixCls + '-extra' },
|
||||
extra
|
||||
)
|
||||
),
|
||||
React.createElement(
|
||||
Animate,
|
||||
{
|
||||
showProp: 'isActive',
|
||||
exclusive: true,
|
||||
component: '',
|
||||
animation: this.props.openAnimation
|
||||
},
|
||||
React.createElement(
|
||||
PanelContent,
|
||||
{
|
||||
prefixCls: prefixCls,
|
||||
isActive: isActive,
|
||||
destroyInactivePanel: destroyInactivePanel,
|
||||
forceRender: forceRender,
|
||||
role: accordion ? 'tabpanel' : null
|
||||
},
|
||||
children
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}]);
|
||||
|
||||
return CollapsePanel;
|
||||
}(Component);
|
||||
|
||||
CollapsePanel.propTypes = {
|
||||
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
||||
id: PropTypes.string,
|
||||
children: PropTypes.any,
|
||||
openAnimation: PropTypes.object,
|
||||
prefixCls: PropTypes.string,
|
||||
header: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),
|
||||
headerClass: PropTypes.string,
|
||||
showArrow: PropTypes.bool,
|
||||
isActive: PropTypes.bool,
|
||||
onItemClick: PropTypes.func,
|
||||
style: PropTypes.object,
|
||||
destroyInactivePanel: PropTypes.bool,
|
||||
disabled: PropTypes.bool,
|
||||
accordion: PropTypes.bool,
|
||||
forceRender: PropTypes.bool,
|
||||
expandIcon: PropTypes.func,
|
||||
extra: PropTypes.node,
|
||||
panelKey: PropTypes.any
|
||||
};
|
||||
|
||||
CollapsePanel.defaultProps = {
|
||||
showArrow: true,
|
||||
isActive: false,
|
||||
destroyInactivePanel: false,
|
||||
onItemClick: function onItemClick() {},
|
||||
|
||||
headerClass: '',
|
||||
forceRender: false
|
||||
};
|
||||
|
||||
export default CollapsePanel;
|
||||
76
web/node_modules/rc-collapse/es/PanelContent.js
generated
vendored
Normal file
76
web/node_modules/rc-collapse/es/PanelContent.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import shallowEqual from 'shallowequal';
|
||||
|
||||
var PanelContent = function (_Component) {
|
||||
_inherits(PanelContent, _Component);
|
||||
|
||||
function PanelContent() {
|
||||
_classCallCheck(this, PanelContent);
|
||||
|
||||
return _possibleConstructorReturn(this, (PanelContent.__proto__ || Object.getPrototypeOf(PanelContent)).apply(this, arguments));
|
||||
}
|
||||
|
||||
_createClass(PanelContent, [{
|
||||
key: 'shouldComponentUpdate',
|
||||
value: function shouldComponentUpdate(nextProps) {
|
||||
return this.props.forceRender || !shallowEqual(this.props, nextProps);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _classnames;
|
||||
|
||||
this._isActived = this.props.forceRender || this._isActived || this.props.isActive;
|
||||
if (!this._isActived) {
|
||||
return null;
|
||||
}
|
||||
var _props = this.props,
|
||||
prefixCls = _props.prefixCls,
|
||||
isActive = _props.isActive,
|
||||
children = _props.children,
|
||||
destroyInactivePanel = _props.destroyInactivePanel,
|
||||
forceRender = _props.forceRender,
|
||||
role = _props.role;
|
||||
|
||||
var contentCls = classnames((_classnames = {}, _defineProperty(_classnames, prefixCls + '-content', true), _defineProperty(_classnames, prefixCls + '-content-active', isActive), _defineProperty(_classnames, prefixCls + '-content-inactive', !isActive), _classnames));
|
||||
var child = !forceRender && !isActive && destroyInactivePanel ? null : React.createElement(
|
||||
'div',
|
||||
{ className: prefixCls + '-content-box' },
|
||||
children
|
||||
);
|
||||
return React.createElement(
|
||||
'div',
|
||||
{
|
||||
className: contentCls,
|
||||
role: role
|
||||
},
|
||||
child
|
||||
);
|
||||
}
|
||||
}]);
|
||||
|
||||
return PanelContent;
|
||||
}(Component);
|
||||
|
||||
PanelContent.propTypes = {
|
||||
prefixCls: PropTypes.string,
|
||||
isActive: PropTypes.bool,
|
||||
children: PropTypes.any,
|
||||
destroyInactivePanel: PropTypes.bool,
|
||||
forceRender: PropTypes.bool,
|
||||
role: PropTypes.string
|
||||
};
|
||||
|
||||
export default PanelContent;
|
||||
4
web/node_modules/rc-collapse/es/index.js
generated
vendored
Normal file
4
web/node_modules/rc-collapse/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import Collapse from './Collapse';
|
||||
|
||||
export default Collapse;
|
||||
export var Panel = Collapse.Panel;
|
||||
35
web/node_modules/rc-collapse/es/openAnimationFactory.js
generated
vendored
Normal file
35
web/node_modules/rc-collapse/es/openAnimationFactory.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import cssAnimation from 'css-animation';
|
||||
|
||||
function animate(node, show, transitionName, done) {
|
||||
var height = void 0;
|
||||
return cssAnimation(node, transitionName, {
|
||||
start: function start() {
|
||||
if (!show) {
|
||||
node.style.height = node.offsetHeight + 'px';
|
||||
} else {
|
||||
height = node.offsetHeight;
|
||||
node.style.height = 0;
|
||||
}
|
||||
},
|
||||
active: function active() {
|
||||
node.style.height = (show ? height : 0) + 'px';
|
||||
},
|
||||
end: function end() {
|
||||
node.style.height = '';
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function animation(prefixCls) {
|
||||
return {
|
||||
enter: function enter(node, done) {
|
||||
return animate(node, true, prefixCls + '-anim', done);
|
||||
},
|
||||
leave: function leave(node, done) {
|
||||
return animate(node, false, prefixCls + '-anim', done);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default animation;
|
||||
Reference in New Issue
Block a user