Skip to content

Commit 7476693

Browse files
author
FalkWolsky
committed
Update JSON Schema Form 2
1 parent 768d1c5 commit 7476693

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

client/packages/lowcoder/src/comps/comps/jsonSchemaFormComp/ArrayFieldTemplate.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const ArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
1818
</div>
1919

2020
{/* Container for the control buttons with vertical alignment */}
21-
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', paddingTop: "38px" }}>
21+
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', paddingTop: "58px" }}>
2222
{/* Move down button */}
2323
{element.hasMoveDown && (
2424
<Button

client/packages/lowcoder/src/comps/comps/jsonSchemaFormComp/ObjectFieldTemplate.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const ObjectFieldTemplate = (props: ObjectFieldTemplateProps) => {
3838
xl: 8, // Extra large devices
3939
};
4040

41-
const { rowGutter = 24, colSpan = defaultResponsiveColSpan } = uiSchema?.['ui:props'] || {};
41+
const { rowGutter = 4, colSpan = defaultResponsiveColSpan } = uiSchema?.['ui:props'] || {};
4242

4343
// Generate responsive colSpan props for each element
4444
const calculateResponsiveColSpan = (element: any) => {
@@ -54,12 +54,12 @@ const ObjectFieldTemplate = (props: ObjectFieldTemplateProps) => {
5454
return (
5555
<ConfigConsumer>
5656
{(configProps) => (
57-
<fieldset id={idSchema.$id}>
57+
<fieldset id={idSchema.$id} className="form-section">
5858
<Row gutter={rowGutter}>
59-
{title && (
60-
<Col span={24}>
59+
{schema.type === 'object' && title && (
60+
<legend>
6161
<TitleFieldTemplate id={titleId(idSchema)} title={title} required={props.required} schema={schema} uiSchema={uiSchema} registry={registry} />
62-
</Col>
62+
</legend>
6363
)}
6464
{description && (
6565
<Col span={24} style={DESCRIPTION_COL_STYLE}>

client/packages/lowcoder/src/comps/comps/jsonSchemaFormComp/jsonSchemaFormComp.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { EditorContext } from "comps/editorState";
2727
import ObjectFieldTemplate from './ObjectFieldTemplate';
2828
import ArrayFieldTemplate from './ArrayFieldTemplate';
2929
import { Select } from 'antd';
30+
import Title from 'antd/es/typography/Title';
3031

3132
Theme.widgets.DateWidget = DateWidget(false);
3233
Theme.widgets.DateTimeWidget = DateWidget(true);
@@ -233,6 +234,8 @@ let FormBasicComp = (function () {
233234
"ui:submitButtonOptions"
234235
] as UISchemaSubmitButtonOptions;
235236

237+
const schema = props.schema;
238+
236239
return (
237240
<Container $style={props.style} $animationStyle={props.animationStyle}>
238241
<ScrollBar
@@ -245,6 +248,9 @@ let FormBasicComp = (function () {
245248
hideScrollbar={!props.showVerticalScrollbar}
246249
>
247250
<ErrorBoundary>
251+
<Title level={2} style={{ marginBottom: '24px' }}>
252+
{schema.title as string | number}
253+
</Title>
248254
<Form
249255
validator={validator}
250256
schema={props.schema}
@@ -314,7 +320,7 @@ let FormBasicComp = (function () {
314320
target={"_blank"}
315321
rel="noreferrer"
316322
>
317-
JSON schema
323+
JSON Schema
318324
</a>
319325
</>
320326
),
@@ -352,7 +358,7 @@ let FormBasicComp = (function () {
352358
target={"_blank"}
353359
rel="noreferrer"
354360
>
355-
UI schema
361+
UI Schema
356362
</a>
357363
</>
358364
),

0 commit comments

Comments
 (0)