gantt-task-react-v 1.1.5 → 1.1.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.
@@ -1,4 +1,4 @@
1
- import type { ReactElement } from "react";
1
+ import type { ReactElement, RefObject } from "react";
2
2
  import type { ActionMetaType, ContextMenuOptionType, ContextMenuType, Distances, RenderTask } from "../../types";
3
3
  type ContextMenuProps = {
4
4
  checkHasCopyTasks: () => boolean;
@@ -8,6 +8,8 @@ type ContextMenuProps = {
8
8
  handleAction: (task: RenderTask, action: (meta: ActionMetaType) => void) => void;
9
9
  handleCloseContextMenu: () => void;
10
10
  options: ContextMenuOptionType[];
11
+ /** Optional boundary element to contain the context menu (like tooltips) */
12
+ boundaryElement?: RefObject<HTMLElement>;
11
13
  };
12
14
  export declare function ContextMenu(props: ContextMenuProps): ReactElement;
13
15
  export {};
@@ -3,6 +3,8 @@ import React from "react";
3
3
  import { AllowReorderTask, ChildByLevelMap, Column, DateSetup, DependencyMap, Distances, GanttRenderIconsProps, MapTaskToNestedIndex, OnResizeColumn, Task, RenderTask, TableRenderBottomProps } from "../../types";
4
4
  export type TaskListProps = {
5
5
  ganttRef: RefObject<HTMLDivElement>;
6
+ /** Ref to the horizontal scroll wrapper (used for containing popups) */
7
+ taskListHorizontalScrollRef?: RefObject<HTMLDivElement>;
6
8
  allowReorderTask?: AllowReorderTask;
7
9
  canReorderTasks?: boolean;
8
10
  canResizeColumns?: boolean;
@@ -10697,6 +10697,7 @@ const TaskListInner = ({
10697
10697
  selectedIdsMirror,
10698
10698
  ganttRef,
10699
10699
  taskListContainerRef,
10700
+ taskListHorizontalScrollRef,
10700
10701
  taskListRef,
10701
10702
  tasks,
10702
10703
  onResizeColumn,
@@ -10787,6 +10788,7 @@ const TaskListInner = ({
10787
10788
  /* @__PURE__ */ jsxs(
10788
10789
  "div",
10789
10790
  {
10791
+ ref: taskListHorizontalScrollRef,
10790
10792
  className: styles$d.taskListHorizontalScroll,
10791
10793
  style: {
10792
10794
  width: tableWidth
@@ -18054,6 +18056,7 @@ function MenuOption(props) {
18054
18056
  );
18055
18057
  }
18056
18058
  function ContextMenu(props) {
18059
+ var _a;
18057
18060
  const {
18058
18061
  checkHasCopyTasks,
18059
18062
  checkHasCutTasks,
@@ -18104,7 +18107,13 @@ function ContextMenu(props) {
18104
18107
  },
18105
18108
  strategy: "absolute",
18106
18109
  placement: "bottom-start",
18107
- middleware: [flip(), shift()],
18110
+ middleware: [
18111
+ flip(),
18112
+ shift({
18113
+ boundary: ((_a = props.boundaryElement) == null ? void 0 : _a.current) || void 0,
18114
+ padding: 8
18115
+ })
18116
+ ],
18108
18117
  whileElementsMounted: autoUpdate
18109
18118
  });
18110
18119
  const { setFloating, setReference } = refs;
@@ -18794,6 +18803,7 @@ const Gantt = (props) => {
18794
18803
  const ganttSVGRef = useRef(null);
18795
18804
  const wrapperRef = useRef(null);
18796
18805
  const taskListRef = useRef(null);
18806
+ const taskListHorizontalScrollRef = useRef(null);
18797
18807
  const locale = useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
18798
18808
  const theme = useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
18799
18809
  const { dateFormats: dateFormats2, rtl } = theme;
@@ -20170,7 +20180,13 @@ const Gantt = (props) => {
20170
20180
  ref: wrapperRef,
20171
20181
  "data-testid": "gantt",
20172
20182
  children: [
20173
- (!columnsProp || columnsProp.length > 0) && /* @__PURE__ */ jsx(TaskList, { ...renderTaskListProps }),
20183
+ (!columnsProp || columnsProp.length > 0) && /* @__PURE__ */ jsx(
20184
+ TaskList,
20185
+ {
20186
+ ...renderTaskListProps,
20187
+ taskListHorizontalScrollRef
20188
+ }
20189
+ ),
20174
20190
  /* @__PURE__ */ jsx(
20175
20191
  TaskGantt,
20176
20192
  {
@@ -20225,7 +20241,8 @@ const Gantt = (props) => {
20225
20241
  distances,
20226
20242
  handleAction,
20227
20243
  handleCloseContextMenu,
20228
- options: contextMenuOptions
20244
+ options: contextMenuOptions,
20245
+ boundaryElement: taskListHorizontalScrollRef
20229
20246
  }
20230
20247
  ),
20231
20248
  ganttContextMenu.task && !waitCommitTasks && /* @__PURE__ */ jsx(
@@ -20237,7 +20254,8 @@ const Gantt = (props) => {
20237
20254
  distances,
20238
20255
  handleAction,
20239
20256
  handleCloseContextMenu: handleCloseGanttContextMenu,
20240
- options: ganttContextMenuOptions
20257
+ options: ganttContextMenuOptions,
20258
+ boundaryElement: verticalGanttContainerRef
20241
20259
  }
20242
20260
  ),
20243
20261
  /* @__PURE__ */ jsx(GanttLoader, { loading: waitCommitTasks })
@@ -10714,6 +10714,7 @@
10714
10714
  selectedIdsMirror,
10715
10715
  ganttRef,
10716
10716
  taskListContainerRef,
10717
+ taskListHorizontalScrollRef,
10717
10718
  taskListRef,
10718
10719
  tasks,
10719
10720
  onResizeColumn,
@@ -10804,6 +10805,7 @@
10804
10805
  /* @__PURE__ */ jsxRuntime.jsxs(
10805
10806
  "div",
10806
10807
  {
10808
+ ref: taskListHorizontalScrollRef,
10807
10809
  className: styles$d.taskListHorizontalScroll,
10808
10810
  style: {
10809
10811
  width: tableWidth
@@ -18071,6 +18073,7 @@
18071
18073
  );
18072
18074
  }
18073
18075
  function ContextMenu(props) {
18076
+ var _a;
18074
18077
  const {
18075
18078
  checkHasCopyTasks,
18076
18079
  checkHasCutTasks,
@@ -18121,7 +18124,13 @@
18121
18124
  },
18122
18125
  strategy: "absolute",
18123
18126
  placement: "bottom-start",
18124
- middleware: [flip(), shift()],
18127
+ middleware: [
18128
+ flip(),
18129
+ shift({
18130
+ boundary: ((_a = props.boundaryElement) == null ? void 0 : _a.current) || void 0,
18131
+ padding: 8
18132
+ })
18133
+ ],
18125
18134
  whileElementsMounted: autoUpdate
18126
18135
  });
18127
18136
  const { setFloating, setReference } = refs;
@@ -18811,6 +18820,7 @@
18811
18820
  const ganttSVGRef = React.useRef(null);
18812
18821
  const wrapperRef = React.useRef(null);
18813
18822
  const taskListRef = React.useRef(null);
18823
+ const taskListHorizontalScrollRef = React.useRef(null);
18814
18824
  const locale = React.useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
18815
18825
  const theme = React.useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
18816
18826
  const { dateFormats: dateFormats2, rtl } = theme;
@@ -20187,7 +20197,13 @@
20187
20197
  ref: wrapperRef,
20188
20198
  "data-testid": "gantt",
20189
20199
  children: [
20190
- (!columnsProp || columnsProp.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(TaskList, { ...renderTaskListProps }),
20200
+ (!columnsProp || columnsProp.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
20201
+ TaskList,
20202
+ {
20203
+ ...renderTaskListProps,
20204
+ taskListHorizontalScrollRef
20205
+ }
20206
+ ),
20191
20207
  /* @__PURE__ */ jsxRuntime.jsx(
20192
20208
  TaskGantt,
20193
20209
  {
@@ -20242,7 +20258,8 @@
20242
20258
  distances,
20243
20259
  handleAction,
20244
20260
  handleCloseContextMenu,
20245
- options: contextMenuOptions
20261
+ options: contextMenuOptions,
20262
+ boundaryElement: taskListHorizontalScrollRef
20246
20263
  }
20247
20264
  ),
20248
20265
  ganttContextMenu.task && !waitCommitTasks && /* @__PURE__ */ jsxRuntime.jsx(
@@ -20254,7 +20271,8 @@
20254
20271
  distances,
20255
20272
  handleAction,
20256
20273
  handleCloseContextMenu: handleCloseGanttContextMenu,
20257
- options: ganttContextMenuOptions
20274
+ options: ganttContextMenuOptions,
20275
+ boundaryElement: verticalGanttContainerRef
20258
20276
  }
20259
20277
  ),
20260
20278
  /* @__PURE__ */ jsxRuntime.jsx(GanttLoader, { loading: waitCommitTasks })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
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",