@syncfusion/ej2-gantt 21.2.8 → 21.2.9

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.
@@ -2078,29 +2078,53 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2078
2078
  startDate = this.checkStartDate(startDate, data.ganttProperties, false);
2079
2079
  if (!isNullOrUndefined(duration)) {
2080
2080
  endDate = this.getEndDate(startDate, duration, data.ganttProperties.durationUnit, data.ganttProperties, false);
2081
+ if (taskSettings.duration) {
2082
+ remainingDuration = data.ganttProperties.duration - sumOfDuration;
2083
+ if (remainingDuration <= 0) {
2084
+ continue;
2085
+ }
2086
+ duration = i === segments.length - 1 ? remainingDuration : remainingDuration > 0 &&
2087
+ duration > remainingDuration ? remainingDuration : duration;
2088
+ endDate = this.getEndDate(startDate, duration, data.ganttProperties.durationUnit, data.ganttProperties, false);
2089
+ }
2090
+ else if (!taskSettings.duration && taskSettings.endDate) {
2091
+ endDate = (!isNullOrUndefined(data.ganttProperties.endDate)) && endDate.getTime() >
2092
+ data.ganttProperties.endDate.getTime() && i !== segments.length - 1 ? endDate : data.ganttProperties.endDate;
2093
+ duration = this.getDuration(startDate, endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2094
+ if (ganttSegments.length > 0 && endDate.getTime() < startDate.getTime()
2095
+ && endDate.getTime() <= data.ganttProperties.endDate.getTime()) {
2096
+ ganttSegments[i - 1].duration = this.getDuration(ganttSegments[i - 1].startDate, data.ganttProperties.endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2097
+ continue;
2098
+ }
2099
+ }
2081
2100
  }
2082
2101
  else {
2083
2102
  endDate = this.getDateFromFormat(endDate);
2103
+ if (endDate && (isNullOrUndefined(duration) || String(duration) === '')) {
2104
+ if (endDate.getHours() === 0 && this.parent.defaultEndTime !== 86400) {
2105
+ this.setTime(this.parent.defaultEndTime, endDate);
2106
+ }
2107
+ }
2084
2108
  endDate = this.checkEndDate(endDate, data.ganttProperties, false);
2085
2109
  duration = this.getDuration(startDate, endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2086
- }
2087
- if (taskSettings.duration) {
2088
- remainingDuration = data.ganttProperties.duration - sumOfDuration;
2089
- if (remainingDuration <= 0) {
2090
- continue;
2110
+ if (taskSettings.duration) {
2111
+ remainingDuration = data.ganttProperties.duration - sumOfDuration - 1;
2112
+ if (remainingDuration <= 0) {
2113
+ continue;
2114
+ }
2115
+ duration = i === segments.length - 1 ? remainingDuration : remainingDuration > 0 &&
2116
+ duration > remainingDuration ? remainingDuration : duration;
2117
+ endDate = this.getEndDate(startDate, duration, data.ganttProperties.durationUnit, data.ganttProperties, false);
2091
2118
  }
2092
- duration = i === segments.length - 1 ? remainingDuration : remainingDuration > 0 &&
2093
- duration > remainingDuration ? remainingDuration : duration;
2094
- endDate = this.getEndDate(startDate, duration, data.ganttProperties.durationUnit, data.ganttProperties, false);
2095
- }
2096
- else if (!taskSettings.duration && taskSettings.endDate) {
2097
- endDate = (!isNullOrUndefined(data.ganttProperties.endDate)) && endDate.getTime() >
2098
- data.ganttProperties.endDate.getTime() && i !== segments.length - 1 ? endDate : data.ganttProperties.endDate;
2099
- duration = this.getDuration(startDate, endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2100
- if (ganttSegments.length > 0 && endDate.getTime() < startDate.getTime()
2101
- && endDate.getTime() <= data.ganttProperties.endDate.getTime()) {
2102
- ganttSegments[i - 1].duration = this.getDuration(ganttSegments[i - 1].startDate, data.ganttProperties.endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2103
- continue;
2119
+ else if (!taskSettings.duration && taskSettings.endDate) {
2120
+ endDate = (!isNullOrUndefined(data.ganttProperties.endDate)) && endDate.getTime() >
2121
+ data.ganttProperties.endDate.getTime() && i !== segments.length - 1 ? endDate : data.ganttProperties.endDate;
2122
+ duration = this.getDuration(startDate, endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2123
+ if (ganttSegments.length > 0 && endDate.getTime() < startDate.getTime()
2124
+ && endDate.getTime() <= data.ganttProperties.endDate.getTime()) {
2125
+ ganttSegments[i - 1].duration = this.getDuration(ganttSegments[i - 1].startDate, data.ganttProperties.endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2126
+ continue;
2127
+ }
2104
2128
  }
2105
2129
  }
2106
2130
  segment = {};
@@ -3933,6 +3957,9 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
3933
3957
  }
3934
3958
  }
3935
3959
  this.parent.setRecordValue('isMilestone', milestone, parentProp, true);
3960
+ if (!isNullOrUndefined(this.parent.taskFields.milestone)) {
3961
+ this.updateMappingData(parentData, 'milestone');
3962
+ }
3936
3963
  if (parentProp.isAutoSchedule) {
3937
3964
  this.calculateDuration(parentData);
3938
3965
  }
@@ -5353,7 +5380,13 @@ var GanttChart = /** @__PURE__ @class */ (function () {
5353
5380
  * @private
5354
5381
  */
5355
5382
  GanttChart.prototype.getRecordByTaskBar = function (target) {
5356
- var item = this.parent.currentViewData[this.getIndexByTaskBar(target)];
5383
+ var item;
5384
+ if (this.parent.enableVirtualization && this.parent.enableMultiTaskbar) {
5385
+ item = this.parent.flatData[this.getIndexByTaskBar(target)];
5386
+ }
5387
+ else {
5388
+ item = this.parent.currentViewData[this.getIndexByTaskBar(target)];
5389
+ }
5357
5390
  return item;
5358
5391
  };
5359
5392
  /**
@@ -5711,7 +5744,12 @@ var GanttChart = /** @__PURE__ @class */ (function () {
5711
5744
  else {
5712
5745
  var id = row.getAttribute('rowUniqueId');
5713
5746
  var record = this.parent.getRecordByID(id);
5714
- recordIndex = this.parent.currentViewData.indexOf(record);
5747
+ if (this.parent.enableVirtualization && this.parent.enableMultiTaskbar) {
5748
+ recordIndex = this.parent.flatData.indexOf(record);
5749
+ }
5750
+ else {
5751
+ recordIndex = this.parent.currentViewData.indexOf(record);
5752
+ }
5715
5753
  }
5716
5754
  return recordIndex;
5717
5755
  };
@@ -7133,9 +7171,11 @@ var Timeline = /** @__PURE__ @class */ (function () {
7133
7171
  var validStartLeft = this.parent.dataOperation.getTaskLeft(validStartDate, false);
7134
7172
  var validEndLeft = this.parent.dataOperation.getTaskLeft(validEndDate, false);
7135
7173
  var isChanged = void 0;
7174
+ var taskbarModule = this.parent.editModule.taskbarEditModule;
7136
7175
  if (!isNullOrUndefined(maxStartLeft) && ((minStartDate < this.timelineStartDate) ||
7137
- (!isNullOrUndefined(this.parent.editModule.taskbarEditModule)) &&
7138
- (!isNullOrUndefined(this.parent.editModule.taskbarEditModule.taskBarEditAction))) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
7176
+ (!isNullOrUndefined(taskbarModule)) && (!isNullOrUndefined(taskbarModule.taskBarEditAction)
7177
+ && taskbarModule.taskBarEditAction !== 'ProgressResizing' &&
7178
+ taskbarModule.taskBarEditAction !== 'RightResizing')) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
7139
7179
  isChanged = 'prevTimeSpan';
7140
7180
  minStartDate = minStartDate > this.timelineStartDate ? this.timelineStartDate : minStartDate;
7141
7181
  }
@@ -7732,7 +7772,7 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7732
7772
  this.parent.columnByField = {};
7733
7773
  this.parent.customColumns = [];
7734
7774
  var tasksMapping = ['id', 'name', 'startDate', 'endDate', 'duration', 'dependency',
7735
- 'progress', 'baselineStartDate', 'baselineEndDate', 'resourceInfo', 'notes', 'work', 'manual', 'type'];
7775
+ 'progress', 'baselineStartDate', 'baselineEndDate', 'resourceInfo', 'notes', 'work', 'manual', 'type', 'milestone'];
7736
7776
  var _loop_1 = function (i) {
7737
7777
  var column = {};
7738
7778
  if (typeof ganttObj.columns[i] === 'string') {
@@ -8079,7 +8119,7 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
8079
8119
  }
8080
8120
  }; // eslint-disable-next-line
8081
8121
  GanttTreeGrid.prototype.durationValueAccessor = function (field, data, column) {
8082
- var ganttProp = data.ganttProperties;
8122
+ var ganttProp = (!isNullOrUndefined(data)) ? data.ganttProperties : null;
8083
8123
  if (!isNullOrUndefined(ganttProp)) {
8084
8124
  return this.parent.dataOperation.getDurationString(ganttProp.duration, ganttProp.durationUnit);
8085
8125
  }
@@ -9205,7 +9245,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9205
9245
  !this.isTemplate(childLabel) &&
9206
9246
  progressDiv[0].querySelectorAll('.e-task-label')[0].children[0])
9207
9247
  progressDiv[0].querySelectorAll('.e-task-label')[0].children[0].remove();
9208
- if (progressDiv[0].querySelectorAll('.e-task-label')[0].textContent == '' &&
9248
+ if (progressDiv[0].querySelectorAll('.e-task-label')[0].textContent === '' &&
9209
9249
  childLabel && !childLabel['elementRef'] && tempDiv.innerHTML !== '')
9210
9250
  progressDiv[0].querySelectorAll('.e-task-label')[0].textContent = childLabel;
9211
9251
  }
@@ -9876,7 +9916,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9876
9916
  !this.isTemplate(parentLabel) &&
9877
9917
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].children[0])
9878
9918
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].children[0].remove();
9879
- if (progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent == '' &&
9919
+ if (progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent === '' &&
9880
9920
  parentLabel && !parentLabel['elementRef'] && div.innerHTML !== '')
9881
9921
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent = parentLabel;
9882
9922
  }
@@ -9906,11 +9946,19 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9906
9946
  * @returns {NodeList} .
9907
9947
  * @private
9908
9948
  */
9909
- ChartRows.prototype.getTableTrNode = function () {
9949
+ ChartRows.prototype.getTableTrNode = function (i) {
9910
9950
  var table = createElement('table');
9911
9951
  var className = (this.parent.gridLines === 'Horizontal' || this.parent.gridLines === 'Both') ?
9912
9952
  'e-chart-row-border' : '';
9913
- table.innerHTML = '<tr class="' + this.getRowClassName(this.templateData) + ' ' + chartRow + '"' +
9953
+ var rows = this.parent.treeGrid.grid.contentModule.getRows()[i];
9954
+ var activecls;
9955
+ if (rows && rows.isSelected) {
9956
+ activecls = 'e-active';
9957
+ }
9958
+ else {
9959
+ activecls = '';
9960
+ }
9961
+ table.innerHTML = '<tr class="' + this.getRowClassName(this.templateData) + ' ' + chartRow + ' ' + (activecls) + '"' +
9914
9962
  'style="display:' + this.getExpandDisplayProp(this.templateData) + ';height:' +
9915
9963
  this.parent.rowHeight + 'px;">' +
9916
9964
  '<td class="' + chartRowCell + ' ' + className
@@ -10348,7 +10396,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10348
10396
  this.parent.renderTemplates();
10349
10397
  this.triggerQueryTaskbarInfo();
10350
10398
  this.parent.modifiedRecords = [];
10351
- if (this.parent.viewType == 'ResourceView' && this.parent.showOverAllocation) {
10399
+ if (this.parent.viewType === 'ResourceView' && this.parent.showOverAllocation) {
10352
10400
  this.updateOverlapped();
10353
10401
  }
10354
10402
  if (collapsedResourceRecord.length) {
@@ -10372,7 +10420,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10372
10420
  ChartRows.prototype.getGanttChartRow = function (i, tempTemplateData) {
10373
10421
  this.templateData = tempTemplateData;
10374
10422
  var taskBaselineTemplateNode = null;
10375
- var parentTrNode = this.getTableTrNode();
10423
+ var parentTrNode = this.getTableTrNode(i);
10376
10424
  var leftLabelNode = this.getLeftLabelNode(i);
10377
10425
  var taskbarContainerNode = this.taskbarContainer();
10378
10426
  taskbarContainerNode[0].setAttribute('aria-label', this.generateAriaLabel(this.templateData));
@@ -10924,6 +10972,19 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10924
10972
  }
10925
10973
  }
10926
10974
  };
10975
+ ChartRows.prototype.updateResourceTaskbarElement = function (tRow, parentTr) {
10976
+ var cloneElement = tRow.querySelector('.e-taskbar-main-container');
10977
+ addClass([cloneElement], 'collpse-parent-border');
10978
+ var id = tRow.querySelector('.' + taskBarMainContainer).getAttribute('rowUniqueId');
10979
+ var ganttData = this.parent.getRecordByID(id);
10980
+ var zIndex = "";
10981
+ if (ganttData && !isNullOrUndefined(ganttData.ganttProperties.eOverlapIndex)) {
10982
+ zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
10983
+ }
10984
+ var cloneChildElement = cloneElement.cloneNode(true);
10985
+ cloneChildElement.style.zIndex = zIndex;
10986
+ parentTr[0].childNodes[0].childNodes[0].childNodes[0].appendChild(cloneChildElement);
10987
+ };
10927
10988
  ChartRows.prototype.getResourceParent = function (record) {
10928
10989
  var chartRows = this.parent.ganttChartModule.getChartRows();
10929
10990
  //Below code is for rendering taskbartemplate in resource view with multi taskbar
@@ -10947,20 +11008,19 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10947
11008
  parentTrNode[0].childNodes[0].childNodes[0].appendChild(collapseParent);
10948
11009
  var tasks = this.parent.dataOperation.setSortedChildTasks(record);
10949
11010
  this.parent.dataOperation.updateOverlappingIndex(tasks);
10950
- for (var i = 0; i < chartRows.length; i++) {
10951
- if (chartRows[i].classList.contains('gridrowtaskId'
10952
- + record.ganttProperties.rowUniqueID + 'level' + (record.level + 1))) {
10953
- var cloneElement = chartRows[i].querySelector('.e-taskbar-main-container');
10954
- addClass([cloneElement], 'collpse-parent-border');
10955
- var id = chartRows[i].querySelector('.' + taskBarMainContainer).getAttribute('rowUniqueId');
10956
- var ganttData = this.parent.getRecordByID(id);
10957
- var zIndex = "";
10958
- if (ganttData && !isNullOrUndefined(ganttData.ganttProperties.eOverlapIndex)) {
10959
- zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
11011
+ var tRow;
11012
+ if (this.parent.enableVirtualization) {
11013
+ for (var i = 0; i < record.childRecords.length; i++) {
11014
+ tRow = this.getGanttChartRow(record.childRecords[i].index, this.parent.flatData[record.childRecords[i].index]);
11015
+ this.updateResourceTaskbarElement(tRow, parentTrNode);
11016
+ }
11017
+ }
11018
+ else {
11019
+ for (var i = 0; i < chartRows.length; i++) {
11020
+ if (chartRows[i].classList.contains('gridrowtaskId'
11021
+ + record.ganttProperties.rowUniqueID + 'level' + (record.level + 1))) {
11022
+ this.updateResourceTaskbarElement(chartRows[i], parentTrNode);
10960
11023
  }
10961
- var cloneChildElement = cloneElement.cloneNode(true);
10962
- cloneChildElement.style.zIndex = zIndex;
10963
- parentTrNode[0].childNodes[0].childNodes[0].childNodes[0].appendChild(cloneChildElement);
10964
11024
  }
10965
11025
  }
10966
11026
  parentTrNode[0].childNodes[0].childNodes[0].appendChild([].slice.call(leftLabelNode)[0]);
@@ -11469,6 +11529,15 @@ var Dependency = /** @__PURE__ @class */ (function () {
11469
11529
  for (var count = 0; count < totLength; count++) {
11470
11530
  if (flatData[count].ganttProperties.predecessorsName) {
11471
11531
  this.validatePredecessorDates(flatData[count]);
11532
+ var predecessorCollection = flatData[count].ganttProperties.predecessor;
11533
+ if (predecessorCollection && predecessorCollection.length > 1) {
11534
+ for (var i = 0; i < predecessorCollection.length; i++) {
11535
+ var validateRecord = this.parent.getRecordByID(predecessorCollection[i].to);
11536
+ if (validateRecord) {
11537
+ this.validatePredecessorDates(validateRecord);
11538
+ }
11539
+ }
11540
+ }
11472
11541
  if (flatData[count].hasChildRecords && this.parent.editModule && !this.parent.allowUnscheduledTasks
11473
11542
  && this.parent.allowParentDependency) {
11474
11543
  this.parent.editModule['updateChildItems'](flatData[count]);
@@ -23992,6 +24061,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23992
24061
  this.isFromDeleteMethod = false;
23993
24062
  this.targetedRecords = [];
23994
24063
  this.isNewRecordAdded = false;
24064
+ this.isValidatedEditedRecord = false;
23995
24065
  /** @hidden */
23996
24066
  this.updateParentRecords = [];
23997
24067
  /** @hidden */
@@ -24646,8 +24716,9 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
24646
24716
  (isNullOrUndefined(taskData.startDate) && !isNullOrUndefined(prevStart)) ||
24647
24717
  (isNullOrUndefined(taskData.endDate) && !isNullOrUndefined(prevEnd)) ||
24648
24718
  (prevStart && prevStart.getTime() !== taskData.startDate.getTime())
24649
- && (prevEnd && prevEnd.getTime() !== taskData.endDate.getTime())
24650
- || (!isNullOrUndefined(prevDuration) && prevDuration !== taskData.duration &&
24719
+ || (prevEnd && prevEnd.getTime() !== taskData.endDate.getTime())
24720
+ || (!isNullOrUndefined(prevDuration) && prevDuration !== taskData.duration)
24721
+ || (!isNullOrUndefined(prevDuration) && prevDuration === taskData.duration &&
24651
24722
  prevDurationUnit !== taskData.durationUnit)) {
24652
24723
  isMoved = true;
24653
24724
  }
@@ -24760,6 +24831,11 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
24760
24831
  this.parent.connectorLineEditModule.openValidationDialog(validateObject);
24761
24832
  }
24762
24833
  else {
24834
+ if (this.parent.editModule && this.parent.editModule.dialogModule &&
24835
+ this.parent.editModule.dialogModule['isEdit'] && this.predecessorUpdated) {
24836
+ this.isValidatedEditedRecord = true;
24837
+ this.parent.predecessorModule.validatePredecessor(args.data, [], '');
24838
+ }
24763
24839
  this.parent.connectorLineEditModule.applyPredecessorOption();
24764
24840
  }
24765
24841
  }
@@ -24823,7 +24899,10 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
24823
24899
  if (this.taskbarMoved) {
24824
24900
  this.parent.editedTaskBarItem = ganttRecord;
24825
24901
  }
24826
- this.parent.predecessorModule.validatePredecessor(ganttRecord, [], '');
24902
+ if (!this.isValidatedEditedRecord) {
24903
+ this.parent.predecessorModule.validatePredecessor(ganttRecord, [], '');
24904
+ }
24905
+ this.isValidatedEditedRecord = false;
24827
24906
  this.parent.predecessorModule.isValidatedParentTaskID = '';
24828
24907
  }
24829
24908
  if (this.parent.allowParentDependency && ganttRecord.hasChildRecords && this.parent.previousRecords[ganttRecord.uniqueID].ganttProperties.startDate &&
@@ -35156,6 +35235,9 @@ var ExportHelper = /** @__PURE__ @class */ (function () {
35156
35235
  footer.graphics.drawRectangle(pen, footerBrush, 0, 0, pdfDoc.pageSettings.width, 35);
35157
35236
  /* eslint-disable-next-line */
35158
35237
  var font = new PdfStandardFont(this.ganttStyle.fontFamily, this.ganttStyle.footer.fontSize, this.ganttStyle.footer.fontStyle);
35238
+ if (this.ganttStyle.font) {
35239
+ font = this.ganttStyle.font;
35240
+ }
35159
35241
  var brush = new PdfSolidBrush(this.ganttStyle.footer.fontColor);
35160
35242
  var pageNumber = new PdfPageNumberField(font);
35161
35243
  var count = new PdfPageCountField(font, brush);