import type { IHierarchyColumnDesc , IPartialCategoryNode } from '../../model' ; import ColumnBuilder from './ColumnBuilder' ; export default class HierarchyColumnBuilder extends ColumnBuilder < IHierarchyColumnDesc > { constructor ( column ) { super ( 'hierarchy' , column ) ; } param { IPartialCategoryNode } hierarchy param { string } hierarchySeparator hierarchy ( hierarchy , hierarchySeparator ? ) { this . desc . hierarchy = hierarchy ; if ( hierarchySeparator ) { this . desc . hierarchySeparator = hierarchySeparator ; } return this ; } build ( data ) { console . assert ( Boolean ( this . desc . hierarchy ) ) ; return super . build ( data ) ; } } param { string } column param { IPartialCategoryNode } hierarchy returns { HierarchyColumnBuilder } export function buildHierarchicalColumn ( column , hierarchy ? ) { const r = new HierarchyColumnBuilder ( column ) ; if ( hierarchy ) { r . hierarchy ( hierarchy ) ; } return r ; }