import { BasePlugin } from '../base'; import type { NestedHeaders } from '../nestedHeaders/nestedHeaders'; import type StateManager from '../nestedHeaders/stateManager'; export declare const PLUGIN_KEY = "collapsibleColumns"; export declare const PLUGIN_PRIORITY = 290; /** * @plugin CollapsibleColumns * @class CollapsibleColumns * * @description * The _CollapsibleColumns_ plugin allows collapsing of columns, covered by a header with the `colspan` property defined. * * Clicking the "collapse/expand" button collapses (or expands) all "child" headers except the first one. * * Setting the {@link Options#collapsiblecolumns} property to `true` will display a "collapse/expand" button in every header * with a defined `colspan` property. * * To limit this functionality to a smaller group of headers, define the `collapsibleColumns` property as an array * of objects, as in the example below. * * @example * ::: only-for javascript * ```js * const container = document.getElementById('example'); * const hot = new Handsontable(container, { * data: generateDataObj(), * colHeaders: true, * rowHeaders: true, * nestedHeaders: true, * // enable plugin * collapsibleColumns: true, * }); * * // or * const hot = new Handsontable(container, { * data: generateDataObj(), * colHeaders: true, * rowHeaders: true, * nestedHeaders: true, * // enable and configure which columns can be collapsed * collapsibleColumns: [ * {row: -4, col: 1, collapsible: true}, * {row: -3, col: 5, collapsible: true} * ], * }); * ``` * ::: * * ::: only-for react * ```jsx * * * // or * * ``` * ::: * * ::: only-for angular * ```ts * // Enable the collapsibleColumns plugin * settings = { * data: generateDataObj(), * colHeaders: true, * rowHeaders: true, * nestedHeaders: true, * // enable plugin * collapsibleColumns: true, * }; * * // Or enable and configure specific collapsible columns * settings = { * data: generateDataObj(), * colHeaders: true, * rowHeaders: true, * nestedHeaders: true, * // enable and configure which columns can be collapsed * collapsibleColumns: [ * { row: -4, col: 1, collapsible: true }, * { row: -3, col: 5, collapsible: true }, * ], * }; * ``` * * ```html * * ``` * ::: */ export declare class CollapsibleColumns 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 plugin dependencies required before this plugin can be initialized. */ static get PLUGIN_DEPS(): string[]; /** * Returns the setting keys that trigger a plugin update when changed via `updateSettings`. */ static get SETTING_KEYS(): string[]; /** * Cached reference to the NestedHeaders plugin. * * @private * @type {NestedHeaders} */ nestedHeadersPlugin: NestedHeaders | null; /** * The NestedHeaders plugin StateManager instance. * * @private * @type {StateManager} */ headerStateManager: StateManager | 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 CollapsibleColumns#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: * - [`collapsibleColumns`](@/api/options.md#collapsiblecolumns) * - [`nestedHeaders`](@/api/options.md#nestedheaders) */ updatePlugin(): void; /** * Disables the plugin functionality for this Handsontable instance. */ disablePlugin(): void; /** * Register shortcuts responsible for toggling collapsible columns. * * @private */ registerShortcuts(): void; /** * Unregister shortcuts responsible for toggling collapsible columns. * * @private */ unregisterShortcuts(): void; /** * Clears the expand/collapse buttons. * * @private */ clearButtons(): void; /** * Expands section at the provided coords. `coords.col` may be any column the group's header spans, * not only its first (anchor) column - it resolves to the owning collapsible group. * * @param {object} coords Contains coordinates information. (`coords.row`, `coords.col`). */ expandSection(coords: { row: number; col: number; }): void; /** * Collapses section at the provided coords. `coords.col` may be any column the group's header spans, * not only its first (anchor) column - it resolves to the owning collapsible group. * * @param {object} coords Contains coordinates information. (`coords.row`, `coords.col`). */ collapseSection(coords: { row: number; col: number; }): void; /** * Collapses or expand all collapsible sections, depending on the action parameter. * * @param {string} action 'collapse' or 'expand'. */ toggleAllCollapsibleSections(action: 'collapse' | 'expand'): void; /** * Collapses all collapsible sections. */ collapseAll(): void; /** * Expands all collapsible sections. */ expandAll(): void; /** * Collapses/Expands a section. * * @param {Array} coords Array of coords - section coordinates. * @param {string} [action] Action definition ('collapse' or 'expand'). * @fires Hooks#beforeColumnCollapse * @fires Hooks#beforeColumnExpand * @fires Hooks#afterColumnCollapse * @fires Hooks#afterColumnExpand */ toggleCollapsibleSection(coords: { row: number; col: number; }[], action?: 'collapse' | 'expand'): void; /** * Gets an array of physical indexes of collapsed columns. * * @private * @returns {number[]} */ getCollapsedColumns(): number[]; /** * Destroys the plugin instance. */ destroy(): void; }