UNPKG

ag-grid-community

Version:

Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue

122 lines (121 loc) • 6.08 kB
import type { NamedBean } from './context/bean'; import { BeanStub } from './context/beanStub'; import type { BeanCollection } from './context/context'; import type { AgColumn } from './entities/agColumn'; import type { CellFocusedEvent, CellFocusedParams } from './events'; import type { AbstractHeaderCellCtrl } from './headerRendering/cells/abstractCell/abstractHeaderCellCtrl'; import type { HeaderCellCtrl } from './headerRendering/cells/column/headerCellCtrl'; import type { TabToNextGridContainerTarget, TabToNextHeaderParams } from './interfaces/iCallbackParams'; import type { CellPosition } from './interfaces/iCellPosition'; import type { WithoutGridCommon } from './interfaces/iCommon'; import type { FocusableContainer } from './interfaces/iFocusableContainer'; import type { HeaderPosition } from './interfaces/iHeaderPosition'; import type { RowPinnedType } from './interfaces/iRowNode'; type FocusDirection = 'Before' | 'After' | null; /** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare class FocusService extends BeanStub implements NamedBean { beanName: "focusSvc"; private colModel; private visibleCols; private rowRenderer; private navigation?; private filterManager?; private overlays?; wireBeans(beans: BeanCollection): void; private focusedCell; private previousCellFocusParams; focusedHeader: HeaderPosition | null; private elementToReveal; private owedFocus; /** the column that had focus before it moved into the advanced filter */ private advFilterFocusColumn; postConstruct(): void; destroy(): void; /** Owes browser focus to the focused cell or row: taken as it lands, dropped on a new target or a move away. */ oweFocus(event?: CellFocusedEvent): void; /** Owes browser focus to a header waiting for its element to mount, in place of any earlier owe. */ deferFocus(header: AbstractHeaderCellCtrl): void; private setOwedFocus; /** Takes an owed focus event, replayed as its cell or row is drawn; other owes wait for takeOwedFocus. */ takeOwedFocusEvent(): CellFocusedEvent | undefined; /** * Takes a cell or row's owed focus once: false for none, a header's, one focus has since moved away from, or one * without an event under suppressFocusAfterRefresh. */ takeOwedFocus(): boolean; private dropOwedFocus; /** A press outside the grid, or focus moved where the grid would not take it from, gives the owed focus up. */ private readonly onActionWhileFocusOwed; /** Whether a press is on the grid as the listening root sees it: a closed root holding it shows only its host. */ private mayPressBeOnGrid; /** Whether a cell or row owed nothing takes focus: a grid row or cell has it, unless suppressFocusAfterRefresh. */ shouldTakeFocus(): boolean; /** A destroyed header gives up the focus owed to it, so later owes of cells and rows are kept. */ dropOwedHeaderFocus(header: AbstractHeaderCellCtrl): void; /** Takes a header's owed focus, once: false unless it asked last and focus stayed put or is unclaimed. */ takeOwedHeaderFocus(header: AbstractHeaderCellCtrl): boolean; /** Whether the grid can take focus without stealing it: focus is unclaimed, or a grid row or cell has it. */ isFocusFreeForGrid(): boolean; onColumnEverythingChanged(): void; getFocusCellToUseAfterRefresh(): CellPosition | null; getFocusHeaderToUseAfterRefresh(): HeaderPosition | null; /** * Check for both cells and rows, as a row might be destroyed and the dom data removed before the cell if the * row is animating out. */ doesRowOrCellHaveBrowserFocus(): boolean; private isDomDataPresentInHierarchy; getFocusedCell(): CellPosition | null; private getFocusEventParams; clearFocusedCell(): void; /** As keyboard navigation does, a column a colSpan covers focuses the spanning cell, rendered or not, and * vertical moves go on from the column asked for. */ setFocusedCellOrSpan(params: CellFocusedParams): void; setFocusedCell(params: CellFocusedParams): void; isCellFocused(cellPosition: CellPosition): boolean; isHeaderWrapperFocused(headerCtrl: HeaderCellCtrl): boolean; /** Focuses `element`, scrolling it into view once column animations settle, as it may be drawn where it was. */ focusGridElement(element: HTMLElement): void; private revealElement; focusHeaderPosition(params: { headerPosition: HeaderPosition | null; direction?: FocusDirection; fromTab?: boolean; allowUserOverride?: boolean; event?: KeyboardEvent; fromCell?: boolean; rowWithoutSpanValue?: number; scroll?: boolean; }): boolean; focusHeaderPositionFromUserFunc(params: { userFunc: (params: WithoutGridCommon<TabToNextHeaderParams>) => boolean | HeaderPosition; headerPosition: HeaderPosition | null; direction?: FocusDirection; event?: KeyboardEvent; }): boolean; private getHeaderPositionFromUserFunc; private focusProvidedHeaderPosition; focusFirstHeader(): boolean; focusLastHeader(event?: KeyboardEvent): boolean; focusPreviousFromFirstCell(event?: KeyboardEvent): boolean; isAnyCellFocused(): boolean; isRowFocused(rowIndex: number, rowPinnedType: RowPinnedType): boolean; focusOverlay(backwards?: boolean): boolean; getDefaultTabToNextGridContainerTarget(params: { backwards: boolean; focusableContainers: FocusableContainer[]; nextIndex: number; }): TabToNextGridContainerTarget | null; private getGridBodyTabTarget; private getGridViewTabTarget; focusGridView(params: { column?: AgColumn; backwards?: boolean; canFocusOverlay?: boolean; event?: KeyboardEvent; }): boolean; private focusAdvancedFilter; focusNextFromAdvancedFilter(backwards?: boolean, forceFirstColumn?: boolean): boolean; clearAdvancedFilterColumn(): void; } export {};