Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gannt add dependency link point click event #2913

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/assets/api/en/GanttAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,20 @@ Event return parameters:
link: ITaskLink;
};
```

### CLICK_DEPENDENCY_LINK_POINT

Events that click dependency line point
Event return parameters:

```
{
event: Event;
/** click start or end link point */
point: 'start' | 'end';
/** the data order */
index: number;
/** the data info */
record: any;
};
```
17 changes: 17 additions & 0 deletions docs/assets/api/zh/GanttAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,20 @@ MOUSEENTER_TASK_BAR
link: ITaskLink;
};
```

### CLICK_DEPENDENCY_LINK_POINT

点击依赖关系点的事件
事件回传参数:

```
{
event: Event;
/** 点击的是起始点还是结束点 */
point: 'start' | 'end';
/** 第几条数据 */
index: number;
/** 点击连接点的数据信息 */
record: any;
};
```
12 changes: 12 additions & 0 deletions packages/vtable-gantt/src/event/event-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,18 @@ function bindTableGroupListener(event: EventManager) {
stateManager.hideTaskBarSelectedBorder();
scene._gantt.stateManager.selectedDenpendencyLink.link = depedencyLink;
stateManager.showDependencyLinkSelectedLine();
} else if ((isClickLeftLinkPoint || isClickRightLinkPoint) && event.poniterState === 'down') {
if (gantt.hasListeners(GANTT_EVENT_TYPE.CLICK_DEPENDENCY_LINK_POINT)) {
const taskIndex = getTaskIndexByY(e.offset.y, gantt);
const record = gantt.getRecordByIndex(taskIndex);
gantt.fireListeners(GANTT_EVENT_TYPE.CLICK_DEPENDENCY_LINK_POINT, {
event: e.nativeEvent,
index: taskIndex,
point: isClickLeftLinkPoint ? 'start' : 'end',
record
});
}
stateManager.hideTaskBarSelectedBorder();
} else if (isClickLeftLinkPoint && event.poniterState === 'draging') {
guaizi149 marked this conversation as resolved.
Show resolved Hide resolved
if (stateManager.isCreatingDependencyLine()) {
const link = stateManager.endCreateDependencyLine(e.offset.y);
Expand Down
8 changes: 7 additions & 1 deletion packages/vtable-gantt/src/ts-types/EVENT_TYPE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export interface EVENT_TYPES {
* 创建任务依赖关系
*/
CREATE_DEPENDENCY_LINK: 'create_dependency_link';

/**
* 点击依赖关系连接点
*/
CLICK_DEPENDENCY_LINK_POINT: 'click_dependency_link_point';
}
/**
* Table event types
Expand All @@ -39,5 +44,6 @@ export const GANTT_EVENT_TYPE: EVENT_TYPES = {
MOUSEENTER_TASK_BAR: 'mouseenter_task_bar',
MOUSELEAVE_TASK_BAR: 'mouseleave_task_bar',
CREATE_TASK_SCHEDULE: 'create_task_schedule',
CREATE_DEPENDENCY_LINK: 'create_dependency_link'
CREATE_DEPENDENCY_LINK: 'create_dependency_link',
CLICK_DEPENDENCY_LINK_POINT: 'click_dependency_link_point'
} as EVENT_TYPES;
8 changes: 8 additions & 0 deletions packages/vtable-gantt/src/ts-types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ export interface TableEventHandlersEventArgumentMap {
/** 依赖信息 */
link: ITaskLink;
};
click_dependency_link_point: {
event: Event;
/** 点击的是起始点还是结束点 */
point: 'start' | 'end';
/** 第几条数据 */
index: number;
record: any;
};
}

export interface TableEventHandlersReturnMap {
Expand Down