MishkaGervaz.Form.Entities.Step (MishkaGervaz v0.0.1-alpha.2)

Copy Markdown View Source

Wizard / tabs step — a named bundle of groups with optional navigation guards.

Steps reference groups (which in turn reference fields), so the form hierarchy reads step → groups → fields. Steps appear inside the layout block when mode: :wizard or mode: :tabs. They support on_enter / before_leave / after_leave lifecycle callbacks (where before_leave can return {:halt, state} to block navigation), an optional action for inline validation, and a summary flag for read-only review steps.

Example

layout do
  mode :wizard
  navigation :sequential
  persistence :ets

  step :details do
    groups [:basic, :meta]
    action :validate_details

    on_enter fn state -> state end
    before_leave fn state -> state end

    ui do
      label "Details"
      icon "hero-information-circle"
    end
  end

  step :review do
    groups [:flags]
    summary true
  end
end

See MishkaGervaz.Form.Dsl.Layout for the surrounding section and MishkaGervaz.Form.Entities.Step.Ui for the ui sub-entity.

Summary

Functions

Transform the step after DSL compilation. Unwraps the singleton ui sub-entity from the parser's list wrapper.

Types

t()

@type t() :: %MishkaGervaz.Form.Entities.Step{
  __identifier__: atom() | nil,
  __spark_metadata__: map() | nil,
  action: atom() | nil,
  after_leave: (map() -> map()) | nil,
  before_leave: (map() -> map()) | nil,
  groups: [atom()],
  name: atom(),
  on_enter: (map() -> map()) | nil,
  summary: boolean(),
  ui: MishkaGervaz.Form.Entities.Step.Ui.t() | nil,
  visible: boolean() | (map() -> boolean())
}

Functions

transform(step)

Transform the step after DSL compilation. Unwraps the singleton ui sub-entity from the parser's list wrapper.