@namespace AntDesign
@inherits ColumnBase
@using AntDesign.Core.Helpers
@using AntDesign.TableModels
@typeparam TData
@if (IsInitialize)
{
return;
}
else if (IsPlaceholder)
{
|
}
else if (IsMeasure)
{
|
}
else if (IsColGroup)
{
@if (AppendExpandColumn)
{
}
if (Width != null)
{
}
else
{
}
}
else if (IsHeader && HeaderColSpan != 0)
{
@if (AppendExpandColumn)
{
|
}
var headerCellAttributes = OnHeaderCell?.Invoke();
@if (Sortable || Filters?.Any() == true)
{
@FilterToolTipSorter(this)
}
else if (TitleTemplate != null)
{
@TitleTemplate
}
else
{
@HeaderTitle
}
|
}
else if (IsBody && RowSpan != 0 && ColSpan != 0)
{
var fieldText = !string.IsNullOrWhiteSpace(Format) ? Formatter.Format(Field, Format) : Field?.ToString();
@if (AppendExpandColumn)
{
@if (Table.RowExpandable(RowData) && (!Table.TreeMode || !RowData.HasChildren))
{
}
|
}
var cellAttributes = OnCell?.Invoke(RowData);
@if (ColIndex == Table.TreeExpandIconColumnIndex && Table.TreeMode)
{
@if (RowData.HasChildren)
{
}
else
{
}
}
@if (CellRender != null)
{
@CellRender(Field)
}
else if (ChildContent != null)
{
@ChildContent
}
else
{
if (!string.IsNullOrWhiteSpace(Format))
{
@(Formatter.Format(GetValue != null ? GetValue(RowData) : Field, Format))
}
else
{
@(GetValue != null ? GetValue(RowData) : Field)
}
}
|
}
@code
{
string HeaderTitle => Title ?? DisplayName ?? FieldName ?? DataIndex;
readonly RenderFragment> SortHeader = col =>
@
@if (col.TitleTemplate != null)@col.TitleTemplate else @col.HeaderTitle
@{
bool hasDescendingSorter = SortDirection.Descending.IsIn(col.SortDirections);
bool hasAscendingSorter = SortDirection.Ascending.IsIn(col.SortDirections);
}
@if (hasAscendingSorter)
{
}
@if (hasDescendingSorter)
{
}
;
readonly RenderFragment> ToolTipSorter = col =>
@
@if (col.ShowSorterTooltip)
{
@col.SortHeader(col)
}
else
{
@col.SortHeader(col)
}
;
readonly RenderFragment> FilterToolTipSorter = col =>
@
@if (col.Filters?.Any() == true)
{
() { ["onclick"]=_callbackFactory.Create(col, col.HandleSort )})">
@if (col.Sortable)
{
@col.ToolTipSorter(col)
}
() { ["OnMaskClick"] = _callbackFactory.Create(col, ()=> col.FilterConfirm()) })"
>
() { ["onclick"] = _callbackFactory.Create(col, () => col._filterOpened = !col._filterOpened )})">
}
else
{
@if (col.Sortable)
{
() { ["onclick"]=_callbackFactory.Create(col, col.HandleSort )})">
@col.ToolTipSorter(col)
}
else if (col.TitleTemplate != null)
{
@col.TitleTemplate
}
else
{
@col.HeaderTitle
}
}
;
}