import type { HotInstance } from '../../core/types'; import { BasePlugin } from '../base'; export declare const PLUGIN_KEY = "search"; export declare const PLUGIN_PRIORITY = 190; declare const DEFAULT_CALLBACK: (instance: HotInstance, row: number, col: number, data: unknown, testResult: boolean) => void; declare const DEFAULT_QUERY_METHOD: (query: string, value: unknown, cellProperties: Record) => boolean; /** * @plugin Search * @class Search * * @description * The search plugin provides an easy interface to search data across Handsontable. * * In order to enable search mechanism, {@link Options#search} option must be set to `true`. * * @example * ```js * // as boolean * search: true * // as a object with one or more options * search: { * callback: myNewCallbackFunction, * queryMethod: myNewQueryMethod, * searchResultClass: 'customClass' * } * * // Access to search plugin instance: * const searchPlugin = hot.getPlugin('search'); * * // Set callback programmatically: * searchPlugin.setCallback(myNewCallbackFunction); * // Set query method programmatically: * searchPlugin.setQueryMethod(myNewQueryMethod); * // Set search result cells class programmatically: * searchPlugin.setSearchResultClass(customClass); * ``` */ export declare class Search extends BasePlugin { #private; /** * Returns the plugin key used to identify and access this plugin within Handsontable. */ static get PLUGIN_KEY(): string; /** * Returns the priority value that determines the plugin's initialization order relative to other plugins. */ static get PLUGIN_PRIORITY(): number; /** * Function called during querying for each cell from the {@link DataMap}. * * @private * @type {Function} */ callback: (instance: HotInstance, row: number, col: number, data: unknown, testResult: boolean) => void; /** * Query function is responsible for determining whether a query matches the value stored in a cell. * * @private * @type {Function} */ queryMethod: (query: string, value: unknown, cellProperties: Record) => boolean; /** * Class name added to each cell that belongs to the searched query. * * @private * @type {string} */ searchResultClass: string; /** * 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 AutoRowSize#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; /** * Updates the plugin's state. * * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options: * - [`search`](@/api/options.md#search) */ updatePlugin(): void; /** * Makes the query. * * @param {string} queryStr Value to be search. * @param {Function} [callback] Callback function performed on cells with values which matches to the searched query. * @param {Function} [queryMethod] Query function responsible for determining whether a query matches the value stored in a cell. * @returns {object[]} Return an array of objects with `row`, `col`, `data` properties or empty array. */ query(queryStr: string, callback?: (instance: HotInstance, row: number, col: number, data: unknown, testResult: boolean) => void, queryMethod?: (query: string, value: unknown, cellProperties: Record) => boolean): unknown[]; /** * Gets the callback function. * * @returns {Function} Return the callback function. */ getCallback(): typeof DEFAULT_CALLBACK; /** * Sets the callback function. This function will be called during querying for each cell. * * @param {Function} newCallback A callback function. */ setCallback(newCallback: typeof DEFAULT_CALLBACK): void; /** * Gets the query method function. * * @returns {Function} Return the query method. */ getQueryMethod(): typeof DEFAULT_QUERY_METHOD; /** * Sets the query method function. The function is responsible for determining whether a query matches the value stored in a cell. * * @param {Function} newQueryMethod A function with specific match logic. */ setQueryMethod(newQueryMethod: typeof DEFAULT_QUERY_METHOD): void; /** * Gets search result cells class name. * * @returns {string} Return the cell class name. */ getSearchResultClass(): string; /** * Sets search result cells class name. This class name will be added to each cell that belongs to the searched query. * * @param {string} newElementClass CSS class name. */ setSearchResultClass(newElementClass: string): void; /** * Updates the settings of the plugin. * * @param {object} searchSettings The plugin settings, taken from Handsontable configuration. * @private */ updatePluginSettings(searchSettings: Record): void; /** * Destroys the plugin instance. */ destroy(): void; } export {};