TCB Filters Component
The CmsFiltersComponent is providing dynamic and responsive filtering functionality for Angular applications. It integrates with the CmsService and utilizes a GenericFiltersComponent to dynamically apply and reset filters for querying data.
How to use the component in your app :
import the component :
import {CmsFiltersComponent} from '@tradinos/cms-frontend-entity';The selector for component , like it :
<lib-cms-filters></lib-cms-filters>Features
Dynamic Filtering:
Leverages the
GenericFiltersComponentto dynamically apply filters based on user input.
Responsive Design:
Automatically adjusts to device screen size (e.g., tablet view) using Angular's
BreakpointObserver.
Filter Management:
Supports both applying filters and resetting filters, with seamless integration into the
CmsServicepipeline.
Observable Integration:
Listens to
applyFilters$andresetFilters$observables from theCmsServicefor filter events.
Inputs
This component does not declare explicit inputs via @Input(). Instead, it dynamically interacts with the CmsService and GenericFiltersComponent. However, the following dependencies are essential for its functionality:
cmsService(required):The service that manages query parameters, filter application, and reset logic.
GenericFiltersComponent(required):The dynamic component responsible for rendering and managing filter fields and user interactions.
Methods
1. ngOnInit(): void
Description:
Lifecycle hook that initializes the component.
Subscribes to screen size changes to determine if the device is a tablet.
Behavior:
Sets
isTablettotrueif the screen width is below 1200px.
2. applyFilters(): void
Description:
Retrieves the current filter values from the
GenericFiltersComponentand pushes them to thequeryParams$observable inCmsService.
Use Case:
Triggered when the user applies filters to update the data query.
3. resetFilters(value: boolean): void
Description:
Resets the filters in the
GenericFiltersComponentand optionally clears the query parameters in theCmsService.
Parameters:
value: Iftrue, clears all query parameters.
Last updated