import type { ColumnDef, Row, Table } from '@tanstack/react-table'; import { type RowModel, TableState } from '@tanstack/table-core'; import { DataViewField, DataViewQuery, DataViewSort, GroupByResolver, GroupedData, InternalFilter, InternalQuery } from '../data-view.types'; export declare function queryToTableState(query: InternalQuery): Partial; /** * Convert field metadata to TanStack ColumnDefs. These carry filter/sort/group/ * visibility capability and the filter predicate. The `header` falls back to * `field.label` so renderers that bypass their column spec still get the right * default header text. */ export declare function fieldsToColumnDefs(fields?: DataViewField[], filters?: InternalFilter[]): ColumnDef[]; /** * Bucket data into `GroupedData` entries keyed by `group_by`. When a resolver * is supplied for that key, the resolver runs per-row; otherwise the field is * accessed directly. Used in client mode only. * * Sections come out in the field's `groupOrder` where it declares one, with * undeclared values following in first-seen order and the null-valued bucket * last — see `orderBucketKeys`. */ export declare function groupData(data: TData[], group_by?: string, fields?: DataViewField[], resolvers?: Record>): GroupedData[]; export declare const GROUP_ROW_ID_PREFIX = "__group__:"; export declare function isGroupRowData(row: unknown): row is GroupedData; /** * Keys group buckets by `group_key` so their ids can't collide with data row * ids. Leaves delegate to `getRowId`, falling back to TanStack's positional * default (which supplying any resolver would otherwise replace). */ export declare function createRowIdResolver(getRowId?: (row: TData, index: number) => string): (row: TData, index: number, parent?: Row) => string; /** * True when there's an active filter, search, or sort/group differing from the * declared defaults. Used to distinguish zero state from empty state. */ export declare const hasActiveQuery: (tableQuery: InternalQuery, defaultSort: DataViewSort) => boolean; export declare const hasQueryChanged: (oldQuery: InternalQuery | null, newQuery: InternalQuery) => boolean; export declare function getInitialColumnVisibility(fields?: DataViewField[]): Record; export declare function transformToDataViewQuery(query: InternalQuery): DataViewQuery; /** * Reverse of `transformToDataViewQuery`. The UI re-applies type information * from field metadata once it sees a column, since the wire format strips it. */ export declare function dataViewQueryToInternal(query: DataViewQuery): InternalQuery; /** * `getFilteredRowModel` with `flatRows` backfilled. table-core's * `filterFromLeafRows` path never fills that array, which kills every API * reading it (`getIsAllRowsSelected`, `toggleAllRowsSelected`, …) while a * filter is active. Filled in place to preserve the model identity downstream * memos key on. */ export declare function getFilteredRowModelWithFlatRows(): (table: Table) => () => RowModel; /** Leaf count from the row tree. Kept recursive so it stays correct for the grouped tree, where `flatRows` also counts group rows. */ export declare function countLeafRows(rows: Row[]): number; /** Difference between pre- and post-filter leaf rows (client mode only). */ export declare function getClientHiddenLeafRowCount(table: Table): number; export declare function hasActiveTableFiltering(table: Table): boolean; export declare function getDefaultTableQuery(defaultSort: DataViewSort, oldQuery?: DataViewQuery): InternalQuery; //# sourceMappingURL=index.d.ts.map