From c4dab8a05b805de039a1c72f7fdff857b654ad10 Mon Sep 17 00:00:00 2001 From: Piotr Laszczkowski Date: Sat, 14 May 2016 19:29:27 +0200 Subject: [PATCH] Update definitions for Handsontable - add hooks to options interface (#9325) * Add type definitions for Handsontable * Update definitions for Handsontable * Add Hooks to Options interface --- handsontable/handsontable-tests.ts | 82 ++++++++++++++++++++++++++++ handsontable/handsontable.d.ts | 86 +++++++++++++++++++++++++++++- 2 files changed, 167 insertions(+), 1 deletion(-) diff --git a/handsontable/handsontable-tests.ts b/handsontable/handsontable-tests.ts index 25ec4dee0f..318038967a 100644 --- a/handsontable/handsontable-tests.ts +++ b/handsontable/handsontable-tests.ts @@ -120,6 +120,88 @@ function test_HandsontableInit() { visibleRows: 123, width: 1232, wordWrap: true, + + // Hooks + afterAutofillApplyValues: function() {}, + afterCellMetaReset: function() {}, + afterChange: function() {}, + afterChangesObserved: function() {}, + afterColumnMove: function() {}, + afterColumnResize: function() {}, + afterColumnSort: function() {}, + afterContextMenuDefaultOptions: function() {}, + afterContextMenuHide: function() {}, + afterContextMenuShow: function() {}, + afterCopyLimit: function() {}, + afterCreateCol: function() {}, + afterCreateRow: function() {}, + afterDeselect: function() {}, + afterDestroy: function() {}, + afterDocumentKeyDown: function() {}, + afterFilter: function() {}, + afterGetCellMeta: function() {}, + afterGetColHeader: function() {}, + afterGetColumnHeaderRenderers: function() {}, + afterGetRowHeader: function() {}, + afterGetRowHeaderRenderers: function() {}, + afterInit: function() {}, + afterLoadData: function() {}, + afterMomentumScroll: function() {}, + afterOnCellCornerMouseDown: function() {}, + afterOnCellMouseDown: function() {}, + afterOnCellMouseOver: function() {}, + afterRemoveCol: function() {}, + afterRemoveRow: function() {}, + afterRender: function() {}, + afterRenderer: function() {}, + afterRowMove: function() {}, + afterRowResize: function() {}, + afterScrollHorizontally: function() {}, + afterScrollVertically: function() {}, + afterSelection: function() {}, + afterSelectionByProp: function() {}, + afterSelectionEnd: function() {}, + afterSelectionEndByProp: function() {}, + afterSetCellMeta: function() {}, + afterUpdateSettings: function() {}, + afterValidate: function() {}, + beforeAutofill: function() {}, + beforeCellAlignment: function() {}, + beforeChange: function() {}, + beforeChangeRender: function() {}, + beforeColumnMove: function() {}, + beforeColumnResize: function() {}, + beforeColumnSort: function() {}, + beforeDrawBorders: function() {}, + beforeFilter: function() {}, + beforeGetCellMeta: function() {}, + beforeInit: function() {}, + beforeInitWalkontable: function() {}, + beforeKeyDown: function() {}, + beforeOnCellMouseDown: function() {}, + beforeRemoveCol: function() {}, + beforeRemoveRow: function() {}, + beforeRender: function() {}, + beforeRenderer: function() {}, + beforeRowMove: function() {}, + beforeRowResize: function() {}, + beforeSetRangeEnd: function() {}, + beforeStretchingColumnWidth: function() {}, + beforeTouchScroll: function() {}, + beforeValidate: function() {}, + construct: function() {}, + init: function() {}, + modifyCol: function() {}, + modifyColHeader: function() {}, + modifyColWidth: function() {}, + modifyCopyableRange: function() {}, + modifyRow: function() {}, + modifyRowHeader: function() {}, + modifyRowHeight: function() {}, + persistentStateLoad: function() {}, + persistentStateReset: function() {}, + persistentStateSave: function() {}, + unmodifyCol: function() {} }); } diff --git a/handsontable/handsontable.d.ts b/handsontable/handsontable.d.ts index 9c7f87aaa3..790eb4b087 100644 --- a/handsontable/handsontable.d.ts +++ b/handsontable/handsontable.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Handsontable 0.24.1 +// Type definitions for Handsontable 0.24.3 // Project: https://handsontable.com/ // Definitions by: Handsoncode sp. z o.o. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped\ @@ -124,6 +124,88 @@ declare namespace ht { wordWrap?: boolean; isEmptyCol?: (col: number) => boolean; isEmptyRow?: (row: number) => boolean; + + // hooks + afterAutofillApplyValues?: (startArea: any[], entireArea: any[]) => void; + afterCellMetaReset?: () => void; + afterChange?: (changes: any[], source: string) => void; + afterChangesObserved?: () => void; + afterColumnMove?: (startColumn: number, endColumn: number) => void; + afterColumnResize?: (currentColumn: number, newSize: number, isDoubleClick: boolean) => void; + afterColumnSort?: (column: number, order: boolean) => void; + afterContextMenuDefaultOptions?: (predefinedItems: any[]) => void; + afterContextMenuHide?: (context: Object) => void; + afterContextMenuShow?: (context: Object) => void; + afterCopyLimit?: (selectedRows: number, selectedColumnds: number, copyRowsLimit: number, copyColumnsLimit: number) => void; + afterCreateCol?: (index: number, amount: number) => void; + afterCreateRow?: (index: number, amount: number) => void; + afterDeselect?: () => void; + afterDestroy?: () => void; + afterDocumentKeyDown?: (event: Event) => void; + afterFilter?: (formulasStack: any[]) => void; + afterGetCellMeta?: (row: number, col: number, cellProperties: Object) => void; + afterGetColHeader?: (col: number, TH: Element) => void; + afterGetColumnHeaderRenderers?: (array: any[]) => void; + afterGetRowHeader?: (row: number, TH: Element) => void; + afterGetRowHeaderRenderers?: (array: any[]) => void; + afterInit?: () => void; + afterLoadData?: (firstTime: boolean) => void; + afterMomentumScroll?: () => void; + afterOnCellCornerMouseDown?: (event: Object) => void; + afterOnCellMouseDown?: (event: Object, coords: Object, TD: Element) => void; + afterOnCellMouseOver?: (event: Object, coords: Object, TD: Element) => void; + afterRemoveCol?: (index: number, amount: number) => void; + afterRemoveRow?: (index: number, amount: number) => void; + afterRender?: (isForced: boolean) => void; + afterRenderer?: (TD: Element, row: number, col: number, prop: string|number, value: string, cellProperties: Object) => void; + afterRowMove?: (startRow: number, endRow: number) => void; + afterRowResize?: (currentRow: number, newSize: number, isDoubleClick: boolean) => void; + afterScrollHorizontally?: () => void; + afterScrollVertically?: () => void; + afterSelection?: (r: number, c: number, r2: number, c2: number) => void; + afterSelectionByProp?: (r: number, p: string, r2: number, p2: string) => void; + afterSelectionEnd?: (r: number, c: number, r2: number, c2: number) => void; + afterSelectionEndByProp?: (r: number, p: string, r2: number, p2: string) => void; + afterSetCellMeta?: (row: number, col: number, key: string, value: any) => void; + afterUpdateSettings?: () => void; + afterValidate?: (isValid: boolean, value: any, row: number, prop: string|number, source: string) => void|boolean; + beforeAutofill?: (start: Object, end: Object, data: any[]) => void; + beforeCellAlignment?: (stateBefore: any, range: any, type: string, alignmentClass: string) => void; + beforeChange?: (changes: any[], source: string) => void; + beforeChangeRender?: (changes: any[], source: string) => void; + beforeColumnMove?: (startColumn: number, endColumn: number) => void; + beforeColumnResize?: (currentColumn: number, newSize: number, isDoubleClick: boolean) => void; + beforeColumnSort?: (column: number, order: boolean) => void; + beforeDrawBorders?: (corners: any[], borderClassName: string) => void; + beforeFilter?: (formulasStack: any[]) => void; + beforeGetCellMeta?: (row: number, col: number, cellProperties: Object) => void; + beforeInit?: () => void; + beforeInitWalkontable?: (walkontableConfig: Object) => void; + beforeKeyDown?: (event: Event) => void; + beforeOnCellMouseDown?: (event: Event, coords: Object, TD: Element) => void; + beforeRemoveCol?: (index: number, amount: number, logicalCols?: any[]) => void; + beforeRemoveRow?: (index: number, amount: number, logicalRows?: any[]) => void; + beforeRender?: (isForced: boolean) => void; + beforeRenderer?: (TD: Element, row: number, col: number, prop: string|number, value: string, cellProperties: Object) => void; + beforeRowMove?: (startRow: number, endRow: number) => void; + beforeRowResize?: (currentRow: number, newSize: number, isDoubleClick: boolean) => any; + beforeSetRangeEnd?: (coords: any[]) => void; + beforeStretchingColumnWidth?: (stretchedWidth: number, column: number) => void; + beforeTouchScroll?: () => void; + beforeValidate?: (value: any, row: number, prop: string|number, source: string) => void; + construct?: () => void; + init?: () => void; + modifyCol?: (col: number) => void; + modifyColHeader?: (column: number) => void; + modifyColWidth?: (width: number, col: number) => void; + modifyCopyableRange?: (copyableRanges: any[]) => void; + modifyRow?: (row: number) => void; + modifyRowHeader?: (row: number) => void; + modifyRowHeight?: (height: number, row: number) => void; + persistentStateLoad?: (key: string, valuePlaceholder: Object) => void; + persistentStateReset?: (key: string) => void; + persistentStateSave?: (key: string, value: any) => void; + unmodifyCol?: (col: number) => void; } interface Methods { addHook(key: string, callback: Function|any[]): void; @@ -203,6 +285,8 @@ declare namespace ht { validateCells(callback: Function): void; } } + + declare var Handsontable: { new (element: Element, options: ht.Options): ht.Methods; };