ui-lib/lib/ui/grid.d.ts
2023-04-04 23:26:46 +08:00

65 lines
1.6 KiB
TypeScript

interface GridColumn {
static create(): HTMLElement;
static setValue(element: HTMLElement, val: any): void;
static setStyle(element: HTMLElement, style: { [key: string]: string }): void;
}
interface GridColumn {
key?: string;
}
interface GridColumnDirection {
[-1]: Number,
0: Number,
1: Number
}
interface GridColumnColumnEventMap {
"reorder": string,
"resize": string,
"sort": string
}
interface Grid {
columns: Array<GridColumn>;
langs?: { all: string, ok: string, reset: string };
virtualCount?: Number;
rowHeight?: Number;
filterRowHeight?: Number;
height?: Number;
readonly?: boolean;
multiSelect?: boolean;
fullrowClick?: boolean;
allowHtml?: boolean;
holderDisabled?: boolean;
window?: Window
sortIndex?: Number;
sortDirection?: keyof GridColumnDirection;
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;
source(): Array<any>;
source(list: Array<any>): void;
}
declare var Grid: {
ColumnTypes: {
Common: 0,
Input: 1,
Dropdown: 2,
Checkbox: 3,
Icon: 4,
isCheckbox(type: Number): boolean;
};
GridColumn: GridColumn;
new(container: HTMLElement): Grid;
}
export default Grid;