ant-design-blazor/components/table/ColumnContext.cs
2020-06-19 23:06:33 +08:00

40 lines
818 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace AntDesign
{
public class ColumnContext
{
public IList<IColumn> Columns { get; set; } = new List<IColumn>();
private int CurrentColIndex { get; set; }
public void AddHeaderColumn(IColumn column)
{
if (column == null)
{
return;
}
column.Index = CurrentColIndex++;
Columns.Add(column);
}
public void AddRowColumn(IColumn column)
{
if (column == null)
{
return;
}
if (++CurrentColIndex >= Columns.Count)
{
CurrentColIndex = 0;
}
column.Index = CurrentColIndex;
}
}
}