ant-design-blazor/components/input/InputGroup.razor.cs
Andrzej Bakun 2d693740c6 fix(module: input): fix & feat & docs & tests: Input general fixes (#1530)
* docs(module:input): api correction & comments

* fix(module:input): clear icon in sync with antD

* fix(module:input): add parameter bordered

* fix(module:textarea): add parameter ShowCounter

* fix(module:input): Focus with behaviors

* docs: add missing docs, rearrange order

* fix(module:search): update to match new standard look

doc(module:search): add API & demos

* fix(module:inputgroup): override style to remove whitespace\
docs: same as react

* fix(module:inputpassword): support custom icon
docs: same as react

* fix(module:input): add blur method
docs: add blur method

* fix(module:input): add readonly parameter

* tests

* fix

* fix(module:input): sequence correction

* Update components/core/Base/AntComponentBase.cs

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* review fixes

* fix: clean-up

* tests: fix missing mock

* fix: focus

* fix(module:input): bind clear button to _inputValue

* tests: clear button show/hide

* tests: package update

Co-authored-by: James Yeung <shunjiey@hotmail.com>
2021-05-27 18:13:26 +08:00

56 lines
1.5 KiB
C#

using System.Collections.Generic;
using Microsoft.AspNetCore.Components;
namespace AntDesign
{
public partial class InputGroup : AntDomComponentBase
{
protected const string PrefixCls = "ant-input-group";
private bool _compact;
private string _compactStyleOverride;
/// <summary>
/// Content wrapped by InputGroup.
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Whether use compact style
/// </summary>
[Parameter]
public bool Compact
{
get { return _compact; }
set
{
_compact = value;
if (_compact)
_compactStyleOverride = "display: flex;";
else
_compactStyleOverride = "";
}
}
/// <summary>
/// The size of InputGroup specifies the size of the included Input fields.
/// Available: large default small
/// </summary>
[Parameter]
public string Size { get; set; }
protected override void OnInitialized()
{
base.OnInitialized();
ClassMapper.Clear()
.Add(PrefixCls)
.If($"{PrefixCls}-lg", () => Size == InputSize.Large)
.If($"{PrefixCls}-sm", () => Size == InputSize.Small)
.If($"{PrefixCls}-compact", () => Compact)
.If($"{PrefixCls}-rtl", () => RTL);
}
}
}