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