diff --git a/components/table/Column.razor b/components/table/Column.razor index 3dfaef1f..93c4af64 100644 --- a/components/table/Column.razor +++ b/components/table/Column.razor @@ -18,6 +18,11 @@ else if (IsMeasure) } else if (IsColGroup) { + @if (AppendExpandColumn) + { + + } + if (Width != null) { @@ -29,6 +34,12 @@ else if (IsColGroup) } else if (IsHeader && HeaderColSpan != 0) { + + @if (AppendExpandColumn) + { + + } + @if (Sortable) { @@ -56,8 +67,20 @@ else if (!IsHeader && 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)) + { + + } + + } + - @if (ColIndex == 1 && Table.TreeMode) + @if (ColIndex == Table.TreeExpandIconColumnIndex && Table.TreeMode) { @if (RowData.HasChildren) diff --git a/components/table/ColumnBase.cs b/components/table/ColumnBase.cs index d26b5095..3d9f93a0 100644 --- a/components/table/ColumnBase.cs +++ b/components/table/ColumnBase.cs @@ -65,6 +65,8 @@ namespace AntDesign public int ColIndex { get; set; } + protected bool AppendExpandColumn => Table.HasExpandTemplate && ColIndex == (Table.TreeMode ? Table.TreeExpandIconColumnIndex : Table.ExpandIconColumnIndex); + protected string FixedStyle { get @@ -107,7 +109,7 @@ namespace AntDesign .GetIf(() => $"ant-table-cell-fix-{Fixed}", () => Fixed.IsIn("right", "left")) .If($"ant-table-cell-fix-right-first", () => Fixed == "right" && Context?.Columns.FirstOrDefault(x => x.Fixed == "right")?.ColIndex == this.ColIndex) .If($"ant-table-cell-fix-left-last", () => Fixed == "left" && Context?.Columns.LastOrDefault(x => x.Fixed == "left")?.ColIndex == this.ColIndex) - .If($"ant-table-cell-with-append", () => ColIndex == 1 && Table.TreeMode) + .If($"ant-table-cell-with-append", () => ColIndex == Table.TreeExpandIconColumnIndex && Table.TreeMode) .If($"ant-table-cell-ellipsis", () => Ellipsis) ; } diff --git a/components/table/ITable.cs b/components/table/ITable.cs index 11c6264a..877a33fb 100644 --- a/components/table/ITable.cs +++ b/components/table/ITable.cs @@ -1,4 +1,6 @@ -namespace AntDesign +using AntDesign.TableModels; + +namespace AntDesign { public interface ITable { @@ -14,6 +16,12 @@ internal int ScrollBarWidth { get; } + internal int ExpandIconColumnIndex { get; } + + internal int TreeExpandIconColumnIndex { get; } + + internal bool HasExpandTemplate { get; } + public TableLocale Locale { get; set; } internal void SelectionChanged(); @@ -33,5 +41,7 @@ internal void HasFixRight(); internal void TableLayoutIsFixed(); + + internal bool RowExpandable(RowData rowData); } } diff --git a/components/table/Table.razor b/components/table/Table.razor index 46922bf2..f9034711 100644 --- a/components/table/Table.razor +++ b/components/table/Table.razor @@ -108,10 +108,6 @@ @