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