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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,23 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
15
15
should change the heading of the (upcoming) version to include a major version bump.
16
16
17
17
-->
18
+
# 6.0.0-beta.21
19
+
20
+
## @rjsf/core
21
+
22
+
- Added `initialDefaultsGenerated` flag to state, which indicates whether the initial generation of defaults has been completed
23
+
- Added `ObjectField` tests for additionalProperties with defaults
24
+
25
+
## @rjsf/utils
26
+
27
+
- 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
+
- Updated `createSchemaUtils` definition to reflect addition of `initialDefaultsGenerated`
29
+
- 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
Copy file name to clipboardExpand all lines: packages/core/src/components/Form.tsx
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -269,6 +269,8 @@ export interface FormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
269
269
// Private
270
270
/** @description result of schemaUtils.retrieveSchema(schema, formData). This a memoized value to avoid re calculate at internal functions (getStateFromProps, onChange) */
271
271
retrievedSchema: S;
272
+
/** Flag indicating whether the initial form defaults have been generated */
273
+
initialDefaultsGenerated: boolean;
272
274
}
273
275
274
276
/** The event data passed when changes have been made to the form, includes everything from the `FormState` except
Copy file name to clipboardExpand all lines: packages/docs/docs/api-reference/utility-functions.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1065,6 +1065,7 @@ Returns the superset of `formData` that includes the given set updated to includ
1065
1065
-[includeUndefinedValues=false]: boolean | "excludeObjectChildren" - Optional flag, if true, cause undefined values to be added as defaults. If "excludeObjectChildren", cause undefined values for this object and pass `includeUndefinedValues` as false when computing defaults for any nested object properties.
1066
1066
-[experimental_defaultFormStateBehavior]: Experimental_DefaultFormStateBehavior - See `Form` documentation for the [experimental_defaultFormStateBehavior](./form-props.md#experimental_defaultFormStateBehavior) prop
1067
1067
-[experimental_customMergeAllOf]: Experimental_CustomMergeAllOf<S> - See `Form` documentation for the [experimental_customMergeAllOf](./form-props.md#experimental_custommergeallof) prop
1068
+
-[initialDefaultsGenerated]: boolean - Optional flag, indicates whether or not initial defaults have been generated
Copy file name to clipboardExpand all lines: packages/docs/docs/migration-guides/v6.x upgrade guide.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -699,6 +699,10 @@ Three new validator-based utility functions are available in `@rjsf/utils`:
699
699
-`findSelectedOptionInXxxOf<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, rootSchema: S, schema: S, fallbackField: string,xxx: 'anyOf' | 'oneOf', formData?: T, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): S | undefined`: Finds the option that matches the selector field in the `schema` or undefined if nothing is selected
700
700
-`getFromSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, rootSchema: S, schema: S, path: string | string[], defaultValue: T | S, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): T | S`: Helper that acts like lodash's `get` but additionally retrieves `$ref`s as needed to get the path for schemas
701
701
702
+
### Changes to existing utility functions
703
+
704
+
-`getDefaultFormState`: Added optional `initialDefaultsGenerated` boolean flag that indicates whether or not initial defaults have been generated
705
+
702
706
### Dynamic UI Schema for Array Items
703
707
704
708
RJSF 6.x introduces a new feature that allows dynamic UI schema generation for array items.
* The formData should take precedence unless it's not valid. This is useful when for example the value from formData does not exist in the schema 'enum' property, in such cases we take the value from the defaults because the value from the formData is not valid.
205
205
*/
206
206
shouldMergeDefaultsIntoFormData?: boolean;
207
+
/** Indicates whether initial defaults have been generated */
208
+
initialDefaultsGenerated?: boolean;
207
209
}
208
210
209
211
/** Computes the defaults for the current `schema` given the `rawFormData` and `parentDefaults` if any. This drills into
@@ -229,6 +231,7 @@ export function computeDefaults<T = any, S extends StrictRJSFSchema = RJSFSchema
0 commit comments