import type { SelectOption } from "./select"; /** * The units or currencies a figure is read in, row by row — the options of the select on its row * that names each row's (`useFieldOptions(alias).units.` passes whole). A range on such a * figure compares in one of them. */ export interface FilterUnits { vocabulary: "unit" | "currency"; options: readonly { key: string; label: string; }[]; } /** * `type` selects the control and operators. `C` is the key type — a query's projected output union * when the caller has one, so conditions stay assignable to a typed `useQuery` filter. */ export interface FilterableColumn { key: C; label: string; type: "text" | "number" | "select"; options?: SelectOption[]; /** * A number read in each row's own unit or currency: the range is typed in one of these, picked * beside it, and keeps only the rows in that unit (a measured unit's kin converted). Omitted for * a figure read in one unit for every row. */ units?: FilterUnits; } /** A number range's `unit` is an option key of the column's `units`; unset, their first. */ export type ColumnFilterValue = { kind: "text"; query: string; } | { kind: "number"; min: number | null; max: number | null; unit?: string; } | { kind: "select"; selected: string[]; }; /** A `TableRecordFilters` condition node, the shape the app query RPC accepts. */ export interface FilterConditionNode { node_type: "condition"; field_key: C; type: "text" | "number" | "select"; operator: string; value: unknown; /** The option of the column's `units` a number compares in. */ unit_option?: string; } /** The unit a range on a figure of these `units` compares in — the one it holds, else their first; none for a figure read in one. */ export declare function numberFilterUnit(units: FilterUnits | undefined, value: ColumnFilterValue | undefined): string | undefined; /** Pure. A number range yields two nodes; an empty filter none. */ export declare function columnFilterToConditions(column: FilterableColumn, value: ColumnFilterValue | undefined): FilterConditionNode[]; export declare function isColumnFilterActive(value: ColumnFilterValue | undefined): boolean; /** For the pill label ("Vàng, Đỏ", "≥ 10", "5–10 kg"). */ export declare function columnFilterSummary(column: FilterableColumn, value: ColumnFilterValue | undefined): string;