mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 05:27:37 +08:00
82ef62b7a7
* fix: add @commitlint/config-conventional to devDependencies * feat: add basic table implementation * feat: continue adding definitions * feat: end of work in 20200414 * fix: add readonly to csssizelength * fix: warnings from table * fix: add ignorecase to csssizelength * feat: refactor table * feat: add simple table Co-authored-by: ElderJames <shunjiey@hotmail.com>
50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System;
|
|
using System.Linq.Expressions;
|
|
using System.Reflection;
|
|
using AntDesign.Internal;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class Column<TItem> : AntComponentBase, ITableColumn
|
|
{
|
|
[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> CellTemplate { 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);
|
|
}
|
|
}
|
|
}
|