Cinder.FilterManager (Cinder v0.2.0)
View SourceCoordinator for Cinder's modular filter system.
Acts as the main interface for filter operations while delegating to individual filter type modules for specific implementations.
Summary
Functions
Builds filter values map for form inputs using modular filter system.
Clears all filters from the filter state.
Clears a specific filter from the filter state.
Counts the number of active filters.
Renders an individual filter input by delegating to the appropriate filter module.
Checks if a filter has a meaningful value using modular system.
Infers filter configuration from Ash resource attribute definitions.
Transforms form values into structured filter objects using modular filter system.
Processes filter parameters from form submission using modular filter system.
Processes raw filter value using the appropriate filter module.
Renders filter controls for a list of columns.
Validates all registered custom filters at application startup.
Types
@type column() :: %{ field: String.t(), label: String.t(), filterable: boolean(), filter_type: filter_type(), filter_options: keyword() }
@type filter() :: %{type: filter_type(), value: filter_value(), operator: atom()}
@type filter_type() ::
:text
| :select
| :multi_select
| :multi_checkboxes
| :date_range
| :number_range
| :boolean
Functions
Builds filter values map for form inputs using modular filter system.
Clears all filters from the filter state.
Clears a specific filter from the filter state.
Counts the number of active filters.
Renders an individual filter input by delegating to the appropriate filter module.
Checks if a filter has a meaningful value using modular system.
Infers filter configuration from Ash resource attribute definitions.
Transforms form values into structured filter objects using modular filter system.
Processes filter parameters from form submission using modular filter system.
Processes raw filter value using the appropriate filter module.
This function is public to enable comprehensive testing of custom filter processing.
Renders filter controls for a list of columns.
Parameters
columns
- List of column definitionsfilters
- Current filter state maptheme
- Theme configurationtarget
- LiveComponent target for events
Returns
HEEx template for filter controls
Validates all registered custom filters at application startup.
This function should be called during application initialization to ensure all custom filters are properly implemented and available.
Returns
:ok if all filters are valid, logs warnings for any issues
Examples
# In your application.ex start/2 function
case Cinder.FilterManager.validate_runtime_filters() do
:ok -> :ok
{:error, _} -> :ok # Continue startup but log issues
end