/** * THE QUERY HALF of a per-column filter: the column shape, the value shape and * the mapping between them. `FilterChip column=` draws it; nothing here draws * anything, so a screen that only turns stored filter state into query * conditions imports no stylesheet. */ import type { SelectOption } from "./select"; /** * A column the picker can filter on. `type` selects the control + operators. * * `C` is the key's type — `string` by default, or the literal union of a * query's projected outputs (`AppQueryColumns[alias]` from the app SDK) when * the caller has one. It exists so a condition built here stays assignable to * a `useQuery` filter typed against its query; with a plain `string` key the * SDK's typed filter would refuse every node this helper produced. */ export interface FilterableColumn { key: C; label: string; type: "text" | "number" | "select"; /** Options for `type: "select"`. */ options?: SelectOption[]; } /** Controlled value of one column's filter — the canonical per-type input. */ export type ColumnFilterValue = { kind: "text"; query: string; } | { kind: "number"; min: number | null; max: number | null; } | { kind: "select"; selected: string[]; }; /** A `TableRecordFilters` condition node (the shape the app query RPC accepts). * `C` follows the column it was built from — see `FilterableColumn`. */ export interface FilterConditionNode { node_type: "condition"; field_key: C; type: "text" | "number" | "select"; operator: string; value: unknown; } /** * Map one column's filter value to query conditions (pure; reusable wherever a * column filter must become a `TableRecordFilters` predicate). Returns 0+ nodes * — a number range yields two, an empty filter yields none. */ export declare function columnFilterToConditions(column: FilterableColumn, value: ColumnFilterValue | undefined): FilterConditionNode[]; /** Whether a value represents an active (non-empty) filter — drives the pill state. */ export declare function isColumnFilterActive(value: ColumnFilterValue | undefined): boolean; /** A short human summary of an active value, for the pill label ("Vàng, Đỏ", "≥ 10"). */ export declare function columnFilterSummary(column: FilterableColumn, value: ColumnFilterValue | undefined): string;