MishkaGervaz.Table.Entities.BulkAction (MishkaGervaz v0.0.1-alpha.3)

Copy Markdown View Source

Entity struct for bulk action configuration.

See MishkaGervaz.Table.Dsl.BulkActions, MishkaGervaz.Table.Entities.BulkAction.Ui, MishkaGervaz.Table.Entities.RowAction (per-row counterpart), MishkaGervaz.Table.Types.Action (type registry), and MishkaGervaz.Table.Web.Events.BulkActionHandler.

Summary

Functions

Transform the bulk action after DSL compilation.

Types

action_type()

@type action_type() :: :event | :destroy | :update | :unarchive | :permanent_destroy

handler()

@type handler() ::
  :parent
  | {:type, action_type()}
  | (list() | :all | {:all_except, list()}, map() ->
       {:ok, map()} | {:error, term()})
  | atom()
  | {atom(), atom()}

t()

@type t() :: %MishkaGervaz.Table.Entities.BulkAction{
  __identifier__: term(),
  __spark_metadata__: map() | nil,
  action: atom() | {atom(), atom()} | nil,
  confirm: boolean() | String.t() | nil,
  event: atom() | nil,
  handler: handler() | nil,
  name: atom(),
  payload: (MapSet.t() -> map()) | nil,
  restricted: boolean(),
  type: action_type() | nil,
  ui: MishkaGervaz.Table.Entities.BulkAction.Ui.t() | nil,
  visible: :active | :archived | (map() -> boolean())
}

Functions

transform(action)

Transform the bulk action after DSL compilation.

Two promotion rules apply, in order:

  1. If type: is set and handler: is still the default :parent, mark the handler as type-based: handler: {:type, type}.
  2. If handler: is one of the built-in type atoms (:event, :destroy, :update, :unarchive, :permanent_destroy), it is treated as a type token, not a literal Ash action name. This keeps type: :destroy and handler: :destroy behaving identically — both route through the master/tenant resolver.