@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
150 lines (149 loc) • 5.19 kB
TypeScript
import { AdaptableColumn } from '../AdaptableState/Common/AdaptableColumn';
import { ColumnScope, ScopeDataType } from '../AdaptableState/Common/ColumnScope';
import { CellColorRange } from '../AdaptableState/StyledColumnState';
/**
* Provides access to a suite of functions related to the `Column Scope` object
*/
export interface ColumnScopeApi {
/**
* True if Column is in given Scope
* @param column Column to check
* @param scope The Scope to check
*/
isColumnInScope(column: AdaptableColumn | undefined, scope: ColumnScope): boolean;
/**
* Returns list of all Columns in the given Scope
* @param scope the Scope to check
*/
getColumnsInScope(scope: ColumnScope): AdaptableColumn[];
/**
* True if Scope is empty
* @param scope Scope to check
*/
scopeIsEmpty(scope: ColumnScope): boolean;
/**
* True if Scope is 'All'
* @param scope Scope to check
*/
scopeIsAll(scope: ColumnScope): boolean;
/**
* True if Scope contains DataTypes
* @param scope Scope to check
*/
scopeHasDataType(scope: ColumnScope): boolean;
/**
* True if Scope contains ColumnTypes
* @param scope Scope to check
*/
scopeHasColumnType(scope: ColumnScope): boolean;
/**
* True if Scope is DataTypes and contains just 'Boolean'
* @param scope Scope to check
*/
scopeHasOnlyBooleanDataType(scope: ColumnScope): boolean;
/**
* True if Scope contains just 1 ColumnId
* @param scope Scope to check
*/
isSingleColumnScope(scope: ColumnScope): boolean;
/**
* Gets the only Column in given Scope
* @param scope Scope to check
*/
getSingleColumnInScope(scope: ColumnScope): string | undefined;
/**
* True if Scope contains just 1 numeric Column
* @param scope Scope to check
*/
isSingleNumericColumnScope(scope: ColumnScope): boolean;
/**
* True if Scope contains just 1 boolean Column
* @param scope Scope to check
*/
isSingleBooleanColumnScope(scope: ColumnScope): boolean;
/**
* True if all selected columns are boolean
* @param scope Scope to check
*/
areAllBooleanColumnsInScope(scope: ColumnScope): boolean;
/**
* True if Scope contains ColumnIds
* @param scope Scope to check
*/
scopeHasColumns(scope: ColumnScope): boolean;
/**
* Gets string representation of the Scope
* @param scope Scope to check
*/
getScopeToString(scope: ColumnScope): string;
/**
* Whether PK column is included in Scope's column section
* @param scope Scope to check
*/
isPrimaryKeyColumnInScopeColumns(scope: ColumnScope): boolean;
/**
* True if Column is in Scope's 'ColumnIds' section
* @param column Column to check
* @param scope Scope to check
*/
isColumnInScopeColumns(column: AdaptableColumn, scope: ColumnScope): boolean;
/**
* Returns all the ColumnIds in the Scope
* @param scope Scope to check
*/
getColumnIdsInScope(scope: ColumnScope): string[] | undefined;
/**
* Returns all the ColumnTypes in the Scope
* @param scope Scope to check
*/
getColumnTypesInScope(scope: ColumnScope): string[] | undefined;
/**
* Returns all the DataTypes in the Scope
* @param scope Scope to check
*/
getDataTypesInScope(scope: ColumnScope): ScopeDataType[] | undefined;
/**
* True if Scope has Numeric DataType containing Column
* @param column Column to check
* @param scope Scope to check
*/
isColumnInNumericScope(column: AdaptableColumn, scope: ColumnScope): boolean;
/**
* True if Scope has text DataType containing Column
* @param column Column to check
* @param scope Scope to check
*/
isColumnInTextScope(column: AdaptableColumn, scope: ColumnScope): boolean;
/**
* True if Scope has Data DataType which contains Column
* @param column Column to check
* @param scope Scope to check
*/
isColumnInDateScope(column: AdaptableColumn, scope: ColumnScope): boolean;
/**
* True if first scope is in second Scope
*
* Scope A | Scope B | Result
* ===========================================================================
* All * true
* * All true
* DataTypes DataTypes all DataTypes from A should be in B
* ColumnIds ColumnIds all ColumnIds from A should be in B
* ColumnIds DataTypes all DataTypes of ColumnIds from A should be in B
* DataTypes ColumnIds false
*
* @param scopeA first Scope
* @param scopeB second Scope
*/
isScopeInScope(scopeA: ColumnScope, scopeB: ColumnScope): boolean;
/**
* Provides a description for the Scope
* @param scope The Scope to check
*/
getScopeDescription(scope: ColumnScope): string;
/**
* Creates Cell Color Ranges (used in Format Column) for given Scope
* @param scope Scope to use
*/
createCellColorRangesForScope(scope: ColumnScope): CellColorRange[];
}