import { BaseGridPlugin, GridElement } from '../../core/plugin/base-plugin';
import { ColumnState } from '../../core/types';
import { FilterConfig, FilterModel } from './types';
/**
 * Filtering Plugin for tbw-grid
 *
 * Adds column header filters with text search, dropdown options, and custom filter panels.
 * Supports both **local filtering** for small datasets and **async handlers** for server-side
 * filtering on large datasets.
 *
 * ## Installation
 *
 * ```ts
 * import { FilteringPlugin } from '@toolbox-web/grid/plugins/filtering';
 * ```
 *
 * ## Configuration Options
 *
 * | Option | Type | Default | Description |
 * |--------|------|---------|-------------|
 * | `debounceMs` | `number` | `300` | Debounce delay for filter input |
 * | `caseSensitive` | `boolean` | `false` | Case-sensitive string matching |
 * | `trimInput` | `boolean` | `true` | Trim whitespace from filter input |
 * | `useWorker` | `boolean` | `true` | Use Web Worker for datasets >1000 rows |
 * | `filterPanelRenderer` | `FilterPanelRenderer` | - | Custom filter panel renderer |
 * | `valuesHandler` | `FilterValuesHandler` | - | Async handler to fetch unique filter values |
 * | `filterHandler` | `FilterHandler<TRow>` | - | Async handler to apply filters remotely |
 *
 * ## Column Configuration
 *
 * | Property | Type | Description |
 * |----------|------|-------------|
 * | `filterable` | `boolean` | Enable filtering for this column |
 * | `filterType` | `'text' \| 'select' \| 'number' \| 'date'` | Filter UI type |
 * | `filterOptions` | `unknown[]` | Predefined options for select filters |
 *
 * ## Programmatic API
 *
 * | Method | Signature | Description |
 * |--------|-----------|-------------|
 * | `setFilter` | `(field, value) => void` | Set filter value for a column |
 * | `getFilters` | `() => FilterModel[]` | Get all current filters |
 * | `clearFilters` | `() => void` | Clear all filters |
 * | `clearFilter` | `(field) => void` | Clear filter for a specific column |
 *
 * ## CSS Custom Properties
 *
 * | Property | Default | Description |
 * |----------|---------|-------------|
 * | `--tbw-filter-panel-bg` | `var(--tbw-color-panel-bg)` | Panel background |
 * | `--tbw-filter-panel-fg` | `var(--tbw-color-fg)` | Panel text color |
 * | `--tbw-filter-panel-border` | `var(--tbw-color-border)` | Panel border |
 * | `--tbw-filter-active-color` | `var(--tbw-color-accent)` | Active filter indicator |
 * | `--tbw-filter-input-bg` | `var(--tbw-color-bg)` | Input background |
 * | `--tbw-filter-input-focus` | `var(--tbw-color-accent)` | Input focus border |
 *
 * @example Basic Usage with Filterable Columns
 * ```ts
 * import '@toolbox-web/grid';
 * import { FilteringPlugin } from '@toolbox-web/grid/plugins/filtering';
 *
 * const grid = document.querySelector('tbw-grid');
 * grid.gridConfig = {
 *   columns: [
 *     { field: 'name', header: 'Name', filterable: true },
 *     { field: 'status', header: 'Status', filterable: true, filterType: 'select' },
 *     { field: 'email', header: 'Email', filterable: true },
 *   ],
 *   plugins: [new FilteringPlugin({ debounceMs: 300 })],
 * };
 * grid.rows = data;
 * ```
 *
 * @example Server-Side Filtering with Async Handlers
 * ```ts
 * new FilteringPlugin({
 *   // Fetch unique values from server for filter dropdown
 *   valuesHandler: async (field, column) => {
 *     const response = await fetch(`/api/distinct-values?field=${field}`);
 *     return response.json();
 *   },
 *   // Apply filters on the server
 *   filterHandler: async (filters, currentRows) => {
 *     const response = await fetch('/api/data', {
 *       method: 'POST',
 *       body: JSON.stringify({ filters }),
 *     });
 *     return response.json();
 *   },
 * });
 * ```
 *
 * @see {@link FilterConfig} for all configuration options
 * @see {@link FilterModel} for filter data structure
 * @see {@link FilterPanelParams} for custom panel renderer parameters
 *
 * @internal Extends BaseGridPlugin
 */
export declare class FilteringPlugin extends BaseGridPlugin<FilterConfig> {
    /** @internal */
    readonly name = "filtering";
    /** @internal */
    readonly styles: string;
    /** @internal */
    protected get defaultConfig(): Partial<FilterConfig>;
    /**
     * Check if filtering is enabled at the grid level.
     * Grid-wide `filterable: false` disables filtering for all columns.
     */
    private isFilteringEnabled;
    /**
     * Check if a specific column is filterable, respecting both grid-level and column-level settings.
     */
    private isColumnFilterable;
    private filters;
    private cachedResult;
    private cacheKey;
    private openPanelField;
    private panelElement;
    private panelAnchorElement;
    private searchText;
    private excludedValues;
    private panelAbortController;
    private globalStylesInjected;
    private static readonly DEFAULT_LIST_ITEM_HEIGHT;
    private static readonly LIST_OVERSCAN;
    private static readonly LIST_BYPASS_THRESHOLD;
    /**
     * Get the item height from CSS variable or fallback to default.
     * Reads --tbw-filter-item-height from the panel element.
     */
    private getListItemHeight;
    /**
     * Sync excludedValues map from a filter model (for set filters).
     */
    private syncExcludedValues;
    /** @internal */
    attach(grid: GridElement): void;
    /** @internal */
    detach(): void;
    /** @internal */
    processRows(rows: readonly unknown[]): unknown[];
    /** @internal */
    afterRender(): void;
    /**
     * Set a filter on a specific field.
     * Pass null to remove the filter.
     */
    setFilter(field: string, filter: Omit<FilterModel, 'field'> | null): void;
    /**
     * Get the current filter for a field.
     */
    getFilter(field: string): FilterModel | undefined;
    /**
     * Get all active filters.
     */
    getFilters(): FilterModel[];
    /**
     * Alias for getFilters() to match functional API naming.
     */
    getFilterModel(): FilterModel[];
    /**
     * Set filters from an array (replaces all existing filters).
     */
    setFilterModel(filters: FilterModel[]): void;
    /**
     * Clear all filters.
     */
    clearAllFilters(): void;
    /**
     * Clear filter for a specific field.
     */
    clearFieldFilter(field: string): void;
    /**
     * Check if a field has an active filter.
     */
    isFieldFiltered(field: string): boolean;
    /**
     * Get the count of filtered rows (from cache).
     */
    getFilteredRowCount(): number;
    /**
     * Get all active filters (alias for getFilters).
     */
    getActiveFilters(): FilterModel[];
    /**
     * Get unique values for a field (for set filter dropdowns).
     * Uses sourceRows to include all values regardless of current filter.
     */
    getUniqueValues(field: string): unknown[];
    /**
     * Copy CSS classes and data attributes from grid to filter panel.
     * This ensures theme classes (e.g., .eds-theme) cascade to the panel.
     */
    private copyGridThemeContext;
    /**
     * Inject global styles for filter panel (rendered in document.body)
     */
    private injectGlobalStyles;
    /**
     * Toggle the filter panel for a field
     */
    private toggleFilterPanel;
    /**
     * Render filter panel content with given values
     */
    private renderPanelContent;
    /**
     * Setup click-outside handler to close the panel
     */
    private setupPanelCloseHandler;
    /**
     * Close the filter panel
     */
    private closeFilterPanel;
    /** Cache for CSS anchor positioning support check */
    private static supportsAnchorPositioning;
    /**
     * Check if browser supports CSS Anchor Positioning
     */
    private static checkAnchorPositioningSupport;
    /**
     * Position the panel below the header cell
     * Uses CSS Anchor Positioning if supported, falls back to JS positioning
     */
    private positionPanel;
    /**
     * Render the default filter panel content
     */
    private renderDefaultFilterPanel;
    /**
     * Render a number range filter panel with min/max inputs and slider
     */
    private renderNumberFilterPanel;
    /**
     * Render a date range filter panel with from/to date inputs
     */
    private renderDateFilterPanel;
    /**
     * Apply a set filter (exclude values)
     */
    private applySetFilter;
    /**
     * Apply a text/number/date filter
     */
    private applyTextFilter;
    /**
     * Internal method to apply filters (sync or async based on config)
     */
    private applyFiltersInternal;
    /**
     * Return filter state for a column if it has an active filter.
     * @internal
     */
    getColumnState(field: string): Partial<ColumnState> | undefined;
    /**
     * Apply filter state from column state.
     * @internal
     */
    applyColumnState(field: string, state: ColumnState): void;
}
//# sourceMappingURL=FilteringPlugin.d.ts.map