mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-20 05:48:14 +08:00
Add option to show separator between table rows (#1304)
* Add option to show separator between table rows * Panels should show header if borders are not shown Closes #835
This commit is contained in:
@ -114,4 +114,24 @@ public enum TableBorderPart
|
||||
/// The bottom right part of a footer.
|
||||
/// </summary>
|
||||
FooterBottomRight,
|
||||
|
||||
/// <summary>
|
||||
/// The left part of a row.
|
||||
/// </summary>
|
||||
RowLeft,
|
||||
|
||||
/// <summary>
|
||||
/// The center part of a row.
|
||||
/// </summary>
|
||||
RowCenter,
|
||||
|
||||
/// <summary>
|
||||
/// The separator part of a row.
|
||||
/// </summary>
|
||||
RowSeparator,
|
||||
|
||||
/// <summary>
|
||||
/// The right part of a row.
|
||||
/// </summary>
|
||||
RowRight,
|
||||
}
|
@ -32,6 +32,10 @@ public sealed class Ascii2TableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "-",
|
||||
TableBorderPart.FooterBottomSeparator => "+",
|
||||
TableBorderPart.FooterBottomRight => "+",
|
||||
TableBorderPart.RowLeft => "|",
|
||||
TableBorderPart.RowCenter => "-",
|
||||
TableBorderPart.RowSeparator => "+",
|
||||
TableBorderPart.RowRight => "|",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class AsciiDoubleHeadTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "-",
|
||||
TableBorderPart.FooterBottomSeparator => "+",
|
||||
TableBorderPart.FooterBottomRight => "+",
|
||||
TableBorderPart.RowLeft => "|",
|
||||
TableBorderPart.RowCenter => "-",
|
||||
TableBorderPart.RowSeparator => "+",
|
||||
TableBorderPart.RowRight => "|",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class AsciiTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "-",
|
||||
TableBorderPart.FooterBottomSeparator => "-",
|
||||
TableBorderPart.FooterBottomRight => "+",
|
||||
TableBorderPart.RowLeft => "|",
|
||||
TableBorderPart.RowCenter => "-",
|
||||
TableBorderPart.RowSeparator => "+",
|
||||
TableBorderPart.RowRight => "|",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class DoubleEdgeTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "═",
|
||||
TableBorderPart.FooterBottomSeparator => "╧",
|
||||
TableBorderPart.FooterBottomRight => "╝",
|
||||
TableBorderPart.RowLeft => "╟",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "┼",
|
||||
TableBorderPart.RowRight => "╢",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class DoubleTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "═",
|
||||
TableBorderPart.FooterBottomSeparator => "╩",
|
||||
TableBorderPart.FooterBottomRight => "╝",
|
||||
TableBorderPart.RowLeft => "╠",
|
||||
TableBorderPart.RowCenter => "═",
|
||||
TableBorderPart.RowSeparator => "╬",
|
||||
TableBorderPart.RowRight => "╣",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ public sealed class HeavyEdgeTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "━",
|
||||
TableBorderPart.FooterBottomSeparator => "┷",
|
||||
TableBorderPart.FooterBottomRight => "┛",
|
||||
TableBorderPart.RowLeft => "┠",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "┼",
|
||||
TableBorderPart.RowRight => "┨",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ public sealed class HeavyHeadTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "─",
|
||||
TableBorderPart.FooterBottomSeparator => "┴",
|
||||
TableBorderPart.FooterBottomRight => "┘",
|
||||
TableBorderPart.RowLeft => "├",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "┼",
|
||||
TableBorderPart.RowRight => "┤",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ public sealed class HeavyTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "━",
|
||||
TableBorderPart.FooterBottomSeparator => "┻",
|
||||
TableBorderPart.FooterBottomRight => "┛",
|
||||
TableBorderPart.RowLeft => "┣",
|
||||
TableBorderPart.RowCenter => "━",
|
||||
TableBorderPart.RowSeparator => "╋",
|
||||
TableBorderPart.RowRight => "┫",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class HorizontalTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "─",
|
||||
TableBorderPart.FooterBottomSeparator => "─",
|
||||
TableBorderPart.FooterBottomRight => "─",
|
||||
TableBorderPart.RowLeft => "─",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "─",
|
||||
TableBorderPart.RowRight => "─",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ namespace Spectre.Console.Rendering;
|
||||
/// </summary>
|
||||
public sealed class MarkdownTableBorder : TableBorder
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override bool SupportsRowSeparator => false;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string GetPart(TableBorderPart part)
|
||||
{
|
||||
@ -32,6 +35,10 @@ public sealed class MarkdownTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => " ",
|
||||
TableBorderPart.FooterBottomSeparator => " ",
|
||||
TableBorderPart.FooterBottomRight => " ",
|
||||
TableBorderPart.RowLeft => " ",
|
||||
TableBorderPart.RowCenter => " ",
|
||||
TableBorderPart.RowSeparator => " ",
|
||||
TableBorderPart.RowRight => " ",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class MinimalDoubleHeadTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => " ",
|
||||
TableBorderPart.FooterBottomSeparator => " ",
|
||||
TableBorderPart.FooterBottomRight => " ",
|
||||
TableBorderPart.RowLeft => " ",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "┼",
|
||||
TableBorderPart.RowRight => " ",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ public sealed class MinimalHeavyHeadTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => " ",
|
||||
TableBorderPart.FooterBottomSeparator => " ",
|
||||
TableBorderPart.FooterBottomRight => " ",
|
||||
TableBorderPart.RowLeft => " ",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "┼",
|
||||
TableBorderPart.RowRight => " ",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class MinimalTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => " ",
|
||||
TableBorderPart.FooterBottomSeparator => " ",
|
||||
TableBorderPart.FooterBottomRight => " ",
|
||||
TableBorderPart.RowLeft => " ",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "┼",
|
||||
TableBorderPart.RowRight => " ",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -8,6 +8,9 @@ public sealed class NoTableBorder : TableBorder
|
||||
/// <inheritdoc/>
|
||||
public override bool Visible => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool SupportsRowSeparator => false;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string GetPart(TableBorderPart part)
|
||||
{
|
||||
|
@ -35,6 +35,10 @@ public sealed class RoundedTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "─",
|
||||
TableBorderPart.FooterBottomSeparator => "┴",
|
||||
TableBorderPart.FooterBottomRight => "╯",
|
||||
TableBorderPart.RowLeft => "├",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "┼",
|
||||
TableBorderPart.RowRight => "┤",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ public sealed class SimpleHeavyTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => " ",
|
||||
TableBorderPart.FooterBottomSeparator => " ",
|
||||
TableBorderPart.FooterBottomRight => " ",
|
||||
TableBorderPart.RowLeft => "─",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "─",
|
||||
TableBorderPart.RowRight => "─",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class SimpleTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => " ",
|
||||
TableBorderPart.FooterBottomSeparator => " ",
|
||||
TableBorderPart.FooterBottomRight => " ",
|
||||
TableBorderPart.RowLeft => "─",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "─",
|
||||
TableBorderPart.RowRight => "─",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public sealed class SquareTableBorder : TableBorder
|
||||
TableBorderPart.FooterBottom => "─",
|
||||
TableBorderPart.FooterBottomSeparator => "┴",
|
||||
TableBorderPart.FooterBottomRight => "┘",
|
||||
TableBorderPart.RowLeft => "├",
|
||||
TableBorderPart.RowCenter => "─",
|
||||
TableBorderPart.RowSeparator => "┼",
|
||||
TableBorderPart.RowRight => "┤",
|
||||
_ => throw new InvalidOperationException("Unknown border part."),
|
||||
};
|
||||
}
|
||||
|
@ -15,6 +15,11 @@ public enum TablePart
|
||||
/// </summary>
|
||||
HeaderSeparator,
|
||||
|
||||
/// <summary>
|
||||
/// The separator between the rows.
|
||||
/// </summary>
|
||||
RowSeparator,
|
||||
|
||||
/// <summary>
|
||||
/// The separator between the footer and the cells.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user