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

Allow replacing hard coded fields & widgets through the registry #310

Closed
olzraiti opened this issue Aug 30, 2016 · 3 comments
Closed

Allow replacing hard coded fields & widgets through the registry #310

olzraiti opened this issue Aug 30, 2016 · 3 comments

Comments

@olzraiti
Copy link
Contributor

olzraiti commented Aug 30, 2016

I'd like to change every checkbox to some switch component. To achieve this, I'd have to provide a custom SchemaField to the form, which would be identical to the default SchemaField with the addition, that I'd have to import StringField from a custom StringField. That StringField would be identical the default StringField with the addition, that I'd have to import BooleanField from a custom BooleanField. That BooleanField would be identical to the default BooleanField with the addition, that I'd have to import CheckboxWidget from a custom CheckboxWidget. And finally, I could replace the checkbox with a switch component.

The other option would be to create a custom widget, and point every checkbox in uiSchema to use that custom component. But that wouldn't be a global solution.

What if I could just give the Form a custom CheckboxWidget in Form's widgets-property, and BooleanField would import the CheckboxWidget from the registry? It would be way simpler and I could drop like 1000 lines of copy pasted code.

SchemaField, DescriptionField and TitleField can already be overridden through the registry. Maybe we should allow overriding every field/widget and always import from the registry?

tl;dr All hard coded field/widget components should import field/widget components from the registry. All fields/widgets should be possible to override through Form's widgets and fields properties.

@olzraiti olzraiti changed the title Allow importing hard coded fields & widgets from the registry Allow replacing hard coded fields & widgets through the registry Aug 30, 2016
@olzraiti
Copy link
Contributor Author

I have an implementation for this in my personal fork. I could create a pull request if approved.

(I have also suggested #205 and mentioned that I could implement it, but I'd personally give this one higher priority.)

@AMongeEntytle
Copy link

+1 to this. I though this was something that should be really easy to implement (not only for widgets but also for fields), much more taking into account how amazing and configurable the library is ... so please let us know if your request is accepted !

@olzraiti
Copy link
Contributor Author

olzraiti commented Nov 9, 2016

Closed by #371

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

No branches or pull requests

2 participants