gantt-task-react-powern 0.5.5 → 0.5.7
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 +120 -53
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +120 -53
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -3019,10 +3019,6 @@ var Gantt = function Gantt(_ref) {
|
|
|
3019
3019
|
lastTouchY = _useState14[0],
|
|
3020
3020
|
setLastTouchY = _useState14[1];
|
|
3021
3021
|
|
|
3022
|
-
var _useState15 = useState(false),
|
|
3023
|
-
hasCircularDeps = _useState15[0],
|
|
3024
|
-
setHasCircularDeps = _useState15[1];
|
|
3025
|
-
|
|
3026
3022
|
useEffect(function () {
|
|
3027
3023
|
if (scheduleType === "lookAhead" && startDate && endDate) {
|
|
3028
3024
|
setDateSetup({
|
|
@@ -3071,16 +3067,6 @@ var Gantt = function Gantt(_ref) {
|
|
|
3071
3067
|
primaryPath = _getCriticalPaths[0],
|
|
3072
3068
|
secondaryPath = _getCriticalPaths[1];
|
|
3073
3069
|
|
|
3074
|
-
if (leafTasks.length > 0 && primaryPath.length === 0 && secondaryPath.length === 0) {
|
|
3075
|
-
setHasCircularDeps(true);
|
|
3076
|
-
} else {
|
|
3077
|
-
if (hasCircularDeps && localStorage.getItem('hideCircularDepsAlert') === 'true') {
|
|
3078
|
-
localStorage.removeItem('hideCircularDepsAlert');
|
|
3079
|
-
}
|
|
3080
|
-
|
|
3081
|
-
setHasCircularDeps(false);
|
|
3082
|
-
}
|
|
3083
|
-
|
|
3084
3070
|
uncolorAll(tasks);
|
|
3085
3071
|
|
|
3086
3072
|
if (scheduleType !== "lookAhead") {
|
|
@@ -3518,60 +3504,141 @@ function getCriticalPaths(leafTasks) {
|
|
|
3518
3504
|
computeCriticalPath(sortedTaskList[_i4], taskMap);
|
|
3519
3505
|
}
|
|
3520
3506
|
|
|
3521
|
-
var
|
|
3522
|
-
var primaryDuration = 0;
|
|
3507
|
+
var taskChainList = [];
|
|
3523
3508
|
|
|
3524
3509
|
for (var _i5 = 0; _i5 < sortedTaskList.length; _i5++) {
|
|
3525
|
-
var
|
|
3526
|
-
|
|
3527
|
-
if (primaryDuration < newDuration) {
|
|
3528
|
-
primaryLeaf = sortedTaskList[_i5];
|
|
3529
|
-
primaryDuration = newDuration;
|
|
3510
|
+
for (var _j = 0; _j < taskMap[sortedTaskList[_i5]].paths.length; _j++) {
|
|
3511
|
+
taskChainList.push(taskMap[sortedTaskList[_i5]].paths[_j]);
|
|
3530
3512
|
}
|
|
3531
3513
|
}
|
|
3532
3514
|
|
|
3533
|
-
|
|
3515
|
+
if (taskChainList.length > 0) {
|
|
3516
|
+
taskChainList.sort(function (a, b) {
|
|
3517
|
+
return b.duration - a.duration;
|
|
3518
|
+
});
|
|
3519
|
+
var primaryLeaf = taskChainList[0].parent;
|
|
3520
|
+
var primaryPath = [];
|
|
3534
3521
|
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
primaryPath.push(taskMap[primaryLeaf].task);
|
|
3538
|
-
primaryLeaf = taskMap[primaryLeaf].next;
|
|
3539
|
-
}
|
|
3522
|
+
while (primaryLeaf !== undefined) {
|
|
3523
|
+
primaryPath.push(taskMap[primaryLeaf].task);
|
|
3540
3524
|
|
|
3541
|
-
|
|
3542
|
-
|
|
3525
|
+
if (taskMap[primaryLeaf].paths.length === 0) {
|
|
3526
|
+
primaryLeaf = undefined;
|
|
3527
|
+
break;
|
|
3528
|
+
}
|
|
3543
3529
|
|
|
3544
|
-
|
|
3545
|
-
|
|
3530
|
+
var primaryDuration = taskMap[primaryLeaf].paths[0].duration;
|
|
3531
|
+
var nextPath = taskMap[primaryLeaf].paths[0];
|
|
3546
3532
|
|
|
3547
|
-
|
|
3533
|
+
for (var _i6 = 1; _i6 < taskMap[primaryLeaf].paths.length; _i6++) {
|
|
3534
|
+
var newDuration = taskMap[primaryLeaf].paths[_i6].duration;
|
|
3548
3535
|
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3536
|
+
if (newDuration > primaryDuration) {
|
|
3537
|
+
nextPath = taskMap[primaryLeaf].paths[_i6];
|
|
3538
|
+
primaryDuration = newDuration;
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
nextPath.visited = true;
|
|
3543
|
+
primaryLeaf = nextPath.task;
|
|
3552
3544
|
}
|
|
3553
|
-
}
|
|
3554
3545
|
|
|
3555
|
-
|
|
3546
|
+
var secondaryLeaf = taskChainList[0].parent;
|
|
3547
|
+
|
|
3548
|
+
for (var _i7 = 0; _i7 < taskChainList.length; _i7++) {
|
|
3549
|
+
if (!taskChainList[_i7].visited) {
|
|
3550
|
+
secondaryLeaf = taskChainList[_i7].parent;
|
|
3551
|
+
break;
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
var secondaryPath = [];
|
|
3556
|
+
|
|
3557
|
+
while (secondaryLeaf !== undefined) {
|
|
3558
|
+
secondaryPath.push(taskMap[secondaryLeaf].task);
|
|
3559
|
+
|
|
3560
|
+
if (taskMap[secondaryLeaf].paths.length === 0) {
|
|
3561
|
+
secondaryLeaf = undefined;
|
|
3562
|
+
break;
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
var secondaryDuration = taskMap[secondaryLeaf].paths[0].duration;
|
|
3566
|
+
var _nextPath = taskMap[secondaryLeaf].paths[0];
|
|
3567
|
+
if (_nextPath.visited) secondaryDuration = 0;
|
|
3568
|
+
|
|
3569
|
+
for (var _i8 = 1; _i8 < taskMap[secondaryLeaf].paths.length; _i8++) {
|
|
3570
|
+
var _newDuration = taskMap[secondaryLeaf].paths[_i8].duration;
|
|
3571
|
+
|
|
3572
|
+
if (_newDuration > secondaryDuration && !taskMap[secondaryLeaf].paths[_i8].visited) {
|
|
3573
|
+
_nextPath = taskMap[secondaryLeaf].paths[_i8];
|
|
3574
|
+
secondaryDuration = _newDuration;
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3556
3577
|
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3578
|
+
if (_nextPath.visited) {
|
|
3579
|
+
break;
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
_nextPath.visited = true;
|
|
3583
|
+
secondaryLeaf = _nextPath.task;
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
return [primaryPath, secondaryPath];
|
|
3560
3587
|
}
|
|
3561
3588
|
|
|
3562
|
-
return [
|
|
3589
|
+
return [[], []];
|
|
3563
3590
|
}
|
|
3564
3591
|
function computeCriticalPath(taskID, taskMap) {
|
|
3565
3592
|
var task = taskMap[taskID].task;
|
|
3566
3593
|
var dependents = taskMap[taskID].dependents;
|
|
3594
|
+
taskMap[taskID].start = task.start.getTime();
|
|
3567
3595
|
taskMap[taskID].end = task.end.getTime();
|
|
3596
|
+
taskMap[taskID].paths = [];
|
|
3568
3597
|
|
|
3569
3598
|
for (var j = 0; j < dependents.length; j++) {
|
|
3570
|
-
var
|
|
3599
|
+
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 paths = taskMap[dependents[j]].paths;
|
|
3601
|
+
|
|
3602
|
+
for (var k = 0; k < paths.length; k++) {
|
|
3603
|
+
var totalDuration = taskMap[taskID].end - taskMap[taskID].start + duration + paths[k].duration;
|
|
3604
|
+
|
|
3605
|
+
if (taskMap[taskID].paths.length < 2) {
|
|
3606
|
+
taskMap[taskID].paths.push({
|
|
3607
|
+
duration: totalDuration,
|
|
3608
|
+
task: dependents[j],
|
|
3609
|
+
parent: taskID,
|
|
3610
|
+
visited: false
|
|
3611
|
+
});
|
|
3612
|
+
} else if (totalDuration > taskMap[taskID].paths[0].duration) {
|
|
3613
|
+
taskMap[taskID].paths[0].duration = totalDuration;
|
|
3614
|
+
taskMap[taskID].paths[0].task = dependents[j];
|
|
3615
|
+
taskMap[taskID].paths[0].parent = taskID;
|
|
3616
|
+
taskMap[taskID].paths[0].visited = false;
|
|
3617
|
+
} else if (totalDuration > taskMap[taskID].paths[0].duration) {
|
|
3618
|
+
taskMap[taskID].paths[1].duration = totalDuration;
|
|
3619
|
+
taskMap[taskID].paths[1].task = dependents[j];
|
|
3620
|
+
taskMap[taskID].paths[1].parent = taskID;
|
|
3621
|
+
taskMap[taskID].paths[1].visited = false;
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3571
3624
|
|
|
3572
|
-
if (
|
|
3573
|
-
taskMap[taskID].
|
|
3574
|
-
|
|
3625
|
+
if (taskMap[taskID].paths.length < 2) {
|
|
3626
|
+
taskMap[taskID].paths.push({
|
|
3627
|
+
duration: duration,
|
|
3628
|
+
task: dependents[j],
|
|
3629
|
+
parent: taskID,
|
|
3630
|
+
visited: false
|
|
3631
|
+
});
|
|
3632
|
+
} else if (duration > taskMap[taskID].paths[0].duration) {
|
|
3633
|
+
taskMap[taskID].paths[0].duration = duration;
|
|
3634
|
+
taskMap[taskID].paths[0].task = dependents[j];
|
|
3635
|
+
taskMap[taskID].paths[0].parent = taskID;
|
|
3636
|
+
taskMap[taskID].paths[0].visited = false;
|
|
3637
|
+
} else if (duration > taskMap[taskID].paths[0].duration) {
|
|
3638
|
+
taskMap[taskID].paths[1].duration = duration;
|
|
3639
|
+
taskMap[taskID].paths[1].task = dependents[j];
|
|
3640
|
+
taskMap[taskID].paths[1].parent = taskID;
|
|
3641
|
+
taskMap[taskID].paths[1].visited = false;
|
|
3575
3642
|
}
|
|
3576
3643
|
}
|
|
3577
3644
|
}
|
|
@@ -3608,12 +3675,12 @@ function colorPath(path, color, tasks, criticalPathType) {
|
|
|
3608
3675
|
}
|
|
3609
3676
|
}
|
|
3610
3677
|
|
|
3611
|
-
var _loop = function _loop(
|
|
3678
|
+
var _loop = function _loop(_i9) {
|
|
3612
3679
|
var taskFromTasks = void 0;
|
|
3613
3680
|
|
|
3614
|
-
for (var
|
|
3615
|
-
if (path[
|
|
3616
|
-
taskFromTasks = tasks[
|
|
3681
|
+
for (var _j2 = 0; _j2 < tasks.length; _j2++) {
|
|
3682
|
+
if (path[_i9].id === tasks[_j2].id) {
|
|
3683
|
+
taskFromTasks = tasks[_j2];
|
|
3617
3684
|
break;
|
|
3618
3685
|
}
|
|
3619
3686
|
}
|
|
@@ -3622,14 +3689,14 @@ function colorPath(path, color, tasks, criticalPathType) {
|
|
|
3622
3689
|
var arrows = taskFromTasks.criticalPathArrows;
|
|
3623
3690
|
if (!arrows) arrows = [];
|
|
3624
3691
|
var arrow = arrows.find(function (arrow) {
|
|
3625
|
-
return arrow.taskId === path[
|
|
3692
|
+
return arrow.taskId === path[_i9 + 1].id;
|
|
3626
3693
|
});
|
|
3627
3694
|
|
|
3628
3695
|
if (arrow) {
|
|
3629
3696
|
arrow.arrowColor = color;
|
|
3630
3697
|
arrow.criticalPathType = criticalPathType;
|
|
3631
3698
|
} else arrows.push({
|
|
3632
|
-
taskId: path[
|
|
3699
|
+
taskId: path[_i9 + 1].id,
|
|
3633
3700
|
arrowColor: color,
|
|
3634
3701
|
criticalPathType: criticalPathType
|
|
3635
3702
|
});
|
|
@@ -3638,8 +3705,8 @@ function colorPath(path, color, tasks, criticalPathType) {
|
|
|
3638
3705
|
}
|
|
3639
3706
|
};
|
|
3640
3707
|
|
|
3641
|
-
for (var
|
|
3642
|
-
_loop(
|
|
3708
|
+
for (var _i9 = 0; _i9 + 1 < path.length; _i9++) {
|
|
3709
|
+
_loop(_i9);
|
|
3643
3710
|
}
|
|
3644
3711
|
}
|
|
3645
3712
|
var getParentWbs = function getParentWbs(wbs) {
|