gantt-task-react-v 1.4.6 → 1.4.7

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.
@@ -4834,7 +4834,7 @@
4834
4834
  () => getExpanderSymbol(hasChildren, isClosed, expandIconWidth, icons),
4835
4835
  [hasChildren, isClosed, expandIconWidth, icons]
4836
4836
  );
4837
- const title = isShowTaskNumbers ? `${indexStr} ${name}` : name;
4837
+ const title2 = isShowTaskNumbers ? `${indexStr} ${name}` : name;
4838
4838
  const onClick = React.useCallback(() => {
4839
4839
  if (task.type !== "empty") {
4840
4840
  onExpanderClick(task);
@@ -4848,7 +4848,7 @@
4848
4848
  style: {
4849
4849
  paddingLeft: depth * nestedTaskNameOffset
4850
4850
  },
4851
- title,
4851
+ title: title2,
4852
4852
  children: [
4853
4853
  /* @__PURE__ */ jsxRuntime.jsx(
4854
4854
  "div",
@@ -5036,45 +5036,45 @@
5036
5036
  };
5037
5037
  function useTaskListColumnsBuilder() {
5038
5038
  const createNameColumn = React.useCallback(
5039
- (title, width) => {
5039
+ (title2, width) => {
5040
5040
  return {
5041
5041
  id: "TitleColumn",
5042
5042
  component: TitleColumn,
5043
5043
  width: width || 120,
5044
- title
5044
+ title: title2
5045
5045
  };
5046
5046
  },
5047
5047
  []
5048
5048
  );
5049
5049
  const createStartDateColumn = React.useCallback(
5050
- (title, width) => {
5050
+ (title2, width) => {
5051
5051
  return {
5052
5052
  id: "DateStartColumn",
5053
5053
  component: DateStartColumn,
5054
5054
  width: width || 60,
5055
- title
5055
+ title: title2
5056
5056
  };
5057
5057
  },
5058
5058
  []
5059
5059
  );
5060
5060
  const createEndDateColumn = React.useCallback(
5061
- (title, width) => {
5061
+ (title2, width) => {
5062
5062
  return {
5063
5063
  id: "DateEndColumn",
5064
5064
  component: DateEndColumn,
5065
5065
  width: width || 60,
5066
- title
5066
+ title: title2
5067
5067
  };
5068
5068
  },
5069
5069
  []
5070
5070
  );
5071
5071
  const createDependenciesColumn = React.useCallback(
5072
- (title, width) => {
5072
+ (title2, width) => {
5073
5073
  return {
5074
5074
  id: "DependenciesColumn",
5075
5075
  component: DependenciesColumn,
5076
5076
  width: width || 90,
5077
- title
5077
+ title: title2
5078
5078
  };
5079
5079
  },
5080
5080
  []
@@ -5601,9 +5601,9 @@
5601
5601
  },
5602
5602
  children: [
5603
5603
  canMoveTasks && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$i.ganttTable_HeaderMoveTask }),
5604
- columns.map(({ title, width, canResize }, index2) => {
5604
+ columns.map(({ title: title2, width, canResize }, index2) => {
5605
5605
  return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
5606
- index2 > 0 && !!title && /* @__PURE__ */ jsxRuntime.jsx(
5606
+ index2 > 0 && !!title2 && /* @__PURE__ */ jsxRuntime.jsx(
5607
5607
  "div",
5608
5608
  {
5609
5609
  className: styles$i.ganttTable_HeaderSeparator,
@@ -5616,7 +5616,7 @@
5616
5616
  /* @__PURE__ */ jsxRuntime.jsxs(
5617
5617
  "div",
5618
5618
  {
5619
- "data-testid": `table-column-header-${title}`,
5619
+ "data-testid": `table-column-header-${title2}`,
5620
5620
  className: styles$i.ganttTable_HeaderItem,
5621
5621
  style: {
5622
5622
  minWidth: width,
@@ -5624,11 +5624,11 @@
5624
5624
  ...pinnedStyles[index2]
5625
5625
  },
5626
5626
  children: [
5627
- title,
5628
- canResizeColumns && canResize !== false && !!title && /* @__PURE__ */ jsxRuntime.jsx(
5627
+ title2,
5628
+ canResizeColumns && canResize !== false && !!title2 && /* @__PURE__ */ jsxRuntime.jsx(
5629
5629
  "div",
5630
5630
  {
5631
- "data-testid": `table-column-header-resize-handle-${title}`,
5631
+ "data-testid": `table-column-header-resize-handle-${title2}`,
5632
5632
  className: styles$i.resizer,
5633
5633
  onMouseDown: (event) => {
5634
5634
  onColumnResizeStart(index2, event.clientX);
@@ -11744,12 +11744,14 @@
11744
11744
  ${x - width},${y - width}
11745
11745
  ${x - width},${y + width}`;
11746
11746
  };
11747
- const arrow_clickable = "_arrow_clickable_13ifc_1";
11748
- const mainPath = "_mainPath_13ifc_9";
11749
- const clickZone = "_clickZone_13ifc_33";
11747
+ const arrow_clickable = "_arrow_clickable_3u3q2_1";
11748
+ const mainPath = "_mainPath_3u3q2_11";
11749
+ const arrow_active = "_arrow_active_3u3q2_37";
11750
+ const clickZone = "_clickZone_3u3q2_81";
11750
11751
  const styles$b = {
11751
11752
  arrow_clickable,
11752
11753
  mainPath,
11754
+ arrow_active,
11753
11755
  clickZone
11754
11756
  };
11755
11757
  const ArrowInner = (props) => {
@@ -11771,6 +11773,7 @@
11771
11773
  rtl,
11772
11774
  onArrowDoubleClick = void 0,
11773
11775
  onArrowClick = void 0,
11776
+ isActive = false,
11774
11777
  fromConnectionIndex = 0,
11775
11778
  fromTotalConnections = 1,
11776
11779
  toConnectionIndex = 0,
@@ -11841,29 +11844,20 @@
11841
11844
  }
11842
11845
  return "var(--gantt-arrow-color)";
11843
11846
  }, [isCritical]);
11844
- return /* @__PURE__ */ jsxRuntime.jsx(
11847
+ return /* @__PURE__ */ jsxRuntime.jsx("g", { fill: color, stroke: color, children: /* @__PURE__ */ jsxRuntime.jsxs(
11845
11848
  "g",
11846
11849
  {
11847
- fill: color,
11848
- stroke: color,
11849
- "data-arrow-from": taskFrom.id,
11850
- "data-arrow-to": taskTo.id,
11851
- children: /* @__PURE__ */ jsxRuntime.jsxs(
11852
- "g",
11853
- {
11854
- "data-testid": `task-arrow-${targetFrom}-${taskFrom.name}-${targetTo}-${taskTo.name}`,
11855
- className: `arrow ${styles$b.arrow_clickable}`,
11856
- onDoubleClick,
11857
- onClick: handleClick,
11858
- children: [
11859
- onArrowDoubleClick && /* @__PURE__ */ jsxRuntime.jsx("path", { d: path, className: styles$b.clickZone }),
11860
- /* @__PURE__ */ jsxRuntime.jsx("path", { className: styles$b.mainPath, d: path }),
11861
- /* @__PURE__ */ jsxRuntime.jsx("polygon", { className: "polygon", points: trianglePoints })
11862
- ]
11863
- }
11864
- )
11850
+ "data-testid": `task-arrow-${targetFrom}-${taskFrom.name}-${targetTo}-${taskTo.name}`,
11851
+ className: `arrow ${styles$b.arrow_clickable}${isActive ? ` ${styles$b.arrow_active}` : ""}`,
11852
+ onDoubleClick,
11853
+ onClick: handleClick,
11854
+ children: [
11855
+ (onArrowDoubleClick || onArrowClick) && /* @__PURE__ */ jsxRuntime.jsx("path", { d: path, className: styles$b.clickZone }),
11856
+ /* @__PURE__ */ jsxRuntime.jsx("path", { className: styles$b.mainPath, d: path }),
11857
+ /* @__PURE__ */ jsxRuntime.jsx("polygon", { className: "polygon", points: trianglePoints })
11858
+ ]
11865
11859
  }
11866
- );
11860
+ ) });
11867
11861
  };
11868
11862
  const Arrow = React.memo(ArrowInner);
11869
11863
  const roundedPath = (points, radius) => {
@@ -13182,6 +13176,8 @@
13182
13176
  onTaskBarDragStart,
13183
13177
  mapGlobalRowIndexToTask,
13184
13178
  onArrowDoubleClick,
13179
+ onArrowClick,
13180
+ activeArrowKey,
13185
13181
  onDoubleClick,
13186
13182
  onClick,
13187
13183
  renderedRowIndexes,
@@ -13203,9 +13199,7 @@
13203
13199
  waitCommitTasks,
13204
13200
  viewMode,
13205
13201
  showProgress = true,
13206
- progressColor,
13207
- onArrowClick,
13208
- selectedArrow
13202
+ progressColor
13209
13203
  } = props;
13210
13204
  const renderedHolidays = React.useMemo(() => {
13211
13205
  const { columnWidth } = distances;
@@ -13488,6 +13482,7 @@
13488
13482
  rtl,
13489
13483
  onArrowDoubleClick,
13490
13484
  onArrowClick,
13485
+ isActive: activeArrowKey === `${source.id}|${taskId}`,
13491
13486
  fromConnectionIndex: getConnectionIndex(
13492
13487
  `${source.id}|${sourceTarget}|out`
13493
13488
  ),
@@ -13573,6 +13568,7 @@
13573
13568
  rtl,
13574
13569
  onArrowDoubleClick,
13575
13570
  onArrowClick,
13571
+ isActive: activeArrowKey === `${taskId}|${dependent.id}`,
13576
13572
  fromConnectionIndex: getConnectionIndex(
13577
13573
  `${taskId}|${ownTarget}|out`
13578
13574
  ),
@@ -13671,6 +13667,7 @@
13671
13667
  rtl,
13672
13668
  onArrowDoubleClick,
13673
13669
  onArrowClick,
13670
+ isActive: activeArrowKey === `${source.id}|${taskId}`,
13674
13671
  fromConnectionIndex: getConnectionIndex(
13675
13672
  `${source.id}|${sourceTarget}|out`
13676
13673
  ),
@@ -13729,80 +13726,11 @@
13729
13726
  visibleTasksMirror,
13730
13727
  onArrowDoubleClick,
13731
13728
  onArrowClick,
13729
+ activeArrowKey,
13732
13730
  showProgress,
13733
13731
  progressColor
13734
13732
  ]);
13735
- const contentRef = React.useRef(null);
13736
- React.useEffect(() => {
13737
- const contentEl = contentRef.current;
13738
- if (!contentEl)
13739
- return void 0;
13740
- const svgRoot = contentEl.ownerSVGElement;
13741
- if (!svgRoot)
13742
- return void 0;
13743
- let currentHighlightedTask = null;
13744
- const highlightArrows = (taskId) => {
13745
- if (currentHighlightedTask === taskId)
13746
- return;
13747
- clearHighlights();
13748
- currentHighlightedTask = taskId;
13749
- const arrows = svgRoot.querySelectorAll(
13750
- `[data-arrow-from="${taskId}"], [data-arrow-to="${taskId}"]`
13751
- );
13752
- arrows.forEach((el) => el.classList.add("gantt-arrow-highlighted"));
13753
- };
13754
- const clearHighlights = () => {
13755
- if (!currentHighlightedTask)
13756
- return;
13757
- svgRoot.querySelectorAll(".gantt-arrow-highlighted").forEach((el) => el.classList.remove("gantt-arrow-highlighted"));
13758
- currentHighlightedTask = null;
13759
- };
13760
- const onMouseOver = (e) => {
13761
- const target = e.target;
13762
- const taskWrapper = target.closest(".TaskItemWrapper");
13763
- if (taskWrapper && taskWrapper.id) {
13764
- highlightArrows(taskWrapper.id);
13765
- }
13766
- };
13767
- const onMouseOut = (e) => {
13768
- const target = e.target;
13769
- const taskWrapper = target.closest(".TaskItemWrapper");
13770
- if (taskWrapper) {
13771
- const relatedTarget = e.relatedTarget;
13772
- if (!relatedTarget || !taskWrapper.contains(relatedTarget)) {
13773
- clearHighlights();
13774
- }
13775
- }
13776
- };
13777
- contentEl.addEventListener("mouseover", onMouseOver);
13778
- contentEl.addEventListener("mouseout", onMouseOut);
13779
- return () => {
13780
- contentEl.removeEventListener("mouseover", onMouseOver);
13781
- contentEl.removeEventListener("mouseout", onMouseOut);
13782
- };
13783
- }, []);
13784
- React.useLayoutEffect(() => {
13785
- const contentEl = contentRef.current;
13786
- if (!contentEl)
13787
- return;
13788
- const svgRoot = contentEl.ownerSVGElement;
13789
- if (!svgRoot)
13790
- return;
13791
- svgRoot.querySelectorAll(".gantt-arrow-selected").forEach((el) => el.classList.remove("gantt-arrow-selected"));
13792
- if (!selectedArrow)
13793
- return;
13794
- if (selectedArrow.taskId) {
13795
- svgRoot.querySelectorAll(
13796
- `[data-arrow-from="${selectedArrow.taskId}"], [data-arrow-to="${selectedArrow.taskId}"]`
13797
- ).forEach((el) => el.classList.add("gantt-arrow-selected"));
13798
- }
13799
- if (selectedArrow.fromId && selectedArrow.toId) {
13800
- svgRoot.querySelectorAll(
13801
- `[data-arrow-from="${selectedArrow.fromId}"][data-arrow-to="${selectedArrow.toId}"]`
13802
- ).forEach((el) => el.classList.add("gantt-arrow-selected"));
13803
- }
13804
- }, [selectedArrow, renderedArrows]);
13805
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "content", ref: contentRef, children: [
13733
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "content", children: [
13806
13734
  renderedSelectedTasks,
13807
13735
  /* @__PURE__ */ jsxRuntime.jsx("g", { children: renderedHolidays }),
13808
13736
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -16358,13 +16286,13 @@
16358
16286
  function getDocumentRect(element) {
16359
16287
  const html = getDocumentElement(element);
16360
16288
  const scroll2 = getNodeScroll(element);
16361
- const body = element.ownerDocument.body;
16362
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
16363
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
16289
+ const body2 = element.ownerDocument.body;
16290
+ const width = max(html.scrollWidth, html.clientWidth, body2.scrollWidth, body2.clientWidth);
16291
+ const height = max(html.scrollHeight, html.clientHeight, body2.scrollHeight, body2.clientHeight);
16364
16292
  let x = -scroll2.scrollLeft + getWindowScrollBarX(element);
16365
16293
  const y = -scroll2.scrollTop;
16366
- if (getComputedStyle$1(body).direction === "rtl") {
16367
- x += max(html.clientWidth, body.clientWidth) - width;
16294
+ if (getComputedStyle$1(body2).direction === "rtl") {
16295
+ x += max(html.clientWidth, body2.clientWidth) - width;
16368
16296
  }
16369
16297
  return {
16370
16298
  width,
@@ -19419,110 +19347,72 @@
19419
19347
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles$1.loader} ${loading ? "" : styles$1.loaderHidden}` });
19420
19348
  };
19421
19349
  const GanttLoader = React.memo(GanttLoaderInner);
19422
- const drawerOverlay = "_drawerOverlay_3p2w6_1";
19423
- const drawer = "_drawer_3p2w6_1";
19424
- const slideIn = "_slideIn_3p2w6_1";
19425
- const drawerHeader = "_drawerHeader_3p2w6_71";
19426
- const closeButton = "_closeButton_3p2w6_89";
19427
- const drawerContent = "_drawerContent_3p2w6_127";
19428
- const defaultSection = "_defaultSection_3p2w6_139";
19429
- const defaultField = "_defaultField_3p2w6_175";
19430
- const defaultFieldLabel = "_defaultFieldLabel_3p2w6_191";
19350
+ const overlay = "_overlay_1rnqn_1";
19351
+ const drawer = "_drawer_1rnqn_19";
19352
+ const drawer_open = "_drawer_open_1rnqn_51";
19353
+ const header = "_header_1rnqn_59";
19354
+ const title = "_title_1rnqn_77";
19355
+ const closeButton = "_closeButton_1rnqn_97";
19356
+ const body = "_body_1rnqn_131";
19431
19357
  const styles = {
19432
- drawerOverlay,
19358
+ overlay,
19433
19359
  drawer,
19434
- slideIn,
19435
- drawerHeader,
19360
+ drawer_open,
19361
+ header,
19362
+ title,
19436
19363
  closeButton,
19437
- drawerContent,
19438
- defaultSection,
19439
- defaultField,
19440
- defaultFieldLabel
19364
+ body
19441
19365
  };
19442
- const DefaultDrawerContent = ({
19443
- data
19444
- }) => {
19445
- var _a, _b, _c, _d, _e, _f;
19446
- if (data.type === "task" && data.task) {
19447
- const { task } = data;
19448
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultSection, children: [
19449
- /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "Task Details" }),
19450
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19451
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "Name:" }),
19452
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: task.name })
19453
- ] }),
19454
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19455
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "Start:" }),
19456
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_a = task.start) == null ? void 0 : _a.toLocaleDateString() })
19457
- ] }),
19458
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19459
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "End:" }),
19460
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_b = task.end) == null ? void 0 : _b.toLocaleDateString() })
19461
- ] }),
19462
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19463
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "Progress:" }),
19464
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
19465
- Math.round(task.progress || 0),
19466
- "%"
19467
- ] })
19468
- ] })
19469
- ] });
19470
- }
19471
- if (data.type === "connection" && data.taskFrom && data.taskTo) {
19472
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultSection, children: [
19473
- /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "Connection Details" }),
19474
- /* @__PURE__ */ jsxRuntime.jsx("h4", { children: "From" }),
19475
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19476
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "Name:" }),
19477
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: data.taskFrom.name })
19478
- ] }),
19479
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19480
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "Start:" }),
19481
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_c = data.taskFrom.start) == null ? void 0 : _c.toLocaleDateString() })
19482
- ] }),
19483
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19484
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "End:" }),
19485
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_d = data.taskFrom.end) == null ? void 0 : _d.toLocaleDateString() })
19486
- ] }),
19487
- /* @__PURE__ */ jsxRuntime.jsx("h4", { children: "To" }),
19488
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19489
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "Name:" }),
19490
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: data.taskTo.name })
19491
- ] }),
19492
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19493
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "Start:" }),
19494
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_e = data.taskTo.start) == null ? void 0 : _e.toLocaleDateString() })
19495
- ] }),
19496
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.defaultField, children: [
19497
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.defaultFieldLabel, children: "End:" }),
19498
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_f = data.taskTo.end) == null ? void 0 : _f.toLocaleDateString() })
19499
- ] })
19500
- ] });
19501
- }
19502
- return null;
19503
- };
19504
- const GanttDrawer = ({
19505
- open,
19506
- width,
19366
+ const GanttDrawerInner = ({
19507
19367
  data,
19368
+ width,
19508
19369
  onClose,
19509
19370
  renderContent
19510
19371
  }) => {
19511
- if (!open || !data)
19512
- return null;
19513
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.drawerOverlay, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.drawer, style: { width }, children: [
19514
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.drawerHeader, children: /* @__PURE__ */ jsxRuntime.jsx(
19515
- "button",
19372
+ const handleOverlayClick = React.useCallback(
19373
+ (e) => {
19374
+ e.stopPropagation();
19375
+ onClose();
19376
+ },
19377
+ [onClose]
19378
+ );
19379
+ const title2 = (data == null ? void 0 : data.type) === "task" ? data.task.name : (data == null ? void 0 : data.type) === "arrow" ? `${data.taskFrom.name} → ${data.taskTo.name}` : "";
19380
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19381
+ data && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.overlay, onClick: handleOverlayClick }),
19382
+ /* @__PURE__ */ jsxRuntime.jsxs(
19383
+ "div",
19516
19384
  {
19517
- className: styles.closeButton,
19518
- onClick: onClose,
19519
- "aria-label": "Close drawer",
19520
- children: "×"
19385
+ className: `${styles.drawer}${data ? ` ${styles.drawer_open}` : ""}`,
19386
+ style: { width },
19387
+ children: [
19388
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.header, children: [
19389
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.title, children: title2 }),
19390
+ /* @__PURE__ */ jsxRuntime.jsx(
19391
+ "button",
19392
+ {
19393
+ className: styles.closeButton,
19394
+ onClick: onClose,
19395
+ "aria-label": "Close drawer",
19396
+ type: "button",
19397
+ children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
19398
+ "path",
19399
+ {
19400
+ d: "M12 4L4 12M4 4l8 8",
19401
+ stroke: "currentColor",
19402
+ strokeWidth: "1.5",
19403
+ strokeLinecap: "round"
19404
+ }
19405
+ ) })
19406
+ }
19407
+ )
19408
+ ] }),
19409
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.body, children: data && renderContent ? renderContent(data) : null })
19410
+ ]
19521
19411
  }
19522
- ) }),
19523
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.drawerContent, children: renderContent ? renderContent(data) : /* @__PURE__ */ jsxRuntime.jsx(DefaultDrawerContent, { data }) })
19524
- ] }) });
19412
+ )
19413
+ ] });
19525
19414
  };
19415
+ const GanttDrawer = React.memo(GanttDrawerInner);
19526
19416
  const Gantt = (props) => {
19527
19417
  var _a, _b;
19528
19418
  const {
@@ -19569,10 +19459,7 @@
19569
19459
  showProgress = true,
19570
19460
  progressColor,
19571
19461
  scrollToTaskId,
19572
- enableDrawer = false,
19573
- drawerWidth = 300,
19574
- renderDrawerContent,
19575
- onArrowClick: onArrowClickProp
19462
+ drawer: drawerProps
19576
19463
  } = props;
19577
19464
  const ganttSVGRef = React.useRef(null);
19578
19465
  const wrapperRef = React.useRef(null);
@@ -19589,36 +19476,11 @@
19589
19476
  [theme, rowHeight]
19590
19477
  );
19591
19478
  const [waitCommitTasks, setWaitCommitTasks] = React.useState(false);
19479
+ const enableDrawer = (drawerProps == null ? void 0 : drawerProps.enableDrawer) ?? false;
19480
+ const drawerWidth = (drawerProps == null ? void 0 : drawerProps.drawerWidth) ?? 360;
19481
+ const renderDrawerContent = drawerProps == null ? void 0 : drawerProps.renderDrawerContent;
19592
19482
  const [drawerData, setDrawerData] = React.useState(null);
19593
- const [selectedArrow, setSelectedArrow] = React.useState(null);
19594
- const handleDrawerClose = React.useCallback(() => {
19595
- setDrawerData(null);
19596
- setSelectedArrow(null);
19597
- }, []);
19598
- const handleBarClickForDrawer = React.useCallback(
19599
- (task, _event) => {
19600
- if (clientTaskBar == null ? void 0 : clientTaskBar.onClick) {
19601
- clientTaskBar.onClick(task);
19602
- }
19603
- if (enableDrawer) {
19604
- setDrawerData({ type: "task", task });
19605
- setSelectedArrow({ taskId: task.id });
19606
- }
19607
- },
19608
- [clientTaskBar == null ? void 0 : clientTaskBar.onClick, enableDrawer]
19609
- );
19610
- const handleArrowClickForDrawer = React.useCallback(
19611
- (taskFrom, taskTo) => {
19612
- if (onArrowClickProp) {
19613
- onArrowClickProp(taskFrom, taskTo);
19614
- }
19615
- if (enableDrawer) {
19616
- setDrawerData({ type: "connection", taskFrom, taskTo });
19617
- setSelectedArrow({ fromId: taskFrom.id, toId: taskTo.id });
19618
- }
19619
- },
19620
- [onArrowClickProp, enableDrawer]
19621
- );
19483
+ const [activeArrowKey, setActiveArrowKey] = React.useState(null);
19622
19484
  const taskBar = React.useMemo(() => {
19623
19485
  return mergeDeepObj(
19624
19486
  {},
@@ -20708,6 +20570,34 @@
20708
20570
  },
20709
20571
  [mapTaskToGlobalIndex, taskBar, handleCommitInternal, sortedTasks]
20710
20572
  );
20573
+ const onArrowClick = React.useCallback(
20574
+ (taskFrom, taskTo) => {
20575
+ if (enableDrawer) {
20576
+ setActiveArrowKey(`${taskFrom.id}|${taskTo.id}`);
20577
+ setDrawerData({ type: "arrow", taskFrom, taskTo });
20578
+ }
20579
+ if (taskBar.onArrowClick) {
20580
+ taskBar.onArrowClick(taskFrom, taskTo);
20581
+ }
20582
+ },
20583
+ [enableDrawer, taskBar]
20584
+ );
20585
+ const handleTaskClick = React.useCallback(
20586
+ (task, _event) => {
20587
+ if (enableDrawer) {
20588
+ setActiveArrowKey(null);
20589
+ setDrawerData({ type: "task", task });
20590
+ }
20591
+ if (taskBar.onClick) {
20592
+ taskBar.onClick(task);
20593
+ }
20594
+ },
20595
+ [enableDrawer, taskBar]
20596
+ );
20597
+ const handleDrawerClose = React.useCallback(() => {
20598
+ setDrawerData(null);
20599
+ setActiveArrowKey(null);
20600
+ }, []);
20711
20601
  const handleAction = useHandleAction({
20712
20602
  checkTaskIdExists,
20713
20603
  childTasksMap,
@@ -20894,6 +20784,7 @@
20894
20784
  const renderTaskBarProps = React.useMemo(
20895
20785
  () => ({
20896
20786
  ...taskBar,
20787
+ onClick: enableDrawer ? handleTaskClick : taskBar.onClick,
20897
20788
  taskBarMovingAction: (task) => {
20898
20789
  var _a2;
20899
20790
  return task.id === ((_a2 = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _a2.id) ? changeInProgress.action : null;
@@ -20920,6 +20811,8 @@
20920
20811
  onTooltipTask: onChangeTooltipTask,
20921
20812
  mapGlobalRowIndexToTask,
20922
20813
  onArrowDoubleClick,
20814
+ onArrowClick: enableDrawer ? onArrowClick : taskBar.onArrowClick,
20815
+ activeArrowKey,
20923
20816
  renderedRowIndexes,
20924
20817
  rtl,
20925
20818
  selectTaskOnMouseDown,
@@ -20931,10 +20824,7 @@
20931
20824
  visibleTasksMirror,
20932
20825
  viewMode,
20933
20826
  showProgress,
20934
- progressColor,
20935
- onArrowClick: enableDrawer ? handleArrowClickForDrawer : void 0,
20936
- onClick: enableDrawer ? handleBarClickForDrawer : taskBar.onClick,
20937
- selectedArrow
20827
+ progressColor
20938
20828
  }),
20939
20829
  [
20940
20830
  viewMode,
@@ -20960,6 +20850,10 @@
20960
20850
  onChangeTooltipTask,
20961
20851
  mapGlobalRowIndexToTask,
20962
20852
  onArrowDoubleClick,
20853
+ onArrowClick,
20854
+ activeArrowKey,
20855
+ enableDrawer,
20856
+ handleTaskClick,
20963
20857
  renderedRowIndexes,
20964
20858
  rtl,
20965
20859
  selectTaskOnMouseDown,
@@ -20973,11 +20867,7 @@
20973
20867
  changeInProgress == null ? void 0 : changeInProgress.action,
20974
20868
  handleDeleteTasks,
20975
20869
  showProgress,
20976
- progressColor,
20977
- enableDrawer,
20978
- handleArrowClickForDrawer,
20979
- handleBarClickForDrawer,
20980
- selectedArrow
20870
+ progressColor
20981
20871
  ]
20982
20872
  );
20983
20873
  const renderTaskListProps = React.useMemo(
@@ -21134,9 +21024,8 @@
21134
21024
  enableDrawer && /* @__PURE__ */ jsxRuntime.jsx(
21135
21025
  GanttDrawer,
21136
21026
  {
21137
- open: drawerData !== null,
21138
- width: drawerWidth,
21139
21027
  data: drawerData,
21028
+ width: drawerWidth,
21140
21029
  onClose: handleDrawerClose,
21141
21030
  renderContent: renderDrawerContent
21142
21031
  }