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

feat: allow free input in AutoComplete #107

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

qrilka
Copy link
Contributor

@qrilka qrilka commented Feb 15, 2024

Hi @luoxiaozero here is my monkey-patched version of AutoComplete - I needed to support free input and not only selection from options.
Maybe this could be made into an option of AutoComplete, what do you think?

@qrilka qrilka force-pushed the auto_complete-allow-free-input branch 2 times, most recently from 60b6c42 to 3525b3c Compare February 16, 2024 09:50
@qrilka
Copy link
Contributor Author

qrilka commented Feb 20, 2024

@luoxiaozero any comments? I've also added "allow_free_input" as an option. So basically by default it almost work as a previous version. Probably the main difference is that the first option doesn't get selected by default and also options update clears up selection (the current component behaves confusingly in this respect in my opinion)

@luoxiaozero
Copy link
Collaborator

I think when allow_free_input is false, the previous behavior can be maintained (as long as the option is not empty, then select_option_index cannot be None)

@qrilka
Copy link
Contributor Author

qrilka commented Feb 20, 2024

What about dropping its value to 1 when options change? That could be done behind a different option if you wish.

@luoxiaozero
Copy link
Collaborator

When the option changes, allow_free_input is 1 if it is false and None if it is true.

@qrilka
Copy link
Contributor Author

qrilka commented Feb 20, 2024

Yes, like that, thanks

@qrilka qrilka force-pushed the auto_complete-allow-free-input branch 2 times, most recently from 0ad47e8 to 8298fa0 Compare February 21, 2024 07:01
@qrilka
Copy link
Contributor Author

qrilka commented Feb 21, 2024

I've also switched the option to just a boolean, not a signal. The source motivation was compile error about NotRawCallback but in principle it makes very little sense to make this option reactive.

@qrilka qrilka marked this pull request as ready for review February 21, 2024 07:03
@luoxiaozero
Copy link
Collaborator

Can you improve the documentation for the newly added fields? (demo_markdown/docs/auto_complete/mod.md)

@qrilka qrilka force-pushed the auto_complete-allow-free-input branch from 8298fa0 to 57a529b Compare February 21, 2024 18:17
@qrilka
Copy link
Contributor Author

qrilka commented Feb 21, 2024

Should be done now

@luoxiaozero
Copy link
Collaborator

Thanks!

@luoxiaozero luoxiaozero merged commit 1dbe00b into thaw-ui:main Feb 22, 2024
3 checks passed
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.

2 participants