gantt-task-react-powern 0.5.2 → 0.5.4
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/index.js +69 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +69 -8
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2127,7 +2127,7 @@ var Bar = function Bar(_ref) {
|
|
|
2127
2127
|
var handleHeight = task.height / 2 - 1;
|
|
2128
2128
|
|
|
2129
2129
|
if (type == "planned") {
|
|
2130
|
-
if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0) return React__default.createElement("g", {
|
|
2130
|
+
if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0 && task.x2 - task.x1 >= 0) return React__default.createElement("g", {
|
|
2131
2131
|
className: styles$6.barWrapper,
|
|
2132
2132
|
tabIndex: 0
|
|
2133
2133
|
}, React__default.createElement(BarDisplay, {
|
|
@@ -2175,7 +2175,7 @@ var Bar = function Bar(_ref) {
|
|
|
2175
2175
|
className: styles$6.barWrapper,
|
|
2176
2176
|
tabIndex: 0
|
|
2177
2177
|
});
|
|
2178
|
-
} else if ((task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) >= 0) {
|
|
2178
|
+
} else if ((task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) >= 0 && task.actualx2 - task.actualx1 >= 0) {
|
|
2179
2179
|
return React__default.createElement("g", {
|
|
2180
2180
|
className: styles$6.barWrapper,
|
|
2181
2181
|
tabIndex: 0
|
|
@@ -3012,9 +3012,17 @@ var Gantt = function Gantt(_ref) {
|
|
|
3012
3012
|
ignoreScrollEvent = _useState12[0],
|
|
3013
3013
|
setIgnoreScrollEvent = _useState12[1];
|
|
3014
3014
|
|
|
3015
|
-
var _useState13 = React.useState(
|
|
3016
|
-
|
|
3017
|
-
|
|
3015
|
+
var _useState13 = React.useState(0),
|
|
3016
|
+
lastTouchX = _useState13[0],
|
|
3017
|
+
setLastTouchX = _useState13[1];
|
|
3018
|
+
|
|
3019
|
+
var _useState14 = React.useState(0),
|
|
3020
|
+
lastTouchY = _useState14[0],
|
|
3021
|
+
setLastTouchY = _useState14[1];
|
|
3022
|
+
|
|
3023
|
+
var _useState15 = React.useState(false),
|
|
3024
|
+
hasCircularDeps = _useState15[0],
|
|
3025
|
+
setHasCircularDeps = _useState15[1];
|
|
3018
3026
|
|
|
3019
3027
|
React.useEffect(function () {
|
|
3020
3028
|
if (scheduleType === "lookAhead" && startDate && endDate) {
|
|
@@ -3154,7 +3162,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
3154
3162
|
}
|
|
3155
3163
|
}, [ganttHeight, tasks, headerHeight, rowHeight]);
|
|
3156
3164
|
React.useEffect(function () {
|
|
3157
|
-
var _wrapperRef$current;
|
|
3165
|
+
var _wrapperRef$current, _wrapperRef$current2, _wrapperRef$current3, _wrapperRef$current4;
|
|
3158
3166
|
|
|
3159
3167
|
var handleWheel = function handleWheel(event) {
|
|
3160
3168
|
if (event.shiftKey || event.deltaX) {
|
|
@@ -3187,13 +3195,66 @@ var Gantt = function Gantt(_ref) {
|
|
|
3187
3195
|
setIgnoreScrollEvent(true);
|
|
3188
3196
|
};
|
|
3189
3197
|
|
|
3198
|
+
var handleLogTouch = function handleLogTouch(event) {
|
|
3199
|
+
if (event) {
|
|
3200
|
+
setLastTouchX(event.changedTouches[0].pageX);
|
|
3201
|
+
setLastTouchY(event.changedTouches[0].pageY);
|
|
3202
|
+
}
|
|
3203
|
+
};
|
|
3204
|
+
|
|
3205
|
+
var handleTouch = function handleTouch(event) {
|
|
3206
|
+
if (event.changedTouches[0].pageX || event.changedTouches[0].pageY) {
|
|
3207
|
+
var deltaX = event.changedTouches[0].pageX - lastTouchX;
|
|
3208
|
+
var deltaY = event.changedTouches[0].pageY - lastTouchY;
|
|
3209
|
+
|
|
3210
|
+
if (Math.abs(deltaX) > Math.abs(deltaY)) {
|
|
3211
|
+
var newScrollX = scrollX - deltaX / 3;
|
|
3212
|
+
|
|
3213
|
+
if (newScrollX > 0 && newScrollX < 1600) {
|
|
3214
|
+
setScrollX(newScrollX);
|
|
3215
|
+
} else if (newScrollX < 0) {
|
|
3216
|
+
setScrollX(0);
|
|
3217
|
+
} else {
|
|
3218
|
+
setScrollX(1600);
|
|
3219
|
+
}
|
|
3220
|
+
} else {
|
|
3221
|
+
var newScrollY = scrollY - deltaY;
|
|
3222
|
+
|
|
3223
|
+
if (newScrollY > 0 && newScrollY < 1600) {
|
|
3224
|
+
setScrollY(newScrollY);
|
|
3225
|
+
} else if (newScrollY < 0) {
|
|
3226
|
+
setScrollY(0);
|
|
3227
|
+
} else {
|
|
3228
|
+
setScrollY(1600);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
setLastTouchX(event.changedTouches[0].pageX);
|
|
3233
|
+
setLastTouchY(event.changedTouches[0].pageY);
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3236
|
+
setIgnoreScrollEvent(true);
|
|
3237
|
+
};
|
|
3238
|
+
|
|
3190
3239
|
(_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.addEventListener("wheel", handleWheel, {
|
|
3191
3240
|
passive: false
|
|
3192
3241
|
});
|
|
3242
|
+
(_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.addEventListener("touchmove", handleTouch, {
|
|
3243
|
+
passive: false
|
|
3244
|
+
});
|
|
3245
|
+
(_wrapperRef$current3 = wrapperRef.current) === null || _wrapperRef$current3 === void 0 ? void 0 : _wrapperRef$current3.addEventListener("touchstart", handleLogTouch, {
|
|
3246
|
+
passive: false
|
|
3247
|
+
});
|
|
3248
|
+
(_wrapperRef$current4 = wrapperRef.current) === null || _wrapperRef$current4 === void 0 ? void 0 : _wrapperRef$current4.addEventListener("touchend", handleLogTouch, {
|
|
3249
|
+
passive: false
|
|
3250
|
+
});
|
|
3193
3251
|
return function () {
|
|
3194
|
-
var _wrapperRef$
|
|
3252
|
+
var _wrapperRef$current5, _wrapperRef$current6, _wrapperRef$current7, _wrapperRef$current8;
|
|
3195
3253
|
|
|
3196
|
-
(_wrapperRef$
|
|
3254
|
+
(_wrapperRef$current5 = wrapperRef.current) === null || _wrapperRef$current5 === void 0 ? void 0 : _wrapperRef$current5.removeEventListener("wheel", handleWheel);
|
|
3255
|
+
(_wrapperRef$current6 = wrapperRef.current) === null || _wrapperRef$current6 === void 0 ? void 0 : _wrapperRef$current6.removeEventListener("touchmove", handleTouch);
|
|
3256
|
+
(_wrapperRef$current7 = wrapperRef.current) === null || _wrapperRef$current7 === void 0 ? void 0 : _wrapperRef$current7.removeEventListener("touchend", handleLogTouch);
|
|
3257
|
+
(_wrapperRef$current8 = wrapperRef.current) === null || _wrapperRef$current8 === void 0 ? void 0 : _wrapperRef$current8.removeEventListener("touchend", handleLogTouch);
|
|
3197
3258
|
};
|
|
3198
3259
|
}, [wrapperRef, scrollY, scrollX, ganttHeight, svgWidth, rtl, ganttFullHeight]);
|
|
3199
3260
|
|