@@ -31,6 +31,8 @@ import {
3131 get as getValue ,
3232 getTargetScrollBarSize ,
3333 isEqual ,
34+ isNonNullable ,
35+ isReactRenderable ,
3436 pickAttrs ,
3537 useEvent ,
3638 useLayoutEffect ,
@@ -76,7 +78,7 @@ import Panel from './Panel';
7678import StickyScrollBar from './stickyScrollBar' ;
7779import Column from './sugar/Column' ;
7880import ColumnGroup from './sugar/ColumnGroup' ;
79- import { getColumnsKey , validateValue , validNumberValue } from './utils/valueUtil' ;
81+ import { getColumnsKey , validNumberValue } from './utils/valueUtil' ;
8082
8183export type CompareProps < T extends React . ComponentType < any > > = (
8284 prevProps : Readonly < React . ComponentProps < T > > ,
@@ -397,8 +399,8 @@ const Table = <RecordType extends DefaultRecordType>(
397399 const pureColWidths = colsKeys . map ( columnKey => colsWidths . get ( columnKey ) ) ;
398400 const colWidths = React . useMemo ( ( ) => pureColWidths , [ pureColWidths . join ( '_' ) ] ) ;
399401 const stickyOffsets = useStickyOffsets ( colWidths , flattenColumns ) ;
400- const fixHeader = scroll && validateValue ( scroll . y ) ;
401- const horizonScroll = ( scroll && validateValue ( mergedScrollX ) ) || Boolean ( expandableConfig . fixed ) ;
402+ const fixHeader = scroll && isNonNullable ( scroll . y ) ;
403+ const horizonScroll = ( scroll && isNonNullable ( mergedScrollX ) ) || Boolean ( expandableConfig . fixed ) ;
402404 const fixColumn = horizonScroll && flattenColumns . some ( ( { fixed } ) => fixed ) ;
403405
404406 // Sticky
@@ -675,10 +677,9 @@ const Table = <RecordType extends DefaultRecordType>(
675677 < ColGroup colWidths = { flattenColumns . map ( ( { width } ) => width ) } columns = { flattenColumns } />
676678 ) ;
677679
678- const captionElement =
679- caption !== null && caption !== undefined ? (
680- < caption className = { `${ prefixCls } -caption` } > { caption } </ caption >
681- ) : undefined ;
680+ const captionElement = isNonNullable ( caption ) ? (
681+ < caption className = { `${ prefixCls } -caption` } > { caption } </ caption >
682+ ) : undefined ;
682683
683684 const dataProps = pickAttrs ( props , { data : true } ) ;
684685 const ariaProps = pickAttrs ( props , { aria : true } ) ;
@@ -730,7 +731,7 @@ const Table = <RecordType extends DefaultRecordType>(
730731 { captionElement }
731732 { bodyColGroup }
732733 { bodyTable }
733- { ! fixFooter && summaryNode && (
734+ { ! fixFooter && isReactRenderable ( summaryNode ) && (
734735 < Footer stickyOffsets = { stickyOffsets } flattenColumns = { flattenColumns } >
735736 { summaryNode }
736737 </ Footer >
@@ -813,7 +814,7 @@ const Table = <RecordType extends DefaultRecordType>(
813814 { bodyColGroup }
814815 { showHeader !== false && < Header { ...headerProps } { ...columnContext } /> }
815816 { bodyTable }
816- { summaryNode && (
817+ { isReactRenderable ( summaryNode ) && (
817818 < Footer stickyOffsets = { stickyOffsets } flattenColumns = { flattenColumns } >
818819 { summaryNode }
819820 </ Footer >
0 commit comments