@leankylin-sheet/react 3.1.10 → 3.1.11

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
@@ -3920,11 +3920,39 @@ var Sheet = function Sheet(_ref) {
3920
3920
  tableCanvas.drawRowHeader(context.scrollTop);
3921
3921
  }
3922
3922
  }, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
3923
+ function isMost(direction) {
3924
+ var _containerRef$current;
3925
+ var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(".luckysheet-scrollbar-y");
3926
+ var scrollTop = target.scrollTop,
3927
+ clientHeight = target.clientHeight,
3928
+ clientWidth = target.clientWidth,
3929
+ scrollHeight = target.scrollHeight,
3930
+ scrollLeft = target.scrollLeft,
3931
+ scrollWidth = target.scrollWidth;
3932
+ if (direction === "bottom") {
3933
+ return scrollTop + clientHeight >= scrollHeight - 1;
3934
+ }
3935
+ if (direction === "top") {
3936
+ return scrollTop <= 1;
3937
+ }
3938
+ if (direction === "left") {
3939
+ return scrollLeft <= 1;
3940
+ }
3941
+ if (direction === "right") {
3942
+ return scrollLeft + clientWidth >= scrollWidth - 1;
3943
+ }
3944
+ return false;
3945
+ }
3923
3946
  var onWheel = useCallback(function (e) {
3924
3947
  setContext(function (draftCtx) {
3925
3948
  handleGlobalWheel(draftCtx, e, refs.globalCache, refs.scrollbarX.current, refs.scrollbarY.current);
3926
3949
  });
3927
- e.preventDefault();
3950
+ var upToBottom = e.deltaY > 0;
3951
+ if (upToBottom && !isMost("bottom")) {
3952
+ e.preventDefault();
3953
+ } else if (!upToBottom && !isMost("top")) {
3954
+ e.preventDefault();
3955
+ }
3928
3956
  }, [refs.globalCache, refs.scrollbarX, refs.scrollbarY, setContext]);
3929
3957
  useEffect(function () {
3930
3958
  var container = containerRef.current;
package/dist/index.js CHANGED
@@ -3930,11 +3930,39 @@ var Sheet = function Sheet(_ref) {
3930
3930
  tableCanvas.drawRowHeader(context.scrollTop);
3931
3931
  }
3932
3932
  }, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
3933
+ function isMost(direction) {
3934
+ var _containerRef$current;
3935
+ var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(".luckysheet-scrollbar-y");
3936
+ var scrollTop = target.scrollTop,
3937
+ clientHeight = target.clientHeight,
3938
+ clientWidth = target.clientWidth,
3939
+ scrollHeight = target.scrollHeight,
3940
+ scrollLeft = target.scrollLeft,
3941
+ scrollWidth = target.scrollWidth;
3942
+ if (direction === "bottom") {
3943
+ return scrollTop + clientHeight >= scrollHeight - 1;
3944
+ }
3945
+ if (direction === "top") {
3946
+ return scrollTop <= 1;
3947
+ }
3948
+ if (direction === "left") {
3949
+ return scrollLeft <= 1;
3950
+ }
3951
+ if (direction === "right") {
3952
+ return scrollLeft + clientWidth >= scrollWidth - 1;
3953
+ }
3954
+ return false;
3955
+ }
3933
3956
  var onWheel = React.useCallback(function (e) {
3934
3957
  setContext(function (draftCtx) {
3935
3958
  core.handleGlobalWheel(draftCtx, e, refs.globalCache, refs.scrollbarX.current, refs.scrollbarY.current);
3936
3959
  });
3937
- e.preventDefault();
3960
+ var upToBottom = e.deltaY > 0;
3961
+ if (upToBottom && !isMost("bottom")) {
3962
+ e.preventDefault();
3963
+ } else if (!upToBottom && !isMost("top")) {
3964
+ e.preventDefault();
3965
+ }
3938
3966
  }, [refs.globalCache, refs.scrollbarX, refs.scrollbarY, setContext]);
3939
3967
  React.useEffect(function () {
3940
3968
  var container = containerRef.current;
package/dist/index.umd.js CHANGED
@@ -107020,11 +107020,39 @@
107020
107020
  tableCanvas.drawRowHeader(context.scrollTop);
107021
107021
  }
107022
107022
  }, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
107023
+ function isMost(direction) {
107024
+ var _containerRef$current;
107025
+ var target = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(".luckysheet-scrollbar-y");
107026
+ var scrollTop = target.scrollTop,
107027
+ clientHeight = target.clientHeight,
107028
+ clientWidth = target.clientWidth,
107029
+ scrollHeight = target.scrollHeight,
107030
+ scrollLeft = target.scrollLeft,
107031
+ scrollWidth = target.scrollWidth;
107032
+ if (direction === "bottom") {
107033
+ return scrollTop + clientHeight >= scrollHeight - 1;
107034
+ }
107035
+ if (direction === "top") {
107036
+ return scrollTop <= 1;
107037
+ }
107038
+ if (direction === "left") {
107039
+ return scrollLeft <= 1;
107040
+ }
107041
+ if (direction === "right") {
107042
+ return scrollLeft + clientWidth >= scrollWidth - 1;
107043
+ }
107044
+ return false;
107045
+ }
107023
107046
  var onWheel = React.useCallback(function (e) {
107024
107047
  setContext(function (draftCtx) {
107025
107048
  handleGlobalWheel(draftCtx, e, refs.globalCache, refs.scrollbarX.current, refs.scrollbarY.current);
107026
107049
  });
107027
- e.preventDefault();
107050
+ var upToBottom = e.deltaY > 0;
107051
+ if (upToBottom && !isMost("bottom")) {
107052
+ e.preventDefault();
107053
+ } else if (!upToBottom && !isMost("top")) {
107054
+ e.preventDefault();
107055
+ }
107028
107056
  }, [refs.globalCache, refs.scrollbarX, refs.scrollbarY, setContext]);
107029
107057
  React.useEffect(function () {
107030
107058
  var container = containerRef.current;