@ -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 )
{
//DropDownClassToggle();
await ValueChanged . InvokeAsync ( item ) ;
}
private async Task FilterItems ( )
private void FilterItems ( )
{
if ( string . IsNullOrEmpty ( _searchText ) )
{
@ -76,13 +59,18 @@ public partial class SimpleSelect<ValueType> : InputBase
protected override async Task OnParametersSetAsync ( )
{
if ( base . InputAttributes is null ) base . InputAttributes = new ( ) ;
if ( base . Required )
{
if ( base . InputAttributes . ContainsKey ( "required" ) ) base . InputAttributes . Add ( "required" , true ) ;
}
OriginalItems = Items ;
if ( _searchText . Length > 0 ) await FilterItems ( ) ;
if ( _searchText . Length > 0 ) FilterItems ( ) ;
await base . OnParametersSetAsync ( ) ;
}
protected override async Task OnInitializedAsync ( )
{
await base . OnInitializedAsync ( ) ;
if ( Required )
{
if ( InputAttributes . ContainsKey ( "required" ) ) InputAttributes . Add ( "required" , true ) ;
}
}
}