-
Notifications
You must be signed in to change notification settings - Fork 460
[AutoComplete] Enable "Multiple = false" when selecting a single item is desired #3571
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
Merged
vnbaaij
merged 27 commits into
microsoft:dev
from
StevenRasmussen:auto-complete-single-item-enhancements
Apr 22, 2025
Merged
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3288027
Autocomplete working with single item selected.
StevenRasmussen 2ad0c86
Added a unit test and updated the results of the failing unit tests d…
StevenRasmussen f3c4199
Fixed whitespace issues.
StevenRasmussen 5b0f2f2
Updates to demo page.
StevenRasmussen f9fdad0
Revert changes to class names so that it won't break anyone that is d…
StevenRasmussen 5b2dfa4
Revert change to css.
StevenRasmussen f398a40
Accessibility changes.
StevenRasmussen 1d01ba0
Updated to use a new attribute instead of a new class.
StevenRasmussen b3df6a2
Fix unit tests.
StevenRasmussen aee8b20
Fix whitespace change.
StevenRasmussen 2e2c523
Reverted test files to remove noise from PR.
StevenRasmussen 3645b30
Fixed an issue with really long text
StevenRasmussen 2144040
Merge branch 'dev' into auto-complete-single-item-enhancements
StevenRasmussen cf780ac
Improve performance of line of code.
StevenRasmussen fa6034c
Removed the usage of addiing to the 'AdditionalAttributes' in favor o…
StevenRasmussen 0b8509d
Added the tab stop for accessibility.
StevenRasmussen 4b0d6c0
Fixed broken unit test after adding in the tabindex property.
StevenRasmussen 629aafd
Update the subgrid to handle N:N relationships.
StevenRasmussen 6fe88c1
Merge branch 'dev' into auto-complete-single-item-enhancements
StevenRasmussen 9a92440
Merge branch 'dev' into auto-complete-single-item-enhancements
dvoituron d4d6b24
Merge branch 'auto-complete-single-item-enhancements' of https://gith…
StevenRasmussen 0016c0f
Merge branch 'dev' into auto-complete-single-item-enhancements
StevenRasmussen 8026280
Merge dev into auto-complete-single-item-enhancements
StevenRasmussen 499affa
Multiple = false working.
StevenRasmussen 6b5d808
Fixed unit tests. Removed unnecessary unit test.
StevenRasmussen 3e3c8c0
Fixed code standards. Guarded against a null property.
StevenRasmussen ee83fc9
Merge branch 'dev' into auto-complete-single-item-enhancements
vnbaaij File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
examples/Demo/Shared/Pages/List/Autocomplete/Examples/AutoCompleteMaxSingleItem.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| @inject DataSource Data | ||
|
|
||
| <FluentAutocomplete TOption="Country" | ||
| AutoComplete="off" | ||
| Autofocus="true" | ||
| Label="Select a country" | ||
| Width="250px" | ||
| Placeholder="Select a country" | ||
| OnOptionsSearch="@OnSearchAsync" | ||
| OptionDisabled="@(e => e.Code == "au")" | ||
| MaximumSelectedOptions="1" | ||
| OptionText="@(item => item.Name)" | ||
| @bind-SelectedOptions="@SelectedItems" /> | ||
|
|
||
| <p> | ||
| <b>Selected</b>: @(String.Join(" - ", SelectedItems.Select(i => i.Name))) | ||
| </p> | ||
|
|
||
| @code | ||
| { | ||
| IEnumerable<Country> SelectedItems = Array.Empty<Country>(); | ||
|
|
||
| private async Task OnSearchAsync(OptionsSearchEventArgs<Country> e) | ||
| { | ||
| var allCountries = await Data.GetCountriesAsync(); | ||
| e.Items = allCountries.Where(i => i.Name.StartsWith(e.Text, StringComparison.OrdinalIgnoreCase)) | ||
| .OrderBy(i => i.Name); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...FluentAutocompleteTests.FluentAutocomplete_MaxSelectedOptionsEqualTo1.verified.razor.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
|
|
||
| <div class=" fluent-autocomplete-multiselect item-selected" style="width: 100%;" b-hg72r5b4ox=""> | ||
| <fluent-text-field style="width: 100%; min-width: 100%;" placeholder="" id="xxx" value="" current-value="" appearance="outline" blazor:onchange="1" role="combobox" aria-expanded="false" aria-controls="" aria-label="Selected 1-Denis Voituron" blazor:onclick="2" blazor:oninput="3" blazor:elementreference="xxx"> | ||
| <fluent-horizontal-scroll id="xxx" style="width: 100%;" slot="start" b-hg72r5b4ox=""> | ||
| <fluent-flipper onclick="event.stopPropagation(); document.getElementById('myComponent-scroll').scrollToPrevious();" slot="previous-flipper" aria-hidden="false" aria-label="Previous" title="Previous" role="button" tabindex="0" class="previous fluent-autocomplete-previous" direction="previous" b-hg72r5b4ox=""></fluent-flipper> | ||
| <fluent-flipper onclick="event.stopPropagation(); document.getElementById('myComponent-scroll').scrollToNext();" slot="next-flipper" aria-hidden="false" aria-label="Next" title="Next" role="button" tabindex="0" class="next fluent-autocomplete-next" direction="next" b-hg72r5b4ox=""></fluent-flipper> | ||
| <fluent-badge id="xxx" appearance="neutral" blazor:onclick="4" aria-label="1-Denis Voituron" blazor:elementreference="xxx"> | ||
| <span style="width: 100%; display: flex; align-items: center; justify-content: center; white-space: nowrap;">1-Denis Voituron<svg style="width: 12px; fill: var(--accent-fill-rest); cursor: pointer; margin: 2px 0px 0px 2px;" focusable="true" tabindex="0" role="button" viewBox="0 0 24 24" blazor:onkeydown="8" blazor:onclick="9"> | ||
| <title>Remove 1-Denis Voituron</title> | ||
| <path d="m4.4 4.55.07-.08a.75.75 0 0 1 .98-.07l.08.07L12 10.94l6.47-6.47a.75.75 0 1 1 1.06 1.06L13.06 12l6.47 6.47c.27.27.3.68.07.98l-.07.08a.75.75 0 0 1-.98.07l-.08-.07L12 13.06l-6.47 6.47a.75.75 0 0 1-1.06-1.06L10.94 12 4.47 5.53a.75.75 0 0 1-.07-.98l.07-.08-.07.08Z"></path> | ||
| </svg> | ||
| </span> | ||
| </fluent-badge> | ||
| </fluent-horizontal-scroll> | ||
| <svg slot="end" style="width: 12px; fill: var(--accent-fill-rest); cursor: pointer;" focusable="true" tabindex="0" role="button" viewBox="0 0 16 16" blazor:onkeydown="5" blazor:onclick="6" blazor:onfocus="7"> | ||
| <title>Clear</title> | ||
| <path d="m2.59 2.72.06-.07a.5.5 0 0 1 .63-.06l.07.06L8 7.29l4.65-4.64a.5.5 0 0 1 .7.7L8.71 8l4.64 4.65c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L8 8.71l-4.65 4.64a.5.5 0 0 1-.7-.7L7.29 8 2.65 3.35a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"></path> | ||
| </svg> | ||
| </fluent-text-field> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,4 +18,4 @@ | |
| </div> | ||
| </div> | ||
| </fluent-anchored-region> | ||
| </div> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,4 +26,4 @@ | |
| <footer>3 items found</footer> | ||
| </div> | ||
| </fluent-anchored-region> | ||
| </div> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.