View Source Backpex.Filter behaviour (Backpex v0.8.2)
The base behaviour for all filters. Injects also basic layout, form and delete button for a filters rendering.
Summary
Callbacks
Defines whether the filter can be used or not.
If no label is defined on the filter map, this value is used as the filter label.
The filter query that is executed if an option was selected.
Renders the filters selected value(s).
Renders the filters options form.
Callbacks
@callback can?(Phoenix.LiveView.Socket.assigns()) :: boolean()
Defines whether the filter can be used or not.
@callback label() :: String.t()
If no label is defined on the filter map, this value is used as the filter label.
@callback query(Ecto.Query.t(), any(), any()) :: Ecto.Query.t()
The filter query that is executed if an option was selected.
@callback render(Phoenix.LiveView.Socket.assigns()) :: Phoenix.LiveView.Rendered.t()
Renders the filters selected value(s).
@callback render_form(Phoenix.LiveView.Socket.assigns()) :: Phoenix.LiveView.Rendered.t()
Renders the filters options form.