gantt-task-react-powern 0.4.32 → 0.4.33

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.
@@ -2393,6 +2393,8 @@ var Gantt = function Gantt(_ref) {
2393
2393
  milestoneBackgroundSelectedColor = _ref$milestoneBackgro2 === void 0 ? "#f29e4c" : _ref$milestoneBackgro2,
2394
2394
  _ref$rtl = _ref.rtl,
2395
2395
  rtl = _ref$rtl === void 0 ? false : _ref$rtl,
2396
+ _ref$criticalPathExpa = _ref.criticalPathExpand,
2397
+ criticalPathExpand = _ref$criticalPathExpa === void 0 ? true : _ref$criticalPathExpa,
2396
2398
  _ref$handleWidth = _ref.handleWidth,
2397
2399
  handleWidth = _ref$handleWidth === void 0 ? 8 : _ref$handleWidth,
2398
2400
  _ref$timeStep = _ref.timeStep,
@@ -2742,6 +2744,57 @@ var Gantt = function Gantt(_ref) {
2742
2744
  }
2743
2745
  };
2744
2746
 
2747
+ useEffect(function () {
2748
+ var _getCriticalPaths2 = getCriticalPaths(leafTasks),
2749
+ primaryPath = _getCriticalPaths2[0];
2750
+
2751
+ console.debug("Primary path", primaryPath);
2752
+
2753
+ var isCPhidden = function isCPhidden(p) {
2754
+ var _tasks$find;
2755
+
2756
+ return (_tasks$find = tasks.find(function (t) {
2757
+ return t.id === p.id.split(".").slice(0, p.id.split(".").length - 1).join(".");
2758
+ })) === null || _tasks$find === void 0 ? void 0 : _tasks$find.hideChildren;
2759
+ };
2760
+
2761
+ var toggleCP = function toggleCP(p) {
2762
+ if (onExpanderClick) {
2763
+ (function () {
2764
+ var _id = p.id;
2765
+ console.debug("toggleCP id ", _id);
2766
+
2767
+ for (var i = 0; i < p.id.split(".").length; i++) {
2768
+ console.debug("toggleCP id ", _id);
2769
+ var t = tasks.find(function (t) {
2770
+ return t.id === _id;
2771
+ });
2772
+
2773
+ if (t) {
2774
+ handleExpanderClick(t);
2775
+ _id = _id.split(".").slice(0, _id.split(".").length - 1).join(".");
2776
+ }
2777
+ }
2778
+ })();
2779
+ }
2780
+ };
2781
+
2782
+ if (criticalPathExpand) {
2783
+ primaryPath.forEach(function (p) {
2784
+ if (isCPhidden(p)) {
2785
+ console.debug("CP hidden ", p);
2786
+ toggleCP(p);
2787
+ }
2788
+ });
2789
+ } else {
2790
+ primaryPath.forEach(function (p) {
2791
+ if (isCPhidden(p) === false) {
2792
+ toggleCP(p);
2793
+ }
2794
+ });
2795
+ }
2796
+ }, [criticalPathExpand, leafTasks, tasks]);
2797
+
2745
2798
  function topologicalOrderingHelper(taskID, taskMap, sortedTaskList) {
2746
2799
  if (!taskMap[taskID]) return true;
2747
2800
  if (taskMap[taskID].finished) return true;