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
|
|
|
|
@using System.Globalization;
|
|
|
|
|
|
|
|
|
|
@{
|
|
|
|
|
var calendar = CultureInfo.InvariantCulture.Calendar;
|
|
|
|
|
|
|
|
|
|
int startYear = PickerValue.Year / 10 * 10 - 1;
|
|
|
|
|
DateTime startDate = new DateTime(startYear, 1, 1);
|
|
|
|
|
|
|
|
|
|
int yearIndex = 0;
|
|
|
|
|
const int MAX_ROW = 4;
|
|
|
|
|
const int MAX_COL = 3;
|
|
|
|
|
const int FIRST_YEAR_INDEX = 0;
|
|
|
|
|
const int LAST_YEAR_INDEX = MAX_ROW * MAX_COL;
|
|
|
|
|
}
|
2020-06-03 10:24:16 +08:00
|
|
|
|
<div class='@($"{PrefixCls}-panel")'>
|
|
|
|
|
<DatePickerTemplate @attributes="GetAttritubes()"
|
|
|
|
|
TValue="TValue"
|
|
|
|
|
MaxRow="MAX_ROW"
|
|
|
|
|
MaxCol="MAX_COL"
|
|
|
|
|
ViewStartDate="startDate"
|
|
|
|
|
IsInView="date => yearIndex != FIRST_YEAR_INDEX && yearIndex != LAST_YEAR_INDEX"
|
|
|
|
|
IsToday="date => DateHelper.IsSameYear(date, DatePicker.CurrentDate)"
|
|
|
|
|
IsSelected="date => DateHelper.IsSameYear(date, Value)"
|
2020-06-16 12:31:46 +08:00
|
|
|
|
GetColTitle='date => date.ToString(this.DatePicker.CultureInfo.GetDateLocale().YearFormat, this.DatePicker.CultureInfo)'
|
2020-06-03 10:24:16 +08:00
|
|
|
|
OnValueSelect="date => OnSelectYear(date)"
|
|
|
|
|
GetNextColValue="date => date.AddYears(1)">
|
|
|
|
|
<RenderPickerHeader>
|
|
|
|
|
<DatePickerHeader @attributes="GetAttritubes()"
|
|
|
|
|
TValue="TValue"
|
|
|
|
|
SuperChangeDateInterval="10"
|
|
|
|
|
ShowPreChange="@false"
|
|
|
|
|
ShowNextChange="@false"
|
|
|
|
|
ShowSuperPreChange="@(!(IsRange && PickerIndex == 1))"
|
|
|
|
|
ShowSuperNextChange="@(!(IsRange && PickerIndex == 0))" />
|
|
|
|
|
</RenderPickerHeader>
|
|
|
|
|
<RenderColValue Context="currentColDate">
|
|
|
|
|
@{yearIndex++;}
|
|
|
|
|
@currentColDate.Year
|
|
|
|
|
</RenderColValue>
|
|
|
|
|
</DatePickerTemplate>
|
|
|
|
|
</div>
|