Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

auto-form - custom component example #353

Open
gashcrumb opened this issue May 24, 2019 · 3 comments
Open

auto-form - custom component example #353

gashcrumb opened this issue May 24, 2019 · 3 comments

Comments

@gashcrumb
Copy link
Collaborator

gashcrumb commented May 24, 2019

This is a...


[x] Feature request
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Documentation issue or request

Description

I'd like to have some kind of custom component example for auto-form that doesn't actually live in the auto-form package. Mostly as advertising that it's a thing that can be done :-)

I think ideally a custom auto-form component would live in the syndesis package, however I did find when I started to create one that the problem is we don't want to have pf3 FormGroup and other related components being imported into syndesis. So maybe the ui package is a better place to keep custom form components? That'd mean making auto-form a dependency of the ui, unless I extract out the auto-form interfaces and types into a separate package.

@riccardo-forina thoughts?

@gashcrumb
Copy link
Collaborator Author

gashcrumb commented May 24, 2019

Basically a custom form component is just UI component that uses the field.onChange, field.onBlur or form.setFieldValue props passed in by Formik to update the property value when appropriate. Technically I'd call the "duration" control an example of a custom component really but I already baked it into auto-form.

@riccardo-forina
Copy link
Collaborator

riccardo-forina commented May 29, 2019

maybe a @syndesis/autoform-widgets? It could depend on PF directly, bypassing the UI (which should contain stuff app specific anyway).

@gashcrumb
Copy link
Collaborator Author

Yeah maybe like @syndesis/autoform-pf3, @syndesis/autoform-pf4 I guess perhaps would be handy at migration time certainly.

My other thought was perhaps this map could be passed in externally via a prop, then the app can basically just tell autoform exactly what widget to use. Could even do it via overriding things in that customComponents prop.

If we think #160 would be super-helpful we might wind up kinda having to do a similar thing as part of supporting that component, or just not make it part of auto-form and instead make it part of the app.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants