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