@syncfusion/ej2-gantt 19.4.40 → 19.4.47

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 (68) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +1 -1
  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 +86 -40
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +86 -40
  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 +17 -17
  13. package/src/gantt/actions/chart-scroll.js +1 -0
  14. package/src/gantt/actions/dialog-edit.js +1 -1
  15. package/src/gantt/actions/edit.d.ts +1 -1
  16. package/src/gantt/actions/edit.js +5 -1
  17. package/src/gantt/actions/filter.js +1 -1
  18. package/src/gantt/actions/keyboard.js +4 -0
  19. package/src/gantt/actions/rowdragdrop.js +1 -1
  20. package/src/gantt/actions/taskbar-edit.js +4 -1
  21. package/src/gantt/base/date-processor.js +8 -1
  22. package/src/gantt/base/gantt-chart.js +6 -2
  23. package/src/gantt/base/gantt.js +20 -9
  24. package/src/gantt/base/task-processor.js +15 -8
  25. package/src/gantt/renderer/chart-rows.js +2 -0
  26. package/src/gantt/renderer/edit-tooltip.js +1 -0
  27. package/src/gantt/renderer/timeline.d.ts +1 -0
  28. package/src/gantt/renderer/timeline.js +16 -15
  29. package/src/gantt/renderer/tooltip.js +1 -0
  30. package/styles/bootstrap-dark.css +9 -1
  31. package/styles/bootstrap.css +9 -1
  32. package/styles/bootstrap4.css +9 -1
  33. package/styles/bootstrap5-dark.css +9 -2
  34. package/styles/bootstrap5.css +9 -2
  35. package/styles/fabric-dark.css +9 -1
  36. package/styles/fabric.css +9 -1
  37. package/styles/gantt/_bootstrap-dark-definition.scss +0 -1
  38. package/styles/gantt/_bootstrap-definition.scss +0 -1
  39. package/styles/gantt/_bootstrap4-definition.scss +0 -1
  40. package/styles/gantt/_bootstrap5-definition.scss +0 -1
  41. package/styles/gantt/_fabric-dark-definition.scss +0 -1
  42. package/styles/gantt/_fabric-definition.scss +0 -1
  43. package/styles/gantt/_fluent-definition.scss +0 -1
  44. package/styles/gantt/_highcontrast-definition.scss +0 -1
  45. package/styles/gantt/_highcontrast-light-definition.scss +0 -1
  46. package/styles/gantt/_layout.scss +8 -1
  47. package/styles/gantt/_material-dark-definition.scss +0 -1
  48. package/styles/gantt/_material-definition.scss +0 -1
  49. package/styles/gantt/_tailwind-definition.scss +0 -1
  50. package/styles/gantt/bootstrap-dark.css +9 -1
  51. package/styles/gantt/bootstrap.css +9 -1
  52. package/styles/gantt/bootstrap4.css +9 -1
  53. package/styles/gantt/bootstrap5-dark.css +9 -2
  54. package/styles/gantt/bootstrap5.css +9 -2
  55. package/styles/gantt/fabric-dark.css +9 -1
  56. package/styles/gantt/fabric.css +9 -1
  57. package/styles/gantt/highcontrast-light.css +9 -1
  58. package/styles/gantt/highcontrast.css +9 -1
  59. package/styles/gantt/material-dark.css +9 -1
  60. package/styles/gantt/material.css +9 -1
  61. package/styles/gantt/tailwind-dark.css +9 -1
  62. package/styles/gantt/tailwind.css +9 -1
  63. package/styles/highcontrast-light.css +9 -1
  64. package/styles/highcontrast.css +9 -1
  65. package/styles/material-dark.css +9 -1
  66. package/styles/material.css +9 -1
  67. package/styles/tailwind-dark.css +9 -1
  68. package/styles/tailwind.css +9 -1
@@ -483,7 +483,14 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
483
483
  tDuration = this.parent.editModule.taskbarEditModule.sumOfDuration(ganttProperties.segments);
484
484
  }
485
485
  else {
486
- tDuration = this.getDuration(ganttProperties.startDate, ganttProperties.endDate, ganttProperties.durationUnit, ganttProperties.isAutoSchedule, ganttProperties.isMilestone);
486
+ // eslint-disable-next-line
487
+ if (!isNullOrUndefined(ganttProperties.startDate) && !isNullOrUndefined(ganttProperties.endDate) &&
488
+ (ganttProperties.startDate).getTime() === (ganttProperties.endDate).getTime() && !isNullOrUndefined(ganttData.taskData[this.parent.taskFields.milestone])) {
489
+ tDuration = 1;
490
+ }
491
+ else {
492
+ tDuration = this.getDuration(ganttProperties.startDate, ganttProperties.endDate, ganttProperties.durationUnit, ganttProperties.isAutoSchedule, ganttProperties.isMilestone);
493
+ }
487
494
  }
488
495
  this.parent.setRecordValue('duration', tDuration, ganttProperties, true);
489
496
  var col = this.parent.columnByField[this.parent.columnMapping.duration];
@@ -2628,7 +2635,12 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2628
2635
  eDate.setHours(0, 0, 0, 0);
2629
2636
  }
2630
2637
  }
2631
- return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2638
+ if ((sDate).getTime() === (eDate).getTime()) {
2639
+ return (this.parent.perDayWidth);
2640
+ }
2641
+ else {
2642
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2643
+ }
2632
2644
  };
2633
2645
  /**
2634
2646
  * Get task left value
@@ -2717,14 +2729,16 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2717
2729
  // eslint-disable-next-line
2718
2730
  var resourcesId = [];
2719
2731
  var resourcesName = [];
2720
- for (var i = 0; i < resourceData.length; i++) {
2721
- resourcesId.push(resourceData[i][resourceSettings.id]);
2722
- var resName = resourceData[i][resourceSettings.name];
2723
- var resourceUnit = resourceData[i][resourceSettings.unit];
2724
- if (resourceUnit !== 100) {
2725
- resName += '[' + resourceUnit + '%' + ']';
2732
+ if (!isNullOrUndefined(resourceData)) {
2733
+ for (var i = 0; i < resourceData.length; i++) {
2734
+ resourcesId.push(resourceData[i][resourceSettings.id]);
2735
+ var resName = resourceData[i][resourceSettings.name];
2736
+ var resourceUnit = resourceData[i][resourceSettings.unit];
2737
+ if (resourceUnit !== 100) {
2738
+ resName += '[' + resourceUnit + '%' + ']';
2739
+ }
2740
+ resourcesName.push(resName);
2726
2741
  }
2727
- resourcesName.push(resName);
2728
2742
  }
2729
2743
  this.parent.setRecordValue('resourceNames', resourcesName.join(','), ganttProp, true);
2730
2744
  this.updateTaskDataResource(ganttData);
@@ -4035,6 +4049,7 @@ var ChartScroll = /** @__PURE__ @class */ (function () {
4035
4049
  */
4036
4050
  ChartScroll.prototype.setScrollTop = function (scrollTop) {
4037
4051
  this.element.scrollTop = scrollTop;
4052
+ this.parent.treeGrid.element.querySelector('.e-content').scrollTop = scrollTop;
4038
4053
  };
4039
4054
  /**
4040
4055
  * To set scroll left for chart scroll container
@@ -4425,6 +4440,12 @@ var GanttChart = /** @__PURE__ @class */ (function () {
4425
4440
  * @private
4426
4441
  */
4427
4442
  GanttChart.prototype.mouseUp = function (e) {
4443
+ if (this.parent.allowRowDragAndDrop) {
4444
+ var ganttDragElemet = this.parent.element.querySelector('.e-ganttdrag');
4445
+ if (ganttDragElemet) {
4446
+ ganttDragElemet.remove();
4447
+ }
4448
+ }
4428
4449
  if (!this.isGanttElement) {
4429
4450
  this.parent.notify('chartMouseUp', e);
4430
4451
  }
@@ -4873,8 +4894,6 @@ var GanttChart = /** @__PURE__ @class */ (function () {
4873
4894
  this.parent.treeGrid.collapseAll();
4874
4895
  }
4875
4896
  this.isExpandAll = false;
4876
- var focussedElement = this.parent.element.querySelector('.e-treegrid');
4877
- focussedElement.focus();
4878
4897
  };
4879
4898
  /**
4880
4899
  * Public method to expand particular level of rows.
@@ -6107,9 +6126,6 @@ var Timeline = /** @__PURE__ @class */ (function () {
6107
6126
  parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell);
6108
6127
  scheduleDateCollection.push(new Date(startDate.toString()));
6109
6128
  increment = this.getIncrement(startDate, count, mode);
6110
- if (this.parent.isInDst(startDate)) {
6111
- increment = increment + (1000 * 60 * 60);
6112
- }
6113
6129
  newTime = startDate.getTime() + increment;
6114
6130
  startDate.setTime(newTime);
6115
6131
  if (startDate >= endDate) {
@@ -6173,24 +6189,17 @@ var Timeline = /** @__PURE__ @class */ (function () {
6173
6189
  dayIntervel - 1 : dayIntervel : dayIntervel;
6174
6190
  lastDay.setDate(lastDay.getDate() + (dayIntervel + (7 * count)));
6175
6191
  increment = lastDay.getTime() - firstDay.getTime();
6176
- if ((this.parent.isInDst(lastDay) && !this.parent.isInDst(firstDay)) ||
6177
- (!this.parent.isInDst(lastDay) && this.parent.isInDst(firstDay))) {
6178
- increment = increment - (1000 * 60 * 60);
6179
- }
6180
6192
  break;
6181
6193
  }
6182
6194
  case 'Day':
6183
6195
  lastDay.setHours(24, 0, 0, 0);
6184
6196
  increment = (lastDay.getTime() - firstDay.getTime()) + (1000 * 60 * 60 * 24 * (count - 1));
6185
- if ((this.parent.isInDst(lastDay) && !this.parent.isInDst(firstDay)) ||
6186
- (!this.parent.isInDst(lastDay) && this.parent.isInDst(firstDay))) {
6187
- increment -= (1000 * 60 * 60);
6188
- }
6189
6197
  break;
6190
6198
  case 'Hour':
6191
6199
  lastDay.setMinutes(60);
6192
6200
  lastDay.setSeconds(0);
6193
6201
  increment = (lastDay.getTime() - firstDay.getTime()) + (1000 * 60 * 60 * (count - 1));
6202
+ increment = this.checkDate(firstDay, lastDay, increment, count);
6194
6203
  break;
6195
6204
  case 'Minutes':
6196
6205
  lastDay.setSeconds(60);
@@ -6199,6 +6208,21 @@ var Timeline = /** @__PURE__ @class */ (function () {
6199
6208
  }
6200
6209
  return increment;
6201
6210
  };
6211
+ Timeline.prototype.checkDate = function (firstDay, lastDay, increment, count) {
6212
+ var date = new Date(firstDay.getTime());
6213
+ date.setTime(date.getTime() + increment);
6214
+ if (((date.getTime() - lastDay.getTime()) / (1000 * 60 * 60)) != count && (firstDay.getTimezoneOffset() !== date.getTimezoneOffset())) {
6215
+ var diffCount = count - (date.getTime() - lastDay.getTime()) / (1000 * 60 * 60);
6216
+ if (!this.parent.isInDst(date)) {
6217
+ increment += (1000 * 60 * 60 * diffCount);
6218
+ }
6219
+ else if (this.parent.isInDst(date)) {
6220
+ increment -= (1000 * 60 * 60 * diffCount);
6221
+ }
6222
+ }
6223
+ return increment;
6224
+ };
6225
+
6202
6226
  /**
6203
6227
  * Method to find header cell was weekend or not
6204
6228
  *
@@ -6281,10 +6305,6 @@ var Timeline = /** @__PURE__ @class */ (function () {
6281
6305
  */
6282
6306
  Timeline.prototype.calculateWidthBetweenTwoDate = function (mode, scheduleWeeks, endDate) {
6283
6307
  var timeDifference = (endDate.getTime() - scheduleWeeks.getTime());
6284
- if ((this.parent.isInDst(scheduleWeeks) && !this.parent.isInDst(endDate)) ||
6285
- (!this.parent.isInDst(scheduleWeeks) && this.parent.isInDst(endDate))) {
6286
- timeDifference = timeDifference - (1000 * 60 * 60);
6287
- }
6288
6308
  var balanceDay = (timeDifference / (1000 * 60 * 60 * 24));
6289
6309
  return balanceDay * this.parent.perDayWidth;
6290
6310
  };
@@ -9348,6 +9368,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9348
9368
  }
9349
9369
  }
9350
9370
  }
9371
+ this.parent.renderTemplates();
9351
9372
  this.triggerQueryTaskbarInfo();
9352
9373
  this.parent.modifiedRecords = [];
9353
9374
  if (collapsedResourceRecord.length) {
@@ -9712,6 +9733,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9712
9733
  else {
9713
9734
  tr.replaceChild(this.getGanttChartRow(index, data).childNodes[0], tr.childNodes[0]);
9714
9735
  }
9736
+ this.parent.renderTemplates();
9715
9737
  if (this.parent.viewType === 'ResourceView' && data.hasChildRecords && this.parent.showOverAllocation) {
9716
9738
  if (isValidateRange) {
9717
9739
  this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);
@@ -11871,6 +11893,7 @@ var Tooltip$1 = /** @__PURE__ @class */ (function () {
11871
11893
  tooltipPositionY = tooltipPositionY + 10;
11872
11894
  }
11873
11895
  args.element.style.top = tooltipPositionY + 'px';
11896
+ args.element.style.visibility = 'visible';
11874
11897
  };
11875
11898
  /**
11876
11899
  * Method to get mouse pointor position
@@ -12120,6 +12143,10 @@ var FocusModule = /** @__PURE__ @class */ (function () {
12120
12143
  FocusModule.prototype.onKeyPress = function (e) {
12121
12144
  var ganttObj = this.parent;
12122
12145
  var expandedRecords = ganttObj.getExpandedRecords(ganttObj.currentViewData);
12146
+ if (isNullOrUndefined(this.parent.focusModule.getActiveElement()) && (e.action === 'expandAll' || e.action === 'collapseAll')) {
12147
+ var focussedElement = this.parent.element.querySelector('.e-treegrid');
12148
+ focussedElement.focus();
12149
+ }
12123
12150
  var targetElement = this.parent.focusModule.getActiveElement();
12124
12151
  if (e.action === 'home' || e.action === 'end' || e.action === 'downArrow' || e.action === 'upArrow' || e.action === 'delete' ||
12125
12152
  e.action === 'rightArrow' || e.action === 'leftArrow' || e.action === 'focusTask' || e.action === 'focusSearch' ||
@@ -12654,8 +12681,14 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
12654
12681
  Gantt.prototype.calculateDimensions = function () {
12655
12682
  var settingsHeight;
12656
12683
  if (typeof (this.height) !== 'number' && this.height.indexOf('%') !== -1 && (this.element.parentElement &&
12657
- !this.element.parentElement.style.height)) {
12658
- var ganttHeight = Number(this.height.split("%")[0]);
12684
+ !this.element.parentElement.style.height || this.element.parentElement.style.height.indexOf('%') !== -1)) {
12685
+ var ganttHeight = void 0;
12686
+ if (this.element.parentElement.style.height.indexOf('%') == -1) {
12687
+ ganttHeight = Number(this.height.split("%")[0]);
12688
+ }
12689
+ else {
12690
+ ganttHeight = Number(this.element.parentElement.style.height.split("%")[0]);
12691
+ }
12659
12692
  ganttHeight = (ganttHeight * window.innerHeight) / 100;
12660
12693
  if (this.height === '100%') {
12661
12694
  ganttHeight = ganttHeight - 16;
@@ -12810,9 +12843,16 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
12810
12843
  var settingsHeight = void 0;
12811
12844
  if (this.height.indexOf('%') !== -1) {
12812
12845
  var ganttHeight = Number(this.height.split("%")[0]);
12813
- if (this.element.parentElement && this.element.parentElement.style.height) {
12814
- var containerHeight = Number(this.element.parentElement.style.height.split("px")[0]);
12815
- ganttHeight = (ganttHeight * containerHeight) / 100;
12846
+ if (this.element.parentElement && (this.element.parentElement.style.height)) {
12847
+ var containerHeight = void 0;
12848
+ if (this.element.parentElement.style.height.indexOf('%') == -1) {
12849
+ containerHeight = Number(this.element.parentElement.style.height.split("px")[0]);
12850
+ ganttHeight = (ganttHeight * containerHeight) / 100;
12851
+ }
12852
+ else {
12853
+ containerHeight = Number(this.element.parentElement.style.height.split("%")[0]);
12854
+ ganttHeight = (window.innerHeight * containerHeight) / 100;
12855
+ }
12816
12856
  }
12817
12857
  else {
12818
12858
  ganttHeight = Number(this.height.split("%")[0]);
@@ -13328,10 +13368,8 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
13328
13368
  this.treeGrid.grid.searchSettings = getActualProperties(this.searchSettings);
13329
13369
  this.treeGrid.grid.dataBind();
13330
13370
  }
13331
- else {
13332
- this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
13333
- this.treeGrid.dataBind();
13334
- }
13371
+ this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
13372
+ this.treeGrid.dataBind();
13335
13373
  if (this.toolbarModule) {
13336
13374
  this.toolbarModule.updateSearchTextBox();
13337
13375
  }
@@ -16190,6 +16228,7 @@ var EditTooltip = /** @__PURE__ @class */ (function () {
16190
16228
  tooltipPositionX += leftEnd - (tooltipPositionX + args.element.offsetWidth);
16191
16229
  }
16192
16230
  args.element.style.left = tooltipPositionX + 'px';
16231
+ args.element.style.visibility = 'visible';
16193
16232
  };
16194
16233
  /**
16195
16234
  * To show/hide taskbar edit tooltip.
@@ -16837,7 +16876,9 @@ var TaskbarEdit = /** @__PURE__ @class */ (function (_super) {
16837
16876
  if (this.isMouseDragged && this.taskBarEditAction) {
16838
16877
  var args = {
16839
16878
  cancel: false,
16840
- requestType: 'taskbarediting'
16879
+ requestType: 'taskbarediting',
16880
+ taskBarEditAction: this.taskBarEditAction,
16881
+ data: this.taskBarEditRecord
16841
16882
  };
16842
16883
  if (this.segmentIndex !== -1) {
16843
16884
  args.requestType = 'mergeSegment';
@@ -17826,6 +17867,7 @@ var TaskbarEdit = /** @__PURE__ @class */ (function (_super) {
17826
17867
  this.isMouseDragged = false;
17827
17868
  }
17828
17869
  else {
17870
+ this.parent.isOnEdit = false;
17829
17871
  this.cancelTaskbarEditActionInMouseLeave();
17830
17872
  }
17831
17873
  }
@@ -18484,7 +18526,7 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
18484
18526
  tempData.ganttProperties.durationUnit = this.parent.durationUnit.toLocaleLowerCase();
18485
18527
  }
18486
18528
  else if (columns[i].field === taskSettings.name) {
18487
- tempData[field] = 'New Task ' + id;
18529
+ tempData[field] = this.localeObj.getConstant('addDialogTitle') + ' ' + id;
18488
18530
  tempData.ganttProperties.taskName = tempData[field];
18489
18531
  }
18490
18532
  else if (columns[i].field === taskSettings.progress) {
@@ -22050,7 +22092,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
22050
22092
  */
22051
22093
  Edit$$1.prototype.updateParentChildRecord = function (data) {
22052
22094
  var ganttRecord = data;
22053
- if (ganttRecord.hasChildRecords && this.taskbarMoved && this.parent.taskMode === 'Auto') {
22095
+ if (ganttRecord.hasChildRecords && this.taskbarMoved && this.parent.taskMode === 'Auto' && this.parent.previousRecords[data.uniqueID].resources === ganttRecord.ganttProperties['resourceNames']) {
22054
22096
  this.updateChildItems(ganttRecord);
22055
22097
  }
22056
22098
  };
@@ -23972,6 +24014,10 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23972
24014
  }
23973
24015
  this.parent.timelineModule.updateTimeLineOnEditing([tempArray], args.action);
23974
24016
  }
24017
+ var flag = getValue('doubleClickTarget', this.parent.treeGrid.editModule);
24018
+ if (flag !== null) {
24019
+ setValue('doubleClickTarget', null, this.parent.treeGrid.editModule);
24020
+ }
23975
24021
  this.addSuccess(args);
23976
24022
  args = this.constructTaskAddedEventArgs(cAddedRecord, args.modifiedRecords, 'add');
23977
24023
  this.parent.trigger('actionComplete', args);
@@ -24878,7 +24924,7 @@ var Filter$1 = /** @__PURE__ @class */ (function () {
24878
24924
  var ganttElement = closest(element, '#' + this.parent.element.id)
24879
24925
  || element.querySelector('#' + this.parent.element.id);
24880
24926
  if ((!(this.filterMenuElement.contains(element)) && !isNullOrUndefined(ganttElement)) || element.nodeName === 'HTML'
24881
- || element.nodeName === 'DIV') {
24927
+ || ((element.nodeName === 'DIV') && (!element.classList.contains('e-day')))) {
24882
24928
  remove(this.filterMenuElement);
24883
24929
  this.parent.treeGrid.grid.notify('filter-menu-close', { isOpen: false });
24884
24930
  this.filterMenuElement = null;
@@ -27659,7 +27705,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
27659
27705
  if (this.dropPosition === 'topSegment' || this.dropPosition === 'bottomSegment') {
27660
27706
  var rowPosition = this.dropPosition === 'topSegment' ? 'Above' : 'Below';
27661
27707
  this.parent.editModule.addRowSelectedItem = droppedRecord;
27662
- this.parent.editModule.updateRealDataSource(draggedRecord, rowPosition);
27708
+ this.parent.editModule.updateRealDataSource([draggedRecord], rowPosition);
27663
27709
  delete this.parent.editModule.addRowSelectedItem;
27664
27710
  }
27665
27711
  }