gantt-task-react-v 1.3.0 → 1.3.3
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/gantt-task-react.es.js +97 -45
- package/dist/gantt-task-react.umd.js +97 -45
- package/package.json +7 -5
|
@@ -11818,29 +11818,45 @@ const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
|
11818
11818
|
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11819
11819
|
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11820
11820
|
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11821
|
-
const
|
|
11822
|
-
|
|
11821
|
+
const intervalDuration = nextDate.getTime() - currentDate.getTime();
|
|
11822
|
+
const percentOfInterval = intervalDuration === 0 ? 0 : remainderMillis / intervalDuration;
|
|
11823
|
+
const result = index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11824
|
+
return isNaN(result) || !isFinite(result) ? 0 : result;
|
|
11823
11825
|
};
|
|
11824
11826
|
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11825
11827
|
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11826
11828
|
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11827
11829
|
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11828
11830
|
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11829
|
-
const
|
|
11830
|
-
|
|
11831
|
+
const intervalDuration = nextDate.getTime() - currentDate.getTime();
|
|
11832
|
+
const percentOfInterval = intervalDuration === 0 ? 0 : remainderMillis / intervalDuration;
|
|
11833
|
+
const result = index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11834
|
+
return isNaN(result) || !isFinite(result) ? 0 : result;
|
|
11831
11835
|
};
|
|
11832
11836
|
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
11833
|
-
const
|
|
11837
|
+
const safeTaskX1 = isNaN(taskX1) || !isFinite(taskX1) ? 0 : taskX1;
|
|
11838
|
+
const safeTaskX2 = isNaN(taskX2) || !isFinite(taskX2) ? 0 : taskX2;
|
|
11839
|
+
const safeProgress = isNaN(progress) || !isFinite(progress) ? 0 : progress;
|
|
11840
|
+
const progressWidth = Math.max(
|
|
11841
|
+
(safeTaskX2 - safeTaskX1) * safeProgress * 0.01,
|
|
11842
|
+
0
|
|
11843
|
+
);
|
|
11834
11844
|
let progressX;
|
|
11835
11845
|
if (rtl) {
|
|
11836
|
-
progressX =
|
|
11846
|
+
progressX = safeTaskX2 - progressWidth;
|
|
11837
11847
|
} else {
|
|
11838
|
-
progressX =
|
|
11848
|
+
progressX = safeTaskX1;
|
|
11839
11849
|
}
|
|
11840
11850
|
return [progressWidth, progressX];
|
|
11841
11851
|
};
|
|
11842
11852
|
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
11843
|
-
|
|
11853
|
+
const safeX = isNaN(x) || !isFinite(x) ? 0 : x;
|
|
11854
|
+
const safeTaskX = isNaN(taskX) || !isFinite(taskX) ? 0 : taskX;
|
|
11855
|
+
const safeXStep = isNaN(xStep) || !isFinite(xStep) || xStep === 0 ? 1 : xStep;
|
|
11856
|
+
const safeTimeStep = isNaN(timeStep) || !isFinite(timeStep) ? 0 : timeStep;
|
|
11857
|
+
let newDate = new Date(
|
|
11858
|
+
(safeX - safeTaskX) / safeXStep * safeTimeStep + taskDate.getTime()
|
|
11859
|
+
);
|
|
11844
11860
|
newDate = new Date(
|
|
11845
11861
|
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
11846
11862
|
);
|
|
@@ -13092,15 +13108,22 @@ const TaskGanttContentInner = (props) => {
|
|
|
13092
13108
|
x2: taskX2,
|
|
13093
13109
|
comparisonDates
|
|
13094
13110
|
} = getTaskCoordinates2(task);
|
|
13111
|
+
const safeContainerX = isNaN(containerX) || !isFinite(containerX) ? 0 : containerX;
|
|
13112
|
+
const safeContainerWidth = isNaN(containerWidth) || !isFinite(containerWidth) ? 0 : Math.max(containerWidth, 0);
|
|
13113
|
+
const safeWidth = isNaN(width) || !isFinite(width) ? 10 : Math.max(width, 1);
|
|
13114
|
+
const safeLevelY = isNaN(levelY) || !isFinite(levelY) ? 0 : levelY;
|
|
13115
|
+
const safeProgressWidth = isNaN(progressWidth) || !isFinite(progressWidth) ? 0 : Math.max(progressWidth, 0);
|
|
13116
|
+
const safeInnerX1 = isNaN(innerX1) || !isFinite(innerX1) ? 0 : innerX1;
|
|
13117
|
+
const safeInnerX2 = isNaN(innerX2) || !isFinite(innerX2) ? safeInnerX1 + safeWidth : innerX2;
|
|
13095
13118
|
tasksRes.push(
|
|
13096
13119
|
/* @__PURE__ */ jsx(
|
|
13097
13120
|
"svg",
|
|
13098
13121
|
{
|
|
13099
13122
|
id: task.id,
|
|
13100
13123
|
className: `${styles$4.TaskItemWrapper} TaskItemWrapper`,
|
|
13101
|
-
x: Math.max(
|
|
13102
|
-
y:
|
|
13103
|
-
width: Math.max(
|
|
13124
|
+
x: Math.max(safeContainerX + (additionalLeftSpace || 0), 0),
|
|
13125
|
+
y: safeLevelY,
|
|
13126
|
+
width: Math.max(safeContainerWidth, 0),
|
|
13104
13127
|
height: fullRowHeight,
|
|
13105
13128
|
children: /* @__PURE__ */ jsx(
|
|
13106
13129
|
TaskItem,
|
|
@@ -13108,14 +13131,14 @@ const TaskGanttContentInner = (props) => {
|
|
|
13108
13131
|
movingAction: taskBarMovingAction(task),
|
|
13109
13132
|
allowMoveTaskBar,
|
|
13110
13133
|
hasChildren: checkHasChildren(task, childTasksMap),
|
|
13111
|
-
progressWidth,
|
|
13112
|
-
progressX: rtl ?
|
|
13134
|
+
progressWidth: safeProgressWidth,
|
|
13135
|
+
progressX: rtl ? safeInnerX2 : safeInnerX1,
|
|
13113
13136
|
onSelectTaskOnMouseDown: selectTaskOnMouseDown,
|
|
13114
13137
|
task,
|
|
13115
13138
|
taskYOffset,
|
|
13116
|
-
width,
|
|
13117
|
-
x1:
|
|
13118
|
-
x2:
|
|
13139
|
+
width: safeWidth,
|
|
13140
|
+
x1: safeInnerX1,
|
|
13141
|
+
x2: safeInnerX2,
|
|
13119
13142
|
distances,
|
|
13120
13143
|
taskHeight,
|
|
13121
13144
|
taskHalfHeight,
|
|
@@ -13145,16 +13168,20 @@ const TaskGanttContentInner = (props) => {
|
|
|
13145
13168
|
)
|
|
13146
13169
|
);
|
|
13147
13170
|
if (task.comparisonDates && comparisonDates) {
|
|
13171
|
+
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) ? 0 : Math.max(comparisonDates.width, 0);
|
|
13174
|
+
const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 0 : Math.max(comparisonDates.height, 0);
|
|
13148
13175
|
tasksRes.push(
|
|
13149
13176
|
/* @__PURE__ */ jsx(
|
|
13150
13177
|
"svg",
|
|
13151
13178
|
{
|
|
13152
13179
|
id: task.id + "_comparison",
|
|
13153
13180
|
className: "TaskItemWrapperComparison",
|
|
13154
|
-
x: Math.max(
|
|
13155
|
-
y:
|
|
13156
|
-
width:
|
|
13157
|
-
height:
|
|
13181
|
+
x: Math.max(safeComparisonX + (additionalLeftSpace || 0), 0),
|
|
13182
|
+
y: safeComparisonY,
|
|
13183
|
+
width: safeComparisonWidth,
|
|
13184
|
+
height: safeComparisonHeight * 2,
|
|
13158
13185
|
children: /* @__PURE__ */ jsx(
|
|
13159
13186
|
BarComparison,
|
|
13160
13187
|
{
|
|
@@ -13163,8 +13190,8 @@ const TaskGanttContentInner = (props) => {
|
|
|
13163
13190
|
isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
|
|
13164
13191
|
isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
|
|
13165
13192
|
barCornerRadius: distances.barCornerRadius,
|
|
13166
|
-
height:
|
|
13167
|
-
width:
|
|
13193
|
+
height: safeComparisonHeight,
|
|
13194
|
+
width: safeComparisonWidth,
|
|
13168
13195
|
borderHeight: distances.barComparisonTaskBorderHeight,
|
|
13169
13196
|
yOffset: distances.barComparisonTaskYOffset,
|
|
13170
13197
|
task,
|
|
@@ -13207,15 +13234,24 @@ const TaskGanttContentInner = (props) => {
|
|
|
13207
13234
|
addedDependenciesAtTask[source.id] = true;
|
|
13208
13235
|
const isCritical2 = criticalPathForTask ? criticalPathForTask.has(source.id) : false;
|
|
13209
13236
|
const { x1: fromX1, x2: fromX2 } = getTaskCoordinates2(source);
|
|
13210
|
-
const
|
|
13211
|
-
const
|
|
13237
|
+
const safeFromX1 = isNaN(fromX1) || !isFinite(fromX1) ? 0 : fromX1;
|
|
13238
|
+
const safeFromX2 = isNaN(fromX2) || !isFinite(fromX2) ? safeFromX1 + 10 : fromX2;
|
|
13239
|
+
const safeTaskX1 = isNaN(taskX1) || !isFinite(taskX1) ? 0 : taskX1;
|
|
13240
|
+
const safeTaskX2 = isNaN(taskX2) || !isFinite(taskX2) ? safeTaskX1 + 10 : taskX2;
|
|
13241
|
+
const containerX2 = Math.min(safeFromX1, safeTaskX1) - DELTA_RELATION_WIDTH;
|
|
13242
|
+
const containerWidth2 = Math.max(safeFromX2, safeTaskX2) - containerX2 + DELTA_RELATION_WIDTH;
|
|
13243
|
+
const safeArrowContainerX = isNaN(containerX2) || !isFinite(containerX2) ? 0 : containerX2;
|
|
13244
|
+
const safeArrowContainerWidth = isNaN(containerWidth2) || !isFinite(containerWidth2) ? 100 : Math.max(containerWidth2, 0);
|
|
13212
13245
|
arrowsRes.push(
|
|
13213
13246
|
/* @__PURE__ */ jsx(
|
|
13214
13247
|
"svg",
|
|
13215
13248
|
{
|
|
13216
|
-
x: Math.max(
|
|
13249
|
+
x: Math.max(
|
|
13250
|
+
safeArrowContainerX + (additionalLeftSpace || 0),
|
|
13251
|
+
0
|
|
13252
|
+
),
|
|
13217
13253
|
y: containerY,
|
|
13218
|
-
width:
|
|
13254
|
+
width: safeArrowContainerWidth,
|
|
13219
13255
|
height: containerHeight,
|
|
13220
13256
|
children: /* @__PURE__ */ jsx(
|
|
13221
13257
|
Arrow,
|
|
@@ -13223,13 +13259,13 @@ const TaskGanttContentInner = (props) => {
|
|
|
13223
13259
|
distances,
|
|
13224
13260
|
taskFrom: source,
|
|
13225
13261
|
targetFrom: sourceTarget,
|
|
13226
|
-
fromX1:
|
|
13227
|
-
fromX2:
|
|
13262
|
+
fromX1: safeFromX1 - safeArrowContainerX,
|
|
13263
|
+
fromX2: safeFromX2 - safeArrowContainerX,
|
|
13228
13264
|
fromY: innerFromY,
|
|
13229
13265
|
taskTo: task,
|
|
13230
13266
|
targetTo: ownTarget,
|
|
13231
|
-
toX1:
|
|
13232
|
-
toX2:
|
|
13267
|
+
toX1: safeTaskX1 - safeArrowContainerX,
|
|
13268
|
+
toX2: safeTaskX2 - safeArrowContainerX,
|
|
13233
13269
|
toY: innerToY,
|
|
13234
13270
|
fullRowHeight,
|
|
13235
13271
|
taskHeight,
|
|
@@ -13272,15 +13308,24 @@ const TaskGanttContentInner = (props) => {
|
|
|
13272
13308
|
const criticalPathForTask = criticalPathOnLevel ? criticalPathOnLevel.dependencies.get(dependent.id) : void 0;
|
|
13273
13309
|
const isCritical2 = criticalPathForTask ? criticalPathForTask.has(task.id) : false;
|
|
13274
13310
|
const { x1: toX1, x2: toX2 } = getTaskCoordinates2(dependent);
|
|
13275
|
-
const
|
|
13276
|
-
const
|
|
13311
|
+
const safeToX1 = isNaN(toX1) || !isFinite(toX1) ? 0 : toX1;
|
|
13312
|
+
const safeToX2 = isNaN(toX2) || !isFinite(toX2) ? safeToX1 + 10 : toX2;
|
|
13313
|
+
const safeTaskX1 = isNaN(taskX1) || !isFinite(taskX1) ? 0 : taskX1;
|
|
13314
|
+
const safeTaskX2 = isNaN(taskX2) || !isFinite(taskX2) ? safeTaskX1 + 10 : taskX2;
|
|
13315
|
+
const containerX2 = Math.min(safeToX1, safeTaskX1) - DELTA_RELATION_WIDTH;
|
|
13316
|
+
const containerWidth2 = Math.max(safeToX2, safeTaskX2) - containerX2 + DELTA_RELATION_WIDTH;
|
|
13317
|
+
const safeArrowContainerX = isNaN(containerX2) || !isFinite(containerX2) ? 0 : containerX2;
|
|
13318
|
+
const safeArrowContainerWidth = isNaN(containerWidth2) || !isFinite(containerWidth2) ? 100 : Math.max(containerWidth2, 0);
|
|
13277
13319
|
arrowsRes.push(
|
|
13278
13320
|
/* @__PURE__ */ jsx(
|
|
13279
13321
|
"svg",
|
|
13280
13322
|
{
|
|
13281
|
-
x: Math.max(
|
|
13323
|
+
x: Math.max(
|
|
13324
|
+
safeArrowContainerX + (additionalLeftSpace || 0),
|
|
13325
|
+
0
|
|
13326
|
+
),
|
|
13282
13327
|
y: containerY,
|
|
13283
|
-
width:
|
|
13328
|
+
width: safeArrowContainerWidth,
|
|
13284
13329
|
height: containerHeight,
|
|
13285
13330
|
children: /* @__PURE__ */ jsx(
|
|
13286
13331
|
Arrow,
|
|
@@ -13288,13 +13333,13 @@ const TaskGanttContentInner = (props) => {
|
|
|
13288
13333
|
distances,
|
|
13289
13334
|
taskFrom: task,
|
|
13290
13335
|
targetFrom: ownTarget,
|
|
13291
|
-
fromX1:
|
|
13292
|
-
fromX2:
|
|
13336
|
+
fromX1: safeTaskX1 - safeArrowContainerX,
|
|
13337
|
+
fromX2: safeTaskX2 - safeArrowContainerX,
|
|
13293
13338
|
fromY: innerFromY,
|
|
13294
13339
|
taskTo: dependent,
|
|
13295
13340
|
targetTo: dependentTarget,
|
|
13296
|
-
toX1:
|
|
13297
|
-
toX2:
|
|
13341
|
+
toX1: safeToX1 - safeArrowContainerX,
|
|
13342
|
+
toX2: safeToX2 - safeArrowContainerX,
|
|
13298
13343
|
toY: innerToY,
|
|
13299
13344
|
fullRowHeight,
|
|
13300
13345
|
taskHeight,
|
|
@@ -13772,21 +13817,26 @@ const countTaskCoordinates = (task, taskToRowIndexMap, startDate, viewMode, rtl,
|
|
|
13772
13817
|
if (typeof rowIndex !== "number") {
|
|
13773
13818
|
throw new Error(`Row index for task ${id} is not found`);
|
|
13774
13819
|
}
|
|
13775
|
-
|
|
13776
|
-
|
|
13820
|
+
let x1 = rtl ? svgWidth - taskXCoordinate(task.end, startDate, viewMode, columnWidth) : taskXCoordinate(task.start, startDate, viewMode, columnWidth);
|
|
13821
|
+
let x2 = rtl ? svgWidth - taskXCoordinate(task.start, startDate, viewMode, columnWidth) : taskXCoordinate(task.end, startDate, viewMode, columnWidth);
|
|
13822
|
+
x1 = isNaN(x1) || !isFinite(x1) ? 0 : x1;
|
|
13823
|
+
x2 = isNaN(x2) || !isFinite(x2) ? Math.max(x1, 10) : x2;
|
|
13777
13824
|
const levelY = rowIndex * fullRowHeight + rowHeight * (comparisonLevel - 1);
|
|
13778
13825
|
const y = levelY + taskYOffset;
|
|
13779
13826
|
const [progressWidth, progressX] = type === "milestone" ? [0, x1] : progressWithByParams(x1, x2, progress, rtl);
|
|
13780
13827
|
const taskX1 = type === "milestone" ? x1 - taskHeight * 0.5 : x1;
|
|
13781
13828
|
const taskX2 = type === "milestone" ? x2 + taskHeight * 0.5 : x2;
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13829
|
+
let taskWidth = type === "milestone" ? taskHeight : Math.max(taskX2 - taskX1, 10);
|
|
13830
|
+
taskWidth = isNaN(taskWidth) || !isFinite(taskWidth) ? 10 : Math.max(taskWidth, 1);
|
|
13831
|
+
let containerX = taskX1 - columnWidth;
|
|
13832
|
+
containerX = isNaN(containerX) || !isFinite(containerX) ? 0 : containerX;
|
|
13833
|
+
let containerWidth = svgWidth - containerX;
|
|
13834
|
+
containerWidth = isNaN(containerWidth) || !isFinite(containerWidth) ? svgWidth : Math.max(containerWidth, 0);
|
|
13785
13835
|
const innerX1 = columnWidth;
|
|
13786
13836
|
const innerX2 = columnWidth + taskWidth;
|
|
13787
13837
|
let comparisonDates;
|
|
13788
13838
|
if (task.comparisonDates) {
|
|
13789
|
-
|
|
13839
|
+
let cx1 = rtl ? svgWidth - taskComparisonXCoordinate(
|
|
13790
13840
|
task.comparisonDates.end || task.end,
|
|
13791
13841
|
startDate,
|
|
13792
13842
|
viewMode,
|
|
@@ -13797,7 +13847,7 @@ const countTaskCoordinates = (task, taskToRowIndexMap, startDate, viewMode, rtl,
|
|
|
13797
13847
|
viewMode,
|
|
13798
13848
|
columnWidth
|
|
13799
13849
|
);
|
|
13800
|
-
|
|
13850
|
+
let cx2 = rtl ? svgWidth - taskComparisonXCoordinate(
|
|
13801
13851
|
task.comparisonDates.start,
|
|
13802
13852
|
startDate,
|
|
13803
13853
|
viewMode,
|
|
@@ -13808,6 +13858,8 @@ const countTaskCoordinates = (task, taskToRowIndexMap, startDate, viewMode, rtl,
|
|
|
13808
13858
|
viewMode,
|
|
13809
13859
|
columnWidth
|
|
13810
13860
|
);
|
|
13861
|
+
cx1 = isNaN(cx1) || !isFinite(cx1) ? x1 : cx1;
|
|
13862
|
+
cx2 = isNaN(cx2) || !isFinite(cx2) ? x2 : cx2;
|
|
13811
13863
|
comparisonDates = {
|
|
13812
13864
|
x: cx1,
|
|
13813
13865
|
y: y + taskHeight,
|
|
@@ -11835,29 +11835,45 @@
|
|
|
11835
11835
|
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11836
11836
|
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11837
11837
|
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11838
|
-
const
|
|
11839
|
-
|
|
11838
|
+
const intervalDuration = nextDate.getTime() - currentDate.getTime();
|
|
11839
|
+
const percentOfInterval = intervalDuration === 0 ? 0 : remainderMillis / intervalDuration;
|
|
11840
|
+
const result = index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11841
|
+
return isNaN(result) || !isFinite(result) ? 0 : result;
|
|
11840
11842
|
};
|
|
11841
11843
|
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11842
11844
|
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11843
11845
|
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11844
11846
|
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11845
11847
|
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11846
|
-
const
|
|
11847
|
-
|
|
11848
|
+
const intervalDuration = nextDate.getTime() - currentDate.getTime();
|
|
11849
|
+
const percentOfInterval = intervalDuration === 0 ? 0 : remainderMillis / intervalDuration;
|
|
11850
|
+
const result = index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11851
|
+
return isNaN(result) || !isFinite(result) ? 0 : result;
|
|
11848
11852
|
};
|
|
11849
11853
|
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
11850
|
-
const
|
|
11854
|
+
const safeTaskX1 = isNaN(taskX1) || !isFinite(taskX1) ? 0 : taskX1;
|
|
11855
|
+
const safeTaskX2 = isNaN(taskX2) || !isFinite(taskX2) ? 0 : taskX2;
|
|
11856
|
+
const safeProgress = isNaN(progress) || !isFinite(progress) ? 0 : progress;
|
|
11857
|
+
const progressWidth = Math.max(
|
|
11858
|
+
(safeTaskX2 - safeTaskX1) * safeProgress * 0.01,
|
|
11859
|
+
0
|
|
11860
|
+
);
|
|
11851
11861
|
let progressX;
|
|
11852
11862
|
if (rtl) {
|
|
11853
|
-
progressX =
|
|
11863
|
+
progressX = safeTaskX2 - progressWidth;
|
|
11854
11864
|
} else {
|
|
11855
|
-
progressX =
|
|
11865
|
+
progressX = safeTaskX1;
|
|
11856
11866
|
}
|
|
11857
11867
|
return [progressWidth, progressX];
|
|
11858
11868
|
};
|
|
11859
11869
|
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
11860
|
-
|
|
11870
|
+
const safeX = isNaN(x) || !isFinite(x) ? 0 : x;
|
|
11871
|
+
const safeTaskX = isNaN(taskX) || !isFinite(taskX) ? 0 : taskX;
|
|
11872
|
+
const safeXStep = isNaN(xStep) || !isFinite(xStep) || xStep === 0 ? 1 : xStep;
|
|
11873
|
+
const safeTimeStep = isNaN(timeStep) || !isFinite(timeStep) ? 0 : timeStep;
|
|
11874
|
+
let newDate = new Date(
|
|
11875
|
+
(safeX - safeTaskX) / safeXStep * safeTimeStep + taskDate.getTime()
|
|
11876
|
+
);
|
|
11861
11877
|
newDate = new Date(
|
|
11862
11878
|
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
11863
11879
|
);
|
|
@@ -13109,15 +13125,22 @@
|
|
|
13109
13125
|
x2: taskX2,
|
|
13110
13126
|
comparisonDates
|
|
13111
13127
|
} = getTaskCoordinates2(task);
|
|
13128
|
+
const safeContainerX = isNaN(containerX) || !isFinite(containerX) ? 0 : containerX;
|
|
13129
|
+
const safeContainerWidth = isNaN(containerWidth) || !isFinite(containerWidth) ? 0 : Math.max(containerWidth, 0);
|
|
13130
|
+
const safeWidth = isNaN(width) || !isFinite(width) ? 10 : Math.max(width, 1);
|
|
13131
|
+
const safeLevelY = isNaN(levelY) || !isFinite(levelY) ? 0 : levelY;
|
|
13132
|
+
const safeProgressWidth = isNaN(progressWidth) || !isFinite(progressWidth) ? 0 : Math.max(progressWidth, 0);
|
|
13133
|
+
const safeInnerX1 = isNaN(innerX1) || !isFinite(innerX1) ? 0 : innerX1;
|
|
13134
|
+
const safeInnerX2 = isNaN(innerX2) || !isFinite(innerX2) ? safeInnerX1 + safeWidth : innerX2;
|
|
13112
13135
|
tasksRes.push(
|
|
13113
13136
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13114
13137
|
"svg",
|
|
13115
13138
|
{
|
|
13116
13139
|
id: task.id,
|
|
13117
13140
|
className: `${styles$4.TaskItemWrapper} TaskItemWrapper`,
|
|
13118
|
-
x: Math.max(
|
|
13119
|
-
y:
|
|
13120
|
-
width: Math.max(
|
|
13141
|
+
x: Math.max(safeContainerX + (additionalLeftSpace || 0), 0),
|
|
13142
|
+
y: safeLevelY,
|
|
13143
|
+
width: Math.max(safeContainerWidth, 0),
|
|
13121
13144
|
height: fullRowHeight,
|
|
13122
13145
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13123
13146
|
TaskItem,
|
|
@@ -13125,14 +13148,14 @@
|
|
|
13125
13148
|
movingAction: taskBarMovingAction(task),
|
|
13126
13149
|
allowMoveTaskBar,
|
|
13127
13150
|
hasChildren: checkHasChildren(task, childTasksMap),
|
|
13128
|
-
progressWidth,
|
|
13129
|
-
progressX: rtl ?
|
|
13151
|
+
progressWidth: safeProgressWidth,
|
|
13152
|
+
progressX: rtl ? safeInnerX2 : safeInnerX1,
|
|
13130
13153
|
onSelectTaskOnMouseDown: selectTaskOnMouseDown,
|
|
13131
13154
|
task,
|
|
13132
13155
|
taskYOffset,
|
|
13133
|
-
width,
|
|
13134
|
-
x1:
|
|
13135
|
-
x2:
|
|
13156
|
+
width: safeWidth,
|
|
13157
|
+
x1: safeInnerX1,
|
|
13158
|
+
x2: safeInnerX2,
|
|
13136
13159
|
distances,
|
|
13137
13160
|
taskHeight,
|
|
13138
13161
|
taskHalfHeight,
|
|
@@ -13162,16 +13185,20 @@
|
|
|
13162
13185
|
)
|
|
13163
13186
|
);
|
|
13164
13187
|
if (task.comparisonDates && comparisonDates) {
|
|
13188
|
+
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) ? 0 : Math.max(comparisonDates.width, 0);
|
|
13191
|
+
const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 0 : Math.max(comparisonDates.height, 0);
|
|
13165
13192
|
tasksRes.push(
|
|
13166
13193
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13167
13194
|
"svg",
|
|
13168
13195
|
{
|
|
13169
13196
|
id: task.id + "_comparison",
|
|
13170
13197
|
className: "TaskItemWrapperComparison",
|
|
13171
|
-
x: Math.max(
|
|
13172
|
-
y:
|
|
13173
|
-
width:
|
|
13174
|
-
height:
|
|
13198
|
+
x: Math.max(safeComparisonX + (additionalLeftSpace || 0), 0),
|
|
13199
|
+
y: safeComparisonY,
|
|
13200
|
+
width: safeComparisonWidth,
|
|
13201
|
+
height: safeComparisonHeight * 2,
|
|
13175
13202
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13176
13203
|
BarComparison,
|
|
13177
13204
|
{
|
|
@@ -13180,8 +13207,8 @@
|
|
|
13180
13207
|
isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
|
|
13181
13208
|
isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
|
|
13182
13209
|
barCornerRadius: distances.barCornerRadius,
|
|
13183
|
-
height:
|
|
13184
|
-
width:
|
|
13210
|
+
height: safeComparisonHeight,
|
|
13211
|
+
width: safeComparisonWidth,
|
|
13185
13212
|
borderHeight: distances.barComparisonTaskBorderHeight,
|
|
13186
13213
|
yOffset: distances.barComparisonTaskYOffset,
|
|
13187
13214
|
task,
|
|
@@ -13224,15 +13251,24 @@
|
|
|
13224
13251
|
addedDependenciesAtTask[source.id] = true;
|
|
13225
13252
|
const isCritical2 = criticalPathForTask ? criticalPathForTask.has(source.id) : false;
|
|
13226
13253
|
const { x1: fromX1, x2: fromX2 } = getTaskCoordinates2(source);
|
|
13227
|
-
const
|
|
13228
|
-
const
|
|
13254
|
+
const safeFromX1 = isNaN(fromX1) || !isFinite(fromX1) ? 0 : fromX1;
|
|
13255
|
+
const safeFromX2 = isNaN(fromX2) || !isFinite(fromX2) ? safeFromX1 + 10 : fromX2;
|
|
13256
|
+
const safeTaskX1 = isNaN(taskX1) || !isFinite(taskX1) ? 0 : taskX1;
|
|
13257
|
+
const safeTaskX2 = isNaN(taskX2) || !isFinite(taskX2) ? safeTaskX1 + 10 : taskX2;
|
|
13258
|
+
const containerX2 = Math.min(safeFromX1, safeTaskX1) - DELTA_RELATION_WIDTH;
|
|
13259
|
+
const containerWidth2 = Math.max(safeFromX2, safeTaskX2) - containerX2 + DELTA_RELATION_WIDTH;
|
|
13260
|
+
const safeArrowContainerX = isNaN(containerX2) || !isFinite(containerX2) ? 0 : containerX2;
|
|
13261
|
+
const safeArrowContainerWidth = isNaN(containerWidth2) || !isFinite(containerWidth2) ? 100 : Math.max(containerWidth2, 0);
|
|
13229
13262
|
arrowsRes.push(
|
|
13230
13263
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13231
13264
|
"svg",
|
|
13232
13265
|
{
|
|
13233
|
-
x: Math.max(
|
|
13266
|
+
x: Math.max(
|
|
13267
|
+
safeArrowContainerX + (additionalLeftSpace || 0),
|
|
13268
|
+
0
|
|
13269
|
+
),
|
|
13234
13270
|
y: containerY,
|
|
13235
|
-
width:
|
|
13271
|
+
width: safeArrowContainerWidth,
|
|
13236
13272
|
height: containerHeight,
|
|
13237
13273
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13238
13274
|
Arrow,
|
|
@@ -13240,13 +13276,13 @@
|
|
|
13240
13276
|
distances,
|
|
13241
13277
|
taskFrom: source,
|
|
13242
13278
|
targetFrom: sourceTarget,
|
|
13243
|
-
fromX1:
|
|
13244
|
-
fromX2:
|
|
13279
|
+
fromX1: safeFromX1 - safeArrowContainerX,
|
|
13280
|
+
fromX2: safeFromX2 - safeArrowContainerX,
|
|
13245
13281
|
fromY: innerFromY,
|
|
13246
13282
|
taskTo: task,
|
|
13247
13283
|
targetTo: ownTarget,
|
|
13248
|
-
toX1:
|
|
13249
|
-
toX2:
|
|
13284
|
+
toX1: safeTaskX1 - safeArrowContainerX,
|
|
13285
|
+
toX2: safeTaskX2 - safeArrowContainerX,
|
|
13250
13286
|
toY: innerToY,
|
|
13251
13287
|
fullRowHeight,
|
|
13252
13288
|
taskHeight,
|
|
@@ -13289,15 +13325,24 @@
|
|
|
13289
13325
|
const criticalPathForTask = criticalPathOnLevel ? criticalPathOnLevel.dependencies.get(dependent.id) : void 0;
|
|
13290
13326
|
const isCritical2 = criticalPathForTask ? criticalPathForTask.has(task.id) : false;
|
|
13291
13327
|
const { x1: toX1, x2: toX2 } = getTaskCoordinates2(dependent);
|
|
13292
|
-
const
|
|
13293
|
-
const
|
|
13328
|
+
const safeToX1 = isNaN(toX1) || !isFinite(toX1) ? 0 : toX1;
|
|
13329
|
+
const safeToX2 = isNaN(toX2) || !isFinite(toX2) ? safeToX1 + 10 : toX2;
|
|
13330
|
+
const safeTaskX1 = isNaN(taskX1) || !isFinite(taskX1) ? 0 : taskX1;
|
|
13331
|
+
const safeTaskX2 = isNaN(taskX2) || !isFinite(taskX2) ? safeTaskX1 + 10 : taskX2;
|
|
13332
|
+
const containerX2 = Math.min(safeToX1, safeTaskX1) - DELTA_RELATION_WIDTH;
|
|
13333
|
+
const containerWidth2 = Math.max(safeToX2, safeTaskX2) - containerX2 + DELTA_RELATION_WIDTH;
|
|
13334
|
+
const safeArrowContainerX = isNaN(containerX2) || !isFinite(containerX2) ? 0 : containerX2;
|
|
13335
|
+
const safeArrowContainerWidth = isNaN(containerWidth2) || !isFinite(containerWidth2) ? 100 : Math.max(containerWidth2, 0);
|
|
13294
13336
|
arrowsRes.push(
|
|
13295
13337
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13296
13338
|
"svg",
|
|
13297
13339
|
{
|
|
13298
|
-
x: Math.max(
|
|
13340
|
+
x: Math.max(
|
|
13341
|
+
safeArrowContainerX + (additionalLeftSpace || 0),
|
|
13342
|
+
0
|
|
13343
|
+
),
|
|
13299
13344
|
y: containerY,
|
|
13300
|
-
width:
|
|
13345
|
+
width: safeArrowContainerWidth,
|
|
13301
13346
|
height: containerHeight,
|
|
13302
13347
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13303
13348
|
Arrow,
|
|
@@ -13305,13 +13350,13 @@
|
|
|
13305
13350
|
distances,
|
|
13306
13351
|
taskFrom: task,
|
|
13307
13352
|
targetFrom: ownTarget,
|
|
13308
|
-
fromX1:
|
|
13309
|
-
fromX2:
|
|
13353
|
+
fromX1: safeTaskX1 - safeArrowContainerX,
|
|
13354
|
+
fromX2: safeTaskX2 - safeArrowContainerX,
|
|
13310
13355
|
fromY: innerFromY,
|
|
13311
13356
|
taskTo: dependent,
|
|
13312
13357
|
targetTo: dependentTarget,
|
|
13313
|
-
toX1:
|
|
13314
|
-
toX2:
|
|
13358
|
+
toX1: safeToX1 - safeArrowContainerX,
|
|
13359
|
+
toX2: safeToX2 - safeArrowContainerX,
|
|
13315
13360
|
toY: innerToY,
|
|
13316
13361
|
fullRowHeight,
|
|
13317
13362
|
taskHeight,
|
|
@@ -13789,21 +13834,26 @@
|
|
|
13789
13834
|
if (typeof rowIndex !== "number") {
|
|
13790
13835
|
throw new Error(`Row index for task ${id} is not found`);
|
|
13791
13836
|
}
|
|
13792
|
-
|
|
13793
|
-
|
|
13837
|
+
let x1 = rtl ? svgWidth - taskXCoordinate(task.end, startDate, viewMode, columnWidth) : taskXCoordinate(task.start, startDate, viewMode, columnWidth);
|
|
13838
|
+
let x2 = rtl ? svgWidth - taskXCoordinate(task.start, startDate, viewMode, columnWidth) : taskXCoordinate(task.end, startDate, viewMode, columnWidth);
|
|
13839
|
+
x1 = isNaN(x1) || !isFinite(x1) ? 0 : x1;
|
|
13840
|
+
x2 = isNaN(x2) || !isFinite(x2) ? Math.max(x1, 10) : x2;
|
|
13794
13841
|
const levelY = rowIndex * fullRowHeight + rowHeight * (comparisonLevel - 1);
|
|
13795
13842
|
const y = levelY + taskYOffset;
|
|
13796
13843
|
const [progressWidth, progressX] = type === "milestone" ? [0, x1] : progressWithByParams(x1, x2, progress, rtl);
|
|
13797
13844
|
const taskX1 = type === "milestone" ? x1 - taskHeight * 0.5 : x1;
|
|
13798
13845
|
const taskX2 = type === "milestone" ? x2 + taskHeight * 0.5 : x2;
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13846
|
+
let taskWidth = type === "milestone" ? taskHeight : Math.max(taskX2 - taskX1, 10);
|
|
13847
|
+
taskWidth = isNaN(taskWidth) || !isFinite(taskWidth) ? 10 : Math.max(taskWidth, 1);
|
|
13848
|
+
let containerX = taskX1 - columnWidth;
|
|
13849
|
+
containerX = isNaN(containerX) || !isFinite(containerX) ? 0 : containerX;
|
|
13850
|
+
let containerWidth = svgWidth - containerX;
|
|
13851
|
+
containerWidth = isNaN(containerWidth) || !isFinite(containerWidth) ? svgWidth : Math.max(containerWidth, 0);
|
|
13802
13852
|
const innerX1 = columnWidth;
|
|
13803
13853
|
const innerX2 = columnWidth + taskWidth;
|
|
13804
13854
|
let comparisonDates;
|
|
13805
13855
|
if (task.comparisonDates) {
|
|
13806
|
-
|
|
13856
|
+
let cx1 = rtl ? svgWidth - taskComparisonXCoordinate(
|
|
13807
13857
|
task.comparisonDates.end || task.end,
|
|
13808
13858
|
startDate,
|
|
13809
13859
|
viewMode,
|
|
@@ -13814,7 +13864,7 @@
|
|
|
13814
13864
|
viewMode,
|
|
13815
13865
|
columnWidth
|
|
13816
13866
|
);
|
|
13817
|
-
|
|
13867
|
+
let cx2 = rtl ? svgWidth - taskComparisonXCoordinate(
|
|
13818
13868
|
task.comparisonDates.start,
|
|
13819
13869
|
startDate,
|
|
13820
13870
|
viewMode,
|
|
@@ -13825,6 +13875,8 @@
|
|
|
13825
13875
|
viewMode,
|
|
13826
13876
|
columnWidth
|
|
13827
13877
|
);
|
|
13878
|
+
cx1 = isNaN(cx1) || !isFinite(cx1) ? x1 : cx1;
|
|
13879
|
+
cx2 = isNaN(cx2) || !isFinite(cx2) ? x2 : cx2;
|
|
13828
13880
|
comparisonDates = {
|
|
13829
13881
|
x: cx1,
|
|
13830
13882
|
y: y + taskHeight,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gantt-task-react-v",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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",
|
|
@@ -43,8 +43,9 @@
|
|
|
43
43
|
"@floating-ui/dom": "1.6.3",
|
|
44
44
|
"@floating-ui/react": "0.26.11",
|
|
45
45
|
"date-fns": "3.6.0",
|
|
46
|
-
"i18next": "^
|
|
47
|
-
"react-i18next": "^15.
|
|
46
|
+
"i18next": "^25.5.2",
|
|
47
|
+
"react-i18next": "^15.7.3",
|
|
48
|
+
"react-window": "^2.1.1"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
51
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
@@ -61,11 +62,11 @@
|
|
|
61
62
|
"@storybook/addon-onboarding": "8.2.10",
|
|
62
63
|
"@storybook/blocks": "8.2.10",
|
|
63
64
|
"@storybook/cli": "8.2.10",
|
|
65
|
+
"@storybook/core-server": "8.2.10",
|
|
66
|
+
"@storybook/jest": "0.2.3",
|
|
64
67
|
"@storybook/react": "8.2.10",
|
|
65
68
|
"@storybook/react-vite": "8.2.10",
|
|
66
69
|
"@storybook/test": "8.2.10",
|
|
67
|
-
"@storybook/core-server": "8.2.10",
|
|
68
|
-
"@storybook/jest": "0.2.3",
|
|
69
70
|
"@storybook/test-runner": "0.23.0",
|
|
70
71
|
"@storybook/testing-library": "^0.2.2",
|
|
71
72
|
"@testing-library/jest-dom": "^6.4.2",
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
"@types/node": "^20.12.4",
|
|
76
77
|
"@types/react": "^18.2.74",
|
|
77
78
|
"@types/react-dom": "^18.2.24",
|
|
79
|
+
"@types/react-window": "^1.8.8",
|
|
78
80
|
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
79
81
|
"@typescript-eslint/parser": "^7.5.0",
|
|
80
82
|
"@vitejs/plugin-react": "4.2.1",
|