1 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
2 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
3 | import _inherits from 'babel-runtime/helpers/inherits';
|
4 |
|
5 | var _class, _temp;
|
6 |
|
7 | import React from 'react';
|
8 | import PropTypes from 'prop-types';
|
9 | import classnames from 'classnames';
|
10 | import { polyfill } from 'react-lifecycles-compat';
|
11 |
|
12 |
|
13 | var TabItem = (_temp = _class = function (_React$Component) {
|
14 | _inherits(TabItem, _React$Component);
|
15 |
|
16 | function TabItem() {
|
17 | _classCallCheck(this, TabItem);
|
18 |
|
19 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
20 | }
|
21 |
|
22 | TabItem.prototype.render = function render() {
|
23 | var _classnames;
|
24 |
|
25 | var _props = this.props,
|
26 | prefix = _props.prefix,
|
27 | active = _props.active,
|
28 | lazyLoad = _props.lazyLoad,
|
29 | unmountInactiveTabs = _props.unmountInactiveTabs,
|
30 | children = _props.children;
|
31 |
|
32 |
|
33 | this._actived = this._actived || active;
|
34 | if (lazyLoad && !this._actived) {
|
35 | return null;
|
36 | }
|
37 |
|
38 | if (unmountInactiveTabs && !active) {
|
39 | return null;
|
40 | }
|
41 |
|
42 | var cls = classnames((_classnames = {}, _classnames[prefix + 'tabs-tabpane'] = true, _classnames['' + (active ? 'active' : 'hidden')] = true, _classnames));
|
43 |
|
44 | return React.createElement(
|
45 | 'div',
|
46 | {
|
47 | role: 'tabpanel',
|
48 | 'aria-hidden': active ? 'false' : 'true',
|
49 | className: cls
|
50 | },
|
51 | children
|
52 | );
|
53 | };
|
54 |
|
55 | return TabItem;
|
56 | }(React.Component), _class.propTypes = {
|
57 | prefix: PropTypes.string,
|
58 | |
59 |
|
60 |
|
61 | title: PropTypes.node,
|
62 | |
63 |
|
64 |
|
65 | closeable: PropTypes.bool,
|
66 | |
67 |
|
68 |
|
69 | disabled: PropTypes.bool,
|
70 | active: PropTypes.bool,
|
71 | lazyLoad: PropTypes.bool,
|
72 | unmountInactiveTabs: PropTypes.bool,
|
73 | children: PropTypes.any
|
74 | }, _class.defaultProps = {
|
75 | prefix: 'next-',
|
76 | closeable: false
|
77 | }, _temp);
|
78 | TabItem.displayName = 'TabItem';
|
79 |
|
80 |
|
81 | export default polyfill(TabItem); |
\ | No newline at end of file |