import { BasePlugin } from '../base'; export declare const PLUGIN_KEY = "hiddenColumns"; export declare const PLUGIN_PRIORITY = 310; /** * @plugin HiddenColumns * @class HiddenColumns * * @description * The `HiddenColumns` plugin lets you [hide specified columns](@/guides/columns/column-hiding/column-hiding.md). * * "Hiding a column" means that the hidden column doesn't get rendered as a DOM element. * * The `HiddenColumns` plugin doesn't modify the source data, * and doesn't participate in data transformation * (the shape of the data returned by the [`getData*()` methods](@/api/core.md#getdata) stays intact). * * You can set the following configuration options: * * | Option | Required | Type | Default | Description | * |---|---|---|---|---| * | `columns` | No | Array | - | [Hides specified columns by default](@/guides/columns/column-hiding/column-hiding.md#step-1-specify-columns-hidden-by-default) | * | `indicators` | No | Boolean | `false` | [Shows UI indicators](@/guides/columns/column-hiding/column-hiding.md#step-2-show-ui-indicators) | * | `copyPasteEnabled` | No | Boolean | `true` | [Sets up copy/paste behavior](@/guides/columns/column-hiding/column-hiding.md#step-4-set-up-copy-and-paste-behavior) | * * @example * * ::: only-for javascript * ```js * const container = document.getElementById('example'); * const hot = new Handsontable(container, { * data: getData(), * hiddenColumns: { * copyPasteEnabled: true, * indicators: true, * columns: [1, 2, 5] * } * }); * * // access the `HiddenColumns` plugin's instance * const hiddenColumnsPlugin = hot.getPlugin('hiddenColumns'); * * // hide a single column * hiddenColumnsPlugin.hideColumn(1); * * // hide multiple columns * hiddenColumnsPlugin.hideColumn(1, 2, 9); * * // hide multiple columns as an array * hiddenColumnsPlugin.hideColumns([1, 2, 9]); * * // unhide a single column * hiddenColumnsPlugin.showColumn(1); * * // unhide multiple columns * hiddenColumnsPlugin.showColumn(1, 2, 9); * * // unhide multiple columns as an array * hiddenColumnsPlugin.showColumns([1, 2, 9]); * * // to see your changes, re-render your Handsontable instance * hot.render(); * ``` * ::: * * ::: only-for react * ```jsx * const hotRef = useRef(null); * * ... * * * * // access the `HiddenColumns` plugin's instance * const hot = hotRef.current.hotInstance; * const hiddenColumnsPlugin = hot.getPlugin('hiddenColumns'); * * // hide a single column * hiddenColumnsPlugin.hideColumn(1); * * // hide multiple columns * hiddenColumnsPlugin.hideColumn(1, 2, 9); * * // hide multiple columns as an array * hiddenColumnsPlugin.hideColumns([1, 2, 9]); * * // unhide a single column * hiddenColumnsPlugin.showColumn(1); * * // unhide multiple columns * hiddenColumnsPlugin.showColumn(1, 2, 9); * * // unhide multiple columns as an array * hiddenColumnsPlugin.showColumns([1, 2, 9]); * * // to see your changes, re-render your Handsontable instance * 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(), * hiddenColumns: { * copyPasteEnabled: true, * indicators: true, * columns: [1, 2, 5], * }, * }; * * ngAfterViewInit(): void { * // Access the `HiddenColumns` plugin's instance * const hot = this.hotTable.hotInstance; * const hiddenColumnsPlugin = hot.getPlugin("hiddenColumns"); * * // Hide a single column * hiddenColumnsPlugin.hideColumn(1); * * // Hide multiple columns * hiddenColumnsPlugin.hideColumn(1, 2, 9); * * // Hide multiple columns as an array * hiddenColumnsPlugin.hideColumns([1, 2, 9]); * * // Unhide a single column * hiddenColumnsPlugin.showColumn(1); * * // Unhide multiple columns * hiddenColumnsPlugin.showColumn(1, 2, 9); * * // Unhide multiple columns as an array * hiddenColumnsPlugin.showColumns([1, 2, 9]); * * // To see your changes, re-render your Handsontable instance * hot.render(); * } * * private getData(): Array<*> { * // Get some data * } * } * ``` * ::: */ export declare class HiddenColumns 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 default settings applied when the plugin is enabled without explicit configuration. */ static get DEFAULT_SETTINGS(): { copyPasteEnabled: boolean; indicators: boolean; columns: number[]; }; /** * 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 HiddenColumns#enablePlugin} method is called. * * @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: * - [`hiddenColumns`](@/api/options.md#hiddencolumns) */ updatePlugin(): void; /** * Disables the plugin functionality for this Handsontable instance. */ disablePlugin(): void; /** * Shows the provided columns. * * @param {number[]} columns Array of visual column indexes. */ showColumns(columns: number[]): void; /** * Shows a single column. * * @param {...number} column Visual column index. */ showColumn(...column: number[]): void; /** * Hides the columns provided in the array. * * @param {number[]} columns Array of visual column indexes. */ hideColumns(columns: number[]): void; /** * Hides a single column. * * @param {...number} column Visual column index. */ hideColumn(...column: number[]): void; /** * Returns an array of visual indexes of hidden columns. * * @returns {number[]} */ getHiddenColumns(): number[]; /** * Checks if the provided column is hidden. * * @param {number} column Visual column index. * @returns {boolean} */ isHidden(column: number): boolean; /** * Get if trim config is valid. Check whether all of the provided column indexes are within the bounds of the table. * * @param {Array} hiddenColumns List of hidden column indexes. * @returns {boolean} */ isValidConfig(hiddenColumns: number[]): boolean; /** * Reset all rendered cells meta. * * @private */ resetCellsMeta(): void; /** * Destroys the plugin instance. */ destroy(): void; }