2020-05-29 00:33:49 +08:00
|
|
|
|
@namespace AntDesign.Internal
|
2020-06-01 14:09:28 +08:00
|
|
|
|
@typeparam TValue
|
|
|
|
|
@inherits DatePickerPanelBase<TValue>
|
2020-07-05 00:06:34 +08:00
|
|
|
|
@using AntDesign
|
2020-04-28 15:56:56 +08:00
|
|
|
|
|
2021-01-21 17:20:10 +08:00
|
|
|
|
<div class="@(PrefixCls)-@(Picker)-panel" @ref="Ref">
|
2020-06-03 10:24:16 +08:00
|
|
|
|
@if (IsShowHeader)
|
|
|
|
|
{
|
|
|
|
|
@RenderPickerHeader
|
|
|
|
|
}
|
|
|
|
|
<div class="@(PrefixCls)-body">
|
|
|
|
|
<table class="@(PrefixCls)-content">
|
2020-04-28 15:56:56 +08:00
|
|
|
|
<thead>
|
|
|
|
|
@RenderTableHeader
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
2021-01-14 10:40:34 +08:00
|
|
|
|
@{
|
|
|
|
|
var startDate = ViewStartDate;
|
|
|
|
|
bool shouldStopRender = false;
|
|
|
|
|
}
|
2020-04-28 15:56:56 +08:00
|
|
|
|
@for (int row = 1; row <= MaxRow; row++)
|
|
|
|
|
{
|
2021-01-14 10:40:34 +08:00
|
|
|
|
if (shouldStopRender)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-28 15:56:56 +08:00
|
|
|
|
var startColDate = startDate;
|
2021-01-14 10:40:34 +08:00
|
|
|
|
|
2020-04-28 15:56:56 +08:00
|
|
|
|
<tr class="@(GetRowClass?.Invoke(startColDate))"
|
|
|
|
|
@onclick="e => OnRowSelect?.Invoke(startColDate)">
|
|
|
|
|
|
|
|
|
|
@RenderFisrtCol?.Invoke(startColDate)
|
|
|
|
|
|
|
|
|
|
@for (int col = 1; col <= MaxCol; col++)
|
|
|
|
|
{
|
2021-01-14 10:40:34 +08:00
|
|
|
|
if (shouldStopRender)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-28 15:56:56 +08:00
|
|
|
|
var currentColDate = startDate;
|
|
|
|
|
|
2020-07-05 00:06:34 +08:00
|
|
|
|
string cellCls = GetCellCls(currentColDate);
|
|
|
|
|
string innerCellCls = GetInnerCellCls(currentColDate);
|
2020-04-28 15:56:56 +08:00
|
|
|
|
|
|
|
|
|
<td title="@GetColTitle?.Invoke(currentColDate)"
|
2020-07-05 00:06:34 +08:00
|
|
|
|
class="@cellCls"
|
|
|
|
|
@onmouseenter="e => DateOnMouseEnter(currentColDate)"
|
|
|
|
|
@onmouseleave="e => DateOnMouseLeave()">
|
|
|
|
|
<div class="@innerCellCls"
|
2020-04-28 15:56:56 +08:00
|
|
|
|
@onclick="e => OnValueSelect?.Invoke(currentColDate)">
|
2020-06-03 10:24:16 +08:00
|
|
|
|
@if (IsCalendar)
|
2020-04-28 15:56:56 +08:00
|
|
|
|
{
|
2020-06-03 10:24:16 +08:00
|
|
|
|
<div class="@(PrefixCls)-calendar-date-value">
|
|
|
|
|
@if (Picker == DatePickerType.Date && DateRender != null)
|
|
|
|
|
{
|
|
|
|
|
@(DateRender(currentColDate, DatePicker.CurrentDate))
|
|
|
|
|
}
|
|
|
|
|
else if (Picker == DatePickerType.Month && MonthCellRender != null)
|
|
|
|
|
{
|
|
|
|
|
@(MonthCellRender(currentColDate))
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@RenderColValue(currentColDate)
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="@(PrefixCls)-calendar-date-content">
|
|
|
|
|
@if (Picker == DatePickerType.Date && CalendarDateRender != null)
|
|
|
|
|
{
|
|
|
|
|
@(CalendarDateRender(currentColDate))
|
|
|
|
|
}
|
|
|
|
|
else if (Picker == DatePickerType.Month && CalendarMonthCellRender != null)
|
|
|
|
|
{
|
|
|
|
|
@(CalendarMonthCellRender(currentColDate))
|
|
|
|
|
}
|
|
|
|
|
</div>
|
2020-04-28 15:56:56 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-06-03 10:24:16 +08:00
|
|
|
|
@if (Picker == DatePickerType.Date && DateRender != null)
|
|
|
|
|
{
|
|
|
|
|
@(DateRender(currentColDate, DatePicker.CurrentDate))
|
|
|
|
|
}
|
|
|
|
|
else if (Picker == DatePickerType.Month && MonthCellRender != null)
|
|
|
|
|
{
|
|
|
|
|
@(MonthCellRender(currentColDate))
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@RenderColValue(currentColDate)
|
|
|
|
|
}
|
2020-04-28 15:56:56 +08:00
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
startDate = @GetNextColValue(currentColDate);
|
2021-01-14 10:40:34 +08:00
|
|
|
|
|
|
|
|
|
if (ShouldStopRenderDate(currentColDate, startDate))
|
|
|
|
|
{
|
|
|
|
|
shouldStopRender = true;
|
|
|
|
|
}
|
2020-04-28 15:56:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@{ var endColDate = startDate;}
|
|
|
|
|
@RenderLastCol?.Invoke(endColDate)
|
|
|
|
|
</tr>
|
|
|
|
|
}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
2021-01-14 10:40:34 +08:00
|
|
|
|
</div>
|