Skip to content

Commit

Permalink
fix: 3253 By adding schema to ArrayFieldTemplateItemType type (rjsf-t…
Browse files Browse the repository at this point in the history
…eam#3298)

fix: rjsf-team#3253 by adding `schema` prop `ArrayFieldTemplateItemType` type to make it consistent with all the rest of the template types
- In `@rjsf/utils`, updated `types.ts` to add `schema` to the `ArrayFieldTemplateItemType` type
- In `@rjsf/core`, updated the `ArrayField` template to pass the `schema` to the props that are provided to the instance of the `ArrayFieldItemTemplate`
- Updated `custom-templates.md` to add the `schema` to the documentation for `ArrayFieldItemTemplate`
- Updated the `CHANGELOG.md` accordingly
  • Loading branch information
heath-freenome authored and shijistar committed Jun 8, 2023
1 parent c3c3dd9 commit 984445b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ 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-15

# @rjsf/core
- Pass the `schema` along to the `ArrayFieldItemTemplate` as part of the fix for [#3253](https://github.com/rjsf-team/react-jsonschema-form/issues/3253)

# @rjsf/utils
- Update the `ArrayFieldItemTemplate` to add `schema` as part of the fix for [#3253](https://github.com/rjsf-team/react-jsonschema-form/issues/3253)

## Dev / docs / playground
- Fixed the documentation for `ArrayFieldItemTemplate` as part of the fix for [#3253](https://github.com/rjsf-team/react-jsonschema-form/issues/3253)

# 5.0.0-beta.14

## @rjsf/antd
Expand Down
1 change: 1 addition & 0 deletions docs/advanced-customization/custom-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ The following props are passed to each `ArrayFieldItemTemplate`:
- `onDropIndexClick: (index) => (event?) => void`: Returns a function that removes the item at `index`.
- `onReorderClick: (index, newIndex) => (event?) => void`: Returns a function that swaps the items at `index` with `newIndex`.
- `readonly`: A boolean value stating if the array item is read-only.
- `schema`: The schema object for this array item.
- `uiSchema`: The uiSchema object for this array item.
- `registry`: The `registry` object.

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/fields/ArrayField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ class ArrayField<
onReorderClick: this.onReorderClick,
readonly,
registry,
schema: itemSchema,
uiSchema: itemUiSchema,
};
}
Expand Down
4 changes: 3 additions & 1 deletion packages/utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ export type ArrayFieldTemplateItemType<
readonly: boolean;
/** A stable, unique key for the array item */
key: string;
/** The uiSchema object for this field */
/** The schema object for this array item */
schema: S;
/** The uiSchema object for this array item */
uiSchema?: UiSchema<T, S, F>;
/** The `registry` object */
registry: Registry<T, S, F>;
Expand Down

0 comments on commit 984445b

Please sign in to comment.