gantt-task-react-powern 0.6.25 → 0.6.26

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
@@ -4646,8 +4646,6 @@ function computeCriticalPath(taskID, taskMap) {
4646
4646
  taskMap[taskID].paths = [];
4647
4647
 
4648
4648
  for (var j = 0; j < dependents.length; j++) {
4649
- var _taskMap$dependents$j, _taskMap$dependents$j2, _taskMap$dependents$j3, _taskMap$dependents$j4;
4650
-
4651
4649
  var depStart = taskMap[dependents[j]].task.start.getTime();
4652
4650
  var depEnd = taskMap[dependents[j]].task.end.getTime();
4653
4651
  var depDuration = depEnd - depStart;
@@ -4655,7 +4653,7 @@ function computeCriticalPath(taskID, taskMap) {
4655
4653
  var endWeek = Math.floor((depEnd / 86400000 + 4) / 7);
4656
4654
  var offTime = 0;
4657
4655
 
4658
- if ((_taskMap$dependents$j = taskMap[dependents[j]].task.calendar) !== null && _taskMap$dependents$j !== void 0 && (_taskMap$dependents$j2 = _taskMap$dependents$j.off_days) !== null && _taskMap$dependents$j2 !== void 0 && _taskMap$dependents$j2.length) {
4656
+ if (taskMap[dependents[j]].task.calendar.off_days && taskMap[dependents[j]].task.calendar.off_days.length) {
4659
4657
  for (var d = 0; d < taskMap[dependents[j]].task.calendar.off_days.length || 0; d++) {
4660
4658
  for (var w = startWeek; w <= endWeek; w++) {
4661
4659
  var dayOfTheWeek = taskMap[dependents[j]].task.calendar.off_days[d];
@@ -4668,7 +4666,7 @@ function computeCriticalPath(taskID, taskMap) {
4668
4666
  }
4669
4667
  }
4670
4668
 
4671
- if ((_taskMap$dependents$j3 = taskMap[dependents[j]].task.calendar) !== null && _taskMap$dependents$j3 !== void 0 && (_taskMap$dependents$j4 = _taskMap$dependents$j3.holidays) !== null && _taskMap$dependents$j4 !== void 0 && _taskMap$dependents$j4.length) {
4669
+ if (taskMap[dependents[j]].task.calendar.holidays && taskMap[dependents[j]].task.calendar.holidays.length) {
4672
4670
  for (var h = 0; h < taskMap[dependents[j]].task.calendar.holidays.length || 0; h++) {
4673
4671
  var holiday = taskMap[dependents[j]].task.calendar.holidays[h];
4674
4672
 
@@ -4681,49 +4679,51 @@ function computeCriticalPath(taskID, taskMap) {
4681
4679
  var overlap = Math.max(taskMap[taskID].end - depStart, 0);
4682
4680
  var paths = taskMap[dependents[j]].paths;
4683
4681
 
4684
- for (var k = 0; k < (paths === null || paths === void 0 ? void 0 : paths.length); k++) {
4685
- var totalDuration = taskMap[taskID].end - taskMap[taskID].start - overlap - offTime + paths[k].duration;
4682
+ if (paths && paths.length) {
4683
+ for (var k = 0; k < paths.length; k++) {
4684
+ var totalDuration = taskMap[taskID].end - taskMap[taskID].start - overlap - offTime + paths[k].duration;
4686
4685
 
4687
- if (taskMap[taskID].paths.length < 2) {
4688
- taskMap[taskID].paths.push({
4689
- duration: totalDuration,
4690
- task: dependents[j],
4691
- parent: taskID,
4692
- visited: false
4693
- });
4694
- } else if (totalDuration > taskMap[taskID].paths[0].duration) {
4695
- taskMap[taskID].paths[0].duration = totalDuration;
4696
- taskMap[taskID].paths[0].task = dependents[j];
4697
- taskMap[taskID].paths[0].parent = taskID;
4698
- taskMap[taskID].paths[0].visited = false;
4699
- } else if (totalDuration > taskMap[taskID].paths[1].duration) {
4700
- taskMap[taskID].paths[1].duration = totalDuration;
4701
- taskMap[taskID].paths[1].task = dependents[j];
4702
- taskMap[taskID].paths[1].parent = taskID;
4703
- taskMap[taskID].paths[1].visited = false;
4686
+ if (taskMap[taskID].paths.length < 2) {
4687
+ taskMap[taskID].paths.push({
4688
+ duration: totalDuration,
4689
+ task: dependents[j],
4690
+ parent: taskID,
4691
+ visited: false
4692
+ });
4693
+ } else if (totalDuration > taskMap[taskID].paths[0].duration) {
4694
+ taskMap[taskID].paths[0].duration = totalDuration;
4695
+ taskMap[taskID].paths[0].task = dependents[j];
4696
+ taskMap[taskID].paths[0].parent = taskID;
4697
+ taskMap[taskID].paths[0].visited = false;
4698
+ } else if (totalDuration > taskMap[taskID].paths[1].duration) {
4699
+ taskMap[taskID].paths[1].duration = totalDuration;
4700
+ taskMap[taskID].paths[1].task = dependents[j];
4701
+ taskMap[taskID].paths[1].parent = taskID;
4702
+ taskMap[taskID].paths[1].visited = false;
4703
+ }
4704
4704
  }
4705
- }
4706
4705
 
4707
- if ((paths === null || paths === void 0 ? void 0 : paths.length) === 0) {
4708
- var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap - offTime;
4706
+ if (paths.length === 0) {
4707
+ var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap - offTime;
4709
4708
 
4710
- if (taskMap[taskID].paths.length < 2) {
4711
- taskMap[taskID].paths.push({
4712
- duration: immediateChildDuration,
4713
- task: dependents[j],
4714
- parent: taskID,
4715
- visited: false
4716
- });
4717
- } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
4718
- taskMap[taskID].paths[0].duration = immediateChildDuration;
4719
- taskMap[taskID].paths[0].task = dependents[j];
4720
- taskMap[taskID].paths[0].parent = taskID;
4721
- taskMap[taskID].paths[0].visited = false;
4722
- } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
4723
- taskMap[taskID].paths[1].duration = immediateChildDuration;
4724
- taskMap[taskID].paths[1].task = dependents[j];
4725
- taskMap[taskID].paths[1].parent = taskID;
4726
- taskMap[taskID].paths[1].visited = false;
4709
+ if (taskMap[taskID].paths.length < 2) {
4710
+ taskMap[taskID].paths.push({
4711
+ duration: immediateChildDuration,
4712
+ task: dependents[j],
4713
+ parent: taskID,
4714
+ visited: false
4715
+ });
4716
+ } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
4717
+ taskMap[taskID].paths[0].duration = immediateChildDuration;
4718
+ taskMap[taskID].paths[0].task = dependents[j];
4719
+ taskMap[taskID].paths[0].parent = taskID;
4720
+ taskMap[taskID].paths[0].visited = false;
4721
+ } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
4722
+ taskMap[taskID].paths[1].duration = immediateChildDuration;
4723
+ taskMap[taskID].paths[1].task = dependents[j];
4724
+ taskMap[taskID].paths[1].parent = taskID;
4725
+ taskMap[taskID].paths[1].visited = false;
4726
+ }
4727
4727
  }
4728
4728
  }
4729
4729
  }