mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-12-29 20:05:48 +08:00
Add column support
Adds support for rendering arbitrary data into columns. Closes #67
This commit is contained in:
committed by
Patrik Svensson
parent
e946289bd9
commit
ae6d2c63a3
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user