You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Feature - Optional Data Controls
Added new `Optional Data Controls` feature as follows:
- In `@rjsf/utils`:
- Updated existing tests where `getDefaultFormState` is used to reflect addition of `initialDefaultsGenerated`
- Updated `types.ts` to support the new `Optional Data Controls` feature as follows:
- Added new `OptionalDataControlsTemplateProps` and refactored the common props from `ArrayFieldTemplateProps` and `ObjectFieldTemplateProps` into a new super type, `ContainerFieldTemplateProps`
- Added new `optionalDataControl?: ReactNode` to the `ArrayFieldTitleProps`, `TitleFieldProps` and `ContainerFieldTemplateProps`
- Updated `GlobalFormOptions` to add new `enableOptionalDataFieldForType?: ('object' | 'array')[]` prop
- Updated `SchemaUtilsType`'s `retrieveSchema()` function to add an additional, property `resolveAnyOfOrOneOfRefs?: boolean`
- Updated the `Templates` interface to add a new required template `OptionalDataControlsTemplate: ComponentType<OptionalDataControlsTemplateProps<T, S, F>>`
- Updated `retrieveSchema()` to add an additional property `resolveAnyOfOrOneOfRefs?: boolean` which causes `resolveAllSchemas()` to resolve `$ref`s inside of the options of `anyOf`/`oneOf` schemas
- Updated `getDefaultFormState` to fix an issue where optional array props had their default set to an empty array when they shouldn't be
- Updated the `TranslatableString` enum to add three new strings in support of the new feature: `OptionalObjectAdd`, `OptionalObjectRemove` and `OptionalObjectEmptyMsg`
- Added three new utility functions: `isFormDataAvailable()`, `isRootSchema()` and `shouldRenderOptionalField()`
- Added or updated tests to verify all of the new behaviors
- In `@rjsf/core`:
- Added a new `OptionalDataControlsField` to the `fields` that renders either undefined (when there is data for a readonly/disabled field) or gets the `OptionalDataControlsTemplate` and renders the `label` and potentially an `onAddClick` or `onRemoveClick` function
- Updated `ArrayField` and `ObjectField` to check whether it `shouldRenderOptionalData()` and if true, calls `ObjectDataControlsField` and passes the result to its associated render template as `optionalDataControl`
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
- In the rest of the themes:
- Updated `ArrayFieldTemplate`, `ArrayFieldTitleTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
- Updated the `ButtonTemplates` classes to better support the `OptionalDataControlTemplate`
- In the doc directory:
- Updated `utility-function.me` docs to add documentation for the new functions
- Also updated docs for `retrieveSchema` and `SchemaUtilsType` for the new prop
- Updated `uiSchema.md` to add documentation for the new `enableOptionalDataFieldForType` prop
- Updated the `v6x upgrade guide.md` to document the new feature and utility functions and changes to `retrieveSchema`
- Updated the playground to add a new `Optional Data Controls` example
- Updated the snapshot and jest tests for `Form` to test the new `Optional Data Controls` feature
- Updated the `CHANGELOG.md` file accordingly
* - Added the snapsnot test for `FormTest.tsx` and ran it on all the themes
* - Added new `optionalControlsId()` function, using it to add ids to all of the data controls
* - Finished up all of the testing
* - Added/updated documentation
* Apply suggestions from code review
-Responded to reviewer feedback
Co-authored-by: Nick Grosenbacher <[email protected]>
---------
Co-authored-by: Nick Grosenbacher <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+83-5Lines changed: 83 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,20 +17,98 @@ should change the heading of the (upcoming) version to include a major version b
17
17
-->
18
18
# 6.0.0-beta.21
19
19
20
+
## @rjsf/antd
21
+
22
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
23
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
24
+
- Updated the `ButtonTemplates` classes to fix up the props in `AntdIconButtonProps` and the `IconButton`s associated with them to better support the `OptionalDataControlTemplate`
25
+
26
+
## @rjsf/chakra-ui
27
+
28
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
29
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
30
+
- Updated the `ButtonTemplates` classes to add `ChakraIconButtonProps` and the `IconButton`s associated with them to better support the `OptionalDataControlTemplate`
31
+
20
32
## @rjsf/core
21
33
22
34
- Added `initialDefaultsGenerated` flag to state, which indicates whether the initial generation of defaults has been completed
23
-
- Added `ObjectField` tests for additionalProperties with defaults
35
+
- Added `ObjectField` tests for additionalProperties with defaults
36
+
- Added a new `OptionalDataControlsField` to the `fields` that renders either undefined (when there is data for a readonly/disabled field) or gets the `OptionalDataControlsTemplate` and renders the `label` and potentially an `onAddClick` or `onRemoveClick` function
37
+
- Updated `ArrayField` and `ObjectField` to check whether it `shouldRenderOptionalData()` and if true, calls `ObjectDataControlsField` and passes the result to its associated render template as `optionalDataControl`
38
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
39
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
40
+
41
+
## @rjsf/daisyui
42
+
43
+
- Updated `ArrayFieldTemplate`, `ArrayFieldTitleTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
44
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
45
+
- Updated the `ButtonTemplates` classes to better support the `OptionalDataControlTemplate`
46
+
47
+
## @rjsf/fluentui-rc
48
+
49
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
50
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
51
+
- Updated the `ButtonTemplates` classes to add `FluentIconButtonProps` and the `IconButton`s associated with them to better support the `OptionalDataControlTemplate`
52
+
53
+
## @rjsf/mantine
54
+
55
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
56
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
57
+
58
+
## @rjsf/mui
59
+
60
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
61
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
62
+
63
+
## @rjsf/primereact
64
+
65
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
66
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
67
+
- Updated the `ButtonTemplates` classes to add `PrimeIconButtonProps` and the `IconButton`s associated with them to better support the `OptionalDataControlTemplate`
68
+
69
+
## @rjsf/react-bootstrap
70
+
71
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
72
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
73
+
- Updated the `ButtonTemplates` classes to add `BootstrapIconButtonProps` and the `IconButton`s associated with them to better support the `OptionalDataControlTemplate`
74
+
75
+
## @rjsf/semantic-ui
76
+
77
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
78
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
79
+
- Updated the `ButtonTemplates` classes to add `SemanticIconButtonProps` and the `IconButton`s associated with them to better support the `OptionalDataControlTemplate`
80
+
81
+
## @rjsf/shadcn
82
+
83
+
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
84
+
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
85
+
- Updated the `ButtonTemplates` classes to add `ShadIconButtonProps` and the `IconButton`s associated with them to better support the `OptionalDataControlTemplate`
24
86
25
87
## @rjsf/utils
26
88
27
89
- Updated `getDefaultFormState` to add a new `initialDefaultsGenerated` prop flag, along with type definitions, fixing uneditable & permanent defaults with additional properties [3759](https://github.com/rjsf-team/react-jsonschema-form/issues/3759)
28
90
- Updated `createSchemaUtils` definition to reflect addition of `initialDefaultsGenerated`
29
91
- Updated existing tests where `getDefaultFormState` is used to reflect addition of `initialDefaultsGenerated`
30
-
31
-
## @rjsf/docs
32
-
33
-
- Updated docs for `getDefaultFormState` to reflect addition of `initialDefaultsGenerated` prop
92
+
- Updated `types.ts` to support the new `Optional Data Controls` feature as follows:
93
+
- Added new `OptionalDataControlsTemplateProps` and refactored the common props from `ArrayFieldTemplateProps` and `ObjectFieldTemplateProps` into a new super type, `ContainerFieldTemplateProps`
94
+
- Added new `optionalDataControl?: ReactNode` to the `ArrayFieldTitleProps`, `TitleFieldProps` and `ContainerFieldTemplateProps`
95
+
- Updated `GlobalFormOptions` to add new `enableOptionalDataFieldForType?: ('object' | 'array')[]` prop
96
+
- Updated `SchemaUtilsType`'s `retrieveSchema()` function to add an additional, property `resolveAnyOfOrOneOfRefs?: boolean`
97
+
- Updated the `Templates` interface to add a new required template `OptionalDataControlsTemplate: ComponentType<OptionalDataControlsTemplateProps<T, S, F>>`
98
+
- Updated `retrieveSchema()` to add an additional property `resolveAnyOfOrOneOfRefs?: boolean` which causes `resolveAllSchemas()` to resolve `$ref`s inside of the options of `anyOf`/`oneOf` schemas
99
+
- Updated `getDefaultFormState` to fix an issue where optional array props had their default set to an empty array when they shouldn't be
100
+
- Updated the `TranslatableString` enum to add three new strings in support of the new feature: `OptionalObjectAdd`, `OptionalObjectRemove` and `OptionalObjectEmptyMsg`
101
+
- Added four new utility functions: `isFormDataAvailable()`, `isRootSchema()`, `optionalControlsId()`, and `shouldRenderOptionalField()`
102
+
103
+
## Dev / docs / playground
104
+
105
+
- Updated docs for `getDefaultFormState` to reflect addition of the `initialDefaultsGenerated` prop
106
+
- Updated `utility-function.me` docs to add documentation for the new functions
107
+
- Also updated docs for `retrieveSchema` and `SchemaUtilsType` for the new prop
108
+
- Updated `uiSchema.md` to add documentation for the new `enableOptionalDataFieldForType` prop
109
+
- Updated the `v6x upgrade guide.md` to document the new feature and utility functions and changes to `retrieveSchema`
110
+
- Updated the playground to add a new `Optional Data Controls` example
111
+
- Updated the snapshot and jest tests for `Form` to test the new `Optional Data Controls` feature
0 commit comments