Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom add button text per array in schema #3130

Closed
1 task done
ivtpz opened this issue Sep 21, 2022 · 0 comments · Fixed by #3135
Closed
1 task done

Custom add button text per array in schema #3130

ivtpz opened this issue Sep 21, 2022 · 0 comments · Fixed by #3135
Assignees
Labels
feature Is a feature request

Comments

@ivtpz
Copy link

ivtpz commented Sep 21, 2022

Prerequisites

What theme are you using?

material-ui

Is your feature request related to a problem? Please describe.

The add item button used in the Array Field Template can only be customized globally, not per-field.

Describe the solution you'd like

Ability to either specify an AddButtonTemplate per field, or simply supplying the uiOptions as a prop to the AddButton used in the ArrayFieldTemplate (to support adding custom ui:something properties per field, and using that ui option in a custom AddButton template)

Describe alternatives you've considered

Currently have a custom ArrayFieldTemplate in my codebase that passes the uiOptions prop to the AddButton

@ivtpz ivtpz added feature Is a feature request needs triage Initial label given, to be assigned correct labels and assigned labels Sep 21, 2022
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Sep 22, 2022
- In `@rjsf/utils`, updated the `IconButtonProps` type to add `uiSchema` which required adding the `T` and `F` generics to it and the associated `ButtonTemplates` in `TemplatesType`
  - Also added `uiSchema` to the `ArrayFieldTemplateItemType`
- In `@rjsf/core`, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `ArrayField` to pass `uiSchema` to the `ArrayFieldTemplateItemType` creating in `renderArrayFieldItem()`
  - Updated `IconButton` to strip out the `uiSchema` before passing props to the button
  - Updated `FieldTemplate` to pass `uiSchema` to `WrapIfAdditional`
  - Updated `ArrayFieldItemTemplate` and `WrapIfAdditional` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- In the `antd`, `bootstrap-4`, `chakra-ui`, `material-ui`, `mui` and `semantic-ui` themes, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `IconButton` and `AddButton` to strip out the `uiSchema` before passing props to the button
  - Updated `FieldTemplate` to pass `uiSchema` to `WrapIfAdditional`
  - Updated `ArrayFieldItemTemplate` and `WrapIfAdditional` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- In the `fluent-ui` theme, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `IconButton` and `AddButton` to strip out the `uiSchema` before passing props to the button
  - Updated `ArrayFieldItemTemplate` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- Updated the `custom-templates.md` to add the `uiSchema` as a prop for `IconButtons` and `ArrayFieldItemTemplate`
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Sep 22, 2022
- In `@rjsf/utils`, updated the `IconButtonProps` type to add `uiSchema` which required adding the `T` and `F` generics to it and the associated `ButtonTemplates` in `TemplatesType`
  - Also added `uiSchema` to the `ArrayFieldTemplateItemType`
- In `@rjsf/core`, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `ArrayField` to pass `uiSchema` to the `ArrayFieldTemplateItemType` creating in `renderArrayFieldItem()`
  - Updated `IconButton` to strip out the `uiSchema` before passing props to the button
  - Updated `FieldTemplate` to pass `uiSchema` to `WrapIfAdditional`
  - Updated `ArrayFieldItemTemplate` and `WrapIfAdditional` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- In the `antd`, `bootstrap-4`, `chakra-ui`, `material-ui`, `mui` and `semantic-ui` themes, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `IconButton` and `AddButton` to strip out the `uiSchema` before passing props to the button
  - Updated `FieldTemplate` to pass `uiSchema` to `WrapIfAdditional`
  - Updated `ArrayFieldItemTemplate` and `WrapIfAdditional` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- In the `fluent-ui` theme, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `IconButton` and `AddButton` to strip out the `uiSchema` before passing props to the button
  - Updated `ArrayFieldItemTemplate` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- Updated the `custom-templates.md` to add the `uiSchema` as a prop for `IconButtons` and `ArrayFieldItemTemplate`
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit that referenced this issue Sep 22, 2022
- In `@rjsf/utils`, updated the `IconButtonProps` type to add `uiSchema` which required adding the `T` and `F` generics to it and the associated `ButtonTemplates` in `TemplatesType`
  - Also added `uiSchema` to the `ArrayFieldTemplateItemType`
- In `@rjsf/core`, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `ArrayField` to pass `uiSchema` to the `ArrayFieldTemplateItemType` creating in `renderArrayFieldItem()`
  - Updated `IconButton` to strip out the `uiSchema` before passing props to the button
  - Updated `FieldTemplate` to pass `uiSchema` to `WrapIfAdditional`
  - Updated `ArrayFieldItemTemplate` and `WrapIfAdditional` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- In the `antd`, `bootstrap-4`, `chakra-ui`, `material-ui`, `mui` and `semantic-ui` themes, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `IconButton` and `AddButton` to strip out the `uiSchema` before passing props to the button
  - Updated `FieldTemplate` to pass `uiSchema` to `WrapIfAdditional`
  - Updated `ArrayFieldItemTemplate` and `WrapIfAdditional` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- In the `fluent-ui` theme, updated the `IconButton`-based components to pass `uiSchema`
  - Updated `IconButton` and `AddButton` to strip out the `uiSchema` before passing props to the button
  - Updated `ArrayFieldItemTemplate` to take `uiSchema` and pass it to the icon buttons
  - Updated `ArrayFieldTemplate` and `ObjectFieldTemplate` to pass `uiSchema` to the icon buttons
- Updated the `custom-templates.md` to add the `uiSchema` as a prop for `IconButtons` and `ArrayFieldItemTemplate`
- Updated the `CHANGELOG.md` accordingly
@heath-freenome heath-freenome removed the needs triage Initial label given, to be assigned correct labels and assigned label Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is a feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants