import { PTableParamsV2, PlDataTableFilters, PlDataTableSheetState, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized } from "./typesV8.js"; import { PlDataTableFilterState } from "./typesV4.js"; import { PTableParamsV2 as PTableParamsV2$1, PlDataTableFiltersWithMeta, PlDataTableStateV2Normalized as PlDataTableStateV2Normalized$1 } from "./typesV7.js"; import { PlDataTableGridStateV6, PlDataTableStateV2V6 } from "./typesV6.js"; import { PlDataTableGridStateV5 } from "./typesV5.js"; import { AxisId, CanonicalizedJson, ColumnUniversalId, PObjectId, PTableColumnId, PTableColumnSpec, PTableRecordFilter, PTableSorting } from "@milaboratories/pl-model-common"; /** * PlDataTableV2 persisted state */ export type PlDataTableStateV2 = { gridState: { columnOrder?: { orderedColIds: CanonicalizedJson[]; }; sort?: { sortModel: { colId: CanonicalizedJson; sort: "asc" | "desc"; }[]; }; columnVisibility?: { hiddenColIds: CanonicalizedJson[]; }; sourceId?: string; sheets?: Record, string | number>; }; pTableParams?: { sorting?: PTableSorting[]; filters?: PTableRecordFilter[]; }; } | { version: 2; stateCache: { sourceId: string; gridState: { columnOrder?: { orderedColIds: CanonicalizedJson[]; }; sort?: { sortModel: { colId: CanonicalizedJson; sort: "asc" | "desc"; }[]; }; columnVisibility?: { hiddenColIds: CanonicalizedJson[]; }; }; sheetsState: PlDataTableSheetState[]; }[]; pTableParams: { hiddenColIds: PObjectId[] | null; filters: PTableRecordFilter[]; sorting: PTableSorting[]; }; } | { version: 3; stateCache: { sourceId: string; gridState: { columnOrder?: { orderedColIds: CanonicalizedJson[]; }; sort?: { sortModel: { colId: CanonicalizedJson; sort: "asc" | "desc"; }[]; }; columnVisibility?: { hiddenColIds: CanonicalizedJson[]; }; }; sheetsState: PlDataTableSheetState[]; filtersState: PlDataTableFilterState[]; }[]; pTableParams: PTableParamsV2$1; } | { version: 4; stateCache: { sourceId: string; gridState: PlDataTableGridStateV6; sheetsState: PlDataTableSheetState[]; filtersState: PlDataTableFilterState[]; }[]; /** Old format; only fields used in migration are typed */ pTableParams: { sourceId: string | null; hiddenColIds: PObjectId[] | null; sorting: PTableSorting[]; }; } | { version: 5; stateCache: { sourceId: string; gridState: PlDataTableGridStateV5; sheetsState: PlDataTableSheetState[]; filtersState: null | PlDataTableFiltersWithMeta; defaultFiltersState: null | PlDataTableFiltersWithMeta; searchString?: string; }[]; pTableParams: PTableParamsV2$1; } | PlDataTableStateV2V6 | PlDataTableStateV2Normalized$1 | PlDataTableStateV2V8 | PlDataTableStateV2V9 | PlDataTableStateV2Normalized; /** v8 state: column ids not yet checked for the pre-rework form. */ export type PlDataTableStateV2V8 = StoredStateV8<8>; /** v9 state as stored before the model read the source's entry itself. */ export type PlDataTableStateV2V9 = StoredStateV8<9>; /** * The v8 shape as SDK versions before the model read the source's entry itself * stored it: `pTableParams` also holds that entry's settings as table parameters. */ type StoredStateV8 = { version: V; stateCache: StoredCacheEntry[]; pTableParams: StoredPTableParams; }; type StoredPTableParams = { sourceId: null; hiddenColIds: null; sorting: null; filters: null; defaultFilters: null; } | { sourceId: string; hiddenColIds: null | PTableColumnId[]; sorting: null | PTableSorting[]; filters: null | PlDataTableFilters; defaultFilters: null | PlDataTableFilters; }; /** Upgrade PlDataTableStateV2 to the latest version */ export declare function upgradePlDataTableStateV2(state: PlDataTableStateV2 | undefined): PlDataTableStateV2Normalized; /** A cache entry as stored, possibly by an SDK version without the sorting fields. */ type StoredCacheEntry = Omit & Partial>; export declare function createDefaultPTableParams(): PTableParamsV2; export declare function createPlDataTableStateV2(): PlDataTableStateV2Normalized; export {}; //# sourceMappingURL=state-migration.d.ts.map