Skip to content
ConsoleMonster
Class

GroupedRows<T>

ConsoleMonster.Frames

Namespace
ConsoleMonster.Frames
Assembly
ConsoleMonster
Implements
IWidget
Modifiers
sealed

A detail table grouped by a key. Every group shares one column layout; group headings carry their own rollup. Long single-column tables repeat their header; wide terminals flow groups into columns without splitting a group. Healthy rows collapse into the group heading in large sections, and rows stop at the length's cap with +N more.

Inheritance

  • object
  • GroupedRows<T>

Type Parameters

T
The row type.

Constructors

public GroupedRows<T>(IEnumerable<T?> items, Func<T?, string> group, FrameScale scale) #

Creates grouped rows.

Parameters

items System.Collections.Generic.IEnumerable<T?> required
The rows, already in display order within each group.
group System.Func<T?, string> required
The group key; groups appear in first-seen order.
scale ConsoleMonster.Frames.FrameScale required
The frame's scale, from the section context.

Methods

public Size Measure(Constraints constraints, RenderContext context) #

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints required
The space offered.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Returns

Size The desired size, never larger than the constraints.
public void Render(Region region, RenderContext context) #

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region required
The target region.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Properties

public IList<GroupedColumn<T?>> Columns { get; } #

The columns.

public Func<string, IReadOnlyList<T?>, GroupHeading>? Heading { get; set; } #

Builds a group's heading; null shows the key only.

public Func<T?, bool>? IsHealthy { get; set; } #

Whether a row is healthy, for collapsing large sections; null never collapses.

public string Noun { get; set; } #

The singular noun for rows, for +N more and collapsed counts.

public string? PluralNoun { get; set; } #

The plural noun; null adds an s.

public string HealthyWord { get; set; } #

The word for collapsed healthy rows (default healthy).