-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add support for object arrays with separate text and value
#1669
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
- Add support for object arrays with separate `text` and `value` properties - Enable search functionality within both text and value fields - Maintain full backward compatibility with existing string arrays - Add helper functions: getOptionText(), getOptionValue(), getSearchableContent() - Update filtering logic to handle both string and object formats - Create comprehensive example (28_autocomplete_text_value_objects.html) - Bump version to 10.3.0
|
Thanks Ahmed for this PR, I'll look into it next week. |
|
@josdejong I hope you can merge it soon, as I'm working on a feature that depends on these changes. Please remember to update the TypeScript for the library as well |
|
I expect to be able to look into it coming Thursday or Friday. Updating the types will require a separate PR at DefinitelyTyped I think. |
josdejong
left a comment
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.
Thanks for your PR @ahmed-saber . It looks well taken care of!
I made a couple of inline comments, can you have a look at those?
Also, just as a reminder: we'll need to update the type definitions in definitelytyped/types/jsoneditor after this PR is merged and published.
feat: enhance autocomplete functionality with support for object arrays and multiple searchable fields
josdejong
left a comment
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.
Thanks for all the updates, I think the PR is almost ready to be finished. Can you have a look at the new inline comments?
josdejong
left a comment
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.
Thanks for your latest updates Ahmed. Here a few more comments.
Refactored autocomplete logic to better support searching across multiple fields and improved match highlighting in dropdowns and hints. Added consistent case normalization and enhanced hint display to prioritize matches that start with the search token for improved user experience.
3f6f6e2 to
425eb9a
Compare
664d88b to
8066595
Compare
|
Thanks for the updates @ahmed-saber! I tested the examples again, there is one odd issue: in example |
|
Similarly, in example |
Replaces manual case checks with a normalizeCase utility for consistent case sensitivity logic throughout the autocomplete component. This improves maintainability and ensures uniform behavior for filtering and hint generation.
|
I found the line was causing |
josdejong
left a comment
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.
Ah, now I understand what's going on: when the token matches halfway a value, the hintText cannot autocomplete the "rest" of the value because we're not at the start. Showing the dropdown in case of a single match too (rows.length < 2) makes sense 👍.
I think we can merge the PR now, thanks for all your work!
|
Published now in |
|
Please remember to update the version of the types as well |
I have no control over DefinitelyTyped/DefinitelyTyped#73377, we have to await until it is reviewed and merged. I guess you'll have to use |
textandvalueproperties