MishkaGervaz.Form.Web.DataLoader.RelationLoader
(MishkaGervaz v0.0.1-alpha.3)
Copy Markdown
View Source
Loads options for relation/select fields in forms.
Follows the same pattern as MishkaGervaz.Table.Web.DataLoader.RelationLoader.
Modes
:static- Load all options at once (page: false):load_more- Paginated with load more button:search- Search with pagination (single select):search_multi- Search with pagination (multi select)
Action Resolution
For master users, tries :master_read → :read_any → :read.
For tenant users, uses :read with the user's site_id as tenant.
User Override
defmodule MyApp.Form.RelationLoader do
use MishkaGervaz.Form.Web.DataLoader.RelationLoader
def load_options(field, state, opts) do
super(field, state, opts)
end
endTop-level helpers (load_all_options/4, load_paginated_options/6,
build_options/4, prepend_nil_option/2, resolve_display_field/2,
resolve_load_action/3, get_tenant/1, maybe_apply_search/2,
maybe_apply_custom_load/3, resolve_selected_fallback/7) are public
so user overrides can reuse them — they live outside the __using__
macro to avoid per-consumer compile cost.
See MishkaGervaz.Form.Web.DataLoader,
MishkaGervaz.Form.Web.DataLoader.Helpers,
MishkaGervaz.Form.Web.State, and the sibling sub-builders
RecordLoader, TenantResolver, HookRunner. The table-side
counterpart is MishkaGervaz.Table.Web.DataLoader.RelationLoader.