11import { useContext } from '@rc-component/context' ;
2- import classNames from 'classnames' ;
32import VirtualList , { type ListProps , type ListRef } from 'rc-virtual-list' ;
43import * as React from 'react' ;
5- import Cell from '../Cell' ;
64import TableContext , { responseImmutable } from '../context/TableContext' ;
75import useFlattenRecords , { type FlattenData } from '../hooks/useFlattenRecords' ;
86import type { ColumnType , OnCustomizeScroll , ScrollConfig } from '../interface' ;
@@ -29,7 +27,6 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
2927 expandedKeys,
3028 prefixCls,
3129 childrenColumnName,
32- emptyNode,
3330 scrollX,
3431 } = useContext ( TableContext , [
3532 'flattenColumns' ,
@@ -38,7 +35,6 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
3835 'prefixCls' ,
3936 'expandedKeys' ,
4037 'childrenColumnName' ,
41- 'emptyNode' ,
4238 'scrollX' ,
4339 ] ) ;
4440 const {
@@ -206,22 +202,19 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
206202
207203 // default 'div' in rc-virtual-list
208204 const wrapperComponent = getComponent ( [ 'body' , 'wrapper' ] ) ;
209- const RowComponent = getComponent ( [ 'body' , 'row' ] , 'div' ) ;
210- const cellComponent = getComponent ( [ 'body' , 'cell' ] , 'div' ) ;
211-
212- let bodyContent : React . ReactNode ;
213- if ( flattenData . length ) {
214- // ========================== Sticky Scroll Bar ==========================
215- const horizontalScrollBarStyle : React . CSSProperties = { } ;
216- if ( sticky ) {
217- horizontalScrollBarStyle . position = 'sticky' ;
218- horizontalScrollBarStyle . bottom = 0 ;
219- if ( typeof sticky === 'object' && sticky . offsetScroll ) {
220- horizontalScrollBarStyle . bottom = sticky . offsetScroll ;
221- }
205+
206+ // ========================== Sticky Scroll Bar ==========================
207+ const horizontalScrollBarStyle : React . CSSProperties = { } ;
208+ if ( sticky ) {
209+ horizontalScrollBarStyle . position = 'sticky' ;
210+ horizontalScrollBarStyle . bottom = 0 ;
211+ if ( typeof sticky === 'object' && sticky . offsetScroll ) {
212+ horizontalScrollBarStyle . bottom = sticky . offsetScroll ;
222213 }
214+ }
223215
224- bodyContent = (
216+ return (
217+ < GridContext . Provider value = { gridContext } >
225218 < VirtualList < FlattenData < any > >
226219 fullHeight = { false }
227220 ref = { listRef }
@@ -247,18 +240,8 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
247240 return < BodyLine data = { item } rowKey = { rowKey } index = { index } style = { itemProps . style } /> ;
248241 } }
249242 </ VirtualList >
250- ) ;
251- } else {
252- bodyContent = (
253- < RowComponent className = { classNames ( `${ prefixCls } -placeholder` ) } >
254- < Cell component = { cellComponent } prefixCls = { prefixCls } >
255- { emptyNode }
256- </ Cell >
257- </ RowComponent >
258- ) ;
259- }
260-
261- return < GridContext . Provider value = { gridContext } > { bodyContent } </ GridContext . Provider > ;
243+ </ GridContext . Provider >
244+ ) ;
262245} ) ;
263246
264247const ResponseGrid = responseImmutable ( Grid ) ;
0 commit comments