igniteui-angular
Version:
Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps
43 lines (42 loc) • 2.26 kB
TypeScript
import { EntityType, FieldType } from '../grids/common/grid.interface';
import { IFilteringExpression } from './filtering-expression.interface';
import { IExpressionTree, IFilteringExpressionsTree } from './filtering-expressions-tree';
export declare class ExpressionsTreeUtil {
/**
* Returns the filtering expression for a column with the provided tree and fieldName.
* ```typescript
* let filteringExpression = ExpressionsTreeUtil.find(gridExpressionTree, 'Column Field');
* ```
*/
static find(tree: IFilteringExpressionsTree, fieldName: string): IFilteringExpressionsTree | IFilteringExpression;
/**
* Returns the index of the filtering expression for a column with the provided tree and fieldName.
* ```typescript
* let filteringExpressionIndex = ExpressionsTreeUtil.findIndex(gridExpressionTree, 'Column Field');
* ```
*/
static findIndex(tree: IFilteringExpressionsTree, fieldName: string): number;
protected static isFilteringExpressionsTreeForColumn(expressionsTree: IFilteringExpressionsTree, fieldName: string): boolean;
}
/**
* Checks if the given entry is an IExpressionTree.
* @param entry The entry to check.
* @returns True if the entry is an IExpressionTree, false otherwise.
*/
export declare function isTree(entry: IExpressionTree | IFilteringExpression): entry is IExpressionTree;
/**
* Recreates the tree from a given array of entities by applying the correct operands
* for each expression and adjusting the search values to be the correct type.
* @param tree The expression tree to recreate.
* @param entities An array of entities to use for recreating the tree.
* @returns The recreated expression tree.
*/
export declare function recreateTree(tree: IExpressionTree, entities: EntityType[]): IExpressionTree;
/**
* Recreates the tree from a given array of fields by applying the correct operands.
* It is recommended to use `recreateTree` if there will be multiple entities in the tree
* with potentially colliding field names.
* @param tree The expression tree to recreate.
* @param fields An array of fields to use for recreating the tree.
*/
export declare function recreateTreeFromFields(tree: IExpressionTree, fields: FieldType[]): IExpressionTree;