@visualjs/grid
Version:
JavaScript Data Table
73 lines (72 loc) • 2.44 kB
TypeScript
import { Store as BaseStore } from "../../../grid/store";
import { RowParams, RowData } from "../../../types";
import { JSXInternal } from "preact/src/jsx";
export interface Actions {
setCellValue: {
row: string;
column: string;
value: any;
};
setPinnedTopRows: string[];
setPinnedBottomRows: string[];
takePinnedRows: string[];
setHoveredRow: string | undefined;
selectRows: string[];
setRows: RowData[];
appendRowsBefore: {
index: number;
rows: RowData[];
};
takeRows: string[];
clear: undefined;
setBaseHeight: number;
setRowHeight: {
row: string;
height: number;
};
}
export interface State {
rows: RowData[];
rowIndexes: Record<string, number>;
pinnedTopRows: string[];
pinnedBottomRows: string[];
normalRows: string[];
hoveredRow?: string;
selectedRows: string[];
height: number | ((id: string) => number);
minHeight: number;
rowHeights: Record<string, number>;
rowStyle?: JSXInternal.CSSProperties;
getRowStyle?: (params: RowParams) => JSXInternal.CSSProperties;
rowClass?: string[];
getRowClass?: (params: RowParams) => string[];
}
export declare class Store extends BaseStore<State, Actions> {
constructor(initial?: Partial<State>);
protected getValidRows(rows: string[]): string[];
getRowInternalIndex(row: string): number;
appendRowsBefore(index: number, rows: RowData[]): void;
appendRows(rows: RowData[]): void;
selectRows(rows: string[]): void;
appendSelectedRows(rows: string[]): void;
takeSelectedRow(row: string): void;
setPinnedTopRows(rows: string[]): void;
appendPinnedTopRows(rows: string[]): void;
setPinnedBottomRows(rows: string[]): void;
appendPinnedBottomRows(rows: string[]): void;
takePinnedRows(rows: string[]): void;
isPinnedTop(row: string): boolean;
isPinnedBottom(row: string): boolean;
isPinnedRow(row: string): boolean;
getPinnedTopRows(): string[];
getPinnedBottomRows(): string[];
getRowIds(): string[];
getRowIdByIndex(y: number): string;
getRowIndex(id: string): number;
getRowDataByIndex(y: number): RowData;
getRowData(row: string): RowData;
getRawCellValue(row: string, column: string): any;
getRowsBetween(start: number, end: number): string[];
sortRows(sort: (rows: RowData[]) => RowData[]): void;
}
export default Store;