diff --git a/Components/Components.csproj b/Components/Components.csproj index a2fe5ef..3dc3012 100644 --- a/Components/Components.csproj +++ b/Components/Components.csproj @@ -15,24 +15,24 @@ - + - - - + + + - + - - + + - + diff --git a/Components/Form/FormNumberComponent.razor b/Components/Form/FormNumberComponent.razor index 22c37a0..db68e1b 100644 --- a/Components/Form/FormNumberComponent.razor +++ b/Components/Form/FormNumberComponent.razor @@ -48,25 +48,25 @@ void OnInputChanged(ChangeEventArgs changeEventArgs) { - int valueWas = Value; - int newValue = int.Parse(changeEventArgs.Value!.ToString()!); - - if (newValue > Max) - { - newValue = Max; - } - - if (newValue < Min) - { - newValue = Min; - } + var valueWas = Value; + var newValue = int.Parse(changeEventArgs.Value!.ToString()!); - if (valueWas != newValue) - { - Value = newValue; - changeEventArgs.Value = newValue; - OnChange.InvokeAsync(changeEventArgs); - } + if (newValue > Max) + { + newValue = Max; + } + + if (newValue < Min) + { + newValue = Min; + } + + if (valueWas != newValue) + { + Value = newValue; + changeEventArgs.Value = newValue; + OnChange.InvokeAsync(changeEventArgs); + } } [Parameter] diff --git a/Components/Form/FormTextComponent.razor b/Components/Form/FormTextComponent.razor index ee64d2c..e222d11 100644 --- a/Components/Form/FormTextComponent.razor +++ b/Components/Form/FormTextComponent.razor @@ -11,7 +11,7 @@ placeholder="@Placeholder" type="text" value="@Value" - id="@labelId" + id="@Id" @oninput="OnChange" @onchange="OnChange"/> @@ -51,6 +51,9 @@ @code { + [Parameter] + public string Id { get; set; } = ""; + [Parameter] public string Label { get; set; } = ""; @@ -62,7 +65,7 @@ [Parameter] public EventCallback OnChange { get; set; } - + [Parameter] public bool ReadOnly { get; set; } diff --git a/Components/Inputs/SearchButtonComponent.razor b/Components/Inputs/SearchButtonComponent.razor index 5fb8f62..818ec9d 100644 --- a/Components/Inputs/SearchButtonComponent.razor +++ b/Components/Inputs/SearchButtonComponent.razor @@ -1,5 +1,4 @@ -@using System.Runtime.InteropServices -@inject ISearchService searchService +@inject ISearchService searchService @inject NavigationManager navigationManager @inject IJSRuntime jsRuntime @@ -7,13 +6,9 @@
Search...
- @if (false) - { -
- @CommandKey + K -
- - } +
+ @CommandKey + K +
- } @@ -125,12 +122,17 @@ searchService.Subscribe(OnSearchChanged); } + private System.Threading.Timer timer = null!; private void OnSearchChanged() { if (searchService.IsVisible) { - jsRuntime.InvokeVoidAsync("SetFocusToElement", "search-dialog-input"); - + timer = new System.Threading.Timer(_ => + { + jsRuntime.InvokeVoidAsync("SetFocusToElement", "search-input-box"); + InvokeAsync(StateHasChanged); + }, null, 1, 1); + } } @@ -149,15 +151,13 @@ { if (url.Contains("#")) { - - navigationManager.NavigateTo(url, - navigationManager.Uri.Split("#").First().Contains(url.Split("#").First())); + navigationManager.NavigateTo(url, + navigationManager.Uri.Split("#").First().Contains(url.Split("#").First())); } else { navigationManager.NavigateTo(url); } - } private void SearchChanged(ChangeEventArgs obj) diff --git a/IGP/IGP.csproj b/IGP/IGP.csproj index 4282b55..08991a4 100644 --- a/IGP/IGP.csproj +++ b/IGP/IGP.csproj @@ -20,10 +20,10 @@ - - - - + + + +