Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-tabs

Package Overview
Dependencies
Maintainers
2
Versions
228
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-tabs - npm Package Compare versions

Comparing version 5.9.2 to 5.9.3

92

lib/Nav.js

@@ -7,4 +7,10 @@ 'use strict';

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; };
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');

@@ -26,4 +32,2 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var tabBarExtraContentStyle = {

@@ -48,5 +52,5 @@ "float": 'right'

getInitialState: function getInitialState() {
this.offset = 0;
return {
next: false,
offset: 0,
prev: false

@@ -64,2 +68,18 @@ };

}
var nextPrev = this.setNextPrev();
// wait next, prev show hide
/* eslint react/no-did-update-set-state:0 */
if (this.isNextPrevShown(this.state) !== this.isNextPrevShown(nextPrev)) {
this.setState({}, this.scrollToActiveTab);
} else {
// can not use props.activeKey
if (!prevProps || props.activeKey !== prevProps.activeKey) {
this.scrollToActiveTab();
}
}
},
onTabClick: function onTabClick(key) {
this.props.onTabClick(key);
},
setNextPrev: function setNextPrev() {
var navNode = this.refs.nav;

@@ -69,4 +89,4 @@ var navNodeWH = this.getOffsetWH(navNode);

var navWrapNodeWH = this.getOffsetWH(navWrapNode);
var state = this.state;
var offset = state.offset;
var offset = this.offset;
var minOffset = navWrapNodeWH - navNodeWH;

@@ -79,3 +99,3 @@ var _state = this.state;

next = false;
this.setOffset(0);
this.setOffset(0, false);
offset = 0;

@@ -86,3 +106,3 @@ } else if (minOffset < offset) {

next = false;
this.setOffset(minOffset);
this.setOffset(minOffset, false);
offset = minOffset;

@@ -99,26 +119,7 @@ }

this.setPrev(prev);
var nextPrev = {
return {
next: next,
prev: prev
};
// wait next,prev show hide
if (this.isNextPrevShown(state) !== this.isNextPrevShown(nextPrev)) {
this.setNextPrev({}, this.scrollToActiveTab);
} else {
// can not use props.activeKey
if (!prevProps || props.activeKey !== prevProps.activeKey) {
this.scrollToActiveTab();
}
}
},
onTabClick: function onTabClick(key) {
this.props.onTabClick(key);
},
// work around eslint warning
setNextPrev: function setNextPrev(nextPrev, callback) {
this.setState(nextPrev, callback);
},
getTabs: function getTabs() {

@@ -151,3 +152,3 @@ var _this = this;

'div',
_extends({
(0, _extends3["default"])({
role: 'tab',

@@ -187,7 +188,7 @@ 'aria-disabled': child.props.disabled ? 'true' : 'false',

setOffset: function setOffset(offset) {
var checkNextPrev = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
var target = Math.min(0, offset);
if (this.state.offset !== target) {
this.setState({
offset: target
});
if (this.offset !== target) {
this.offset = target;
var navOffset = {};

@@ -222,2 +223,5 @@ var tabPosition = this.props.tabPosition;

this.refs.nav.style[navOffset.name] = navOffset.value;
if (checkNextPrev) {
this.setNextPrev();
}
}

@@ -250,3 +254,3 @@ },

var navWrapNodeWH = this.getOffsetWH(navWrap);
var offset = this.state.offset;
var offset = this.offset;

@@ -257,10 +261,6 @@ var wrapOffset = this.getOffsetLT(navWrap);

offset += wrapOffset - activeTabOffset;
this.setState({
offset: offset
});
this.setOffset(offset);
} else if (wrapOffset + navWrapNodeWH < activeTabOffset + activeTabWH) {
offset -= activeTabOffset + activeTabWH - (wrapOffset + navWrapNodeWH);
this.setState({
offset: offset
});
this.setOffset(offset);
}

@@ -272,4 +272,4 @@ }

var navWrapNodeWH = this.getOffsetWH(navWrapNode);
var state = this.state;
var offset = state.offset;
var offset = this.offset;
this.setOffset(offset + navWrapNodeWH);

@@ -280,4 +280,4 @@ },

var navWrapNodeWH = this.getOffsetWH(navWrapNode);
var state = this.state;
var offset = state.offset;
var offset = this.offset;
this.setOffset(offset - navWrapNodeWH);

@@ -308,3 +308,3 @@ },

unselectable: 'unselectable',
className: (0, _classnames4["default"])((_classnames = {}, _defineProperty(_classnames, prefixCls + '-tab-prev', 1), _defineProperty(_classnames, prefixCls + '-tab-btn-disabled', !state.prev), _classnames))
className: (0, _classnames4["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls + '-tab-prev', 1), (0, _defineProperty3["default"])(_classnames, prefixCls + '-tab-btn-disabled', !state.prev), _classnames))
},

@@ -319,3 +319,3 @@ _react2["default"].createElement('span', { className: prefixCls + '-tab-prev-icon' })

unselectable: 'unselectable',
className: (0, _classnames4["default"])((_classnames2 = {}, _defineProperty(_classnames2, prefixCls + '-tab-next', 1), _defineProperty(_classnames2, prefixCls + '-tab-btn-disabled', !state.next), _classnames2))
className: (0, _classnames4["default"])((_classnames2 = {}, (0, _defineProperty3["default"])(_classnames2, prefixCls + '-tab-next', 1), (0, _defineProperty3["default"])(_classnames2, prefixCls + '-tab-btn-disabled', !state.next), _classnames2))
},

@@ -322,0 +322,0 @@ _react2["default"].createElement('span', { className: prefixCls + '-tab-next-icon' })

@@ -7,2 +7,6 @@ 'use strict';

var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = require('react');

@@ -18,4 +22,2 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var TabPane = _react2["default"].createClass({

@@ -36,3 +38,3 @@ displayName: 'TabPane',

var prefixCls = props.rootPrefixCls + '-tabpane';
var cls = (0, _classnames3["default"])((_classnames = {}, _defineProperty(_classnames, prefixCls + '-hidden', !props.active), _defineProperty(_classnames, prefixCls, 1), _classnames));
var cls = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls + '-hidden', !props.active), (0, _defineProperty3["default"])(_classnames, prefixCls, 1), _classnames));
return _react2["default"].createElement(

@@ -39,0 +41,0 @@ 'div',

@@ -7,2 +7,6 @@ 'use strict';

var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = require('react');

@@ -34,4 +38,2 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function noop() {}

@@ -227,3 +229,3 @@

var cls = (0, _classnames3["default"])((_classnames = {}, _defineProperty(_classnames, prefixCls, 1), _defineProperty(_classnames, prefixCls + '-' + tabPosition, 1), _defineProperty(_classnames, className, !!className), _classnames));
var cls = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls, 1), (0, _defineProperty3["default"])(_classnames, prefixCls + '-' + tabPosition, 1), (0, _defineProperty3["default"])(_classnames, className, !!className), _classnames));
var tabMovingDirection = this.state.tabMovingDirection;

@@ -230,0 +232,0 @@ var tabPanes = this.getTabPanes();

{
"name": "rc-tabs",
"version": "5.9.2",
"version": "5.9.3",
"description": "tabs ui component for react",

@@ -32,3 +32,3 @@ "keywords": [

"start": "rc-tools run server",
"pub": "rc-tools run pub",
"pub": "rc-tools run pub --babel-runtime",
"lint": "rc-tools run lint",

@@ -49,3 +49,3 @@ "karma": "rc-tools run karma",

"react-dom": "15.x",
"react-router": "^1.0.3"
"react-router": "2.x"
},

@@ -56,2 +56,3 @@ "pre-commit": [

"dependencies": {
"babel-runtime": "6.x",
"classnames": "2.x",

@@ -58,0 +59,0 @@ "rc-animate": "2.x"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc