File tree Expand file tree Collapse file tree 5 files changed +53
-20
lines changed
client/packages/lowcoder/src/comps/comps/tableLiteComp Expand file tree Collapse file tree 5 files changed +53
-20
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ interface HeightConfig {
46
46
toolbarHeight ?: number ;
47
47
headerHeight ?: number ;
48
48
containerPadding ?: number ;
49
+ stickyToolbar ?: boolean ; // when true, toolbar is outside scroll and should be reserved
49
50
}
50
51
51
52
export function useTableHeights (
@@ -74,20 +75,18 @@ export function useTableHeights(
74
75
showHeader = true ,
75
76
toolbarHeight = 48 ,
76
77
headerHeight = 40 ,
77
- containerPadding = 0
78
+ containerPadding = 0 ,
79
+ stickyToolbar = false ,
78
80
} = config ;
79
81
80
- const toolbarSpace = showToolbar ? toolbarHeight : 0 ;
82
+ // Reserve space for toolbar ONLY if it's sticky (outside the scroll area)
83
+ const toolbarSpace = showToolbar && stickyToolbar ? toolbarHeight : 0 ;
81
84
const headerSpace = showHeader ? headerHeight : 0 ;
82
85
const totalUsedSpace = toolbarSpace + headerSpace + containerPadding ;
83
86
84
87
// Calculate available height for table body
85
88
const bodyHeight = Math . max ( 0 , containerHeight - totalUsedSpace ) ;
86
89
87
- console . log ( 'Container height:' , containerHeight ) ;
88
- console . log ( 'Body height calculated:' , bodyHeight ) ;
89
-
90
-
91
90
return {
92
91
containerStyle : {
93
92
height : '100%' ,
Original file line number Diff line number Diff line change @@ -61,22 +61,37 @@ export const TableContainer: React.FC<TableContainerProps> = ({
61
61
} ) => {
62
62
const ToolbarComponent = stickyToolbar ? StickyToolbar : DefaultToolbar ;
63
63
64
+ const renderToolbarOutside = stickyToolbar && showToolbar ;
65
+ const renderToolbarInside = ! stickyToolbar && showToolbar ;
66
+
64
67
return (
65
68
< MainContainer $mode = { mode } $height = { containerHeight } ref = { containerRef } >
66
- { /* Above toolbar */ }
67
- { showToolbar && toolbarPosition === 'above' && (
69
+ { /* Above toolbar (sticky) */ }
70
+ { renderToolbarOutside && toolbarPosition === 'above' && (
68
71
< ToolbarComponent $position = "above" >
69
72
{ toolbar }
70
73
</ ToolbarComponent >
71
74
) }
72
75
73
- { /* Table content */ }
76
+ { /* Table content + optional non-sticky toolbar inside scrollable area */ }
74
77
< TableSection $mode = { mode } >
78
+ { /* Non-sticky toolbar ABOVE inside scrollable area */ }
79
+ { renderToolbarInside && toolbarPosition === 'above' && (
80
+ < DefaultToolbar >
81
+ { toolbar }
82
+ </ DefaultToolbar >
83
+ ) }
75
84
{ children }
85
+ { /* Non-sticky toolbar BELOW inside scrollable area */ }
86
+ { renderToolbarInside && toolbarPosition === 'below' && (
87
+ < DefaultToolbar >
88
+ { toolbar }
89
+ </ DefaultToolbar >
90
+ ) }
76
91
</ TableSection >
77
92
78
- { /* Below toolbar */ }
79
- { showToolbar && toolbarPosition === 'below' && (
93
+ { /* Below toolbar (sticky) */ }
94
+ { renderToolbarOutside && toolbarPosition === 'below' && (
80
95
< ToolbarComponent $position = "below" >
81
96
{ toolbar }
82
97
</ ToolbarComponent >
Original file line number Diff line number Diff line change @@ -91,11 +91,10 @@ function TableRendererComp<RecordType extends object>(props: TableRendererProps<
91
91
) ;
92
92
}
93
93
94
- const scrollConfig = { x : totalWidth , y : bodyHeight } ;
95
-
96
94
// VIRTUALIZED: High performance for large datasets
97
95
if ( virtualizationConfig . enabled && heights . canVirtualize ) {
98
- console . log ( 'VirtualizedTable' ) ;
96
+ console . log ( 'VirtualizedTable' ) ;
97
+ const scrollConfig = { x : totalWidth , y : bodyHeight } ;
99
98
return (
100
99
< VirtualizedTable
101
100
{ ...baseTableProps }
@@ -116,13 +115,14 @@ function TableRendererComp<RecordType extends object>(props: TableRendererProps<
116
115
) ;
117
116
}
118
117
119
- // FIXED: Regular height-constrained mode
118
+ // FIXED: Regular height-constrained mode without internal vertical scroll
119
+ // Let the outer container handle vertical scrolling so the footer appears right after the table
120
120
return (
121
121
< FixedModeTable
122
122
{ ...baseTableProps }
123
123
columns = { columns }
124
124
bodyHeight = { bodyHeight }
125
- scroll = { scrollConfig }
125
+ scroll = { { x : totalWidth } }
126
126
virtual = { false }
127
127
style = { props . style }
128
128
headerStyle = { props . headerStyle }
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ export const TableContainer = styled.div<{
11
11
font-size: 12px; /* Smaller font */
12
12
line-height: 1.4;
13
13
}
14
+ /* Virtualized body cell padding */
15
+ .ant-table-tbody-virtual .ant-table-cell {
16
+ padding: 8px 8px !important;
17
+ font-size: 12px;
18
+ line-height: 1.4;
19
+ }
14
20
15
21
/* Header cell padding and font */
16
22
.ant-table-thead > tr > th {
@@ -33,6 +39,12 @@ export const TableContainer = styled.div<{
33
39
font-size: 14px;
34
40
line-height: 1.5;
35
41
}
42
+ /* Virtualized body cell padding */
43
+ .ant-table-tbody-virtual .ant-table-cell {
44
+ padding: 12px 12px !important;
45
+ font-size: 14px;
46
+ line-height: 1.5;
47
+ }
36
48
37
49
/* Header cell padding and font */
38
50
.ant-table-thead > tr > th {
@@ -54,6 +66,12 @@ export const TableContainer = styled.div<{
54
66
font-size: 14px;
55
67
line-height: 1.6;
56
68
}
69
+ /* Virtualized body cell padding */
70
+ .ant-table-tbody-virtual .ant-table-cell {
71
+ padding: 16px 16px !important;
72
+ font-size: 14px;
73
+ line-height: 1.6;
74
+ }
57
75
58
76
/* Header cell padding and font */
59
77
.ant-table-thead > tr > th {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export const TableCompView = React.memo((props: {
49
49
const autoHeight = compChildren . autoHeight . getView ( ) ;
50
50
const rowAutoHeight = compChildren . rowAutoHeight . getView ( ) ;
51
51
const showHeader = ! compChildren . hideHeader . getView ( ) ;
52
- const stickyToolbar = false ; // TODO: Add this as a prop later
52
+ const stickyToolbar = ! ! toolbar . fixedToolbar ; // use toolbar setting
53
53
54
54
55
55
// NEW: Use hooks for clean logic
@@ -59,7 +59,8 @@ export const TableCompView = React.memo((props: {
59
59
showToolbar : ! hideToolbar ,
60
60
showHeader : showHeader ,
61
61
toolbarHeight : 48 ,
62
- headerHeight : 40
62
+ headerHeight : 40 ,
63
+ stickyToolbar,
63
64
} ) ;
64
65
const virtualization = useVirtualization (
65
66
heights . canVirtualize ,
@@ -74,8 +75,8 @@ export const TableCompView = React.memo((props: {
74
75
) ;
75
76
const columnsAggrData = comp . columnAggrData ;
76
77
const headerFilters = useMemo ( ( ) => compChildren . headerFilters . getView ( ) , [ compChildren . headerFilters ] ) ;
77
-
78
-
78
+
79
+
79
80
80
81
const antdColumns = useMemo (
81
82
( ) =>
You can’t perform that action at this time.
0 commit comments