11import { ContainerStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
22import { EditorContext } from "comps/editorState" ;
33import { BackgroundColorContext } from "comps/utils/backgroundColorContext" ;
4- import { HintPlaceHolder } from "lowcoder-design" ;
4+ import { HintPlaceHolder , ScrollBar } from "lowcoder-design" ;
55import { ReactNode , useContext } from "react" ;
66import styled , { css } from "styled-components" ;
77import { checkIsMobile } from "util/commonUtils" ;
@@ -14,10 +14,7 @@ const getStyle = (style: ContainerStyleType) => {
1414 border-width : ${ style . borderWidth } ;
1515 border-radius : ${ style . radius } ;
1616 overflow : hidden;
17- // margin: ${ style . margin } ;
1817 padding : ${ style . padding } ;
19- // width: ${ widthCalculator ( style . margin ) } ;
20- // height: ${ heightCalculator ( style . margin ) } ;
2118 ${ style . background && `background-color: ${ style . background } ;` }
2219 ${ style . backgroundImage && `background-image: ${ style . backgroundImage } ;` }
2320 ${ style . backgroundImageRepeat && `background-repeat: ${ style . backgroundImageRepeat } ;` }
@@ -107,6 +104,7 @@ export function TriContainer(props: TriContainerProps) {
107104 const { showHeader, showFooter } = container ;
108105 // When the header and footer are not displayed, the body must be displayed
109106 const showBody = container . showBody || ( ! showHeader && ! showFooter ) ;
107+ const scrollbars = container . scrollbars ;
110108
111109 const { items : headerItems , ...otherHeaderProps } = container . header ;
112110 const { items : bodyItems , ...otherBodyProps } = container . body [ "0" ] . children . view . getView ( ) ;
@@ -149,27 +147,52 @@ export function TriContainer(props: TriContainerProps) {
149147 ) }
150148 { showBody && (
151149 < BackgroundColorContext . Provider value = { bodyStyle . background } >
152- < BodyInnerGrid
153- $showBorder = { showHeader }
154- { ...otherBodyProps }
155- items = { gridItemCompToGridItems ( bodyItems ) }
156- autoHeight = { container . autoHeight }
157- emptyRows = { 14 }
158- minHeight = { showHeader ? "143px" : "142px" }
159- containerPadding = {
160- ( showHeader && showFooter ) || showHeader ? [ paddingWidth , 11.5 ] : [ paddingWidth , 11 ]
161- }
162- hintPlaceholder = { props . hintPlaceholder ?? HintPlaceHolder }
163- $backgroundColor = { bodyStyle ?. background || 'transparent' }
164- $borderColor = { style ?. border }
165- $borderWidth = { style ?. borderWidth }
166- $backgroundImage = { bodyStyle ?. backgroundImage }
167- $backgroundImageRepeat = { bodyStyle ?. backgroundImageRepeat }
168- $backgroundImageSize = { bodyStyle ?. backgroundImageSize }
169- $backgroundImagePosition = { bodyStyle ?. backgroundImagePosition }
170- $backgroundImageOrigin = { bodyStyle ?. backgroundImageOrigin }
171- style = { { padding : bodyStyle . containerbodypadding } }
172- />
150+ { scrollbars ? (
151+ < ScrollBar style = { { height : container . autoHeight ? "auto" : "100%" , margin : "0px" , padding : "0px" } } >
152+ < BodyInnerGrid
153+ $showBorder = { showHeader }
154+ { ...otherBodyProps }
155+ items = { gridItemCompToGridItems ( bodyItems ) }
156+ autoHeight = { container . autoHeight }
157+ emptyRows = { 14 }
158+ minHeight = { showHeader ? "143px" : "142px" }
159+ containerPadding = {
160+ ( showHeader && showFooter ) || showHeader ? [ paddingWidth , 11.5 ] : [ paddingWidth , 11 ]
161+ }
162+ hintPlaceholder = { props . hintPlaceholder ?? HintPlaceHolder }
163+ $backgroundColor = { bodyStyle ?. background || 'transparent' }
164+ $borderColor = { style ?. border }
165+ $borderWidth = { style ?. borderWidth }
166+ $backgroundImage = { bodyStyle ?. backgroundImage }
167+ $backgroundImageRepeat = { bodyStyle ?. backgroundImageRepeat }
168+ $backgroundImageSize = { bodyStyle ?. backgroundImageSize }
169+ $backgroundImagePosition = { bodyStyle ?. backgroundImagePosition }
170+ $backgroundImageOrigin = { bodyStyle ?. backgroundImageOrigin }
171+ style = { { padding : bodyStyle . containerbodypadding } }
172+ />
173+ </ ScrollBar >
174+ ) : (
175+ < BodyInnerGrid
176+ $showBorder = { showHeader }
177+ { ...otherBodyProps }
178+ items = { gridItemCompToGridItems ( bodyItems ) }
179+ autoHeight = { container . autoHeight }
180+ emptyRows = { 14 }
181+ minHeight = { showHeader ? "143px" : "142px" }
182+ containerPadding = {
183+ ( showHeader && showFooter ) || showHeader ? [ paddingWidth , 11.5 ] : [ paddingWidth , 11 ]
184+ }
185+ hintPlaceholder = { props . hintPlaceholder ?? HintPlaceHolder }
186+ $backgroundColor = { bodyStyle ?. background || 'transparent' }
187+ $borderColor = { style ?. border }
188+ $borderWidth = { style ?. borderWidth }
189+ $backgroundImage = { bodyStyle ?. backgroundImage }
190+ $backgroundImageRepeat = { bodyStyle ?. backgroundImageRepeat }
191+ $backgroundImageSize = { bodyStyle ?. backgroundImageSize }
192+ $backgroundImagePosition = { bodyStyle ?. backgroundImagePosition }
193+ $backgroundImageOrigin = { bodyStyle ?. backgroundImageOrigin }
194+ style = { { padding : bodyStyle . containerbodypadding } } />
195+ ) }
173196 </ BackgroundColorContext . Provider >
174197 ) }
175198 { showFooter && (
0 commit comments