2020-05-29 00:33:49 +08:00
|
|
|
|
@namespace AntDesign.Internal
|
2020-06-01 14:09:28 +08:00
|
|
|
|
@typeparam TValue
|
|
|
|
|
@inherits DatePickerPanelBase<TValue>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
|
2021-01-21 17:20:10 +08:00
|
|
|
|
<div class="@(PrefixCls)-header" @ref="Ref">
|
2020-04-28 15:56:56 +08:00
|
|
|
|
@if (ShowSuperPreChange)
|
|
|
|
|
{
|
2020-06-03 10:24:16 +08:00
|
|
|
|
<button tabindex="-1" class="@(PrefixCls)-header-super-prev-btn" @onclick="e => ChangePickerYearValue(-SuperChangeDateInterval)">
|
|
|
|
|
<span class="@(PrefixCls)-super-prev-icon"></span>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if (ShowPreChange)
|
|
|
|
|
{
|
2020-06-03 10:24:16 +08:00
|
|
|
|
<button tabindex="-1" class="@(PrefixCls)-header-prev-btn" @onclick="e => ChangePickerMonthValue(-ChangeDateInterval)">
|
|
|
|
|
<span class="@(PrefixCls)-prev-icon"></span>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-16 12:31:46 +08:00
|
|
|
|
<div class="@(PrefixCls)-header-view">
|
2020-11-25 11:08:12 +08:00
|
|
|
|
@if (Locale.Lang.MonthBeforeYear)
|
2020-06-16 12:31:46 +08:00
|
|
|
|
{
|
|
|
|
|
@if (Picker.IsIn(DatePickerType.Date, DatePickerType.Week))
|
2020-04-28 15:56:56 +08:00
|
|
|
|
{
|
2020-06-16 12:31:46 +08:00
|
|
|
|
<button type="button" tabindex="-1" class="@(PrefixCls)-month-btn" @onclick="e => PopUpPicker(DatePickerType.Month)">
|
2020-11-25 11:08:12 +08:00
|
|
|
|
@(PickerValue.ToString(Locale.Lang.MonthFormat, CultureInfo))
|
2020-04-28 15:56:56 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
2020-06-16 12:31:46 +08:00
|
|
|
|
@if (Picker.IsIn(DatePickerType.Date, DatePickerType.Month, DatePickerType.Quarter, DatePickerType.Week))
|
2020-04-28 15:56:56 +08:00
|
|
|
|
{
|
2020-06-16 12:31:46 +08:00
|
|
|
|
<button type="button" tabindex="-1" class="@(PrefixCls)-year-btn" @onclick="e => PopUpPicker(DatePickerType.Year)">
|
2020-11-25 11:08:12 +08:00
|
|
|
|
@(PickerValue.ToString(Locale.Lang.YearFormat, CultureInfo))
|
2020-04-28 15:56:56 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
2020-06-16 12:31:46 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@if (Picker.IsIn(DatePickerType.Date, DatePickerType.Month, DatePickerType.Quarter, DatePickerType.Week))
|
2020-04-28 15:56:56 +08:00
|
|
|
|
{
|
2020-06-16 12:31:46 +08:00
|
|
|
|
<button type="button" tabindex="-1" class="@(PrefixCls)-year-btn" @onclick="e => PopUpPicker(DatePickerType.Year)">
|
2020-11-25 11:08:12 +08:00
|
|
|
|
@(PickerValue.ToString(Locale.Lang.YearFormat, CultureInfo))
|
2020-04-28 15:56:56 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
2020-06-16 12:31:46 +08:00
|
|
|
|
@if (Picker.IsIn(DatePickerType.Date, DatePickerType.Week))
|
2020-04-28 15:56:56 +08:00
|
|
|
|
{
|
2020-06-16 12:31:46 +08:00
|
|
|
|
<button type="button" tabindex="-1" class="@(PrefixCls)-month-btn" @onclick="e => PopUpPicker(DatePickerType.Month)">
|
2020-11-25 11:08:12 +08:00
|
|
|
|
@(PickerValue.ToString(Locale.Lang.MonthFormat, CultureInfo))
|
2020-04-28 15:56:56 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
2020-06-16 12:31:46 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if (Picker.IsIn(DatePickerType.Year))
|
|
|
|
|
{
|
|
|
|
|
int startYear = PickerValue.Year / 10 * 10;
|
2021-01-14 10:40:34 +08:00
|
|
|
|
int showCount = 9;
|
|
|
|
|
|
|
|
|
|
if (startYear < DateTime.MinValue.Year)
|
|
|
|
|
{
|
|
|
|
|
startYear = DateTime.MinValue.Year;
|
|
|
|
|
showCount = 10;
|
|
|
|
|
}
|
2020-06-16 12:31:46 +08:00
|
|
|
|
|
|
|
|
|
<button type="button" class="@(PrefixCls)-decade-btn" @onclick="e => PopUpPicker(DatePickerType.Decade)">
|
2021-01-14 10:40:34 +08:00
|
|
|
|
@(startYear)-@(startYear + showCount)
|
2020-06-16 12:31:46 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
@if (Picker.IsIn(DatePickerType.Decade))
|
|
|
|
|
{
|
|
|
|
|
int startYear = PickerValue.Year / 100 * 100;
|
|
|
|
|
|
2021-01-14 10:40:34 +08:00
|
|
|
|
if (startYear < DateTime.MinValue.Year)
|
|
|
|
|
{
|
|
|
|
|
startYear = DateTime.MinValue.Year + 10;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-16 12:31:46 +08:00
|
|
|
|
<button type="button" class="@(PrefixCls)-decade-btn">
|
|
|
|
|
@(startYear)-@(startYear + 99)
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
|
|
|
|
|
@if (ShowNextChange)
|
|
|
|
|
{
|
2020-06-03 10:24:16 +08:00
|
|
|
|
<button tabindex="-1" class="@(PrefixCls)-header-next-btn" @onclick="e => ChangePickerMonthValue(ChangeDateInterval)">
|
|
|
|
|
<span class="@(PrefixCls)-next-icon"></span>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
@if (ShowSuperNextChange)
|
|
|
|
|
{
|
2020-06-03 10:24:16 +08:00
|
|
|
|
<button tabindex="-1" class="@(PrefixCls)-header-super-next-btn" @onclick="e => ChangePickerYearValue(SuperChangeDateInterval)">
|
|
|
|
|
<span class="@(PrefixCls)-super-next-icon"></span>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
[Parameter]
|
|
|
|
|
public int SuperChangeDateInterval { get; set; } = 1;
|
|
|
|
|
[Parameter]
|
|
|
|
|
public int ChangeDateInterval { get; set; } = 1;
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool ShowSuperPreChange { get; set; } = true;
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool ShowPreChange { get; set; } = true;
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool ShowNextChange { get; set; } = true;
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool ShowSuperNextChange { get; set; } = true;
|
|
|
|
|
}
|