@eclipse-scout/core
Version:
Eclipse Scout runtime
70 lines • 3.4 kB
TypeScript
/// <reference types="jquery" />
import { Tile, TileGrid } from '../index';
export interface TileGridSelectionInstruction {
selectedTiles: Tile[];
focusedTile: Tile;
}
export declare class TileGridSelectionHandler {
tileGrid: TileGrid;
constructor(tileGrid: TileGrid);
selectTileOnMouseDown(event: JQuery.MouseDownEvent): void;
getFilteredTiles(): Tile[];
getFilteredTileCount(): number;
getVisibleTiles(): Tile[];
getVisibleTileCount(): number;
getGridColumnCount(): number;
getVisibleGridRowCount(): number;
getVisibleGridX(tile: Tile): number;
getVisibleGridY(tile: Tile): number;
getSelectedTiles(): Tile[];
isSelectable(): boolean;
isMultiSelect(): boolean;
addTilesToSelection(tiles: Tile[]): void;
selectTile(tile: Tile): void;
selectTiles(tiles: Tile[]): void;
deselectTile(tile: Tile): void;
deselectTiles(tiles: Tile[]): void;
deselectAllTiles(): void;
toggleSelection(): void;
getFocusedTile(): Tile;
/**
* @returns the focused tile if there is one.
* Otherwise, returns the last tile of the selection if diff is > 0 and the first tile if diff is <= 0.
* If there is no focused tile and no selection, null is returned.
*/
computeFocusedTile(diff?: number): Tile;
/**
* Only sets the focus if event does not prevent the default and the tile does not have the class 'unfocusable'.
*/
protected _checkAndSetFocusedTile(event: JQuery.MouseDownEvent, tile: Tile): void;
setFocusedTile(tile: Tile): void;
scrollTo(tile: Tile): void;
scrollToTop(): void;
scrollToBottom(): void;
findVisibleTileIndexAt(x: number, y: number, startIndex?: number, reverse?: boolean): number;
getTileGridByRow(rowIndex: number): TileGrid;
isHorizontalGridActive(): boolean;
computeSelectionX(xDiff: number, extend: boolean): TileGridSelectionInstruction;
computeSelectionY(yDiff: number, extend: boolean): TileGridSelectionInstruction;
computeSelectionToFirst(extend: boolean): TileGridSelectionInstruction;
computeSelectionToLast(extend: boolean): TileGridSelectionInstruction;
/**
* If no tiles are selected, an object is returned containing the tile that should be focused and selected.
* This is the first tile if diff is > 0 and the last tile otherwise.
*
* If there are tiles selected but there is no focused tile, an object is returned containing the tile to be focused.
* This is the last tile if diff is > 0 and the first tile otherwise.
*/
protected _computeFocusedTileOrSelection(diff: number): TileGridSelectionInstruction;
computeSelectionBetween(focusedTileIndex: number, newFocusedTileIndex: number, extend: boolean): TileGridSelectionInstruction;
executeSelection(instruction: TileGridSelectionInstruction): void;
/**
* Searches for the last selected tile in the current selection block, starting from tileIndex. Expects tile at tileIndex to be selected.
*/
protected _findLastSelectedTileBefore(tiles: Tile[], tileIndex: number): Tile;
/**
* Searches for the last selected tile in the current selection block, starting from tileIndex. Expects tile at tileIndex to be selected.
*/
protected _findLastSelectedTileAfter(tiles: Tile[], tileIndex: number): Tile;
}
//# sourceMappingURL=TileGridSelectionHandler.d.ts.map