import { BasePlugin } from '../base'; import DataManager from './data/dataManager'; import CollapsingUI from './ui/collapsing'; import HeadersUI from './ui/headers'; import ContextMenuUI from './ui/contextMenu'; import type { TrimmingMap } from '../../translations'; import RowMoveController from './utils/rowMoveController'; export declare const PLUGIN_KEY = "nestedRows"; export declare const PLUGIN_PRIORITY = 300; /** * @plugin NestedRows * @class NestedRows * * @description * Plugin responsible for displaying and operating on data sources with nested structures. */ export declare class NestedRows 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; /** * Reference to the DataManager instance. * * @private * @type {object} */ dataManager: DataManager | null; /** * Reference to the HeadersUI instance. * * @private * @type {object} */ headersUI: HeadersUI | null; /** * Reference to the CollapsingUI instance. * * @private * @type {object} */ collapsingUI: CollapsingUI | null; /** * Reference to the ContextMenuUI instance. * * @private * @type {object} */ contextMenuUI: ContextMenuUI | null; /** * Reference to the RowMoveController instance. * * @private * @type {object} */ rowMoveController: RowMoveController | null; /** * Map of skipped rows by plugin. * * @private * @type {null|TrimmingMap} */ collapsedRowsMap: 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 NestedRows#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: * - [`nestedRows`](@/api/options.md#nestedrows) */ updatePlugin(): void; /** * Register shortcuts responsible for toggling collapsible columns. * * @private */ registerShortcuts(): void; /** * Unregister shortcuts responsible for toggling collapsible columns. * * @private */ unregisterShortcuts(): void; /** * Collapses every top-level parent row, which hides all of their descendants. * * A parent that was already collapsed inside another one stays collapsed. * * @fires Hooks#beforeRowCollapse * @fires Hooks#afterRowCollapse */ collapseAll(): void; /** * Expands every collapsed parent row at every nesting level, so no row stays hidden. * * @fires Hooks#beforeRowExpand * @fires Hooks#afterRowExpand */ expandAll(): void; /** * Collapses a parent row, which hides its children. * * @param {number} row Visual row index of the parent. * @returns {boolean} `true` if the collapsed state changed. `false` when the row is not a parent, * when it is already collapsed, or when the {@link Hooks#beforeRowCollapse} hook blocked the action. * @fires Hooks#beforeRowCollapse * @fires Hooks#afterRowCollapse */ collapseParent(row: number): boolean; /** * Expands a parent row, which shows its children again. * * @param {number} row Visual row index of the parent. * @returns {boolean} `true` if the collapsed state changed. `false` when the row is not a parent, * when it is already expanded, or when the {@link Hooks#beforeRowExpand} hook blocked the action. * @fires Hooks#beforeRowExpand * @fires Hooks#afterRowExpand */ expandParent(row: number): boolean; /** * Collapses an expanded parent row, or expands a collapsed one. This is the same action as clicking * the button in the row header or pressing Enter on it. * * @param {number} row Visual row index of the parent. * @returns {boolean} `true` if the collapsed state changed. * @fires Hooks#beforeRowCollapse * @fires Hooks#afterRowCollapse * @fires Hooks#beforeRowExpand * @fires Hooks#afterRowExpand */ toggleParent(row: number): boolean; /** * Returns the physical row indexes of every parent row that is collapsed. * * The indexes are physical, not visual, because a parent collapsed inside another collapsed parent * is trimmed and therefore has no visual index at all. Physical indexes are also what you want to * store when saving the state. Convert one with {@link Core#toVisualRow}. * * @returns {number[]} Physical row indexes, sorted ascending. */ getCollapsedParents(): number[]; /** * Checks whether a parent row is collapsed. * * @param {number} row Visual row index of the parent. * @returns {boolean} `true` if the row is a parent and its children are hidden. */ isParentCollapsed(row: number): boolean; /** * Checks whether a row has children. * * @param {number} row Visual row index. * @returns {boolean} */ isParent(row: number): boolean; /** * Returns how deeply a row is nested. Top-level rows are at level `0`. * * @param {number} row Visual row index. * @returns {number|null} The nesting level, or `null` when the row does not exist. */ getRowLevel(row: number): number | null; /** * Returns the parent of a row. * * A visible row always has visible ancestors, so the returned index is visual like the argument. * * @param {number} row Visual row index. * @returns {number|null} Visual row index of the parent, or `null` for a top-level row. */ getRowParent(row: number): number | null; /** * Counts the children of a row. * * @param {number} row Visual row index. * @param {boolean} [recursive=false] `true` counts every descendant, `false` counts only the direct * children. * @returns {number} */ countChildren(row: number, recursive?: boolean): number; /** * Expands every ancestor of a row, so that a row hidden inside collapsed parents becomes visible. * * Takes a physical row index, because the row you want to reveal is hidden and therefore has no * visual index. * * @param {number} row Physical row index of the row to reveal. * @returns {boolean} `true` if anything was expanded. * @fires Hooks#beforeRowExpand * @fires Hooks#afterRowExpand */ expandToRow(row: number): boolean; /** * Shows rows down to the given nesting level and collapses everything deeper. * * Level `0` leaves only the top-level rows visible. * * This runs as two steps - an expand and a collapse - so it fires both pairs of hooks. Returning * `false` from {@link Hooks#beforeRowExpand} cancels the whole call and leaves the grid as it was. * Returning `false` from {@link Hooks#beforeRowCollapse} blocks only the collapse step, so the * expand step stays applied. * * @param {number} level The deepest nesting level that stays expanded. * @fires Hooks#beforeRowCollapse * @fires Hooks#afterRowCollapse * @fires Hooks#beforeRowExpand * @fires Hooks#afterRowExpand */ expandToLevel(level: number): void; /** * Enable the modify hook skipping flag - allows retrieving the data from Handsontable without this plugin's * modifications. * * @private */ disableCoreAPIModifiers(): void; /** * Disable the modify hook skipping flag. * * @private */ enableCoreAPIModifiers(): void; /** * The modifyRowData hook callback. * * @private * @param {number} row Visual row index. * @returns {boolean} */ onModifyRowData(row: number): unknown; /** * Modify the source data length to match the length of the nested structure. * * @private * @returns {number} */ onModifySourceLength(): number | undefined; /** * @private * @param {number} index The index where the data was spliced. * @param {number} amount An amount of items to remove. * @param {object} element An element to add. * @returns {boolean} */ onBeforeDataSplice(index: number, amount: number, element: Record): boolean; /** * Destroys the plugin instance. */ destroy(): void; }