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

Render a select widget for arrays if specified in the ui schema #2125

Closed
wants to merge 1 commit into from

Conversation

sradevski
Copy link

Reasons for making this change

Currently it is impossible to render a multiselect for an array that doesn't have an enum. This is useful when the array is open-ended and can contain any strings provided in a multiselect input. It also makes it more consistent as a behavior when compared with how it is decided whether it is a files widget or not.

Related tickets:
#1196
#774
#939
#1645
#1570
#1385

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

Copy link
Member

@epicfaace epicfaace left a comment

Choose a reason for hiding this comment

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

thanks -- can you add a test to Forms_test that tests this behavior as well?

@@ -528,7 +529,10 @@ export function isSelect(_schema, rootSchema = {}) {
return false;
}

export function isMultiSelect(schema, rootSchema = {}) {
export function isMultiSelect(schema, uiSchema, rootSchema = {}) {

Choose a reason for hiding this comment

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

Why are we restricting this to only use the "select" widget? Can we remove that restriction and leave it up to the user. The reason being, it could be possible, that the customWidget for select handles only single select and one could have a separate widget for multi select.

@heath-freenome heath-freenome added the v5 refactor Needs refactor due to v5 breaking changes label Aug 29, 2022
@heath-freenome
Copy link
Member

@sradevski Sorry for the long delay in getting to the PR... Unfortunately, the v5 beta refactored the utils.js file into its own @rjsf/utils package, converted the core package to Typescript. On the plus side, the changes made in other themes beside core are now unnecessary as the ArrayFieldTemplates were simplified so only the change in core needs to happen. Are you able to update the v5 beta with these changes?

@heath-freenome
Copy link
Member

I believe that #2697 actually fixes this issue more elegantly and more broadly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes v5 refactor Needs refactor due to v5 breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants