Aurora. Uix. Templates. Basic. Actions. MultiSelect
(Aurora UIX v0.1.6-rc.4)
Copy Markdown
Provides helpers for managing multi-value select actions in Aurora UIX form layouts.
This module sets up and modifies actions for the three strips around the checkbox list that
represents a multi-value select: beside the label, at the top right, and below the list. It is the
scalar counterpart of Aurora.Uix.Templates.Basic.Actions.ManyToMany, which does the same for a
many-to-many membership.
Key Features
- Adds
:default_toggle_all, a tri-state checkbox rendered beside the group label: checked when every option is selected, unchecked when none is, and a dash when only some are. Clicking a checked toggle clears the selection; clicking it in either other state selects everything. - Registers empty header and footer groups, so a host always has an extension point above and below the checkbox list even though the library ships no default there.
- Integrates with the Aurora UIX action modification pipeline, so hosts add, insert, replace or remove actions from the layout DSL field options.
Key Constraints
- Actions render only for
layout_type: :form; every component falls back to~H""otherwise. - The toggle rides the parent form's
phx-change="validate"and is identified by_target(seeAurora.Uix.Templates.Basic.Handlers.FormImpl). It must not usephx-click: a click on a checkbox firesclickand thenchange, and the trailing change would re-validate with the pre-click selection and undo the toggle. - Its input name is deliberately outside the resource scope, so the toggle never reaches the
host's changeset or Ash action as an unknown key. It shares the
auix_toggle_all__prefix with the many-to-many toggle because both are resolved by the sameFormImplclause. - Expects the
assignsmap to include an:auixkey with:layout_type,:multi_select_toggle_stateand the layout tree options, plus the:fieldbeing rendered.
Summary
Functions
Sets up actions for the multi-value select field rendering layout by adding defaults and applying modifications.
Renders the tri-state checkbox that selects or clears every option.
Functions
Sets up actions for the multi-value select field rendering layout by adding defaults and applying modifications.
Parameters
assigns(map()) - Assigns map containing the layout tree and context.- Must include
:auixkey with required subkeys.
- Must include
Returns
map() - The updated assigns with actions set.
@spec toggle_all(map()) :: Phoenix.LiveView.Rendered.t()
Renders the tri-state checkbox that selects or clears every option.
Checked means every option is selected, unchecked means none is, and the mixed modifier paints a
dash for a partial selection. Only :all renders as checked, so clicking from either other state
selects everything.
Parameters
assigns(map()) - Assigns map containing the select context.- Must include
:auix(with:layout_typeand:multi_select_toggle_state) and:field.
- Must include
Returns
Phoenix.LiveView.Rendered.t() - Rendered checkbox component.