diff --git a/src/Connected.Components/Components/SimpleSelect.razor b/src/Connected.Components/Components/SimpleSelect.razor index 2d895a7..ec9c163 100644 --- a/src/Connected.Components/Components/SimpleSelect.razor +++ b/src/Connected.Components/Components/SimpleSelect.razor @@ -6,20 +6,53 @@ @if (Items is not null) { -
- @if (EnableSearch) - { - - } - + + @if (IsLabel) { - @if (item is not null) + + } + + + + + + @if (Clearable) { - + + + } - } - -
+ + + + @if (IsError) + { + + + + } + + + } \ No newline at end of file diff --git a/src/Connected.Components/Components/SimpleSelect.razor.cs b/src/Connected.Components/Components/SimpleSelect.razor.cs index d94a841..2baadb7 100644 --- a/src/Connected.Components/Components/SimpleSelect.razor.cs +++ b/src/Connected.Components/Components/SimpleSelect.razor.cs @@ -1,7 +1,5 @@ using Connected.Models; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; -using System; namespace Connected.Components; public partial class SimpleSelect : InputBase @@ -31,6 +29,29 @@ public partial class SimpleSelect : InputBase } } + private string DropDownClass { get; set; } = "drop-down"; + + bool DropDownClicked = false; + + public void DropDownClassToggle() + { + DropDownClicked = !DropDownClicked; + if (DropDownClicked) + { + DropDownClass = ""; + } else + { + DropDownClass = "drop-down"; + } + StateHasChanged(); + } + + private async Task SetSelectedItem(ValueType item) + { + //DropDownClassToggle(); + await ValueChanged.InvokeAsync(item); + } + private async Task FilterItems() { if (string.IsNullOrEmpty(_searchText)) @@ -61,6 +82,7 @@ public partial class SimpleSelect : InputBase if (base.InputAttributes.ContainsKey("required")) base.InputAttributes.Add("required", true); } OriginalItems = Items; + if (_searchText.Length>0) await FilterItems(); await base.OnInitializedAsync(); } } \ No newline at end of file