Skip to content

Conversation

@a-b-r-o-w-n
Copy link
Contributor

Reasons for making this change

Fixes #1219. oneOf / anyOf will now use the SelectWidget to render the top control. This can be customized by the user.

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've run npm run cs-format on my branch to conform my code to prettier coding style
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

@a-b-r-o-w-n
Copy link
Contributor Author

I have 3 tests failing locally on master, as well as this branch. Also, I am curious if any other props need to be plumbed through to the select widget. It feels a little weird to provide a stubbed schema, but that may be ok for this use case. Just let me know if I can update anything.

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.

A stubbed schema seems fine, thanks!

You should probably pass in the props listed here, as well.

@epicfaace
Copy link
Member

A stubbed schema seems fine, thanks!

You should probably pass in the props listed here, as well.

In addition to the autofocus and placeholder attributes (see #1223 -- maybe we can get these attributes from the uiSchema entry of the oneOf once #1141 is resolved). For now, just add which attributes you are able to without needing the uiSchema.

* change schema type to number
* get uiOptions to pass to widget
@a-b-r-o-w-n
Copy link
Contributor Author

@epicfaace Let me know if we shouldn't just get the uiOptions now without #1141. It didn't appear to make a difference since the defaults are falsey.

@a-b-r-o-w-n
Copy link
Contributor Author

@epicfaace are you still waiting for changes?

@epicfaace
Copy link
Member

epicfaace commented Mar 27, 2019

@a-b-r-o-w-n sorry for the delay. Can you also add tests for oneOf & anyOf in which you actually define a SelectWidget in the widgets prop for the form?

@a-b-r-o-w-n
Copy link
Contributor Author

🤦‍♂️ I thought I already had. I'll update the specs

@epicfaace
Copy link
Member

Thanks!

@epicfaace epicfaace merged commit f8d0d45 into rjsf-team:master Apr 5, 2019
@mravenash
Copy link

Can anyone add an example on the play ground for this? It would be really helpful.
Regards
Avenash

@a-b-r-o-w-n a-b-r-o-w-n deleted the custom-oneof-widget branch April 17, 2019 15:12
@a-b-r-o-w-n
Copy link
Contributor Author

@mravenash I don't think the playground supports custom widgets since it is just json. Here is a codesandbox link that has an example though: https://codesandbox.io/embed/6wxv10mz2k

@mravenash
Copy link

mravenash commented Apr 18, 2019

It works, the fix was in 1.5, was using 1.4. Thanks Andy for quickly giving the sandbox example.!!

@katepma
Copy link

katepma commented Apr 23, 2019

Is there any way to remove the border that encapsulates the custom widgets? I see this css classname fieldset and its border-width is set to 2px. Is there any way to override it? Any inputs will be appreciated.
Regards
Mamta

@a-b-r-o-w-n
Copy link
Contributor Author

What I have done is to either provide a custom field template or just use css to modify the border:

.MyForm {
  fieldset {
    border: none;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow custom widget for oneOf / anyOf select

4 participants