2020-05-29 00:33:49 +08:00
|
|
|
|
@namespace AntDesign.Internal
|
2020-04-28 15:56:56 +08:00
|
|
|
|
@inherits AntDomComponentBase
|
|
|
|
|
|
2020-07-06 19:09:01 +08:00
|
|
|
|
@if (!IsRange)
|
|
|
|
|
{
|
|
|
|
|
<div class="@(PrefixCls)-input">
|
|
|
|
|
<input @ref="Ref"
|
|
|
|
|
@onclick="OnClick"
|
2021-02-20 17:54:12 +08:00
|
|
|
|
@onkeyup="OnKeyUp"
|
|
|
|
|
@oninput="OnInput"
|
|
|
|
|
@onfocus="Onfocus"
|
2020-07-06 19:09:01 +08:00
|
|
|
|
@bind-value="@Value"
|
|
|
|
|
disabled="@Disabled"
|
|
|
|
|
placeholder="@Placeholder"
|
|
|
|
|
readonly="@ReadOnly">
|
|
|
|
|
@if (ShowSuffixIcon)
|
|
|
|
|
{
|
|
|
|
|
@if (ShowClear())
|
|
|
|
|
{
|
|
|
|
|
<span class="@(PrefixCls)-clear" onclick="@OnClickClear">
|
|
|
|
|
<Icon type="close-circle" theme="fill"/>
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
<span class="@(PrefixCls)-suffix">
|
|
|
|
|
|
|
|
|
|
@if (SuffixIcon != null)
|
|
|
|
|
{
|
|
|
|
|
@SuffixIcon
|
|
|
|
|
}
|
|
|
|
|
else if (ShowTime)
|
|
|
|
|
{
|
|
|
|
|
<Icon type="clock-circle"/>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<Icon type="calendar"/>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div class="@(PrefixCls)-input">
|
|
|
|
|
<input @ref="Ref"
|
|
|
|
|
@onclick="OnClick"
|
2021-02-20 17:54:12 +08:00
|
|
|
|
@onkeyup="OnKeyUp"
|
|
|
|
|
@oninput="OnInput"
|
|
|
|
|
@onfocus="Onfocus"
|
2020-07-06 19:09:01 +08:00
|
|
|
|
@bind-value="@Value"
|
|
|
|
|
disabled="@Disabled"
|
|
|
|
|
placeholder="@Placeholder"
|
|
|
|
|
readonly="@ReadOnly">
|
|
|
|
|
</div>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
@if (ShowSuffixIcon)
|
|
|
|
|
{
|
2020-07-06 19:09:01 +08:00
|
|
|
|
@if (ShowClear())
|
|
|
|
|
{
|
|
|
|
|
<span class="@(PrefixCls)-clear" onclick="@OnClickClear">
|
|
|
|
|
<Icon type="close-circle" theme="fill"/>
|
|
|
|
|
</span>
|
|
|
|
|
}
|
2020-04-28 15:56:56 +08:00
|
|
|
|
<span class="@(PrefixCls)-suffix">
|
|
|
|
|
|
|
|
|
|
@if (SuffixIcon != null)
|
|
|
|
|
{
|
|
|
|
|
@SuffixIcon
|
|
|
|
|
}
|
|
|
|
|
else if (ShowTime)
|
|
|
|
|
{
|
2020-07-06 19:09:01 +08:00
|
|
|
|
<Icon type="clock-circle"/>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-07-06 19:09:01 +08:00
|
|
|
|
<Icon type="calendar"/>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
}
|
2020-07-06 19:09:01 +08:00
|
|
|
|
|
|
|
|
|
}
|
2020-04-28 15:56:56 +08:00
|
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string PrefixCls { get; set; } = "ant-picker";
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string Size { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string Value { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string Placeholder { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool ReadOnly { get; set; }
|
|
|
|
|
|
2020-07-06 19:09:01 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public bool IsRange { get; set; } = false;
|
|
|
|
|
|
2020-04-28 15:56:56 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public bool Disabled { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool AutoFocus { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool ShowSuffixIcon { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool ShowTime { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment SuffixIcon { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
2020-05-18 18:42:22 +08:00
|
|
|
|
public EventCallback OnClick { get; set; }
|
2020-04-28 15:56:56 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback Onfocus { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback Onfocusout { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
2021-02-20 17:54:12 +08:00
|
|
|
|
public EventCallback<KeyboardEventArgs> OnKeyUp { get; set; }
|
2020-07-11 23:03:13 +08:00
|
|
|
|
|
2020-04-28 15:56:56 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback<ChangeEventArgs> OnInput { get; set; }
|
|
|
|
|
|
2020-07-06 19:09:01 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public bool AllowClear { get; set; } = true;
|
2020-07-11 23:03:13 +08:00
|
|
|
|
|
2020-07-06 19:09:01 +08:00
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback OnClickClear { get; set; }
|
|
|
|
|
|
2020-04-28 15:56:56 +08:00
|
|
|
|
public bool IsOnFocused { get; set; } = false;
|
2020-07-11 23:03:13 +08:00
|
|
|
|
|
2020-07-06 19:09:01 +08:00
|
|
|
|
public bool ShowClear() {
|
|
|
|
|
return !Disabled && !String.IsNullOrEmpty(Value) && AllowClear;
|
|
|
|
|
}
|
2020-04-28 15:56:56 +08:00
|
|
|
|
}
|