@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
@@ -1701,7 +1701,7 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
1701
1701
  }
1702
1702
  }
1703
1703
  if (!this.parent.taskFields.child) {
1704
- this.parent.taskFields.child = 'Children';
1704
+ this.parent.setProperties({ taskFields: { child: 'Children' } }, true);
1705
1705
  }
1706
1706
  this.constructDataSource(data);
1707
1707
  hierarchicalData = this.hierarchyData;
@@ -2026,9 +2026,9 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2026
2026
  }
2027
2027
  else {
2028
2028
  var uniqueId = ganttData.uniqueID.replace(this.parent.element.id + '_data_', '');
2029
- if (this.parent.viewType === 'ResourceView' && typeof (ganttData.ganttProperties.taskId) === "string") {
2030
- uniqueId = ganttProperties.taskId.toString();
2031
- }
2029
+ // if (this.parent.viewType === 'ResourceView' && typeof(ganttData.ganttProperties.taskId) === "string") {
2030
+ // uniqueId = ganttProperties.taskId.toString();
2031
+ // }
2032
2032
  this.parent.setRecordValue('rowUniqueID', uniqueId, ganttData);
2033
2033
  this.parent.setRecordValue('rowUniqueID', uniqueId, ganttProperties, true);
2034
2034
  this.parent.setRecordValue('sharedTaskUniqueIds', [], ganttProperties, true);
@@ -2149,6 +2149,7 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2149
2149
  segment.endDate = !taskSettings.duration && taskSettings.endDate
2150
2150
  && segment.endDate > data.ganttProperties.endDate ? data.ganttProperties.endDate : segment.endDate;
2151
2151
  segment.offsetDuration = 1;
2152
+ segment.duration = this.getDuration(segment.startDate, segment.endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2152
2153
  }
2153
2154
  }
2154
2155
  else {
@@ -2757,17 +2758,17 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2757
2758
  var isValid = false;
2758
2759
  var modifiedsDate = new Date(startDate.getTime());
2759
2760
  var hour = 0;
2760
- if (ganttData && ganttData.durationUnit == 'hour') {
2761
+ if (!isNullOrUndefined(ganttData) && ganttData.durationUnit == 'hour') {
2761
2762
  modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 60 * 1000);
2762
2763
  }
2763
- if (ganttData && ganttData.durationUnit == 'minute') {
2764
+ if (!isNullOrUndefined(ganttData) && (ganttData.durationUnit == 'minute') || !isNullOrUndefined(ganttData) && ganttData.durationUnit == "day" && ganttData.duration < 1) {
2764
2765
  modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 1000);
2765
2766
  }
2766
2767
  for (var i = 0; i < this.parent.dayWorkingTime.length; i++) {
2767
2768
  hour = hour + this.parent.dayWorkingTime[i].to - this.parent.dayWorkingTime[i].from;
2768
2769
  }
2769
2770
  var dateDiff = modifiedsDate.getTime() - sDate.getTime();
2770
- if (ganttData && ganttData.durationUnit == 'minute' && ganttData.duration < (hour * 60)) {
2771
+ if (!isNullOrUndefined(ganttData) && (ganttData.durationUnit == 'minute' && ganttData.duration < (hour * 60)) || !isNullOrUndefined(ganttData) && ganttData.durationUnit == "day" && ganttData.duration < 1) {
2771
2772
  if (tierMode === 'Day') {
2772
2773
  if ((Math.floor((dateDiff / (1000 * 60 * 60)) % 24) >= hour || dateDiff === 0)) {
2773
2774
  isValid = true;
@@ -6549,6 +6550,13 @@ var Timeline = /** @__PURE__ @class */ (function () {
6549
6550
  tier = 'bottomTier';
6550
6551
  tr = null;
6551
6552
  }
6553
+ if (this.parent.height === "Auto" || this.parent.timelineModule.isSingleTier) {
6554
+ var timelineContainer = this.parent.element.getElementsByClassName('e-timeline-header-container')[0]['offsetHeight'];
6555
+ this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
6556
+ if (!isNullOrUndefined(this.parent.element.getElementsByClassName('e-gridcontent')[0])) {
6557
+ this.parent.treeGrid.element.getElementsByClassName('e-gridcontent')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
6558
+ }
6559
+ }
6552
6560
  };
6553
6561
  /**
6554
6562
  * To validate timeline tier count.
@@ -7046,7 +7054,7 @@ var Timeline = /** @__PURE__ @class */ (function () {
7046
7054
  // PDf export collection
7047
7055
  timelineCell.value = value;
7048
7056
  timelineCell.isWeekend = isWeekendCell;
7049
- timelineCell.width = cellWidth;
7057
+ timelineCell.width = thWidth;
7050
7058
  return parentTr;
7051
7059
  };
7052
7060
  /**
@@ -10421,7 +10429,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10421
10429
  width = endLeft - left;
10422
10430
  }
10423
10431
  else {
10424
- left = ganttProp.left < ganttProp.autoLeft ? ganttProp.left : ganttProp.autoLeft;
10432
+ left = ganttProp.left < ganttProp.autoLeft ? ganttProp.autoLeft : ganttProp.left;
10425
10433
  width = ganttProp.autoWidth;
10426
10434
  }
10427
10435
  return left + width;
@@ -11685,7 +11693,7 @@ var Dependency = /** @__PURE__ @class */ (function () {
11685
11693
  ganttRecord = predecessorsCollection[count];
11686
11694
  if ((!ganttRecord.hasChildRecords && !this.parent.allowParentDependency) || this.parent.allowParentDependency) {
11687
11695
  this.updatePredecessorHelper(ganttRecord, predecessorsCollection);
11688
- if (!ganttRecord.ganttProperties.isAutoSchedule) {
11696
+ if (!ganttRecord.ganttProperties.isAutoSchedule && this.parent.editSettings.allowEditing) {
11689
11697
  this.parent.connectorLineEditModule['calculateOffset'](ganttRecord);
11690
11698
  }
11691
11699
  }
@@ -13161,8 +13169,12 @@ var Splitter$1 = /** @__PURE__ @class */ (function () {
13161
13169
  },
13162
13170
  resizing: function (args) {
13163
13171
  _this.parent.trigger('splitterResizing', args);
13172
+ if (_this.parent.timelineModule.isZoomToFit) {
13173
+ _this.parent.timelineModule.updateTimelineAfterZooming(_this.parent.timelineModule.timelineEndDate, true);
13174
+ }
13164
13175
  },
13165
13176
  resizeStop: function (args) {
13177
+ _this.parent['calculateDimensions']();
13166
13178
  var leftPane = args.pane[0];
13167
13179
  _this.splitterPreviousPositionGrid = leftPane.scrollWidth + 1 + 'px';
13168
13180
  _this.splitterObject.paneSettings[0].size = _this.getSpliterPositionInPercentage(_this.splitterPreviousPositionGrid);
@@ -14326,14 +14338,14 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
14326
14338
  };
14327
14339
  this.focusModule = new FocusModule(this);
14328
14340
  if (this.zoomingLevels.length === 0) {
14329
- this.zoomingLevels = this.getZoomingLevels();
14341
+ this.setProperties({ zoomingLevels: this.getZoomingLevels() }, true);
14330
14342
  }
14331
14343
  this.resourceFieldsMapping();
14332
14344
  if (isNullOrUndefined(this.resourceFields.unit)) { //set resourceUnit as unit if not mapping
14333
- this.resourceFields.unit = 'unit';
14345
+ this.setProperties({ resourceFields: { unit: 'unit' } }, true);
14334
14346
  }
14335
14347
  if (!isNullOrUndefined(this.taskFields.work)) {
14336
- this.taskType = 'FixedWork';
14348
+ this.setProperties({ taskType: 'FixedWork' }, true);
14337
14349
  }
14338
14350
  this.taskIds = [];
14339
14351
  };
@@ -14943,6 +14955,9 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
14943
14955
  this.splitterModule.splitterPreviousPositionChart = pane2.scrollWidth + 1 + 'px';
14944
14956
  this.splitterModule.splitterObject.paneSettings[0].size = this.splitterModule['getSpliterPositionInPercentage'](this.splitterModule.splitterPreviousPositionGrid);
14945
14957
  this.splitterModule.splitterObject.paneSettings[1].size = this.splitterModule.splitterPreviousPositionChart;
14958
+ if (this.timelineModule.isZoomToFit) {
14959
+ this.timelineModule.processZoomToFit();
14960
+ }
14946
14961
  }
14947
14962
  };
14948
14963
  Gantt.prototype.keyActionHandler = function (e) {
@@ -25623,7 +25638,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
25623
25638
  this.parent.timelineModule.updateTimeLineOnEditing([tempArray], args.action);
25624
25639
  }
25625
25640
  if (this.parent.viewType === 'ResourceView') {
25626
- if (args.action === 'TaskbarEditing') {
25641
+ if (args.action === 'TaskbarEditing' || args.action === 'DrawConnectorLine') {
25627
25642
  this.updateSharedTask(args.data);
25628
25643
  }
25629
25644
  else if (args.action === 'DialogEditing' || args.action === 'CellEditing' || args.action === 'methodUpdate') {
@@ -30753,14 +30768,68 @@ var CriticalPath = /** @__PURE__ @class */ (function () {
30753
30768
  var criticalPathIds = [];
30754
30769
  var index;
30755
30770
  var predecessorFrom;
30756
- for (var x = collection.length - 1; x >= 0; x--) {
30771
+ var slackindexes = [];
30772
+ var indexes = [];
30773
+ for (var z = flatRecords.length - 1; z >= 0; z--) {
30774
+ if (flatRecords[parseInt(z.toString(), 10)].slack === '0 day') {
30775
+ var index1 = flatRecords[parseInt(z.toString(), 10)].index;
30776
+ slackindexes.push(index1);
30777
+ }
30778
+ }
30779
+ var num = 0;
30780
+ indexes.push(slackindexes[parseInt(num.toString(), 10)]);
30781
+ for (var j = 0; j < indexes.length; j++) {
30782
+ var i = flatRecords[indexes[parseInt(j.toString(), 10)]].ganttProperties.predecessor;
30783
+ if (!isNullOrUndefined(i)) {
30784
+ for (var f = i.length - 1; f >= 0; f--) {
30785
+ if (this.parent.viewType === 'ProjectView') {
30786
+ var q = modelRecordIds.indexOf(i[parseInt(f.toString(), 10)]['from']);
30787
+ for (var k = 0; k < indexes.length; k++) {
30788
+ var item = indexes[parseInt(j.toString(), 10)];
30789
+ if (item !== q) {
30790
+ indexes.push(q);
30791
+ }
30792
+ break;
30793
+ }
30794
+ }
30795
+ else {
30796
+ var q = this.resourceCollectionIds.indexOf(i[parseInt(f.toString(), 10)]['from']);
30797
+ for (var k = 0; k < indexes.length; k++) {
30798
+ var item = indexes[parseInt(j.toString(), 10)];
30799
+ if (item !== q) {
30800
+ indexes.push(q);
30801
+ }
30802
+ break;
30803
+ }
30804
+ }
30805
+ }
30806
+ }
30807
+ }
30808
+ for (var x = 0; x < indexes.length; x++) {
30757
30809
  if (this.parent.viewType === 'ProjectView') {
30758
- index = modelRecordIds.indexOf(collection[x]['taskid'].toString());
30810
+ index = modelRecordIds.indexOf(flatRecords[indexes[parseInt(x.toString(), 10)]]['ganttProperties']['taskId'].toString());
30759
30811
  }
30760
30812
  else {
30761
- index = this.resourceCollectionIds.indexOf(collection[x]['taskid'].toString());
30813
+ index = this.resourceCollectionIds.indexOf(flatRecords[indexes[parseInt(x.toString(), 10)]]['TaskID'].toString());
30762
30814
  }
30763
30815
  var predecessorLength = flatRecords[index].ganttProperties.predecessor;
30816
+ if (isNullOrUndefined(predecessorLength)) {
30817
+ if (taskBeyondEnddate.length > 0) {
30818
+ for (var i = 0; i < taskBeyondEnddate.length; i++) {
30819
+ if (this.parent.viewType === 'ProjectView') {
30820
+ index = modelRecordIds.indexOf(taskBeyondEnddate[i].toString());
30821
+ }
30822
+ else {
30823
+ index = this.resourceCollectionIds.indexOf(taskBeyondEnddate[i].toString());
30824
+ }
30825
+ if (index !== -1 && flatRecords[index].ganttProperties.progress < 100) {
30826
+ this.criticalTasks.push(flatRecords[index]);
30827
+ criticalPathIds = criticalPathIds.concat(taskBeyondEnddate[i]);
30828
+ }
30829
+ }
30830
+ }
30831
+ break;
30832
+ }
30764
30833
  var noSlackValue = 0 + ' ' + flatRecords[index].ganttProperties.durationUnit;
30765
30834
  for (var i = predecessorLength.length - 1; i >= 0; i--) {
30766
30835
  var toID = void 0;
@@ -30824,21 +30893,8 @@ var CriticalPath = /** @__PURE__ @class */ (function () {
30824
30893
  flatRecords[index].isCritical = true;
30825
30894
  flatRecords[index].ganttProperties.isCritical = true;
30826
30895
  this.criticalTasks.push(flatRecords[index]);
30827
- criticalPathIds.push(collection[x]['taskid']);
30828
- }
30829
- }
30830
- }
30831
- if (taskBeyondEnddate.length > 0) {
30832
- for (var i = 0; i < taskBeyondEnddate.length; i++) {
30833
- if (this.parent.viewType === 'ProjectView') {
30834
- index = modelRecordIds.indexOf(taskBeyondEnddate[i].toString());
30835
- }
30836
- else {
30837
- index = this.resourceCollectionIds.indexOf(taskBeyondEnddate[i].toString());
30838
- }
30839
- if (index !== -1 && flatRecords[index].ganttProperties.progress < 100) {
30840
- this.criticalTasks.push(flatRecords[index]);
30841
- criticalPathIds = criticalPathIds.concat(taskBeyondEnddate[i]);
30896
+ var num_1 = flatRecords[parseInt(index.toString(), 10)]['ganttProperties']['taskId'];
30897
+ criticalPathIds.push(num_1);
30842
30898
  }
30843
30899
  }
30844
30900
  }
@@ -31267,7 +31323,7 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
31267
31323
  this.parent.ganttChartModule.targetElement;
31268
31324
  // Closed edited cell before opening context menu
31269
31325
  // eslint-disable-next-line
31270
- if (!isNullOrUndefined(this.parent.editModule) && this.parent.editModule.cellEditModule && this.parent.editModule.cellEditModule.isCellEdit && target.parentElement.classList.contains('e-row')) {
31326
+ 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')) {
31271
31327
  this.parent.treeGrid.closeEdit();
31272
31328
  }
31273
31329
  if (!isNullOrUndefined(args.element) && args.element.id === this.parent.element.id + '_contextmenu') {