mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-04 13:08:23 +08:00
7e7d63aaec
* refactor: add ChildContent and title for column * feat: add pagination and empty * feat(module: table): add officeial demo * fix: indent
53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System;
|
|
using System.Linq.Expressions;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class Column<TItem> : AntComponentBase, ITableColumn
|
|
{
|
|
[Parameter]
|
|
public string Title { get; set; }
|
|
|
|
[Parameter]
|
|
public TItem Field { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<TItem> FieldChanged { get; set; }
|
|
|
|
[Parameter]
|
|
public Expression<Func<TItem>> FieldExpression { get; set; }
|
|
|
|
[Parameter]
|
|
public bool Sort { get; set; }
|
|
|
|
[Parameter]
|
|
public RenderFragment<TItem> CellRender { get; set; }
|
|
|
|
[Parameter]
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
[CascadingParameter]
|
|
public ITable Table { get; set; }
|
|
|
|
[CascadingParameter(Name = "IsHeader")]
|
|
public bool IsHeader { get; set; }
|
|
|
|
private FieldIdentifier? _fieldIdentifier;
|
|
|
|
public string DisplayName => _fieldIdentifier?.GetDisplayName();
|
|
|
|
public string FieldName => _fieldIdentifier?.FieldName;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
if (FieldExpression != null)
|
|
{
|
|
_fieldIdentifier = FieldIdentifier.Create(FieldExpression);
|
|
}
|
|
|
|
Table?.AddColumn(this);
|
|
}
|
|
}
|
|
} |