Latest updates from IceHrmPro
This commit is contained in:
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;
|
||||
Reference in New Issue
Block a user