import type { ColumnDef } from '../types/column.types'; import type { ColumnFilter, FilterModel, FilterSetOption } from '../types/filter.types'; import type { FiltersToolPanelConfig } from '../types/grid.types'; import type { IconRenderer } from '../icons/icon-renderer'; /** * Collaborators the {@link FiltersToolPanel} needs from the grid, injected so * the panel stays a pure-UI component that owns no grid state of its own. */ export interface FiltersToolPanelDeps { /** Renders themed, registry-backed icons (funnel, chevrons, add, close). */ readonly iconRenderer: IconRenderer; /** * Live, flat leaf column definitions (groups already flattened by the * `ColumnModel`). Used to populate the Add-Filter picker and to resolve a * `colId` from the filter model back to its column when reconciling. */ readonly getColumns: () => ColumnDef[]; /** Current applied filter model — drives the badge count and picker exclusions. */ readonly getFilterModel: () => FilterModel; /** * Lazily extracts unique value/label pairs for a set-type column's checkbox * list. Called only when a section is first expanded, so unexpanded columns * never pay the `allRows` scan. */ readonly getUniqueOptions: (colDef: ColumnDef) => FilterSetOption[]; /** * Write path — applies (or clears with `null`) a column's filter through the * grid's single {@link import('../engines/filter/filter-engine').FilterEngine}, * then re-runs the data pipeline. Keeps this panel, the header funnel and the * public API mutually consistent. */ readonly onFilterChange: (colId: string, filter: ColumnFilter | null) => void; } /** * The **Filters Tool Panel** — a filter funnel button anchored to the grid's * top-right corner that opens a floating panel for managing *all* column * filters in one place. * * The panel starts with an **Add Filter** action; choosing a column from its * searchable picker adds a collapsible section whose body is the exact same * condition/set filter editor used by the per-column header popup (both share * {@link FilterEditor}). Sections can be expanded/collapsed via a chevron and * removed via an ✕; the funnel button shows a badge with the active-filter * count. * * It is opt-in (`GridOptions.filtersToolPanel.enabled`) and pure UI: it never * filters rows itself, only calling {@link FiltersToolPanelDeps.onFilterChange} * and reflecting the model back via {@link syncFromModel}. Every visual is * class-driven — all colors, spacing, radii and typography come from theme CSS * variables (see `filters-tool-panel.css.ts`); the component sets no inline * styles. */ export declare class FiltersToolPanel { private readonly deps; private wrapperEl; private launcherEl; private launcherIconEl; private badgeEl; private panelEl; private sectionsEl; private emptyEl; private addBtnEl; private addDropdownEl; private isOpen; /** colId → section view-state, in insertion order. */ private readonly sections; /** * Guards {@link syncFromModel} against reacting to this panel's *own* writes: * while set, sync only refreshes the badge and skips section reconciliation, * so a user clearing a set-filter back to "all selected" (which drops the * column from the model) does not tear its own section down. */ private selfUpdating; private readonly boundOutsideDown; private readonly boundKeydown; constructor(deps: FiltersToolPanelDeps); /** * Builds the launcher button + panel and appends them to the grid wrapper. * Call once per grid instance. * * @param wrapperEl - The `.pg-grid` root element (the panel floats over it). * @param toolsBarEl - The shared `.pg-grid__tools` bar the launcher docks into * so it lays out beside other launchers instead of stacking. * @param config - Feature configuration (`defaultOpen` opens it immediately). */ mount(wrapperEl: HTMLElement, toolsBarEl: HTMLElement, config: FiltersToolPanelConfig): void; /** Opens the panel. Idempotent. */ open(): void; /** Closes the panel (and any open add-dropdown). Idempotent. */ close(): void; /** Toggles the panel open/closed. */ toggle(): void; /** * Reconciles the panel with an authoritative filter model — the single hook * the grid calls from its `store.watch('filterModel')`. Always refreshes the * badge/glyph; unless this panel is mid-write ({@link selfUpdating}), it also * adds sections for externally-applied filters (header funnel, public API, * Photon AI), refreshes any open editor whose value changed, and removes * sections whose applied filter was cleared elsewhere. * * @param model - The current applied filter model. */ syncFromModel(model: FilterModel): void; /** Removes the launcher + panel, disposes every section editor, detaches listeners. */ destroy(): void; private buildLauncher; private buildPanel; private toggleAddDropdown; private openAddDropdown; private closeAddDropdown; /** Renders the picker list: filterable columns without an existing section, filtered by `term`. */ private renderColumnList; /** Filterable leaf columns that do not already have a section. */ private getAvailableColumns; private addSection; private toggleSection; private expandSection; private collapseSection; /** ✕ handler: clears the column's filter through the grid and drops the section. */ private removeSection; /** Tears down a section's DOM + editor without touching the filter model. */ private disposeSection; private onSectionFilterChange; private updateBadge; private updateEmptyState; } //# sourceMappingURL=filters-tool-panel.d.ts.map