@juzhenfe/page-model 3.18.1 → 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.
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
|
-
},
|
|
8966
|
-
|
|
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 {
|
|
@@ -9252,8 +9277,12 @@ const useColumnDrag = () => {
|
|
|
9252
9277
|
}
|
|
9253
9278
|
});
|
|
9254
9279
|
};
|
|
9280
|
+
const clearSelectStart = () => {
|
|
9281
|
+
document.removeEventListener("selectstart", sortable);
|
|
9282
|
+
};
|
|
9255
9283
|
return {
|
|
9256
9284
|
initTableDrag,
|
|
9285
|
+
clearSelectStart,
|
|
9257
9286
|
destroyTableDrag() {
|
|
9258
9287
|
sortable && sortable.destroy();
|
|
9259
9288
|
sortable = null;
|
|
@@ -9603,7 +9632,7 @@ const _sfc_main$n = defineComponent({
|
|
|
9603
9632
|
tableManager.updateColumnToolsVisible(false);
|
|
9604
9633
|
};
|
|
9605
9634
|
const scrollLifecycle = useListenScroll(tableManager);
|
|
9606
|
-
const { initTableDrag, destroyTableDrag } = useColumnDrag();
|
|
9635
|
+
const { initTableDrag, destroyTableDrag, clearSelectStart } = useColumnDrag();
|
|
9607
9636
|
onMounted(() => {
|
|
9608
9637
|
tableManager.updateTableRef(tableRef.value);
|
|
9609
9638
|
scrollLifecycle.onMounted();
|
|
@@ -9631,6 +9660,7 @@ const _sfc_main$n = defineComponent({
|
|
|
9631
9660
|
}, 2e3);
|
|
9632
9661
|
});
|
|
9633
9662
|
const handleTableHeaderDragEnd = (newWidth, oldWidth, column, event) => {
|
|
9663
|
+
clearSelectStart();
|
|
9634
9664
|
if (newWidth === oldWidth) {
|
|
9635
9665
|
return false;
|
|
9636
9666
|
}
|
|
@@ -14898,7 +14928,7 @@ const defineEditableTable = function(config) {
|
|
|
14898
14928
|
};
|
|
14899
14929
|
var iconfont = "";
|
|
14900
14930
|
const name = "@juzhenfe/page-model";
|
|
14901
|
-
const version = "3.18.
|
|
14931
|
+
const version = "3.18.3";
|
|
14902
14932
|
const types = "dist/main.d.ts";
|
|
14903
14933
|
const main = "dist/index.umd.js";
|
|
14904
14934
|
const keywords = [
|