import { compile } from '@syncfusion/ej2-base' ; import { getEnumValue } from '@syncfusion/ej2-base' ; import { CustomSummaryType } from '../base/type' ; import { AggregateType , CellType } from '../base/enum' ; import { Property , Collection , ChildProperty , NumberFormatOptions , DateFormatOptions } from '@syncfusion/ej2-base' ; import { AggregateColumnModel } from './aggregate-model' ; import { ValueFormatter } from '../services/value-formatter' ; /**
 * Configures the Grid's aggregate column.
 */ export class AggregateColumn extends ChildProperty < AggregateColumn > { private formatFn : Function ; private templateFn : { [ x ] : { fn : Function ; property : string ; } ; } = { } ; aspType default @ Property ( ) public type : AggregateType | AggregateType [ ] | string ; default @ Property ( ) public field : string ; default @ Property ( ) public columnName : string ; aspType default @ Property ( ) public format : string | NumberFormatOptions | DateFormatOptions ; default @ Property ( ) public footerTemplate : string ; default @ Property ( ) public groupFooterTemplate : string ; default @ Property ( ) public groupCaptionTemplate : string ; default @ Property ( ) public customAggregate : CustomSummaryType | string ; hidden public setFormatter ( cultureName ) { let valueFormatter = new ValueFormatter ( cultureName ) ; if ( this . format && ( ( < DateFormatOptions > this . format ) . skeleton || ( < DateFormatOptions > this . format ) . format ) ) { this . formatFn = valueFormatter . getFormatFunction ( this . format as DateFormatOptions ) ; } } hidden public getFormatter ( ) { return this . formatFn ; } hidden public setTemplate ( helper = { } ) { if ( this . footerTemplate !== undefined ) { this . templateFn [ getEnumValue ( CellType , CellType . Summary ) ] = { fn : compile ( this . footerTemplate , helper ) , property : 'footerTemplate' } ; } if ( this . groupFooterTemplate !== undefined ) { this . templateFn [ getEnumValue ( CellType , CellType . GroupSummary ) ] = { fn : compile ( this . groupFooterTemplate , helper ) , property : 'groupFooterTemplate' } ; } if ( this . groupCaptionTemplate !== undefined ) { this . templateFn [ getEnumValue ( CellType , CellType . CaptionSummary ) ] = { fn : compile ( this . groupCaptionTemplate , helper ) , property : 'groupCaptionTemplate' } ; } } hidden public getTemplate ( type ) { return this . templateFn [ getEnumValue ( CellType , type ) ] ; } hidden public setPropertiesSilent ( prop ) { this . setProperties ( prop , true ) ; } } /**
 * Configures the aggregate rows.
 */ export class AggregateRow extends ChildProperty < AggregateRow > { default @ Collection < AggregateColumnModel > ( [ ] , AggregateColumn ) public columns : AggregateColumnModel [ ] ; }