import type { HotInstance } from '../../core/types'; import { LinkedPhysicalIndexToValueMap as IndexToValueMap } from '../../translations'; /** * Store and manages states of sorted columns. * * @private * @class ColumnStatesManager */ export declare class ColumnStatesManager { /** * Handsontable instance. * * @type {Core} */ hot: HotInstance; /** * Index map storing sorting states for every column. ColumnStatesManager write and read to/from this element. * * @type {LinkedPhysicalIndexToValueMap} */ sortingStates: IndexToValueMap; /** * Determines whether we should sort empty cells. * * @type {boolean} */ sortEmptyCells: boolean; /** * Determines whether indicator should be visible (for sorted columns). * * @type {boolean} */ indicator: boolean; /** * Determines whether click on the header perform sorting. * * @type {boolean} */ headerAction: boolean; /** * Determines compare function factory. Method get as parameters `sortOder` and `columnMeta` and return compare function. */ compareFunctionFactory: unknown; /** * Name of map storing sorting states. Required for unique name (PR #7440 introduced it). It's needed as * both ColumnSorting and MultiColumnSorting plugins create state manager and as a consequence register maps. * Objects are destroyed in strange order as the updateSettings doesn't work well. */ mapName: string; /** * Initializes the column states manager with the Handsontable instance and registers the sorting states index map under the given map name. */ constructor(hot: HotInstance, mapName: string); /** * Update column properties which affect the sorting result. * * **Note**: All column properties can be overwritten by {@link Options#columns} option. * * @param {object} allSortSettings Column sorting plugin's configuration object. */ updateAllColumnsProperties(allSortSettings: Record): void; /** * Get all column properties which affect the sorting result. * * @returns {object} */ getAllColumnsProperties(): Record; /** * Get sort order of column. * * @param {number} searchedColumn Visual column index. * @returns {string|undefined} Sort order (`asc` for ascending, `desc` for descending and undefined for not sorted). */ getSortOrderOfColumn(searchedColumn: number): string | undefined; /** * Get order of particular column in the states queue. * * @param {number} column Visual column index. * @returns {number} */ getIndexOfColumnInSortQueue(column: number): number; /** * Get number of sorted columns. * * @returns {number} */ getNumberOfSortedColumns(): number; /** * Get if list of sorted columns is empty. * * @returns {boolean} */ isListOfSortedColumnsEmpty(): boolean; /** * Get if particular column is sorted. * * @param {number} column Visual column index. * @returns {boolean} */ isColumnSorted(column: number): boolean; /** * Queue of sort states containing sorted columns and their orders (Array of objects containing `column` and `sortOrder` properties). * * **Note**: Please keep in mind that returned objects expose **visual** column index under the `column` key. * * @returns {Array} */ getSortStates(): { column: number; }[]; /** * Get sort state for particular column. Object contains `column` and `sortOrder` properties. * * **Note**: Please keep in mind that returned objects expose **visual** column index under the `column` key. * * @param {number} column Visual column index. * @returns {object|undefined} */ getColumnSortState(column: number): { column: number; sortOrder: string; } | undefined; /** * Set all column states. * * @param {Array} sortStates Sort states. */ setSortStates(sortStates: unknown[]): void; /** * Destroy the state manager. */ destroy(): void; }