Add support for table footers

This commit is contained in:
Patrik Svensson
2020-10-24 17:15:19 +02:00
committed by Patrik Svensson
parent c9c0ad733f
commit 03334f693d
31 changed files with 504 additions and 132 deletions

View File

@ -60,6 +60,26 @@ namespace Spectre.Console.Rendering
/// </summary>
HeaderBottomRight,
/// <summary>
/// The top left part of a footer.
/// </summary>
FooterTopLeft,
/// <summary>
/// The top part of a footer.
/// </summary>
FooterTop,
/// <summary>
/// The top separator part of a footer.
/// </summary>
FooterTopSeparator,
/// <summary>
/// The top right part of a footer.
/// </summary>
FooterTopRight,
/// <summary>
/// The left part of a cell.
/// </summary>

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "|",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "|",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "+",

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "+",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "+",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "+",

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "|",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "|",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "-",

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "║",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => "║",
TableBorderPart.FooterTopLeft => "╟",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "┼",
TableBorderPart.FooterTopRight => "╢",
TableBorderPart.FooterBottomLeft => "╚",
TableBorderPart.FooterBottom => "═",
TableBorderPart.FooterBottomSeparator => "╧",

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "║",
TableBorderPart.CellSeparator => "║",
TableBorderPart.CellRight => "║",
TableBorderPart.FooterTopLeft => "╠",
TableBorderPart.FooterTop => "═",
TableBorderPart.FooterTopSeparator => "╬",
TableBorderPart.FooterTopRight => "╣",
TableBorderPart.FooterBottomLeft => "╚",
TableBorderPart.FooterBottom => "═",
TableBorderPart.FooterBottomSeparator => "╩",

View File

@ -29,6 +29,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "┃",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => "┃",
TableBorderPart.FooterTopLeft => "┠",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "┼",
TableBorderPart.FooterTopRight => "┨",
TableBorderPart.FooterBottomLeft => "┗",
TableBorderPart.FooterBottom => "━",
TableBorderPart.FooterBottomSeparator => "┷",

View File

@ -29,6 +29,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "│",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => "│",
TableBorderPart.FooterTopLeft => "├",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "┼",
TableBorderPart.FooterTopRight => "┤",
TableBorderPart.FooterBottomLeft => "└",
TableBorderPart.FooterBottom => "─",
TableBorderPart.FooterBottomSeparator => "┴",

View File

@ -29,6 +29,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "┃",
TableBorderPart.CellSeparator => "┃",
TableBorderPart.CellRight => "┃",
TableBorderPart.FooterTopLeft => "┣",
TableBorderPart.FooterTop => "━",
TableBorderPart.FooterTopSeparator => "╋",
TableBorderPart.FooterTopRight => "┫",
TableBorderPart.FooterBottomLeft => "┗",
TableBorderPart.FooterBottom => "━",
TableBorderPart.FooterBottomSeparator => "┻",

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "─",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "─",
TableBorderPart.FooterTopRight => "─",
TableBorderPart.FooterBottomLeft => "─",
TableBorderPart.FooterBottom => "─",
TableBorderPart.FooterBottomSeparator => "─",

View File

@ -29,6 +29,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => " ",
TableBorderPart.FooterTopSeparator => " ",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
@ -40,7 +44,12 @@ namespace Spectre.Console.Rendering
/// <inheritdoc/>
public override string GetColumnRow(TablePart part, IReadOnlyList<int> widths, IReadOnlyList<IColumn> columns)
{
if (part != TablePart.Separator)
if (part == TablePart.FooterSeparator)
{
return string.Empty;
}
if (part != TablePart.HeaderSeparator)
{
return base.GetColumnRow(part, widths, columns);
}

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "═",
TableBorderPart.FooterTopSeparator => "╪",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",

View File

@ -29,6 +29,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "━",
TableBorderPart.FooterTopSeparator => "┿",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "┼",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",

View File

@ -29,6 +29,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "│",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => "│",
TableBorderPart.FooterTopLeft => "├",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "┼",
TableBorderPart.FooterTopRight => "┤",
TableBorderPart.FooterBottomLeft => "╰",
TableBorderPart.FooterBottom => "─",
TableBorderPart.FooterBottomSeparator => "┴",

View File

@ -29,6 +29,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "━",
TableBorderPart.FooterTop => "━",
TableBorderPart.FooterTopSeparator => "━",
TableBorderPart.FooterTopRight => "━",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "─",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "─",
TableBorderPart.FooterTopRight => "─",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",

View File

@ -26,6 +26,10 @@ namespace Spectre.Console.Rendering
TableBorderPart.CellLeft => "│",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => "│",
TableBorderPart.FooterTopLeft => "├",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "┼",
TableBorderPart.FooterTopRight => "┤",
TableBorderPart.FooterBottomLeft => "└",
TableBorderPart.FooterBottom => "─",
TableBorderPart.FooterBottomSeparator => "┴",

View File

@ -13,7 +13,12 @@ namespace Spectre.Console.Rendering
/// <summary>
/// The separator between the header and the cells.
/// </summary>
Separator,
HeaderSeparator,
/// <summary>
/// The separator between the footer and the cells.
/// </summary>
FooterSeparator,
/// <summary>
/// The bottom of a table.