diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d868eef63..ffe74fccf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ should change the heading of the (upcoming) version to include a major version b - Updated `ObjectField` to remove the `name` from the path passed to `onChange()` callback in `handleAddClick()` and `onDropPropertyClick()`, fixing [#4763](https://github.com/rjsf-team/react-jsonschema-form/issues/4763) - Updated `Form` to restore the passing of an empty string for `name` to avoid accidentally showing it as the title for the whole schema +- Updated `Form` to add the `globalFormOptions` to the `registry` when there are `GlobalFormOptions` provided, also stopped passing `idPrefix` and `idSeparator` to `SchemaField` +- Updated `ArrayField`, `LayoutGridField`, `ObjectField` and `SchemaField` to get `idPrefix`, `idSeparator` from the `registry.globalFormOptions`, no longer passing them on `FieldProps` + - Updated `SchemaField` to get `experimental_componentUpdateStrategy` from the `registry.globalFormOptions` as well ## @rjsf/shadcn @@ -33,6 +36,13 @@ should change the heading of the (upcoming) version to include a major version b ## @rjsf/utils - Update `getDefaultFormState()` to add support for `null` defaults for `["null", "object"]` and `["null", "array"]`, fixing [#1581](https://github.com/rjsf-team/react-jsonschema-form/issues/1581) +- Added a new `GlobalFormProps` interface which contains the following props and replaced the `experimental_componentUpdateStrategy` in `Registry` with `globalFormProps?: GlobalFormProps` + - `experimental_componentUpdateStrategy` (refactored from `Registry`) and `idPrefix` & `idSeparator` (refactored from `FieldProps`) +- BREAKING CHANGE: Removed the optional `idPrefix` and `idSeparator` props from the `FieldProps` interface + +## Dev / docs / playground + +- Updated the `custom-widget-fields.md` and `v6.x upgrade guide.md` to document the refactor of the `idPrefix` and `idSeparator` refactor # 6.0.0-beta.16 diff --git a/packages/core/src/components/Form.tsx b/packages/core/src/components/Form.tsx index 85ed258503..8ed2c75d12 100644 --- a/packages/core/src/components/Form.tsx +++ b/packages/core/src/components/Form.tsx @@ -43,6 +43,7 @@ import _forEach from 'lodash/forEach'; import _get from 'lodash/get'; import _isEmpty from 'lodash/isEmpty'; import _isNil from 'lodash/isNil'; +import _omitBy from 'lodash/omitBy'; import _pick from 'lodash/pick'; import _set from 'lodash/set'; import _toPath from 'lodash/toPath'; @@ -956,10 +957,14 @@ export default class Form< const { translateString: customTranslateString, uiSchema = {}, - experimental_componentUpdateStrategy = 'customDeep', + experimental_componentUpdateStrategy, + idSeparator, + idPrefix, } = this.props; const { schema, schemaUtils } = this.state; const { fields, templates, widgets, formContext, translateString } = getDefaultRegistry(); + // Omit any options that are undefined or null + const globalFormOptions = _omitBy({ idPrefix, idSeparator, experimental_componentUpdateStrategy }, _isNil); return { fields: { ...fields, ...this.props.fields }, templates: { @@ -976,7 +981,7 @@ export default class Form< schemaUtils, translateString: customTranslateString || translateString, globalUiOptions: uiSchema[UI_GLOBAL_OPTIONS_KEY], - experimental_componentUpdateStrategy, + globalFormOptions, }; } @@ -1101,8 +1106,6 @@ export default class Form< const { children, id, - idPrefix = '', - idSeparator, className = '', tagName, name, @@ -1158,8 +1161,6 @@ export default class Form< uiSchema={uiSchema} errorSchema={errorSchema} idSchema={idSchema} - idPrefix={idPrefix} - idSeparator={idSeparator} formData={formData} onChange={this.onChange} onBlur={this.onBlur} diff --git a/packages/core/src/components/fields/ArrayField.tsx b/packages/core/src/components/fields/ArrayField.tsx index 4e8d7a0b23..e931428b47 100644 --- a/packages/core/src/components/fields/ArrayField.tsx +++ b/packages/core/src/components/fields/ArrayField.tsx @@ -511,13 +511,12 @@ class ArrayField(uiSchema); const _schemaItems: S = isObject(schema.items) ? (schema.items as S) : ({} as S); const itemsSchema: S = schemaUtils.retrieveSchema(_schemaItems); @@ -735,8 +734,6 @@ class ArrayField(uiSchema); - const { schemaUtils, formContext } = registry; + const { schemaUtils, formContext, globalFormOptions } = registry; + const { idPrefix, idSeparator = '_' } = globalFormOptions; const _schemaItems: S[] = isObject(schema.items) ? (schema.items as S[]) : ([] as S[]); const itemSchemas = _schemaItems.map((item: S, index: number) => schemaUtils.retrieveSchema(item, formData[index] as unknown as T[]), @@ -884,7 +882,7 @@ class ArrayField(uiSchema, globalUiOptions); const FieldTemplate = getTemplate<'FieldTemplate', T, S, F>('FieldTemplate', registry, uiOptions); const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>( @@ -291,9 +290,7 @@ function SchemaFieldRender > { shouldComponentUpdate(nextProps: Readonly>) { - const { experimental_componentUpdateStrategy = 'customDeep' } = this.props.registry; + const { + registry: { globalFormOptions }, + } = this.props; + const { experimental_componentUpdateStrategy = 'customDeep' } = globalFormOptions; return shouldRender(this, nextProps, this.state, experimental_componentUpdateStrategy); } diff --git a/packages/core/src/getDefaultRegistry.ts b/packages/core/src/getDefaultRegistry.ts index f86f1a3652..fbabade578 100644 --- a/packages/core/src/getDefaultRegistry.ts +++ b/packages/core/src/getDefaultRegistry.ts @@ -20,5 +20,6 @@ export default function getDefaultRegistry< rootSchema: {} as S, formContext: {} as F, translateString: englishStringTranslator, + globalFormOptions: {}, }; } diff --git a/packages/core/test/SchemaField.test.jsx b/packages/core/test/SchemaField.test.jsx index 269ca81c9c..7cd785d7c4 100644 --- a/packages/core/test/SchemaField.test.jsx +++ b/packages/core/test/SchemaField.test.jsx @@ -52,7 +52,7 @@ describe('SchemaField', () => { schemaUtils, translateString: englishStringTranslator, globalUiOptions: undefined, - experimental_componentUpdateStrategy: 'customDeep', + globalFormOptions: {}, }); }); it('should provide expected registry with globalUiOptions as prop', () => { @@ -87,7 +87,7 @@ describe('SchemaField', () => { schemaUtils, translateString: englishStringTranslator, globalUiOptions: { copyable: true }, - experimental_componentUpdateStrategy: 'customDeep', + globalFormOptions: {}, }); }); }); diff --git a/packages/core/test/testData/getTestRegistry.tsx b/packages/core/test/testData/getTestRegistry.tsx index 466eb754f7..e96dbd7215 100644 --- a/packages/core/test/testData/getTestRegistry.tsx +++ b/packages/core/test/testData/getTestRegistry.tsx @@ -22,5 +22,6 @@ export default function getTestRegistry( rootSchema, schemaUtils, translateString: englishStringTranslator, + globalFormOptions: {}, }; } diff --git a/packages/daisyui/jest.config.json b/packages/daisyui/jest.config.json index aad0bf0c52..3d13ca7a0a 100644 --- a/packages/daisyui/jest.config.json +++ b/packages/daisyui/jest.config.json @@ -6,7 +6,7 @@ }, "coveragePathIgnorePatterns": ["/node_modules/", "/test/"], "transformIgnorePatterns": [ - "/node_modules/(?!(@rjsf|@epicfaace|@fortawesome|@coreui|yup|react-day-picker|dayjs|deep-freeze-es6)/)" + "/node_modules/(?!(@fortawesome|yup|react-day-picker|dayjs|deep-freeze-es6)/)" ], "moduleNameMapper": { "\\.(css|less|scss|sass)$": "/test/fileMock.js" diff --git a/packages/daisyui/test/__snapshots__/Array.test.tsx.snap b/packages/daisyui/test/__snapshots__/Array.test.tsx.snap index 8689d60115..a088655cae 100644 --- a/packages/daisyui/test/__snapshots__/Array.test.tsx.snap +++ b/packages/daisyui/test/__snapshots__/Array.test.tsx.snap @@ -17,7 +17,6 @@ exports[`array fields array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -33,6 +32,7 @@ exports[`array fields array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -3687,7 +3687,6 @@ exports[`array fields array icons 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -3703,6 +3702,7 @@ exports[`array fields array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -7289,7 +7289,6 @@ exports[`array fields array icons 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -7305,6 +7304,7 @@ exports[`array fields array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -11041,7 +11041,6 @@ exports[`array fields array icons 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -11057,6 +11056,7 @@ exports[`array fields array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -14862,7 +14862,6 @@ exports[`array fields checkboxes 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -14878,6 +14877,7 @@ exports[`array fields checkboxes 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -18597,7 +18597,6 @@ exports[`array fields empty errors array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -18613,6 +18612,7 @@ exports[`array fields empty errors array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -22196,7 +22196,6 @@ exports[`array fields empty errors array 1`] = ` id="root_name__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -22212,6 +22211,7 @@ exports[`array fields empty errors array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -25873,7 +25873,6 @@ exports[`array fields fixed array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -25889,6 +25888,7 @@ exports[`array fields fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": [ @@ -29484,7 +29484,6 @@ exports[`array fields fixed array 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -29500,6 +29499,7 @@ exports[`array fields fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": [ @@ -33138,7 +33138,6 @@ exports[`array fields fixed array 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -33154,6 +33153,7 @@ exports[`array fields fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": [ @@ -36836,7 +36836,6 @@ exports[`array fields has errors 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -36852,6 +36851,7 @@ exports[`array fields has errors 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -40435,7 +40435,6 @@ exports[`array fields has errors 1`] = ` id="root_name__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -40451,6 +40450,7 @@ exports[`array fields has errors 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -44116,7 +44116,6 @@ exports[`array fields no errors 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -44132,6 +44131,7 @@ exports[`array fields no errors 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -47715,7 +47715,6 @@ exports[`array fields no errors 1`] = ` id="root_name__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -47731,6 +47730,7 @@ exports[`array fields no errors 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -51392,7 +51392,6 @@ exports[`with title and description array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -51408,6 +51407,7 @@ exports[`with title and description array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -55097,7 +55097,6 @@ exports[`with title and description array icons 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -55113,6 +55112,7 @@ exports[`with title and description array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -58734,7 +58734,6 @@ exports[`with title and description array icons 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -58750,6 +58749,7 @@ exports[`with title and description array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -62499,7 +62499,6 @@ exports[`with title and description array icons 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -62515,6 +62514,7 @@ exports[`with title and description array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -66333,7 +66333,6 @@ exports[`with title and description checkboxes 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -66349,6 +66348,7 @@ exports[`with title and description checkboxes 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -70082,7 +70082,6 @@ exports[`with title and description fixed array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -70098,6 +70097,7 @@ exports[`with title and description fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -73734,7 +73734,6 @@ exports[`with title and description fixed array 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -73750,6 +73749,7 @@ exports[`with title and description fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -77405,7 +77405,6 @@ exports[`with title and description fixed array 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -77421,6 +77420,7 @@ exports[`with title and description fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -81109,7 +81109,6 @@ exports[`with title and description from both array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -81125,6 +81124,7 @@ exports[`with title and description from both array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -84821,7 +84821,6 @@ exports[`with title and description from both array icons 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -84837,6 +84836,7 @@ exports[`with title and description from both array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -88460,7 +88460,6 @@ exports[`with title and description from both array icons 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -88476,6 +88475,7 @@ exports[`with title and description from both array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -92227,7 +92227,6 @@ exports[`with title and description from both array icons 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -92243,6 +92242,7 @@ exports[`with title and description from both array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -96063,7 +96063,6 @@ exports[`with title and description from both checkboxes 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -96079,6 +96078,7 @@ exports[`with title and description from both checkboxes 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -99819,7 +99819,6 @@ exports[`with title and description from both fixed array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -99835,6 +99834,7 @@ exports[`with title and description from both fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -103472,7 +103472,6 @@ exports[`with title and description from both fixed array 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -103488,6 +103487,7 @@ exports[`with title and description from both fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -107141,7 +107141,6 @@ exports[`with title and description from both fixed array 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -107157,6 +107156,7 @@ exports[`with title and description from both fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -110843,7 +110843,6 @@ exports[`with title and description from uiSchema array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -110859,6 +110858,7 @@ exports[`with title and description from uiSchema array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -114549,7 +114549,6 @@ exports[`with title and description from uiSchema array icons 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -114565,6 +114564,7 @@ exports[`with title and description from uiSchema array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -118182,7 +118182,6 @@ exports[`with title and description from uiSchema array icons 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -118198,6 +118197,7 @@ exports[`with title and description from uiSchema array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -121945,7 +121945,6 @@ exports[`with title and description from uiSchema array icons 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -121961,6 +121960,7 @@ exports[`with title and description from uiSchema array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -125777,7 +125777,6 @@ exports[`with title and description from uiSchema checkboxes 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -125793,6 +125792,7 @@ exports[`with title and description from uiSchema checkboxes 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -129527,7 +129527,6 @@ exports[`with title and description from uiSchema fixed array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -129543,6 +129542,7 @@ exports[`with title and description from uiSchema fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": [ @@ -133174,7 +133174,6 @@ exports[`with title and description from uiSchema fixed array 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -133190,6 +133189,7 @@ exports[`with title and description from uiSchema fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": [ @@ -136839,7 +136839,6 @@ exports[`with title and description from uiSchema fixed array 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -136855,6 +136854,7 @@ exports[`with title and description from uiSchema fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": [ @@ -140537,7 +140537,6 @@ exports[`with title and description with global label off array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -140553,6 +140552,7 @@ exports[`with title and description with global label off array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -144227,7 +144227,6 @@ exports[`with title and description with global label off array icons 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -144243,6 +144242,7 @@ exports[`with title and description with global label off array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -147846,7 +147846,6 @@ exports[`with title and description with global label off array icons 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -147862,6 +147861,7 @@ exports[`with title and description with global label off array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -151598,7 +151598,6 @@ exports[`with title and description with global label off array icons 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -151614,6 +151613,7 @@ exports[`with title and description with global label off array icons 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -155419,7 +155419,6 @@ exports[`with title and description with global label off checkboxes 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -155435,6 +155434,7 @@ exports[`with title and description with global label off checkboxes 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -159176,7 +159176,6 @@ exports[`with title and description with global label off fixed array 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -159192,6 +159191,7 @@ exports[`with title and description with global label off fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -162813,7 +162813,6 @@ exports[`with title and description with global label off fixed array 1`] = ` id="root_0__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -162829,6 +162828,7 @@ exports[`with title and description with global label off fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -166471,7 +166471,6 @@ exports[`with title and description with global label off fixed array 1`] = ` id="root_1__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -166487,6 +166486,7 @@ exports[`with title and description with global label off fixed array 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, diff --git a/packages/daisyui/test/__snapshots__/Form.test.tsx.snap b/packages/daisyui/test/__snapshots__/Form.test.tsx.snap index 8e77f483db..bc66bda144 100644 --- a/packages/daisyui/test/__snapshots__/Form.test.tsx.snap +++ b/packages/daisyui/test/__snapshots__/Form.test.tsx.snap @@ -17,7 +17,6 @@ exports[`single fields checkbox field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -33,6 +32,7 @@ exports[`single fields checkbox field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "boolean", @@ -3637,7 +3637,6 @@ exports[`single fields checkbox field with label 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -3653,6 +3652,7 @@ exports[`single fields checkbox field with label 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "title": "test", @@ -7273,7 +7273,6 @@ exports[`single fields checkbox field with label and description 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -7289,6 +7288,7 @@ exports[`single fields checkbox field with label and description 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "test description", @@ -10922,7 +10922,6 @@ exports[`single fields checkbox field with label and rich text description 1`] = id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -10938,6 +10937,7 @@ exports[`single fields checkbox field with label and rich text description 1`] = "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "**test** __description__", @@ -14583,7 +14583,6 @@ exports[`single fields checkboxes field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -14599,6 +14598,7 @@ exports[`single fields checkboxes field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -18333,7 +18333,6 @@ exports[`single fields field with description 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -18349,6 +18348,7 @@ exports[`single fields field with description 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -21935,7 +21935,6 @@ exports[`single fields field with description 1`] = ` id="root_my-field__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -21951,6 +21950,7 @@ exports[`single fields field with description 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -25615,7 +25615,6 @@ exports[`single fields field with description in uiSchema 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -25631,6 +25630,7 @@ exports[`single fields field with description in uiSchema 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -29223,7 +29223,6 @@ exports[`single fields field with description in uiSchema 1`] = ` id="root_my-field__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -29239,6 +29238,7 @@ exports[`single fields field with description in uiSchema 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -32908,7 +32908,6 @@ exports[`single fields field with markdown description 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -32924,6 +32923,7 @@ exports[`single fields field with markdown description 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -36516,7 +36516,6 @@ exports[`single fields field with markdown description 1`] = ` id="root_my-field__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -36532,6 +36531,7 @@ exports[`single fields field with markdown description 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -40201,7 +40201,6 @@ exports[`single fields field with markdown description in uiSchema 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -40217,6 +40216,7 @@ exports[`single fields field with markdown description in uiSchema 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -43810,7 +43810,6 @@ exports[`single fields field with markdown description in uiSchema 1`] = ` id="root_my-field__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -43826,6 +43825,7 @@ exports[`single fields field with markdown description in uiSchema 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -47496,7 +47496,6 @@ exports[`single fields format color 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -47512,6 +47511,7 @@ exports[`single fields format color 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "format": "color", @@ -51145,7 +51145,6 @@ exports[`single fields format date 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -51161,6 +51160,7 @@ exports[`single fields format date 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "format": "date", @@ -54803,7 +54803,6 @@ exports[`single fields format datetime 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -54819,6 +54818,7 @@ exports[`single fields format datetime 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "format": "datetime", @@ -58461,7 +58461,6 @@ exports[`single fields format time 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -58477,6 +58476,7 @@ exports[`single fields format time 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "format": "time", @@ -62105,7 +62105,6 @@ exports[`single fields help and error display 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -62121,6 +62120,7 @@ exports[`single fields help and error display 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "string", @@ -65761,7 +65761,6 @@ exports[`single fields hidden field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -65777,6 +65776,7 @@ exports[`single fields hidden field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -69363,7 +69363,6 @@ exports[`single fields hidden field 1`] = ` id="root_my-field__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -69379,6 +69378,7 @@ exports[`single fields hidden field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -73016,7 +73016,6 @@ exports[`single fields hidden label 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -73032,6 +73031,7 @@ exports[`single fields hidden label 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "string", @@ -76660,7 +76660,6 @@ exports[`single fields null field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -76676,6 +76675,7 @@ exports[`single fields null field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "null", @@ -80275,7 +80275,6 @@ exports[`single fields number field 0 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -80291,6 +80290,7 @@ exports[`single fields number field 0 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "number", @@ -83922,7 +83922,6 @@ exports[`single fields number field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -83938,6 +83937,7 @@ exports[`single fields number field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "number", @@ -87569,7 +87569,6 @@ exports[`single fields password field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -87585,6 +87584,7 @@ exports[`single fields password field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "string", @@ -91219,7 +91219,6 @@ exports[`single fields radio field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -91235,6 +91234,7 @@ exports[`single fields radio field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "boolean", @@ -94882,7 +94882,6 @@ exports[`single fields schema examples 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -94898,6 +94897,7 @@ exports[`single fields schema examples 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "examples": [ @@ -98569,7 +98569,6 @@ exports[`single fields select field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -98585,6 +98584,7 @@ exports[`single fields select field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "enum": [ @@ -102254,7 +102254,6 @@ exports[`single fields select field multiple choice 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -102270,6 +102269,7 @@ exports[`single fields select field multiple choice 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -106013,7 +106013,6 @@ exports[`single fields select field multiple choice enumDisabled 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -106029,6 +106028,7 @@ exports[`single fields select field multiple choice enumDisabled 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -109778,7 +109778,6 @@ exports[`single fields select field multiple choice enumDisabled using checkboxe id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -109794,6 +109793,7 @@ exports[`single fields select field multiple choice enumDisabled using checkboxe "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -113526,7 +113526,6 @@ exports[`single fields select field multiple choice formData 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -113542,6 +113541,7 @@ exports[`single fields select field multiple choice formData 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -117285,7 +117285,6 @@ exports[`single fields select field multiple choice with labels 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -117301,6 +117300,7 @@ exports[`single fields select field multiple choice with labels 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "items": { @@ -121065,7 +121065,6 @@ exports[`single fields select field single choice enumDisabled 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -121081,6 +121080,7 @@ exports[`single fields select field single choice enumDisabled 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "enum": [ @@ -124756,7 +124756,6 @@ exports[`single fields select field single choice enumDisabled using radio widge id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -124772,6 +124771,7 @@ exports[`single fields select field single choice enumDisabled using radio widge "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "enum": [ @@ -128442,7 +128442,6 @@ exports[`single fields select field single choice form disabled using radio widg id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -128458,6 +128457,7 @@ exports[`single fields select field single choice form disabled using radio widg "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "enum": [ @@ -132125,7 +132125,6 @@ exports[`single fields select field single choice formData 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -132141,6 +132140,7 @@ exports[`single fields select field single choice formData 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "enum": [ @@ -135812,7 +135812,6 @@ exports[`single fields select field single choice uiSchema disabled using radio id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -135828,6 +135827,7 @@ exports[`single fields select field single choice uiSchema disabled using radio "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "enum": [ @@ -139496,7 +139496,6 @@ exports[`single fields slider field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -139512,6 +139511,7 @@ exports[`single fields slider field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "maximum": 100, @@ -143147,7 +143147,6 @@ exports[`single fields string field format data-url 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -143163,6 +143162,7 @@ exports[`single fields string field format data-url 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "format": "data-url", @@ -146775,7 +146775,6 @@ exports[`single fields string field format email 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -146791,6 +146790,7 @@ exports[`single fields string field format email 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "format": "email", @@ -150424,7 +150424,6 @@ exports[`single fields string field format uri 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -150440,6 +150439,7 @@ exports[`single fields string field format uri 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "format": "uri", @@ -154073,7 +154073,6 @@ exports[`single fields string field regular 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -154089,6 +154088,7 @@ exports[`single fields string field regular 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "string", @@ -157719,7 +157719,6 @@ exports[`single fields string field with placeholder 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -157735,6 +157734,7 @@ exports[`single fields string field with placeholder 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "string", @@ -161369,7 +161369,6 @@ exports[`single fields textarea field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -161385,6 +161384,7 @@ exports[`single fields textarea field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "string", @@ -165003,7 +165003,6 @@ exports[`single fields title field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -165019,6 +165018,7 @@ exports[`single fields title field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -168622,7 +168622,6 @@ exports[`single fields title field 1`] = ` id="root_title__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -168638,6 +168637,7 @@ exports[`single fields title field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -172304,7 +172304,6 @@ exports[`single fields unsupported field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -172320,6 +172319,7 @@ exports[`single fields unsupported field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": undefined, @@ -175939,7 +175939,6 @@ exports[`single fields up/down field 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -175955,6 +175954,7 @@ exports[`single fields up/down field 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "number", @@ -179589,7 +179589,6 @@ exports[`single fields using custom tagName 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -179605,6 +179604,7 @@ exports[`single fields using custom tagName 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "type": "string", diff --git a/packages/daisyui/test/__snapshots__/Object.test.tsx.snap b/packages/daisyui/test/__snapshots__/Object.test.tsx.snap index b8ba77c421..6ae8c05f51 100644 --- a/packages/daisyui/test/__snapshots__/Object.test.tsx.snap +++ b/packages/daisyui/test/__snapshots__/Object.test.tsx.snap @@ -17,7 +17,6 @@ exports[`object fields additionalProperties 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -33,6 +32,7 @@ exports[`object fields additionalProperties 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -3638,7 +3638,6 @@ exports[`object fields additionalProperties 1`] = ` id="root_foo__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -3654,6 +3653,7 @@ exports[`object fields additionalProperties 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -7375,7 +7375,6 @@ exports[`object fields object 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -7391,6 +7390,7 @@ exports[`object fields object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -10989,7 +10989,6 @@ exports[`object fields object 1`] = ` id="root_a__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -11005,6 +11004,7 @@ exports[`object fields object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -14646,7 +14646,6 @@ exports[`object fields object 1`] = ` id="root_b__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -14662,6 +14661,7 @@ exports[`object fields object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -18335,7 +18335,6 @@ exports[`object fields show add button and fields if additionalProperties is tru id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -18351,6 +18350,7 @@ exports[`object fields show add button and fields if additionalProperties is tru "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -21953,7 +21953,6 @@ exports[`object fields show add button and fields if additionalProperties is tru id="root_additionalProperty__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -21969,6 +21968,7 @@ exports[`object fields show add button and fields if additionalProperties is tru "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -25688,7 +25688,6 @@ exports[`object fields with title and description additionalProperties 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -25704,6 +25703,7 @@ exports[`object fields with title and description additionalProperties 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -29338,7 +29338,6 @@ exports[`object fields with title and description additionalProperties 1`] = ` id="root_foo__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -29354,6 +29353,7 @@ exports[`object fields with title and description additionalProperties 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -33079,7 +33079,6 @@ exports[`object fields with title and description from both additionalProperties id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -33095,6 +33094,7 @@ exports[`object fields with title and description from both additionalProperties "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -36748,7 +36748,6 @@ exports[`object fields with title and description from both additionalProperties id="root_foo__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -36764,6 +36763,7 @@ exports[`object fields with title and description from both additionalProperties "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -40489,7 +40489,6 @@ exports[`object fields with title and description from both object 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -40505,6 +40504,7 @@ exports[`object fields with title and description from both object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -44157,7 +44157,6 @@ exports[`object fields with title and description from both object 1`] = ` id="root_a__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -44173,6 +44172,7 @@ exports[`object fields with title and description from both object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -47831,7 +47831,6 @@ exports[`object fields with title and description from both object 1`] = ` id="root_b__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -47847,6 +47846,7 @@ exports[`object fields with title and description from both object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -51537,7 +51537,6 @@ exports[`object fields with title and description from uiSchema additionalProper id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -51553,6 +51552,7 @@ exports[`object fields with title and description from uiSchema additionalProper "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -55200,7 +55200,6 @@ exports[`object fields with title and description from uiSchema additionalProper id="root_foo__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -55216,6 +55215,7 @@ exports[`object fields with title and description from uiSchema additionalProper "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -58937,7 +58937,6 @@ exports[`object fields with title and description from uiSchema object 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -58953,6 +58952,7 @@ exports[`object fields with title and description from uiSchema object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -62593,7 +62593,6 @@ exports[`object fields with title and description from uiSchema object 1`] = ` id="root_a__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -62609,6 +62608,7 @@ exports[`object fields with title and description from uiSchema object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -66258,7 +66258,6 @@ exports[`object fields with title and description from uiSchema object 1`] = ` id="root_b__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -66274,6 +66273,7 @@ exports[`object fields with title and description from uiSchema object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "properties": { @@ -69955,7 +69955,6 @@ exports[`object fields with title and description from uiSchema show add button id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -69971,6 +69970,7 @@ exports[`object fields with title and description from uiSchema show add button "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -73615,7 +73615,6 @@ exports[`object fields with title and description from uiSchema show add button id="root_additionalProperty__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -73631,6 +73630,7 @@ exports[`object fields with title and description from uiSchema show add button "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -77350,7 +77350,6 @@ exports[`object fields with title and description object 1`] = ` id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -77366,6 +77365,7 @@ exports[`object fields with title and description object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -80999,7 +80999,6 @@ exports[`object fields with title and description object 1`] = ` id="root_a__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -81015,6 +81014,7 @@ exports[`object fields with title and description object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -84665,7 +84665,6 @@ exports[`object fields with title and description object 1`] = ` id="root_b__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -84681,6 +84680,7 @@ exports[`object fields with title and description object 1`] = ` "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "description": "a test description", @@ -88363,7 +88363,6 @@ exports[`object fields with title and description show add button and fields if id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -88379,6 +88378,7 @@ exports[`object fields with title and description show add button and fields if "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -92010,7 +92010,6 @@ exports[`object fields with title and description show add button and fields if id="root_additionalProperty__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -92026,6 +92025,7 @@ exports[`object fields with title and description show add button and fields if "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": undefined, "rootSchema": { "additionalProperties": true, @@ -95749,7 +95749,6 @@ exports[`object fields with title and description with global label off addition id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -95765,6 +95764,7 @@ exports[`object fields with title and description with global label off addition "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -99384,7 +99384,6 @@ exports[`object fields with title and description with global label off addition id="root_foo__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -99400,6 +99399,7 @@ exports[`object fields with title and description with global label off addition "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -103117,7 +103117,6 @@ exports[`object fields with title and description with global label off object 1 id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -103133,6 +103132,7 @@ exports[`object fields with title and description with global label off object 1 "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -106751,7 +106751,6 @@ exports[`object fields with title and description with global label off object 1 id="root_a__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -106767,6 +106766,7 @@ exports[`object fields with title and description with global label off object 1 "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -110409,7 +110409,6 @@ exports[`object fields with title and description with global label off object 1 id="root_b__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -110425,6 +110424,7 @@ exports[`object fields with title and description with global label off object 1 "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -114099,7 +114099,6 @@ exports[`object fields with title and description with global label off show add id="root__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -114115,6 +114114,7 @@ exports[`object fields with title and description with global label off show add "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, @@ -117731,7 +117731,6 @@ exports[`object fields with title and description with global label off show add id="root_additionalProperty__description" registry={ { - "experimental_componentUpdateStrategy": "customDeep", "fields": { "AnyOfField": [Function], "ArrayField": [Function], @@ -117747,6 +117746,7 @@ exports[`object fields with title and description with global label off show add "StringField": [Function], }, "formContext": {}, + "globalFormOptions": {}, "globalUiOptions": { "label": false, }, diff --git a/packages/daisyui/test/helpers/createMocks.ts b/packages/daisyui/test/helpers/createMocks.ts index 5532733634..1b2895b204 100644 --- a/packages/daisyui/test/helpers/createMocks.ts +++ b/packages/daisyui/test/helpers/createMocks.ts @@ -25,6 +25,7 @@ export function mockRegistry() { rootSchema: {}, schemaUtils: mockSchemaUtils, translateString: englishStringTranslator, + globalFormOptions: {}, }; } diff --git a/packages/docs/docs/advanced-customization/custom-widgets-fields.md b/packages/docs/docs/advanced-customization/custom-widgets-fields.md index f13a981115..d99d97308f 100644 --- a/packages/docs/docs/advanced-customization/custom-widgets-fields.md +++ b/packages/docs/docs/advanced-customization/custom-widgets-fields.md @@ -397,8 +397,6 @@ A field component will always be passed the following props: - `readonly`: A boolean value stating if the field is read-only; - `autofocus`: A boolean value stating if the field should autofocus; - `name`: The unique name of the field, usually derived from the name of the property in the JSONSchema -- `idPrefix`: To avoid collisions with existing ids in the DOM, it is possible to change the prefix used for ids; Default is `root` -- `idSeparator`: To avoid using a path separator that is present in field names, it is possible to change the separator used for ids (Default is `_`) - `rawErrors`: `An array of strings listing all generated error messages from encountered errors for this field - `onChange`: The field change event handler; called with the updated field value, the optional change path for the value (defaults to an empty array), an optional ErrorSchema and the optional id of the field being changed - `onBlur`: The input blur event handler; call it with the field id and value; @@ -410,8 +408,12 @@ The `registry` is an object containing the registered core, theme and custom fie - `fields`: The set of all fields used by the `Form`. Includes fields from `core`, theme-specific fields and any [custom registered fields](#custom-field-components); - `widgets`: The set of all widgets used by the `Form`. Includes widgets from `core`, theme-specific widgets and any [custom registered widgets](#custom-component-registration), if any; +- `templates`: The set of templates used by the `Form`. Includes templates from `core`, theme-specific templates and any custom registered templates - `rootSchema`: The root schema, as passed to the `Form`, which can contain referenced [definitions](../json-schema/definitions.md); - `schemaUtils`: The current implementation of the `SchemaUtilsType` (from `@rjsf/utils`) in use by the `Form`. Used to call any of the validation-schema-based utility functions. +- `translateString`: The string translation function to use when displaying any of the RJSF strings in templates, fields or widgets +- `globalFormOptions`: The global Form Options that are available for all templates, fields and widgets to access +- `globalUiOptions`: The optional global UI Options that are available for all templates, fields and widgets to access The registry is passed down the component tree, so you can access it from your custom field, custom widget, custom template and `SchemaField` components. diff --git a/packages/docs/docs/api-reference/form-props.md b/packages/docs/docs/api-reference/form-props.md index 7b18d0dc21..81d6b46ea8 100644 --- a/packages/docs/docs/api-reference/form-props.md +++ b/packages/docs/docs/api-reference/form-props.md @@ -56,6 +56,18 @@ Formerly the `validate` prop. The `customValidate` prop requires a function that specifies custom validation rules for the form. See [Validation](../usage/validation.md) for more information. +## experimental_componentUpdateStrategy + +Experimental feature to specify an alternative component update strategy that accepts one of the following value: +React's default `Component` rendering strategy is to re-render on every state change, see `shouldComponentUpdate` docs. +`PureComponent`'s strategy uses shallow equality. One can also always update (not recommended for performance reasons, but can be useful for testing) + +| Option | Description | +| ---------- | ------------------------------------------------- | +| customDeep | Legacy behavior - uses RJSF's deepEquals function | +| shallow | shallow equality | +| always | component always rerenders | + ## experimental_defaultFormStateBehavior Experimental features to specify different form state behavior. diff --git a/packages/docs/docs/migration-guides/v6.x upgrade guide.md b/packages/docs/docs/migration-guides/v6.x upgrade guide.md index 45480a3b20..88df4e5cea 100644 --- a/packages/docs/docs/migration-guides/v6.x upgrade guide.md +++ b/packages/docs/docs/migration-guides/v6.x upgrade guide.md @@ -259,6 +259,38 @@ function StringFieldError(props: FieldProps) { } ``` +### FieldProps.idPrefix and FieldProps.idSeparator refactor + +The `idPrefix` and `idSeparator` props were refactored from the `FieldProps` interface to the new `GlobalFormOptions` interface, +If your custom implementation required either of those props, you can simply obtain them from the `registry.globalFormOptions` variable instead. + +### Registry BREAKING CHANGES + +A new required prop, `globalFormOptions: GlobalFormOptions`, was added to the `Registry` interface. +This could affect your tests if you have your own way of creating `registry` objects to test your custom widgets, fields and/or templates. +If you are creating `Registry` objects, you simply need to add an empty object to the `globalFormOptions` prop. +You may also, provide values for any of the optional props contained within the `GlobalFormOptions` type. + +The definition of the `GlobalFormOptions` object is: + +```typescript +/** The set of options from the `Form` that will be available on the `Registry` for use in everywhere the `registry` is + * available. + */ +export type GlobalFormOptions = { + /** To avoid collisions with existing ids in the DOM, it is possible to change the prefix used for ids; + * Default is `root`. This prop is passed to the `toIdSchema()` function within the RJSF field implementations. + */ + readonly idPrefix?: string; + /** To avoid using a path separator that is present in field names, it is possible to change the separator used for + * ids; Default is `_`. This prop is passed to the `toIdSchema()` function within the RJSF field implementations. + */ + readonly idSeparator?: string; + /** The component update strategy used by the Form and its fields for performance optimization */ + readonly experimental_componentUpdateStrategy?: 'customDeep' | 'shallow' | 'always'; +}; +``` + ### Templates BREAKING CHANGES #### ArrayFieldTemplateItemType diff --git a/packages/utils/src/types.ts b/packages/utils/src/types.ts index 711d621548..816d227b98 100644 --- a/packages/utils/src/types.ts +++ b/packages/utils/src/types.ts @@ -395,6 +395,22 @@ export type GlobalUISchemaOptions = GenericObjectType & { enableMarkdownInDescription?: boolean; }; +/** The set of options from the `Form` that will be available on the `Registry` for use in everywhere the `registry` is + * available. + */ +export type GlobalFormOptions = { + /** To avoid collisions with existing ids in the DOM, it is possible to change the prefix used for ids; + * Default is `root`. This prop is passed to the `toIdSchema()` function within the RJSF field implementations. + */ + readonly idPrefix?: string; + /** To avoid using a path separator that is present in field names, it is possible to change the separator used for + * ids; Default is `_`. This prop is passed to the `toIdSchema()` function within the RJSF field implementations. + */ + readonly idSeparator?: string; + /** The component update strategy used by the Form and its fields for performance optimization */ + readonly experimental_componentUpdateStrategy?: 'customDeep' | 'shallow' | 'always'; +}; + /** The object containing the registered core, theme and custom fields and widgets as well as the root schema, form * context, schema utils and templates. */ @@ -403,7 +419,7 @@ export interface Registry; - /** The set of templates used by the `Form`. Includes templates from `core`, theme-specific fields and any custom + /** The set of templates used by the `Form`. Includes templates from `core`, theme-specific templates and any custom * registered templates */ templates: TemplatesType; @@ -421,10 +437,10 @@ export interface Registry; /** The string translation function to use when displaying any of the RJSF strings in templates, fields or widgets */ translateString: (stringKey: TranslatableString, params?: string[]) => string; + /** The global Form Options that are available for all templates, fields and widgets to access */ + readonly globalFormOptions: GlobalFormOptions; /** The optional global UI Options that are available for all templates, fields and widgets to access */ globalUiOptions?: GlobalUISchemaOptions; - /** The component update strategy used by the Form and its fields for performance optimization */ - experimental_componentUpdateStrategy?: 'customDeep' | 'shallow' | 'always'; } /** The properties that are passed to a `Field` implementation */ @@ -458,14 +474,6 @@ export interface FieldProps