ant-design-blazor/components/calendar/internal/CalendarPanelChooser.razor
笨木头 cf959decf9 feat: add calendar (#176)
* feat: refactor datePicker, add Calendar(basic)

* feat: add calendar and demos

* fix: timePicker format error

* fix: release comments

* refactor: replace @bind-Value with Value

* refactor: replace @bind-Value with Value

* fix: conflit
2020-06-03 10:24:16 +08:00

63 lines
2.4 KiB
C#

@namespace AntDesign.Internal
@inherits AntDomComponentBase
@{
Action ClosePanel = () => { };
Action<DateTime, int> ChangePickerValue = async (date, index) => { await Calendar.ChangeValue(date); };
Action<DateTime, int> ChangeValue = async (date, index) => { await Calendar.ChangeValue(date); };
Action<string, int> ChangePickerType = (type, index) => { Calendar.ChangePickerType(type, index); };
Func<int, DateTime> GetIndexPickerValue = (index) => Calendar.Value;
Func<int, DateTime?> GetIndexValue = (index) => Calendar.Value;
Dictionary<string, object> attributes =
new Dictionary<string, object>()
{
{ "PrefixCls", "ant-picker" },
{ "Picker", Calendar.Picker },
{ "ClosePanel", ClosePanel },
{ "ChangePickerValue", ChangePickerValue },
{ "ChangeValue", ChangeValue },
{ "ChangePickerType", ChangePickerType },
{ "GetIndexPickerValue", GetIndexPickerValue },
{ "GetIndexValue", GetIndexValue },
{ "DisabledDate", Calendar.DisabledDate },
{ "DateRender", Calendar.DateFullCellRender },
{ "MonthCellRender", Calendar.MonthFullCellRender },
{ "CalendarDateRender", Calendar.DateCellRender },
{ "CalendarMonthCellRender", Calendar.MonthCellRender },
{ "OnSelect", OnSelect },
{ "PickerIndex", 0 },
{ "IsCalendar", true },
{ "IsShowHeader", false },
};
Dictionary<string, object> dateAttributes = new Dictionary<string, object>(attributes);
dateAttributes.Add("ShowToday", false);
}
<CascadingValue Value=@Calendar>
@if (IsShowDatePanel())
{
<DatePickerDatePanel TValue="DateTime" @attributes="dateAttributes" />
}
else if (IsShowQuarterPanel())
{
<DatePickerQuarterPanel TValue="DateTime" @attributes="attributes" />
}
else if (IsShowWeekPanel())
{
<DatePickerDatePanel TValue="DateTime" @attributes="dateAttributes" IsWeek="@true" />
}
else if (IsShowMonthPanel())
{
<DatePickerMonthPanel TValue="DateTime" @attributes="attributes" />
}
else if (IsShowYearPanel())
{
<DatePickerYearPanel TValue="DateTime" @attributes="attributes" />
}
else if (IsShowDecadePanel())
{
<DatePickerDecadePanel TValue="DateTime" @attributes="attributes" />
}
</CascadingValue>