OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/frontend/app/components/wp-fast-table/builders/rows/plain-rows-builder.ts

45 lines
1.3 KiB

import {WorkPackageTableRow} from '../../wp-table.interfaces';
import {RowsBuilder} from './rows-builder';
import {States} from '../../../states.service';
import {injectorBridge} from '../../../angular/angular-injector-bridge.functions';
import {WorkPackageTableColumnsService} from '../../state/wp-table-columns.service';
import {WorkPackageTable} from '../../wp-fast-table';
import {SingleRowBuilder} from './single-row-builder';
export class PlainRowsBuilder extends RowsBuilder {
// Injections
public states:States;
public wpTableColumns:WorkPackageTableColumnsService;
public I18n:op.I18n;
// The group expansion state
constructor() {
super();
injectorBridge(this);
}
/**
* Rebuild the entire grouped tbody from the given table
* @param table
*/
public buildRows(table:WorkPackageTable):DocumentFragment {
let tbodyContent = document.createDocumentFragment();
table.rows.forEach((wpId:string) => {
let row = table.rowIndex[wpId];
let tr = this.buildEmptyRow(row);
row.element = tr;
tbodyContent.appendChild(tr);
});
return tbodyContent;
}
public buildEmptyRow(row:WorkPackageTableRow, table?:WorkPackageTable) {
return this.rowBuilder.buildEmpty(row.object);
}
}
PlainRowsBuilder.$inject = ['wpTableColumns', 'states', 'I18n'];