Skip to content

Commit 91dc43e

Browse files
heath-freenomeAlgirdyz
authored andcommitted
Added new utility functions needed by LayoutGridForm (rjsf-team#4503)
* Added new utility functions needed by LayoutGridForm Adding new functions to `@rjsf/utils` to support the upcoming `LayoutGridForm` - Updated `@rjsf/utils` to add new types and functions in support of the `LayoutGridForm` - Updated the `utility-functions.md` documentation for the new functions - Updated the `v6.x upgrade guide.md` documentation for the new functions and types - Updated the `CHANGELOG_V6.md` for the new functions and types * - Fixed build and removed console.log * Update packages/utils/src/schema/findSelectedOptionInXxxOf.ts - Reviewer feedback
1 parent 86ab86e commit 91dc43e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

CHANGELOG_v6.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,22 @@ should change the heading of the (upcoming) version to include a major version b
6868
- BREAKING CHANGE: Added two the following new, required props to `TemplatesType`:
6969
- `ArrayFieldItemButtonsTemplate: ComponentType<ArrayFieldItemButtonsTemplateType<T, S, F>>;`
7070
- `GridTemplate: ComponentType<GridTemplateProps>`
71-
- Added a new `buttonId<T>(id: IdSchema<T> | string, btn: 'add' | 'copy' | 'moveDown' | 'moveUp' | 'remove')` used to generate consistent ids for RJSF buttons
71+
- BREAKING CHANGE: Updated the `SchemaUtilsType` to add new validator-based functions to the interface
72+
- Added the following new non-validator utility functions:
73+
- `buttonId<T>(id: IdSchema<T> | string, btn: 'add' | 'copy' | 'moveDown' | 'moveUp' | 'remove')`: used to generate consistent ids for RJSF buttons
74+
- `getTestIds(): TestIdShape`: Returns an object of test IDs that can only be used in test mode, helpful for writing unit tests for React components
75+
- `hashObject(object: unknown): string`: Stringifies an `object` and returns the hash of the resulting string
76+
- `hashString(string: string): string`: Hashes a string into hex format
77+
- `lookupFromFormContext<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(regOrFc: Registry<T, S, F> | Registry<T, S, F>['formContext'], toLookup: string, fallback?: unknown)`: Given a React JSON Schema Form registry or formContext object, return the value associated with `toLookup`
78+
- Added the following new validator-based utility functions:
79+
- `findFieldInSchema<T = undefined, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, rootSchema: S, path: string | string[], schema: S, formData?: T, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): FoundFieldType<S>`: Finds the field specified by the `path` within the root or recursed `schema`
80+
- `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
81+
- `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
82+
83+
84+
## @rjsf/validator-ajv6
85+
86+
- BREAKING CHANGE: This deprecated validator has been removed
7287

7388
## Dev / docs / playground
7489

0 commit comments

Comments
 (0)