Add column support

Adds support for rendering arbitrary data into columns.

Closes #67
This commit is contained in:
Patrik Svensson
2020-09-04 01:34:31 +02:00
committed by Patrik Svensson
parent e946289bd9
commit ae6d2c63a3
19 changed files with 340 additions and 35 deletions

View File

@@ -7,7 +7,7 @@ namespace Spectre.Console
/// <summary>
/// A renderable grid.
/// </summary>
public sealed class Grid : Renderable
public sealed class Grid : Renderable, IExpandable
{
private readonly Table _table;
@@ -21,6 +21,13 @@ namespace Spectre.Console
/// </summary>
public int RowCount => _table.RowCount;
/// <inheritdoc/>
public bool Expand
{
get => _table.Expand;
set => _table.Expand = value;
}
/// <summary>
/// Initializes a new instance of the <see cref="Grid"/> class.
/// </summary>
@@ -94,11 +101,6 @@ namespace Spectre.Console
throw new ArgumentNullException(nameof(columns));
}
if (columns.Length < _table.ColumnCount)
{
throw new InvalidOperationException("The number of row columns are less than the number of grid columns.");
}
if (columns.Length > _table.ColumnCount)
{
throw new InvalidOperationException("The number of row columns are greater than the number of grid columns.");