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.
41 lines
1.4 KiB
41 lines
1.4 KiB
8 years ago
|
import {timelineCellClassName} from '../timeline-cell-builder';
|
||
8 years ago
|
import {WorkPackageEditForm} from '../../../wp-edit-form/work-package-edit-form';
|
||
|
import {locateRow} from '../../helpers/wp-table-row-helpers';
|
||
|
import {WorkPackageTable} from '../../wp-fast-table';
|
||
|
import {WorkPackageTableRow} from '../../wp-table.interfaces';
|
||
|
import {SingleRowBuilder} from './single-row-builder';
|
||
|
|
||
8 years ago
|
import {detailsLinkClassName} from '../details-link-builder';
|
||
|
|
||
|
export class RowRefreshBuilder extends SingleRowBuilder {
|
||
8 years ago
|
|
||
|
/**
|
||
|
* Refresh a row that is currently being edited, that is, some edit fields may be open
|
||
|
*/
|
||
8 years ago
|
public refreshRow(row:WorkPackageTableRow, editForm:WorkPackageEditForm|null):HTMLElement|null {
|
||
8 years ago
|
// Get the row for the WP if refreshing existing
|
||
8 years ago
|
const rowElement = row.element || locateRow(row.workPackageId);
|
||
8 years ago
|
if (!rowElement) {
|
||
|
return null;
|
||
|
}
|
||
8 years ago
|
|
||
|
// Iterate all columns, reattaching or rendering new columns
|
||
8 years ago
|
const jRow = jQuery(rowElement);
|
||
8 years ago
|
this.columns.forEach((column:string) => {
|
||
8 years ago
|
const oldTd = jRow.find(`td.${column}`);
|
||
8 years ago
|
|
||
|
// Reattach the column if its currently being edited
|
||
8 years ago
|
if (!this.isColumnBeingEdited(editForm, column)) {
|
||
8 years ago
|
const cell = this.cellBuilder.build(row.object, column);
|
||
8 years ago
|
oldTd.replaceWith(cell);
|
||
8 years ago
|
}
|
||
|
});
|
||
|
|
||
|
return rowElement;
|
||
|
}
|
||
8 years ago
|
|
||
|
private isColumnBeingEdited(editForm:WorkPackageEditForm|null, column:string) {
|
||
|
return editForm && editForm.activeFields[column];
|
||
|
}
|
||
8 years ago
|
}
|