ant-design-blazor/components/date-picker/internal/DatePickerMonthPanel.razor
James Yeung d2e9c4b247 feat(module: config-provider): support RTL (#1238)
* feat(module: config-provider): support RTL

* add rtl for each component

* fix rtl for pagination

* add rtl for overlay
2021-03-31 19:23:26 +08:00

51 lines
1.9 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 = 4;
const int MAX_COL = 3;
string inViewClass = $"{PrefixCls}-cell-in-view";
}
<div class="@ClassMapper.Class" @ref="Ref">
<DatePickerTemplate @attributes="GetAttritubes()"
TValue="TValue"
MaxRow="MAX_ROW"
MaxCol="MAX_COL"
ViewStartDate="startDate"
IsInView="date => true"
IsToday="date => DateHelper.IsSameMonth(date, DatePicker.CurrentDate)"
IsSelected="date => DateHelper.IsSameMonth(date, Value)"
GetColTitle='date => date.ToString(Locale.Lang.MonthFormat, CultureInfo)'
OnValueSelect="date => OnSelectMonth(date)"
GetNextColValue="date => DateHelper.AddMonthsSafely(date, 1)">
<RenderPickerHeader>
<DatePickerHeader @attributes="GetAttritubes()"
TValue="TValue"
ShowNextChange="@false"
ShowPreChange="@false"
ShowSuperPreChange="@(!(IsRange && PickerIndex == 1))"
ShowSuperNextChange="@(!(IsRange && PickerIndex == 0))" />
</RenderPickerHeader>
<RenderColValue Context="currentColDate">
@(currentColDate.ToString(Locale.Lang.MonthFormat, CultureInfo))
</RenderColValue>
</DatePickerTemplate>
</div>
@if (RenderExtraFooter != null && !IsRange)
{
<div class="@(PrefixCls)-footer">
<div class="@(PrefixCls)-footer-extra">
@RenderExtraFooter
</div>
</div>
}