DefinitelyTyped/handsontable/handsontable.d.ts
Piotr Laszczkowski 735fe1063e Update definitions for Handsontable (#8970)
* Add type definitions for Handsontable

* Update definitions for Handsontable
2016-04-26 01:00:02 +09:00

209 lines
7.7 KiB
TypeScript

// Type definitions for Handsontable 0.24.1
// Project: https://handsontable.com/
// Definitions by: Handsoncode sp. z o.o. <http://handsoncode.net/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped\
declare namespace ht {
interface Options {
allowEmpty?: boolean;
allowInsertColumn?: boolean;
allowInsertRow?: boolean;
allowInvalid?: boolean;
allowRemoveColumn?: boolean;
allowRemoveRow?: boolean;
autoColumnSize?: Object|boolean;
autoComplete?: any[];
autoRowSize?: Object|boolean;
autoWrapCol?: boolean;
autoWrapRow?: boolean;
bindRowsWithHeaders?: boolean|string;
cell?: any[];
cells?: Function;
checkedTemplate?: boolean|string;
className?: string|any[];
colHeaders?: boolean|any[]|Function;
collapsibleColumns?: boolean|any[];
columnHeaderHeight?: number|any[];
columns?: any[];
columnSorting?: boolean|Object;
columnSummary?: Object;
colWidths?: any[]|Function|number|string;
commentedCellClassName?: string;
comments?: boolean|any[];
contextMenu?: boolean|any[]|Object;
contextMenuCopyPaste?: Object;
copyable?: boolean;
copyColsLimit?: number;
copyPaste?: boolean;
copyRowsLimit?: number;
correctFormat?: boolean;
currentColClassName?: string;
currentRowClassName?: string;
customBorders?: boolean|any[];
data?: any[]|Function;
dataSchema?: Object;
dateFormat?: string;
debug?: boolean;
defaultDate?: string;
disableVisualSelection?: boolean|string|any[];
dropdownMenu?: boolean|Object|any[];
editor?: string|Function|boolean;
enterBeginsEditing?: boolean;
enterMoves?: Object|Function;
fillHandle?: boolean|string|Object;
filter?: boolean;
filteringCaseSensitive?: boolean;
filters?: boolean;
fixedColumnsLeft?: number;
fixedRowsBottom?: number;
fixedRowsTop?: number;
format?: string;
fragmentSelection?: boolean|string;
ganttChart?: Object;
headerTooltips?: boolean|Object;
height?: number|Function;
hiddenColumns?: boolean|Object;
hiddenRows?: boolean|Object;
invalidCellClassName?: string;
label?: Object;
language?: string;
manualColumnFreeze?: boolean;
manualColumnMove?: boolean|any[];
manualColumnResize?: boolean|any[];
manualRowMove?: boolean|any[];
manualRowResize?: boolean|any[];
maxCols?: number;
maxRows?: number;
mergeCells?: boolean|any[];
minCols?: number;
minRows?: number;
minSpareCols?: number;
minSpareRows?: number;
multiSelect?: boolean;
nestedHeaders?: any[];
noWordWrapClassName?: string;
observeChanges?: boolean;
observeDOMVisibility?: boolean;
outsideClickDeselects?: boolean;
pasteMode?: string;
persistentState?: boolean;
placeholder?: any;
placeholderCellClassName?: string;
preventOverflow?: string|boolean;
readOnly?: boolean;
readOnlyCellClassName?: string;
renderAllRows?: boolean;
renderer?: string|Function;
rowHeaders?: boolean|any[]|Function;
rowHeaderWidth?: number|any[];
rowHeights?: any[]|Function|number|string;
search?: boolean;
selectOptions?: any[];
skipColumnOnPaste?: boolean;
sortByRelevance?: boolean;
sortFunction?: Function;
sortIndicator?: boolean;
source?: any[]|Function;
startCols?: number;
startRows?: number;
stretchH?: string;
strict?: boolean;
tableClassName?: string|any[];
tabMoves?: Object;
title?: string;
trimDropdown?: boolean;
trimWhitespace?: boolean;
type?: string;
uncheckedTemplate?: boolean|string;
undo?: boolean;
validator?: Function|RegExp;
viewportColumnRenderingOffset?: number|string;
viewportRowRenderingOffset?: number|string;
visibleRows?: number;
width?: number|Function;
wordWrap?: boolean;
isEmptyCol?: (col: number) => boolean;
isEmptyRow?: (row: number) => boolean;
}
interface Methods {
addHook(key: string, callback: Function|any[]): void;
addHookOnce(key: string, callback: Function|any[]): void;
alter(action: string, index: number, amount?: number, source?: string, keepEmptyRows?: boolean): void;
clear(): void;
colOffset(): number;
colToProp(col: number): string|number;
countCols(): number;
countEmptyCols(ending?: boolean): number;
countEmptyRows(ending?: boolean): number;
countRenderedCols(): number;
countRenderedRows(): number;
countRows(): number;
countSourceRows(): number;
countVisibleCols(): number;
countVisibleRows(): number;
deselectCell(): void;
destroy(): void;
destroyEditor(revertOriginal?: boolean): void;
getActiveEditor(): Object;
getCell(row: number, col: number, topmost?: boolean): Element;
getCellEditor(row: number, col: number): Object;
getCellMeta(row: number, col: number): Object;
getCellRenderer(row: number, col: number): Function;
getCellValidator(row: number, col: number): any;
getColHeader(col: number): any[]|string;
getColWidth(col: number): number;
getCoords(elem: Element): Object;
getCopyableData(row: number, column: number): string;
getCopyableText(startRow: number, startCol: number, endRow: number, endCol: number): string;
getData(r?: number, c?: number, r2?: number, c2?: number): any[];
getDataAtCell(row: number, col: number): any;
getDataAtCol(col: number): any[];
getDataAtProp(prop: string|number): any[];
getDataAtRow(row: number): any[];
getDataAtRowProp(row: number, prop: string): any;
getDataType(rowFrom: number, columnFrom: number, rowTo: number, columnTo: number): string;
getInstance(): any;
getPlugin(pluginName: string): any;
getRowHeader(row?: number): any[]|string;
getRowHeight(row: number): number;
getSchema(): Object;
getSelected(): any[];
getSelectedRange(): any;
getSettings(): Object;
getSourceData(r?: number, c?: number, r2?: number, c2?: number): any[];
getSourceDataAtCell(row: number, column: number): any;
getSourceDataAtCol(column: number): any[];
getSourceDataAtRow(row: number): any[]|Object;
getValue(): any;
hasColHeaders(): boolean;
hasHook(key: string): boolean;
hasRowHeaders(): boolean;
isEmptyCol(col: number): boolean;
isEmptyRow(row: number): boolean;
isListening(): boolean;
listen(): void;
loadData(data: any[]): void;
populateFromArray(row: number, col: number, input: any[], endRow?: number, endCol?: number, source?: string, method?: string, direction?: string, deltas?: any[]): any;
propToCol(prop: string): number;
removeCellMeta(row: number, col: number, key: string): void;
removeHook(key: string, callback: Function): void;
render(): void;
rowOffset(): number;
runHooks(key: string, p1?: any, p2?: any, p3?: any, p4?: any, p5?: any, p6?: any): any;
selectCell(row: number, col: number, endRow?: number, endCol?: number, scrollToCell?: boolean, changeListener?: boolean): boolean;
selectCellByProp(row: number, prop: string, endRow?: number, endProp?: string, scrollToCell?: boolean): boolean;
setCellMeta(row: number, col: number, key: string, val: string): void;
setCellMetaObject(row: number, col: number, prop: Object): void;
setDataAtCell(row: number|any[], col: number, value: string, source?: string): void;
setDataAtRowProp(row: number|any[], prop: string, value: string, source?: string): void;
spliceCol(col: number, index: number, amount: number, elements?: any): void;
spliceRow(row: number, index: number, amount: number, elements?: any): void;
unlisten(): void;
updateSettings(settings: Object, init: boolean): void;
validateCells(callback: Function): void;
}
}
declare var Handsontable: {
new (element: Element, options: ht.Options): ht.Methods;
};