mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-14 17:01:18 +08:00
cf959decf9
* 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
63 lines
2.4 KiB
C#
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> |