2020-05-30 01:46:41 +08:00
|
|
|
@namespace AntDesign
|
2020-06-19 23:06:33 +08:00
|
|
|
@inherits ColumnBase
|
2020-09-06 15:31:40 +08:00
|
|
|
@using AntDesign.Core.Helpers
|
2020-07-08 16:12:49 +08:00
|
|
|
@using AntDesign.TableModels
|
2020-06-05 16:06:23 +08:00
|
|
|
@typeparam TData
|
2020-05-30 01:46:41 +08:00
|
|
|
|
2020-06-19 23:06:33 +08:00
|
|
|
@if (IsPlaceholder)
|
2020-05-30 01:46:41 +08:00
|
|
|
{
|
2020-06-19 23:06:33 +08:00
|
|
|
<td style="padding: 0px; border: 0px; height: 0px;"></td>
|
|
|
|
}
|
|
|
|
else if (IsColGroup)
|
|
|
|
{
|
|
|
|
if (Width > 0)
|
|
|
|
{
|
|
|
|
<col style="width: @(Width)px; min-width: @(Width)px;">
|
|
|
|
}
|
|
|
|
}
|
2020-09-28 16:06:02 +08:00
|
|
|
else if (IsHeader && HeaderColSpan != 0)
|
2020-06-19 23:06:33 +08:00
|
|
|
{
|
2020-09-28 16:06:02 +08:00
|
|
|
<th class="@ClassMapper.Class" style="@FixedStyle @Style" @onclick="HandelHeaderClick" colspan="@HeaderColSpan">
|
2020-07-08 16:12:49 +08:00
|
|
|
@if (Sortable)
|
|
|
|
{
|
|
|
|
if (ShowSorterTooltip)
|
|
|
|
{
|
|
|
|
@ToolTipSorter(this)
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@SortHeader(this)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@HeaderTitle
|
|
|
|
}
|
2020-06-05 16:06:23 +08:00
|
|
|
</th>
|
2020-05-30 01:46:41 +08:00
|
|
|
}
|
2020-11-03 13:31:22 +08:00
|
|
|
else if (!IsHeader && RowSpan != 0 && ColSpan != 0)
|
2020-05-30 01:46:41 +08:00
|
|
|
{
|
2020-09-28 16:06:02 +08:00
|
|
|
<td class="@ClassMapper.Class" style="@FixedStyle @Style" rowspan="@RowSpan" colspan="@ColSpan">
|
2020-06-05 16:06:23 +08:00
|
|
|
@if (CellRender != null)
|
|
|
|
{
|
|
|
|
@CellRender(Field)
|
|
|
|
}
|
|
|
|
else if (ChildContent != null)
|
|
|
|
{
|
|
|
|
@ChildContent
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-07-05 00:09:53 +08:00
|
|
|
if (!string.IsNullOrWhiteSpace(Format))
|
|
|
|
{
|
|
|
|
@(Formatter<TData>.Format(Field,Format))
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@Field
|
|
|
|
}
|
2020-06-05 16:06:23 +08:00
|
|
|
}
|
|
|
|
</td>
|
2020-05-30 01:46:41 +08:00
|
|
|
}
|
2020-07-08 16:12:49 +08:00
|
|
|
|
|
|
|
@code
|
|
|
|
{
|
|
|
|
|
|
|
|
string HeaderTitle => Title ?? DisplayName ?? FieldName;
|
|
|
|
|
|
|
|
readonly RenderFragment<Column<TData>> SortHeader = col =>
|
|
|
|
@<div class="ant-table-column-sorters">
|
|
|
|
<span>@col.HeaderTitle</span>
|
|
|
|
<span class="ant-table-column-sorter ant-table-column-sorter-full">
|
|
|
|
<span class="ant-table-column-sorter-inner">
|
|
|
|
<Icon Type="caret-up" Class=@($"ant-table-column-sorter-up {(col.SortModel.SortType==SortType.Ascending? "active":"")}") />
|
|
|
|
<Icon Type="caret-down" Class=@($"ant-table-column-sorter-down {(col.SortModel.SortType==SortType.Descending? "active":"")}") />
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>;
|
|
|
|
|
2020-09-06 15:31:40 +08:00
|
|
|
readonly RenderFragment<Column<TData>> ToolTipSorter = col =>
|
|
|
|
@<Tooltip Class="ant-table-column-sorters-with-tooltip" Title="@col.SorterTooltip">
|
|
|
|
@col.SortHeader(col)
|
|
|
|
</Tooltip>;
|
2020-07-08 16:12:49 +08:00
|
|
|
|
2020-09-06 15:31:40 +08:00
|
|
|
}
|