From fb0e5543eede498cadff5ab40bbb6c5f7432f914 Mon Sep 17 00:00:00 2001 From: Danilo Faria Date: Tue, 4 Aug 2015 15:05:53 -0400 Subject: [PATCH] Ui-grid improvements --- ui-grid/ui-grid.d.ts | 64 +++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 15c65e50d..896a2d60e 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -112,7 +112,7 @@ declare module uiGrid { } scrollbars: { NEVER: number; - ALWAYS: number; + ALWAYS: number; } } export interface IGridInstance { @@ -247,7 +247,7 @@ declare module uiGrid { clearAllFilters(refreshRows?: boolean, clearConditions?: boolean, clearFlags?: boolean): ng.IPromise>; clearRowInvisible(rowEntity: any): void; getVisibleRows(grid: IGridInstance): Array; - handleWindowResize(): void; + handleWindowResize(): void; notifiyDataChange(type: string): void; refreshRows(): ng.IPromise; registerColumnsProcessor(processorFunction: IColumnProcessor, priority: number): void; @@ -257,23 +257,23 @@ declare module uiGrid { scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): void; setRowInvisible(rowEntity: any): void; sortHandleNulls(a: any,b: any): number; - queueGridRefresh(): void; + queueGridRefresh(): void; queueRefresh(): void; on: { sortChanged: (scope: ng.IScope, handler: (grid: IGridInstance, sortColumns: Array) => void) => void; - columnVisiblityChanged: (scope: ng.IScope, handler: (grid: IGridColumn) => void) => void; + columnVisibilityChanged: (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 + * 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; + 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; + scrollEnd: (scope: ng.IScope, handler: () => void) => void; } } export interface IGridSelectionApi { @@ -291,7 +291,7 @@ declare module uiGrid { getSelectAllState: () => boolean; on: { rowSelectionChanged: (scope: ng.IScope, handler: (row: IGridRow, event?: Event) => void) => void; - rowSelectionChangedBatch: (scope: ng.IScope, handler: (row: Array, event?: Event) => void) => void; + rowSelectionChangedBatch: (scope: ng.IScope, handler: (row: Array, event?: Event) => void) => void; } } export interface IGridPaginationApi { @@ -303,18 +303,23 @@ 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; + getErrorRows(grid?: IGridInstance): Array; setRowsClean(dataRows: Array): Array; setRowsDirty(dataRows: Array): Array; - setSavePromise(rowEntity: Object, savePromise: ng.IPromise): void; + 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; } - } + } + export interface IGridRowResizableApi { + on: { + columnSizeChanged: (scope: ng.IScope, handler: (coldDef: IColumnDef) => void) => void; + } + } export interface IGridApiConstructor { new (grid: IGridInstance): IGridApi; @@ -375,25 +380,30 @@ declare module uiGrid { core: IGridCoreApi; /** - * Selection api - */ + * Selection api + */ selection: IGridSelectionApi; - + /** - * Pagination api + * Pagination api */ pagination: IGridPaginationApi; - - + + /** - * Grid Row Edit Api - */ + * Grid Row Edit Api + */ rowEdit: IGridRowEditApi; - + + /** + * Grid row resizable Api + */ + colResizable: IGridRowResizableApi; + /** * A grid instance is made available in the gridApi. - */ + */ grid: IGridInstance; } export interface IGridRowConstructor { @@ -522,6 +532,8 @@ declare module uiGrid { } export interface IGridColumn { + /** Column definition */ + colDef: uiGrid.IColumnDef; /** * Column name that will be shown in the header. * If displayName is not provided then one is generated using the name. @@ -540,9 +552,11 @@ declare module uiGrid { filters?: Array; name?: string; /** Sort on this column */ - sort?: ISortInfo + 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; + /** Column width */ + width: number; /** * Initializes a column * @param colDef the column def to associate with this column