Aurora. Uix. Action
(Aurora UIX v0.1.5)
Copy Markdown
Represents an action with a name and an associated function component.
Key Features
- Encapsulates an action's name and its function component.
- Provides flexible constructors for different input types.
Key Constraints
- The
:namemust be a binary. - The
:function_componentmust be a function.
Summary
Functions
Retrieves all the available actions group.
Retrieves every host-facing action option name, across all groups.
Retrieves the available actions for the given group.
Creates a new action from a tuple containing the name and function component.
Creates a new action from a name and a function component.
Types
Functions
@spec action_groups() :: [atom()]
Retrieves all the available actions group.
Returns
A list(atom()) with all the available actions groups.
@spec action_option_names() :: [atom()]
Retrieves every host-facing action option name, across all groups.
These are the keys a host writes in the layout DSL (add_header_action:, remove_row_action:,
…). Deriving the list here rather than from one group keeps callers that must recognise an action
option — such as the layout DSL, which evaluates their function captures at compile time — correct
when a new group is registered.
Returns
A list(atom()) with all the available action option names.
Retrieves the available actions for the given group.
Parameters
action_group(atom()) - Name of the group to retrieve.
Returns
A map() or nil if the group does not exists.
Creates a new action from a tuple containing the name and function component.
Parameters
{name, function_component}({binary(), function()}) - Tuple with the action name and function.
Returns
Aurora.Uix.Action.t() - An action struct with the given name and function component.
Examples
iex> Aurora.Uix.Action.new({"delete", fn -> :deleted end})
%Aurora.Uix.Action{name: "delete", function_component: #Function<...>}
Creates a new action from a name and a function component.
Parameters
name(atom()) - The name of the action.function_component(function()) - The function component to associate.
Returns
Aurora.Uix.Action.t() - An action struct with the given name and function component.
Examples
iex> Aurora.Uix.Action.new("save", fn -> :ok end)
%Aurora.Uix.Action{name: "save", function_component: #Function<...>}