import { BlankMode, FilterModel } from '@toolbox-web/grid/plugins/filtering'; export type { _Augmentation as _FilteringAugmentation } from '@toolbox-web/grid/features/filtering'; /** * Filtering methods returned from useGridFiltering. */ export interface FilteringMethods { /** * Set a filter on a specific field. * @param field - The field name to filter * @param filter - Filter configuration, or null to remove * @param options - `{ silent: true }` applies the filter without emitting `filter-change` */ setFilter: (field: string, filter: Omit | null, options?: { silent?: boolean; }) => void; /** * Get the current filter for a field. */ getFilter: (field: string) => FilterModel | undefined; /** * Get all active filters. */ getFilters: () => FilterModel[]; /** * Set all filters at once (replaces existing). * @param options - `{ silent: true }` applies filters without emitting `filter-change` */ setFilterModel: (filters: FilterModel[], options?: { silent?: boolean; }) => void; /** * Clear all active filters. * @param options - `{ silent: true }` clears filters without emitting `filter-change` */ clearAllFilters: (options?: { silent?: boolean; }) => void; /** * Clear filter for a specific field. * @param options - `{ silent: true }` clears filter without emitting `filter-change` */ clearFieldFilter: (field: string, options?: { silent?: boolean; }) => void; /** * Check if a field has an active filter. */ isFieldFiltered: (field: string) => boolean; /** * Get the count of rows after filtering. */ getFilteredRowCount: () => number; /** * Get unique values for a field (for building filter dropdowns). */ getUniqueValues: (field: string) => unknown[]; /** * Get set filters whose values no longer match any rows in the current data. */ getStaleFilters: () => FilterModel[]; /** * Get the current blank mode for a field. */ getBlankMode: (field: string) => BlankMode; /** * Toggle blank filter mode for a field. */ toggleBlankFilter: (field: string, mode: BlankMode) => void; } /** * Hook for programmatic filter control. * * Must be used within a DataGrid component tree with filtering enabled. * * @example * ```tsx * import { useGridFiltering } from '@toolbox-web/grid-react/features/filtering'; * * function QuickFilters() { * const { setFilter, clearAllFilters, getFilteredRowCount, isFieldFiltered } = useGridFiltering(); * * return ( *
* setFilter('name', e.target.value ? { operator: 'contains', value: e.target.value } : null)} * /> * {getFilteredRowCount()} rows * *
* ); * } * ``` * @param selector - Optional CSS selector to target a specific grid element via * DOM query instead of using React context. Use when the component contains * multiple grids, e.g. `'tbw-grid.primary'` or `'#my-grid'`. */ export declare function useGridFiltering(selector?: string): FilteringMethods; //# sourceMappingURL=filtering.d.ts.map