gantt-task-react-v 1.3.4 → 1.3.5

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.
@@ -13168,40 +13168,47 @@ const TaskGanttContentInner = (props) => {
13168
13168
  )
13169
13169
  );
13170
13170
  if (task.comparisonDates && comparisonDates) {
13171
+ console.log(`Comparison bar for task ${task.id}:`, {
13172
+ originalCoords: comparisonDates,
13173
+ taskComparisonDates: task.comparisonDates
13174
+ });
13171
13175
  const safeComparisonX = isNaN(comparisonDates.x) || !isFinite(comparisonDates.x) ? 0 : comparisonDates.x;
13172
- const safeComparisonY = isNaN(comparisonDates.y) || !isFinite(comparisonDates.y) ? safeLevelY : comparisonDates.y;
13173
- const safeComparisonWidth = isNaN(comparisonDates.width) || !isFinite(comparisonDates.width) ? 10 : Math.max(comparisonDates.width, 1);
13174
- const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 4 : Math.max(comparisonDates.height, 1);
13175
- tasksRes.push(
13176
- /* @__PURE__ */ jsx(
13177
- "svg",
13178
- {
13179
- id: task.id + "_comparison",
13180
- className: "TaskItemWrapperComparison",
13181
- x: Math.max(safeComparisonX + (additionalLeftSpace || 0), 0),
13182
- y: safeComparisonY,
13183
- width: safeComparisonWidth,
13184
- height: safeComparisonHeight * 2,
13185
- children: /* @__PURE__ */ jsx(
13186
- BarComparison,
13187
- {
13188
- inProgress: !task.comparisonDates.end,
13189
- isPlan: task.comparisonDates.start.getTime() >= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.end.getTime() || task.comparisonDates.start.getTime() <= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.start.getTime(),
13190
- isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
13191
- isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
13192
- barCornerRadius: distances.barCornerRadius,
13193
- height: safeComparisonHeight,
13194
- width: safeComparisonWidth,
13195
- borderHeight: distances.barComparisonTaskBorderHeight,
13196
- yOffset: distances.barComparisonTaskYOffset,
13197
- task,
13198
- onTooltipTask
13199
- }
13200
- )
13201
- },
13202
- key2 + "_comparison"
13203
- )
13204
- );
13176
+ const safeComparisonWidth = isNaN(comparisonDates.width) || !isFinite(comparisonDates.width) ? 10 : Math.max(comparisonDates.width, 3);
13177
+ const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 6 : Math.max(comparisonDates.height, 3);
13178
+ const comparisonRight = safeComparisonX + safeComparisonWidth;
13179
+ const isVisible = comparisonRight >= 0 && safeComparisonX <= 1e4;
13180
+ if (isVisible) {
13181
+ tasksRes.push(
13182
+ /* @__PURE__ */ jsx(
13183
+ "svg",
13184
+ {
13185
+ id: task.id + "_comparison",
13186
+ className: "TaskItemWrapperComparison",
13187
+ x: Math.max(safeComparisonX + (additionalLeftSpace || 0), 0),
13188
+ y: safeLevelY + taskHeight + 2,
13189
+ width: safeComparisonWidth,
13190
+ height: safeComparisonHeight,
13191
+ children: /* @__PURE__ */ jsx(
13192
+ BarComparison,
13193
+ {
13194
+ inProgress: !task.comparisonDates.end,
13195
+ isPlan: task.comparisonDates.start.getTime() >= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.end.getTime() || task.comparisonDates.start.getTime() <= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.start.getTime(),
13196
+ isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
13197
+ isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
13198
+ barCornerRadius: distances.barCornerRadius,
13199
+ height: safeComparisonHeight,
13200
+ width: safeComparisonWidth,
13201
+ borderHeight: distances.barComparisonTaskBorderHeight,
13202
+ yOffset: distances.barComparisonTaskYOffset,
13203
+ task,
13204
+ onTooltipTask
13205
+ }
13206
+ )
13207
+ },
13208
+ key2 + "_comparison"
13209
+ )
13210
+ );
13211
+ }
13205
13212
  }
13206
13213
  const addedDependenciesAtLevel = addedDependencies[comparisonLevel] || {};
13207
13214
  if (!addedDependencies[comparisonLevel]) {
@@ -13860,11 +13867,12 @@ const countTaskCoordinates = (task, taskToRowIndexMap, startDate, viewMode, rtl,
13860
13867
  );
13861
13868
  cx1 = isNaN(cx1) || !isFinite(cx1) ? x1 : cx1;
13862
13869
  cx2 = isNaN(cx2) || !isFinite(cx2) ? x2 : cx2;
13870
+ const comparisonWidth = Math.max(Math.abs(cx2 - cx1), 3);
13871
+ const comparisonX = Math.min(cx1, cx2);
13863
13872
  comparisonDates = {
13864
- x: cx1,
13873
+ x: comparisonX,
13865
13874
  y: y + taskHeight,
13866
- width: Math.max(cx2 - cx1, 1),
13867
- // Ensure minimum width of 1px for visibility
13875
+ width: comparisonWidth,
13868
13876
  height: barComparisonTaskHeight
13869
13877
  };
13870
13878
  }
@@ -13185,40 +13185,47 @@
13185
13185
  )
13186
13186
  );
13187
13187
  if (task.comparisonDates && comparisonDates) {
13188
+ console.log(`Comparison bar for task ${task.id}:`, {
13189
+ originalCoords: comparisonDates,
13190
+ taskComparisonDates: task.comparisonDates
13191
+ });
13188
13192
  const safeComparisonX = isNaN(comparisonDates.x) || !isFinite(comparisonDates.x) ? 0 : comparisonDates.x;
13189
- const safeComparisonY = isNaN(comparisonDates.y) || !isFinite(comparisonDates.y) ? safeLevelY : comparisonDates.y;
13190
- const safeComparisonWidth = isNaN(comparisonDates.width) || !isFinite(comparisonDates.width) ? 10 : Math.max(comparisonDates.width, 1);
13191
- const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 4 : Math.max(comparisonDates.height, 1);
13192
- tasksRes.push(
13193
- /* @__PURE__ */ jsxRuntime.jsx(
13194
- "svg",
13195
- {
13196
- id: task.id + "_comparison",
13197
- className: "TaskItemWrapperComparison",
13198
- x: Math.max(safeComparisonX + (additionalLeftSpace || 0), 0),
13199
- y: safeComparisonY,
13200
- width: safeComparisonWidth,
13201
- height: safeComparisonHeight * 2,
13202
- children: /* @__PURE__ */ jsxRuntime.jsx(
13203
- BarComparison,
13204
- {
13205
- inProgress: !task.comparisonDates.end,
13206
- isPlan: task.comparisonDates.start.getTime() >= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.end.getTime() || task.comparisonDates.start.getTime() <= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.start.getTime(),
13207
- isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
13208
- isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
13209
- barCornerRadius: distances.barCornerRadius,
13210
- height: safeComparisonHeight,
13211
- width: safeComparisonWidth,
13212
- borderHeight: distances.barComparisonTaskBorderHeight,
13213
- yOffset: distances.barComparisonTaskYOffset,
13214
- task,
13215
- onTooltipTask
13216
- }
13217
- )
13218
- },
13219
- key2 + "_comparison"
13220
- )
13221
- );
13193
+ const safeComparisonWidth = isNaN(comparisonDates.width) || !isFinite(comparisonDates.width) ? 10 : Math.max(comparisonDates.width, 3);
13194
+ const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 6 : Math.max(comparisonDates.height, 3);
13195
+ const comparisonRight = safeComparisonX + safeComparisonWidth;
13196
+ const isVisible = comparisonRight >= 0 && safeComparisonX <= 1e4;
13197
+ if (isVisible) {
13198
+ tasksRes.push(
13199
+ /* @__PURE__ */ jsxRuntime.jsx(
13200
+ "svg",
13201
+ {
13202
+ id: task.id + "_comparison",
13203
+ className: "TaskItemWrapperComparison",
13204
+ x: Math.max(safeComparisonX + (additionalLeftSpace || 0), 0),
13205
+ y: safeLevelY + taskHeight + 2,
13206
+ width: safeComparisonWidth,
13207
+ height: safeComparisonHeight,
13208
+ children: /* @__PURE__ */ jsxRuntime.jsx(
13209
+ BarComparison,
13210
+ {
13211
+ inProgress: !task.comparisonDates.end,
13212
+ isPlan: task.comparisonDates.start.getTime() >= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.end.getTime() || task.comparisonDates.start.getTime() <= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.start.getTime(),
13213
+ isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
13214
+ isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
13215
+ barCornerRadius: distances.barCornerRadius,
13216
+ height: safeComparisonHeight,
13217
+ width: safeComparisonWidth,
13218
+ borderHeight: distances.barComparisonTaskBorderHeight,
13219
+ yOffset: distances.barComparisonTaskYOffset,
13220
+ task,
13221
+ onTooltipTask
13222
+ }
13223
+ )
13224
+ },
13225
+ key2 + "_comparison"
13226
+ )
13227
+ );
13228
+ }
13222
13229
  }
13223
13230
  const addedDependenciesAtLevel = addedDependencies[comparisonLevel] || {};
13224
13231
  if (!addedDependencies[comparisonLevel]) {
@@ -13877,11 +13884,12 @@
13877
13884
  );
13878
13885
  cx1 = isNaN(cx1) || !isFinite(cx1) ? x1 : cx1;
13879
13886
  cx2 = isNaN(cx2) || !isFinite(cx2) ? x2 : cx2;
13887
+ const comparisonWidth = Math.max(Math.abs(cx2 - cx1), 3);
13888
+ const comparisonX = Math.min(cx1, cx2);
13880
13889
  comparisonDates = {
13881
- x: cx1,
13890
+ x: comparisonX,
13882
13891
  y: y + taskHeight,
13883
- width: Math.max(cx2 - cx1, 1),
13884
- // Ensure minimum width of 1px for visibility
13892
+ width: comparisonWidth,
13885
13893
  height: barComparisonTaskHeight
13886
13894
  };
13887
13895
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Interactive Gantt Chart for React with TypeScript.",
5
5
  "author": "aguilanbon",
6
6
  "homepage": "https://github.com/aguilanbon/gantt-task-react-v",