gantt-task-react-v 1.0.39 → 1.0.40
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.
- package/dist/gantt-task-react.es.js +41 -50
- package/dist/gantt-task-react.umd.js +41 -50
- package/package.json +1 -1
|
@@ -13184,8 +13184,7 @@ const TaskGanttInner = (props) => {
|
|
|
13184
13184
|
verticalGanttContainerRef,
|
|
13185
13185
|
verticalScrollbarRef
|
|
13186
13186
|
} = props;
|
|
13187
|
-
const
|
|
13188
|
-
const moveStateVertRef = useRef(null);
|
|
13187
|
+
const ganttBodyRef = React__default.useRef(null);
|
|
13189
13188
|
const moveStateHorRef = useRef(null);
|
|
13190
13189
|
const moveStateScrollRef = useRef(null);
|
|
13191
13190
|
const containerStyle = useMemo(
|
|
@@ -13217,50 +13216,49 @@ const TaskGanttInner = (props) => {
|
|
|
13217
13216
|
]
|
|
13218
13217
|
);
|
|
13219
13218
|
useEffect(() => {
|
|
13220
|
-
if (!
|
|
13219
|
+
if (!ganttBodyRef.current) {
|
|
13221
13220
|
return () => {
|
|
13222
13221
|
};
|
|
13223
13222
|
}
|
|
13224
|
-
const
|
|
13223
|
+
const ganttBodyContainer = ganttBodyRef.current;
|
|
13225
13224
|
const onScrollStart = (event) => {
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
clientY: event.clientY,
|
|
13230
|
-
scrollLeft: verticalGanttContainerRef.current.scrollLeft,
|
|
13231
|
-
scrollTop: horizontalContainerRef.current.scrollTop
|
|
13232
|
-
};
|
|
13225
|
+
var _a, _b, _c, _d;
|
|
13226
|
+
const mouseEvent = event;
|
|
13227
|
+
mouseEvent.preventDefault();
|
|
13233
13228
|
moveStateHorRef.current = {
|
|
13234
|
-
clientX:
|
|
13235
|
-
clientY:
|
|
13236
|
-
scrollLeft:
|
|
13237
|
-
scrollTop: horizontalContainerRef.current.scrollTop
|
|
13229
|
+
clientX: mouseEvent.clientX,
|
|
13230
|
+
clientY: mouseEvent.clientY,
|
|
13231
|
+
scrollLeft: ((_a = verticalGanttContainerRef.current) == null ? void 0 : _a.scrollLeft) || 0,
|
|
13232
|
+
scrollTop: ((_b = horizontalContainerRef.current) == null ? void 0 : _b.scrollTop) || 0
|
|
13238
13233
|
};
|
|
13239
13234
|
moveStateScrollRef.current = {
|
|
13240
|
-
clientX:
|
|
13241
|
-
clientY:
|
|
13242
|
-
scrollLeft: verticalScrollbarRef.current.scrollLeft,
|
|
13243
|
-
scrollTop: verticalScrollbarRef.current.scrollTop
|
|
13235
|
+
clientX: mouseEvent.clientX,
|
|
13236
|
+
clientY: mouseEvent.clientY,
|
|
13237
|
+
scrollLeft: ((_c = verticalScrollbarRef.current) == null ? void 0 : _c.scrollLeft) || 0,
|
|
13238
|
+
scrollTop: ((_d = verticalScrollbarRef.current) == null ? void 0 : _d.scrollTop) || 0
|
|
13244
13239
|
};
|
|
13245
|
-
|
|
13240
|
+
ganttBodyContainer.classList.add(styles$2.calendarDragging);
|
|
13246
13241
|
};
|
|
13247
13242
|
const onScrollMove = (event) => {
|
|
13248
|
-
if (!
|
|
13243
|
+
if (!moveStateHorRef.current) {
|
|
13249
13244
|
return;
|
|
13250
13245
|
}
|
|
13251
|
-
event
|
|
13252
|
-
|
|
13253
|
-
const scrollVertContainer = verticalGanttContainerRef.current;
|
|
13254
|
-
scrollVertContainer.scrollLeft = scrollLeft + clientX - event.clientX;
|
|
13246
|
+
const mouseEvent = event;
|
|
13247
|
+
mouseEvent.preventDefault();
|
|
13255
13248
|
const {
|
|
13256
13249
|
clientX: clientXH,
|
|
13257
13250
|
scrollLeft: scrollLeftH,
|
|
13258
13251
|
scrollTop: scrollTopH,
|
|
13259
13252
|
clientY: clientYH
|
|
13260
13253
|
} = moveStateHorRef.current;
|
|
13254
|
+
const vertContainer = verticalGanttContainerRef.current;
|
|
13255
|
+
if (vertContainer) {
|
|
13256
|
+
vertContainer.scrollLeft = scrollLeftH + clientXH - mouseEvent.clientX;
|
|
13257
|
+
}
|
|
13261
13258
|
const horContainer = horizontalContainerRef.current;
|
|
13262
|
-
horContainer
|
|
13263
|
-
|
|
13259
|
+
if (horContainer) {
|
|
13260
|
+
horContainer.scrollTop = scrollTopH + clientYH - mouseEvent.clientY;
|
|
13261
|
+
}
|
|
13264
13262
|
const {
|
|
13265
13263
|
clientX: clientXS,
|
|
13266
13264
|
scrollLeft: scrollLeftS,
|
|
@@ -13268,25 +13266,27 @@ const TaskGanttInner = (props) => {
|
|
|
13268
13266
|
clientY: clientYS
|
|
13269
13267
|
} = moveStateScrollRef.current;
|
|
13270
13268
|
const scrollContainer = verticalScrollbarRef.current;
|
|
13271
|
-
scrollContainer
|
|
13272
|
-
|
|
13269
|
+
if (scrollContainer) {
|
|
13270
|
+
scrollContainer.scrollLeft = scrollLeftS + clientXS - mouseEvent.clientX;
|
|
13271
|
+
scrollContainer.scrollTop = scrollTopS + clientYS - mouseEvent.clientY;
|
|
13272
|
+
}
|
|
13273
13273
|
};
|
|
13274
13274
|
const onScrollEnd = (event) => {
|
|
13275
|
-
event
|
|
13276
|
-
|
|
13275
|
+
const mouseEvent = event;
|
|
13276
|
+
mouseEvent.preventDefault();
|
|
13277
13277
|
moveStateHorRef.current = null;
|
|
13278
13278
|
moveStateScrollRef.current = null;
|
|
13279
|
-
|
|
13279
|
+
ganttBodyContainer.classList.remove(styles$2.calendarDragging);
|
|
13280
13280
|
};
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13281
|
+
ganttBodyContainer.addEventListener("mousemove", onScrollMove);
|
|
13282
|
+
ganttBodyContainer.addEventListener("mousedown", onScrollStart);
|
|
13283
|
+
ganttBodyContainer.addEventListener("mouseup", onScrollEnd);
|
|
13284
|
+
ganttBodyContainer.addEventListener("mouseout", onScrollEnd);
|
|
13285
13285
|
return () => {
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13286
|
+
ganttBodyContainer.removeEventListener("mousemove", onScrollMove);
|
|
13287
|
+
ganttBodyContainer.removeEventListener("mousedown", onScrollStart);
|
|
13288
|
+
ganttBodyContainer.removeEventListener("mouseup", onScrollEnd);
|
|
13289
|
+
ganttBodyContainer.removeEventListener("mouseout", onScrollEnd);
|
|
13290
13290
|
};
|
|
13291
13291
|
}, [verticalScrollbarRef, horizontalContainerRef, verticalGanttContainerRef]);
|
|
13292
13292
|
return /* @__PURE__ */ jsxs(
|
|
@@ -13313,7 +13313,7 @@ const TaskGanttInner = (props) => {
|
|
|
13313
13313
|
ref: horizontalContainerRef,
|
|
13314
13314
|
className: styles$2.horizontalContainer,
|
|
13315
13315
|
style: containerStyle,
|
|
13316
|
-
children: /* @__PURE__ */ jsx("div", { style: gridStyle, children: /* @__PURE__ */ jsxs(
|
|
13316
|
+
children: /* @__PURE__ */ jsx("div", { style: gridStyle, ref: ganttBodyRef, children: /* @__PURE__ */ jsxs(
|
|
13317
13317
|
"svg",
|
|
13318
13318
|
{
|
|
13319
13319
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -13323,15 +13323,6 @@ const TaskGanttInner = (props) => {
|
|
|
13323
13323
|
ref: ganttSVGRef,
|
|
13324
13324
|
children: [
|
|
13325
13325
|
/* @__PURE__ */ jsx(GanttToday, { ...ganttTodayProps }),
|
|
13326
|
-
/* @__PURE__ */ jsx(
|
|
13327
|
-
"rect",
|
|
13328
|
-
{
|
|
13329
|
-
ref: contentRef,
|
|
13330
|
-
width: "100%",
|
|
13331
|
-
height: "100%",
|
|
13332
|
-
fill: "transparent"
|
|
13333
|
-
}
|
|
13334
|
-
),
|
|
13335
13326
|
/* @__PURE__ */ jsx(TaskGanttContent, { ...barProps })
|
|
13336
13327
|
]
|
|
13337
13328
|
}
|
|
@@ -13201,8 +13201,7 @@
|
|
|
13201
13201
|
verticalGanttContainerRef,
|
|
13202
13202
|
verticalScrollbarRef
|
|
13203
13203
|
} = props;
|
|
13204
|
-
const
|
|
13205
|
-
const moveStateVertRef = React.useRef(null);
|
|
13204
|
+
const ganttBodyRef = React.useRef(null);
|
|
13206
13205
|
const moveStateHorRef = React.useRef(null);
|
|
13207
13206
|
const moveStateScrollRef = React.useRef(null);
|
|
13208
13207
|
const containerStyle = React.useMemo(
|
|
@@ -13234,50 +13233,49 @@
|
|
|
13234
13233
|
]
|
|
13235
13234
|
);
|
|
13236
13235
|
React.useEffect(() => {
|
|
13237
|
-
if (!
|
|
13236
|
+
if (!ganttBodyRef.current) {
|
|
13238
13237
|
return () => {
|
|
13239
13238
|
};
|
|
13240
13239
|
}
|
|
13241
|
-
const
|
|
13240
|
+
const ganttBodyContainer = ganttBodyRef.current;
|
|
13242
13241
|
const onScrollStart = (event) => {
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
clientY: event.clientY,
|
|
13247
|
-
scrollLeft: verticalGanttContainerRef.current.scrollLeft,
|
|
13248
|
-
scrollTop: horizontalContainerRef.current.scrollTop
|
|
13249
|
-
};
|
|
13242
|
+
var _a, _b, _c, _d;
|
|
13243
|
+
const mouseEvent = event;
|
|
13244
|
+
mouseEvent.preventDefault();
|
|
13250
13245
|
moveStateHorRef.current = {
|
|
13251
|
-
clientX:
|
|
13252
|
-
clientY:
|
|
13253
|
-
scrollLeft:
|
|
13254
|
-
scrollTop: horizontalContainerRef.current.scrollTop
|
|
13246
|
+
clientX: mouseEvent.clientX,
|
|
13247
|
+
clientY: mouseEvent.clientY,
|
|
13248
|
+
scrollLeft: ((_a = verticalGanttContainerRef.current) == null ? void 0 : _a.scrollLeft) || 0,
|
|
13249
|
+
scrollTop: ((_b = horizontalContainerRef.current) == null ? void 0 : _b.scrollTop) || 0
|
|
13255
13250
|
};
|
|
13256
13251
|
moveStateScrollRef.current = {
|
|
13257
|
-
clientX:
|
|
13258
|
-
clientY:
|
|
13259
|
-
scrollLeft: verticalScrollbarRef.current.scrollLeft,
|
|
13260
|
-
scrollTop: verticalScrollbarRef.current.scrollTop
|
|
13252
|
+
clientX: mouseEvent.clientX,
|
|
13253
|
+
clientY: mouseEvent.clientY,
|
|
13254
|
+
scrollLeft: ((_c = verticalScrollbarRef.current) == null ? void 0 : _c.scrollLeft) || 0,
|
|
13255
|
+
scrollTop: ((_d = verticalScrollbarRef.current) == null ? void 0 : _d.scrollTop) || 0
|
|
13261
13256
|
};
|
|
13262
|
-
|
|
13257
|
+
ganttBodyContainer.classList.add(styles$2.calendarDragging);
|
|
13263
13258
|
};
|
|
13264
13259
|
const onScrollMove = (event) => {
|
|
13265
|
-
if (!
|
|
13260
|
+
if (!moveStateHorRef.current) {
|
|
13266
13261
|
return;
|
|
13267
13262
|
}
|
|
13268
|
-
event
|
|
13269
|
-
|
|
13270
|
-
const scrollVertContainer = verticalGanttContainerRef.current;
|
|
13271
|
-
scrollVertContainer.scrollLeft = scrollLeft + clientX - event.clientX;
|
|
13263
|
+
const mouseEvent = event;
|
|
13264
|
+
mouseEvent.preventDefault();
|
|
13272
13265
|
const {
|
|
13273
13266
|
clientX: clientXH,
|
|
13274
13267
|
scrollLeft: scrollLeftH,
|
|
13275
13268
|
scrollTop: scrollTopH,
|
|
13276
13269
|
clientY: clientYH
|
|
13277
13270
|
} = moveStateHorRef.current;
|
|
13271
|
+
const vertContainer = verticalGanttContainerRef.current;
|
|
13272
|
+
if (vertContainer) {
|
|
13273
|
+
vertContainer.scrollLeft = scrollLeftH + clientXH - mouseEvent.clientX;
|
|
13274
|
+
}
|
|
13278
13275
|
const horContainer = horizontalContainerRef.current;
|
|
13279
|
-
horContainer
|
|
13280
|
-
|
|
13276
|
+
if (horContainer) {
|
|
13277
|
+
horContainer.scrollTop = scrollTopH + clientYH - mouseEvent.clientY;
|
|
13278
|
+
}
|
|
13281
13279
|
const {
|
|
13282
13280
|
clientX: clientXS,
|
|
13283
13281
|
scrollLeft: scrollLeftS,
|
|
@@ -13285,25 +13283,27 @@
|
|
|
13285
13283
|
clientY: clientYS
|
|
13286
13284
|
} = moveStateScrollRef.current;
|
|
13287
13285
|
const scrollContainer = verticalScrollbarRef.current;
|
|
13288
|
-
scrollContainer
|
|
13289
|
-
|
|
13286
|
+
if (scrollContainer) {
|
|
13287
|
+
scrollContainer.scrollLeft = scrollLeftS + clientXS - mouseEvent.clientX;
|
|
13288
|
+
scrollContainer.scrollTop = scrollTopS + clientYS - mouseEvent.clientY;
|
|
13289
|
+
}
|
|
13290
13290
|
};
|
|
13291
13291
|
const onScrollEnd = (event) => {
|
|
13292
|
-
event
|
|
13293
|
-
|
|
13292
|
+
const mouseEvent = event;
|
|
13293
|
+
mouseEvent.preventDefault();
|
|
13294
13294
|
moveStateHorRef.current = null;
|
|
13295
13295
|
moveStateScrollRef.current = null;
|
|
13296
|
-
|
|
13296
|
+
ganttBodyContainer.classList.remove(styles$2.calendarDragging);
|
|
13297
13297
|
};
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13298
|
+
ganttBodyContainer.addEventListener("mousemove", onScrollMove);
|
|
13299
|
+
ganttBodyContainer.addEventListener("mousedown", onScrollStart);
|
|
13300
|
+
ganttBodyContainer.addEventListener("mouseup", onScrollEnd);
|
|
13301
|
+
ganttBodyContainer.addEventListener("mouseout", onScrollEnd);
|
|
13302
13302
|
return () => {
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13303
|
+
ganttBodyContainer.removeEventListener("mousemove", onScrollMove);
|
|
13304
|
+
ganttBodyContainer.removeEventListener("mousedown", onScrollStart);
|
|
13305
|
+
ganttBodyContainer.removeEventListener("mouseup", onScrollEnd);
|
|
13306
|
+
ganttBodyContainer.removeEventListener("mouseout", onScrollEnd);
|
|
13307
13307
|
};
|
|
13308
13308
|
}, [verticalScrollbarRef, horizontalContainerRef, verticalGanttContainerRef]);
|
|
13309
13309
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -13330,7 +13330,7 @@
|
|
|
13330
13330
|
ref: horizontalContainerRef,
|
|
13331
13331
|
className: styles$2.horizontalContainer,
|
|
13332
13332
|
style: containerStyle,
|
|
13333
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: gridStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13333
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: gridStyle, ref: ganttBodyRef, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13334
13334
|
"svg",
|
|
13335
13335
|
{
|
|
13336
13336
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -13340,15 +13340,6 @@
|
|
|
13340
13340
|
ref: ganttSVGRef,
|
|
13341
13341
|
children: [
|
|
13342
13342
|
/* @__PURE__ */ jsxRuntime.jsx(GanttToday, { ...ganttTodayProps }),
|
|
13343
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13344
|
-
"rect",
|
|
13345
|
-
{
|
|
13346
|
-
ref: contentRef,
|
|
13347
|
-
width: "100%",
|
|
13348
|
-
height: "100%",
|
|
13349
|
-
fill: "transparent"
|
|
13350
|
-
}
|
|
13351
|
-
),
|
|
13352
13343
|
/* @__PURE__ */ jsxRuntime.jsx(TaskGanttContent, { ...barProps })
|
|
13353
13344
|
]
|
|
13354
13345
|
}
|
package/package.json
CHANGED