ag-grid-community
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
113 lines (112 loc) • 5.62 kB
TypeScript
import type { AutoScrollService } from '../agStack/rendering/autoScrollService';
import type { BeanStub } from '../context/beanStub';
import type { AgColumn } from '../entities/agColumn';
import type { AgColumnGroup } from '../entities/agColumnGroup';
import type { IAbstractHeaderCellComp } from '../headerRendering/cells/abstractCell/abstractHeaderCellCtrl';
import type { Column } from '../interfaces/iColumn';
import type { RowPinnedType } from '../interfaces/iRowNode';
import type { CellCtrl } from '../rendering/cell/cellCtrl';
import type { CellPosition } from './iCellPosition';
import type { ICellRangeFeature } from './iCellRangeFeature';
import type { RowPosition } from './iRowPosition';
/** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export interface IRangeService {
readonly autoScrollService: AutoScrollService;
isEmpty(): boolean;
removeAllCellRanges(silent?: boolean): void;
getCellRangeCount(cell: CellPosition): number;
getRangeRowCount(cellRange: CellRange): number;
isCellInAnyRange(cell: CellPosition): boolean;
isCellInSpecificRange(cell: CellPosition, range: CellRange): boolean;
isColumnInAnyRange(column: AgColumn | AgColumnGroup): boolean;
isRowInRange(rowPos: RowPosition, cellRange: CellRange): boolean;
isBottomRightCell(cellRange: CellRange, cell: CellPosition): boolean;
isContiguousRange(cellRange: CellRange): boolean;
isMoreThanOneCell(): boolean;
areAllRangesAbleToMerge(): boolean;
onDragStart(mouseEvent: MouseEvent): void;
onDragStop(): void;
onDragging(mouseEvent: MouseEvent): void;
getCellRanges(): CellRange[];
setRangeToCell(cell: CellPosition, appendRange?: boolean): void;
handleCellMouseDown(event: MouseEvent, cell: CellPosition): void;
handleCellKeyboardSelect(event: KeyboardEvent, cell: CellPosition): void;
intersectLastRange(fromMouseClick?: boolean): void;
setCellRange(params: CellRangeParams): void;
addCellRange(params: CellRangeParams): CellRange | undefined;
extendLatestRangeInDirection(event: KeyboardEvent): CellPosition | undefined;
extendLatestRangeToCell(cell: CellPosition): void;
extendRangeToCell(cellRange: CellRange, cell: CellPosition): void;
extendRangeRowCountBy(cellRange: CellRange, targetCount: number): void;
extendRangeColumnCountBy(cellRange: CellRange, delta: number): void;
updateRangeRowBoundary(params: CellRangeBoundaryParams): void;
getRangeStartRow(cellRange: PartialCellRange): RowPosition;
getRangeEndRow(cellRange: PartialCellRange): RowPosition;
createCellRangeFromCellRangeParams(params: CellRangeParams): CellRange | undefined;
createPartialCellRangeFromRangeParams(params: CellRangeParams, allowEmptyColumns: boolean): PartialCellRange | undefined;
setCellRanges(cellRanges: CellRange[]): void;
clearCellRangeCellValues(params: ClearCellRangeParams): void;
createDragListenerFeature(eContainer: HTMLElement): BeanStub;
createCellRangeFeature(ctrl: CellCtrl): ICellRangeFeature;
createRangeHighlightFeature(compBean: BeanStub, column: AgColumn | AgColumnGroup, headerComp: IAbstractHeaderCellComp): void;
createHeaderGroupCellMouseListenerFeature(column: AgColumnGroup, eGui: HTMLElement): BeanStub;
forEachRowInRange(cellRange: CellRange, callback: (row: RowPosition) => void): void;
handleColumnSelection(column: AgColumn | AgColumnGroup, event: MouseEvent | KeyboardEvent): void;
}
export declare enum CellRangeType {
VALUE = 0,
DIMENSION = 1
}
/** Describes a single range of cells */
export interface CellRange {
id?: string;
type?: CellRangeType;
/** The start row of the range */
startRow?: RowPosition;
/** The end row of the range */
endRow?: RowPosition;
/** The columns in the range */
columns: Column[];
/** The start column for the range */
startColumn: Column;
/** A custom color class to be applied to this range */
colorClass?: string | null;
}
export type PartialCellRange = Omit<CellRange, 'startColumn'> & Partial<Pick<CellRange, 'startColumn'>>;
export interface CellRangeParams {
/** Start row index */
rowStartIndex: number | null;
/** Pinned state of start row. Either 'top', 'bottom' or null */
rowStartPinned?: RowPinnedType;
/** End row index */
rowEndIndex: number | null;
/** Pinned state of end row. Either 'top', 'bottom' or null */
rowEndPinned?: RowPinnedType;
/** Starting column for range */
columnStart?: string | Column;
/** End column for range */
columnEnd?: string | Column;
/** Specify Columns to include instead of using `columnStart` and `columnEnd` */
columns?: (string | Column)[];
}
export interface CellRangeBoundaryParams {
cellRange: CellRange;
boundary: 'start' | 'end';
cellPosition: CellPosition;
silent?: boolean;
}
export interface ClearCellRangeParams {
cellRanges?: CellRange[];
/** Source passed to `cellValueChanged` event */
cellEventSource?: string;
/** `true` to dispatch `cellSelectionDeleteStart` and `cellSelectionDeleteEnd` events */
dispatchWrapperEvents?: boolean;
/** Source passed to `cellSelectionDeleteStart` and `cellSelectionDeleteEnd` events */
wrapperEventSource?: 'deleteKey';
/**
* When `true` and in batch editing mode, cells with pending edits are restored to their
* original `sourceValue` instead of being cleared to `deleteValue`. This is used by
* fill-handle reduction to undo a fill rather than clearing cells.
*/
restoreSourceInBatch?: boolean;
}