@@ -53,7 +53,6 @@ class Pagination extends React.Component {
5353 nextIcon : PropTypes . oneOfType ( [ PropTypes . func , PropTypes . node ] ) ,
5454 jumpPrevIcon : PropTypes . oneOfType ( [ PropTypes . func , PropTypes . node ] ) ,
5555 jumpNextIcon : PropTypes . oneOfType ( [ PropTypes . func , PropTypes . node ] ) ,
56- hideBoundary : PropTypes . bool ,
5756 pagerCount : PropTypes . number ,
5857 } ;
5958
@@ -76,7 +75,6 @@ class Pagination extends React.Component {
7675 locale : LOCALE ,
7776 style : { } ,
7877 itemRender : defaultItemRender ,
79- hideBoundary : false ,
8078 pagerCount : 5 ,
8179 } ;
8280
@@ -338,8 +336,8 @@ class Pagination extends React.Component {
338336 let lastPager = null ;
339337 let gotoButton = null ;
340338
341- const { pagerCount, hideBoundary } = props ;
342- const pageBoundaryCount = hideBoundary ? 0 : 1 ;
339+ const { pagerCount } = props ;
340+ const boundaryRemainder = pagerCount % 2 === 0 ? 1 : 0 ;
343341 const goButton = ( props . showQuickJumper && props . showQuickJumper . goButton ) ;
344342 const halfPagerCount = Math . max ( 1 , Math . floor ( pagerCount / 2 ) ) ;
345343 const pageBufferSize = props . showLessItems ? 1 : halfPagerCount ;
@@ -507,7 +505,19 @@ class Pagination extends React.Component {
507505 </ li >
508506 ) ;
509507 }
508+ const firstPagerRender = props . itemRender (
509+ 1 ,
510+ 'jump-first' ,
511+ this . getItemIcon ( props . jumpNextIcon )
512+ )
513+ const lastPagerRender = props . itemRender (
514+ allPages ,
515+ 'jump-last' ,
516+ this . getItemIcon ( props . jumpNextIcon )
517+ )
518+
510519 lastPager = (
520+ firstPagerRender === null ? null :
511521 < Pager
512522 locale = { props . locale }
513523 last
@@ -522,6 +532,7 @@ class Pagination extends React.Component {
522532 />
523533 ) ;
524534 firstPager = (
535+ lastPagerRender === null ? null :
525536 < Pager
526537 locale = { props . locale }
527538 rootPrefixCls = { prefixCls }
@@ -536,14 +547,14 @@ class Pagination extends React.Component {
536547 ) ;
537548
538549 let left = Math . max ( 1 , current - pageBufferSize ) ;
539- let right = Math . min ( current + pageBufferSize , allPages ) ;
550+ let right = Math . min ( current + pageBufferSize - boundaryRemainder , allPages ) ;
540551
541552 if ( current - 1 <= pageBufferSize ) {
542- right = 1 + pageBufferSize * 2 + pageBoundaryCount ;
553+ right = 1 + pageBufferSize * 2 - boundaryRemainder ;
543554 }
544555
545556 if ( allPages - current <= pageBufferSize ) {
546- left = allPages - pageBufferSize * 2 - pageBoundaryCount ;
557+ left = allPages - pageBufferSize * 2 ;
547558 }
548559
549560 for ( let i = left ; i <= right ; i ++ ) {
@@ -564,8 +575,8 @@ class Pagination extends React.Component {
564575 }
565576
566577 if (
567- current - pageBoundaryCount > pageBufferSize &&
568- current !== pageBoundaryCount + pageBufferSize + 1
578+ current - boundaryRemainder > pageBufferSize &&
579+ current !== boundaryRemainder + pageBufferSize + 1
569580 ) {
570581 pagerList [ 0 ] = React . cloneElement ( pagerList [ 0 ] , {
571582 className : `${ prefixCls } -item-after-jump-prev` ,
@@ -579,10 +590,10 @@ class Pagination extends React.Component {
579590 pagerList . push ( jumpNext ) ;
580591 }
581592
582- if ( left !== 1 && ! hideBoundary ) {
593+ if ( left !== 1 ) {
583594 pagerList . unshift ( firstPager ) ;
584595 }
585- if ( right !== allPages && ! hideBoundary ) {
596+ if ( right !== allPages ) {
586597 pagerList . push ( lastPager ) ;
587598 }
588599 }
0 commit comments