2020-12-05 18:44:38 +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
|
|
|
|
|
2021-01-09 23:57:31 +08:00
|
|
|
|
@if (IsInitialize)
|
|
|
|
|
{
|
2021-09-02 12:34:30 +08:00
|
|
|
|
return;
|
2021-01-09 23:57:31 +08:00
|
|
|
|
}
|
2021-04-26 17:35:01 +08:00
|
|
|
|
else if (Hidden)
|
|
|
|
|
{
|
2021-09-02 12:34:30 +08:00
|
|
|
|
return;
|
2021-04-26 17:35:01 +08:00
|
|
|
|
}
|
2021-01-09 23:57:31 +08:00
|
|
|
|
else if (IsPlaceholder)
|
2020-05-30 01:46:41 +08:00
|
|
|
|
{
|
2021-09-02 12:34:30 +08:00
|
|
|
|
<td style="padding: 0px; border: 0px; height: 0px;"></td>
|
2020-06-19 23:06:33 +08:00
|
|
|
|
}
|
2021-01-09 23:57:31 +08:00
|
|
|
|
else if (IsMeasure)
|
|
|
|
|
{
|
2021-09-02 12:34:30 +08:00
|
|
|
|
<td style="padding: 0px; border: 0px; height: 0px;"><div style="height: 0px; overflow: hidden;"> </div></td>
|
2021-01-09 23:57:31 +08:00
|
|
|
|
}
|
2020-06-19 23:06:33 +08:00
|
|
|
|
else if (IsColGroup)
|
|
|
|
|
{
|
2021-09-02 12:34:30 +08:00
|
|
|
|
@if (AppendExpandColumn)
|
|
|
|
|
{
|
|
|
|
|
<col class="ant-table-expand-icon-col">
|
|
|
|
|
}
|
2021-01-21 14:56:20 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
if (Width != null)
|
|
|
|
|
{
|
|
|
|
|
<col style="width: @((CssSizeLength)Width); min-width: @((CssSizeLength)Width);">
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<col />
|
|
|
|
|
}
|
2020-06-19 23:06:33 +08:00
|
|
|
|
}
|
2020-09-28 16:06:02 +08:00
|
|
|
|
else if (IsHeader && HeaderColSpan != 0)
|
2020-06-19 23:06:33 +08:00
|
|
|
|
{
|
2021-01-21 14:56:20 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
@if (AppendExpandColumn)
|
|
|
|
|
{
|
|
|
|
|
<th class="ant-table-cell ant-table-row-expand-icon-cell"></th>
|
|
|
|
|
}
|
2021-01-21 14:56:20 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
var headerCellAttributes = OnHeaderCell?.Invoke();
|
|
|
|
|
<CascadingValue Name="IsHeader" Value="false" IsFixed>
|
2023-01-02 20:35:03 +08:00
|
|
|
|
<th class="@ClassMapper.Class" style="@FixedStyle @HeaderStyle" colspan="@(HeaderColSpan > 1 ? HeaderColSpan : false)" rowspan="@(RowSpan > 1 ? RowSpan : false)" title="@(Ellipsis ? Title : false)" @attributes="headerCellAttributes">
|
2021-09-02 12:34:30 +08:00
|
|
|
|
@if (Sortable || (_filterable && _filters?.Any() == true))
|
2022-01-18 10:06:29 +08:00
|
|
|
|
{
|
|
|
|
|
@FilterToolTipSorter
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-01-18 11:02:19 +08:00
|
|
|
|
@ColumnTitle()
|
2022-01-18 10:06:29 +08:00
|
|
|
|
}
|
|
|
|
|
</th>
|
|
|
|
|
</CascadingValue>
|
2020-05-30 01:46:41 +08:00
|
|
|
|
}
|
2021-01-24 13:52:57 +08:00
|
|
|
|
else if (IsBody && RowSpan != 0 && ColSpan != 0)
|
2020-05-30 01:46:41 +08:00
|
|
|
|
{
|
2021-01-10 21:44:25 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
var fieldText = !string.IsNullOrWhiteSpace(Format) ? Formatter<TData>.Format(Field, Format) : Field?.ToString();
|
2021-01-10 21:44:25 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
@if (AppendExpandColumn)
|
|
|
|
|
{
|
|
|
|
|
<td class="ant-table-cell ant-table-row-expand-icon-cell">
|
|
|
|
|
@if (Table.RowExpandable(RowData) && (!Table.TreeMode || !RowData.HasChildren))
|
|
|
|
|
{
|
|
|
|
|
<button type="button" @onclick="ToggleTreeNode" @onclick:stopPropagation
|
|
|
|
|
class="ant-table-row-expand-icon @(RowData.Expanded ? "ant-table-row-expand-icon-expanded" : "ant-table-row-expand-icon-collapsed")"
|
|
|
|
|
aria-label="@(RowData.Expanded ? Table.Locale.Collapse : Table.Locale.Expand)"></button>
|
|
|
|
|
}
|
2022-01-18 10:06:29 +08:00
|
|
|
|
</td>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cellData = new CellData<TData>(RowData, Field, Format);
|
|
|
|
|
var cellAttributes = OnCell?.Invoke(cellData);
|
2021-09-02 12:34:30 +08:00
|
|
|
|
<CascadingValue Name="IsBody" Value="false" IsFixed>
|
2023-01-02 20:35:03 +08:00
|
|
|
|
@{
|
|
|
|
|
var title = Context.HeaderColumns.LastOrDefault(x => x.ColIndex <= ColIndex && x.ColIndex + x.HeaderColSpan > ColIndex)?.Title;
|
|
|
|
|
}
|
|
|
|
|
<td class="@ClassMapper.Class" style="@FixedStyle @Style" rowspan="@RowSpan" colspan="@ColSpan" title="@(Ellipsis ? fieldText : false)" data-label="@title" @attributes="cellAttributes">
|
2021-09-02 12:34:30 +08:00
|
|
|
|
@if (ColIndex == Table.TreeExpandIconColumnIndex && Table.TreeMode)
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-table-row-indent indent-level-@RowData.Level" style="padding-left: @((CssSizeLength)(RowData.Level * Table.IndentSize));"></span>
|
|
|
|
|
@if (RowData.HasChildren)
|
|
|
|
|
{
|
|
|
|
|
<button type="button" @onclick="ToggleTreeNode" @onclick:stopPropagation class="ant-table-row-expand-icon @(RowData?.Expanded == true ? "ant-table-row-expand-icon-expanded" : "ant-table-row-expand-icon-collapsed")" aria-label="@(RowData?.Expanded == true ? Table.Locale.Collapse : Table.Locale.Expand)"></button>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<button type="button" class="ant-table-row-expand-icon ant-table-row-expand-icon-spaced" aria-label="@Table.Locale.Expand"></button>
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-21 14:56:20 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
@if (CellRender != null)
|
|
|
|
|
{
|
|
|
|
|
@CellRender(cellData)
|
|
|
|
|
}
|
|
|
|
|
else if (ChildContent != null)
|
|
|
|
|
{
|
|
|
|
|
@ChildContent
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-01-18 10:06:29 +08:00
|
|
|
|
@cellData.FormattedValue
|
2021-09-02 12:34:30 +08:00
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
</CascadingValue>
|
2020-05-30 01:46:41 +08:00
|
|
|
|
}
|
2020-07-08 16:12:49 +08:00
|
|
|
|
|
|
|
|
|
@code
|
|
|
|
|
{
|
2023-01-18 11:02:19 +08:00
|
|
|
|
RenderFragment ColumnTitle()
|
|
|
|
|
{
|
|
|
|
|
return @<span class="ant-table-column-title">
|
|
|
|
|
@if (TitleTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@TitleTemplate
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@Title
|
|
|
|
|
}
|
|
|
|
|
</span>;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
RenderFragment SortHeader =>
|
|
|
|
|
@<Template>
|
2023-01-18 11:02:19 +08:00
|
|
|
|
@ColumnTitle()
|
2021-09-02 12:34:30 +08:00
|
|
|
|
@{
|
|
|
|
|
bool hasDescendingSorter = SortDirection.Descending.IsIn(SortDirections);
|
|
|
|
|
bool hasAscendingSorter = SortDirection.Ascending.IsIn(SortDirections);
|
|
|
|
|
}
|
|
|
|
|
<span class="ant-table-column-sorter@(hasDescendingSorter && hasAscendingSorter ? " ant-table-column-sorter-full" : "")">
|
|
|
|
|
<span class="ant-table-column-sorter-inner">
|
|
|
|
|
@if (hasAscendingSorter)
|
|
|
|
|
{
|
|
|
|
|
<Icon Type="caret-up" Class=@($"ant-table-column-sorter-up{(_sortDirection == SortDirection.Ascending ? " active" : "")}") />
|
|
|
|
|
}
|
|
|
|
|
@if (hasDescendingSorter)
|
|
|
|
|
{
|
|
|
|
|
<Icon Type="caret-down" Class=@($"ant-table-column-sorter-down{(_sortDirection == SortDirection.Descending ? " active" : "")}") />
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
</Template>
|
|
|
|
|
;
|
2020-07-08 16:12:49 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
RenderFragment ToolTipSorter =>
|
|
|
|
|
@<Template>
|
|
|
|
|
@if (ShowSorterTooltip)
|
|
|
|
|
{
|
|
|
|
|
<Tooltip Title="@SorterTooltip">
|
|
|
|
|
<Unbound>
|
|
|
|
|
<div class="ant-table-column-sorters" @ref="context.Current" @onclick="HandleSort">
|
|
|
|
|
@SortHeader
|
|
|
|
|
</div>
|
|
|
|
|
</Unbound>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div class="ant-table-column-sorters" @onclick="HandleSort">
|
|
|
|
|
@SortHeader
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</Template>
|
|
|
|
|
;
|
2021-02-27 23:55:48 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
RenderFragment FilterToolTipSorter =>
|
|
|
|
|
@<Template>
|
|
|
|
|
@if (_filterable && _filters?.Any() == true)
|
|
|
|
|
{
|
|
|
|
|
<div class="ant-table-filter-column">
|
|
|
|
|
@if (Sortable)
|
|
|
|
|
{
|
|
|
|
|
@ToolTipSorter
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-01-18 11:02:19 +08:00
|
|
|
|
@ColumnTitle()
|
2021-09-02 12:34:30 +08:00
|
|
|
|
}
|
2021-04-11 01:11:19 +08:00
|
|
|
|
|
2021-09-10 19:06:50 +08:00
|
|
|
|
<Dropdown Trigger="new[] { Trigger.Click }" Visible="_filterOpened" Placement="Placement.BottomRight" OnMaskClick="() => { if (_filterOpened) FilterConfirm(); }">
|
2021-09-02 12:34:30 +08:00
|
|
|
|
<Unbound>
|
|
|
|
|
<span @ref="context.Current" role="button" tabindex="-1" class="ant-dropdown-trigger ant-table-filter-trigger@((_filterOpened ? " ant-dropdown-open" : "") + (_hasFilterSelected ? " active" : ""))"
|
|
|
|
|
@onclick="() => { if (_filterOpened) FilterConfirm(); else _filterOpened = true; }">
|
|
|
|
|
<Icon Type="filter" Theme="fill" />
|
|
|
|
|
</span>
|
|
|
|
|
</Unbound>
|
|
|
|
|
<Overlay>
|
|
|
|
|
<div class="ant-table-filter-dropdown">
|
|
|
|
|
@if (_filters?.Any() == true && _columnFilterType == TableFilterType.List)
|
|
|
|
|
{
|
|
|
|
|
<Menu AutoCloseDropdown="false" SelectedKeys="_selectedFilterValues">
|
|
|
|
|
@foreach (var filter in _filters)
|
|
|
|
|
{
|
|
|
|
|
<MenuItem Key="@filter.Value?.ToString()" OnClick="() => FilterSelected(filter)">
|
|
|
|
|
@if (FilterMultiple)
|
|
|
|
|
{
|
|
|
|
|
<Checkbox Value="filter.Selected" ValueChanged="value => FilterSelected(filter)">@filter.Text</Checkbox>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<Radio TValue="bool" Checked="filter.Selected" CheckedChanged="value => FilterSelected(filter)">@filter.Text</Radio>
|
|
|
|
|
}
|
|
|
|
|
</MenuItem>
|
|
|
|
|
}
|
|
|
|
|
</Menu>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div id="@("popup-container-for-" + Id)" style="position:relative!important"></div>
|
|
|
|
|
int filterCount = _filters.Count();
|
|
|
|
|
@for (int index = 0; index < filterCount; index++)
|
|
|
|
|
{
|
|
|
|
|
var filter = _filters.ElementAt(index);
|
|
|
|
|
var noInput = filter.FilterCompareOperator == TableFilterCompareOperator.IsNull || filter.FilterCompareOperator == TableFilterCompareOperator.IsNotNull;
|
|
|
|
|
<div @key="filter" style="padding:10px;min-width:150px;@(index > 0 ? "border-top:1px solid #f0f0f0" : "")">
|
|
|
|
|
@if (index > 0)
|
|
|
|
|
{
|
|
|
|
|
<div>
|
|
|
|
|
<Space Style="margin-bottom:10px">
|
|
|
|
|
<SpaceItem>
|
2021-09-10 19:06:50 +08:00
|
|
|
|
<Select Value="filter.FilterCondition" TItemValue="TableFilterCondition" TItem="TableFilterCondition" ValueChanged="value => SetFilterCondition(filter,value)" PopupContainerSelector="@("#popup-container-for-" + Id)" BoundaryAdjustMode="@TriggerBoundaryAdjustMode.None">
|
2021-09-02 12:34:30 +08:00
|
|
|
|
<SelectOptions>
|
|
|
|
|
<SelectOption TItem="TableFilterCondition" TItemValue="TableFilterCondition" Value="@TableFilterCondition.And" Label="@Table?.Locale.FilterOptions.And"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCondition" TItemValue="TableFilterCondition" Value="@TableFilterCondition.Or" Label="@Table?.Locale.FilterOptions.Or"></SelectOption>
|
|
|
|
|
</SelectOptions>
|
|
|
|
|
</Select>
|
|
|
|
|
</SpaceItem>
|
|
|
|
|
</Space>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
<Space Style="width:100%;">
|
|
|
|
|
<SpaceItem Style="flex:auto">
|
2021-09-10 19:06:50 +08:00
|
|
|
|
<Select Value="filter.FilterCompareOperator" TItemValue="TableFilterCompareOperator" TItem="TableFilterCompareOperator" Style="width: 100%; overflow: visible" ValueChanged="value => SetFilterCompareOperator(filter,value)" PopupContainerSelector="@("#popup-container-for-" + Id)" BoundaryAdjustMode="@TriggerBoundaryAdjustMode.None" DropdownMatchSelectWidth="false">
|
2021-09-02 12:34:30 +08:00
|
|
|
|
<SelectOptions>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.Equals" Label="@Table?.Locale.FilterOptions.Equals"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.NotEquals" Label="@Table?.Locale.FilterOptions.NotEquals"></SelectOption>
|
|
|
|
|
@if (_columnDataType == typeof(string))
|
|
|
|
|
{
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.Contains" Label="@Table?.Locale.FilterOptions.Contains"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.StartsWith" Label="@Table?.Locale.FilterOptions.StartsWith"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.EndsWith" Label="@Table?.Locale.FilterOptions.EndsWith"></SelectOption>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType.IsEnum)
|
|
|
|
|
{
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.Contains" Label="@Table?.Locale.FilterOptions.Contains"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.NotContains" Label="@Table?.Locale.FilterOptions.NotContains"></SelectOption>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(DateTime))
|
|
|
|
|
{
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.GreaterThan" Label="@Table?.Locale.FilterOptions.GreaterThan"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.LessThan" Label="@Table?.Locale.FilterOptions.LessThan"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.GreaterThanOrEquals" Label="@Table?.Locale.FilterOptions.GreaterThanOrEquals"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.LessThanOrEquals" Label="@Table?.Locale.FilterOptions.LessThanOrEquals"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.TheSameDateWith" Label="@Table?.Locale.FilterOptions.TheSameDateWith"></SelectOption>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(Guid)) { }
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.GreaterThan" Label="@Table?.Locale.FilterOptions.GreaterThan"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.LessThan" Label="@Table?.Locale.FilterOptions.LessThan"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.GreaterThanOrEquals" Label="@Table?.Locale.FilterOptions.GreaterThanOrEquals"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.LessThanOrEquals" Label="@Table?.Locale.FilterOptions.LessThanOrEquals"></SelectOption>
|
|
|
|
|
}
|
|
|
|
|
@if (THelper.IsTypeNullable<TData>() || _columnDataType == typeof(string))
|
|
|
|
|
{
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.IsNull" Label="@Table?.Locale.FilterOptions.IsNull"></SelectOption>
|
|
|
|
|
<SelectOption TItem="TableFilterCompareOperator" TItemValue="TableFilterCompareOperator" Value="@TableFilterCompareOperator.IsNotNull" Label="@Table?.Locale.FilterOptions.IsNotNull"></SelectOption>
|
|
|
|
|
}
|
|
|
|
|
</SelectOptions>
|
|
|
|
|
</Select>
|
|
|
|
|
</SpaceItem>
|
|
|
|
|
@if (!noInput)
|
|
|
|
|
{
|
|
|
|
|
<SpaceItem>
|
|
|
|
|
@FilterInput(filter)
|
|
|
|
|
</SpaceItem>
|
|
|
|
|
}
|
|
|
|
|
@if (filterCount > 1)
|
|
|
|
|
{
|
|
|
|
|
<SpaceItem>
|
|
|
|
|
<Button Size="small" Icon="close" Type="primary" OnClick="()=> RemoveFilter(filter)">
|
|
|
|
|
</Button>
|
|
|
|
|
</SpaceItem>
|
|
|
|
|
}
|
|
|
|
|
</Space>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
<div class="ant-table-filter-dropdown-btns">
|
|
|
|
|
<Button Size="small" Type="link" OnClick="ResetFilters">
|
|
|
|
|
@Table?.Locale.FilterReset
|
|
|
|
|
</Button>
|
|
|
|
|
@if (_columnFilterType == TableFilterType.FieldType)
|
|
|
|
|
{
|
|
|
|
|
<Button Size="small" Icon="plus" Type="primary" OnClick="AddFilter">
|
|
|
|
|
</Button>
|
|
|
|
|
}
|
|
|
|
|
<Button Size="small" Type="primary" OnClick="() => FilterConfirm()">
|
|
|
|
|
@Table?.Locale.FilterConfirm
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Overlay>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ToolTipSorter
|
|
|
|
|
}
|
|
|
|
|
</Template>
|
|
|
|
|
;
|
2021-06-03 18:54:41 +08:00
|
|
|
|
|
2021-09-02 12:34:30 +08:00
|
|
|
|
RenderFragment<TableFilter> FilterInput => filter =>
|
|
|
|
|
@<Template>
|
|
|
|
|
@if (_columnDataType == typeof(DateTime))
|
|
|
|
|
{
|
|
|
|
|
if (filter.FilterCompareOperator != TableFilterCompareOperator.TheSameDateWith)
|
|
|
|
|
{
|
|
|
|
|
<DatePicker Value="(DateTime?)filter.Value" ShowTime="@true"
|
2021-09-10 19:06:50 +08:00
|
|
|
|
TValue="DateTime?" ValueChanged="value => SetFilterValue(filter, value?.AddMilliseconds(-value.Value.Millisecond))"
|
|
|
|
|
PopupContainerSelector="@("#popup-container-for-" + Id)"
|
|
|
|
|
BoundaryAdjustMode="@TriggerBoundaryAdjustMode.None"/>
|
2021-09-02 12:34:30 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-09-10 19:06:50 +08:00
|
|
|
|
<DatePicker Value="(DateTime?)filter.Value" TValue="DateTime?" ValueChanged="value => SetFilterValue(filter, value)"
|
|
|
|
|
PopupContainerSelector="@("#popup-container-for-" + Id)"
|
|
|
|
|
BoundaryAdjustMode="@TriggerBoundaryAdjustMode.None"/>
|
2021-09-02 12:34:30 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType.IsEnum)
|
|
|
|
|
{
|
2023-03-10 16:50:15 +08:00
|
|
|
|
<EnumSelect TEnum="TData" Mode="multiple"
|
|
|
|
|
@*Values="EnumHelper<TData>.Split(filter.Value)" workaround for https://github.com/ant-design-blazor/ant-design-blazor/issues/3006 *@
|
2021-09-10 19:06:50 +08:00
|
|
|
|
PopupContainerSelector="@("#popup-container-for-" + Id)"
|
|
|
|
|
Style="width:180px;"
|
|
|
|
|
ValuesChanged="value => SetFilterValue(filter, EnumHelper<TData>.Combine(value))"
|
|
|
|
|
BoundaryAdjustMode="@TriggerBoundaryAdjustMode.None"/>
|
2021-09-02 12:34:30 +08:00
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(byte))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(byte?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="byte?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(decimal))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(decimal?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="decimal?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(double))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(double?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="double?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(short))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(short?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="short?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(int))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(int?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="int?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(long))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(long?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="long?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(sbyte))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(sbyte?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="sbyte?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(float))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(float?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="float?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(ushort))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(ushort?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="ushort?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(uint))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(uint?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="uint?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(ulong))
|
|
|
|
|
{
|
|
|
|
|
<InputNumber Value="(ulong?)filter.Value" Formatter="number => NumberFormatter(number)" TValue="ulong?" ValueChanged="value => SetFilterValue(filter, value)"></InputNumber>
|
|
|
|
|
}
|
|
|
|
|
else if (_columnDataType == typeof(Guid))
|
|
|
|
|
{
|
|
|
|
|
<Input Value="(Guid?)filter.Value" TValue="Guid?" ValueChanged="value => SetFilterValue(filter, value)" />
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<Input TValue="TData" Value="(TData)filter.Value" ValueChanged="value => SetFilterValue(filter, value)" />
|
|
|
|
|
}
|
|
|
|
|
</Template>
|
|
|
|
|
;
|
2021-07-31 00:12:22 +08:00
|
|
|
|
}
|