import { BasePlugin } from '../base'; import IndexSyncer from './indexSyncer'; import type AxisSyncer from './indexSyncer/axisSyncer'; import type { HyperFormulaEngine } from './engine/types'; export declare const PLUGIN_KEY = "formulas"; export declare const SETTING_KEYS: string[]; export declare const PLUGIN_PRIORITY = 260; /** * This plugin allows you to perform Excel-like calculations in your business applications. It does it by an * integration with our other product, [HyperFormula](https://github.com/handsontable/hyperformula/), which is a * powerful calculation engine with an extensive number of features. * * To test out HyperFormula, see [this guide](@/guides/formulas/formula-calculation/formula-calculation.md#available-functions). * * @plugin Formulas * @class Formulas */ export declare class Formulas extends BasePlugin { #private; /** * Returns the plugin key used to identify this plugin in Handsontable settings. */ static get PLUGIN_KEY(): string; /** * Returns the priority order used to determine the order in which plugins are initialized. */ static get PLUGIN_PRIORITY(): number; /** * Returns the list of settings keys observed by the plugin for configuration changes. */ static get SETTING_KEYS(): string[]; /** * Static register used to set up one global HyperFormula instance. * TODO: currently used in tests, might be removed later. * * @private * @type {object} */ staticRegister: { register: (name: string, item: unknown) => void; getItem: (name: string) => unknown; hasItem: (name: string) => boolean; getNames: () => string[]; getValues: () => unknown[]; clear: () => void; }; /** * The engine instance that will be used for this instance of Handsontable. * * @type {HyperFormula|null} */ engine: HyperFormulaEngine | null; /** * HyperFormula's sheet id. * * @type {number|null} */ sheetId: number | null; /** * HyperFormula's sheet name. * * @type {string|null} */ sheetName: string | null; /** * Index synchronizer responsible for manipulating with some general options related to indexes synchronization. * * @type {IndexSyncer|null} */ indexSyncer: IndexSyncer | null; /** * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows. * * @type {AxisSyncer|null} */ rowAxisSyncer: AxisSyncer | null; /** * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns. * * @type {AxisSyncer|null} */ columnAxisSyncer: AxisSyncer | null; /** * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit} * hook and if it returns `true` then the {@link Formulas#enablePlugin} method is called. * * @returns {boolean} */ isEnabled(): boolean; /** * Enables the plugin functionality for this Handsontable instance. */ enablePlugin(): void; /** * Disables the plugin functionality for this Handsontable instance. */ disablePlugin(): void; /** * Triggered on `updateSettings`. * * @private * @param {object} newSettings New set of settings passed to the `updateSettings` method. */ updatePlugin(newSettings: Record): void; /** * Destroys the plugin instance. */ destroy(): void; /** * Add a sheet to the shared HyperFormula instance. * * @param {string|null} [sheetName] The new sheet name. If not provided (or a null is passed), will be * auto-generated by HyperFormula. * @param {Array} [sheetData] Data passed to the shared HyperFormula instance. Has to be declared as an array of * arrays - array of objects is not supported in this scenario. * @returns {boolean|string} `false` if the data format is unusable or it is impossible to add a new sheet to the * engine, the created sheet name otherwise. */ addSheet(sheetName?: string | null, sheetData?: unknown[][]): string | boolean; /** * Switch the sheet used as data in the Handsontable instance (it loads the data from the shared HyperFormula * instance). * * @param {string} sheetName Sheet name used in the shared HyperFormula instance. */ switchSheet(sheetName: string): void; /** * Get the cell type under specified visual coordinates. * * @param {number} row Visual row index. * @param {number} column Visual column index. * @param {number} [sheet] The target sheet id, defaults to the current sheet. * @returns {string} Possible values: 'FORMULA' | 'VALUE' | 'ARRAYFORMULA' | 'EMPTY'. */ getCellType(row: number, column: number, sheet?: number | null): unknown; /** * Returns `true` if under specified visual coordinates is formula. * * @param {number} row Visual row index. * @param {number} column Visual column index. * @param {number} [sheet] The target sheet id, defaults to the current sheet. * @returns {boolean} */ isFormulaCellType(row: number, column: number, sheet?: number | null): boolean; /** * Renders dependent sheets (handsontable instances) based on the changes - list of the * recalculated dependent cells. * * @private * @param {object[]} dependentCells The values and location of applied changes within HF engine. * @param {boolean} [renderSelf] `true` if it's supposed to render itself, `false` otherwise. */ renderDependentSheets(dependentCells: unknown[], renderSelf?: boolean): void; /** * Validates dependent cells based on the cells that are modified by the change. * * @private * @param {object[]} dependentCells The values and location of applied changes within HF engine. * @param {object[]} [changedCells] The values and location of applied changes by developer (through API or UI). */ validateDependentCells(dependentCells: unknown[], changedCells?: unknown[]): void; /** * Sync a change from the change-related hooks with the engine. * * @private * @param {number} row Visual row index. * @param {number} column Visual column index. * @param {Handsontable.CellValue} newValue New value. * @returns {Array} Array of changes exported from the engine. */ syncChangeWithEngine(row: number, column: number, newValue: unknown): unknown[] | undefined; }