MishkaGervaz.Form.Entities.AutoFields (MishkaGervaz v0.0.1-alpha.3)

Copy Markdown View Source

Auto-discover form fields from the resource's public Ash attributes.

Use inside the fields section to bring in every public attribute as a field, with except / only to scope the set, defaults and ui_defaults to set baseline behaviour, and override :name do … end for per-field tweaks. Auto fields are appended at :end (default) or prepended at :start so explicit field declarations keep their position.

Example

fields do
  field :title, :text, required: true

  auto_fields do
    except [:id, :internal_only]
    position :end

    defaults required: false, visible: true

    override :age, type: :range, required: true

    override :bio do
      ui do
        label "Biography"
        rows 8
      end
    end
  end
end

See MishkaGervaz.Form.Dsl.Fields for the surrounding section, and the sub-modules below for defaults, ui_defaults, and override.

Summary

Types

t()

@type t() :: %MishkaGervaz.Form.Entities.AutoFields{
  __spark_metadata__: map() | nil,
  defaults: MishkaGervaz.Form.Entities.AutoFields.Defaults.t() | nil,
  except: [atom()],
  only: [atom()] | nil,
  overrides: [MishkaGervaz.Form.Entities.AutoFields.Override.t()],
  position: :start | :end,
  ui_defaults: MishkaGervaz.Form.Entities.AutoFields.UiDefaults.t() | nil
}

Functions

transform(auto_fields)