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: Reimplement #2537 so that ui:label is respected for array description and title #3191

Merged

Conversation

heath-freenome
Copy link
Member

@heath-freenome heath-freenome commented Oct 10, 2022

Reasons for making this change

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

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

…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
@@ -12,13 +12,24 @@ npm start

All packages will be live-built, and a live development server showcasing components with hot reload enabled will then run at [localhost:8080](http://localhost:8080).

### First time step

If this is the first time you have cloned the repo, run the `npm run prepare` script that will set up `husky` to provide a git precommit hook that will format and lint any code you have added to a PR.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepare should automatically run after install but I guess it doesn't hurt to have this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to in the lerna world 🤷🏼

@heath-freenome heath-freenome merged commit 06408a9 into rjsf-team:main Oct 10, 2022
@heath-freenome heath-freenome deleted the reimplement-2537-to-fix-2535 branch October 10, 2022 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants