UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

49 lines (48 loc) 2.62 kB
import { IRowNode } from 'ag-grid-enterprise'; import { ExpressionFunction } from '../../parser/src/types'; import { BaseParameter } from './expressionFunctionUtils'; import { AggregateParams } from './scalarAggregationHelper'; import { TypeHint } from '../../AdaptableState/Common/Types'; import { AdaptableColumnDataType } from '../../types'; /** * List of all the AggregatedScalar Functions available in AdaptableQL */ export type AggregatedScalarFunctionName = ScalarAggregationFunction | OperandFunction; export type ScalarAggregationFunction = 'SUM' | 'PERCENTAGE' | 'QUANT' | 'QUARTILE' | 'PERCENTILE' | 'PREVIOUS' | 'NEXT' | 'FIRST' | 'LAST' | 'ABSOLUTE_DIFF' | 'PERCENT_DIFF' | 'AVG' | 'MIN' | 'MAX' | 'COUNT' | 'CUMUL' | 'MEDIAN' | 'MODE' | 'DISTINCT' | 'ONLY' | 'STD_DEVIATION'; type OperandFunction = 'COL' | 'OVER' | 'GROUP_BY' | 'WEIGHT'; export interface ScalarAggregationParameter extends BaseParameter<'aggregationScalar', TypeHint<string, ScalarAggregationFunction>> { value: AggregatedScalarExpressionEvaluation; } export interface OverParameter extends BaseParameter<'operand', 'OVER'> { value: string; } export interface GroupByParameter extends BaseParameter<'operand', 'GROUP_BY'> { value: string[]; } export interface WeightParameter extends BaseParameter<'operand', 'WEIGHT'> { value: string; } export interface AggregatedScalarExpressionEvaluation { aggregationParams: AggregateParams<any, string | number>; rowValueGetter?: (rowNode: IRowNode, aggregatedValue: any) => string | number | Date | boolean; context?: { weightParam?: WeightParameter; }; sortByColumn?: string; rowFilterFn?: (rowNode: IRowNode) => boolean; getRowNodes?: () => IRowNode[]; columnType?: AdaptableColumnDataType; } export interface CumulatedAggregationValue { currentValue: number; cumulatedValues: Record<number | string, number>; numberOfCumulatedValues?: number; totalAggregationValue?: number; } export declare const aggregatedExpressionFunctions: AggregatedScalarFunctionName[]; export declare const cumulativeAggregatedExpressionFunctions: AggregatedScalarFunctionName[]; export declare const quantileAggregatedExpressionFunctions: AggregatedScalarFunctionName[]; export declare const aggregatedScalarExpressionFunctions: Record<AggregatedScalarFunctionName, ExpressionFunction>; export declare const aggregatedScalarExpressionFunctionNames: AggregatedScalarFunctionName[]; export declare const addGroupByParams: (groupByColumnNames: string[] | undefined, expressionEvaluation: AggregatedScalarExpressionEvaluation) => void; export {};