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/table-handler-registry.ts

66 lines
2.1 KiB

import {TimelineTransformer} from './state/timeline-transformer';
import {HierarchyTransformer} from './state/hierarchy-transformer';
import {HierarchyClickHandler} from './row/hierarchy-click-handler';
import {WorkPackageTable} from '../wp-fast-table';
import {RowClickHandler} from './row/click-handler';
import {RowDoubleClickHandler} from './row/double-click-handler';
import {EditCellHandler} from './cell/edit-cell-handler';
import {WorkPackageStateLinksHandler} from './row/wp-state-links-handler';
import {SelectionTransformer} from './state/selection-transformer';
import {RowsTransformer} from './state/rows-transformer';
import {ColumnsTransformer} from './state/columns-transformer';
import {GroupRowHandler} from './row/group-row-handler';
import {ContextMenuHandler} from './row/context-menu-handler';
import {ContextMenuKeyboardHandler} from './row/context-menu-keyboard-handler';
export interface TableEventHandler {
EVENT:string;
SELECTOR:string;
handleEvent(table: WorkPackageTable, evt: JQueryEventObject):void;
}
export class TableHandlerRegistry {
static eventHandlers = [
// Hierarchy expansion/collapsing
HierarchyClickHandler,
// Clicking or pressing Enter on a single cell, editable or not
EditCellHandler,
// Clicking on the details view
WorkPackageStateLinksHandler,
// Clicking on the row (not within a cell)
RowClickHandler,
RowDoubleClickHandler,
// Clicking on group headers
GroupRowHandler,
// Right clicking on rows
ContextMenuHandler,
// SHIFT+ALT+F10 on rows
ContextMenuKeyboardHandler,
];
static stateTransformers = [
SelectionTransformer,
RowsTransformer,
ColumnsTransformer,
TimelineTransformer,
HierarchyTransformer
];
static attachTo(table: WorkPackageTable) {
let body = jQuery(table.tbody);
this.stateTransformers.map((cls) => {
return new cls(table);
});
this.eventHandlers.map((cls) => {
let handler = <TableEventHandler> new cls();
body.on(handler.EVENT, handler.SELECTOR, (evt:JQueryEventObject) => {
handler.handleEvent(table, evt);
});
return handler;
});
}
}