gantt-task-react-v 1.1.6 → 1.1.8

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.
@@ -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
@@ -17996,9 +17998,9 @@ const useContextMenu = (wrapperRef, scrollToTask) => {
17996
17998
  handleOpenContextMenu
17997
17999
  };
17998
18000
  };
17999
- const menuOption = "_menuOption_1ulvi_3";
18000
- const icon = "_icon_1ulvi_55";
18001
- const label = "_label_1ulvi_63";
18001
+ const menuOption = "_menuOption_1frh4_3";
18002
+ const icon = "_icon_1frh4_79";
18003
+ const label = "_label_1frh4_87";
18002
18004
  const styles$1 = {
18003
18005
  menuOption,
18004
18006
  icon,
@@ -18014,20 +18016,25 @@ function MenuOption(props) {
18014
18016
  },
18015
18017
  handleAction,
18016
18018
  option,
18017
- option: { icon: icon2, label: label2 }
18019
+ option: { icon: icon2, label: label2, disabled }
18018
18020
  } = props;
18019
18021
  const onClick = useCallback(
18020
18022
  (e) => {
18021
18023
  e.preventDefault();
18024
+ if (disabled) {
18025
+ return;
18026
+ }
18022
18027
  handleAction(option);
18023
- onClose();
18028
+ onClose == null ? void 0 : onClose();
18024
18029
  },
18025
- [onClose, handleAction, option]
18030
+ [onClose, handleAction, option, disabled]
18026
18031
  );
18027
18032
  return /* @__PURE__ */ jsxs(
18028
18033
  "button",
18029
18034
  {
18030
18035
  className: styles$1.menuOption,
18036
+ "aria-disabled": disabled,
18037
+ disabled,
18031
18038
  style: {
18032
18039
  height: contextMenuOptionHeight,
18033
18040
  paddingLeft: contextMenuSidePadding,
@@ -18043,7 +18050,7 @@ function MenuOption(props) {
18043
18050
  style: {
18044
18051
  width: contextMenuIconWidth,
18045
18052
  color: "var(--gantt-context-menu-text-color)",
18046
- opacity: 0.5
18053
+ opacity: disabled ? 0.3 : 0.5
18047
18054
  },
18048
18055
  children: icon2
18049
18056
  }
@@ -18801,6 +18808,7 @@ const Gantt = (props) => {
18801
18808
  const ganttSVGRef = useRef(null);
18802
18809
  const wrapperRef = useRef(null);
18803
18810
  const taskListRef = useRef(null);
18811
+ const taskListHorizontalScrollRef = useRef(null);
18804
18812
  const locale = useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
18805
18813
  const theme = useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
18806
18814
  const { dateFormats: dateFormats2, rtl } = theme;
@@ -20177,7 +20185,13 @@ const Gantt = (props) => {
20177
20185
  ref: wrapperRef,
20178
20186
  "data-testid": "gantt",
20179
20187
  children: [
20180
- (!columnsProp || columnsProp.length > 0) && /* @__PURE__ */ jsx(TaskList, { ...renderTaskListProps }),
20188
+ (!columnsProp || columnsProp.length > 0) && /* @__PURE__ */ jsx(
20189
+ TaskList,
20190
+ {
20191
+ ...renderTaskListProps,
20192
+ taskListHorizontalScrollRef
20193
+ }
20194
+ ),
20181
20195
  /* @__PURE__ */ jsx(
20182
20196
  TaskGantt,
20183
20197
  {
@@ -20233,7 +20247,7 @@ const Gantt = (props) => {
20233
20247
  handleAction,
20234
20248
  handleCloseContextMenu,
20235
20249
  options: contextMenuOptions,
20236
- boundaryElement: taskListContainerRef
20250
+ boundaryElement: taskListHorizontalScrollRef
20237
20251
  }
20238
20252
  ),
20239
20253
  ganttContextMenu.task && !waitCommitTasks && /* @__PURE__ */ jsx(
@@ -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
@@ -18013,9 +18015,9 @@
18013
18015
  handleOpenContextMenu
18014
18016
  };
18015
18017
  };
18016
- const menuOption = "_menuOption_1ulvi_3";
18017
- const icon = "_icon_1ulvi_55";
18018
- const label = "_label_1ulvi_63";
18018
+ const menuOption = "_menuOption_1frh4_3";
18019
+ const icon = "_icon_1frh4_79";
18020
+ const label = "_label_1frh4_87";
18019
18021
  const styles$1 = {
18020
18022
  menuOption,
18021
18023
  icon,
@@ -18031,20 +18033,25 @@
18031
18033
  },
18032
18034
  handleAction,
18033
18035
  option,
18034
- option: { icon: icon2, label: label2 }
18036
+ option: { icon: icon2, label: label2, disabled }
18035
18037
  } = props;
18036
18038
  const onClick = React.useCallback(
18037
18039
  (e) => {
18038
18040
  e.preventDefault();
18041
+ if (disabled) {
18042
+ return;
18043
+ }
18039
18044
  handleAction(option);
18040
- onClose();
18045
+ onClose == null ? void 0 : onClose();
18041
18046
  },
18042
- [onClose, handleAction, option]
18047
+ [onClose, handleAction, option, disabled]
18043
18048
  );
18044
18049
  return /* @__PURE__ */ jsxRuntime.jsxs(
18045
18050
  "button",
18046
18051
  {
18047
18052
  className: styles$1.menuOption,
18053
+ "aria-disabled": disabled,
18054
+ disabled,
18048
18055
  style: {
18049
18056
  height: contextMenuOptionHeight,
18050
18057
  paddingLeft: contextMenuSidePadding,
@@ -18060,7 +18067,7 @@
18060
18067
  style: {
18061
18068
  width: contextMenuIconWidth,
18062
18069
  color: "var(--gantt-context-menu-text-color)",
18063
- opacity: 0.5
18070
+ opacity: disabled ? 0.3 : 0.5
18064
18071
  },
18065
18072
  children: icon2
18066
18073
  }
@@ -18818,6 +18825,7 @@
18818
18825
  const ganttSVGRef = React.useRef(null);
18819
18826
  const wrapperRef = React.useRef(null);
18820
18827
  const taskListRef = React.useRef(null);
18828
+ const taskListHorizontalScrollRef = React.useRef(null);
18821
18829
  const locale = React.useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
18822
18830
  const theme = React.useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
18823
18831
  const { dateFormats: dateFormats2, rtl } = theme;
@@ -20194,7 +20202,13 @@
20194
20202
  ref: wrapperRef,
20195
20203
  "data-testid": "gantt",
20196
20204
  children: [
20197
- (!columnsProp || columnsProp.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(TaskList, { ...renderTaskListProps }),
20205
+ (!columnsProp || columnsProp.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
20206
+ TaskList,
20207
+ {
20208
+ ...renderTaskListProps,
20209
+ taskListHorizontalScrollRef
20210
+ }
20211
+ ),
20198
20212
  /* @__PURE__ */ jsxRuntime.jsx(
20199
20213
  TaskGantt,
20200
20214
  {
@@ -20250,7 +20264,7 @@
20250
20264
  handleAction,
20251
20265
  handleCloseContextMenu,
20252
20266
  options: contextMenuOptions,
20253
- boundaryElement: taskListContainerRef
20267
+ boundaryElement: taskListHorizontalScrollRef
20254
20268
  }
20255
20269
  ),
20256
20270
  ganttContextMenu.task && !waitCommitTasks && /* @__PURE__ */ jsxRuntime.jsx(
package/dist/style.css CHANGED
@@ -636,7 +636,7 @@
636
636
  cursor: grabbing;
637
637
  }
638
638
  /*noinspection CssUnresolvedCustomProperty*/
639
- ._menuOption_1ulvi_3 {
639
+ ._menuOption_1frh4_3 {
640
640
  display: flex;
641
641
  align-items: center;
642
642
  text-align: left;
@@ -653,20 +653,32 @@
653
653
  fill: var(--gantt-table-action-color);
654
654
  }
655
655
 
656
- ._menuOption_1ulvi_3 svg {
656
+ ._menuOption_1frh4_3 svg {
657
657
  width: 20px;
658
658
  height: 20px;
659
659
  }
660
660
 
661
- ._menuOption_1ulvi_3:hover {
661
+ ._menuOption_1frh4_3:hover {
662
662
  background-color: #eeeeee;
663
663
  }
664
664
 
665
- ._icon_1ulvi_55 {
665
+ ._menuOption_1frh4_3[aria-disabled="true"],
666
+ ._menuOption_1frh4_3:disabled {
667
+ opacity: 0.6;
668
+ cursor: default;
669
+ background-color: transparent;
670
+ }
671
+
672
+ ._menuOption_1frh4_3[aria-disabled="true"]:hover,
673
+ ._menuOption_1frh4_3:disabled:hover {
674
+ background-color: transparent;
675
+ }
676
+
677
+ ._icon_1frh4_79 {
666
678
  font-size: inherit;
667
679
  }
668
680
 
669
- ._label_1ulvi_63 {
681
+ ._label_1frh4_87 {
670
682
  flex: 1;
671
683
  }
672
684
  /* HTML: <div class="loader"></div> */
@@ -570,6 +570,10 @@ export type ContextMenuOptionType = {
570
570
  * @param meta Metadata for checking
571
571
  */
572
572
  checkIsAvailable?: (meta: CheckIsAvailableMetaType) => void;
573
+ /**
574
+ * Optional flag to render the option as disabled (not clickable)
575
+ */
576
+ disabled?: boolean;
573
577
  label: ReactNode;
574
578
  icon?: ReactNode;
575
579
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
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",