gantt-task-react-v 1.1.4 → 1.1.6
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 {};
|
|
@@ -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
|
|
17980
|
-
x:
|
|
17981
|
-
y:
|
|
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);
|
|
@@ -18115,7 +18105,13 @@ function ContextMenu(props) {
|
|
|
18115
18105
|
},
|
|
18116
18106
|
strategy: "absolute",
|
|
18117
18107
|
placement: "bottom-start",
|
|
18118
|
-
middleware: [
|
|
18108
|
+
middleware: [
|
|
18109
|
+
flip(),
|
|
18110
|
+
shift({
|
|
18111
|
+
boundary: ((_a = props.boundaryElement) == null ? void 0 : _a.current) || void 0,
|
|
18112
|
+
padding: 8
|
|
18113
|
+
})
|
|
18114
|
+
],
|
|
18119
18115
|
whileElementsMounted: autoUpdate
|
|
18120
18116
|
});
|
|
18121
18117
|
const { setFloating, setReference } = refs;
|
|
@@ -18125,12 +18121,7 @@ function ContextMenu(props) {
|
|
|
18125
18121
|
}
|
|
18126
18122
|
}, [context, task, x, y]);
|
|
18127
18123
|
const focus = useFocus(context);
|
|
18128
|
-
const dismiss = useDismiss(context
|
|
18129
|
-
outsidePress: true,
|
|
18130
|
-
outsidePressEvent: "mousedown",
|
|
18131
|
-
ancestorScroll: true,
|
|
18132
|
-
escapeKey: true
|
|
18133
|
-
});
|
|
18124
|
+
const dismiss = useDismiss(context);
|
|
18134
18125
|
const role = useRole(context, { role: "tooltip" });
|
|
18135
18126
|
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
18136
18127
|
focus,
|
|
@@ -18159,7 +18150,7 @@ function ContextMenu(props) {
|
|
|
18159
18150
|
ref: setReference
|
|
18160
18151
|
}
|
|
18161
18152
|
),
|
|
18162
|
-
task && /* @__PURE__ */
|
|
18153
|
+
task && /* @__PURE__ */ jsxs(
|
|
18163
18154
|
"div",
|
|
18164
18155
|
{
|
|
18165
18156
|
ref: setFloatingRef,
|
|
@@ -18179,24 +18170,29 @@ function ContextMenu(props) {
|
|
|
18179
18170
|
zIndex: 10
|
|
18180
18171
|
},
|
|
18181
18172
|
...getFloatingProps(),
|
|
18182
|
-
children:
|
|
18183
|
-
|
|
18184
|
-
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
|
|
18188
|
-
|
|
18189
|
-
|
|
18190
|
-
|
|
18191
|
-
|
|
18192
|
-
|
|
18193
|
-
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
|
|
18173
|
+
children: [
|
|
18174
|
+
optionsForRender.map((option, index2) => /* @__PURE__ */ jsx(
|
|
18175
|
+
MenuOption,
|
|
18176
|
+
{
|
|
18177
|
+
onClose: handleCloseContextMenu,
|
|
18178
|
+
distances,
|
|
18179
|
+
handleAction: handleOptionAction,
|
|
18180
|
+
option
|
|
18181
|
+
},
|
|
18182
|
+
index2
|
|
18183
|
+
)),
|
|
18184
|
+
optionsForRender.length === 0 && /* @__PURE__ */ jsx(
|
|
18185
|
+
"div",
|
|
18186
|
+
{
|
|
18187
|
+
style: {
|
|
18188
|
+
padding: "6px 12px",
|
|
18189
|
+
color: "var(--gantt-context-menu-empty-color, #666)",
|
|
18190
|
+
fontSize: "var(--gantt-font-size)"
|
|
18191
|
+
},
|
|
18192
|
+
children: "—"
|
|
18193
|
+
}
|
|
18194
|
+
)
|
|
18195
|
+
]
|
|
18200
18196
|
}
|
|
18201
18197
|
)
|
|
18202
18198
|
] });
|
|
@@ -20236,7 +20232,8 @@ const Gantt = (props) => {
|
|
|
20236
20232
|
distances,
|
|
20237
20233
|
handleAction,
|
|
20238
20234
|
handleCloseContextMenu,
|
|
20239
|
-
options: contextMenuOptions
|
|
20235
|
+
options: contextMenuOptions,
|
|
20236
|
+
boundaryElement: taskListContainerRef
|
|
20240
20237
|
}
|
|
20241
20238
|
),
|
|
20242
20239
|
ganttContextMenu.task && !waitCommitTasks && /* @__PURE__ */ jsx(
|
|
@@ -20248,7 +20245,8 @@ const Gantt = (props) => {
|
|
|
20248
20245
|
distances,
|
|
20249
20246
|
handleAction,
|
|
20250
20247
|
handleCloseContextMenu: handleCloseGanttContextMenu,
|
|
20251
|
-
options: ganttContextMenuOptions
|
|
20248
|
+
options: ganttContextMenuOptions,
|
|
20249
|
+
boundaryElement: verticalGanttContainerRef
|
|
20252
20250
|
}
|
|
20253
20251
|
),
|
|
20254
20252
|
/* @__PURE__ */ jsx(GanttLoader, { loading: waitCommitTasks })
|
|
@@ -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
|
|
17997
|
-
x:
|
|
17998
|
-
y:
|
|
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);
|
|
@@ -18132,7 +18122,13 @@
|
|
|
18132
18122
|
},
|
|
18133
18123
|
strategy: "absolute",
|
|
18134
18124
|
placement: "bottom-start",
|
|
18135
|
-
middleware: [
|
|
18125
|
+
middleware: [
|
|
18126
|
+
flip(),
|
|
18127
|
+
shift({
|
|
18128
|
+
boundary: ((_a = props.boundaryElement) == null ? void 0 : _a.current) || void 0,
|
|
18129
|
+
padding: 8
|
|
18130
|
+
})
|
|
18131
|
+
],
|
|
18136
18132
|
whileElementsMounted: autoUpdate
|
|
18137
18133
|
});
|
|
18138
18134
|
const { setFloating, setReference } = refs;
|
|
@@ -18142,12 +18138,7 @@
|
|
|
18142
18138
|
}
|
|
18143
18139
|
}, [context, task, x, y]);
|
|
18144
18140
|
const focus = useFocus(context);
|
|
18145
|
-
const dismiss = useDismiss(context
|
|
18146
|
-
outsidePress: true,
|
|
18147
|
-
outsidePressEvent: "mousedown",
|
|
18148
|
-
ancestorScroll: true,
|
|
18149
|
-
escapeKey: true
|
|
18150
|
-
});
|
|
18141
|
+
const dismiss = useDismiss(context);
|
|
18151
18142
|
const role = useRole(context, { role: "tooltip" });
|
|
18152
18143
|
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
18153
18144
|
focus,
|
|
@@ -18176,7 +18167,7 @@
|
|
|
18176
18167
|
ref: setReference
|
|
18177
18168
|
}
|
|
18178
18169
|
),
|
|
18179
|
-
task && /* @__PURE__ */ jsxRuntime.
|
|
18170
|
+
task && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18180
18171
|
"div",
|
|
18181
18172
|
{
|
|
18182
18173
|
ref: setFloatingRef,
|
|
@@ -18196,24 +18187,29 @@
|
|
|
18196
18187
|
zIndex: 10
|
|
18197
18188
|
},
|
|
18198
18189
|
...getFloatingProps(),
|
|
18199
|
-
children:
|
|
18200
|
-
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18205
|
-
|
|
18206
|
-
|
|
18207
|
-
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
|
|
18216
|
-
|
|
18190
|
+
children: [
|
|
18191
|
+
optionsForRender.map((option, index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
18192
|
+
MenuOption,
|
|
18193
|
+
{
|
|
18194
|
+
onClose: handleCloseContextMenu,
|
|
18195
|
+
distances,
|
|
18196
|
+
handleAction: handleOptionAction,
|
|
18197
|
+
option
|
|
18198
|
+
},
|
|
18199
|
+
index2
|
|
18200
|
+
)),
|
|
18201
|
+
optionsForRender.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18202
|
+
"div",
|
|
18203
|
+
{
|
|
18204
|
+
style: {
|
|
18205
|
+
padding: "6px 12px",
|
|
18206
|
+
color: "var(--gantt-context-menu-empty-color, #666)",
|
|
18207
|
+
fontSize: "var(--gantt-font-size)"
|
|
18208
|
+
},
|
|
18209
|
+
children: "—"
|
|
18210
|
+
}
|
|
18211
|
+
)
|
|
18212
|
+
]
|
|
18217
18213
|
}
|
|
18218
18214
|
)
|
|
18219
18215
|
] });
|
|
@@ -20253,7 +20249,8 @@
|
|
|
20253
20249
|
distances,
|
|
20254
20250
|
handleAction,
|
|
20255
20251
|
handleCloseContextMenu,
|
|
20256
|
-
options: contextMenuOptions
|
|
20252
|
+
options: contextMenuOptions,
|
|
20253
|
+
boundaryElement: taskListContainerRef
|
|
20257
20254
|
}
|
|
20258
20255
|
),
|
|
20259
20256
|
ganttContextMenu.task && !waitCommitTasks && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20265,7 +20262,8 @@
|
|
|
20265
20262
|
distances,
|
|
20266
20263
|
handleAction,
|
|
20267
20264
|
handleCloseContextMenu: handleCloseGanttContextMenu,
|
|
20268
|
-
options: ganttContextMenuOptions
|
|
20265
|
+
options: ganttContextMenuOptions,
|
|
20266
|
+
boundaryElement: verticalGanttContainerRef
|
|
20269
20267
|
}
|
|
20270
20268
|
),
|
|
20271
20269
|
/* @__PURE__ */ jsxRuntime.jsx(GanttLoader, { loading: waitCommitTasks })
|
package/package.json
CHANGED