@@ -14,15 +14,15 @@ import { i18nObjs, trans } from "i18n";
1414import type { JSONSchema7 } from "json-schema" ;
1515import styled from "styled-components" ;
1616import { toBoolean , toNumber , toString } from "util/convertUtils" ;
17- import { Section , sectionNames } from "lowcoder-design" ;
17+ import { Section , sectionNames , ScrollBar } from "lowcoder-design" ;
1818import { jsonObjectControl } from "../../controls/codeControl" ;
1919import { eventHandlerControl , submitEvent } from "../../controls/eventHandlerControl" ;
20- import { UICompBuilder } from "../../generators" ;
20+ import { UICompBuilder , withDefault } from "../../generators" ;
2121import DateWidget from "./dateWidget" ;
2222import ErrorBoundary from "./errorBoundary" ;
2323import { Theme } from "@rjsf/antd" ;
2424import { hiddenPropertyView } from "comps/utils/propertyUtils" ;
25-
25+ import { AutoHeightControl } from "../../controls/autoHeightControl" ;
2626import { useContext , useEffect } from "react" ;
2727import { EditorContext } from "comps/editorState" ;
2828
@@ -49,6 +49,11 @@ const Container = styled.div<{
4949 font-size: 18px;
5050 }
5151
52+ .ant-row {
53+ margin-left: 0 !important;
54+ margin-right: 0 !important;
55+ }
56+
5257 #root-description {
5358 font-size: 12px;
5459 display: inline-block;
@@ -188,7 +193,9 @@ let FormBasicComp = (function () {
188193 const childrenMap = {
189194 resetAfterSubmit : BoolControl ,
190195 schema : jsonObjectControl ( i18nObjs . jsonForm . defaultSchema ) ,
196+ showVerticalScrollbar : withDefault ( BoolControl , false ) ,
191197 uiSchema : jsonObjectControl ( i18nObjs . jsonForm . defaultUiSchema ) ,
198+ autoHeight : AutoHeightControl ,
192199 data : jsonObjectExposingStateControl ( "data" , i18nObjs . jsonForm . defaultFormData ) ,
193200 onEvent : eventHandlerControl ( EventOptions ) ,
194201 style : styleControl ( JsonSchemaFormStyle , 'style' ) ,
@@ -202,6 +209,15 @@ let FormBasicComp = (function () {
202209
203210 return (
204211 < Container $style = { props . style } $animationStyle = { props . animationStyle } >
212+ < ScrollBar
213+ style = { {
214+ height : props . autoHeight ? "auto" : "100%" ,
215+ margin : "0px" ,
216+ padding : "0px" ,
217+ } }
218+ overflow = { "hidden" }
219+ hideScrollbar = { ! props . showVerticalScrollbar }
220+ >
205221 < ErrorBoundary >
206222 < Form
207223 validator = { validator }
@@ -226,6 +242,7 @@ let FormBasicComp = (function () {
226242 }
227243 />
228244 </ ErrorBoundary >
245+ </ ScrollBar >
229246 </ Container >
230247 ) ;
231248 } )
@@ -325,9 +342,16 @@ let FormBasicComp = (function () {
325342 } ) }
326343 </ Section >
327344 ) }
328-
329345 { ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
330346 < >
347+ < Section name = { sectionNames . layout } >
348+ { children . autoHeight . getPropertyView ( ) }
349+ { ! children . autoHeight . getView ( ) && (
350+ children . showVerticalScrollbar . propertyView ( {
351+ label : trans ( "prop.showVerticalScrollbar" ) ,
352+ } )
353+ ) }
354+ </ Section >
331355 < Section name = { sectionNames . style } >
332356 { children . style . getPropertyView ( ) }
333357 </ Section >
@@ -343,6 +367,13 @@ let FormBasicComp = (function () {
343367 . build ( ) ;
344368} ) ( ) ;
345369
370+ FormBasicComp = class extends FormBasicComp {
371+ override autoHeight ( ) : boolean {
372+ return this . children . autoHeight . getView ( ) ;
373+ }
374+ } ;
375+
376+
346377let FormTmpComp = withExposingConfigs ( FormBasicComp , [
347378 depsConfig ( {
348379 name : "data" ,
0 commit comments