@syncfusion/ej2-gantt 24.1.44 → 24.1.45

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.
@@ -3848,14 +3848,11 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
3848
3848
  */
3849
3849
  TaskProcessor.prototype.updateWidthLeft = function (data) {
3850
3850
  var ganttRecord = data.ganttProperties;
3851
+ var totalSegmentsProgressWidth = 0;
3851
3852
  // task endDate may be changed in segment calculation so this must be calculated first.
3852
3853
  // task width calculating was based on endDate
3853
3854
  if (!isNullOrUndefined(ganttRecord.segments) && ganttRecord.segments.length > 0) {
3854
3855
  var segments = ganttRecord.segments;
3855
- var fixedWidth = true;
3856
- var totalTaskWidth = this.splitTasksDuration(segments) * ((this.parent.timelineModule.bottomTier === "Hour" || this.parent.timelineModule.bottomTier === "Minutes") ? this.parent.timelineSettings.timelineUnitSize : this.parent.perDayWidth);
3857
-
3858
- var totalProgressWidth = this.parent.dataOperation.getProgressWidth(totalTaskWidth, ganttRecord.progress);
3859
3856
  for (var i = 0; i < segments.length; i++) {
3860
3857
  var segment = segments[i];
3861
3858
  if (i === 0 && !isNullOrUndefined(ganttRecord.startDate) &&
@@ -3866,22 +3863,27 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
3866
3863
  this.parent.chartRowsModule.incrementSegments(segments, 0, data);
3867
3864
  }
3868
3865
  segment.width = this.getSplitTaskWidth(segment.startDate, segment.duration, data);
3866
+ totalSegmentsProgressWidth = totalSegmentsProgressWidth + segment.width;
3869
3867
  segment.showProgress = false;
3870
3868
  segment.progressWidth = -1;
3871
3869
  if (i !== 0) {
3872
3870
  var pStartDate = new Date(ganttRecord.startDate.getTime());
3873
3871
  segment.left = this.getSplitTaskLeft(segment.startDate, pStartDate);
3874
3872
  }
3875
- if (totalProgressWidth > 0 && totalProgressWidth > segment.width) {
3876
- totalProgressWidth = totalProgressWidth - segment.width;
3877
- segment.progressWidth = segment.width;
3878
- segment.showProgress = false;
3879
- }
3880
- else if (fixedWidth) {
3881
- segment.progressWidth = totalProgressWidth;
3882
- segment.showProgress = true;
3883
- totalProgressWidth = totalProgressWidth - segment.width;
3884
- fixedWidth = false;
3873
+ }
3874
+ var setProgress = this.parent.dataOperation.getProgressWidth(totalSegmentsProgressWidth, ganttRecord.progress);
3875
+ var isValid = true;
3876
+ for (var i = 0; i < segments.length; i++) {
3877
+ if (isValid) {
3878
+ if (setProgress <= segments[i].width) {
3879
+ segments[i].progressWidth = setProgress;
3880
+ segments[i].showProgress = true;
3881
+ isValid = false;
3882
+ }
3883
+ else {
3884
+ segments[i].progressWidth = segments[i].width;
3885
+ setProgress = setProgress - segments[i].progressWidth;
3886
+ }
3885
3887
  }
3886
3888
  }
3887
3889
  this.parent.setRecordValue('segments', ganttRecord.segments, ganttRecord, true);
@@ -3889,7 +3891,12 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
3889
3891
  }
3890
3892
  this.parent.setRecordValue('width', this.parent.dataOperation.calculateWidth(data), ganttRecord, true);
3891
3893
  this.parent.setRecordValue('left', this.parent.dataOperation.calculateLeft(ganttRecord), ganttRecord, true);
3892
- this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth((ganttRecord.isAutoSchedule || !data.hasChildRecords ? ganttRecord.width : ganttRecord.autoWidth), ganttRecord.progress), ganttRecord, true);
3894
+ if (!isNullOrUndefined(ganttRecord.segments) && ganttRecord.segments.length > 0) {
3895
+ this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth(totalSegmentsProgressWidth, ganttRecord.progress), ganttRecord, true);
3896
+ }
3897
+ else {
3898
+ this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth((ganttRecord.isAutoSchedule || !data.hasChildRecords ? ganttRecord.width : ganttRecord.autoWidth), ganttRecord.progress), ganttRecord, true);
3899
+ }
3893
3900
  };
3894
3901
  /**
3895
3902
  * method to update left, width, progress width in record
@@ -24408,6 +24415,9 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
24408
24415
  var ganttObj = this.parent;
24409
24416
  var resourceSettings = ganttObj.resourceFields;
24410
24417
  var ganttData = this.beforeOpenArgs.rowData;
24418
+ if (((this.beforeOpenArgs.requestType === 'beforeOpenEditDialog' && !isNullOrUndefined(this.editedRecord[this.parent.taskFields.resourceInfo])) || (this.beforeOpenArgs.requestType === 'beforeOpenAddDialog' && !isNullOrUndefined(this.editedRecord[this.parent.taskFields.resourceInfo]))) && (typeof (this.editedRecord[this.parent.taskFields.resourceInfo]) === "object")) {
24419
+ this.parent.setRecordValue('resourceInfo', this.parent.dataOperation.setResourceInfo(this.editedRecord), ganttData.ganttProperties, true);
24420
+ }
24411
24421
  var rowResource = ganttData.ganttProperties.resourceInfo;
24412
24422
  var inputModel = this.beforeOpenArgs[itemName];
24413
24423
  var resourceTreeGridId = ganttObj.element.id + '' + itemName + 'TabContainer';
@@ -24446,6 +24456,11 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
24446
24456
  this.ganttResources.push(resourceInfo[i]);
24447
24457
  }
24448
24458
  }
24459
+ else if (!this.isEdit && !isNullOrUndefined(resourceInfo)) {
24460
+ for (var i = 0; i < resourceInfo.length; i++) {
24461
+ this.ganttResources.push(resourceInfo[i]);
24462
+ }
24463
+ }
24449
24464
  inputModel.rowSelected = function (args) {
24450
24465
  _this.updateResourceCollection(args, resourceTreeGridId);
24451
24466
  };
@@ -24857,7 +24872,14 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
24857
24872
  }
24858
24873
  }
24859
24874
  else {
24860
- tasksData[fieldName] = controlObj.value;
24875
+ if (fieldName === "Duration") {
24876
+ var numericValue = parseFloat(String(controlObj.value));
24877
+
24878
+ tasksData[fieldName] = numericValue;
24879
+ }
24880
+ else {
24881
+ tasksData[fieldName] = controlObj.value;
24882
+ }
24861
24883
  if (this.parent.enableHtmlSanitizer && typeof (controlObj.value) === 'string') {
24862
24884
  controlObj.value = SanitizeHtmlHelper.sanitize(controlObj.value);
24863
24885
  tasksData[fieldName] = controlObj.value;
@@ -27551,9 +27573,11 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
27551
27573
  var taskID = updateRecord.ganttProperties.taskId;
27552
27574
  var resourceID = prevResource[index][this.parent.resourceFields.id];
27553
27575
  var record = flatRecords[this.parent.getTaskIds().indexOf('R' + resourceID)];
27554
- for (var j = 0; j < record.childRecords.length; j++) {
27555
- if (record.childRecords[j].ganttProperties.taskId === taskID) {
27556
- this.removeChildRecord(record.childRecords[j]);
27576
+ if (!isNullOrUndefined(record)) {
27577
+ for (var j = 0; j < record.childRecords.length; j++) {
27578
+ if (record.childRecords[j].ganttProperties.taskId === taskID) {
27579
+ this.removeChildRecord(record.childRecords[j]);
27580
+ }
27557
27581
  }
27558
27582
  }
27559
27583
  }
@@ -29107,7 +29131,6 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
29107
29131
  addedRecords: [args.newTaskData],
29108
29132
  changedRecords: args.modifiedTaskData
29109
29133
  };
29110
- var prevID_1 = args.data.ganttProperties.taskId.toString();
29111
29134
  /* tslint:disable-next-line */
29112
29135
  var query = _this.parent.query instanceof Query ? _this.parent.query : new Query();
29113
29136
  var adaptor = data_2.adaptor;
@@ -29115,14 +29138,21 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
29115
29138
  /* tslint:disable-next-line */
29116
29139
  var crud = data_2.saveChanges(updatedData_2, _this.parent.taskFields.id, null, query);
29117
29140
  crud.then(function (e) {
29141
+ if (e.addedRecords[0][_this.parent.taskFields.id].toString() != args.data['ganttProperties']['taskId']) {
29142
+ args.data['ganttProperties']['taskId'] = e.addedRecords[0][_this.parent.taskFields.id].toString();
29143
+ args.newTaskData[tempTaskID] = e.addedRecords[0][_this.parent.taskFields.id].toString();
29144
+ args.data['ganttProperties']['rowUniqueID'] = e.addedRecords[0][_this.parent.taskFields.id].toString();
29145
+ _this.parent.ids.push(e.addedRecords[0][_this.parent.taskFields.id].toString());
29146
+ }
29147
+ var prevID = args.data.ganttProperties.taskId.toString();
29118
29148
  if (_this.parent.taskFields.id && !isNullOrUndefined(e.addedRecords[0][_this.parent.taskFields.id]) &&
29119
- e.addedRecords[0][_this.parent.taskFields.id].toString() == prevID_1) {
29149
+ e.addedRecords[0][_this.parent.taskFields.id].toString() == prevID) {
29120
29150
  _this.parent.setRecordValue('taskId', e.addedRecords[0][_this.parent.taskFields.id], args.data.ganttProperties, true);
29121
29151
  _this.parent.setRecordValue('taskData', e.addedRecords[0], args.data);
29122
29152
  _this.parent.setRecordValue(_this.parent.taskFields.id, e.addedRecords[0][_this.parent.taskFields.id], args.data);
29123
29153
  _this.parent.setRecordValue('rowUniqueID', e.addedRecords[0][_this.parent.taskFields.id].toString(), args.data.ganttProperties, true);
29124
29154
  _this.updateClientDataFromServer(e, args);
29125
- var idsIndex = _this.parent.ids.indexOf(prevID_1);
29155
+ var idsIndex = _this.parent.ids.indexOf(prevID);
29126
29156
  if (idsIndex !== -1) {
29127
29157
  _this.parent.ids[idsIndex] = e.addedRecords[0][_this.parent.taskFields.id].toString();
29128
29158
  }
@@ -38337,13 +38367,22 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
38337
38367
  progressFormat.alignment = PdfTextAlignment.Left;
38338
38368
  }
38339
38369
  var pageIndex = -1;
38370
+ var renderBaselineWidth = 0;
38371
+ if (this.baselineWidth > detail.totalWidth) {
38372
+ renderBaselineWidth = detail.totalWidth;
38373
+ this.baselineWidth = this.baselineWidth - detail.totalWidth;
38374
+ }
38375
+ else {
38376
+ renderBaselineWidth = this.baselineWidth;
38377
+ }
38378
+ var baselinePen = new PdfPen(taskbar.baselineBorderColor);
38379
+ var baselineBrush = new PdfSolidBrush(taskbar.baselineColor);
38380
+ var renderedBaseline = false;
38340
38381
  if (!taskbar.isMilestone) {
38341
38382
  var taskbarPen_1 = new PdfPen(taskbar.taskBorderColor);
38342
38383
  var taskBrush_1 = new PdfSolidBrush(taskbar.taskColor);
38343
- var baselinePen = new PdfPen(taskbar.baselineBorderColor);
38344
38384
  var manualParentBorderPen = new PdfPen(taskbar.manualParentBorder);
38345
38385
  var manualChildBorderPen = new PdfPen(taskbar.manualChildBorder);
38346
- var baselineBrush = new PdfSolidBrush(taskbar.baselineColor);
38347
38386
  var manualTaskbarPen = new PdfPen(taskbar.manuallineColor);
38348
38387
  var manualParentPen = new PdfPen(taskbar.manualParentProgress);
38349
38388
  var manualline = new PdfPen(taskbar.manuallineColor);
@@ -38414,11 +38453,12 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
38414
38453
  else {
38415
38454
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
38416
38455
  if (this.isAutoFit()) {
38417
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
38456
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
38418
38457
  }
38419
38458
  else {
38420
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
38459
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
38421
38460
  }
38461
+ renderedBaseline = true;
38422
38462
  }
38423
38463
  if (taskbar.isSpliterTask) {
38424
38464
  splitline.dashStyle = PdfDashStyle.Dot;
@@ -38631,11 +38671,12 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
38631
38671
  else {
38632
38672
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
38633
38673
  if (this.isAutoFit()) {
38634
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
38674
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
38635
38675
  }
38636
38676
  else {
38637
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
38677
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
38638
38678
  }
38679
+ renderedBaseline = true;
38639
38680
  }
38640
38681
  if (taskbar.isSpliterTask) {
38641
38682
  var pervwidth_1 = 0;
@@ -38792,11 +38833,12 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
38792
38833
  }
38793
38834
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
38794
38835
  if (this.isAutoFit()) {
38795
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
38836
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
38796
38837
  }
38797
38838
  else {
38798
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
38839
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
38799
38840
  }
38841
+ renderedBaseline = true;
38800
38842
  }
38801
38843
  if (!this.isScheduledTask && this.unscheduledTaskBy === 'duration') {
38802
38844
  var brush1 = void 0;
@@ -38948,11 +38990,12 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
38948
38990
  }
38949
38991
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
38950
38992
  if (this.isAutoFit()) {
38951
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
38993
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
38952
38994
  }
38953
38995
  else {
38954
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
38996
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight_1 + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
38955
38997
  }
38998
+ renderedBaseline = true;
38956
38999
  }
38957
39000
  if (!this.isScheduledTask && this.unscheduledTaskBy === 'duration') {
38958
39001
  var brush1 = void 0;
@@ -39173,6 +39216,15 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
39173
39216
  this.drawMilestone(page, startPoint, detail, cumulativeWidth);
39174
39217
  }
39175
39218
  }
39219
+ if (this.baselineEndDate >= detail.startDate && !renderedBaseline && detail.startIndex != 1 && this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
39220
+ var adjustHeight = pixelToPoint((this.parent.rowHeight - this.height) / 4.5);
39221
+ if (this.isAutoFit()) {
39222
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
39223
+ }
39224
+ else {
39225
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
39226
+ }
39227
+ }
39176
39228
  this.drawRightLabel(page, startPoint, detail, cumulativeWidth);
39177
39229
  return isNextPage;
39178
39230
  };