@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
@@ -602,10 +602,10 @@ class DateProcessor {
602
602
  */
603
603
  getDurationAsSeconds(duration, durationUnit) {
604
604
  let value = 0;
605
- if (!durationUnit || durationUnit === 'day') {
605
+ if (!durationUnit || durationUnit.toLocaleLowerCase() === 'day') {
606
606
  value = this.parent.secondsPerDay * duration;
607
607
  }
608
- else if (durationUnit === 'hour') {
608
+ else if (durationUnit.toLocaleLowerCase() === 'hour') {
609
609
  value = duration * 3600;
610
610
  }
611
611
  else {
@@ -1753,6 +1753,7 @@ class TaskProcessor extends DateProcessor {
1753
1753
  */
1754
1754
  prepareDataSource(data) {
1755
1755
  this.prepareRecordCollection(data, 0);
1756
+ this.parent.initialLoadData = extend({}, {}, this.parent.flatData, true);
1756
1757
  // Method to maintain the shared task uniqueIds
1757
1758
  if (this.parent.viewType === 'ResourceView') {
1758
1759
  this.calculateSharedTaskUniqueIds();
@@ -2570,7 +2571,7 @@ class TaskProcessor extends DateProcessor {
2570
2571
  return 0;
2571
2572
  }
2572
2573
  else {
2573
- return this.getTaskWidth(sDate, eDate);
2574
+ return this.getTaskWidth(sDate, eDate, ganttProp);
2574
2575
  }
2575
2576
  }
2576
2577
  getTaskbarHeight() {
@@ -2684,13 +2685,29 @@ class TaskProcessor extends DateProcessor {
2684
2685
  * @returns {number} .
2685
2686
  * @private
2686
2687
  */
2687
- getTaskWidth(startDate, endDate) {
2688
+ getTaskWidth(startDate, endDate, ganttData) {
2688
2689
  const sDate = new Date(startDate.getTime());
2689
2690
  const eDate = new Date(endDate.getTime());
2690
2691
  const tierMode = this.parent.timelineModule.bottomTier !== 'None' ? this.parent.timelineModule.bottomTier :
2691
2692
  this.parent.timelineModule.topTier;
2693
+ let isValid = false;
2694
+ let modifiedsDate = new Date(startDate.getTime());
2695
+ let hour = 0;
2696
+ if (ganttData && ganttData.durationUnit == 'hour') {
2697
+ modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 60 * 1000);
2698
+ }
2699
+ if (ganttData && ganttData.durationUnit == 'minute') {
2700
+ modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 60 * 60 * 1000);
2701
+ }
2702
+ for (let i = 0; i < this.parent.dayWorkingTime.length; i++) {
2703
+ hour = hour + this.parent.dayWorkingTime[i].to - this.parent.dayWorkingTime[i].from;
2704
+ }
2705
+ let dateDiff = modifiedsDate.getTime() - sDate.getTime();
2692
2706
  if (tierMode === 'Day') {
2693
- if (this.getSecondsInDecimal(sDate) === this.parent.defaultStartTime) {
2707
+ if ((Math.floor((dateDiff / (1000 * 60 * 60)) % 24) >= hour || dateDiff === 0)) {
2708
+ isValid = true;
2709
+ }
2710
+ if (this.getSecondsInDecimal(sDate) === this.parent.defaultStartTime && isValid) {
2694
2711
  sDate.setHours(0, 0, 0, 0);
2695
2712
  }
2696
2713
  if (this.getSecondsInDecimal(eDate) === this.parent.defaultEndTime) {
@@ -2700,11 +2717,19 @@ class TaskProcessor extends DateProcessor {
2700
2717
  eDate.setHours(0, 0, 0, 0);
2701
2718
  }
2702
2719
  }
2720
+ else {
2721
+ isValid = true;
2722
+ }
2703
2723
  if ((sDate).getTime() === (eDate).getTime()) {
2704
2724
  return (this.parent.perDayWidth);
2705
2725
  }
2706
2726
  else {
2707
- return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2727
+ if (isValid) {
2728
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2729
+ }
2730
+ else {
2731
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * hour)) * this.parent.perDayWidth);
2732
+ }
2708
2733
  }
2709
2734
  }
2710
2735
  /**
@@ -9934,7 +9959,6 @@ class ChartRows extends DateProcessor {
9934
9959
  }
9935
9960
  if (this.templateData.hasChildRecords) {
9936
9961
  const parentTaskbarTemplateNode = this.getParentTaskbarNode(i, taskbarContainerNode);
9937
- const milestoneTemplateNode = this.getMilestoneNode(i, taskbarContainerNode);
9938
9962
  if (!this.templateData.ganttProperties.isAutoSchedule) {
9939
9963
  const manualTaskbar = this.getManualTaskbar();
9940
9964
  if (!isNullOrUndefined(manualTaskbar[0])) {
@@ -9949,9 +9973,6 @@ class ChartRows extends DateProcessor {
9949
9973
  if (parentTaskbarTemplateNode && parentTaskbarTemplateNode.length > 0) {
9950
9974
  taskbarContainerNode[0].appendChild([].slice.call(parentTaskbarTemplateNode)[0]);
9951
9975
  }
9952
- else if (milestoneTemplateNode && milestoneTemplateNode.length > 0) {
9953
- taskbarContainerNode[0].appendChild([].slice.call(milestoneTemplateNode)[0]);
9954
- }
9955
9976
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
9956
9977
  this.templateData.ganttProperties.baselineEndDate) {
9957
9978
  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()))
@@ -11098,7 +11119,7 @@ class Dependency {
11098
11119
  this.dateValidateModule.calculateEndDate(childGanttRecord);
11099
11120
  }
11100
11121
  this.parent.dataOperation.updateWidthLeft(childGanttRecord);
11101
- if (!this.parent.isLoad && childGanttRecord.parentItem && this.parent.isInPredecessorValidation &&
11122
+ if (!this.parent.isLoad && !this.parent.isFromOnPropertyChange && childGanttRecord.parentItem && this.parent.isInPredecessorValidation &&
11102
11123
  this.parent.getParentTask(childGanttRecord.parentItem).ganttProperties.isAutoSchedule) {
11103
11124
  if (this.parentIds.indexOf(childGanttRecord.parentItem.uniqueID) === -1) {
11104
11125
  this.parentIds.push(childGanttRecord.parentItem.uniqueID);
@@ -14140,6 +14161,9 @@ let Gantt = class Gantt extends Component {
14140
14161
  * @private
14141
14162
  */
14142
14163
  renderGantt(isChange) {
14164
+ if (isChange) {
14165
+ this.isFromOnPropertyChange = isChange;
14166
+ }
14143
14167
  // predecessor calculation
14144
14168
  if (this.predecessorModule && this.taskFields.dependency) {
14145
14169
  this.predecessorModule['parentIds'] = [];
@@ -14154,7 +14178,6 @@ let Gantt = class Gantt extends Component {
14154
14178
  this.timelineModule.validateTimelineProp();
14155
14179
  }
14156
14180
  if (isChange) {
14157
- this.isFromOnPropertyChange = isChange;
14158
14181
  if (this.enableValidation) {
14159
14182
  this.dataOperation.updateGanttData();
14160
14183
  }
@@ -21916,6 +21939,7 @@ class DialogEdit {
21916
21939
  renderNotesTab(itemName) {
21917
21940
  const ganttObj = this.parent;
21918
21941
  const inputModel = this.beforeOpenArgs[itemName];
21942
+ inputModel.enableHtmlSanitizer = this.parent.enableHtmlSanitizer;
21919
21943
  const ganttProp = this.editedRecord.ganttProperties;
21920
21944
  const divElement = this.createDivElement('', ganttObj.element.id + '' + itemName + 'TabContainer');
21921
21945
  RichTextEditor.Inject(Toolbar$2, Link, HtmlEditor, QuickToolbar, Count);
@@ -24504,7 +24528,13 @@ class Edit$2 {
24504
24528
  }
24505
24529
  else if (isNullOrUndefined(previousData)) {
24506
24530
  calcEndDate = previousStartDate;
24507
- this.calculateDateByRoundOffDuration(childRecords[i], calcEndDate);
24531
+ const initialData = this.parent.initialLoadData[childRecords[i].index];
24532
+ if (this.parent.isLoad) {
24533
+ this.calculateDateByRoundOffDuration(initialData, calcEndDate);
24534
+ }
24535
+ else {
24536
+ this.calculateDateByRoundOffDuration(childRecords[i], calcEndDate);
24537
+ }
24508
24538
  if (this.parent.isOnEdit && this.validatedChildItems.indexOf(childRecords[i]) === -1) {
24509
24539
  this.validatedChildItems.push(childRecords[i]);
24510
24540
  }
@@ -28929,12 +28959,14 @@ class NonWorkingDay {
28929
28959
  }
28930
28960
  updateHolidayLabelHeight() {
28931
28961
  const height = this.parent.getContentHeight();
28962
+ let gantttable = document.getElementById("ganttContainer");
28932
28963
  // eslint-disable-next-line
28933
28964
  let toolbarHeight = 0;
28934
28965
  if (!isNullOrUndefined(this.parent.toolbarModule) && !isNullOrUndefined(this.parent.toolbarModule.element)) {
28935
28966
  toolbarHeight = this.parent.toolbarModule.element.offsetHeight;
28936
28967
  }
28937
- const viewportHeight = this.parent.ganttHeight - toolbarHeight - this.parent.ganttChartModule.chartTimelineContainer.offsetHeight;
28968
+ const viewportHeight = (this.parent.height === 'auto') ? gantttable.offsetHeight - toolbarHeight - this.parent.ganttChartModule.chartTimelineContainer.offsetHeight :
28969
+ this.parent.ganttHeight - toolbarHeight - this.parent.ganttChartModule.chartTimelineContainer.offsetHeight;
28938
28970
  const top = (viewportHeight < height) ? viewportHeight / 2 : height / 2;
28939
28971
  const labels = this.holidayContainer.querySelectorAll('.' + holidayLabel);
28940
28972
  for (let i = 0; i < labels.length; i++) {
@@ -30222,7 +30254,7 @@ class ContextMenu$2 {
30222
30254
  splitTaskDuration = Math.ceil(currentTaskDifference / this.parent.timelineSettings.timelineUnitSize);
30223
30255
  splitTaskDuration -= 1;
30224
30256
  }
30225
- const contextMenuClickDate = this.parent.dataOperation.getEndDate(startDate, splitTaskDuration, this.rowData.ganttProperties.durationUnit, this.rowData, false);
30257
+ const 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);
30226
30258
  return contextMenuClickDate;
30227
30259
  }
30228
30260
  contextMenuBeforeOpen(args) {