Builds the grid columns from the :column slots of GanttEx.Live.Gantt.
Built-in fields get a translated label, a width, an alignment and an inline editor by default:
| Field | Label | Editor |
|---|---|---|
:text | Task name | :text |
:start_date | Start time | :date |
:end_date | End time | :date |
:duration | Duration | :number |
:progress | Progress | :progress |
:type | Type | :type |
:wbs | WBS | none |
:add | (add button) | none |
Any other field is read from the task :meta and is not editable unless an
editor is given. The tree is shown in the column marked with tree, or
in the :text column.
iex> labels = GanttEx.I18n.labels("en")
iex> columns = GanttEx.Live.Columns.build([], labels)
iex> Enum.map(columns, &{&1.field, &1.label, &1.tree})
[{:text, "Task name", true}, {:start_date, "Start time", false}, {:duration, "Duration", false}, {:add, "", false}]
iex> [owner] = GanttEx.Live.Columns.build([%{field: :owner_name}], labels, widths: %{"owner_name" => 150})
iex> {owner.label, owner.width, owner.editor, owner.tree}
{"Owner name", 150, nil, true}
Summary
Functions
Normalizes column slots (or the default columns when none are given).
Finds a column by its field sent as a string by the client.
Returns the sum of the column widths.
Types
Functions
Normalizes column slots (or the default columns when none are given).
Options
:widths- widths set by the user, keyed by the field as a string.:readonly- drops the:addcolumn.
Finds a column by its field sent as a string by the client.
@spec total_width([t()]) :: non_neg_integer()
Returns the sum of the column widths.