mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 17:31:42 +08:00
b27e4d47a6
* fix(module:datepicker): validate manually entered date against format * fix(module:datepicker): keep frozen the panel until valid date entered * fix(module:datepicker): switch to current culture format * fix(module:datepicker): build fix * fix(module:datepicker): use InvariantCulture when calling ToString on date * fix(module:datepicker): FormatAnalyzer handles also year, week, month & quarter picker * fix(module:datepicker): FormatAnalyzer broken tests * fix: FormatAnalyzer handles prefixes in format. Suffix is handled for picker type = "year" Tests include validation of not changing state * fix: all modes go through format analyzing (inluding week&quarter) * fix(module:datepickerbase): InternalFormat initalized properly for all modes * fix(module:rangepicker): reset opposing date when in conflict with current * fix(module:rangePicker): handle null in second part of range * fix(module:datepicker): switch from BindConverter to partials * tests(module:datepicker): FormatAnalyzer new tests to cover switch from BindConverter * tests(module:datepicker): missed change in tests * fix: focus, key events, reset value to original if not confirmed * fix: bug fix on range & clean-up * Update DatePicker.razor Co-authored-by: James Yeung <shunjiey@hotmail.com>
154 lines
3.6 KiB
C#
154 lines
3.6 KiB
C#
@namespace AntDesign.Internal
|
|
@inherits AntDomComponentBase
|
|
|
|
@if (!IsRange)
|
|
{
|
|
<div class="@(PrefixCls)-input">
|
|
<input @ref="Ref"
|
|
@onclick="OnClick"
|
|
@onkeyup="OnKeyUp"
|
|
@onkeydown="@OnKeyDown"
|
|
@oninput="OnInput"
|
|
@onfocus="Onfocus"
|
|
@onblur="OnBlur"
|
|
@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"
|
|
@onkeyup="OnKeyUp"
|
|
@onkeydown="@OnKeyDown"
|
|
@oninput="OnInput"
|
|
@onfocus="Onfocus"
|
|
@onblur="OnBlur"
|
|
@bind-value="@Value"
|
|
disabled="@Disabled"
|
|
placeholder="@Placeholder"
|
|
readonly="@ReadOnly">
|
|
</div>
|
|
@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>
|
|
}
|
|
|
|
}
|
|
|
|
@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; }
|
|
|
|
[Parameter]
|
|
public bool IsRange { get; set; } = false;
|
|
|
|
[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]
|
|
public EventCallback OnClick { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback Onfocus { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback OnBlur { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback Onfocusout { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<KeyboardEventArgs> OnKeyUp { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<KeyboardEventArgs> OnKeyDown { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<ChangeEventArgs> OnInput { get; set; }
|
|
|
|
[Parameter]
|
|
public bool AllowClear { get; set; } = true;
|
|
|
|
[Parameter]
|
|
public EventCallback OnClickClear { get; set; }
|
|
|
|
public bool IsOnFocused { get; set; } = false;
|
|
|
|
public bool ShowClear()
|
|
{
|
|
return !Disabled && !String.IsNullOrEmpty(Value) && AllowClear;
|
|
}
|
|
} |