ant-design-blazor/components/input/TextArea.razor
Andrzej Bakun 6bc277c623 fix(module: textarea): add rows parameter (#1920)
doc: adjust to match antD
tests: sizing tests
2021-09-07 13:46:34 +08:00

61 lines
2.1 KiB
C#

@namespace AntDesign
@inherits Input<string>
@{
Dictionary<string, object> attributes =
new Dictionary<string, object>()
{
{ "onchange", CallbackFactory.Create(this, OnChangeAsync) },
{ "onblur", CallbackFactory.Create(this, OnBlurAsync) },
{ "oninput", CallbackFactory.Create(this, OnInputAsync) },
{ "onkeypress", CallbackFactory.Create(this, OnKeyPressAsync) },
{ "onkeyup", CallbackFactory.Create(this, OnKeyUpAsync) },
{ "onkeydown", CallbackFactory.Create(this, OnkeyDownAsync) },
{ "onfocus", CallbackFactory.Create(this, OnFocusAsync) },
{ "value", CurrentValueAsString },
{ "placeholder", Placeholder },
{ "id", Id },
{ "style", Style },
{ "class", ClassMapper.Class },
{ "disabled", Disabled },
{ "readonly", ReadOnly },
};
if (Attributes != null)
{
Attributes.Keys.ForEach(key => { attributes[key] = Attributes[key]; });
}
}
@if (ShowCount)
{
<div class="ant-input=textarea ant-input-textarea-show-count" data-count="@(Value?.Length ?? 0)">
@if (Suffix != null)
{
<span class="@_warpperClassMapper.Class">
<textarea @ref="Ref" @attributes="attributes" @onclick:stopPropagation="@StopPropagation" @onblur:stopPropagation="@StopPropagation"/>
@Suffix
</span>
}
else
{
<textarea @ref="Ref" @attributes="attributes" @onclick:stopPropagation="@StopPropagation" @onblur:stopPropagation="@StopPropagation"/>
}
<AntDesign.Text Style="float: right; pointer-events: none; white-space: nowrap; color: rgba(0, 0, 0, 0.45)">&nbsp;@($"/ {MaxLength}")</AntDesign.Text>
</div>
}
else
{
@if (Suffix != null)
{
<span class="@_warpperClassMapper.Class">
<textarea @ref="Ref" @attributes="attributes" @onclick:stopPropagation="@StopPropagation" @onblur:stopPropagation="@StopPropagation"/>
@Suffix
</span>
}
else
{
<textarea @ref="Ref" @attributes="attributes" @onclick:stopPropagation="@StopPropagation" @onblur:stopPropagation="@StopPropagation"/>
}
}