import type { ColumnFilterConfig } from './dynamic-columns-shim'; import type { TableMetadata } from './types'; export interface UseDynamicFiltersOptions { /** * Static equality filters always applied (never shown as removable chips). * Mirrors DynamicTable's `defaultFilters` — e.g. scoping a board to one owner. */ defaultFilters?: Record; /** * Model key — the fallback base for the per-field `facets` endpoint when no * `endpoint` is given. Omit all of `endpoint`/`model`/`facetsEndpoint` to keep * text filters as bare "Contiene..." boxes. */ model?: string; /** * The org-scoped LIST endpoint (e.g. `/data//me`). The facets base is * derived from it EXACTLY like DynamicTable derives the aggregate endpoint — * `/facets` — so the board and its table sibling hit the same route * (the backend registers both `/data/:model/facets` and * `/data/:model/me/facets`). */ endpoint?: string; /** * Explicit `facets` endpoint override — wins over `endpoint`/`model`. The * loader appends `?field=&q=&limit=50`. */ facetsEndpoint?: string; } export interface UseDynamicFiltersResult { /** Per-field selected values, `filterKey → values[]` (empty = inactive). */ dynamicFilters: Record; /** Free-text search term (the toolbar search box). */ globalFilter: string; setGlobalFilter: (v: string) => void; /** Config for each filterable field, keyed by the metadata filter/column key. */ columnFilterConfigs: Map; /** * The serialized query params (`f_`, `search`, `search_columns`) ready to * spread into a `/data/:model` request. Stable object identity while inputs * are unchanged so a consumer can safely depend on it in a fetch effect. */ filterParams: Record; /** Apply a field's selection (replaces its values). */ handleDynamicFilterChange: (filterKey: string, values: string[]) => void; /** Count of fields with an active selection + the search term. */ activeFilterCount: number; /** Clear every field filter and the search term. */ clearAll: () => void; } /** * Reads the model's filter metadata and returns the live filter state + the * serialized request params. Pure of any view concern — DynamicTable adds its * own sort/pagination/`columnFilters`; DynamicKanban spreads `filterParams` * straight onto its single-page fetch. */ export declare function useDynamicFilters(metadata: TableMetadata | null, opts?: UseDynamicFiltersOptions): UseDynamicFiltersResult; //# sourceMappingURL=use-dynamic-filters.d.ts.map