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-row-builder.ts

45 lines
1.5 KiB

import {WorkPackageTable} from '../../wp-fast-table';
import {$injectFields} from '../../../angular/angular-injector-bridge.functions';
import {States} from '../../../states.service';
import {WorkPackageTableTimelineService} from '../../state/wp-table-timeline.service';
import {WorkPackageCacheService} from '../../../work-packages/work-package-cache.service';
import {commonRowClassName} from '../rows/single-row-builder';
export const timelineCellClassName = 'wp-timeline-cell';
export class TimelineRowBuilder {
public states:States;
public wpTableTimeline:WorkPackageTableTimelineService;
public wpCacheService:WorkPackageCacheService;
constructor(protected workPackageTable:WorkPackageTable) {
$injectFields(this, 'states', 'wpTableTimeline', 'wpCacheService');
}
public build(workPackageId:string|null) {
const cell = document.createElement('div');
cell.classList.add(timelineCellClassName, commonRowClassName);
if (workPackageId) {
cell.dataset['workPackageId'] = workPackageId;
}
return cell;
}
/**
* Build and insert a timeline row for the given work package using the additional classes.
* @param workPackage
* @param timelineBody
* @param rowClasses
*/
public insert(workPackageId:string | null,
timelineBody:DocumentFragment | HTMLElement,
rowClasses:string[] = []) {
const cell = this.build(workPackageId);
cell.classList.add(...rowClasses);
timelineBody.appendChild(cell);
}
}