@progress/kendo-angular-gantt 0.3.0-dev.202112141015 → 0.3.0-dev.202201111723
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/dist/cdn/js/kendo-angular-gantt.js +2 -2
- package/dist/cdn/main.js +10 -4
- package/dist/es/dependencies/utils.js +6 -5
- package/dist/es/editing/dependencies-table.component.js +131 -0
- package/dist/es/editing/edit-dialog.component.js +37 -6
- package/dist/es/editing/edit.service.js +88 -7
- package/dist/es/editing/task-fields.component.js +43 -0
- package/dist/es/gantt.component.js +49 -26
- package/dist/es/gantt.module.js +12 -3
- package/dist/es/index.js +3 -0
- package/dist/es/localization/gantt-localization.service.js +26 -0
- package/dist/es/models/dependency-type.enum.js +16 -0
- package/dist/es/models/models.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es2015/dependencies/utils.js +6 -5
- package/dist/es2015/editing/dependencies-table.component.d.ts +39 -0
- package/dist/es2015/editing/dependencies-table.component.js +160 -0
- package/dist/es2015/editing/edit-dialog.component.d.ts +10 -3
- package/dist/es2015/editing/edit-dialog.component.js +55 -33
- package/dist/es2015/editing/edit.service.d.ts +21 -3
- package/dist/es2015/editing/edit.service.js +77 -10
- package/dist/es2015/editing/task-fields.component.d.ts +22 -0
- package/dist/es2015/editing/task-fields.component.js +67 -0
- package/dist/es2015/gantt.component.d.ts +4 -6
- package/dist/es2015/gantt.component.js +42 -23
- package/dist/es2015/gantt.module.js +12 -3
- package/dist/es2015/index.d.ts +3 -0
- package/dist/es2015/index.js +3 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/{models/events/remove-event.interface.d.ts → localization/gantt-localization.service.d.ts} +6 -7
- package/dist/es2015/localization/gantt-localization.service.js +25 -0
- package/dist/es2015/models/dependency-type.enum.d.ts +1 -1
- package/dist/es2015/models/dependency-type.enum.js +16 -0
- package/dist/es2015/models/events/task-edit-event.interface.d.ts +17 -4
- package/dist/es2015/models/models.d.ts +0 -2
- package/dist/es2015/models/models.js +1 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/fesm2015/index.js +429 -76
- package/dist/fesm5/index.js +377 -49
- package/dist/npm/dependencies/utils.js +6 -5
- package/dist/npm/editing/dependencies-table.component.js +133 -0
- package/dist/npm/editing/edit-dialog.component.js +36 -5
- package/dist/npm/editing/edit.service.js +87 -6
- package/dist/npm/editing/task-fields.component.js +45 -0
- package/dist/npm/gantt.component.js +49 -26
- package/dist/npm/gantt.module.js +11 -2
- package/dist/npm/index.js +6 -0
- package/dist/npm/localization/gantt-localization.service.js +28 -0
- package/dist/npm/models/dependency-type.enum.js +16 -0
- package/dist/npm/models/models.js +2 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-angular-gantt.js +1 -1
- package/package.json +3 -1
- package/dist/es/models/events/edit-event.interface.js +0 -4
- package/dist/es/models/events/remove-event.interface.js +0 -4
- package/dist/es2015/models/events/edit-event.interface.d.ts +0 -19
- package/dist/es2015/models/events/edit-event.interface.js +0 -4
- package/dist/es2015/models/events/remove-event.interface.js +0 -4
- package/dist/npm/models/events/edit-event.interface.js +0 -6
- package/dist/npm/models/events/remove-event.interface.js +0 -6
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { DependencyType } from '../models/dependency-type.enum';
|
|
5
6
|
/**
|
|
6
7
|
* @hidden
|
|
7
8
|
*
|
|
@@ -45,9 +46,9 @@ export var dependencyCoordinates = function (from, to, rowHeight, type, minDista
|
|
|
45
46
|
| |
|
|
46
47
|
[[[]]]- -[[[]]]
|
|
47
48
|
*/
|
|
48
|
-
if (type ===
|
|
49
|
+
if (type === DependencyType.FF || type === DependencyType.SS) {
|
|
49
50
|
// polyline start from first task
|
|
50
|
-
var dir = type ===
|
|
51
|
+
var dir = type === DependencyType.SS ? 'left' : 'right';
|
|
51
52
|
top = from.top;
|
|
52
53
|
left = from[dir];
|
|
53
54
|
points.push({ top: top, left: left });
|
|
@@ -73,9 +74,9 @@ export var dependencyCoordinates = function (from, to, rowHeight, type, minDista
|
|
|
73
74
|
|
|
|
74
75
|
-[[[]]]
|
|
75
76
|
*/
|
|
76
|
-
var startDir = type ===
|
|
77
|
-
var endDir = type ===
|
|
78
|
-
var additionalTurn = type ===
|
|
77
|
+
var startDir = type === DependencyType.SF ? 'left' : 'right';
|
|
78
|
+
var endDir = type === DependencyType.SF ? 'right' : 'left';
|
|
79
|
+
var additionalTurn = type === DependencyType.SF
|
|
79
80
|
? from[startDir] - minDistanceBeforeTurn * 2 < to[endDir]
|
|
80
81
|
: from[startDir] + minDistanceBeforeTurn * 2 > to[endDir];
|
|
81
82
|
// polyline start from first task
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
7
|
+
import { FormArray, FormControl, FormGroup, Validators } from '@angular/forms';
|
|
8
|
+
import { MappingService } from '../common/mapping.service';
|
|
9
|
+
import { GanttLocalizationService } from '../localization/gantt-localization.service';
|
|
10
|
+
import { DependencyType } from '../models/dependency-type.enum';
|
|
11
|
+
import { EditService } from './edit.service';
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
var DependenciesTableComponent = /** @class */ (function () {
|
|
16
|
+
function DependenciesTableComponent(mapper, editService, localizationService) {
|
|
17
|
+
this.mapper = mapper;
|
|
18
|
+
this.editService = editService;
|
|
19
|
+
this.localizationService = localizationService;
|
|
20
|
+
this.dependenciesChange = new EventEmitter();
|
|
21
|
+
this.selectedKeys = [];
|
|
22
|
+
this.formGroups = new FormArray([]);
|
|
23
|
+
this.dependencyTypes = this.getDependencyTypes();
|
|
24
|
+
}
|
|
25
|
+
Object.defineProperty(DependenciesTableComponent.prototype, "taskId", {
|
|
26
|
+
get: function () {
|
|
27
|
+
return this.editService.dataItem.id;
|
|
28
|
+
},
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(DependenciesTableComponent.prototype, "dependencyIdField", {
|
|
33
|
+
// The target dependency id field
|
|
34
|
+
// e.g. if Predecessors, we have the `fromId` which is the currently edited task,
|
|
35
|
+
// while the `toId` is missing (needs to be selected by the user)
|
|
36
|
+
get: function () {
|
|
37
|
+
return this.dependencyType === 'predecessor' ? 'fromId' : 'toId';
|
|
38
|
+
},
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true
|
|
41
|
+
});
|
|
42
|
+
DependenciesTableComponent.prototype.ngOnInit = function () {
|
|
43
|
+
var _this = this;
|
|
44
|
+
// generate the FormGroups per each Grid row
|
|
45
|
+
if (this.formGroups.controls.length === 0) {
|
|
46
|
+
var fields_1 = this.mapper.dependencyFields;
|
|
47
|
+
this.dependencies.forEach(function (item) {
|
|
48
|
+
var _a;
|
|
49
|
+
var formGroup = new FormGroup((_a = {},
|
|
50
|
+
_a[fields_1.id] = new FormControl(_this.mapper.extractFromDependency(item, 'id')),
|
|
51
|
+
_a[fields_1.fromId] = new FormControl(_this.mapper.extractFromDependency(item, 'fromId'), Validators.required),
|
|
52
|
+
_a[fields_1.toId] = new FormControl(_this.mapper.extractFromDependency(item, 'toId'), Validators.required),
|
|
53
|
+
_a[fields_1.type] = new FormControl(_this.mapper.extractFromDependency(item, 'type'), Validators.required),
|
|
54
|
+
_a));
|
|
55
|
+
_this.formGroups.push(formGroup);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
this.formGroups.valueChanges.subscribe(function (val) {
|
|
59
|
+
_this.formGroups.controls.forEach(function (control) {
|
|
60
|
+
if (control.dirty) {
|
|
61
|
+
_this.editService.updateDependencies(control.value);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
_this.dependenciesChange.emit(val);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
DependenciesTableComponent.prototype.getFormControl = function (dataItemIndex, field) {
|
|
68
|
+
// return the FormControl for the respective column editor
|
|
69
|
+
return this.formGroups.controls
|
|
70
|
+
.find(function (_control, index) { return index === dataItemIndex; })
|
|
71
|
+
.get(this.mapper.dependencyFields[field]);
|
|
72
|
+
};
|
|
73
|
+
DependenciesTableComponent.prototype.getText = function (token) {
|
|
74
|
+
return this.localizationService.get(token);
|
|
75
|
+
};
|
|
76
|
+
DependenciesTableComponent.prototype.getDependencyTypes = function () {
|
|
77
|
+
var types = Object.keys(DependencyType)
|
|
78
|
+
.filter(function (value) { return typeof DependencyType[value] === 'number'; })
|
|
79
|
+
.map(function (type) {
|
|
80
|
+
return {
|
|
81
|
+
type: type,
|
|
82
|
+
id: DependencyType[type]
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
return types;
|
|
86
|
+
};
|
|
87
|
+
DependenciesTableComponent.prototype.addHandler = function () {
|
|
88
|
+
var _a;
|
|
89
|
+
var fields = this.mapper.dependencyFields;
|
|
90
|
+
var formGroup = new FormGroup((_a = {},
|
|
91
|
+
_a[fields.id] = new FormControl(),
|
|
92
|
+
_a[fields.fromId] = new FormControl(this.dependencyIdField === 'toId' ? this.taskId : null, Validators.required),
|
|
93
|
+
_a[fields.toId] = new FormControl(this.dependencyIdField === 'fromId' ? this.taskId : null, Validators.required),
|
|
94
|
+
_a[fields.type] = new FormControl(null, Validators.required),
|
|
95
|
+
_a));
|
|
96
|
+
this.formGroups.push(formGroup);
|
|
97
|
+
};
|
|
98
|
+
DependenciesTableComponent.prototype.removeHandler = function () {
|
|
99
|
+
var selectedIndex = this.selectedKeys[0];
|
|
100
|
+
var item = this.formGroups.at(selectedIndex).value;
|
|
101
|
+
this.editService.deleteDependency(item);
|
|
102
|
+
this.formGroups.removeAt(selectedIndex);
|
|
103
|
+
};
|
|
104
|
+
tslib_1.__decorate([
|
|
105
|
+
Input(),
|
|
106
|
+
tslib_1.__metadata("design:type", Array)
|
|
107
|
+
], DependenciesTableComponent.prototype, "tasks", void 0);
|
|
108
|
+
tslib_1.__decorate([
|
|
109
|
+
Input(),
|
|
110
|
+
tslib_1.__metadata("design:type", Array)
|
|
111
|
+
], DependenciesTableComponent.prototype, "dependencies", void 0);
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
Input(),
|
|
114
|
+
tslib_1.__metadata("design:type", String)
|
|
115
|
+
], DependenciesTableComponent.prototype, "dependencyType", void 0);
|
|
116
|
+
tslib_1.__decorate([
|
|
117
|
+
Output(),
|
|
118
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
119
|
+
], DependenciesTableComponent.prototype, "dependenciesChange", void 0);
|
|
120
|
+
DependenciesTableComponent = tslib_1.__decorate([
|
|
121
|
+
Component({
|
|
122
|
+
selector: 'kendo-gantt-dependencies-table',
|
|
123
|
+
template: "\n <kendo-grid\n [data]=\"dependencies\"\n [selectable]=\"{ mode: 'single' }\"\n [(selectedKeys)]=\"selectedKeys\"\n kendoGridSelectBy\n [height]=\"295\"\n >\n <ng-template kendoGridToolbarTemplate>\n <button kendoButton (click)=\"addHandler()\">\n {{ getText('taskEditingDependenciesAddButtonText') }}\n </button>\n <button kendoButton (click)=\"removeHandler()\" [disabled]=\"selectedKeys.length === 0\">\n {{ getText('taskEditingDependenciesRemoveButtonText') }}\n </button>\n </ng-template>\n <kendo-grid-column [title]=\"getText('taskEditingDependenciesGridNameColumnTitle')\" [field]=\"dependencyIdField\">\n <ng-template kendoGridCellTemplate let-dataItem=\"dataItem\" let-column=\"column\" let-rowIndex=\"rowIndex\">\n <kendo-dropdownlist\n [data]=\"tasks\"\n textField=\"title\"\n valueField=\"id\"\n [valuePrimitive]=\"true\"\n [formControl]=\"getFormControl(rowIndex, column.field)\"\n >\n </kendo-dropdownlist>\n </ng-template>\n </kendo-grid-column>\n <kendo-grid-column [title]=\"getText('taskEditingDependenciesGridTypeColumnTitle')\" field=\"type\">\n <ng-template kendoGridCellTemplate let-dataItem=\"dataItem\" let-column=\"column\" let-rowIndex=\"rowIndex\">\n <kendo-dropdownlist\n [data]=\"dependencyTypes\"\n textField=\"type\"\n valueField=\"id\"\n [valuePrimitive]=\"true\"\n [formControl]=\"getFormControl(rowIndex, column.field)\"\n >\n </kendo-dropdownlist>\n </ng-template>\n </kendo-grid-column>\n </kendo-grid>\n "
|
|
124
|
+
}),
|
|
125
|
+
tslib_1.__metadata("design:paramtypes", [MappingService,
|
|
126
|
+
EditService,
|
|
127
|
+
GanttLocalizationService])
|
|
128
|
+
], DependenciesTableComponent);
|
|
129
|
+
return DependenciesTableComponent;
|
|
130
|
+
}());
|
|
131
|
+
export { DependenciesTableComponent };
|
|
@@ -3,23 +3,53 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
|
-
import { Component, Input } from '@angular/core';
|
|
7
|
-
import { FormGroup } from '@angular/forms';
|
|
6
|
+
import { ChangeDetectorRef, Component, Input } from '@angular/core';
|
|
8
7
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
9
8
|
import { MappingService } from '../common/mapping.service';
|
|
9
|
+
import { DependencyType } from '../models/dependency-type.enum';
|
|
10
10
|
import { EditService } from './edit.service';
|
|
11
11
|
/**
|
|
12
12
|
* @hidden
|
|
13
13
|
*/
|
|
14
14
|
var EditDialogComponent = /** @class */ (function () {
|
|
15
|
-
function EditDialogComponent(mapper, editService, localizationService) {
|
|
15
|
+
function EditDialogComponent(mapper, editService, cdr, localizationService) {
|
|
16
16
|
this.mapper = mapper;
|
|
17
17
|
this.editService = editService;
|
|
18
|
+
this.cdr = cdr;
|
|
18
19
|
this.localizationService = localizationService;
|
|
19
20
|
}
|
|
21
|
+
EditDialogComponent.prototype.ngOnInit = function () {
|
|
22
|
+
var _this = this;
|
|
23
|
+
this.editService.loadTasks(this.data).subscribe(function (value) {
|
|
24
|
+
_this.loadedTasks = value;
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(EditDialogComponent.prototype, "predecessors", {
|
|
28
|
+
get: function () {
|
|
29
|
+
return this.editService.predecessors;
|
|
30
|
+
},
|
|
31
|
+
set: function (items) {
|
|
32
|
+
this.editService.predecessors = items;
|
|
33
|
+
},
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(EditDialogComponent.prototype, "successors", {
|
|
38
|
+
get: function () {
|
|
39
|
+
return this.editService.successors;
|
|
40
|
+
},
|
|
41
|
+
set: function (items) {
|
|
42
|
+
this.editService.successors = items;
|
|
43
|
+
},
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true
|
|
46
|
+
});
|
|
20
47
|
EditDialogComponent.prototype.getText = function (token) {
|
|
21
48
|
return this.localizationService.get(token);
|
|
22
49
|
};
|
|
50
|
+
EditDialogComponent.prototype.getDependencyType = function (typeId) {
|
|
51
|
+
return DependencyType[typeId];
|
|
52
|
+
};
|
|
23
53
|
EditDialogComponent.prototype.handleEditingResult = function (editResultType) {
|
|
24
54
|
this.editService.triggerEditEvent(editResultType);
|
|
25
55
|
};
|
|
@@ -28,15 +58,16 @@ var EditDialogComponent = /** @class */ (function () {
|
|
|
28
58
|
};
|
|
29
59
|
tslib_1.__decorate([
|
|
30
60
|
Input(),
|
|
31
|
-
tslib_1.__metadata("design:type",
|
|
32
|
-
], EditDialogComponent.prototype, "
|
|
61
|
+
tslib_1.__metadata("design:type", Array)
|
|
62
|
+
], EditDialogComponent.prototype, "data", void 0);
|
|
33
63
|
EditDialogComponent = tslib_1.__decorate([
|
|
34
64
|
Component({
|
|
35
65
|
selector: 'kendo-gantt-edit-dialog',
|
|
36
|
-
template: "\n <kendo-dialog\n [title]=\"getText('taskEditingDialogTitle')\"\n [width]=\"575\"\n [height]=\"470\"\n (close)=\"handleEditingResult('cancel')\">\n <kendo-dialog-messages\n [closeTitle]=\"getText('taskEditingDialogCloseTitle')\"></kendo-dialog-messages>\n <
|
|
66
|
+
template: "\n <kendo-dialog\n [title]=\"getText('taskEditingDialogTitle')\"\n [width]=\"575\"\n [height]=\"470\"\n (close)=\"handleEditingResult('cancel')\">\n <kendo-dialog-messages\n [closeTitle]=\"getText('taskEditingDialogCloseTitle')\"></kendo-dialog-messages>\n\n <kendo-tabstrip [keepTabContent]=\"true\">\n <kendo-tabstrip-tab [title]=\"getText('taskEditingGeneralTabTitle')\" [selected]=\"true\">\n <ng-template kendoTabContent>\n <kendo-gantt-task-fields></kendo-gantt-task-fields>\n </ng-template>\n </kendo-tabstrip-tab>\n <kendo-tabstrip-tab [title]=\"getText('taskEditingPredecessorsTabTitle')\">\n <ng-template kendoTabContent>\n <kendo-gantt-dependencies-table\n [tasks]=\"loadedTasks\"\n [(dependencies)]=\"predecessors\"\n dependencyType=\"predecessor\"\n >\n </kendo-gantt-dependencies-table>\n </ng-template>\n </kendo-tabstrip-tab>\n <kendo-tabstrip-tab [title]=\"getText('taskEditingSuccessorsTabTitle')\">\n <ng-template kendoTabContent>\n <kendo-gantt-dependencies-table\n [tasks]=\"loadedTasks\"\n [(dependencies)]=\"successors\"\n dependencyType=\"successor\">\n </kendo-gantt-dependencies-table>\n </ng-template>\n </kendo-tabstrip-tab>\n </kendo-tabstrip>\n\n <kendo-dialog-actions layout=\"normal\">\n <button kendoButton (click)=\"onTaskDelete()\">{{ getText('deleteButtonText') }}</button>\n <kendo-treelist-spacer></kendo-treelist-spacer>\n <button kendoButton [primary]=\"true\" (click)=\"handleEditingResult('save')\">{{ getText('saveButtonText') }}</button>\n <button kendoButton (click)=\"handleEditingResult('cancel')\">{{ getText('cancelButtonText') }}</button>\n </kendo-dialog-actions>\n </kendo-dialog>\n "
|
|
37
67
|
}),
|
|
38
68
|
tslib_1.__metadata("design:paramtypes", [MappingService,
|
|
39
69
|
EditService,
|
|
70
|
+
ChangeDetectorRef,
|
|
40
71
|
LocalizationService])
|
|
41
72
|
], EditDialogComponent);
|
|
42
73
|
return EditDialogComponent;
|
|
@@ -4,36 +4,117 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Injectable } from '@angular/core';
|
|
7
|
-
import { Subject } from 'rxjs';
|
|
7
|
+
import { EMPTY, forkJoin, isObservable, of, Subject } from 'rxjs';
|
|
8
|
+
import { MappingService } from '../common/mapping.service';
|
|
9
|
+
import { map, expand, reduce } from 'rxjs/operators';
|
|
10
|
+
import { isPresent, normalizeGanttData } from '../utils';
|
|
8
11
|
/**
|
|
9
12
|
* @hidden
|
|
10
13
|
*/
|
|
11
14
|
var EditService = /** @class */ (function () {
|
|
12
|
-
function EditService() {
|
|
15
|
+
function EditService(mapper) {
|
|
16
|
+
var _this = this;
|
|
17
|
+
this.mapper = mapper;
|
|
13
18
|
this.showEditingDialog = new Subject();
|
|
14
19
|
this.showConfirmationDialog = new Subject();
|
|
15
20
|
this.editEvent = new Subject();
|
|
16
21
|
this.addEvent = new Subject();
|
|
22
|
+
this.updatedItems = [];
|
|
23
|
+
this.deletedItems = [];
|
|
24
|
+
this.itemIndex = function (item, data) {
|
|
25
|
+
return data.findIndex(function (dataItem) { return _this.mapper.extractFromTask(dataItem, 'id') === _this.mapper.extractFromTask(item, 'id'); });
|
|
26
|
+
};
|
|
17
27
|
}
|
|
18
|
-
EditService.prototype
|
|
28
|
+
Object.defineProperty(EditService.prototype, "dependencies", {
|
|
29
|
+
get: function () {
|
|
30
|
+
return this.predecessors.concat(this.successors);
|
|
31
|
+
},
|
|
32
|
+
set: function (items) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
// Can this whole thing be moved to edit-dialog? Dependencies might not be needed here
|
|
35
|
+
var dataItemId = this.mapper.extractFromTask(this.dataItem, 'id');
|
|
36
|
+
this.predecessors = items.filter(function (item) { return _this.mapper.extractFromDependency(item, 'toId') === dataItemId; });
|
|
37
|
+
this.successors = items.filter(function (item) { return _this.mapper.extractFromDependency(item, 'fromId') === dataItemId; });
|
|
38
|
+
},
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true
|
|
41
|
+
});
|
|
42
|
+
EditService.prototype.createEditDialog = function (dataItem, taskFormGroup, dependencies) {
|
|
19
43
|
this.dataItem = dataItem;
|
|
20
|
-
this.
|
|
44
|
+
this.taskFormGroup = taskFormGroup;
|
|
45
|
+
this.dependencies = dependencies;
|
|
21
46
|
this.showEditingDialog.next(true);
|
|
22
47
|
};
|
|
23
48
|
EditService.prototype.closeEditDialog = function () {
|
|
24
49
|
this.showEditingDialog.next(false);
|
|
25
50
|
this.dataItem = undefined;
|
|
26
|
-
this.
|
|
51
|
+
this.taskFormGroup = undefined;
|
|
52
|
+
this.dependencies = [];
|
|
53
|
+
this.updatedItems = [];
|
|
54
|
+
this.deletedItems = [];
|
|
27
55
|
};
|
|
28
56
|
EditService.prototype.triggerEditEvent = function (editResultType) {
|
|
29
57
|
this.editEvent.next({
|
|
30
|
-
|
|
58
|
+
taskFormGroup: this.taskFormGroup,
|
|
31
59
|
dataItem: this.dataItem,
|
|
60
|
+
dependencies: {
|
|
61
|
+
createdItems: this.getCreatedDependencies(),
|
|
62
|
+
updatedItems: this.updatedItems,
|
|
63
|
+
deletedItems: this.deletedItems
|
|
64
|
+
},
|
|
32
65
|
editResultType: editResultType
|
|
33
66
|
});
|
|
34
67
|
};
|
|
68
|
+
EditService.prototype.updateDependencies = function (item) {
|
|
69
|
+
if (!this.isNew(item)) {
|
|
70
|
+
// update
|
|
71
|
+
var index = this.itemIndex(item, this.updatedItems);
|
|
72
|
+
if (index !== -1) {
|
|
73
|
+
this.updatedItems.splice(index, 1, item);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.updatedItems.push(item);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
EditService.prototype.getCreatedDependencies = function () {
|
|
81
|
+
var _this = this;
|
|
82
|
+
return this.dependencies.filter(function (item) { return _this.mapper.extractFromDependency(item, 'id') === null; });
|
|
83
|
+
};
|
|
84
|
+
EditService.prototype.deleteDependency = function (item) {
|
|
85
|
+
var updatedIndex = this.itemIndex(item, this.updatedItems);
|
|
86
|
+
if (updatedIndex !== -1) {
|
|
87
|
+
this.updatedItems.splice(updatedIndex, 1);
|
|
88
|
+
}
|
|
89
|
+
if (!this.isNew(item)) {
|
|
90
|
+
this.deletedItems.push(item);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
EditService.prototype.loadTasks = function (initialValues, isInitializer) {
|
|
94
|
+
var _this = this;
|
|
95
|
+
if (isInitializer === void 0) { isInitializer = true; }
|
|
96
|
+
return forkJoin(initialValues.map(function (v) { return _this.getElementById(v); })).pipe(map(function (value) {
|
|
97
|
+
return value.reduce(function (acc, item) { return acc = acc.concat(normalizeGanttData(item)); }, []);
|
|
98
|
+
}), expand(function (values) {
|
|
99
|
+
if (values.some(function (el) { return _this.hasChildren(el); })) {
|
|
100
|
+
return _this.loadTasks(values, false);
|
|
101
|
+
}
|
|
102
|
+
return EMPTY;
|
|
103
|
+
}), reduce(function (acc, values) { return acc.concat(values); }, isInitializer ? initialValues.slice() : []));
|
|
104
|
+
};
|
|
105
|
+
EditService.prototype.getElementById = function (item) {
|
|
106
|
+
var children = this.fetchChildren(item);
|
|
107
|
+
if (isObservable(children)) {
|
|
108
|
+
return children;
|
|
109
|
+
}
|
|
110
|
+
return of(children);
|
|
111
|
+
};
|
|
112
|
+
EditService.prototype.isNew = function (item) {
|
|
113
|
+
return !isPresent(this.mapper.extractFromDependency(item, 'id'));
|
|
114
|
+
};
|
|
35
115
|
EditService = tslib_1.__decorate([
|
|
36
|
-
Injectable()
|
|
116
|
+
Injectable(),
|
|
117
|
+
tslib_1.__metadata("design:paramtypes", [MappingService])
|
|
37
118
|
], EditService);
|
|
38
119
|
return EditService;
|
|
39
120
|
}());
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { Component } from '@angular/core';
|
|
7
|
+
import { MappingService } from '../common/mapping.service';
|
|
8
|
+
import { GanttLocalizationService } from '../localization/gantt-localization.service';
|
|
9
|
+
import { EditService } from './edit.service';
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
var TaskFieldsComponent = /** @class */ (function () {
|
|
14
|
+
function TaskFieldsComponent(mapper, editService, localizationService) {
|
|
15
|
+
this.mapper = mapper;
|
|
16
|
+
this.editService = editService;
|
|
17
|
+
this.localizationService = localizationService;
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(TaskFieldsComponent.prototype, "formGroup", {
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
get: function () {
|
|
24
|
+
return this.editService.taskFormGroup;
|
|
25
|
+
},
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true
|
|
28
|
+
});
|
|
29
|
+
TaskFieldsComponent.prototype.getText = function (token) {
|
|
30
|
+
return this.localizationService.get(token);
|
|
31
|
+
};
|
|
32
|
+
TaskFieldsComponent = tslib_1.__decorate([
|
|
33
|
+
Component({
|
|
34
|
+
selector: 'kendo-gantt-task-fields',
|
|
35
|
+
template: "\n <form class=\"k-form\" [formGroup]=\"formGroup\">\n <kendo-formfield *ngIf=\"formGroup.contains(mapper.taskFields.title)\">\n <kendo-label [for]=\"mapper.taskFields.title\" [text]=\"getText('titleFieldInputLabel')\"></kendo-label>\n <input class=\"k-textbox\" [formControlName]=\"mapper.taskFields.title\" />\n </kendo-formfield>\n <div class=\"k-hstack\">\n <kendo-formfield [style.width.%]=\"49\" *ngIf=\"formGroup.contains(mapper.taskFields.start)\">\n <kendo-label [for]=\"mapper.taskFields.start\" [text]=\"getText('startFieldInputLabel')\"></kendo-label>\n <kendo-datetimepicker [formControlName]=\"mapper.taskFields.start\"></kendo-datetimepicker>\n </kendo-formfield>\n <kendo-treelist-spacer></kendo-treelist-spacer>\n <kendo-formfield [style.width.%]=\"49\" *ngIf=\"formGroup.contains(mapper.taskFields.end)\">\n <kendo-label [for]=\"mapper.taskFields.end\" [text]=\"getText('endFieldInputLabel')\"></kendo-label>\n <kendo-datetimepicker [formControlName]=\"mapper.taskFields.end\"></kendo-datetimepicker>\n </kendo-formfield>\n </div>\n <kendo-formfield [style.width.%]=\"49\" *ngIf=\"formGroup.contains(mapper.taskFields.completionRatio)\">\n <kendo-label [for]=\"mapper.taskFields.completionRatio\" [text]=\"getText('completionRatioFieldInputLabel')\"></kendo-label>\n <kendo-numerictextbox\n [formControlName]=\"mapper.taskFields.completionRatio\"\n [min]=\"0\"\n [max]=\"1\"\n [decimals]=\"2\"\n format=\"p2\"\n [step]=\"0.01\"\n ></kendo-numerictextbox>\n </kendo-formfield>\n </form>\n "
|
|
36
|
+
}),
|
|
37
|
+
tslib_1.__metadata("design:paramtypes", [MappingService,
|
|
38
|
+
EditService,
|
|
39
|
+
GanttLocalizationService])
|
|
40
|
+
], TaskFieldsComponent);
|
|
41
|
+
return TaskFieldsComponent;
|
|
42
|
+
}());
|
|
43
|
+
export { TaskFieldsComponent };
|