UNPKG

2.95 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
13function _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; } }
14
15function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
17function _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; }
18
19function _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; }
20
21var SortMethod = function (_React$PureComponent) {
22 _inherits(SortMethod, _React$PureComponent);
23
24 function SortMethod(props) {
25 _classCallCheck(this, SortMethod);
26
27 var _this = _possibleConstructorReturn(this, (SortMethod.__proto__ || Object.getPrototypeOf(SortMethod)).call(this, props));
28
29 _this.onSortEnd = _this.onSortEnd.bind(_this);
30 return _this;
31 }
32
33 _createClass(SortMethod, [{
34 key: 'onSortEnd',
35 value: function onSortEnd(_ref) {
36 var oldIndex = _ref.oldIndex,
37 newIndex = _ref.newIndex;
38 var _props = this.props,
39 activeIndex = _props.activeIndex,
40 handleTabChange = _props.handleTabChange,
41 handleTabSequence = _props.handleTabSequence;
42
43 if (oldIndex === newIndex) {
44 if (activeIndex !== oldIndex) {
45 handleTabChange(oldIndex);
46 }
47 } else {
48 handleTabSequence({ oldIndex: oldIndex, newIndex: newIndex });
49 }
50 }
51 }]);
52
53 return SortMethod;
54}(React.PureComponent);
55
56exports.default = SortMethod;
57module.exports = exports['default'];
\No newline at end of file