gantt-task-react-powern 0.4.88 → 0.4.95

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
@@ -2020,7 +2020,7 @@ var Bar = function Bar(_ref) {
2020
2020
  var handleHeight = task.height / 2 - 1;
2021
2021
 
2022
2022
  if (type == "planned") {
2023
- if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0) return React__default.createElement("g", {
2023
+ if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) > 0) return React__default.createElement("g", {
2024
2024
  className: styles$6.barWrapper,
2025
2025
  tabIndex: 0
2026
2026
  }, React__default.createElement(BarDisplay, {
@@ -2068,7 +2068,7 @@ var Bar = function Bar(_ref) {
2068
2068
  className: styles$6.barWrapper,
2069
2069
  tabIndex: 0
2070
2070
  });
2071
- } else if ((task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) >= 0) {
2071
+ } else if ((task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) > 0) {
2072
2072
  return React__default.createElement("g", {
2073
2073
  className: styles$6.barWrapper,
2074
2074
  tabIndex: 0
@@ -2960,8 +2960,8 @@ var Gantt = function Gantt(_ref) {
2960
2960
  if (leafTasks.length > 0 && primaryPath.length === 0 && secondaryPath.length === 0) {
2961
2961
  setHasCircularDeps(true);
2962
2962
  } else {
2963
- if (hasCircularDeps && localStorage.getItem('hideCircularDepsAlert') === 'true') {
2964
- localStorage.removeItem('hideCircularDepsAlert');
2963
+ if (hasCircularDeps && localStorage.getItem("hideCircularDepsAlert") === "true") {
2964
+ localStorage.removeItem("hideCircularDepsAlert");
2965
2965
  }
2966
2966
 
2967
2967
  setHasCircularDeps(false);
@@ -3113,7 +3113,7 @@ var Gantt = function Gantt(_ref) {
3113
3113
  var alert = document.getElementById("alert-container");
3114
3114
 
3115
3115
  if (checkbox.checked) {
3116
- localStorage.setItem('hideCircularDepsAlert', 'true');
3116
+ localStorage.setItem("hideCircularDepsAlert", "true");
3117
3117
  alert.style.display = "None";
3118
3118
  }
3119
3119
  };
@@ -3266,7 +3266,7 @@ var Gantt = function Gantt(_ref) {
3266
3266
  taskLabelRenderer: taskLabelRenderer,
3267
3267
  onMultiSelect: onMultiSelect
3268
3268
  };
3269
- return React__default.createElement("div", null, hasCircularDeps && localStorage.getItem('hideCircularDepsAlert') !== 'true' && React__default.createElement("div", {
3269
+ return React__default.createElement("div", null, hasCircularDeps && localStorage.getItem("hideCircularDepsAlert") !== "true" && React__default.createElement("div", {
3270
3270
  id: "alert-container",
3271
3271
  className: styles$9.alertContainer + " " + styles$9.warning
3272
3272
  }, React__default.createElement("input", {
@@ -3415,19 +3415,59 @@ function getCriticalPaths(leafTasks) {
3415
3415
  secondaryLeaf = taskMap[secondaryLeaf].next;
3416
3416
  }
3417
3417
 
3418
+ console.debug([primaryPath, secondaryPath]);
3418
3419
  return [primaryPath, secondaryPath];
3419
3420
  }
3420
3421
  function computeCriticalPath(taskID, taskMap) {
3421
3422
  var task = taskMap[taskID].task;
3422
3423
  var dependents = taskMap[taskID].dependents;
3424
+ taskMap[taskID].start = task.start.getTime();
3423
3425
  taskMap[taskID].end = task.end.getTime();
3426
+ var start = taskMap[taskID].start;
3424
3427
 
3425
- for (var j = 0; j < dependents.length; j++) {
3426
- var newDependentEnd = taskMap[dependents[j]].end;
3428
+ for (var _iterator = _createForOfIteratorHelperLoose(dependents), _step; !(_step = _iterator()).done;) {
3429
+ var _dependentTask$depend;
3427
3430
 
3428
- if (newDependentEnd > taskMap[taskID].end) {
3429
- taskMap[taskID].next = dependents[j];
3430
- taskMap[taskID].end = newDependentEnd;
3431
+ var depID = _step.value;
3432
+ var dependentTask = taskMap[depID].task;
3433
+ var dependency = (_dependentTask$depend = dependentTask.dependencies) === null || _dependentTask$depend === void 0 ? void 0 : _dependentTask$depend.find(function (d) {
3434
+ return d.id === taskID;
3435
+ });
3436
+ if (!dependency) continue;
3437
+
3438
+ switch (dependency.type) {
3439
+ case "FS":
3440
+ if (taskMap[depID].end > taskMap[taskID].end) {
3441
+ taskMap[taskID].next = depID;
3442
+ taskMap[taskID].end = taskMap[depID].end;
3443
+ }
3444
+
3445
+ break;
3446
+
3447
+ case "SS":
3448
+ if (taskMap[depID].start > start) {
3449
+ taskMap[taskID].next = depID;
3450
+ start = taskMap[depID].start;
3451
+ taskMap[taskID].end = taskMap[depID].end;
3452
+ }
3453
+
3454
+ break;
3455
+
3456
+ case "FF":
3457
+ if (taskMap[depID].end > taskMap[taskID].end) {
3458
+ taskMap[taskID].next = depID;
3459
+ taskMap[taskID].end = taskMap[depID].end;
3460
+ }
3461
+
3462
+ break;
3463
+
3464
+ case "SF":
3465
+ if (taskMap[depID].start > taskMap[taskID].end) {
3466
+ taskMap[taskID].next = depID;
3467
+ taskMap[taskID].end = taskMap[depID].start;
3468
+ }
3469
+
3470
+ break;
3431
3471
  }
3432
3472
  }
3433
3473
  }