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

fix: #2007 by reimplementing #2533 #3186

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

heath-freenome
Copy link
Member

Reasons for making this change

Fixed #2007 by reimplementing #2533

The current code for FieldTemplate and TextWidget in bootstrap 4 is incompatible with the core package. This breaks the external facing API for customizing field template. According to the core package implementation and documents, FieldTemplate is responsible for layout of labels, description, errors and help while the input widget along with the state is to be managed by the Field Component themselves (and Widgets) If a user, uses custom field template with the bootstrap 4 form, the label is displayed multiple times, once by the custom field template (as intended in the API) and second time by the TextWidget (breaks from the core package convention) This fixes the problem and updates the tests to catch any future regressions.

  • Updated FieldTemplate to output Label generation, adding an additional check to simply render children when the component is hidden
  • Updated BaseInputTemplate, CheckboxesWidget, RadioWidget, SelectWidget and TextareaWidget, removing the Label generation
  • Updated the test snapshots
  • Updated the CHANGELOG.md accordingly

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

Fixed rjsf-team#2007

The current code for FieldTemplate and TextWidget in bootstrap 4 is incompatible with the core package. This breaks the
external facing API for customizing field template.
According to the core package implementation and documents, FieldTemplate is responsible for layout of labels, description, errors and help while the input widget along with the state is to be managed by the Field Component themselves (and Widgets)
If a user, uses custom field template with the bootstrap 4 form, the label is displayed multiple times, once by the custom field template (as intended in the API) and second time by the TextWidget (breaks from the core package convention)
This fixes the problem and updates the tests to catch any future regressions.

- Updated `FieldTemplate` to output `Label` generation, adding an additional check to simply render `children` when the component is `hidden`
- Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `SelectWidget` and `TextareaWidget`, removing the `Label` generation
- Updated the test snapshots
- Updated the `CHANGELOG.md` accordingly
@heath-freenome heath-freenome merged commit 4542b16 into rjsf-team:main Oct 7, 2022
@heath-freenome heath-freenome deleted the reimplement-2533 branch October 7, 2022 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bootstrap-4] Widget and FieldTemplate customisation
2 participants