@leankylin-sheet/react 3.1.11 → 3.1.12

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.esm.js CHANGED
@@ -3922,7 +3922,8 @@ var Sheet = function Sheet(_ref) {
3922
3922
  }, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
3923
3923
  function isMost(direction) {
3924
3924
  var _containerRef$current;
3925
- var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(".luckysheet-scrollbar-y");
3925
+ var targetClassName = ["top", "bottom"].includes(direction) ? ".luckysheet-scrollbar-y" : ".luckysheet-scrollbar-x";
3926
+ var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(targetClassName);
3926
3927
  var scrollTop = target.scrollTop,
3927
3928
  clientHeight = target.clientHeight,
3928
3929
  clientWidth = target.clientWidth,
@@ -3947,11 +3948,25 @@ var Sheet = function Sheet(_ref) {
3947
3948
  setContext(function (draftCtx) {
3948
3949
  handleGlobalWheel(draftCtx, e, refs.globalCache, refs.scrollbarX.current, refs.scrollbarY.current);
3949
3950
  });
3951
+ if (e.deltaY === 0 && e.deltaX === 0) {
3952
+ return;
3953
+ }
3954
+ var mainDirection = Math.abs(e.deltaY) > Math.abs(e.deltaX) ? "vertical" : "horizontal";
3950
3955
  var upToBottom = e.deltaY > 0;
3951
- if (upToBottom && !isMost("bottom")) {
3952
- e.preventDefault();
3953
- } else if (!upToBottom && !isMost("top")) {
3954
- e.preventDefault();
3956
+ var leftToRight = e.deltaX > 0;
3957
+ if (mainDirection === "vertical") {
3958
+ if (upToBottom && !isMost("bottom")) {
3959
+ e.preventDefault();
3960
+ } else if (!upToBottom && !isMost("top")) {
3961
+ e.preventDefault();
3962
+ }
3963
+ }
3964
+ if (mainDirection === "horizontal") {
3965
+ if (leftToRight && !isMost("right")) {
3966
+ e.preventDefault();
3967
+ } else if (!leftToRight && !isMost("left")) {
3968
+ e.preventDefault();
3969
+ }
3955
3970
  }
3956
3971
  }, [refs.globalCache, refs.scrollbarX, refs.scrollbarY, setContext]);
3957
3972
  useEffect(function () {
package/dist/index.js CHANGED
@@ -3932,7 +3932,8 @@ var Sheet = function Sheet(_ref) {
3932
3932
  }, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
3933
3933
  function isMost(direction) {
3934
3934
  var _containerRef$current;
3935
- var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(".luckysheet-scrollbar-y");
3935
+ var targetClassName = ["top", "bottom"].includes(direction) ? ".luckysheet-scrollbar-y" : ".luckysheet-scrollbar-x";
3936
+ var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(targetClassName);
3936
3937
  var scrollTop = target.scrollTop,
3937
3938
  clientHeight = target.clientHeight,
3938
3939
  clientWidth = target.clientWidth,
@@ -3957,11 +3958,25 @@ var Sheet = function Sheet(_ref) {
3957
3958
  setContext(function (draftCtx) {
3958
3959
  core.handleGlobalWheel(draftCtx, e, refs.globalCache, refs.scrollbarX.current, refs.scrollbarY.current);
3959
3960
  });
3961
+ if (e.deltaY === 0 && e.deltaX === 0) {
3962
+ return;
3963
+ }
3964
+ var mainDirection = Math.abs(e.deltaY) > Math.abs(e.deltaX) ? "vertical" : "horizontal";
3960
3965
  var upToBottom = e.deltaY > 0;
3961
- if (upToBottom && !isMost("bottom")) {
3962
- e.preventDefault();
3963
- } else if (!upToBottom && !isMost("top")) {
3964
- e.preventDefault();
3966
+ var leftToRight = e.deltaX > 0;
3967
+ if (mainDirection === "vertical") {
3968
+ if (upToBottom && !isMost("bottom")) {
3969
+ e.preventDefault();
3970
+ } else if (!upToBottom && !isMost("top")) {
3971
+ e.preventDefault();
3972
+ }
3973
+ }
3974
+ if (mainDirection === "horizontal") {
3975
+ if (leftToRight && !isMost("right")) {
3976
+ e.preventDefault();
3977
+ } else if (!leftToRight && !isMost("left")) {
3978
+ e.preventDefault();
3979
+ }
3965
3980
  }
3966
3981
  }, [refs.globalCache, refs.scrollbarX, refs.scrollbarY, setContext]);
3967
3982
  React.useEffect(function () {
package/dist/index.umd.js CHANGED
@@ -107022,7 +107022,8 @@
107022
107022
  }, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
107023
107023
  function isMost(direction) {
107024
107024
  var _containerRef$current;
107025
- var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(".luckysheet-scrollbar-y");
107025
+ var targetClassName = ["top", "bottom"].includes(direction) ? ".luckysheet-scrollbar-y" : ".luckysheet-scrollbar-x";
107026
+ var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(targetClassName);
107026
107027
  var scrollTop = target.scrollTop,
107027
107028
  clientHeight = target.clientHeight,
107028
107029
  clientWidth = target.clientWidth,
@@ -107047,11 +107048,25 @@
107047
107048
  setContext(function (draftCtx) {
107048
107049
  handleGlobalWheel(draftCtx, e, refs.globalCache, refs.scrollbarX.current, refs.scrollbarY.current);
107049
107050
  });
107051
+ if (e.deltaY === 0 && e.deltaX === 0) {
107052
+ return;
107053
+ }
107054
+ var mainDirection = Math.abs(e.deltaY) > Math.abs(e.deltaX) ? "vertical" : "horizontal";
107050
107055
  var upToBottom = e.deltaY > 0;
107051
- if (upToBottom && !isMost("bottom")) {
107052
- e.preventDefault();
107053
- } else if (!upToBottom && !isMost("top")) {
107054
- e.preventDefault();
107056
+ var leftToRight = e.deltaX > 0;
107057
+ if (mainDirection === "vertical") {
107058
+ if (upToBottom && !isMost("bottom")) {
107059
+ e.preventDefault();
107060
+ } else if (!upToBottom && !isMost("top")) {
107061
+ e.preventDefault();
107062
+ }
107063
+ }
107064
+ if (mainDirection === "horizontal") {
107065
+ if (leftToRight && !isMost("right")) {
107066
+ e.preventDefault();
107067
+ } else if (!leftToRight && !isMost("left")) {
107068
+ e.preventDefault();
107069
+ }
107055
107070
  }
107056
107071
  }, [refs.globalCache, refs.scrollbarX, refs.scrollbarY, setContext]);
107057
107072
  React.useEffect(function () {