@@ -28,7 +28,7 @@ import { BackgroundColorContext } from "comps/utils/backgroundColorContext";
2828import { PrimaryColor } from "constants/style" ;
2929import { trans } from "i18n" ;
3030import _ from "lodash" ;
31- import { darkenColor , isDarkColor } from "lowcoder-design" ;
31+ import { darkenColor , isDarkColor , ScrollBar } from "lowcoder-design" ;
3232import React , { Children , useCallback , useContext , useEffect , useMemo , useRef , useState } from "react" ;
3333import { Resizable } from "react-resizable" ;
3434import styled , { css } from "styled-components" ;
@@ -43,6 +43,7 @@ import { CellColorViewType } from "./column/tableColumnComp";
4343import { defaultTheme } from "@lowcoder-ee/constants/themeConstants" ;
4444import { useMergeCompStyles } from "@lowcoder-ee/util/hooks" ;
4545import { childrenToProps } from "@lowcoder-ee/comps/generators/multi" ;
46+ import { getVerticalMargin } from "@lowcoder-ee/util/cssUtil" ;
4647
4748
4849function genLinerGradient ( color :string ) {
@@ -148,10 +149,13 @@ const BackgroundWrapper = styled.div<{
148149 // padding: unset !important;
149150 padding:${ ( props ) => props . $style . padding } !important;
150151 margin:${ ( props ) => props . $style . margin } !important;
151- overflow: scroll !important;
152+ // overflow: scroll !important;
152153 border-style:${ ( props ) => props . $style . borderStyle } !important;
153154 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 }
155159` ;
156160
157161// 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<{
166170$visibleResizables :boolean ;
167171$showHRowGridBorder ?:boolean ;
168172} > `
169- overflow: unset !important;
173+ // overflow: unset !important;
174+ // max-height: 100%;
175+ // overflow-y: auto;
170176
171177 .ant-table-wrapper {
172178 border-top: unset;
@@ -193,22 +199,23 @@ const TableWrapper = styled.div<{
193199 }
194200
195201 .ant-table {
196- overflow-y:scroll;
202+ // overflow-y:scroll;
197203 background:${ ( props ) => props . $style . background } ;
198204 .ant-table-container {
199205 border-left: unset;
200206 border-top: none !important;
201207 border-inline-start: none !important;
202- overflow-y:scroll;
203- height:300px
208+ // overflow-y:scroll;
209+ // height:300px;
204210
205211 &::after {
206212 box-shadow: none !important;
207213 }
208214
209215 .ant-table-content {
210- overflow-y:scroll;
211- overflow-x:scroll;
216+ // overflow-y:scroll;
217+ // overflow-x:scroll;
218+ overflow: unset !important
212219 }
213220
214221 // A table expand row contains table
@@ -220,21 +227,22 @@ const TableWrapper = styled.div<{
220227 border-top: unset;
221228
222229 > .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+ }
223238 > tr > th {
224239 background-color:${ ( props ) => props . $headerStyle . headerBackground } ;
225240
226241 border-color:${ ( props ) => props . $headerStyle . border } ;
227242 border-width:${ ( props ) => props . $headerStyle . borderWidth } ;
228243 color:${ ( props ) => props . $headerStyle . headerText } ;
229244 // 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+
238246
239247 > div {
240248 margin:${ ( props ) => props . $headerStyle . margin } ;
@@ -715,6 +723,8 @@ export function TableCompView(props: {
715723const toolbarStyle = compChildren . toolbarStyle . getView ( ) ;
716724const rowAutoHeight = compChildren . rowAutoHeight . getView ( ) ;
717725const tableAutoHeight = comp . getTableAutoHeight ( ) ;
726+ const showHorizontalScrollbar = compChildren . showHorizontalScrollbar . getView ( ) ;
727+ const showVerticalScrollbar = compChildren . showVerticalScrollbar . getView ( ) ;
718728const visibleResizables = compChildren . visibleResizables . getView ( ) ;
719729const showHRowGridBorder = compChildren . showHRowGridBorder . getView ( ) ;
720730const columnsStyle = compChildren . columnsStyle . getView ( ) ;
@@ -833,69 +843,76 @@ export function TableCompView(props: {
833843return (
834844< BackgroundColorContext . Provider value = { style . background } >
835845< 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+ }
860876}
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 ( )
861900}
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> */ }
899916</ BackgroundWrapper >
900917
901918</ BackgroundColorContext . Provider >