Add support for aligning tables

This commit is contained in:
Patrik Svensson
2020-10-21 17:59:55 +02:00
committed by Patrik Svensson
parent b52056ee49
commit 9afc1ea721
17 changed files with 542 additions and 132 deletions

View File

@ -27,7 +27,7 @@ namespace Spectre.Console
throw new ArgumentNullException(nameof(text));
}
return SetHeader(panel, new Title(text, style, alignment));
return SetHeader(panel, new PanelHeader(text, style, alignment));
}
/// <summary>
@ -36,7 +36,7 @@ namespace Spectre.Console
/// <param name="panel">The panel.</param>
/// <param name="header">The header to use.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static Panel SetHeader(this Panel panel, Title header)
public static Panel SetHeader(this Panel panel, PanelHeader header)
{
if (panel is null)
{

View File

@ -183,9 +183,8 @@ namespace Spectre.Console
/// <param name="table">The table.</param>
/// <param name="text">The heading.</param>
/// <param name="style">The style.</param>
/// <param name="alignment">The alignment.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table SetHeading(this Table table, string text, Style? style = null, Justify? alignment = null)
public static Table SetHeading(this Table table, string text, Style? style = null)
{
if (table is null)
{
@ -197,7 +196,7 @@ namespace Spectre.Console
throw new ArgumentNullException(nameof(text));
}
return SetHeading(table, new Title(text, style, alignment));
return SetHeading(table, new TableTitle(text, style));
}
/// <summary>
@ -206,7 +205,7 @@ namespace Spectre.Console
/// <param name="table">The table.</param>
/// <param name="heading">The heading.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table SetHeading(this Table table, Title heading)
public static Table SetHeading(this Table table, TableTitle heading)
{
if (table is null)
{
@ -223,9 +222,8 @@ namespace Spectre.Console
/// <param name="table">The table.</param>
/// <param name="text">The footnote.</param>
/// <param name="style">The style.</param>
/// <param name="alignment">The alignment.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table SetFootnote(this Table table, string text, Style? style = null, Justify? alignment = null)
public static Table SetFootnote(this Table table, string text, Style? style = null)
{
if (table is null)
{
@ -237,7 +235,7 @@ namespace Spectre.Console
throw new ArgumentNullException(nameof(text));
}
return SetFootnote(table, new Title(text, style, alignment));
return SetFootnote(table, new TableTitle(text, style));
}
/// <summary>
@ -246,7 +244,7 @@ namespace Spectre.Console
/// <param name="table">The table.</param>
/// <param name="footnote">The footnote.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static Table SetFootnote(this Table table, Title footnote)
public static Table SetFootnote(this Table table, TableTitle footnote)
{
if (table is null)
{