1
1
import { ContainerStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
2
2
import { EditorContext } from "comps/editorState" ;
3
3
import { BackgroundColorContext } from "comps/utils/backgroundColorContext" ;
4
- import { HintPlaceHolder } from "lowcoder-design" ;
4
+ import { HintPlaceHolder , ScrollBar } from "lowcoder-design" ;
5
5
import { ReactNode , useContext } from "react" ;
6
6
import styled , { css } from "styled-components" ;
7
7
import { checkIsMobile } from "util/commonUtils" ;
@@ -14,10 +14,7 @@ const getStyle = (style: ContainerStyleType) => {
14
14
border-width : ${ style . borderWidth } ;
15
15
border-radius : ${ style . radius } ;
16
16
overflow : hidden;
17
- // margin: ${ style . margin } ;
18
17
padding : ${ style . padding } ;
19
- // width: ${ widthCalculator ( style . margin ) } ;
20
- // height: ${ heightCalculator ( style . margin ) } ;
21
18
${ style . background && `background-color: ${ style . background } ;` }
22
19
${ style . backgroundImage && `background-image: ${ style . backgroundImage } ;` }
23
20
${ style . backgroundImageRepeat && `background-repeat: ${ style . backgroundImageRepeat } ;` }
@@ -107,6 +104,7 @@ export function TriContainer(props: TriContainerProps) {
107
104
const { showHeader, showFooter } = container ;
108
105
// When the header and footer are not displayed, the body must be displayed
109
106
const showBody = container . showBody || ( ! showHeader && ! showFooter ) ;
107
+ const scrollbars = container . scrollbars ;
110
108
111
109
const { items : headerItems , ...otherHeaderProps } = container . header ;
112
110
const { items : bodyItems , ...otherBodyProps } = container . body [ "0" ] . children . view . getView ( ) ;
@@ -149,27 +147,52 @@ export function TriContainer(props: TriContainerProps) {
149
147
) }
150
148
{ showBody && (
151
149
< 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
+ ) }
173
196
</ BackgroundColorContext . Provider >
174
197
) }
175
198
{ showFooter && (
0 commit comments