@@ -72,7 +72,8 @@ interface PaginationState {
7272 pageSize : number ;
7373}
7474
75- function noop ( ) { }
75+ function noop ( ) {
76+ }
7677
7778function isInteger ( v : number ) {
7879 const value = Number ( v ) ;
@@ -124,6 +125,7 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
124125 totalBoundaryShowSizeChanger : 50 ,
125126 } ;
126127 paginationNode = React . createRef < HTMLUListElement > ( ) ;
128+
127129 constructor ( props : PaginationProps ) {
128130 super ( props ) ;
129131
@@ -529,6 +531,7 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
529531 ) ;
530532 }
531533
534+ const prev = this . renderPrev ( prevPage ) ;
532535 return (
533536 < ul
534537 className = { classNames (
@@ -542,18 +545,22 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
542545 { ...dataOrAriaAttributeProps }
543546 >
544547 { totalText }
545- < li
546- title = { showTitle ? locale . prev_page : null }
547- onClick = { this . prev }
548- tabIndex = { this . hasPrev ( ) ? 0 : null }
549- onKeyPress = { this . runIfEnterPrev }
550- className = { classNames ( `${ prefixCls } -prev` , {
551- [ `${ prefixCls } -disabled` ] : ! this . hasPrev ( ) ,
552- } ) }
553- aria-disabled = { ! this . hasPrev ( ) }
554- >
555- { this . renderPrev ( prevPage ) }
556- </ li >
548+ {
549+ prev ? (
550+ < li
551+ title = { showTitle ? locale . prev_page : null }
552+ onClick = { this . prev }
553+ tabIndex = { this . hasPrev ( ) ? 0 : null }
554+ onKeyPress = { this . runIfEnterPrev }
555+ className = { classNames ( `${ prefixCls } -prev` , {
556+ [ `${ prefixCls } -disabled` ] : ! this . hasPrev ( ) ,
557+ } ) }
558+ aria-disabled = { ! this . hasPrev ( ) }
559+ >
560+ { prev }
561+ </ li >
562+ ) : null
563+ }
557564 < li
558565 title = { showTitle ? `${ current } /${ allPages } ` : null }
559566 className = { `${ prefixCls } -simple-pager` }
@@ -616,9 +623,20 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
616623 } else {
617624 const prevItemTitle = showLessItems ? locale . prev_3 : locale . prev_5 ;
618625 const nextItemTitle = showLessItems ? locale . next_3 : locale . next_5 ;
626+
627+ const jumpPrevContent = itemRender (
628+ this . getJumpPrevPage ( ) ,
629+ 'jump-prev' ,
630+ this . getItemIcon ( jumpPrevIcon , 'prev page' ) ,
631+ ) ;
632+ const jumpNextContent = itemRender (
633+ this . getJumpNextPage ( ) ,
634+ 'jump-next' ,
635+ this . getItemIcon ( jumpNextIcon , 'next page' ) ,
636+ ) ;
619637 if ( showPrevNextJumpers ) {
620638 jumpPrev = (
621- < li
639+ jumpPrevContent ? < li
622640 title = { showTitle ? prevItemTitle : null }
623641 key = "prev"
624642 onClick = { this . jumpPrev }
@@ -628,15 +646,11 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
628646 [ `${ prefixCls } -jump-prev-custom-icon` ] : ! ! jumpPrevIcon ,
629647 } ) }
630648 >
631- { itemRender (
632- this . getJumpPrevPage ( ) ,
633- 'jump-prev' ,
634- this . getItemIcon ( jumpPrevIcon , 'prev page' ) ,
635- ) }
636- </ li >
649+ { jumpPrevContent }
650+ </ li > : null
637651 ) ;
638652 jumpNext = (
639- < li
653+ jumpNextContent ? < li
640654 title = { showTitle ? nextItemTitle : null }
641655 key = "next"
642656 tabIndex = { 0 }
@@ -646,12 +660,8 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
646660 [ `${ prefixCls } -jump-next-custom-icon` ] : ! ! jumpNextIcon ,
647661 } ) }
648662 >
649- { itemRender (
650- this . getJumpNextPage ( ) ,
651- 'jump-next' ,
652- this . getItemIcon ( jumpNextIcon , 'next page' ) ,
653- ) }
654- </ li >
663+ { jumpNextContent }
664+ </ li > : null
655665 ) ;
656666 }
657667 lastPager = (
@@ -739,6 +749,9 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
739749
740750 const prevDisabled = ! this . hasPrev ( ) || ! allPages ;
741751 const nextDisabled = ! this . hasNext ( ) || ! allPages ;
752+
753+ const prev = this . renderPrev ( prevPage ) ;
754+ const next = this . renderNext ( nextPage ) ;
742755 return (
743756 < ul
744757 className = { classNames ( prefixCls , className , {
@@ -749,31 +762,39 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
749762 { ...dataOrAriaAttributeProps }
750763 >
751764 { totalText }
752- < li
753- title = { showTitle ? locale . prev_page : null }
754- onClick = { this . prev }
755- tabIndex = { prevDisabled ? null : 0 }
756- onKeyPress = { this . runIfEnterPrev }
757- className = { classNames ( `${ prefixCls } -prev` , {
758- [ `${ prefixCls } -disabled` ] : prevDisabled ,
759- } ) }
760- aria-disabled = { prevDisabled }
761- >
762- { this . renderPrev ( prevPage ) }
763- </ li >
765+ {
766+ prev ? (
767+ < li
768+ title = { showTitle ? locale . prev_page : null }
769+ onClick = { this . prev }
770+ tabIndex = { prevDisabled ? null : 0 }
771+ onKeyPress = { this . runIfEnterPrev }
772+ className = { classNames ( `${ prefixCls } -prev` , {
773+ [ `${ prefixCls } -disabled` ] : prevDisabled ,
774+ } ) }
775+ aria-disabled = { prevDisabled }
776+ >
777+ { prev }
778+ </ li >
779+ ) : null
780+ }
764781 { pagerList }
765- < li
766- title = { showTitle ? locale . next_page : null }
767- onClick = { this . next }
768- tabIndex = { nextDisabled ? null : 0 }
769- onKeyPress = { this . runIfEnterNext }
770- className = { classNames ( `${ prefixCls } -next` , {
771- [ `${ prefixCls } -disabled` ] : nextDisabled ,
772- } ) }
773- aria-disabled = { nextDisabled }
774- >
775- { this . renderNext ( nextPage ) }
776- </ li >
782+ {
783+ next ? (
784+ < li
785+ title = { showTitle ? locale . next_page : null }
786+ onClick = { this . next }
787+ tabIndex = { nextDisabled ? null : 0 }
788+ onKeyPress = { this . runIfEnterNext }
789+ className = { classNames ( `${ prefixCls } -next` , {
790+ [ `${ prefixCls } -disabled` ] : nextDisabled ,
791+ } ) }
792+ aria-disabled = { nextDisabled }
793+ >
794+ { next }
795+ </ li >
796+ ) : null
797+ }
777798 < Options
778799 disabled = { disabled }
779800 locale = { locale }
0 commit comments