import { Row } from './row' ; import { Settings } from './settings' ; import { Column } from './column' ; export class RowModelGenerator { private uidRow = 0 ; constructor ( private readonly settings , private readonly columns ) { } getUidRow ( ) { return ++ this . uidRow ; } curUidRow ( ) { return this . uidRow ; } generateRow ( row ) { if ( ! ( row instanceof Row ) ) { row = new Row ( row , this . settings ) ; } this . columns . forEach ( ( column ) => { if ( column . containsDots ) { row [ column . name ] = column . getValue ( row ) ; } } ) ; if ( ! row . $$uid ) { row . $$uid = this . getUidRow ( ) ; } return row ; } generateRows ( data ) { return data . map ( x => this . generateRow ( x ) ) ; } setRowIndexes ( rows ) { rows . forEach ( ( row , i ) => row . $$index = i ) ; } }