gantt-task-react-powern 0.4.24 → 0.4.25

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 CHANGED
@@ -1878,7 +1878,8 @@ var Project = function Project(_ref) {
1878
1878
  height: task.height,
1879
1879
  rx: task.barCornerRadius,
1880
1880
  ry: task.barCornerRadius,
1881
- className: styles$8.projectBackground
1881
+ className: styles$8.projectBackground,
1882
+ stroke: task.styles.criticalPathColor
1882
1883
  }), React__default.createElement("rect", {
1883
1884
  x: task.progressX,
1884
1885
  width: task.progressWidth,
@@ -1886,7 +1887,8 @@ var Project = function Project(_ref) {
1886
1887
  height: task.height,
1887
1888
  ry: task.barCornerRadius,
1888
1889
  rx: task.barCornerRadius,
1889
- fill: processColor
1890
+ fill: processColor,
1891
+ stroke: task.styles.criticalPathColor
1890
1892
  }), React__default.createElement("rect", {
1891
1893
  fill: barColor,
1892
1894
  x: task.x1,
@@ -1895,15 +1897,18 @@ var Project = function Project(_ref) {
1895
1897
  height: task.height / 2,
1896
1898
  rx: task.barCornerRadius,
1897
1899
  ry: task.barCornerRadius,
1898
- className: styles$8.projectTop
1900
+ className: styles$8.projectTop,
1901
+ stroke: task.styles.criticalPathColor
1899
1902
  }), React__default.createElement("polygon", {
1900
1903
  className: styles$8.projectTop,
1901
1904
  points: projectLeftTriangle,
1902
- fill: barColor
1905
+ fill: barColor,
1906
+ stroke: task.styles.criticalPathColor
1903
1907
  }), React__default.createElement("polygon", {
1904
1908
  className: styles$8.projectTop,
1905
1909
  points: projectRightTriangle,
1906
- fill: barColor
1910
+ fill: barColor,
1911
+ stroke: task.styles.criticalPathColor
1907
1912
  }));
1908
1913
  };
1909
1914
 
@@ -2525,6 +2530,7 @@ var Gantt = function Gantt(_ref) {
2525
2530
  primaryPath = _getCriticalPaths[0],
2526
2531
  secondaryPath = _getCriticalPaths[1];
2527
2532
 
2533
+ uncolorAll(tasks);
2528
2534
  colorPath(secondaryPath, "#00ff00", tasks);
2529
2535
  colorPath(primaryPath, "#ff0000", tasks);
2530
2536
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor));
@@ -2795,18 +2801,40 @@ var Gantt = function Gantt(_ref) {
2795
2801
  return [].concat(longestPath, [task]);
2796
2802
  }
2797
2803
 
2804
+ function uncolorAll(tasks) {
2805
+ tasks.forEach(function (task) {
2806
+ if (task.styles) delete task.styles.criticalPathColor;
2807
+ delete task.criticalPathArrows;
2808
+ });
2809
+ }
2810
+
2798
2811
  function colorPath(path, color, tasks) {
2799
2812
  for (var i = 0; i < path.length; i++) {
2800
- for (var j = 0; j < tasks.length; j++) {
2801
- if (path[i].id.startsWith(tasks[j].id + ".") || path[i].id === tasks[j].id) {
2802
- var _tasks$j$styles;
2813
+ var longestIDLength = 0;
2814
+ var longestTask = void 0;
2803
2815
 
2804
- var _styles = (_tasks$j$styles = tasks[j].styles) != null ? _tasks$j$styles : {};
2816
+ for (var j = 0; j < tasks.length; j++) {
2817
+ if (path[i].id === tasks[j].id) {
2818
+ longestTask = tasks[j];
2819
+ break;
2820
+ }
2805
2821
 
2806
- _styles.criticalPathColor = color;
2807
- tasks[j].styles = _styles;
2822
+ if (path[i].id.startsWith(tasks[j].id + ".") && tasks[j].id.length > longestIDLength) {
2823
+ longestIDLength = tasks[j].id.length;
2824
+ longestTask = tasks[j];
2808
2825
  }
2809
2826
  }
2827
+
2828
+ if (longestTask) {
2829
+ var _longestTask$styles;
2830
+
2831
+ console.log("Colored " + longestTask.id + " " + color);
2832
+
2833
+ var _styles = (_longestTask$styles = longestTask.styles) != null ? _longestTask$styles : {};
2834
+
2835
+ _styles.criticalPathColor = color;
2836
+ longestTask.styles = _styles;
2837
+ }
2810
2838
  }
2811
2839
 
2812
2840
  var _loop = function _loop(_i) {