@syncfusion/ej2-gantt 22.2.12 → 23.1.36

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 (124) hide show
  1. package/CHANGELOG.md +180 -164
  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 +846 -242
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +884 -264
  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 +21 -21
  13. package/src/gantt/actions/cell-edit.js +4 -1
  14. package/src/gantt/actions/critical-path.d.ts +2 -0
  15. package/src/gantt/actions/critical-path.js +79 -59
  16. package/src/gantt/actions/dependency.d.ts +1 -0
  17. package/src/gantt/actions/dependency.js +43 -25
  18. package/src/gantt/actions/dialog-edit.js +27 -7
  19. package/src/gantt/actions/edit.js +15 -8
  20. package/src/gantt/actions/pdf-export.d.ts +4 -1
  21. package/src/gantt/actions/pdf-export.js +36 -3
  22. package/src/gantt/actions/rowdragdrop.js +10 -2
  23. package/src/gantt/actions/selection.js +22 -5
  24. package/src/gantt/actions/taskbar-edit.js +51 -36
  25. package/src/gantt/actions/toolbar.js +8 -0
  26. package/src/gantt/base/date-processor.js +1 -1
  27. package/src/gantt/base/gantt-chart.d.ts +1 -0
  28. package/src/gantt/base/gantt-chart.js +79 -6
  29. package/src/gantt/base/gantt-model.d.ts +7 -0
  30. package/src/gantt/base/gantt.d.ts +6 -0
  31. package/src/gantt/base/gantt.js +73 -11
  32. package/src/gantt/base/interface.d.ts +14 -0
  33. package/src/gantt/base/task-processor.d.ts +4 -4
  34. package/src/gantt/base/task-processor.js +75 -25
  35. package/src/gantt/base/tree-grid.js +19 -10
  36. package/src/gantt/export/export-helper.d.ts +5 -1
  37. package/src/gantt/export/export-helper.js +150 -3
  38. package/src/gantt/export/pdf-base/pdf-grid-table.js +2 -2
  39. package/src/gantt/export/pdf-base/pdf-style/gantt-theme.js +8 -0
  40. package/src/gantt/export/pdf-base/treegrid-layouter.js +3 -1
  41. package/src/gantt/export/pdf-connector-line.js +3 -1
  42. package/src/gantt/export/pdf-gantt.js +6 -0
  43. package/src/gantt/export/pdf-taskbar.d.ts +13 -0
  44. package/src/gantt/export/pdf-taskbar.js +39 -5
  45. package/src/gantt/export/pdf-timeline.js +17 -8
  46. package/src/gantt/export/pdf-treegrid.js +3 -3
  47. package/src/gantt/models/task-fields-model.d.ts +7 -0
  48. package/src/gantt/models/task-fields.d.ts +6 -0
  49. package/src/gantt/models/task-fields.js +3 -0
  50. package/src/gantt/renderer/chart-rows.d.ts +1 -1
  51. package/src/gantt/renderer/chart-rows.js +39 -20
  52. package/src/gantt/renderer/connector-line.js +49 -9
  53. package/src/gantt/renderer/edit-tooltip.js +2 -1
  54. package/src/gantt/renderer/timeline.js +16 -9
  55. package/src/gantt/renderer/tooltip.js +5 -5
  56. package/styles/bootstrap-dark.css +44 -100
  57. package/styles/bootstrap.css +44 -100
  58. package/styles/bootstrap4.css +44 -100
  59. package/styles/bootstrap5-dark.css +44 -100
  60. package/styles/bootstrap5.css +44 -100
  61. package/styles/fabric-dark.css +44 -100
  62. package/styles/fabric.css +44 -100
  63. package/styles/fluent-dark.css +44 -100
  64. package/styles/fluent.css +44 -100
  65. package/styles/gantt/_layout.scss +44 -31
  66. package/styles/gantt/_theme.scss +104 -98
  67. package/styles/gantt/bootstrap-dark.css +44 -100
  68. package/styles/gantt/bootstrap-dark.scss +1 -1
  69. package/styles/gantt/bootstrap.css +44 -100
  70. package/styles/gantt/bootstrap.scss +1 -1
  71. package/styles/gantt/bootstrap4.css +44 -100
  72. package/styles/gantt/bootstrap4.scss +1 -1
  73. package/styles/gantt/bootstrap5-dark.css +44 -100
  74. package/styles/gantt/bootstrap5-dark.scss +1 -1
  75. package/styles/gantt/bootstrap5.css +44 -100
  76. package/styles/gantt/bootstrap5.scss +1 -1
  77. package/styles/gantt/fabric-dark.css +44 -100
  78. package/styles/gantt/fabric-dark.scss +1 -1
  79. package/styles/gantt/fabric.css +44 -100
  80. package/styles/gantt/fabric.scss +1 -1
  81. package/styles/gantt/fluent-dark.css +44 -100
  82. package/styles/gantt/fluent-dark.scss +1 -1
  83. package/styles/gantt/fluent.css +44 -100
  84. package/styles/gantt/fluent.scss +1 -1
  85. package/styles/gantt/highcontrast-light.css +40 -100
  86. package/styles/gantt/highcontrast-light.scss +1 -1
  87. package/styles/gantt/highcontrast.css +44 -100
  88. package/styles/gantt/highcontrast.scss +1 -1
  89. package/styles/gantt/icons/_bootstrap-dark.scss +4 -0
  90. package/styles/gantt/icons/_bootstrap.scss +4 -0
  91. package/styles/gantt/icons/_bootstrap4.scss +4 -0
  92. package/styles/gantt/icons/_bootstrap5.scss +4 -0
  93. package/styles/gantt/icons/_fabric-dark.scss +4 -0
  94. package/styles/gantt/icons/_fabric.scss +4 -0
  95. package/styles/gantt/icons/_fluent.scss +4 -0
  96. package/styles/gantt/icons/_fusionnew.scss +4 -0
  97. package/styles/gantt/icons/_highcontrast.scss +4 -0
  98. package/styles/gantt/icons/_material-dark.scss +4 -0
  99. package/styles/gantt/icons/_material.scss +4 -0
  100. package/styles/gantt/icons/_material3.scss +4 -0
  101. package/styles/gantt/icons/_tailwind-dark.scss +4 -0
  102. package/styles/gantt/icons/_tailwind.scss +4 -0
  103. package/styles/gantt/material-dark.css +44 -101
  104. package/styles/gantt/material-dark.scss +1 -1
  105. package/styles/gantt/material.css +44 -101
  106. package/styles/gantt/material.scss +1 -1
  107. package/styles/gantt/material3-dark.css +45 -102
  108. package/styles/gantt/material3-dark.scss +1 -1
  109. package/styles/gantt/material3.css +45 -102
  110. package/styles/gantt/material3.scss +1 -1
  111. package/styles/gantt/tailwind-dark.css +44 -101
  112. package/styles/gantt/tailwind-dark.scss +1 -1
  113. package/styles/gantt/tailwind.css +44 -101
  114. package/styles/gantt/tailwind.scss +1 -1
  115. package/styles/highcontrast-light.css +40 -100
  116. package/styles/highcontrast.css +44 -100
  117. package/styles/material-dark.css +44 -101
  118. package/styles/material.css +44 -101
  119. package/styles/material3-dark.css +45 -102
  120. package/styles/material3-dark.scss +1 -1
  121. package/styles/material3.css +45 -102
  122. package/styles/material3.scss +1 -1
  123. package/styles/tailwind-dark.css +44 -101
  124. package/styles/tailwind.css +44 -101
@@ -344,6 +344,7 @@ var Gantt = /** @class */ (function (_super) {
344
344
  createSpinner({ target: this.element }, this.createElement);
345
345
  this.trigger('load', {});
346
346
  this.element.classList.add(cls.root);
347
+ this.rowHeight = (!isNullOrUndefined(document.body.className) && document.body.className.includes("e-bigger")) ? (this.rowHeight === 36) ? 46 : this.rowHeight : this.rowHeight;
347
348
  if (this.isAdaptive) {
348
349
  this.element.classList.add(cls.adaptive);
349
350
  }
@@ -886,7 +887,39 @@ var Gantt = /** @class */ (function (_super) {
886
887
  this.treeGridModule.renderTreeGrid();
887
888
  };
888
889
  Gantt.prototype.updateCurrentViewData = function () {
890
+ var _this = this;
889
891
  this.currentViewData = this.treeGrid.getCurrentViewRecords().slice();
892
+ if (!this.loadChildOnDemand && this.taskFields.hasChildMapping && this.currentViewData.length > 0) {
893
+ this.autoCalculateDateScheduling = false;
894
+ this.flatData = [];
895
+ this.dataOperation.taskIds = [];
896
+ this.ids = [];
897
+ this.dataOperation.recordIndex = 0;
898
+ this.dataOperation.dataArray = this.currentViewData;
899
+ this.dataOperation.cloneDataSource();
900
+ if (this.predecessorModule && this.taskFields.dependency) {
901
+ this.predecessorModule['parentIds'] = [];
902
+ this.predecessorModule['parentRecord'] = [];
903
+ this.predecessorModule.updatePredecessors();
904
+ }
905
+ var gridData = this.treeGrid.grid.contentModule['rows'];
906
+ var data = gridData.filter(function (x) {
907
+ if (x['data'][_this.taskFields.id] === _this.flatData[0].ganttProperties.taskId) {
908
+ return x;
909
+ }
910
+ })[0];
911
+ var index = data['index'];
912
+ for (var i = 0; i < this.flatData.length; i++) {
913
+ this.flatData[i].index = index;
914
+ index++;
915
+ }
916
+ this.currentViewData = this.flatData;
917
+ this.treeGrid.grid.currentViewData = this.flatData;
918
+ if (!isNullOrUndefined(this.treeGrid['virtualScrollModule'])) {
919
+ this.treeGrid['virtualScrollModule'].visualData = this.flatData;
920
+ this.updatedRecords = this.flatData;
921
+ }
922
+ }
890
923
  };
891
924
  /**
892
925
  * @param {IGanttData} records -Defines the delete record collections.
@@ -906,7 +939,7 @@ var Gantt = /** @class */ (function (_super) {
906
939
  * @private
907
940
  */
908
941
  Gantt.prototype.updateContentHeight = function (args) {
909
- if (!this.allowTaskbarOverlap && this.viewType === 'ResourceView' && !this.isLoad) {
942
+ if ((!this.allowTaskbarOverlap && !this.ganttChartModule.isCollapseAll && !this.ganttChartModule.isExpandAll) && this.viewType === 'ResourceView' && !this.isLoad) {
910
943
  return;
911
944
  }
912
945
  else {
@@ -1272,6 +1305,9 @@ var Gantt = /** @class */ (function (_super) {
1272
1305
  else {
1273
1306
  this.getCurrentRecords(args);
1274
1307
  }
1308
+ if (!this.loadChildOnDemand && this.taskFields.hasChildMapping) {
1309
+ this.updateContentHeight();
1310
+ }
1275
1311
  if (this.enableCriticalPath && this.criticalPathModule) {
1276
1312
  this.criticalPathModule.showCriticalPath(this.enableCriticalPath);
1277
1313
  }
@@ -1287,6 +1323,9 @@ var Gantt = /** @class */ (function (_super) {
1287
1323
  }
1288
1324
  this.initialChartRowElements = this.ganttChartModule.getChartRows();
1289
1325
  this.isLoad = false;
1326
+ if (!this.loadChildOnDemand && this.taskFields.hasChildMapping) {
1327
+ this.autoCalculateDateScheduling = true;
1328
+ }
1290
1329
  this.trigger('dataBound', args);
1291
1330
  };
1292
1331
  /**
@@ -1551,7 +1590,14 @@ var Gantt = /** @class */ (function (_super) {
1551
1590
  if (prop === 'locale') {
1552
1591
  this.isLocaleChanged = true;
1553
1592
  }
1554
- isRefresh = true;
1593
+ if (prop === 'taskFields') {
1594
+ if (!isNullOrUndefined(newProp.taskFields.child)) {
1595
+ return;
1596
+ }
1597
+ }
1598
+ if (prop !== 'allowTaskbarDragAndDrop') {
1599
+ isRefresh = true;
1600
+ }
1555
1601
  break;
1556
1602
  case 'validateManualTasksOnLinking':
1557
1603
  this.validateManualTasksOnLinking = newProp.validateManualTasksOnLinking;
@@ -2231,6 +2277,9 @@ var Gantt = /** @class */ (function (_super) {
2231
2277
  * @returns {Promise<any>} .
2232
2278
  */
2233
2279
  Gantt.prototype.pdfExport = function (pdfExportProperties, isMultipleExport, pdfDoc, isBlob) {
2280
+ if (pdfExportProperties && pdfExportProperties.fitToWidthSettings && pdfExportProperties.fitToWidthSettings.isFitToWidth) {
2281
+ pdfExportProperties.pageOrientation == 'Landscape';
2282
+ }
2234
2283
  return this.pdfExportModule ? this.pdfExportModule.export(pdfExportProperties, isMultipleExport, pdfDoc, isBlob)
2235
2284
  : null;
2236
2285
  };
@@ -2319,14 +2368,17 @@ var Gantt = /** @class */ (function (_super) {
2319
2368
  this.isTimelineRoundOff = isTimelineRoundOff;
2320
2369
  this.timelineModule.refreshTimelineByTimeSpan();
2321
2370
  this.dataOperation.reUpdateGanttDataPosition();
2322
- this.timelineModule.updateChartByNewTimeline();
2323
- this.ganttChartModule.chartBodyContent.style.width = formatUnit(this.timelineModule.totalTimelineWidth);
2324
- this.ganttChartModule.updateLastRowBottomWidth();
2325
- if (this.taskFields.dependency) {
2326
- this.ganttChartModule.reRenderConnectorLines();
2327
- }
2328
- if (isFrom !== 'beforeAdd') {
2329
- this.notify('selectRowByIndex', {});
2371
+ if (!this.pdfExportModule || (this.pdfExportModule && !this.pdfExportModule.isPdfExport) || (this.pdfExportModule && this.pdfExportModule.isPdfExport && this.pdfExportModule.helper.exportProps &&
2372
+ this.pdfExportModule.helper.exportProps.fitToWidthSettings && !this.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth)) {
2373
+ this.timelineModule.updateChartByNewTimeline();
2374
+ this.ganttChartModule.chartBodyContent.style.width = formatUnit(this.timelineModule.totalTimelineWidth);
2375
+ this.ganttChartModule.updateLastRowBottomWidth();
2376
+ if (this.taskFields.dependency) {
2377
+ this.ganttChartModule.reRenderConnectorLines();
2378
+ }
2379
+ if (isFrom !== 'beforeAdd') {
2380
+ this.notify('selectRowByIndex', {});
2381
+ }
2330
2382
  }
2331
2383
  };
2332
2384
  /**
@@ -2904,8 +2956,15 @@ var Gantt = /** @class */ (function (_super) {
2904
2956
  * @returns {HTMLElement} .
2905
2957
  */
2906
2958
  Gantt.prototype.getRowByID = function (id) {
2959
+ var _this = this;
2907
2960
  var record = this.getRecordByID(id.toString());
2908
- var index = this.updatedRecords.indexOf(record);
2961
+ var index;
2962
+ if (!this.loadChildOnDemand && this.taskFields.hasChildMapping) {
2963
+ index = this.updatedRecords.map(function (item) { return item[_this.taskFields.id]; }).indexOf(record.ganttProperties.taskId);
2964
+ }
2965
+ else {
2966
+ index = this.updatedRecords.indexOf(record);
2967
+ }
2909
2968
  if (index !== -1) {
2910
2969
  return this.getRowByIndex(index);
2911
2970
  }
@@ -3366,6 +3425,9 @@ var Gantt = /** @class */ (function (_super) {
3366
3425
  __decorate([
3367
3426
  Property(true)
3368
3427
  ], Gantt.prototype, "enableVirtualMaskRow", void 0);
3428
+ __decorate([
3429
+ Property(false)
3430
+ ], Gantt.prototype, "loadChildOnDemand", void 0);
3369
3431
  __decorate([
3370
3432
  Property(true)
3371
3433
  ], Gantt.prototype, "UpdateOffsetOnTaskbarEdit", void 0);
@@ -802,6 +802,8 @@ export interface PdfExportProperties {
802
802
  exportType?: ExportType;
803
803
  /** Indicates whether to show the predecessors in exported Pdf */
804
804
  showPredecessorLines?: boolean;
805
+ /** Defines the export options in rendering each row fit to the PDF page width */
806
+ fitToWidthSettings?: FitToWidthSettings;
805
807
  }
806
808
  export interface PdfQueryCellInfoEventArgs {
807
809
  /** Defines the column of the current cell. */
@@ -886,6 +888,18 @@ export interface ITaskbarStyle {
886
888
  criticalProgressColor?: PdfColor;
887
889
  /** Defines the child taskbar border color */
888
890
  criticalTaskBorderColor?: PdfColor;
891
+ /** Defines the baseline color */
892
+ baselineColor?: PdfColor;
893
+ /** Defines the baseline border color */
894
+ baselineBorderColor?: PdfColor;
895
+ }
896
+ export interface FitToWidthSettings {
897
+ /** Specifies whether to export gantt data where each row is adjusted and rendered to fit the PDF document page size. */
898
+ isFitToWidth?: boolean;
899
+ /** Specifies the grid width in percentage while exporting. */
900
+ gridWidth?: string;
901
+ /** Specifies the chart width in percentage while exporting. */
902
+ chartWidth?: string;
889
903
  }
890
904
  export interface IGanttStyle {
891
905
  /** Defines the columnHeader style. */
@@ -5,9 +5,9 @@ import { DateProcessor } from './date-processor';
5
5
  * To calculate and update task related values
6
6
  */
7
7
  export declare class TaskProcessor extends DateProcessor {
8
- private recordIndex;
9
- private dataArray;
10
- private taskIds;
8
+ recordIndex: number;
9
+ dataArray: Object[];
10
+ taskIds: Object[];
11
11
  private segmentCollection;
12
12
  private hierarchyData;
13
13
  constructor(parent: Gantt);
@@ -21,7 +21,7 @@ export declare class TaskProcessor extends DateProcessor {
21
21
  private processTimeline;
22
22
  private initDataSource;
23
23
  private constructDataSource;
24
- private cloneDataSource;
24
+ cloneDataSource(): void;
25
25
  /**
26
26
  * @param {object[]} resources .
27
27
  * @param {object[]} data .
@@ -87,7 +87,9 @@ var TaskProcessor = /** @class */ (function (_super) {
87
87
  dataManager.executeQuery(queryManager).then(function (e) {
88
88
  _this.dataArray = e.result;
89
89
  _this.processTimeline();
90
- _this.cloneDataSource();
90
+ if (_this.parent.loadChildOnDemand || (!_this.parent.loadChildOnDemand && !(_this.parent.taskFields.hasChildMapping))) {
91
+ _this.cloneDataSource();
92
+ }
91
93
  _this.parent.renderGantt(isChange);
92
94
  }).catch(function (e) {
93
95
  // Trigger action failure event
@@ -126,6 +128,9 @@ var TaskProcessor = /** @class */ (function (_super) {
126
128
  var data = [];
127
129
  for (var i = 0; i < this.dataArray.length; i++) {
128
130
  var tempData = this.dataArray[i];
131
+ if (tempData['parentItem']) {
132
+ delete tempData['parentItem'];
133
+ }
129
134
  data.push(extend({}, {}, tempData, true));
130
135
  if (!isNullOrUndefined(tempData[taskIdMapping])) {
131
136
  this.taskIds.push(tempData[taskIdMapping].toString());
@@ -135,7 +140,12 @@ var TaskProcessor = /** @class */ (function (_super) {
135
140
  this.parent.setProperties({ taskFields: { child: 'Children' } }, true);
136
141
  }
137
142
  this.constructDataSource(data);
138
- hierarchicalData = this.hierarchyData;
143
+ if (!this.parent.loadChildOnDemand && this.parent.taskFields.hasChildMapping && this.hierarchyData.length === 0) {
144
+ hierarchicalData = this.dataArray;
145
+ }
146
+ else {
147
+ hierarchicalData = this.hierarchyData;
148
+ }
139
149
  }
140
150
  else {
141
151
  hierarchicalData = this.dataArray;
@@ -357,7 +367,12 @@ var TaskProcessor = /** @class */ (function (_super) {
357
367
  if (!isNullOrUndefined(data[taskSettings.id])) {
358
368
  id = data[taskSettings.id];
359
369
  name = data[taskSettings.name];
360
- this.addTaskData(ganttData, data, isLoad);
370
+ if (!this.parent.loadChildOnDemand && taskSettings.hasChildMapping && data['taskData']) {
371
+ ganttData['taskData'] = data['taskData'];
372
+ }
373
+ else {
374
+ this.addTaskData(ganttData, data, isLoad);
375
+ }
361
376
  }
362
377
  else if (!isNullOrUndefined(data[resourceFields.id])) {
363
378
  id = data[resourceFields.id];
@@ -395,6 +410,9 @@ var TaskProcessor = /** @class */ (function (_super) {
395
410
  this.parent.setRecordValue('notes', notes, ganttProperties, true);
396
411
  this.parent.setRecordValue('cssClass', data[taskSettings.cssClass], ganttProperties, true);
397
412
  this.parent.setRecordValue('parentItem', this.getCloneParent(parentItem), ganttData);
413
+ if (!this.parent.loadChildOnDemand && taskSettings.hasChildMapping && this.parent.currentViewData.length > 0) {
414
+ this.parent.setRecordValue('parentItem', ganttData.parentItem, this.parent.currentViewData[this.taskIds.indexOf(data[taskSettings.id].toString())]);
415
+ }
398
416
  var parentUniqId = ganttData.parentItem ? ganttData.parentItem.uniqueID : null;
399
417
  this.parent.setRecordValue('parentUniqueID', parentUniqId, ganttData);
400
418
  if (this.parent.viewType === 'ResourceView' && !isNullOrUndefined(taskSettings.parentID)
@@ -402,7 +420,12 @@ var TaskProcessor = /** @class */ (function (_super) {
402
420
  this.parent.setRecordValue('parentId', ganttData.parentItem.taskId, ganttProperties, true);
403
421
  }
404
422
  this.parent.setRecordValue('level', level, ganttData);
405
- this.parent.setRecordValue('uniqueID', getUid(this.parent.element.id + '_data_'), ganttData);
423
+ if (!this.parent.loadChildOnDemand && taskSettings.hasChildMapping && data['uniqueID']) {
424
+ this.parent.setRecordValue('uniqueID', data['uniqueID'], ganttData);
425
+ }
426
+ else {
427
+ this.parent.setRecordValue('uniqueID', getUid(this.parent.element.id + '_data_'), ganttData);
428
+ }
406
429
  this.parent.setRecordValue('uniqueID', ganttData.uniqueID, ganttProperties, true);
407
430
  this.parent.setRecordValue('childRecords', [], ganttData);
408
431
  if (this.parent.dataSource instanceof Object && isCountRequired(this.parent) &&
@@ -417,7 +440,12 @@ var TaskProcessor = /** @class */ (function (_super) {
417
440
  }
418
441
  }
419
442
  else {
420
- this.parent.setRecordValue('hasChildRecords', false, ganttData);
443
+ if (!this.parent.loadChildOnDemand && taskSettings.hasChildMapping && ganttData.taskData[taskSettings.hasChildMapping]) {
444
+ this.parent.setRecordValue('hasChildRecords', true, ganttData);
445
+ }
446
+ else {
447
+ this.parent.setRecordValue('hasChildRecords', false, ganttData);
448
+ }
421
449
  }
422
450
  if (ganttData.hasChildRecords) {
423
451
  this.parent.setRecordValue('autoStartDate', ganttData.ganttProperties.startDate, ganttProperties);
@@ -1030,7 +1058,12 @@ var TaskProcessor = /** @class */ (function (_super) {
1030
1058
  }
1031
1059
  else {
1032
1060
  this.updateDurationValue(duration, ganttProperties);
1033
- this.calculateEndDate(ganttData);
1061
+ if (this.parent.autoCalculateDateScheduling) {
1062
+ this.calculateEndDate(ganttData);
1063
+ }
1064
+ else {
1065
+ this.parent.setRecordValue('endDate', endDate, ganttProperties, true);
1066
+ }
1034
1067
  }
1035
1068
  };
1036
1069
  /**
@@ -1815,7 +1848,7 @@ var TaskProcessor = /** @class */ (function (_super) {
1815
1848
  */
1816
1849
  TaskProcessor.prototype.updateDurationValue = function (duration, ganttProperties) {
1817
1850
  var tempDuration = this.getDurationValue(duration);
1818
- if (!isNaN(getValue('duration', tempDuration))) {
1851
+ if (!isNaN(getValue('duration', tempDuration)) && !(this.parent.viewType === "ResourceView" && tempDuration["duration"] === 0)) {
1819
1852
  this.parent.setRecordValue('duration', getValue('duration', tempDuration), ganttProperties, true);
1820
1853
  }
1821
1854
  if (!isNullOrUndefined(getValue('durationUnit', tempDuration))) {
@@ -2200,7 +2233,14 @@ var TaskProcessor = /** @class */ (function (_super) {
2200
2233
  * @private
2201
2234
  */
2202
2235
  TaskProcessor.prototype.reUpdateGanttDataPosition = function () {
2203
- var flatData = this.parent.flatData;
2236
+ var flatData;
2237
+ if (this.parent.pdfExportModule && this.parent.pdfExportModule.isPdfExport && this.parent.pdfExportModule.helper.exportProps &&
2238
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) {
2239
+ flatData = this.parent.pdfExportModule.helper.beforeSinglePageExport['cloneFlatData'];
2240
+ }
2241
+ else {
2242
+ flatData = this.parent.flatData;
2243
+ }
2204
2244
  var length = flatData.length;
2205
2245
  for (var i = 0; i < length; i++) {
2206
2246
  var data = flatData[i];
@@ -2327,6 +2367,7 @@ var TaskProcessor = /** @class */ (function (_super) {
2327
2367
  * @private
2328
2368
  */
2329
2369
  TaskProcessor.prototype.updateParentItems = function (cloneParent, isParent) {
2370
+ var _this = this;
2330
2371
  var parentData = isParent ? cloneParent : this.parent.getParentTask(cloneParent);
2331
2372
  var deleteUpdate = false;
2332
2373
  var ganttProp = parentData.ganttProperties;
@@ -2335,8 +2376,8 @@ var TaskProcessor = /** @class */ (function (_super) {
2335
2376
  var previousStartDate = ganttProp.isAutoSchedule ? ganttProp.startDate : ganttProp.autoStartDate;
2336
2377
  var previousEndDate = ganttProp.isAutoSchedule ? ganttProp.endDate :
2337
2378
  ganttProp.autoEndDate;
2338
- var childRecords = parentData.childRecords;
2339
- var childLength = childRecords.length;
2379
+ var childRecords_1 = parentData.childRecords;
2380
+ var childLength = childRecords_1.length;
2340
2381
  var totalDuration = 0;
2341
2382
  var progressValues = {};
2342
2383
  var minStartDate = null;
@@ -2345,38 +2386,43 @@ var TaskProcessor = /** @class */ (function (_super) {
2345
2386
  var totalProgress = 0;
2346
2387
  var childCompletedWorks = 0;
2347
2388
  var childData = void 0;
2348
- for (var count = 0; count < childLength; count++) {
2349
- childData = childRecords[count];
2350
- if (this.parent.isOnDelete && childData.isDelete) {
2351
- if (childLength === 1 && this.parent.viewType === 'ProjectView') {
2389
+ var _loop_6 = function (count) {
2390
+ if (!this_4.parent.loadChildOnDemand && this_4.parent.taskFields.hasChildMapping) {
2391
+ childData = this_4.parent.currentViewData.filter(function (item) { return item.ganttProperties.taskId === childRecords_1[count][_this.parent.taskFields.id]; })[0];
2392
+ }
2393
+ else {
2394
+ childData = childRecords_1[count];
2395
+ }
2396
+ if (this_4.parent.isOnDelete && childData.isDelete) {
2397
+ if (childLength === 1 && this_4.parent.viewType === 'ProjectView') {
2352
2398
  deleteUpdate = true;
2353
2399
  }
2354
- continue;
2400
+ return "continue";
2355
2401
  }
2356
- var startDate = this.getValidStartDate(childData.ganttProperties);
2402
+ var startDate = this_4.getValidStartDate(childData.ganttProperties);
2357
2403
  if (parentData.hasChildRecords && !ganttProp.isAutoSchedule && !isNullOrUndefined(childData.ganttProperties.autoStartDate)) {
2358
2404
  startDate = childData.ganttProperties.autoStartDate;
2359
2405
  }
2360
- var endDate = this.getValidEndDate(childData.ganttProperties);
2406
+ var endDate = this_4.getValidEndDate(childData.ganttProperties);
2361
2407
  if (parentData.hasChildRecords && !ganttProp.isAutoSchedule && !isNullOrUndefined(childData.ganttProperties.autoEndDate)) {
2362
2408
  endDate = childData.ganttProperties.autoEndDate;
2363
2409
  }
2364
2410
  if (isNullOrUndefined(minStartDate)) {
2365
- minStartDate = this.getDateFromFormat(startDate);
2411
+ minStartDate = this_4.getDateFromFormat(startDate);
2366
2412
  }
2367
2413
  if (isNullOrUndefined(maxEndDate)) {
2368
- maxEndDate = this.getDateFromFormat(endDate);
2414
+ maxEndDate = this_4.getDateFromFormat(endDate);
2369
2415
  }
2370
- if (!isNullOrUndefined(endDate) && this.compareDates(endDate, maxEndDate) === 1) {
2371
- maxEndDate = this.getDateFromFormat(endDate);
2416
+ if (!isNullOrUndefined(endDate) && this_4.compareDates(endDate, maxEndDate) === 1) {
2417
+ maxEndDate = this_4.getDateFromFormat(endDate);
2372
2418
  }
2373
- if (!isNullOrUndefined(startDate) && this.compareDates(startDate, minStartDate) === -1) {
2374
- minStartDate = this.getDateFromFormat(startDate);
2419
+ if (!isNullOrUndefined(startDate) && this_4.compareDates(startDate, minStartDate) === -1) {
2420
+ minStartDate = this_4.getDateFromFormat(startDate);
2375
2421
  }
2376
2422
  if (!childData.ganttProperties.isMilestone && isScheduledTask(childData.ganttProperties)) {
2377
- progressValues = this.getParentProgress(childData);
2423
+ progressValues = this_4.getParentProgress(childData);
2378
2424
  totalProgress += getValue('totalProgress', progressValues);
2379
- if (childData[this.parent.taskFields.duration] < 1) {
2425
+ if (childData[this_4.parent.taskFields.duration] < 1) {
2380
2426
  totalDuration += getValue('totalDuration', progressValues);
2381
2427
  totalDuration = Number(totalDuration.toFixed(4));
2382
2428
  }
@@ -2388,6 +2434,10 @@ var TaskProcessor = /** @class */ (function (_super) {
2388
2434
  milestoneCount++;
2389
2435
  }
2390
2436
  childCompletedWorks += childData.ganttProperties.work;
2437
+ };
2438
+ var this_4 = this;
2439
+ for (var count = 0; count < childLength; count++) {
2440
+ _loop_6(count);
2391
2441
  }
2392
2442
  if (!deleteUpdate) {
2393
2443
  var taskCount = void 0;
@@ -117,6 +117,11 @@ var GanttTreeGrid = /** @class */ (function () {
117
117
  this.wireEvents();
118
118
  };
119
119
  GanttTreeGrid.prototype.composeProperties = function () {
120
+ this.parent.treeGrid.hasChildMapping = this.parent.taskFields.hasChildMapping;
121
+ this.parent.treeGrid.loadChildOnDemand = this.parent.loadChildOnDemand;
122
+ this.parent.treeGrid['isFromGantt'] = true;
123
+ this.parent.treeGrid.parentIdMapping = this.parent.taskFields.parentID;
124
+ this.parent.treeGrid.idMapping = this.parent.taskFields.id;
120
125
  this.parent.treeGrid.showColumnMenu = this.parent.showColumnMenu;
121
126
  this.parent.treeGrid.enableCollapseAll = this.parent.collapseAllParentTasks;
122
127
  this.parent.treeGrid.columnMenuItems = this.parent.columnMenuItems;
@@ -133,8 +138,14 @@ var GanttTreeGrid = /** @class */ (function () {
133
138
  this.parent.treeGrid.dataSource = { result: this.parent.flatData, count: count };
134
139
  }
135
140
  else {
136
- this.parent.treeGrid.hasChildMapping = null;
137
- this.parent.treeGrid.dataSource = this.parent.flatData;
141
+ if (!this.parent.treeGrid.loadChildOnDemand && this.parent.taskFields.hasChildMapping) {
142
+ this.parent.autoCalculateDateScheduling = false;
143
+ this.parent.treeGrid.dataSource = this.parent.dataSource;
144
+ }
145
+ else {
146
+ this.parent.treeGrid.hasChildMapping = null;
147
+ this.parent.treeGrid.dataSource = this.parent.flatData;
148
+ }
138
149
  }
139
150
  this.parent.treeGrid.expandStateMapping = this.parent.taskFields.expandState;
140
151
  var isGantt = 'isGantt';
@@ -295,7 +306,7 @@ var GanttTreeGrid = /** @class */ (function () {
295
306
  collapsedArgs = this.createExpandCollapseArgs(args, null);
296
307
  this.parent.ganttChartModule.collapsedGanttRow(collapsedArgs);
297
308
  }
298
- if (this.parent.viewType === 'ResourceView' && !this.parent.allowTaskbarOverlap && collapsedArgs['gridRow']) {
309
+ if (this.parent.viewType === 'ResourceView' && !this.parent.allowTaskbarOverlap && !this.parent.ganttChartModule.isCollapseAll && collapsedArgs['gridRow']) {
299
310
  collapsedArgs['gridRow'].style.height = collapsedArgs['chartRow'].style.height;
300
311
  this.parent.contentHeight = this.parent.enableRtl ? this.parent['element'].getElementsByClassName('e-content')[2].children[0]['offsetHeight'] :
301
312
  this.parent['element'].getElementsByClassName('e-content')[0].children[0]['offsetHeight'];
@@ -325,7 +336,7 @@ var GanttTreeGrid = /** @class */ (function () {
325
336
  expandedArgs = this.createExpandCollapseArgs(args, null);
326
337
  this.parent.ganttChartModule.expandedGanttRow(expandedArgs);
327
338
  }
328
- if (this.parent.viewType === 'ResourceView' && !this.parent.allowTaskbarOverlap && args['row']) {
339
+ if (this.parent.viewType === 'ResourceView' && !this.parent.allowTaskbarOverlap && !this.parent.ganttChartModule.isExpandAll && args['row']) {
329
340
  args['row'].style.height = this.parent.rowHeight + 'px';
330
341
  this.parent.contentHeight = this.parent.enableRtl ? this.parent['element'].getElementsByClassName('e-content')[2].children[0]['offsetHeight'] :
331
342
  this.parent['element'].getElementsByClassName('e-content')[0].children[0]['offsetHeight'];
@@ -895,6 +906,9 @@ var GanttTreeGrid = /** @class */ (function () {
895
906
  if (!isNullOrUndefined(ganttProp)) {
896
907
  return this.parent.dataOperation.getDurationString(ganttProp.duration, ganttProp.durationUnit);
897
908
  }
909
+ else if (!this.parent.loadChildOnDemand && this.parent.taskFields.hasChildMapping) {
910
+ return this.parent.dataOperation.getDurationString(parseInt(data[this.parent.taskFields.duration]), this.parent.durationUnit);
911
+ }
898
912
  return '';
899
913
  }; // eslint-disable-next-line
900
914
  GanttTreeGrid.prototype.resourceValueAccessor = function (field, data, column) {
@@ -931,12 +945,7 @@ var GanttTreeGrid = /** @class */ (function () {
931
945
  };
932
946
  GanttTreeGrid.prototype.updateScrollTop = function (args) {
933
947
  var newScrollTop;
934
- if (getValue('top', args) > (this.parent.flatData.length * this.parent.rowHeight)) {
935
- newScrollTop = getValue('top', args) - document.getElementsByClassName('e-chart-scroll-container e-content')[0]['offsetHeight'];
936
- }
937
- else {
938
- newScrollTop = getValue('top', args);
939
- }
948
+ newScrollTop = getValue('top', args);
940
949
  this.treeGridElement.querySelector('.e-content').scrollTop = newScrollTop;
941
950
  this.previousScroll.top = this.treeGridElement.querySelector('.e-content').scrollTop;
942
951
  };
@@ -9,7 +9,7 @@ import { Gantt } from './../base/gantt';
9
9
  export declare class ExportHelper {
10
10
  private parent;
11
11
  private flatData;
12
- private exportProps;
12
+ exportProps: PdfExportProperties;
13
13
  private gantt;
14
14
  private rowIndex;
15
15
  private colIndex;
@@ -19,7 +19,11 @@ export declare class ExportHelper {
19
19
  private pdfDoc;
20
20
  private exportValueFormatter;
21
21
  private totalColumnWidth;
22
+ beforeSinglePageExport: Object;
23
+ baselineHeight: number;
24
+ baselineTop: number;
22
25
  constructor(parent: Gantt);
26
+ processToFit(): void;
23
27
  /**
24
28
  * @param {IGanttData[]} data .
25
29
  * @param {PdfGantt} gantt .