import { BasePlugin } from '../base';
import { TrimmingMap } from '../../translations';
export declare const PLUGIN_KEY = "trimRows";
export declare const PLUGIN_PRIORITY = 330;
/**
* @plugin TrimRows
* @class TrimRows
*
* @description
* The plugin allows to trim certain rows. The trimming is achieved by applying the transformation algorithm to the data
* transformation. In this case, when the row is trimmed it is not accessible using `getData*` methods thus the trimmed
* data is not visible to other plugins.
*
* @example
* ::: only-for javascript
* ```js
* const container = document.getElementById('example');
* const hot = new Handsontable(container, {
* data: getData(),
* // hide selected rows on table initialization
* trimRows: [1, 2, 5]
* });
*
* // access the trimRows plugin instance
* const trimRowsPlugin = hot.getPlugin('trimRows');
*
* // hide single row
* trimRowsPlugin.trimRow(1);
*
* // hide multiple rows
* trimRowsPlugin.trimRow(1, 2, 9);
*
* // or as an array
* trimRowsPlugin.trimRows([1, 2, 9]);
*
* // show single row
* trimRowsPlugin.untrimRow(1);
*
* // show multiple rows
* trimRowsPlugin.untrimRow(1, 2, 9);
*
* // or as an array
* trimRowsPlugin.untrimRows([1, 2, 9]);
*
* // rerender table to see the changes
* hot.render();
* ```
* :::
*
* ::: only-for react
* ```jsx
* const hotRef = useRef(null);
*
* ...
*
*
*
* const hot = hotRef.current.hotInstance;
* // access the trimRows plugin instance
* const trimRowsPlugin = hot.getPlugin('trimRows');
*
* // hide single row
* trimRowsPlugin.trimRow(1);
*
* // hide multiple rows
* trimRowsPlugin.trimRow(1, 2, 9);
*
* // or as an array
* trimRowsPlugin.trimRows([1, 2, 9]);
*
* // show single row
* trimRowsPlugin.untrimRow(1);
*
* // show multiple rows
* trimRowsPlugin.untrimRow(1, 2, 9);
*
* // or as an array
* trimRowsPlugin.untrimRows([1, 2, 9]);
*
* // rerender table to see the changes
* hot.render();
* ```
* :::
*
* ::: only-for angular
* ```ts
* import { AfterViewInit, Component, ViewChild } from "@angular/core";
* import {
* GridSettings,
* HotTableModule,
* HotTableComponent,
* } from "@handsontable/angular-wrapper";
*
* `@Component`({
* selector: "app-example",
* standalone: true,
* imports: [HotTableModule],
* template: `
*
*
`,
* })
* export class ExampleComponent implements AfterViewInit {
* `@ViewChild`(HotTableComponent, { static: false })
* readonly hotTable!: HotTableComponent;
*
* readonly gridSettings = {
* data: this.getData(),
* // Hide selected rows on table initialization
* trimRows: [1, 2, 5],
* };
*
* ngAfterViewInit(): void {
* // Access the trimRows plugin instance
* const hot = this.hotTable.hotInstance;
* const trimRowsPlugin = hot.getPlugin("trimRows");
*
* // Hide a single row
* trimRowsPlugin.trimRow(1);
*
* // Hide multiple rows
* trimRowsPlugin.trimRow(1, 2, 9);
*
* // Or as an array
* trimRowsPlugin.trimRows([1, 2, 9]);
*
* // Show a single row
* trimRowsPlugin.untrimRow(1);
*
* // Show multiple rows
* trimRowsPlugin.untrimRow(1, 2, 9);
*
* // Or as an array
* trimRowsPlugin.untrimRows([1, 2, 9]);
*
* // Re-render table to see the changes
* hot.render();
* }
*
* private getData(): unknown[] {
* // Get some data
* }
* }
* ```
* :::
*/
export declare class TrimRows 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[];
/**
* Map of skipped rows by the plugin.
*
* @private
* @type {null|TrimmingMap}
*/
trimmedRowsMap: TrimmingMap | 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 TrimRows#enablePlugin} method is called.
* When [[Options#dataProvider]] is a complete server-backed configuration, the DataProvider plugin blocks this plugin from enabling.
*
* @returns {boolean}
*/
isEnabled(): boolean;
/**
* Enables the plugin functionality for this Handsontable instance.
*/
enablePlugin(): 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:
* - [`trimRows`](@/api/options.md#trimrows)
*/
updatePlugin(): void;
/**
* Disables the plugin functionality for this Handsontable instance.
*/
disablePlugin(): void;
/**
* Get list of trimmed rows.
*
* @returns {Array} Physical rows.
*/
getTrimmedRows(): number[];
/**
* Trims the rows provided in the array.
*
* @param {number[]} rows Array of physical row indexes.
* @fires Hooks#beforeTrimRow
* @fires Hooks#afterTrimRow
*/
trimRows(rows: number[]): void;
/**
* Trims the row provided as a physical row index (counting from 0).
*
* @param {...number} row Physical row index.
*/
trimRow(...row: number[]): void;
/**
* Untrims the rows provided in the array.
*
* @param {number[]} rows Array of physical row indexes.
* @fires Hooks#beforeUntrimRow
* @fires Hooks#afterUntrimRow
*/
untrimRows(rows: number[]): void;
/**
* Untrims the row provided as a physical row index (counting from 0).
*
* @param {...number} row Physical row index.
*/
untrimRow(...row: number[]): void;
/**
* Checks if given row is hidden.
*
* @param {number} physicalRow Physical row index.
* @returns {boolean}
*/
isTrimmed(physicalRow: number): boolean;
/**
* Untrims all trimmed rows.
*/
untrimAll(): void;
/**
* Get if trim config is valid. Check whether all of the provided physical row indexes are within source data.
*
* @param {Array} trimmedRows List of physical row indexes.
* @returns {boolean}
*/
isValidConfig(trimmedRows: number[]): boolean;
/**
* Destroys the plugin instance.
*/
destroy(): void;
}