gantt-task-react-powern 0.6.24 → 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.
@@ -4549,13 +4549,13 @@ function getCriticalPaths(leafTasks) {
4549
4549
  }
4550
4550
  }
4551
4551
 
4552
- for (var _i4 = sortedTaskList.length - 1; _i4 >= 0; _i4--) {
4552
+ for (var _i4 = (sortedTaskList === null || sortedTaskList === void 0 ? void 0 : sortedTaskList.length) - 1; _i4 >= 0; _i4--) {
4553
4553
  computeCriticalPath(sortedTaskList[_i4], taskMap);
4554
4554
  }
4555
4555
 
4556
4556
  var taskChainList = [];
4557
4557
 
4558
- for (var _i5 = 0; _i5 < sortedTaskList.length; _i5++) {
4558
+ for (var _i5 = 0; _i5 < (sortedTaskList === null || sortedTaskList === void 0 ? void 0 : sortedTaskList.length); _i5++) {
4559
4559
  for (var _j = 0; _j < taskMap[sortedTaskList[_i5]].paths.length; _j++) {
4560
4560
  taskChainList.push(taskMap[sortedTaskList[_i5]].paths[_j]);
4561
4561
  }
@@ -4652,75 +4652,77 @@ function computeCriticalPath(taskID, taskMap) {
4652
4652
  var endWeek = Math.floor((depEnd / 86400000 + 4) / 7);
4653
4653
  var offTime = 0;
4654
4654
 
4655
- for (var d = 0; d < ((_taskMap$dependents$j = taskMap[dependents[j]].task.calendar) === null || _taskMap$dependents$j === void 0 ? void 0 : (_taskMap$dependents$j2 = _taskMap$dependents$j.off_days) === null || _taskMap$dependents$j2 === void 0 ? void 0 : _taskMap$dependents$j2.length) || 0; d++) {
4656
- var _taskMap$dependents$j, _taskMap$dependents$j2;
4655
+ if (taskMap[dependents[j]].task.calendar.off_days && taskMap[dependents[j]].task.calendar.off_days.length) {
4656
+ for (var d = 0; d < taskMap[dependents[j]].task.calendar.off_days.length || 0; d++) {
4657
+ for (var w = startWeek; w <= endWeek; w++) {
4658
+ var dayOfTheWeek = taskMap[dependents[j]].task.calendar.off_days[d];
4659
+ var offDay = 86400000 * (7 * w - 4 + dayOfTheWeek);
4657
4660
 
4658
- for (var w = startWeek; w <= endWeek; w++) {
4659
- var dayOfTheWeek = taskMap[dependents[j]].task.calendar.off_days[d];
4660
- var offDay = 86400000 * (7 * w - 4 + dayOfTheWeek);
4661
-
4662
- if (offDay >= depStart && offDay <= depEnd && (offDay > taskMap[taskID].end || taskMap[taskID].task.calendar.off_days.includes(dayOfTheWeek))) {
4663
- offTime += 86400000;
4661
+ if (offDay >= depStart && offDay <= depEnd && (offDay > taskMap[taskID].end || taskMap[taskID].task.calendar.off_days.includes(dayOfTheWeek))) {
4662
+ offTime += 86400000;
4663
+ }
4664
4664
  }
4665
4665
  }
4666
4666
  }
4667
4667
 
4668
- for (var h = 0; h < ((_taskMap$dependents$j3 = taskMap[dependents[j]].task.calendar) === null || _taskMap$dependents$j3 === void 0 ? void 0 : (_taskMap$dependents$j4 = _taskMap$dependents$j3.holidays) === null || _taskMap$dependents$j4 === void 0 ? void 0 : _taskMap$dependents$j4.length) || 0; h++) {
4669
- var _taskMap$dependents$j3, _taskMap$dependents$j4;
4670
-
4671
- var holiday = taskMap[dependents[j]].task.calendar.holidays[h];
4668
+ if (taskMap[dependents[j]].task.calendar.holidays && taskMap[dependents[j]].task.calendar.holidays.length) {
4669
+ for (var h = 0; h < taskMap[dependents[j]].task.calendar.holidays.length || 0; h++) {
4670
+ var holiday = taskMap[dependents[j]].task.calendar.holidays[h];
4672
4671
 
4673
- if (holiday >= depStart && holiday <= depEnd) {
4674
- offTime += 86400000;
4672
+ if (holiday >= depStart && holiday <= depEnd) {
4673
+ offTime += 86400000;
4674
+ }
4675
4675
  }
4676
4676
  }
4677
4677
 
4678
4678
  var overlap = Math.max(taskMap[taskID].end - depStart, 0);
4679
4679
  var paths = taskMap[dependents[j]].paths;
4680
4680
 
4681
- for (var k = 0; k < paths.length; k++) {
4682
- var totalDuration = taskMap[taskID].end - taskMap[taskID].start - overlap - offTime + paths[k].duration;
4681
+ if (paths && paths.length) {
4682
+ for (var k = 0; k < paths.length; k++) {
4683
+ var totalDuration = taskMap[taskID].end - taskMap[taskID].start - overlap - offTime + paths[k].duration;
4683
4684
 
4684
- if (taskMap[taskID].paths.length < 2) {
4685
- taskMap[taskID].paths.push({
4686
- duration: totalDuration,
4687
- task: dependents[j],
4688
- parent: taskID,
4689
- visited: false
4690
- });
4691
- } else if (totalDuration > taskMap[taskID].paths[0].duration) {
4692
- taskMap[taskID].paths[0].duration = totalDuration;
4693
- taskMap[taskID].paths[0].task = dependents[j];
4694
- taskMap[taskID].paths[0].parent = taskID;
4695
- taskMap[taskID].paths[0].visited = false;
4696
- } else if (totalDuration > taskMap[taskID].paths[1].duration) {
4697
- taskMap[taskID].paths[1].duration = totalDuration;
4698
- taskMap[taskID].paths[1].task = dependents[j];
4699
- taskMap[taskID].paths[1].parent = taskID;
4700
- taskMap[taskID].paths[1].visited = false;
4685
+ if (taskMap[taskID].paths.length < 2) {
4686
+ taskMap[taskID].paths.push({
4687
+ duration: totalDuration,
4688
+ task: dependents[j],
4689
+ parent: taskID,
4690
+ visited: false
4691
+ });
4692
+ } else if (totalDuration > taskMap[taskID].paths[0].duration) {
4693
+ taskMap[taskID].paths[0].duration = totalDuration;
4694
+ taskMap[taskID].paths[0].task = dependents[j];
4695
+ taskMap[taskID].paths[0].parent = taskID;
4696
+ taskMap[taskID].paths[0].visited = false;
4697
+ } else if (totalDuration > taskMap[taskID].paths[1].duration) {
4698
+ taskMap[taskID].paths[1].duration = totalDuration;
4699
+ taskMap[taskID].paths[1].task = dependents[j];
4700
+ taskMap[taskID].paths[1].parent = taskID;
4701
+ taskMap[taskID].paths[1].visited = false;
4702
+ }
4701
4703
  }
4702
- }
4703
4704
 
4704
- if (paths.length === 0) {
4705
- var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap - offTime;
4705
+ if (paths.length === 0) {
4706
+ var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap - offTime;
4706
4707
 
4707
- if (taskMap[taskID].paths.length < 2) {
4708
- taskMap[taskID].paths.push({
4709
- duration: immediateChildDuration,
4710
- task: dependents[j],
4711
- parent: taskID,
4712
- visited: false
4713
- });
4714
- } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
4715
- taskMap[taskID].paths[0].duration = immediateChildDuration;
4716
- taskMap[taskID].paths[0].task = dependents[j];
4717
- taskMap[taskID].paths[0].parent = taskID;
4718
- taskMap[taskID].paths[0].visited = false;
4719
- } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
4720
- taskMap[taskID].paths[1].duration = immediateChildDuration;
4721
- taskMap[taskID].paths[1].task = dependents[j];
4722
- taskMap[taskID].paths[1].parent = taskID;
4723
- taskMap[taskID].paths[1].visited = false;
4708
+ if (taskMap[taskID].paths.length < 2) {
4709
+ taskMap[taskID].paths.push({
4710
+ duration: immediateChildDuration,
4711
+ task: dependents[j],
4712
+ parent: taskID,
4713
+ visited: false
4714
+ });
4715
+ } else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
4716
+ taskMap[taskID].paths[0].duration = immediateChildDuration;
4717
+ taskMap[taskID].paths[0].task = dependents[j];
4718
+ taskMap[taskID].paths[0].parent = taskID;
4719
+ taskMap[taskID].paths[0].visited = false;
4720
+ } else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
4721
+ taskMap[taskID].paths[1].duration = immediateChildDuration;
4722
+ taskMap[taskID].paths[1].task = dependents[j];
4723
+ taskMap[taskID].paths[1].parent = taskID;
4724
+ taskMap[taskID].paths[1].visited = false;
4725
+ }
4724
4726
  }
4725
4727
  }
4726
4728
  }