import type { IDataRow , ECompareValueType } from './interfaces' ; import MultiLevelCompositeColumn , { IMultiLevelCompositeColumnDesc } from './MultiLevelCompositeColumn' ; import { concat } from '../internal' ; import { toolbar } from './annotations' ; param label returns { { type : string , label : string } } export function createNestedDesc ( label = 'Nested' , showNestedSummaries = true ) { return { type : 'nested' , label , showNestedSummaries } ; } /**
 * a nested column is a composite column where the sorting order is determined by the nested ordering of the children
 * i.e., sort by the first child if equal sort by the second child,...
 */ @ toolbar ( 'rename' , 'clone' , 'sort' , 'sortBy' ) export default class NestedColumn extends MultiLevelCompositeColumn { toCompareValue ( row ) { return concat ( this . children . map ( ( d ) => d . toCompareValue ( row ) ) ) ; } toCompareValueType ( ) { return concat ( this . children . map ( ( d ) => d . toCompareValueType ( ) ) ) ; } getLabel ( row ) { return this . children . map ( ( d ) => d . getLabel ( row ) ) . join ( ';' ) ; } getValue ( row ) { return this . children . map ( ( d ) => d . getValue ( row ) ) . join ( ';' ) ; } }