AshReports.Layout.IR.Row (ash_reports v0.1.0)

Intermediate Representation for a row in a layout.

The RowIR represents a single row containing cells with shared row-level properties that can be inherited by cells.

Usage

row = AshReports.Layout.IR.Row.new(
  properties: %{align: :center},
  cells: [cell1, cell2, cell3]
)

Property Inheritance

Row properties can be inherited by cells. The inheritance chain is: grid/table -> row -> cell -> content

Summary

Functions

Adds a cell to the row.

Returns the number of cells in the row.

Gets a property from the row.

Creates a new RowIR struct with the given options.

Sets a property on the row.

Types

t()

@type t() :: %AshReports.Layout.IR.Row{
  cells: [AshReports.Layout.IR.Cell.t()],
  index: non_neg_integer(),
  properties: map()
}

Functions

add_cell(row, cell)

@spec add_cell(t(), AshReports.Layout.IR.Cell.t()) :: t()

Adds a cell to the row.

cell_count(row)

@spec cell_count(t()) :: non_neg_integer()

Returns the number of cells in the row.

get_property(row, key, default \\ nil)

@spec get_property(t(), atom(), any()) :: any()

Gets a property from the row.

new(opts \\ [])

@spec new(Keyword.t()) :: t()

Creates a new RowIR struct with the given options.

Options

  • :index - Row index (0-indexed, default: 0)
  • :properties - Map of row properties (align, fill, etc.)
  • :cells - List of CellIR items

Examples

iex> AshReports.Layout.IR.Row.new(index: 1, cells: [cell1, cell2])
%AshReports.Layout.IR.Row{index: 1, cells: [cell1, cell2], ...}

put_property(row, key, value)

@spec put_property(t(), atom(), any()) :: t()

Sets a property on the row.