vxe-table 4.13.13 → 4.13.15

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.
@@ -9,7 +9,7 @@ import TableHeaderComponent from './header';
9
9
  import TableFooterComponent from './footer';
10
10
  import tableProps from './props';
11
11
  import tableEmits from './emits';
12
- import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId } from './util';
12
+ import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCellHeight } from './util';
13
13
  import { getSlotVNs } from '../../ui/src/vn';
14
14
  import { warnLog, errLog } from '../../ui/src/log';
15
15
  import TableCustomPanelComponent from '../module/custom/panel';
@@ -509,16 +509,14 @@ export default defineComponent({
509
509
  });
510
510
  const computeHeaderCellOpts = computed(() => {
511
511
  const headerCellOpts = Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig);
512
- if (headerCellOpts.height) {
513
- headerCellOpts.height = XEUtils.toNumber(headerCellOpts.height);
514
- }
512
+ const cellOpts = computeCellOpts.value;
513
+ headerCellOpts.height = XEUtils.toNumber(getCellHeight(headerCellOpts.height || cellOpts.height));
515
514
  return headerCellOpts;
516
515
  });
517
516
  const computeFooterCellOpts = computed(() => {
518
517
  const footerCellOpts = Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig);
519
- if (footerCellOpts.height) {
520
- footerCellOpts.height = XEUtils.toNumber(footerCellOpts.height);
521
- }
518
+ const cellOpts = computeCellOpts.value;
519
+ footerCellOpts.height = XEUtils.toNumber(getCellHeight(footerCellOpts.height || cellOpts.height));
522
520
  return footerCellOpts;
523
521
  });
524
522
  const computeRowOpts = computed(() => {
@@ -2166,7 +2164,7 @@ export default defineComponent({
2166
2164
  if (tableElem) {
2167
2165
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
2168
2166
  // 兼容性处理
2169
- tableElem.style.paddingRight = osbWidth && fixedType && (browseObj['-moz'] || browseObj.safari) ? `${osbWidth}px` : '';
2167
+ tableElem.style.paddingRight = osbWidth && fixedType && (browseObj.firefox || browseObj.safari) ? `${osbWidth}px` : '';
2170
2168
  }
2171
2169
  const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);
2172
2170
  if (emptyBlockElem) {
@@ -3589,40 +3587,40 @@ export default defineComponent({
3589
3587
  return -1;
3590
3588
  };
3591
3589
  };
3592
- // const lazyScrollXData = () => {
3593
- // const { lxTimeout, lxRunTime, scrollXStore } = internalData
3594
- // const { visibleSize } = scrollXStore
3595
- // const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)))
3596
- // if (lxTimeout) {
3597
- // clearTimeout(lxTimeout)
3598
- // }
3599
- // if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
3600
- // internalData.lxRunTime = Date.now()
3601
- // loadScrollXData()
3602
- // }
3603
- // internalData.lxTimeout = setTimeout(() => {
3604
- // internalData.lxTimeout = undefined
3605
- // internalData.lxRunTime = undefined
3606
- // loadScrollXData()
3607
- // }, fpsTime)
3608
- // }
3609
- // const lazyScrollYData = () => {
3610
- // const { lyTimeout, lyRunTime, scrollYStore } = internalData
3611
- // const { visibleSize } = scrollYStore
3612
- // const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)))
3613
- // if (lyTimeout) {
3614
- // clearTimeout(lyTimeout)
3615
- // }
3616
- // if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
3617
- // internalData.lyRunTime = Date.now()
3618
- // loadScrollYData()
3619
- // }
3620
- // internalData.lyTimeout = setTimeout(() => {
3621
- // internalData.lyTimeout = undefined
3622
- // internalData.lyRunTime = undefined
3623
- // loadScrollYData()
3624
- // }, fpsTime)
3625
- // }
3590
+ const lazyScrollXData = () => {
3591
+ const { lxTimeout, lxRunTime, scrollXStore } = internalData;
3592
+ const { visibleSize } = scrollXStore;
3593
+ const fpsTime = visibleSize > 26 ? 26 : (visibleSize > 16 ? 14 : 6);
3594
+ if (lxTimeout) {
3595
+ clearTimeout(lxTimeout);
3596
+ }
3597
+ if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
3598
+ internalData.lxRunTime = Date.now();
3599
+ loadScrollXData();
3600
+ }
3601
+ internalData.lxTimeout = setTimeout(() => {
3602
+ internalData.lxTimeout = undefined;
3603
+ internalData.lxRunTime = undefined;
3604
+ loadScrollXData();
3605
+ }, fpsTime);
3606
+ };
3607
+ const lazyScrollYData = () => {
3608
+ const { lyTimeout, lyRunTime, scrollYStore } = internalData;
3609
+ const { visibleSize } = scrollYStore;
3610
+ const fpsTime = visibleSize > 30 ? 32 : (visibleSize > 20 ? 18 : 8);
3611
+ if (lyTimeout) {
3612
+ clearTimeout(lyTimeout);
3613
+ }
3614
+ if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
3615
+ internalData.lyRunTime = Date.now();
3616
+ loadScrollYData();
3617
+ }
3618
+ internalData.lyTimeout = setTimeout(() => {
3619
+ internalData.lyTimeout = undefined;
3620
+ internalData.lyRunTime = undefined;
3621
+ loadScrollYData();
3622
+ }, fpsTime);
3623
+ };
3626
3624
  const checkLastSyncScroll = (isRollX, isRollY) => {
3627
3625
  const { scrollXLoad, scrollYLoad } = reactData;
3628
3626
  const { lcsTimeout } = internalData;
@@ -9517,23 +9515,25 @@ export default defineComponent({
9517
9515
  * 横向 X 可视渲染事件处理
9518
9516
  */
9519
9517
  triggerScrollXEvent() {
9520
- // const virtualXOpts = computeVirtualXOpts.value
9521
- // if (virtualXOpts.immediate) {
9522
- loadScrollXData();
9523
- // } else {
9524
- // lazyScrollXData()
9525
- // }
9518
+ const virtualXOpts = computeVirtualXOpts.value;
9519
+ if (virtualXOpts.immediate) {
9520
+ loadScrollXData();
9521
+ }
9522
+ else {
9523
+ lazyScrollXData();
9524
+ }
9526
9525
  },
9527
9526
  /**
9528
9527
  * 纵向 Y 可视渲染事件处理
9529
9528
  */
9530
9529
  triggerScrollYEvent() {
9531
- // const virtualYOpts = computeVirtualYOpts.value
9532
- // if (virtualYOpts.immediate) {
9533
- loadScrollYData();
9534
- // } else {
9535
- // lazyScrollYData()
9536
- // }
9530
+ const virtualYOpts = computeVirtualYOpts.value;
9531
+ if (virtualYOpts.immediate) {
9532
+ loadScrollYData();
9533
+ }
9534
+ else {
9535
+ lazyScrollYData();
9536
+ }
9537
9537
  },
9538
9538
  triggerBodyScrollEvent(evnt, fixedType) {
9539
9539
  const { scrollYLoad, scrollXLoad } = reactData;
@@ -9743,9 +9743,8 @@ export default defineComponent({
9743
9743
  if (isRollX) {
9744
9744
  evnt.preventDefault();
9745
9745
  internalData.inWheelScroll = true;
9746
- wheelScrollLeftTo(scrollLeft, (offsetLeft) => {
9747
- internalData.inWheelScroll = true;
9748
- const currLeftNum = offsetLeft;
9746
+ if (browseObj.firefox || browseObj.safari) {
9747
+ const currLeftNum = scrollLeft;
9749
9748
  setScrollLeft(xHandleEl, currLeftNum);
9750
9749
  setScrollLeft(bodyScrollElem, currLeftNum);
9751
9750
  setScrollLeft(headerScrollElem, currLeftNum);
@@ -9757,14 +9756,30 @@ export default defineComponent({
9757
9756
  type: 'table',
9758
9757
  fixed: ''
9759
9758
  });
9760
- });
9759
+ }
9760
+ else {
9761
+ wheelScrollLeftTo(scrollLeft, (offsetLeft) => {
9762
+ internalData.inWheelScroll = true;
9763
+ const currLeftNum = offsetLeft;
9764
+ setScrollLeft(xHandleEl, currLeftNum);
9765
+ setScrollLeft(bodyScrollElem, currLeftNum);
9766
+ setScrollLeft(headerScrollElem, currLeftNum);
9767
+ setScrollLeft(footerScrollElem, currLeftNum);
9768
+ if (scrollXLoad) {
9769
+ $xeTable.triggerScrollXEvent(evnt);
9770
+ }
9771
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, bodyScrollElem.scrollTop, currLeftNum, {
9772
+ type: 'table',
9773
+ fixed: ''
9774
+ });
9775
+ });
9776
+ }
9761
9777
  }
9762
9778
  if (isRollY) {
9763
9779
  evnt.preventDefault();
9764
9780
  internalData.inWheelScroll = true;
9765
- wheelScrollTopTo(scrollTop - currScrollTop, (offsetTop) => {
9766
- internalData.inWheelScroll = true;
9767
- const currTopNum = bodyScrollElem.scrollTop + offsetTop;
9781
+ if (browseObj.firefox || browseObj.safari) {
9782
+ const currTopNum = scrollTop;
9768
9783
  setScrollTop(yHandleEl, currTopNum);
9769
9784
  setScrollTop(bodyScrollElem, currTopNum);
9770
9785
  setScrollTop(leftScrollElem, currTopNum);
@@ -9777,7 +9792,25 @@ export default defineComponent({
9777
9792
  type: 'table',
9778
9793
  fixed: ''
9779
9794
  });
9780
- });
9795
+ }
9796
+ else {
9797
+ wheelScrollTopTo(scrollTop - currScrollTop, (offsetTop) => {
9798
+ internalData.inWheelScroll = true;
9799
+ const currTopNum = bodyScrollElem.scrollTop + offsetTop;
9800
+ setScrollTop(yHandleEl, currTopNum);
9801
+ setScrollTop(bodyScrollElem, currTopNum);
9802
+ setScrollTop(leftScrollElem, currTopNum);
9803
+ setScrollTop(rightScrollElem, currTopNum);
9804
+ setScrollTop(rowExpandEl, currTopNum);
9805
+ if (scrollYLoad) {
9806
+ $xeTable.triggerScrollYEvent(evnt);
9807
+ }
9808
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, bodyScrollElem.scrollLeft, {
9809
+ type: 'table',
9810
+ fixed: ''
9811
+ });
9812
+ });
9813
+ }
9781
9814
  }
9782
9815
  },
9783
9816
  triggerVirtualScrollXEvent(evnt) {
@@ -9913,20 +9946,18 @@ export default defineComponent({
9913
9946
  ySpaceWidth = maxXWidth;
9914
9947
  isScrollXBig = true;
9915
9948
  }
9916
- let marginLeft = '';
9917
- if (scrollXLoad && overflowX) {
9918
- marginLeft = `${xSpaceLeft}px`;
9949
+ if (!(scrollXLoad && overflowX)) {
9950
+ xSpaceLeft = 0;
9919
9951
  }
9920
9952
  if (headerTableElem) {
9921
- headerTableElem.style.marginLeft = headerTableElem.getAttribute('xvm') ? marginLeft : '';
9953
+ headerTableElem.style.transform = headerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '';
9922
9954
  }
9923
9955
  if (bodyTableElem) {
9924
- bodyTableElem.style.marginLeft = marginLeft;
9956
+ bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`;
9925
9957
  }
9926
9958
  if (footerTableElem) {
9927
- footerTableElem.style.marginLeft = footerTableElem.getAttribute('xvm') ? marginLeft : '';
9959
+ footerTableElem.style.transform = footerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '';
9928
9960
  }
9929
- reactData.isScrollXBig = isScrollXBig;
9930
9961
  const containerList = ['main'];
9931
9962
  containerList.forEach(name => {
9932
9963
  const layoutList = ['header', 'body', 'footer'];
@@ -9937,6 +9968,9 @@ export default defineComponent({
9937
9968
  }
9938
9969
  });
9939
9970
  });
9971
+ reactData.scrollXLeft = xSpaceLeft;
9972
+ reactData.scrollXWidth = ySpaceWidth;
9973
+ reactData.isScrollXBig = isScrollXBig;
9940
9974
  const scrollXSpaceEl = refScrollXSpaceElem.value;
9941
9975
  if (scrollXSpaceEl) {
9942
9976
  scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
@@ -9952,7 +9986,7 @@ export default defineComponent({
9952
9986
  },
9953
9987
  // 更新纵向 Y 可视渲染上下剩余空间大小
9954
9988
  updateScrollYSpace() {
9955
- const { isAllOverflow, scrollYLoad, expandColumn } = reactData;
9989
+ const { isAllOverflow, overflowY, scrollYLoad, expandColumn } = reactData;
9956
9990
  const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData, rowExpandedMaps } = internalData;
9957
9991
  const { startIndex } = scrollYStore;
9958
9992
  const mouseOpts = computeMouseOpts.value;
@@ -9962,6 +9996,8 @@ export default defineComponent({
9962
9996
  const defaultRowHeight = computeDefaultRowHeight.value;
9963
9997
  const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
9964
9998
  const bodyTableElem = getRefElem(elemStore['main-body-table']);
9999
+ const leftBodyTableElem = getRefElem(elemStore['left-body-table']);
10000
+ const rightbodyTableElem = getRefElem(elemStore['right-body-table']);
9965
10001
  const containerList = ['main', 'left', 'right'];
9966
10002
  let ySpaceTop = 0;
9967
10003
  let scrollYHeight = 0;
@@ -10015,12 +10051,20 @@ export default defineComponent({
10015
10051
  }
10016
10052
  ySpaceHeight = maxYHeight;
10017
10053
  }
10054
+ if (!(scrollYLoad && overflowY)) {
10055
+ scrollYTop = 0;
10056
+ }
10057
+ if (leftBodyTableElem) {
10058
+ leftBodyTableElem.style.transform = `translate(0px, ${scrollYTop}px)`;
10059
+ }
10060
+ if (bodyTableElem) {
10061
+ bodyTableElem.style.transform = `translate(${reactData.scrollXLeft || 0}px, ${scrollYTop}px)`;
10062
+ }
10063
+ if (rightbodyTableElem) {
10064
+ rightbodyTableElem.style.transform = `translate(0px, ${scrollYTop}px)`;
10065
+ }
10018
10066
  containerList.forEach(name => {
10019
10067
  const layoutList = ['header', 'body', 'footer'];
10020
- const tableElem = getRefElem(elemStore[`${name}-body-table`]);
10021
- if (tableElem) {
10022
- tableElem.style.marginTop = scrollYTop ? `${scrollYTop}px` : '';
10023
- }
10024
10068
  layoutList.forEach(layout => {
10025
10069
  const ySpaceElem = getRefElem(elemStore[`${name}-${layout}-ySpace`]);
10026
10070
  if (ySpaceElem) {
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "4.13.13";
3
+ export const version = "4.13.15";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/dom.js CHANGED
@@ -45,7 +45,7 @@ export function isScale(val) {
45
45
  return val && /^\d+%$/.test(val);
46
46
  }
47
47
  export function hasClass(elem, cls) {
48
- return elem && elem.className && elem.className.match && elem.className.match(getClsRE(cls));
48
+ return !!(elem && elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
49
49
  }
50
50
  export function removeClass(elem, cls) {
51
51
  if (elem && hasClass(elem, cls)) {
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"4.13.13"}`;
3
+ const version = `table v${"4.13.15"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);