Comparing version 7.3.4 to 7.5.0
@@ -20,6 +20,6 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
exports["default"] = _Tabs2["default"]; | ||
exports.TabPane = _TabPane2["default"]; | ||
exports.TabContent = _TabContent2["default"]; | ||
exports['default'] = _Tabs2['default']; | ||
exports.TabPane = _TabPane2['default']; | ||
exports.TabContent = _TabContent2['default']; |
@@ -19,7 +19,7 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var InkTabBar = (0, _createReactClass2["default"])({ | ||
var InkTabBar = (0, _createReactClass2['default'])({ | ||
displayName: 'InkTabBar', | ||
mixins: [_TabBarMixin2["default"], _InkTabBarMixin2["default"]], | ||
mixins: [_TabBarMixin2['default'], _InkTabBarMixin2['default']], | ||
render: function render() { | ||
@@ -32,3 +32,3 @@ var inkBarNode = this.getInkBarNode(); | ||
exports["default"] = InkTabBar; | ||
exports['default'] = InkTabBar; | ||
module.exports = exports['default']; |
@@ -23,3 +23,3 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -107,3 +107,3 @@ function getScroll(w, top) { | ||
exports["default"] = { | ||
exports['default'] = { | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -129,4 +129,4 @@ return { | ||
var className = prefixCls + '-ink-bar'; | ||
var classes = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, className, true), (0, _defineProperty3["default"])(_classnames, inkBarAnimated ? className + '-animated' : className + '-no-animated', true), _classnames)); | ||
return _react2["default"].createElement('div', { | ||
var classes = (0, _classnames3['default'])((_classnames = {}, (0, _defineProperty3['default'])(_classnames, className, true), (0, _defineProperty3['default'])(_classnames, inkBarAnimated ? className + '-animated' : className + '-no-animated', true), _classnames)); | ||
return _react2['default'].createElement('div', { | ||
style: styles.inkBar, | ||
@@ -133,0 +133,0 @@ className: classes, |
@@ -23,7 +23,7 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var ScrollableInkTabBar = (0, _createReactClass2["default"])({ | ||
var ScrollableInkTabBar = (0, _createReactClass2['default'])({ | ||
displayName: 'ScrollableInkTabBar', | ||
mixins: [_TabBarMixin2["default"], _InkTabBarMixin2["default"], _ScrollableTabBarMixin2["default"]], | ||
mixins: [_TabBarMixin2['default'], _InkTabBarMixin2['default'], _ScrollableTabBarMixin2['default']], | ||
render: function render() { | ||
@@ -37,3 +37,3 @@ var inkBarNode = this.getInkBarNode(); | ||
exports["default"] = ScrollableInkTabBar; | ||
exports['default'] = ScrollableInkTabBar; | ||
module.exports = exports['default']; |
@@ -19,7 +19,7 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var ScrollableTabBar = (0, _createReactClass2["default"])({ | ||
var ScrollableTabBar = (0, _createReactClass2['default'])({ | ||
displayName: 'ScrollableTabBar', | ||
mixins: [_TabBarMixin2["default"], _ScrollableTabBarMixin2["default"]], | ||
mixins: [_TabBarMixin2['default'], _ScrollableTabBarMixin2['default']], | ||
render: function render() { | ||
@@ -33,3 +33,3 @@ var inkBarNode = this.getInkBarNode(); | ||
exports["default"] = ScrollableTabBar; | ||
exports['default'] = ScrollableTabBar; | ||
module.exports = exports['default']; |
@@ -21,5 +21,5 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
exports["default"] = { | ||
exports['default'] = { | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -227,3 +227,3 @@ return { | ||
prevButton = _react2["default"].createElement( | ||
prevButton = _react2['default'].createElement( | ||
'span', | ||
@@ -233,8 +233,8 @@ { | ||
unselectable: 'unselectable', | ||
className: (0, _classnames6["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls + '-tab-prev', 1), (0, _defineProperty3["default"])(_classnames, prefixCls + '-tab-btn-disabled', !prev), _classnames)) | ||
className: (0, _classnames6['default'])((_classnames = {}, (0, _defineProperty3['default'])(_classnames, prefixCls + '-tab-prev', 1), (0, _defineProperty3['default'])(_classnames, prefixCls + '-tab-btn-disabled', !prev), _classnames)) | ||
}, | ||
_react2["default"].createElement('span', { className: prefixCls + '-tab-prev-icon' }) | ||
_react2['default'].createElement('span', { className: prefixCls + '-tab-prev-icon' }) | ||
); | ||
nextButton = _react2["default"].createElement( | ||
nextButton = _react2['default'].createElement( | ||
'span', | ||
@@ -244,5 +244,5 @@ { | ||
unselectable: 'unselectable', | ||
className: (0, _classnames6["default"])((_classnames2 = {}, (0, _defineProperty3["default"])(_classnames2, prefixCls + '-tab-next', 1), (0, _defineProperty3["default"])(_classnames2, prefixCls + '-tab-btn-disabled', !next), _classnames2)) | ||
className: (0, _classnames6['default'])((_classnames2 = {}, (0, _defineProperty3['default'])(_classnames2, prefixCls + '-tab-next', 1), (0, _defineProperty3['default'])(_classnames2, prefixCls + '-tab-btn-disabled', !next), _classnames2)) | ||
}, | ||
_react2["default"].createElement('span', { className: prefixCls + '-tab-next-icon' }) | ||
_react2['default'].createElement('span', { className: prefixCls + '-tab-next-icon' }) | ||
); | ||
@@ -252,8 +252,8 @@ } | ||
var navClassName = prefixCls + '-nav'; | ||
var navClasses = (0, _classnames6["default"])((_classnames3 = {}, (0, _defineProperty3["default"])(_classnames3, navClassName, true), (0, _defineProperty3["default"])(_classnames3, scrollAnimated ? navClassName + '-animated' : navClassName + '-no-animated', true), _classnames3)); | ||
var navClasses = (0, _classnames6['default'])((_classnames3 = {}, (0, _defineProperty3['default'])(_classnames3, navClassName, true), (0, _defineProperty3['default'])(_classnames3, scrollAnimated ? navClassName + '-animated' : navClassName + '-no-animated', true), _classnames3)); | ||
return _react2["default"].createElement( | ||
return _react2['default'].createElement( | ||
'div', | ||
{ | ||
className: (0, _classnames6["default"])((_classnames4 = {}, (0, _defineProperty3["default"])(_classnames4, prefixCls + '-nav-container', 1), (0, _defineProperty3["default"])(_classnames4, prefixCls + '-nav-container-scrolling', showNextPrev), _classnames4)), | ||
className: (0, _classnames6['default'])((_classnames4 = {}, (0, _defineProperty3['default'])(_classnames4, prefixCls + '-nav-container', 1), (0, _defineProperty3['default'])(_classnames4, prefixCls + '-nav-container-scrolling', showNextPrev), _classnames4)), | ||
key: 'container', | ||
@@ -264,9 +264,9 @@ ref: 'container' | ||
nextButton, | ||
_react2["default"].createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-nav-wrap', ref: 'navWrap' }, | ||
_react2["default"].createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-nav-scroll' }, | ||
_react2["default"].createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
@@ -273,0 +273,0 @@ { className: navClasses, ref: 'nav' }, |
@@ -31,8 +31,8 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var SwipeableInkTabBar = (0, _createReactClass2["default"])({ | ||
var SwipeableInkTabBar = (0, _createReactClass2['default'])({ | ||
displayName: 'SwipeableInkTabBar', | ||
mixins: [_TabBarMixin2["default"], _InkTabBarMixin2["default"], _SwipeableTabBarMixin2["default"]], | ||
mixins: [_TabBarMixin2['default'], _InkTabBarMixin2['default'], _SwipeableTabBarMixin2['default']], | ||
@@ -53,3 +53,3 @@ getSwipeableTabs: function getSwipeableTabs() { | ||
_react2["default"].Children.forEach(children, function (child) { | ||
_react2['default'].Children.forEach(children, function (child) { | ||
if (!child) { | ||
@@ -73,5 +73,5 @@ return; | ||
} | ||
rst.push(_react2["default"].createElement( | ||
rst.push(_react2['default'].createElement( | ||
'div', | ||
(0, _extends3["default"])({ | ||
(0, _extends3['default'])({ | ||
role: 'tab', | ||
@@ -99,3 +99,3 @@ style: tabStyle, | ||
exports["default"] = SwipeableInkTabBar; | ||
exports['default'] = SwipeableInkTabBar; | ||
module.exports = exports['default']; |
@@ -23,5 +23,5 @@ 'use strict'; | ||
var _reactHammerjs = require('react-hammerjs'); | ||
var _rcHammerjs = require('rc-hammerjs'); | ||
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs); | ||
var _rcHammerjs2 = _interopRequireDefault(_rcHammerjs); | ||
@@ -34,5 +34,5 @@ var _reactDom = require('react-dom'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
exports["default"] = { | ||
exports['default'] = { | ||
getInitialState: function getInitialState() { | ||
@@ -139,4 +139,4 @@ var _checkPaginationByKey = this.checkPaginationByKey(this.props.activeKey), | ||
this.swipeNode = _reactDom2["default"].findDOMNode(swipe); // dom which scroll (9999px) | ||
this.realNode = _reactDom2["default"].findDOMNode(nav); // dom which visiable in screen (viewport) | ||
this.swipeNode = _reactDom2['default'].findDOMNode(swipe); // dom which scroll (9999px) | ||
this.realNode = _reactDom2['default'].findDOMNode(nav); // dom which visiable in screen (viewport) | ||
var _isVertical = (0, _utils.isVertical)(tabBarPosition); | ||
@@ -193,3 +193,3 @@ var _viewSize = (0, _utils.getStyle)(this.realNode, _isVertical ? 'height' : 'width'); | ||
var navClassName = prefixCls + '-nav'; | ||
var navClasses = (0, _classnames4["default"])((0, _defineProperty3["default"])({}, navClassName, true)); | ||
var navClasses = (0, _classnames4['default'])((0, _defineProperty3['default'])({}, navClassName, true)); | ||
var direction = {}; | ||
@@ -204,21 +204,21 @@ if ((0, _utils.isVertical)(tabBarPosition)) { | ||
}; | ||
return _react2["default"].createElement( | ||
return _react2['default'].createElement( | ||
'div', | ||
{ | ||
className: (0, _classnames4["default"])((_classnames2 = {}, (0, _defineProperty3["default"])(_classnames2, prefixCls + '-nav-container', 1), (0, _defineProperty3["default"])(_classnames2, prefixCls + '-nav-swipe-container', 1), (0, _defineProperty3["default"])(_classnames2, prefixCls + '-prevpage', hasPrevPage), (0, _defineProperty3["default"])(_classnames2, prefixCls + '-nextpage', hasNextPage), _classnames2)), | ||
className: (0, _classnames4['default'])((_classnames2 = {}, (0, _defineProperty3['default'])(_classnames2, prefixCls + '-nav-container', 1), (0, _defineProperty3['default'])(_classnames2, prefixCls + '-nav-swipe-container', 1), (0, _defineProperty3['default'])(_classnames2, prefixCls + '-prevpage', hasPrevPage), (0, _defineProperty3['default'])(_classnames2, prefixCls + '-nextpage', hasNextPage), _classnames2)), | ||
key: 'container', | ||
ref: 'container' | ||
}, | ||
_react2["default"].createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-nav-wrap', ref: 'navWrap' }, | ||
_react2["default"].createElement( | ||
_reactHammerjs2["default"], | ||
(0, _extends3["default"])({}, events, direction, { | ||
_react2['default'].createElement( | ||
_rcHammerjs2['default'], | ||
(0, _extends3['default'])({}, events, direction, { | ||
options: hammerOptions | ||
}), | ||
_react2["default"].createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-nav-swipe', ref: 'swipe' }, | ||
_react2["default"].createElement( | ||
_react2['default'].createElement( | ||
'div', | ||
@@ -225,0 +225,0 @@ { className: navClasses, ref: 'nav' }, |
@@ -27,5 +27,5 @@ 'use strict'; | ||
var _reactHammerjs = require('react-hammerjs'); | ||
var _rcHammerjs = require('rc-hammerjs'); | ||
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs); | ||
var _rcHammerjs2 = _interopRequireDefault(_rcHammerjs); | ||
@@ -38,3 +38,3 @@ var _reactDom = require('react-dom'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -78,12 +78,12 @@ var RESISTANCE_COEF = 0.6; | ||
var SwipeableTabContent = (0, _createReactClass2["default"])({ | ||
var SwipeableTabContent = (0, _createReactClass2['default'])({ | ||
displayName: 'SwipeableTabContent', | ||
propTypes: { | ||
tabBarPosition: _propTypes2["default"].string, | ||
onChange: _propTypes2["default"].func, | ||
children: _propTypes2["default"].any, | ||
hammerOptions: _propTypes2["default"].any, | ||
animated: _propTypes2["default"].bool, | ||
activeKey: _propTypes2["default"].string | ||
tabBarPosition: _propTypes2['default'].string, | ||
onChange: _propTypes2['default'].func, | ||
children: _propTypes2['default'].any, | ||
hammerOptions: _propTypes2['default'].any, | ||
animated: _propTypes2['default'].bool, | ||
activeKey: _propTypes2['default'].string | ||
}, | ||
@@ -97,3 +97,3 @@ | ||
componentDidMount: function componentDidMount() { | ||
this.rootNode = _reactDom2["default"].findDOMNode(this); | ||
this.rootNode = _reactDom2['default'].findDOMNode(this); | ||
}, | ||
@@ -195,3 +195,3 @@ onPanStart: function onPanStart() { | ||
if (animated !== false) { | ||
events = (0, _extends3["default"])({}, events, { | ||
events = (0, _extends3['default'])({}, events, { | ||
onPan: this.onPan, | ||
@@ -201,8 +201,8 @@ onPanEnd: this.onPanEnd | ||
} | ||
return _react2["default"].createElement( | ||
_reactHammerjs2["default"], | ||
(0, _extends3["default"])({}, events, direction, { | ||
return _react2['default'].createElement( | ||
_rcHammerjs2['default'], | ||
(0, _extends3['default'])({}, events, direction, { | ||
options: hammerOptions | ||
}), | ||
_react2["default"].createElement(_TabContent2["default"], this.props) | ||
_react2['default'].createElement(_TabContent2['default'], this.props) | ||
); | ||
@@ -212,3 +212,3 @@ } | ||
exports["default"] = SwipeableTabContent; | ||
exports['default'] = SwipeableTabContent; | ||
module.exports = exports['default']; |
@@ -15,7 +15,7 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var TabBar = (0, _createReactClass2["default"])({ | ||
var TabBar = (0, _createReactClass2['default'])({ | ||
displayName: 'TabBar', | ||
mixins: [_TabBarMixin2["default"]], | ||
mixins: [_TabBarMixin2['default']], | ||
render: function render() { | ||
@@ -27,3 +27,3 @@ var tabs = this.getTabs(); | ||
exports["default"] = TabBar; | ||
exports['default'] = TabBar; | ||
module.exports = exports['default']; |
@@ -27,9 +27,9 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var tabBarExtraContentStyle = { | ||
"float": 'right' | ||
float: 'right' | ||
}; | ||
exports["default"] = { | ||
exports['default'] = { | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -52,3 +52,3 @@ return { | ||
_react2["default"].Children.forEach(children, function (child) { | ||
_react2['default'].Children.forEach(children, function (child) { | ||
if (!child) { | ||
@@ -72,6 +72,6 @@ return; | ||
} | ||
(0, _warning2["default"])('tab' in child.props, 'There must be `tab` property on children of Tabs.'); | ||
rst.push(_react2["default"].createElement( | ||
(0, _warning2['default'])('tab' in child.props, 'There must be `tab` property on children of Tabs.'); | ||
rst.push(_react2['default'].createElement( | ||
'div', | ||
(0, _extends3["default"])({ | ||
(0, _extends3['default'])({ | ||
role: 'tab', | ||
@@ -100,4 +100,4 @@ 'aria-disabled': child.props.disabled ? 'true' : 'false', | ||
var cls = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls + '-bar', 1), (0, _defineProperty3["default"])(_classnames, className, !!className), _classnames)); | ||
return _react2["default"].createElement( | ||
var cls = (0, _classnames3['default'])((_classnames = {}, (0, _defineProperty3['default'])(_classnames, prefixCls + '-bar', 1), (0, _defineProperty3['default'])(_classnames, className, !!className), _classnames)); | ||
return _react2['default'].createElement( | ||
'div', | ||
@@ -112,3 +112,3 @@ { | ||
}, | ||
extraContent ? _react2["default"].createElement( | ||
extraContent ? _react2['default'].createElement( | ||
'div', | ||
@@ -115,0 +115,0 @@ { |
@@ -33,14 +33,14 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var TabContent = (0, _createReactClass2["default"])({ | ||
var TabContent = (0, _createReactClass2['default'])({ | ||
displayName: 'TabContent', | ||
propTypes: { | ||
animated: _propTypes2["default"].bool, | ||
animatedWithMargin: _propTypes2["default"].bool, | ||
prefixCls: _propTypes2["default"].string, | ||
children: _propTypes2["default"].any, | ||
activeKey: _propTypes2["default"].string, | ||
style: _propTypes2["default"].any, | ||
tabBarPosition: _propTypes2["default"].string | ||
animated: _propTypes2['default'].bool, | ||
animatedWithMargin: _propTypes2['default'].bool, | ||
prefixCls: _propTypes2['default'].string, | ||
children: _propTypes2['default'].any, | ||
activeKey: _propTypes2['default'].string, | ||
style: _propTypes2['default'].any, | ||
tabBarPosition: _propTypes2['default'].string | ||
}, | ||
@@ -58,3 +58,3 @@ getDefaultProps: function getDefaultProps() { | ||
_react2["default"].Children.forEach(children, function (child) { | ||
_react2['default'].Children.forEach(children, function (child) { | ||
if (!child) { | ||
@@ -65,3 +65,3 @@ return; | ||
var active = activeKey === key; | ||
newChildren.push(_react2["default"].cloneElement(child, { | ||
newChildren.push(_react2['default'].cloneElement(child, { | ||
active: active, | ||
@@ -87,3 +87,3 @@ destroyInactiveTabPane: props.destroyInactiveTabPane, | ||
var classes = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls + '-content', true), (0, _defineProperty3["default"])(_classnames, animated ? prefixCls + '-content-animated' : prefixCls + '-content-no-animated', true), _classnames)); | ||
var classes = (0, _classnames3['default'])((_classnames = {}, (0, _defineProperty3['default'])(_classnames, prefixCls + '-content', true), (0, _defineProperty3['default'])(_classnames, animated ? prefixCls + '-content-animated' : prefixCls + '-content-no-animated', true), _classnames)); | ||
if (animated) { | ||
@@ -93,5 +93,5 @@ var activeIndex = (0, _utils.getActiveIndex)(children, activeKey); | ||
var animatedStyle = animatedWithMargin ? (0, _utils.getMarginStyle)(activeIndex, tabBarPosition) : (0, _utils.getTransformPropValue)((0, _utils.getTransformByIndex)(activeIndex, tabBarPosition)); | ||
style = (0, _extends3["default"])({}, style, animatedStyle); | ||
style = (0, _extends3['default'])({}, style, animatedStyle); | ||
} else { | ||
style = (0, _extends3["default"])({}, style, { | ||
style = (0, _extends3['default'])({}, style, { | ||
display: 'none' | ||
@@ -101,3 +101,3 @@ }); | ||
} | ||
return _react2["default"].createElement( | ||
return _react2['default'].createElement( | ||
'div', | ||
@@ -113,3 +113,3 @@ { | ||
exports["default"] = TabContent; | ||
exports['default'] = TabContent; | ||
module.exports = exports['default']; |
@@ -27,13 +27,13 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var TabPane = (0, _createReactClass2["default"])({ | ||
var TabPane = (0, _createReactClass2['default'])({ | ||
displayName: 'TabPane', | ||
propTypes: { | ||
className: _propTypes2["default"].string, | ||
active: _propTypes2["default"].bool, | ||
style: _propTypes2["default"].any, | ||
destroyInactiveTabPane: _propTypes2["default"].bool, | ||
forceRender: _propTypes2["default"].bool, | ||
placeholder: _propTypes2["default"].node | ||
className: _propTypes2['default'].string, | ||
active: _propTypes2['default'].bool, | ||
style: _propTypes2['default'].any, | ||
destroyInactiveTabPane: _propTypes2['default'].bool, | ||
forceRender: _propTypes2['default'].bool, | ||
placeholder: _propTypes2['default'].node | ||
}, | ||
@@ -54,5 +54,5 @@ getDefaultProps: function getDefaultProps() { | ||
var prefixCls = props.rootPrefixCls + '-tabpane'; | ||
var cls = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls, 1), (0, _defineProperty3["default"])(_classnames, prefixCls + '-inactive', !active), (0, _defineProperty3["default"])(_classnames, prefixCls + '-active', active), (0, _defineProperty3["default"])(_classnames, className, className), _classnames)); | ||
var cls = (0, _classnames3['default'])((_classnames = {}, (0, _defineProperty3['default'])(_classnames, prefixCls, 1), (0, _defineProperty3['default'])(_classnames, prefixCls + '-inactive', !active), (0, _defineProperty3['default'])(_classnames, prefixCls + '-active', active), (0, _defineProperty3['default'])(_classnames, className, className), _classnames)); | ||
var isRender = destroyInactiveTabPane ? active : this._isActived; | ||
return _react2["default"].createElement( | ||
return _react2['default'].createElement( | ||
'div', | ||
@@ -70,3 +70,3 @@ { | ||
exports["default"] = TabPane; | ||
exports['default'] = TabPane; | ||
module.exports = exports['default']; |
243
lib/Tabs.js
@@ -15,2 +15,6 @@ 'use strict'; | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
@@ -44,3 +48,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -51,3 +55,3 @@ function noop() {} | ||
var activeKey = void 0; | ||
_react2["default"].Children.forEach(props.children, function (child) { | ||
_react2['default'].Children.forEach(props.children, function (child) { | ||
if (child && !activeKey && !child.props.disabled) { | ||
@@ -61,8 +65,8 @@ activeKey = child.key; | ||
var Tabs = function (_React$Component) { | ||
(0, _inherits3["default"])(Tabs, _React$Component); | ||
(0, _inherits3['default'])(Tabs, _React$Component); | ||
function Tabs(props) { | ||
(0, _classCallCheck3["default"])(this, Tabs); | ||
(0, _classCallCheck3['default'])(this, Tabs); | ||
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props)); | ||
var _this = (0, _possibleConstructorReturn3['default'])(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, props)); | ||
@@ -93,128 +97,135 @@ _this.render = _this.render.bind(_this); | ||
Tabs.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
if ('activeKey' in nextProps) { | ||
this.setState({ | ||
activeKey: nextProps.activeKey | ||
}); | ||
} | ||
}; | ||
Tabs.prototype.onTabClick = function onTabClick(activeKey) { | ||
if (this.tabBar.props.onTabClick) { | ||
this.tabBar.props.onTabClick(activeKey); | ||
} | ||
this.setActiveKey(activeKey); | ||
}; | ||
Tabs.prototype.onNavKeyDown = function onNavKeyDown(e) { | ||
var eventKeyCode = e.keyCode; | ||
if (eventKeyCode === _KeyCode2["default"].RIGHT || eventKeyCode === _KeyCode2["default"].DOWN) { | ||
e.preventDefault(); | ||
var nextKey = this.getNextActiveKey(true); | ||
this.onTabClick(nextKey); | ||
} else if (eventKeyCode === _KeyCode2["default"].LEFT || eventKeyCode === _KeyCode2["default"].UP) { | ||
e.preventDefault(); | ||
var previousKey = this.getNextActiveKey(false); | ||
this.onTabClick(previousKey); | ||
} | ||
}; | ||
Tabs.prototype.setActiveKey = function setActiveKey(activeKey) { | ||
if (this.state.activeKey !== activeKey) { | ||
if (!('activeKey' in this.props)) { | ||
(0, _createClass3['default'])(Tabs, [{ | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
if ('activeKey' in nextProps) { | ||
this.setState({ | ||
activeKey: activeKey | ||
activeKey: nextProps.activeKey | ||
}); | ||
} | ||
this.props.onChange(activeKey); | ||
} | ||
}; | ||
Tabs.prototype.getNextActiveKey = function getNextActiveKey(next) { | ||
var activeKey = this.state.activeKey; | ||
var children = []; | ||
_react2["default"].Children.forEach(this.props.children, function (c) { | ||
if (c && !c.props.disabled) { | ||
if (next) { | ||
children.push(c); | ||
} else { | ||
children.unshift(c); | ||
}, { | ||
key: 'onTabClick', | ||
value: function onTabClick(activeKey) { | ||
if (this.tabBar.props.onTabClick) { | ||
this.tabBar.props.onTabClick(activeKey); | ||
} | ||
this.setActiveKey(activeKey); | ||
} | ||
}, { | ||
key: 'onNavKeyDown', | ||
value: function onNavKeyDown(e) { | ||
var eventKeyCode = e.keyCode; | ||
if (eventKeyCode === _KeyCode2['default'].RIGHT || eventKeyCode === _KeyCode2['default'].DOWN) { | ||
e.preventDefault(); | ||
var nextKey = this.getNextActiveKey(true); | ||
this.onTabClick(nextKey); | ||
} else if (eventKeyCode === _KeyCode2['default'].LEFT || eventKeyCode === _KeyCode2['default'].UP) { | ||
e.preventDefault(); | ||
var previousKey = this.getNextActiveKey(false); | ||
this.onTabClick(previousKey); | ||
} | ||
} | ||
}, { | ||
key: 'setActiveKey', | ||
value: function setActiveKey(activeKey) { | ||
if (this.state.activeKey !== activeKey) { | ||
if (!('activeKey' in this.props)) { | ||
this.setState({ | ||
activeKey: activeKey | ||
}); | ||
} | ||
this.props.onChange(activeKey); | ||
} | ||
}); | ||
var length = children.length; | ||
var ret = length && children[0].key; | ||
children.forEach(function (child, i) { | ||
if (child.key === activeKey) { | ||
if (i === length - 1) { | ||
ret = children[0].key; | ||
} else { | ||
ret = children[i + 1].key; | ||
} | ||
}, { | ||
key: 'getNextActiveKey', | ||
value: function getNextActiveKey(next) { | ||
var activeKey = this.state.activeKey; | ||
var children = []; | ||
_react2['default'].Children.forEach(this.props.children, function (c) { | ||
if (c && !c.props.disabled) { | ||
if (next) { | ||
children.push(c); | ||
} else { | ||
children.unshift(c); | ||
} | ||
} | ||
} | ||
}); | ||
return ret; | ||
}; | ||
}); | ||
var length = children.length; | ||
var ret = length && children[0].key; | ||
children.forEach(function (child, i) { | ||
if (child.key === activeKey) { | ||
if (i === length - 1) { | ||
ret = children[0].key; | ||
} else { | ||
ret = children[i + 1].key; | ||
} | ||
} | ||
}); | ||
return ret; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _classnames; | ||
Tabs.prototype.render = function render() { | ||
var _classnames; | ||
var props = this.props; | ||
var prefixCls = props.prefixCls, | ||
tabBarPosition = props.tabBarPosition, | ||
className = props.className, | ||
renderTabContent = props.renderTabContent, | ||
renderTabBar = props.renderTabBar; | ||
var props = this.props; | ||
var prefixCls = props.prefixCls, | ||
tabBarPosition = props.tabBarPosition, | ||
className = props.className, | ||
renderTabContent = props.renderTabContent, | ||
renderTabBar = props.renderTabBar; | ||
var cls = (0, _classnames3['default'])((_classnames = {}, (0, _defineProperty3['default'])(_classnames, prefixCls, 1), (0, _defineProperty3['default'])(_classnames, prefixCls + '-' + tabBarPosition, 1), (0, _defineProperty3['default'])(_classnames, className, !!className), _classnames)); | ||
var cls = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls, 1), (0, _defineProperty3["default"])(_classnames, prefixCls + '-' + tabBarPosition, 1), (0, _defineProperty3["default"])(_classnames, className, !!className), _classnames)); | ||
this.tabBar = renderTabBar(); | ||
var contents = [_react2["default"].cloneElement(this.tabBar, { | ||
prefixCls: prefixCls, | ||
key: 'tabBar', | ||
onKeyDown: this.onNavKeyDown, | ||
tabBarPosition: tabBarPosition, | ||
onTabClick: this.onTabClick, | ||
panels: props.children, | ||
activeKey: this.state.activeKey | ||
}), _react2["default"].cloneElement(renderTabContent(), { | ||
prefixCls: prefixCls, | ||
tabBarPosition: tabBarPosition, | ||
activeKey: this.state.activeKey, | ||
destroyInactiveTabPane: props.destroyInactiveTabPane, | ||
children: props.children, | ||
onChange: this.setActiveKey, | ||
key: 'tabContent' | ||
})]; | ||
if (tabBarPosition === 'bottom') { | ||
contents.reverse(); | ||
this.tabBar = renderTabBar(); | ||
var contents = [_react2['default'].cloneElement(this.tabBar, { | ||
prefixCls: prefixCls, | ||
key: 'tabBar', | ||
onKeyDown: this.onNavKeyDown, | ||
tabBarPosition: tabBarPosition, | ||
onTabClick: this.onTabClick, | ||
panels: props.children, | ||
activeKey: this.state.activeKey | ||
}), _react2['default'].cloneElement(renderTabContent(), { | ||
prefixCls: prefixCls, | ||
tabBarPosition: tabBarPosition, | ||
activeKey: this.state.activeKey, | ||
destroyInactiveTabPane: props.destroyInactiveTabPane, | ||
children: props.children, | ||
onChange: this.setActiveKey, | ||
key: 'tabContent' | ||
})]; | ||
if (tabBarPosition === 'bottom') { | ||
contents.reverse(); | ||
} | ||
return _react2['default'].createElement( | ||
'div', | ||
{ | ||
className: cls, | ||
style: props.style | ||
}, | ||
contents | ||
); | ||
} | ||
return _react2["default"].createElement( | ||
'div', | ||
{ | ||
className: cls, | ||
style: props.style | ||
}, | ||
contents | ||
); | ||
}; | ||
}]); | ||
return Tabs; | ||
}(_react2["default"].Component); | ||
}(_react2['default'].Component); | ||
exports["default"] = Tabs; | ||
exports['default'] = Tabs; | ||
Tabs.propTypes = { | ||
destroyInactiveTabPane: _propTypes2["default"].bool, | ||
renderTabBar: _propTypes2["default"].func.isRequired, | ||
renderTabContent: _propTypes2["default"].func.isRequired, | ||
onChange: _propTypes2["default"].func, | ||
children: _propTypes2["default"].any, | ||
prefixCls: _propTypes2["default"].string, | ||
className: _propTypes2["default"].string, | ||
tabBarPosition: _propTypes2["default"].string, | ||
style: _propTypes2["default"].object, | ||
activeKey: _propTypes2["default"].string, | ||
defaultActiveKey: _propTypes2["default"].string | ||
destroyInactiveTabPane: _propTypes2['default'].bool, | ||
renderTabBar: _propTypes2['default'].func.isRequired, | ||
renderTabContent: _propTypes2['default'].func.isRequired, | ||
onChange: _propTypes2['default'].func, | ||
children: _propTypes2['default'].any, | ||
prefixCls: _propTypes2['default'].string, | ||
className: _propTypes2['default'].string, | ||
tabBarPosition: _propTypes2['default'].string, | ||
style: _propTypes2['default'].object, | ||
activeKey: _propTypes2['default'].string, | ||
defaultActiveKey: _propTypes2['default'].string | ||
}; | ||
@@ -230,3 +241,3 @@ | ||
Tabs.TabPane = _TabPane2["default"]; | ||
Tabs.TabPane = _TabPane2['default']; | ||
module.exports = exports['default']; |
@@ -28,3 +28,3 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -34,3 +34,3 @@ function toArray(children) { | ||
var c = []; | ||
_react2["default"].Children.forEach(children, function (child) { | ||
_react2['default'].Children.forEach(children, function (child) { | ||
if (child) { | ||
@@ -92,3 +92,3 @@ c.push(child); | ||
var marginDirection = isVertical(tabBarPosition) ? 'marginTop' : 'marginLeft'; | ||
return (0, _defineProperty3["default"])({}, marginDirection, -index * 100 + '%'); | ||
return (0, _defineProperty3['default'])({}, marginDirection, -index * 100 + '%'); | ||
} | ||
@@ -95,0 +95,0 @@ |
{ | ||
"name": "rc-tabs", | ||
"version": "7.3.4", | ||
"version": "7.5.0", | ||
"description": "tabs ui component for react", | ||
@@ -12,5 +12,7 @@ "keywords": [ | ||
"lib", | ||
"es", | ||
"assets/*.css" | ||
], | ||
"main": "./lib/index", | ||
"module": "./es/index", | ||
"homepage": "http://github.com/react-component/tabs", | ||
@@ -31,2 +33,3 @@ "author": "yiminghe@gmail.com", | ||
"build": "rc-tools run build", | ||
"compile": "rc-tools run compile", | ||
"gh-pages": "rc-tools run gh-pages", | ||
@@ -58,3 +61,3 @@ "start": "rc-tools run server", | ||
"pre-commit": "1.x", | ||
"rc-tools": "5.x", | ||
"rc-tools": "6.x", | ||
"react": "15.x", | ||
@@ -73,5 +76,5 @@ "react-dom": "^15.5.4", | ||
"prop-types": "15.x", | ||
"react-hammerjs": "~0.5.0", | ||
"rc-hammerjs": "~0.6.0", | ||
"warning": "^3.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118932
37
3223
+ Addedrc-hammerjs@~0.6.0
+ Addedrc-hammerjs@0.6.10(transitive)
- Removedreact-hammerjs@~0.5.0
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedreact-hammerjs@0.5.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.39(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)