gantt-lib 0.141.1 → 0.141.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/index.mjs CHANGED
@@ -6025,7 +6025,7 @@ var DragGuideLines = ({
6025
6025
  var DragGuideLines_default = DragGuideLines;
6026
6026
 
6027
6027
  // src/components/DependencyLines/DependencyLines.tsx
6028
- import React6, { useMemo as useMemo6, useState as useState3 } from "react";
6028
+ import React6, { useId, useMemo as useMemo6, useState as useState3 } from "react";
6029
6029
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
6030
6030
  function isTaskHidden(taskId, collapsedParentIds, taskMap) {
6031
6031
  const task = taskMap.get(taskId);
@@ -6076,6 +6076,8 @@ var DependencyLines = React6.memo(({
6076
6076
  onDependencyClick,
6077
6077
  horizontalWindow
6078
6078
  }) => {
6079
+ const markerPrefix = `gantt-dependency-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
6080
+ const markerId = (kind) => `${markerPrefix}-${kind}`;
6079
6081
  const [hoveredLineId, setHoveredLineId] = useState3(null);
6080
6082
  const tasksForPositions = allTasks ?? tasks;
6081
6083
  const { taskPositions, taskIndices, hiddenTaskIds } = useMemo6(() => {
@@ -6199,6 +6201,9 @@ var DependencyLines = React6.memo(({
6199
6201
  if (activityEndpoints && predecessor.rowTop === successor.rowTop) {
6200
6202
  fromY = predecessor.rowTop + predecessor.rowHeight / 2;
6201
6203
  toY = successor.rowTop + successor.rowHeight / 2;
6204
+ } else if (activityEndpoints) {
6205
+ fromY = reverseOrder ? predecessor.rowTop : predecessor.rowTop + predecessor.rowHeight;
6206
+ toY = reverseOrder ? successor.rowTop + successor.rowHeight : successor.rowTop;
6202
6207
  } else if (reverseOrder) {
6203
6208
  fromY = predecessor.rowTop + 10;
6204
6209
  toY = successor.rowTop + successor.rowHeight - 6;
@@ -6260,7 +6265,7 @@ var DependencyLines = React6.memo(({
6260
6265
  /* @__PURE__ */ jsx7(
6261
6266
  "marker",
6262
6267
  {
6263
- id: "arrowhead",
6268
+ id: markerId("arrowhead"),
6264
6269
  markerWidth: "8",
6265
6270
  markerHeight: "6",
6266
6271
  markerUnits: "userSpaceOnUse",
@@ -6279,7 +6284,7 @@ var DependencyLines = React6.memo(({
6279
6284
  /* @__PURE__ */ jsx7(
6280
6285
  "marker",
6281
6286
  {
6282
- id: "arrowhead-cycle",
6287
+ id: markerId("arrowhead-cycle"),
6283
6288
  markerWidth: "8",
6284
6289
  markerHeight: "6",
6285
6290
  markerUnits: "userSpaceOnUse",
@@ -6298,7 +6303,7 @@ var DependencyLines = React6.memo(({
6298
6303
  /* @__PURE__ */ jsx7(
6299
6304
  "marker",
6300
6305
  {
6301
- id: "arrowhead-selected",
6306
+ id: markerId("arrowhead-selected"),
6302
6307
  markerWidth: "8",
6303
6308
  markerHeight: "6",
6304
6309
  markerUnits: "userSpaceOnUse",
@@ -6317,7 +6322,7 @@ var DependencyLines = React6.memo(({
6317
6322
  /* @__PURE__ */ jsx7(
6318
6323
  "marker",
6319
6324
  {
6320
- id: "arrowhead-hover",
6325
+ id: markerId("arrowhead-hover"),
6321
6326
  markerWidth: "8",
6322
6327
  markerHeight: "6",
6323
6328
  markerUnits: "userSpaceOnUse",
@@ -6336,7 +6341,7 @@ var DependencyLines = React6.memo(({
6336
6341
  /* @__PURE__ */ jsx7(
6337
6342
  "marker",
6338
6343
  {
6339
- id: "arrowhead-critical",
6344
+ id: markerId("arrowhead-critical"),
6340
6345
  markerWidth: "8",
6341
6346
  markerHeight: "6",
6342
6347
  markerUnits: "userSpaceOnUse",
@@ -6362,10 +6367,11 @@ var DependencyLines = React6.memo(({
6362
6367
  else if (isCritical) pathClassName += " gantt-dependency-critical";
6363
6368
  if (isVirtual && !isSelected) pathClassName += " gantt-dependency-virtual";
6364
6369
  let markerEnd;
6365
- if (isSelected) markerEnd = "url(#arrowhead-selected)";
6366
- else if (hasCycle) markerEnd = "url(#arrowhead-cycle)";
6367
- else if (isCritical) markerEnd = "url(#arrowhead-critical)";
6368
- else markerEnd = "url(#arrowhead)";
6370
+ if (isHovered) markerEnd = `url(#${markerId("arrowhead-hover")})`;
6371
+ else if (isSelected) markerEnd = `url(#${markerId("arrowhead-selected")})`;
6372
+ else if (hasCycle) markerEnd = `url(#${markerId("arrowhead-cycle")})`;
6373
+ else if (isCritical) markerEnd = `url(#${markerId("arrowhead-critical")})`;
6374
+ else markerEnd = `url(#${markerId("arrowhead")})`;
6369
6375
  const lagColor = isSelected ? "#ef4444" : hasCycle ? "var(--gantt-dependency-cycle-color, #ef4444)" : isCritical ? "var(--gantt-critical-path-color, #dc2626)" : "var(--gantt-dependency-line-color, #666666)";
6370
6376
  return /* @__PURE__ */ jsxs5(React6.Fragment, { children: [
6371
6377
  /* @__PURE__ */ jsxs5(