@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.
@@ -3802,14 +3802,11 @@ class TaskProcessor extends DateProcessor {
3802
3802
  */
3803
3803
  updateWidthLeft(data) {
3804
3804
  const ganttRecord = data.ganttProperties;
3805
+ let totalSegmentsProgressWidth = 0;
3805
3806
  // task endDate may be changed in segment calculation so this must be calculated first.
3806
3807
  // task width calculating was based on endDate
3807
3808
  if (!isNullOrUndefined(ganttRecord.segments) && ganttRecord.segments.length > 0) {
3808
3809
  const segments = ganttRecord.segments;
3809
- let fixedWidth = true;
3810
- const totalTaskWidth = this.splitTasksDuration(segments) * ((this.parent.timelineModule.bottomTier === "Hour" || this.parent.timelineModule.bottomTier === "Minutes") ? this.parent.timelineSettings.timelineUnitSize : this.parent.perDayWidth);
3811
-
3812
- let totalProgressWidth = this.parent.dataOperation.getProgressWidth(totalTaskWidth, ganttRecord.progress);
3813
3810
  for (let i = 0; i < segments.length; i++) {
3814
3811
  const segment = segments[i];
3815
3812
  if (i === 0 && !isNullOrUndefined(ganttRecord.startDate) &&
@@ -3820,22 +3817,27 @@ class TaskProcessor extends DateProcessor {
3820
3817
  this.parent.chartRowsModule.incrementSegments(segments, 0, data);
3821
3818
  }
3822
3819
  segment.width = this.getSplitTaskWidth(segment.startDate, segment.duration, data);
3820
+ totalSegmentsProgressWidth = totalSegmentsProgressWidth + segment.width;
3823
3821
  segment.showProgress = false;
3824
3822
  segment.progressWidth = -1;
3825
3823
  if (i !== 0) {
3826
3824
  const pStartDate = new Date(ganttRecord.startDate.getTime());
3827
3825
  segment.left = this.getSplitTaskLeft(segment.startDate, pStartDate);
3828
3826
  }
3829
- if (totalProgressWidth > 0 && totalProgressWidth > segment.width) {
3830
- totalProgressWidth = totalProgressWidth - segment.width;
3831
- segment.progressWidth = segment.width;
3832
- segment.showProgress = false;
3833
- }
3834
- else if (fixedWidth) {
3835
- segment.progressWidth = totalProgressWidth;
3836
- segment.showProgress = true;
3837
- totalProgressWidth = totalProgressWidth - segment.width;
3838
- fixedWidth = false;
3827
+ }
3828
+ let setProgress = this.parent.dataOperation.getProgressWidth(totalSegmentsProgressWidth, ganttRecord.progress);
3829
+ let isValid = true;
3830
+ for (let i = 0; i < segments.length; i++) {
3831
+ if (isValid) {
3832
+ if (setProgress <= segments[i].width) {
3833
+ segments[i].progressWidth = setProgress;
3834
+ segments[i].showProgress = true;
3835
+ isValid = false;
3836
+ }
3837
+ else {
3838
+ segments[i].progressWidth = segments[i].width;
3839
+ setProgress = setProgress - segments[i].progressWidth;
3840
+ }
3839
3841
  }
3840
3842
  }
3841
3843
  this.parent.setRecordValue('segments', ganttRecord.segments, ganttRecord, true);
@@ -3843,7 +3845,12 @@ class TaskProcessor extends DateProcessor {
3843
3845
  }
3844
3846
  this.parent.setRecordValue('width', this.parent.dataOperation.calculateWidth(data), ganttRecord, true);
3845
3847
  this.parent.setRecordValue('left', this.parent.dataOperation.calculateLeft(ganttRecord), ganttRecord, true);
3846
- this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth((ganttRecord.isAutoSchedule || !data.hasChildRecords ? ganttRecord.width : ganttRecord.autoWidth), ganttRecord.progress), ganttRecord, true);
3848
+ if (!isNullOrUndefined(ganttRecord.segments) && ganttRecord.segments.length > 0) {
3849
+ this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth(totalSegmentsProgressWidth, ganttRecord.progress), ganttRecord, true);
3850
+ }
3851
+ else {
3852
+ this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth((ganttRecord.isAutoSchedule || !data.hasChildRecords ? ganttRecord.width : ganttRecord.autoWidth), ganttRecord.progress), ganttRecord, true);
3853
+ }
3847
3854
  }
3848
3855
  /**
3849
3856
  * method to update left, width, progress width in record
@@ -23903,6 +23910,9 @@ class DialogEdit {
23903
23910
  const ganttObj = this.parent;
23904
23911
  const resourceSettings = ganttObj.resourceFields;
23905
23912
  const ganttData = this.beforeOpenArgs.rowData;
23913
+ 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")) {
23914
+ this.parent.setRecordValue('resourceInfo', this.parent.dataOperation.setResourceInfo(this.editedRecord), ganttData.ganttProperties, true);
23915
+ }
23906
23916
  const rowResource = ganttData.ganttProperties.resourceInfo;
23907
23917
  const inputModel = this.beforeOpenArgs[itemName];
23908
23918
  const resourceTreeGridId = ganttObj.element.id + '' + itemName + 'TabContainer';
@@ -23941,6 +23951,11 @@ class DialogEdit {
23941
23951
  this.ganttResources.push(resourceInfo[i]);
23942
23952
  }
23943
23953
  }
23954
+ else if (!this.isEdit && !isNullOrUndefined(resourceInfo)) {
23955
+ for (let i = 0; i < resourceInfo.length; i++) {
23956
+ this.ganttResources.push(resourceInfo[i]);
23957
+ }
23958
+ }
23944
23959
  inputModel.rowSelected = (args) => {
23945
23960
  this.updateResourceCollection(args, resourceTreeGridId);
23946
23961
  };
@@ -24349,7 +24364,14 @@ class DialogEdit {
24349
24364
  }
24350
24365
  }
24351
24366
  else {
24352
- tasksData[fieldName] = controlObj.value;
24367
+ if (fieldName === "Duration") {
24368
+ let numericValue = parseFloat(String(controlObj.value));
24369
+
24370
+ tasksData[fieldName] = numericValue;
24371
+ }
24372
+ else {
24373
+ tasksData[fieldName] = controlObj.value;
24374
+ }
24353
24375
  if (this.parent.enableHtmlSanitizer && typeof (controlObj.value) === 'string') {
24354
24376
  controlObj.value = SanitizeHtmlHelper.sanitize(controlObj.value);
24355
24377
  tasksData[fieldName] = controlObj.value;
@@ -27002,9 +27024,11 @@ class Edit$2 {
27002
27024
  const taskID = updateRecord.ganttProperties.taskId;
27003
27025
  const resourceID = prevResource[index][this.parent.resourceFields.id];
27004
27026
  const record = flatRecords[this.parent.getTaskIds().indexOf('R' + resourceID)];
27005
- for (let j = 0; j < record.childRecords.length; j++) {
27006
- if (record.childRecords[j].ganttProperties.taskId === taskID) {
27007
- this.removeChildRecord(record.childRecords[j]);
27027
+ if (!isNullOrUndefined(record)) {
27028
+ for (let j = 0; j < record.childRecords.length; j++) {
27029
+ if (record.childRecords[j].ganttProperties.taskId === taskID) {
27030
+ this.removeChildRecord(record.childRecords[j]);
27031
+ }
27008
27032
  }
27009
27033
  }
27010
27034
  }
@@ -28543,7 +28567,6 @@ class Edit$2 {
28543
28567
  addedRecords: [args.newTaskData],
28544
28568
  changedRecords: args.modifiedTaskData
28545
28569
  };
28546
- const prevID = args.data.ganttProperties.taskId.toString();
28547
28570
  /* tslint:disable-next-line */
28548
28571
  const query = this.parent.query instanceof Query ? this.parent.query : new Query();
28549
28572
  const adaptor = data.adaptor;
@@ -28551,6 +28574,13 @@ class Edit$2 {
28551
28574
  /* tslint:disable-next-line */
28552
28575
  const crud = data.saveChanges(updatedData, this.parent.taskFields.id, null, query);
28553
28576
  crud.then((e) => {
28577
+ if (e.addedRecords[0][this.parent.taskFields.id].toString() != args.data['ganttProperties']['taskId']) {
28578
+ args.data['ganttProperties']['taskId'] = e.addedRecords[0][this.parent.taskFields.id].toString();
28579
+ args.newTaskData[tempTaskID] = e.addedRecords[0][this.parent.taskFields.id].toString();
28580
+ args.data['ganttProperties']['rowUniqueID'] = e.addedRecords[0][this.parent.taskFields.id].toString();
28581
+ this.parent.ids.push(e.addedRecords[0][this.parent.taskFields.id].toString());
28582
+ }
28583
+ const prevID = args.data.ganttProperties.taskId.toString();
28554
28584
  if (this.parent.taskFields.id && !isNullOrUndefined(e.addedRecords[0][this.parent.taskFields.id]) &&
28555
28585
  e.addedRecords[0][this.parent.taskFields.id].toString() == prevID) {
28556
28586
  this.parent.setRecordValue('taskId', e.addedRecords[0][this.parent.taskFields.id], args.data.ganttProperties, true);
@@ -37451,13 +37481,22 @@ class PdfGanttTaskbarCollection {
37451
37481
  progressFormat.alignment = PdfTextAlignment.Left;
37452
37482
  }
37453
37483
  let pageIndex = -1;
37484
+ let renderBaselineWidth = 0;
37485
+ if (this.baselineWidth > detail.totalWidth) {
37486
+ renderBaselineWidth = detail.totalWidth;
37487
+ this.baselineWidth = this.baselineWidth - detail.totalWidth;
37488
+ }
37489
+ else {
37490
+ renderBaselineWidth = this.baselineWidth;
37491
+ }
37492
+ const baselinePen = new PdfPen(taskbar.baselineBorderColor);
37493
+ const baselineBrush = new PdfSolidBrush(taskbar.baselineColor);
37494
+ let renderedBaseline = false;
37454
37495
  if (!taskbar.isMilestone) {
37455
37496
  const taskbarPen = new PdfPen(taskbar.taskBorderColor);
37456
37497
  const taskBrush = new PdfSolidBrush(taskbar.taskColor);
37457
- const baselinePen = new PdfPen(taskbar.baselineBorderColor);
37458
37498
  const manualParentBorderPen = new PdfPen(taskbar.manualParentBorder);
37459
37499
  const manualChildBorderPen = new PdfPen(taskbar.manualChildBorder);
37460
- const baselineBrush = new PdfSolidBrush(taskbar.baselineColor);
37461
37500
  const manualTaskbarPen = new PdfPen(taskbar.manuallineColor);
37462
37501
  const manualParentPen = new PdfPen(taskbar.manualParentProgress);
37463
37502
  const manualline = new PdfPen(taskbar.manuallineColor);
@@ -37528,11 +37567,12 @@ class PdfGanttTaskbarCollection {
37528
37567
  else {
37529
37568
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
37530
37569
  if (this.isAutoFit()) {
37531
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
37570
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
37532
37571
  }
37533
37572
  else {
37534
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
37573
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
37535
37574
  }
37575
+ renderedBaseline = true;
37536
37576
  }
37537
37577
  if (taskbar.isSpliterTask) {
37538
37578
  splitline.dashStyle = PdfDashStyle.Dot;
@@ -37745,11 +37785,12 @@ class PdfGanttTaskbarCollection {
37745
37785
  else {
37746
37786
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
37747
37787
  if (this.isAutoFit()) {
37748
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
37788
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
37749
37789
  }
37750
37790
  else {
37751
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
37791
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
37752
37792
  }
37793
+ renderedBaseline = true;
37753
37794
  }
37754
37795
  if (taskbar.isSpliterTask) {
37755
37796
  let pervwidth = 0;
@@ -37906,11 +37947,12 @@ class PdfGanttTaskbarCollection {
37906
37947
  }
37907
37948
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
37908
37949
  if (this.isAutoFit()) {
37909
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
37950
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
37910
37951
  }
37911
37952
  else {
37912
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
37953
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
37913
37954
  }
37955
+ renderedBaseline = true;
37914
37956
  }
37915
37957
  if (!this.isScheduledTask && this.unscheduledTaskBy === 'duration') {
37916
37958
  let brush1;
@@ -38062,11 +38104,12 @@ class PdfGanttTaskbarCollection {
38062
38104
  }
38063
38105
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
38064
38106
  if (this.isAutoFit()) {
38065
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
38107
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
38066
38108
  }
38067
38109
  else {
38068
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
38110
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
38069
38111
  }
38112
+ renderedBaseline = true;
38070
38113
  }
38071
38114
  if (!this.isScheduledTask && this.unscheduledTaskBy === 'duration') {
38072
38115
  let brush1;
@@ -38287,6 +38330,15 @@ class PdfGanttTaskbarCollection {
38287
38330
  this.drawMilestone(page, startPoint, detail, cumulativeWidth);
38288
38331
  }
38289
38332
  }
38333
+ if (this.baselineEndDate >= detail.startDate && !renderedBaseline && detail.startIndex != 1 && this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
38334
+ const adjustHeight = pixelToPoint((this.parent.rowHeight - this.height) / 4.5);
38335
+ if (this.isAutoFit()) {
38336
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
38337
+ }
38338
+ else {
38339
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
38340
+ }
38341
+ }
38290
38342
  this.drawRightLabel(page, startPoint, detail, cumulativeWidth);
38291
38343
  return isNextPage;
38292
38344
  }