UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

95 lines (93 loc) 3.07 kB
/** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import { Selectors } from './selectors'; export type Config = { /** Enable debug logs */ isDebug?: boolean; /** CSS Selectors being used to find Rows, Row Groups, Cells and Focusable elements */ selectors?: Partial<typeof Selectors>; /** How many rows to move when pressing page up/down - Default goes to first/last row */ pageUpDown?: number; } | undefined; export declare class DataGridNav { private selectors; readonly pageUpDown: number | undefined; private keys; private disabled; readonly debug: boolean; constructor(); constructor(config: Config); private debugLog; /** * Disables the keyboard listener in cases * that elements inside the grid need to use * arrows keys etc., like select dropdowns */ disable(): void; /** * Enables the keyboard listeners */ enable(): void; private isFocusable; focusParentCell(el: Element): void; /** Used as a keyboard listener for key up */ tableKeyUp(): void; /** Used as a keyboard listener for key down */ tableKeyDown(e: KeyboardEvent): void; /** * Handles the navigation inside a cell */ cellNavigation(e: KeyboardEvent): void; /** * Get the valid focusable child of a cell * @return {FocusableElement | null} - The valid focusable child, or null if there are none or multiple focusable children */ private getValidFocusableChild; /** * Handles the navigation outside a cell * on the grid level */ gridNavigation(e: KeyboardEvent): void; private pageCellNavigation; private verticalCellNavigation; /** * Sending a row `Element` and then the first cell will be focused. * * If you want to focus the last cell then the row children can be passed in * reversed order */ private focusOnFirstCell; /** * Get the column index of a `cell` based on the first `row` parent. * `cellIndex` could be used, but it's not supported in HTML tables. */ private getColumnIndex; /** * Get the row index of a `row` based * on its sibling rows */ private getRowIndex; /** * Equivalent to prevUntil/nextUntil in jQuery * https://api.jquery.com/prevUntil/ */ private findUntil; }