@@ -11,6 +11,7 @@ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
11
11
import TableRenderer from "./parts/TableRenderer" ;
12
12
import { useContainerHeight , useTableMode , useTableHeights , useVirtualization } from "./hooks/useTableConfiguration" ;
13
13
import { ToolbarStyleProvider } from "./styles/ToolbarStyles" ;
14
+ import { TableContainer } from "./parts/TableContainer" ;
14
15
15
16
export const TableCompView = React . memo ( ( props : {
16
17
comp : InstanceType < typeof TableImplComp > ;
@@ -48,6 +49,8 @@ export const TableCompView = React.memo((props: {
48
49
const autoHeight = compChildren . autoHeight . getView ( ) ;
49
50
const rowAutoHeight = compChildren . rowAutoHeight . getView ( ) ;
50
51
const showHeader = ! compChildren . hideHeader . getView ( ) ;
52
+ const stickyToolbar = false ; // TODO: Add this as a prop later
53
+
51
54
52
55
// NEW: Use hooks for clean logic
53
56
const { mode, isFixedMode } = useTableMode ( autoHeight ) ;
@@ -171,65 +174,72 @@ export const TableCompView = React.memo((props: {
171
174
172
175
if ( antdColumns . length === 0 ) {
173
176
return (
174
- < div >
175
- { toolbar . position === "above" && ! hideToolbar && toolbarView }
176
- < EmptyContent text = { trans ( "table.emptyColumns" ) } />
177
- { toolbar . position === "below" && ! hideToolbar && toolbarView }
178
- </ div >
177
+ < TableContainer
178
+ mode = { mode as 'AUTO' | 'FIXED' }
179
+ containerHeight = { mode === 'FIXED' ? containerHeight : undefined }
180
+ toolbarPosition = { toolbar . position }
181
+ stickyToolbar = { stickyToolbar }
182
+ showToolbar = { ! hideToolbar }
183
+ toolbar = { toolbarView }
184
+ >
185
+ < EmptyContent text = { trans ( "table.emptyColumns" ) } />
186
+ </ TableContainer >
179
187
) ;
180
- }
181
-
188
+ }
182
189
const showTableLoading =
183
190
loading ||
184
191
( ( showDataLoadingIndicators ) && ( compChildren . data as any ) . isLoading ( ) ) ||
185
192
compChildren . loading . getView ( ) ;
186
193
187
- return (
188
- < div style = { { height : '100%' , display : 'flex' , flexDirection : 'column' } } >
189
- { toolbar . position === "above" && ! hideToolbar && toolbarView }
190
- < div ref = { containerRef } style = { { flex : 1 , minHeight : 0 } } >
191
-
192
- < TableRenderer < any >
193
- { ...compChildren . selection . getView ( ) ( onEvent ) }
194
- bordered = { compChildren . showRowGridBorder . getView ( ) }
195
- onChange = { ( pagination : any , filters : any , sorter : any , extra : any ) => {
196
- onTableChange ( pagination , filters , sorter , extra , comp . dispatch , onEvent ) ;
197
- } }
198
- showHeader = { showHeader }
199
- columns = { antdColumns }
200
- dataSource = { pageDataInfo . data }
201
- size = { size }
202
- tableLayout = "fixed"
203
- pagination = { false }
204
- summary = { summaryView }
205
- viewModeResizable = { compChildren . viewModeResizable . getView ( ) }
206
- rowColorFn = { compChildren . rowColor . getView ( ) as any }
207
- rowHeightFn = { compChildren . rowHeight . getView ( ) as any }
208
- columnsStyle = { columnsStyle }
209
- rowAutoHeight = { rowAutoHeight }
210
- customLoading = { showTableLoading }
211
- onCellClick = { ( columnName : string , dataIndex : string ) => {
212
- comp . children . selectedCell . dispatchChangeValueAction ( {
213
- name : columnName ,
214
- dataIndex : dataIndex ,
215
- } ) ;
216
- } }
217
- mode = { mode as 'AUTO' | 'FIXED' }
218
- heights = { heights }
219
- virtualizationConfig = { virtualization }
220
- // ADD: Style props
221
- style = { style }
222
- toolbarStyle = { toolbarStyle }
223
- headerStyle = { headerStyle }
224
- rowStyle = { rowStyle }
225
- fixedHeader = { compChildren . fixedHeader . getView ( ) }
226
- showHRowGridBorder = { showHRowGridBorder }
227
- showVerticalScrollbar = { compChildren . showVerticalScrollbar . getView ( ) }
228
- showHorizontalScrollbar = { compChildren . showHorizontalScrollbar . getView ( ) }
229
- />
230
-
231
- </ div >
232
- { toolbar . position === "below" && ! hideToolbar && toolbarView }
233
- </ div >
234
- ) ;
194
+ return (
195
+ < TableContainer
196
+ mode = { mode as 'AUTO' | 'FIXED' }
197
+ containerHeight = { mode === 'FIXED' ? containerHeight : undefined }
198
+ toolbarPosition = { toolbar . position }
199
+ stickyToolbar = { stickyToolbar }
200
+ showToolbar = { ! hideToolbar }
201
+ toolbar = { toolbarView }
202
+ containerRef = { containerRef }
203
+ >
204
+
205
+ < TableRenderer < any >
206
+ { ...compChildren . selection . getView ( ) ( onEvent ) }
207
+ bordered = { compChildren . showRowGridBorder . getView ( ) }
208
+ onChange = { ( pagination : any , filters : any , sorter : any , extra : any ) => {
209
+ onTableChange ( pagination , filters , sorter , extra , comp . dispatch , onEvent ) ;
210
+ } }
211
+ showHeader = { showHeader }
212
+ columns = { antdColumns }
213
+ dataSource = { pageDataInfo . data }
214
+ size = { size }
215
+ tableLayout = "fixed"
216
+ pagination = { false }
217
+ summary = { summaryView }
218
+ viewModeResizable = { compChildren . viewModeResizable . getView ( ) }
219
+ rowColorFn = { compChildren . rowColor . getView ( ) as any }
220
+ rowHeightFn = { compChildren . rowHeight . getView ( ) as any }
221
+ columnsStyle = { columnsStyle }
222
+ rowAutoHeight = { rowAutoHeight }
223
+ customLoading = { showTableLoading }
224
+ onCellClick = { ( columnName : string , dataIndex : string ) => {
225
+ comp . children . selectedCell . dispatchChangeValueAction ( {
226
+ name : columnName ,
227
+ dataIndex : dataIndex ,
228
+ } ) ;
229
+ } }
230
+ mode = { mode as 'AUTO' | 'FIXED' }
231
+ heights = { heights }
232
+ virtualizationConfig = { virtualization }
233
+ style = { style }
234
+ toolbarStyle = { toolbarStyle }
235
+ headerStyle = { headerStyle }
236
+ rowStyle = { rowStyle }
237
+ fixedHeader = { compChildren . fixedHeader . getView ( ) }
238
+ showHRowGridBorder = { showHRowGridBorder }
239
+ showVerticalScrollbar = { compChildren . showVerticalScrollbar . getView ( ) }
240
+ showHorizontalScrollbar = { compChildren . showHorizontalScrollbar . getView ( ) }
241
+ />
242
+
243
+ </ TableContainer >
244
+ ) ;
235
245
} ) ;
0 commit comments