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

Added Combobox #23

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Added Combobox #23

wants to merge 2 commits into from

Conversation

iamsadat
Copy link

@iamsadat iamsadat commented Aug 7, 2023

#21
Please let me know if there are any changes required

@iamsadat iamsadat changed the title #21 Fix: Added Combobox Added Combobox Aug 7, 2023
@vantezzen
Copy link
Owner

It looks like the combobox wasn't integrated into AutoForm? You just added a combobox for a string of users and replaced the API example with it?

@iamsadat
Copy link
Author

iamsadat commented Aug 7, 2023

This is not the final draft and I just wanted to make sure if the UI and model is okay for the projects. I still have to make amends and integrate the api results in the dropdown menu.
p.s. I'm actually new to Open Source and I'm still learning how things work so apologies if I'm doing things wrong

@vantezzen
Copy link
Owner

vantezzen commented Aug 7, 2023

No problem, let me know if you need anything!
Generally, you'll first need to create a "AutoFormCombobox" component in auto-form.tsx - you can probably copy the existing "AutoFormEnum" and edit it to use the combobox instead. For this, you'll probably need to copy the contents of your current "combobox.tsx" component and update it to be more generic (like "Select..." instead of "Select user...") because auto-form should be usable with all data.

Finally, you'll need to add your new AutoFormCombobox component to the "INPUT_COMPONENTS" object (https://github.com/vantezzen/auto-form/blob/e02d0de88b19a2edb60cfac2e27b72e15739eb5a/src/components/ui/auto-form.tsx#L463C7-L463C23) which is where the components are registered by adding combobox: AutoFormCombobox.

You should now be able to set fieldType: "combobox" for an enum in the fieldConfig. Its probably best if you create a new example component ideas of editing the Api example, just for the combobox.

I'll mark this PR as "draft" while you're working on it, just for overview.

@vantezzen vantezzen marked this pull request as draft August 7, 2023 15:49
@iamsadat
Copy link
Author

Thank you so much for the help! @vantezzen
I have made the following changes:

  1. Integrated the API with the combobox
  2. Added combobox to the INPUT_COMPONENTS
  3. Changed ZodEnum: "combobox" in DEFAULT_ZOD_HANDLERS (I'm guessing this might not be correct with its working for me)

Please let me know if any changes are required and thanks again for the help!!

@iamsadat iamsadat marked this pull request as ready for review August 15, 2023 18:39
@iamsadat iamsadat marked this pull request as draft August 15, 2023 18:41
@nikolaischunk
Copy link

looks promising! would love to see some updates! @iamsadat

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

Successfully merging this pull request may close these issues.

None yet

3 participants