@syncfusion/ej2-gantt 21.1.38 → 21.1.41

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 (54) hide show
  1. package/CHANGELOG.md +14 -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 +47 -15
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +47 -15
  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 +15 -15
  13. package/src/gantt/actions/context-menu.js +1 -1
  14. package/src/gantt/actions/dependency.js +1 -1
  15. package/src/gantt/actions/dialog-edit.js +1 -0
  16. package/src/gantt/actions/edit.js +7 -1
  17. package/src/gantt/base/date-processor.js +2 -2
  18. package/src/gantt/base/gantt.d.ts +1 -0
  19. package/src/gantt/base/gantt.js +3 -1
  20. package/src/gantt/base/task-processor.d.ts +1 -1
  21. package/src/gantt/base/task-processor.js +29 -4
  22. package/src/gantt/renderer/chart-rows.js +0 -4
  23. package/src/gantt/renderer/nonworking-day.js +3 -1
  24. package/styles/bootstrap-dark.css +1 -0
  25. package/styles/bootstrap.css +1 -0
  26. package/styles/bootstrap4.css +1 -0
  27. package/styles/bootstrap5-dark.css +1 -0
  28. package/styles/bootstrap5.css +1 -0
  29. package/styles/fabric-dark.css +1 -0
  30. package/styles/fabric.css +1 -0
  31. package/styles/fluent-dark.css +0 -3
  32. package/styles/fluent.css +0 -3
  33. package/styles/gantt/_layout.scss +0 -8
  34. package/styles/gantt/bootstrap-dark.css +1 -0
  35. package/styles/gantt/bootstrap.css +1 -0
  36. package/styles/gantt/bootstrap4.css +1 -0
  37. package/styles/gantt/bootstrap5-dark.css +1 -0
  38. package/styles/gantt/bootstrap5.css +1 -0
  39. package/styles/gantt/fabric-dark.css +1 -0
  40. package/styles/gantt/fabric.css +1 -0
  41. package/styles/gantt/fluent-dark.css +0 -3
  42. package/styles/gantt/fluent.css +0 -3
  43. package/styles/gantt/highcontrast-light.css +1 -0
  44. package/styles/gantt/highcontrast.css +1 -0
  45. package/styles/gantt/material-dark.css +1 -0
  46. package/styles/gantt/material.css +1 -0
  47. package/styles/gantt/tailwind-dark.css +1 -0
  48. package/styles/gantt/tailwind.css +1 -0
  49. package/styles/highcontrast-light.css +1 -0
  50. package/styles/highcontrast.css +1 -0
  51. package/styles/material-dark.css +1 -0
  52. package/styles/material.css +1 -0
  53. package/styles/tailwind-dark.css +1 -0
  54. package/styles/tailwind.css +1 -0
@@ -603,10 +603,10 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
603
603
  */
604
604
  DateProcessor.prototype.getDurationAsSeconds = function (duration, durationUnit) {
605
605
  var value = 0;
606
- if (!durationUnit || durationUnit === 'day') {
606
+ if (!durationUnit || durationUnit.toLocaleLowerCase() === 'day') {
607
607
  value = this.parent.secondsPerDay * duration;
608
608
  }
609
- else if (durationUnit === 'hour') {
609
+ else if (durationUnit.toLocaleLowerCase() === 'hour') {
610
610
  value = duration * 3600;
611
611
  }
612
612
  else {
@@ -1782,6 +1782,7 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
1782
1782
  */
1783
1783
  TaskProcessor.prototype.prepareDataSource = function (data) {
1784
1784
  this.prepareRecordCollection(data, 0);
1785
+ this.parent.initialLoadData = extend({}, {}, this.parent.flatData, true);
1785
1786
  // Method to maintain the shared task uniqueIds
1786
1787
  if (this.parent.viewType === 'ResourceView') {
1787
1788
  this.calculateSharedTaskUniqueIds();
@@ -2610,7 +2611,7 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2610
2611
  return 0;
2611
2612
  }
2612
2613
  else {
2613
- return this.getTaskWidth(sDate, eDate);
2614
+ return this.getTaskWidth(sDate, eDate, ganttProp);
2614
2615
  }
2615
2616
  };
2616
2617
  TaskProcessor.prototype.getTaskbarHeight = function () {
@@ -2724,13 +2725,29 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2724
2725
  * @returns {number} .
2725
2726
  * @private
2726
2727
  */
2727
- TaskProcessor.prototype.getTaskWidth = function (startDate, endDate) {
2728
+ TaskProcessor.prototype.getTaskWidth = function (startDate, endDate, ganttData) {
2728
2729
  var sDate = new Date(startDate.getTime());
2729
2730
  var eDate = new Date(endDate.getTime());
2730
2731
  var tierMode = this.parent.timelineModule.bottomTier !== 'None' ? this.parent.timelineModule.bottomTier :
2731
2732
  this.parent.timelineModule.topTier;
2733
+ var isValid = false;
2734
+ var modifiedsDate = new Date(startDate.getTime());
2735
+ var hour = 0;
2736
+ if (ganttData && ganttData.durationUnit == 'hour') {
2737
+ modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 60 * 1000);
2738
+ }
2739
+ if (ganttData && ganttData.durationUnit == 'minute') {
2740
+ modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 60 * 60 * 1000);
2741
+ }
2742
+ for (var i = 0; i < this.parent.dayWorkingTime.length; i++) {
2743
+ hour = hour + this.parent.dayWorkingTime[i].to - this.parent.dayWorkingTime[i].from;
2744
+ }
2745
+ var dateDiff = modifiedsDate.getTime() - sDate.getTime();
2732
2746
  if (tierMode === 'Day') {
2733
- if (this.getSecondsInDecimal(sDate) === this.parent.defaultStartTime) {
2747
+ if ((Math.floor((dateDiff / (1000 * 60 * 60)) % 24) >= hour || dateDiff === 0)) {
2748
+ isValid = true;
2749
+ }
2750
+ if (this.getSecondsInDecimal(sDate) === this.parent.defaultStartTime && isValid) {
2734
2751
  sDate.setHours(0, 0, 0, 0);
2735
2752
  }
2736
2753
  if (this.getSecondsInDecimal(eDate) === this.parent.defaultEndTime) {
@@ -2740,11 +2757,19 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2740
2757
  eDate.setHours(0, 0, 0, 0);
2741
2758
  }
2742
2759
  }
2760
+ else {
2761
+ isValid = true;
2762
+ }
2743
2763
  if ((sDate).getTime() === (eDate).getTime()) {
2744
2764
  return (this.parent.perDayWidth);
2745
2765
  }
2746
2766
  else {
2747
- return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2767
+ if (isValid) {
2768
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2769
+ }
2770
+ else {
2771
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * hour)) * this.parent.perDayWidth);
2772
+ }
2748
2773
  }
2749
2774
  };
2750
2775
  /**
@@ -10340,7 +10365,6 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10340
10365
  }
10341
10366
  if (this.templateData.hasChildRecords) {
10342
10367
  var parentTaskbarTemplateNode = this.getParentTaskbarNode(i, taskbarContainerNode);
10343
- var milestoneTemplateNode = this.getMilestoneNode(i, taskbarContainerNode);
10344
10368
  if (!this.templateData.ganttProperties.isAutoSchedule) {
10345
10369
  var manualTaskbar = this.getManualTaskbar();
10346
10370
  if (!isNullOrUndefined(manualTaskbar[0])) {
@@ -10355,9 +10379,6 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10355
10379
  if (parentTaskbarTemplateNode && parentTaskbarTemplateNode.length > 0) {
10356
10380
  taskbarContainerNode[0].appendChild([].slice.call(parentTaskbarTemplateNode)[0]);
10357
10381
  }
10358
- else if (milestoneTemplateNode && milestoneTemplateNode.length > 0) {
10359
- taskbarContainerNode[0].appendChild([].slice.call(milestoneTemplateNode)[0]);
10360
- }
10361
10382
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
10362
10383
  this.templateData.ganttProperties.baselineEndDate) {
10363
10384
  taskBaselineTemplateNode = ((this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.baselineEndDate.getTime()) || ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
@@ -11507,7 +11528,7 @@ var Dependency = /** @__PURE__ @class */ (function () {
11507
11528
  this.dateValidateModule.calculateEndDate(childGanttRecord);
11508
11529
  }
11509
11530
  this.parent.dataOperation.updateWidthLeft(childGanttRecord);
11510
- if (!this.parent.isLoad && childGanttRecord.parentItem && this.parent.isInPredecessorValidation &&
11531
+ if (!this.parent.isLoad && !this.parent.isFromOnPropertyChange && childGanttRecord.parentItem && this.parent.isInPredecessorValidation &&
11511
11532
  this.parent.getParentTask(childGanttRecord.parentItem).ganttProperties.isAutoSchedule) {
11512
11533
  if (this.parentIds.indexOf(childGanttRecord.parentItem.uniqueID) === -1) {
11513
11534
  this.parentIds.push(childGanttRecord.parentItem.uniqueID);
@@ -14572,6 +14593,9 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
14572
14593
  * @private
14573
14594
  */
14574
14595
  Gantt.prototype.renderGantt = function (isChange) {
14596
+ if (isChange) {
14597
+ this.isFromOnPropertyChange = isChange;
14598
+ }
14575
14599
  // predecessor calculation
14576
14600
  if (this.predecessorModule && this.taskFields.dependency) {
14577
14601
  this.predecessorModule['parentIds'] = [];
@@ -14586,7 +14610,6 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
14586
14610
  this.timelineModule.validateTimelineProp();
14587
14611
  }
14588
14612
  if (isChange) {
14589
- this.isFromOnPropertyChange = isChange;
14590
14613
  if (this.enableValidation) {
14591
14614
  this.dataOperation.updateGanttData();
14592
14615
  }
@@ -22407,6 +22430,7 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
22407
22430
  DialogEdit.prototype.renderNotesTab = function (itemName) {
22408
22431
  var ganttObj = this.parent;
22409
22432
  var inputModel = this.beforeOpenArgs[itemName];
22433
+ inputModel.enableHtmlSanitizer = this.parent.enableHtmlSanitizer;
22410
22434
  var ganttProp = this.editedRecord.ganttProperties;
22411
22435
  var divElement = this.createDivElement('', ganttObj.element.id + '' + itemName + 'TabContainer');
22412
22436
  RichTextEditor.Inject(Toolbar$2, Link, HtmlEditor, QuickToolbar, Count);
@@ -25026,7 +25050,13 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
25026
25050
  }
25027
25051
  else if (isNullOrUndefined(previousData)) {
25028
25052
  calcEndDate = previousStartDate;
25029
- this.calculateDateByRoundOffDuration(childRecords[i], calcEndDate);
25053
+ var initialData = this.parent.initialLoadData[childRecords[i].index];
25054
+ if (this.parent.isLoad) {
25055
+ this.calculateDateByRoundOffDuration(initialData, calcEndDate);
25056
+ }
25057
+ else {
25058
+ this.calculateDateByRoundOffDuration(childRecords[i], calcEndDate);
25059
+ }
25030
25060
  if (this.parent.isOnEdit && this.validatedChildItems.indexOf(childRecords[i]) === -1) {
25031
25061
  this.validatedChildItems.push(childRecords[i]);
25032
25062
  }
@@ -29491,12 +29521,14 @@ var NonWorkingDay = /** @__PURE__ @class */ (function () {
29491
29521
  };
29492
29522
  NonWorkingDay.prototype.updateHolidayLabelHeight = function () {
29493
29523
  var height = this.parent.getContentHeight();
29524
+ var gantttable = document.getElementById("ganttContainer");
29494
29525
  // eslint-disable-next-line
29495
29526
  var toolbarHeight = 0;
29496
29527
  if (!isNullOrUndefined(this.parent.toolbarModule) && !isNullOrUndefined(this.parent.toolbarModule.element)) {
29497
29528
  toolbarHeight = this.parent.toolbarModule.element.offsetHeight;
29498
29529
  }
29499
- var viewportHeight = this.parent.ganttHeight - toolbarHeight - this.parent.ganttChartModule.chartTimelineContainer.offsetHeight;
29530
+ var viewportHeight = (this.parent.height === 'auto') ? gantttable.offsetHeight - toolbarHeight - this.parent.ganttChartModule.chartTimelineContainer.offsetHeight :
29531
+ this.parent.ganttHeight - toolbarHeight - this.parent.ganttChartModule.chartTimelineContainer.offsetHeight;
29500
29532
  var top = (viewportHeight < height) ? viewportHeight / 2 : height / 2;
29501
29533
  var labels = this.holidayContainer.querySelectorAll('.' + holidayLabel);
29502
29534
  for (var i = 0; i < labels.length; i++) {
@@ -30799,7 +30831,7 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
30799
30831
  splitTaskDuration = Math.ceil(currentTaskDifference / this.parent.timelineSettings.timelineUnitSize);
30800
30832
  splitTaskDuration -= 1;
30801
30833
  }
30802
- var contextMenuClickDate = this.parent.dataOperation.getEndDate(startDate, splitTaskDuration, this.rowData.ganttProperties.durationUnit, this.rowData, false);
30834
+ var contextMenuClickDate = this.parent.dataOperation.getEndDate(startDate, splitTaskDuration, (this.parent.timelineSettings.bottomTier.unit !== "None") ? this.parent.timelineSettings.bottomTier.unit.toLocaleLowerCase() : this.parent.timelineSettings.topTier.unit.toLocaleLowerCase(), this.rowData, false);
30803
30835
  return contextMenuClickDate;
30804
30836
  };
30805
30837
  ContextMenu$$1.prototype.contextMenuBeforeOpen = function (args) {