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