Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Ensure the root field is always wrapped in Form.Item

The original ternary expression has existed since the antd theme was added in rjsf-team#1561. I am not familiar enough with antd to know what, if any, undesirable effects this change could cause.
  • Loading branch information
nickgros committed Apr 22, 2023
1 parent 436493b commit 924365e
Show file tree
Hide file tree
Showing 5 changed files with 12,586 additions and 10,491 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ should change the heading of the (upcoming) version to include a major version b
-->

# 5.6.3

## @rjsf/antd

- Fix #3608 by ensuring the root field is always wrapped in Form.Item

# 5.6.2

## Dev / docs / playground
Expand Down
34 changes: 15 additions & 19 deletions packages/antd/src/templates/FieldTemplate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,21 @@ export default function FieldTemplate<
uiSchema={uiSchema}
registry={registry}
>
{id === 'root' ? (
children
) : (
<Form.Item
colon={colon}
hasFeedback={schema.type !== 'array' && schema.type !== 'object'}
help={(!!rawHelp && help) || (rawErrors?.length ? errors : undefined)}
htmlFor={id}
label={displayLabel && label}
labelCol={labelCol}
required={required}
style={wrapperStyle}
validateStatus={rawErrors?.length ? 'error' : undefined}
wrapperCol={wrapperCol}
{...descriptionProps}
>
{children}
</Form.Item>
)}
<Form.Item
colon={colon}
hasFeedback={schema.type !== 'array' && schema.type !== 'object'}
help={(!!rawHelp && help) || (rawErrors?.length ? errors : undefined)}
htmlFor={id}
label={displayLabel && label}
labelCol={labelCol}
required={required}
style={wrapperStyle}
validateStatus={rawErrors?.length ? 'error' : undefined}
wrapperCol={wrapperCol}
{...descriptionProps}
>
{children}
</Form.Item>
</WrapIfAdditionalTemplate>
);
}
Loading

0 comments on commit 924365e

Please sign in to comment.