@progress/kendo-angular-gantt 0.3.0-dev.202201111723 → 1.0.0

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 (138) hide show
  1. package/dist/cdn/js/kendo-angular-gantt.js +2 -2
  2. package/dist/cdn/main.js +1 -29
  3. package/dist/es/common/touch-enabled.js +9 -0
  4. package/dist/es/dependencies/utils.js +34 -0
  5. package/dist/es/dragging/dependency-drag-create.directive.js +347 -0
  6. package/dist/es/dragging/drag-validation-tooltip.component.js +27 -0
  7. package/dist/es/editing/dependencies-table.component.js +1 -1
  8. package/dist/es/editing/edit-dialog.component.js +3 -3
  9. package/dist/es/editing/edit.service.js +4 -2
  10. package/dist/es/editing/task-fields.component.js +1 -1
  11. package/dist/es/editing/{util.js → utils.js} +0 -0
  12. package/dist/es/gantt.component.js +313 -28
  13. package/dist/es/gantt.module.js +23 -6
  14. package/dist/es/index.js +5 -0
  15. package/dist/es/main.js +1 -0
  16. package/dist/es/models/events/dependency-add-event.interface.js +4 -0
  17. package/dist/es/models/events/task-delete-event.interface.js +4 -0
  18. package/dist/es/models/view-item.interface.js +4 -0
  19. package/dist/es/navigation/navigation-models.js +4 -0
  20. package/dist/es/navigation/navigation.service.js +390 -0
  21. package/dist/es/navigation/utils.js +77 -0
  22. package/dist/es/package-metadata.js +1 -1
  23. package/dist/es/rendering/gantt-milestone-task.component.js +12 -6
  24. package/dist/es/rendering/gantt-summary-task.component.js +27 -6
  25. package/dist/es/rendering/gantt-task-base.js +84 -22
  26. package/dist/es/rendering/gantt-task.component.js +13 -8
  27. package/dist/es/rendering/gantt-tasks-table-body.component.js +13 -5
  28. package/dist/es/scrolling/drag-scroll-settings.js +20 -0
  29. package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
  30. package/dist/es/scrolling/timeline-scroll.service.js +39 -0
  31. package/dist/es/scrolling/utils.js +80 -0
  32. package/dist/es/timeline/gantt-timeline.component.js +50 -4
  33. package/dist/es/toolbar/toolbar.component.js +12 -13
  34. package/dist/es/toolbar/view-selector.component.js +1 -1
  35. package/dist/es/utils.js +153 -12
  36. package/dist/es2015/common/touch-enabled.d.ts +9 -0
  37. package/dist/es2015/common/touch-enabled.js +9 -0
  38. package/dist/es2015/dependencies/utils.d.ts +15 -0
  39. package/dist/es2015/dependencies/utils.js +34 -0
  40. package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
  41. package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
  42. package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
  43. package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
  44. package/dist/es2015/editing/dependencies-table.component.js +1 -1
  45. package/dist/es2015/editing/edit-dialog.component.d.ts +1 -1
  46. package/dist/es2015/editing/edit-dialog.component.js +12 -4
  47. package/dist/es2015/editing/edit.service.d.ts +2 -3
  48. package/dist/es2015/editing/edit.service.js +4 -2
  49. package/dist/es2015/editing/task-fields.component.js +1 -1
  50. package/dist/es2015/editing/{util.d.ts → utils.d.ts} +2 -2
  51. package/dist/es2015/editing/{util.js → utils.js} +0 -0
  52. package/dist/es2015/gantt.component.d.ts +112 -17
  53. package/dist/es2015/gantt.component.js +292 -30
  54. package/dist/es2015/gantt.module.js +23 -6
  55. package/dist/es2015/index.d.ts +5 -0
  56. package/dist/es2015/index.js +5 -0
  57. package/dist/es2015/index.metadata.json +1 -1
  58. package/dist/es2015/main.d.ts +1 -0
  59. package/dist/es2015/main.js +1 -0
  60. package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
  61. package/dist/es2015/models/events/dependency-add-event.interface.js +4 -0
  62. package/dist/es2015/models/events/task-click-event.interface.d.ts +3 -3
  63. package/dist/es2015/models/events/task-delete-event.interface.d.ts +21 -0
  64. package/dist/es2015/models/events/task-delete-event.interface.js +4 -0
  65. package/dist/es2015/models/events/task-edit-event.interface.d.ts +27 -10
  66. package/dist/es2015/models/models.d.ts +4 -0
  67. package/dist/es2015/models/view-item.interface.d.ts +35 -0
  68. package/dist/es2015/models/view-item.interface.js +4 -0
  69. package/dist/es2015/navigation/navigation-models.d.ts +34 -0
  70. package/dist/es2015/navigation/navigation-models.js +4 -0
  71. package/dist/es2015/navigation/navigation.service.d.ts +126 -0
  72. package/dist/es2015/navigation/navigation.service.js +355 -0
  73. package/dist/es2015/navigation/utils.d.ts +26 -0
  74. package/dist/es2015/navigation/utils.js +69 -0
  75. package/dist/es2015/package-metadata.js +1 -1
  76. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +3 -1
  77. package/dist/es2015/rendering/gantt-milestone-task.component.js +35 -8
  78. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +5 -1
  79. package/dist/es2015/rendering/gantt-summary-task.component.js +47 -8
  80. package/dist/es2015/rendering/gantt-task-base.d.ts +20 -6
  81. package/dist/es2015/rendering/gantt-task-base.js +75 -22
  82. package/dist/es2015/rendering/gantt-task.component.d.ts +4 -2
  83. package/dist/es2015/rendering/gantt-task.component.js +47 -13
  84. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +6 -3
  85. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +27 -9
  86. package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
  87. package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
  88. package/dist/es2015/scrolling/scroll-sync.service.d.ts +1 -1
  89. package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
  90. package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
  91. package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
  92. package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
  93. package/dist/es2015/scrolling/utils.d.ts +29 -0
  94. package/dist/es2015/scrolling/utils.js +80 -0
  95. package/dist/es2015/timeline/gantt-timeline.component.d.ts +29 -4
  96. package/dist/es2015/timeline/gantt-timeline.component.js +67 -5
  97. package/dist/es2015/toolbar/toolbar.component.d.ts +4 -5
  98. package/dist/es2015/toolbar/toolbar.component.js +12 -13
  99. package/dist/es2015/toolbar/view-selector.component.js +3 -1
  100. package/dist/es2015/utils.d.ts +77 -8
  101. package/dist/es2015/utils.js +153 -12
  102. package/dist/fesm2015/index.js +3033 -1367
  103. package/dist/fesm5/index.js +2447 -830
  104. package/dist/npm/common/touch-enabled.js +11 -0
  105. package/dist/npm/dependencies/utils.js +34 -0
  106. package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
  107. package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
  108. package/dist/npm/editing/dependencies-table.component.js +1 -1
  109. package/dist/npm/editing/edit-dialog.component.js +3 -3
  110. package/dist/npm/editing/edit.service.js +4 -2
  111. package/dist/npm/editing/task-fields.component.js +1 -1
  112. package/dist/npm/editing/{util.js → utils.js} +0 -0
  113. package/dist/npm/gantt.component.js +315 -30
  114. package/dist/npm/gantt.module.js +22 -5
  115. package/dist/npm/index.js +10 -0
  116. package/dist/npm/main.js +2 -0
  117. package/dist/npm/models/events/dependency-add-event.interface.js +6 -0
  118. package/dist/npm/models/events/task-delete-event.interface.js +6 -0
  119. package/dist/npm/models/view-item.interface.js +6 -0
  120. package/dist/npm/navigation/navigation-models.js +6 -0
  121. package/dist/npm/navigation/navigation.service.js +392 -0
  122. package/dist/npm/navigation/utils.js +79 -0
  123. package/dist/npm/package-metadata.js +1 -1
  124. package/dist/npm/rendering/gantt-milestone-task.component.js +11 -5
  125. package/dist/npm/rendering/gantt-summary-task.component.js +26 -5
  126. package/dist/npm/rendering/gantt-task-base.js +84 -22
  127. package/dist/npm/rendering/gantt-task.component.js +12 -7
  128. package/dist/npm/rendering/gantt-tasks-table-body.component.js +13 -5
  129. package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
  130. package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
  131. package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
  132. package/dist/npm/scrolling/utils.js +83 -0
  133. package/dist/npm/timeline/gantt-timeline.component.js +49 -3
  134. package/dist/npm/toolbar/toolbar.component.js +10 -11
  135. package/dist/npm/toolbar/view-selector.component.js +1 -1
  136. package/dist/npm/utils.js +153 -12
  137. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  138. package/package.json +23 -21
@@ -4,6 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { isDocumentAvailable, closestInScope, matchesClasses } from '@progress/kendo-angular-common';
6
6
  import { addDays, addWeeks, cloneDate, firstDayInWeek } from '@progress/kendo-date-math';
7
+ import { DependencyType } from './models/dependency-type.enum';
7
8
  /**
8
9
  * @hidden
9
10
  */
@@ -107,24 +108,43 @@ export const isNumber = (contender) => typeof contender === 'number' && !isNaN(c
107
108
  * @hidden
108
109
  */
109
110
  export const isString = (contender) => typeof contender === 'string';
111
+ /**
112
+ * @hidden
113
+ *
114
+ * Gets the closest timeline task wrapper element from an event target.
115
+ * Restricts the search up to the provided parent element from the second param.
116
+ */
117
+ export const getClosestTaskWrapper = (element, parentScope) => {
118
+ return closestInScope(element, matchesClasses('k-task-wrap'), parentScope);
119
+ };
120
+ /**
121
+ * @hidden
122
+ *
123
+ * Checks whether the queried item or its parent items has a `k-task-wrap` selector.
124
+ * Restricts the search up to the provided parent element from the second param.
125
+ */
126
+ export const isTaskWrapper = (contender, parentScope) => {
127
+ const taskWrapper = closestInScope(contender, matchesClasses('k-task-wrap'), parentScope);
128
+ return isPresent(taskWrapper);
129
+ };
110
130
  /**
111
131
  * @hidden
112
132
  *
113
133
  * Gets the closest timeline task element from an event target.
114
- * Restricts the search up to the provided gantt element from the second param.
134
+ * Restricts the search up to the provided parent element from the second param.
115
135
  */
116
- export const getClosestTask = (element, gantt) => {
117
- return closestInScope(element, matchesClasses('k-task'), gantt);
136
+ export const getClosestTask = (element, parentScope) => {
137
+ return closestInScope(element, matchesClasses('k-task'), parentScope);
118
138
  };
119
139
  /**
120
140
  * @hidden
121
141
  *
122
142
  * Gets the closest timeline task element index from an event target.
123
143
  * Uses the `data-task-index` attribute assigned to each task.
124
- * Restricts the search up to the provided gantt element from the second param.
144
+ * Restricts the search up to the provided parent element from the second param.
125
145
  */
126
- export const getClosestTaskIndex = (element, gantt) => {
127
- const task = closestInScope(element, matchesClasses('k-task'), gantt);
146
+ export const getClosestTaskIndex = (element, parentScope) => {
147
+ const task = closestInScope(element, matchesClasses('k-task-wrap'), parentScope);
128
148
  if (!isPresent(task)) {
129
149
  return null;
130
150
  }
@@ -134,19 +154,140 @@ export const getClosestTaskIndex = (element, gantt) => {
134
154
  * @hidden
135
155
  *
136
156
  * Checks whether the queried item or its parent items has a `k-task` selector.
137
- * Restricts the search up to the provided gantt element from the second param.
157
+ * Restricts the search up to the provided parent element from the second param.
138
158
  */
139
- export const isTask = (contender, gantt) => {
140
- const task = closestInScope(contender, matchesClasses('k-task'), gantt);
159
+ export const isTask = (contender, parentScope) => {
160
+ const task = closestInScope(contender, matchesClasses('k-task'), parentScope);
141
161
  return isPresent(task);
142
162
  };
163
+ /**
164
+ * @hidden
165
+ *
166
+ * Checks whether the queried item or its parent items has a `k-toolbar` selector.
167
+ * Restricts the search up to the provided parent element from the second param.
168
+ */
169
+ export const isToolbar = (contender, parentScope) => {
170
+ const toolbar = closestInScope(contender, matchesClasses('k-gantt-toolbar'), parentScope);
171
+ return isPresent(toolbar);
172
+ };
143
173
  /**
144
174
  * @hidden
145
175
  *
146
176
  * Checks whether the queried item or its parent items has a `k-task-actions` selector - used for the clear button.
147
- * Restricts the search up to the provided gantt element from the second param.
177
+ * Restricts the search up to the provided parent element from the second param.
148
178
  */
149
- export const isClearButton = (contender, gantt) => {
150
- const clearButtonContainer = closestInScope(contender, matchesClasses('k-task-actions'), gantt);
179
+ export const isClearButton = (contender, parentScope) => {
180
+ const clearButtonContainer = closestInScope(contender, matchesClasses('k-task-actions'), parentScope);
151
181
  return isPresent(clearButtonContainer);
152
182
  };
183
+ /**
184
+ * @hidden
185
+ *
186
+ * Checks whether the queried item has a `k-task-dot` selector - used for the dependency drag clues.
187
+ */
188
+ export const isDependencyDragClue = (element) => {
189
+ if (!isPresent(element)) {
190
+ return false;
191
+ }
192
+ return element.classList.contains('k-task-dot');
193
+ };
194
+ /**
195
+ * @hidden
196
+ *
197
+ * Checks whether the queried item has a `k-task-dot` & `k-task-start` selector - used for the dependency drag start clues.
198
+ */
199
+ export const isDependencyDragStartClue = (element) => {
200
+ if (!isPresent(element)) {
201
+ return false;
202
+ }
203
+ return element.classList.contains('k-task-dot') && element.classList.contains('k-task-start');
204
+ };
205
+ /**
206
+ * @hidden
207
+ *
208
+ * Gets the `DependencyType` for an attempted dependency create from the provided two elements.
209
+ * The two linked drag clue HTML elements are used to extract this data (via their CSS classes).
210
+ */
211
+ export const getDependencyTypeFromTargetTasks = (fromTaskClue, toTaskClue) => {
212
+ if (!isDependencyDragClue(fromTaskClue) || !isDependencyDragClue(toTaskClue)) {
213
+ return null;
214
+ }
215
+ const fromTaskType = isDependencyDragStartClue(fromTaskClue) ? 'S' : 'F';
216
+ const toTaskType = isDependencyDragStartClue(toTaskClue) ? 'S' : 'F';
217
+ const dependencyTypeName = `${fromTaskType}${toTaskType}`;
218
+ switch (dependencyTypeName) {
219
+ case 'FF': return DependencyType.FF;
220
+ case 'FS': return DependencyType.FS;
221
+ case 'SF': return DependencyType.SF;
222
+ case 'SS': return DependencyType.SS;
223
+ default: return null;
224
+ }
225
+ };
226
+ /**
227
+ * @hidden
228
+ *
229
+ * Checks whether the two provided drag clues belong to the same task element.
230
+ */
231
+ export const sameTaskClues = (fromTaskClue, toTaskClue, parentScope) => {
232
+ if (!isPresent(fromTaskClue) || !isPresent(toTaskClue)) {
233
+ return false;
234
+ }
235
+ const fromTaskWrapper = getClosestTaskWrapper(fromTaskClue, parentScope);
236
+ const toTaskWrapper = getClosestTaskWrapper(toTaskClue, parentScope);
237
+ return fromTaskWrapper === toTaskWrapper;
238
+ };
239
+ /**
240
+ * @hidden
241
+ *
242
+ * Fits a contender number between a min and max range.
243
+ * If the contender is below the min value, the min value is returned.
244
+ * If the contender is above the max value, the max value is returned.
245
+ */
246
+ export const fitToRange = (contender, min, max) => {
247
+ if (!isPresent(contender) || contender < min) {
248
+ return min;
249
+ }
250
+ else if (contender > max) {
251
+ return max;
252
+ }
253
+ else {
254
+ return contender;
255
+ }
256
+ };
257
+ /**
258
+ * @hidden
259
+ *
260
+ * Checks whether either of the two provided tasks is a parent of the other.
261
+ */
262
+ export const areParentChild = (taskA, taskB) => {
263
+ let parentChildRelationship = false;
264
+ let taskAParent = taskA;
265
+ while (isPresent(taskAParent) && isPresent(taskAParent.data)) {
266
+ if (taskAParent.data === taskB.data) {
267
+ parentChildRelationship = true;
268
+ break;
269
+ }
270
+ taskAParent = taskAParent.parent;
271
+ }
272
+ let taskBParent = taskB;
273
+ while (!parentChildRelationship && isPresent(taskBParent) && isPresent(taskBParent.data)) {
274
+ if (taskBParent.data === taskA.data) {
275
+ parentChildRelationship = true;
276
+ break;
277
+ }
278
+ taskBParent = taskBParent.parent;
279
+ }
280
+ return parentChildRelationship;
281
+ };
282
+ /**
283
+ * @hidden
284
+ *
285
+ * Extracts an element from the provided client coords.
286
+ * Using the `event.target` is not reliable under mobile devices with the current implementation of the draggable, so use this instead.
287
+ */
288
+ export const elementFromPoint = (clientX, clientY) => {
289
+ if (!isDocumentAvailable()) {
290
+ return null;
291
+ }
292
+ return document.elementFromPoint(clientX, clientY);
293
+ };