gantt-task-react-v 1.3.4 → 1.3.6

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.
@@ -13115,73 +13115,19 @@ const TaskGanttContentInner = (props) => {
13115
13115
  const safeProgressWidth = isNaN(progressWidth) || !isFinite(progressWidth) ? 0 : Math.max(progressWidth, 0);
13116
13116
  const safeInnerX1 = isNaN(innerX1) || !isFinite(innerX1) ? 0 : innerX1;
13117
13117
  const safeInnerX2 = isNaN(innerX2) || !isFinite(innerX2) ? safeInnerX1 + safeWidth : innerX2;
13118
- tasksRes.push(
13119
- /* @__PURE__ */ jsx(
13120
- "svg",
13121
- {
13122
- id: task.id,
13123
- className: `${styles$4.TaskItemWrapper} TaskItemWrapper`,
13124
- x: Math.max(safeContainerX + (additionalLeftSpace || 0), 0),
13125
- y: safeLevelY,
13126
- width: Math.max(safeContainerWidth, 0),
13127
- height: fullRowHeight,
13128
- children: /* @__PURE__ */ jsx(
13129
- TaskItem,
13130
- {
13131
- movingAction: taskBarMovingAction(task),
13132
- allowMoveTaskBar,
13133
- hasChildren: checkHasChildren(task, childTasksMap),
13134
- progressWidth: safeProgressWidth,
13135
- progressX: rtl ? safeInnerX2 : safeInnerX1,
13136
- onSelectTaskOnMouseDown: selectTaskOnMouseDown,
13137
- task,
13138
- taskYOffset,
13139
- width: safeWidth,
13140
- x1: safeInnerX1,
13141
- x2: safeInnerX2,
13142
- distances,
13143
- taskHeight,
13144
- taskHalfHeight,
13145
- isProgressChangeable: (t) => isProgressChangeable(t) && !waitCommitTasks,
13146
- isDateChangeable: (t) => isDateChangeable(t) && !waitCommitTasks,
13147
- isRelationChangeable: (t) => isRelationChangeable(t) && !waitCommitTasks,
13148
- authorizedRelations,
13149
- ganttRelationEvent,
13150
- canDelete: !task.isDisabled && !waitCommitTasks,
13151
- onDoubleClick,
13152
- onClick,
13153
- onEventStart: onTaskBarDragStart,
13154
- onTooltipTask,
13155
- onRelationStart: onTaskBarRelationStart,
13156
- isSelected: Boolean(selectedIdsMirror[taskId]),
13157
- isCritical,
13158
- rtl,
13159
- onDeleteTask,
13160
- renderCustomLabel,
13161
- viewMode,
13162
- showProgress,
13163
- progressColor
13164
- }
13165
- )
13166
- },
13167
- key2
13168
- )
13169
- );
13118
+ let comparisonBarElement = null;
13170
13119
  if (task.comparisonDates && comparisonDates) {
13171
13120
  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",
13121
+ const safeComparisonWidth = isNaN(comparisonDates.width) || !isFinite(comparisonDates.width) ? 10 : Math.max(comparisonDates.width, 3);
13122
+ const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 6 : Math.max(comparisonDates.height, 3);
13123
+ const comparisonRight = safeComparisonX + safeComparisonWidth;
13124
+ const isVisible = comparisonRight >= 0 && safeComparisonX <= 1e4;
13125
+ if (isVisible) {
13126
+ const relativeComparisonX = safeComparisonX - safeContainerX;
13127
+ comparisonBarElement = /* @__PURE__ */ jsx(
13128
+ "g",
13178
13129
  {
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,
13130
+ transform: `translate(${relativeComparisonX}, ${taskHeight + 2})`,
13185
13131
  children: /* @__PURE__ */ jsx(
13186
13132
  BarComparison,
13187
13133
  {
@@ -13193,16 +13139,70 @@ const TaskGanttContentInner = (props) => {
13193
13139
  height: safeComparisonHeight,
13194
13140
  width: safeComparisonWidth,
13195
13141
  borderHeight: distances.barComparisonTaskBorderHeight,
13196
- yOffset: distances.barComparisonTaskYOffset,
13142
+ yOffset: 0,
13197
13143
  task,
13198
13144
  onTooltipTask
13199
13145
  }
13200
13146
  )
13201
- },
13202
- key2 + "_comparison"
13203
- )
13204
- );
13147
+ }
13148
+ );
13149
+ }
13205
13150
  }
13151
+ tasksRes.push(
13152
+ /* @__PURE__ */ jsxs(
13153
+ "svg",
13154
+ {
13155
+ id: task.id,
13156
+ className: `${styles$4.TaskItemWrapper} TaskItemWrapper`,
13157
+ x: Math.max(safeContainerX + (additionalLeftSpace || 0), 0),
13158
+ y: safeLevelY,
13159
+ width: Math.max(safeContainerWidth, 0),
13160
+ height: fullRowHeight,
13161
+ children: [
13162
+ /* @__PURE__ */ jsx(
13163
+ TaskItem,
13164
+ {
13165
+ movingAction: taskBarMovingAction(task),
13166
+ allowMoveTaskBar,
13167
+ hasChildren: checkHasChildren(task, childTasksMap),
13168
+ progressWidth: safeProgressWidth,
13169
+ progressX: rtl ? safeInnerX2 : safeInnerX1,
13170
+ onSelectTaskOnMouseDown: selectTaskOnMouseDown,
13171
+ task,
13172
+ taskYOffset,
13173
+ width: safeWidth,
13174
+ x1: safeInnerX1,
13175
+ x2: safeInnerX2,
13176
+ distances,
13177
+ taskHeight,
13178
+ taskHalfHeight,
13179
+ isProgressChangeable: (t) => isProgressChangeable(t) && !waitCommitTasks,
13180
+ isDateChangeable: (t) => isDateChangeable(t) && !waitCommitTasks,
13181
+ isRelationChangeable: (t) => isRelationChangeable(t) && !waitCommitTasks,
13182
+ authorizedRelations,
13183
+ ganttRelationEvent,
13184
+ canDelete: !task.isDisabled && !waitCommitTasks,
13185
+ onDoubleClick,
13186
+ onClick,
13187
+ onEventStart: onTaskBarDragStart,
13188
+ onTooltipTask,
13189
+ onRelationStart: onTaskBarRelationStart,
13190
+ isSelected: Boolean(selectedIdsMirror[taskId]),
13191
+ isCritical,
13192
+ rtl,
13193
+ onDeleteTask,
13194
+ renderCustomLabel,
13195
+ viewMode,
13196
+ showProgress,
13197
+ progressColor
13198
+ }
13199
+ ),
13200
+ comparisonBarElement
13201
+ ]
13202
+ },
13203
+ key2
13204
+ )
13205
+ );
13206
13206
  const addedDependenciesAtLevel = addedDependencies[comparisonLevel] || {};
13207
13207
  if (!addedDependencies[comparisonLevel]) {
13208
13208
  addedDependencies[comparisonLevel] = addedDependenciesAtLevel;
@@ -13860,11 +13860,12 @@ const countTaskCoordinates = (task, taskToRowIndexMap, startDate, viewMode, rtl,
13860
13860
  );
13861
13861
  cx1 = isNaN(cx1) || !isFinite(cx1) ? x1 : cx1;
13862
13862
  cx2 = isNaN(cx2) || !isFinite(cx2) ? x2 : cx2;
13863
+ const comparisonWidth = Math.max(Math.abs(cx2 - cx1), 3);
13864
+ const comparisonX = Math.min(cx1, cx2);
13863
13865
  comparisonDates = {
13864
- x: cx1,
13866
+ x: comparisonX,
13865
13867
  y: y + taskHeight,
13866
- width: Math.max(cx2 - cx1, 1),
13867
- // Ensure minimum width of 1px for visibility
13868
+ width: comparisonWidth,
13868
13869
  height: barComparisonTaskHeight
13869
13870
  };
13870
13871
  }
@@ -13132,73 +13132,19 @@
13132
13132
  const safeProgressWidth = isNaN(progressWidth) || !isFinite(progressWidth) ? 0 : Math.max(progressWidth, 0);
13133
13133
  const safeInnerX1 = isNaN(innerX1) || !isFinite(innerX1) ? 0 : innerX1;
13134
13134
  const safeInnerX2 = isNaN(innerX2) || !isFinite(innerX2) ? safeInnerX1 + safeWidth : innerX2;
13135
- tasksRes.push(
13136
- /* @__PURE__ */ jsxRuntime.jsx(
13137
- "svg",
13138
- {
13139
- id: task.id,
13140
- className: `${styles$4.TaskItemWrapper} TaskItemWrapper`,
13141
- x: Math.max(safeContainerX + (additionalLeftSpace || 0), 0),
13142
- y: safeLevelY,
13143
- width: Math.max(safeContainerWidth, 0),
13144
- height: fullRowHeight,
13145
- children: /* @__PURE__ */ jsxRuntime.jsx(
13146
- TaskItem,
13147
- {
13148
- movingAction: taskBarMovingAction(task),
13149
- allowMoveTaskBar,
13150
- hasChildren: checkHasChildren(task, childTasksMap),
13151
- progressWidth: safeProgressWidth,
13152
- progressX: rtl ? safeInnerX2 : safeInnerX1,
13153
- onSelectTaskOnMouseDown: selectTaskOnMouseDown,
13154
- task,
13155
- taskYOffset,
13156
- width: safeWidth,
13157
- x1: safeInnerX1,
13158
- x2: safeInnerX2,
13159
- distances,
13160
- taskHeight,
13161
- taskHalfHeight,
13162
- isProgressChangeable: (t) => isProgressChangeable(t) && !waitCommitTasks,
13163
- isDateChangeable: (t) => isDateChangeable(t) && !waitCommitTasks,
13164
- isRelationChangeable: (t) => isRelationChangeable(t) && !waitCommitTasks,
13165
- authorizedRelations,
13166
- ganttRelationEvent,
13167
- canDelete: !task.isDisabled && !waitCommitTasks,
13168
- onDoubleClick,
13169
- onClick,
13170
- onEventStart: onTaskBarDragStart,
13171
- onTooltipTask,
13172
- onRelationStart: onTaskBarRelationStart,
13173
- isSelected: Boolean(selectedIdsMirror[taskId]),
13174
- isCritical,
13175
- rtl,
13176
- onDeleteTask,
13177
- renderCustomLabel,
13178
- viewMode,
13179
- showProgress,
13180
- progressColor
13181
- }
13182
- )
13183
- },
13184
- key2
13185
- )
13186
- );
13135
+ let comparisonBarElement = null;
13187
13136
  if (task.comparisonDates && comparisonDates) {
13188
13137
  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",
13138
+ const safeComparisonWidth = isNaN(comparisonDates.width) || !isFinite(comparisonDates.width) ? 10 : Math.max(comparisonDates.width, 3);
13139
+ const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 6 : Math.max(comparisonDates.height, 3);
13140
+ const comparisonRight = safeComparisonX + safeComparisonWidth;
13141
+ const isVisible = comparisonRight >= 0 && safeComparisonX <= 1e4;
13142
+ if (isVisible) {
13143
+ const relativeComparisonX = safeComparisonX - safeContainerX;
13144
+ comparisonBarElement = /* @__PURE__ */ jsxRuntime.jsx(
13145
+ "g",
13195
13146
  {
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,
13147
+ transform: `translate(${relativeComparisonX}, ${taskHeight + 2})`,
13202
13148
  children: /* @__PURE__ */ jsxRuntime.jsx(
13203
13149
  BarComparison,
13204
13150
  {
@@ -13210,16 +13156,70 @@
13210
13156
  height: safeComparisonHeight,
13211
13157
  width: safeComparisonWidth,
13212
13158
  borderHeight: distances.barComparisonTaskBorderHeight,
13213
- yOffset: distances.barComparisonTaskYOffset,
13159
+ yOffset: 0,
13214
13160
  task,
13215
13161
  onTooltipTask
13216
13162
  }
13217
13163
  )
13218
- },
13219
- key2 + "_comparison"
13220
- )
13221
- );
13164
+ }
13165
+ );
13166
+ }
13222
13167
  }
13168
+ tasksRes.push(
13169
+ /* @__PURE__ */ jsxRuntime.jsxs(
13170
+ "svg",
13171
+ {
13172
+ id: task.id,
13173
+ className: `${styles$4.TaskItemWrapper} TaskItemWrapper`,
13174
+ x: Math.max(safeContainerX + (additionalLeftSpace || 0), 0),
13175
+ y: safeLevelY,
13176
+ width: Math.max(safeContainerWidth, 0),
13177
+ height: fullRowHeight,
13178
+ children: [
13179
+ /* @__PURE__ */ jsxRuntime.jsx(
13180
+ TaskItem,
13181
+ {
13182
+ movingAction: taskBarMovingAction(task),
13183
+ allowMoveTaskBar,
13184
+ hasChildren: checkHasChildren(task, childTasksMap),
13185
+ progressWidth: safeProgressWidth,
13186
+ progressX: rtl ? safeInnerX2 : safeInnerX1,
13187
+ onSelectTaskOnMouseDown: selectTaskOnMouseDown,
13188
+ task,
13189
+ taskYOffset,
13190
+ width: safeWidth,
13191
+ x1: safeInnerX1,
13192
+ x2: safeInnerX2,
13193
+ distances,
13194
+ taskHeight,
13195
+ taskHalfHeight,
13196
+ isProgressChangeable: (t) => isProgressChangeable(t) && !waitCommitTasks,
13197
+ isDateChangeable: (t) => isDateChangeable(t) && !waitCommitTasks,
13198
+ isRelationChangeable: (t) => isRelationChangeable(t) && !waitCommitTasks,
13199
+ authorizedRelations,
13200
+ ganttRelationEvent,
13201
+ canDelete: !task.isDisabled && !waitCommitTasks,
13202
+ onDoubleClick,
13203
+ onClick,
13204
+ onEventStart: onTaskBarDragStart,
13205
+ onTooltipTask,
13206
+ onRelationStart: onTaskBarRelationStart,
13207
+ isSelected: Boolean(selectedIdsMirror[taskId]),
13208
+ isCritical,
13209
+ rtl,
13210
+ onDeleteTask,
13211
+ renderCustomLabel,
13212
+ viewMode,
13213
+ showProgress,
13214
+ progressColor
13215
+ }
13216
+ ),
13217
+ comparisonBarElement
13218
+ ]
13219
+ },
13220
+ key2
13221
+ )
13222
+ );
13223
13223
  const addedDependenciesAtLevel = addedDependencies[comparisonLevel] || {};
13224
13224
  if (!addedDependencies[comparisonLevel]) {
13225
13225
  addedDependencies[comparisonLevel] = addedDependenciesAtLevel;
@@ -13877,11 +13877,12 @@
13877
13877
  );
13878
13878
  cx1 = isNaN(cx1) || !isFinite(cx1) ? x1 : cx1;
13879
13879
  cx2 = isNaN(cx2) || !isFinite(cx2) ? x2 : cx2;
13880
+ const comparisonWidth = Math.max(Math.abs(cx2 - cx1), 3);
13881
+ const comparisonX = Math.min(cx1, cx2);
13880
13882
  comparisonDates = {
13881
- x: cx1,
13883
+ x: comparisonX,
13882
13884
  y: y + taskHeight,
13883
- width: Math.max(cx2 - cx1, 1),
13884
- // Ensure minimum width of 1px for visibility
13885
+ width: comparisonWidth,
13885
13886
  height: barComparisonTaskHeight
13886
13887
  };
13887
13888
  }
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.6",
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",