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/timeline/timeline-render-pass.ts

31 lines
1.0 KiB

import {PrimaryRenderPass, RenderedRow, SecondaryRenderPass} from '../primary-render-pass';
import {TimelineRowBuilder} from './timeline-row-builder';
import {WorkPackageTable} from '../../wp-fast-table';
export class TimelineRenderPass implements SecondaryRenderPass {
/** Row builders */
protected timelineBuilder:TimelineRowBuilder;
/** Resulting timeline body */
public timelineBody:DocumentFragment;
constructor(private table:WorkPackageTable, private tablePass:PrimaryRenderPass) {
}
public render() {
// Prepare and reset the render pass
this.timelineBody = document.createDocumentFragment();
this.timelineBuilder = new TimelineRowBuilder(this.table);
// Render into timeline fragment
this.tablePass.renderedOrder.forEach((row:RenderedRow) => {
const wpId = row.isWorkPackage ? row.belongsTo!.id : null;
const secondary = this.timelineBuilder.build(wpId);
this.tablePass.augmentSecondaryElement(secondary, row);
this.timelineBody.appendChild(secondary);
});
}
}