sheet-happens 0.0.22 → 0.0.23

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.d.ts CHANGED
@@ -74,7 +74,7 @@ export interface SheetProps {
74
74
  onChange?: (changes: Array<Change>) => void;
75
75
  onCellWidthChange?: (indices: number[], value: number) => void;
76
76
  onCellHeightChange?: (indices: number[], value: number) => void;
77
- onScrollChange?: (scrollX: number, scrolLY: number) => void;
77
+ onScrollChange?: (visibleRows: number[], visibleColumns: number[]) => void;
78
78
  }
79
79
  export interface Style {
80
80
  color?: string;
package/dist/index.js CHANGED
@@ -1035,6 +1035,11 @@ function Sheet(props) {
1035
1035
  var rowSizes = React.useMemo(function () {
1036
1036
  return calculateRowsOrColsSizes(sheetStyle.freezeRows, cellHeight, sheetStyle.columnHeaderHeight, dataOffset.y, canvasHeight);
1037
1037
  }, [sheetStyle, cellHeight, dataOffset.y, canvasHeight]);
1038
+ React.useEffect(function () {
1039
+ if (props.onScrollChange) {
1040
+ props.onScrollChange([].concat(rowSizes.index), [].concat(columnSizes.index));
1041
+ }
1042
+ }, [rowSizes, columnSizes, props.onScrollChange]);
1038
1043
 
1039
1044
  var changeSelection = function changeSelection(x1, y1, x2, y2, scrollToP2) {
1040
1045
  if (scrollToP2 === void 0) {
@@ -1701,10 +1706,6 @@ function Sheet(props) {
1701
1706
  x: cellX,
1702
1707
  y: cellY
1703
1708
  });
1704
-
1705
- if (props.onScrollChange) {
1706
- props.onScrollChange(cellX, cellY);
1707
- }
1708
1709
  }
1709
1710
 
1710
1711
  var newMaxScroll = _extends({}, maxScroll);