gantt-task-react-powern 0.4.13 → 0.4.14
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/tooltip.d.ts +3 -0
- package/dist/components/task-item/bar/bar-display.d.ts +1 -2
- package/dist/components/task-item/task-item.d.ts +2 -1
- package/dist/helpers/bar-helper.d.ts +1 -1
- package/dist/index.js +231 -132
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +231 -132
- package/dist/index.modern.js.map +1 -1
- package/dist/types/gantt-task-actions.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -436,6 +436,7 @@ var styles$2 = {"tooltipDefaultContainer":"_3T42e","tooltipDefaultContainerParag
|
|
|
436
436
|
|
|
437
437
|
var Tooltip = function Tooltip(_ref) {
|
|
438
438
|
var task = _ref.task,
|
|
439
|
+
type = _ref.type,
|
|
439
440
|
rowHeight = _ref.rowHeight,
|
|
440
441
|
rtl = _ref.rtl,
|
|
441
442
|
svgContainerHeight = _ref.svgContainerHeight,
|
|
@@ -479,14 +480,14 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
479
480
|
newRelatedY += rowHeight;
|
|
480
481
|
}
|
|
481
482
|
} else {
|
|
482
|
-
newRelatedX = task.x2 + arrowIndent * 1.5 + taskListWidth - scrollX;
|
|
483
|
+
newRelatedX = type == "planned" ? task.x2 + arrowIndent * 1.5 + taskListWidth - scrollX : task.actualx2 + arrowIndent * 1.5 + taskListWidth - scrollX;
|
|
483
484
|
|
|
484
485
|
var _tooltipLeftmostPoint = tooltipWidth + newRelatedX;
|
|
485
486
|
|
|
486
487
|
var fullChartWidth = taskListWidth + svgContainerWidth;
|
|
487
488
|
|
|
488
489
|
if (_tooltipLeftmostPoint > fullChartWidth) {
|
|
489
|
-
newRelatedX = task.x1 + taskListWidth - arrowIndent * 1.5 - scrollX - tooltipWidth;
|
|
490
|
+
newRelatedX = type == "planned" ? task.x1 + taskListWidth - arrowIndent * 1.5 - scrollX - tooltipWidth : task.actualx1 + taskListWidth - arrowIndent * 1.5 - scrollX - tooltipWidth;
|
|
490
491
|
}
|
|
491
492
|
|
|
492
493
|
if (newRelatedX < taskListWidth) {
|
|
@@ -515,28 +516,41 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
515
516
|
}, React__default.createElement(TooltipContent, {
|
|
516
517
|
task: task,
|
|
517
518
|
fontSize: fontSize,
|
|
518
|
-
fontFamily: fontFamily
|
|
519
|
+
fontFamily: fontFamily,
|
|
520
|
+
type: type
|
|
519
521
|
}));
|
|
520
522
|
};
|
|
521
523
|
var StandardTooltipContent = function StandardTooltipContent(_ref2) {
|
|
522
524
|
var task = _ref2.task,
|
|
523
525
|
fontSize = _ref2.fontSize,
|
|
524
|
-
fontFamily = _ref2.fontFamily
|
|
526
|
+
fontFamily = _ref2.fontFamily,
|
|
527
|
+
type = _ref2.type;
|
|
525
528
|
var style = {
|
|
526
529
|
fontSize: fontSize,
|
|
527
530
|
fontFamily: fontFamily
|
|
528
531
|
};
|
|
529
|
-
return React__default.createElement("div", {
|
|
532
|
+
if (type == "planned") return React__default.createElement("div", {
|
|
530
533
|
className: styles$2.tooltipDefaultContainer,
|
|
531
534
|
style: style
|
|
532
535
|
}, React__default.createElement("b", {
|
|
533
536
|
style: {
|
|
534
537
|
fontSize: fontSize + 6
|
|
535
538
|
}
|
|
536
|
-
}, task.name + ": "
|
|
539
|
+
}, task.name + ": Planned dates: "), React__default.createElement("b", null, task.start.getDate() + "-" + (task.start.getMonth() + 1) + "-" + task.start.getFullYear() + " - " + task.end.getDate() + "-" + (task.end.getMonth() + 1) + "-" + task.end.getFullYear()), task.end.getTime() - task.start.getTime() !== 0 && React__default.createElement("p", {
|
|
537
540
|
className: styles$2.tooltipDefaultContainerParagraph
|
|
538
541
|
}, "Duration: " + ~~((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React__default.createElement("p", {
|
|
539
542
|
className: styles$2.tooltipDefaultContainerParagraph
|
|
543
|
+
}, !!task.progress && "Progress: " + task.progress + " %"));else return React__default.createElement("div", {
|
|
544
|
+
className: styles$2.tooltipDefaultContainer,
|
|
545
|
+
style: style
|
|
546
|
+
}, React__default.createElement("b", {
|
|
547
|
+
style: {
|
|
548
|
+
fontSize: fontSize + 6
|
|
549
|
+
}
|
|
550
|
+
}, task.name + ": Actual dates: "), React__default.createElement("b", null, task.actualStart.getDate() + "-" + (task.actualStart.getMonth() + 1) + "-" + task.actualStart.getFullYear() + " - " + task.actualEnd.getDate() + "-" + (task.actualEnd.getMonth() + 1) + "-" + task.actualEnd.getFullYear()), task.actualEnd.getTime() - task.actualStart.getTime() !== 0 && React__default.createElement("p", {
|
|
551
|
+
className: styles$2.tooltipDefaultContainerParagraph
|
|
552
|
+
}, "Duration: " + ~~((task.actualEnd.getTime() - task.actualStart.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React__default.createElement("p", {
|
|
553
|
+
className: styles$2.tooltipDefaultContainerParagraph
|
|
540
554
|
}, !!task.progress && "Progress: " + task.progress + " %"));
|
|
541
555
|
};
|
|
542
556
|
|
|
@@ -1111,13 +1125,15 @@ var Arrow = function Arrow(_ref) {
|
|
|
1111
1125
|
};
|
|
1112
1126
|
|
|
1113
1127
|
var drownPathAndTriangle = function drownPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent) {
|
|
1128
|
+
var taskToStart = Math.min(taskTo.x1, taskTo.actualx1);
|
|
1129
|
+
var taskFromEnd = Math.max(taskFrom.x2, taskFrom.actualx2);
|
|
1114
1130
|
var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
|
|
1115
1131
|
var taskToEndPosition = taskTo.y + taskHeight / 2;
|
|
1116
|
-
var taskFromEndPosition =
|
|
1117
|
-
var taskFromHorizontalOffsetValue = taskFromEndPosition <
|
|
1118
|
-
var taskToHorizontalOffsetValue = taskFromEndPosition >
|
|
1119
|
-
var path = "M " +
|
|
1120
|
-
var trianglePoints =
|
|
1132
|
+
var taskFromEndPosition = taskFromEnd + arrowIndent * 2;
|
|
1133
|
+
var taskFromHorizontalOffsetValue = taskFromEndPosition < taskToStart ? "" : "H " + (taskToStart - arrowIndent);
|
|
1134
|
+
var taskToHorizontalOffsetValue = taskFromEndPosition > taskToStart ? arrowIndent : taskToStart - taskFromEnd - arrowIndent;
|
|
1135
|
+
var path = "M " + taskFromEnd + " " + (taskFrom.y + taskHeight / 2) + " \n h " + arrowIndent + " \n v " + indexCompare * rowHeight / 2 + " \n " + taskFromHorizontalOffsetValue + "\n V " + taskToEndPosition + " \n h " + taskToHorizontalOffsetValue;
|
|
1136
|
+
var trianglePoints = taskToStart + "," + taskToEndPosition + " \n " + (taskToStart - 5) + "," + (taskToEndPosition - 5) + " \n " + (taskToStart - 5) + "," + (taskToEndPosition + 5);
|
|
1121
1137
|
return [path, trianglePoints];
|
|
1122
1138
|
};
|
|
1123
1139
|
|
|
@@ -1309,23 +1325,6 @@ var progressWithByParams = function progressWithByParams(taskX1, taskX2, progres
|
|
|
1309
1325
|
|
|
1310
1326
|
return [progressWidth, progressX];
|
|
1311
1327
|
};
|
|
1312
|
-
|
|
1313
|
-
var progressByX = function progressByX(x, task) {
|
|
1314
|
-
if (x >= task.x2) return 100;else if (x <= task.x1) return 0;else {
|
|
1315
|
-
var barWidth = task.x2 - task.x1;
|
|
1316
|
-
var progressPercent = Math.round((x - task.x1) * 100 / barWidth);
|
|
1317
|
-
return progressPercent;
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
|
|
1321
|
-
var progressByXRTL = function progressByXRTL(x, task) {
|
|
1322
|
-
if (x >= task.x2) return 0;else if (x <= task.x1) return 100;else {
|
|
1323
|
-
var barWidth = task.x2 - task.x1;
|
|
1324
|
-
var progressPercent = Math.round((task.x2 - x) * 100 / barWidth);
|
|
1325
|
-
return progressPercent;
|
|
1326
|
-
}
|
|
1327
|
-
};
|
|
1328
|
-
|
|
1329
1328
|
var getProgressPoint = function getProgressPoint(progressX, taskY, taskHeight) {
|
|
1330
1329
|
var point = [progressX - 5, taskY + taskHeight, progressX + 5, taskY + taskHeight, progressX, taskY + taskHeight - 8.66];
|
|
1331
1330
|
return point.join(",");
|
|
@@ -1342,6 +1341,17 @@ var startByX = function startByX(x, xStep, task) {
|
|
|
1342
1341
|
return newX;
|
|
1343
1342
|
};
|
|
1344
1343
|
|
|
1344
|
+
var startByActualX = function startByActualX(x, xStep, task) {
|
|
1345
|
+
if (x >= task.actualx2 - task.handleWidth * 2) {
|
|
1346
|
+
x = task.actualx2 - task.handleWidth * 2;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
var steps = Math.round((x - task.actualx1) / xStep);
|
|
1350
|
+
var additionalXValue = steps * xStep;
|
|
1351
|
+
var newX = task.actualx1 + additionalXValue;
|
|
1352
|
+
return newX;
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1345
1355
|
var endByX = function endByX(x, xStep, task) {
|
|
1346
1356
|
if (x <= task.x1 + task.handleWidth * 2) {
|
|
1347
1357
|
x = task.x1 + task.handleWidth * 2;
|
|
@@ -1353,6 +1363,17 @@ var endByX = function endByX(x, xStep, task) {
|
|
|
1353
1363
|
return newX;
|
|
1354
1364
|
};
|
|
1355
1365
|
|
|
1366
|
+
var endByActualX = function endByActualX(x, xStep, task) {
|
|
1367
|
+
if (x <= task.actualx1 + task.handleWidth * 2) {
|
|
1368
|
+
x = task.actualx1 + task.handleWidth * 2;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
var steps = Math.round((x - task.actualx2) / xStep);
|
|
1372
|
+
var additionalXValue = steps * xStep;
|
|
1373
|
+
var newX = task.actualx2 + additionalXValue;
|
|
1374
|
+
return newX;
|
|
1375
|
+
};
|
|
1376
|
+
|
|
1356
1377
|
var moveByX = function moveByX(x, xStep, task) {
|
|
1357
1378
|
var steps = Math.round((x - task.x1) / xStep);
|
|
1358
1379
|
var additionalXValue = steps * xStep;
|
|
@@ -1361,13 +1382,21 @@ var moveByX = function moveByX(x, xStep, task) {
|
|
|
1361
1382
|
return [newX1, newX2];
|
|
1362
1383
|
};
|
|
1363
1384
|
|
|
1385
|
+
var moveByActualX = function moveByActualX(x, xStep, task) {
|
|
1386
|
+
var steps = Math.round((x - task.actualx1) / xStep);
|
|
1387
|
+
var additionalXValue = steps * xStep;
|
|
1388
|
+
var newX1 = task.actualx1 + additionalXValue;
|
|
1389
|
+
var newX2 = newX1 + task.actualx2 - task.actualx1;
|
|
1390
|
+
return [newX1, newX2];
|
|
1391
|
+
};
|
|
1392
|
+
|
|
1364
1393
|
var dateByX = function dateByX(x, taskX, taskDate, xStep, timeStep) {
|
|
1365
1394
|
var newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
|
|
1366
1395
|
newDate = new Date(newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 60000);
|
|
1367
1396
|
return newDate;
|
|
1368
1397
|
};
|
|
1369
1398
|
|
|
1370
|
-
var handleTaskBySVGMouseEvent = function handleTaskBySVGMouseEvent(svgX, action, selectedTask, xStep, timeStep, initEventX1Delta, rtl) {
|
|
1399
|
+
var handleTaskBySVGMouseEvent = function handleTaskBySVGMouseEvent(svgX, action, selectedTask, type, xStep, timeStep, initEventX1Delta, rtl) {
|
|
1371
1400
|
var result;
|
|
1372
1401
|
|
|
1373
1402
|
switch (selectedTask.type) {
|
|
@@ -1376,58 +1405,40 @@ var handleTaskBySVGMouseEvent = function handleTaskBySVGMouseEvent(svgX, action,
|
|
|
1376
1405
|
break;
|
|
1377
1406
|
|
|
1378
1407
|
default:
|
|
1379
|
-
result = handleTaskBySVGMouseEventForBar(svgX, action, selectedTask, xStep, timeStep, initEventX1Delta, rtl);
|
|
1408
|
+
result = handleTaskBySVGMouseEventForBar(svgX, action, selectedTask, type, xStep, timeStep, initEventX1Delta, rtl);
|
|
1380
1409
|
break;
|
|
1381
1410
|
}
|
|
1382
1411
|
|
|
1383
1412
|
return result;
|
|
1384
1413
|
};
|
|
1385
1414
|
|
|
1386
|
-
var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(svgX, action, selectedTask, xStep, timeStep, initEventX1Delta, rtl) {
|
|
1415
|
+
var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(svgX, action, selectedTask, type, xStep, timeStep, initEventX1Delta, rtl) {
|
|
1387
1416
|
var changedTask = _extends({}, selectedTask);
|
|
1388
1417
|
|
|
1389
1418
|
var isChanged = false;
|
|
1390
1419
|
|
|
1391
1420
|
switch (action) {
|
|
1392
|
-
case "progress":
|
|
1393
|
-
if (rtl) {
|
|
1394
|
-
changedTask.progress = progressByXRTL(svgX, selectedTask);
|
|
1395
|
-
} else {
|
|
1396
|
-
changedTask.progress = progressByX(svgX, selectedTask);
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
isChanged = changedTask.progress !== selectedTask.progress;
|
|
1400
|
-
|
|
1401
|
-
if (isChanged) {
|
|
1402
|
-
var _progressWithByParams2 = progressWithByParams(changedTask.x1, changedTask.x2, changedTask.progress, rtl),
|
|
1403
|
-
progressWidth = _progressWithByParams2[0],
|
|
1404
|
-
progressX = _progressWithByParams2[1];
|
|
1405
|
-
|
|
1406
|
-
changedTask.progressWidth = progressWidth;
|
|
1407
|
-
changedTask.progressX = progressX;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
break;
|
|
1411
|
-
|
|
1412
1421
|
case "start":
|
|
1413
1422
|
{
|
|
1414
|
-
var newX1 = startByX(svgX, xStep, selectedTask);
|
|
1415
|
-
changedTask.x1 = newX1;
|
|
1416
|
-
isChanged = changedTask.x1 !== selectedTask.x1;
|
|
1423
|
+
var newX1 = type == "planned" ? startByX(svgX, xStep, selectedTask) : startByActualX(svgX, xStep, selectedTask);
|
|
1424
|
+
if (type == "planned") changedTask.x1 = newX1;else if (type == "actual") changedTask.actualx1 = newX1;
|
|
1425
|
+
isChanged = changedTask.x1 !== selectedTask.x1 || changedTask.actualx1 !== selectedTask.actualx1;
|
|
1417
1426
|
|
|
1418
1427
|
if (isChanged) {
|
|
1419
1428
|
if (rtl) {
|
|
1420
|
-
changedTask.end = dateByX(newX1, selectedTask.x1, selectedTask.end, xStep, timeStep);
|
|
1429
|
+
if (type == "planned") changedTask.end = dateByX(newX1, selectedTask.x1, selectedTask.end, xStep, timeStep);
|
|
1430
|
+
if (type == "actual") changedTask.actualEnd = dateByX(newX1, selectedTask.actualx1, selectedTask.actualEnd, xStep, timeStep);
|
|
1421
1431
|
} else {
|
|
1422
|
-
changedTask.start = dateByX(newX1, selectedTask.x1, selectedTask.start, xStep, timeStep);
|
|
1432
|
+
if (type == "planned") changedTask.start = dateByX(newX1, selectedTask.x1, selectedTask.start, xStep, timeStep);
|
|
1433
|
+
if (type == "actual") changedTask.actualStart = dateByX(newX1, selectedTask.actualx1, selectedTask.actualStart, xStep, timeStep);
|
|
1423
1434
|
}
|
|
1424
1435
|
|
|
1425
|
-
var
|
|
1426
|
-
|
|
1427
|
-
|
|
1436
|
+
var _progressWithByParams2 = progressWithByParams(changedTask.x1, changedTask.x2, changedTask.progress, rtl),
|
|
1437
|
+
progressWidth = _progressWithByParams2[0],
|
|
1438
|
+
progressX = _progressWithByParams2[1];
|
|
1428
1439
|
|
|
1429
|
-
changedTask.progressWidth =
|
|
1430
|
-
changedTask.progressX =
|
|
1440
|
+
changedTask.progressWidth = progressWidth;
|
|
1441
|
+
changedTask.progressX = progressX;
|
|
1431
1442
|
}
|
|
1432
1443
|
|
|
1433
1444
|
break;
|
|
@@ -1435,23 +1446,25 @@ var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(s
|
|
|
1435
1446
|
|
|
1436
1447
|
case "end":
|
|
1437
1448
|
{
|
|
1438
|
-
var newX2 = endByX(svgX, xStep, selectedTask);
|
|
1439
|
-
changedTask.x2 = newX2;
|
|
1440
|
-
isChanged = changedTask.x2 !== selectedTask.x2;
|
|
1449
|
+
var newX2 = type == "planned" ? endByX(svgX, xStep, selectedTask) : endByActualX(svgX, xStep, selectedTask);
|
|
1450
|
+
if (type == "planned") changedTask.x2 = newX2;else if (type == "actual") changedTask.actualx2 = newX2;
|
|
1451
|
+
isChanged = changedTask.x2 !== selectedTask.x2 || changedTask.actualx2 !== selectedTask.actualx2;
|
|
1441
1452
|
|
|
1442
1453
|
if (isChanged) {
|
|
1443
1454
|
if (rtl) {
|
|
1444
|
-
changedTask.start = dateByX(newX2, selectedTask.x2, selectedTask.start, xStep, timeStep);
|
|
1455
|
+
if (type == "planned") changedTask.start = dateByX(newX2, selectedTask.x2, selectedTask.start, xStep, timeStep);
|
|
1456
|
+
if (type == "actual") changedTask.actualStart = dateByX(newX2, selectedTask.actualx2, selectedTask.actualStart, xStep, timeStep);
|
|
1445
1457
|
} else {
|
|
1446
|
-
changedTask.end = dateByX(newX2, selectedTask.x2, selectedTask.end, xStep, timeStep);
|
|
1458
|
+
if (type == "planned") changedTask.end = dateByX(newX2, selectedTask.x2, selectedTask.end, xStep, timeStep);
|
|
1459
|
+
if (type == "actual") changedTask.actualEnd = dateByX(newX2, selectedTask.actualx2, selectedTask.actualEnd, xStep, timeStep);
|
|
1447
1460
|
}
|
|
1448
1461
|
|
|
1449
|
-
var
|
|
1450
|
-
|
|
1451
|
-
|
|
1462
|
+
var _progressWithByParams3 = progressWithByParams(changedTask.x1, changedTask.x2, changedTask.progress, rtl),
|
|
1463
|
+
_progressWidth = _progressWithByParams3[0],
|
|
1464
|
+
_progressX = _progressWithByParams3[1];
|
|
1452
1465
|
|
|
1453
|
-
changedTask.progressWidth =
|
|
1454
|
-
changedTask.progressX =
|
|
1466
|
+
changedTask.progressWidth = _progressWidth;
|
|
1467
|
+
changedTask.progressX = _progressX;
|
|
1455
1468
|
}
|
|
1456
1469
|
|
|
1457
1470
|
break;
|
|
@@ -1459,24 +1472,27 @@ var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(s
|
|
|
1459
1472
|
|
|
1460
1473
|
case "move":
|
|
1461
1474
|
{
|
|
1462
|
-
var
|
|
1463
|
-
newMoveX1 =
|
|
1464
|
-
newMoveX2 =
|
|
1475
|
+
var _ref = type == "planned" ? moveByX(svgX - initEventX1Delta, xStep, selectedTask) : moveByActualX(svgX - initEventX1Delta, xStep, selectedTask),
|
|
1476
|
+
newMoveX1 = _ref[0],
|
|
1477
|
+
newMoveX2 = _ref[1];
|
|
1465
1478
|
|
|
1466
|
-
isChanged = newMoveX1 !== selectedTask.x1;
|
|
1479
|
+
if (type == "planned") isChanged = newMoveX1 !== selectedTask.x1;
|
|
1480
|
+
if (type == "actual") isChanged = newMoveX1 !== selectedTask.actualx1;
|
|
1467
1481
|
|
|
1468
1482
|
if (isChanged) {
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
_progressWidth3 = _progressWithByParams5[0],
|
|
1476
|
-
_progressX3 = _progressWithByParams5[1];
|
|
1483
|
+
if (type == "planned") {
|
|
1484
|
+
changedTask.start = dateByX(newMoveX1, selectedTask.x1, selectedTask.start, xStep, timeStep);
|
|
1485
|
+
changedTask.end = dateByX(newMoveX2, selectedTask.x2, selectedTask.end, xStep, timeStep);
|
|
1486
|
+
changedTask.x1 = newMoveX1;
|
|
1487
|
+
changedTask.x2 = newMoveX2;
|
|
1488
|
+
}
|
|
1477
1489
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1490
|
+
if (type == "actual") {
|
|
1491
|
+
changedTask.actualStart = dateByX(newMoveX1, selectedTask.actualx1, selectedTask.actualStart, xStep, timeStep);
|
|
1492
|
+
changedTask.actualEnd = dateByX(newMoveX2, selectedTask.actualx2, selectedTask.actualEnd, xStep, timeStep);
|
|
1493
|
+
changedTask.actualx1 = newMoveX1;
|
|
1494
|
+
changedTask.actualx2 = newMoveX2;
|
|
1495
|
+
}
|
|
1480
1496
|
}
|
|
1481
1497
|
|
|
1482
1498
|
break;
|
|
@@ -1497,9 +1513,9 @@ var handleTaskBySVGMouseEventForMilestone = function handleTaskBySVGMouseEventFo
|
|
|
1497
1513
|
switch (action) {
|
|
1498
1514
|
case "move":
|
|
1499
1515
|
{
|
|
1500
|
-
var
|
|
1501
|
-
newMoveX1 =
|
|
1502
|
-
newMoveX2 =
|
|
1516
|
+
var _moveByX = moveByX(svgX - initEventX1Delta, xStep, selectedTask),
|
|
1517
|
+
newMoveX1 = _moveByX[0],
|
|
1518
|
+
newMoveX2 = _moveByX[1];
|
|
1503
1519
|
|
|
1504
1520
|
isChanged = newMoveX1 !== selectedTask.x1;
|
|
1505
1521
|
|
|
@@ -1582,8 +1598,7 @@ var sortTasks = function sortTasks(taskA, taskB) {
|
|
|
1582
1598
|
var BarDisplay = function BarDisplay(_ref) {
|
|
1583
1599
|
var x = _ref.x,
|
|
1584
1600
|
y = _ref.y,
|
|
1585
|
-
|
|
1586
|
-
actualX2 = _ref.actualX2,
|
|
1601
|
+
type = _ref.type,
|
|
1587
1602
|
width = _ref.width,
|
|
1588
1603
|
height = _ref.height,
|
|
1589
1604
|
isSelected = _ref.isSelected,
|
|
@@ -1601,31 +1616,41 @@ var BarDisplay = function BarDisplay(_ref) {
|
|
|
1601
1616
|
return isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
|
|
1602
1617
|
};
|
|
1603
1618
|
|
|
1604
|
-
return React__default.createElement("g", {
|
|
1619
|
+
if (type == "planned") return React__default.createElement("g", {
|
|
1605
1620
|
onMouseDown: onMouseDown
|
|
1606
1621
|
}, React__default.createElement("rect", {
|
|
1607
1622
|
x: x,
|
|
1608
1623
|
width: width,
|
|
1609
1624
|
y: y,
|
|
1610
|
-
height: height
|
|
1625
|
+
height: height,
|
|
1611
1626
|
ry: barCornerRadius,
|
|
1612
1627
|
rx: barCornerRadius,
|
|
1613
1628
|
fill: getBarColor(),
|
|
1614
1629
|
strokeWidth: 2,
|
|
1615
1630
|
stroke: styles.criticalPathColor
|
|
1616
1631
|
}), React__default.createElement("rect", {
|
|
1617
|
-
x:
|
|
1618
|
-
width:
|
|
1619
|
-
y: y
|
|
1620
|
-
height: height
|
|
1632
|
+
x: progressX,
|
|
1633
|
+
width: progressWidth,
|
|
1634
|
+
y: y,
|
|
1635
|
+
height: height,
|
|
1636
|
+
ry: barCornerRadius,
|
|
1637
|
+
rx: barCornerRadius,
|
|
1638
|
+
fill: getProcessColor()
|
|
1639
|
+
}));else return React__default.createElement("g", {
|
|
1640
|
+
onMouseDown: onMouseDown
|
|
1641
|
+
}, React__default.createElement("rect", {
|
|
1642
|
+
x: x,
|
|
1643
|
+
width: width,
|
|
1644
|
+
y: y,
|
|
1645
|
+
height: height,
|
|
1621
1646
|
ry: barCornerRadius,
|
|
1622
1647
|
rx: barCornerRadius,
|
|
1623
1648
|
fill: styles.taskProgressColor
|
|
1624
1649
|
}), React__default.createElement("rect", {
|
|
1625
1650
|
x: progressX,
|
|
1626
1651
|
width: progressWidth,
|
|
1627
|
-
y: y
|
|
1628
|
-
height: height
|
|
1652
|
+
y: y,
|
|
1653
|
+
height: height,
|
|
1629
1654
|
ry: barCornerRadius,
|
|
1630
1655
|
rx: barCornerRadius,
|
|
1631
1656
|
fill: getProcessColor()
|
|
@@ -1664,29 +1689,29 @@ var Bar = function Bar(_ref) {
|
|
|
1664
1689
|
isProgressChangeable = _ref.isProgressChangeable,
|
|
1665
1690
|
isDateChangeable = _ref.isDateChangeable,
|
|
1666
1691
|
rtl = _ref.rtl,
|
|
1692
|
+
type = _ref.type,
|
|
1667
1693
|
onEventStart = _ref.onEventStart,
|
|
1668
1694
|
isSelected = _ref.isSelected;
|
|
1669
1695
|
var progressPoint = getProgressPoint(+!rtl * task.progressWidth + task.progressX, task.y, task.height);
|
|
1670
|
-
var handleHeight = task.height -
|
|
1671
|
-
return React__default.createElement("g", {
|
|
1696
|
+
var handleHeight = task.height / 2 - 1;
|
|
1697
|
+
if (type == "planned") return React__default.createElement("g", {
|
|
1672
1698
|
className: styles$6.barWrapper,
|
|
1673
1699
|
tabIndex: 0
|
|
1674
1700
|
}, React__default.createElement(BarDisplay, {
|
|
1675
1701
|
x: task.x1,
|
|
1676
1702
|
y: task.y,
|
|
1677
|
-
|
|
1678
|
-
actualX2: task.actualx2,
|
|
1703
|
+
type: type,
|
|
1679
1704
|
startProgressWidth: task.progressStartWidth,
|
|
1680
1705
|
endProgressWidth: task.progressEndWidth,
|
|
1681
1706
|
width: task.x2 - task.x1,
|
|
1682
|
-
height: task.height,
|
|
1707
|
+
height: task.height / 2,
|
|
1683
1708
|
progressX: task.progressX,
|
|
1684
1709
|
progressWidth: task.progressWidth,
|
|
1685
1710
|
barCornerRadius: task.barCornerRadius,
|
|
1686
1711
|
styles: task.styles,
|
|
1687
1712
|
isSelected: isSelected,
|
|
1688
1713
|
onMouseDown: function onMouseDown(e) {
|
|
1689
|
-
isDateChangeable && onEventStart("move", task, e);
|
|
1714
|
+
isDateChangeable && onEventStart("move", task, e, "planned");
|
|
1690
1715
|
}
|
|
1691
1716
|
}), React__default.createElement("g", {
|
|
1692
1717
|
className: "handleGroup"
|
|
@@ -1697,7 +1722,7 @@ var Bar = function Bar(_ref) {
|
|
|
1697
1722
|
height: handleHeight,
|
|
1698
1723
|
barCornerRadius: task.barCornerRadius,
|
|
1699
1724
|
onMouseDown: function onMouseDown(e) {
|
|
1700
|
-
onEventStart("start", task, e);
|
|
1725
|
+
onEventStart("start", task, e, "planned");
|
|
1701
1726
|
}
|
|
1702
1727
|
}), React__default.createElement(BarDateHandle, {
|
|
1703
1728
|
x: task.x2 - task.handleWidth - 1,
|
|
@@ -1706,18 +1731,63 @@ var Bar = function Bar(_ref) {
|
|
|
1706
1731
|
height: handleHeight,
|
|
1707
1732
|
barCornerRadius: task.barCornerRadius,
|
|
1708
1733
|
onMouseDown: function onMouseDown(e) {
|
|
1709
|
-
onEventStart("end", task, e);
|
|
1734
|
+
onEventStart("end", task, e, "planned");
|
|
1710
1735
|
}
|
|
1711
1736
|
})), isProgressChangeable && React__default.createElement(BarProgressHandle, {
|
|
1712
1737
|
progressPoint: progressPoint,
|
|
1713
1738
|
onMouseDown: function onMouseDown(e) {
|
|
1714
|
-
onEventStart("progress", task, e);
|
|
1739
|
+
onEventStart("progress", task, e, "planned");
|
|
1740
|
+
}
|
|
1741
|
+
})));else return React__default.createElement("g", {
|
|
1742
|
+
className: styles$6.barWrapper,
|
|
1743
|
+
tabIndex: 0
|
|
1744
|
+
}, React__default.createElement(BarDisplay, {
|
|
1745
|
+
x: task.actualx1,
|
|
1746
|
+
y: task.y + task.height / 2,
|
|
1747
|
+
type: type,
|
|
1748
|
+
startProgressWidth: task.progressStartWidth,
|
|
1749
|
+
endProgressWidth: task.progressEndWidth,
|
|
1750
|
+
width: task.actualx2 - task.actualx1,
|
|
1751
|
+
height: task.height / 2,
|
|
1752
|
+
progressX: task.progressX,
|
|
1753
|
+
progressWidth: task.progressWidth,
|
|
1754
|
+
barCornerRadius: task.barCornerRadius,
|
|
1755
|
+
styles: task.styles,
|
|
1756
|
+
isSelected: isSelected,
|
|
1757
|
+
onMouseDown: function onMouseDown(e) {
|
|
1758
|
+
isDateChangeable && onEventStart("move", task, e, "actual");
|
|
1759
|
+
}
|
|
1760
|
+
}), React__default.createElement("g", {
|
|
1761
|
+
className: "handleGroup"
|
|
1762
|
+
}, isDateChangeable && React__default.createElement("g", null, React__default.createElement(BarDateHandle, {
|
|
1763
|
+
x: task.actualx1 + 1,
|
|
1764
|
+
y: task.y + task.height / 2 + 1,
|
|
1765
|
+
width: task.handleWidth,
|
|
1766
|
+
height: handleHeight,
|
|
1767
|
+
barCornerRadius: task.barCornerRadius,
|
|
1768
|
+
onMouseDown: function onMouseDown(e) {
|
|
1769
|
+
onEventStart("start", task, e, "actual");
|
|
1770
|
+
}
|
|
1771
|
+
}), React__default.createElement(BarDateHandle, {
|
|
1772
|
+
x: task.actualx2 - task.handleWidth - 1,
|
|
1773
|
+
y: task.y + task.height / 2 + 1,
|
|
1774
|
+
width: task.handleWidth,
|
|
1775
|
+
height: handleHeight,
|
|
1776
|
+
barCornerRadius: task.barCornerRadius,
|
|
1777
|
+
onMouseDown: function onMouseDown(e) {
|
|
1778
|
+
onEventStart("end", task, e, "actual");
|
|
1779
|
+
}
|
|
1780
|
+
})), isProgressChangeable && React__default.createElement(BarProgressHandle, {
|
|
1781
|
+
progressPoint: progressPoint,
|
|
1782
|
+
onMouseDown: function onMouseDown(e) {
|
|
1783
|
+
onEventStart("progress", task, e, "actual");
|
|
1715
1784
|
}
|
|
1716
1785
|
})));
|
|
1717
1786
|
};
|
|
1718
1787
|
|
|
1719
1788
|
var BarSmall = function BarSmall(_ref) {
|
|
1720
1789
|
var task = _ref.task,
|
|
1790
|
+
type = _ref.type,
|
|
1721
1791
|
isProgressChangeable = _ref.isProgressChangeable,
|
|
1722
1792
|
isDateChangeable = _ref.isDateChangeable,
|
|
1723
1793
|
onEventStart = _ref.onEventStart,
|
|
@@ -1729,8 +1799,7 @@ var BarSmall = function BarSmall(_ref) {
|
|
|
1729
1799
|
}, React__default.createElement(BarDisplay, {
|
|
1730
1800
|
x: task.x1,
|
|
1731
1801
|
y: task.y,
|
|
1732
|
-
|
|
1733
|
-
actualX2: task.actualx2,
|
|
1802
|
+
type: type,
|
|
1734
1803
|
startProgressWidth: task.progressStartWidth,
|
|
1735
1804
|
endProgressWidth: task.progressEndWidth,
|
|
1736
1805
|
width: task.x2 - task.x1,
|
|
@@ -1842,35 +1911,39 @@ var TaskItem = function TaskItem(props) {
|
|
|
1842
1911
|
isSelected = _props.isSelected,
|
|
1843
1912
|
onEventStart = _props.onEventStart;
|
|
1844
1913
|
|
|
1845
|
-
var _useState = React.useState(React__default.createElement("div", null)),
|
|
1914
|
+
var _useState = React.useState([React__default.createElement("div", null)]),
|
|
1846
1915
|
taskItem = _useState[0],
|
|
1847
1916
|
setTaskItem = _useState[1];
|
|
1848
1917
|
|
|
1849
1918
|
React.useEffect(function () {
|
|
1850
1919
|
switch (task.typeInternal) {
|
|
1851
1920
|
case "milestone":
|
|
1852
|
-
setTaskItem(React__default.createElement(Milestone, Object.assign({}, props)));
|
|
1921
|
+
setTaskItem([React__default.createElement(Milestone, Object.assign({}, props))]);
|
|
1853
1922
|
break;
|
|
1854
1923
|
|
|
1855
1924
|
case "project":
|
|
1856
|
-
setTaskItem(React__default.createElement(Project, Object.assign({}, props)));
|
|
1925
|
+
setTaskItem([React__default.createElement(Project, Object.assign({}, props))]);
|
|
1857
1926
|
break;
|
|
1858
1927
|
|
|
1859
1928
|
case "smalltask":
|
|
1860
|
-
setTaskItem(React__default.createElement(BarSmall, Object.assign({}, props)));
|
|
1929
|
+
setTaskItem([React__default.createElement(BarSmall, Object.assign({}, props))]);
|
|
1861
1930
|
break;
|
|
1862
1931
|
|
|
1863
1932
|
default:
|
|
1864
|
-
setTaskItem(React__default.createElement(Bar, Object.assign({}, props
|
|
1933
|
+
setTaskItem([React__default.createElement(Bar, Object.assign({}, props, {
|
|
1934
|
+
type: "planned"
|
|
1935
|
+
})), React__default.createElement(Bar, Object.assign({}, props, {
|
|
1936
|
+
type: "actual"
|
|
1937
|
+
}))]);
|
|
1865
1938
|
break;
|
|
1866
1939
|
}
|
|
1867
1940
|
}, [task, isSelected]);
|
|
1868
|
-
return React__default.createElement("g", {
|
|
1941
|
+
return React__default.createElement("g", null, React__default.createElement("g", {
|
|
1869
1942
|
onKeyDown: function onKeyDown(e) {
|
|
1870
1943
|
switch (e.key) {
|
|
1871
1944
|
case "Delete":
|
|
1872
1945
|
{
|
|
1873
|
-
if (isDelete) onEventStart("delete", task, e);
|
|
1946
|
+
if (isDelete) onEventStart("delete", task, e, "planned");
|
|
1874
1947
|
break;
|
|
1875
1948
|
}
|
|
1876
1949
|
}
|
|
@@ -1878,21 +1951,42 @@ var TaskItem = function TaskItem(props) {
|
|
|
1878
1951
|
e.stopPropagation();
|
|
1879
1952
|
},
|
|
1880
1953
|
onMouseEnter: function onMouseEnter(e) {
|
|
1881
|
-
onEventStart("mouseenter", task, e);
|
|
1954
|
+
onEventStart("mouseenter", task, e, "planned");
|
|
1882
1955
|
},
|
|
1883
1956
|
onMouseLeave: function onMouseLeave(e) {
|
|
1884
|
-
onEventStart("mouseleave", task, e);
|
|
1957
|
+
onEventStart("mouseleave", task, e, "planned");
|
|
1885
1958
|
},
|
|
1886
1959
|
onDoubleClick: function onDoubleClick(e) {
|
|
1887
|
-
onEventStart("dblclick", task, e);
|
|
1960
|
+
onEventStart("dblclick", task, e, "planned");
|
|
1888
1961
|
},
|
|
1889
1962
|
onClick: function onClick(e) {
|
|
1890
|
-
onEventStart("click", task, e);
|
|
1963
|
+
onEventStart("click", task, e, "planned");
|
|
1964
|
+
}
|
|
1965
|
+
}, taskItem[0]), React__default.createElement("g", {
|
|
1966
|
+
onKeyDown: function onKeyDown(e) {
|
|
1967
|
+
switch (e.key) {
|
|
1968
|
+
case "Delete":
|
|
1969
|
+
{
|
|
1970
|
+
if (isDelete) onEventStart("delete", task, e, "actual");
|
|
1971
|
+
break;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
e.stopPropagation();
|
|
1976
|
+
},
|
|
1977
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
1978
|
+
onEventStart("mouseenter", task, e, "actual");
|
|
1979
|
+
},
|
|
1980
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
1981
|
+
onEventStart("mouseleave", task, e, "actual");
|
|
1982
|
+
},
|
|
1983
|
+
onDoubleClick: function onDoubleClick(e) {
|
|
1984
|
+
onEventStart("dblclick", task, e, "actual");
|
|
1891
1985
|
},
|
|
1892
|
-
|
|
1893
|
-
onEventStart("
|
|
1986
|
+
onClick: function onClick(e) {
|
|
1987
|
+
onEventStart("click", task, e, "actual");
|
|
1894
1988
|
}
|
|
1895
|
-
}, taskItem);
|
|
1989
|
+
}, taskItem[1]));
|
|
1896
1990
|
};
|
|
1897
1991
|
|
|
1898
1992
|
var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
@@ -1948,7 +2042,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
1948
2042
|
point.x = event.clientX;
|
|
1949
2043
|
var cursor = point.matrixTransform(svg === null || svg === void 0 ? void 0 : (_svg$current$getScree = svg.current.getScreenCTM()) === null || _svg$current$getScree === void 0 ? void 0 : _svg$current$getScree.inverse());
|
|
1950
2044
|
|
|
1951
|
-
var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, ganttEvent.action, ganttEvent.changedTask, xStep, timeStep, initEventX1Delta, rtl),
|
|
2045
|
+
var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, ganttEvent.action, ganttEvent.changedTask, ganttEvent.type, xStep, timeStep, initEventX1Delta, rtl),
|
|
1952
2046
|
isChanged = _handleTaskBySVGMouse.isChanged,
|
|
1953
2047
|
changedTask = _handleTaskBySVGMouse.changedTask;
|
|
1954
2048
|
|
|
@@ -1977,16 +2071,17 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
1977
2071
|
|
|
1978
2072
|
var action = ganttEvent.action,
|
|
1979
2073
|
originalSelectedTask = ganttEvent.originalSelectedTask,
|
|
1980
|
-
changedTask = ganttEvent.changedTask
|
|
2074
|
+
changedTask = ganttEvent.changedTask,
|
|
2075
|
+
type = ganttEvent.type;
|
|
1981
2076
|
if (!changedTask || !point || !(svg !== null && svg !== void 0 && svg.current) || !originalSelectedTask) return Promise.resolve();
|
|
1982
2077
|
event.preventDefault();
|
|
1983
2078
|
point.x = event.clientX;
|
|
1984
2079
|
var cursor = point.matrixTransform(svg === null || svg === void 0 ? void 0 : (_svg$current$getScree2 = svg.current.getScreenCTM()) === null || _svg$current$getScree2 === void 0 ? void 0 : _svg$current$getScree2.inverse());
|
|
1985
2080
|
|
|
1986
|
-
var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, changedTask, xStep, timeStep, initEventX1Delta, rtl),
|
|
2081
|
+
var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, changedTask, type, xStep, timeStep, initEventX1Delta, rtl),
|
|
1987
2082
|
newChangedTask = _handleTaskBySVGMouse2.changedTask;
|
|
1988
2083
|
|
|
1989
|
-
var isNotLikeOriginal = originalSelectedTask.start !== newChangedTask.start || originalSelectedTask.end !== newChangedTask.end || originalSelectedTask.progress !== newChangedTask.progress;
|
|
2084
|
+
var isNotLikeOriginal = originalSelectedTask.start !== newChangedTask.start || originalSelectedTask.end !== newChangedTask.end || originalSelectedTask.actualStart !== newChangedTask.actualStart || originalSelectedTask.actualEnd !== newChangedTask.actualEnd || originalSelectedTask.progress !== newChangedTask.progress;
|
|
1990
2085
|
svg.current.removeEventListener("mousemove", handleMouseMove);
|
|
1991
2086
|
svg.current.removeEventListener("mouseup", handleMouseUp);
|
|
1992
2087
|
setGanttEvent({
|
|
@@ -2042,7 +2137,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2042
2137
|
}
|
|
2043
2138
|
}, [ganttEvent, xStep, initEventX1Delta, onProgressChange, timeStep, onDateChange, svg, isMoving, point, rtl, setFailedTask, setGanttEvent]);
|
|
2044
2139
|
|
|
2045
|
-
var handleBarEventStart = function handleBarEventStart(action, task, event) {
|
|
2140
|
+
var handleBarEventStart = function handleBarEventStart(action, task, event, type) {
|
|
2046
2141
|
try {
|
|
2047
2142
|
return Promise.resolve(function () {
|
|
2048
2143
|
if (!event) {
|
|
@@ -2082,7 +2177,8 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2082
2177
|
setGanttEvent({
|
|
2083
2178
|
action: action,
|
|
2084
2179
|
changedTask: task,
|
|
2085
|
-
originalSelectedTask: task
|
|
2180
|
+
originalSelectedTask: task,
|
|
2181
|
+
type: type
|
|
2086
2182
|
});
|
|
2087
2183
|
}
|
|
2088
2184
|
} else if (action === "mouseleave") {
|
|
@@ -2101,17 +2197,19 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2101
2197
|
if (!(svg !== null && svg !== void 0 && svg.current) || !point) return;
|
|
2102
2198
|
point.x = event.clientX;
|
|
2103
2199
|
var cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse());
|
|
2104
|
-
setInitEventX1Delta(cursor.x - task.x1);
|
|
2200
|
+
if (type == "planned") setInitEventX1Delta(cursor.x - task.x1);else if (type == "actual") setInitEventX1Delta(cursor.x - task.actualx1);
|
|
2105
2201
|
setGanttEvent({
|
|
2106
2202
|
action: action,
|
|
2107
2203
|
changedTask: task,
|
|
2108
|
-
originalSelectedTask: task
|
|
2204
|
+
originalSelectedTask: task,
|
|
2205
|
+
type: type
|
|
2109
2206
|
});
|
|
2110
2207
|
} else {
|
|
2111
2208
|
setGanttEvent({
|
|
2112
2209
|
action: action,
|
|
2113
2210
|
changedTask: task,
|
|
2114
|
-
originalSelectedTask: task
|
|
2211
|
+
originalSelectedTask: task,
|
|
2212
|
+
type: type
|
|
2115
2213
|
});
|
|
2116
2214
|
}
|
|
2117
2215
|
}();
|
|
@@ -2712,6 +2810,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
2712
2810
|
scrollX: scrollX,
|
|
2713
2811
|
scrollY: scrollY,
|
|
2714
2812
|
task: ganttEvent.changedTask,
|
|
2813
|
+
type: ganttEvent.type,
|
|
2715
2814
|
headerHeight: headerHeight,
|
|
2716
2815
|
taskListWidth: taskListWidth,
|
|
2717
2816
|
TooltipContent: TooltipContent,
|