@progress/kendo-angular-gantt 21.4.1-develop.1 → 22.0.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/columns/column-base.component.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-gantt.mjs +201 -201
- package/localization/messages.d.ts +1 -1
- package/package.json +22 -30
- package/rendering/gantt-task-base.d.ts +1 -1
- package/schematics/ngAdd/index.js +7 -7
- package/timeline/view-base.d.ts +1 -1
- package/esm2022/binding-directives/flat-binding.directive.mjs +0 -50
- package/esm2022/binding-directives/hierarchy-binding.directive.mjs +0 -49
- package/esm2022/columns/cell-template.directive.mjs +0 -47
- package/esm2022/columns/column-base.component.mjs +0 -22
- package/esm2022/columns/column-group.component.mjs +0 -80
- package/esm2022/columns/column-menu-template.directive.mjs +0 -40
- package/esm2022/columns/column.component.mjs +0 -122
- package/esm2022/columns/columns.mjs +0 -15
- package/esm2022/columns/edit-template.directive.mjs +0 -46
- package/esm2022/columns/filter-cell-template.directive.mjs +0 -32
- package/esm2022/columns/filter-menu-template.directive.mjs +0 -41
- package/esm2022/columns/footer-template.directive.mjs +0 -44
- package/esm2022/columns/header-template.directive.mjs +0 -43
- package/esm2022/columns/span-column.component.mjs +0 -82
- package/esm2022/common/default-callbacks.mjs +0 -25
- package/esm2022/common/mapping.service.mjs +0 -62
- package/esm2022/common/option-changes.service.mjs +0 -28
- package/esm2022/dependencies/dependency-dom.service.mjs +0 -80
- package/esm2022/dependencies/dom-dependency-args.mjs +0 -5
- package/esm2022/dependencies/gantt-dependency.directive.mjs +0 -91
- package/esm2022/dependencies/utils.mjs +0 -195
- package/esm2022/directives.mjs +0 -63
- package/esm2022/dragging/dependency-drag-create.directive.mjs +0 -337
- package/esm2022/dragging/drag-validation-tooltip.component.mjs +0 -70
- package/esm2022/dragging/task-drag.directive.mjs +0 -94
- package/esm2022/dragging/task-drag.service.mjs +0 -239
- package/esm2022/editing/add-task.component.mjs +0 -127
- package/esm2022/editing/dependencies-table.component.mjs +0 -233
- package/esm2022/editing/edit-dialog.component.mjs +0 -225
- package/esm2022/editing/edit.service.mjs +0 -118
- package/esm2022/editing/task-fields.component.mjs +0 -127
- package/esm2022/editing/utils.mjs +0 -15
- package/esm2022/expanded-state/expand-event.mjs +0 -18
- package/esm2022/expanded-state/expandable.directive.mjs +0 -39
- package/esm2022/gantt.component.mjs +0 -2415
- package/esm2022/gantt.module.mjs +0 -132
- package/esm2022/index.mjs +0 -42
- package/esm2022/localization/custom-messages.component.mjs +0 -52
- package/esm2022/localization/gantt-localization.service.mjs +0 -27
- package/esm2022/localization/localized-messages.directive.mjs +0 -39
- package/esm2022/localization/messages.mjs +0 -453
- package/esm2022/models/cell-content-type.interface.mjs +0 -5
- package/esm2022/models/class-callbacks.mjs +0 -5
- package/esm2022/models/column-menu-settings.interface.mjs +0 -5
- package/esm2022/models/column-reorder-config.mjs +0 -5
- package/esm2022/models/current-time-settings.interface.mjs +0 -5
- package/esm2022/models/date-range.interface.mjs +0 -5
- package/esm2022/models/dependency-type.enum.mjs +0 -32
- package/esm2022/models/events/cell-click-event.interface.mjs +0 -5
- package/esm2022/models/events/cell-close-event.interface.mjs +0 -44
- package/esm2022/models/events/click-event.interface.mjs +0 -5
- package/esm2022/models/events/column-locked-change-event.interface.mjs +0 -5
- package/esm2022/models/events/column-reorder-event.interface.mjs +0 -5
- package/esm2022/models/events/column-resize-event.interface.mjs +0 -5
- package/esm2022/models/events/column-visibility-change-event.interface.mjs +0 -5
- package/esm2022/models/events/data-state-change-event.interface.mjs +0 -5
- package/esm2022/models/events/dependency-add-event.interface.mjs +0 -5
- package/esm2022/models/events/index.mjs +0 -5
- package/esm2022/models/events/selected-view-change-event.interface.mjs +0 -5
- package/esm2022/models/events/task-add-event.interface.mjs +0 -5
- package/esm2022/models/events/task-click-event.interface.mjs +0 -5
- package/esm2022/models/events/task-delete-event.interface.mjs +0 -5
- package/esm2022/models/events/task-drag-event.interface.mjs +0 -5
- package/esm2022/models/events/task-edit-event.interface.mjs +0 -5
- package/esm2022/models/filterable-settings.mjs +0 -5
- package/esm2022/models/gantt-dependency-model-fields.interface.mjs +0 -13
- package/esm2022/models/gantt-dependency.interface.mjs +0 -5
- package/esm2022/models/gantt-task-model-fields.interface.mjs +0 -15
- package/esm2022/models/gantt-task.interface.mjs +0 -5
- package/esm2022/models/models.mjs +0 -8
- package/esm2022/models/slot.interface.mjs +0 -5
- package/esm2022/models/sort-settings.mjs +0 -17
- package/esm2022/models/splitter-pane-options.interface.mjs +0 -20
- package/esm2022/models/timeline-header-date-format.mjs +0 -5
- package/esm2022/models/timeline-options.interface.mjs +0 -5
- package/esm2022/models/timeline-view.mjs +0 -5
- package/esm2022/models/toolbar-settings.mjs +0 -5
- package/esm2022/models/tooltip-options.interface.mjs +0 -5
- package/esm2022/models/view-item.interface.mjs +0 -5
- package/esm2022/navigation/navigation-models.mjs +0 -5
- package/esm2022/navigation/navigation.service.mjs +0 -271
- package/esm2022/navigation/utils.mjs +0 -61
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-gantt.mjs +0 -8
- package/esm2022/rendering/gantt-header-table-body.component.mjs +0 -61
- package/esm2022/rendering/gantt-milestone-task.component.mjs +0 -102
- package/esm2022/rendering/gantt-summary-task.component.mjs +0 -157
- package/esm2022/rendering/gantt-task-base.mjs +0 -230
- package/esm2022/rendering/gantt-task.component.mjs +0 -227
- package/esm2022/rendering/gantt-tasks-table-body.component.mjs +0 -206
- package/esm2022/scrolling/drag-scroll-settings.mjs +0 -20
- package/esm2022/scrolling/scroll-sync.service.mjs +0 -83
- package/esm2022/scrolling/timeline-scroll.directive.mjs +0 -83
- package/esm2022/scrolling/timeline-scroll.service.mjs +0 -37
- package/esm2022/scrolling/utils.mjs +0 -77
- package/esm2022/selection/selectable.directive.mjs +0 -126
- package/esm2022/selection/selection-change-event.mjs +0 -5
- package/esm2022/template-directives/summary-task-template.directive.mjs +0 -43
- package/esm2022/template-directives/task-content-template.directive.mjs +0 -46
- package/esm2022/template-directives/task-drag-tooltip-template.directive.mjs +0 -47
- package/esm2022/template-directives/task-template.directive.mjs +0 -41
- package/esm2022/template-directives/task-tooltip-template.directive.mjs +0 -48
- package/esm2022/timeline/current-time-marker.service.mjs +0 -90
- package/esm2022/timeline/gantt-timeline.component.mjs +0 -624
- package/esm2022/timeline/timeline-base-view.service.mjs +0 -201
- package/esm2022/timeline/timeline-day-view.component.mjs +0 -49
- package/esm2022/timeline/timeline-day-view.service.mjs +0 -68
- package/esm2022/timeline/timeline-month-view.component.mjs +0 -49
- package/esm2022/timeline/timeline-month-view.service.mjs +0 -66
- package/esm2022/timeline/timeline-view.service.mjs +0 -38
- package/esm2022/timeline/timeline-week-view.component.mjs +0 -49
- package/esm2022/timeline/timeline-week-view.service.mjs +0 -62
- package/esm2022/timeline/timeline-year-view.component.mjs +0 -49
- package/esm2022/timeline/timeline-year-view.service.mjs +0 -57
- package/esm2022/timeline/view-base.mjs +0 -73
- package/esm2022/toolbar/toolbar-navigation.service.mjs +0 -29
- package/esm2022/toolbar/toolbar-template.directive.mjs +0 -56
- package/esm2022/toolbar/toolbar.component.mjs +0 -181
- package/esm2022/toolbar/view-selector.component.mjs +0 -112
- package/esm2022/utils.mjs +0 -311
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Directive, EventEmitter, Output } from '@angular/core';
|
|
6
|
-
import { TaskDragService } from './task-drag.service';
|
|
7
|
-
import { DragTargetContainerDirective } from '@progress/kendo-angular-utils';
|
|
8
|
-
import { Subscription } from 'rxjs';
|
|
9
|
-
import { GanttComponent } from '../gantt.component';
|
|
10
|
-
import { getEditItem } from '../editing/utils';
|
|
11
|
-
import { MappingService } from '../common/mapping.service';
|
|
12
|
-
import { hasObservers } from '@progress/kendo-angular-common';
|
|
13
|
-
import * as i0 from "@angular/core";
|
|
14
|
-
import * as i1 from "../gantt.component";
|
|
15
|
-
import * as i2 from "../common/mapping.service";
|
|
16
|
-
import * as i3 from "@progress/kendo-angular-utils";
|
|
17
|
-
import * as i4 from "./task-drag.service";
|
|
18
|
-
/**
|
|
19
|
-
* Represents the Gantt task drag directive.
|
|
20
|
-
*
|
|
21
|
-
* Use this directive to enable dragging of tasks in the Gantt. The directive listens and emits events with information about the dragged task.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```html
|
|
25
|
-
* <kendo-gantt [data]="tasks" kendoGanttTaskDrag (taskDrag)="onTaskDrag($event)" (taskDragEnd)="onTaskDragEnd($event)">
|
|
26
|
-
* </kendo-gantt>
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @remarks
|
|
30
|
-
* Applied to: {@link GanttComponent}
|
|
31
|
-
*/
|
|
32
|
-
export class TaskDragDirective {
|
|
33
|
-
/**
|
|
34
|
-
* Emits while the user resizes or moves a task by dragging.
|
|
35
|
-
*/
|
|
36
|
-
taskDrag = new EventEmitter();
|
|
37
|
-
/**
|
|
38
|
-
* Fires when the user finishes dragging to resize or move a task.
|
|
39
|
-
* The event data gives you all information needed to update the task and related tasks.
|
|
40
|
-
*/
|
|
41
|
-
taskDragEnd = new EventEmitter();
|
|
42
|
-
subs = new Subscription();
|
|
43
|
-
constructor(gantt, mapper, dragTargetContainer, taskDragService) {
|
|
44
|
-
dragTargetContainer.mode = 'manual';
|
|
45
|
-
dragTargetContainer.dragTargetFilter = '.k-resize-handle, .k-task, .k-task-draghandle';
|
|
46
|
-
dragTargetContainer.cursorStyle = null;
|
|
47
|
-
dragTargetContainer.threshold = 5;
|
|
48
|
-
this.subs.add(dragTargetContainer.onDragStart.subscribe((args) => {
|
|
49
|
-
taskDragService.onDragStart(args);
|
|
50
|
-
}));
|
|
51
|
-
this.subs.add(dragTargetContainer.onDrag.subscribe((args) => {
|
|
52
|
-
taskDragService.onDrag(args);
|
|
53
|
-
}));
|
|
54
|
-
this.subs.add(dragTargetContainer.onDragEnd.subscribe((args) => {
|
|
55
|
-
taskDragService.onDragEnd(args);
|
|
56
|
-
}));
|
|
57
|
-
this.subs.add(taskDragService.drag.subscribe((args) => {
|
|
58
|
-
hasObservers(this.taskDrag) && this.taskDrag.emit({
|
|
59
|
-
start: args.start,
|
|
60
|
-
end: args.end,
|
|
61
|
-
completionRatio: args.completionRatio,
|
|
62
|
-
item: getEditItem(args.item, gantt.treeList.view.data, mapper),
|
|
63
|
-
dragEvent: args.dragEvent
|
|
64
|
-
});
|
|
65
|
-
}));
|
|
66
|
-
this.subs.add(taskDragService.dragEnd.subscribe((args) => {
|
|
67
|
-
hasObservers(this.taskDragEnd) && this.taskDragEnd.emit({
|
|
68
|
-
start: args.start,
|
|
69
|
-
end: args.end,
|
|
70
|
-
completionRatio: args.completionRatio,
|
|
71
|
-
item: getEditItem(args.item, gantt.treeList.view.data, mapper),
|
|
72
|
-
dragEvent: args.dragEvent
|
|
73
|
-
});
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
ngOnDestroy() {
|
|
77
|
-
this.subs.unsubscribe();
|
|
78
|
-
}
|
|
79
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TaskDragDirective, deps: [{ token: i1.GanttComponent }, { token: i2.MappingService }, { token: i3.DragTargetContainerDirective }, { token: i4.TaskDragService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
80
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: TaskDragDirective, isStandalone: true, selector: "[kendoGanttTaskDrag]", outputs: { taskDrag: "taskDrag", taskDragEnd: "taskDragEnd" }, providers: [TaskDragService], hostDirectives: [{ directive: i3.DragTargetContainerDirective }], ngImport: i0 });
|
|
81
|
-
}
|
|
82
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TaskDragDirective, decorators: [{
|
|
83
|
-
type: Directive,
|
|
84
|
-
args: [{
|
|
85
|
-
selector: '[kendoGanttTaskDrag]',
|
|
86
|
-
standalone: true,
|
|
87
|
-
providers: [TaskDragService],
|
|
88
|
-
hostDirectives: [DragTargetContainerDirective]
|
|
89
|
-
}]
|
|
90
|
-
}], ctorParameters: () => [{ type: i1.GanttComponent }, { type: i2.MappingService }, { type: i3.DragTargetContainerDirective }, { type: i4.TaskDragService }], propDecorators: { taskDrag: [{
|
|
91
|
-
type: Output
|
|
92
|
-
}], taskDragEnd: [{
|
|
93
|
-
type: Output
|
|
94
|
-
}] } });
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Injectable, NgZone } from '@angular/core';
|
|
6
|
-
import { Subject } from 'rxjs';
|
|
7
|
-
import { MappingService } from '../common/mapping.service';
|
|
8
|
-
import { isPresent } from '@progress/kendo-angular-common';
|
|
9
|
-
import * as i0 from "@angular/core";
|
|
10
|
-
import * as i1 from "../common/mapping.service";
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
export class TaskDragService {
|
|
15
|
-
mapper;
|
|
16
|
-
zone;
|
|
17
|
-
taskDraggable;
|
|
18
|
-
drag = new Subject();
|
|
19
|
-
dragEnd = new Subject();
|
|
20
|
-
dragStart = new Subject();
|
|
21
|
-
tasksContainer;
|
|
22
|
-
tasksContainerRect;
|
|
23
|
-
scrollableContainer;
|
|
24
|
-
currentDragTask;
|
|
25
|
-
currentDragTaskRect;
|
|
26
|
-
leftDragHandle;
|
|
27
|
-
rightDragHandle;
|
|
28
|
-
completionRatioHandle;
|
|
29
|
-
tasks = [];
|
|
30
|
-
editedProp;
|
|
31
|
-
prevX;
|
|
32
|
-
prevWidth;
|
|
33
|
-
prevLeft;
|
|
34
|
-
prevScrollLeft;
|
|
35
|
-
newRange;
|
|
36
|
-
offsetX;
|
|
37
|
-
maxWidth;
|
|
38
|
-
newCompletionRatio;
|
|
39
|
-
constructor(mapper, zone) {
|
|
40
|
-
this.mapper = mapper;
|
|
41
|
-
this.zone = zone;
|
|
42
|
-
}
|
|
43
|
-
registerTask(task) {
|
|
44
|
-
if (!this.tasks.some(t => t === task)) {
|
|
45
|
-
this.tasks.push(task);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
onDragStart(args) {
|
|
49
|
-
this.tasksContainerRect = this.tasksContainer.getBoundingClientRect();
|
|
50
|
-
this.currentDragTask = this.tasks.find(t => t.taskElement.nativeElement.contains(args.dragTarget) || t.taskElement.nativeElement.nextElementSibling === args.dragTarget);
|
|
51
|
-
const taskEl = this.currentDragTask.taskElement.nativeElement;
|
|
52
|
-
this.currentDragTaskRect = taskEl.getBoundingClientRect();
|
|
53
|
-
this.completionRatioHandle = args.dragTarget.classList.contains('k-task-draghandle');
|
|
54
|
-
this.leftDragHandle = args.dragTarget.classList.contains('k-resize-w');
|
|
55
|
-
this.rightDragHandle = args.dragTarget.classList.contains('k-resize-e');
|
|
56
|
-
if (this.leftDragHandle) {
|
|
57
|
-
this.editedProp = 'start';
|
|
58
|
-
}
|
|
59
|
-
else if (this.rightDragHandle) {
|
|
60
|
-
this.editedProp = 'end';
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
this.editedProp = 'both';
|
|
64
|
-
}
|
|
65
|
-
this.dragStart.next(args);
|
|
66
|
-
}
|
|
67
|
-
onDrag(args) {
|
|
68
|
-
if (this.completionRatioHandle) { // completion ratio handle drag
|
|
69
|
-
const taskWidth = this.currentDragTaskRect.width;
|
|
70
|
-
const scrollLeft = this.scrollableContainer?.scrollLeft;
|
|
71
|
-
const scrollDelta = isPresent(this.prevScrollLeft) ? this.prevScrollLeft - scrollLeft : 0;
|
|
72
|
-
const completionWidth = Math.min(Math.max(args.dragEvent.clientX - this.currentDragTaskRect.left - scrollDelta, 0), taskWidth);
|
|
73
|
-
const newCompletionRatio = completionWidth / taskWidth;
|
|
74
|
-
this.currentDragTask.draggedCompletionWidth = completionWidth;
|
|
75
|
-
!this.prevScrollLeft && (this.prevScrollLeft = scrollLeft);
|
|
76
|
-
this.newCompletionRatio = newCompletionRatio;
|
|
77
|
-
this.drag.next({
|
|
78
|
-
start: this.mapper.extractFromTask(this.currentDragTask.dataItem, 'start'),
|
|
79
|
-
end: this.mapper.extractFromTask(this.currentDragTask.dataItem, 'end'),
|
|
80
|
-
completionRatio: newCompletionRatio,
|
|
81
|
-
dragEvent: args,
|
|
82
|
-
item: this.currentDragTask.dataItem,
|
|
83
|
-
offset: this.prevX,
|
|
84
|
-
width: this.prevWidth
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
else { // task resize or drag
|
|
88
|
-
const marquee = this.calculateMarquee(args, this.leftDragHandle, this.rightDragHandle);
|
|
89
|
-
if (!marquee) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const { left, width } = marquee;
|
|
93
|
-
this.newRange = this.calculateStartEnd(this.editedProp, width, left);
|
|
94
|
-
this.drag.next({
|
|
95
|
-
start: this.newRange.start,
|
|
96
|
-
end: this.newRange.end,
|
|
97
|
-
completionRatio: this.mapper.extractFromTask(this.currentDragTask.dataItem, 'completionRatio'),
|
|
98
|
-
dragEvent: args,
|
|
99
|
-
item: this.currentDragTask.dataItem,
|
|
100
|
-
offset: left,
|
|
101
|
-
width
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
onDragEnd(args) {
|
|
106
|
-
if (this.completionRatioHandle) {
|
|
107
|
-
this.dragEnd.next({
|
|
108
|
-
start: this.mapper.extractFromTask(this.currentDragTask.dataItem, 'start'),
|
|
109
|
-
end: this.mapper.extractFromTask(this.currentDragTask.dataItem, 'end'),
|
|
110
|
-
completionRatio: this.newCompletionRatio,
|
|
111
|
-
dragEvent: args,
|
|
112
|
-
item: this.currentDragTask.dataItem,
|
|
113
|
-
offset: this.prevX,
|
|
114
|
-
width: this.prevWidth
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
this.dragEnd.next({
|
|
119
|
-
start: this.newRange.start,
|
|
120
|
-
end: this.newRange.end,
|
|
121
|
-
completionRatio: this.mapper.extractFromTask(this.currentDragTask.dataItem, 'completionRatio'),
|
|
122
|
-
dragEvent: args,
|
|
123
|
-
item: this.currentDragTask.dataItem,
|
|
124
|
-
offset: this.prevX,
|
|
125
|
-
width: this.prevWidth
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
this.prevWidth = this.prevX = this.prevLeft = this.prevScrollLeft = this.offsetX = this.maxWidth = this.newCompletionRatio = null;
|
|
129
|
-
this.currentDragTaskRect = this.currentDragTask = this.currentDragTask.draggedCompletionWidth = this.editedProp = this.newRange = null;
|
|
130
|
-
this.leftDragHandle = this.rightDragHandle = this.completionRatioHandle = false;
|
|
131
|
-
}
|
|
132
|
-
calculateMarquee(e, leftDragHandle, rightDragHandle) {
|
|
133
|
-
const clientX = e.dragEvent.clientX;
|
|
134
|
-
// Update container rect when dragging outside of it to avoid miscalculations
|
|
135
|
-
// coming from scrolling the whole page during dragging a task
|
|
136
|
-
if (clientX < this.tasksContainerRect.x || clientX > this.tasksContainerRect.right) {
|
|
137
|
-
this.zone.runOutsideAngular(() => {
|
|
138
|
-
this.tasksContainerRect = this.tasksContainer.getBoundingClientRect();
|
|
139
|
-
this.currentDragTaskRect = this.currentDragTask.taskElement.nativeElement.getBoundingClientRect();
|
|
140
|
-
});
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const scrollLeft = this.scrollableContainer?.scrollLeft;
|
|
144
|
-
const scrollDelta = isPresent(this.prevScrollLeft) ? this.prevScrollLeft - scrollLeft : 0;
|
|
145
|
-
let left, width;
|
|
146
|
-
if (leftDragHandle) {
|
|
147
|
-
if (!isPresent(this.maxWidth)) {
|
|
148
|
-
this.maxWidth = this.currentDragTaskRect.right - this.tasksContainerRect.x + scrollLeft;
|
|
149
|
-
}
|
|
150
|
-
left = Math.min(Math.max(clientX - this.tasksContainerRect.x - scrollDelta, 0), this.maxWidth);
|
|
151
|
-
width = Math.min(Math.max(this.currentDragTaskRect.right - clientX + scrollDelta, 0), this.maxWidth);
|
|
152
|
-
}
|
|
153
|
-
else if (rightDragHandle) {
|
|
154
|
-
if (!isPresent(this.maxWidth)) {
|
|
155
|
-
this.maxWidth = this.tasksContainerRect.right - this.currentDragTaskRect.x;
|
|
156
|
-
}
|
|
157
|
-
left = this.prevLeft ?? (this.currentDragTaskRect.x - this.tasksContainerRect.x);
|
|
158
|
-
width = Math.min(Math.max(clientX - this.tasksContainerRect.x - left - scrollDelta, 0), this.maxWidth);
|
|
159
|
-
}
|
|
160
|
-
else { // dragging the whole task
|
|
161
|
-
if (!isPresent(this.offsetX)) {
|
|
162
|
-
this.offsetX = e.dragEvent.offsetX;
|
|
163
|
-
}
|
|
164
|
-
left = Math.max(clientX - this.tasksContainerRect.x - this.offsetX - scrollDelta, 0);
|
|
165
|
-
}
|
|
166
|
-
const cursorLeft = clientX - this.tasksContainerRect.x;
|
|
167
|
-
// out of limits (0, max possible width) when dragging the left handle
|
|
168
|
-
if (this.leftDragHandle && (cursorLeft < 0 || this.maxWidth < cursorLeft)) {
|
|
169
|
-
return {
|
|
170
|
-
left: cursorLeft < 0 ? 0 : this.maxWidth,
|
|
171
|
-
width
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
// out of limits (0, max possible width) when dragging right handle
|
|
175
|
-
if (rightDragHandle && (clientX < this.currentDragTaskRect.x) || clientX > this.tasksContainerRect.right) {
|
|
176
|
-
return {
|
|
177
|
-
left,
|
|
178
|
-
width: clientX < this.currentDragTaskRect.x ? 0 : this.maxWidth
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
// out of limits (start < view start || end > view end) when dragging the whole task
|
|
182
|
-
if (!(this.leftDragHandle || this.rightDragHandle) && (left < 0 || (clientX + this.currentDragTaskRect.width - scrollDelta - this.offsetX > this.tasksContainerRect.right))) {
|
|
183
|
-
return {
|
|
184
|
-
left: Math.min(Math.max(left, 0), this.tasksContainerRect.width - this.currentDragTaskRect.width),
|
|
185
|
-
width: this.currentDragTaskRect.width
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
this.prevX = clientX;
|
|
189
|
-
this.prevLeft = left;
|
|
190
|
-
this.prevWidth = width;
|
|
191
|
-
!this.prevScrollLeft && (this.prevScrollLeft = scrollLeft);
|
|
192
|
-
return {
|
|
193
|
-
left,
|
|
194
|
-
width: width ?? this.currentDragTaskRect.width
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
calculateStartEnd(editedProp, width, left) {
|
|
198
|
-
const startDate = this.mapper.extractFromTask(this.currentDragTask.dataItem, 'start');
|
|
199
|
-
const endDate = this.mapper.extractFromTask(this.currentDragTask.dataItem, 'end');
|
|
200
|
-
const duration = endDate - startDate;
|
|
201
|
-
const delta = left - this.currentDragTaskRect.x + this.tasksContainerRect.x;
|
|
202
|
-
if (editedProp === 'both') {
|
|
203
|
-
if (duration) {
|
|
204
|
-
const delta = left - this.currentDragTaskRect.x + this.tasksContainerRect.left;
|
|
205
|
-
const coef = delta / this.currentDragTask.taskWidth;
|
|
206
|
-
const deltaMs = duration * coef;
|
|
207
|
-
const newStart = new Date(startDate.getTime() + deltaMs);
|
|
208
|
-
const newEnd = new Date(newStart.getTime() + duration);
|
|
209
|
-
return {
|
|
210
|
-
start: newStart,
|
|
211
|
-
end: newEnd
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
else { // milestone task
|
|
215
|
-
const initialOffset = this.currentDragTaskRect.x - this.tasksContainerRect.x;
|
|
216
|
-
const msPerPx = (startDate - this.currentDragTask.viewService.viewStart) / initialOffset;
|
|
217
|
-
const deltaMs = delta * msPerPx;
|
|
218
|
-
return {
|
|
219
|
-
start: new Date(startDate.getTime() + deltaMs),
|
|
220
|
-
end: new Date(startDate.getTime() + deltaMs)
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
const coef = width / this.currentDragTask.taskWidth;
|
|
225
|
-
const newDuration = duration * coef;
|
|
226
|
-
const newPropDate = editedProp === 'start' ? new Date(endDate - newDuration) : new Date(startDate.getTime() + newDuration);
|
|
227
|
-
const newStart = editedProp === 'start' ? newPropDate : startDate;
|
|
228
|
-
const newEnd = editedProp === 'end' ? newPropDate : endDate;
|
|
229
|
-
return {
|
|
230
|
-
start: newStart,
|
|
231
|
-
end: newEnd
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TaskDragService, deps: [{ token: i1.MappingService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
235
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TaskDragService });
|
|
236
|
-
}
|
|
237
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TaskDragService, decorators: [{
|
|
238
|
-
type: Injectable
|
|
239
|
-
}], ctorParameters: () => [{ type: i1.MappingService }, { type: i0.NgZone }] });
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Component, Input, NgZone } from '@angular/core';
|
|
6
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
-
import { EditService } from './edit.service';
|
|
8
|
-
import { plusIcon } from '@progress/kendo-svg-icons';
|
|
9
|
-
import { DropDownButtonComponent } from '@progress/kendo-angular-buttons';
|
|
10
|
-
import { EventsOutsideAngularDirective } from '@progress/kendo-angular-common';
|
|
11
|
-
import * as i0 from "@angular/core";
|
|
12
|
-
import * as i1 from "@progress/kendo-angular-l10n";
|
|
13
|
-
import * as i2 from "./edit.service";
|
|
14
|
-
/**
|
|
15
|
-
* Displays the UI for adding new items to the Gantt.
|
|
16
|
-
* Use this in a toolbar template to show a custom icon or a list of options.
|
|
17
|
-
*/
|
|
18
|
-
export class GanttAddTaskComponent {
|
|
19
|
-
localizationService;
|
|
20
|
-
editService;
|
|
21
|
-
ngZone;
|
|
22
|
-
/**
|
|
23
|
-
* Sets the data for the DropDownButton.
|
|
24
|
-
* Provide the data as an array-like list.
|
|
25
|
-
*/
|
|
26
|
-
data;
|
|
27
|
-
/**
|
|
28
|
-
* Sets the name of an existing icon in a Kendo UI theme.
|
|
29
|
-
* @default 'plus'
|
|
30
|
-
*/
|
|
31
|
-
icon = 'plus';
|
|
32
|
-
/**
|
|
33
|
-
* Sets an [`SVGIcon`](slug:api_icons_svgicon) to render inside the `GanttAddTaskComponent` using
|
|
34
|
-
* an [`SVGIconComponent`](slug:api_icons_svgiconcomponent).
|
|
35
|
-
*/
|
|
36
|
-
svgIcon = plusIcon;
|
|
37
|
-
constructor(localizationService, editService, ngZone) {
|
|
38
|
-
this.localizationService = localizationService;
|
|
39
|
-
this.editService = editService;
|
|
40
|
-
this.ngZone = ngZone;
|
|
41
|
-
!this.data && (this.data = [{
|
|
42
|
-
text: this.getText('addChildText'),
|
|
43
|
-
type: 'addChild'
|
|
44
|
-
}, {
|
|
45
|
-
text: this.getText('addAboveText'),
|
|
46
|
-
type: 'addAbove'
|
|
47
|
-
}, {
|
|
48
|
-
text: this.getText('addBelowText'),
|
|
49
|
-
type: 'addBelow'
|
|
50
|
-
}]);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* @hidden
|
|
54
|
-
*/
|
|
55
|
-
getText(message) {
|
|
56
|
-
return this.localizationService.get(message);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* @hidden
|
|
60
|
-
*/
|
|
61
|
-
handleOpen(e) {
|
|
62
|
-
if (!this.editService.getSelectedItem()) {
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @hidden
|
|
68
|
-
*/
|
|
69
|
-
handleMouseClick() {
|
|
70
|
-
if (!this.editService.getSelectedItem()) {
|
|
71
|
-
this.ngZone.run(() => {
|
|
72
|
-
this.editService.addEvent.next({
|
|
73
|
-
selectedItem: null,
|
|
74
|
-
actionType: 'addTask'
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @hidden
|
|
81
|
-
*/
|
|
82
|
-
handleItemClick(e) {
|
|
83
|
-
this.editService.addEvent.next({
|
|
84
|
-
actionType: e.type,
|
|
85
|
-
selectedItem: null
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: GanttAddTaskComponent, deps: [{ token: i1.LocalizationService }, { token: i2.EditService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
89
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: GanttAddTaskComponent, isStandalone: true, selector: "kendo-gantt-add-task", inputs: { data: "data", icon: "icon", svgIcon: "svgIcon" }, ngImport: i0, template: `
|
|
90
|
-
<kendo-dropdownbutton
|
|
91
|
-
[data]="data"
|
|
92
|
-
[icon]="icon"
|
|
93
|
-
[svgIcon]="svgIcon"
|
|
94
|
-
[kendoEventsOutsideAngular]="{ click: handleMouseClick }"
|
|
95
|
-
[scope]="this"
|
|
96
|
-
(itemClick)="handleItemClick($event)"
|
|
97
|
-
(open)="handleOpen($event)">
|
|
98
|
-
{{ getText('addTaskText') }}
|
|
99
|
-
</kendo-dropdownbutton>
|
|
100
|
-
`, isInline: true, dependencies: [{ kind: "component", type: DropDownButtonComponent, selector: "kendo-dropdownbutton", inputs: ["arrowIcon", "icon", "svgIcon", "iconClass", "imageUrl", "textField", "data", "size", "rounded", "fillMode", "themeColor", "buttonAttributes"], outputs: ["itemClick", "focus", "blur"], exportAs: ["kendoDropDownButton"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }] });
|
|
101
|
-
}
|
|
102
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: GanttAddTaskComponent, decorators: [{
|
|
103
|
-
type: Component,
|
|
104
|
-
args: [{
|
|
105
|
-
selector: 'kendo-gantt-add-task',
|
|
106
|
-
template: `
|
|
107
|
-
<kendo-dropdownbutton
|
|
108
|
-
[data]="data"
|
|
109
|
-
[icon]="icon"
|
|
110
|
-
[svgIcon]="svgIcon"
|
|
111
|
-
[kendoEventsOutsideAngular]="{ click: handleMouseClick }"
|
|
112
|
-
[scope]="this"
|
|
113
|
-
(itemClick)="handleItemClick($event)"
|
|
114
|
-
(open)="handleOpen($event)">
|
|
115
|
-
{{ getText('addTaskText') }}
|
|
116
|
-
</kendo-dropdownbutton>
|
|
117
|
-
`,
|
|
118
|
-
standalone: true,
|
|
119
|
-
imports: [DropDownButtonComponent, EventsOutsideAngularDirective]
|
|
120
|
-
}]
|
|
121
|
-
}], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i2.EditService }, { type: i0.NgZone }], propDecorators: { data: [{
|
|
122
|
-
type: Input
|
|
123
|
-
}], icon: [{
|
|
124
|
-
type: Input
|
|
125
|
-
}], svgIcon: [{
|
|
126
|
-
type: Input
|
|
127
|
-
}] } });
|