@@ -347,8 +347,8 @@ function Table<RecordType extends DefaultRecordType>(
347347
348348 // ====================== Scroll ======================
349349 const scrollSummaryRef = React . useRef < HTMLDivElement > ( ) ;
350- const [ pingedLeft , setPingedLeft ] = React . useState ( false ) ;
351- const [ pingedRight , setPingedRight ] = React . useState ( false ) ;
350+ const [ shadowStart , setShadowStart ] = React . useState ( false ) ;
351+ const [ shadowEnd , setShadowEnd ] = React . useState ( false ) ;
352352 const [ colsWidths , updateColsWidths ] = useLayoutState ( new Map < React . Key , number > ( ) ) ;
353353
354354 // Convert map to number width
@@ -440,7 +440,6 @@ function Table<RecordType extends DefaultRecordType>(
440440
441441 const onInternalScroll = useEvent (
442442 ( { currentTarget, scrollLeft } : { currentTarget : HTMLElement ; scrollLeft ?: number } ) => {
443- const isRTL = direction === 'rtl' ;
444443 const mergedScrollLeft =
445444 typeof scrollLeft === 'number' ? scrollLeft : currentTarget . scrollLeft ;
446445
@@ -463,24 +462,20 @@ function Table<RecordType extends DefaultRecordType>(
463462 : measureTarget . scrollWidth ;
464463 const clientWidth = measureTarget . clientWidth ;
465464
465+ const absScrollStart = Math . abs ( mergedScrollLeft ) ;
466466 setScrollInfo ( ori => {
467- const nextScrollInfo : ScrollInfoType = [ mergedScrollLeft , scrollWidth - clientWidth ] ;
467+ const nextScrollInfo : ScrollInfoType = [ absScrollStart , scrollWidth - clientWidth ] ;
468468 return isEqual ( ori , nextScrollInfo ) ? ori : nextScrollInfo ;
469469 } ) ;
470470
471471 // There is no space to scroll
472472 if ( scrollWidth === clientWidth ) {
473- setPingedLeft ( false ) ;
474- setPingedRight ( false ) ;
473+ setShadowStart ( false ) ;
474+ setShadowEnd ( false ) ;
475475 return ;
476476 }
477- if ( isRTL ) {
478- setPingedLeft ( - mergedScrollLeft < scrollWidth - clientWidth ) ;
479- setPingedRight ( - mergedScrollLeft > 0 ) ;
480- } else {
481- setPingedLeft ( mergedScrollLeft > 0 ) ;
482- setPingedRight ( mergedScrollLeft < scrollWidth - clientWidth ) ;
483- }
477+ setShadowStart ( absScrollStart > 0 ) ;
478+ setShadowEnd ( absScrollStart < scrollWidth - clientWidth ) ;
484479 }
485480 } ,
486481 ) ;
@@ -497,8 +492,8 @@ function Table<RecordType extends DefaultRecordType>(
497492 scrollLeft : scrollBodyRef . current ?. scrollLeft ,
498493 } ) ;
499494 } else {
500- setPingedLeft ( false ) ;
501- setPingedRight ( false ) ;
495+ setShadowStart ( false ) ;
496+ setShadowEnd ( false ) ;
502497 }
503498 } ;
504499
@@ -771,8 +766,10 @@ function Table<RecordType extends DefaultRecordType>(
771766 < div
772767 className = { classNames ( prefixCls , className , {
773768 [ `${ prefixCls } -rtl` ] : direction === 'rtl' ,
774- [ `${ prefixCls } -ping-left` ] : pingedLeft ,
775- [ `${ prefixCls } -ping-right` ] : pingedRight ,
769+ [ `${ prefixCls } -fix-start-shadow` ] : horizonScroll ,
770+ [ `${ prefixCls } -fix-end-shadow` ] : horizonScroll ,
771+ [ `${ prefixCls } -fix-start-shadow-show` ] : horizonScroll && shadowStart ,
772+ [ `${ prefixCls } -fix-end-shadow-show` ] : horizonScroll && shadowEnd ,
776773 [ `${ prefixCls } -layout-fixed` ] : tableLayout === 'fixed' ,
777774 [ `${ prefixCls } -fixed-header` ] : fixHeader ,
778775 /** No used but for compatible */
0 commit comments