gantt-task-react-v 1.4.1 → 1.4.2
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 +52 -10
- package/dist/gantt-task-react.umd.js +52 -10
- package/dist/style.css +10 -7
- package/package.json +1 -1
|
@@ -11727,9 +11727,9 @@ const generateTrianglePoints = (x, y, width, isLeftDirected) => {
|
|
|
11727
11727
|
${x - width},${y - width}
|
|
11728
11728
|
${x - width},${y + width}`;
|
|
11729
11729
|
};
|
|
11730
|
-
const arrow_clickable = "
|
|
11731
|
-
const mainPath = "
|
|
11732
|
-
const clickZone = "
|
|
11730
|
+
const arrow_clickable = "_arrow_clickable_50mfa_1";
|
|
11731
|
+
const mainPath = "_mainPath_50mfa_11";
|
|
11732
|
+
const clickZone = "_clickZone_50mfa_49";
|
|
11733
11733
|
const styles$a = {
|
|
11734
11734
|
arrow_clickable,
|
|
11735
11735
|
mainPath,
|
|
@@ -11821,18 +11821,60 @@ const ArrowInner = (props) => {
|
|
|
11821
11821
|
) });
|
|
11822
11822
|
};
|
|
11823
11823
|
const Arrow = memo(ArrowInner);
|
|
11824
|
+
const roundedPath = (points, radius) => {
|
|
11825
|
+
if (points.length < 2)
|
|
11826
|
+
return "";
|
|
11827
|
+
let d = `M ${points[0][0]} ${points[0][1]}`;
|
|
11828
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
11829
|
+
const prev = points[i - 1];
|
|
11830
|
+
const curr = points[i];
|
|
11831
|
+
const next = points[i + 1];
|
|
11832
|
+
const dx1 = prev[0] - curr[0];
|
|
11833
|
+
const dy1 = prev[1] - curr[1];
|
|
11834
|
+
const len1 = Math.abs(dx1) + Math.abs(dy1);
|
|
11835
|
+
const dx2 = next[0] - curr[0];
|
|
11836
|
+
const dy2 = next[1] - curr[1];
|
|
11837
|
+
const len2 = Math.abs(dx2) + Math.abs(dy2);
|
|
11838
|
+
const r = Math.min(radius, len1 / 2, len2 / 2);
|
|
11839
|
+
if (r <= 0 || len1 === 0 || len2 === 0) {
|
|
11840
|
+
d += ` L ${curr[0]} ${curr[1]}`;
|
|
11841
|
+
continue;
|
|
11842
|
+
}
|
|
11843
|
+
const ux1 = dx1 === 0 ? 0 : dx1 / Math.abs(dx1);
|
|
11844
|
+
const uy1 = dy1 === 0 ? 0 : dy1 / Math.abs(dy1);
|
|
11845
|
+
const ux2 = dx2 === 0 ? 0 : dx2 / Math.abs(dx2);
|
|
11846
|
+
const uy2 = dy2 === 0 ? 0 : dy2 / Math.abs(dy2);
|
|
11847
|
+
d += ` L ${curr[0] + ux1 * r} ${curr[1] + uy1 * r}`;
|
|
11848
|
+
d += ` Q ${curr[0]} ${curr[1]} ${curr[0] + ux2 * r} ${curr[1] + uy2 * r}`;
|
|
11849
|
+
}
|
|
11850
|
+
const last = points[points.length - 1];
|
|
11851
|
+
d += ` L ${last[0]} ${last[1]}`;
|
|
11852
|
+
return d;
|
|
11853
|
+
};
|
|
11854
|
+
const ARROW_CORNER_RADIUS = 6;
|
|
11824
11855
|
const drownPathAndTriangle = (indexForm, fromX1, fromX2, fromY, isTaskFromLeftSide, indexTo, toX1, toX2, toY, isTaskToLeftSide, fullRowHeight, taskHeight, arrowIndent) => {
|
|
11825
11856
|
const isDownDirected = indexTo > indexForm;
|
|
11826
|
-
const
|
|
11857
|
+
const spreadSeed = Math.abs(
|
|
11858
|
+
Math.round(fromX1 + fromX2) * 7 + Math.round(toX1 + toX2) * 13
|
|
11859
|
+
);
|
|
11860
|
+
const maxSpread = Math.min(fullRowHeight * 0.15, 8);
|
|
11861
|
+
const spreadOffset = (spreadSeed % 11 / 10 - 0.5) * maxSpread * 2;
|
|
11862
|
+
const horizontalDockingY = isDownDirected ? (indexForm + 1) * fullRowHeight + spreadOffset : indexForm * fullRowHeight + spreadOffset;
|
|
11827
11863
|
const taskFromEndPositionX = isTaskFromLeftSide ? fromX1 - arrowIndent : fromX2 + arrowIndent;
|
|
11828
11864
|
const taskToEndPositionX = isTaskToLeftSide ? toX1 - arrowIndent : toX2 + arrowIndent;
|
|
11829
11865
|
const taskToEndPositionY = toY + taskHeight / 2;
|
|
11830
|
-
const
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11866
|
+
const startX = isTaskFromLeftSide ? fromX1 : fromX2;
|
|
11867
|
+
const startY = fromY + taskHeight / 2;
|
|
11868
|
+
const endX = isTaskToLeftSide ? toX1 : toX2;
|
|
11869
|
+
const waypoints = [
|
|
11870
|
+
[startX, startY],
|
|
11871
|
+
[taskFromEndPositionX, startY],
|
|
11872
|
+
[taskFromEndPositionX, horizontalDockingY],
|
|
11873
|
+
[taskToEndPositionX, horizontalDockingY],
|
|
11874
|
+
[taskToEndPositionX, taskToEndPositionY],
|
|
11875
|
+
[endX, taskToEndPositionY]
|
|
11876
|
+
];
|
|
11877
|
+
const path = roundedPath(waypoints, ARROW_CORNER_RADIUS);
|
|
11836
11878
|
const trianglePoints = isTaskToLeftSide ? generateTrianglePoints(toX1, taskToEndPositionY, 5, false) : generateTrianglePoints(toX2, taskToEndPositionY, 5, true);
|
|
11837
11879
|
return [path, trianglePoints];
|
|
11838
11880
|
};
|
|
@@ -11744,9 +11744,9 @@
|
|
|
11744
11744
|
${x - width},${y - width}
|
|
11745
11745
|
${x - width},${y + width}`;
|
|
11746
11746
|
};
|
|
11747
|
-
const arrow_clickable = "
|
|
11748
|
-
const mainPath = "
|
|
11749
|
-
const clickZone = "
|
|
11747
|
+
const arrow_clickable = "_arrow_clickable_50mfa_1";
|
|
11748
|
+
const mainPath = "_mainPath_50mfa_11";
|
|
11749
|
+
const clickZone = "_clickZone_50mfa_49";
|
|
11750
11750
|
const styles$a = {
|
|
11751
11751
|
arrow_clickable,
|
|
11752
11752
|
mainPath,
|
|
@@ -11838,18 +11838,60 @@
|
|
|
11838
11838
|
) });
|
|
11839
11839
|
};
|
|
11840
11840
|
const Arrow = React.memo(ArrowInner);
|
|
11841
|
+
const roundedPath = (points, radius) => {
|
|
11842
|
+
if (points.length < 2)
|
|
11843
|
+
return "";
|
|
11844
|
+
let d = `M ${points[0][0]} ${points[0][1]}`;
|
|
11845
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
11846
|
+
const prev = points[i - 1];
|
|
11847
|
+
const curr = points[i];
|
|
11848
|
+
const next = points[i + 1];
|
|
11849
|
+
const dx1 = prev[0] - curr[0];
|
|
11850
|
+
const dy1 = prev[1] - curr[1];
|
|
11851
|
+
const len1 = Math.abs(dx1) + Math.abs(dy1);
|
|
11852
|
+
const dx2 = next[0] - curr[0];
|
|
11853
|
+
const dy2 = next[1] - curr[1];
|
|
11854
|
+
const len2 = Math.abs(dx2) + Math.abs(dy2);
|
|
11855
|
+
const r = Math.min(radius, len1 / 2, len2 / 2);
|
|
11856
|
+
if (r <= 0 || len1 === 0 || len2 === 0) {
|
|
11857
|
+
d += ` L ${curr[0]} ${curr[1]}`;
|
|
11858
|
+
continue;
|
|
11859
|
+
}
|
|
11860
|
+
const ux1 = dx1 === 0 ? 0 : dx1 / Math.abs(dx1);
|
|
11861
|
+
const uy1 = dy1 === 0 ? 0 : dy1 / Math.abs(dy1);
|
|
11862
|
+
const ux2 = dx2 === 0 ? 0 : dx2 / Math.abs(dx2);
|
|
11863
|
+
const uy2 = dy2 === 0 ? 0 : dy2 / Math.abs(dy2);
|
|
11864
|
+
d += ` L ${curr[0] + ux1 * r} ${curr[1] + uy1 * r}`;
|
|
11865
|
+
d += ` Q ${curr[0]} ${curr[1]} ${curr[0] + ux2 * r} ${curr[1] + uy2 * r}`;
|
|
11866
|
+
}
|
|
11867
|
+
const last = points[points.length - 1];
|
|
11868
|
+
d += ` L ${last[0]} ${last[1]}`;
|
|
11869
|
+
return d;
|
|
11870
|
+
};
|
|
11871
|
+
const ARROW_CORNER_RADIUS = 6;
|
|
11841
11872
|
const drownPathAndTriangle = (indexForm, fromX1, fromX2, fromY, isTaskFromLeftSide, indexTo, toX1, toX2, toY, isTaskToLeftSide, fullRowHeight, taskHeight, arrowIndent) => {
|
|
11842
11873
|
const isDownDirected = indexTo > indexForm;
|
|
11843
|
-
const
|
|
11874
|
+
const spreadSeed = Math.abs(
|
|
11875
|
+
Math.round(fromX1 + fromX2) * 7 + Math.round(toX1 + toX2) * 13
|
|
11876
|
+
);
|
|
11877
|
+
const maxSpread = Math.min(fullRowHeight * 0.15, 8);
|
|
11878
|
+
const spreadOffset = (spreadSeed % 11 / 10 - 0.5) * maxSpread * 2;
|
|
11879
|
+
const horizontalDockingY = isDownDirected ? (indexForm + 1) * fullRowHeight + spreadOffset : indexForm * fullRowHeight + spreadOffset;
|
|
11844
11880
|
const taskFromEndPositionX = isTaskFromLeftSide ? fromX1 - arrowIndent : fromX2 + arrowIndent;
|
|
11845
11881
|
const taskToEndPositionX = isTaskToLeftSide ? toX1 - arrowIndent : toX2 + arrowIndent;
|
|
11846
11882
|
const taskToEndPositionY = toY + taskHeight / 2;
|
|
11847
|
-
const
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11883
|
+
const startX = isTaskFromLeftSide ? fromX1 : fromX2;
|
|
11884
|
+
const startY = fromY + taskHeight / 2;
|
|
11885
|
+
const endX = isTaskToLeftSide ? toX1 : toX2;
|
|
11886
|
+
const waypoints = [
|
|
11887
|
+
[startX, startY],
|
|
11888
|
+
[taskFromEndPositionX, startY],
|
|
11889
|
+
[taskFromEndPositionX, horizontalDockingY],
|
|
11890
|
+
[taskToEndPositionX, horizontalDockingY],
|
|
11891
|
+
[taskToEndPositionX, taskToEndPositionY],
|
|
11892
|
+
[endX, taskToEndPositionY]
|
|
11893
|
+
];
|
|
11894
|
+
const path = roundedPath(waypoints, ARROW_CORNER_RADIUS);
|
|
11853
11895
|
const trianglePoints = isTaskToLeftSide ? generateTrianglePoints(toX1, taskToEndPositionY, 5, false) : generateTrianglePoints(toX2, taskToEndPositionY, 5, true);
|
|
11854
11896
|
return [path, trianglePoints];
|
|
11855
11897
|
};
|
package/dist/style.css
CHANGED
|
@@ -439,31 +439,34 @@
|
|
|
439
439
|
._calendarDragging_15t8b_85 {
|
|
440
440
|
cursor: ew-resize;
|
|
441
441
|
}
|
|
442
|
-
.
|
|
442
|
+
._arrow_clickable_50mfa_1 {
|
|
443
443
|
cursor: pointer;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
/*noinspection CssUnresolvedCustomProperty*/
|
|
447
|
-
.
|
|
447
|
+
._arrow_clickable_50mfa_1:hover ._mainPath_50mfa_11 {
|
|
448
448
|
filter: var(--gantt-hover-filter);
|
|
449
449
|
stroke: var(--gantt-arrow-hover-color, red);
|
|
450
450
|
stroke-width: 3px;
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
/*noinspection CssUnresolvedCustomProperty*/
|
|
454
|
-
.
|
|
454
|
+
._arrow_clickable_50mfa_1:hover polygon {
|
|
455
455
|
fill: var(--gantt-arrow-hover-color, red);
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
.
|
|
458
|
+
._mainPath_50mfa_11 {
|
|
459
459
|
fill: none;
|
|
460
|
-
stroke-width:
|
|
460
|
+
stroke-width: 1.5px;
|
|
461
|
+
stroke-linecap: round;
|
|
462
|
+
stroke-linejoin: round;
|
|
463
|
+
opacity: 0.85;
|
|
461
464
|
}
|
|
462
465
|
|
|
463
|
-
.
|
|
466
|
+
._clickZone_50mfa_49 {
|
|
464
467
|
fill: none;
|
|
465
468
|
stroke: transparent;
|
|
466
|
-
stroke-width:
|
|
469
|
+
stroke-width: 10px;
|
|
467
470
|
}
|
|
468
471
|
._relationLine_wh2qy_1 {
|
|
469
472
|
/*noinspection CssUnresolvedCustomProperty*/
|
package/package.json
CHANGED