2020-08-26 22:37:08 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
|
|
|
|
|
|
namespace AntDesign
|
|
|
|
|
{
|
|
|
|
|
public class AutoCompleteInput<TValue> : Input<TValue>, IAutoCompleteInput
|
|
|
|
|
{
|
2021-08-08 18:58:16 +08:00
|
|
|
|
public AutoCompleteInput()
|
|
|
|
|
{
|
|
|
|
|
AutoComplete = false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-26 22:37:08 +08:00
|
|
|
|
[CascadingParameter]
|
2021-08-08 18:58:16 +08:00
|
|
|
|
public IAutoCompleteRef Component { get; set; }
|
2020-08-26 22:37:08 +08:00
|
|
|
|
|
2021-01-21 17:20:10 +08:00
|
|
|
|
[CascadingParameter(Name = "OverlayTriggerContext")]
|
|
|
|
|
public ForwardRef OverlayTriggerContext
|
|
|
|
|
{
|
|
|
|
|
get { return RefBack; }
|
|
|
|
|
set { RefBack = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-26 22:37:08 +08:00
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
|
2021-08-08 18:58:16 +08:00
|
|
|
|
if (Component != null) Component?.SetInputComponent(this);
|
2020-08-26 22:37:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal override async Task OnFocusAsync(FocusEventArgs e)
|
|
|
|
|
{
|
2021-08-08 18:58:16 +08:00
|
|
|
|
if (Component != null) await Component?.InputFocus(e);
|
2020-08-26 22:37:08 +08:00
|
|
|
|
|
|
|
|
|
await base.OnFocusAsync(e);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override async Task OnkeyDownAsync(KeyboardEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
await base.OnkeyDownAsync(args);
|
|
|
|
|
|
2021-08-08 18:58:16 +08:00
|
|
|
|
if (Component != null) await Component?.InputKeyDown(args);
|
2020-08-26 22:37:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override async void OnInputAsync(ChangeEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
base.OnInputAsync(args);
|
|
|
|
|
|
2021-08-08 18:58:16 +08:00
|
|
|
|
if (Component != null) await Component?.InputInput(args);
|
2020-08-26 22:37:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region IAutoCompleteInput
|
|
|
|
|
|
|
|
|
|
public void SetValue(object value)
|
|
|
|
|
{
|
|
|
|
|
this.CurrentValue = (TValue)value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|