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/handlers/row/hierarchy-click-handler.ts

47 lines
1.4 KiB

import {ClickOrEnterHandler} from '../click-or-enter-handler';
import {WorkPackageTableHierarchiesService} from '../../state/wp-table-hierarchy.service';
import {injectorBridge} from '../../../angular/angular-injector-bridge.functions';
import {WorkPackageTable} from '../../wp-fast-table';
import {States} from '../../../states.service';
import {TableEventHandler} from '../table-handler-registry';
import {rowClassName} from '../../builders/rows/single-row-builder';
export class HierarchyClickHandler extends ClickOrEnterHandler implements TableEventHandler {
// Injections
public states:States;
public wpTableHierarchies:WorkPackageTableHierarchiesService;
constructor(table: WorkPackageTable) {
super();
injectorBridge(this);
}
public get EVENT() {
return 'click.table.hierarchy';
}
public get SELECTOR() {
return `.${rowClassName} .wp-table--hierarchy-indicator `;
}
public eventScope(table:WorkPackageTable) {
return jQuery(table.tbody);
}
public processEvent(table: WorkPackageTable, evt:JQueryEventObject):boolean {
let target = jQuery(evt.target);
// Locate the row from event
let element = target.closest(`.${rowClassName}`);
let wpId = element.data('workPackageId');
this.wpTableHierarchies.toggle(wpId);
evt.stopImmediatePropagation();
evt.preventDefault();
return false;
}
}
HierarchyClickHandler.$inject = ['states', 'wpTableHierarchies'];