-
Notifications
You must be signed in to change notification settings - Fork 510
Adapt RemoteSearchDropdown to a multipurpose SearchDropdown #6177
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
Conversation
indico/web/forms/jinja_helpers.py
Outdated
| if isinstance(field.widget, TypeaheadWidget): | ||
| return True | ||
| if isinstance(field.widget, Select): | ||
| if isinstance(field.widget, (DropdownWidget, Select)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is correct? We use Select here because it becomes bigger in multiple mode. But the SUI Dropdown has the same size regardless of whether it's for a single value or multiple values. So I think it should stay above in the return True case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
462e9c9 to
da2a9f5
Compare
| fetchData(); | ||
| } | ||
| }, [preload, fetchData]); | ||
| }, [preload, fetchData, optionsFromProps, transformOptions]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI this only works because the component is used in a kind of special way, and optionsFromProps is always the same object (not just the same data in the object). Otherwise this would cause a render loop, since e.g. {} != {}. But since this is always populated from a statically defined object, it works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh okay, got it! Good to understand more the intricacies of JS
2e09b14 to
823c05a
Compare
|
@SegiNyn Please have a look at the display issue from my previous comment, and look over my other comments and the fixes I made. I think if you don't spot any problems with them and fix the display problem, we can merge this. |
|
I tested with the diff shared by @ThiefMaster and found a couple of corner cases. When
With
|
|
Hi @ThiefMaster,
|
|
Maybe you might have a different opinion on what to do with the highlighting, but what I've done is to disable the highlight when allowAdditions is True |
|
Okay let me see if I can tweak it some more. |
This broke typing something in the field after adding a custom item
b7d6d6c to
6442b0a
Compare
|
Thanks! FYI I just pushed the latest rebased version (no changes besides rebasing) |
|
@ThiefMaster, I've removed the space below so it looks like this. But about the highlighting, do you think there is something else we can do in the filtering options that would allow the search to still be highlighted but not treated as a different entry when allowadditions is enabled? |
indico/web/client/js/react/components/WTFSearchDropdown.module.scss
Outdated
Show resolved
Hide resolved
| // LICENSE file for more details. | ||
|
|
||
| :global(.ui.multiple.search.dropdown) :global(input[type='text'].search) { | ||
| margin: 0em 0.64285714em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| margin: 0em 0.64285714em; | |
| margin: 0 0.64285714em; |
0 usually needs no unit
TBH I'm not really worried about not having the highlighting there. So if someone later wants to improve this fine, but it's not something I'll spend time on for now ;) |







This Pr adds some more options to the RemoteDropdown widget.