visual-grid
Version:
JavaScript Data Table
75 lines (74 loc) • 2.83 kB
TypeScript
import { Boundary, CellPosition, Coordinate, GridOptions, MenuItem, RowData } from '../types';
import defaultRender from '../views';
import { Listener, Root, RootState } from '../grid/store';
import { Store as GridStore } from '../grid/store/grid';
import { Store as RowStore } from '../grid/store/row';
import { Store as CellStore } from '../grid/store/cell';
import { Store as ColumnStore } from '../grid/store/column';
import CellRange from '../selection/CellRange';
export interface Stores {
grid: GridStore;
row: RowStore;
cell: CellStore;
column: ColumnStore;
}
export declare type Store = Root<Stores>;
export declare type State = RootState<Stores>;
export declare class Grid {
protected container: HTMLElement;
protected root: Store;
constructor(container: HTMLElement, props: GridOptions, render?: typeof defaultRender);
api(): Store;
destroy(): Promise<void>;
/**
* Agent for root store
*/
getState(): State;
subscribe(listener: Listener<unknown, State>): () => void;
store<K extends keyof Stores>(s: K): import("../grid/store").Stores<Stores>[K];
state<K extends keyof Stores>(s: K): RootState<Stores>[K];
/**
* Actions
*/
getCoordinate(row: string, col: string): Coordinate;
getCellPosition(coord: Coordinate): CellPosition;
getRawCellValueByCoord(coord: Coordinate): any;
getCellValue(row: string, column: string): any;
getCellValueByCoord(coord: Coordinate): any;
setCellValue(row: string, column: string, value: any): void;
setCellValueByCoord(coord: Coordinate, value: any): void;
getSelectBoundary(row: string, column: string): Boundary | undefined;
getFillingBoundary(row: string, column: string): Boundary | undefined;
getContextMenuItems(pos: CellPosition): MenuItem[];
copySelection(): void;
pasteFromClipboard(): void;
/**
* Agent for grid store
*/
setLoading(loading: boolean): void;
/**
* Agent for column store
*/
getColumnOptions(column: string): import("../types").ColumnOptions;
getColumnOptionsByIndex(x: number): import("../types").ColumnOptions;
getColumnByIndex(x: number): string;
/**
* Agent for row store
*/
appendRows(rows: RowData[]): void;
appendRowsBefore(index: number, rows: RowData[]): void;
appendSelectRows(rows: string[]): void;
takeSelectRow(row: string): void;
getRowIdByIndex(y: number): string;
getRowIndex(id: string): number;
getRawCellValue(row: string, column: string): any;
getRowDataByIndex(y: number): RowData;
getRowData(row: string): RowData;
/**
* Agent for cell store
*/
getCoordLocatedRange(coord: Coordinate): CellRange | undefined;
stopEditing(): void;
setEditing(pos?: CellPosition): void;
}
export default Grid;