@syncfusion/ej2-gantt 21.1.37 → 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 (66) hide show
  1. package/CHANGELOG.md +27 -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 +84 -39
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +84 -39
  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/column-menu.d.ts +1 -0
  14. package/src/gantt/actions/column-menu.js +1 -0
  15. package/src/gantt/actions/context-menu.js +1 -1
  16. package/src/gantt/actions/critical-path.d.ts +1 -0
  17. package/src/gantt/actions/critical-path.js +1 -0
  18. package/src/gantt/actions/dependency.js +1 -1
  19. package/src/gantt/actions/dialog-edit.js +1 -0
  20. package/src/gantt/actions/edit.js +7 -1
  21. package/src/gantt/actions/keyboard.js +1 -0
  22. package/src/gantt/base/date-processor.js +2 -2
  23. package/src/gantt/base/gantt-model.d.ts +6 -0
  24. package/src/gantt/base/gantt.d.ts +2 -0
  25. package/src/gantt/base/gantt.js +17 -3
  26. package/src/gantt/base/task-processor.d.ts +1 -1
  27. package/src/gantt/base/task-processor.js +39 -21
  28. package/src/gantt/export/pdf-base/pdf-borders.d.ts +2 -0
  29. package/src/gantt/export/pdf-base/pdf-borders.js +2 -0
  30. package/src/gantt/export/pdf-base/pdf-grid-table.d.ts +1 -3
  31. package/src/gantt/export/pdf-base/pdf-grid-table.js +1 -3
  32. package/src/gantt/models/column.d.ts +4 -4
  33. package/src/gantt/renderer/chart-rows.js +3 -5
  34. package/src/gantt/renderer/nonworking-day.js +3 -1
  35. package/src/gantt/renderer/timeline.js +4 -1
  36. package/styles/bootstrap-dark.css +1 -0
  37. package/styles/bootstrap.css +1 -0
  38. package/styles/bootstrap4.css +1 -0
  39. package/styles/bootstrap5-dark.css +1 -0
  40. package/styles/bootstrap5.css +1 -0
  41. package/styles/fabric-dark.css +1 -0
  42. package/styles/fabric.css +1 -0
  43. package/styles/fluent-dark.css +0 -3
  44. package/styles/fluent.css +0 -3
  45. package/styles/gantt/_layout.scss +0 -8
  46. package/styles/gantt/bootstrap-dark.css +1 -0
  47. package/styles/gantt/bootstrap.css +1 -0
  48. package/styles/gantt/bootstrap4.css +1 -0
  49. package/styles/gantt/bootstrap5-dark.css +1 -0
  50. package/styles/gantt/bootstrap5.css +1 -0
  51. package/styles/gantt/fabric-dark.css +1 -0
  52. package/styles/gantt/fabric.css +1 -0
  53. package/styles/gantt/fluent-dark.css +0 -3
  54. package/styles/gantt/fluent.css +0 -3
  55. package/styles/gantt/highcontrast-light.css +1 -0
  56. package/styles/gantt/highcontrast.css +1 -0
  57. package/styles/gantt/material-dark.css +1 -0
  58. package/styles/gantt/material.css +1 -0
  59. package/styles/gantt/tailwind-dark.css +1 -0
  60. package/styles/gantt/tailwind.css +1 -0
  61. package/styles/highcontrast-light.css +1 -0
  62. package/styles/highcontrast.css +1 -0
  63. package/styles/material-dark.css +1 -0
  64. package/styles/material.css +1 -0
  65. package/styles/tailwind-dark.css +1 -0
  66. 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
  /**
@@ -2982,17 +3007,15 @@ class TaskProcessor extends DateProcessor {
2982
3007
  else {
2983
3008
  hierarchicalData = this.parent.dataSource;
2984
3009
  }
2985
- this.parent.flatData.map((data) => {
2986
- hierarchicalData.map((record) => {
2987
- if (data.ganttProperties.taskId === record[this.parent.taskFields.id]) {
2988
- if (!isNullOrUndefined(this.parent.taskFields.startDate)) {
2989
- task[this.parent.taskFields.endDate] = record[this.parent.taskFields.endDate];
2990
- }
2991
- if (!isNullOrUndefined(this.parent.taskFields.endDate)) {
2992
- task[this.parent.taskFields.endDate] = record[this.parent.taskFields.endDate];
2993
- }
3010
+ hierarchicalData.map((record) => {
3011
+ if (task.ganttProperties.taskId === record[this.parent.taskFields.id]) {
3012
+ if (!isNullOrUndefined(this.parent.taskFields.startDate)) {
3013
+ task[this.parent.taskFields.startDate] = record[this.parent.taskFields.startDate];
2994
3014
  }
2995
- });
3015
+ if (!isNullOrUndefined(this.parent.taskFields.endDate)) {
3016
+ task[this.parent.taskFields.endDate] = record[this.parent.taskFields.endDate];
3017
+ }
3018
+ }
2996
3019
  });
2997
3020
  }
2998
3021
  getWorkInHour(work, workUnit) {
@@ -3743,12 +3766,7 @@ class TaskProcessor extends DateProcessor {
3743
3766
  durationInDay = (childGanttRecord.ganttProperties.duration / (this.parent.secondsPerDay / 60));
3744
3767
  break;
3745
3768
  default:
3746
- if (childGanttRecord.ganttProperties.duration < 1) {
3747
- durationInDay = (childGanttRecord.ganttProperties.duration / (this.parent.secondsPerDay / 3600));
3748
- }
3749
- else {
3750
- durationInDay = childGanttRecord.ganttProperties.duration;
3751
- }
3769
+ durationInDay = childGanttRecord.ganttProperties.duration;
3752
3770
  }
3753
3771
  if (childGanttRecord.hasChildRecords) {
3754
3772
  setValue('totalProgress', childGanttRecord.ganttProperties.totalProgress, progressValues);
@@ -3847,7 +3865,7 @@ class TaskProcessor extends DateProcessor {
3847
3865
  else {
3848
3866
  taskCount = childLength - milestoneCount;
3849
3867
  }
3850
- const parentProgress = (taskCount > 0 && totalDuration > 0) ? (totalProgress / totalDuration) : 0;
3868
+ const parentProgress = (taskCount > 0 && totalDuration > 0) ? Number((totalProgress / totalDuration).toFixed(2)) : 0;
3851
3869
  const parentProp = parentData.ganttProperties;
3852
3870
  const milestone = (taskCount === 0) && minStartDate && maxEndDate &&
3853
3871
  minStartDate.getTime() === maxEndDate.getTime() ? true : false;
@@ -5793,7 +5811,10 @@ class Timeline {
5793
5811
  * @private
5794
5812
  */
5795
5813
  changeTimelineSettings(newTimeline) {
5796
- if (!this.isZoomIn) {
5814
+ if (this.isZoomToFit) {
5815
+ this.isSingleTier = this.customTimelineSettings.topTier.unit === 'None' || this.customTimelineSettings.bottomTier.unit === 'None' ? true : false;
5816
+ }
5817
+ else if (!this.isZoomIn) {
5797
5818
  this.isSingleTier = newTimeline.topTier.unit === 'None' || newTimeline.bottomTier.unit === 'None' ? true : false;
5798
5819
  }
5799
5820
  const skipProperty = this.isSingleTier ?
@@ -9938,7 +9959,6 @@ class ChartRows extends DateProcessor {
9938
9959
  }
9939
9960
  if (this.templateData.hasChildRecords) {
9940
9961
  const parentTaskbarTemplateNode = this.getParentTaskbarNode(i, taskbarContainerNode);
9941
- const milestoneTemplateNode = this.getMilestoneNode(i, taskbarContainerNode);
9942
9962
  if (!this.templateData.ganttProperties.isAutoSchedule) {
9943
9963
  const manualTaskbar = this.getManualTaskbar();
9944
9964
  if (!isNullOrUndefined(manualTaskbar[0])) {
@@ -9953,9 +9973,6 @@ class ChartRows extends DateProcessor {
9953
9973
  if (parentTaskbarTemplateNode && parentTaskbarTemplateNode.length > 0) {
9954
9974
  taskbarContainerNode[0].appendChild([].slice.call(parentTaskbarTemplateNode)[0]);
9955
9975
  }
9956
- else if (milestoneTemplateNode && milestoneTemplateNode.length > 0) {
9957
- taskbarContainerNode[0].appendChild([].slice.call(milestoneTemplateNode)[0]);
9958
- }
9959
9976
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
9960
9977
  this.templateData.ganttProperties.baselineEndDate) {
9961
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()))
@@ -10464,7 +10481,9 @@ class ChartRows extends DateProcessor {
10464
10481
  this.parent.ganttChartModule.tempNextElement = null;
10465
10482
  }
10466
10483
  const row = this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[index].getAttribute('data-uid'));
10467
- row.data = data;
10484
+ if (!isNullOrUndefined(row)) {
10485
+ row.data = data;
10486
+ }
10468
10487
  }
10469
10488
  }
10470
10489
  getResourceParent(record) {
@@ -11100,7 +11119,7 @@ class Dependency {
11100
11119
  this.dateValidateModule.calculateEndDate(childGanttRecord);
11101
11120
  }
11102
11121
  this.parent.dataOperation.updateWidthLeft(childGanttRecord);
11103
- if (!this.parent.isLoad && childGanttRecord.parentItem && this.parent.isInPredecessorValidation &&
11122
+ if (!this.parent.isLoad && !this.parent.isFromOnPropertyChange && childGanttRecord.parentItem && this.parent.isInPredecessorValidation &&
11104
11123
  this.parent.getParentTask(childGanttRecord.parentItem).ganttProperties.isAutoSchedule) {
11105
11124
  if (this.parentIds.indexOf(childGanttRecord.parentItem.uniqueID) === -1) {
11106
11125
  this.parentIds.push(childGanttRecord.parentItem.uniqueID);
@@ -13216,6 +13235,7 @@ class FocusModule {
13216
13235
  if (ganttObj.selectedRowIndex === ganttObj.flatData.indexOf(currentSelectingRecord)) {
13217
13236
  return;
13218
13237
  }
13238
+ ganttObj.selectionModule.selectRow(ganttObj.flatData.indexOf(currentSelectingRecord), false, true);
13219
13239
  }
13220
13240
  break;
13221
13241
  case 'downArrow':
@@ -13633,7 +13653,9 @@ let Gantt = class Gantt extends Component {
13633
13653
  contextMenu: 'shift+F10' //F Key
13634
13654
  };
13635
13655
  this.focusModule = new FocusModule(this);
13636
- this.zoomingLevels = this.getZoomingLevels();
13656
+ if (this.zoomingLevels.length === 0) {
13657
+ this.zoomingLevels = this.getZoomingLevels();
13658
+ }
13637
13659
  this.resourceFieldsMapping();
13638
13660
  if (isNullOrUndefined(this.resourceFields.unit)) { //set resourceUnit as unit if not mapping
13639
13661
  this.resourceFields.unit = 'unit';
@@ -14139,6 +14161,9 @@ let Gantt = class Gantt extends Component {
14139
14161
  * @private
14140
14162
  */
14141
14163
  renderGantt(isChange) {
14164
+ if (isChange) {
14165
+ this.isFromOnPropertyChange = isChange;
14166
+ }
14142
14167
  // predecessor calculation
14143
14168
  if (this.predecessorModule && this.taskFields.dependency) {
14144
14169
  this.predecessorModule['parentIds'] = [];
@@ -14153,7 +14178,6 @@ let Gantt = class Gantt extends Component {
14153
14178
  this.timelineModule.validateTimelineProp();
14154
14179
  }
14155
14180
  if (isChange) {
14156
- this.isFromOnPropertyChange = isChange;
14157
14181
  if (this.enableValidation) {
14158
14182
  this.dataOperation.updateGanttData();
14159
14183
  }
@@ -14837,6 +14861,14 @@ let Gantt = class Gantt extends Component {
14837
14861
  this.chartRowsModule.refreshGanttRows();
14838
14862
  this.isLoad = false;
14839
14863
  break;
14864
+ case 'dayWorkingTime':
14865
+ this.isLoad = true;
14866
+ this.dataOperation.reUpdateGanttData();
14867
+ this.treeGrid.refreshColumns();
14868
+ this.chartRowsModule.initiateTemplates();
14869
+ this.chartRowsModule.refreshGanttRows();
14870
+ this.isLoad = false;
14871
+ break;
14840
14872
  case 'addDialogFields':
14841
14873
  case 'editDialogFields':
14842
14874
  if (this.editModule && this.editModule.dialogModule) {
@@ -14916,7 +14948,6 @@ let Gantt = class Gantt extends Component {
14916
14948
  case 'readOnly':
14917
14949
  case 'viewType':
14918
14950
  case 'taskFields':
14919
- case 'dayWorkingTime':
14920
14951
  case 'allowTaskbarDragAndDrop':
14921
14952
  case 'allowTaskbarOverlap':
14922
14953
  case 'allowParentDependency':
@@ -16903,6 +16934,9 @@ __decorate([
16903
16934
  __decorate([
16904
16935
  Complex({}, TimelineSettings)
16905
16936
  ], Gantt.prototype, "timelineSettings", void 0);
16937
+ __decorate([
16938
+ Property([])
16939
+ ], Gantt.prototype, "zoomingLevels", void 0);
16906
16940
  __decorate([
16907
16941
  Complex({}, SortSettings)
16908
16942
  ], Gantt.prototype, "sortSettings", void 0);
@@ -21905,6 +21939,7 @@ class DialogEdit {
21905
21939
  renderNotesTab(itemName) {
21906
21940
  const ganttObj = this.parent;
21907
21941
  const inputModel = this.beforeOpenArgs[itemName];
21942
+ inputModel.enableHtmlSanitizer = this.parent.enableHtmlSanitizer;
21908
21943
  const ganttProp = this.editedRecord.ganttProperties;
21909
21944
  const divElement = this.createDivElement('', ganttObj.element.id + '' + itemName + 'TabContainer');
21910
21945
  RichTextEditor.Inject(Toolbar$2, Link, HtmlEditor, QuickToolbar, Count);
@@ -24493,7 +24528,13 @@ class Edit$2 {
24493
24528
  }
24494
24529
  else if (isNullOrUndefined(previousData)) {
24495
24530
  calcEndDate = previousStartDate;
24496
- 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
+ }
24497
24538
  if (this.parent.isOnEdit && this.validatedChildItems.indexOf(childRecords[i]) === -1) {
24498
24539
  this.validatedChildItems.push(childRecords[i]);
24499
24540
  }
@@ -28918,12 +28959,14 @@ class NonWorkingDay {
28918
28959
  }
28919
28960
  updateHolidayLabelHeight() {
28920
28961
  const height = this.parent.getContentHeight();
28962
+ let gantttable = document.getElementById("ganttContainer");
28921
28963
  // eslint-disable-next-line
28922
28964
  let toolbarHeight = 0;
28923
28965
  if (!isNullOrUndefined(this.parent.toolbarModule) && !isNullOrUndefined(this.parent.toolbarModule.element)) {
28924
28966
  toolbarHeight = this.parent.toolbarModule.element.offsetHeight;
28925
28967
  }
28926
- 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;
28927
28970
  const top = (viewportHeight < height) ? viewportHeight / 2 : height / 2;
28928
28971
  const labels = this.holidayContainer.querySelectorAll('.' + holidayLabel);
28929
28972
  for (let i = 0; i < labels.length; i++) {
@@ -29136,6 +29179,7 @@ class DayMarkers {
29136
29179
  }
29137
29180
  }
29138
29181
 
29182
+ /** @hidden */
29139
29183
  class CriticalPath {
29140
29184
  constructor(parent) {
29141
29185
  this.resourceCollectionIds = [];
@@ -30210,7 +30254,7 @@ class ContextMenu$2 {
30210
30254
  splitTaskDuration = Math.ceil(currentTaskDifference / this.parent.timelineSettings.timelineUnitSize);
30211
30255
  splitTaskDuration -= 1;
30212
30256
  }
30213
- 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);
30214
30258
  return contextMenuClickDate;
30215
30259
  }
30216
30260
  contextMenuBeforeOpen(args) {
@@ -30740,6 +30784,7 @@ class ExcelExport$1 {
30740
30784
 
30741
30785
  /**
30742
30786
  * Configures columnMenu collection in Gantt.
30787
+ * @hidden
30743
30788
  */
30744
30789
  class ColumnMenu$1 {
30745
30790
  constructor(parent) {
@@ -31985,6 +32030,7 @@ class TemporaryDictionary {
31985
32030
  */
31986
32031
  /**
31987
32032
  * `PdfBorders` class used represents the cell border of the PDF grid.
32033
+ * @hidden
31988
32034
  */
31989
32035
  class PdfBorders {
31990
32036
  // Properties
@@ -32084,6 +32130,7 @@ class PdfBorders {
32084
32130
  this.bottomPen = defaultBorderPenBottom;
32085
32131
  }
32086
32132
  }
32133
+ /** @hidden */
32087
32134
  class PdfPaddings {
32088
32135
  constructor(left, right, top, bottom) {
32089
32136
  /**
@@ -32954,9 +33001,7 @@ class PdfTreeGrid extends PdfLayoutElement {
32954
33001
  }
32955
33002
  }
32956
33003
 
32957
- /**
32958
- *
32959
- */
33004
+ /**@hidden*/
32960
33005
  class PdfTreeGridCell {
32961
33006
  constructor(row) {
32962
33007
  this.cellWidth = 0;