ant-design-blazor/components/date-picker/internal/DatePickerQuarterPanel.razor
Andrzej Bakun 6a6a12175f fix(module: RangePicker): ShowTime issues addressed (#1788)
* 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>
2021-07-31 10:53:53 +00:00

39 lines
1.6 KiB
C#

@namespace AntDesign.Internal
@typeparam TValue
@inherits DatePickerPanelBase<TValue>
@using System.Globalization;
@{
var calendar = CultureInfo.InvariantCulture.Calendar;
DateTime startDate = new DateTime(PickerValue.Year, 1, 1);
const int MAX_ROW = 1;
const int MAX_COL = 4;
}
<div class='@($"{PrefixCls}-panel")' @ref="Ref">
<DatePickerTemplate @attributes="GetAttributes()"
TValue="TValue"
MaxRow="MAX_ROW"
MaxCol="MAX_COL"
ViewStartDate="startDate"
IsInView="date => true"
IsToday="date => DateHelper.IsSameQuarter(date, DatePicker.CurrentDate)"
IsSelected="date => DateHelper.IsSameQuarter(date, Value)"
GetColTitle='date => date.ToString(Locale.Lang.YearFormat, CultureInfo)'
OnValueSelect="date => OnSelectQuarter(date)"
GetNextColValue="date => DateHelper.AddMonthsSafely(date, 3)">
<RenderPickerHeader>
<DatePickerHeader @attributes="GetAttributes()"
TValue="TValue"
ShowPreChange="@false"
ShowNextChange="@false"
ShowSuperPreChange="@(!(IsRange && PickerIndex == 1))"
ShowSuperNextChange="@(!(IsRange && PickerIndex == 0))" />
</RenderPickerHeader>
<RenderColValue Context="currentColDate">
@DateHelper.GetDayOfQuarter(currentColDate)
</RenderColValue>
</DatePickerTemplate>
</div>