vxe-table 3.10.9 → 3.10.10

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.
@@ -6785,26 +6785,20 @@ const Methods = {
6785
6785
  handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
6786
6786
  const $xeTable = this;
6787
6787
  const props = $xeTable;
6788
+ const reactData = $xeTable;
6789
+ const internalData = $xeTable;
6788
6790
  const {
6789
6791
  highlightHoverRow
6790
6792
  } = props;
6793
+ const {
6794
+ lastScrollLeft,
6795
+ lastScrollTop
6796
+ } = internalData;
6791
6797
  const tableBody = $xeTable.$refs.tableBody;
6792
6798
  const bodyElem = tableBody ? tableBody.$el : null;
6793
6799
  const rowOpts = $xeTable.computeRowOpts;
6794
6800
  const validTip = $xeTable.$refs.validTip;
6795
6801
  const tooltip = $xeTable.$refs.tooltip;
6796
- if (rowOpts.isHover || highlightHoverRow) {
6797
- $xeTable.clearHoverRow();
6798
- }
6799
- if (validTip && validTip.visible) {
6800
- validTip.close();
6801
- }
6802
- if (tooltip && tooltip.visible) {
6803
- tooltip.close();
6804
- }
6805
- if (isRollX) {
6806
- $xeTable.checkScrolling();
6807
- }
6808
6802
  const bodyHeight = bodyElem ? bodyElem.clientHeight : 0;
6809
6803
  const bodyWidth = bodyElem ? bodyElem.clientWidth : 0;
6810
6804
  const scrollHeight = bodyElem ? bodyElem.scrollHeight : 0;
@@ -6813,17 +6807,50 @@ const Methods = {
6813
6807
  let isBottom = false;
6814
6808
  let isLeft = false;
6815
6809
  let isRight = false;
6810
+ let direction = '';
6811
+ let isTopBoundary = false;
6812
+ let isBottomBoundary = false;
6813
+ let isLeftBoundary = false;
6814
+ let isRightBoundary = false;
6816
6815
  if (isRollX) {
6816
+ const xThreshold = $xeTable.computeScrollXThreshold;
6817
6817
  isLeft = scrollLeft <= 0;
6818
- if (!isTop) {
6818
+ if (!isLeft) {
6819
6819
  isRight = scrollLeft + bodyWidth >= scrollWidth;
6820
6820
  }
6821
+ if (scrollLeft > lastScrollLeft) {
6822
+ direction = 'right';
6823
+ if (scrollLeft + bodyWidth >= scrollWidth - xThreshold) {
6824
+ isRightBoundary = true;
6825
+ }
6826
+ } else {
6827
+ direction = 'left';
6828
+ if (scrollLeft <= xThreshold) {
6829
+ isLeftBoundary = true;
6830
+ }
6831
+ }
6821
6832
  $xeTable.checkScrolling();
6833
+ internalData.lastScrollLeft = scrollLeft;
6834
+ reactData.lastScrollTime = Date.now();
6822
6835
  } else {
6836
+ const yThreshold = $xeTable.computeScrollYThreshold;
6823
6837
  isTop = scrollTop <= 0;
6824
6838
  if (!isTop) {
6825
6839
  isBottom = scrollTop + bodyHeight >= scrollHeight;
6826
6840
  }
6841
+ if (scrollTop > lastScrollTop) {
6842
+ direction = 'bottom';
6843
+ if (scrollTop + bodyHeight >= scrollHeight - yThreshold) {
6844
+ isBottomBoundary = true;
6845
+ }
6846
+ } else {
6847
+ direction = 'top';
6848
+ if (scrollTop <= yThreshold) {
6849
+ isTopBoundary = true;
6850
+ }
6851
+ }
6852
+ internalData.lastScrollTop = scrollTop;
6853
+ reactData.lastScrollTime = Date.now();
6827
6854
  }
6828
6855
  const evntParams = Object.assign({
6829
6856
  scrollTop,
@@ -6837,8 +6864,21 @@ const Methods = {
6837
6864
  isTop,
6838
6865
  isBottom,
6839
6866
  isLeft,
6840
- isRight
6867
+ isRight,
6868
+ direction
6841
6869
  }, params);
6870
+ if (rowOpts.isHover || highlightHoverRow) {
6871
+ $xeTable.clearHoverRow();
6872
+ }
6873
+ if (validTip && validTip.visible) {
6874
+ validTip.close();
6875
+ }
6876
+ if (tooltip && tooltip.visible) {
6877
+ tooltip.close();
6878
+ }
6879
+ if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
6880
+ $xeTable.dispatchEvent('scroll-boundary', evntParams, evnt);
6881
+ }
6842
6882
  $xeTable.dispatchEvent('scroll', evntParams, evnt);
6843
6883
  },
6844
6884
  /**
@@ -6875,8 +6915,6 @@ const Methods = {
6875
6915
  const bodyElem = tableBody.$el;
6876
6916
  const headerElem = tableHeader ? tableHeader.$el : null;
6877
6917
  const footerElem = tableFooter ? tableFooter.$el : null;
6878
- $xeTable.lastScrollLeft = scrollLeft;
6879
- $xeTable.lastScrollTime = Date.now();
6880
6918
  (0, _dom.setScrollLeft)(bodyElem, scrollLeft);
6881
6919
  (0, _dom.setScrollLeft)(headerElem, scrollLeft);
6882
6920
  (0, _dom.setScrollLeft)(footerElem, scrollLeft);
@@ -6890,8 +6928,6 @@ const Methods = {
6890
6928
  } = wrapperEl;
6891
6929
  const isRollX = true;
6892
6930
  const isRollY = false;
6893
- $xeTable.lastScrollLeft = scrollLeft;
6894
- $xeTable.lastScrollTime = Date.now();
6895
6931
  $xeTable.handleSyncScrollX(scrollLeft);
6896
6932
  $xeTable.triggerScrollXEvent(evnt);
6897
6933
  $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
@@ -6913,8 +6949,6 @@ const Methods = {
6913
6949
  const bodyElem = tableBody.$el;
6914
6950
  const leftElem = leftBody ? leftBody.$el : null;
6915
6951
  const rightElem = rightBody ? rightBody.$el : null;
6916
- $xeTable.lastScrollTop = scrollTop;
6917
- $xeTable.lastScrollTime = Date.now();
6918
6952
  (0, _dom.setScrollTop)(bodyElem, scrollTop);
6919
6953
  (0, _dom.setScrollTop)(leftElem, scrollTop);
6920
6954
  (0, _dom.setScrollTop)(rightElem, scrollTop);
@@ -6928,8 +6962,6 @@ const Methods = {
6928
6962
  } = wrapperEl;
6929
6963
  const isRollX = false;
6930
6964
  const isRollY = true;
6931
- $xeTable.lastScrollTop = scrollTop;
6932
- $xeTable.lastScrollTime = Date.now();
6933
6965
  $xeTable.handleSyncScrollY(scrollTop);
6934
6966
  $xeTable.triggerScrollYEvent(evnt);
6935
6967
  $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {