@juzhenfe/page-model 3.18.2 → 3.18.3

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.
@@ -186,6 +186,12 @@ declare global {
186
186
  * 显示索引列
187
187
  */
188
188
  showIndex?: boolean
189
+
190
+ /**
191
+ * 辅助横向滚动
192
+ */
193
+ assistScrollX?: boolean
194
+
189
195
  /**
190
196
  * 显示多选条数提示
191
197
  */
package/dist/index.es.js CHANGED
@@ -8959,14 +8959,36 @@ const useSelectionsTable = () => {
8959
8959
  };
8960
8960
  };
8961
8961
  function useListenScroll(tableManager) {
8962
+ let scrollBarWrapEle;
8962
8963
  const handleScroll = throttle(function handleScroll2(e) {
8963
8964
  tableManager.updateScrollTop(e.target.scrollTop);
8964
8965
  tableManager.updateScrollLeft(e.target.scrollLeft);
8965
- }, 120);
8966
- let scrollBarWrapEle;
8966
+ }, 10);
8967
+ const getScrollable = () => {
8968
+ const wrapRect = scrollBarWrapEle.getBoundingClientRect();
8969
+ const contentRect = scrollBarWrapEle.querySelector(".el-scrollbar__view").getBoundingClientRect();
8970
+ return {
8971
+ scrollY: wrapRect.height < contentRect.height,
8972
+ scrollX: wrapRect.width < contentRect.width
8973
+ };
8974
+ };
8975
+ const setScrollX = (scrollLeft) => {
8976
+ tableManager.tableRef.setScrollLeft(scrollLeft);
8977
+ };
8978
+ const handleWheel = (e) => {
8979
+ const { scrollX, scrollY } = getScrollable();
8980
+ if (!scrollY && scrollX) {
8981
+ const wheelDelta = e.wheelDelta;
8982
+ const currentScrollLeft = scrollBarWrapEle.scrollLeft;
8983
+ setScrollX(currentScrollLeft + Number(wheelDelta * -1));
8984
+ }
8985
+ };
8967
8986
  function onMounted2() {
8968
8987
  scrollBarWrapEle = tableManager.tableRef.$el.querySelector(".el-scrollbar__wrap");
8969
8988
  scrollBarWrapEle.addEventListener("scroll", handleScroll);
8989
+ if (tableManager.table.assistScrollX) {
8990
+ scrollBarWrapEle.addEventListener("mousewheel", handleWheel);
8991
+ }
8970
8992
  }
8971
8993
  function onActivated2() {
8972
8994
  tableManager.tableRef.scrollBarRef.setScrollTop(tableManager.scrollTop);
@@ -8974,6 +8996,9 @@ function useListenScroll(tableManager) {
8974
8996
  }
8975
8997
  function onUnmounted2() {
8976
8998
  scrollBarWrapEle.removeEventListener("scroll", handleScroll);
8999
+ if (tableManager.table.assistScrollX) {
9000
+ scrollBarWrapEle.removeEventListener("mousewheel", handleWheel);
9001
+ }
8977
9002
  scrollBarWrapEle = null;
8978
9003
  }
8979
9004
  return {
@@ -14903,7 +14928,7 @@ const defineEditableTable = function(config) {
14903
14928
  };
14904
14929
  var iconfont = "";
14905
14930
  const name = "@juzhenfe/page-model";
14906
- const version = "3.18.2";
14931
+ const version = "3.18.3";
14907
14932
  const types = "dist/main.d.ts";
14908
14933
  const main = "dist/index.umd.js";
14909
14934
  const keywords = [