import type { HotInstance } from '../../core/types'; import type { OperationType, ConditionId, ColumnConditions } from './filters'; import { LinkedPhysicalIndexToValueMap as IndexToValueMap } from '../../translations'; /** * @private * @class ConditionCollection */ declare class ConditionCollection { /** * Handsontable instance. * * @type {Core} */ hot: HotInstance; /** * Indicates whether the internal IndexMap should be registered or not. Generally, * registered Maps responds to the index changes. Within that collection, sometimes * this is not necessary. * * @type {boolean} */ isMapRegistrable: boolean; /** * Index map storing filtering states for every column. ConditionCollection write and read to/from element. * * @type {LinkedPhysicalIndexToValueMap} */ filteringStates: IndexToValueMap; /** * Initializes the condition collection with the Handsontable instance, optionally registering the filtering states index map on the column index mapper. */ constructor(hot: HotInstance, isMapRegistrable?: boolean); /** * Check if condition collection is empty (so no needed to filter data). * * @returns {boolean} */ isEmpty(): boolean; /** * Check if value is matched to the criteria of conditions chain. * * @param {object} value Object with `value` and `meta` keys. * @param {number} column The physical column index. * @returns {boolean} */ isMatch(value: unknown, column: number): boolean; /** * Check if the value is matches the conditions. * * @param {Array} conditions List of conditions. * @param {object} value Object with `value` and `meta` keys. * @param {string} [operationType='conjunction'] Type of conditions operation. * @returns {boolean} */ isMatchInConditions(conditions: unknown[], value: unknown, operationType?: string): boolean; /** * Add condition to the collection. * * @param {number} column The physical column index. * @param {object} conditionDefinition Object with keys: * * `command` Object, Command object with condition name as `key` property. * * `args` Array, Condition arguments. * @param {string} [operation='conjunction'] Type of conditions operation. * @param {number} [position] Position to which condition will be added. When argument is undefined * the condition will be processed as the last condition. * @fires ConditionCollection#beforeAdd * @fires ConditionCollection#afterAdd */ addCondition(column: number, conditionDefinition: Record, operation?: string, position?: number): void; /** * Get all added conditions from the collection at specified column index. * * @param {number} column The physical column index. * @returns {Array} Returns conditions collection as an array. */ getConditions(column: number): ConditionId[]; /** * Get operation for particular column. * * @param {number} column The physical column index. * @returns {string|undefined} */ getOperation(column: number): OperationType | undefined; /** * Get all filtered physical columns in the order in which actions are performed. * * @returns {Array} */ getFilteredColumns(): number[]; /** * Gets position in the filtering states stack for the specific column. * * @param {number} column The physical column index. * @returns {number} Returns -1 when the column doesn't exist in the stack. */ getColumnStackPosition(column: number): number; /** * Export all previously added conditions. * * @returns {Array} */ exportAllConditions(): ColumnConditions[]; /** * Import conditions to the collection. * * @param {Array} conditions The collection of the conditions. */ importAllConditions(conditions: ColumnConditions[] | unknown[]): void; /** * Remove conditions at given column index. * * @param {number} column The physical column index. * @fires ConditionCollection#beforeRemove * @fires ConditionCollection#afterRemove */ removeConditions(column: number): void; /** * Clean all conditions collection and reset order stack. * * @fires ConditionCollection#beforeClean * @fires ConditionCollection#afterClean */ clean(): void; /** * Check if at least one condition was added at specified column index. And if second parameter is passed then additionally * check if condition exists under its name. * * @param {number} column The physical column index. * @param {string} [name] Condition name. * @returns {boolean} */ hasConditions(column: number, name?: string): boolean; /** * Destroy object. */ destroy(): void; } interface ConditionCollection { addLocalHook(key: string, callback: Function): this; removeLocalHook(key: string, callback: Function): this; runLocalHooks(key: string, ...args: unknown[]): void; clearLocalHooks(): this; } export default ConditionCollection;