import type { BeanCollection } from '../context/context'; import type { AgColumn } from '../entities/agColumn'; import type { ColAggFunc, IAggFunc } from '../entities/colDef'; import type { ShowValuesAsStateValue } from '../entities/colDef-showValuesAs'; import type { ColumnEventType } from '../events'; import type { ColumnPinnedType } from '../interfaces/iColumn'; import type { SortDef, SortDirection, SortType } from '../interfaces/iSort'; export interface ColumnStateParams { /** True if the column is hidden */ hide?: boolean | null; /** Width of the column in pixels */ width?: number | null; /** Column's flex if flex is set */ flex?: number | null; /** The sort direction of the column */ sort?: SortDirection; /** The type of sort applied to the column */ sortType?: SortType | null; /** The order of the sort, if sorting by many columns */ sortIndex?: number | null; /** The aggregation function applied */ aggFunc?: string | IAggFunc | null; /** * The position of this column in the order of value columns when aggregating in pivot mode. * When aggregating by a single column, any number can be used. When aggregating by multiple * columns, this determines the order (e.g. `0` for first, `1` for second). */ valueIndex?: number | null; /** True if pivot active */ pivot?: boolean | null; /** The order of the pivot, if pivoting by many columns */ pivotIndex?: number | null; /** Set if column is pinned */ pinned?: ColumnPinnedType; /** True if row group active */ rowGroup?: boolean | null; /** The order of the row group, if grouping by many columns */ rowGroupIndex?: number | null; /** The active "Show Values As" selection: the mode name, or the object form (with `params` / `precision`) * for modes that take input. `null` clears it. */ showValuesAs?: ShowValuesAsStateValue; } export interface ColumnState extends ColumnStateParams { /** ID of the column */ colId: string; } export interface ApplyColumnStateParams { /** The state from `getColumnState` */ state?: ColumnState[]; /** Whether column order should be applied */ applyOrder?: boolean; /** State to apply to columns where state is missing for those columns */ defaultState?: ColumnStateParams; } /** Pre-mutation snapshot; `dispatchColStateChanges` diffs against it to fire the right column events. */ interface ColumnStateChanges { /** Pre-mutation snapshot (`sortColumns` mutates `.columns` in place); `undefined` when empty/absent. */ rowGroupColumns: AgColumn[] | undefined; pivotColumns: AgColumn[] | undefined; /** Per-column scalar snapshot keyed by colId; insertion order = capture order. */ before: Map; /** Pre-mutation `colsList` ref. Unchanged ref ⇒ order untouched (only ever reassigned) ⇒ skip the O(n) diff. */ colsList: AgColumn[]; } /** Minimal pre-apply snapshot: only the fields `dispatchColumnFieldChanges` diffs. */ interface ColumnStateBefore { width: number; hide: boolean; pinned: ColumnPinnedType; sort: SortDirection; sortType: SortType | undefined; sortIndex: number | null; aggFunc: ColAggFunc; } /** Updates hide/sort/sortIndex/pinned/flex. Per field: `null`/empty clears, only `undefined` is skipped. */ export declare const updateSomeColumnState: (beans: BeanCollection, column: AgColumn, hide: boolean | null | undefined, sort: SortDirection | SortDef | undefined, sortIndex: number | null | undefined, pinned: boolean | "left" | "right" | null | undefined, flex: number | null | undefined, source: ColumnEventType) => void; /** Show/hide columns — skips the full `_applyColumnState` rebuild (visibility can't change colsList membership/order). * `filterLockedColumns` (UI paths) skips `lockVisible` cols; the API path passes `false`. * @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _setColsVisible(beans: BeanCollection, keys: (string | AgColumn)[], visible: boolean | undefined, source: ColumnEventType, filterLockedColumns?: boolean): void; /** Apply `ColumnState` across two passes, then — once for the whole operation — re-order, refresh the * visible cols and dispatch the resulting events. Returns `true` if every provided state matched a column. * @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _applyColumnState(beans: BeanCollection, params: ApplyColumnStateParams, source: ColumnEventType): boolean; /** Reset all columns to the state declared in their colDefs (`initial*`/explicit), re-apply the colDef * order, and fire `columnsReset`. * @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _resetColumnState(beans: BeanCollection, source: ColumnEventType): void; /** Snapshot column state before a mutation. Pair with {@link dispatchColStateChanges} after the * mutation to fire the resulting events. Used by both apply-column-state and apply-new-column-defs. */ export declare function captureColumnStateChanges(beans: BeanCollection): ColumnStateChanges; /** Diff current column state against a {@link captureColumnStateChanges} snapshot and dispatch the changed * column events (value/resize/pin/visible/sort/rowGroup/pivot/moved). */ export declare function dispatchColStateChanges(beans: BeanCollection, source: ColumnEventType, changes: ColumnStateChanges): void; export declare const _getColumnState: (beans: BeanCollection) => ColumnState[]; export declare function getColumnStateFromColDef(beans: BeanCollection, column: AgColumn): ColumnState; export {};