From 2a04a33b8fc79f79fa358fd341f1b4669f369bf3 Mon Sep 17 00:00:00 2001 From: Raymond Suelzer Date: Fri, 17 Jul 2015 16:04:30 -0400 Subject: [PATCH 1/8] added some api extensions, fixed some types added core, pagination, selection to GridAPI. Also fixed a few types that were incorrect, missing, or should have been nullable. --- ui-grid/ui-grid.d.ts | 78 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 9 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index f27700e70..0d7f4e7fe 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -88,11 +88,11 @@ declare module uiGrid { } export interface IGridOptions { aggregationCalcThrottle?: number; - appScopeProvider?: ng.IScope; + appScopeProvider?: ng.IScope | Object; columnDefs?: IColumnDef; columnFooterHeight?: number; columnVirtualizationThreshold?: number; - data?: Array; + data?: Array | string; enableColumnMenus?: boolean; enableFiltering?: boolean; enableHorizontalScrollbar?: boolean; @@ -109,7 +109,7 @@ declare module uiGrid { gridFooterTemplate?: string; gridMenuCustomItems?: Array; gridMenuShowHideColumns?: boolean; - gridMenuTitleFilter: (title: string) => ng.IPromise | string; + gridMenuTitleFilter?: (title: string) => ng.IPromise | string; headerTemplate?: string; horizontalScrollThreshold?: number; infiniteScrollDown?: boolean; @@ -130,12 +130,52 @@ declare module uiGrid { useExternalSorting?: boolean; virtualizationThreshold?: number; wheelScrollThrottle?: number; - getRowIdentity(): any; - rowEquality(entityA: IGridRow, entityB: IGridRow): boolean; - rowIdentity(): any; + getRowIdentity?(): any; + rowEquality?(entityA: IGridRow, entityB: IGridRow): boolean; + rowIdentity? (): any; + totalItems?: number; } + + + export interface IGridCoreApi { + on: { + sortChanged: (scope: ng.IScope, handler: (grid: IGridInstance, sortColumns: IColumnDef[]) => void) => void; + columnVisiblityChanged: (scope: ng.IScope, handler: (grid: IGridColumn) => void) => void; + } + } + + export interface IGridSelectionApi { + toggleRowSelection: (rowEntity: IGridRow, event?: Event) => void; + selectRow: (rowEntity: IGridRow, event?: Event) => void; + selectRowByVisibleIndex: (rowEntity: number, event?: Event) => void; + unSelectRow: (rowEntity: IGridRow, event?: Event) => void; + selectAllRows: (event?: Event) => void; + selectAllVisibleRows: (event?: Event) => void; + clearSelectedRows: (event?: Event) => void; + getSelectedRows: () => IGridRow[]; + getSelectedGridRows: () => IGridRow[]; + setMultiSelect: (multiSelect: boolean) => void; + setModifierKeysToMultiSelect: (multiSelect: boolean) => void; + getSelectAllState: () => boolean; + on: { + rowSelectionChanged: (scope: ng.IScope, handler: (row: IGridRow, event?: Event) => void) => void; + rowSelectionChangedBatch: (scope, handler: (row: IGridRow[], event?: Event) => void) => void; + } + } + + export interface IGridPaginationApi { + getPage: () => number; + getTotalPages: () => number; + nextPage: () => void; + previousPage: () => void; + seek: () => void; + on: { + paginationChanged: (scope, handler: (newPage: number, pageSize: number) => void) => void; + } + } + export interface IGridApiConstructor { - new(grid: IGridInstance): IGridApi; + new (grid: IGridInstance): IGridApi; } export interface IGridApi { /** @@ -186,6 +226,26 @@ declare module uiGrid { * @param callBackFn function to execute */ suppressEvents(listenerFuncs: Function | Array, callBackFn: Function): void; + + /** + * Core Api + */ + core: IGridCoreApi; + + /** + * Selection api + */ + + selection: IGridSelectionApi; + + + /** + * Pagination api + */ + pagination: IGridPaginationApi; + + + } export interface IGridRowConstructor { /** @@ -410,7 +470,7 @@ declare module uiGrid { * in this case your function needs to accept the full set of visible rows, * and return a value that should be shown */ - aggregationType: number | Function; + aggregationType?: number | Function; /** * cellClass can be a string specifying the class to append to a cell * or it can be a function(row,rowRenderIndex, col, colRenderIndex) @@ -604,7 +664,7 @@ declare module uiGrid { leaveOpen?: boolean; } export interface ISortInfo { - direction?: number; + direction?: string; ignoreSort?: boolean; priority?: number; } From 370f04bfcd1470b5db0fef0a9d81a8376bd60623 Mon Sep 17 00:00:00 2001 From: Raymond Suelzer Date: Fri, 17 Jul 2015 16:09:33 -0400 Subject: [PATCH 2/8] direction should be a string sort direction should be a string --- ui-grid/ui-grid-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 6bdae2f64..1d0dd3462 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -72,7 +72,7 @@ columnDef.menuItems = [{ columnDef.minWidth = 100; columnDef.name = 'MyColumn'; columnDef.sort = { - direction: 0, + direction: 'ASC', ignoreSort: false, priority: 1 }; From d187f678d1c014d1e04b1489bd50f2c2726fcf39 Mon Sep 17 00:00:00 2001 From: Raymond Suelzer Date: Fri, 17 Jul 2015 16:13:57 -0400 Subject: [PATCH 3/8] fixing missing ng.scope on api callback --- ui-grid/ui-grid.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 0d7f4e7fe..7318b1d79 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -159,7 +159,7 @@ declare module uiGrid { getSelectAllState: () => boolean; on: { rowSelectionChanged: (scope: ng.IScope, handler: (row: IGridRow, event?: Event) => void) => void; - rowSelectionChangedBatch: (scope, handler: (row: IGridRow[], event?: Event) => void) => void; + rowSelectionChangedBatch: (scope: ng.IScope, handler: (row: IGridRow[], event?: Event) => void) => void; } } @@ -170,7 +170,7 @@ declare module uiGrid { previousPage: () => void; seek: () => void; on: { - paginationChanged: (scope, handler: (newPage: number, pageSize: number) => void) => void; + paginationChanged: (scope: ng.IScope, handler: (newPage: number, pageSize: number) => void) => void; } } From e23467fc87e8bc99345b61416ffea7c0863a67b4 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 21 Jul 2015 13:00:23 -0400 Subject: [PATCH 4/8] added uigridconstants, and all gridApi.core gridApi.rowEdit definitions. --- ui-grid/ui-grid-tests.ts | 14 +++ ui-grid/ui-grid.d.ts | 187 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 193 insertions(+), 8 deletions(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 1d0dd3462..065bb1a52 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -86,3 +86,17 @@ columnDef.visible = true; columnDef.width = 100; columnDef.width = '*'; + +var gridInstance: uiGrid.IGridInstance; +var menuItem: uiGrid.IMenuItem + +var gridApi: uiGrid.IGridApi +gridApi.core.clearAllFilters(true); +gridApi.core.addToGridMenu(gridInstance, [menuItem]); +gridApi.core.getVisibleRows(gridInstance); +gridApi.core.handleWindowResize(); +gridApi.core.queueGridRefresh() +gridApi.core.queueRefresh(); +var colProcessor: uiGrid.IColumnProcessor; +gridApi.core.registerColumnsProcessor(colProcessor, 100); + diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 7318b1d79..7e5305046 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -12,6 +12,113 @@ /// declare module uiGrid { + export interface UIGridConstants { + LOG_DEBUG_MESSAGES: boolean; + LOG_WARN_MESSAGES: boolean; + LOG_ERROR_MESSAGES: boolean; + CUSTOM_FILTERS: RegExp; + COL_FIELD: RegExp; + MODEL_COL_FIELD: RegExp; + TOOLTIP: RegExp; + DISPLAY_CELL_TEMPLATE: RegExp; + TEMPLATE_REGEXP: RegExp; + FUNC_REGEXP: RegExp; + DOT_REGEXP: RegExp; + APOS_REGEXP: RegExp; + BRACKET_REGEXP: RegExp; + COL_CLASS_PREFIX: string; + events: { + GRID_SCROLL: string; + COLUMN_MENU_SHOWN: string; + ITEM_DRAGGING: string; + COLUMN_HEADER_CLICK: string; + }; + keymap: { + TAB: number; + STRG: number; + CAPSLOCK: number; + CTRL: number; + CTRLRIGHT: number; + CTRLR: number; + SHIFT: number; + RETURN: number; + ENTER: number; + BACKSPACE: number; + BCKSP: number; + ALT: number; + ALTR: number; + ALTRIGHT: number; + SPACE: number; + WIN: number; + MAC: number; + FN: number; + PG_UP: number; + PG_DOWN: number; + UP: number; + DOWN: number; + LEFT: number; + RIGHT: number; + ESC: number; + DEL: number; + F1: number; + F2: number; + F3: number; + F4: number; + F5: number; + F6: number; + F7: number; + F8: number; + F9: number; + F10: number; + F11: number; + F12: number; + }; + ASC: string; + DESC: string; + filter: { + STARTS_WITH: number; + ENDS_WITH: number; + EXACT: number; + CONTAINS: number; + GREATER_THAN: number; + GREATER_THAN_OR_EQUAL: number; + LESS_THAN: number; + LESS_THAN_OR_EQUAL: number; + NOT_EQUAL: number; + SELECT: string; + INPUT: string; + }; + scrollDirection: { + UP: string; + DOWN: string; + LEFT: string; + RIGHT: string; + NONE: string; + }, + aggregationTypes: { + sum: number; + count: number; + avg: number; + min: number; + max: number; + }; + CURRENCY_SYMBOLS: string[]; + dataChange: { + ALL: string; + EDIT: string; + ROW: string; + COLUMN: string; + OPTIONS: string; + } + scrollbars: { + NEVER: number; + ALWAYS: number; + //WHEN_NEEDED: number + } + + } + + export interface IGridInstance { appScope?: ng.IScope; columnFooterHeight?: number; @@ -67,7 +174,7 @@ declare module uiGrid { resetColumnSorting(excludedColumn: IGridColumn): void; scrollTo(rowEntity: any, colDef: IColumnDef): ng.IPromise; scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): ng.IPromise; - sortColumn(column: IGridColumn, direction?: number, add?: boolean): ng.IPromise; + sortColumn(column: IGridColumn, direction?: string, add?: boolean): ng.IPromise; updateCanvasHeight(): void; updateFooterHeightCallback(name: string): void; } @@ -94,6 +201,7 @@ declare module uiGrid { columnVirtualizationThreshold?: number; data?: Array | string; enableColumnMenus?: boolean; + enablePagiationControls?: boolean; enableFiltering?: boolean; enableHorizontalScrollbar?: boolean; enableMinHeightCheck?: boolean; @@ -118,7 +226,7 @@ declare module uiGrid { maxVisibleColumnCount?: number; minRowsToShow?: number; minimumColumnSize?: number; - onRegisterApi: (gridApi: IGridApi) => void; + onRegisterApi?: (gridApi: IGridApi) => void; rowHeight?: number; rowTemplate?: string; scrollDebounce?: number; @@ -134,13 +242,47 @@ declare module uiGrid { rowEquality?(entityA: IGridRow, entityB: IGridRow): boolean; rowIdentity? (): any; totalItems?: number; + paginationPageSize?: number; + } export interface IGridCoreApi { + addRowHeaderColumn(column: IColumnDef): void; + addToGridMenu(grid: IGridInstance, items: IMenuItem[]): void; + clearAllFilters(refreshRows?: boolean, clearConditions?: boolean, clearFlags?: boolean): ng.IPromise; + clearRowInvisible(rowEntity: IGridRow): void; + getVisibleRows(grid: IGridInstance): IGridRow[]; + handleWindowResize(): void; + notifiyDataChange(type): void; + refreshRows(): ng.IPromise; + registerColumnsProcessor(processorFunction: IColumnProcessor, priority: number): void; + registerRowsProcessor(rowProcessor: IRowProcessor, priority: number): void; + removeFromGridMenu(grid: IGridInstance, id: string): void; + scrollTo(entity: any, colDef: IColumnDef): void; /*A row entity can be anything?*/ + scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): void; + setRowInvisible(rowEntity: IGridRow): void; + sortHandleNulls(a: any,b: any): number; + queueGridRefresh(): void; + queueRefresh(); on: { sortChanged: (scope: ng.IScope, handler: (grid: IGridInstance, sortColumns: IColumnDef[]) => void) => void; - columnVisiblityChanged: (scope: ng.IScope, handler: (grid: IGridColumn) => void) => void; + columnVisiblityChanged: (scope: ng.IScope, handler: (grid: IGridColumn) => void) => void; + canvasHeightChanged: (scope: ng.IScope, handler: (oldHeight: number, newHeight: number) => void) => void; + /* filterChangedis raised after the filter is changed. The nature of the watch expression doesn't allow notification + of what changed, so the receiver of this event will need to re-extract the filter conditions from the columns. + http://ui-grid.info/docs/#/api/ui.grid.core.api:PublicApi*/ + filterChanged: (scope: ng.IScope, handler: () => void) => void; + rowsRendered: (scope: ng.IScope, handler: () => void) => void; + /* rowsVisibleChanged + is raised after the rows that are visible change. The filtering is zero-based, + so it isn't possible to say which rows changed (unlike in the selection feature). + We can plausibly know which row was changed when setRowInvisible is called, but in + that situation the user already knows which row they changed. + When a filter runs we don't know what changed, and that is the one that would have been useful. */ + rowsVisibleChanged: (scope: ng.IScope, handler: () => void) => void; + scrollBegin: (scope: ng.IScope, handler: () => void) => void; + scrollEnd: (scope: ng.IScope, handler: () => void) => void; } } @@ -173,6 +315,26 @@ declare module uiGrid { paginationChanged: (scope: ng.IScope, handler: (newPage: number, pageSize: number) => void) => void; } } + + export interface IGridRowEditApi { + flushDirtyRows(grid?: IGridInstance): ng.IPromise; + getDirtyRows(grid?: IGridInstance): IGridRow[]; + getErrorRows(grid?: IGridInstance): IGridRow[]; + /** + * NOTE: The items below expect the entities not the grid row instance + * http://ui-grid.info/docs/#/api/ui.grid.rowEdit.api:PublicApi + */ + setRowsClean(dataRows: any[]): any[]; + setRowsDirty(dataRows: any[]): any[]; + /** + * Sets the promise associated with the row save, + * mandatory that the saveRow event handler calls this method somewhere before returning. + */ + setSavePromise(rowEntity: any, saveProvies: ng.IPromise): void; + on: { + saveRow: (scope: ng.IScope, handler: (rowEntity: any) => void) => void + } + } export interface IGridApiConstructor { new (grid: IGridInstance): IGridApi; @@ -234,8 +396,7 @@ declare module uiGrid { /** * Selection api - */ - + */ selection: IGridSelectionApi; @@ -243,9 +404,17 @@ declare module uiGrid { * Pagination api */ pagination: IGridPaginationApi; - - - + + + /** + * Grid Row Edit Api + */ + rowEdit: IGridRowEditApi; + + /** + * A grid instance is made available in the gridApi. + */ + grid: IGridInstance; } export interface IGridRowConstructor { /** @@ -390,6 +559,8 @@ declare module uiGrid { /** Filters for this column. Includes 'term' property bound to filter input elements */ filters?: Array; name?: string; + /** Sort on this column */ + sort?: ISortInfo /** Algorithm to use for sorting this column. Takes 'a' and 'b' parameters like any normal sorting function. */ sortingAlgorithm?: (a: any, b: any) => number; /** From 5ea2c74b9d84e1905e66ae3e5c2c9e1693224c7a Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 21 Jul 2015 17:14:21 -0400 Subject: [PATCH 5/8] fixing missing ";" --- ui-grid/ui-grid.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 7e5305046..30a2b2037 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -94,7 +94,7 @@ declare module uiGrid { LEFT: string; RIGHT: string; NONE: string; - }, + }; aggregationTypes: { sum: number; count: number; From 67fdc1b0407a7d76a3662a9d01338eb3fdf18368 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 21 Jul 2015 17:25:32 -0400 Subject: [PATCH 6/8] fixing comments, line breaks, and typos, fixing T[] -> Array --- ui-grid/ui-grid-tests.ts | 8 +++--- ui-grid/ui-grid.d.ts | 54 ++++++++++++++++++---------------------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 065bb1a52..151d0436f 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -87,16 +87,16 @@ columnDef.width = 100; columnDef.width = '*'; -var gridInstance: uiGrid.IGridInstance; -var menuItem: uiGrid.IMenuItem - var gridApi: uiGrid.IGridApi +var gridInstance: uiGrid.IGridInstance; +var menuItem: uiGrid.IMenuItem; +var colProcessor: uiGrid.IColumnProcessor; + gridApi.core.clearAllFilters(true); gridApi.core.addToGridMenu(gridInstance, [menuItem]); gridApi.core.getVisibleRows(gridInstance); gridApi.core.handleWindowResize(); gridApi.core.queueGridRefresh() gridApi.core.queueRefresh(); -var colProcessor: uiGrid.IColumnProcessor; gridApi.core.registerColumnsProcessor(colProcessor, 100); diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 30a2b2037..42f8e7e0f 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -102,7 +102,7 @@ declare module uiGrid { min: number; max: number; }; - CURRENCY_SYMBOLS: string[]; + CURRENCY_SYMBOLS: Array; dataChange: { ALL: string; EDIT: string; @@ -112,10 +112,8 @@ declare module uiGrid { } scrollbars: { NEVER: number; - ALWAYS: number; - //WHEN_NEEDED: number + ALWAYS: number; } - } @@ -242,17 +240,16 @@ declare module uiGrid { rowEquality?(entityA: IGridRow, entityB: IGridRow): boolean; rowIdentity? (): any; totalItems?: number; - paginationPageSize?: number; - + paginationPageSize?: number; + paginationCurrentPage?: number; } - export interface IGridCoreApi { addRowHeaderColumn(column: IColumnDef): void; - addToGridMenu(grid: IGridInstance, items: IMenuItem[]): void; - clearAllFilters(refreshRows?: boolean, clearConditions?: boolean, clearFlags?: boolean): ng.IPromise; + addToGridMenu(grid: IGridInstance, items: Array): void; + clearAllFilters(refreshRows?: boolean, clearConditions?: boolean, clearFlags?: boolean): ng.IPromise>; clearRowInvisible(rowEntity: IGridRow): void; - getVisibleRows(grid: IGridInstance): IGridRow[]; + getVisibleRows(grid: IGridInstance): Array; handleWindowResize(): void; notifiyDataChange(type): void; refreshRows(): ng.IPromise; @@ -266,20 +263,17 @@ declare module uiGrid { queueGridRefresh(): void; queueRefresh(); on: { - sortChanged: (scope: ng.IScope, handler: (grid: IGridInstance, sortColumns: IColumnDef[]) => void) => void; + sortChanged: (scope: ng.IScope, handler: (grid: IGridInstance, sortColumns: Array) => void) => void; columnVisiblityChanged: (scope: ng.IScope, handler: (grid: IGridColumn) => void) => void; canvasHeightChanged: (scope: ng.IScope, handler: (oldHeight: number, newHeight: number) => void) => void; - /* filterChangedis raised after the filter is changed. The nature of the watch expression doesn't allow notification - of what changed, so the receiver of this event will need to re-extract the filter conditions from the columns. - http://ui-grid.info/docs/#/api/ui.grid.core.api:PublicApi*/ + + /** + * filterChangedis raised after the filter is changed. The nature of the watch expression doesn't allow notification + * of what changed, so the receiver of this event will need to re-extract the filter conditions from the columns. + * http://ui-grid.info/docs/#/api/ui.grid.core.api:PublicApi + */ filterChanged: (scope: ng.IScope, handler: () => void) => void; - rowsRendered: (scope: ng.IScope, handler: () => void) => void; - /* rowsVisibleChanged - is raised after the rows that are visible change. The filtering is zero-based, - so it isn't possible to say which rows changed (unlike in the selection feature). - We can plausibly know which row was changed when setRowInvisible is called, but in - that situation the user already knows which row they changed. - When a filter runs we don't know what changed, and that is the one that would have been useful. */ + rowsRendered: (scope: ng.IScope, handler: () => void) => void; rowsVisibleChanged: (scope: ng.IScope, handler: () => void) => void; scrollBegin: (scope: ng.IScope, handler: () => void) => void; scrollEnd: (scope: ng.IScope, handler: () => void) => void; @@ -294,14 +288,14 @@ declare module uiGrid { selectAllRows: (event?: Event) => void; selectAllVisibleRows: (event?: Event) => void; clearSelectedRows: (event?: Event) => void; - getSelectedRows: () => IGridRow[]; - getSelectedGridRows: () => IGridRow[]; + getSelectedRows: () => Array; + getSelectedGridRows: () => Array; setMultiSelect: (multiSelect: boolean) => void; setModifierKeysToMultiSelect: (multiSelect: boolean) => void; getSelectAllState: () => boolean; on: { rowSelectionChanged: (scope: ng.IScope, handler: (row: IGridRow, event?: Event) => void) => void; - rowSelectionChangedBatch: (scope: ng.IScope, handler: (row: IGridRow[], event?: Event) => void) => void; + rowSelectionChangedBatch: (scope: ng.IScope, handler: (row: Array, event?: Event) => void) => void; } } @@ -318,21 +312,21 @@ declare module uiGrid { export interface IGridRowEditApi { flushDirtyRows(grid?: IGridInstance): ng.IPromise; - getDirtyRows(grid?: IGridInstance): IGridRow[]; - getErrorRows(grid?: IGridInstance): IGridRow[]; + getDirtyRows(grid?: IGridInstance): Array; + getErrorRows(grid?: IGridInstance): Array; /** * NOTE: The items below expect the entities not the grid row instance * http://ui-grid.info/docs/#/api/ui.grid.rowEdit.api:PublicApi */ - setRowsClean(dataRows: any[]): any[]; - setRowsDirty(dataRows: any[]): any[]; + setRowsClean(dataRows: Array): Array; + setRowsDirty(dataRows: Array): Array; /** * Sets the promise associated with the row save, * mandatory that the saveRow event handler calls this method somewhere before returning. */ - setSavePromise(rowEntity: any, saveProvies: ng.IPromise): void; + setSavePromise(rowEntity: Object, savePromise: ng.IPromise): void; on: { - saveRow: (scope: ng.IScope, handler: (rowEntity: any) => void) => void + saveRow: (scope: ng.IScope, handler: (rowEntity: Array) => void) => void } } From 21c47b36e25eaf1601781d866e23c70b2f0f26cf Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 21 Jul 2015 17:29:23 -0400 Subject: [PATCH 7/8] fixing missing return types. thanks Travis! --- ui-grid/ui-grid-tests.ts | 2 +- ui-grid/ui-grid.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 151d0436f..21d42c021 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -87,7 +87,7 @@ columnDef.width = 100; columnDef.width = '*'; -var gridApi: uiGrid.IGridApi +var gridApi: uiGrid.IGridApi; var gridInstance: uiGrid.IGridInstance; var menuItem: uiGrid.IMenuItem; var colProcessor: uiGrid.IColumnProcessor; diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 42f8e7e0f..50b1033b0 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -251,7 +251,7 @@ declare module uiGrid { clearRowInvisible(rowEntity: IGridRow): void; getVisibleRows(grid: IGridInstance): Array; handleWindowResize(): void; - notifiyDataChange(type): void; + notifiyDataChange(type: string): void; refreshRows(): ng.IPromise; registerColumnsProcessor(processorFunction: IColumnProcessor, priority: number): void; registerRowsProcessor(rowProcessor: IRowProcessor, priority: number): void; @@ -261,7 +261,7 @@ declare module uiGrid { setRowInvisible(rowEntity: IGridRow): void; sortHandleNulls(a: any,b: any): number; queueGridRefresh(): void; - queueRefresh(); + queueRefresh(): void; on: { sortChanged: (scope: ng.IScope, handler: (grid: IGridInstance, sortColumns: Array) => void) => void; columnVisiblityChanged: (scope: ng.IScope, handler: (grid: IGridColumn) => void) => void; From 72a6d57c065e9c6f64b187634be4ff6d9d8cffdf Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 22 Jul 2015 11:21:01 -0400 Subject: [PATCH 8/8] make entities 'any' and remove extra spaces. --- ui-grid/ui-grid.d.ts | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 50b1033b0..15c65e50d 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -115,8 +115,6 @@ declare module uiGrid { ALWAYS: number; } } - - export interface IGridInstance { appScope?: ng.IScope; columnFooterHeight?: number; @@ -170,7 +168,7 @@ declare module uiGrid { registerStyleComputation(styleComputation: ($scope: ng.IScope) => string): void; removeRowsProcessor(rows: IRowProcessor): void; resetColumnSorting(excludedColumn: IGridColumn): void; - scrollTo(rowEntity: any, colDef: IColumnDef): ng.IPromise; + scrollTo(rowEntity: IGridRow, colDef: IColumnDef): ng.IPromise; scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): ng.IPromise; sortColumn(column: IGridColumn, direction?: string, add?: boolean): ng.IPromise; updateCanvasHeight(): void; @@ -243,12 +241,11 @@ declare module uiGrid { paginationPageSize?: number; paginationCurrentPage?: number; } - export interface IGridCoreApi { addRowHeaderColumn(column: IColumnDef): void; addToGridMenu(grid: IGridInstance, items: Array): void; clearAllFilters(refreshRows?: boolean, clearConditions?: boolean, clearFlags?: boolean): ng.IPromise>; - clearRowInvisible(rowEntity: IGridRow): void; + clearRowInvisible(rowEntity: any): void; getVisibleRows(grid: IGridInstance): Array; handleWindowResize(): void; notifiyDataChange(type: string): void; @@ -258,7 +255,7 @@ declare module uiGrid { removeFromGridMenu(grid: IGridInstance, id: string): void; scrollTo(entity: any, colDef: IColumnDef): void; /*A row entity can be anything?*/ scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): void; - setRowInvisible(rowEntity: IGridRow): void; + setRowInvisible(rowEntity: any): void; sortHandleNulls(a: any,b: any): number; queueGridRefresh(): void; queueRefresh(): void; @@ -279,7 +276,6 @@ declare module uiGrid { scrollEnd: (scope: ng.IScope, handler: () => void) => void; } } - export interface IGridSelectionApi { toggleRowSelection: (rowEntity: IGridRow, event?: Event) => void; selectRow: (rowEntity: IGridRow, event?: Event) => void; @@ -298,7 +294,6 @@ declare module uiGrid { rowSelectionChangedBatch: (scope: ng.IScope, handler: (row: Array, event?: Event) => void) => void; } } - export interface IGridPaginationApi { getPage: () => number; getTotalPages: () => number; @@ -308,25 +303,16 @@ declare module uiGrid { on: { paginationChanged: (scope: ng.IScope, handler: (newPage: number, pageSize: number) => void) => void; } - } - + } export interface IGridRowEditApi { flushDirtyRows(grid?: IGridInstance): ng.IPromise; getDirtyRows(grid?: IGridInstance): Array; - getErrorRows(grid?: IGridInstance): Array; - /** - * NOTE: The items below expect the entities not the grid row instance - * http://ui-grid.info/docs/#/api/ui.grid.rowEdit.api:PublicApi - */ - setRowsClean(dataRows: Array): Array; - setRowsDirty(dataRows: Array): Array; - /** - * Sets the promise associated with the row save, - * mandatory that the saveRow event handler calls this method somewhere before returning. - */ + getErrorRows(grid?: IGridInstance): Array; + setRowsClean(dataRows: Array): Array; + setRowsDirty(dataRows: Array): Array; setSavePromise(rowEntity: Object, savePromise: ng.IPromise): void; on: { - saveRow: (scope: ng.IScope, handler: (rowEntity: Array) => void) => void + saveRow: (scope: ng.IScope, handler: (rowEntity: Array) => void) => void } }