import { PlDataTableGridStateCore, PlDataTableSheet, PlDataTableSheetState, PlDataTableStateV2, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized, PlDataTableFilters, PlDataTableFiltersWithMeta, PTableColumnId, PTableSorting } from '@platforma-sdk/model'; import { ComputedRef, Ref, WritableComputedRef } from 'vue'; import { PlDataTableSettingsV2 } from '../types'; import { PlDataTableGridFields } from './grid-state'; import { Nil } from '@milaboratories/helpers'; /** The source the table shows, as the stored state has to describe it. */ export type PlDataTableTarget = { sourceId: string; sheets: PlDataTableSheet[]; }; /** A change the user made to the settings of one source. */ export type PlDataTableEdit = { sourceId: string; patch: Partial>; }; /** * The stored state with the edits applied and, when a source is on screen, * brought in line with it: the stored state points at that source, the source * has an entry at the recent end of the cache, and its sheet selection names a * value each sheet offers. * * Every write of the table state is this function's result, whether the user * edited something or only the source on screen changed, so a table mounted * on a source the stored state does not point at writes the same way a sort * does. */ export declare function reduceTableState(stored: PlDataTableStateV2Normalized, target: null | PlDataTableTarget, edits: PlDataTableEdit[]): PlDataTableStateV2Normalized; /** * The value shown on each sheet: the saved one while the sheet still offers it, * otherwise the sheet's default, otherwise its first option. Sheets without * options are not shown and get no entry. */ export declare function resolveSheetsState(sheets: PlDataTableSheet[], saved: PlDataTableSheetState[]): PlDataTableSheetState[]; export declare function useTableState(tableStateDenormalized: Ref, settings: Ref, defaultFilters: Ref): { /** Source whose settings the controls show and edit; `null` while there is none. */ sourceId: ComputedRef; /** The grid's own state for the source on screen, to restore the grid from */ gridState: ComputedRef; /** Sorting the user set on the source on screen; `null` while untouched */ sorting: ComputedRef; /** Columns the user hid on the source on screen; `null` while untouched */ hiddenColIds: ComputedRef; getEntry: (sourceId: string) => undefined | PlDataTableStateV2CacheEntry; updateGrid: (sourceId: string, grid: PlDataTableGridFields) => void; sheetsState: WritableComputedRef; searchString: WritableComputedRef; filtersState: WritableComputedRef; defaultFiltersState: WritableComputedRef; resetDefaultFilters: () => void; }; //# sourceMappingURL=table-state-v2.d.ts.map