gantt-task-react-powern 0.4.85 → 0.4.86
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/components/other/arrow.d.ts +2 -1
- package/dist/index.js +86 -61
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +86 -61
- package/dist/index.modern.js.map +1 -1
- package/dist/types/bar-task.d.ts +2 -1
- package/dist/types/public-types.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BarTask } from "../../types/bar-task";
|
|
3
|
+
import { Dependency } from "../../types/public-types";
|
|
3
4
|
declare type ArrowProps = {
|
|
4
5
|
taskFrom: BarTask;
|
|
5
6
|
taskTo: BarTask;
|
|
6
7
|
rowHeight: number;
|
|
7
8
|
taskHeight: number;
|
|
8
9
|
arrowIndent: number;
|
|
9
|
-
rtl: boolean;
|
|
10
10
|
arrowColor: string;
|
|
11
|
+
dependencyType: Dependency;
|
|
11
12
|
};
|
|
12
13
|
export declare const Arrow: React.FC<ArrowProps>;
|
|
13
14
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1358,22 +1358,12 @@ var Arrow = function Arrow(_ref) {
|
|
|
1358
1358
|
rowHeight = _ref.rowHeight,
|
|
1359
1359
|
taskHeight = _ref.taskHeight,
|
|
1360
1360
|
arrowIndent = _ref.arrowIndent,
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
var path;
|
|
1364
|
-
var trianglePoints;
|
|
1361
|
+
arrowColor = _ref.arrowColor,
|
|
1362
|
+
dependencyType = _ref.dependencyType;
|
|
1365
1363
|
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
path = _drownPathAndTriangle[0];
|
|
1370
|
-
trianglePoints = _drownPathAndTriangle[1];
|
|
1371
|
-
} else {
|
|
1372
|
-
var _drownPathAndTriangle2 = drownPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent);
|
|
1373
|
-
|
|
1374
|
-
path = _drownPathAndTriangle2[0];
|
|
1375
|
-
trianglePoints = _drownPathAndTriangle2[1];
|
|
1376
|
-
}
|
|
1364
|
+
var _drawPathAndTriangle = drawPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType),
|
|
1365
|
+
path = _drawPathAndTriangle[0],
|
|
1366
|
+
trianglePoints = _drawPathAndTriangle[1];
|
|
1377
1367
|
|
|
1378
1368
|
return React__default.createElement("g", {
|
|
1379
1369
|
className: "arrow"
|
|
@@ -1388,35 +1378,76 @@ var Arrow = function Arrow(_ref) {
|
|
|
1388
1378
|
}));
|
|
1389
1379
|
};
|
|
1390
1380
|
|
|
1391
|
-
var
|
|
1392
|
-
var
|
|
1381
|
+
var drawPathAndTriangle = function drawPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType) {
|
|
1382
|
+
var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
|
|
1383
|
+
var taskToEndY = taskTo.y + taskHeight / 2;
|
|
1384
|
+
var verticalOffset = indexCompare * (rowHeight / 2);
|
|
1393
1385
|
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
}
|
|
1386
|
+
var minX = function minX(t) {
|
|
1387
|
+
return Math.min(t.x1 || 0, t.actualx1 || 0);
|
|
1388
|
+
};
|
|
1397
1389
|
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
}
|
|
1390
|
+
var maxX = function maxX(t) {
|
|
1391
|
+
return Math.max(t.x2 || 0, t.actualx2 || 0);
|
|
1392
|
+
};
|
|
1401
1393
|
|
|
1402
|
-
var
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1394
|
+
var fromPoint, toPoint;
|
|
1395
|
+
|
|
1396
|
+
switch (dependencyType) {
|
|
1397
|
+
case "SS":
|
|
1398
|
+
fromPoint = minX(taskFrom);
|
|
1399
|
+
toPoint = minX(taskTo);
|
|
1400
|
+
break;
|
|
1401
|
+
|
|
1402
|
+
case "SF":
|
|
1403
|
+
fromPoint = minX(taskFrom);
|
|
1404
|
+
toPoint = maxX(taskTo);
|
|
1405
|
+
break;
|
|
1406
|
+
|
|
1407
|
+
case "FS":
|
|
1408
|
+
fromPoint = maxX(taskFrom);
|
|
1409
|
+
toPoint = minX(taskTo);
|
|
1410
|
+
break;
|
|
1411
|
+
|
|
1412
|
+
case "FF":
|
|
1413
|
+
fromPoint = maxX(taskFrom);
|
|
1414
|
+
toPoint = maxX(taskTo);
|
|
1415
|
+
break;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
var arrowPoints = function arrowPoints(x, y, right) {
|
|
1419
|
+
if (right === void 0) {
|
|
1420
|
+
right = true;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
return right ? x + "," + y + " " + (x - 5) + "," + (y - 5) + " " + (x - 5) + "," + (y + 5) : x + "," + y + " " + (x + 5) + "," + (y - 5) + " " + (x + 5) + "," + (y + 5);
|
|
1424
|
+
};
|
|
1425
|
+
|
|
1426
|
+
var path;
|
|
1427
|
+
var trianglePoints;
|
|
1428
|
+
|
|
1429
|
+
switch (dependencyType) {
|
|
1430
|
+
case "SS":
|
|
1431
|
+
path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint + Math.min(toPoint - fromPoint, 0) - 2 * arrowIndent) + "\n V " + taskToEndY + "\n H " + (toPoint - 5);
|
|
1432
|
+
trianglePoints = arrowPoints(toPoint, taskToEndY, true);
|
|
1433
|
+
break;
|
|
1434
|
+
|
|
1435
|
+
case "SF":
|
|
1436
|
+
path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint - 2 * arrowIndent) + "\n V " + (taskFrom.y + taskHeight / 2 + verticalOffset) + "\n " + (fromPoint - toPoint > 4 * arrowIndent ? "" : "H " + (toPoint + 2 * arrowIndent)) + "\n V " + taskToEndY + "\n H " + (toPoint + 5);
|
|
1437
|
+
trianglePoints = arrowPoints(toPoint, taskToEndY, false);
|
|
1438
|
+
break;
|
|
1439
|
+
|
|
1440
|
+
case "FS":
|
|
1441
|
+
path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint + 2 * arrowIndent) + "\n V " + (taskFrom.y + taskHeight / 2 + verticalOffset) + "\n " + (toPoint - fromPoint > 4 * arrowIndent ? "" : "H " + (toPoint - 2 * arrowIndent)) + "\n V " + taskToEndY + "\n H " + (toPoint - 5);
|
|
1442
|
+
trianglePoints = arrowPoints(toPoint, taskToEndY, true);
|
|
1443
|
+
break;
|
|
1444
|
+
|
|
1445
|
+
case "FF":
|
|
1446
|
+
path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint + Math.max(toPoint - fromPoint, 0) + 2 * arrowIndent) + "\n V " + taskToEndY + "\n H " + (toPoint + 5);
|
|
1447
|
+
trianglePoints = arrowPoints(toPoint, taskToEndY, false);
|
|
1448
|
+
break;
|
|
1449
|
+
}
|
|
1411
1450
|
|
|
1412
|
-
var drownPathAndTriangleRTL = function drownPathAndTriangleRTL(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent) {
|
|
1413
|
-
var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
|
|
1414
|
-
var taskToEndPosition = taskTo.y + taskHeight / 2;
|
|
1415
|
-
var taskFromEndPosition = taskFrom.x1 - arrowIndent * 2;
|
|
1416
|
-
var taskFromHorizontalOffsetValue = taskFromEndPosition > taskTo.x2 ? "" : "H " + (taskTo.x2 + arrowIndent);
|
|
1417
|
-
var taskToHorizontalOffsetValue = taskFromEndPosition < taskTo.x2 ? -arrowIndent : taskTo.x2 - taskFrom.x1 + arrowIndent;
|
|
1418
|
-
var path = "M " + taskFrom.x1 + " " + (taskFrom.y + taskHeight / 2) + " \n h " + -arrowIndent + " \n v " + indexCompare * rowHeight / 2 + " \n " + taskFromHorizontalOffsetValue + "\n V " + taskToEndPosition + " \n h " + taskToHorizontalOffsetValue;
|
|
1419
|
-
var trianglePoints = taskTo.x2 + "," + taskToEndPosition + " \n " + (taskTo.x2 + 5) + "," + (taskToEndPosition + 5) + " \n " + (taskTo.x2 + 5) + "," + (taskToEndPosition - 5);
|
|
1420
1451
|
return [path, trianglePoints];
|
|
1421
1452
|
};
|
|
1422
1453
|
|
|
@@ -1429,9 +1460,16 @@ var convertToBarTasks = function convertToBarTasks(tasks, dates, columnWidth, ro
|
|
|
1429
1460
|
|
|
1430
1461
|
var _loop = function _loop(j) {
|
|
1431
1462
|
var dependence = barTasks.findIndex(function (value) {
|
|
1432
|
-
return value.id === dependencies[j];
|
|
1463
|
+
return value.id === dependencies[j].id;
|
|
1433
1464
|
});
|
|
1434
|
-
|
|
1465
|
+
|
|
1466
|
+
if (dependence !== -1 && task.start.getTime() > 0 && task.end.getTime() > 0) {
|
|
1467
|
+
var barchild = _extends({}, task, {
|
|
1468
|
+
dependencyType: dependencies[j].type
|
|
1469
|
+
});
|
|
1470
|
+
|
|
1471
|
+
barTasks[dependence].barChildren.push(barchild);
|
|
1472
|
+
}
|
|
1435
1473
|
};
|
|
1436
1474
|
|
|
1437
1475
|
for (var j = 0; j < dependencies.length; j++) {
|
|
@@ -1523,7 +1561,7 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
1523
1561
|
};
|
|
1524
1562
|
|
|
1525
1563
|
var convertToMilestone = function convertToMilestone(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, milestoneBackgroundColor, milestoneBackgroundSelectedColor) {
|
|
1526
|
-
var x = task.start && task.end ? taskXCoordinate(task.
|
|
1564
|
+
var x = task.start && task.end ? taskXCoordinate(task.start, dates, columnWidth) : 0;
|
|
1527
1565
|
var y = taskYCoordinate(index, rowHeight, taskHeight);
|
|
1528
1566
|
var x1 = task.start && task.end ? x - taskHeight * 0.5 : 0;
|
|
1529
1567
|
var x2 = task.start && task.end ? x + taskHeight * 0.5 : 0;
|
|
@@ -2546,9 +2584,9 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2546
2584
|
taskFrom: task,
|
|
2547
2585
|
taskTo: tasks[child.index],
|
|
2548
2586
|
rowHeight: rowHeight,
|
|
2587
|
+
dependencyType: child.dependencyType,
|
|
2549
2588
|
taskHeight: taskHeight,
|
|
2550
2589
|
arrowIndent: arrowIndent,
|
|
2551
|
-
rtl: rtl,
|
|
2552
2590
|
arrowColor: (criticalTask === null || criticalTask === void 0 ? void 0 : criticalTask.arrowColor) || "#808080"
|
|
2553
2591
|
});
|
|
2554
2592
|
}
|
|
@@ -2570,21 +2608,6 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2570
2608
|
}, tasks.map(function (_task) {
|
|
2571
2609
|
var task = _task.start.getTime() > 0 && _task.end.getTime() > 0 || _task.actualStart.getTime() > 0 && _task.actualEnd.getTime() > 0 ? _task : undefined;
|
|
2572
2610
|
|
|
2573
|
-
if (!task && _task.typeInternal === "milestone") {
|
|
2574
|
-
return React__default.createElement(Milestone, {
|
|
2575
|
-
task: _task,
|
|
2576
|
-
arrowIndent: arrowIndent,
|
|
2577
|
-
taskHeight: taskHeight,
|
|
2578
|
-
isProgressChangeable: false,
|
|
2579
|
-
isDateChangeable: false,
|
|
2580
|
-
isDelete: !_task.isDisabled,
|
|
2581
|
-
onEventStart: function onEventStart() {},
|
|
2582
|
-
key: _task.id,
|
|
2583
|
-
isSelected: !!selectedTask && _task.id === selectedTask.id,
|
|
2584
|
-
rtl: rtl
|
|
2585
|
-
});
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
2611
|
if (!task) {
|
|
2589
2612
|
return React__default.createElement("g", {
|
|
2590
2613
|
key: _task.id,
|
|
@@ -2905,6 +2928,8 @@ var Gantt = function Gantt(_ref) {
|
|
|
2905
2928
|
primaryPath = _getCriticalPaths[0],
|
|
2906
2929
|
secondaryPath = _getCriticalPaths[1];
|
|
2907
2930
|
|
|
2931
|
+
console.debug(primaryPath, secondaryPath);
|
|
2932
|
+
|
|
2908
2933
|
if (leafTasks.length > 0 && primaryPath.length === 0 && secondaryPath.length === 0) {
|
|
2909
2934
|
setHasCircularDeps(true);
|
|
2910
2935
|
} else {
|
|
@@ -3282,7 +3307,7 @@ function topologicalOrderingHelper(taskID, taskMap, sortedTaskList) {
|
|
|
3282
3307
|
taskMap[taskID].started = true;
|
|
3283
3308
|
var task = taskMap[taskID].task;
|
|
3284
3309
|
if (task.dependencies) for (var i = 0; i < task.dependencies.length; i++) {
|
|
3285
|
-
var successVal = topologicalOrderingHelper(task.dependencies[i], taskMap, sortedTaskList);
|
|
3310
|
+
var successVal = topologicalOrderingHelper(task.dependencies[i].id, taskMap, sortedTaskList);
|
|
3286
3311
|
if (!successVal) return false;
|
|
3287
3312
|
}
|
|
3288
3313
|
taskMap[taskID].finished = true;
|
|
@@ -3314,7 +3339,7 @@ function getCriticalPaths(leafTasks) {
|
|
|
3314
3339
|
if (task.dependencies) for (var j = 0; j < task.dependencies.length; j++) {
|
|
3315
3340
|
var _taskMap$task$depende;
|
|
3316
3341
|
|
|
3317
|
-
(_taskMap$task$depende = taskMap[task.dependencies[j]]) === null || _taskMap$task$depende === void 0 ? void 0 : _taskMap$task$depende.dependents.push(task.id);
|
|
3342
|
+
(_taskMap$task$depende = taskMap[task.dependencies[j].id]) === null || _taskMap$task$depende === void 0 ? void 0 : _taskMap$task$depende.dependents.push(task.id);
|
|
3318
3343
|
}
|
|
3319
3344
|
}
|
|
3320
3345
|
|