SimpleSelect - code cleanup (removed unnecessary blank space, removed unused private methods)

features/rewrite/toggleinput
markosteger 2 years ago committed by Gitea
parent d688b25589
commit 7c60aefe31

@ -7,7 +7,6 @@
@if (Items is not null) @if (Items is not null)
{ {
<div class="@InputFieldClassList"> <div class="@InputFieldClassList">
<select type="textarea" style="height:0px;" @attributes=@InputAttributes> <select type="textarea" style="height:0px;" @attributes=@InputAttributes>
</select> </select>
@if (IsLabel) @if (IsLabel)
@ -42,8 +41,7 @@
<input type="text" <input type="text"
placeholder="Enter search string..." placeholder="Enter search string..."
class="dropdown-item" class="dropdown-item"
@bind-value="@SearchText" @bind-value="@SearchText" />
/>
} }
@foreach (ValueType item in Items) @foreach (ValueType item in Items)
{ {

@ -29,30 +29,13 @@ public partial class SimpleSelect<ValueType> : 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) private async Task SetSelectedItem(ValueType item)
{ {
//DropDownClassToggle(); //DropDownClassToggle();
await ValueChanged.InvokeAsync(item); await ValueChanged.InvokeAsync(item);
} }
private async Task FilterItems() private void FilterItems()
{ {
if (string.IsNullOrEmpty(_searchText)) if (string.IsNullOrEmpty(_searchText))
{ {
@ -78,7 +61,7 @@ public partial class SimpleSelect<ValueType> : InputBase
{ {
OriginalItems = Items; OriginalItems = Items;
if (_searchText.Length>0) await FilterItems(); if (_searchText.Length>0) FilterItems();
await base.OnParametersSetAsync(); await base.OnParametersSetAsync();
} }

Loading…
Cancel
Save