@@ -28,7 +28,7 @@ import { BackgroundColorContext } from "comps/utils/backgroundColorContext";
28
28
import { PrimaryColor } from "constants/style" ;
29
29
import { trans } from "i18n" ;
30
30
import _ from "lodash" ;
31
- import { darkenColor , isDarkColor } from "lowcoder-design" ;
31
+ import { darkenColor , isDarkColor , ScrollBar } from "lowcoder-design" ;
32
32
import React , { Children , useCallback , useContext , useEffect , useMemo , useRef , useState } from "react" ;
33
33
import { Resizable } from "react-resizable" ;
34
34
import styled , { css } from "styled-components" ;
@@ -43,6 +43,7 @@ import { CellColorViewType } from "./column/tableColumnComp";
43
43
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants" ;
44
44
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks" ;
45
45
import { childrenToProps } from "@lowcoder-ee/comps/generators/multi" ;
46
+ import { getVerticalMargin } from "@lowcoder-ee/util/cssUtil" ;
46
47
47
48
48
49
function genLinerGradient ( color : string ) {
@@ -148,10 +149,13 @@ const BackgroundWrapper = styled.div<{
148
149
// padding: unset !important;
149
150
padding: ${ ( props ) => props . $style . padding } !important;
150
151
margin: ${ ( props ) => props . $style . margin } !important;
151
- overflow: scroll !important;
152
+ // overflow: scroll !important;
152
153
border-style: ${ ( props ) => props . $style . borderStyle } !important;
153
154
border-width: ${ ( props ) => `${ props . $style . borderWidth } !important` } ;
154
- ${ ( props ) => props . $style }
155
+ border-color: ${ ( props ) => `${ props . $style . border } !important` } ;
156
+ height: calc(100% - ${ ( props ) => getVerticalMargin ( props . $style . margin . split ( ' ' ) ) } );
157
+ // overflow-y: auto;
158
+ // ${ ( props ) => props . $style }
155
159
` ;
156
160
157
161
// TODO: find a way to limit the calc function for max-height only to first Margin value
@@ -166,7 +170,9 @@ const TableWrapper = styled.div<{
166
170
$visibleResizables : boolean ;
167
171
$showHRowGridBorder ?: boolean ;
168
172
} > `
169
- overflow: unset !important;
173
+ // overflow: unset !important;
174
+ // max-height: 100%;
175
+ // overflow-y: auto;
170
176
171
177
.ant-table-wrapper {
172
178
border-top: unset;
@@ -193,22 +199,23 @@ const TableWrapper = styled.div<{
193
199
}
194
200
195
201
.ant-table {
196
- overflow-y:scroll;
202
+ // overflow-y:scroll;
197
203
background: ${ ( props ) => props . $style . background } ;
198
204
.ant-table-container {
199
205
border-left: unset;
200
206
border-top: none !important;
201
207
border-inline-start: none !important;
202
- overflow-y:scroll;
203
- height:300px
208
+ // overflow-y:scroll;
209
+ // height:300px;
204
210
205
211
&::after {
206
212
box-shadow: none !important;
207
213
}
208
214
209
215
.ant-table-content {
210
- overflow-y:scroll;
211
- overflow-x:scroll;
216
+ // overflow-y:scroll;
217
+ // overflow-x:scroll;
218
+ overflow: unset !important
212
219
}
213
220
214
221
// A table expand row contains table
@@ -220,21 +227,22 @@ const TableWrapper = styled.div<{
220
227
border-top: unset;
221
228
222
229
> .ant-table-thead {
230
+ ${ ( props ) =>
231
+ props . $fixedHeader && `
232
+ position: sticky;
233
+ position: -webkit-sticky;
234
+ top: ${ props . $fixedToolbar ? '47px' : '0' } ;
235
+ z-index: 99;
236
+ `
237
+ }
223
238
> tr > th {
224
239
background-color: ${ ( props ) => props . $headerStyle . headerBackground } ;
225
240
226
241
border-color: ${ ( props ) => props . $headerStyle . border } ;
227
242
border-width: ${ ( props ) => props . $headerStyle . borderWidth } ;
228
243
color: ${ ( props ) => props . $headerStyle . headerText } ;
229
244
// border-inline-end: ${ ( props ) => `${ props . $headerStyle . borderWidth } solid ${ props . $headerStyle . border } ` } !important;
230
- ${ ( props ) =>
231
- props . $fixedHeader && `
232
- position: sticky;
233
- position: -webkit-sticky;
234
- top: ${ props . $fixedToolbar ? '47px' : '0' } ;
235
- z-index: 99;
236
- `
237
- }
245
+
238
246
239
247
> div {
240
248
margin: ${ ( props ) => props . $headerStyle . margin } ;
@@ -715,6 +723,8 @@ export function TableCompView(props: {
715
723
const toolbarStyle = compChildren . toolbarStyle . getView ( ) ;
716
724
const rowAutoHeight = compChildren . rowAutoHeight . getView ( ) ;
717
725
const tableAutoHeight = comp . getTableAutoHeight ( ) ;
726
+ const showHorizontalScrollbar = compChildren . showHorizontalScrollbar . getView ( ) ;
727
+ const showVerticalScrollbar = compChildren . showVerticalScrollbar . getView ( ) ;
718
728
const visibleResizables = compChildren . visibleResizables . getView ( ) ;
719
729
const showHRowGridBorder = compChildren . showHRowGridBorder . getView ( ) ;
720
730
const columnsStyle = compChildren . columnsStyle . getView ( ) ;
@@ -833,69 +843,76 @@ export function TableCompView(props: {
833
843
return (
834
844
< BackgroundColorContext . Provider value = { style . background } >
835
845
< BackgroundWrapper ref = { ref } $style = { style } $tableAutoHeight = { tableAutoHeight } >
836
- { toolbar . position === "above" && toolbarView }
837
- < TableWrapper
838
- $style = { style }
839
- $rowStyle = { rowStyle }
840
- $headerStyle = { headerStyle }
841
- $toolbarStyle = { toolbarStyle }
842
- $toolbarPosition = { toolbar . position }
843
- $fixedHeader = { compChildren . fixedHeader . getView ( ) }
844
- $fixedToolbar = { toolbar . fixedToolbar && toolbar . position === 'above' }
845
- $visibleResizables = { visibleResizables }
846
- $showHRowGridBorder = { showHRowGridBorder }
847
- >
848
- < ResizeableTable < RecordType >
849
- expandable = { {
850
- ...expansion . expandableConfig ,
851
- childrenColumnName : supportChildren
852
- ? COLUMN_CHILDREN_KEY
853
- : "OB_CHILDREN_KEY_PLACEHOLDER" ,
854
- fixed : "left" ,
855
- onExpand : ( expanded ) => {
856
- if ( expanded ) {
857
- handleChangeEvent ( 'rowExpand' )
858
- } else {
859
- handleChangeEvent ( 'rowShrink' )
846
+ { /* <div style={{
847
+ overflowY: 'auto',
848
+ maxHeight: '100%',
849
+ }}> */ }
850
+ < ScrollBar style = { { height : "100%" , margin : "0px" , padding : "0px" } } hideScrollbar = { ! showVerticalScrollbar } >
851
+ { toolbar . position === "above" && toolbarView }
852
+ < TableWrapper
853
+ $style = { style }
854
+ $rowStyle = { rowStyle }
855
+ $headerStyle = { headerStyle }
856
+ $toolbarStyle = { toolbarStyle }
857
+ $toolbarPosition = { toolbar . position }
858
+ $fixedHeader = { compChildren . fixedHeader . getView ( ) }
859
+ $fixedToolbar = { toolbar . fixedToolbar && toolbar . position === 'above' }
860
+ $visibleResizables = { visibleResizables }
861
+ $showHRowGridBorder = { showHRowGridBorder }
862
+ >
863
+ < ResizeableTable < RecordType >
864
+ expandable = { {
865
+ ...expansion . expandableConfig ,
866
+ childrenColumnName : supportChildren
867
+ ? COLUMN_CHILDREN_KEY
868
+ : "OB_CHILDREN_KEY_PLACEHOLDER" ,
869
+ fixed : "left" ,
870
+ onExpand : ( expanded ) => {
871
+ if ( expanded ) {
872
+ handleChangeEvent ( 'rowExpand' )
873
+ } else {
874
+ handleChangeEvent ( 'rowShrink' )
875
+ }
860
876
}
877
+ } }
878
+ rowColorFn = { compChildren . rowColor . getView ( ) as any }
879
+ rowHeightFn = { compChildren . rowHeight . getView ( ) as any }
880
+ { ...compChildren . selection . getView ( ) ( onEvent ) }
881
+ bordered = { compChildren . showRowGridBorder . getView ( ) }
882
+ onChange = { ( pagination , filters , sorter , extra ) => {
883
+ onTableChange ( pagination , filters , sorter , extra , comp . dispatch , onEvent ) ;
884
+ } }
885
+ showHeader = { ! compChildren . hideHeader . getView ( ) }
886
+ columns = { antdColumns }
887
+ columnsStyle = { columnsStyle }
888
+ viewModeResizable = { compChildren . viewModeResizable . getView ( ) }
889
+ visibleResizables = { compChildren . visibleResizables . getView ( ) }
890
+ dataSource = { pageDataInfo . data }
891
+ size = { compChildren . size . getView ( ) }
892
+ rowAutoHeight = { rowAutoHeight }
893
+ tableLayout = "fixed"
894
+ loading = {
895
+ loading ||
896
+ // fixme isLoading type
897
+ ( compChildren . showDataLoadSpinner . getView ( ) &&
898
+ ( compChildren . data as any ) . isLoading ( ) ) ||
899
+ compChildren . loading . getView ( )
861
900
}
862
- } }
863
- rowColorFn = { compChildren . rowColor . getView ( ) as any }
864
- rowHeightFn = { compChildren . rowHeight . getView ( ) as any }
865
- { ...compChildren . selection . getView ( ) ( onEvent ) }
866
- bordered = { compChildren . showRowGridBorder . getView ( ) }
867
- onChange = { ( pagination , filters , sorter , extra ) => {
868
- onTableChange ( pagination , filters , sorter , extra , comp . dispatch , onEvent ) ;
869
- } }
870
- showHeader = { ! compChildren . hideHeader . getView ( ) }
871
- columns = { antdColumns }
872
- columnsStyle = { columnsStyle }
873
- viewModeResizable = { compChildren . viewModeResizable . getView ( ) }
874
- visibleResizables = { compChildren . visibleResizables . getView ( ) }
875
- dataSource = { pageDataInfo . data }
876
- size = { compChildren . size . getView ( ) }
877
- rowAutoHeight = { rowAutoHeight }
878
- tableLayout = "fixed"
879
- loading = {
880
- loading ||
881
- // fixme isLoading type
882
- ( compChildren . showDataLoadSpinner . getView ( ) &&
883
- ( compChildren . data as any ) . isLoading ( ) ) ||
884
- compChildren . loading . getView ( )
885
- }
886
- onCellClick = { ( columnName : string , dataIndex : string ) => {
887
- comp . children . selectedCell . dispatchChangeValueAction ( {
888
- name : columnName ,
889
- dataIndex : dataIndex ,
890
- } ) ;
891
- } }
892
- />
893
-
894
- < SlotConfigContext . Provider value = { { modalWidth : width && Math . max ( width , 300 ) } } >
895
- { expansion . expandModalView }
896
- </ SlotConfigContext . Provider >
897
- </ TableWrapper >
898
- { toolbar . position === "below" && toolbarView }
901
+ onCellClick = { ( columnName : string , dataIndex : string ) => {
902
+ comp . children . selectedCell . dispatchChangeValueAction ( {
903
+ name : columnName ,
904
+ dataIndex : dataIndex ,
905
+ } ) ;
906
+ } }
907
+ />
908
+
909
+ < SlotConfigContext . Provider value = { { modalWidth : width && Math . max ( width , 300 ) } } >
910
+ { expansion . expandModalView }
911
+ </ SlotConfigContext . Provider >
912
+ </ TableWrapper >
913
+ { toolbar . position === "below" && toolbarView }
914
+ </ ScrollBar >
915
+ { /* </div> */ }
899
916
</ BackgroundWrapper >
900
917
901
918
</ BackgroundColorContext . Provider >
0 commit comments