UNPKG

4.24 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _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; }; }();
8
9var _react = require('react');
10
11var React = _interopRequireWildcard(_react);
12
13var _reactPoppop = require('react-poppop');
14
15var _reactPoppop2 = _interopRequireDefault(_reactPoppop);
16
17var _reactSortableHoc = require('react-sortable-hoc');
18
19var _SortMethod2 = require('./SortMethod');
20
21var _SortMethod3 = _interopRequireDefault(_SortMethod2);
22
23function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
25function _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; } }
26
27function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28
29function _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; }
30
31function _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; }
32
33var DragTabContainer = (0, _reactSortableHoc.SortableContainer)(function (_ref) {
34 var children = _ref.children;
35
36 return React.createElement(
37 'div',
38 { style: { marginTop: '50px' } },
39 children
40 );
41});
42
43var ModalTabListWrapper = function (_SortMethod) {
44 _inherits(ModalTabListWrapper, _SortMethod);
45
46 function ModalTabListWrapper() {
47 _classCallCheck(this, ModalTabListWrapper);
48
49 return _possibleConstructorReturn(this, (ModalTabListWrapper.__proto__ || Object.getPrototypeOf(ModalTabListWrapper)).apply(this, arguments));
50 }
51
52 _createClass(ModalTabListWrapper, [{
53 key: 'render',
54 value: function render() {
55 return React.createElement(
56 DragTabContainer,
57 { onSortEnd: this.onSortEnd,
58 axis: 'y',
59 lockAxis: 'y'
60 // if no pressDelay, close button cannot be triggered,
61 // because it would always treat click as dnd action
62 , pressDelay: '100' },
63 this.props.children
64 );
65 }
66 }]);
67
68 return ModalTabListWrapper;
69}(_SortMethod3.default);
70
71var TabModal = function (_React$Component) {
72 _inherits(TabModal, _React$Component);
73
74 function TabModal() {
75 _classCallCheck(this, TabModal);
76
77 return _possibleConstructorReturn(this, (TabModal.__proto__ || Object.getPrototypeOf(TabModal)).apply(this, arguments));
78 }
79
80 _createClass(TabModal, [{
81 key: 'render',
82 value: function render() {
83 return React.createElement(
84 _reactPoppop2.default,
85 { open: true,
86 onClose: this.props.closeModal,
87 closeOnEsc: true,
88 closeBtn: true },
89 React.createElement(
90 ModalTabListWrapper,
91 { handleTabSequence: this.props.handleTabSequence,
92 handleTabChange: this.props.handleTabChange,
93 activeIndex: this.props.activeIndex },
94 this.props.children
95 )
96 );
97 }
98 }]);
99
100 return TabModal;
101}(React.Component);
102
103exports.default = TabModal;
104module.exports = exports['default'];
\No newline at end of file