@@ -1076,6 +1076,8 @@ return /******/ (function(modules) { // webpackBootstrap
10761076
10771077 exports . __esModule = true ;
10781078
1079+ 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 ; } ;
1080+
10791081 var _react = __webpack_require__ ( 2 ) ;
10801082
10811083 var _react2 = _interopRequireDefault ( _react ) ;
@@ -1192,6 +1194,23 @@ return /******/ (function(modules) { // webpackBootstrap
11921194 }
11931195 }
11941196 } ,
1197+ canGoNext : function canGoNext ( opts ) {
1198+ var canGo = true ;
1199+ if ( ! opts . infinite ) {
1200+ if ( opts . centerMode ) {
1201+ // check if current slide is last slide
1202+ if ( opts . currentSlide >= opts . slideCount - 1 ) {
1203+ canGo = false ;
1204+ }
1205+ } else {
1206+ // check if all slides are shown in slider
1207+ if ( opts . slideCount <= opts . slidesToShow || opts . currentSlide >= opts . slideCount - opts . slidesToShow ) {
1208+ canGo = false ;
1209+ }
1210+ }
1211+ }
1212+ return canGo ;
1213+ } ,
11951214 slideHandler : function slideHandler ( index ) {
11961215 var _this = this ;
11971216
@@ -1378,21 +1397,32 @@ return /******/ (function(modules) { // webpackBootstrap
13781397
13791398 return 'vertical' ;
13801399 } ,
1381- autoPlay : function autoPlay ( ) {
1382- var _this2 = this ;
1400+ play : function play ( ) {
1401+ var nextIndex ;
1402+
1403+ if ( ! this . state . mounted ) {
1404+ return false ;
1405+ }
1406+
1407+ if ( this . props . rtl ) {
1408+ nextIndex = this . state . currentSlide - this . props . slidesToScroll ;
1409+ } else {
1410+ if ( this . canGoNext ( _extends ( { } , this . props , this . state ) ) ) {
1411+ nextIndex = this . state . currentSlide + this . props . slidesToScroll ;
1412+ } else {
1413+ return false ;
1414+ }
1415+ }
13831416
1417+ this . slideHandler ( nextIndex ) ;
1418+ } ,
1419+ autoPlay : function autoPlay ( ) {
13841420 if ( this . state . autoPlayTimer ) {
13851421 return ;
13861422 }
1387- var play = function play ( ) {
1388- if ( _this2 . state . mounted ) {
1389- var nextIndex = _this2 . props . rtl ? _this2 . state . currentSlide - _this2 . props . slidesToScroll : _this2 . state . currentSlide + _this2 . props . slidesToScroll ;
1390- _this2 . slideHandler ( nextIndex ) ;
1391- }
1392- } ;
13931423 if ( this . props . autoplay ) {
13941424 this . setState ( {
1395- autoPlayTimer : setInterval ( play , this . props . autoplaySpeed )
1425+ autoPlayTimer : setInterval ( this . play , this . props . autoplaySpeed )
13961426 } ) ;
13971427 }
13981428 } ,
@@ -1845,6 +1875,10 @@ return /******/ (function(modules) { // webpackBootstrap
18451875
18461876 var _classnames2 = _interopRequireDefault ( _classnames ) ;
18471877
1878+ var _helpers = __webpack_require__ ( 8 ) ;
1879+
1880+ var _helpers2 = _interopRequireDefault ( _helpers ) ;
1881+
18481882 function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
18491883
18501884 var PrevArrow = exports . PrevArrow = _react2 . default . createClass ( {
@@ -1902,20 +1936,9 @@ return /******/ (function(modules) { // webpackBootstrap
19021936 var nextClasses = { 'slick-arrow' : true , 'slick-next' : true } ;
19031937 var nextHandler = this . clickHandler . bind ( this , { message : 'next' } ) ;
19041938
1905- if ( ! this . props . infinite ) {
1906- if ( this . props . centerMode ) {
1907- // check if current slide is last slide
1908- if ( this . props . currentSlide >= this . props . slideCount - 1 ) {
1909- nextClasses [ 'slick-disabled' ] = true ;
1910- nextHandler = null ;
1911- }
1912- } else {
1913- // check if all slides are shown in slider
1914- if ( this . props . slideCount <= this . props . slidesToShow || this . props . currentSlide >= this . props . slideCount - this . props . slidesToShow ) {
1915- nextClasses [ 'slick-disabled' ] = true ;
1916- nextHandler = null ;
1917- }
1918- }
1939+ if ( ! _helpers2 . default . canGoNext ( this . props ) ) {
1940+ nextClasses [ 'slick-disabled' ] = true ;
1941+ nextHandler = null ;
19191942 }
19201943
19211944 var nextArrowProps = {
0 commit comments