1- import React , { forwardRef , RefAttributes , useEffect , useImperativeHandle , useMemo , useRef , useState } from 'react' ;
1+ import React , { forwardRef , type RefAttributes , useEffect , useImperativeHandle , useMemo , useRef , useState } from 'react' ;
22import classNames from 'classnames' ;
33import { pick } from 'lodash-es' ;
4+
45import log from '@tdesign/common-js/log/index' ;
56import { getIEVersion } from '@tdesign/common-js/utils/helper' ;
67import Affix , { type AffixRef } from '../affix' ;
@@ -365,14 +366,14 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
365366 const barWidth = isWidthOverflow ? scrollbarWidth : 0 ;
366367 const affixHeaderWrapHeight = affixHeaderHeight - barWidth ;
367368 const affixHeaderWrapHeightStyle = {
368- width : `${ tableWidth . current } px` ,
369+ width : `${ tableWidth } px` ,
369370 height : `${ affixHeaderWrapHeight } px` ,
370371 opacity : headerOpacity ,
371372 } ;
372- const affixedHeader = Boolean ( ( headerAffixedTop || virtualConfig . isVirtualScroll ) && tableWidth . current ) && (
373+ const affixedHeader = Boolean ( ( headerAffixedTop || virtualConfig . isVirtualScroll ) && tableWidth ) && (
373374 < div
374375 ref = { affixHeaderRef }
375- style = { { width : `${ tableWidth . current - borderWidth } px` , opacity : headerOpacity } }
376+ style = { { width : `${ tableWidth } px` , opacity : headerOpacity } }
376377 className = { classNames ( [
377378 'scrollbar' ,
378379 {
@@ -382,7 +383,7 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
382383 >
383384 < table
384385 className = { classNames ( tableElmClasses ) }
385- style = { { ...tableElementStyles , width : tableElmWidth . current ? `${ tableElmWidth . current } px` : undefined } }
386+ style = { { ...tableElementStyles , width : tableElmWidth ? `${ tableElmWidth } px` : undefined } }
386387 >
387388 { renderColGroup ( true ) }
388389 { showHeader && < THead { ...headProps } /> }
@@ -431,7 +432,7 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
431432 const totalMarginTop = tableFootHeight + marginScrollbarWidth ;
432433 const hasFooter = props . footData ?. length || props . footerSummary ;
433434 const affixedFooter = Boolean (
434- ( virtualConfig . isVirtualScroll || props . footerAffixedBottom ) && hasFooter && tableWidth . current ,
435+ ( virtualConfig . isVirtualScroll || props . footerAffixedBottom ) && hasFooter && tableWidth ,
435436 ) && (
436437 < Affix
437438 className = { tableBaseClass . affixedFooterWrap }
@@ -443,15 +444,15 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
443444 >
444445 < div
445446 ref = { affixFooterRef }
446- style = { { width : `${ tableWidth . current - borderWidth } px` , opacity : Number ( showAffixFooter ) } }
447+ style = { { width : `${ tableWidth } px` , opacity : Number ( showAffixFooter ) } }
447448 className = { classNames ( [
448449 'scrollbar' ,
449450 { [ tableBaseClass . affixedFooterElm ] : props . footerAffixedBottom || virtualConfig . isVirtualScroll } ,
450451 ] ) }
451452 >
452453 < table
453454 className = { tableElmClasses }
454- style = { { ...tableElementStyles , width : tableElmWidth . current ? `${ tableElmWidth . current } px` : undefined } }
455+ style = { { ...tableElementStyles , width : tableElmWidth ? `${ tableElmWidth } px` : undefined } }
455456 >
456457 { renderColGroup ( true ) }
457458 < TFoot
@@ -516,8 +517,8 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
516517 style = { {
517518 ...tableElementStyles ,
518519 width :
519- resizable && isWidthOverflow && tableElmWidth . current
520- ? `${ tableElmWidth . current } px`
520+ resizable && isWidthOverflow && tableElmWidth
521+ ? `${ tableElmWidth } px`
521522 : tableElementStyles . width ,
522523 } }
523524 >
@@ -633,7 +634,6 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
633634 tableElmClasses ,
634635 tableElementStyles ,
635636 columns ,
636- spansAndLeafNodes ,
637637 showHeader ,
638638 props . headerAffixedTop ,
639639 ] ,
@@ -655,7 +655,6 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
655655 tableElmWidth ,
656656 affixFooterRef ,
657657 borderWidth ,
658- bordered ,
659658 isWidthOverflow ,
660659 scrollbarWidth ,
661660 tableElmClasses ,
@@ -669,7 +668,6 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
669668 props . footerSummary ,
670669 props . footerAffixedBottom ,
671670 props . rowspanAndColspanInFooter ,
672- tableWidth . current ,
673671 ] ,
674672 ) ;
675673
@@ -698,12 +696,12 @@ const BaseTable = forwardRef<BaseTableRef, BaseTableProps>((originalProps, ref)
698696 ref = { horizontalScrollbarRef }
699697 className = { classNames ( [ 'scrollbar' , tableBaseClass . obviousScrollbar ] ) }
700698 style = { {
701- width : `${ tableWidth . current } px` ,
699+ width : `${ tableWidth } px` ,
702700 overflow : 'auto' ,
703701 opacity : Number ( showAffixFooter ) ,
704702 } }
705703 >
706- < div style = { { width : `${ tableElmWidth . current } px` , height : '5px' } } > </ div >
704+ < div style = { { width : `${ tableElmWidth } px` , height : '5px' } } > </ div >
707705 </ div >
708706 </ Affix >
709707 ) ;
0 commit comments