import type { ISequence } from '../internal' ; import type { Column , IDataRow , IOrderedGroup } from '../model' ; import type { ERenderMode , ICellRenderer , ICellRendererFactory , IGroupCellRenderer , IImposer , IRenderContext , ISummaryRenderer , } from './interfaces' ; import { noRenderer } from './utils' ; /**
 * helper class that renders a group renderer as a selected (e.g. median) single item
 */ export abstract class AAggregatedGroupRenderer < T extends Column > implements ICellRendererFactory { abstract readonly title : string ; abstract canRender ( col , mode ) ; abstract create ( col , context , imposer ? ) ; protected abstract aggregatedIndex ( rows , col ) ; createGroup ( col , context , imposer ? ) { const single = this . create ( col , context , imposer ) ; return { template : single . template , update : ( node , group ) => { return context . tasks . groupRows ( col , group , 'aggregated' , ( rows ) => this . aggregatedIndex ( rows , col ) ) . then ( ( data ) => { if ( typeof data !== 'symbol' ) { single . update ( node , data . row , data . index , group ) ; } } ) ; } , } ; } createSummary ( ) { return noRenderer ; } } export default AAggregatedGroupRenderer ;