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 for ui:options label & description #2537

Closed
wants to merge 3 commits into from

Conversation

newt10
Copy link
Collaborator

@newt10 newt10 commented Sep 3, 2021

Reasons for making this change

There are many bugs describing the problem with the current code ignoring some settings from uiSchema; namely

  • ui:title,
  • ui:description
  • ui:options
    • label:
    • title:
    • description:

This changeset fixes above problems for all fields, array fields and object fields. Labels are hidden when the ui:options {label: false} is provided as well as title and description fields from ui:options are applied as per the documentation.

If this is related to existing tickets, include links to them as well. Use the syntax fixes #2535 .

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests
    • I've updated docs if needed
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

Note

  • No documentation updates are required as this is a bug fix and aligns the expected behavior with documented behavior.

Screenshots

uiOptions

uiTitle

Tests passing after the code change

uiSchema Tests Passing

Tests failing before code change

https://pastebin.com/QE2a9jqv

@newt10 newt10 linked an issue Sep 3, 2021 that may be closed by this pull request
3 tasks
@newt10 newt10 added awaiting review labelOrDescription Relating to labels and descriptions of fields in the form labels Sep 3, 2021
@newt10 newt10 requested a review from epicfaace September 3, 2021 22:29
@newt10
Copy link
Collaborator Author

newt10 commented Sep 3, 2021

@epicfaace I have made the changes based on your review. Let me know if you need anything else in order to merge this.

@bejito
Copy link

bejito commented Sep 9, 2021

LGTM

@MilesNorton
Copy link

@newt10 @bejito What is the status with this ticket?

@heath-freenome
Copy link
Member

@newt10 With the conversion to typescript in v5, I was wondering if you had time to refactor this onto the latest changes in master?

@heath-freenome heath-freenome added awaiting changes v5 refactor Needs refactor due to v5 breaking changes and removed awaiting review labels Sep 7, 2022
@heath-freenome heath-freenome added the p1 Important to fix soon label Sep 28, 2022
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this pull request Oct 10, 2022
…rray description and title

Fix rjsf-team#2535 by reimplementing rjsf-team#2537
- In `@rjsf/utils`, updated the props for the description and title templates to add `schema`
  - Also made the `title` and `description` for the array field description and title props as optional
- In all of the themes, ensured that the `schema` is now passed to the all the calls to the description and title templates
  - With the exception of the `antd` theme, removed the logic for conditionally rendering the `ArrayFieldDescriptionTemplate` since that template already handles the condition
- In `@rjsf/core`, updated the `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to not render the template when `ui:label` is false
  - Updated the tests to verify this change
- Updated the `custom-templates.md` file to document the new `schema` prop and add the `uiSchema` prop docs where missing
- Updated the `contributing.md` file to improve developer documentation
- Updated the `CHANGELOG.md` file accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this pull request Oct 10, 2022
…rray description and title

Fix rjsf-team#2535 by reimplementing rjsf-team#2537
- In `@rjsf/utils`, updated the props for the description and title templates to add `schema`
  - Also made the `title` and `description` for the array field description and title props as optional
- In all of the themes, ensured that the `schema` is now passed to the all the calls to the description and title templates
  - With the exception of the `antd` theme, removed the logic for conditionally rendering the `ArrayFieldDescriptionTemplate` since that template already handles the condition
  - Deleted the tests for `DescriptionField` and `TitleField` in the `bootstrap-4` theme because they broke, and are redundant anyway given the other tests
- In `@rjsf/core`, updated the `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to not render the template when `ui:label` is false
  - Updated the tests to verify this change
- Updated the `custom-templates.md` file to document the new `schema` prop and add the `uiSchema` prop docs where missing
- Updated the `contributing.md` file to improve developer documentation
- Updated the `CHANGELOG.md` file accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this pull request Oct 10, 2022
…rray description and title

Fix rjsf-team#2535 by reimplementing rjsf-team#2537. Also fixes rjsf-team#3176 by passing uiSchema and schema to the description and title templates.
- In `@rjsf/utils`, updated the props for the description and title templates to add `schema`
  - Also made the `title` and `description` for the array field description and title props as optional
- In all of the themes, ensured that the `schema` is now passed to the all the calls to the description and title templates
  - With the exception of the `antd` theme, removed the logic for conditionally rendering the `ArrayFieldDescriptionTemplate` since that template already handles the condition
  - Deleted the tests for `DescriptionField` and `TitleField` in the `bootstrap-4` theme because they broke, and are redundant anyway given the other tests
- In `@rjsf/core`, updated the `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to not render the template when `ui:label` is false
  - Updated the tests to verify this change
- Updated the `custom-templates.md` file to document the new `schema` prop and add the `uiSchema` prop docs where missing
- Updated the `contributing.md` file to improve developer documentation
- Updated the `CHANGELOG.md` file accordingly
heath-freenome added a commit that referenced this pull request Oct 10, 2022
…ription and title (#3191)

Fix #2535 by reimplementing #2537. Also fixes #3176 by passing uiSchema and schema to the description and title templates.
- In `@rjsf/utils`, updated the props for the description and title templates to add `schema`
  - Also made the `title` and `description` for the array field description and title props as optional
- In all of the themes, ensured that the `schema` is now passed to the all the calls to the description and title templates
  - With the exception of the `antd` theme, removed the logic for conditionally rendering the `ArrayFieldDescriptionTemplate` since that template already handles the condition
  - Deleted the tests for `DescriptionField` and `TitleField` in the `bootstrap-4` theme because they broke, and are redundant anyway given the other tests
- In `@rjsf/core`, updated the `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to not render the template when `ui:label` is false
  - Updated the tests to verify this change
- Updated the `custom-templates.md` file to document the new `schema` prop and add the `uiSchema` prop docs where missing
- Updated the `contributing.md` file to improve developer documentation
- Updated the `CHANGELOG.md` file accordingly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes bug core labelOrDescription Relating to labels and descriptions of fields in the form p1 Important to fix soon uiSchema v5 refactor Needs refactor due to v5 breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui:options not behaving as expected from the documentation
5 participants