Checkbox - working example -- NumberInput,TextInput - InputAttributes initialization moved to InputBase class #8
@ -7,7 +7,6 @@
 | 
			
		||||
@if (Items is not null)
 | 
			
		||||
{
 | 
			
		||||
   <div class="@InputFieldClassList">
 | 
			
		||||
        
 | 
			
		||||
        <select type="textarea" style="height:0px;" @attributes=@InputAttributes>
 | 
			
		||||
            </select>
 | 
			
		||||
            @if (IsLabel)
 | 
			
		||||
@ -42,8 +41,7 @@
 | 
			
		||||
                        <input type="text"
 | 
			
		||||
                            placeholder="Enter search string..."
 | 
			
		||||
                            class="dropdown-item"
 | 
			
		||||
                            @bind-value="@SearchText"
 | 
			
		||||
                        />
 | 
			
		||||
                            @bind-value="@SearchText" />
 | 
			
		||||
                    }
 | 
			
		||||
                    @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)
 | 
			
		||||
	{
 | 
			
		||||
		//DropDownClassToggle();
 | 
			
		||||
		await ValueChanged.InvokeAsync(item);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private async Task FilterItems()
 | 
			
		||||
	private void FilterItems()
 | 
			
		||||
	{
 | 
			
		||||
		if (string.IsNullOrEmpty(_searchText))
 | 
			
		||||
		{
 | 
			
		||||
@ -78,7 +61,7 @@ public partial class SimpleSelect<ValueType> : InputBase
 | 
			
		||||
	{
 | 
			
		||||
		
 | 
			
		||||
		OriginalItems = Items;
 | 
			
		||||
		if (_searchText.Length>0) await FilterItems();
 | 
			
		||||
		if (_searchText.Length>0) FilterItems();
 | 
			
		||||
		await base.OnParametersSetAsync();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user