From 0b917b03d2c7b1de1f4347b0a276c16105c3f8ba Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Wed, 23 Sep 2015 20:32:32 -0600 Subject: [PATCH] Create type aliases to support use without generics --- ui-grid/ui-grid-tests.ts | 14 ++-- ui-grid/ui-grid.d.ts | 169 ++++++++++++++++++++------------------- 2 files changed, 94 insertions(+), 89 deletions(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 5e1497594..b4ba6e3ee 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -6,7 +6,7 @@ interface MyEntity { age: number; } -var columnDef: uiGrid.IColumnDef; +var columnDef: uiGrid.IColumnDefOf; columnDef.aggregationHideLabel = true; columnDef.aggregationHideLabel = false; columnDef.aggregationType = 1; @@ -19,7 +19,7 @@ columnDef.cellClass = (gridRow, gridCol, index) => { columnDef.cellFilter = 'date'; columnDef.cellTemplate = '
hello
'; columnDef.cellTooltip = 'blah'; -columnDef.cellTooltip = function (gridRow: uiGrid.IGridRow, gridCol: uiGrid.IGridColumn) { +columnDef.cellTooltip = function (gridRow: uiGrid.IGridRow, gridCol: uiGrid.IGridColumn) { return 'blah'; }; columnDef.displayName = 'Jumper'; @@ -96,7 +96,7 @@ columnDef.width = '*'; var gridApi: uiGrid.IGridApi; -var gridInstance: uiGrid.IGridInstance; +var gridInstance: uiGrid.IGridInstanceOf; var menuItem: uiGrid.IMenuItem; var colProcessor: uiGrid.IColumnProcessor; @@ -108,7 +108,7 @@ gridApi.core.queueGridRefresh() gridApi.core.queueRefresh(); gridApi.core.registerColumnsProcessor(colProcessor, 100); -var gridOptions: uiGrid.IGridOptions = { +var gridOptions: uiGrid.IGridOptionsOf = { data: [{name: 'Bob', age: 100}], onRegisterApi: (api) => { api.selection.on.rowSelectionChanged(null, (row) => { @@ -119,14 +119,14 @@ var gridOptions: uiGrid.IGridOptions = { interface AnotherEntity { anObject: string } -var anotherGridInstance: uiGrid.IGridInstance; +var anotherGridInstance: uiGrid.IGridInstance; var rowEntityToScrollTo = { anObject: 'inGridOptionsData' }; -var columnDefToScrollTo: uiGrid.IColumnDef; +var columnDefToScrollTo: uiGrid.IColumnDef; anotherGridInstance.scrollTo(); anotherGridInstance.scrollTo(rowEntityToScrollTo); anotherGridInstance.scrollTo(rowEntityToScrollTo, columnDefToScrollTo); var selectedRowEntities: Array = gridApi.selection.getSelectedRows(); -var selectedGridRows: Array> = gridApi.selection.getSelectedGridRows(); +var selectedGridRows: Array = gridApi.selection.getSelectedGridRows(); diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 3b63f6855..2b6397122 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -120,12 +120,13 @@ declare module uiGrid { ALWAYS: number; } } - export interface IGridInstance { + export type IGridInstance = IGridInstanceOf; + export interface IGridInstanceOf { /** * adds a row header column to the grid * @param {IColumnDef} colDef The column definition */ - addRowHeaderColumn(colDef: IColumnDef): void; + addRowHeaderColumn(colDef: IColumnDefOf): void; /** * uses the first row of data to assign colDef.type for any types not defined. */ @@ -193,48 +194,48 @@ declare module uiGrid { * @param {IGridColumn} col Column to access * @returns {string} Cell display value */ - getCellDisplayValue(row: IGridRow, col: IGridColumn): string; + getCellDisplayValue(row: IGridRowOf, col: IGridColumnOf): string; /** * Gets the displayed value of a cell * @param {IGridRow} row Row to access * @param {IGridColumn} col Column to access * @returns {any} Cell value */ - getCellValue(row: IGridRow, col: IGridColumn): any; + getCellValue(row: IGridRowOf, col: IGridColumnOf): any; /** * returns a grid colDef for the column name * @param {string} name Column name * @returns {IColumnDef} The column definition */ - getColDef(name: string): IColumnDef; + getColDef(name: string): IColumnDefOf; /** * returns a grid column by name * @param {string} name Column name * @returns {IGridColumn} The column */ - getColumn(name: string): IGridColumn; + getColumn(name: string): IGridColumnOf; /** * Return the columns that the grid is currently being sorted by * @returns {Array} the columns that the grid is currently being sorted by */ - getColumnSorting(): Array>; + getColumnSorting(): Array>; /** * Returns the $parse-able accessor for a column within its $scope * @param {IGridColumn} col Column object * @returns {string} $parse-able accessor for a column within its $scope */ - getGridQualifiedColField(col: IGridColumn): string; + getGridQualifiedColField(col: IGridColumnOf): string; /** * returns all columns except for rowHeader columns * @returns {Array} All data columns */ - getOnlyDataColumns(): Array>; + getOnlyDataColumns(): Array>; /** * returns the GridRow that contains the rowEntity * @param {any} rowEntity the gridOptionms.data array element instance * @param {Array} rows The rows to look in. if not provided then it looks in grid.rows */ - getRow(rowEntity: TEntity, rows?: Array>): IGridRow; + getRow(rowEntity: TEntity, rows?: Array>): IGridRowOf; /** * Triggered when the browser window resizes; automatically resizes the grid * @param {ng.IAngularEvent} $event Resize event @@ -270,7 +271,7 @@ declare module uiGrid { * @param {IGridColumn} column The column * @returns {boolean} true if the column is a row header */ - isRowHeaderColumn(column: IGridColumn): boolean; + isRowHeaderColumn(column: IGridColumnOf): boolean; /** * creates or removes GridRow objects from the newRawData array. Calls each registered * rowBuilder to further process the row @@ -309,7 +310,7 @@ declare module uiGrid { * @param {IGridRow} gridRow reference to gridRow * @returns {IGridRow} the gridRow with all additional behavior added */ - processRowBuilders(gridRow: IGridRow): IGridRow; + processRowBuilders(gridRow: IGridRowOf): IGridRowOf; /** * calls the row processors, specifically * intended to reset the sorting when an edit is called, @@ -398,7 +399,7 @@ declare module uiGrid { * ALL * @returns {Function} deregister function - a function that can be called to deregister this callback */ - registerDataChangeCallback(callback: (grid: IGridInstance) => void, types: Array): Function; + registerDataChangeCallback(callback: (grid: IGridInstanceOf) => void, types: Array): Function; /** * When the build creates rows from gridOptions.data, the rowBuilders will be called to add * additional properties to the row. @@ -437,7 +438,7 @@ declare module uiGrid { * Return the columns that the grid is currently being sorted by * @param {IGridColumn} [excludedColumn] Optional GridColumn to exclude from having its sorting reset */ - resetColumnSorting(excludedColumn: IGridColumn): void; + resetColumnSorting(excludedColumn: IGridColumnOf): void; /** * Scroll the grid such that the specified * row and column is in view @@ -445,7 +446,7 @@ declare module uiGrid { * @param {IColumnDef} colDef to make visible * @returns {ng.IPromise} a promise that is resolved after any scrolling is finished */ - scrollTo(rowEntity?: TEntity, colDef?: IColumnDef): ng.IPromise; + scrollTo(rowEntity?: TEntity, colDef?: IColumnDefOf): ng.IPromise; /** * Scrolls the grid to make a certain row and column combo visible, * in the case that it is not completely visible on the screen already. @@ -453,7 +454,7 @@ declare module uiGrid { * @param {IGridColumn} gridCol column to make visible * @returns {ng.IPromise} a promise that is resolved when scrolling is complete */ - scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): ng.IPromise; + scrollToIfNecessary(gridRow: IGridRowOf, gridCol: IGridColumnOf): ng.IPromise; /** * Set the sorting on a given column, optionally resetting any existing sorting on the Grid. * Emits the sortChanged event whenever the sort criteria are changed. @@ -465,7 +466,7 @@ declare module uiGrid { * reset any existing sorting and sort by this column only * @returns {ng.IPromise} A resolved promise that supplies the column. */ - sortColumn(column: IGridColumn, direction?: string, add?: boolean): ng.IPromise>; + sortColumn(column: IGridColumnOf, direction?: string, add?: boolean): ng.IPromise>; /** * flags all render containers to update their canvas height */ @@ -514,18 +515,19 @@ declare module uiGrid { ($scope: ng.IScope): string; } export interface IColumnBuilder { - (colDef: IColumnDef, col: IGridColumn, gridOptions: IGridOptions): void; + (colDef: IColumnDefOf, col: IGridColumnOf, gridOptions: IGridOptionsOf): void; } export interface IRowBuilder { - (row: IGridRow, gridOptions: IGridOptions): void; + (row: IGridRowOf, gridOptions: IGridOptionsOf): void; } export interface IRowProcessor { - (renderedRowsToProcess: Array>, columns: Array>): Array>; + (renderedRowsToProcess: Array>, columns: Array>): Array>; } export interface IColumnProcessor { - (renderedColumnsToProcess: Array>, rows: Array>): Array>; + (renderedColumnsToProcess: Array>, rows: Array>): Array>; } - export interface IGridOptions extends cellNav.IGridOptions, edit.IGridOptions, expandable.IGridOptions, + export type IGridOptions = IGridOptionsOf; + export interface IGridOptionsOf extends cellNav.IGridOptions, edit.IGridOptions, expandable.IGridOptions, exporter.IGridOptions, grouping.IGridOptions, importer.IGridOptions, infiniteScroll.IGridOptions, moveColumns.IGridOptions, pagination.IGridOptions, pinning.IGridOptions, resizeColumns.IGridOptions, rowEdit.IGridOptions, saveState.IGridOptions, selection.IGridOptions, treeBase.IGridOptions, @@ -542,7 +544,7 @@ declare module uiGrid { /** * Array of columnDef objects. Only required property is name. */ - columnDefs?: Array>; + columnDefs?: Array>; /** * The height of the footer rows (column footer and grid footer) in pixels */ @@ -805,14 +807,14 @@ declare module uiGrid { * @param {IGridRow} row The row for which you want the unique id * @returns {string} row uid */ - getRowIdentity?(row: IGridRow): any; + getRowIdentity?(row: IGridRowOf): any; /** * By default, rows are compared using object equality. This option can be overridden * to compare on any data item property or function * @param {IGridRow} entityA First Data Item to compare * @param {IGridRow} entityB Second Data Item to compare */ - rowEquality?(entityA: IGridRow, entityB: IGridRow): boolean; + rowEquality?(entityA: IGridRowOf, entityB: IGridRowOf): boolean; /** * This function is used to get and, if necessary, set the value uniquely identifying this row * (i.e. if an identity is not present it will set one). @@ -828,7 +830,7 @@ declare module uiGrid { * adds a row header column to the grid * @param {IColumnDef} column Column Definition */ - addRowHeaderColumn(column: IColumnDef): void; + addRowHeaderColumn(column: IColumnDefOf): void; /** * add items to the grid menu. Used by features * to add their menu items if they are enabled, can also be used by @@ -842,7 +844,7 @@ declare module uiGrid { * which is provided when you want to remove an item. The id should be unique. */ - addToGridMenu(grid: IGridInstance, items: Array): void; + addToGridMenu(grid: IGridInstanceOf, items: Array): void; /** * Clears all filters and optionally refreshes the visible rows. * @param {boolean} [refreshRows=true] Defaults to true. @@ -851,7 +853,7 @@ declare module uiGrid { * @returns {ng.IPromise} If `refreshRows` is true, returns a promise of the rows refreshing. */ clearAllFilters(refreshRows?: boolean, clearConditions?: boolean, - clearFlags?: boolean): ng.IPromise>>; + clearFlags?: boolean): ng.IPromise>>; /** * Clears any override on visibility for the row so that it returns to * using normal filtering and other visibility calculations. @@ -866,7 +868,7 @@ declare module uiGrid { * @param {IGridInstance} grid the grid you want to get visible rows from * @returns {Array} an array of gridRow */ - getVisibleRows(grid: IGridInstance): Array>; + getVisibleRows(grid: IGridInstanceOf): Array>; /** * Trigger a grid resize, normally this would be picked * up by a watch on window size, but in some circumstances it is necessary @@ -931,7 +933,7 @@ declare module uiGrid { * @param {IColumnDef} colDef to make visible * @returns {ng.IPromise} a promise that is resolved after any scrolling is finished */ - scrollTo(entity: TEntity, colDef: IColumnDef): void; /*A row entity can be anything?*/ + scrollTo(entity: TEntity, colDef: IColumnDefOf): void; /*A row entity can be anything?*/ /** * Scrolls the grid to make a certain row and column combo visible, * in the case that it is not completely visible on the screen already. @@ -939,7 +941,7 @@ declare module uiGrid { * @param {IGridColumn} gridCol column to make visible * @returns {ng.IPromise} a promise that is resolved when scrolling is complete */ - scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): void; + scrollToIfNecessary(gridRow: IGridRowOf, gridCol: IGridColumnOf): void; /** * A null handling method that can be used when building custom sort * functions @@ -1017,7 +1019,7 @@ declare module uiGrid { * Column visibility changed event handler * @param {IGridColumn} column Ui Grid column */ - (column: IGridColumn): void; + (column: IGridColumnOf): void; } export interface canvasHeightChangedHandler { /** @@ -1186,15 +1188,15 @@ declare module uiGrid { } export interface IRowColConstructor { - new (row: uiGrid.IGridRow, col: IGridColumn): IRowCol; + new (row: uiGrid.IGridRowOf, col: IGridColumnOf): IRowCol; } /** * A row and column pair that represents the intersection of these two entities */ export interface IRowCol { - row: uiGrid.IGridRow; - col: IGridColumn; + row: uiGrid.IGridRowOf; + col: IGridColumnOf; /** * Gets the intersection of where the row and column meet * @returns The value from the grid data that this RowCol points to. If the column has a cellFilter this @@ -1286,7 +1288,7 @@ declare module uiGrid { reader.readAsText( files[0] ); } */ - editFileChooserCallback?: (gridRow: uiGrid.IGridRow, gridCol: IGridColumn, files: FileList) => void; + editFileChooserCallback?: (gridRow: uiGrid.IGridRowOf, gridCol: IGridColumnOf, files: FileList) => void; /** * A bindable string value that is used when binding to edit controls instead of colDef.field * For example if you have a complex property on an object like: @@ -1498,7 +1500,7 @@ declare module uiGrid { * Raised when cell editing is complete * @param {IGridRow} row The row that was expanded */ - (row: IGridRow): void; + (row: IGridRowOf): void; } } @@ -1562,7 +1564,7 @@ declare module uiGrid { * @param {any} value The cell value * @returns {any} Formatted value */ - exporterFieldCallback?: (grid: IGridInstance, row: uiGrid.IGridRow, col: IGridColumn, value: any) => any; + exporterFieldCallback?: (grid: IGridInstanceOf, row: uiGrid.IGridRowOf, col: IGridColumnOf, value: any) => any; /** * A function to apply to the header displayNames before exporting. Useful for internationalisation, * for example if you were using angular-translate you'd set this to $translate.instant. @@ -1939,7 +1941,7 @@ declare module uiGrid { * @param {IGridColumn} col the column which on which aggregation changed. * The aggregation type is available as col.treeAggregation.type */ - (col: IGridColumn): void; + (col: IGridColumnOf): void; } export interface groupingChangedHandler { @@ -1948,7 +1950,7 @@ declare module uiGrid { * @param {IGridColumn} col the column which on which grouping changed. * The new grouping is available as col.grouping */ - (col: IGridColumn): void; + (col: IGridColumnOf): void; } /** @@ -1973,7 +1975,7 @@ declare module uiGrid { * @param {IGridInstance} grid The grid we're importing into, may be useful in some way * @param {Array} newObjects An array of new objects that you should add to your data */ - importerDataAddCallback?: (grid: IGridInstance, newObjects: Array) => void; + importerDataAddCallback?: (grid: IGridInstanceOf, newObjects: Array) => void; /** * A callback function that provides custom error handling, * rather than the standard grid behaviour of an alert box and a console message. @@ -1990,7 +1992,7 @@ declare module uiGrid { * @param {any} context the context data that importer would have appended to that console message, * often the file content itself or the element that is in error */ - importerErrorCallback?: (grid: IGridInstance, errorKey: string, consoleMessage: string, + importerErrorCallback?: (grid: IGridInstanceOf, errorKey: string, consoleMessage: string, context: any) => void; /** * A callback function that will filter (usually translate) a single header. @@ -2010,7 +2012,7 @@ declare module uiGrid { * @returns {any} The modified object * @default angular.identity */ - importerObjectCallback?: (grid: IGridInstance, newObject: TEntity) => TEntity; + importerObjectCallback?: (grid: IGridInstanceOf, newObject: TEntity) => TEntity; /** * A callback function that will process headers using custom * logic. Set this callback function if the headers that your user will provide in their @@ -2029,7 +2031,7 @@ declare module uiGrid { * which you need to match to column.names * @returns {Array} array of matching column names, in the same order as the headerArray */ - importerProcessHeaders?: (grid: IGridInstance, headerArray: Array) => Array; + importerProcessHeaders?: (grid: IGridInstanceOf, headerArray: Array) => Array; /** * Whether or not importer is enabled. Automatically set * to false if the user's browser does not support the required fileApi. @@ -2132,7 +2134,7 @@ declare module uiGrid { * @param {boolean} scrollDown flag that there are pages downwards, so fire infinite scroll events downward * @returns {ng.IPromise} A promise that is resolved when scrolling finishes */ - dataRemovedBottom(grid: IGridInstance, scrollUp: boolean, scrollDown: boolean): ng.IPromise; + dataRemovedBottom(grid: IGridInstanceOf, scrollUp: boolean, scrollDown: boolean): ng.IPromise; /** * Adjusts the scroll position after you've removed data at the bottom * @param {boolean} scrollUp flag that there are pages upwards, fire infinite scroll events upward @@ -2151,7 +2153,7 @@ declare module uiGrid { * @param {boolean} scrollDown flag that there are pages downwards, so fire infinite scroll events downward * @returns {ng.IPromise} A promise that is resolved when scrolling finishes */ - dataRemovedTop(grid: IGridInstance, scrollUp: boolean, scrollDown: boolean): ng.IPromise; + dataRemovedTop(grid: IGridInstanceOf, scrollUp: boolean, scrollDown: boolean): ng.IPromise; /** * Call this function when you have taken some action that makes the current scroll position invalid. * For example, if you're using external sorting and you've resorted then you might reset the scroll, @@ -2367,7 +2369,7 @@ declare module uiGrid { * @param {IGridColumn} col The column being pinned * @param {string} container One of the recognized container types from uiGridPinningConstants */ - pinColumn(col: IGridColumn, container: string): void; + pinColumn(col: IGridColumnOf, container: string): void; // Events /** @@ -2469,19 +2471,19 @@ declare module uiGrid { * @returns {ng.IPromise>} a promise that represents the aggregate of all of the individual save * promises. i.e. it will be resolved when all the individual save promises have been resolved. */ - flushDirtyRows(grid?: IGridInstance): ng.IPromise>; + flushDirtyRows(grid?: IGridInstanceOf): ng.IPromise>; /** * Returns all currently dirty rows * @param {IGridInstance} grid The target grid * @returns {Array} An array of gridRows that are currently dirty */ - getDirtyRows(grid?: IGridInstance): Array>; + getDirtyRows(grid?: IGridInstanceOf): Array>; /** * Returns all currently errored rows * @param {IGridInstance} grid The target grid * @returns {Array} An array of gridRows that are currently in error */ - getErrorRows(grid?: IGridInstance): Array>; + getErrorRows(grid?: IGridInstanceOf): Array>; /** * Sets each of the rows passed in dataRows to be clean, * removing them from the dirty cache and the error cache, @@ -2827,7 +2829,7 @@ declare module uiGrid { * returns all selected rows as gridRows * @returns {Array} The selected rows */ - getSelectedGridRows(): Array>; + getSelectedGridRows(): Array>; /** * Gets selected rows as entities * @returns {Array} Selected row entities @@ -2907,7 +2909,7 @@ declare module uiGrid { * @param {IGridRow} row The selected rows * @param {ng.IAngularEvent} event object if raised from event */ - (row: uiGrid.IGridRow, event?: ng.IAngularEvent): void; + (row: uiGrid.IGridRowOf, event?: ng.IAngularEvent): void; } export interface rowSelectionChangedBatchHandler { @@ -2916,7 +2918,7 @@ declare module uiGrid { * @param {IGridRow} row The selected rows * @param {ng.IAngularEvent} event object if raised from event */ - (row: Array>, event?: ng.IAngularEvent): void; + (row: Array>, event?: ng.IAngularEvent): void; } } @@ -2951,7 +2953,7 @@ declare module uiGrid { * @param {IGridRow} row Row objet */ customerTreeAggregationFn?: (aggregation: IGridTreeBaseAggregationObject, fieldValue: any, numValue: number, - row: IGridRow) => void; + row: IGridRowOf) => void; /** * A custom label to use for this aggregation. If providedm, we don't use native i18n */ @@ -3052,7 +3054,7 @@ declare module uiGrid { export interface IGridTreeBaseCustomAggregation { label: string; aggregationFn: (aggregation: IGridTreeBaseAggregationObject, fieldValue: any, numValue: number, - row?: IGridRow) => void; + row?: IGridRowOf) => void; finalizerFn?: (aggregation: IGridTreeBaseAggregationObject) => void; } export interface IGridTreeBaseAggregationObject { @@ -3072,13 +3074,13 @@ declare module uiGrid { * collapse the specified row. When you expand the row again, all grandchildren will retain their state * @param {IGridRow} row The row to collapse */ - collapseRow(row: IGridRow): void; + collapseRow(row: IGridRowOf): void; /** * collapse all children of the specified row. When you expand the row again, all grandchildren will be * collapsed * @param {IGridRow} row The row to collapse children of */ - collapseRowChildren(row: IGridRow): void; + collapseRowChildren(row: IGridRowOf): void; /** * Expands all tree rows */ @@ -3087,13 +3089,13 @@ declare module uiGrid { * Expand the immediate children of the specified row * @param {IGridRow} row The row to expand */ - expandRow(row: IGridRow): void; + expandRow(row: IGridRowOf): void; /** * Get the children of the specified row * @param {IGridRow} row The row you want the children of * @returns Array Array of children rows */ - getRowChildren(row: IGridRow): Array>; + getRowChildren(row: IGridRowOf): Array>; /** * Get the tree state for this grid, used by the saveState feature Returned treeState as an object * ```{ expandedState: { uid: 'expanded', uid: 'collapsed' } }``` @@ -3111,7 +3113,7 @@ declare module uiGrid { * call expand if row is collapsed, and collapse if it is expanded * @param {IGridRow} row The row to toggle */ - toggleRowTreeState(row: IGridRow): void; + toggleRowTreeState(row: IGridRowOf): void; // Events on: { @@ -3146,7 +3148,7 @@ declare module uiGrid { * Row Collapsed callback * @param {IGridRow} row The row that was collapsed. You can also retrieve the grid from this row with row.grid */ - (row: IGridRow): void; + (row: IGridRowOf): void; } export interface rowExpandedHandler { @@ -3154,7 +3156,7 @@ declare module uiGrid { * Row Expanded callback * @param {IGridRow} row The row that was expanded. You can also retrieve the grid from this row with row.grid */ - (row: IGridRow): void; + (row: IGridRowOf): void; } /** @@ -3205,7 +3207,7 @@ declare module uiGrid { // Tree View export interface IGridApiConstructor { - new (grid: IGridInstance): IGridApi; + new (grid: IGridInstanceOf): IGridApi; } export interface IGridApi { /** @@ -3339,7 +3341,7 @@ declare module uiGrid { /** * A grid instance is made available in the gridApi. */ - grid: IGridInstance; + grid: IGridInstanceOf; } export interface IGridRowConstructor { /** @@ -3349,13 +3351,14 @@ declare module uiGrid { * @param index the current position of the row in the array * @param reference to the parent grid */ - new(entity: TEntity, index: number, reference: IGridInstance): IGridRow; + new(entity: TEntity, index: number, reference: IGridInstanceOf): IGridRowOf; } - export interface IGridRow extends cellNav.IGridRow, edit.IGridRow, exporter.IGridRow, selection.IGridRow { + export type IGridRow = IGridRowOf; + export interface IGridRowOf extends cellNav.IGridRow, edit.IGridRow, exporter.IGridRow, selection.IGridRow { /** A reference to an item in gridOptions.data[] */ entity: TEntity; /** A reference back to the grid */ - grid: IGridInstance; + grid: IGridInstanceOf; /** * height of each individual row. changing the height will flag all * row renderContainers to recalculate their canvas height @@ -3383,7 +3386,7 @@ declare module uiGrid { * Changed to just call the internal function row.clearThisRowInvisible(). * @param row the row we want to clear the invisible flag */ - clearRowInvisible(row: IGridRow): void; + clearRowInvisible(row: IGridRowOf): void; /** * Clears any override on the row visibility, returning it to normal visibility calculations. * Emits the rowsVisibleChanged event @@ -3403,13 +3406,13 @@ declare module uiGrid { * @param col column instance * @returns resulting name that can be evaluated against a row */ - getEntityQualifiedColField(col: IGridColumn): string; + getEntityQualifiedColField(col: IGridColumnOf): string; /** * returns the qualified field name as it exists on scope ie: row.entity.fieldA * @param col column instance * @returns resulting name that can be evaluated on scope */ - getQualifiedColField(col: IGridColumn): string; + getQualifiedColField(col: IGridColumnOf): string; /** * Sets an override on the row that forces it to always be invisible. * Emits the rowsVisibleChanged event if it changed the row visibility. @@ -3419,7 +3422,7 @@ declare module uiGrid { * Changed to just call the internal function row.setThisRowInvisible(). * @param row the row we want to set to invisible */ - setRowInvisible(row: IGridRow): void; + setRowInvisible(row: IGridRowOf): void; /** * Sets an override on the row that forces it to always be invisible. * Emits the rowsVisibleChanged event if it changed the row visibility @@ -3437,12 +3440,13 @@ declare module uiGrid { * @param index the current position of the column in the array * @param grid reference to the grid */ - new(gridCol: IColumnDef, index: number, grid: IGridInstance): IGridColumn; + new(gridCol: IColumnDefOf, index: number, grid: IGridInstanceOf): IGridColumnOf; } - export interface IGridColumn { + export type IGridColumn = IGridColumnOf; + export interface IGridColumnOf { /** Column definition */ - colDef: uiGrid.IColumnDef; + colDef: uiGrid.IColumnDefOf; /** * Column name that will be shown in the header. * If displayName is not provided then one is generated using the name. @@ -3472,7 +3476,7 @@ declare module uiGrid { * @param uid The unique and immutable uid we'd like to allocate to this column * @param grid the grid we'd like to create this column in */ - GridColumn(colDef: IColumnDef, uid: number, grid: IGridInstance): void; + GridColumn(colDef: IColumnDefOf, uid: number, grid: IGridInstanceOf): void; /** * Gets the aggregation label from colDef.aggregationLabel if specified or by using i18n, * including deciding whether or not to display based on colDef.aggregationHideLabel. @@ -3510,7 +3514,7 @@ declare module uiGrid { * @param propName the property name we'd like to set * @param defaultValue the value to use if the colDef doesn't provide the setting */ - setPropertyOrDefault(colDef: IColumnDef, propName: string, defaultValue: any): void; + setPropertyOrDefault(colDef: IColumnDefOf, propName: string, defaultValue: any): void; /** Makes the column visible by setting colDef.visible = true */ showColumn(): void; /** @@ -3519,7 +3523,7 @@ declare module uiGrid { * @param isNew whether the column is being newly created, if not we're updating an existing * column, and some items such as the sort shouldn't be copied down */ - updateColumnDef(colDef: IColumnDef, isNew: boolean): void; + updateColumnDef(colDef: IColumnDefOf, isNew: boolean): void; } /** @@ -3527,7 +3531,8 @@ declare module uiGrid { * which would typically be one of many column definitions within the * gridOptions.columnDefs array */ - export interface IColumnDef extends cellNav.IColumnDef, edit.IColumnDef, exporter.IColumnDef, grouping.IColumnDef, + export type IColumnDef = IColumnDefOf; + export interface IColumnDefOf extends cellNav.IColumnDef, edit.IColumnDef, exporter.IColumnDef, grouping.IColumnDef, moveColumns.IColumnDef, pinning.IColumnDef, resizeColumns.IColumnDef, treeBase.IColumnDef { /** * defaults to false @@ -3710,17 +3715,17 @@ declare module uiGrid { } export interface ICellClassGetter { - (gridRow?: IGridRow, gridCol?: IGridColumn, colRenderIndex?: number): string; + (gridRow?: IGridRowOf, gridCol?: IGridColumnOf, colRenderIndex?: number): string; } export interface ICellTooltipGetter { - (gridRow: IGridRow, gridCol: IGridColumn): string; + (gridRow: IGridRowOf, gridCol: IGridColumnOf): string; } export interface IHeaderTooltipGetter { - (gridCol: IGridColumn): string; + (gridCol: IGridColumnOf): string; } export interface IHeaderFooterCellClassGetter { - (gridRow: IGridRow, rowRenderIndex: number, gridCol: IGridColumn, colRenderIndex: number): string; + (gridRow: IGridRowOf, rowRenderIndex: number, gridCol: IGridColumnOf, colRenderIndex: number): string; } export interface IMenuItem { /** controls the title that is displayed in the menu */