ui-lib/lib/ui/grid/grid.d.ts

81 lines
2.1 KiB
TypeScript

import { GridColumnDefinition } from "./column"
export interface GridItem {
value: any;
displayValue: string;
}
export interface GridSourceItem {
value: string;
text: string;
}
interface GridColumnDirection {
[-1]: Number,
1: Number
}
interface GridColumnColumnEventMap {
"reorder": string,
"resize": string,
"sort": string
}
export class Grid {
static ColumnTypes: {
Common: 0,
Input: 1,
Dropdown: 2,
Checkbox: 3,
Icon: 4,
Text: 5,
isCheckbox(type: Number): boolean;
};
columns: Array<GridColumnDefinition>;
langs?: { all: string, ok: string, reset: string };
virtualCount?: Number;
rowHeight?: Number;
extraRows?: Number;
filterRowHeight?: Number;
height?: Number;
readonly?: boolean;
multiSelect?: boolean;
fullrowClick?: boolean;
allowHtml?: boolean;
holderDisabled?: boolean;
headerVisible?: boolean;
window?: Window
sortIndex?: Number;
sortDirection?: keyof GridColumnDirection;
constructor(container: HTMLElement);
willSelect?: (index: Number, colIndex: Number) => boolean;
selectedRowChanged?: (index?: Number) => void;
cellDblClicked?: (index: Number, colIndex: Number) => void;
cellClicked?: (index: Number, colIndex: Number) => boolean;
rowDblClicked?: (index: Number) => void;
columnChanged?: <K extends keyof GridColumnColumnEventMap>(type: K, index: Number, value: Number | keyof GridColumnDirection) => void;
get source(): Array<GridItem | any>;
set source(list: Array<GridItem | any>);
get selectedIndexes(): Array<Number>;
set selectedIndexes(indexes: Array<Number>);
get loading(): boolean;
set loading(flag: boolean);
get scrollTop(): Number;
set scrollTop(top: Number);
readonly virtual: boolean;
readonly sortKey: string | undefined;
readonly selectedIndex: Number | -1;
init(container?: HTMLElement): void;
scrollToIndex(index: Number): void;
resize(force?: boolean): void;
reload(): void;
refresh(): void;
resetChange(): void;
sortColumn(reload?: boolean): void;
}