UNPKG

3.75 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _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
9var _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
11var _react = require('react');
12
13var _react2 = _interopRequireDefault(_react);
14
15var _SortMethod2 = require('./SortMethod');
16
17var _SortMethod3 = _interopRequireDefault(_SortMethod2);
18
19var _reactSortableHoc = require('react-sortable-hoc');
20
21var _TabList = require('./TabList');
22
23var _TabList2 = _interopRequireDefault(_TabList);
24
25function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
33function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
34
35var DragTabContainer = (0, _reactSortableHoc.SortableContainer)(function (_ref) {
36 var children = _ref.children,
37 props = _objectWithoutProperties(_ref, ['children']);
38
39 return _react2.default.createElement(
40 _TabList2.default,
41 props,
42 children
43 );
44});
45
46var DragTabList = function (_SortMethod) {
47 _inherits(DragTabList, _SortMethod);
48
49 function DragTabList() {
50 _classCallCheck(this, DragTabList);
51
52 return _possibleConstructorReturn(this, (DragTabList.__proto__ || Object.getPrototypeOf(DragTabList)).apply(this, arguments));
53 }
54
55 _createClass(DragTabList, [{
56 key: 'render',
57 value: function render() {
58 var _props = this.props,
59 children = _props.children,
60 props = _objectWithoutProperties(_props, ['children']);
61
62 return _react2.default.createElement(
63 DragTabContainer,
64 _extends({ onSortEnd: this.onSortEnd,
65 axis: 'x',
66 lockAxis: 'x'
67 // if no pressDelay, close button cannot be triggered,
68 // because it would always treat click as dnd action
69 , pressDelay: 100
70 }, props),
71 children
72 );
73 }
74 }]);
75
76 return DragTabList;
77}(_SortMethod3.default);
78
79exports.default = DragTabList;
80
81
82DragTabList.displayName = 'DragTabList';
83module.exports = exports['default'];
\No newline at end of file