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/modes/rows-builder.ts

40 lines
1.2 KiB

import {States} from '../../../states.service';
import {WorkPackageTable} from '../../wp-fast-table';
import {WorkPackageTableRow} from '../../wp-table.interfaces';
import {RowRefreshBuilder} from '../rows/row-refresh-builder';
import {TableRenderPass} from './table-render-pass';
import {Subject} from 'rxjs';
export abstract class RowsBuilder {
public states:States;
protected refreshBuilder:RowRefreshBuilder;
constructor(public workPackageTable:WorkPackageTable) {
this.refreshBuilder = new RowRefreshBuilder(this.workPackageTable);
}
/**
* Build all rows of the table.
*/
public abstract buildRows():TableRenderPass;
/**
* Determine if this builder applies to the current view mode.
*/
public isApplicable(table:WorkPackageTable) {
return true;
}
/**
* Refresh a single row after structural changes.
* Will perform dirty checking for when a work package is currently being edited.
*/
public refreshRow(row:WorkPackageTableRow):[HTMLElement, boolean]|null {
let editing = this.states.editing.get(row.workPackageId).value;
return this.refreshBuilder.refreshRow(row, editing);
}
}
RowsBuilder.$inject = ['states'];