gantt-task-react-v 1.1.7 → 1.1.9
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.
|
@@ -17998,9 +17998,9 @@ const useContextMenu = (wrapperRef, scrollToTask) => {
|
|
|
17998
17998
|
handleOpenContextMenu
|
|
17999
17999
|
};
|
|
18000
18000
|
};
|
|
18001
|
-
const menuOption = "
|
|
18002
|
-
const icon = "
|
|
18003
|
-
const label = "
|
|
18001
|
+
const menuOption = "_menuOption_1frh4_3";
|
|
18002
|
+
const icon = "_icon_1frh4_79";
|
|
18003
|
+
const label = "_label_1frh4_87";
|
|
18004
18004
|
const styles$1 = {
|
|
18005
18005
|
menuOption,
|
|
18006
18006
|
icon,
|
|
@@ -18016,20 +18016,25 @@ function MenuOption(props) {
|
|
|
18016
18016
|
},
|
|
18017
18017
|
handleAction,
|
|
18018
18018
|
option,
|
|
18019
|
-
option: { icon: icon2, label: label2 }
|
|
18019
|
+
option: { icon: icon2, label: label2, disabled }
|
|
18020
18020
|
} = props;
|
|
18021
18021
|
const onClick = useCallback(
|
|
18022
18022
|
(e) => {
|
|
18023
18023
|
e.preventDefault();
|
|
18024
|
+
if (disabled) {
|
|
18025
|
+
return;
|
|
18026
|
+
}
|
|
18024
18027
|
handleAction(option);
|
|
18025
|
-
onClose();
|
|
18028
|
+
onClose == null ? void 0 : onClose();
|
|
18026
18029
|
},
|
|
18027
|
-
[onClose, handleAction, option]
|
|
18030
|
+
[onClose, handleAction, option, disabled]
|
|
18028
18031
|
);
|
|
18029
18032
|
return /* @__PURE__ */ jsxs(
|
|
18030
18033
|
"button",
|
|
18031
18034
|
{
|
|
18032
18035
|
className: styles$1.menuOption,
|
|
18036
|
+
"aria-disabled": disabled,
|
|
18037
|
+
disabled,
|
|
18033
18038
|
style: {
|
|
18034
18039
|
height: contextMenuOptionHeight,
|
|
18035
18040
|
paddingLeft: contextMenuSidePadding,
|
|
@@ -18045,7 +18050,7 @@ function MenuOption(props) {
|
|
|
18045
18050
|
style: {
|
|
18046
18051
|
width: contextMenuIconWidth,
|
|
18047
18052
|
color: "var(--gantt-context-menu-text-color)",
|
|
18048
|
-
opacity: 0.5
|
|
18053
|
+
opacity: disabled ? 0.3 : 0.5
|
|
18049
18054
|
},
|
|
18050
18055
|
children: icon2
|
|
18051
18056
|
}
|
|
@@ -18780,6 +18785,8 @@ const Gantt = (props) => {
|
|
|
18780
18785
|
onAddTaskAction,
|
|
18781
18786
|
onEditTaskAction,
|
|
18782
18787
|
onSelectTaskIds,
|
|
18788
|
+
// Invoked when user right-clicks a row in the task list
|
|
18789
|
+
onRowContextMenu,
|
|
18783
18790
|
onWheel,
|
|
18784
18791
|
roundEndDate: clientRoundEndDate = defaultRoundEndDate,
|
|
18785
18792
|
roundStartDate: clientRoundStartDate = defaultRoundStartDate,
|
|
@@ -19106,6 +19113,19 @@ const Gantt = (props) => {
|
|
|
19106
19113
|
[mapTaskToCoordinates, setScrollXProgrammatically]
|
|
19107
19114
|
);
|
|
19108
19115
|
const { contextMenu, handleCloseContextMenu, handleOpenContextMenu } = useContextMenu(wrapperRef, scrollToTask);
|
|
19116
|
+
const handleOpenContextMenuForRow = useCallback(
|
|
19117
|
+
(task, clientX, clientY) => {
|
|
19118
|
+
try {
|
|
19119
|
+
if (onRowContextMenu && task && task.id) {
|
|
19120
|
+
onRowContextMenu(task.id);
|
|
19121
|
+
}
|
|
19122
|
+
} catch (err) {
|
|
19123
|
+
console.error(err);
|
|
19124
|
+
}
|
|
19125
|
+
handleOpenContextMenu(task, clientX, clientY);
|
|
19126
|
+
},
|
|
19127
|
+
[onRowContextMenu, handleOpenContextMenu]
|
|
19128
|
+
);
|
|
19109
19129
|
const [ganttContextMenu, setGanttContextMenu] = useState({
|
|
19110
19130
|
task: null,
|
|
19111
19131
|
x: 0,
|
|
@@ -20127,7 +20147,7 @@ const Gantt = (props) => {
|
|
|
20127
20147
|
handleMoveTaskBefore,
|
|
20128
20148
|
handleMoveTaskAfter,
|
|
20129
20149
|
handleMoveTasksInside,
|
|
20130
|
-
handleOpenContextMenu,
|
|
20150
|
+
handleOpenContextMenu: handleOpenContextMenuForRow,
|
|
20131
20151
|
mapTaskToNestedIndex,
|
|
20132
20152
|
onExpanderClick,
|
|
20133
20153
|
scrollToBottomStep,
|
|
@@ -20157,7 +20177,7 @@ const Gantt = (props) => {
|
|
|
20157
20177
|
handleMoveTaskAfter,
|
|
20158
20178
|
handleMoveTaskBefore,
|
|
20159
20179
|
handleMoveTasksInside,
|
|
20160
|
-
|
|
20180
|
+
handleOpenContextMenuForRow,
|
|
20161
20181
|
mapTaskToNestedIndex,
|
|
20162
20182
|
onExpanderClick,
|
|
20163
20183
|
scrollToBottomStep,
|
|
@@ -18015,9 +18015,9 @@
|
|
|
18015
18015
|
handleOpenContextMenu
|
|
18016
18016
|
};
|
|
18017
18017
|
};
|
|
18018
|
-
const menuOption = "
|
|
18019
|
-
const icon = "
|
|
18020
|
-
const label = "
|
|
18018
|
+
const menuOption = "_menuOption_1frh4_3";
|
|
18019
|
+
const icon = "_icon_1frh4_79";
|
|
18020
|
+
const label = "_label_1frh4_87";
|
|
18021
18021
|
const styles$1 = {
|
|
18022
18022
|
menuOption,
|
|
18023
18023
|
icon,
|
|
@@ -18033,20 +18033,25 @@
|
|
|
18033
18033
|
},
|
|
18034
18034
|
handleAction,
|
|
18035
18035
|
option,
|
|
18036
|
-
option: { icon: icon2, label: label2 }
|
|
18036
|
+
option: { icon: icon2, label: label2, disabled }
|
|
18037
18037
|
} = props;
|
|
18038
18038
|
const onClick = React.useCallback(
|
|
18039
18039
|
(e) => {
|
|
18040
18040
|
e.preventDefault();
|
|
18041
|
+
if (disabled) {
|
|
18042
|
+
return;
|
|
18043
|
+
}
|
|
18041
18044
|
handleAction(option);
|
|
18042
|
-
onClose();
|
|
18045
|
+
onClose == null ? void 0 : onClose();
|
|
18043
18046
|
},
|
|
18044
|
-
[onClose, handleAction, option]
|
|
18047
|
+
[onClose, handleAction, option, disabled]
|
|
18045
18048
|
);
|
|
18046
18049
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18047
18050
|
"button",
|
|
18048
18051
|
{
|
|
18049
18052
|
className: styles$1.menuOption,
|
|
18053
|
+
"aria-disabled": disabled,
|
|
18054
|
+
disabled,
|
|
18050
18055
|
style: {
|
|
18051
18056
|
height: contextMenuOptionHeight,
|
|
18052
18057
|
paddingLeft: contextMenuSidePadding,
|
|
@@ -18062,7 +18067,7 @@
|
|
|
18062
18067
|
style: {
|
|
18063
18068
|
width: contextMenuIconWidth,
|
|
18064
18069
|
color: "var(--gantt-context-menu-text-color)",
|
|
18065
|
-
opacity: 0.5
|
|
18070
|
+
opacity: disabled ? 0.3 : 0.5
|
|
18066
18071
|
},
|
|
18067
18072
|
children: icon2
|
|
18068
18073
|
}
|
|
@@ -18797,6 +18802,8 @@
|
|
|
18797
18802
|
onAddTaskAction,
|
|
18798
18803
|
onEditTaskAction,
|
|
18799
18804
|
onSelectTaskIds,
|
|
18805
|
+
// Invoked when user right-clicks a row in the task list
|
|
18806
|
+
onRowContextMenu,
|
|
18800
18807
|
onWheel,
|
|
18801
18808
|
roundEndDate: clientRoundEndDate = defaultRoundEndDate,
|
|
18802
18809
|
roundStartDate: clientRoundStartDate = defaultRoundStartDate,
|
|
@@ -19123,6 +19130,19 @@
|
|
|
19123
19130
|
[mapTaskToCoordinates, setScrollXProgrammatically]
|
|
19124
19131
|
);
|
|
19125
19132
|
const { contextMenu, handleCloseContextMenu, handleOpenContextMenu } = useContextMenu(wrapperRef, scrollToTask);
|
|
19133
|
+
const handleOpenContextMenuForRow = React.useCallback(
|
|
19134
|
+
(task, clientX, clientY) => {
|
|
19135
|
+
try {
|
|
19136
|
+
if (onRowContextMenu && task && task.id) {
|
|
19137
|
+
onRowContextMenu(task.id);
|
|
19138
|
+
}
|
|
19139
|
+
} catch (err) {
|
|
19140
|
+
console.error(err);
|
|
19141
|
+
}
|
|
19142
|
+
handleOpenContextMenu(task, clientX, clientY);
|
|
19143
|
+
},
|
|
19144
|
+
[onRowContextMenu, handleOpenContextMenu]
|
|
19145
|
+
);
|
|
19126
19146
|
const [ganttContextMenu, setGanttContextMenu] = React.useState({
|
|
19127
19147
|
task: null,
|
|
19128
19148
|
x: 0,
|
|
@@ -20144,7 +20164,7 @@
|
|
|
20144
20164
|
handleMoveTaskBefore,
|
|
20145
20165
|
handleMoveTaskAfter,
|
|
20146
20166
|
handleMoveTasksInside,
|
|
20147
|
-
handleOpenContextMenu,
|
|
20167
|
+
handleOpenContextMenu: handleOpenContextMenuForRow,
|
|
20148
20168
|
mapTaskToNestedIndex,
|
|
20149
20169
|
onExpanderClick,
|
|
20150
20170
|
scrollToBottomStep,
|
|
@@ -20174,7 +20194,7 @@
|
|
|
20174
20194
|
handleMoveTaskAfter,
|
|
20175
20195
|
handleMoveTaskBefore,
|
|
20176
20196
|
handleMoveTasksInside,
|
|
20177
|
-
|
|
20197
|
+
handleOpenContextMenuForRow,
|
|
20178
20198
|
mapTaskToNestedIndex,
|
|
20179
20199
|
onExpanderClick,
|
|
20180
20200
|
scrollToBottomStep,
|
package/dist/style.css
CHANGED
|
@@ -636,7 +636,7 @@
|
|
|
636
636
|
cursor: grabbing;
|
|
637
637
|
}
|
|
638
638
|
/*noinspection CssUnresolvedCustomProperty*/
|
|
639
|
-
.
|
|
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
|
-
.
|
|
656
|
+
._menuOption_1frh4_3 svg {
|
|
657
657
|
width: 20px;
|
|
658
658
|
height: 20px;
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
-
.
|
|
661
|
+
._menuOption_1frh4_3:hover {
|
|
662
662
|
background-color: #eeeeee;
|
|
663
663
|
}
|
|
664
664
|
|
|
665
|
-
.
|
|
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
|
-
.
|
|
681
|
+
._label_1frh4_87 {
|
|
670
682
|
flex: 1;
|
|
671
683
|
}
|
|
672
684
|
/* HTML: <div class="loader"></div> */
|
|
@@ -308,6 +308,10 @@ export interface GanttProps {
|
|
|
308
308
|
* @param wheelEvent
|
|
309
309
|
*/
|
|
310
310
|
onWheel?: (wheelEvent: WheelEvent) => void;
|
|
311
|
+
/**
|
|
312
|
+
* Invokes when user right-clicks a row in the task list. Receives the `task.id` of the clicked row.
|
|
313
|
+
*/
|
|
314
|
+
onRowContextMenu?: (taskId: string) => void;
|
|
311
315
|
/**
|
|
312
316
|
* Recount descedents of a group task when moving
|
|
313
317
|
*/
|
|
@@ -570,6 +574,10 @@ export type ContextMenuOptionType = {
|
|
|
570
574
|
* @param meta Metadata for checking
|
|
571
575
|
*/
|
|
572
576
|
checkIsAvailable?: (meta: CheckIsAvailableMetaType) => void;
|
|
577
|
+
/**
|
|
578
|
+
* Optional flag to render the option as disabled (not clickable)
|
|
579
|
+
*/
|
|
580
|
+
disabled?: boolean;
|
|
573
581
|
label: ReactNode;
|
|
574
582
|
icon?: ReactNode;
|
|
575
583
|
};
|
package/package.json
CHANGED