|
|
@ -1,7 +1,5 @@
|
|
|
|
using Connected.Models;
|
|
|
|
using Connected.Models;
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Connected.Components;
|
|
|
|
namespace Connected.Components;
|
|
|
|
public partial class SimpleSelect<ValueType> : InputBase
|
|
|
|
public partial class SimpleSelect<ValueType> : InputBase
|
|
|
@ -31,6 +29,29 @@ 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)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//DropDownClassToggle();
|
|
|
|
|
|
|
|
await ValueChanged.InvokeAsync(item);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task FilterItems()
|
|
|
|
private async Task FilterItems()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(_searchText))
|
|
|
|
if (string.IsNullOrEmpty(_searchText))
|
|
|
@ -61,6 +82,7 @@ public partial class SimpleSelect<ValueType> : InputBase
|
|
|
|
if (base.InputAttributes.ContainsKey("required")) base.InputAttributes.Add("required", true);
|
|
|
|
if (base.InputAttributes.ContainsKey("required")) base.InputAttributes.Add("required", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OriginalItems = Items;
|
|
|
|
OriginalItems = Items;
|
|
|
|
|
|
|
|
if (_searchText.Length>0) await FilterItems();
|
|
|
|
await base.OnInitializedAsync();
|
|
|
|
await base.OnInitializedAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|