1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
8 |
|
9 | 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; }; }();
|
10 |
|
11 | var _react = require('react');
|
12 |
|
13 | var React = _interopRequireWildcard(_react);
|
14 |
|
15 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
16 |
|
17 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
18 |
|
19 | 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; }
|
20 |
|
21 | 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; }
|
22 |
|
23 | var PanelList = function (_React$PureComponent) {
|
24 | _inherits(PanelList, _React$PureComponent);
|
25 |
|
26 | function PanelList() {
|
27 | _classCallCheck(this, PanelList);
|
28 |
|
29 | return _possibleConstructorReturn(this, (PanelList.__proto__ || Object.getPrototypeOf(PanelList)).apply(this, arguments));
|
30 | }
|
31 |
|
32 | _createClass(PanelList, [{
|
33 | key: 'render',
|
34 | value: function render() {
|
35 | var _props = this.props,
|
36 | children = _props.children,
|
37 | activeIndex = _props.activeIndex,
|
38 | customStyle = _props.customStyle;
|
39 |
|
40 | if (!children || activeIndex === undefined) {
|
41 | return null;
|
42 | }
|
43 |
|
44 | var props = {};
|
45 | if (customStyle && customStyle.Panel) {
|
46 | props = _extends({}, props, { CustomPanelStyle: customStyle.Panel });
|
47 | }
|
48 |
|
49 |
|
50 | var result = React.Children.toArray(children).map(function (child, index) {
|
51 | return React.cloneElement(child, _extends({
|
52 | key: index,
|
53 | active: index === activeIndex,
|
54 | index: index
|
55 | }, props));
|
56 | });
|
57 | return React.createElement(
|
58 | 'div',
|
59 | null,
|
60 | result
|
61 | );
|
62 | }
|
63 | }]);
|
64 |
|
65 | return PanelList;
|
66 | }(React.PureComponent);
|
67 |
|
68 | exports.default = PanelList;
|
69 | module.exports = exports['default']; |
\ | No newline at end of file |