From c20602596d16e9c9e177b58d11dc8b0a5ce97770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikul=C3=A1=C5=A1=20Hobl=C3=ADk?= Date: Fri, 2 Sep 2022 18:36:44 +0200 Subject: [PATCH] [HxSearchBox] Keyboard navigation #348 --- .../HxSearchBoxDoc/HxSearchBox_Demo.razor | 17 ++-- .../Forms/SearchBox/HxSearchBox.razor | 26 +++++- .../Forms/SearchBox/HxSearchBox.razor.cs | 84 +++++++++++++++++++ .../Forms/SearchBox/HxSearchBox.razor.css | 4 + 4 files changed, 119 insertions(+), 12 deletions(-) diff --git a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxSearchBoxDoc/HxSearchBox_Demo.razor b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxSearchBoxDoc/HxSearchBox_Demo.razor index c8f9433f9..72958f395 100644 --- a/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxSearchBoxDoc/HxSearchBox_Demo.razor +++ b/Havit.Blazor.Components.Web.Bootstrap.Documentation/Pages/Components/HxSearchBoxDoc/HxSearchBox_Demo.razor @@ -28,11 +28,12 @@ private string textQuery; List 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 = "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 = "Tasks", Subtitle = "720", Icon = BootstrapIcon.ListTask } + }; private void OnItemSelected(SearchBoxItem item) { @@ -49,9 +50,9 @@ await Task.Delay(400); // imitate slower server API return new() - { - Data = Data.Where(i => i.Title.Contains(request.UserInput, StringComparison.OrdinalIgnoreCase)) - }; + { + Data = Data.Where(i => i.Title.Contains(request.UserInput, StringComparison.OrdinalIgnoreCase)) + }; } class SearchBoxItem diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor index fb1060c84..c54f13620 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor +++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/SearchBox/HxSearchBox.razor @@ -15,7 +15,7 @@
- + InputGroupEndTemplate="@InputGroupEndTemplate" />*@ + @if (InputGroupEndText is null && InputGroupEndTemplate is null) { @@ -66,7 +74,12 @@ IconBase icon = ItemIconSelector?.Invoke(item) ?? null;
  • -