namespace WebSite.Docus.Inputs.Inputs;
class Input1 : BaseComponent
{
private Input? input;
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.Component<FieldControl>()
.Set(c => c.OnVisibleChanged, OnVisibleChanged)
.Set(c => c.OnEnabledChanged, OnEnabledChanged)
.Set(c => c.OnReadOnlyChanged, OnReadOnlyChanged)
.Set(c => c.SetValue, SetValue)
.Set(c => c.GetValue, GetValue)
.Build();
builder.Field<Input>("颜色:", "Color")
.Set(f => f.Type, InputType.Color)
.Build(value => input = value);
}
private void OnVisibleChanged(bool value) => input?.SetVisible(value);
private void OnEnabledChanged(bool value) => input?.SetEnabled(value);
private void OnReadOnlyChanged(bool value) => input?.SetReadOnly(value);
private void SetValue() => input?.SetValue("#009688");
private string? GetValue() => input?.Value;
}
namespace WebSite.Docus.Inputs.Inputs;
class Input2 : BaseComponent
{
private Input? input;
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.Component<FieldControl>()
.Set(c => c.OnVisibleChanged, OnVisibleChanged)
.Set(c => c.OnEnabledChanged, OnEnabledChanged)
.Set(c => c.OnReadOnlyChanged, OnReadOnlyChanged)
.Set(c => c.SetValue, SetValue)
.Set(c => c.GetValue, GetValue)
.Build();
builder.Field<Input>("邮箱:", "Email")
.Set(f => f.Type, InputType.Email)
.Build(value => input = value);
}
private void OnVisibleChanged(bool value) => input?.SetVisible(value);
private void OnEnabledChanged(bool value) => input?.SetEnabled(value);
private void OnReadOnlyChanged(bool value) => input?.SetReadOnly(value);
private void SetValue() => input?.SetValue("test123@test.com");
private string? GetValue() => input?.Value;
}
namespace WebSite.Docus.Inputs.Inputs;
class Input3 : BaseComponent
{
private Input? input;
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.Component<FieldControl>()
.Set(c => c.OnVisibleChanged, OnVisibleChanged)
.Set(c => c.OnEnabledChanged, OnEnabledChanged)
.Set(c => c.OnReadOnlyChanged, OnReadOnlyChanged)
.Set(c => c.SetValue, SetValue)
.Set(c => c.GetValue, GetValue)
.Build();
builder.Field<Input>("Slider:", "Range")
.Set(f => f.Type, InputType.Range)
.Build(value => input = value);
}
private void OnVisibleChanged(bool value) => input?.SetVisible(value);
private void OnEnabledChanged(bool value) => input?.SetEnabled(value);
private void OnReadOnlyChanged(bool value) => input?.SetReadOnly(value);
private void SetValue() => input?.SetValue(30);
private string? GetValue() => input?.Value;
}
namespace WebSite.Docus.Inputs.Inputs;
class Input4 : BaseComponent
{
private Input? input;
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.Component<FieldControl>()
.Set(c => c.OnVisibleChanged, OnVisibleChanged)
.Set(c => c.OnEnabledChanged, OnEnabledChanged)
.Set(c => c.OnReadOnlyChanged, OnReadOnlyChanged)
.Set(c => c.SetValue, SetValue)
.Set(c => c.GetValue, GetValue)
.Build();
builder.Field<Input>("搜索:", "Search")
.Set(f => f.Type, InputType.Search)
.Build(value => input = value);
}
private void OnVisibleChanged(bool value) => input?.SetVisible(value);
private void OnEnabledChanged(bool value) => input?.SetEnabled(value);
private void OnReadOnlyChanged(bool value) => input?.SetReadOnly(value);
private void SetValue() => input?.SetValue("test");
private string? GetValue() => input?.Value;
}
namespace WebSite.Docus.Inputs.Inputs;
class Input5 : BaseComponent
{
private Input? input;
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.Component<FieldControl>()
.Set(c => c.OnVisibleChanged, OnVisibleChanged)
.Set(c => c.OnEnabledChanged, OnEnabledChanged)
.Set(c => c.OnReadOnlyChanged, OnReadOnlyChanged)
.Set(c => c.SetValue, SetValue)
.Set(c => c.GetValue, GetValue)
.Build();
builder.Field<Input>("电话:", "Tel")
.Set(f => f.Type, InputType.Tel)
.Build(value => input = value);
}
private void OnVisibleChanged(bool value) => input?.SetVisible(value);
private void OnEnabledChanged(bool value) => input?.SetEnabled(value);
private void OnReadOnlyChanged(bool value) => input?.SetReadOnly(value);
private void SetValue() => input?.SetValue("1234567890");
private string? GetValue() => input?.Value;
}
namespace WebSite.Docus.Inputs.Inputs;
class Input6 : BaseComponent
{
private Input? input;
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.Component<FieldControl>()
.Set(c => c.OnVisibleChanged, OnVisibleChanged)
.Set(c => c.OnEnabledChanged, OnEnabledChanged)
.Set(c => c.OnReadOnlyChanged, OnReadOnlyChanged)
.Set(c => c.SetValue, SetValue)
.Set(c => c.GetValue, GetValue)
.Build();
builder.Field<Input>("网址:", "Url")
.Set(f => f.Type, InputType.Url)
.Build(value => input = value);
}
private void OnVisibleChanged(bool value) => input?.SetVisible(value);
private void OnEnabledChanged(bool value) => input?.SetEnabled(value);
private void OnReadOnlyChanged(bool value) => input?.SetReadOnly(value);
private void SetValue() => input?.SetValue("http://www.test.com");
private string? GetValue() => input?.Value;
}