AshReports.Layout.Grid (ash_reports v0.1.0)

A grid layout container that maps to Typst's grid() function.

Grids provide flexible layout capabilities with configurable columns and rows. Use grids for layout/presentation purposes where the arrangement itself doesn't convey tabular data semantics.

Example

grid :metrics_grid do
  columns 3
  rows 2
  gutter "5pt"

  label :label1 do
    text "Revenue"
  end

  label :label2 do
    text "Costs"
  end

  label :label3 do
    text "Profit"
  end

  field :revenue do
    source :total_revenue
    format :currency
  end

  field :costs do
    source :total_costs
    format :currency
  end

  field :profit do
    source :net_profit
    format :currency
  end
end

Summary

Types

alignment()

@type alignment() :: atom() | {atom(), atom()} | nil

t()

@type t() :: %AshReports.Layout.Grid{
  align: alignment(),
  column_gutter: String.t() | nil,
  columns: pos_integer() | [track_size()],
  elements: [map()],
  fill: String.t() | (integer(), integer() -> String.t()) | nil,
  grid_cells: [AshReports.Layout.GridCell.t()],
  gutter: String.t() | nil,
  inset: String.t() | nil,
  name: atom(),
  row_entities: [AshReports.Layout.Row.t()],
  row_gutter: String.t() | nil,
  rows: pos_integer() | [track_size()] | :auto | nil,
  stroke: String.t() | nil
}

track_size()

@type track_size() :: pos_integer() | String.t() | :auto | {:fr, number()}