gantt-task-react-v 1.1.4 → 1.1.5

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.
@@ -10021,10 +10021,10 @@ const TaskListTableRowInner = forwardRef(
10021
10021
  const { id, comparisonLevel = 1 } = task;
10022
10022
  const onRootMouseDown = useCallback(
10023
10023
  (event) => {
10024
+ event.preventDefault();
10024
10025
  if (event.button !== 0) {
10025
10026
  return;
10026
10027
  }
10027
- event.preventDefault();
10028
10028
  if (task.type !== "empty") {
10029
10029
  scrollToTask(task);
10030
10030
  }
@@ -12783,9 +12783,6 @@ const TaskItemInner = (props) => {
12783
12783
  ]);
12784
12784
  const onMouseDown = useCallback(
12785
12785
  (event) => {
12786
- if (event.button !== 0) {
12787
- return;
12788
- }
12789
12786
  event.stopPropagation();
12790
12787
  onSelectTaskOnMouseDown(task.id, event);
12791
12788
  },
@@ -17976,16 +17973,9 @@ const useContextMenu = (wrapperRef, scrollToTask) => {
17976
17973
  }
17977
17974
  const { top, left } = wrapperNode.getBoundingClientRect();
17978
17975
  setContextMenu({
17979
- task: null,
17980
- x: 0,
17981
- y: 0
17982
- });
17983
- requestAnimationFrame(() => {
17984
- setContextMenu({
17985
- task,
17986
- x: clientX - left,
17987
- y: clientY - top
17988
- });
17976
+ task,
17977
+ x: clientX - left,
17978
+ y: clientY - top
17989
17979
  });
17990
17980
  if (task.type !== "empty") {
17991
17981
  scrollToTask(task);
@@ -18064,7 +18054,6 @@ function MenuOption(props) {
18064
18054
  );
18065
18055
  }
18066
18056
  function ContextMenu(props) {
18067
- var _a;
18068
18057
  const {
18069
18058
  checkHasCopyTasks,
18070
18059
  checkHasCutTasks,
@@ -18125,12 +18114,7 @@ function ContextMenu(props) {
18125
18114
  }
18126
18115
  }, [context, task, x, y]);
18127
18116
  const focus = useFocus(context);
18128
- const dismiss = useDismiss(context, {
18129
- outsidePress: true,
18130
- outsidePressEvent: "mousedown",
18131
- ancestorScroll: true,
18132
- escapeKey: true
18133
- });
18117
+ const dismiss = useDismiss(context);
18134
18118
  const role = useRole(context, { role: "tooltip" });
18135
18119
  const { getReferenceProps, getFloatingProps } = useInteractions([
18136
18120
  focus,
@@ -18159,7 +18143,7 @@ function ContextMenu(props) {
18159
18143
  ref: setReference
18160
18144
  }
18161
18145
  ),
18162
- task && /* @__PURE__ */ jsx(
18146
+ task && /* @__PURE__ */ jsxs(
18163
18147
  "div",
18164
18148
  {
18165
18149
  ref: setFloatingRef,
@@ -18179,24 +18163,29 @@ function ContextMenu(props) {
18179
18163
  zIndex: 10
18180
18164
  },
18181
18165
  ...getFloatingProps(),
18182
- children: task.type !== "project" ? optionsForRender.map((option, index2) => /* @__PURE__ */ jsx(
18183
- MenuOption,
18184
- {
18185
- onClose: handleCloseContextMenu,
18186
- distances,
18187
- handleAction: handleOptionAction,
18188
- option
18189
- },
18190
- index2
18191
- )) : ((_a = optionsForRender[2]) == null ? void 0 : _a.checkIsAvailable) ? /* @__PURE__ */ jsx(
18192
- MenuOption,
18193
- {
18194
- onClose: handleCloseContextMenu,
18195
- distances,
18196
- handleAction: handleOptionAction,
18197
- option: optionsForRender[2]
18198
- }
18199
- ) : null
18166
+ children: [
18167
+ optionsForRender.map((option, index2) => /* @__PURE__ */ jsx(
18168
+ MenuOption,
18169
+ {
18170
+ onClose: handleCloseContextMenu,
18171
+ distances,
18172
+ handleAction: handleOptionAction,
18173
+ option
18174
+ },
18175
+ index2
18176
+ )),
18177
+ optionsForRender.length === 0 && /* @__PURE__ */ jsx(
18178
+ "div",
18179
+ {
18180
+ style: {
18181
+ padding: "6px 12px",
18182
+ color: "var(--gantt-context-menu-empty-color, #666)",
18183
+ fontSize: "var(--gantt-font-size)"
18184
+ },
18185
+ children: "—"
18186
+ }
18187
+ )
18188
+ ]
18200
18189
  }
18201
18190
  )
18202
18191
  ] });
@@ -10038,10 +10038,10 @@
10038
10038
  const { id, comparisonLevel = 1 } = task;
10039
10039
  const onRootMouseDown = React.useCallback(
10040
10040
  (event) => {
10041
+ event.preventDefault();
10041
10042
  if (event.button !== 0) {
10042
10043
  return;
10043
10044
  }
10044
- event.preventDefault();
10045
10045
  if (task.type !== "empty") {
10046
10046
  scrollToTask(task);
10047
10047
  }
@@ -12800,9 +12800,6 @@
12800
12800
  ]);
12801
12801
  const onMouseDown = React.useCallback(
12802
12802
  (event) => {
12803
- if (event.button !== 0) {
12804
- return;
12805
- }
12806
12803
  event.stopPropagation();
12807
12804
  onSelectTaskOnMouseDown(task.id, event);
12808
12805
  },
@@ -17993,16 +17990,9 @@
17993
17990
  }
17994
17991
  const { top, left } = wrapperNode.getBoundingClientRect();
17995
17992
  setContextMenu({
17996
- task: null,
17997
- x: 0,
17998
- y: 0
17999
- });
18000
- requestAnimationFrame(() => {
18001
- setContextMenu({
18002
- task,
18003
- x: clientX - left,
18004
- y: clientY - top
18005
- });
17993
+ task,
17994
+ x: clientX - left,
17995
+ y: clientY - top
18006
17996
  });
18007
17997
  if (task.type !== "empty") {
18008
17998
  scrollToTask(task);
@@ -18081,7 +18071,6 @@
18081
18071
  );
18082
18072
  }
18083
18073
  function ContextMenu(props) {
18084
- var _a;
18085
18074
  const {
18086
18075
  checkHasCopyTasks,
18087
18076
  checkHasCutTasks,
@@ -18142,12 +18131,7 @@
18142
18131
  }
18143
18132
  }, [context, task, x, y]);
18144
18133
  const focus = useFocus(context);
18145
- const dismiss = useDismiss(context, {
18146
- outsidePress: true,
18147
- outsidePressEvent: "mousedown",
18148
- ancestorScroll: true,
18149
- escapeKey: true
18150
- });
18134
+ const dismiss = useDismiss(context);
18151
18135
  const role = useRole(context, { role: "tooltip" });
18152
18136
  const { getReferenceProps, getFloatingProps } = useInteractions([
18153
18137
  focus,
@@ -18176,7 +18160,7 @@
18176
18160
  ref: setReference
18177
18161
  }
18178
18162
  ),
18179
- task && /* @__PURE__ */ jsxRuntime.jsx(
18163
+ task && /* @__PURE__ */ jsxRuntime.jsxs(
18180
18164
  "div",
18181
18165
  {
18182
18166
  ref: setFloatingRef,
@@ -18196,24 +18180,29 @@
18196
18180
  zIndex: 10
18197
18181
  },
18198
18182
  ...getFloatingProps(),
18199
- children: task.type !== "project" ? optionsForRender.map((option, index2) => /* @__PURE__ */ jsxRuntime.jsx(
18200
- MenuOption,
18201
- {
18202
- onClose: handleCloseContextMenu,
18203
- distances,
18204
- handleAction: handleOptionAction,
18205
- option
18206
- },
18207
- index2
18208
- )) : ((_a = optionsForRender[2]) == null ? void 0 : _a.checkIsAvailable) ? /* @__PURE__ */ jsxRuntime.jsx(
18209
- MenuOption,
18210
- {
18211
- onClose: handleCloseContextMenu,
18212
- distances,
18213
- handleAction: handleOptionAction,
18214
- option: optionsForRender[2]
18215
- }
18216
- ) : null
18183
+ children: [
18184
+ optionsForRender.map((option, index2) => /* @__PURE__ */ jsxRuntime.jsx(
18185
+ MenuOption,
18186
+ {
18187
+ onClose: handleCloseContextMenu,
18188
+ distances,
18189
+ handleAction: handleOptionAction,
18190
+ option
18191
+ },
18192
+ index2
18193
+ )),
18194
+ optionsForRender.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
18195
+ "div",
18196
+ {
18197
+ style: {
18198
+ padding: "6px 12px",
18199
+ color: "var(--gantt-context-menu-empty-color, #666)",
18200
+ fontSize: "var(--gantt-font-size)"
18201
+ },
18202
+ children: "—"
18203
+ }
18204
+ )
18205
+ ]
18217
18206
  }
18218
18207
  )
18219
18208
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
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",