Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #351 from havit/feature/HxSearchBoxKeyboardNavigation
[HxSearchBox] [HxAutoauggest] [HxInputTags] Keyboard navigation #348
- Loading branch information
Showing
37 changed files
with
660 additions
and
357 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
54 changes: 54 additions & 0 deletions
54
...rap.Documentation/Pages/Components/HxSearchBoxDoc/HxSearchBox_Demo_DisableTextQuery.razor
This file contains 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,54 @@ | ||
<HxSearchBox DataProvider="ProvideSearchResults" | ||
TItem="SearchBoxItem" | ||
ItemTitleSelector="i => i.Title" | ||
ItemSubtitleSelector="i => i.Subtitle" | ||
ItemIconSelector="i => i.Icon" | ||
Placeholder="Search" | ||
AllowTextQuery="false" | ||
OnItemSelected="OnItemSelected"> | ||
<DefaultContentTemplate> | ||
<div class="p-2 text-muted">Search for Mouse, Table or Door...</div> | ||
</DefaultContentTemplate> | ||
<NotFoundTemplate> | ||
<div class="small py-2 px-3 text-muted"><HxIcon CssClass="me-2" Icon="BootstrapIcon.EmojiFrown"/>Sorry, I did not find that...</div> | ||
</NotFoundTemplate> | ||
</HxSearchBox> | ||
|
||
<p class="mt-3"> | ||
Last selected item: @selectedItem?.Title<br/> | ||
</p> | ||
|
||
@code { | ||
private SearchBoxItem selectedItem; | ||
|
||
List<SearchBoxItem> Data { get; set; } = new() | ||
{ | ||
new() { Title = "Table", Subtitle = "50 000", Icon = BootstrapIcon.Table }, | ||
new() { Title = "Mouse", Subtitle = "400", Icon = BootstrapIcon.Mouse }, | ||
new() { Title = "Door", Subtitle = "1000", Icon = BootstrapIcon.DoorClosed }, | ||
new() { Title = "Big table", Subtitle = "9 000", Icon = BootstrapIcon.Table }, | ||
new() { Title = "Small table", Subtitle = "7 200", Icon = BootstrapIcon.Table } | ||
}; | ||
|
||
private void OnItemSelected(SearchBoxItem item) | ||
{ | ||
selectedItem = item; | ||
} | ||
|
||
private async Task<SearchBoxDataProviderResult<SearchBoxItem>> ProvideSearchResults(SearchBoxDataProviderRequest request) | ||
{ | ||
await Task.Delay(400); // imitate slower server API | ||
return new() | ||
{ | ||
Data = Data.Where(i => i.Title.Contains(request.UserInput, StringComparison.OrdinalIgnoreCase)) | ||
}; | ||
} | ||
|
||
class SearchBoxItem | ||
{ | ||
public string Title { get; set; } | ||
public string Subtitle { get; set; } | ||
public BootstrapIcon Icon { get; set; } | ||
} | ||
} |
This file contains 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 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.