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