diff --git a/handsontable/handsontable-tests.ts b/handsontable/handsontable-tests.ts index d062f9c629..bd53d7d7fd 100644 --- a/handsontable/handsontable-tests.ts +++ b/handsontable/handsontable-tests.ts @@ -250,7 +250,7 @@ function test_HandsontableMethods() { hot.getRowHeight(123); hot.getSchema(); hot.getSelected(); - hot.getSelectedRange(); + const range: ht.Range = hot.getSelectedRange(); hot.getSettings(); hot.getSourceData(123, 123, 123, 123); hot.getSourceDataAtCell(123, 123); @@ -283,4 +283,8 @@ function test_HandsontableMethods() { hot.unlisten(); hot.updateSettings({}, true); hot.validateCells(function() {}); + + Handsontable.renderers.NumericRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {}); + Handsontable.renderers.TextRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {}); + Handsontable.Dom.addEvent(new HTMLElement(), "eventName", () => {}); } diff --git a/handsontable/index.d.ts b/handsontable/index.d.ts index 7a82509baa..e3a2281cff 100644 --- a/handsontable/index.d.ts +++ b/handsontable/index.d.ts @@ -250,7 +250,7 @@ declare namespace ht { getRowHeight(row: number): number; getSchema(): Object; getSelected(): any[]; - getSelectedRange(): any; + getSelectedRange(): Range; getSettings(): Object; getSourceData(r?: number, c?: number, r2?: number, c2?: number): any[]; getSourceDataAtCell(row: number, column: number): any; @@ -284,9 +284,73 @@ declare namespace ht { updateSettings(settings: Object, init: boolean): void; validateCells(callback: Function): void; } + + interface Selection { + start: CellPosition; + end: CellPosition; + } + + interface Range { + from: CellPosition; + to: CellPosition; + } + + interface HandsontableRegisterer { + getInstance(id: string): Methods; + registerInstance(id: string, instance: Methods): void; + removeInstance(id: string): void; + } + + interface ColumnProperties extends CellProperties { + data?: string; + editor?: string; + selectOptions?: any[]; + } + + interface CellProperties { + renderer?: ( + instance: Methods, + td: HTMLTableDataCellElement, + row: number, + col: number, + prop: string, + value: any, + tdCellProperties: Object) => void; + type?: string; + readOnly?: boolean; + language?: string; + format?: string; + validator?: (value: string, callback: (condition: boolean) => void) => void; + } + + interface CellPosition { + row: number; + col: number; + } } declare var Handsontable: { new (element: Element, options: ht.Options): ht.Methods; + renderers: { + TextRenderer( + instance: any, + td: HTMLTableCellElement, + row: number, + col: number, + prop: string, + value: any, + cellProperties: any): void; + NumericRenderer( + instance: any, + td: HTMLTableCellElement, + row: number, + col: number, + prop: string, + value: any, + cellProperties: any): void; + } + Dom: { + addEvent(element: HTMLElement, eventName: string, callback: Function): void; + } };