vxe-table 3.12.10-beta.9 → 3.12.11

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.
Files changed (178) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/ar-EG.js +2 -1
  4. package/es/locale/lang/de-DE.js +2 -1
  5. package/es/locale/lang/en-US.js +4 -3
  6. package/es/locale/lang/es-ES.js +2 -1
  7. package/es/locale/lang/fr-FR.js +2 -1
  8. package/es/locale/lang/hu-HU.js +2 -1
  9. package/es/locale/lang/hy-AM.js +2 -1
  10. package/es/locale/lang/it-IT.js +2 -1
  11. package/es/locale/lang/ja-JP.js +2 -1
  12. package/es/locale/lang/ko-KR.js +2 -1
  13. package/es/locale/lang/nb-NO.js +2 -1
  14. package/es/locale/lang/pt-BR.js +2 -1
  15. package/es/locale/lang/ru-RU.js +4 -3
  16. package/es/locale/lang/th-TH.js +2 -1
  17. package/es/locale/lang/ug-CN.js +2 -1
  18. package/es/locale/lang/uk-UA.js +518 -517
  19. package/es/locale/lang/vi-VN.js +2 -1
  20. package/es/locale/lang/zh-CHT.js +2 -1
  21. package/es/locale/lang/zh-CN.js +2 -1
  22. package/es/style.css +1 -1
  23. package/es/style.min.css +1 -1
  24. package/es/table/module/edit/mixin.js +7 -7
  25. package/es/table/module/export/mixin.js +105 -69
  26. package/es/table/module/keyboard/mixin.js +68 -25
  27. package/es/table/module/menu/mixin.js +3 -1
  28. package/es/table/src/body.js +114 -87
  29. package/es/table/src/cell.js +43 -57
  30. package/es/table/src/column.js +43 -8
  31. package/es/table/src/columnInfo.js +3 -0
  32. package/es/table/src/footer.js +47 -6
  33. package/es/table/src/header.js +67 -165
  34. package/es/table/src/methods.js +962 -480
  35. package/es/table/src/props.js +14 -4
  36. package/es/table/src/table.js +114 -33
  37. package/es/table/src/util.js +74 -58
  38. package/es/table/style.css +246 -191
  39. package/es/table/style.min.css +1 -1
  40. package/es/ui/index.js +20 -6
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +246 -191
  43. package/es/vxe-table/style.min.css +1 -1
  44. package/lib/index.css +1 -1
  45. package/lib/index.min.css +1 -1
  46. package/lib/index.umd.js +1725 -1022
  47. package/lib/index.umd.min.js +1 -1
  48. package/lib/locale/lang/ar-EG.js +2 -1
  49. package/lib/locale/lang/ar-EG.min.js +1 -1
  50. package/lib/locale/lang/de-DE.js +2 -1
  51. package/lib/locale/lang/de-DE.min.js +1 -1
  52. package/lib/locale/lang/en-US.js +4 -3
  53. package/lib/locale/lang/en-US.min.js +1 -1
  54. package/lib/locale/lang/en-US.umd.js +4 -3
  55. package/lib/locale/lang/es-ES.js +2 -1
  56. package/lib/locale/lang/es-ES.min.js +1 -1
  57. package/lib/locale/lang/es-ES.umd.js +2 -1
  58. package/lib/locale/lang/fr-FR.js +2 -1
  59. package/lib/locale/lang/fr-FR.min.js +1 -1
  60. package/lib/locale/lang/hu-HU.js +2 -1
  61. package/lib/locale/lang/hu-HU.min.js +1 -1
  62. package/lib/locale/lang/hu-HU.umd.js +2 -1
  63. package/lib/locale/lang/hy-AM.js +2 -1
  64. package/lib/locale/lang/hy-AM.min.js +1 -1
  65. package/lib/locale/lang/it-IT.js +2 -1
  66. package/lib/locale/lang/it-IT.min.js +1 -1
  67. package/lib/locale/lang/ja-JP.js +2 -1
  68. package/lib/locale/lang/ja-JP.min.js +1 -1
  69. package/lib/locale/lang/ja-JP.umd.js +2 -1
  70. package/lib/locale/lang/ko-KR.js +2 -1
  71. package/lib/locale/lang/ko-KR.min.js +1 -1
  72. package/lib/locale/lang/ko-KR.umd.js +2 -1
  73. package/lib/locale/lang/nb-NO.js +2 -1
  74. package/lib/locale/lang/nb-NO.min.js +1 -1
  75. package/lib/locale/lang/pt-BR.js +2 -1
  76. package/lib/locale/lang/pt-BR.min.js +1 -1
  77. package/lib/locale/lang/pt-BR.umd.js +2 -1
  78. package/lib/locale/lang/ru-RU.js +4 -3
  79. package/lib/locale/lang/ru-RU.min.js +1 -1
  80. package/lib/locale/lang/ru-RU.umd.js +4 -3
  81. package/lib/locale/lang/th-TH.js +2 -1
  82. package/lib/locale/lang/th-TH.min.js +1 -1
  83. package/lib/locale/lang/ug-CN.js +2 -1
  84. package/lib/locale/lang/ug-CN.min.js +1 -1
  85. package/lib/locale/lang/uk-UA.js +518 -517
  86. package/lib/locale/lang/uk-UA.min.js +1 -1
  87. package/lib/locale/lang/uk-UA.umd.js +518 -517
  88. package/lib/locale/lang/vi-VN.js +2 -1
  89. package/lib/locale/lang/vi-VN.min.js +1 -1
  90. package/lib/locale/lang/zh-CHT.js +2 -1
  91. package/lib/locale/lang/zh-CHT.min.js +1 -1
  92. package/lib/locale/lang/zh-CHT.umd.js +2 -1
  93. package/lib/locale/lang/zh-CN.js +2 -1
  94. package/lib/locale/lang/zh-CN.min.js +1 -1
  95. package/lib/locale/lang/zh-CN.umd.js +2 -1
  96. package/lib/style.css +1 -1
  97. package/lib/style.min.css +1 -1
  98. package/lib/table/module/edit/mixin.js +7 -2
  99. package/lib/table/module/edit/mixin.min.js +1 -1
  100. package/lib/table/module/export/mixin.js +105 -64
  101. package/lib/table/module/export/mixin.min.js +1 -1
  102. package/lib/table/module/keyboard/mixin.js +73 -27
  103. package/lib/table/module/keyboard/mixin.min.js +1 -1
  104. package/lib/table/module/menu/mixin.js +3 -1
  105. package/lib/table/src/body.js +114 -80
  106. package/lib/table/src/body.min.js +1 -1
  107. package/lib/table/src/cell.js +32 -42
  108. package/lib/table/src/cell.min.js +1 -1
  109. package/lib/table/src/column.js +12 -0
  110. package/lib/table/src/column.min.js +1 -1
  111. package/lib/table/src/columnInfo.js +3 -0
  112. package/lib/table/src/columnInfo.min.js +1 -1
  113. package/lib/table/src/footer.js +43 -4
  114. package/lib/table/src/footer.min.js +1 -1
  115. package/lib/table/src/header.js +49 -172
  116. package/lib/table/src/header.min.js +1 -1
  117. package/lib/table/src/methods.js +1072 -538
  118. package/lib/table/src/methods.min.js +1 -1
  119. package/lib/table/src/props.js +14 -4
  120. package/lib/table/src/props.min.js +1 -1
  121. package/lib/table/src/table.js +113 -36
  122. package/lib/table/src/table.min.js +1 -1
  123. package/lib/table/src/util.js +88 -71
  124. package/lib/table/src/util.min.js +1 -1
  125. package/lib/table/style/style.css +246 -191
  126. package/lib/table/style/style.min.css +1 -1
  127. package/lib/ui/index.js +20 -6
  128. package/lib/ui/index.min.js +1 -1
  129. package/lib/ui/src/log.js +1 -1
  130. package/lib/ui/src/log.min.js +1 -1
  131. package/lib/vxe-table/style/style.css +246 -191
  132. package/lib/vxe-table/style/style.min.css +1 -1
  133. package/package.json +2 -2
  134. package/packages/locale/lang/ar-EG.ts +2 -1
  135. package/packages/locale/lang/de-DE.ts +2 -1
  136. package/packages/locale/lang/en-US.ts +4 -3
  137. package/packages/locale/lang/es-ES.ts +2 -1
  138. package/packages/locale/lang/fr-FR.ts +2 -1
  139. package/packages/locale/lang/hu-HU.ts +2 -1
  140. package/packages/locale/lang/hy-AM.ts +2 -1
  141. package/packages/locale/lang/it-IT.ts +2 -1
  142. package/packages/locale/lang/ja-JP.ts +2 -1
  143. package/packages/locale/lang/ko-KR.ts +2 -1
  144. package/packages/locale/lang/nb-NO.ts +2 -1
  145. package/packages/locale/lang/pt-BR.ts +2 -1
  146. package/packages/locale/lang/ru-RU.ts +4 -3
  147. package/packages/locale/lang/th-TH.ts +2 -1
  148. package/packages/locale/lang/ug-CN.ts +2 -1
  149. package/packages/locale/lang/uk-UA.ts +518 -517
  150. package/packages/locale/lang/vi-VN.ts +2 -1
  151. package/packages/locale/lang/zh-CHT.ts +2 -1
  152. package/packages/locale/lang/zh-CN.ts +2 -1
  153. package/packages/table/module/edit/mixin.ts +7 -7
  154. package/packages/table/module/export/mixin.ts +138 -80
  155. package/packages/table/module/keyboard/mixin.ts +65 -24
  156. package/packages/table/module/menu/mixin.ts +4 -1
  157. package/packages/table/src/body.ts +126 -90
  158. package/packages/table/src/cell.ts +45 -67
  159. package/packages/table/src/column.ts +48 -10
  160. package/packages/table/src/columnInfo.ts +3 -0
  161. package/packages/table/src/footer.ts +50 -7
  162. package/packages/table/src/header.ts +67 -166
  163. package/packages/table/src/methods.ts +1007 -492
  164. package/packages/table/src/props.ts +16 -6
  165. package/packages/table/src/table.ts +124 -33
  166. package/packages/table/src/util.ts +83 -63
  167. package/packages/ui/index.ts +19 -5
  168. package/styles/components/table.scss +313 -274
  169. package/styles/theme/base.scss +4 -6
  170. package/styles/theme/dark.scss +1 -0
  171. package/styles/theme/light.scss +1 -0
  172. package/styles/variable.scss +1 -0
  173. /package/es/{iconfont.1736854649055.ttf → iconfont.1739008141486.ttf} +0 -0
  174. /package/es/{iconfont.1736854649055.woff → iconfont.1739008141486.woff} +0 -0
  175. /package/es/{iconfont.1736854649055.woff2 → iconfont.1739008141486.woff2} +0 -0
  176. /package/lib/{iconfont.1736854649055.ttf → iconfont.1739008141486.ttf} +0 -0
  177. /package/lib/{iconfont.1736854649055.woff → iconfont.1739008141486.woff} +0 -0
  178. /package/lib/{iconfont.1736854649055.woff2 → iconfont.1739008141486.woff2} +0 -0
@@ -392,6 +392,7 @@ function updateAfterListIndex($xeTable) {
392
392
  parent: null,
393
393
  level: 0,
394
394
  height: 0,
395
+ resizeHeight: 0,
395
396
  oTop: 0
396
397
  };
397
398
  fullAllDataRowIdData[rowid] = rest;
@@ -443,6 +444,7 @@ function updateAfterDataIndex($xeTable) {
443
444
  parent: null,
444
445
  level: 0,
445
446
  height: 0,
447
+ resizeHeight: 0,
446
448
  oTop: 0
447
449
  };
448
450
  fullAllDataRowIdData[rowid] = rest;
@@ -506,7 +508,6 @@ function updateStyle($xeTable) {
506
508
  const internalData = $xeTable;
507
509
  const {
508
510
  border,
509
- showOverflow: allColumnOverflow,
510
511
  showHeaderOverflow: allColumnHeaderOverflow,
511
512
  showFooterOverflow: allColumnFooterOverflow,
512
513
  mouseConfig,
@@ -519,7 +520,9 @@ function updateStyle($xeTable) {
519
520
  tableColumn,
520
521
  scrollXLoad,
521
522
  scrollYLoad,
523
+ overflowX,
522
524
  scrollbarWidth,
525
+ overflowY,
523
526
  scrollbarHeight,
524
527
  columnStore,
525
528
  editStore,
@@ -543,6 +546,8 @@ function updateStyle($xeTable) {
543
546
  return;
544
547
  }
545
548
  const containerList = ['main', 'left', 'right'];
549
+ const osbWidth = overflowY ? scrollbarWidth : 0;
550
+ const osbHeight = overflowX ? scrollbarHeight : 0;
546
551
  const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
547
552
  const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
548
553
  const mouseOpts = $xeTable.computeMouseOpts;
@@ -550,16 +555,16 @@ function updateStyle($xeTable) {
550
555
  const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
551
556
  if (emptyPlaceholderElem) {
552
557
  emptyPlaceholderElem.style.top = `${headerHeight}px`;
553
- emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : '';
558
+ emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
554
559
  }
555
560
  let bodyHeight = 0;
556
561
  let bodyMaxHeight = 0;
557
- const bodyMinHeight = customMinHeight - headerHeight - footerHeight - scrollbarHeight;
562
+ const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
558
563
  if (customMaxHeight) {
559
- bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - scrollbarHeight);
564
+ bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
560
565
  }
561
566
  if (customHeight) {
562
- bodyHeight = customHeight - headerHeight - footerHeight - scrollbarHeight;
567
+ bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
563
568
  }
564
569
  if (!bodyHeight) {
565
570
  if (bodyTableElem) {
@@ -577,27 +582,27 @@ function updateStyle($xeTable) {
577
582
  const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
578
583
  const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
579
584
  if (scrollXVirtualEl) {
580
- scrollXVirtualEl.style.height = `${scrollbarHeight}px`;
581
- scrollXVirtualEl.style.visibility = scrollbarHeight ? 'visible' : 'hidden';
585
+ scrollXVirtualEl.style.height = `${osbHeight}px`;
586
+ scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
582
587
  }
583
588
  const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
584
589
  if (xWrapperEl) {
585
- xWrapperEl.style.left = scrollbarXToTop ? `${scrollbarWidth}px` : '';
586
- xWrapperEl.style.width = `${el.clientWidth - scrollbarWidth}px`;
590
+ xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
591
+ xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
587
592
  }
588
593
  if (xLeftCornerEl) {
589
- xLeftCornerEl.style.width = scrollbarXToTop ? `${scrollbarWidth}px` : '';
590
- xLeftCornerEl.style.display = scrollbarXToTop ? scrollbarWidth && scrollbarHeight ? 'block' : '' : '';
594
+ xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
595
+ xLeftCornerEl.style.display = scrollbarXToTop ? osbWidth && osbHeight ? 'block' : '' : '';
591
596
  }
592
597
  if (xRightCornerEl) {
593
- xRightCornerEl.style.width = scrollbarXToTop ? '' : `${scrollbarWidth}px`;
594
- xRightCornerEl.style.display = scrollbarXToTop ? '' : scrollbarWidth && scrollbarHeight ? 'block' : '';
598
+ xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
599
+ xRightCornerEl.style.display = scrollbarXToTop ? '' : osbWidth && osbHeight ? 'block' : '';
595
600
  }
596
601
  const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
597
602
  if (scrollYVirtualEl) {
598
- scrollYVirtualEl.style.width = `${scrollbarWidth}px`;
603
+ scrollYVirtualEl.style.width = `${osbWidth}px`;
599
604
  scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
600
- scrollYVirtualEl.style.visibility = scrollbarWidth ? 'visible' : 'hidden';
605
+ scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden';
601
606
  }
602
607
  const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
603
608
  if (yTopCornerEl) {
@@ -716,14 +721,14 @@ function updateStyle($xeTable) {
716
721
  if (wrapperElem) {
717
722
  wrapperElem.style.top = `${headerHeight}px`;
718
723
  }
719
- fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + headerHeight + footerHeight + scrollbarHeight}px`;
724
+ fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + headerHeight + footerHeight + osbHeight}px`;
720
725
  fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
721
726
  }
722
727
  let tWidth = tableWidth;
723
728
  let renderColumnList = tableColumn;
724
729
  let isOptimizeMode = false;
725
730
  // 如果是使用优化模式
726
- if (scrollXLoad || scrollYLoad || allColumnOverflow && isAllOverflow) {
731
+ if (scrollXLoad || scrollYLoad || isAllOverflow) {
727
732
  if (expandColumn || spanMethod || footerSpanMethod) {
728
733
  // 如果不支持优化模式
729
734
  } else {
@@ -745,7 +750,7 @@ function updateStyle($xeTable) {
745
750
  if (tableElem) {
746
751
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
747
752
  // 兼容性处理
748
- tableElem.style.paddingRight = scrollbarWidth && fixedType && (_dom.browse['-moz'] || _dom.browse.safari) ? `${scrollbarWidth}px` : '';
753
+ tableElem.style.paddingRight = osbWidth && fixedType && (_dom.browse['-moz'] || _dom.browse.safari) ? `${osbWidth}px` : '';
749
754
  }
750
755
  const emptyBlockElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-emptyBlock`]);
751
756
  if (emptyBlockElem) {
@@ -780,7 +785,7 @@ function updateStyle($xeTable) {
780
785
  // 如果是固定列
781
786
  if (fixedWrapperElem) {
782
787
  if (wrapperElem) {
783
- wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - scrollbarHeight : tableHeight + headerHeight}px`;
788
+ wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`;
784
789
  }
785
790
  }
786
791
  }
@@ -807,7 +812,7 @@ function updateStyle($xeTable) {
807
812
  } else if (layout === 'footer') {
808
813
  cellOverflow = _xeUtils.default.isUndefined(showFooterOverflow) || _xeUtils.default.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
809
814
  } else {
810
- cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? allColumnOverflow : showOverflow;
815
+ cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? isAllOverflow : showOverflow;
811
816
  }
812
817
  const showEllipsis = cellOverflow === 'ellipsis';
813
818
  const showTitle = cellOverflow === 'title';
@@ -851,16 +856,16 @@ function updateStyle($xeTable) {
851
856
  return $xeTable.$nextTick();
852
857
  }
853
858
  function computeRowHeight($xeTable) {
854
- const props = $xeTable;
859
+ const reactData = $xeTable;
855
860
  const {
856
- showOverflow
857
- } = props;
861
+ isAllOverflow
862
+ } = reactData;
858
863
  const tableHeader = $xeTable.$refs.refTableHeader;
859
864
  const tableBody = $xeTable.$refs.refTableBody;
860
865
  const tableBodyElem = tableBody ? tableBody.$el : null;
861
866
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
862
867
  let rowHeight = 0;
863
- if (showOverflow) {
868
+ if (isAllOverflow) {
864
869
  if (tableBodyElem) {
865
870
  const tableHeaderElem = tableHeader ? tableHeader.$el : null;
866
871
  let firstTrElem;
@@ -881,40 +886,39 @@ function computeRowHeight($xeTable) {
881
886
  // 最低支持 18px 行高
882
887
  return Math.max(18, rowHeight);
883
888
  }
884
- function handleVirtualYVisible($xeTable) {
885
- const props = $xeTable;
889
+ function handleVirtualYVisible($xeTable, currScrollTop) {
886
890
  const reactData = $xeTable;
887
891
  const internalData = $xeTable;
888
892
  const {
889
- showOverflow
890
- } = props;
891
- const {
892
- rowHeight
893
+ isAllOverflow
893
894
  } = reactData;
894
895
  const {
895
896
  elemStore,
897
+ isResizeCellHeight,
896
898
  afterFullData,
897
899
  fullAllDataRowIdData
898
900
  } = internalData;
901
+ const rowOpts = $xeTable.computeRowOpts;
902
+ const cellOpts = $xeTable.computeCellOpts;
903
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
899
904
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
900
905
  if (bodyScrollElem) {
901
- const {
902
- scrollTop,
903
- clientHeight
904
- } = bodyScrollElem;
906
+ const clientHeight = bodyScrollElem.clientHeight;
907
+ const scrollTop = _xeUtils.default.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop;
905
908
  const endHeight = scrollTop + clientHeight;
906
909
  let toVisibleIndex = -1;
907
910
  let offsetTop = 0;
908
911
  let visibleSize = 0;
909
- if (showOverflow) {
910
- toVisibleIndex = Math.floor(scrollTop / rowHeight);
911
- visibleSize = Math.ceil(clientHeight / rowHeight) + 1;
912
+ const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
913
+ if (!isCustomCellHeight && isAllOverflow) {
914
+ toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
915
+ visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
912
916
  } else {
913
917
  for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
914
918
  const row = afterFullData[rIndex];
915
919
  const rowid = (0, _util.getRowid)($xeTable, row);
916
- const rowRest = fullAllDataRowIdData[rowid];
917
- offsetTop += rowRest ? rowRest.height || rowHeight : rowHeight;
920
+ const rowRest = fullAllDataRowIdData[rowid] || {};
921
+ offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
918
922
  if (toVisibleIndex === -1 && scrollTop < offsetTop) {
919
923
  toVisibleIndex = rIndex;
920
924
  }
@@ -1202,7 +1206,7 @@ function autoCellWidth($xeTable) {
1202
1206
  }
1203
1207
  const tableHeight = bodyElem.offsetHeight;
1204
1208
  const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
1205
- reactData.scrollbarWidth = overflowY ? Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth) : 0;
1209
+ reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
1206
1210
  reactData.overflowY = overflowY;
1207
1211
  internalData.tableWidth = tableWidth;
1208
1212
  internalData.tableHeight = tableHeight;
@@ -1211,7 +1215,7 @@ function autoCellWidth($xeTable) {
1211
1215
  const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
1212
1216
  const overflowX = tableWidth > bodyWidth;
1213
1217
  const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
1214
- reactData.scrollbarHeight = overflowX ? Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight) : 0;
1218
+ reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
1215
1219
  internalData.headerHeight = headerHeight;
1216
1220
  internalData.footerHeight = footerHeight;
1217
1221
  reactData.overflowX = overflowX;
@@ -1221,68 +1225,43 @@ function autoCellWidth($xeTable) {
1221
1225
  $xeTable.checkScrolling();
1222
1226
  }
1223
1227
  }
1224
- // const updateCellOffset = ($xeTable: VxeTableConstructor) => {
1225
- // const internalData = $xeTable as unknown as TableInternalData
1226
- // const { chTimeout, chRunTime } = internalData
1227
- // if (chTimeout) {
1228
- // clearTimeout(chTimeout)
1229
- // }
1230
- // if (!chRunTime || chRunTime + 10 < Date.now()) {
1231
- // internalData.chRunTime = Date.now()
1232
- // }
1233
- // internalData.chTimeout = setTimeout(() => {
1234
- // internalData.chRunTime = undefined
1235
- // internalData.chTimeout = undefined
1236
- // }, 80)
1237
- // }
1228
+ const calcCellAutoHeight = (rowRest, wrapperEl) => {
1229
+ const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
1230
+ let colHeight = rowRest.height;
1231
+ for (let i = 0; i < cellElemList.length; i++) {
1232
+ const cellElem = cellElemList[i];
1233
+ const tdEl = cellElem.parentElement;
1234
+ const topBottomPadding = Math.ceil(_xeUtils.default.toNumber(tdEl.style.paddingTop) + _xeUtils.default.toNumber(tdEl.style.paddingBottom));
1235
+ const cellHeight = cellElem ? cellElem.clientHeight : 0;
1236
+ colHeight = Math.max(colHeight - topBottomPadding, Math.ceil(cellHeight));
1237
+ }
1238
+ return colHeight;
1239
+ };
1238
1240
  const calcCellHeight = $xeTable => {
1239
- const props = $xeTable;
1240
1241
  const reactData = $xeTable;
1241
1242
  const internalData = $xeTable;
1242
- const {
1243
- showOverflow
1244
- } = props;
1245
1243
  const {
1246
1244
  tableData,
1245
+ isAllOverflow,
1246
+ scrollYLoad,
1247
1247
  scrollXLoad
1248
1248
  } = reactData;
1249
1249
  const {
1250
1250
  fullAllDataRowIdData
1251
1251
  } = internalData;
1252
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
1252
1253
  const el = $xeTable.$refs.refElem;
1253
- if (!showOverflow && el) {
1254
- let paddingTop = 0;
1255
- let paddingBottom = 0;
1256
- let calcPadding = false;
1254
+ if (!isAllOverflow && scrollYLoad && el) {
1257
1255
  tableData.forEach(row => {
1258
1256
  const rowid = (0, _util.getRowid)($xeTable, row);
1259
1257
  const rowRest = fullAllDataRowIdData[rowid];
1260
- const cellList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]>.vxe-body--column>.vxe-cell>.vxe-cell--auto-wrapper`);
1261
- if (rowRest && cellList.length) {
1262
- let height = 0;
1263
- for (let i = 0; i < cellList.length; i++) {
1264
- const cellElem = cellList[i];
1265
- const tdEl = cellElem.parentElement;
1266
- if (!tdEl || !tdEl.clientWidth) {
1267
- break;
1268
- }
1269
- if (!calcPadding) {
1270
- paddingTop = _xeUtils.default.toNumber(getComputedStyle(tdEl).paddingTop);
1271
- paddingBottom = _xeUtils.default.toNumber(getComputedStyle(tdEl).paddingBottom);
1272
- calcPadding = true;
1273
- }
1274
- let cellHeight = paddingTop + paddingBottom;
1275
- if (cellElem) {
1276
- cellHeight += cellElem.clientHeight;
1277
- }
1278
- height = Math.max(height, cellHeight);
1279
- }
1280
- rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
1258
+ if (rowRest) {
1259
+ const height = calcCellAutoHeight(rowRest, el);
1260
+ rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, height) : height);
1281
1261
  }
1282
1262
  });
1283
- reactData.isCalcCellHeight++;
1263
+ reactData.calcCellHeightFlag++;
1284
1264
  }
1285
- // updateCellOffset()
1286
1265
  };
1287
1266
  function getOrderField(_vm, column) {
1288
1267
  const {
@@ -1309,6 +1288,18 @@ function getOrderField(_vm, column) {
1309
1288
  return cellValue;
1310
1289
  };
1311
1290
  }
1291
+ function handleTargetEnterEvent($xeTable, isClear) {
1292
+ const internalData = $xeTable;
1293
+ const $tooltip = $xeTable.$refs.refTooltip;
1294
+ clearTimeout(internalData.tooltipTimeout);
1295
+ if (isClear) {
1296
+ $xeTable.closeTooltip();
1297
+ } else {
1298
+ if ($tooltip && $tooltip.setActived) {
1299
+ $tooltip.setActived(true);
1300
+ }
1301
+ }
1302
+ }
1312
1303
  function clearDragStatus($xeTable) {
1313
1304
  const reactData = $xeTable;
1314
1305
  const {
@@ -1419,13 +1410,17 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1419
1410
  return;
1420
1411
  }
1421
1412
  const {
1413
+ overflowX,
1422
1414
  scrollbarWidth,
1415
+ overflowY,
1423
1416
  scrollbarHeight
1424
1417
  } = reactData;
1425
1418
  const {
1426
1419
  prevDragToChild
1427
1420
  } = internalData;
1428
1421
  const wrapperRect = el.getBoundingClientRect();
1422
+ const osbWidth = overflowY ? scrollbarWidth : 0;
1423
+ const osbHeight = overflowX ? scrollbarHeight : 0;
1429
1424
  const tableWidth = el.clientWidth;
1430
1425
  const tableHeight = el.clientHeight;
1431
1426
  if (trEl) {
@@ -1436,14 +1431,14 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1436
1431
  const trRect = trEl.getBoundingClientRect();
1437
1432
  let trHeight = trEl.clientHeight;
1438
1433
  const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
1439
- if (offsetTop + trHeight > tableHeight - scrollbarHeight) {
1440
- trHeight = tableHeight - offsetTop - scrollbarHeight;
1434
+ if (offsetTop + trHeight > tableHeight - osbHeight) {
1435
+ trHeight = tableHeight - offsetTop - osbHeight;
1441
1436
  }
1442
1437
  rdLineEl.style.display = 'block';
1443
- rdLineEl.style.left = `${scrollbarYToLeft ? scrollbarWidth : 0}px`;
1438
+ rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
1444
1439
  rdLineEl.style.top = `${offsetTop}px`;
1445
1440
  rdLineEl.style.height = `${trHeight}px`;
1446
- rdLineEl.style.width = `${tableWidth - scrollbarWidth}px`;
1441
+ rdLineEl.style.width = `${tableWidth - osbWidth}px`;
1447
1442
  rdLineEl.setAttribute('drag-pos', dragPos);
1448
1443
  rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
1449
1444
  } else {
@@ -1468,7 +1463,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1468
1463
  thWidth -= startX - offsetLeft;
1469
1464
  offsetLeft = startX;
1470
1465
  }
1471
- const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : scrollbarWidth);
1466
+ const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
1472
1467
  if (offsetLeft + thWidth > endX) {
1473
1468
  thWidth = endX - offsetLeft;
1474
1469
  }
@@ -1479,7 +1474,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1479
1474
  if (prevDragToChild) {
1480
1475
  cdLineEl.style.height = `${thRect.height}px`;
1481
1476
  } else {
1482
- cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : scrollbarHeight)}px`;
1477
+ cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
1483
1478
  }
1484
1479
  cdLineEl.setAttribute('drag-pos', dragPos);
1485
1480
  cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
@@ -1510,6 +1505,49 @@ function hideDropTip($xeTable) {
1510
1505
  cdLineEl.style.display = '';
1511
1506
  }
1512
1507
  }
1508
+ /**
1509
+ * 处理显示 tooltip
1510
+ * @param {Event} evnt 事件
1511
+ * @param {Row} row 行对象
1512
+ */
1513
+ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
1514
+ const reactData = $xeTable;
1515
+ if (!overflowElem) {
1516
+ return $xeTable.$nextTick();
1517
+ }
1518
+ params.cell = tdEl;
1519
+ const {
1520
+ tooltipStore
1521
+ } = reactData;
1522
+ const tooltipOpts = $xeTable.computeTooltipOpts;
1523
+ const {
1524
+ column,
1525
+ row
1526
+ } = params;
1527
+ const {
1528
+ showAll,
1529
+ contentMethod
1530
+ } = tooltipOpts;
1531
+ const customContent = contentMethod ? contentMethod(params) : null;
1532
+ const useCustom = contentMethod && !_xeUtils.default.eqNull(customContent);
1533
+ const content = useCustom ? customContent : _xeUtils.default.toString(column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
1534
+ const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
1535
+ if (content && (showAll || useCustom || isCellOverflow)) {
1536
+ Object.assign(tooltipStore, {
1537
+ row,
1538
+ column,
1539
+ visible: true,
1540
+ currOpts: {}
1541
+ });
1542
+ $xeTable.$nextTick(() => {
1543
+ const $tooltip = $xeTable.$refs.refTooltip;
1544
+ if ($tooltip && $tooltip.open) {
1545
+ $tooltip.open(isCellOverflow ? overflowElem : tipElem || overflowElem, (0, _utils.formatText)(content));
1546
+ }
1547
+ });
1548
+ }
1549
+ return $xeTable.$nextTick();
1550
+ }
1513
1551
  function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
1514
1552
  const internalData = $xeTable;
1515
1553
  const {
@@ -1841,11 +1879,10 @@ function handleColumn($xeTable, collectColumn) {
1841
1879
  internalData.collectColumn = collectColumn;
1842
1880
  const tableFullColumn = getColumnList(collectColumn);
1843
1881
  internalData.tableFullColumn = tableFullColumn;
1844
- reactData.isLoading = true;
1882
+ reactData.isColLoading = true;
1845
1883
  reactData.isDragColMove = false;
1846
1884
  initColumnSort($xeTable);
1847
1885
  return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
1848
- reactData.isLoading = false;
1849
1886
  cacheColumnMap($xeTable);
1850
1887
  parseColumns($xeTable, true).then(() => {
1851
1888
  if (reactData.scrollXLoad) {
@@ -1870,6 +1907,7 @@ function handleColumn($xeTable, collectColumn) {
1870
1907
  if ($xeTable.handleUpdateCustomColumn) {
1871
1908
  $xeTable.handleUpdateCustomColumn();
1872
1909
  }
1910
+ reactData.isColLoading = false;
1873
1911
  return $xeTable.recalculate();
1874
1912
  });
1875
1913
  });
@@ -1877,15 +1915,12 @@ function handleColumn($xeTable, collectColumn) {
1877
1915
  /**
1878
1916
  * 纵向 Y 可视渲染处理
1879
1917
  */
1880
- function loadScrollYData($xeTable) {
1881
- const props = $xeTable;
1918
+ function loadScrollYData($xeTable, scrollTop) {
1882
1919
  const reactData = $xeTable;
1883
1920
  const internalData = $xeTable;
1884
1921
  const {
1885
- showOverflow
1886
- } = props;
1887
- const {
1888
- mergeList
1922
+ mergeList,
1923
+ isAllOverflow
1889
1924
  } = reactData;
1890
1925
  const {
1891
1926
  scrollYStore
@@ -1896,11 +1931,11 @@ function loadScrollYData($xeTable) {
1896
1931
  endIndex,
1897
1932
  offsetSize
1898
1933
  } = scrollYStore;
1899
- const autoOffsetYSize = showOverflow ? offsetSize : offsetSize + 1;
1934
+ const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1;
1900
1935
  const {
1901
1936
  toVisibleIndex,
1902
1937
  visibleSize
1903
- } = handleVirtualYVisible($xeTable);
1938
+ } = handleVirtualYVisible($xeTable, scrollTop);
1904
1939
  const offsetItem = {
1905
1940
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
1906
1941
  endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
@@ -1920,6 +1955,54 @@ function loadScrollYData($xeTable) {
1920
1955
  }
1921
1956
  }
1922
1957
  }
1958
+ function lazyScrollXData($xeTable) {
1959
+ const internalData = $xeTable;
1960
+ const {
1961
+ lxTimeout,
1962
+ lxRunTime,
1963
+ scrollXStore
1964
+ } = internalData;
1965
+ const {
1966
+ visibleSize
1967
+ } = scrollXStore;
1968
+ const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)));
1969
+ if (lxTimeout) {
1970
+ clearTimeout(lxTimeout);
1971
+ }
1972
+ if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
1973
+ internalData.lxRunTime = Date.now();
1974
+ loadScrollXData($xeTable);
1975
+ }
1976
+ internalData.lxTimeout = setTimeout(() => {
1977
+ internalData.lxTimeout = undefined;
1978
+ internalData.lxRunTime = undefined;
1979
+ loadScrollXData($xeTable);
1980
+ }, fpsTime);
1981
+ }
1982
+ function lazyScrollYData($xeTable) {
1983
+ const internalData = $xeTable;
1984
+ const {
1985
+ lyTimeout,
1986
+ lyRunTime,
1987
+ scrollYStore
1988
+ } = internalData;
1989
+ const {
1990
+ visibleSize
1991
+ } = scrollYStore;
1992
+ const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)));
1993
+ if (lyTimeout) {
1994
+ clearTimeout(lyTimeout);
1995
+ }
1996
+ if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
1997
+ internalData.lyRunTime = Date.now();
1998
+ loadScrollYData($xeTable);
1999
+ }
2000
+ internalData.lyTimeout = setTimeout(() => {
2001
+ internalData.lyTimeout = undefined;
2002
+ internalData.lyRunTime = undefined;
2003
+ loadScrollYData($xeTable);
2004
+ }, fpsTime);
2005
+ }
1923
2006
  function checkLastSyncScroll($xeTable, isRollX, isRollY) {
1924
2007
  const reactData = $xeTable;
1925
2008
  const internalData = $xeTable;
@@ -1936,6 +2019,7 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
1936
2019
  internalData.lcsTimeout = setTimeout(() => {
1937
2020
  internalData.lcsRunTime = Date.now();
1938
2021
  internalData.lcsTimeout = undefined;
2022
+ internalData.intoRunScroll = false;
1939
2023
  internalData.inVirtualScroll = false;
1940
2024
  internalData.inWheelScroll = false;
1941
2025
  internalData.inHeaderScroll = false;
@@ -1955,6 +2039,43 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
1955
2039
  $xeTable.updateCellAreas();
1956
2040
  }, 200);
1957
2041
  }
2042
+ const getWheelSpeed = lastScrollTime => {
2043
+ let multiple = 1;
2044
+ const currTime = Date.now();
2045
+ if (lastScrollTime + 25 > currTime) {
2046
+ multiple = 1.18;
2047
+ } else if (lastScrollTime + 30 > currTime) {
2048
+ multiple = 1.15;
2049
+ } else if (lastScrollTime + 40 > currTime) {
2050
+ multiple = 1.12;
2051
+ } else if (lastScrollTime + 55 > currTime) {
2052
+ multiple = 1.09;
2053
+ } else if (lastScrollTime + 75 > currTime) {
2054
+ multiple = 1.06;
2055
+ } else if (lastScrollTime + 100 > currTime) {
2056
+ multiple = 1.03;
2057
+ }
2058
+ return multiple;
2059
+ };
2060
+ const wheelScrollTo = (diffNum, cb) => {
2061
+ const duration = Math.abs(diffNum);
2062
+ const startTime = performance.now();
2063
+ let countTop = 0;
2064
+ const step = timestamp => {
2065
+ let progress = (timestamp - startTime) / duration;
2066
+ if (progress > 1) {
2067
+ progress = 1;
2068
+ }
2069
+ const easedProgress = Math.pow(progress, 2);
2070
+ const offsetTop = Math.floor(diffNum * easedProgress) - countTop;
2071
+ countTop += offsetTop;
2072
+ cb(offsetTop);
2073
+ if (progress < 1) {
2074
+ requestAnimationFrame(step);
2075
+ }
2076
+ };
2077
+ requestAnimationFrame(step);
2078
+ };
1958
2079
  function updateHeight($xeTable) {
1959
2080
  const internalData = $xeTable;
1960
2081
  internalData.customHeight = calcTableHeight($xeTable, 'height');
@@ -1962,59 +2083,62 @@ function updateHeight($xeTable) {
1962
2083
  internalData.customMaxHeight = calcTableHeight($xeTable, 'maxHeight');
1963
2084
  }
1964
2085
  function calcColumnAutoWidth(column, wrapperEl) {
1965
- const cellElList = wrapperEl.querySelectorAll(`.vxe-header--column.${column.id}>.vxe-cell,.vxe-body--column.${column.id}>.vxe-cell,.vxe-footer--column.${column.id}>.vxe-cell`);
1966
- const firstCellEl = cellElList[0];
1967
- let paddingSize = 0;
1968
- if (firstCellEl) {
1969
- const cellStyle = getComputedStyle(firstCellEl);
1970
- paddingSize = Math.floor(_xeUtils.default.toNumber(cellStyle.paddingLeft) + _xeUtils.default.toNumber(cellStyle.paddingRight)) + 2;
2086
+ const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`);
2087
+ let leftRightPadding = 0;
2088
+ const firstCellEl = cellElemList[0];
2089
+ if (firstCellEl && firstCellEl.parentElement) {
2090
+ const cellStyle = getComputedStyle(firstCellEl.parentElement);
2091
+ leftRightPadding = Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingLeft) + _xeUtils.default.toNumber(cellStyle.paddingRight));
1971
2092
  }
1972
- let colWidth = column.renderAutoWidth - paddingSize;
1973
- _xeUtils.default.arrayEach(cellElList, itemEl => {
1974
- const cellEl = itemEl;
1975
- const thElem = cellEl.parentElement;
1976
- let titleWidth = 0;
1977
- if (`${thElem.tagName}`.toLowerCase() === 'th') {
1978
- _xeUtils.default.arrayEach(cellEl.children, btnEl => {
1979
- titleWidth += btnEl.offsetWidth + 1;
1980
- });
1981
- } else {
1982
- const labelEl = cellEl.firstElementChild;
1983
- if (labelEl) {
1984
- titleWidth = labelEl.offsetWidth;
1985
- }
1986
- }
1987
- if (titleWidth) {
1988
- colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
1989
- }
1990
- });
1991
- return colWidth + paddingSize;
2093
+ let colWidth = column.renderAutoWidth - leftRightPadding;
2094
+ for (let i = 0; i < cellElemList.length; i++) {
2095
+ const celEl = cellElemList[i];
2096
+ colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0);
2097
+ }
2098
+ return colWidth + leftRightPadding;
1992
2099
  }
1993
2100
  function calcCellWidth($xeTable) {
1994
- const reactData = $xeTable;
1995
2101
  const internalData = $xeTable;
1996
2102
  const autoWidthColumnList = $xeTable.computeAutoWidthColumnList;
1997
- reactData.isCalcColumn = true;
1998
- return $xeTable.$nextTick().then(() => {
1999
- const {
2000
- fullColumnIdData
2001
- } = internalData;
2002
- const el = $xeTable.$refs.refElem;
2003
- if (el) {
2004
- autoWidthColumnList.forEach(column => {
2005
- const colid = column.id;
2006
- const colRest = fullColumnIdData[colid];
2007
- const colWidth = calcColumnAutoWidth(column, el);
2008
- if (colRest) {
2009
- colRest.width = Math.max(colWidth, colRest.width);
2010
- }
2011
- column.renderAutoWidth = colWidth;
2012
- });
2013
- $xeTable.analyColumnWidth();
2014
- }
2015
- reactData.isCalcColumn = false;
2016
- });
2103
+ const {
2104
+ fullColumnIdData
2105
+ } = internalData;
2106
+ const el = $xeTable.$refs.refElem;
2107
+ if (el) {
2108
+ el.setAttribute('data-calc-col', 'Y');
2109
+ autoWidthColumnList.forEach(column => {
2110
+ const colid = column.id;
2111
+ const colRest = fullColumnIdData[colid];
2112
+ const colWidth = calcColumnAutoWidth(column, el);
2113
+ if (colRest) {
2114
+ colRest.width = Math.max(colWidth, colRest.width);
2115
+ }
2116
+ column.renderAutoWidth = colWidth;
2117
+ });
2118
+ $xeTable.analyColumnWidth();
2119
+ el.removeAttribute('data-calc-col');
2120
+ }
2017
2121
  }
2122
+ const handleUpdateColResize = ($xeTable, evnt, params) => {
2123
+ $xeTable.analyColumnWidth();
2124
+ $xeTable.recalculate(true).then(() => {
2125
+ $xeTable.saveCustomStore('update:width');
2126
+ $xeTable.updateCellAreas();
2127
+ $xeTable.dispatchEvent('column-resizable-change', params, evnt);
2128
+ // 已废弃 resizable-change
2129
+ $xeTable.dispatchEvent('resizable-change', params, evnt);
2130
+ setTimeout(() => $xeTable.recalculate(true), 300);
2131
+ });
2132
+ };
2133
+ const handleUpdateRowResize = ($xeTable, evnt, params) => {
2134
+ const reactData = $xeTable;
2135
+ reactData.resizeHeightFlag++;
2136
+ $xeTable.recalculate(true).then(() => {
2137
+ $xeTable.updateCellAreas();
2138
+ $xeTable.dispatchEvent('row-resizable-change', params, evnt);
2139
+ setTimeout(() => $xeTable.recalculate(true), 300);
2140
+ });
2141
+ };
2018
2142
  const Methods = {
2019
2143
  callSlot(slotFunc, params, h, vNodes) {
2020
2144
  if (slotFunc) {
@@ -2079,7 +2203,7 @@ const Methods = {
2079
2203
  (0, _log.warnLog)('vxe.error.delFunc', ['syncData', 'getData']);
2080
2204
  return this.$nextTick().then(() => {
2081
2205
  this.tableData = [];
2082
- return this.$nextTick().then(() => this.loadTableData(this.tableFullData));
2206
+ return this.$nextTick().then(() => this.loadTableData(this.tableFullData, true));
2083
2207
  });
2084
2208
  },
2085
2209
  /**
@@ -2141,11 +2265,12 @@ const Methods = {
2141
2265
  * 加载表格数据
2142
2266
  * @param {Array} datas 数据
2143
2267
  */
2144
- loadTableData(datas) {
2268
+ loadTableData(datas, isReset) {
2145
2269
  const $xeTable = this;
2270
+ const reactData = $xeTable;
2271
+ const internalData = $xeTable;
2146
2272
  const {
2147
2273
  keepSource,
2148
- showOverflow,
2149
2274
  treeConfig,
2150
2275
  treeOpts,
2151
2276
  editStore,
@@ -2158,7 +2283,6 @@ const Methods = {
2158
2283
  sYOpts
2159
2284
  } = this;
2160
2285
  const childrenField = treeOpts.children || treeOpts.childrenField;
2161
- const rowOpts = $xeTable.computeRowOpts;
2162
2286
  let treeData = [];
2163
2287
  let fullData = datas ? datas.slice(0) : [];
2164
2288
  if (treeConfig) {
@@ -2201,42 +2325,30 @@ const Methods = {
2201
2325
  scrollYStore.endIndex = 1;
2202
2326
  scrollXStore.startIndex = 0;
2203
2327
  scrollXStore.endIndex = 1;
2328
+ reactData.isRowLoading = true;
2329
+ reactData.scrollVMLoading = false;
2204
2330
  editStore.insertMaps = {};
2205
- editStore.removeList = [];
2206
2331
  editStore.removeMaps = {};
2207
2332
  const sYLoad = updateScrollYStatus($xeTable, fullData);
2208
- this.isDragRowMove = false;
2333
+ reactData.isDragColMove = false;
2334
+ reactData.isDragRowMove = false;
2209
2335
  // 全量数据
2210
- this.tableFullData = fullData;
2211
- this.tableFullTreeData = treeData;
2336
+ internalData.tableFullData = fullData;
2337
+ internalData.tableFullTreeData = treeData;
2212
2338
  // 缓存数据
2213
- this.cacheRowMap(true);
2339
+ $xeTable.cacheRowMap(true, isReset);
2214
2340
  // 原始数据
2215
- this.tableSynchData = datas;
2341
+ internalData.tableSynchData = datas;
2342
+ if (isReset) {
2343
+ internalData.isResizeCellHeight = false;
2344
+ reactData.rowExpandedMaps = {};
2345
+ reactData.rowExpandLazyLoadedMaps = {};
2346
+ reactData.treeExpandedMaps = {};
2347
+ reactData.treeExpandLazyLoadedMaps = {};
2348
+ }
2216
2349
  // 克隆原数据,用于显示编辑状态,与编辑值做对比
2217
2350
  if (keepSource) {
2218
- this.cacheSourceMap(fullData);
2219
- }
2220
- if (sYLoad) {
2221
- if (showOverflow) {
2222
- if (!rowOpts.height) {
2223
- const errColumn = this.tableFullColumn.find(column => column.showOverflow === false);
2224
- if (errColumn) {
2225
- (0, _log.errLog)('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true']);
2226
- }
2227
- }
2228
- }
2229
- if (process.env.NODE_ENV === 'development') {
2230
- if (!(this.height || this.maxHeight)) {
2231
- (0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
2232
- }
2233
- // if (!this.showOverflow) {
2234
- // warnLog('vxe.error.reqProp', ['table.show-overflow'])
2235
- // }
2236
- if (this.spanMethod) {
2237
- (0, _log.warnLog)('vxe.error.scrollErrProp', ['table.span-method']);
2238
- }
2239
- }
2351
+ $xeTable.cacheSourceMap(fullData);
2240
2352
  }
2241
2353
  if (this.clearCellAreas && this.mouseConfig) {
2242
2354
  this.clearCellAreas();
@@ -2256,6 +2368,27 @@ const Methods = {
2256
2368
  if (sYLoad) {
2257
2369
  scrollYStore.endIndex = scrollYStore.visibleSize;
2258
2370
  }
2371
+ if (sYLoad) {
2372
+ // if (showOverflow) {
2373
+ // if (!rowOpts.height) {
2374
+ // const errColumn = this.tableFullColumn.find((column: any) => column.showOverflow === false)
2375
+ // if (errColumn) {
2376
+ // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
2377
+ // }
2378
+ // }
2379
+ // }
2380
+ if (process.env.NODE_ENV === 'development') {
2381
+ if (!(this.height || this.maxHeight)) {
2382
+ (0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
2383
+ }
2384
+ // if (!this.showOverflow) {
2385
+ // warnLog('vxe.error.reqProp', ['table.show-overflow'])
2386
+ // }
2387
+ if (this.spanMethod) {
2388
+ (0, _log.warnLog)('vxe.error.scrollErrProp', ['table.span-method']);
2389
+ }
2390
+ }
2391
+ }
2259
2392
  this.handleReserveStatus();
2260
2393
  this.checkSelectionStatus();
2261
2394
  return new Promise(resolve => {
@@ -2269,6 +2402,7 @@ const Methods = {
2269
2402
  if (sYOpts.scrollToTopOnChange) {
2270
2403
  targetScrollTop = 0;
2271
2404
  }
2405
+ reactData.isRowLoading = false;
2272
2406
  calcCellHeight($xeTable);
2273
2407
  // 是否变更虚拟滚动
2274
2408
  if (oldScrollYLoad === sYLoad) {
@@ -2294,7 +2428,7 @@ const Methods = {
2294
2428
  const {
2295
2429
  initStatus
2296
2430
  } = this;
2297
- return this.loadTableData(datas).then(() => {
2431
+ return this.loadTableData(datas, false).then(() => {
2298
2432
  this.inited = true;
2299
2433
  this.initStatus = true;
2300
2434
  if (!initStatus) {
@@ -2311,7 +2445,7 @@ const Methods = {
2311
2445
  return this.clearAll().then(() => {
2312
2446
  this.inited = true;
2313
2447
  this.initStatus = true;
2314
- return this.loadTableData(datas);
2448
+ return this.loadTableData(datas, true);
2315
2449
  }).then(() => {
2316
2450
  this.handleLoadDefaults();
2317
2451
  return this.recalculate();
@@ -2392,9 +2526,8 @@ const Methods = {
2392
2526
  },
2393
2527
  /**
2394
2528
  * 更新数据行的 Map
2395
- * 牺牲数据组装的耗时,用来换取使用过程中的流畅
2396
2529
  */
2397
- cacheRowMap(isSource) {
2530
+ cacheRowMap(isReset, isSource) {
2398
2531
  const {
2399
2532
  treeConfig,
2400
2533
  treeOpts,
@@ -2420,7 +2553,7 @@ const Methods = {
2420
2553
  row[childrenField] = null;
2421
2554
  }
2422
2555
  let cacheItem = fullAllDataRowIdData[rowid];
2423
- if (!cacheItem) {
2556
+ if (isReset || !cacheItem) {
2424
2557
  cacheItem = {
2425
2558
  row,
2426
2559
  rowid,
@@ -2433,6 +2566,7 @@ const Methods = {
2433
2566
  parent: parentRow,
2434
2567
  level,
2435
2568
  height: 0,
2569
+ resizeHeight: 0,
2436
2570
  oTop: 0
2437
2571
  };
2438
2572
  }
@@ -2538,6 +2672,7 @@ const Methods = {
2538
2672
  parent: parentRow,
2539
2673
  level: parentLevel + nodes.length,
2540
2674
  height: 0,
2675
+ resizeHeight: 0,
2541
2676
  oTop: 0
2542
2677
  };
2543
2678
  fullDataRowIdData[rowid] = rest;
@@ -2930,20 +3065,38 @@ const Methods = {
2930
3065
  return this.$nextTick();
2931
3066
  },
2932
3067
  getCellElement(row, fieldOrColumn) {
2933
- const column = (0, _util.handleFieldOrColumn)(this, fieldOrColumn);
3068
+ const $xeTable = this;
3069
+ const internalData = $xeTable;
3070
+ const {
3071
+ elemStore
3072
+ } = internalData;
3073
+ const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
2934
3074
  if (!column) {
2935
3075
  return null;
2936
3076
  }
2937
- const {
2938
- $refs
2939
- } = this;
2940
- const rowid = (0, _util.getRowid)(this, row);
2941
- let bodyElem = null;
3077
+ const rowid = (0, _util.getRowid)($xeTable, row);
3078
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
3079
+ const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
3080
+ const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
3081
+ let bodyElem;
2942
3082
  if (column) {
2943
- bodyElem = $refs[`${column.fixed || 'table'}Body`] || $refs.refTableBody;
2944
- }
2945
- if (bodyElem && bodyElem.$el) {
2946
- return bodyElem.$el.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
3083
+ if (column.fixed) {
3084
+ if (column.fixed === 'left') {
3085
+ if (leftScrollElem) {
3086
+ bodyElem = leftScrollElem;
3087
+ }
3088
+ } else {
3089
+ if (rightScrollElem) {
3090
+ bodyElem = rightScrollElem;
3091
+ }
3092
+ }
3093
+ }
3094
+ if (!bodyElem) {
3095
+ bodyElem = bodyScrollElem;
3096
+ }
3097
+ if (bodyElem) {
3098
+ return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
3099
+ }
2947
3100
  }
2948
3101
  return null;
2949
3102
  },
@@ -3470,7 +3623,11 @@ const Methods = {
3470
3623
  * @param {String/Number} rowid 行主键
3471
3624
  */
3472
3625
  getRowById(cellValue) {
3473
- const fullDataRowIdData = this.fullDataRowIdData;
3626
+ const $xeTable = this;
3627
+ const internalData = $xeTable;
3628
+ const {
3629
+ fullDataRowIdData
3630
+ } = internalData;
3474
3631
  const rowid = _xeUtils.default.eqNull(cellValue) ? '' : encodeURIComponent(cellValue);
3475
3632
  return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null;
3476
3633
  },
@@ -3478,14 +3635,9 @@ const Methods = {
3478
3635
  * 根据行获取行的唯一主键
3479
3636
  * @param {Row} row 行对象
3480
3637
  */
3481
- getRowid(cellValue) {
3638
+ getRowid(row) {
3482
3639
  const $xeTable = this;
3483
- const internalData = $xeTable;
3484
- const {
3485
- fullDataRowIdData
3486
- } = internalData;
3487
- const rowid = _xeUtils.default.eqNull(cellValue) ? '' : encodeURIComponent(cellValue || '');
3488
- return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null;
3640
+ return (0, _util.getRowid)($xeTable, row);
3489
3641
  },
3490
3642
  /**
3491
3643
  * 获取处理后的表格数据
@@ -3689,29 +3841,41 @@ const Methods = {
3689
3841
  },
3690
3842
  setColumnWidth(fieldOrColumn, width) {
3691
3843
  const $xeTable = this;
3844
+ const internalData = $xeTable;
3845
+ const {
3846
+ elemStore
3847
+ } = internalData;
3692
3848
  let status = false;
3693
3849
  const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
3694
- cols.forEach(item => {
3695
- const column = (0, _util.handleFieldOrColumn)($xeTable, item);
3696
- if (column) {
3697
- const colWidth = _xeUtils.default.toInteger(width);
3698
- let rdWidth = colWidth;
3699
- if ((0, _dom.isScale)(width)) {
3700
- const refTableBody = $xeTable.$refs.refTableBody;
3701
- const bodyElem = refTableBody ? refTableBody.$el : null;
3702
- const bodyWidth = bodyElem ? bodyElem.clientWidth - 1 : 0;
3703
- rdWidth = Math.floor(colWidth * bodyWidth);
3704
- }
3705
- column.resizeWidth = rdWidth;
3706
- if (!status) {
3707
- status = true;
3850
+ let cWidth = _xeUtils.default.toInteger(width);
3851
+ if ((0, _dom.isScale)(width)) {
3852
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
3853
+ const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0;
3854
+ cWidth = Math.floor(cWidth * bodyWidth);
3855
+ }
3856
+ if (cWidth) {
3857
+ cols.forEach(item => {
3858
+ const column = (0, _util.handleFieldOrColumn)($xeTable, item);
3859
+ if (column) {
3860
+ column.resizeWidth = cWidth;
3861
+ if (!status) {
3862
+ status = true;
3863
+ }
3708
3864
  }
3865
+ });
3866
+ if (status) {
3867
+ return $xeTable.refreshColumn().then(() => {
3868
+ return {
3869
+ status
3870
+ };
3871
+ });
3709
3872
  }
3710
- });
3711
- if (status) {
3712
- return $xeTable.refreshColumn();
3713
3873
  }
3714
- return $xeTable.$nextTick();
3874
+ return $xeTable.$nextTick().then(() => {
3875
+ return {
3876
+ status
3877
+ };
3878
+ });
3715
3879
  },
3716
3880
  getColumnWidth(fieldOrColumn) {
3717
3881
  const column = (0, _util.handleFieldOrColumn)(this, fieldOrColumn);
@@ -4038,53 +4202,489 @@ const Methods = {
4038
4202
  remainList
4039
4203
  });
4040
4204
  },
4041
- handleResizeDblclickEvent(evnt, params) {
4205
+ handleColResizeMousedownEvent(evnt, fixedType, params) {
4206
+ const $xeTable = this;
4207
+ const reactData = $xeTable;
4208
+ const internalData = $xeTable;
4209
+ evnt.stopPropagation();
4210
+ evnt.preventDefault();
4211
+ const {
4212
+ column
4213
+ } = params;
4214
+ const {
4215
+ overflowX,
4216
+ scrollbarHeight
4217
+ } = reactData;
4218
+ const {
4219
+ elemStore,
4220
+ visibleColumn
4221
+ } = internalData;
4222
+ const resizableOpts = $xeTable.computeResizableOpts;
4223
+ const osbHeight = overflowX ? scrollbarHeight : 0;
4224
+ const tableEl = $xeTable.$refs.refElem;
4225
+ const leftContainerElem = $xeTable.$refs.refLeftContainer;
4226
+ const rightContainerElem = $xeTable.$refs.refRightContainer;
4227
+ const resizeBarElem = $xeTable.$refs.refColResizeBar;
4228
+ if (!resizeBarElem) {
4229
+ return;
4230
+ }
4231
+ const resizeTipElem = resizeBarElem.firstElementChild;
4232
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
4233
+ const {
4234
+ clientX: dragClientX
4235
+ } = evnt;
4236
+ const wrapperElem = $xeTable.$refs.refElem;
4237
+ const dragBtnElem = evnt.target;
4238
+ let resizeColumn = column;
4239
+ if (column.children && column.children.length) {
4240
+ _xeUtils.default.eachTree(column.children, childColumn => {
4241
+ resizeColumn = childColumn;
4242
+ });
4243
+ }
4244
+ const cell = dragBtnElem.parentNode;
4245
+ const cellParams = Object.assign(params, {
4246
+ cell
4247
+ });
4248
+ let dragLeft = 0;
4249
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
4250
+ if (!bodyScrollElem) {
4251
+ return;
4252
+ }
4253
+ const pos = (0, _dom.getOffsetPos)(dragBtnElem, wrapperElem);
4254
+ const dragBtnWidth = dragBtnElem.clientWidth;
4255
+ const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
4256
+ const minInterval = (0, _util.getColReMinWidth)(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
4257
+ let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
4258
+ let dragPosLeft = pos.left + dragBtnOffsetWidth;
4259
+ const isLeftFixed = fixedType === 'left';
4260
+ const isRightFixed = fixedType === 'right';
4261
+ // 计算左右侧固定列偏移量
4262
+ let fixedOffsetWidth = 0;
4263
+ if (isLeftFixed || isRightFixed) {
4264
+ const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
4265
+ let tempCellElem = cell[siblingProp];
4266
+ while (tempCellElem) {
4267
+ if ((0, _dom.hasClass)(tempCellElem, 'fixed--hidden')) {
4268
+ break;
4269
+ } else if (!(0, _dom.hasClass)(tempCellElem, 'col--group')) {
4270
+ fixedOffsetWidth += tempCellElem.offsetWidth;
4271
+ }
4272
+ tempCellElem = tempCellElem[siblingProp];
4273
+ }
4274
+ if (isRightFixed && rightContainerElem) {
4275
+ dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth;
4276
+ }
4277
+ }
4278
+ // 处理拖动事件
4279
+ const updateEvent = evnt => {
4280
+ evnt.stopPropagation();
4281
+ evnt.preventDefault();
4282
+ const tableHeight = tableEl.clientHeight;
4283
+ const offsetX = evnt.clientX - dragClientX;
4284
+ let left = dragPosLeft + offsetX;
4285
+ const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
4286
+ if (isLeftFixed) {
4287
+ // 左固定列(不允许超过右侧固定列、不允许超过右边距)
4288
+ left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
4289
+ } else if (isRightFixed) {
4290
+ // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
4291
+ dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval;
4292
+ left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
4293
+ } else {
4294
+ dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
4295
+ // left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
4296
+ }
4297
+ dragLeft = Math.max(left, dragMinLeft);
4298
+ const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
4299
+ resizeBarElem.style.left = `${resizeBarLeft}px`;
4300
+ resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
4301
+ resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
4302
+ if (resizableOpts.showDragTip && resizeTipElem) {
4303
+ resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
4304
+ const tableWidth = tableEl.clientWidth;
4305
+ const wrapperRect = wrapperElem.getBoundingClientRect();
4306
+ const resizeBarWidth = resizeBarElem.clientWidth;
4307
+ const resizeTipWidth = resizeTipElem.clientWidth;
4308
+ const resizeTipHeight = resizeTipElem.clientHeight;
4309
+ let resizeTipLeft = -resizeTipWidth;
4310
+ if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
4311
+ resizeTipLeft = 0;
4312
+ } else if (resizeBarLeft > tableWidth) {
4313
+ resizeTipLeft += tableWidth - resizeBarLeft;
4314
+ }
4315
+ resizeTipElem.style.left = `${resizeTipLeft}px`;
4316
+ resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
4317
+ }
4318
+ reactData.isDragResize = true;
4319
+ };
4320
+ reactData.isDragResize = true;
4321
+ (0, _dom.addClass)(tableEl, 'col-drag--resize');
4322
+ resizeBarElem.style.display = 'block';
4323
+ document.onmousemove = updateEvent;
4324
+ document.onmouseup = function (evnt) {
4325
+ document.onmousemove = null;
4326
+ document.onmouseup = null;
4327
+ resizeBarElem.style.display = 'none';
4328
+ internalData._lastResizeTime = Date.now();
4329
+ setTimeout(() => {
4330
+ reactData.isDragResize = false;
4331
+ }, 50);
4332
+ const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
4333
+ const resizeParams = Object.assign(Object.assign({}, params), {
4334
+ resizeWidth,
4335
+ resizeColumn
4336
+ });
4337
+ if (resizableOpts.dragMode === 'fixed') {
4338
+ visibleColumn.forEach(item => {
4339
+ if (item.id !== resizeColumn.id) {
4340
+ if (!item.resizeWidth) {
4341
+ item.resizeWidth = item.renderWidth;
4342
+ }
4343
+ }
4344
+ });
4345
+ }
4346
+ if ($xeTable.handleColResizeCellAreaEvent) {
4347
+ $xeTable.handleColResizeCellAreaEvent(evnt, resizeParams);
4348
+ } else {
4349
+ resizeColumn.resizeWidth = resizeWidth;
4350
+ handleUpdateColResize($xeTable, evnt, resizeParams);
4351
+ }
4352
+ (0, _dom.removeClass)(tableEl, 'col-drag--resize');
4353
+ };
4354
+ updateEvent(evnt);
4355
+ if ($xeTable.closeMenu) {
4356
+ $xeTable.closeMenu();
4357
+ }
4358
+ },
4359
+ handleColResizeDblclickEvent(evnt, params) {
4360
+ const $xeTable = this;
4361
+ const reactData = $xeTable;
4362
+ const internalData = $xeTable;
4363
+ const resizableOpts = $xeTable.computeResizableOpts;
4364
+ const {
4365
+ isDblclickAutoWidth
4366
+ } = resizableOpts;
4367
+ const el = $xeTable.$refs.refElem;
4368
+ if (isDblclickAutoWidth && el) {
4369
+ evnt.stopPropagation();
4370
+ evnt.preventDefault();
4371
+ const {
4372
+ fullColumnIdData
4373
+ } = internalData;
4374
+ const {
4375
+ column
4376
+ } = params;
4377
+ let resizeColumn = column;
4378
+ if (column.children && column.children.length) {
4379
+ _xeUtils.default.eachTree(column.children, childColumn => {
4380
+ resizeColumn = childColumn;
4381
+ });
4382
+ }
4383
+ const colid = resizeColumn.id;
4384
+ const colRest = fullColumnIdData[colid];
4385
+ const dragBtnElem = evnt.target;
4386
+ const cell = dragBtnElem.parentNode;
4387
+ const cellParams = Object.assign(params, {
4388
+ cell
4389
+ });
4390
+ const colMinWidth = (0, _util.getColReMinWidth)(cellParams);
4391
+ el.setAttribute('data-calc-col', 'Y');
4392
+ let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
4393
+ el.removeAttribute('data-calc-col');
4394
+ if (colRest) {
4395
+ resizeWidth = Math.max(resizeWidth, colRest.width);
4396
+ }
4397
+ resizeWidth = Math.max(colMinWidth, resizeWidth);
4398
+ const resizeParams = Object.assign(Object.assign({}, params), {
4399
+ resizeWidth,
4400
+ resizeColumn
4401
+ });
4402
+ reactData.isDragResize = false;
4403
+ internalData._lastResizeTime = Date.now();
4404
+ if ($xeTable.handleColResizeDblclickCellAreaEvent) {
4405
+ $xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams);
4406
+ } else {
4407
+ resizeColumn.resizeWidth = resizeWidth;
4408
+ handleUpdateColResize($xeTable, evnt, resizeParams);
4409
+ }
4410
+ }
4411
+ },
4412
+ handleRowResizeMousedownEvent(evnt, params) {
4413
+ const $xeTable = this;
4414
+ const reactData = $xeTable;
4415
+ const internalData = $xeTable;
4416
+ evnt.stopPropagation();
4417
+ evnt.preventDefault();
4418
+ const {
4419
+ row
4420
+ } = params;
4421
+ const {
4422
+ overflowX,
4423
+ scrollbarWidth,
4424
+ overflowY,
4425
+ scrollbarHeight
4426
+ } = reactData;
4427
+ const {
4428
+ elemStore,
4429
+ fullAllDataRowIdData
4430
+ } = internalData;
4431
+ const osbWidth = overflowY ? scrollbarWidth : 0;
4432
+ const osbHeight = overflowX ? scrollbarHeight : 0;
4433
+ const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
4434
+ const resizableOpts = $xeTable.computeResizableOpts;
4435
+ const rowOpts = $xeTable.computeRowOpts;
4436
+ const cellOpts = $xeTable.computeCellOpts;
4437
+ const tableEl = $xeTable.$refs.refElem;
4438
+ const resizeBarElem = $xeTable.$refs.refRowResizeBar;
4439
+ if (!resizeBarElem) {
4440
+ return;
4441
+ }
4442
+ const {
4443
+ clientY: dragClientY
4444
+ } = evnt;
4445
+ const resizeTipElem = resizeBarElem.firstElementChild;
4446
+ const dragBtnElem = evnt.currentTarget;
4447
+ const tdEl = dragBtnElem.parentNode;
4448
+ const trEl = tdEl.parentNode;
4449
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
4450
+ if (!bodyScrollElem) {
4451
+ return;
4452
+ }
4453
+ const rowid = (0, _util.getRowid)($xeTable, row);
4454
+ const rowRest = fullAllDataRowIdData[rowid];
4455
+ if (!rowRest) {
4456
+ return;
4457
+ }
4458
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
4459
+ const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
4460
+ const tableRect = tableEl.getBoundingClientRect();
4461
+ const trRect = trEl.getBoundingClientRect();
4462
+ const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight;
4463
+ let resizeHeight = currCellHeight;
4464
+ const cellEl = tdEl.querySelector('.vxe-cell');
4465
+ let cellMinHeight = 0;
4466
+ if (cellEl) {
4467
+ const cellStyle = getComputedStyle(cellEl);
4468
+ cellMinHeight = Math.max(1, Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingTop) + _xeUtils.default.toNumber(cellStyle.paddingBottom)));
4469
+ }
4470
+ const minTop = trRect.y - tableRect.y + cellMinHeight;
4471
+ // 处理拖动事件
4472
+ const updateEvent = evnt => {
4473
+ evnt.stopPropagation();
4474
+ evnt.preventDefault();
4475
+ const tableWidth = tableEl.clientWidth - osbWidth;
4476
+ const tableHeight = tableEl.clientHeight - osbHeight;
4477
+ let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
4478
+ if (dragTop < minTop) {
4479
+ dragTop = minTop;
4480
+ } else {
4481
+ resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY);
4482
+ }
4483
+ resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
4484
+ resizeBarElem.style.top = `${dragTop}px`;
4485
+ resizeBarElem.style.width = `${tableWidth}px`;
4486
+ if (resizableOpts.showDragTip && resizeTipElem) {
4487
+ resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
4488
+ const resizeTipWidth = resizeTipElem.clientWidth;
4489
+ const resizeTipHeight = resizeTipElem.clientHeight;
4490
+ let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
4491
+ let resizeBarTop = 0;
4492
+ if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
4493
+ resizeBarLeft = tableWidth - resizeTipWidth - 2;
4494
+ }
4495
+ if (dragTop + resizeTipHeight >= tableHeight) {
4496
+ resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
4497
+ }
4498
+ resizeTipElem.style.left = `${resizeBarLeft}px`;
4499
+ resizeTipElem.style.top = `${resizeBarTop}px`;
4500
+ }
4501
+ reactData.isDragResize = true;
4502
+ };
4503
+ reactData.isDragResize = true;
4504
+ (0, _dom.addClass)(tableEl, 'row-drag--resize');
4505
+ resizeBarElem.style.display = 'block';
4506
+ document.onmousemove = updateEvent;
4507
+ document.onmouseup = function (evnt) {
4508
+ document.onmousemove = null;
4509
+ document.onmouseup = null;
4510
+ resizeBarElem.style.display = 'none';
4511
+ internalData._lastResizeTime = Date.now();
4512
+ setTimeout(() => {
4513
+ reactData.isDragResize = false;
4514
+ }, 50);
4515
+ if (resizeHeight !== currCellHeight) {
4516
+ const resizeParams = Object.assign(Object.assign({}, params), {
4517
+ resizeHeight,
4518
+ resizeRow: row
4519
+ });
4520
+ internalData.isResizeCellHeight = true;
4521
+ if ($xeTable.handleRowResizeCellAreaEvent) {
4522
+ $xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams);
4523
+ } else {
4524
+ rowRest.resizeHeight = resizeHeight;
4525
+ handleUpdateRowResize($xeTable, evnt, resizeParams);
4526
+ }
4527
+ }
4528
+ (0, _dom.removeClass)(tableEl, 'row-drag--resize');
4529
+ };
4530
+ updateEvent(evnt);
4531
+ },
4532
+ handleRowResizeDblclickEvent(evnt, params) {
4533
+ const $xeTable = this;
4534
+ const reactData = $xeTable;
4535
+ const internalData = $xeTable;
4536
+ const resizableOpts = $xeTable.computeResizableOpts;
4537
+ const {
4538
+ isDblclickAutoHeight
4539
+ } = resizableOpts;
4540
+ const el = $xeTable.$refs.refElem;
4541
+ if (isDblclickAutoHeight && el) {
4542
+ evnt.stopPropagation();
4543
+ evnt.preventDefault();
4544
+ const {
4545
+ editStore
4546
+ } = reactData;
4547
+ const {
4548
+ fullAllDataRowIdData
4549
+ } = internalData;
4550
+ const {
4551
+ actived
4552
+ } = editStore;
4553
+ const {
4554
+ row
4555
+ } = params;
4556
+ const rowid = (0, _util.getRowid)($xeTable, row);
4557
+ const rowRest = fullAllDataRowIdData[rowid];
4558
+ if (!rowRest) {
4559
+ return;
4560
+ }
4561
+ const handleRsHeight = () => {
4562
+ const resizeHeight = calcCellAutoHeight(rowRest, el);
4563
+ const resizeParams = Object.assign(Object.assign({}, params), {
4564
+ resizeHeight,
4565
+ resizeRow: row
4566
+ });
4567
+ reactData.isDragResize = false;
4568
+ internalData._lastResizeTime = Date.now();
4569
+ if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
4570
+ $xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams);
4571
+ } else {
4572
+ rowRest.resizeHeight = resizeHeight;
4573
+ handleUpdateRowResize($xeTable, evnt, resizeParams);
4574
+ }
4575
+ };
4576
+ if (actived.row || actived.column) {
4577
+ $xeTable.clearEdit().then(handleRsHeight);
4578
+ } else {
4579
+ handleRsHeight();
4580
+ }
4581
+ }
4582
+ },
4583
+ setRowHeightConf(heightConf) {
4584
+ const $xeTable = this;
4585
+ const reactData = $xeTable;
4586
+ const internalData = $xeTable;
4587
+ const {
4588
+ fullAllDataRowIdData
4589
+ } = internalData;
4590
+ let status = false;
4591
+ if (heightConf) {
4592
+ _xeUtils.default.each(heightConf, (height, rowid) => {
4593
+ const rowRest = fullAllDataRowIdData[rowid];
4594
+ if (rowRest) {
4595
+ const rHeight = _xeUtils.default.toInteger(height);
4596
+ if (rHeight) {
4597
+ rowRest.resizeHeight = rHeight;
4598
+ if (!status) {
4599
+ status = true;
4600
+ }
4601
+ }
4602
+ }
4603
+ });
4604
+ if (status) {
4605
+ internalData.isResizeCellHeight = true;
4606
+ reactData.resizeHeightFlag++;
4607
+ }
4608
+ }
4609
+ return $xeTable.$nextTick().then(() => {
4610
+ return {
4611
+ status
4612
+ };
4613
+ });
4614
+ },
4615
+ getRowHeightConf(isFull) {
4616
+ const $xeTable = this;
4617
+ const internalData = $xeTable;
4618
+ const {
4619
+ fullAllDataRowIdData,
4620
+ afterFullData
4621
+ } = internalData;
4622
+ const rowOpts = $xeTable.computeRowOpts;
4623
+ const cellOpts = $xeTable.computeCellOpts;
4624
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
4625
+ const rest = {};
4626
+ afterFullData.forEach(row => {
4627
+ const rowid = (0, _util.getRowid)($xeTable, row);
4628
+ const rowRest = fullAllDataRowIdData[rowid];
4629
+ if (rowRest) {
4630
+ const resizeHeight = rowRest.resizeHeight;
4631
+ if (resizeHeight || isFull) {
4632
+ const currCellHeight = resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
4633
+ rest[rowid] = currCellHeight;
4634
+ }
4635
+ }
4636
+ });
4637
+ return rest;
4638
+ },
4639
+ setRowHeight(rowOrId, height) {
4042
4640
  const $xeTable = this;
4043
4641
  const reactData = $xeTable;
4044
4642
  const internalData = $xeTable;
4045
- const resizableOpts = $xeTable.computeResizableOpts;
4046
4643
  const {
4047
- isDblclickAutoWidth
4048
- } = resizableOpts;
4049
- const el = $xeTable.$refs.refElem;
4050
- if (isDblclickAutoWidth && el) {
4051
- const {
4052
- fullColumnIdData
4053
- } = internalData;
4054
- const {
4055
- column
4056
- } = params;
4057
- let resizeColumn = column;
4058
- if (column.children && column.children.length) {
4059
- _xeUtils.default.eachTree(column.children, childColumn => {
4060
- resizeColumn = childColumn;
4061
- });
4062
- }
4063
- const colid = resizeColumn.id;
4064
- const colRest = fullColumnIdData[colid];
4065
- const dragBtnElem = evnt.target;
4066
- const cell = dragBtnElem.parentNode;
4067
- const cellParams = Object.assign(params, {
4068
- cell
4644
+ fullAllDataRowIdData
4645
+ } = internalData;
4646
+ let status = false;
4647
+ const rows = _xeUtils.default.isArray(rowOrId) ? rowOrId : [rowOrId];
4648
+ let rHeight = _xeUtils.default.toInteger(height);
4649
+ if ((0, _dom.isScale)(height)) {
4650
+ const tableBody = $xeTable.$refs.refTableBody;
4651
+ const bodyElem = tableBody ? tableBody.$el : null;
4652
+ const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0;
4653
+ rHeight = Math.floor(rHeight * bodyHeight);
4654
+ }
4655
+ if (rHeight) {
4656
+ rows.forEach(row => {
4657
+ const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : (0, _util.getRowid)($xeTable, row);
4658
+ const rowRest = fullAllDataRowIdData[rowid];
4659
+ if (rowRest) {
4660
+ rowRest.resizeHeight = rHeight;
4661
+ if (!status) {
4662
+ status = true;
4663
+ }
4664
+ }
4069
4665
  });
4070
- const colMinWidth = (0, _util.getColReMinWidth)(cellParams);
4071
- let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
4072
- if (colRest) {
4073
- resizeWidth = Math.max(resizeWidth, colRest.width);
4666
+ if (status) {
4667
+ internalData.isResizeCellHeight = true;
4668
+ reactData.resizeHeightFlag++;
4074
4669
  }
4075
- resizeColumn.resizeWidth = Math.max(colMinWidth, resizeWidth);
4076
- reactData._isResize = false;
4077
- internalData._lastResizeTime = Date.now();
4078
- $xeTable.analyColumnWidth();
4079
- $xeTable.recalculate(true).then(() => {
4080
- $xeTable.saveCustomStore('update:visible');
4081
- $xeTable.updateCellAreas();
4082
- $xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), {
4083
- resizeWidth
4084
- }), evnt);
4085
- setTimeout(() => $xeTable.recalculate(true), 300);
4086
- });
4087
4670
  }
4671
+ return $xeTable.$nextTick();
4672
+ },
4673
+ getRowHeight(rowOrId) {
4674
+ const $xeTable = this;
4675
+ const internalData = $xeTable;
4676
+ const {
4677
+ fullAllDataRowIdData
4678
+ } = internalData;
4679
+ const rowOpts = $xeTable.computeRowOpts;
4680
+ const cellOpts = $xeTable.computeCellOpts;
4681
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
4682
+ const rowid = _xeUtils.default.isString(rowOrId) || _xeUtils.default.isNumber(rowOrId) ? rowOrId : (0, _util.getRowid)($xeTable, rowOrId);
4683
+ const rowRest = fullAllDataRowIdData[rowid];
4684
+ if (rowRest) {
4685
+ return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
4686
+ }
4687
+ return 0;
4088
4688
  },
4089
4689
  /**
4090
4690
  * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
@@ -4520,10 +5120,10 @@ const Methods = {
4520
5120
  }
4521
5121
  } else if (isContextMenu) {
4522
5122
  // 如果按下上下文键
4523
- this._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
5123
+ internalData._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
4524
5124
  clearTimeout(internalData.keyCtxTimeout);
4525
5125
  internalData.keyCtxTimeout = setTimeout(() => {
4526
- this._keyCtx = false;
5126
+ internalData._keyCtx = false;
4527
5127
  }, 1000);
4528
5128
  } else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
4529
5129
  const {
@@ -4803,53 +5403,45 @@ const Methods = {
4803
5403
  this.updateCellAreas();
4804
5404
  this.recalculate(true);
4805
5405
  },
4806
- handleTargetEnterEvent(isClear) {
4807
- const $tooltip = this.$refs.tooltip;
4808
- clearTimeout(this.tooltipTimeout);
4809
- if (isClear) {
4810
- this.closeTooltip();
4811
- } else {
4812
- if ($tooltip) {
4813
- $tooltip.setActived(true);
4814
- }
4815
- }
4816
- },
4817
5406
  handleTargetLeaveEvent() {
4818
- const tooltipOpts = this.tooltipOpts;
4819
- let $tooltip = this.$refs.tooltip;
4820
- if ($tooltip) {
5407
+ const $xeTable = this;
5408
+ const internalData = $xeTable;
5409
+ const tooltipOpts = $xeTable.computeTooltipOpts;
5410
+ let $tooltip = $xeTable.$refs.refTooltip;
5411
+ if ($tooltip && $tooltip.setActived) {
4821
5412
  $tooltip.setActived(false);
4822
5413
  }
4823
5414
  if (tooltipOpts.enterable) {
4824
- this.tooltipTimeout = setTimeout(() => {
4825
- $tooltip = this.$refs.tooltip;
4826
- if ($tooltip && !$tooltip.isActived()) {
4827
- this.closeTooltip();
5415
+ internalData.tooltipTimeout = setTimeout(() => {
5416
+ $tooltip = $xeTable.$refs.refTooltip;
5417
+ if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
5418
+ $xeTable.closeTooltip();
4828
5419
  }
4829
5420
  }, tooltipOpts.leaveDelay);
4830
5421
  } else {
4831
- this.closeTooltip();
5422
+ $xeTable.closeTooltip();
4832
5423
  }
4833
5424
  },
4834
5425
  triggerHeaderTitleEvent(evnt, iconParams, params) {
5426
+ const $xeTable = this;
5427
+ const reactData = $xeTable;
4835
5428
  const tipContent = iconParams.content || iconParams.message;
4836
5429
  if (tipContent) {
4837
5430
  const {
4838
- $refs,
4839
5431
  tooltipStore
4840
- } = this;
5432
+ } = reactData;
4841
5433
  const {
4842
5434
  column
4843
5435
  } = params;
4844
5436
  const content = (0, _utils.getFuncText)(tipContent);
4845
- this.handleTargetEnterEvent(true);
5437
+ handleTargetEnterEvent($xeTable, true);
4846
5438
  tooltipStore.row = null;
4847
5439
  tooltipStore.column = column;
4848
5440
  tooltipStore.visible = true;
4849
5441
  tooltipStore.currOpts = iconParams;
4850
- this.$nextTick(() => {
4851
- const $tooltip = $refs.tooltip;
4852
- if ($tooltip) {
5442
+ $xeTable.$nextTick(() => {
5443
+ const $tooltip = $xeTable.$refs.refTooltip;
5444
+ if ($tooltip && $tooltip.open) {
4853
5445
  $tooltip.open(evnt.currentTarget, content);
4854
5446
  }
4855
5447
  });
@@ -4859,28 +5451,48 @@ const Methods = {
4859
5451
  * 触发表头 tooltip 事件
4860
5452
  */
4861
5453
  triggerHeaderTooltipEvent(evnt, params) {
5454
+ const $xeTable = this;
5455
+ const reactData = $xeTable;
4862
5456
  const {
4863
5457
  tooltipStore
4864
- } = this;
5458
+ } = reactData;
4865
5459
  const {
4866
5460
  column
4867
5461
  } = params;
5462
+ handleTargetEnterEvent($xeTable, true);
4868
5463
  const titleElem = evnt.currentTarget;
4869
- this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row);
5464
+ if (!titleElem) {
5465
+ return;
5466
+ }
5467
+ const cellEl = titleElem.parentElement;
5468
+ if (!cellEl) {
5469
+ return;
5470
+ }
5471
+ const thEl = cellEl.parentElement;
5472
+ if (!thEl) {
5473
+ return;
5474
+ }
4870
5475
  if (tooltipStore.column !== column || !tooltipStore.visible) {
4871
- this.handleTooltip(evnt, titleElem, titleElem, null, params);
5476
+ handleTooltip($xeTable, evnt, thEl, cellEl, null, params);
4872
5477
  }
4873
5478
  },
4874
5479
  /**
4875
5480
  * 触发单元格 tooltip 事件
4876
5481
  */
4877
5482
  triggerBodyTooltipEvent(evnt, params) {
5483
+ const $xeTable = this;
5484
+ const props = $xeTable;
5485
+ const reactData = $xeTable;
5486
+ const {
5487
+ editConfig
5488
+ } = props;
5489
+ const {
5490
+ editStore
5491
+ } = reactData;
4878
5492
  const {
4879
- editConfig,
4880
- editOpts,
4881
- editStore,
4882
5493
  tooltipStore
4883
- } = this;
5494
+ } = reactData;
5495
+ const editOpts = $xeTable.computeEditOpts;
4884
5496
  const {
4885
5497
  actived
4886
5498
  } = editStore;
@@ -4888,8 +5500,8 @@ const Methods = {
4888
5500
  row,
4889
5501
  column
4890
5502
  } = params;
4891
- const cell = evnt.currentTarget;
4892
- this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row);
5503
+ const tdEl = evnt.currentTarget;
5504
+ handleTargetEnterEvent($xeTable, tooltipStore.column !== column || tooltipStore.row !== row);
4893
5505
  // 单元格处于编辑状态时不触发提示框
4894
5506
  if (column.editRender && (0, _utils.isEnableConf)(editConfig)) {
4895
5507
  // 如果是行编辑模式
@@ -4902,80 +5514,26 @@ const Methods = {
4902
5514
  }
4903
5515
  }
4904
5516
  if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
4905
- let overflowElem;
4906
- let tipElem;
4907
- if (column.treeNode) {
4908
- overflowElem = cell.querySelector('.vxe-tree-cell');
4909
- if (column.type === 'html') {
4910
- tipElem = cell.querySelector('.vxe-cell--html');
4911
- }
4912
- } else {
4913
- tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
4914
- }
4915
- this.handleTooltip(evnt, cell, overflowElem || cell.children[0], tipElem, params);
5517
+ handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), null, params);
4916
5518
  }
4917
5519
  },
4918
5520
  /**
4919
5521
  * 触发表尾 tooltip 事件
4920
5522
  */
4921
5523
  triggerFooterTooltipEvent(evnt, params) {
5524
+ const $xeTable = this;
5525
+ const reactData = $xeTable;
4922
5526
  const {
4923
5527
  column
4924
5528
  } = params;
4925
5529
  const {
4926
5530
  tooltipStore
4927
- } = this;
5531
+ } = reactData;
4928
5532
  const cell = evnt.currentTarget;
4929
- this.handleTargetEnterEvent(true);
5533
+ handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
4930
5534
  if (tooltipStore.column !== column || !tooltipStore.visible) {
4931
- this.handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--item') || cell.children[0], null, params);
4932
- }
4933
- },
4934
- /**
4935
- * 处理显示 tooltip
4936
- * @param {Event} evnt 事件
4937
- * @param {ColumnInfo} column 列配置
4938
- * @param {Row} row 行对象
4939
- */
4940
- handleTooltip(evnt, cell, overflowElem, tipElem, params) {
4941
- const $xeTable = this;
4942
- if (!overflowElem) {
4943
- return $xeTable.$nextTick();
4944
- }
4945
- params.cell = cell;
4946
- const {
4947
- $refs,
4948
- tooltipOpts,
4949
- tooltipStore
4950
- } = this;
4951
- const {
4952
- column,
4953
- row
4954
- } = params;
4955
- const {
4956
- showAll,
4957
- enabled,
4958
- contentMethod
4959
- } = tooltipOpts;
4960
- const customContent = contentMethod ? contentMethod(params) : null;
4961
- const useCustom = contentMethod && !_xeUtils.default.eqNull(customContent);
4962
- const content = useCustom ? customContent : (column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
4963
- const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
4964
- if (content && (showAll || enabled || useCustom || isCellOverflow)) {
4965
- Object.assign(tooltipStore, {
4966
- row,
4967
- column,
4968
- visible: true,
4969
- currOpts: {}
4970
- });
4971
- this.$nextTick(() => {
4972
- const $tooltip = $refs.tooltip;
4973
- if ($tooltip) {
4974
- $tooltip.open(isCellOverflow ? overflowElem : tipElem || overflowElem, (0, _utils.formatText)(content));
4975
- }
4976
- });
5535
+ handleTooltip($xeTable, evnt, cell, cell.querySelector('.vxe-cell--wrapper') || cell.children[0], null, params);
4977
5536
  }
4978
- return this.$nextTick();
4979
5537
  },
4980
5538
  openTooltip(target, content) {
4981
5539
  const {
@@ -4991,12 +5549,13 @@ const Methods = {
4991
5549
  * 关闭 tooltip
4992
5550
  */
4993
5551
  closeTooltip() {
5552
+ const $xeTable = this;
5553
+ const reactData = $xeTable;
4994
5554
  const {
4995
- $refs,
4996
5555
  tooltipStore
4997
- } = this;
4998
- const tooltip = $refs.tooltip;
4999
- const commTip = $refs.refCommTooltip;
5556
+ } = reactData;
5557
+ const tooltip = $xeTable.$refs.refTooltip;
5558
+ const commTip = $xeTable.$refs.refCommTooltip;
5000
5559
  if (tooltipStore.visible) {
5001
5560
  Object.assign(tooltipStore, {
5002
5561
  row: null,
@@ -6217,10 +6776,13 @@ const Methods = {
6217
6776
  this.hoverRow = null;
6218
6777
  },
6219
6778
  triggerHeaderCellClickEvent(evnt, params) {
6779
+ const $xeTable = this;
6780
+ const internalData = $xeTable;
6220
6781
  const {
6221
- _lastResizeTime,
6222
- sortOpts
6223
- } = this;
6782
+ _lastResizeTime
6783
+ } = internalData;
6784
+ const sortOpts = $xeTable.computeSortOpts;
6785
+ const columnOpts = $xeTable.computeColumnOpts;
6224
6786
  const {
6225
6787
  column
6226
6788
  } = params;
@@ -6229,18 +6791,18 @@ const Methods = {
6229
6791
  const triggerSort = (0, _dom.getEventTargetNode)(evnt, cell, 'vxe-cell--sort').flag;
6230
6792
  const triggerFilter = (0, _dom.getEventTargetNode)(evnt, cell, 'vxe-cell--filter').flag;
6231
6793
  if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
6232
- this.triggerSortEvent(evnt, column, getNextSortOrder(this, column));
6794
+ $xeTable.triggerSortEvent(evnt, column, getNextSortOrder($xeTable, column));
6233
6795
  }
6234
- this.emitEvent('header-cell-click', Object.assign({
6796
+ $xeTable.dispatchEvent('header-cell-click', Object.assign({
6235
6797
  triggerResizable,
6236
6798
  triggerSort,
6237
6799
  triggerFilter,
6238
6800
  cell
6239
6801
  }, params), evnt);
6240
- if (this.columnOpts.isCurrent || this.highlightCurrentColumn) {
6241
- this.triggerCurrentColumnEvent(evnt, params);
6802
+ if (columnOpts.isCurrent || $xeTable.highlightCurrentColumn) {
6803
+ $xeTable.triggerCurrentColumnEvent(evnt, params);
6242
6804
  }
6243
- return this.$nextTick();
6805
+ return $xeTable.$nextTick();
6244
6806
  },
6245
6807
  triggerHeaderCellDblclickEvent(evnt, params) {
6246
6808
  this.emitEvent('header-cell-dblclick', Object.assign({
@@ -6292,18 +6854,26 @@ const Methods = {
6292
6854
  */
6293
6855
  triggerCellClickEvent(evnt, params) {
6294
6856
  const $xeTable = this;
6857
+ const props = $xeTable;
6858
+ const reactData = $xeTable;
6295
6859
  const {
6296
6860
  highlightCurrentRow,
6861
+ editConfig
6862
+ } = props;
6863
+ const {
6297
6864
  editStore,
6298
- radioOpts,
6299
- expandOpts,
6300
- treeOpts,
6301
- keyboardOpts,
6302
- editConfig,
6303
- editOpts,
6304
- checkboxOpts,
6305
- rowOpts
6306
- } = this;
6865
+ isDragResize
6866
+ } = reactData;
6867
+ if (isDragResize) {
6868
+ return;
6869
+ }
6870
+ const expandOpts = $xeTable.computeExpandOpts;
6871
+ const editOpts = $xeTable.computeEditOpts;
6872
+ const treeOpts = $xeTable.computeTreeOpts;
6873
+ const radioOpts = $xeTable.computeRadioOpts;
6874
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
6875
+ const keyboardOpts = $xeTable.computeKeyboardOpts;
6876
+ const rowOpts = $xeTable.computeRowOpts;
6307
6877
  const {
6308
6878
  actived,
6309
6879
  focused
@@ -6402,11 +6972,20 @@ const Methods = {
6402
6972
  * 如果是双击模式,则激活为编辑状态
6403
6973
  */
6404
6974
  triggerCellDblclickEvent(evnt, params) {
6975
+ const $xeTable = this;
6976
+ const props = $xeTable;
6977
+ const reactData = $xeTable;
6978
+ const {
6979
+ editConfig
6980
+ } = props;
6405
6981
  const {
6406
6982
  editStore,
6407
- editConfig,
6408
- editOpts
6409
- } = this;
6983
+ isDragResize
6984
+ } = reactData;
6985
+ if (isDragResize) {
6986
+ return;
6987
+ }
6988
+ const editOpts = $xeTable.computeEditOpts;
6410
6989
  const {
6411
6990
  actived
6412
6991
  } = editStore;
@@ -6494,6 +7073,10 @@ const Methods = {
6494
7073
  triggerSortEvent(evnt, column, order) {
6495
7074
  const $xeTable = this;
6496
7075
  const sortOpts = $xeTable.computeSortOpts;
7076
+ const {
7077
+ multiple,
7078
+ allowClear
7079
+ } = sortOpts;
6497
7080
  const {
6498
7081
  field,
6499
7082
  sortable,
@@ -6501,7 +7084,9 @@ const Methods = {
6501
7084
  } = column;
6502
7085
  if (sortable || remoteSort) {
6503
7086
  if (!order || column.order === order) {
6504
- $xeTable.clearSort(sortOpts.multiple ? column : null);
7087
+ if (allowClear) {
7088
+ $xeTable.clearSort(multiple ? column : null);
7089
+ }
6505
7090
  } else {
6506
7091
  $xeTable.sort({
6507
7092
  field,
@@ -6636,7 +7221,8 @@ const Methods = {
6636
7221
  isPeerDrag,
6637
7222
  isCrossDrag,
6638
7223
  isSelfToChildDrag,
6639
- dragEndMethod
7224
+ dragEndMethod,
7225
+ dragToChildMethod
6640
7226
  } = rowDragOpts;
6641
7227
  const treeOpts = $xeTable.computeTreeOpts;
6642
7228
  const {
@@ -6655,13 +7241,15 @@ const Methods = {
6655
7241
  if (prevDragRow && dragRow) {
6656
7242
  // 判断是否有拖动
6657
7243
  if (prevDragRow !== dragRow) {
6658
- return Promise.resolve(dEndMethod ? dEndMethod({
7244
+ const dragParams = {
6659
7245
  oldRow: dragRow,
6660
7246
  newRow: prevDragRow,
6661
7247
  dragPos: prevDragPos,
6662
7248
  dragToChild: !!prevDragToChild,
6663
7249
  offsetIndex: dragOffsetIndex
6664
- }) : true).then(status => {
7250
+ };
7251
+ const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
7252
+ return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then(status => {
6665
7253
  if (!status) {
6666
7254
  return;
6667
7255
  }
@@ -6739,7 +7327,9 @@ const Methods = {
6739
7327
  // 根到根
6740
7328
  }
6741
7329
  const fullList = _xeUtils.default.toTreeArray(internalData.afterTreeFullData, {
6742
- children: childrenField
7330
+ key: rowField,
7331
+ parentKey: parentField,
7332
+ children: mapChildrenField
6743
7333
  });
6744
7334
  // 移出
6745
7335
  const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
@@ -6754,12 +7344,12 @@ const Methods = {
6754
7344
  childRow[parentField] = dragRow[parentField];
6755
7345
  });
6756
7346
  }
6757
- dragRow[parentField] = prevDragToChild ? prevDragRow[rowField] : prevDragRow[parentField];
7347
+ dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
6758
7348
  internalData.tableFullTreeData = _xeUtils.default.toArrayTree(fullList, {
6759
- key: treeOpts.rowField,
6760
- parentKey: treeOpts.parentField,
7349
+ key: rowField,
7350
+ parentKey: parentField,
6761
7351
  children: childrenField,
6762
- mapChildren: treeOpts.mapChildrenField
7352
+ mapChildren: mapChildrenField
6763
7353
  });
6764
7354
  }
6765
7355
  }
@@ -6779,7 +7369,7 @@ const Methods = {
6779
7369
  }
6780
7370
  reactData.isDragRowMove = true;
6781
7371
  $xeTable.handleTableData(treeConfig && transform);
6782
- $xeTable.cacheRowMap();
7372
+ $xeTable.cacheRowMap(false);
6783
7373
  updateScrollYStatus($xeTable);
6784
7374
  if (!(treeConfig && transform)) {
6785
7375
  updateAfterDataIndex($xeTable);
@@ -6796,7 +7386,7 @@ const Methods = {
6796
7386
  oldRow: dragRow,
6797
7387
  newRow: prevDragRow,
6798
7388
  dragPos: prevDragPos,
6799
- dragToChild: !!prevDragToChild,
7389
+ dragToChild: isDragToChildFlag,
6800
7390
  offsetIndex: dragOffsetIndex,
6801
7391
  _index: {
6802
7392
  newIndex: nafIndex,
@@ -6832,18 +7422,16 @@ const Methods = {
6832
7422
  prevDragRow,
6833
7423
  prevDragPos
6834
7424
  } = internalData;
6835
- if (treeConfig && prevDragToChild) {
7425
+ if (treeConfig && lazy && prevDragToChild) {
6836
7426
  // 懒加载
6837
- if (lazy) {
6838
- const newRowid = (0, _util.getRowid)($xeTable, prevDragRow);
6839
- const rowRest = fullAllDataRowIdData[newRowid];
6840
- if (prevDragRow[hasChildField]) {
6841
- if (rowRest && rowRest.treeLoaded) {
6842
- $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6843
- }
6844
- } else {
7427
+ const newRowid = (0, _util.getRowid)($xeTable, prevDragRow);
7428
+ const rowRest = fullAllDataRowIdData[newRowid];
7429
+ if (prevDragRow[hasChildField]) {
7430
+ if (rowRest && rowRest.treeLoaded) {
6845
7431
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6846
7432
  }
7433
+ } else {
7434
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6847
7435
  }
6848
7436
  } else {
6849
7437
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
@@ -6988,7 +7576,8 @@ const Methods = {
6988
7576
  isCrossDrag,
6989
7577
  isSelfToChildDrag,
6990
7578
  isToChildDrag,
6991
- dragEndMethod
7579
+ dragEndMethod,
7580
+ dragToChildMethod
6992
7581
  } = columnDragOpts;
6993
7582
  const {
6994
7583
  collectColumn
@@ -6999,13 +7588,15 @@ const Methods = {
6999
7588
  if (prevDragCol !== dragCol) {
7000
7589
  const oldColumn = dragCol;
7001
7590
  const newColumn = prevDragCol;
7002
- return Promise.resolve(dragEndMethod ? dragEndMethod({
7591
+ const dragParams = {
7003
7592
  oldColumn,
7004
7593
  newColumn,
7005
7594
  dragPos: prevDragPos,
7006
7595
  dragToChild: !!prevDragToChild,
7007
7596
  offsetIndex: dragOffsetIndex
7008
- }) : true).then(status => {
7597
+ };
7598
+ const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
7599
+ return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
7009
7600
  if (!status) {
7010
7601
  return;
7011
7602
  }
@@ -7101,7 +7692,7 @@ const Methods = {
7101
7692
  parent: nParent
7102
7693
  } = newMatchRest;
7103
7694
  // 转子级
7104
- if (isCrossDrag && isToChildDrag && prevDragToChild) {
7695
+ if (isCrossDrag && isToChildDrag && isDragToChildFlag) {
7105
7696
  oldColumn.parentId = newColumn.id;
7106
7697
  newColumn.children = (newColumn.children || []).concat([oldColumn]);
7107
7698
  } else {
@@ -7132,7 +7723,7 @@ const Methods = {
7132
7723
  oldColumn,
7133
7724
  newColumn,
7134
7725
  dragPos: prevDragPos,
7135
- dragToChild: !!prevDragToChild,
7726
+ dragToChild: isDragToChildFlag,
7136
7727
  offsetIndex: dragOffsetIndex,
7137
7728
  _index: {
7138
7729
  newIndex: nafIndex,
@@ -8383,17 +8974,22 @@ const Methods = {
8383
8974
  * 获取表格的滚动状态
8384
8975
  */
8385
8976
  getScroll() {
8977
+ const $xeTable = this;
8978
+ const reactData = $xeTable;
8979
+ const internalData = $xeTable;
8386
8980
  const {
8387
- $refs,
8388
8981
  scrollXLoad,
8389
8982
  scrollYLoad
8390
- } = this;
8391
- const bodyElem = $refs.refTableBody.$el;
8983
+ } = reactData;
8984
+ const {
8985
+ elemStore
8986
+ } = internalData;
8987
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
8392
8988
  return {
8393
8989
  virtualX: scrollXLoad,
8394
8990
  virtualY: scrollYLoad,
8395
- scrollTop: bodyElem.scrollTop,
8396
- scrollLeft: bodyElem.scrollLeft
8991
+ scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
8992
+ scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
8397
8993
  };
8398
8994
  },
8399
8995
  handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
@@ -8501,60 +9097,6 @@ const Methods = {
8501
9097
  }
8502
9098
  $xeTable.dispatchEvent('scroll', evntParams, evnt);
8503
9099
  },
8504
- lazyScrollXData() {
8505
- const $xeTable = this;
8506
- const internalData = $xeTable;
8507
- const {
8508
- lxTimeout,
8509
- lxRunTime,
8510
- scrollXStore
8511
- } = internalData;
8512
- const {
8513
- visibleSize
8514
- } = scrollXStore;
8515
- const fpsTime = Math.max(5, Math.min(80, Math.floor(visibleSize * 3)));
8516
- if (lxTimeout) {
8517
- clearTimeout(lxTimeout);
8518
- }
8519
- if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
8520
- internalData.lxRunTime = Date.now();
8521
- loadScrollXData($xeTable);
8522
- }
8523
- internalData.lxTimeout = setTimeout(() => {
8524
- internalData.lxTimeout = undefined;
8525
- internalData.lxRunTime = undefined;
8526
- loadScrollXData($xeTable);
8527
- }, fpsTime);
8528
- },
8529
- lazyScrollYData() {
8530
- const $xeTable = this;
8531
- const props = $xeTable;
8532
- const internalData = $xeTable;
8533
- const {
8534
- showOverflow
8535
- } = props;
8536
- const {
8537
- lyTimeout,
8538
- lyRunTime,
8539
- scrollYStore
8540
- } = internalData;
8541
- const {
8542
- visibleSize
8543
- } = scrollYStore;
8544
- const fpsTime = showOverflow ? 5 : Math.max(5, Math.min(80, Math.floor(visibleSize / 2)));
8545
- if (lyTimeout) {
8546
- clearTimeout(lyTimeout);
8547
- }
8548
- if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
8549
- internalData.lyRunTime = Date.now();
8550
- loadScrollYData($xeTable);
8551
- }
8552
- internalData.lyTimeout = setTimeout(() => {
8553
- internalData.lyTimeout = undefined;
8554
- internalData.lyRunTime = undefined;
8555
- loadScrollYData($xeTable);
8556
- }, fpsTime);
8557
- },
8558
9100
  /**
8559
9101
  * 横向 X 可视渲染事件处理
8560
9102
  */
@@ -8564,7 +9106,7 @@ const Methods = {
8564
9106
  if (sXOpts.immediate) {
8565
9107
  loadScrollXData($xeTable);
8566
9108
  } else {
8567
- $xeTable.lazyScrollXData();
9109
+ lazyScrollXData($xeTable);
8568
9110
  }
8569
9111
  },
8570
9112
  /**
@@ -8576,7 +9118,7 @@ const Methods = {
8576
9118
  if (sYOpts.immediate) {
8577
9119
  loadScrollYData($xeTable);
8578
9120
  } else {
8579
- $xeTable.lazyScrollYData();
9121
+ lazyScrollYData($xeTable);
8580
9122
  }
8581
9123
  },
8582
9124
  triggerBodyScrollEvent(evnt, fixedType) {
@@ -8584,6 +9126,7 @@ const Methods = {
8584
9126
  const internalData = $xeTable;
8585
9127
  const {
8586
9128
  elemStore,
9129
+ intoRunScroll,
8587
9130
  lastScrollTop,
8588
9131
  lastScrollLeft,
8589
9132
  inWheelScroll,
@@ -8603,6 +9146,9 @@ const Methods = {
8603
9146
  if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
8604
9147
  return;
8605
9148
  }
9149
+ if (intoRunScroll) {
9150
+ return;
9151
+ }
8606
9152
  if (!bodyScrollElem) {
8607
9153
  return;
8608
9154
  }
@@ -8661,6 +9207,7 @@ const Methods = {
8661
9207
  const internalData = $xeTable;
8662
9208
  const {
8663
9209
  elemStore,
9210
+ intoRunScroll,
8664
9211
  inWheelScroll,
8665
9212
  inVirtualScroll,
8666
9213
  inBodyScroll,
@@ -8671,16 +9218,10 @@ const Methods = {
8671
9218
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
8672
9219
  const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
8673
9220
  const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
8674
- if (inWheelScroll) {
8675
- return;
8676
- }
8677
- if (inVirtualScroll) {
8678
- return;
8679
- }
8680
- if (inBodyScroll) {
9221
+ if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
8681
9222
  return;
8682
9223
  }
8683
- if (inFooterScroll) {
9224
+ if (intoRunScroll) {
8684
9225
  return;
8685
9226
  }
8686
9227
  if (!headerScrollElem) {
@@ -8711,6 +9252,7 @@ const Methods = {
8711
9252
  const internalData = $xeTable;
8712
9253
  const {
8713
9254
  elemStore,
9255
+ intoRunScroll,
8714
9256
  inWheelScroll,
8715
9257
  inVirtualScroll,
8716
9258
  inHeaderScroll,
@@ -8721,16 +9263,10 @@ const Methods = {
8721
9263
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
8722
9264
  const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
8723
9265
  const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
8724
- if (inWheelScroll) {
8725
- return;
8726
- }
8727
- if (inVirtualScroll) {
8728
- return;
8729
- }
8730
- if (inHeaderScroll) {
9266
+ if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
8731
9267
  return;
8732
9268
  }
8733
- if (inBodyScroll) {
9269
+ if (intoRunScroll) {
8734
9270
  return;
8735
9271
  }
8736
9272
  if (!footerScrollElem) {
@@ -8762,9 +9298,13 @@ const Methods = {
8762
9298
  const reactData = $xeTable;
8763
9299
  const internalData = $xeTable;
8764
9300
  const {
9301
+ target,
8765
9302
  deltaY,
8766
9303
  deltaX
8767
9304
  } = evnt;
9305
+ if (target && /^textarea$/i.test(target.tagName)) {
9306
+ return;
9307
+ }
8768
9308
  const {
8769
9309
  highlightHoverRow
8770
9310
  } = tableProps;
@@ -8788,26 +9328,13 @@ const Methods = {
8788
9328
  if (!bodyScrollElem) {
8789
9329
  return;
8790
9330
  }
8791
- let multiple = 1;
8792
- if (reactData.lastScrollTime + 25 > Date.now()) {
8793
- multiple = 1.18;
8794
- } else if (reactData.lastScrollTime + 30 > Date.now()) {
8795
- multiple = 1.15;
8796
- } else if (reactData.lastScrollTime + 40 > Date.now()) {
8797
- multiple = 1.12;
8798
- } else if (reactData.lastScrollTime + 55 > Date.now()) {
8799
- multiple = 1.09;
8800
- } else if (reactData.lastScrollTime + 75 > Date.now()) {
8801
- multiple = 1.06;
8802
- } else if (reactData.lastScrollTime + 100 > Date.now()) {
8803
- multiple = 1.03;
8804
- }
8805
- const deltaTop = deltaY * multiple;
8806
- const deltaLeft = deltaX * multiple;
9331
+ const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
9332
+ const deltaTop = deltaY * wheelSpeed;
9333
+ const deltaLeft = deltaX * wheelSpeed;
8807
9334
  const isTopWheel = deltaTop < 0;
8808
- const currScrollTop = yHandleEl.scrollTop;
9335
+ const currScrollTop = bodyScrollElem.scrollTop;
8809
9336
  // 如果滚动位置已经是顶部或底部,则不需要触发
8810
- if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= yHandleEl.scrollHeight - yHandleEl.clientHeight) {
9337
+ if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
8811
9338
  return;
8812
9339
  }
8813
9340
  const scrollTop = bodyScrollElem.scrollTop + deltaTop;
@@ -8820,16 +9347,29 @@ const Methods = {
8820
9347
  if (rowOpts.isHover || highlightHoverRow) {
8821
9348
  $xeTable.clearHoverRow();
8822
9349
  }
8823
- internalData.inWheelScroll = true;
8824
- (0, _dom.setScrollTop)(yHandleEl, scrollTop);
8825
- (0, _dom.setScrollTop)(bodyScrollElem, scrollTop);
8826
- (0, _dom.setScrollTop)(leftScrollElem, scrollTop);
8827
- (0, _dom.setScrollTop)(rightScrollElem, scrollTop);
8828
- $xeTable.triggerScrollYEvent(evnt);
8829
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
8830
- type: 'footer',
8831
- fixed: ''
9350
+ wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, offsetTop => {
9351
+ const currTopNum = bodyScrollElem.scrollTop + offsetTop;
9352
+ internalData.inWheelScroll = true;
9353
+ (0, _dom.setScrollTop)(yHandleEl, currTopNum);
9354
+ (0, _dom.setScrollTop)(bodyScrollElem, currTopNum);
9355
+ (0, _dom.setScrollTop)(leftScrollElem, currTopNum);
9356
+ (0, _dom.setScrollTop)(rightScrollElem, currTopNum);
9357
+ $xeTable.triggerScrollYEvent(evnt);
9358
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
9359
+ type: 'table',
9360
+ fixed: ''
9361
+ });
8832
9362
  });
9363
+ // internalData.inWheelScroll = true
9364
+ // setScrollTop(yHandleEl, scrollTop)
9365
+ // setScrollTop(bodyScrollElem, scrollTop)
9366
+ // setScrollTop(leftScrollElem, scrollTop)
9367
+ // setScrollTop(rightScrollElem, scrollTop)
9368
+ // loadScrollYData($xeTable, scrollTop)
9369
+ // $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
9370
+ // type: 'footer',
9371
+ // fixed: ''
9372
+ // })
8833
9373
  }
8834
9374
  },
8835
9375
  triggerVirtualScrollXEvent(evnt) {
@@ -8918,15 +9458,15 @@ const Methods = {
8918
9458
  },
8919
9459
  updateScrollXData() {
8920
9460
  const $xeTable = this;
8921
- const props = $xeTable;
9461
+ const reactData = $xeTable;
8922
9462
  const {
8923
- showOverflow
8924
- } = props;
9463
+ isAllOverflow
9464
+ } = reactData;
8925
9465
  handleTableColumn($xeTable);
8926
9466
  return $xeTable.$nextTick().then(() => {
8927
9467
  handleTableColumn($xeTable);
8928
9468
  $xeTable.updateScrollXSpace();
8929
- if (!showOverflow) {
9469
+ if (!isAllOverflow) {
8930
9470
  $xeTable.updateScrollYSpace();
8931
9471
  }
8932
9472
  });
@@ -8998,49 +9538,46 @@ const Methods = {
8998
9538
  // 更新纵向 Y 可视渲染上下剩余空间大小
8999
9539
  updateScrollYSpace() {
9000
9540
  const $xeTable = this;
9001
- const props = $xeTable;
9002
9541
  const reactData = $xeTable;
9003
9542
  const internalData = $xeTable;
9004
9543
  const {
9005
- showOverflow
9006
- } = props;
9007
- const {
9008
- scrollYLoad,
9009
- rowHeight
9544
+ isAllOverflow,
9545
+ scrollYLoad
9010
9546
  } = reactData;
9011
9547
  const {
9012
9548
  scrollYStore,
9013
9549
  elemStore,
9550
+ isResizeCellHeight,
9014
9551
  afterFullData,
9015
9552
  fullAllDataRowIdData
9016
9553
  } = internalData;
9017
9554
  const {
9018
9555
  startIndex
9019
9556
  } = scrollYStore;
9557
+ const rowOpts = $xeTable.computeRowOpts;
9558
+ const cellOpts = $xeTable.computeCellOpts;
9559
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
9020
9560
  const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
9021
9561
  const containerList = ['main', 'left', 'right'];
9022
9562
  let topSpaceHeight = 0;
9023
9563
  let ySpaceHeight = 0;
9024
9564
  if (scrollYLoad) {
9025
- if (showOverflow) {
9026
- ySpaceHeight = afterFullData.length * rowHeight;
9027
- topSpaceHeight = Math.max(0, startIndex * rowHeight);
9565
+ const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
9566
+ if (!isCustomCellHeight && isAllOverflow) {
9567
+ ySpaceHeight = afterFullData.length * defaultRowHeight;
9568
+ topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
9028
9569
  } else {
9029
9570
  for (let i = 0; i < afterFullData.length; i++) {
9030
9571
  const row = afterFullData[i];
9031
9572
  const rowid = (0, _util.getRowid)($xeTable, row);
9032
- const rowRest = fullAllDataRowIdData[rowid];
9033
- if (rowRest) {
9034
- ySpaceHeight += rowRest.height || rowHeight;
9035
- }
9573
+ const rowRest = fullAllDataRowIdData[rowid] || {};
9574
+ ySpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
9036
9575
  }
9037
9576
  for (let i = 0; i < startIndex; i++) {
9038
9577
  const row = afterFullData[i];
9039
9578
  const rowid = (0, _util.getRowid)($xeTable, row);
9040
- const rowRest = fullAllDataRowIdData[rowid];
9041
- if (rowRest) {
9042
- topSpaceHeight += rowRest.height || rowHeight;
9043
- }
9579
+ const rowRest = fullAllDataRowIdData[rowid] || {};
9580
+ topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
9044
9581
  }
9045
9582
  }
9046
9583
  } else {
@@ -9065,7 +9602,7 @@ const Methods = {
9065
9602
  if (scrollYSpaceEl) {
9066
9603
  scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
9067
9604
  }
9068
- $xeTable.$nextTick(() => {
9605
+ return $xeTable.$nextTick().then(() => {
9069
9606
  updateStyle($xeTable);
9070
9607
  });
9071
9608
  },
@@ -9136,12 +9673,9 @@ const Methods = {
9136
9673
  */
9137
9674
  scrollToRow(row, fieldOrColumn) {
9138
9675
  const $xeTable = this;
9139
- const props = $xeTable;
9140
9676
  const reactData = $xeTable;
9141
9677
  const {
9142
- showOverflow
9143
- } = props;
9144
- const {
9678
+ isAllOverflow,
9145
9679
  scrollYLoad,
9146
9680
  scrollXLoad
9147
9681
  } = reactData;
@@ -9158,7 +9692,7 @@ const Methods = {
9158
9692
  }
9159
9693
  return Promise.all(rest).then(() => {
9160
9694
  if (row) {
9161
- if (!showOverflow && (scrollYLoad || scrollXLoad)) {
9695
+ if (!isAllOverflow && (scrollYLoad || scrollXLoad)) {
9162
9696
  calcCellHeight($xeTable);
9163
9697
  calcCellWidth($xeTable);
9164
9698
  }