@syncfusion/ej2-gantt 22.2.8 → 22.2.10

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 (56) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/ej2-gantt.min.js +2 -2
  3. package/dist/ej2-gantt.umd.min.js +2 -2
  4. package/dist/ej2-gantt.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-gantt.es2015.js +89 -33
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +89 -33
  8. package/dist/es6/ej2-gantt.es5.js.map +1 -1
  9. package/dist/global/ej2-gantt.min.js +2 -2
  10. package/dist/global/ej2-gantt.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +16 -16
  13. package/src/gantt/actions/context-menu.js +1 -1
  14. package/src/gantt/actions/critical-path.js +59 -18
  15. package/src/gantt/actions/dependency.js +1 -1
  16. package/src/gantt/actions/edit.js +1 -1
  17. package/src/gantt/base/gantt.js +6 -3
  18. package/src/gantt/base/splitter.js +4 -0
  19. package/src/gantt/base/task-processor.js +8 -7
  20. package/src/gantt/renderer/chart-rows.js +1 -1
  21. package/src/gantt/renderer/timeline.js +8 -1
  22. package/styles/bootstrap-dark.css +1 -1
  23. package/styles/bootstrap.css +1 -1
  24. package/styles/bootstrap4.css +1 -1
  25. package/styles/bootstrap5-dark.css +1 -1
  26. package/styles/bootstrap5.css +1 -1
  27. package/styles/fabric-dark.css +1 -1
  28. package/styles/fabric.css +1 -1
  29. package/styles/fluent-dark.css +1 -1
  30. package/styles/fluent.css +1 -1
  31. package/styles/gantt/_layout.scss +1 -1
  32. package/styles/gantt/bootstrap-dark.css +1 -1
  33. package/styles/gantt/bootstrap.css +1 -1
  34. package/styles/gantt/bootstrap4.css +1 -1
  35. package/styles/gantt/bootstrap5-dark.css +1 -1
  36. package/styles/gantt/bootstrap5.css +1 -1
  37. package/styles/gantt/fabric-dark.css +1 -1
  38. package/styles/gantt/fabric.css +1 -1
  39. package/styles/gantt/fluent-dark.css +1 -1
  40. package/styles/gantt/fluent.css +1 -1
  41. package/styles/gantt/highcontrast-light.css +1 -1
  42. package/styles/gantt/highcontrast.css +1 -1
  43. package/styles/gantt/material-dark.css +1 -1
  44. package/styles/gantt/material.css +1 -1
  45. package/styles/gantt/material3-dark.css +1 -1
  46. package/styles/gantt/material3.css +1 -1
  47. package/styles/gantt/tailwind-dark.css +1 -1
  48. package/styles/gantt/tailwind.css +1 -1
  49. package/styles/highcontrast-light.css +1 -1
  50. package/styles/highcontrast.css +1 -1
  51. package/styles/material-dark.css +1 -1
  52. package/styles/material.css +1 -1
  53. package/styles/material3-dark.css +1 -1
  54. package/styles/material3.css +1 -1
  55. package/styles/tailwind-dark.css +1 -1
  56. package/styles/tailwind.css +1 -1
@@ -1677,7 +1677,7 @@ class TaskProcessor extends DateProcessor {
1677
1677
  }
1678
1678
  }
1679
1679
  if (!this.parent.taskFields.child) {
1680
- this.parent.taskFields.child = 'Children';
1680
+ this.parent.setProperties({ taskFields: { child: 'Children' } }, true);
1681
1681
  }
1682
1682
  this.constructDataSource(data);
1683
1683
  hierarchicalData = this.hierarchyData;
@@ -1989,9 +1989,9 @@ class TaskProcessor extends DateProcessor {
1989
1989
  }
1990
1990
  else {
1991
1991
  let uniqueId = ganttData.uniqueID.replace(this.parent.element.id + '_data_', '');
1992
- if (this.parent.viewType === 'ResourceView' && typeof (ganttData.ganttProperties.taskId) === "string") {
1993
- uniqueId = ganttProperties.taskId.toString();
1994
- }
1992
+ // if (this.parent.viewType === 'ResourceView' && typeof(ganttData.ganttProperties.taskId) === "string") {
1993
+ // uniqueId = ganttProperties.taskId.toString();
1994
+ // }
1995
1995
  this.parent.setRecordValue('rowUniqueID', uniqueId, ganttData);
1996
1996
  this.parent.setRecordValue('rowUniqueID', uniqueId, ganttProperties, true);
1997
1997
  this.parent.setRecordValue('sharedTaskUniqueIds', [], ganttProperties, true);
@@ -2111,6 +2111,7 @@ class TaskProcessor extends DateProcessor {
2111
2111
  segment.endDate = !taskSettings.duration && taskSettings.endDate
2112
2112
  && segment.endDate > data.ganttProperties.endDate ? data.ganttProperties.endDate : segment.endDate;
2113
2113
  segment.offsetDuration = 1;
2114
+ segment.duration = this.getDuration(segment.startDate, segment.endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2114
2115
  }
2115
2116
  }
2116
2117
  else {
@@ -2718,17 +2719,17 @@ class TaskProcessor extends DateProcessor {
2718
2719
  let isValid = false;
2719
2720
  let modifiedsDate = new Date(startDate.getTime());
2720
2721
  let hour = 0;
2721
- if (ganttData && ganttData.durationUnit == 'hour') {
2722
+ if (!isNullOrUndefined(ganttData) && ganttData.durationUnit == 'hour') {
2722
2723
  modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 60 * 1000);
2723
2724
  }
2724
- if (ganttData && ganttData.durationUnit == 'minute') {
2725
+ if (!isNullOrUndefined(ganttData) && (ganttData.durationUnit == 'minute') || !isNullOrUndefined(ganttData) && ganttData.durationUnit == "day" && ganttData.duration < 1) {
2725
2726
  modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 1000);
2726
2727
  }
2727
2728
  for (let i = 0; i < this.parent.dayWorkingTime.length; i++) {
2728
2729
  hour = hour + this.parent.dayWorkingTime[i].to - this.parent.dayWorkingTime[i].from;
2729
2730
  }
2730
2731
  let dateDiff = modifiedsDate.getTime() - sDate.getTime();
2731
- if (ganttData && ganttData.durationUnit == 'minute' && ganttData.duration < (hour * 60)) {
2732
+ if (!isNullOrUndefined(ganttData) && (ganttData.durationUnit == 'minute' && ganttData.duration < (hour * 60)) || !isNullOrUndefined(ganttData) && ganttData.durationUnit == "day" && ganttData.duration < 1) {
2732
2733
  if (tierMode === 'Day') {
2733
2734
  if ((Math.floor((dateDiff / (1000 * 60 * 60)) % 24) >= hour || dateDiff === 0)) {
2734
2735
  isValid = true;
@@ -6485,6 +6486,13 @@ class Timeline {
6485
6486
  tier = 'bottomTier';
6486
6487
  tr = null;
6487
6488
  }
6489
+ if (this.parent.height === "Auto" || this.parent.timelineModule.isSingleTier) {
6490
+ var timelineContainer = this.parent.element.getElementsByClassName('e-timeline-header-container')[0]['offsetHeight'];
6491
+ this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
6492
+ if (!isNullOrUndefined(this.parent.element.getElementsByClassName('e-gridcontent')[0])) {
6493
+ this.parent.treeGrid.element.getElementsByClassName('e-gridcontent')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
6494
+ }
6495
+ }
6488
6496
  }
6489
6497
  /**
6490
6498
  * To validate timeline tier count.
@@ -6981,7 +6989,7 @@ class Timeline {
6981
6989
  // PDf export collection
6982
6990
  timelineCell.value = value;
6983
6991
  timelineCell.isWeekend = isWeekendCell;
6984
- timelineCell.width = cellWidth;
6992
+ timelineCell.width = thWidth;
6985
6993
  return parentTr;
6986
6994
  }
6987
6995
  /**
@@ -10015,7 +10023,7 @@ class ChartRows extends DateProcessor {
10015
10023
  width = endLeft - left;
10016
10024
  }
10017
10025
  else {
10018
- left = ganttProp.left < ganttProp.autoLeft ? ganttProp.left : ganttProp.autoLeft;
10026
+ left = ganttProp.left < ganttProp.autoLeft ? ganttProp.autoLeft : ganttProp.left;
10019
10027
  width = ganttProp.autoWidth;
10020
10028
  }
10021
10029
  return left + width;
@@ -11275,7 +11283,7 @@ class Dependency {
11275
11283
  ganttRecord = predecessorsCollection[count];
11276
11284
  if ((!ganttRecord.hasChildRecords && !this.parent.allowParentDependency) || this.parent.allowParentDependency) {
11277
11285
  this.updatePredecessorHelper(ganttRecord, predecessorsCollection);
11278
- if (!ganttRecord.ganttProperties.isAutoSchedule) {
11286
+ if (!ganttRecord.ganttProperties.isAutoSchedule && this.parent.editSettings.allowEditing) {
11279
11287
  this.parent.connectorLineEditModule['calculateOffset'](ganttRecord);
11280
11288
  }
11281
11289
  }
@@ -12746,8 +12754,12 @@ class Splitter$1 {
12746
12754
  },
12747
12755
  resizing: (args) => {
12748
12756
  this.parent.trigger('splitterResizing', args);
12757
+ if (this.parent.timelineModule.isZoomToFit) {
12758
+ this.parent.timelineModule.updateTimelineAfterZooming(this.parent.timelineModule.timelineEndDate, true);
12759
+ }
12749
12760
  },
12750
12761
  resizeStop: (args) => {
12762
+ this.parent['calculateDimensions']();
12751
12763
  const leftPane = args.pane[0];
12752
12764
  this.splitterPreviousPositionGrid = leftPane.scrollWidth + 1 + 'px';
12753
12765
  this.splitterObject.paneSettings[0].size = this.getSpliterPositionInPercentage(this.splitterPreviousPositionGrid);
@@ -13893,14 +13905,14 @@ let Gantt = class Gantt extends Component {
13893
13905
  };
13894
13906
  this.focusModule = new FocusModule(this);
13895
13907
  if (this.zoomingLevels.length === 0) {
13896
- this.zoomingLevels = this.getZoomingLevels();
13908
+ this.setProperties({ zoomingLevels: this.getZoomingLevels() }, true);
13897
13909
  }
13898
13910
  this.resourceFieldsMapping();
13899
13911
  if (isNullOrUndefined(this.resourceFields.unit)) { //set resourceUnit as unit if not mapping
13900
- this.resourceFields.unit = 'unit';
13912
+ this.setProperties({ resourceFields: { unit: 'unit' } }, true);
13901
13913
  }
13902
13914
  if (!isNullOrUndefined(this.taskFields.work)) {
13903
- this.taskType = 'FixedWork';
13915
+ this.setProperties({ taskType: 'FixedWork' }, true);
13904
13916
  }
13905
13917
  this.taskIds = [];
13906
13918
  }
@@ -14510,6 +14522,9 @@ let Gantt = class Gantt extends Component {
14510
14522
  this.splitterModule.splitterPreviousPositionChart = pane2.scrollWidth + 1 + 'px';
14511
14523
  this.splitterModule.splitterObject.paneSettings[0].size = this.splitterModule['getSpliterPositionInPercentage'](this.splitterModule.splitterPreviousPositionGrid);
14512
14524
  this.splitterModule.splitterObject.paneSettings[1].size = this.splitterModule.splitterPreviousPositionChart;
14525
+ if (this.timelineModule.isZoomToFit) {
14526
+ this.timelineModule.processZoomToFit();
14527
+ }
14513
14528
  }
14514
14529
  }
14515
14530
  keyActionHandler(e) {
@@ -25099,7 +25114,7 @@ class Edit$2 {
25099
25114
  this.parent.timelineModule.updateTimeLineOnEditing([tempArray], args.action);
25100
25115
  }
25101
25116
  if (this.parent.viewType === 'ResourceView') {
25102
- if (args.action === 'TaskbarEditing') {
25117
+ if (args.action === 'TaskbarEditing' || args.action === 'DrawConnectorLine') {
25103
25118
  this.updateSharedTask(args.data);
25104
25119
  }
25105
25120
  else if (args.action === 'DialogEditing' || args.action === 'CellEditing' || args.action === 'methodUpdate') {
@@ -30183,14 +30198,68 @@ class CriticalPath {
30183
30198
  let criticalPathIds = [];
30184
30199
  let index;
30185
30200
  let predecessorFrom;
30186
- for (let x = collection.length - 1; x >= 0; x--) {
30201
+ const slackindexes = [];
30202
+ const indexes = [];
30203
+ for (let z = flatRecords.length - 1; z >= 0; z--) {
30204
+ if (flatRecords[parseInt(z.toString(), 10)].slack === '0 day') {
30205
+ const index1 = flatRecords[parseInt(z.toString(), 10)].index;
30206
+ slackindexes.push(index1);
30207
+ }
30208
+ }
30209
+ const num = 0;
30210
+ indexes.push(slackindexes[parseInt(num.toString(), 10)]);
30211
+ for (let j = 0; j < indexes.length; j++) {
30212
+ const i = flatRecords[indexes[parseInt(j.toString(), 10)]].ganttProperties.predecessor;
30213
+ if (!isNullOrUndefined(i)) {
30214
+ for (let f = i.length - 1; f >= 0; f--) {
30215
+ if (this.parent.viewType === 'ProjectView') {
30216
+ const q = modelRecordIds.indexOf(i[parseInt(f.toString(), 10)]['from']);
30217
+ for (let k = 0; k < indexes.length; k++) {
30218
+ const item = indexes[parseInt(j.toString(), 10)];
30219
+ if (item !== q) {
30220
+ indexes.push(q);
30221
+ }
30222
+ break;
30223
+ }
30224
+ }
30225
+ else {
30226
+ const q = this.resourceCollectionIds.indexOf(i[parseInt(f.toString(), 10)]['from']);
30227
+ for (let k = 0; k < indexes.length; k++) {
30228
+ const item = indexes[parseInt(j.toString(), 10)];
30229
+ if (item !== q) {
30230
+ indexes.push(q);
30231
+ }
30232
+ break;
30233
+ }
30234
+ }
30235
+ }
30236
+ }
30237
+ }
30238
+ for (let x = 0; x < indexes.length; x++) {
30187
30239
  if (this.parent.viewType === 'ProjectView') {
30188
- index = modelRecordIds.indexOf(collection[x]['taskid'].toString());
30240
+ index = modelRecordIds.indexOf(flatRecords[indexes[parseInt(x.toString(), 10)]]['ganttProperties']['taskId'].toString());
30189
30241
  }
30190
30242
  else {
30191
- index = this.resourceCollectionIds.indexOf(collection[x]['taskid'].toString());
30243
+ index = this.resourceCollectionIds.indexOf(flatRecords[indexes[parseInt(x.toString(), 10)]]['TaskID'].toString());
30192
30244
  }
30193
30245
  const predecessorLength = flatRecords[index].ganttProperties.predecessor;
30246
+ if (isNullOrUndefined(predecessorLength)) {
30247
+ if (taskBeyondEnddate.length > 0) {
30248
+ for (let i = 0; i < taskBeyondEnddate.length; i++) {
30249
+ if (this.parent.viewType === 'ProjectView') {
30250
+ index = modelRecordIds.indexOf(taskBeyondEnddate[i].toString());
30251
+ }
30252
+ else {
30253
+ index = this.resourceCollectionIds.indexOf(taskBeyondEnddate[i].toString());
30254
+ }
30255
+ if (index !== -1 && flatRecords[index].ganttProperties.progress < 100) {
30256
+ this.criticalTasks.push(flatRecords[index]);
30257
+ criticalPathIds = criticalPathIds.concat(taskBeyondEnddate[i]);
30258
+ }
30259
+ }
30260
+ }
30261
+ break;
30262
+ }
30194
30263
  const noSlackValue = 0 + ' ' + flatRecords[index].ganttProperties.durationUnit;
30195
30264
  for (let i = predecessorLength.length - 1; i >= 0; i--) {
30196
30265
  let toID;
@@ -30254,21 +30323,8 @@ class CriticalPath {
30254
30323
  flatRecords[index].isCritical = true;
30255
30324
  flatRecords[index].ganttProperties.isCritical = true;
30256
30325
  this.criticalTasks.push(flatRecords[index]);
30257
- criticalPathIds.push(collection[x]['taskid']);
30258
- }
30259
- }
30260
- }
30261
- if (taskBeyondEnddate.length > 0) {
30262
- for (let i = 0; i < taskBeyondEnddate.length; i++) {
30263
- if (this.parent.viewType === 'ProjectView') {
30264
- index = modelRecordIds.indexOf(taskBeyondEnddate[i].toString());
30265
- }
30266
- else {
30267
- index = this.resourceCollectionIds.indexOf(taskBeyondEnddate[i].toString());
30268
- }
30269
- if (index !== -1 && flatRecords[index].ganttProperties.progress < 100) {
30270
- this.criticalTasks.push(flatRecords[index]);
30271
- criticalPathIds = criticalPathIds.concat(taskBeyondEnddate[i]);
30326
+ const num = flatRecords[parseInt(index.toString(), 10)]['ganttProperties']['taskId'];
30327
+ criticalPathIds.push(num);
30272
30328
  }
30273
30329
  }
30274
30330
  }
@@ -30688,7 +30744,7 @@ class ContextMenu$2 {
30688
30744
  this.parent.ganttChartModule.targetElement;
30689
30745
  // Closed edited cell before opening context menu
30690
30746
  // eslint-disable-next-line
30691
- if (!isNullOrUndefined(this.parent.editModule) && this.parent.editModule.cellEditModule && this.parent.editModule.cellEditModule.isCellEdit && target.parentElement.classList.contains('e-row')) {
30747
+ if ((!isNullOrUndefined(this.parent.editModule) && this.parent.editModule.cellEditModule && this.parent.editModule.cellEditModule.isCellEdit && target.parentElement.classList.contains('e-row')) || target.parentElement.classList.contains('e-treecolumn-container')) {
30692
30748
  this.parent.treeGrid.closeEdit();
30693
30749
  }
30694
30750
  if (!isNullOrUndefined(args.element) && args.element.id === this.parent.element.id + '_contextmenu') {