kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
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.
62 lines
1.8 KiB
62 lines
1.8 KiB
8 years ago
|
import {Subject} from "rxjs";
|
||
8 years ago
|
import {States} from "../../../states.service";
|
||
|
import {WorkPackageTable} from "../../wp-fast-table";
|
||
|
import {WorkPackageTableRow} from "../../wp-table.interfaces";
|
||
8 years ago
|
import {SingleRowBuilder} from "../rows/single-row-builder";
|
||
|
import {RowRefreshBuilder} from "../rows/row-refresh-builder";
|
||
8 years ago
|
|
||
|
export abstract class RowsBuilder {
|
||
|
public states:States;
|
||
|
|
||
8 years ago
|
protected rowBuilder:SingleRowBuilder;
|
||
8 years ago
|
protected refreshBuilder:RowRefreshBuilder;
|
||
8 years ago
|
|
||
8 years ago
|
protected stopExisting$ = new Subject();
|
||
8 years ago
|
|
||
8 years ago
|
constructor(public workPackageTable: WorkPackageTable) {
|
||
8 years ago
|
this.setupRowBuilders();
|
||
8 years ago
|
}
|
||
|
|
||
|
/**
|
||
|
* Build all rows of the table.
|
||
|
*/
|
||
8 years ago
|
public buildRows(table: WorkPackageTable): DocumentFragment {
|
||
|
this.stopExisting$.next();
|
||
|
return this.internalBuildRows(table);
|
||
|
}
|
||
|
|
||
|
public abstract internalBuildRows(table: WorkPackageTable): DocumentFragment;
|
||
8 years ago
|
|
||
8 years ago
|
|
||
|
/**
|
||
|
* Determine if this builder applies to the current view mode.
|
||
|
*/
|
||
8 years ago
|
public isApplicable(table:WorkPackageTable) {
|
||
8 years ago
|
return true;
|
||
|
}
|
||
|
|
||
8 years ago
|
/**
|
||
|
* Refresh a single row after structural changes.
|
||
|
* Will perform dirty checking for when a work package is currently being edited.
|
||
|
*/
|
||
8 years ago
|
public refreshRow(row:WorkPackageTableRow, table:WorkPackageTable):HTMLElement|null {
|
||
8 years ago
|
let editing = this.states.editing.get(row.workPackageId).value;
|
||
8 years ago
|
return this.refreshBuilder.refreshRow(row, editing);
|
||
8 years ago
|
}
|
||
|
|
||
8 years ago
|
/**
|
||
|
* Construct the single and refresh row builders for this instance
|
||
|
*/
|
||
|
protected setupRowBuilders() {
|
||
|
this.rowBuilder = new SingleRowBuilder(this.stopExisting$, this.workPackageTable);
|
||
|
this.refreshBuilder = new RowRefreshBuilder(this.stopExisting$, this.workPackageTable);
|
||
|
}
|
||
|
|
||
8 years ago
|
/**
|
||
|
* Build an empty row for the given work package.
|
||
|
*/
|
||
|
protected abstract buildEmptyRow(row:WorkPackageTableRow, table:WorkPackageTable):HTMLElement;
|
||
|
}
|
||
|
|
||
|
RowsBuilder.$inject = ['states'];
|