diff --git a/CHANGELOG.md b/CHANGELOG.md index b594f05f06..cea300ab84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,53 @@ it according to semantic versioning. For example, if your PR adds a breaking cha should change the heading of the (upcoming) version to include a major version bump. --> +# 5.0.0-beta-16 + +## @rjsf/antd +- Updated the usage of the `ButtonTemplates` to pass the new required `registry` prop, filtering it out in the actual implementations before spreading props, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) +- Updated the test for the `CheckboxWidget` validating that the `schema.title` is passed as the label, fixing [#3302](https://github.com/rjsf-team/react-jsonschema-form/issues/3302) + +## @rjsf/bootstrap-4 +- Updated the usage of the `ButtonTemplates` to pass the new required `registry` prop, filtering it out in the actual implementations before spreading props, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) +- Updated `CheckboxWidget` to get the `required` state of the checkbox from the `schemaRequiresTrueValue()` utility function rather than the `required` prop, fixing [#3317](https://github.com/rjsf-team/react-jsonschema-form/issues/3317) +- Updated the test for the `CheckboxWidget` validating that the `schema.title` is passed as the label, fixing [#3302](https://github.com/rjsf-team/react-jsonschema-form/issues/3302) + +## @rjsf/chakra-ui +- Updated the usage of the `ButtonTemplates` to pass the new required `registry` prop, filtering it out in the actual implementations before spreading props, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) +- Updated `CheckboxWidget` to get the `required` state of the checkbox from the `schemaRequiresTrueValue()` utility function rather than the `required` prop, fixing [#3317](https://github.com/rjsf-team/react-jsonschema-form/issues/3317) +- Updated the test for the `CheckboxWidget` validating that the `schema.title` is passed as the label, fixing [#3302](https://github.com/rjsf-team/react-jsonschema-form/issues/3302) + +## @rjsf/core +- Updated the usage of the `ButtonTemplates` to pass the new required `registry` prop, filtering it out in the actual implementations before spreading props, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) + - Also, passed `registry` into the `SubmitButton` inside of the `Form` as part of this fix +- Updated `ArrayField` to pass the new `totalItems` prop to the `ArrayFieldItemTemplate` instances, fixing [#3315](https://github.com/rjsf-team/react-jsonschema-form/issues/3315) + - Also refactored the near duplicate logic for `onAddClick` and `onAddIndexClick` into a new `_handleAddClick()` function, fixing [#3316](https://github.com/rjsf-team/react-jsonschema-form/issues/3316) + +## @rjsf/fluent-ui +- Updated the usage of the `ButtonTemplates` to pass the new required `registry` prop, filtering it out in the actual implementations before spreading props, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) +- Updated the test for the `CheckboxWidget` validating that the `schema.title` is passed as the label, fixing [#3302](https://github.com/rjsf-team/react-jsonschema-form/issues/3302) + +## @rjsf/material-ui +- Updated the usage of the `ButtonTemplates` to pass the new required `registry` prop, filtering it out in the actual implementations before spreading props, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) +- Updated the test for the `CheckboxWidget` validating that the `schema.title` is passed as the label, fixing [#3302](https://github.com/rjsf-team/react-jsonschema-form/issues/3302) + +## @rjsf/mui +- Updated the usage of the `ButtonTemplates` to pass the new required `registry` prop, filtering it out in the actual implementations before spreading props, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) +- Updated the test for the `CheckboxWidget` validating that the `schema.title` is passed as the label, fixing [#3302](https://github.com/rjsf-team/react-jsonschema-form/issues/3302) + +## @rjsf/semantic-ui +- Updated the usage of the `ButtonTemplates` to pass the new required `registry` prop, filtering it out in the actual implementations before spreading props, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) +- Updated `CheckboxWidget` to get the `required` state of the checkbox from the `schemaRequiresTrueValue()` utility function rather than the `required` prop, fixing [#3317](https://github.com/rjsf-team/react-jsonschema-form/issues/3317) + - Also fixed the `CheckboxWidget` missing label issue [#3302](https://github.com/rjsf-team/react-jsonschema-form/issues/3302) +- Updated the test for the `CheckboxWidget` validating that the `schema.title` is passed as the label, fixing [#3302](https://github.com/rjsf-team/react-jsonschema-form/issues/3302) + +## @rjsf/utils +- Updated the `SubmitButtonProps` and `IconButtonProps` to add required `registry` prop, fixing - [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) +- Updated the `ArrayFieldTemplateItemType` to add the new `totalItems` prop, fixing [#3315](https://github.com/rjsf-team/react-jsonschema-form/issues/3315) + +## Dev / docs / playground +- Fixed the documentation for `ArrayFieldItemTemplate`, `SubmitButtonProps` and `IconButtonProps` as part of the fix for [#3314](https://github.com/rjsf-team/react-jsonschema-form/issues/3314) and [#3315](https://github.com/rjsf-team/react-jsonschema-form/issues/3315) + # 5.0.0-beta-15 ## @rjsf/core diff --git a/docs/advanced-customization/custom-templates.md b/docs/advanced-customization/custom-templates.md index d1aad99166..c0427ca6d1 100644 --- a/docs/advanced-customization/custom-templates.md +++ b/docs/advanced-customization/custom-templates.md @@ -217,6 +217,7 @@ The following props are passed to each `ArrayFieldItemTemplate`: - `hasRemove`: A boolean value stating whether the array item can be removed. - `hasToolbar`: A boolean value stating whether the array item has a toolbar. - `index`: A number stating the index the array item occurs in `items`. +- `totalItems`: A number stating the total number `items` in the array. - `key`: A stable, unique key for the array item. - `onAddIndexClick: (index) => (event?) => void`: Returns a function that adds a new item at `index`. - `onDropIndexClick: (index) => (event?) => void`: Returns a function that removes the item at `index`. @@ -849,6 +850,7 @@ Each button template (except for the `SubmitButton`) accepts, as props, the stan - `iconType`: An alternative specification for the type of the icon button. - `icon`: The name representation or actual react element implementation for the icon. - `uiSchema`: The uiSchema object for this field. +- `registry`: The `registry` object. ### AddButton @@ -1003,3 +1005,4 @@ render(( The following prop is passed to a `SubmitButton`: - `uiSchema`: The uiSchema object for this field, used to extract the `UISchemaSubmitButtonOptions`. +- `registry`: The `registry` object. diff --git a/packages/antd/src/templates/ArrayFieldItemTemplate/index.tsx b/packages/antd/src/templates/ArrayFieldItemTemplate/index.tsx index 2b01d14bef..0f5dbe4aec 100644 --- a/packages/antd/src/templates/ArrayFieldItemTemplate/index.tsx +++ b/packages/antd/src/templates/ArrayFieldItemTemplate/index.tsx @@ -43,6 +43,7 @@ const ArrayFieldItemTemplate = ({ onClick={onReorderClick(index, index - 1)} style={BTN_STYLE} uiSchema={uiSchema} + registry={registry} /> )} {(hasMoveUp || hasMoveDown) && ( @@ -51,6 +52,7 @@ const ArrayFieldItemTemplate = ({ onClick={onReorderClick(index, index + 1)} style={BTN_STYLE} uiSchema={uiSchema} + registry={registry} /> )} {hasRemove && ( @@ -59,6 +61,7 @@ const ArrayFieldItemTemplate = ({ onClick={onDropIndexClick(index)} style={BTN_STYLE} uiSchema={uiSchema} + registry={registry} /> )} diff --git a/packages/antd/src/templates/ArrayFieldTemplate/index.tsx b/packages/antd/src/templates/ArrayFieldTemplate/index.tsx index e20937d35b..39793e20fa 100644 --- a/packages/antd/src/templates/ArrayFieldTemplate/index.tsx +++ b/packages/antd/src/templates/ArrayFieldTemplate/index.tsx @@ -105,6 +105,7 @@ const ArrayFieldTemplate = ({ disabled={disabled || readonly} onClick={onAddClick} uiSchema={uiSchema} + registry={registry} /> diff --git a/packages/antd/src/templates/IconButton/index.tsx b/packages/antd/src/templates/IconButton/index.tsx index b90437eac8..ec3d8a58b3 100644 --- a/packages/antd/src/templates/IconButton/index.tsx +++ b/packages/antd/src/templates/IconButton/index.tsx @@ -10,7 +10,13 @@ import PlusCircleOutlined from "@ant-design/icons/PlusCircleOutlined"; export type AntdIconButtonProps = Omit; export default function IconButton(props: AntdIconButtonProps & ButtonProps) { - const { iconType = "default", icon, uiSchema, ...otherProps } = props; + const { + iconType = "default", + icon, + uiSchema, + registry, + ...otherProps + } = props; return -`; diff --git a/packages/bootstrap-4/test/__snapshots__/CheckboxWidget.test.tsx.snap b/packages/bootstrap-4/test/__snapshots__/CheckboxWidget.test.tsx.snap deleted file mode 100644 index 07a70f0075..0000000000 --- a/packages/bootstrap-4/test/__snapshots__/CheckboxWidget.test.tsx.snap +++ /dev/null @@ -1,32 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`CheckboxWidget simple 1`] = ` -
-
- - -
-
-`; diff --git a/packages/bootstrap-4/test/__snapshots__/Form.test.tsx.snap b/packages/bootstrap-4/test/__snapshots__/Form.test.tsx.snap index f19063fea8..2b99c0afe3 100644 --- a/packages/bootstrap-4/test/__snapshots__/Form.test.tsx.snap +++ b/packages/bootstrap-4/test/__snapshots__/Form.test.tsx.snap @@ -28,6 +28,7 @@ exports[`single fields checkbox field 1`] = ` onBlur={[Function]} onChange={[Function]} onFocus={[Function]} + required={false} type="checkbox" /> @@ -46,7 +47,7 @@ exports[`single fields checkbox field 1`] = ` `; -exports[`single fields checkbox field 2`] = ` +exports[`single fields checkbox field with label 1`] = `
+ diff --git a/packages/chakra-ui/src/AddButton/AddButton.tsx b/packages/chakra-ui/src/AddButton/AddButton.tsx index 6ce0152596..8ff0dd5e89 100644 --- a/packages/chakra-ui/src/AddButton/AddButton.tsx +++ b/packages/chakra-ui/src/AddButton/AddButton.tsx @@ -5,6 +5,7 @@ import { AddIcon } from "@chakra-ui/icons"; const AddButton: React.ComponentType = ({ uiSchema, + registry, ...props }) => ( + + +`; + exports[`single fields checkboxes field 1`] = ` .emotion-1 { margin-bottom: 1px; diff --git a/packages/core/src/components/Form.tsx b/packages/core/src/components/Form.tsx index 8487032251..2682754f3d 100644 --- a/packages/core/src/components/Form.tsx +++ b/packages/core/src/components/Form.tsx @@ -834,7 +834,11 @@ export default class Form< disabled={disabled} readonly={readonly} /> - {children ? children : } + {children ? ( + children + ) : ( + + )} {showErrorList === "bottom" && this.renderErrors(registry)} ); diff --git a/packages/core/src/components/fields/ArrayField.tsx b/packages/core/src/components/fields/ArrayField.tsx index e97e415ae1..6b0b2c9d8e 100644 --- a/packages/core/src/components/fields/ArrayField.tsx +++ b/packages/core/src/components/fields/ArrayField.tsx @@ -192,13 +192,14 @@ class ArrayField< return schemaUtils.getDefaultFormState(itemSchema) as unknown as T; }; - /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of - * the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the - * keyed data + /** Callback handler for when the user clicks on the add or add at index buttons. Creates a new row of keyed form data + * either at the end of the list (when index is not specified) or inserted at the `index` when it is, adding it into + * the state, and then returning `onChange()` with the plain form data converted from the keyed data * * @param event - The event for the click + * @param [index] - The optional index at which to add the new data */ - onAddClick = (event: MouseEvent) => { + _handleAddClick(event: MouseEvent, index?: number) { if (event) { event.preventDefault(); } @@ -209,7 +210,12 @@ class ArrayField< key: generateRowId(), item: this._getNewFormDataRow(), }; - const newKeyedFormData = [...keyedFormData, newKeyedFormDataRow]; + const newKeyedFormData = [...keyedFormData]; + if (index !== undefined) { + newKeyedFormData.splice(index, 0, newKeyedFormDataRow); + } else { + newKeyedFormData.push(newKeyedFormDataRow); + } this.setState( { keyedFormData: newKeyedFormData, @@ -217,6 +223,16 @@ class ArrayField< }, () => onChange(keyedToPlainFormData(newKeyedFormData)) ); + } + + /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of + * the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the + * keyed data + * + * @param event - The event for the click + */ + onAddClick = (event: MouseEvent) => { + this._handleAddClick(event); }; /** Callback handler for when the user clicks on the add button on an existing array element. Creates a new row of @@ -227,25 +243,7 @@ class ArrayField< */ onAddIndexClick = (index: number) => { return (event: MouseEvent) => { - if (event) { - event.preventDefault(); - } - const { onChange } = this.props; - const { keyedFormData } = this.state; - const newKeyedFormDataRow: KeyedFormDataType = { - key: generateRowId(), - item: this._getNewFormDataRow(), - }; - const newKeyedFormData = [...keyedFormData]; - newKeyedFormData.splice(index, 0, newKeyedFormDataRow); - - this.setState( - { - keyedFormData: newKeyedFormData, - updatedKeyedFormData: true, - }, - () => onChange(keyedToPlainFormData(newKeyedFormData)) - ); + this._handleAddClick(event, index); }; }; @@ -478,6 +476,7 @@ class ArrayField< onBlur, onFocus, rawErrors, + totalItems: keyedFormData.length, }); }), className: `field field-array field-array-of-${itemsSchema.type}`, @@ -739,6 +738,7 @@ class ArrayField< onBlur, onFocus, rawErrors, + totalItems: keyedFormData.length, }); }), onAddClick: this.onAddClick, @@ -781,6 +781,7 @@ class ArrayField< onBlur: FieldProps["onBlur"]; onFocus: FieldProps["onFocus"]; rawErrors?: string[]; + totalItems: number; }) { const { key, @@ -798,6 +799,7 @@ class ArrayField< onBlur, onFocus, rawErrors, + totalItems, } = props; const { disabled, @@ -856,6 +858,7 @@ class ArrayField< hasMoveDown: has.moveDown, hasRemove: has.remove, index, + totalItems, key, onAddIndexClick: this.onAddIndexClick, onDropIndexClick: this.onDropIndexClick, diff --git a/packages/core/src/components/templates/ArrayFieldItemTemplate.tsx b/packages/core/src/components/templates/ArrayFieldItemTemplate.tsx index 5da0254d36..bea8a1e08c 100644 --- a/packages/core/src/components/templates/ArrayFieldItemTemplate.tsx +++ b/packages/core/src/components/templates/ArrayFieldItemTemplate.tsx @@ -56,6 +56,7 @@ export default function ArrayFieldItemTemplate< disabled={disabled || readonly || !hasMoveUp} onClick={onReorderClick(index, index - 1)} uiSchema={uiSchema} + registry={registry} /> )} {(hasMoveUp || hasMoveDown) && ( @@ -64,6 +65,7 @@ export default function ArrayFieldItemTemplate< disabled={disabled || readonly || !hasMoveDown} onClick={onReorderClick(index, index + 1)} uiSchema={uiSchema} + registry={registry} /> )} {hasRemove && ( @@ -72,6 +74,7 @@ export default function ArrayFieldItemTemplate< disabled={disabled || readonly} onClick={onDropIndexClick(index)} uiSchema={uiSchema} + registry={registry} /> )} diff --git a/packages/core/src/components/templates/ArrayFieldTemplate.tsx b/packages/core/src/components/templates/ArrayFieldTemplate.tsx index 5b129e5e5d..cf117894f6 100644 --- a/packages/core/src/components/templates/ArrayFieldTemplate.tsx +++ b/packages/core/src/components/templates/ArrayFieldTemplate.tsx @@ -85,6 +85,7 @@ export default function ArrayFieldTemplate< onClick={onAddClick} disabled={disabled || readonly} uiSchema={uiSchema} + registry={registry} /> )} diff --git a/packages/core/src/components/templates/ButtonTemplates/AddButton.tsx b/packages/core/src/components/templates/ButtonTemplates/AddButton.tsx index c8e3306be2..27aa5f34b4 100644 --- a/packages/core/src/components/templates/ButtonTemplates/AddButton.tsx +++ b/packages/core/src/components/templates/ButtonTemplates/AddButton.tsx @@ -14,7 +14,7 @@ export default function AddButton< T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any ->({ className, onClick, disabled }: IconButtonProps) { +>({ className, onClick, disabled, registry }: IconButtonProps) { return (

@@ -25,6 +25,7 @@ export default function AddButton< title="Add" onClick={onClick} disabled={disabled} + registry={registry} />

diff --git a/packages/core/src/components/templates/ButtonTemplates/IconButton.tsx b/packages/core/src/components/templates/ButtonTemplates/IconButton.tsx index ac86b1cbf9..358403f5fe 100644 --- a/packages/core/src/components/templates/ButtonTemplates/IconButton.tsx +++ b/packages/core/src/components/templates/ButtonTemplates/IconButton.tsx @@ -16,6 +16,7 @@ export default function IconButton< icon, className, uiSchema, + registry, ...otherProps } = props; return ( diff --git a/packages/core/src/components/templates/ObjectFieldTemplate.tsx b/packages/core/src/components/templates/ObjectFieldTemplate.tsx index 37c371ca68..ce2be8b2eb 100644 --- a/packages/core/src/components/templates/ObjectFieldTemplate.tsx +++ b/packages/core/src/components/templates/ObjectFieldTemplate.tsx @@ -79,6 +79,7 @@ export default function ObjectFieldTemplate< onClick={onAddClick(schema)} disabled={disabled || readonly} uiSchema={uiSchema} + registry={registry} /> )} diff --git a/packages/core/src/components/templates/WrapIfAdditionalTemplate.tsx b/packages/core/src/components/templates/WrapIfAdditionalTemplate.tsx index 35b6cb8bc0..bda1bc6450 100644 --- a/packages/core/src/components/templates/WrapIfAdditionalTemplate.tsx +++ b/packages/core/src/components/templates/WrapIfAdditionalTemplate.tsx @@ -65,6 +65,7 @@ export default function WrapIfAdditionalTemplate< disabled={disabled || readonly} onClick={onDropPropertyClick(label)} uiSchema={uiSchema} + registry={registry} /> diff --git a/packages/fluent-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx b/packages/fluent-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx index 563485aa0b..021def7afa 100644 --- a/packages/fluent-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +++ b/packages/fluent-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx @@ -34,6 +34,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly || !hasMoveUp} onClick={onReorderClick(index, index - 1)} uiSchema={uiSchema} + registry={registry} /> )} {(hasMoveUp || hasMoveDown) && ( @@ -41,6 +42,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly || !hasMoveDown} onClick={onReorderClick(index, index + 1)} uiSchema={uiSchema} + registry={registry} /> )} {hasRemove && ( @@ -48,6 +50,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly} onClick={onDropIndexClick(index)} uiSchema={uiSchema} + registry={registry} /> )} diff --git a/packages/fluent-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx b/packages/fluent-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx index 4512db01ef..a88d0adc88 100644 --- a/packages/fluent-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +++ b/packages/fluent-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx @@ -73,6 +73,7 @@ const ArrayFieldTemplate = (props: ArrayFieldTemplateProps) => { onClick={onAddClick} disabled={disabled || readonly} uiSchema={uiSchema} + registry={registry} /> )} diff --git a/packages/fluent-ui/test/Form.test.tsx b/packages/fluent-ui/test/Form.test.tsx index f87dd7d222..f7aa9e5a9a 100644 --- a/packages/fluent-ui/test/Form.test.tsx +++ b/packages/fluent-ui/test/Form.test.tsx @@ -191,9 +191,10 @@ describe("single fields", () => { .toJSON(); expect(tree).toMatchSnapshot(); }); - test("checkbox field", () => { + test("checkbox field with label", () => { const schema: RJSFSchema = { type: "boolean", + title: "test", }; const tree = renderer .create(
) diff --git a/packages/fluent-ui/test/__snapshots__/Form.test.tsx.snap b/packages/fluent-ui/test/__snapshots__/Form.test.tsx.snap index 2cc70f09bd..c9e838af1d 100644 --- a/packages/fluent-ui/test/__snapshots__/Form.test.tsx.snap +++ b/packages/fluent-ui/test/__snapshots__/Form.test.tsx.snap @@ -88,7 +88,7 @@ exports[`single fields checkbox field 1`] = `
`; -exports[`single fields checkbox field 2`] = ` +exports[`single fields checkbox field with label 1`] = `
+ diff --git a/packages/material-ui/src/AddButton/AddButton.tsx b/packages/material-ui/src/AddButton/AddButton.tsx index 4cb9ce6f31..031eb3d3f1 100644 --- a/packages/material-ui/src/AddButton/AddButton.tsx +++ b/packages/material-ui/src/AddButton/AddButton.tsx @@ -5,6 +5,7 @@ import { IconButtonProps } from "@rjsf/utils"; const AddButton: React.ComponentType = ({ uiSchema, + registry, ...props }) => { return ( diff --git a/packages/material-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx b/packages/material-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx index 315c1ef40a..7def41c20d 100644 --- a/packages/material-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +++ b/packages/material-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx @@ -46,6 +46,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly || !hasMoveUp} onClick={onReorderClick(index, index - 1)} uiSchema={uiSchema} + registry={registry} /> )} {(hasMoveUp || hasMoveDown) && ( @@ -54,6 +55,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly || !hasMoveDown} onClick={onReorderClick(index, index + 1)} uiSchema={uiSchema} + registry={registry} /> )} {hasRemove && ( @@ -62,6 +64,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly} onClick={onDropIndexClick(index)} uiSchema={uiSchema} + registry={registry} /> )} diff --git a/packages/material-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx b/packages/material-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx index 28d90435a5..3b2f4c945b 100644 --- a/packages/material-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +++ b/packages/material-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx @@ -76,6 +76,7 @@ const ArrayFieldTemplate = (props: ArrayFieldTemplateProps) => { onClick={onAddClick} disabled={disabled || readonly} uiSchema={uiSchema} + registry={registry} /> diff --git a/packages/material-ui/src/IconButton/IconButton.tsx b/packages/material-ui/src/IconButton/IconButton.tsx index d9fa72a17f..a970423ce5 100644 --- a/packages/material-ui/src/IconButton/IconButton.tsx +++ b/packages/material-ui/src/IconButton/IconButton.tsx @@ -8,7 +8,7 @@ import RemoveIcon from "@material-ui/icons/Remove"; import { IconButtonProps } from "@rjsf/utils"; export default function MuiIconButton(props: IconButtonProps) { - const { icon, color, uiSchema, ...otherProps } = props; + const { icon, color, uiSchema, registry, ...otherProps } = props; return ( diff --git a/packages/material-ui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx b/packages/material-ui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx index fee1cfdadd..b063e29c57 100644 --- a/packages/material-ui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +++ b/packages/material-ui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx @@ -71,6 +71,7 @@ const WrapIfAdditionalTemplate = ({ disabled={disabled || readonly} onClick={onDropPropertyClick(label)} uiSchema={uiSchema} + registry={registry} /> diff --git a/packages/material-ui/test/Form.test.tsx b/packages/material-ui/test/Form.test.tsx index a1a548a2c7..b3e426de8f 100644 --- a/packages/material-ui/test/Form.test.tsx +++ b/packages/material-ui/test/Form.test.tsx @@ -198,9 +198,10 @@ describe("single fields", () => { .toJSON(); expect(tree).toMatchSnapshot(); }); - test("checkbox field", () => { + test("checkbox field with label", () => { const schema: RJSFSchema = { type: "boolean", + title: "test", }; const tree = renderer .create() diff --git a/packages/material-ui/test/__snapshots__/Form.test.tsx.snap b/packages/material-ui/test/__snapshots__/Form.test.tsx.snap index 653cf88442..ed35e5e428 100644 --- a/packages/material-ui/test/__snapshots__/Form.test.tsx.snap +++ b/packages/material-ui/test/__snapshots__/Form.test.tsx.snap @@ -96,7 +96,7 @@ exports[`single fields checkbox field 1`] = ` `; -exports[`single fields checkbox field 2`] = ` +exports[`single fields checkbox field with label 1`] = `
- + test diff --git a/packages/mui/src/AddButton/AddButton.tsx b/packages/mui/src/AddButton/AddButton.tsx index a8ee541415..efeb631fbd 100644 --- a/packages/mui/src/AddButton/AddButton.tsx +++ b/packages/mui/src/AddButton/AddButton.tsx @@ -5,6 +5,7 @@ import { IconButtonProps } from "@rjsf/utils"; const AddButton: React.ComponentType = ({ uiSchema, + registry, ...props }) => { return ( diff --git a/packages/mui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx b/packages/mui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx index 1f132c21ee..3050a5667b 100644 --- a/packages/mui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +++ b/packages/mui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx @@ -45,6 +45,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly || !hasMoveUp} onClick={onReorderClick(index, index - 1)} uiSchema={uiSchema} + registry={registry} /> )} {(hasMoveUp || hasMoveDown) && ( @@ -53,6 +54,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly || !hasMoveDown} onClick={onReorderClick(index, index + 1)} uiSchema={uiSchema} + registry={registry} /> )} {hasRemove && ( @@ -61,6 +63,7 @@ const ArrayFieldItemTemplate = (props: ArrayFieldTemplateItemType) => { disabled={disabled || readonly} onClick={onDropIndexClick(index)} uiSchema={uiSchema} + registry={registry} /> )} diff --git a/packages/mui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx b/packages/mui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx index 321b0abea6..591495954a 100644 --- a/packages/mui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +++ b/packages/mui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx @@ -76,6 +76,7 @@ const ArrayFieldTemplate = (props: ArrayFieldTemplateProps) => { onClick={onAddClick} disabled={disabled || readonly} uiSchema={uiSchema} + registry={registry} /> diff --git a/packages/mui/src/IconButton/IconButton.tsx b/packages/mui/src/IconButton/IconButton.tsx index f0ee680f55..bb0cf636aa 100644 --- a/packages/mui/src/IconButton/IconButton.tsx +++ b/packages/mui/src/IconButton/IconButton.tsx @@ -8,7 +8,7 @@ import RemoveIcon from "@mui/icons-material/Remove"; import { IconButtonProps } from "@rjsf/utils"; export default function MuiIconButton(props: IconButtonProps) { - const { icon, color, uiSchema, ...otherProps } = props; + const { icon, color, uiSchema, registry, ...otherProps } = props; return ( diff --git a/packages/mui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx b/packages/mui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx index 232705d704..c16fcbb60d 100644 --- a/packages/mui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +++ b/packages/mui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx @@ -71,6 +71,7 @@ const WrapIfAdditionalTemplate = ({ disabled={disabled || readonly} onClick={onDropPropertyClick(label)} uiSchema={uiSchema} + registry={registry} /> diff --git a/packages/mui/test/Form.test.tsx b/packages/mui/test/Form.test.tsx index af18613f75..f5f6477159 100644 --- a/packages/mui/test/Form.test.tsx +++ b/packages/mui/test/Form.test.tsx @@ -221,9 +221,10 @@ describe("single fields", () => { .toJSON(); expect(tree).toMatchSnapshot(); }); - test("checkbox field", () => { + test("checkbox field with label", () => { const schema: RJSFSchema = { type: "boolean", + title: "test", }; const tree = renderer .create() diff --git a/packages/mui/test/__snapshots__/Form.test.tsx.snap b/packages/mui/test/__snapshots__/Form.test.tsx.snap index f793ad438e..81d4f40c40 100644 --- a/packages/mui/test/__snapshots__/Form.test.tsx.snap +++ b/packages/mui/test/__snapshots__/Form.test.tsx.snap @@ -357,7 +357,7 @@ exports[`single fields checkbox field 1`] = ` `; -exports[`single fields checkbox field 2`] = ` +exports[`single fields checkbox field with label 1`] = ` .emotion-0 { display: -webkit-inline-box; display: -webkit-inline-flex; @@ -664,7 +664,7 @@ exports[`single fields checkbox field 2`] = ` - + test diff --git a/packages/semantic-ui/src/AddButton/AddButton.tsx b/packages/semantic-ui/src/AddButton/AddButton.tsx index 2dc9d5c468..fc025ba2b4 100644 --- a/packages/semantic-ui/src/AddButton/AddButton.tsx +++ b/packages/semantic-ui/src/AddButton/AddButton.tsx @@ -2,7 +2,7 @@ import React from "react"; import { IconButtonProps } from "@rjsf/utils"; import { Button, Icon, ButtonProps } from "semantic-ui-react"; -function AddButton({ uiSchema, color, ...props }: IconButtonProps) { +function AddButton({ uiSchema, registry, color, ...props }: IconButtonProps) { return (