Masu.Layout (Masu v0.1.0)

Copy Markdown View Source

How a grid lays out its columns: their order, which are hidden, which are pinned to the start or the end, and their widths.

A grid starts with the layout of its :col slots (their order, and their hidden, pinned and width attributes), and changes it as the person moves, hides, pins and resizes columns. With the query (Masu.Query), it is the person's view (Masu.View).

The columns a grid shows are columns/2 of its layout: the pinned to the start first, then the others, then the pinned to the end, each in the layout's order, without the hidden ones.

Summary

Functions

Every column, with whether it is hidden and where it is pinned, in the order they show (the pinned to the start first, the pinned to the end last): for the columns menu.

Applies a change from the browser: any of "order" (every key, in order), "hidden" (keys), "pinned" (key to "start" or "end") and "widths" (key to pixels, merged into the widths there are). Keys of no column are left out; a grid always shows one column at least.

The columns that show, in their places: the pinned to the start, the others, the pinned to the end; each with its width and pin.

The layout made to fit the columns: the keys of columns that no longer exist are left out, and a column that the layout does not name (one added since it was saved) takes its declared place, as declared.

The layout of the columns as declared.

The layout as the browser gets it.

Types

pin()

@type pin() :: :start | :end

t()

@type t() :: %Masu.Layout{
  hidden: [String.t()],
  order: [String.t()],
  pinned: %{required(String.t()) => pin()},
  widths: %{required(String.t()) => pos_integer()}
}

Functions

all(layout, columns)

@spec all(t(), [Masu.Column.t()]) :: [Masu.Column.t()]

Every column, with whether it is hidden and where it is pinned, in the order they show (the pinned to the start first, the pinned to the end last): for the columns menu.

change(layout, params, columns)

@spec change(t(), map(), [Masu.Column.t()]) :: t()

Applies a change from the browser: any of "order" (every key, in order), "hidden" (keys), "pinned" (key to "start" or "end") and "widths" (key to pixels, merged into the widths there are). Keys of no column are left out; a grid always shows one column at least.

columns(layout, columns)

@spec columns(t(), [Masu.Column.t()]) :: [Masu.Column.t()]

The columns that show, in their places: the pinned to the start, the others, the pinned to the end; each with its width and pin.

fit(layout, columns)

@spec fit(t(), [Masu.Column.t()]) :: t()

The layout made to fit the columns: the keys of columns that no longer exist are left out, and a column that the layout does not name (one added since it was saved) takes its declared place, as declared.

new(columns)

@spec new([Masu.Column.t()]) :: t()

The layout of the columns as declared.

to_wire(layout)

@spec to_wire(t()) :: map()

The layout as the browser gets it.