gantt-task-react-powern 0.5.9 → 0.6.1

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: " + ~~Math.ceil((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: " + ~~Math.ceil((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
  };
@@ -3505,7 +3505,6 @@ function getCriticalPaths(leafTasks) {
3505
3505
  computeCriticalPath(sortedTaskList[_i4], taskMap);
3506
3506
  }
3507
3507
 
3508
- console.debug(taskMap);
3509
3508
  var taskChainList = [];
3510
3509
 
3511
3510
  for (var _i5 = 0; _i5 < sortedTaskList.length; _i5++) {
@@ -3514,6 +3513,14 @@ function getCriticalPaths(leafTasks) {
3514
3513
  }
3515
3514
  }
3516
3515
 
3516
+ var printedList = taskChainList.map(function (elem) {
3517
+ var newElem = _extends({}, elem);
3518
+
3519
+ newElem.duration = Math.round(elem.duration / 86400000);
3520
+ return newElem;
3521
+ });
3522
+ console.debug(printedList);
3523
+
3517
3524
  if (taskChainList.length > 0) {
3518
3525
  taskChainList.sort(function (a, b) {
3519
3526
  return b.duration - a.duration;
@@ -3625,25 +3632,27 @@ function computeCriticalPath(taskID, taskMap) {
3625
3632
  }
3626
3633
  }
3627
3634
 
3628
- var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap;
3635
+ if (paths.length === 0) {
3636
+ var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap;
3629
3637
 
3630
- if (taskMap[taskID].paths.length < 2) {
3631
- taskMap[taskID].paths.push({
3632
- duration: immediateChildDuration,
3633
- task: dependents[j],
3634
- parent: taskID,
3635
- visited: false
3636
- });
3637
- } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
3638
- taskMap[taskID].paths[0].duration = immediateChildDuration;
3639
- taskMap[taskID].paths[0].task = dependents[j];
3640
- taskMap[taskID].paths[0].parent = taskID;
3641
- taskMap[taskID].paths[0].visited = false;
3642
- } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
3643
- taskMap[taskID].paths[1].duration = immediateChildDuration;
3644
- taskMap[taskID].paths[1].task = dependents[j];
3645
- taskMap[taskID].paths[1].parent = taskID;
3646
- taskMap[taskID].paths[1].visited = false;
3638
+ if (taskMap[taskID].paths.length < 2) {
3639
+ taskMap[taskID].paths.push({
3640
+ duration: immediateChildDuration,
3641
+ task: dependents[j],
3642
+ parent: taskID,
3643
+ visited: false
3644
+ });
3645
+ } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
3646
+ taskMap[taskID].paths[0].duration = immediateChildDuration;
3647
+ taskMap[taskID].paths[0].task = dependents[j];
3648
+ taskMap[taskID].paths[0].parent = taskID;
3649
+ taskMap[taskID].paths[0].visited = false;
3650
+ } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
3651
+ taskMap[taskID].paths[1].duration = immediateChildDuration;
3652
+ taskMap[taskID].paths[1].task = dependents[j];
3653
+ taskMap[taskID].paths[1].parent = taskID;
3654
+ taskMap[taskID].paths[1].visited = false;
3655
+ }
3647
3656
  }
3648
3657
  }
3649
3658
  }