UNPKG

3.77 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 _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; };
10
11var _react = require('react');
12
13var React = _interopRequireWildcard(_react);
14
15var _reactSortableHoc = require('react-sortable-hoc');
16
17var _Tab = require('./Tab');
18
19var _Tab2 = _interopRequireDefault(_Tab);
20
21function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
23function _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; } }
24
25function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26
27function _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; }
28
29function _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; }
30
31function _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; }
32
33var DragTabElement = (0, _reactSortableHoc.SortableElement)(function (_ref) {
34 var children = _ref.children,
35 props = _objectWithoutProperties(_ref, ['children']);
36
37 return React.createElement(
38 _Tab2.default,
39 _extends({ index: props.tabIndex }, props),
40 children
41 );
42});
43
44var DragTab = function (_React$PureComponent) {
45 _inherits(DragTab, _React$PureComponent);
46
47 function DragTab() {
48 _classCallCheck(this, DragTab);
49
50 return _possibleConstructorReturn(this, (DragTab.__proto__ || Object.getPrototypeOf(DragTab)).apply(this, arguments));
51 }
52
53 _createClass(DragTab, [{
54 key: 'render',
55 value: function render() {
56 var _this2 = this;
57
58 var _props = this.props,
59 children = _props.children,
60 props = _objectWithoutProperties(_props, ['children']);
61
62 return React.createElement(
63 DragTabElement,
64 _extends({ ref: function ref(node) {
65 return _this2.__DRAG_TAB_INTERNAL_NODE = node;
66 } }, props),
67 children
68 );
69 }
70 }]);
71
72 return DragTab;
73}(React.PureComponent);
74
75DragTab.displayName = 'DragTab';
76
77exports.default = DragTab;
78module.exports = exports['default'];
\No newline at end of file