mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 01:11:52 +08:00
6a6a12175f
* fix(module:rangePicker): year & month skip * fix(module:rangePicker): extra space removed on 2nd picker * fix(module:rangePicker): when ShowTime, click on OK moves to other picker * fix(module:rangePicker): adjust year skip button * fix(module:rangePicker): focus issue resolution * fix(module:rangePicker): remove incorrect value from input Co-authored-by: James Yeung <shunjiey@hotmail.com>
50 lines
2.0 KiB
C#
50 lines
2.0 KiB
C#
@namespace AntDesign.Internal
|
|
@typeparam TValue
|
|
@inherits DatePickerPanelBase<TValue>
|
|
@using System.Globalization;
|
|
|
|
@{
|
|
var calendar = CultureInfo.InvariantCulture.Calendar;
|
|
|
|
int year = PickerValue.Year / 100 * 100;
|
|
|
|
if (year < DateTime.MinValue.Year)
|
|
{
|
|
year = DateTime.MinValue.Year;
|
|
}
|
|
|
|
DateTime startDate = DateHelper.AddYearsSafely(new DateTime(year, 1, 1), -10);
|
|
|
|
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 - 1;
|
|
}
|
|
<div class='@($"{PrefixCls}-panel")' @ref="Ref">
|
|
<DatePickerTemplate @attributes="GetAttributes()"
|
|
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)"
|
|
OnValueSelect="date => OnSelectYear(date)"
|
|
GetNextColValue="date => DateHelper.AddYearsSafely(date, 10)">
|
|
<RenderPickerHeader>
|
|
<DatePickerHeader @attributes="GetAttributes()"
|
|
TValue="TValue"
|
|
Picker="@Picker"
|
|
SuperChangeDateInterval="100"
|
|
ShowPreChange="@false"
|
|
ShowNextChange="@false"
|
|
ShowSuperPreChange="@(!(IsRange && PickerIndex == 1))"
|
|
ShowSuperNextChange="@(!(IsRange && PickerIndex == 0))" />
|
|
</RenderPickerHeader>
|
|
<RenderColValue Context="currentColDate">
|
|
@{yearIndex++;}
|
|
@(currentColDate.Year)-@(currentColDate.Year + 9)
|
|
</RenderColValue>
|
|
</DatePickerTemplate>
|
|
</div> |