2020-04-23 17:13:56 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
2020-03-23 09:31:08 +08:00
|
|
|
|
|
2020-05-29 00:33:49 +08:00
|
|
|
|
namespace AntDesign
|
2020-03-23 09:31:08 +08:00
|
|
|
|
{
|
2020-05-20 12:57:16 +08:00
|
|
|
|
public partial class InputGroup : AntDomComponentBase
|
2020-03-23 09:31:08 +08:00
|
|
|
|
{
|
|
|
|
|
protected const string PrefixCls = "ant-input-group";
|
2021-05-27 18:13:26 +08:00
|
|
|
|
private bool _compact;
|
|
|
|
|
private string _compactStyleOverride;
|
2020-03-23 09:31:08 +08:00
|
|
|
|
|
2021-05-27 18:13:26 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Content wrapped by InputGroup.
|
|
|
|
|
/// </summary>
|
2020-03-23 09:31:08 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
|
|
2021-05-27 18:13:26 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether use compact style
|
|
|
|
|
/// </summary>
|
2020-03-23 09:31:08 +08:00
|
|
|
|
[Parameter]
|
2021-05-27 18:13:26 +08:00
|
|
|
|
public bool Compact
|
|
|
|
|
{
|
|
|
|
|
get { return _compact; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_compact = value;
|
|
|
|
|
if (_compact)
|
|
|
|
|
_compactStyleOverride = "display: flex;";
|
|
|
|
|
else
|
|
|
|
|
_compactStyleOverride = "";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-23 17:13:56 +08:00
|
|
|
|
|
2021-05-27 18:13:26 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The size of InputGroup specifies the size of the included Input fields.
|
|
|
|
|
/// Available: large default small
|
|
|
|
|
/// </summary>
|
2020-05-29 12:55:15 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public string Size { get; set; }
|
2020-03-23 09:31:08 +08:00
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
|
|
|
|
|
ClassMapper.Clear()
|
|
|
|
|
.Add(PrefixCls)
|
2020-05-20 12:57:16 +08:00
|
|
|
|
.If($"{PrefixCls}-lg", () => Size == InputSize.Large)
|
|
|
|
|
.If($"{PrefixCls}-sm", () => Size == InputSize.Small)
|
2021-03-12 17:02:11 +08:00
|
|
|
|
.If($"{PrefixCls}-compact", () => Compact)
|
|
|
|
|
.If($"{PrefixCls}-rtl", () => RTL);
|
2020-03-23 09:31:08 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|