@syncfusion/ej2-gantt 19.4.55 → 20.1.47-1460716

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.
Files changed (212) hide show
  1. package/CHANGELOG.md +1072 -1047
  2. package/README.md +75 -75
  3. package/dist/ej2-gantt.umd.min.js +1 -10
  4. package/dist/ej2-gantt.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-gantt.es2015.js +341 -240
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +713 -598
  8. package/dist/es6/ej2-gantt.es5.js.map +1 -1
  9. package/dist/global/ej2-gantt.min.js +1 -10
  10. package/dist/global/ej2-gantt.min.js.map +1 -1
  11. package/dist/global/index.d.ts +0 -9
  12. package/dist/ts/components.ts +4 -0
  13. package/dist/ts/gantt/actions/actions.ts +18 -0
  14. package/dist/ts/gantt/actions/cell-edit.ts +606 -0
  15. package/dist/ts/gantt/actions/chart-scroll.ts +167 -0
  16. package/dist/ts/gantt/actions/column-menu.ts +35 -0
  17. package/dist/ts/gantt/actions/column-reorder.ts +52 -0
  18. package/dist/ts/gantt/actions/column-resize.ts +52 -0
  19. package/dist/ts/gantt/actions/connector-line-edit.ts +829 -0
  20. package/dist/ts/gantt/actions/context-menu.ts +754 -0
  21. package/dist/ts/gantt/actions/day-markers.ts +80 -0
  22. package/dist/ts/gantt/actions/dependency.ts +692 -0
  23. package/dist/ts/gantt/actions/dialog-edit.ts +2208 -0
  24. package/dist/ts/gantt/actions/edit.ts +3499 -0
  25. package/dist/ts/gantt/actions/excel-export.ts +61 -0
  26. package/dist/ts/gantt/actions/filter.ts +302 -0
  27. package/dist/ts/gantt/actions/keyboard.ts +306 -0
  28. package/dist/ts/gantt/actions/pdf-export.ts +214 -0
  29. package/dist/ts/gantt/actions/rowdragdrop.ts +839 -0
  30. package/dist/ts/gantt/actions/selection.ts +536 -0
  31. package/dist/ts/gantt/actions/sort.ts +98 -0
  32. package/dist/ts/gantt/actions/taskbar-edit.ts +1940 -0
  33. package/dist/ts/gantt/actions/toolbar.ts +489 -0
  34. package/dist/ts/gantt/actions/virtual-scroll.ts +60 -0
  35. package/dist/ts/gantt/base/common.ts +9 -0
  36. package/dist/ts/gantt/base/constant.ts +13 -0
  37. package/dist/ts/gantt/base/css-constants.ts +148 -0
  38. package/dist/ts/gantt/base/date-processor.ts +1257 -0
  39. package/dist/ts/gantt/base/enum.ts +372 -0
  40. package/dist/ts/gantt/base/gantt-chart.ts +1248 -0
  41. package/dist/ts/gantt/base/gantt.ts +4069 -0
  42. package/dist/ts/gantt/base/interface.ts +955 -0
  43. package/dist/ts/gantt/base/splitter.ts +174 -0
  44. package/dist/ts/gantt/base/task-processor.ts +2217 -0
  45. package/dist/ts/gantt/base/tree-grid.ts +694 -0
  46. package/dist/ts/gantt/base/utils.ts +208 -0
  47. package/dist/ts/gantt/export/export-helper.ts +552 -0
  48. package/dist/ts/gantt/export/pdf-base/dictionary.ts +152 -0
  49. package/dist/ts/gantt/export/pdf-base/pdf-borders.ts +277 -0
  50. package/dist/ts/gantt/export/pdf-base/pdf-grid-table.ts +901 -0
  51. package/dist/ts/gantt/export/pdf-base/pdf-style/gantt-theme.ts +131 -0
  52. package/dist/ts/gantt/export/pdf-base/pdf-style/style.ts +91 -0
  53. package/dist/ts/gantt/export/pdf-base/treegrid-layouter.ts +414 -0
  54. package/dist/ts/gantt/export/pdf-connector-line.ts +422 -0
  55. package/dist/ts/gantt/export/pdf-gantt.ts +282 -0
  56. package/dist/ts/gantt/export/pdf-taskbar.ts +395 -0
  57. package/dist/ts/gantt/export/pdf-timeline.ts +202 -0
  58. package/dist/ts/gantt/export/pdf-treegrid.ts +406 -0
  59. package/dist/ts/gantt/models/add-dialog-field-settings.ts +33 -0
  60. package/dist/ts/gantt/models/column.ts +464 -0
  61. package/dist/ts/gantt/models/day-working-time.ts +22 -0
  62. package/dist/ts/gantt/models/edit-dialog-field-settings.ts +33 -0
  63. package/dist/ts/gantt/models/edit-settings.ts +79 -0
  64. package/dist/ts/gantt/models/event-marker.ts +27 -0
  65. package/dist/ts/gantt/models/filter-settings.ts +53 -0
  66. package/dist/ts/gantt/models/holiday.ts +34 -0
  67. package/dist/ts/gantt/models/label-settings.ts +30 -0
  68. package/dist/ts/gantt/models/models.ts +36 -0
  69. package/dist/ts/gantt/models/resource-fields.ts +38 -0
  70. package/dist/ts/gantt/models/search-settings.ts +77 -0
  71. package/dist/ts/gantt/models/selection-settings.ts +56 -0
  72. package/dist/ts/gantt/models/sort-settings.ts +50 -0
  73. package/dist/ts/gantt/models/splitter-settings.ts +47 -0
  74. package/dist/ts/gantt/models/task-fields.ts +171 -0
  75. package/dist/ts/gantt/models/timeline-settings.ts +112 -0
  76. package/dist/ts/gantt/models/tooltip-settings.ts +46 -0
  77. package/dist/ts/gantt/renderer/chart-rows.ts +1838 -0
  78. package/dist/ts/gantt/renderer/connector-line.ts +1025 -0
  79. package/dist/ts/gantt/renderer/edit-tooltip.ts +228 -0
  80. package/dist/ts/gantt/renderer/event-marker.ts +96 -0
  81. package/dist/ts/gantt/renderer/nonworking-day.ts +205 -0
  82. package/dist/ts/gantt/renderer/render.ts +5 -0
  83. package/dist/ts/gantt/renderer/timeline.ts +1397 -0
  84. package/dist/ts/gantt/renderer/tooltip.ts +450 -0
  85. package/dist/ts/gantt/renderer/virtual-content-render.ts +50 -0
  86. package/license +9 -9
  87. package/package.json +80 -80
  88. package/src/gantt/actions/cell-edit.js +2 -1
  89. package/src/gantt/actions/dialog-edit.js +2 -1
  90. package/src/gantt/actions/edit.js +36 -9
  91. package/src/gantt/actions/rowdragdrop.js +37 -15
  92. package/src/gantt/actions/selection.js +3 -2
  93. package/src/gantt/actions/taskbar-edit.js +24 -24
  94. package/src/gantt/base/date-processor.js +0 -1
  95. package/src/gantt/base/gantt-chart.js +36 -5
  96. package/src/gantt/base/gantt-model.d.ts +779 -779
  97. package/src/gantt/base/gantt.d.ts +27 -27
  98. package/src/gantt/base/gantt.js +35 -76
  99. package/src/gantt/base/splitter.js +1 -0
  100. package/src/gantt/base/task-processor.js +13 -13
  101. package/src/gantt/base/tree-grid.js +3 -1
  102. package/src/gantt/export/pdf-base/treegrid-layouter.js +13 -13
  103. package/src/gantt/export/pdf-connector-line.js +11 -11
  104. package/src/gantt/export/pdf-gantt.js +24 -24
  105. package/src/gantt/export/pdf-taskbar.js +11 -11
  106. package/src/gantt/export/pdf-treegrid.js +13 -13
  107. package/src/gantt/models/add-dialog-field-settings-model.d.ts +21 -21
  108. package/src/gantt/models/add-dialog-field-settings.js +19 -19
  109. package/src/gantt/models/day-working-time-model.d.ts +11 -11
  110. package/src/gantt/models/day-working-time.js +19 -19
  111. package/src/gantt/models/edit-dialog-field-settings-model.d.ts +21 -21
  112. package/src/gantt/models/edit-dialog-field-settings.js +19 -19
  113. package/src/gantt/models/edit-settings-model.d.ts +50 -50
  114. package/src/gantt/models/edit-settings.js +19 -19
  115. package/src/gantt/models/event-marker-model.d.ts +16 -16
  116. package/src/gantt/models/event-marker.js +19 -19
  117. package/src/gantt/models/filter-settings-model.d.ts +34 -34
  118. package/src/gantt/models/filter-settings.js +19 -19
  119. package/src/gantt/models/holiday-model.d.ts +21 -21
  120. package/src/gantt/models/holiday.js +19 -19
  121. package/src/gantt/models/label-settings-model.d.ts +16 -16
  122. package/src/gantt/models/label-settings.js +19 -19
  123. package/src/gantt/models/resource-fields-model.d.ts +21 -21
  124. package/src/gantt/models/resource-fields.js +19 -19
  125. package/src/gantt/models/search-settings-model.d.ts +56 -56
  126. package/src/gantt/models/search-settings.js +19 -19
  127. package/src/gantt/models/selection-settings-model.d.ts +35 -35
  128. package/src/gantt/models/selection-settings.js +19 -19
  129. package/src/gantt/models/sort-settings-model.d.ts +24 -24
  130. package/src/gantt/models/sort-settings.js +19 -19
  131. package/src/gantt/models/splitter-settings-model.d.ts +30 -30
  132. package/src/gantt/models/splitter-settings.js +19 -19
  133. package/src/gantt/models/task-fields-model.d.ts +110 -110
  134. package/src/gantt/models/task-fields.js +19 -19
  135. package/src/gantt/models/timeline-settings-model.d.ts +71 -71
  136. package/src/gantt/models/timeline-settings.js +19 -19
  137. package/src/gantt/models/tooltip-settings-model.d.ts +26 -26
  138. package/src/gantt/models/tooltip-settings.js +19 -19
  139. package/src/gantt/renderer/chart-rows.js +49 -37
  140. package/src/gantt/renderer/connector-line.js +22 -18
  141. package/src/gantt/renderer/event-marker.js +1 -0
  142. package/src/gantt/renderer/nonworking-day.js +13 -6
  143. package/src/gantt/renderer/timeline.d.ts +1 -0
  144. package/src/gantt/renderer/timeline.js +51 -12
  145. package/src/gantt/renderer/tooltip.js +11 -3
  146. package/styles/bootstrap-dark.css +442 -427
  147. package/styles/bootstrap.css +442 -433
  148. package/styles/bootstrap4.css +454 -479
  149. package/styles/bootstrap5-dark.css +457 -433
  150. package/styles/bootstrap5.css +457 -433
  151. package/styles/fabric-dark.css +438 -421
  152. package/styles/fabric.css +445 -428
  153. package/styles/fluent-dark.css +1938 -0
  154. package/styles/fluent-dark.scss +1 -0
  155. package/styles/fluent.css +1938 -0
  156. package/styles/fluent.scss +1 -0
  157. package/styles/gantt/_all.scss +2 -2
  158. package/styles/gantt/_bootstrap-dark-definition.scss +210 -156
  159. package/styles/gantt/_bootstrap-definition.scss +211 -157
  160. package/styles/gantt/_bootstrap4-definition.scss +213 -158
  161. package/styles/gantt/_bootstrap5-definition.scss +215 -162
  162. package/styles/gantt/_fabric-dark-definition.scss +211 -157
  163. package/styles/gantt/_fabric-definition.scss +211 -157
  164. package/styles/gantt/_fluent-dark-definition.scss +1 -0
  165. package/styles/gantt/_fluent-definition.scss +215 -162
  166. package/styles/gantt/_fusionnew-definition.scss +214 -0
  167. package/styles/gantt/_highcontrast-definition.scss +211 -157
  168. package/styles/gantt/_highcontrast-light-definition.scss +211 -157
  169. package/styles/gantt/_layout.scss +1446 -1027
  170. package/styles/gantt/_material-dark-definition.scss +212 -157
  171. package/styles/gantt/_material-definition.scss +212 -157
  172. package/styles/gantt/_material3-definition.scss +215 -0
  173. package/styles/gantt/_tailwind-definition.scss +215 -161
  174. package/styles/gantt/_theme.scss +702 -668
  175. package/styles/gantt/bootstrap-dark.css +442 -427
  176. package/styles/gantt/bootstrap.css +442 -433
  177. package/styles/gantt/bootstrap4.css +454 -479
  178. package/styles/gantt/bootstrap5-dark.css +457 -433
  179. package/styles/gantt/bootstrap5.css +457 -433
  180. package/styles/gantt/fabric-dark.css +438 -421
  181. package/styles/gantt/fabric.css +445 -428
  182. package/styles/gantt/fluent-dark.css +1938 -0
  183. package/styles/gantt/fluent-dark.scss +22 -0
  184. package/styles/gantt/fluent.css +1938 -0
  185. package/styles/gantt/fluent.scss +22 -0
  186. package/styles/gantt/highcontrast-light.css +405 -405
  187. package/styles/gantt/highcontrast.css +444 -456
  188. package/styles/gantt/icons/_bootstrap-dark.scss +124 -113
  189. package/styles/gantt/icons/_bootstrap.scss +124 -113
  190. package/styles/gantt/icons/_bootstrap4.scss +124 -113
  191. package/styles/gantt/icons/_bootstrap5.scss +124 -112
  192. package/styles/gantt/icons/_fabric-dark.scss +124 -112
  193. package/styles/gantt/icons/_fabric.scss +124 -112
  194. package/styles/gantt/icons/_fluent-dark.scss +1 -0
  195. package/styles/gantt/icons/_fluent.scss +124 -112
  196. package/styles/gantt/icons/_fusionnew.scss +120 -0
  197. package/styles/gantt/icons/_highcontrast.scss +124 -112
  198. package/styles/gantt/icons/_material-dark.scss +124 -112
  199. package/styles/gantt/icons/_material.scss +124 -112
  200. package/styles/gantt/icons/_material3.scss +124 -0
  201. package/styles/gantt/icons/_tailwind-dark.scss +124 -113
  202. package/styles/gantt/icons/_tailwind.scss +124 -113
  203. package/styles/gantt/material-dark.css +446 -417
  204. package/styles/gantt/material.css +445 -419
  205. package/styles/gantt/tailwind-dark.css +452 -482
  206. package/styles/gantt/tailwind.css +449 -479
  207. package/styles/highcontrast-light.css +405 -405
  208. package/styles/highcontrast.css +444 -456
  209. package/styles/material-dark.css +446 -417
  210. package/styles/material.css +445 -419
  211. package/styles/tailwind-dark.css +452 -482
  212. package/styles/tailwind.css +449 -479
@@ -1,12 +1,3 @@
1
- /*!
2
- * filename: index.d.ts
3
- * version : 19.4.55
4
- * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
- * Use of this code is subject to the terms of our license.
6
- * A copy of the current license can be obtained at any time by e-mailing
7
- * licensing@syncfusion.com. Any infringement will be prosecuted under
8
- * applicable laws.
9
- */
10
1
  import * as _gantt from '@syncfusion/ej2-gantt';
11
2
 
12
3
  export declare namespace ej {
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Gantt Component
3
+ */
4
+ export * from './gantt/base/gantt';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Gantt Action Modules
3
+ */
4
+ export * from './edit';
5
+ export * from './column-reorder';
6
+ export * from './column-resize';
7
+ export * from './filter';
8
+ export * from './sort';
9
+ export * from './dependency';
10
+ export * from './selection';
11
+ export * from './toolbar';
12
+ export * from './day-markers';
13
+ export * from './context-menu';
14
+ export * from './excel-export';
15
+ export * from './column-menu';
16
+ export * from './rowdragdrop';
17
+ export * from './pdf-export';
18
+ export * from './virtual-scroll';
@@ -0,0 +1,606 @@
1
+ import { isNullOrUndefined as isNOU, getValue, getElement, extend, isNullOrUndefined } from '@syncfusion/ej2-base';
2
+ import { Gantt } from '../base/gantt';
3
+ import { ITaskData, ITaskbarEditedEventArgs, IGanttData, CellEditArgs, ITaskSegment } from '../base/interface';
4
+ import { ColumnModel } from '../models/column';
5
+ import { EJ2Intance } from '@syncfusion/ej2-grids';
6
+ import { TaskFieldsModel, EditDialogFieldSettingsModel, ResourceFieldsModel } from '../models/models';
7
+ import { TreeGrid, Edit } from '@syncfusion/ej2-treegrid';
8
+ import { Deferred } from '@syncfusion/ej2-data';
9
+ import { Tab } from '@syncfusion/ej2-navigations';
10
+ /**
11
+ * To handle cell edit action on default columns and custom columns
12
+ */
13
+ export class CellEdit {
14
+ private parent: Gantt;
15
+ /**
16
+ * @private
17
+ */
18
+ public isCellEdit: boolean = false;
19
+ public isResourceCellEdited: boolean = false;
20
+ public editedColumn: ColumnModel;
21
+ constructor(ganttObj: Gantt) {
22
+ this.parent = ganttObj;
23
+ this.bindTreeGridProperties();
24
+ }
25
+ /**
26
+ * Bind all editing related properties from Gantt to TreeGrid
27
+ *
28
+ * @returns {void} .
29
+ */
30
+ private bindTreeGridProperties(): void {
31
+ this.parent.treeGrid.editSettings.allowEditing = this.parent.editSettings.allowEditing;
32
+ this.parent.treeGrid.editSettings.allowNextRowEdit = this.parent.editSettings.allowNextRowEdit;
33
+ this.parent.treeGrid.editSettings.mode = 'Cell';
34
+ this.parent.treeGrid.cellEdit = this.ensureEditCell.bind(this);
35
+ if (this.parent.editSettings.allowEditing) {
36
+ TreeGrid.Inject(Edit);
37
+ }
38
+ }
39
+ /**
40
+ * Ensure current cell was editable or not
41
+ *
42
+ * @param {CellEditArgs} args .
43
+ * @returns {void | Deferred} .
44
+ */
45
+ private ensureEditCell(args: CellEditArgs): void | Deferred {
46
+ const data: IGanttData = args.rowData;
47
+ const field: string = args.columnName;
48
+ this.editedColumn = this.parent.getColumnByField(field, this.parent.ganttColumns);
49
+ const taskSettings: TaskFieldsModel = this.parent.taskFields;
50
+ if (this.parent.readOnly) {
51
+ args.cancel = true;
52
+ return;
53
+ }
54
+ if (this.parent.editSettings.mode === 'Dialog') {
55
+ args.cancel = true;
56
+ return;
57
+ }
58
+ if (data.hasChildRecords && ((field === taskSettings.endDate && ((!isNullOrUndefined(data['isManual']) &&
59
+ data['isManual'] == false) || this.parent.taskMode == 'Auto')) || field === taskSettings.duration
60
+ || field === taskSettings.dependency || field === taskSettings.progress
61
+ || field === taskSettings.work || field === 'taskType')) {
62
+ args.cancel = true;
63
+ } else {
64
+ const callBackPromise: Deferred = new Deferred();
65
+ this.parent.trigger('cellEdit', args, (arg: CellEditArgs) => {
66
+ if (data.level === 0 && this.parent.viewType === 'ResourceView') {
67
+ arg.cancel = true;
68
+ }
69
+ callBackPromise.resolve(arg);
70
+ if (!arg.cancel) {
71
+ if (arg.columnName === this.parent.taskFields.notes) {
72
+ this.openNotesEditor(arg);
73
+ } else {
74
+ this.isCellEdit = true;
75
+ if (!isNOU(this.parent.toolbarModule)) {
76
+ this.parent.toolbarModule.refreshToolbarItems();
77
+ }
78
+ }
79
+ }
80
+ });
81
+ return callBackPromise;
82
+ }
83
+ }
84
+ /**
85
+ * To render edit dialog and to focus on notes tab
86
+ *
87
+ * @param {CellEditArgs} args .
88
+ * @returns {void} .
89
+ */
90
+ private openNotesEditor(args: CellEditArgs): void {
91
+ const taskSettings: TaskFieldsModel = this.parent.taskFields;
92
+ const data: IGanttData = args.rowData;
93
+ const field: string = args.columnName;
94
+ if ((field === taskSettings.notes && !this.parent.showInlineNotes)) {
95
+ args.cancel = true;
96
+ const columnTypes: string[] =
97
+ this.parent.editModule.dialogModule.updatedEditFields.map((x: EditDialogFieldSettingsModel) => { return x.type; });
98
+ const index: number = columnTypes.indexOf('Notes');
99
+ if (index !== -1) {
100
+ this.parent.editModule.dialogModule.openEditDialog(data.ganttProperties.rowUniqueID);
101
+ const tabObj: Tab = (<EJ2Intance>document.getElementById(this.parent.element.id + '_Tab')).ej2_instances[0];
102
+ tabObj.selectedItem = index;
103
+ }
104
+ }
105
+ if (field === taskSettings.notes && this.parent.showInlineNotes === true) {
106
+ this.isCellEdit = true;
107
+ }
108
+ }
109
+ private isValueChange(args: Record<string, unknown>, field: string): boolean {
110
+ const data: IGanttData = getValue('data', args);
111
+ const editedValue: Record<string, unknown> = data[field];
112
+ const previousValue: Record<string, unknown> = getValue('previousData', args);
113
+ if ((isNOU(editedValue) && !isNOU(previousValue)) || (!isNOU(editedValue) && isNOU(previousValue))) {
114
+ return true;
115
+ } else if (!isNOU(editedValue) && !isNOU(previousValue)) {
116
+ if (editedValue instanceof Date) {
117
+ return editedValue.getTime() !== data.taskData[field].getTime() ? true : false;
118
+ } else if (field === this.parent.taskFields.resourceInfo) {
119
+ return editedValue !== previousValue ? true : false;
120
+ } else if (editedValue !== data.taskData[field]) {
121
+ return true;
122
+ }
123
+ }
124
+ return false;
125
+ }
126
+ /**
127
+ * Initiate cell save action on Gantt with arguments from TreeGrid
128
+ *
129
+ * @param {object} args .
130
+ * @param {object} editedObj .
131
+ * @returns {void} .
132
+ * @private
133
+ */
134
+ public initiateCellEdit(args: object, editedObj: object): void {
135
+ const column: ColumnModel = getValue('column', args);
136
+ const data: IGanttData = getValue('data', args);
137
+ const editedArgs: ITaskbarEditedEventArgs = {};
138
+ editedArgs.action = 'CellEditing';
139
+ editedArgs.data = this.parent.getTaskByUniqueID(data.uniqueID);
140
+ const previousValue: Record<string, unknown> = getValue('previousData', args);
141
+ const editedValue: object = this.parent.allowUnscheduledTasks ? data[column.field] : ((isNullOrUndefined(data[column.field])
142
+ || data[column.field] === '') && (this.parent.taskFields.duration === column.field ||
143
+ this.parent.taskFields.startDate === column.field || this.parent.taskFields.endDate === column.field)) ? previousValue
144
+ : data[column.field];
145
+ if (!isNOU(data)) {
146
+ data[column.field] = previousValue;
147
+ editedArgs.data[column.field] = previousValue;
148
+ this.parent.initiateEditAction(true);
149
+ this.parent.setRecordValue(column.field, editedValue, editedArgs.data);
150
+ if (column.field === this.parent.taskFields.name) {
151
+ this.taskNameEdited(editedArgs);
152
+ } else if (column.field === this.parent.taskFields.startDate) {
153
+ this.startDateEdited(editedArgs);
154
+ } else if (column.field === this.parent.taskFields.endDate) {
155
+ this.endDateEdited(editedArgs);
156
+ } else if (column.field === this.parent.taskFields.duration) {
157
+ this.durationEdited(editedArgs);
158
+ } else if (column.field === this.parent.taskFields.resourceInfo) {
159
+ this.resourceEdited(editedArgs, editedObj, data);
160
+ } else if (column.field === this.parent.taskFields.progress) {
161
+ this.progressEdited(editedArgs);
162
+ } else if (column.field === this.parent.taskFields.baselineStartDate
163
+ || column.field === this.parent.taskFields.baselineEndDate) {
164
+ this.baselineEdited(editedArgs);
165
+ } else if (column.field === this.parent.taskFields.dependency) {
166
+ this.dependencyEdited(editedArgs, previousValue);
167
+ } else if (column.field === this.parent.taskFields.notes) {
168
+ this.notedEdited(editedArgs);
169
+ } else if (column.field === this.parent.taskFields.work) {
170
+ this.workEdited(editedArgs);
171
+ } else if (column.field === 'taskType' && !isNOU(this.parent.taskFields.work)) {
172
+ this.typeEdited(editedArgs, editedObj);
173
+ } else if (column.field === this.parent.taskFields.manual) {
174
+ this.taskmodeEdited(editedArgs);
175
+ } else {
176
+ this.parent.setRecordValue('taskData.' + column.field, editedArgs.data[column.field], editedArgs.data);
177
+ this.parent.editModule.initiateSaveAction(editedArgs);
178
+ }
179
+ } else {
180
+ this.parent.editModule.endEditAction(args);
181
+ }
182
+ this.isCellEdit = false;
183
+ if (!isNOU(this.parent.toolbarModule)) {
184
+ this.parent.toolbarModule.refreshToolbarItems();
185
+ }
186
+ }
187
+ /**
188
+ * To update task name cell with new value
189
+ *
190
+ * @param {ITaskbarEditedEventArgs} args .
191
+ * @returns {void} .
192
+ */
193
+ private taskNameEdited(args: ITaskbarEditedEventArgs): void {
194
+ this.parent.setRecordValue('taskData.' + this.parent.taskFields.name, args.data[this.parent.taskFields.name], args.data);
195
+ this.parent.setRecordValue('taskName', args.data[this.parent.taskFields.name], args.data.ganttProperties, true);
196
+ this.updateEditedRecord(args);
197
+ }
198
+ /**
199
+ * To update task notes cell with new value
200
+ *
201
+ * @param {ITaskbarEditedEventArgs} args .
202
+ * @returns {void} .
203
+ */
204
+ private notedEdited(args: ITaskbarEditedEventArgs): void {
205
+ this.parent.setRecordValue('taskData.' + this.parent.taskFields.notes, args.data[this.parent.taskFields.notes], args.data);
206
+ this.parent.setRecordValue('notes', args.data[this.parent.taskFields.notes], args.data.ganttProperties, true);
207
+ this.updateEditedRecord(args);
208
+ }
209
+ /**
210
+ * To update task schedule mode cell with new value
211
+ *
212
+ * @param {ITaskbarEditedEventArgs} args .
213
+ * @returns {void} .
214
+ */
215
+ private taskmodeEdited(args: ITaskbarEditedEventArgs): void {
216
+ this.parent.setRecordValue(
217
+ 'isAutoSchedule',
218
+ !args.data[this.parent.taskFields.manual],
219
+ args.data.ganttProperties, true);
220
+ this.parent.editModule.updateTaskScheduleModes(args.data);
221
+ this.updateEditedRecord(args);
222
+ }
223
+ /**
224
+ * To update task start date cell with new value
225
+ *
226
+ * @param {ITaskbarEditedEventArgs} args .
227
+ * @returns {void} .
228
+ */
229
+ private startDateEdited(args: ITaskbarEditedEventArgs): void {
230
+ const ganttData: IGanttData = args.data;
231
+ const ganttProb: ITaskData = args.data.ganttProperties;
232
+ let currentValue: Date = args.data[this.parent.taskFields.startDate];
233
+ currentValue = currentValue ? new Date(currentValue.getTime()) : null;
234
+ currentValue = this.parent.dateValidationModule.checkStartDate(currentValue);
235
+ if (isNOU(currentValue)) {
236
+ if (!ganttData.hasChildRecords) {
237
+ this.parent.setRecordValue('startDate', null, ganttProb, true);
238
+ this.parent.setRecordValue('duration', null, ganttProb, true);
239
+ this.parent.setRecordValue('isMilestone', false, ganttProb, true);
240
+ if (this.parent.allowUnscheduledTasks && isNOU(this.parent.taskFields.endDate)) {
241
+ this.parent.setRecordValue('endDate', null, ganttProb, true);
242
+ }
243
+ }
244
+ } else if (ganttProb.endDate || !isNOU(ganttProb.duration)) {
245
+ this.parent.setRecordValue('startDate', new Date(currentValue.getTime()), ganttProb, true);
246
+ this.parent.dateValidationModule.calculateEndDate(ganttData);
247
+ } else if (isNOU(ganttProb.endDate) && isNOU(ganttProb.duration)) {
248
+ this.parent.setRecordValue('startDate', new Date(currentValue.getTime()), ganttProb, true);
249
+ }
250
+ this.parent.setRecordValue('isMilestone', ganttProb.duration === 0 ? true : false, ganttProb, true);
251
+ this.parent.dataOperation.updateWidthLeft(args.data);
252
+ this.parent.dataOperation.updateMappingData(ganttData, 'startDate');
253
+ this.parent.dataOperation.updateMappingData(ganttData, 'endDate');
254
+ this.parent.dataOperation.updateMappingData(ganttData, 'duration');
255
+ this.updateEditedRecord(args);
256
+ }
257
+
258
+ public validateEndDateWithSegments(ganttProp: ITaskData): ITaskSegment[] {
259
+ const ganttSegments: ITaskSegment[] = [];
260
+ const segments: ITaskSegment[] = ganttProp.segments;
261
+ for (let i: number = 0; i < segments.length; i++) {
262
+ const segment: ITaskSegment = segments[i];
263
+ let endDate: Date = segment.endDate;
264
+ endDate = (!isNullOrUndefined(ganttProp.endDate)) && endDate.getTime() <
265
+ ganttProp.endDate.getTime() && i !== segments.length - 1 ? endDate : ganttProp.endDate;
266
+ segment.duration = this.parent.dataOperation.getDuration(
267
+ segment.startDate, endDate, ganttProp.durationUnit, ganttProp.isAutoSchedule,
268
+ ganttProp.isMilestone
269
+ );
270
+ if (segments.length > 0 && endDate.getTime() < segment.startDate.getTime()
271
+ && endDate.getTime() <= ganttProp.endDate.getTime()) {
272
+ segments[i - 1].duration = this.parent.dataOperation.getDuration(
273
+ segments[i - 1].startDate, ganttProp.endDate, ganttProp.durationUnit,
274
+ ganttProp.isAutoSchedule, ganttProp.isMilestone);
275
+ continue;
276
+ }
277
+ ganttSegments.push(segment);
278
+ }
279
+ return ganttSegments;
280
+ }
281
+
282
+ /**
283
+ * To update task end date cell with new value
284
+ *
285
+ * @param {ITaskbarEditedEventArgs} args .
286
+ * @returns {void} .
287
+ */
288
+ private endDateEdited(args: ITaskbarEditedEventArgs): void {
289
+ const ganttProb: ITaskData = args.data.ganttProperties;
290
+ let currentValue: Date = args.data[this.parent.taskFields.endDate];
291
+ currentValue = currentValue ? new Date(currentValue.getTime()) : null;
292
+ if (isNOU(currentValue)) {
293
+ this.parent.setRecordValue('endDate', currentValue, ganttProb, true);
294
+ this.parent.setRecordValue('duration', null, ganttProb, true);
295
+ this.parent.setRecordValue('isMilestone', false, ganttProb, true);
296
+ } else {
297
+ if ((currentValue.getHours() === 0 && this.parent.defaultEndTime !== 86400)) {
298
+ this.parent.dateValidationModule.setTime(this.parent.defaultEndTime, currentValue);
299
+ }
300
+ currentValue = this.parent.dateValidationModule.checkEndDate(currentValue, ganttProb);
301
+ this.parent.setRecordValue('endDate', currentValue, ganttProb, true);
302
+ if (!isNOU(ganttProb.startDate) && isNOU(ganttProb.duration)) {
303
+ if (this.parent.dateValidationModule.compareDates(ganttProb.endDate, ganttProb.startDate) === -1) {
304
+ this.parent.setRecordValue('endDate', new Date(ganttProb.startDate.getTime()), ganttProb, true);
305
+ this.parent.dateValidationModule.setTime(this.parent.defaultEndTime, ganttProb.endDate);
306
+ }
307
+ } else if (!isNOU(ganttProb.duration) && isNOU(ganttProb.startDate)) {
308
+ this.parent.setRecordValue(
309
+ 'startDate',
310
+ this.parent.dateValidationModule.getStartDate(ganttProb.endDate, ganttProb.duration, ganttProb.durationUnit, ganttProb),
311
+ ganttProb,
312
+ true
313
+ );
314
+ }
315
+ if (!isNullOrUndefined(ganttProb.segments)) {
316
+ ganttProb.segments = this.validateEndDateWithSegments(ganttProb);
317
+ }
318
+ if (this.compareDatesFromRecord(ganttProb) === -1) {
319
+ this.parent.dateValidationModule.calculateDuration(args.data);
320
+ } else {
321
+ this.parent.editModule.revertCellEdit(args);
322
+ }
323
+ this.parent.setRecordValue('isMilestone', (ganttProb.duration === 0 ? true : false), ganttProb, true);
324
+ if (ganttProb.isMilestone) {
325
+ this.parent.setRecordValue(
326
+ 'startDate',
327
+ this.parent.dateValidationModule.checkStartDate(ganttProb.startDate, ganttProb),
328
+ ganttProb,
329
+ true
330
+ );
331
+ }
332
+ }
333
+ if (!isNullOrUndefined(args.data.ganttProperties.segments) && args.data.ganttProperties.segments.length > 0) {
334
+ this.parent.setRecordValue(
335
+ 'segments', this.parent.dataOperation.setSegmentsInfo(args.data, false), args.data.ganttProperties, true
336
+ );
337
+ this.parent.dataOperation.updateMappingData(args.data, 'segments');
338
+ }
339
+ this.parent.dataOperation.updateWidthLeft(args.data);
340
+ this.parent.dataOperation.updateMappingData(args.data, 'startDate');
341
+ this.parent.dataOperation.updateMappingData(args.data, 'endDate');
342
+ this.parent.dataOperation.updateMappingData(args.data, 'duration');
343
+ this.parent.editModule.updateResourceRelatedFields(args.data, 'endDate');
344
+ this.updateEditedRecord(args);
345
+ }
346
+ /**
347
+ * To update duration cell with new value
348
+ *
349
+ * @param {ITaskbarEditedEventArgs} args .
350
+ * @returns {void} .
351
+ */
352
+ private durationEdited(args: ITaskbarEditedEventArgs): void {
353
+ const ganttProb: ITaskData = args.data.ganttProperties;
354
+ const durationString: string = args.data[this.parent.taskFields.duration];
355
+ this.parent.dataOperation.updateDurationValue(durationString, ganttProb);
356
+ this.updateDates(args);
357
+ this.parent.editModule.updateResourceRelatedFields(args.data, 'duration');
358
+ this.updateEditedRecord(args);
359
+ }
360
+ /**
361
+ * To update start date, end date based on duration
362
+ *
363
+ * @param {ITaskbarEditedEventArgs} args .
364
+ * @returns {void} .
365
+ */
366
+ private updateDates(args: ITaskbarEditedEventArgs): void {
367
+ const ganttProb: ITaskData = args.data.ganttProperties;
368
+ const endDate: Date = this.parent.dateValidationModule.getDateFromFormat(ganttProb.endDate);
369
+ const startDate: Date = this.parent.dateValidationModule.getDateFromFormat(ganttProb.startDate);
370
+ const currentDuration: number = ganttProb.duration;
371
+ if (isNOU(currentDuration)) {
372
+ this.parent.setRecordValue('isMilestone', false, ganttProb, true);
373
+ this.parent.setRecordValue('endDate', null, ganttProb, true);
374
+ } else {
375
+ if (isNOU(startDate) && !isNOU(endDate)) {
376
+ this.parent.setRecordValue(
377
+ 'startDate',
378
+ this.parent.dateValidationModule.getStartDate(endDate, currentDuration, ganttProb.durationUnit, ganttProb),
379
+ ganttProb,
380
+ true
381
+ );
382
+ }
383
+ if (currentDuration !== 0 && ganttProb.isMilestone) {
384
+ this.parent.setRecordValue('isMilestone', false, ganttProb, true);
385
+ this.parent.setRecordValue(
386
+ 'startDate',
387
+ this.parent.dateValidationModule.checkStartDate(ganttProb.startDate, ganttProb),
388
+ ganttProb,
389
+ true
390
+ );
391
+ }
392
+ if (!isNullOrUndefined(ganttProb.segments) && ganttProb.segments.length > 0) {
393
+ this.parent.setRecordValue('segments', this.parent.dataOperation.setSegmentsInfo(args.data, false), ganttProb, true);
394
+ this.parent.dataOperation.updateMappingData(args.data, 'segments');
395
+ }
396
+ this.parent.setRecordValue('isMilestone', (ganttProb.duration === 0 ? true : false), ganttProb, true);
397
+ this.parent.dateValidationModule.calculateEndDate(args.data);
398
+ }
399
+ this.parent.dataOperation.updateWidthLeft(args.data);
400
+ this.parent.dataOperation.updateMappingData(args.data, 'endDate');
401
+ this.parent.dataOperation.updateMappingData(args.data, 'startDate');
402
+ this.parent.dataOperation.updateMappingData(args.data, 'duration');
403
+ }
404
+ /**
405
+ * To update progress cell with new value
406
+ *
407
+ * @param {ITaskbarEditedEventArgs} args .
408
+ * @returns {void} .
409
+ */
410
+ private progressEdited(args: ITaskbarEditedEventArgs): void {
411
+ const ganttRecord: IGanttData = args.data;
412
+ this.parent.setRecordValue(
413
+ 'progress',
414
+ (ganttRecord[this.parent.taskFields.progress] > 100 ? 100 : ganttRecord[this.parent.taskFields.progress]),
415
+ ganttRecord.ganttProperties, true);
416
+ this.parent.setRecordValue(
417
+ 'taskData.' + this.parent.taskFields.progress,
418
+ (ganttRecord[this.parent.taskFields.progress] > 100 ? 100 : ganttRecord[this.parent.taskFields.progress]),
419
+ args.data);
420
+ if (!ganttRecord.ganttProperties.isAutoSchedule) {
421
+ this.parent.setRecordValue('autoWidth',
422
+ this.parent.dataOperation.calculateWidth(ganttRecord, false), ganttRecord.ganttProperties, true);
423
+ }
424
+ if (!isNullOrUndefined(args.data.ganttProperties.segments) && args.data.ganttProperties.segments.length > 0 &&
425
+ !isNullOrUndefined(this.parent.editModule.taskbarEditModule)) {
426
+ this.parent.editModule.taskbarEditModule.updateSegmentProgress(args.data.ganttProperties);
427
+ }
428
+ if (!args.data.hasChildRecords) {
429
+ const width: number = ganttRecord.ganttProperties.isAutoSchedule ? ganttRecord.ganttProperties.width :
430
+ ganttRecord.ganttProperties.autoWidth;
431
+ this.parent.setRecordValue(
432
+ 'progressWidth',
433
+ this.parent.dataOperation.getProgressWidth(width, ganttRecord.ganttProperties.progress),
434
+ ganttRecord.ganttProperties,
435
+ true
436
+ );
437
+ }
438
+ this.updateEditedRecord(args);
439
+ }
440
+ /**
441
+ * To update baselines with new baseline start date and baseline end date
442
+ *
443
+ * @param {ITaskbarEditedEventArgs} args .
444
+ * @returns {void} .
445
+ */
446
+ private baselineEdited(args: ITaskbarEditedEventArgs): void {
447
+ const ganttRecord: ITaskData = args.data.ganttProperties;
448
+ const baseLineStartDate: Date = args.data[this.parent.taskFields.baselineStartDate];
449
+ const baseLineEndDate: Date = args.data[this.parent.taskFields.baselineEndDate];
450
+ if (baseLineEndDate && baseLineEndDate.getHours() === 0 && this.parent.defaultEndTime !== 86400) {
451
+ this.parent.dateValidationModule.setTime(this.parent.defaultEndTime, baseLineEndDate);
452
+ }
453
+ this.parent.setRecordValue(
454
+ 'baselineStartDate',
455
+ this.parent.dateValidationModule.checkBaselineStartDate(baseLineStartDate),
456
+ ganttRecord,
457
+ true);
458
+ this.parent.setRecordValue(
459
+ 'baselineEndDate',
460
+ this.parent.dateValidationModule.checkBaselineEndDate(baseLineEndDate),
461
+ ganttRecord,
462
+ true);
463
+ if (ganttRecord.baselineStartDate && ganttRecord.baselineEndDate) {
464
+ this.parent.setRecordValue(
465
+ 'baselineLeft',
466
+ this.parent.dataOperation.calculateBaselineLeft(ganttRecord),
467
+ ganttRecord, true
468
+ );
469
+ this.parent.setRecordValue(
470
+ 'baselineWidth',
471
+ this.parent.dataOperation.calculateBaselineWidth(ganttRecord),
472
+ ganttRecord,
473
+ true
474
+ );
475
+ }
476
+ this.updateEditedRecord(args);
477
+ }
478
+ /**
479
+ * To update task's resource cell with new value
480
+ *
481
+ * @param {ITaskbarEditedEventArgs} args .
482
+ * @param {object} editedObj .
483
+ * @param {IGanttData} previousData .
484
+ * @returns {void} .
485
+ */
486
+ private resourceEdited(args: ITaskbarEditedEventArgs, editedObj: Object, previousData: IGanttData): void {
487
+ const resourceSettings: ResourceFieldsModel = this.parent.resourceFields;
488
+ const editedResourceId: string[] = editedObj[this.parent.taskFields.resourceInfo];
489
+ if (editedResourceId) {
490
+ this.isResourceCellEdited = true;
491
+ const tempResourceInfo: Object[] = this.parent.dataOperation.setResourceInfo(editedObj);
492
+ const editedResouceLength: number = tempResourceInfo.length;
493
+ const previousResource: Object[] = previousData.ganttProperties.resourceInfo;
494
+ let index: number;
495
+ const editedResources: Object[] = [];
496
+ const resourceData: Object[] = this.parent.resources;
497
+ let newIndex: number;
498
+ for (let count: number = 0; count < editedResouceLength; count++) {
499
+ if (previousResource) {
500
+ const previousResourceLength: number = previousResource.length;
501
+ for (newIndex = 0; newIndex < previousResourceLength; newIndex++) {
502
+ if (previousResource[newIndex][resourceSettings.id] === editedResourceId[count]) {
503
+ index = newIndex;
504
+ break;
505
+ } else {
506
+ index = -1;
507
+ }
508
+ }
509
+ }
510
+ if (!isNOU(index) && index !== -1) {
511
+ editedResources.push(previousResource[index]);
512
+ } else {
513
+ const resource: Object[] = resourceData.filter((resourceInfo: Object) => {
514
+ return (editedResourceId[count] === resourceInfo[resourceSettings.id]);
515
+ });
516
+ const ganttDataResource: Object = extend({}, resource[0]);
517
+ ganttDataResource[resourceSettings.unit] = 100;
518
+ editedResources.push(ganttDataResource);
519
+ }
520
+ }
521
+ args.data.ganttProperties.resourceInfo = editedResources;
522
+ this.parent.dataOperation.updateMappingData(args.data, 'resourceInfo');
523
+ this.parent.editModule.updateResourceRelatedFields(args.data, 'resource');
524
+ if (this.parent.viewType === 'ResourceView') {
525
+ this.parent.editModule.dialogModule.isResourceUpdate = true;
526
+ this.parent.editModule.dialogModule.previousResource = previousResource;
527
+ }
528
+ this.updateDates(args);
529
+ this.updateEditedRecord(args);
530
+ }
531
+ }
532
+ /**
533
+ * To update task's predecessor cell with new value
534
+ *
535
+ * @param {ITaskbarEditedEventArgs} editedArgs .
536
+ * @param {object} cellEditArgs .
537
+ * @returns {void} .
538
+ */
539
+ private dependencyEdited(editedArgs: ITaskbarEditedEventArgs, cellEditArgs: object): void {
540
+ this.parent.predecessorModule.updateUnscheduledDependency(editedArgs.data);
541
+ if (!this.parent.connectorLineEditModule.updatePredecessor(
542
+ editedArgs.data,
543
+ editedArgs.data[this.parent.taskFields.dependency], editedArgs)) {
544
+ this.parent.editModule.revertCellEdit(cellEditArgs);
545
+ }
546
+ }
547
+ /**
548
+ * To update task's work cell with new value
549
+ *
550
+ * @param {ITaskbarEditedEventArgs} editedArgs .
551
+ * @returns {void} .
552
+ */
553
+ private workEdited(editedArgs: ITaskbarEditedEventArgs): void {
554
+ const ganttProb: ITaskData = editedArgs.data.ganttProperties;
555
+ const workValue: number = editedArgs.data[this.parent.taskFields.work];
556
+ this.parent.setRecordValue('work', workValue, ganttProb, true);
557
+ this.parent.editModule.updateResourceRelatedFields(editedArgs.data, 'work');
558
+ this.updateDates(editedArgs);
559
+ this.updateEditedRecord(editedArgs);
560
+ }
561
+ /**
562
+ * To update task type cell with new value
563
+ *
564
+ * @param {ITaskbarEditedEventArgs} args .
565
+ * @param {object} editedObj .
566
+ * @returns {void} .
567
+ */
568
+ private typeEdited(args: ITaskbarEditedEventArgs, editedObj: Object): void {
569
+ const key: string = 'taskType';
570
+ const ganttProb: ITaskData = args.data.ganttProperties;
571
+ const taskType: string = editedObj[key];
572
+ this.parent.setRecordValue('taskType', taskType, ganttProb, true);
573
+ //this.parent.dataOperation.updateMappingData(args.data, 'taskType');
574
+ this.updateEditedRecord(args);
575
+ }
576
+ /**
577
+ * To compare start date and end date from Gantt record
578
+ *
579
+ * @param {ITaskData} ganttRecord .
580
+ * @returns {number} .
581
+ */
582
+ private compareDatesFromRecord(ganttRecord: ITaskData): number {
583
+ const sDate: Date = this.parent.dateValidationModule.getValidStartDate(ganttRecord);
584
+ const eDate: Date = this.parent.dateValidationModule.getValidEndDate(ganttRecord);
585
+ return this.parent.dateValidationModule.compareDates(sDate, eDate);
586
+ }
587
+ /**
588
+ * To start method save action with edited cell value
589
+ *
590
+ * @param {ITaskbarEditedEventArgs} args .
591
+ * @returns {void} .
592
+ */
593
+ private updateEditedRecord(args: ITaskbarEditedEventArgs): void {
594
+ this.parent.editModule.initiateUpdateAction(args);
595
+ }
596
+ /**
597
+ * To remove all public private properties
598
+ *
599
+ * @returns {void} .
600
+ * @private
601
+ */
602
+ public destroy(): void {
603
+ // Destroy Method
604
+ this.parent.editModule.cellEditModule = undefined;
605
+ }
606
+ }