1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
4 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
5 | import _inherits from 'babel-runtime/helpers/inherits';
|
6 |
|
7 | var _class, _temp;
|
8 |
|
9 | import React, { PureComponent } from 'react';
|
10 | import PropTypes from 'prop-types';
|
11 | import classnames from 'classnames';
|
12 |
|
13 | var TabContent = (_temp = _class = function (_PureComponent) {
|
14 | _inherits(TabContent, _PureComponent);
|
15 |
|
16 | function TabContent() {
|
17 | _classCallCheck(this, TabContent);
|
18 |
|
19 | return _possibleConstructorReturn(this, _PureComponent.apply(this, arguments));
|
20 | }
|
21 |
|
22 | TabContent.prototype.render = function render() {
|
23 | var _classnames;
|
24 |
|
25 | var _props = this.props,
|
26 | prefix = _props.prefix,
|
27 | activeKey = _props.activeKey,
|
28 | lazyLoad = _props.lazyLoad,
|
29 | unmountInactiveTabs = _props.unmountInactiveTabs,
|
30 | children = _props.children,
|
31 | className = _props.className,
|
32 | others = _objectWithoutProperties(_props, ['prefix', 'activeKey', 'lazyLoad', 'unmountInactiveTabs', 'children', 'className']);
|
33 |
|
34 | var formatChildren = [];
|
35 | React.Children.forEach(children, function (child) {
|
36 |
|
37 | var active = activeKey == child.key;
|
38 | formatChildren.push(React.cloneElement(child, {
|
39 | prefix: prefix,
|
40 | active: active,
|
41 | lazyLoad: lazyLoad,
|
42 | unmountInactiveTabs: unmountInactiveTabs
|
43 | }));
|
44 | });
|
45 |
|
46 | var classNames = classnames((_classnames = {}, _classnames[prefix + 'tabs-content'] = true, _classnames), className);
|
47 |
|
48 | return React.createElement(
|
49 | 'div',
|
50 | _extends({}, others, { className: classNames }),
|
51 | formatChildren
|
52 | );
|
53 | };
|
54 |
|
55 | return TabContent;
|
56 | }(PureComponent), _class.propTypes = {
|
57 | prefix: PropTypes.string,
|
58 | activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
59 | lazyLoad: PropTypes.bool,
|
60 | children: PropTypes.any
|
61 | }, _temp);
|
62 |
|
63 |
|
64 | export default TabContent; |
\ | No newline at end of file |