gantt-task-react-powern 0.5.8 → 0.6.0

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.
package/dist/index.js CHANGED
@@ -678,7 +678,7 @@ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
678
678
  }
679
679
  }, task.name + ": Planned dates: "), React__default.createElement("b", null, task.start.getMonth() + 1 + "/" + task.start.getDate() + "/" + task.start.getFullYear() + " - " + (task.end.getMonth() + 1) + "/" + task.end.getDate() + "/" + task.end.getFullYear()), task.end.getTime() - task.start.getTime() !== 0 && React__default.createElement("p", {
680
680
  className: styles$2.tooltipDefaultContainerParagraph
681
- }, "Duration: " + ~~((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React__default.createElement("p", {
681
+ }, "Duration: " + ~~Math.round((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React__default.createElement("p", {
682
682
  className: styles$2.tooltipDefaultContainerParagraph
683
683
  }, !!task.progress && "Progress: " + task.progress + " %"));else return React__default.createElement("div", {
684
684
  className: styles$2.tooltipDefaultContainer,
@@ -689,7 +689,7 @@ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
689
689
  }
690
690
  }, task.name + ": Actual dates: "), React__default.createElement("b", null, task.actualStart.getMonth() + 1 + "/" + task.actualStart.getDate() + "/" + task.actualStart.getFullYear() + " - " + (task.actualEnd.getMonth() + 1) + "/" + task.actualEnd.getDate() + "/" + task.actualEnd.getFullYear()), task.actualEnd.getTime() - task.actualStart.getTime() !== 0 && React__default.createElement("p", {
691
691
  className: styles$2.tooltipDefaultContainerParagraph
692
- }, "Duration: " + ~~((task.actualEnd.getTime() - task.actualStart.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React__default.createElement("p", {
692
+ }, "Duration: " + ~~Math.round((task.actualEnd.getTime() - task.actualStart.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React__default.createElement("p", {
693
693
  className: styles$2.tooltipDefaultContainerParagraph
694
694
  }, !!task.progress && "Progress: " + task.progress + " %"));
695
695
  };
@@ -3597,11 +3597,12 @@ function computeCriticalPath(taskID, taskMap) {
3597
3597
  taskMap[taskID].paths = [];
3598
3598
 
3599
3599
  for (var j = 0; j < dependents.length; j++) {
3600
- var duration = taskMap[dependents[j]].task.end.getTime() - taskMap[dependents[j]].task.start.getTime() - Math.max(taskMap[taskID].end - taskMap[dependents[j]].task.start.getTime(), 0);
3600
+ var depDuration = taskMap[dependents[j]].task.end.getTime() - taskMap[dependents[j]].task.start.getTime();
3601
+ var overlap = Math.max(taskMap[taskID].end - taskMap[dependents[j]].task.start.getTime(), 0);
3601
3602
  var paths = taskMap[dependents[j]].paths;
3602
3603
 
3603
3604
  for (var k = 0; k < paths.length; k++) {
3604
- var totalDuration = taskMap[taskID].end - taskMap[taskID].start + duration + paths[k].duration;
3605
+ var totalDuration = taskMap[taskID].end - taskMap[taskID].start - overlap + paths[k].duration;
3605
3606
 
3606
3607
  if (taskMap[taskID].paths.length < 2) {
3607
3608
  taskMap[taskID].paths.push({
@@ -3623,20 +3624,22 @@ function computeCriticalPath(taskID, taskMap) {
3623
3624
  }
3624
3625
  }
3625
3626
 
3627
+ var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap;
3628
+
3626
3629
  if (taskMap[taskID].paths.length < 2) {
3627
3630
  taskMap[taskID].paths.push({
3628
- duration: duration,
3631
+ duration: immediateChildDuration,
3629
3632
  task: dependents[j],
3630
3633
  parent: taskID,
3631
3634
  visited: false
3632
3635
  });
3633
- } else if (duration > taskMap[taskID].paths[0].duration) {
3634
- taskMap[taskID].paths[0].duration = duration;
3636
+ } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
3637
+ taskMap[taskID].paths[0].duration = immediateChildDuration;
3635
3638
  taskMap[taskID].paths[0].task = dependents[j];
3636
3639
  taskMap[taskID].paths[0].parent = taskID;
3637
3640
  taskMap[taskID].paths[0].visited = false;
3638
- } else if (duration > taskMap[taskID].paths[1].duration) {
3639
- taskMap[taskID].paths[1].duration = duration;
3641
+ } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
3642
+ taskMap[taskID].paths[1].duration = immediateChildDuration;
3640
3643
  taskMap[taskID].paths[1].task = dependents[j];
3641
3644
  taskMap[taskID].paths[1].parent = taskID;
3642
3645
  taskMap[taskID].paths[1].visited = false;