gantt-task-react-powern 0.4.79 → 0.4.81

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.
@@ -441,7 +441,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
441
441
  }, tasks.map(function (t) {
442
442
  var expanderSymbol = "";
443
443
 
444
- if (!leafTaskIds.has(t.id)) {
444
+ if (!(leafTaskIds.has(t.id) || t.type === "milestone")) {
445
445
  if (t.hideChildren === false) {
446
446
  expanderSymbol = "▼";
447
447
  } else if (t.hideChildren === true) {
@@ -490,7 +490,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
490
490
  style: {
491
491
  paddingLeft: t.depth * 4 + "px"
492
492
  }
493
- }, !leafTaskIds.has(t.id) ? React.createElement("div", {
493
+ }, !(leafTaskIds.has(t.id) || t.type === "milestone") ? React.createElement("div", {
494
494
  className: styles$1.taskListExpander,
495
495
  onClick: function onClick() {
496
496
  return onExpanderClick(t);
@@ -2518,44 +2518,51 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
2518
2518
  }
2519
2519
  };
2520
2520
 
2521
- return React.createElement("g", {
2522
- className: "content"
2523
- }, React.createElement("g", {
2524
- className: "arrows"
2525
- }, tasks.map(function (_task) {
2526
- var task = _task.start.getTime() > 0 && _task.end.getTime() > 0 ? _task : undefined;
2521
+ var getArrows = function getArrows(isCritical, criticalPathType) {
2522
+ return tasks.flatMap(function (_task) {
2523
+ var task = _task.start.getTime() > 0 && _task.end.getTime() > 0 ? _task : undefined;
2527
2524
 
2528
- if (!task) {
2529
- return React.createElement("g", {
2530
- key: _task.id,
2531
- style: {
2532
- height: taskHeight
2533
- }
2534
- });
2535
- }
2525
+ if (!task) {
2526
+ return [React.createElement("g", {
2527
+ key: _task.id + (isCritical ? "-critical" : "-normal"),
2528
+ style: {
2529
+ height: taskHeight
2530
+ }
2531
+ })];
2532
+ }
2536
2533
 
2537
- return task.barChildren.map(function (child) {
2538
- var _task$criticalPathArr, _task$criticalPathArr2;
2539
-
2540
- if (task.x2 > task.x1 || task.actualx2 > task.actualx1) return React.createElement(Arrow, {
2541
- key: "Arrow from " + task.id + " to " + tasks[child.index].id,
2542
- taskFrom: task,
2543
- taskTo: tasks[child.index],
2544
- rowHeight: rowHeight,
2545
- taskHeight: taskHeight,
2546
- arrowIndent: arrowIndent,
2547
- rtl: rtl,
2548
- arrowColor: ((_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : (_task$criticalPathArr2 = _task$criticalPathArr.find(function (arrow) {
2549
- return arrow.taskId == tasks[child.index].id;
2550
- })) === null || _task$criticalPathArr2 === void 0 ? void 0 : _task$criticalPathArr2.arrowColor) || "#808080"
2551
- });else return React.createElement("g", {
2552
- key: _task.id,
2553
- style: {
2554
- height: taskHeight
2534
+ return task.barChildren.map(function (child) {
2535
+ if (task.x2 > task.x1 || task.actualx2 > task.actualx1) {
2536
+ var _task$criticalPathArr;
2537
+
2538
+ var criticalTask = (_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : _task$criticalPathArr.find(function (arrow) {
2539
+ return arrow.taskId === tasks[child.index].id && (!!arrow.criticalPathType ? arrow.criticalPathType === criticalPathType : !criticalPathType);
2540
+ });
2541
+
2542
+ if (!!criticalTask === isCritical) {
2543
+ return React.createElement(Arrow, {
2544
+ key: "Arrow from " + task.id + " to " + tasks[child.index].id + (isCritical ? "-critical" : ""),
2545
+ taskFrom: task,
2546
+ taskTo: tasks[child.index],
2547
+ rowHeight: rowHeight,
2548
+ taskHeight: taskHeight,
2549
+ arrowIndent: arrowIndent,
2550
+ rtl: rtl,
2551
+ arrowColor: (criticalTask === null || criticalTask === void 0 ? void 0 : criticalTask.arrowColor) || "#808080"
2552
+ });
2553
+ }
2555
2554
  }
2556
- });
2555
+
2556
+ return null;
2557
+ }).filter(Boolean);
2557
2558
  });
2558
- })), React.createElement("g", {
2559
+ };
2560
+
2561
+ return React.createElement("g", {
2562
+ className: "content"
2563
+ }, React.createElement("g", {
2564
+ className: "arrows"
2565
+ }, getArrows(false), getArrows(true, "secondary"), getArrows(true, "primary")), React.createElement("g", {
2559
2566
  className: "bar",
2560
2567
  fontFamily: fontFamily,
2561
2568
  fontSize: fontSize
@@ -2881,8 +2888,8 @@ var Gantt = function Gantt(_ref) {
2881
2888
  uncolorAll(tasks);
2882
2889
 
2883
2890
  if (scheduleType !== "lookAhead") {
2884
- colorPath(secondaryPath, "#00ff00", tasks);
2885
- colorPath(primaryPath, "#ff0000", tasks);
2891
+ colorPath(secondaryPath, "#00ff00", tasks, "secondary");
2892
+ colorPath(primaryPath, "#ff0000", tasks, "primary");
2886
2893
  }
2887
2894
 
2888
2895
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor));
@@ -3325,7 +3332,7 @@ function uncolorAll(tasks) {
3325
3332
  delete task.criticalPathArrows;
3326
3333
  });
3327
3334
  }
3328
- function colorPath(path, color, tasks) {
3335
+ function colorPath(path, color, tasks, criticalPathType) {
3329
3336
  for (var i = 0; i < path.length; i++) {
3330
3337
  var longestIDLength = 0;
3331
3338
  var longestTask = void 0;
@@ -3368,10 +3375,16 @@ function colorPath(path, color, tasks) {
3368
3375
  var arrow = arrows.find(function (arrow) {
3369
3376
  return arrow.taskId === path[_i7 + 1].id;
3370
3377
  });
3371
- if (arrow) arrow.arrowColor = color;else arrows.push({
3378
+
3379
+ if (arrow) {
3380
+ arrow.arrowColor = color;
3381
+ arrow.criticalPathType = criticalPathType;
3382
+ } else arrows.push({
3372
3383
  taskId: path[_i7 + 1].id,
3373
- arrowColor: color
3384
+ arrowColor: color,
3385
+ criticalPathType: criticalPathType
3374
3386
  });
3387
+
3375
3388
  taskFromTasks.criticalPathArrows = arrows;
3376
3389
  }
3377
3390
  };