Skip to content

Commit cd948df

Browse files
Fix 3624 by removing duplicate description render in templates
Fixes #3624 by removing the duplicate render of the `description` in the `ObjectFieldTemplate` and `ArrayFieldTemplate` - In `@rjsf/antd` - Removed render of `description` in the object and array field templates because it is already done in `FieldTemplate` in this theme - Updated the snapshot accordingly - Updated `OptionsDrawer` in the playground to allow users to change the `idPrefix` and `idSeparator` - Updated the `CHANGELOG.md` accordingly # Conflicts: # CHANGELOG.md
1 parent 61860ad commit cd948df

File tree

6 files changed

+34
-362
lines changed

6 files changed

+34
-362
lines changed

CHANGELOG.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,52 @@ should change the heading of the (upcoming) version to include a major version b
1717
-->
1818
# 6.0.2
1919

20-
## @rjsf/shadcn
20+
## @rjsf/antd
2121

2222
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
23+
- Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to remove the rendering of a duplicate description (since the `FieldTemplate` already does it), fixing [#3624](https://github.com/rjsf-team/react-jsonschema-form/issues/3624)
2324

24-
## @rjsf/semantic-ui
25+
## @rjsf/chakra-ui
2526

26-
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
27+
- Updated `CheckboxWidget` to handle label and description rendering consistently, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
2728

28-
## @rjsf/react-bootstrap
29+
## @rjsf/core
2930

30-
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
31+
- Fixed duplicate label and description rendering in `CheckboxWidget` by conditionally rendering them based on widget type
32+
- Updated `CheckboxWidget` to handle label and description rendering consistently
33+
- Modified `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
3134

32-
## @rjsf/primereact
35+
## @rjsf/fluentui-rc
3336

3437
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
3538

39+
## @rjsf/mantine
40+
41+
- Updated `CheckboxWidget` to handle label and description rendering consistently, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
42+
3643
## @rjsf/mui
3744

3845
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
3946

40-
## @rjsf/mantine
47+
## @rjsf/primereact
4148

42-
- Updated `CheckboxWidget` to handle label and description rendering consistently, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
49+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
4350

44-
## @rjsf/fluentui-rc
51+
## @rjsf/react-bootstrap
4552

4653
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
4754

48-
## @rjsf/antd
55+
## @rjsf/semantic-ui
4956

5057
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
5158

59+
## @rjsf/shadcn
5260

53-
## @rjsf/chakra-ui
54-
55-
- Updated `CheckboxWidget` to handle label and description rendering consistently, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
61+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
5662

57-
## @rjsf/core
63+
## Dev / docs / playground
5864

59-
- Fixed duplicate label and description rendering in `CheckboxWidget` by conditionally rendering them based on widget type
60-
- Updated `CheckboxWidget` to handle label and description rendering consistently
61-
- Modified `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
65+
- Updated the `OptionsDrawer` of the playground to add `idPrefix` and `idSeparator` fields
6266

6367
# 6.0.1
6468

packages/antd/src/templates/ArrayFieldTemplate/index.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ import classNames from 'classnames';
1212
import { Col, Row, ConfigProvider } from 'antd';
1313
import { useContext } from 'react';
1414

15-
const DESCRIPTION_COL_STYLE = {
16-
paddingBottom: '8px',
17-
};
18-
1915
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
2016
*
2117
* @param props - The `ArrayFieldTemplateProps` props for the component
@@ -41,11 +37,6 @@ export default function ArrayFieldTemplate<
4137
uiSchema,
4238
} = props;
4339
const uiOptions = getUiOptions<T, S, F>(uiSchema);
44-
const ArrayFieldDescriptionTemplate = getTemplate<'ArrayFieldDescriptionTemplate', T, S, F>(
45-
'ArrayFieldDescriptionTemplate',
46-
registry,
47-
uiOptions,
48-
);
4940
const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>(
5041
'ArrayFieldTitleTemplate',
5142
registry,
@@ -84,17 +75,6 @@ export default function ArrayFieldTemplate<
8475
/>
8576
</Col>
8677
)}
87-
{(uiOptions.description || schema.description) && (
88-
<Col span={24} style={DESCRIPTION_COL_STYLE}>
89-
<ArrayFieldDescriptionTemplate
90-
description={uiOptions.description || schema.description}
91-
fieldPathId={fieldPathId}
92-
schema={schema}
93-
uiSchema={uiSchema}
94-
registry={registry}
95-
/>
96-
</Col>
97-
)}
9878
<Col className='row array-item-list' span={24}>
9979
{!showOptionalDataControlInTitle ? optionalDataControl : undefined}
10080
{items}

packages/antd/src/templates/ObjectFieldTemplate/index.tsx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
StrictRJSFSchema,
1212
UiSchema,
1313
canExpand,
14-
descriptionId,
1514
getTemplate,
1615
getUiOptions,
1716
titleId,
@@ -20,10 +19,6 @@ import {
2019
import { Col, Row, ConfigProvider } from 'antd';
2120
import { useContext } from 'react';
2221

23-
const DESCRIPTION_COL_STYLE = {
24-
paddingBottom: '8px',
25-
};
26-
2722
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
2823
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
2924
* the properties.
@@ -36,7 +31,6 @@ export default function ObjectFieldTemplate<
3631
F extends FormContextType = any,
3732
>(props: ObjectFieldTemplateProps<T, S, F>) {
3833
const {
39-
description,
4034
disabled,
4135
formData,
4236
fieldPathId,
@@ -52,11 +46,6 @@ export default function ObjectFieldTemplate<
5246
} = props;
5347
const uiOptions = getUiOptions<T, S, F>(uiSchema);
5448
const TitleFieldTemplate = getTemplate<'TitleFieldTemplate', T, S, F>('TitleFieldTemplate', registry, uiOptions);
55-
const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
56-
'DescriptionFieldTemplate',
57-
registry,
58-
uiOptions,
59-
);
6049
const { formContext } = registry;
6150
const showOptionalDataControlInTitle = !readonly && !disabled;
6251
// Button templates are not overridden in the uiSchema
@@ -132,17 +121,6 @@ export default function ObjectFieldTemplate<
132121
/>
133122
</Col>
134123
)}
135-
{description && (
136-
<Col span={24} style={DESCRIPTION_COL_STYLE}>
137-
<DescriptionFieldTemplate
138-
id={descriptionId(fieldPathId)}
139-
description={description}
140-
schema={schema}
141-
uiSchema={uiSchema}
142-
registry={registry}
143-
/>
144-
</Col>
145-
)}
146124
{!showOptionalDataControlInTitle ? <Col span={24}>{optionalDataControl}</Col> : undefined}
147125
{properties
148126
.filter((e) => !e.hidden)

0 commit comments

Comments
 (0)