@syncfusion/ej2-gantt 20.4.38 → 20.4.40

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.
@@ -2541,7 +2541,7 @@ class TaskProcessor extends DateProcessor {
2541
2541
  }
2542
2542
  else if (endDate) {
2543
2543
  sDate = new Date(endDate.getTime());
2544
- milestone = true;
2544
+ milestone = isNullOrUndefined(startDate) && this.parent.allowUnscheduledTasks ? false : true;
2545
2545
  }
2546
2546
  else {
2547
2547
  sDate = this.getValidStartDate(ganttProp);
@@ -2664,6 +2664,9 @@ class TaskProcessor extends DateProcessor {
2664
2664
  else if (isMilestone && this.getSecondsInDecimal(date) === this.parent.defaultEndTime) {
2665
2665
  date.setHours(24);
2666
2666
  }
2667
+ else if (this.getSecondsInDecimal(date) === this.parent.defaultEndTime && this.parent.allowUnscheduledTasks) {
2668
+ date.setHours(22);
2669
+ }
2667
2670
  }
2668
2671
  const timelineStartDate = this.parent.timelineModule.timelineStartDate;
2669
2672
  if (timelineStartDate) {
@@ -3637,7 +3640,12 @@ class TaskProcessor extends DateProcessor {
3637
3640
  durationInDay = (childGanttRecord.ganttProperties.duration / (this.parent.secondsPerDay / 60));
3638
3641
  break;
3639
3642
  default:
3640
- durationInDay = childGanttRecord.ganttProperties.duration;
3643
+ if (childGanttRecord.ganttProperties.duration < 1) {
3644
+ durationInDay = (childGanttRecord.ganttProperties.duration / (this.parent.secondsPerDay / 3600));
3645
+ }
3646
+ else {
3647
+ durationInDay = childGanttRecord.ganttProperties.duration;
3648
+ }
3641
3649
  }
3642
3650
  if (childGanttRecord.hasChildRecords) {
3643
3651
  setValue('totalProgress', childGanttRecord.ganttProperties.totalProgress, progressValues);
@@ -3714,7 +3722,13 @@ class TaskProcessor extends DateProcessor {
3714
3722
  if (!childData.ganttProperties.isMilestone && isScheduledTask(childData.ganttProperties)) {
3715
3723
  progressValues = this.getParentProgress(childData);
3716
3724
  totalProgress += getValue('totalProgress', progressValues);
3717
- totalDuration += getValue('totalDuration', progressValues);
3725
+ if (childData[this.parent.taskFields.duration] < 1) {
3726
+ totalDuration += getValue('totalDuration', progressValues);
3727
+ totalDuration = Number(totalDuration.toFixed(4));
3728
+ }
3729
+ else {
3730
+ totalDuration += getValue('totalDuration', progressValues);
3731
+ }
3718
3732
  }
3719
3733
  else {
3720
3734
  milestoneCount++;
@@ -5515,7 +5529,7 @@ class Timeline {
5515
5529
  this.totalTimelineWidth = 0;
5516
5530
  this.customTimelineSettings = null;
5517
5531
  this.parent.isTimelineRoundOff = this.isZoomToFit ? false : isNullOrUndefined(this.parent.projectStartDate) ? true : false;
5518
- if (this.parent.enablePersistence) {
5532
+ if (this.parent.enablePersistence && this.parent.isLoad) {
5519
5533
  this.parent.timelineSettings = this.parent.currentZoomingLevel;
5520
5534
  }
5521
5535
  }
@@ -9501,6 +9515,7 @@ class ChartRows extends DateProcessor {
9501
9515
  }
9502
9516
  this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);
9503
9517
  }
9518
+ this.parent.ganttChartModule.updateLastRowBottomWidth();
9504
9519
  }
9505
9520
  /**
9506
9521
  * To render taskbars.
@@ -9609,9 +9624,9 @@ class ChartRows extends DateProcessor {
9609
9624
  }
9610
9625
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
9611
9626
  this.templateData.ganttProperties.baselineEndDate) {
9612
- taskBaselineTemplateNode = ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
9627
+ 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()))
9613
9628
  && (!isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate) && !isNullOrUndefined(this.templateData.ganttProperties.endDate) && (this.templateData.ganttProperties.baselineEndDate.toLocaleDateString() === this.templateData.ganttProperties.endDate.toLocaleDateString())) &&
9614
- this.templateData.ganttProperties.isMilestone)
9629
+ this.templateData.ganttProperties.isMilestone))
9615
9630
  ? this.getMilestoneBaselineNode() : this.getTaskBaselineNode();
9616
9631
  }
9617
9632
  }
@@ -9622,9 +9637,9 @@ class ChartRows extends DateProcessor {
9622
9637
  }
9623
9638
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
9624
9639
  this.templateData.ganttProperties.baselineEndDate) {
9625
- taskBaselineTemplateNode = ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
9640
+ 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()))
9626
9641
  && (!isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate) && !isNullOrUndefined(this.templateData.ganttProperties.endDate) && (this.templateData.ganttProperties.baselineEndDate.toLocaleDateString() === this.templateData.ganttProperties.endDate.toLocaleDateString())) &&
9627
- this.templateData.ganttProperties.isMilestone)
9642
+ this.templateData.ganttProperties.isMilestone))
9628
9643
  ? this.getMilestoneBaselineNode() : this.getTaskBaselineNode();
9629
9644
  }
9630
9645
  }
@@ -9670,9 +9685,9 @@ class ChartRows extends DateProcessor {
9670
9685
  }
9671
9686
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
9672
9687
  this.templateData.ganttProperties.baselineEndDate) {
9673
- taskBaselineTemplateNode = ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
9688
+ 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()))
9674
9689
  && (!isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate) && !isNullOrUndefined(this.templateData.ganttProperties.endDate) && (this.templateData.ganttProperties.baselineEndDate.toLocaleDateString() === this.templateData.ganttProperties.endDate.toLocaleDateString())) &&
9675
- this.templateData.ganttProperties.isMilestone)
9690
+ this.templateData.ganttProperties.isMilestone))
9676
9691
  ? this.getMilestoneBaselineNode() : this.getTaskBaselineNode();
9677
9692
  }
9678
9693
  }
@@ -9771,6 +9786,10 @@ class ChartRows extends DateProcessor {
9771
9786
  const taskbarElement = !isNullOrUndefined(data.ganttProperties.segments) && data.ganttProperties.segments.length > 0 ? trElement :
9772
9787
  trElement.querySelector('.' + taskBarMainContainer);
9773
9788
  let rowElement;
9789
+ let segmentRowElement;
9790
+ if (data.ganttProperties.segments && data.ganttProperties.segments.length > 0) {
9791
+ segmentRowElement = trElement.parentElement.parentElement.parentElement;
9792
+ }
9774
9793
  let triggerTaskbarElement;
9775
9794
  const args = {
9776
9795
  data: data,
@@ -9783,7 +9802,8 @@ class ChartRows extends DateProcessor {
9783
9802
  args.milestoneColor = taskbarElement.querySelector(classCollections[0]) ?
9784
9803
  getComputedStyle(taskbarElement.querySelector(classCollections[0])).borderBottomColor : null;
9785
9804
  args.baselineColor = trElement.querySelector(classCollections[1]) ?
9786
- getComputedStyle(trElement.querySelector(classCollections[1])).borderBottomColor : null;
9805
+ getComputedStyle(trElement.querySelector(classCollections[1])).borderBottomColor :
9806
+ (trElement.querySelector('.' + baselineBar) ? getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor : null);
9787
9807
  }
9788
9808
  else {
9789
9809
  const childTask = taskbarElement.querySelector(classCollections[0]);
@@ -9800,17 +9820,33 @@ class ChartRows extends DateProcessor {
9800
9820
  getComputedStyle(taskbarElement.querySelector(classCollections[1])).backgroundColor;
9801
9821
  // args.progressBarBorderColor = taskbarElement.querySelector(progressBarClass) ?
9802
9822
  // getComputedStyle(taskbarElement.querySelector(progressBarClass)).borderColor : null;
9803
- args.baselineColor = trElement.querySelector('.' + baselineBar) ?
9804
- getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor : null;
9823
+ if (segmentRowElement) {
9824
+ args.baselineColor = segmentRowElement.querySelector('.' + baselineBar) ?
9825
+ getComputedStyle(segmentRowElement.querySelector('.' + baselineBar)).backgroundColor : null;
9826
+ }
9827
+ else {
9828
+ args.baselineColor = trElement.querySelector('.' + baselineBar) ?
9829
+ getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor : null;
9830
+ }
9805
9831
  args.taskLabelColor = taskbarElement.querySelector('.' + taskLabel) ?
9806
9832
  getComputedStyle(taskbarElement.querySelector('.' + taskLabel)).color : null;
9807
9833
  }
9808
- args.rightLabelColor = trElement.querySelector('.' + rightLabelContainer) &&
9809
- (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) ?
9810
- getComputedStyle((trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color : null;
9811
- args.leftLabelColor = trElement.querySelector('.' + leftLabelContainer) &&
9812
- (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) ?
9813
- getComputedStyle((trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color : null;
9834
+ if (segmentRowElement) {
9835
+ args.rightLabelColor = segmentRowElement.querySelector('.' + rightLabelContainer) &&
9836
+ (segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) ?
9837
+ getComputedStyle((segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color : null;
9838
+ args.leftLabelColor = segmentRowElement.querySelector('.' + leftLabelContainer) &&
9839
+ (segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) ?
9840
+ getComputedStyle((segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color : null;
9841
+ }
9842
+ else {
9843
+ args.rightLabelColor = trElement.querySelector('.' + rightLabelContainer) &&
9844
+ (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) ?
9845
+ getComputedStyle((trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color : null;
9846
+ args.leftLabelColor = trElement.querySelector('.' + leftLabelContainer) &&
9847
+ (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) ?
9848
+ getComputedStyle((trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color : null;
9849
+ }
9814
9850
  this.parent.trigger('queryTaskbarInfo', args, (taskbarArgs) => {
9815
9851
  this.updateQueryTaskbarInfoArgs(taskbarArgs, rowElement, triggerTaskbarElement);
9816
9852
  });
@@ -9828,6 +9864,10 @@ class ChartRows extends DateProcessor {
9828
9864
  const trElement = args.rowElement;
9829
9865
  const taskbarElement = args.taskbarElement;
9830
9866
  const classCollections = this.getClassName(args);
9867
+ let segmentRowElement;
9868
+ if (args.data.ganttProperties.segments && args.data.ganttProperties.segments.length > 0) {
9869
+ segmentRowElement = trElement.parentElement.parentElement.parentElement;
9870
+ }
9831
9871
  if (args.taskbarType === 'Milestone') {
9832
9872
  if (taskbarElement.querySelector(classCollections[0]) &&
9833
9873
  getComputedStyle(taskbarElement.querySelector(classCollections[0])).borderBottomColor !== args.milestoneColor) {
@@ -9839,6 +9879,10 @@ class ChartRows extends DateProcessor {
9839
9879
  trElement.querySelector(classCollections[1]).style.borderBottomColor = args.baselineColor;
9840
9880
  trElement.querySelector('.' + baselineMilestoneBottom).style.borderTopColor = args.baselineColor;
9841
9881
  }
9882
+ if (trElement.querySelector('.' + baselineBar) &&
9883
+ getComputedStyle(trElement.querySelector('.' + baselineBar)).borderTopColor !== args.baselineColor) {
9884
+ trElement.querySelector('.' + baselineBar).style.backgroundColor = args.baselineColor;
9885
+ }
9842
9886
  }
9843
9887
  else {
9844
9888
  if (taskbarElement.querySelector(classCollections[0]) &&
@@ -9873,20 +9917,42 @@ class ChartRows extends DateProcessor {
9873
9917
  getComputedStyle(taskbarElement.querySelector('.' + taskLabel)).color !== args.taskLabelColor) {
9874
9918
  taskbarElement.querySelector('.' + taskLabel).style.color = args.taskLabelColor;
9875
9919
  }
9876
- if (trElement.querySelector('.' + baselineBar) &&
9877
- getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor !== args.baselineColor) {
9878
- trElement.querySelector('.' + baselineBar).style.backgroundColor = args.baselineColor;
9920
+ if (segmentRowElement) {
9921
+ if (segmentRowElement.querySelector('.' + baselineBar) &&
9922
+ getComputedStyle(segmentRowElement.querySelector('.' + baselineBar)).backgroundColor !== args.baselineColor) {
9923
+ segmentRowElement.querySelector('.' + baselineBar).style.backgroundColor = args.baselineColor;
9924
+ }
9925
+ }
9926
+ else {
9927
+ if (trElement.querySelector('.' + baselineBar) &&
9928
+ getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor !== args.baselineColor) {
9929
+ trElement.querySelector('.' + baselineBar).style.backgroundColor = args.baselineColor;
9930
+ }
9879
9931
  }
9880
9932
  }
9881
- if (trElement.querySelector('.' + leftLabelContainer) &&
9882
- (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) &&
9883
- getComputedStyle((trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color !== args.leftLabelColor) {
9884
- (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label).style.color = args.leftLabelColor;
9933
+ if (segmentRowElement) {
9934
+ if (segmentRowElement.querySelector('.' + leftLabelContainer) &&
9935
+ (segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) &&
9936
+ getComputedStyle((segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color !== args.leftLabelColor) {
9937
+ (segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label).style.color = args.leftLabelColor;
9938
+ }
9939
+ if (segmentRowElement.querySelector('.' + rightLabelContainer) &&
9940
+ (segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) &&
9941
+ getComputedStyle((segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color !== args.rightLabelColor) {
9942
+ (segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label).style.color = args.rightLabelColor;
9943
+ }
9885
9944
  }
9886
- if (trElement.querySelector('.' + rightLabelContainer) &&
9887
- (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) &&
9888
- getComputedStyle((trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color !== args.rightLabelColor) {
9889
- (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label).style.color = args.rightLabelColor;
9945
+ else {
9946
+ if (trElement.querySelector('.' + leftLabelContainer) &&
9947
+ (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) &&
9948
+ getComputedStyle((trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color !== args.leftLabelColor) {
9949
+ (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label).style.color = args.leftLabelColor;
9950
+ }
9951
+ if (trElement.querySelector('.' + rightLabelContainer) &&
9952
+ (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) &&
9953
+ getComputedStyle((trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color !== args.rightLabelColor) {
9954
+ (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label).style.color = args.rightLabelColor;
9955
+ }
9890
9956
  }
9891
9957
  }
9892
9958
  getClassName(args) {
@@ -10495,9 +10561,9 @@ class Dependency {
10495
10561
  const flatData = this.parent.flatData;
10496
10562
  const totLength = this.parent.flatData.length;
10497
10563
  for (let count = 0; count < totLength; count++) {
10498
- if (flatData[count].ganttProperties.predecessor) {
10564
+ if (flatData[count].ganttProperties.predecessorsName) {
10499
10565
  this.validatePredecessorDates(flatData[count]);
10500
- if (flatData[count].hasChildRecords && this.parent.editModule) {
10566
+ if (flatData[count].hasChildRecords && this.parent.editModule && !this.parent.allowUnscheduledTasks) {
10501
10567
  this.parent.editModule['updateChildItems'](flatData[count]);
10502
10568
  }
10503
10569
  }
@@ -10509,6 +10575,9 @@ class Dependency {
10509
10575
  for (let i = parentPredecessorLength - 1; i >= 0; i--) {
10510
10576
  let item = this.parentPredecessors[i];
10511
10577
  this.validatePredecessorDates(item);
10578
+ if (item.ganttProperties.startDate) {
10579
+ this.parent.editModule['updateChildItems'](item);
10580
+ }
10512
10581
  }
10513
10582
  }
10514
10583
  }
@@ -15104,18 +15173,24 @@ let Gantt = class Gantt extends Component {
15104
15173
  */
15105
15174
  /* eslint-disable-next-line */
15106
15175
  setRecordValue(field, value, record, isTaskData) {
15176
+ value = isUndefined(value) ? null : value;
15107
15177
  if (this.isOnEdit || this.isOnDelete) {
15108
15178
  this.makeCloneData(field, record, isTaskData);
15109
- const id = isTaskData ? record.rowUniqueID : record.ganttProperties.rowUniqueID;
15179
+ const ganttData = isTaskData ? record : record.ganttProperties;
15180
+ const id = ganttData.rowUniqueID;
15110
15181
  const task = this.getRecordByID(id);
15111
- if (task && this.editedRecords.indexOf(task) === -1) {
15182
+ let isValid = false;
15183
+ if (isNullOrUndefined(value) || (!isNullOrUndefined(value) && !isNullOrUndefined(ganttData[field]) && (value instanceof Date ? value.getTime() !==
15184
+ ganttData[field].getTime() : ganttData[field] !== value))) {
15185
+ isValid = true;
15186
+ }
15187
+ if (task && ((this.editedRecords.indexOf(task) === -1 && isValid) || this.editedRecords.length === 0)) {
15112
15188
  this.editedRecords.push(task);
15113
15189
  if (this.enableImmutableMode) {
15114
15190
  this.modifiedRecords.push(task);
15115
15191
  }
15116
15192
  }
15117
15193
  }
15118
- value = isUndefined(value) ? null : value;
15119
15194
  setValue(field, value, record);
15120
15195
  }
15121
15196
  makeCloneData(field, record, isTaskData) {