@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
70 lines (69 loc) • 2.37 kB
TypeScript
/**
* Defines which Columns in a Layout display Aggregated values when Row-Grouped
*/
import { PivotTotalPosition } from '../LayoutState';
import type { AdaptableColumn } from './AdaptableColumn';
export type AggregationColumnValue = string | true | WeightedAverageAggregation;
/**
* Defines an Aggregated Column in a Table Layout
*/
export type TableAggregationColumns = {
/**
* The Column being Aggretated
*/
ColumnId: string;
/**
* The type of Aggregation
*/
AggFunc: AggregationColumnValue;
}[];
/**
* Defines an Aggregated Column in a Pivot Layout
*/
export type PivotAggregationColumns = {
/**
* Column which is aggregated
*/
ColumnId: string;
/**
* Aggregation function to apply to the column
*/
AggFunc: AggregationColumnValue;
/**
* Whether to show the total for this column; it can be also customized for specific Pivot Columns
*/
Total?: PivotTotalPosition | {
PivotColumnId: string;
ShowTotal?: PivotTotalPosition;
}[];
}[];
export declare const WEIGHTED_AVERAGE_AGG_FN_NAME = "weightedAvg";
export declare const ONLY_AGG_FN_NAME = "only";
/**
* Defines a Weighted Average Agg
*/
export interface WeightedAverageAggregation {
/**
* Type is always 'weightedAverage'
*/
type: 'weightedAverage';
/**
* Column which is weighted
*/
weightedColumnId: string;
}
export declare const isWeightedAverageAggFuncName: (aggFunc: string) => aggFunc is "weightedAvg";
export declare const isWeightedAverageAggregation: (aggFunc: TableAggregationColumns[0]["AggFunc"]) => aggFunc is WeightedAverageAggregation;
export declare const getAggFuncName: (aggFunc: TableAggregationColumns[0]["AggFunc"]) => string | true;
/**
* Whether the Weighted Average aggregation should be offered for this Column:
* it must be a numeric, aggregatable Column that either has no agg-func
* restriction or explicitly allows `weightedAvg`.
*/
export declare const isWeightedAverageAggFuncEligible: (column: AdaptableColumn) => boolean;
/**
* Returns the Column's available aggregation function names ordered for display,
* ensuring `weightedAvg` is positioned right after `avg` (and only present when
* the Column is eligible for Weighted Average).
*/
export declare const getDisplayAggFuncNames: (column: AdaptableColumn) => string[];