vxe-table 3.12.10-beta.2 → 3.12.10-beta.21

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 +2 -1
  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 +55 -32
  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 +96 -64
  29. package/es/table/src/cell.js +3 -7
  30. package/es/table/src/column.js +2 -0
  31. package/es/table/src/columnInfo.js +1 -0
  32. package/es/table/src/footer.js +31 -6
  33. package/es/table/src/header.js +45 -141
  34. package/es/table/src/methods.js +918 -456
  35. package/es/table/src/props.js +6 -2
  36. package/es/table/src/table.js +299 -149
  37. package/es/table/src/util.js +67 -57
  38. package/es/table/style.css +299 -191
  39. package/es/table/style.min.css +1 -1
  40. package/es/ui/index.js +20 -10
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +299 -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 +1735 -1025
  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 +2 -1
  53. package/lib/locale/lang/en-US.min.js +1 -1
  54. package/lib/locale/lang/en-US.umd.js +2 -1
  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 +12 -2
  99. package/lib/table/module/edit/mixin.min.js +1 -1
  100. package/lib/table/module/export/mixin.js +52 -27
  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 +89 -60
  106. package/lib/table/src/body.min.js +1 -1
  107. package/lib/table/src/cell.js +3 -5
  108. package/lib/table/src/cell.min.js +1 -1
  109. package/lib/table/src/column.js +2 -0
  110. package/lib/table/src/column.min.js +1 -1
  111. package/lib/table/src/columnInfo.js +1 -0
  112. package/lib/table/src/columnInfo.min.js +1 -1
  113. package/lib/table/src/footer.js +26 -6
  114. package/lib/table/src/footer.min.js +1 -1
  115. package/lib/table/src/header.js +38 -153
  116. package/lib/table/src/header.min.js +1 -1
  117. package/lib/table/src/methods.js +1076 -551
  118. package/lib/table/src/methods.min.js +1 -1
  119. package/lib/table/src/props.js +6 -2
  120. package/lib/table/src/props.min.js +1 -1
  121. package/lib/table/src/table.js +269 -129
  122. package/lib/table/src/table.min.js +1 -1
  123. package/lib/table/src/util.js +80 -70
  124. package/lib/table/src/util.min.js +1 -1
  125. package/lib/table/style/style.css +299 -191
  126. package/lib/table/style/style.min.css +1 -1
  127. package/lib/ui/index.js +20 -10
  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 +299 -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 +2 -1
  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 +50 -27
  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 +102 -61
  158. package/packages/table/src/cell.ts +3 -7
  159. package/packages/table/src/column.ts +7 -2
  160. package/packages/table/src/columnInfo.ts +1 -0
  161. package/packages/table/src/footer.ts +31 -6
  162. package/packages/table/src/header.ts +45 -141
  163. package/packages/table/src/methods.ts +957 -461
  164. package/packages/table/src/props.ts +6 -2
  165. package/packages/table/src/table.ts +325 -149
  166. package/packages/table/src/util.ts +75 -62
  167. package/packages/ui/index.ts +21 -9
  168. package/styles/components/table.scss +352 -260
  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.1736736807414.ttf → iconfont.1737182271148.ttf} +0 -0
  174. /package/es/{iconfont.1736736807414.woff → iconfont.1737182271148.woff} +0 -0
  175. /package/es/{iconfont.1736736807414.woff2 → iconfont.1737182271148.woff2} +0 -0
  176. /package/lib/{iconfont.1736736807414.ttf → iconfont.1737182271148.ttf} +0 -0
  177. /package/lib/{iconfont.1736736807414.woff → iconfont.1737182271148.woff} +0 -0
  178. /package/lib/{iconfont.1736736807414.woff2 → iconfont.1737182271148.woff2} +0 -0
@@ -264,7 +264,7 @@ function cacheColumnMap($xeTable) {
264
264
  }
265
265
  fullColumnFieldData[field] = rest;
266
266
  } else {
267
- if (storage || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
267
+ if (storage && !type || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
268
268
  (0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
269
269
  }
270
270
  }
@@ -364,6 +364,102 @@ const updateScrollYStatus = ($xeTable, fullData) => {
364
364
  reactData.scrollYLoad = scrollYLoad;
365
365
  return scrollYLoad;
366
366
  };
367
+ function updateAfterListIndex($xeTable) {
368
+ const internalData = $xeTable;
369
+ const {
370
+ afterFullData,
371
+ fullDataRowIdData,
372
+ fullAllDataRowIdData
373
+ } = internalData;
374
+ const fullMaps = {};
375
+ afterFullData.forEach((row, index) => {
376
+ const rowid = (0, _util.getRowid)($xeTable, row);
377
+ const rowRest = fullAllDataRowIdData[rowid];
378
+ const seq = index + 1;
379
+ if (rowRest) {
380
+ rowRest.seq = seq;
381
+ rowRest._index = index;
382
+ } else {
383
+ const rest = {
384
+ row,
385
+ rowid,
386
+ seq,
387
+ index: -1,
388
+ $index: -1,
389
+ _index: index,
390
+ treeIndex: -1,
391
+ items: [],
392
+ parent: null,
393
+ level: 0,
394
+ height: 0,
395
+ resizeHeight: 0,
396
+ oTop: 0
397
+ };
398
+ fullAllDataRowIdData[rowid] = rest;
399
+ fullDataRowIdData[rowid] = rest;
400
+ }
401
+ fullMaps[rowid] = row;
402
+ });
403
+ internalData.afterFullRowMaps = fullMaps;
404
+ }
405
+ /**
406
+ * 预编译
407
+ * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
408
+ */
409
+ function updateAfterDataIndex($xeTable) {
410
+ const props = $xeTable;
411
+ const internalData = $xeTable;
412
+ const {
413
+ treeConfig
414
+ } = props;
415
+ const {
416
+ fullDataRowIdData,
417
+ fullAllDataRowIdData,
418
+ afterTreeFullData
419
+ } = internalData;
420
+ const treeOpts = $xeTable.computeTreeOpts;
421
+ const {
422
+ transform
423
+ } = treeOpts;
424
+ const childrenField = treeOpts.children || treeOpts.childrenField;
425
+ const fullMaps = {};
426
+ if (treeConfig) {
427
+ _xeUtils.default.eachTree(afterTreeFullData, (row, index, items, path) => {
428
+ const rowid = (0, _util.getRowid)($xeTable, row);
429
+ const rowRest = fullAllDataRowIdData[rowid];
430
+ const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
431
+ if (rowRest) {
432
+ rowRest.seq = seq;
433
+ rowRest.treeIndex = index;
434
+ } else {
435
+ const rest = {
436
+ row,
437
+ rowid,
438
+ seq,
439
+ index: -1,
440
+ $index: -1,
441
+ _index: -1,
442
+ treeIndex: -1,
443
+ items: [],
444
+ parent: null,
445
+ level: 0,
446
+ height: 0,
447
+ resizeHeight: 0,
448
+ oTop: 0
449
+ };
450
+ fullAllDataRowIdData[rowid] = rest;
451
+ fullDataRowIdData[rowid] = rest;
452
+ }
453
+ fullMaps[rowid] = row;
454
+ }, {
455
+ children: transform ? treeOpts.mapChildrenField : childrenField
456
+ });
457
+ internalData.afterFullRowMaps = fullMaps;
458
+ updateAfterListIndex($xeTable);
459
+ } else {
460
+ updateAfterListIndex($xeTable);
461
+ }
462
+ }
367
463
  /**
368
464
  * 如果为虚拟树,将树结构拍平
369
465
  * @returns
@@ -425,7 +521,9 @@ function updateStyle($xeTable) {
425
521
  tableColumn,
426
522
  scrollXLoad,
427
523
  scrollYLoad,
524
+ overflowX,
428
525
  scrollbarWidth,
526
+ overflowY,
429
527
  scrollbarHeight,
430
528
  columnStore,
431
529
  editStore,
@@ -449,6 +547,8 @@ function updateStyle($xeTable) {
449
547
  return;
450
548
  }
451
549
  const containerList = ['main', 'left', 'right'];
550
+ const osbWidth = overflowY ? scrollbarWidth : 0;
551
+ const osbHeight = overflowX ? scrollbarHeight : 0;
452
552
  const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
453
553
  const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
454
554
  const mouseOpts = $xeTable.computeMouseOpts;
@@ -456,16 +556,16 @@ function updateStyle($xeTable) {
456
556
  const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
457
557
  if (emptyPlaceholderElem) {
458
558
  emptyPlaceholderElem.style.top = `${headerHeight}px`;
459
- emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : '';
559
+ emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
460
560
  }
461
561
  let bodyHeight = 0;
462
562
  let bodyMaxHeight = 0;
463
- const bodyMinHeight = customMinHeight - headerHeight - footerHeight - scrollbarHeight;
563
+ const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
464
564
  if (customMaxHeight) {
465
- bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - scrollbarHeight);
565
+ bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
466
566
  }
467
567
  if (customHeight) {
468
- bodyHeight = customHeight - headerHeight - footerHeight - scrollbarHeight;
568
+ bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
469
569
  }
470
570
  if (!bodyHeight) {
471
571
  if (bodyTableElem) {
@@ -478,35 +578,42 @@ function updateStyle($xeTable) {
478
578
  }
479
579
  bodyHeight = Math.max(bodyMinHeight, bodyHeight);
480
580
  }
581
+ const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
582
+ const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
583
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
481
584
  const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
482
585
  if (scrollXVirtualEl) {
483
- scrollXVirtualEl.style.height = `${scrollbarHeight}px`;
484
- scrollXVirtualEl.style.visibility = scrollbarHeight ? 'visible' : 'hidden';
586
+ scrollXVirtualEl.style.height = `${osbHeight}px`;
587
+ scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
485
588
  }
486
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
487
- if (xHandleEl) {
488
- xHandleEl.style.width = `${el.clientWidth - scrollbarWidth}px`;
589
+ const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
590
+ if (xWrapperEl) {
591
+ xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
592
+ xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
593
+ }
594
+ if (xLeftCornerEl) {
595
+ xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
596
+ xLeftCornerEl.style.display = scrollbarXToTop ? osbWidth && osbHeight ? 'block' : '' : '';
489
597
  }
490
- const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
491
598
  if (xRightCornerEl) {
492
- xRightCornerEl.style.width = `${scrollbarWidth}px`;
493
- xRightCornerEl.style.display = scrollbarWidth && scrollbarHeight ? 'block' : '';
599
+ xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
600
+ xRightCornerEl.style.display = scrollbarXToTop ? '' : osbWidth && osbHeight ? 'block' : '';
494
601
  }
495
602
  const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
496
603
  if (scrollYVirtualEl) {
497
- scrollYVirtualEl.style.width = `${scrollbarWidth}px`;
604
+ scrollYVirtualEl.style.width = `${osbWidth}px`;
498
605
  scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
499
- scrollYVirtualEl.style.visibility = scrollbarWidth ? 'visible' : 'hidden';
606
+ scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden';
500
607
  }
501
608
  const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
502
609
  if (yTopCornerEl) {
503
610
  yTopCornerEl.style.height = `${headerHeight}px`;
504
611
  yTopCornerEl.style.display = headerHeight ? 'block' : '';
505
612
  }
506
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
507
- if (yHandleEl) {
508
- yHandleEl.style.height = `${bodyHeight}px`;
509
- yHandleEl.style.top = `${headerHeight}px`;
613
+ const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem;
614
+ if (yWrapperEl) {
615
+ yWrapperEl.style.height = `${bodyHeight}px`;
616
+ yWrapperEl.style.top = `${headerHeight}px`;
510
617
  }
511
618
  const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem;
512
619
  if (yBottomCornerEl) {
@@ -615,7 +722,7 @@ function updateStyle($xeTable) {
615
722
  if (wrapperElem) {
616
723
  wrapperElem.style.top = `${headerHeight}px`;
617
724
  }
618
- fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + headerHeight + footerHeight + scrollbarHeight}px`;
725
+ fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + headerHeight + footerHeight + osbHeight}px`;
619
726
  fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
620
727
  }
621
728
  let tWidth = tableWidth;
@@ -644,7 +751,7 @@ function updateStyle($xeTable) {
644
751
  if (tableElem) {
645
752
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
646
753
  // 兼容性处理
647
- tableElem.style.paddingRight = scrollbarWidth && fixedType && (_dom.browse['-moz'] || _dom.browse.safari) ? `${scrollbarWidth}px` : '';
754
+ tableElem.style.paddingRight = osbWidth && fixedType && (_dom.browse['-moz'] || _dom.browse.safari) ? `${osbWidth}px` : '';
648
755
  }
649
756
  const emptyBlockElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-emptyBlock`]);
650
757
  if (emptyBlockElem) {
@@ -679,7 +786,7 @@ function updateStyle($xeTable) {
679
786
  // 如果是固定列
680
787
  if (fixedWrapperElem) {
681
788
  if (wrapperElem) {
682
- wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - scrollbarHeight : tableHeight + headerHeight}px`;
789
+ wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`;
683
790
  }
684
791
  }
685
792
  }
@@ -750,62 +857,69 @@ function updateStyle($xeTable) {
750
857
  return $xeTable.$nextTick();
751
858
  }
752
859
  function computeRowHeight($xeTable) {
860
+ const props = $xeTable;
861
+ const {
862
+ showOverflow
863
+ } = props;
753
864
  const tableHeader = $xeTable.$refs.refTableHeader;
754
865
  const tableBody = $xeTable.$refs.refTableBody;
755
866
  const tableBodyElem = tableBody ? tableBody.$el : null;
756
867
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
757
868
  let rowHeight = 0;
758
- if (tableBodyElem) {
759
- const tableHeaderElem = tableHeader ? tableHeader.$el : null;
760
- let firstTrElem;
761
- firstTrElem = tableBodyElem.querySelector('tr');
762
- if (!firstTrElem && tableHeaderElem) {
763
- firstTrElem = tableHeaderElem.querySelector('tr');
869
+ if (showOverflow) {
870
+ if (tableBodyElem) {
871
+ const tableHeaderElem = tableHeader ? tableHeader.$el : null;
872
+ let firstTrElem;
873
+ firstTrElem = tableBodyElem.querySelector('tr');
874
+ if (!firstTrElem && tableHeaderElem) {
875
+ firstTrElem = tableHeaderElem.querySelector('tr');
876
+ }
877
+ if (firstTrElem) {
878
+ rowHeight = firstTrElem.clientHeight;
879
+ }
764
880
  }
765
- if (firstTrElem) {
766
- rowHeight = firstTrElem.clientHeight;
881
+ if (!rowHeight) {
882
+ rowHeight = defaultRowHeight;
767
883
  }
768
- }
769
- if (!rowHeight) {
884
+ } else {
770
885
  rowHeight = defaultRowHeight;
771
886
  }
772
887
  // 最低支持 18px 行高
773
888
  return Math.max(18, rowHeight);
774
889
  }
775
- function handleVirtualYVisible($xeTable) {
890
+ function handleVirtualYVisible($xeTable, currScrollTop) {
776
891
  const props = $xeTable;
777
- const reactData = $xeTable;
778
892
  const internalData = $xeTable;
779
893
  const {
780
894
  showOverflow
781
895
  } = props;
782
- const {
783
- rowHeight
784
- } = reactData;
785
896
  const {
786
897
  elemStore,
898
+ isResizeCellHeight,
787
899
  afterFullData,
788
900
  fullAllDataRowIdData
789
901
  } = internalData;
902
+ const rowOpts = $xeTable.computeRowOpts;
903
+ const cellOpts = $xeTable.computeCellOpts;
904
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
790
905
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
791
906
  if (bodyScrollElem) {
792
- const {
793
- scrollTop,
794
- clientHeight
795
- } = bodyScrollElem;
907
+ const clientHeight = bodyScrollElem.clientHeight;
908
+ const scrollTop = _xeUtils.default.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop;
796
909
  const endHeight = scrollTop + clientHeight;
797
910
  let toVisibleIndex = -1;
798
911
  let offsetTop = 0;
799
912
  let visibleSize = 0;
800
- if (showOverflow) {
801
- toVisibleIndex = Math.floor(scrollTop / rowHeight);
802
- visibleSize = Math.ceil(clientHeight / rowHeight) + 1;
913
+ const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
914
+ if (!isCustomCellHeight && showOverflow) {
915
+ toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
916
+ visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
803
917
  } else {
804
918
  for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
805
919
  const row = afterFullData[rIndex];
806
920
  const rowid = (0, _util.getRowid)($xeTable, row);
807
921
  const rowRest = fullAllDataRowIdData[rowid];
808
- offsetTop += rowRest ? rowRest.height || rowHeight : rowHeight;
922
+ offsetTop += rowRest ? rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight : defaultRowHeight;
809
923
  if (toVisibleIndex === -1 && scrollTop < offsetTop) {
810
924
  toVisibleIndex = rIndex;
811
925
  }
@@ -1093,7 +1207,7 @@ function autoCellWidth($xeTable) {
1093
1207
  }
1094
1208
  const tableHeight = bodyElem.offsetHeight;
1095
1209
  const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
1096
- reactData.scrollbarWidth = overflowY ? Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth) : 0;
1210
+ reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
1097
1211
  reactData.overflowY = overflowY;
1098
1212
  internalData.tableWidth = tableWidth;
1099
1213
  internalData.tableHeight = tableHeight;
@@ -1102,7 +1216,7 @@ function autoCellWidth($xeTable) {
1102
1216
  const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
1103
1217
  const overflowX = tableWidth > bodyWidth;
1104
1218
  const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
1105
- reactData.scrollbarHeight = overflowX ? Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight) : 0;
1219
+ reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
1106
1220
  internalData.headerHeight = headerHeight;
1107
1221
  internalData.footerHeight = footerHeight;
1108
1222
  reactData.overflowX = overflowX;
@@ -1112,20 +1226,22 @@ function autoCellWidth($xeTable) {
1112
1226
  $xeTable.checkScrolling();
1113
1227
  }
1114
1228
  }
1115
- // const updateCellOffset = ($xeTable: VxeTableConstructor) => {
1116
- // const internalData = $xeTable as unknown as TableInternalData
1117
- // const { chTimeout, chRunTime } = internalData
1118
- // if (chTimeout) {
1119
- // clearTimeout(chTimeout)
1120
- // }
1121
- // if (!chRunTime || chRunTime + 10 < Date.now()) {
1122
- // internalData.chRunTime = Date.now()
1123
- // }
1124
- // internalData.chTimeout = setTimeout(() => {
1125
- // internalData.chRunTime = undefined
1126
- // internalData.chTimeout = undefined
1127
- // }, 80)
1128
- // }
1229
+ const calcCellAutoHeight = (rowRest, wrapperEl) => {
1230
+ const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
1231
+ let topBottomPadding = 0;
1232
+ const firstCellEl = cellElemList[0];
1233
+ if (firstCellEl && firstCellEl.parentElement) {
1234
+ const cellStyle = getComputedStyle(firstCellEl.parentElement);
1235
+ topBottomPadding = Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingTop) + _xeUtils.default.toNumber(cellStyle.paddingBottom));
1236
+ }
1237
+ let colHeight = rowRest.height - topBottomPadding;
1238
+ for (let i = 0; i < cellElemList.length; i++) {
1239
+ const cellElem = cellElemList[i];
1240
+ const cellHeight = cellElem ? cellElem.clientHeight : 0;
1241
+ colHeight = Math.max(colHeight, Math.ceil(cellHeight));
1242
+ }
1243
+ return colHeight + topBottomPadding;
1244
+ };
1129
1245
  const calcCellHeight = $xeTable => {
1130
1246
  const props = $xeTable;
1131
1247
  const reactData = $xeTable;
@@ -1135,45 +1251,25 @@ const calcCellHeight = $xeTable => {
1135
1251
  } = props;
1136
1252
  const {
1137
1253
  tableData,
1254
+ scrollYLoad,
1138
1255
  scrollXLoad
1139
1256
  } = reactData;
1140
1257
  const {
1141
1258
  fullAllDataRowIdData
1142
1259
  } = internalData;
1260
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
1143
1261
  const el = $xeTable.$refs.refElem;
1144
- if (!showOverflow && el) {
1145
- let paddingTop = 0;
1146
- let paddingBottom = 0;
1147
- let calcPadding = false;
1262
+ if (!showOverflow && scrollYLoad && el) {
1148
1263
  tableData.forEach(row => {
1149
1264
  const rowid = (0, _util.getRowid)($xeTable, row);
1150
1265
  const rowRest = fullAllDataRowIdData[rowid];
1151
- const cellList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]>.vxe-body--column>.vxe-cell`);
1152
- if (rowRest && cellList.length) {
1153
- let height = 0;
1154
- for (let i = 0; i < cellList.length; i++) {
1155
- const cellElem = cellList[i];
1156
- const tdEl = cellElem.parentElement;
1157
- if (!tdEl || !tdEl.clientWidth) {
1158
- break;
1159
- }
1160
- if (!calcPadding) {
1161
- paddingTop = _xeUtils.default.toNumber(getComputedStyle(tdEl).paddingTop);
1162
- paddingBottom = _xeUtils.default.toNumber(getComputedStyle(tdEl).paddingBottom);
1163
- calcPadding = true;
1164
- }
1165
- let cellHeight = paddingTop + paddingBottom;
1166
- if (cellElem) {
1167
- cellHeight += cellElem.clientHeight;
1168
- }
1169
- height = Math.max(height, cellHeight);
1170
- }
1171
- rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
1266
+ if (rowRest) {
1267
+ const height = calcCellAutoHeight(rowRest, el);
1268
+ rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, height) : height);
1172
1269
  }
1173
1270
  });
1174
- reactData.isCalcCellHeight++;
1271
+ reactData.calcCellHeightFlag++;
1175
1272
  }
1176
- // updateCellOffset()
1177
1273
  };
1178
1274
  function getOrderField(_vm, column) {
1179
1275
  const {
@@ -1200,6 +1296,18 @@ function getOrderField(_vm, column) {
1200
1296
  return cellValue;
1201
1297
  };
1202
1298
  }
1299
+ function handleTargetEnterEvent($xeTable, isClear) {
1300
+ const internalData = $xeTable;
1301
+ const $tooltip = $xeTable.$refs.refTooltip;
1302
+ clearTimeout(internalData.tooltipTimeout);
1303
+ if (isClear) {
1304
+ $xeTable.closeTooltip();
1305
+ } else {
1306
+ if ($tooltip && $tooltip.setActived) {
1307
+ $tooltip.setActived(true);
1308
+ }
1309
+ }
1310
+ }
1203
1311
  function clearDragStatus($xeTable) {
1204
1312
  const reactData = $xeTable;
1205
1313
  const {
@@ -1310,29 +1418,35 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1310
1418
  return;
1311
1419
  }
1312
1420
  const {
1421
+ overflowX,
1313
1422
  scrollbarWidth,
1423
+ overflowY,
1314
1424
  scrollbarHeight
1315
1425
  } = reactData;
1316
1426
  const {
1317
1427
  prevDragToChild
1318
1428
  } = internalData;
1319
1429
  const wrapperRect = el.getBoundingClientRect();
1430
+ const osbWidth = overflowY ? scrollbarWidth : 0;
1431
+ const osbHeight = overflowX ? scrollbarHeight : 0;
1320
1432
  const tableWidth = el.clientWidth;
1321
1433
  const tableHeight = el.clientHeight;
1322
1434
  if (trEl) {
1323
1435
  const rdLineEl = $xeTable.$refs.refDragRowLineElem;
1324
1436
  if (rdLineEl) {
1325
1437
  if (showLine) {
1438
+ const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
1326
1439
  const trRect = trEl.getBoundingClientRect();
1327
1440
  let trHeight = trEl.clientHeight;
1328
1441
  const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
1329
- if (offsetTop + trHeight > tableHeight - scrollbarHeight) {
1330
- trHeight = tableHeight - offsetTop - scrollbarHeight;
1442
+ if (offsetTop + trHeight > tableHeight - osbHeight) {
1443
+ trHeight = tableHeight - offsetTop - osbHeight;
1331
1444
  }
1332
1445
  rdLineEl.style.display = 'block';
1446
+ rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
1333
1447
  rdLineEl.style.top = `${offsetTop}px`;
1334
1448
  rdLineEl.style.height = `${trHeight}px`;
1335
- rdLineEl.style.width = `${tableWidth - scrollbarWidth}px`;
1449
+ rdLineEl.style.width = `${tableWidth - osbWidth}px`;
1336
1450
  rdLineEl.setAttribute('drag-pos', dragPos);
1337
1451
  rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
1338
1452
  } else {
@@ -1343,6 +1457,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1343
1457
  const cdLineEl = $xeTable.$refs.refDragColLineElem;
1344
1458
  if (cdLineEl) {
1345
1459
  if (showLine) {
1460
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
1346
1461
  const leftContainerElem = $xeTable.$refs.refLeftContainer;
1347
1462
  const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
1348
1463
  const rightContainerElem = $xeTable.$refs.refRightContainer;
@@ -1356,7 +1471,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1356
1471
  thWidth -= startX - offsetLeft;
1357
1472
  offsetLeft = startX;
1358
1473
  }
1359
- const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : scrollbarWidth);
1474
+ const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
1360
1475
  if (offsetLeft + thWidth > endX) {
1361
1476
  thWidth = endX - offsetLeft;
1362
1477
  }
@@ -1367,7 +1482,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1367
1482
  if (prevDragToChild) {
1368
1483
  cdLineEl.style.height = `${thRect.height}px`;
1369
1484
  } else {
1370
- cdLineEl.style.height = `${tableHeight - offsetTop - scrollbarHeight}px`;
1485
+ cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
1371
1486
  }
1372
1487
  cdLineEl.setAttribute('drag-pos', dragPos);
1373
1488
  cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
@@ -1398,6 +1513,49 @@ function hideDropTip($xeTable) {
1398
1513
  cdLineEl.style.display = '';
1399
1514
  }
1400
1515
  }
1516
+ /**
1517
+ * 处理显示 tooltip
1518
+ * @param {Event} evnt 事件
1519
+ * @param {Row} row 行对象
1520
+ */
1521
+ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
1522
+ const reactData = $xeTable;
1523
+ if (!overflowElem) {
1524
+ return $xeTable.$nextTick();
1525
+ }
1526
+ params.cell = tdEl;
1527
+ const {
1528
+ tooltipStore
1529
+ } = reactData;
1530
+ const tooltipOpts = $xeTable.computeTooltipOpts;
1531
+ const {
1532
+ column,
1533
+ row
1534
+ } = params;
1535
+ const {
1536
+ showAll,
1537
+ contentMethod
1538
+ } = tooltipOpts;
1539
+ const customContent = contentMethod ? contentMethod(params) : null;
1540
+ const useCustom = contentMethod && !_xeUtils.default.eqNull(customContent);
1541
+ const content = useCustom ? customContent : _xeUtils.default.toString(column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
1542
+ const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
1543
+ if (content && (showAll || useCustom || isCellOverflow)) {
1544
+ Object.assign(tooltipStore, {
1545
+ row,
1546
+ column,
1547
+ visible: true,
1548
+ currOpts: {}
1549
+ });
1550
+ $xeTable.$nextTick(() => {
1551
+ const $tooltip = $xeTable.$refs.refTooltip;
1552
+ if ($tooltip && $tooltip.open) {
1553
+ $tooltip.open(isCellOverflow ? overflowElem : tipElem || overflowElem, (0, _utils.formatText)(content));
1554
+ }
1555
+ });
1556
+ }
1557
+ return $xeTable.$nextTick();
1558
+ }
1401
1559
  function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
1402
1560
  const internalData = $xeTable;
1403
1561
  const {
@@ -1422,16 +1580,16 @@ function computeScrollLoad($xeTable) {
1422
1580
  scrollXStore,
1423
1581
  scrollYStore
1424
1582
  } = internalData;
1425
- const sYOpts = $xeTable.computeSYOpts;
1426
- const sXOpts = $xeTable.computeSXOpts;
1583
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
1584
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
1427
1585
  // 计算 X 逻辑
1428
1586
  if (scrollXLoad) {
1429
1587
  const {
1430
1588
  toVisibleIndex: toXVisibleIndex,
1431
1589
  visibleSize: visibleXSize
1432
1590
  } = handleVirtualXVisible($xeTable);
1433
- const offsetXSize = Math.max(0, sXOpts.oSize ? _xeUtils.default.toNumber(sXOpts.oSize) : 0);
1434
- scrollXStore.preloadSize = 4;
1591
+ const offsetXSize = Math.max(0, virtualXOpts.oSize ? _xeUtils.default.toNumber(virtualXOpts.oSize) : 0);
1592
+ scrollXStore.preloadSize = _xeUtils.default.toNumber(virtualXOpts.preSize);
1435
1593
  scrollXStore.offsetSize = offsetXSize;
1436
1594
  scrollXStore.visibleSize = visibleXSize;
1437
1595
  scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
@@ -1443,7 +1601,6 @@ function computeScrollLoad($xeTable) {
1443
1601
  } else {
1444
1602
  $xeTable.updateScrollXSpace();
1445
1603
  }
1446
- calcCellHeight($xeTable);
1447
1604
  // 计算 Y 逻辑
1448
1605
  const rowHeight = computeRowHeight($xeTable);
1449
1606
  scrollYStore.rowHeight = rowHeight;
@@ -1453,8 +1610,8 @@ function computeScrollLoad($xeTable) {
1453
1610
  visibleSize: visibleYSize
1454
1611
  } = handleVirtualYVisible($xeTable);
1455
1612
  if (scrollYLoad) {
1456
- const offsetYSize = Math.max(0, sYOpts.oSize ? _xeUtils.default.toNumber(sYOpts.oSize) : 0);
1457
- scrollYStore.preloadSize = 2;
1613
+ const offsetYSize = Math.max(0, virtualYOpts.oSize ? _xeUtils.default.toNumber(virtualYOpts.oSize) : 0);
1614
+ scrollYStore.preloadSize = _xeUtils.default.toNumber(virtualYOpts.preSize);
1458
1615
  scrollYStore.offsetSize = offsetYSize;
1459
1616
  scrollYStore.visibleSize = visibleYSize;
1460
1617
  scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
@@ -1480,12 +1637,14 @@ function handleRecalculateLayout($xeTable, reFull) {
1480
1637
  }
1481
1638
  calcCellWidth($xeTable);
1482
1639
  autoCellWidth($xeTable);
1640
+ updateStyle($xeTable);
1483
1641
  return computeScrollLoad($xeTable).then(() => {
1484
1642
  if (reFull === true) {
1485
1643
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
1486
1644
  calcCellHeight($xeTable);
1487
1645
  calcCellWidth($xeTable);
1488
1646
  autoCellWidth($xeTable);
1647
+ updateStyle($xeTable);
1489
1648
  return computeScrollLoad($xeTable);
1490
1649
  }
1491
1650
  });
@@ -1764,7 +1923,7 @@ function handleColumn($xeTable, collectColumn) {
1764
1923
  /**
1765
1924
  * 纵向 Y 可视渲染处理
1766
1925
  */
1767
- function loadScrollYData($xeTable) {
1926
+ function loadScrollYData($xeTable, scrollTop) {
1768
1927
  const props = $xeTable;
1769
1928
  const reactData = $xeTable;
1770
1929
  const internalData = $xeTable;
@@ -1787,7 +1946,7 @@ function loadScrollYData($xeTable) {
1787
1946
  const {
1788
1947
  toVisibleIndex,
1789
1948
  visibleSize
1790
- } = handleVirtualYVisible($xeTable);
1949
+ } = handleVirtualYVisible($xeTable, scrollTop);
1791
1950
  const offsetItem = {
1792
1951
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
1793
1952
  endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
@@ -1807,6 +1966,54 @@ function loadScrollYData($xeTable) {
1807
1966
  }
1808
1967
  }
1809
1968
  }
1969
+ function lazyScrollXData($xeTable) {
1970
+ const internalData = $xeTable;
1971
+ const {
1972
+ lxTimeout,
1973
+ lxRunTime,
1974
+ scrollXStore
1975
+ } = internalData;
1976
+ const {
1977
+ visibleSize
1978
+ } = scrollXStore;
1979
+ const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)));
1980
+ if (lxTimeout) {
1981
+ clearTimeout(lxTimeout);
1982
+ }
1983
+ if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
1984
+ internalData.lxRunTime = Date.now();
1985
+ loadScrollXData($xeTable);
1986
+ }
1987
+ internalData.lxTimeout = setTimeout(() => {
1988
+ internalData.lxTimeout = undefined;
1989
+ internalData.lxRunTime = undefined;
1990
+ loadScrollXData($xeTable);
1991
+ }, fpsTime);
1992
+ }
1993
+ function lazyScrollYData($xeTable) {
1994
+ const internalData = $xeTable;
1995
+ const {
1996
+ lyTimeout,
1997
+ lyRunTime,
1998
+ scrollYStore
1999
+ } = internalData;
2000
+ const {
2001
+ visibleSize
2002
+ } = scrollYStore;
2003
+ const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)));
2004
+ if (lyTimeout) {
2005
+ clearTimeout(lyTimeout);
2006
+ }
2007
+ if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
2008
+ internalData.lyRunTime = Date.now();
2009
+ loadScrollYData($xeTable);
2010
+ }
2011
+ internalData.lyTimeout = setTimeout(() => {
2012
+ internalData.lyTimeout = undefined;
2013
+ internalData.lyRunTime = undefined;
2014
+ loadScrollYData($xeTable);
2015
+ }, fpsTime);
2016
+ }
1810
2017
  function checkLastSyncScroll($xeTable, isRollX, isRollY) {
1811
2018
  const reactData = $xeTable;
1812
2019
  const internalData = $xeTable;
@@ -1823,27 +2030,63 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
1823
2030
  internalData.lcsTimeout = setTimeout(() => {
1824
2031
  internalData.lcsRunTime = Date.now();
1825
2032
  internalData.lcsTimeout = undefined;
2033
+ internalData.intoRunScroll = false;
1826
2034
  internalData.inVirtualScroll = false;
1827
2035
  internalData.inWheelScroll = false;
1828
2036
  internalData.inHeaderScroll = false;
1829
2037
  internalData.inBodyScroll = false;
1830
2038
  internalData.inFooterScroll = false;
1831
2039
  internalData.scrollRenderType = '';
2040
+ calcCellHeight($xeTable);
1832
2041
  if (isRollX && scrollXLoad) {
1833
- $xeTable.updateScrollXData().then(() => {
1834
- calcCellHeight($xeTable);
1835
- loadScrollXData($xeTable);
1836
- });
2042
+ $xeTable.updateScrollXData();
1837
2043
  }
1838
2044
  if (isRollY && scrollYLoad) {
1839
2045
  $xeTable.updateScrollYData().then(() => {
1840
2046
  calcCellHeight($xeTable);
1841
- loadScrollYData($xeTable);
2047
+ $xeTable.updateScrollYSpace();
1842
2048
  });
1843
2049
  }
1844
2050
  $xeTable.updateCellAreas();
1845
2051
  }, 200);
1846
2052
  }
2053
+ const getWheelSpeed = lastScrollTime => {
2054
+ let multiple = 1;
2055
+ const currTime = Date.now();
2056
+ if (lastScrollTime + 25 > currTime) {
2057
+ multiple = 1.18;
2058
+ } else if (lastScrollTime + 30 > currTime) {
2059
+ multiple = 1.15;
2060
+ } else if (lastScrollTime + 40 > currTime) {
2061
+ multiple = 1.12;
2062
+ } else if (lastScrollTime + 55 > currTime) {
2063
+ multiple = 1.09;
2064
+ } else if (lastScrollTime + 75 > currTime) {
2065
+ multiple = 1.06;
2066
+ } else if (lastScrollTime + 100 > currTime) {
2067
+ multiple = 1.03;
2068
+ }
2069
+ return multiple;
2070
+ };
2071
+ const wheelScrollTo = (diffNum, cb) => {
2072
+ const duration = Math.abs(diffNum);
2073
+ const startTime = performance.now();
2074
+ let countTop = 0;
2075
+ const step = timestamp => {
2076
+ let progress = (timestamp - startTime) / duration;
2077
+ if (progress > 1) {
2078
+ progress = 1;
2079
+ }
2080
+ const easedProgress = Math.pow(progress, 2);
2081
+ const offsetTop = Math.floor(diffNum * easedProgress) - countTop;
2082
+ countTop += offsetTop;
2083
+ cb(offsetTop);
2084
+ if (progress < 1) {
2085
+ requestAnimationFrame(step);
2086
+ }
2087
+ };
2088
+ requestAnimationFrame(step);
2089
+ };
1847
2090
  function updateHeight($xeTable) {
1848
2091
  const internalData = $xeTable;
1849
2092
  internalData.customHeight = calcTableHeight($xeTable, 'height');
@@ -1851,59 +2094,62 @@ function updateHeight($xeTable) {
1851
2094
  internalData.customMaxHeight = calcTableHeight($xeTable, 'maxHeight');
1852
2095
  }
1853
2096
  function calcColumnAutoWidth(column, wrapperEl) {
1854
- 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`);
1855
- const firstCellEl = cellElList[0];
1856
- let paddingSize = 0;
1857
- if (firstCellEl) {
1858
- const cellStyle = getComputedStyle(firstCellEl);
1859
- paddingSize = Math.floor(_xeUtils.default.toNumber(cellStyle.paddingLeft) + _xeUtils.default.toNumber(cellStyle.paddingRight)) + 2;
2097
+ const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`);
2098
+ let leftRightPadding = 0;
2099
+ const firstCellEl = cellElemList[0];
2100
+ if (firstCellEl && firstCellEl.parentElement) {
2101
+ const cellStyle = getComputedStyle(firstCellEl.parentElement);
2102
+ leftRightPadding = Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingLeft) + _xeUtils.default.toNumber(cellStyle.paddingRight));
1860
2103
  }
1861
- let colWidth = column.renderAutoWidth - paddingSize;
1862
- _xeUtils.default.arrayEach(cellElList, itemEl => {
1863
- const cellEl = itemEl;
1864
- const thElem = cellEl.parentElement;
1865
- let titleWidth = 0;
1866
- if (`${thElem.tagName}`.toLowerCase() === 'th') {
1867
- _xeUtils.default.arrayEach(cellEl.children, btnEl => {
1868
- titleWidth += btnEl.offsetWidth + 1;
1869
- });
1870
- } else {
1871
- const labelEl = cellEl.firstElementChild;
1872
- if (labelEl) {
1873
- titleWidth = labelEl.offsetWidth;
1874
- }
1875
- }
1876
- if (titleWidth) {
1877
- colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
1878
- }
1879
- });
1880
- return colWidth + paddingSize;
2104
+ let colWidth = column.renderAutoWidth - leftRightPadding;
2105
+ for (let i = 0; i < cellElemList.length; i++) {
2106
+ const celEl = cellElemList[i];
2107
+ colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0);
2108
+ }
2109
+ return colWidth + leftRightPadding;
1881
2110
  }
1882
2111
  function calcCellWidth($xeTable) {
1883
- const reactData = $xeTable;
1884
2112
  const internalData = $xeTable;
1885
2113
  const autoWidthColumnList = $xeTable.computeAutoWidthColumnList;
1886
- reactData.isCalcColumn = true;
1887
- return $xeTable.$nextTick().then(() => {
1888
- const {
1889
- fullColumnIdData
1890
- } = internalData;
1891
- const el = $xeTable.$refs.refElem;
1892
- if (el) {
1893
- autoWidthColumnList.forEach(column => {
1894
- const colid = column.id;
1895
- const colRest = fullColumnIdData[colid];
1896
- const colWidth = calcColumnAutoWidth(column, el);
1897
- if (colRest) {
1898
- colRest.width = Math.max(colWidth, colRest.width);
1899
- }
1900
- column.renderAutoWidth = colWidth;
1901
- });
1902
- $xeTable.analyColumnWidth();
1903
- }
1904
- reactData.isCalcColumn = false;
1905
- });
2114
+ const {
2115
+ fullColumnIdData
2116
+ } = internalData;
2117
+ const el = $xeTable.$refs.refElem;
2118
+ if (el) {
2119
+ el.setAttribute('data-calc-col', 'Y');
2120
+ autoWidthColumnList.forEach(column => {
2121
+ const colid = column.id;
2122
+ const colRest = fullColumnIdData[colid];
2123
+ const colWidth = calcColumnAutoWidth(column, el);
2124
+ if (colRest) {
2125
+ colRest.width = Math.max(colWidth, colRest.width);
2126
+ }
2127
+ column.renderAutoWidth = colWidth;
2128
+ });
2129
+ $xeTable.analyColumnWidth();
2130
+ el.removeAttribute('data-calc-col');
2131
+ }
1906
2132
  }
2133
+ const handleUpdateColResize = ($xeTable, evnt, params) => {
2134
+ $xeTable.analyColumnWidth();
2135
+ $xeTable.recalculate(true).then(() => {
2136
+ $xeTable.saveCustomStore('update:width');
2137
+ $xeTable.updateCellAreas();
2138
+ $xeTable.dispatchEvent('column-resizable-change', params, evnt);
2139
+ // 已废弃 resizable-change
2140
+ $xeTable.dispatchEvent('resizable-change', params, evnt);
2141
+ setTimeout(() => $xeTable.recalculate(true), 300);
2142
+ });
2143
+ };
2144
+ const handleUpdateRowResize = ($xeTable, evnt, params) => {
2145
+ const reactData = $xeTable;
2146
+ reactData.resizeHeightFlag++;
2147
+ $xeTable.recalculate(true).then(() => {
2148
+ $xeTable.updateCellAreas();
2149
+ $xeTable.dispatchEvent('row-resizable-change', params, evnt);
2150
+ setTimeout(() => $xeTable.recalculate(true), 300);
2151
+ });
2152
+ };
1907
2153
  const Methods = {
1908
2154
  callSlot(slotFunc, params, h, vNodes) {
1909
2155
  if (slotFunc) {
@@ -1968,7 +2214,7 @@ const Methods = {
1968
2214
  (0, _log.warnLog)('vxe.error.delFunc', ['syncData', 'getData']);
1969
2215
  return this.$nextTick().then(() => {
1970
2216
  this.tableData = [];
1971
- return this.$nextTick().then(() => this.loadTableData(this.tableFullData));
2217
+ return this.$nextTick().then(() => this.loadTableData(this.tableFullData, true));
1972
2218
  });
1973
2219
  },
1974
2220
  /**
@@ -2030,8 +2276,9 @@ const Methods = {
2030
2276
  * 加载表格数据
2031
2277
  * @param {Array} datas 数据
2032
2278
  */
2033
- loadTableData(datas) {
2279
+ loadTableData(datas, isReset) {
2034
2280
  const $xeTable = this;
2281
+ const internalData = $xeTable;
2035
2282
  const {
2036
2283
  keepSource,
2037
2284
  showOverflow,
@@ -2099,9 +2346,12 @@ const Methods = {
2099
2346
  this.tableFullData = fullData;
2100
2347
  this.tableFullTreeData = treeData;
2101
2348
  // 缓存数据
2102
- this.cacheRowMap(true);
2349
+ this.cacheRowMap(isReset, true);
2103
2350
  // 原始数据
2104
2351
  this.tableSynchData = datas;
2352
+ if (isReset) {
2353
+ internalData.isResizeCellHeight = false;
2354
+ }
2105
2355
  // 克隆原数据,用于显示编辑状态,与编辑值做对比
2106
2356
  if (keepSource) {
2107
2357
  this.cacheSourceMap(fullData);
@@ -2158,6 +2408,7 @@ const Methods = {
2158
2408
  if (sYOpts.scrollToTopOnChange) {
2159
2409
  targetScrollTop = 0;
2160
2410
  }
2411
+ calcCellHeight($xeTable);
2161
2412
  // 是否变更虚拟滚动
2162
2413
  if (oldScrollYLoad === sYLoad) {
2163
2414
  (0, _util.restoreScrollLocation)(this, targetScrollLeft, targetScrollTop).then(() => {
@@ -2182,7 +2433,7 @@ const Methods = {
2182
2433
  const {
2183
2434
  initStatus
2184
2435
  } = this;
2185
- return this.loadTableData(datas).then(() => {
2436
+ return this.loadTableData(datas, false).then(() => {
2186
2437
  this.inited = true;
2187
2438
  this.initStatus = true;
2188
2439
  if (!initStatus) {
@@ -2199,7 +2450,7 @@ const Methods = {
2199
2450
  return this.clearAll().then(() => {
2200
2451
  this.inited = true;
2201
2452
  this.initStatus = true;
2202
- return this.loadTableData(datas);
2453
+ return this.loadTableData(datas, true);
2203
2454
  }).then(() => {
2204
2455
  this.handleLoadDefaults();
2205
2456
  return this.recalculate();
@@ -2280,9 +2531,8 @@ const Methods = {
2280
2531
  },
2281
2532
  /**
2282
2533
  * 更新数据行的 Map
2283
- * 牺牲数据组装的耗时,用来换取使用过程中的流畅
2284
2534
  */
2285
- cacheRowMap(isSource) {
2535
+ cacheRowMap(isReset, isSource) {
2286
2536
  const {
2287
2537
  treeConfig,
2288
2538
  treeOpts,
@@ -2308,7 +2558,7 @@ const Methods = {
2308
2558
  row[childrenField] = null;
2309
2559
  }
2310
2560
  let cacheItem = fullAllDataRowIdData[rowid];
2311
- if (!cacheItem) {
2561
+ if (isReset || !cacheItem) {
2312
2562
  cacheItem = {
2313
2563
  row,
2314
2564
  rowid,
@@ -2316,10 +2566,12 @@ const Methods = {
2316
2566
  index: -1,
2317
2567
  _index: -1,
2318
2568
  $index: -1,
2569
+ treeIndex: index,
2319
2570
  items,
2320
2571
  parent: parentRow,
2321
2572
  level,
2322
2573
  height: 0,
2574
+ resizeHeight: 0,
2323
2575
  oTop: 0
2324
2576
  };
2325
2577
  }
@@ -2420,10 +2672,12 @@ const Methods = {
2420
2672
  index,
2421
2673
  _index: -1,
2422
2674
  $index: -1,
2675
+ treeIndex: -1,
2423
2676
  items,
2424
2677
  parent: parentRow,
2425
2678
  level: parentLevel + nodes.length,
2426
2679
  height: 0,
2680
+ resizeHeight: 0,
2427
2681
  oTop: 0
2428
2682
  };
2429
2683
  fullDataRowIdData[rowid] = rest;
@@ -2435,7 +2689,7 @@ const Methods = {
2435
2689
  if (transform) {
2436
2690
  row[mapChildrenField] = _xeUtils.default.clone(rows, false);
2437
2691
  }
2438
- this.updateAfterDataIndex();
2692
+ updateAfterDataIndex($xeTable);
2439
2693
  return rows;
2440
2694
  });
2441
2695
  },
@@ -2816,20 +3070,38 @@ const Methods = {
2816
3070
  return this.$nextTick();
2817
3071
  },
2818
3072
  getCellElement(row, fieldOrColumn) {
2819
- const column = (0, _util.handleFieldOrColumn)(this, fieldOrColumn);
3073
+ const $xeTable = this;
3074
+ const internalData = $xeTable;
3075
+ const {
3076
+ elemStore
3077
+ } = internalData;
3078
+ const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
2820
3079
  if (!column) {
2821
3080
  return null;
2822
3081
  }
2823
- const {
2824
- $refs
2825
- } = this;
2826
- const rowid = (0, _util.getRowid)(this, row);
2827
- let bodyElem = null;
3082
+ const rowid = (0, _util.getRowid)($xeTable, row);
3083
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
3084
+ const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
3085
+ const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
3086
+ let bodyElem;
2828
3087
  if (column) {
2829
- bodyElem = $refs[`${column.fixed || 'table'}Body`] || $refs.refTableBody;
2830
- }
2831
- if (bodyElem && bodyElem.$el) {
2832
- return bodyElem.$el.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
3088
+ if (column.fixed) {
3089
+ if (column.fixed === 'left') {
3090
+ if (leftScrollElem) {
3091
+ bodyElem = leftScrollElem;
3092
+ }
3093
+ } else {
3094
+ if (rightScrollElem) {
3095
+ bodyElem = rightScrollElem;
3096
+ }
3097
+ }
3098
+ }
3099
+ if (!bodyElem) {
3100
+ bodyElem = bodyScrollElem;
3101
+ }
3102
+ if (bodyElem) {
3103
+ return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
3104
+ }
2833
3105
  }
2834
3106
  return null;
2835
3107
  },
@@ -3068,6 +3340,7 @@ const Methods = {
3068
3340
  * 如果存在筛选条件,继续处理
3069
3341
  */
3070
3342
  updateAfterFullData() {
3343
+ const $xeTable = this;
3071
3344
  const {
3072
3345
  tableFullColumn,
3073
3346
  tableFullData,
@@ -3272,7 +3545,7 @@ const Methods = {
3272
3545
  }
3273
3546
  this.afterFullData = tableData;
3274
3547
  this.afterTreeFullData = tableTree;
3275
- this.updateAfterDataIndex();
3548
+ updateAfterDataIndex($xeTable);
3276
3549
  },
3277
3550
  /**
3278
3551
  * 预编译
@@ -3280,78 +3553,7 @@ const Methods = {
3280
3553
  */
3281
3554
  updateAfterDataIndex() {
3282
3555
  const $xeTable = this;
3283
- const props = $xeTable;
3284
- const internalData = $xeTable;
3285
- const {
3286
- treeConfig
3287
- } = props;
3288
- const {
3289
- afterFullData,
3290
- fullDataRowIdData,
3291
- fullAllDataRowIdData,
3292
- afterTreeFullData
3293
- } = internalData;
3294
- const treeOpts = $xeTable.computeTreeOpts;
3295
- const childrenField = treeOpts.children || treeOpts.childrenField;
3296
- const fullMaps = {};
3297
- if (treeConfig) {
3298
- _xeUtils.default.eachTree(afterTreeFullData, (row, index, items, path) => {
3299
- const rowid = (0, _util.getRowid)($xeTable, row);
3300
- const rowRest = fullAllDataRowIdData[rowid];
3301
- const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
3302
- if (rowRest) {
3303
- rowRest.seq = seq;
3304
- rowRest._index = index;
3305
- } else {
3306
- const rest = {
3307
- row,
3308
- rowid,
3309
- seq,
3310
- index: -1,
3311
- $index: -1,
3312
- _index: index,
3313
- items: [],
3314
- parent: null,
3315
- level: 0,
3316
- height: 0,
3317
- oTop: 0
3318
- };
3319
- fullAllDataRowIdData[rowid] = rest;
3320
- fullDataRowIdData[rowid] = rest;
3321
- }
3322
- fullMaps[rowid] = row;
3323
- }, {
3324
- children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField
3325
- });
3326
- } else {
3327
- afterFullData.forEach((row, index) => {
3328
- const rowid = (0, _util.getRowid)($xeTable, row);
3329
- const rowRest = fullAllDataRowIdData[rowid];
3330
- const seq = index + 1;
3331
- if (rowRest) {
3332
- rowRest.seq = seq;
3333
- rowRest._index = index;
3334
- } else {
3335
- const rest = {
3336
- row,
3337
- rowid,
3338
- seq,
3339
- index: -1,
3340
- $index: -1,
3341
- _index: index,
3342
- items: [],
3343
- parent: null,
3344
- level: 0,
3345
- height: 0,
3346
- oTop: 0
3347
- };
3348
- fullAllDataRowIdData[rowid] = rest;
3349
- fullDataRowIdData[rowid] = rest;
3350
- }
3351
- fullMaps[rowid] = row;
3352
- });
3353
- }
3354
- this.afterFullRowMaps = fullMaps;
3556
+ updateAfterDataIndex($xeTable);
3355
3557
  },
3356
3558
  /**
3357
3559
  * 只对 tree-config 有效,获取行的子级
@@ -3426,7 +3628,11 @@ const Methods = {
3426
3628
  * @param {String/Number} rowid 行主键
3427
3629
  */
3428
3630
  getRowById(cellValue) {
3429
- const fullDataRowIdData = this.fullDataRowIdData;
3631
+ const $xeTable = this;
3632
+ const internalData = $xeTable;
3633
+ const {
3634
+ fullDataRowIdData
3635
+ } = internalData;
3430
3636
  const rowid = _xeUtils.default.eqNull(cellValue) ? '' : encodeURIComponent(cellValue);
3431
3637
  return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null;
3432
3638
  },
@@ -3434,14 +3640,9 @@ const Methods = {
3434
3640
  * 根据行获取行的唯一主键
3435
3641
  * @param {Row} row 行对象
3436
3642
  */
3437
- getRowid(cellValue) {
3643
+ getRowid(row) {
3438
3644
  const $xeTable = this;
3439
- const internalData = $xeTable;
3440
- const {
3441
- fullDataRowIdData
3442
- } = internalData;
3443
- const rowid = _xeUtils.default.eqNull(cellValue) ? '' : encodeURIComponent(cellValue || '');
3444
- return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null;
3645
+ return (0, _util.getRowid)($xeTable, row);
3445
3646
  },
3446
3647
  /**
3447
3648
  * 获取处理后的表格数据
@@ -3645,29 +3846,41 @@ const Methods = {
3645
3846
  },
3646
3847
  setColumnWidth(fieldOrColumn, width) {
3647
3848
  const $xeTable = this;
3849
+ const internalData = $xeTable;
3850
+ const {
3851
+ elemStore
3852
+ } = internalData;
3648
3853
  let status = false;
3649
3854
  const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
3650
- cols.forEach(item => {
3651
- const column = (0, _util.handleFieldOrColumn)($xeTable, item);
3652
- if (column) {
3653
- const colWidth = _xeUtils.default.toInteger(width);
3654
- let rdWidth = colWidth;
3655
- if ((0, _dom.isScale)(width)) {
3656
- const refTableBody = $xeTable.$refs.refTableBody;
3657
- const bodyElem = refTableBody ? refTableBody.$el : null;
3658
- const bodyWidth = bodyElem ? bodyElem.clientWidth - 1 : 0;
3659
- rdWidth = Math.floor(colWidth * bodyWidth);
3660
- }
3661
- column.resizeWidth = rdWidth;
3662
- if (!status) {
3663
- status = true;
3855
+ let cWidth = _xeUtils.default.toInteger(width);
3856
+ if ((0, _dom.isScale)(width)) {
3857
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
3858
+ const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0;
3859
+ cWidth = Math.floor(cWidth * bodyWidth);
3860
+ }
3861
+ if (cWidth) {
3862
+ cols.forEach(item => {
3863
+ const column = (0, _util.handleFieldOrColumn)($xeTable, item);
3864
+ if (column) {
3865
+ column.resizeWidth = cWidth;
3866
+ if (!status) {
3867
+ status = true;
3868
+ }
3664
3869
  }
3870
+ });
3871
+ if (status) {
3872
+ return $xeTable.refreshColumn().then(() => {
3873
+ return {
3874
+ status
3875
+ };
3876
+ });
3665
3877
  }
3666
- });
3667
- if (status) {
3668
- return $xeTable.refreshColumn();
3669
3878
  }
3670
- return $xeTable.$nextTick();
3879
+ return $xeTable.$nextTick().then(() => {
3880
+ return {
3881
+ status
3882
+ };
3883
+ });
3671
3884
  },
3672
3885
  getColumnWidth(fieldOrColumn) {
3673
3886
  const column = (0, _util.handleFieldOrColumn)(this, fieldOrColumn);
@@ -3963,78 +4176,495 @@ const Methods = {
3963
4176
  if (defaultMinWidth && !column.minWidth) {
3964
4177
  column.minWidth = defaultMinWidth;
3965
4178
  }
3966
- if (column.visible) {
3967
- if (column.resizeWidth) {
3968
- resizeList.push(column);
3969
- } else if (column.width === 'auto') {
3970
- autoList.push(column);
3971
- } else if ((0, _dom.isPx)(column.width)) {
3972
- pxList.push(column);
3973
- } else if ((0, _dom.isScale)(column.width)) {
3974
- scaleList.push(column);
3975
- } else if ((0, _dom.isPx)(column.minWidth)) {
3976
- pxMinList.push(column);
3977
- } else if (column.minWidth === 'auto') {
3978
- autoMinList.push(column);
3979
- } else if ((0, _dom.isScale)(column.minWidth)) {
3980
- scaleMinList.push(column);
4179
+ if (column.visible) {
4180
+ if (column.resizeWidth) {
4181
+ resizeList.push(column);
4182
+ } else if (column.width === 'auto') {
4183
+ autoList.push(column);
4184
+ } else if ((0, _dom.isPx)(column.width)) {
4185
+ pxList.push(column);
4186
+ } else if ((0, _dom.isScale)(column.width)) {
4187
+ scaleList.push(column);
4188
+ } else if ((0, _dom.isPx)(column.minWidth)) {
4189
+ pxMinList.push(column);
4190
+ } else if (column.minWidth === 'auto') {
4191
+ autoMinList.push(column);
4192
+ } else if ((0, _dom.isScale)(column.minWidth)) {
4193
+ scaleMinList.push(column);
4194
+ } else {
4195
+ remainList.push(column);
4196
+ }
4197
+ }
4198
+ });
4199
+ Object.assign(this.columnStore, {
4200
+ resizeList,
4201
+ pxList,
4202
+ pxMinList,
4203
+ autoMinList,
4204
+ scaleList,
4205
+ scaleMinList,
4206
+ autoList,
4207
+ remainList
4208
+ });
4209
+ },
4210
+ handleColResizeMousedownEvent(evnt, fixedType, params) {
4211
+ const $xeTable = this;
4212
+ const reactData = $xeTable;
4213
+ const internalData = $xeTable;
4214
+ evnt.stopPropagation();
4215
+ evnt.preventDefault();
4216
+ const {
4217
+ column
4218
+ } = params;
4219
+ const {
4220
+ overflowX,
4221
+ scrollbarHeight
4222
+ } = reactData;
4223
+ const {
4224
+ elemStore,
4225
+ visibleColumn
4226
+ } = internalData;
4227
+ const resizableOpts = $xeTable.computeResizableOpts;
4228
+ const osbHeight = overflowX ? scrollbarHeight : 0;
4229
+ const tableEl = $xeTable.$refs.refElem;
4230
+ const leftContainerElem = $xeTable.$refs.refLeftContainer;
4231
+ const rightContainerElem = $xeTable.$refs.refRightContainer;
4232
+ const resizeBarElem = $xeTable.$refs.refColResizeBar;
4233
+ if (!resizeBarElem) {
4234
+ return;
4235
+ }
4236
+ const resizeTipElem = resizeBarElem.firstElementChild;
4237
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
4238
+ const {
4239
+ clientX: dragClientX
4240
+ } = evnt;
4241
+ const wrapperElem = $xeTable.$refs.refElem;
4242
+ const dragBtnElem = evnt.target;
4243
+ let resizeColumn = column;
4244
+ if (column.children && column.children.length) {
4245
+ _xeUtils.default.eachTree(column.children, childColumn => {
4246
+ resizeColumn = childColumn;
4247
+ });
4248
+ }
4249
+ const cell = dragBtnElem.parentNode;
4250
+ const cellParams = Object.assign(params, {
4251
+ cell
4252
+ });
4253
+ let dragLeft = 0;
4254
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
4255
+ if (!bodyScrollElem) {
4256
+ return;
4257
+ }
4258
+ const pos = (0, _dom.getOffsetPos)(dragBtnElem, wrapperElem);
4259
+ const dragBtnWidth = dragBtnElem.clientWidth;
4260
+ const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
4261
+ const minInterval = (0, _util.getColReMinWidth)(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
4262
+ let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
4263
+ let dragPosLeft = pos.left + dragBtnOffsetWidth;
4264
+ const isLeftFixed = fixedType === 'left';
4265
+ const isRightFixed = fixedType === 'right';
4266
+ // 计算左右侧固定列偏移量
4267
+ let fixedOffsetWidth = 0;
4268
+ if (isLeftFixed || isRightFixed) {
4269
+ const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
4270
+ let tempCellElem = cell[siblingProp];
4271
+ while (tempCellElem) {
4272
+ if ((0, _dom.hasClass)(tempCellElem, 'fixed--hidden')) {
4273
+ break;
4274
+ } else if (!(0, _dom.hasClass)(tempCellElem, 'col--group')) {
4275
+ fixedOffsetWidth += tempCellElem.offsetWidth;
4276
+ }
4277
+ tempCellElem = tempCellElem[siblingProp];
4278
+ }
4279
+ if (isRightFixed && rightContainerElem) {
4280
+ dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth;
4281
+ }
4282
+ }
4283
+ // 处理拖动事件
4284
+ const updateEvent = evnt => {
4285
+ evnt.stopPropagation();
4286
+ evnt.preventDefault();
4287
+ const tableHeight = tableEl.clientHeight;
4288
+ const offsetX = evnt.clientX - dragClientX;
4289
+ let left = dragPosLeft + offsetX;
4290
+ const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
4291
+ if (isLeftFixed) {
4292
+ // 左固定列(不允许超过右侧固定列、不允许超过右边距)
4293
+ left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
4294
+ } else if (isRightFixed) {
4295
+ // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
4296
+ dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval;
4297
+ left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
4298
+ } else {
4299
+ dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
4300
+ // left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
4301
+ }
4302
+ dragLeft = Math.max(left, dragMinLeft);
4303
+ const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
4304
+ resizeBarElem.style.left = `${resizeBarLeft}px`;
4305
+ resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
4306
+ resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
4307
+ if (resizableOpts.showDragTip && resizeTipElem) {
4308
+ resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
4309
+ const tableWidth = tableEl.clientWidth;
4310
+ const wrapperRect = wrapperElem.getBoundingClientRect();
4311
+ const resizeBarWidth = resizeBarElem.clientWidth;
4312
+ const resizeTipWidth = resizeTipElem.clientWidth;
4313
+ const resizeTipHeight = resizeTipElem.clientHeight;
4314
+ let resizeTipLeft = -resizeTipWidth;
4315
+ if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
4316
+ resizeTipLeft = 0;
4317
+ } else if (resizeBarLeft > tableWidth) {
4318
+ resizeTipLeft += tableWidth - resizeBarLeft;
4319
+ }
4320
+ resizeTipElem.style.left = `${resizeTipLeft}px`;
4321
+ resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
4322
+ }
4323
+ };
4324
+ reactData.isDragResize = true;
4325
+ (0, _dom.addClass)(tableEl, 'col-drag--resize');
4326
+ resizeBarElem.style.display = 'block';
4327
+ document.onmousemove = updateEvent;
4328
+ document.onmouseup = function (evnt) {
4329
+ document.onmousemove = null;
4330
+ document.onmouseup = null;
4331
+ resizeBarElem.style.display = 'none';
4332
+ reactData.isDragResize = false;
4333
+ internalData._lastResizeTime = Date.now();
4334
+ const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
4335
+ const resizeParams = Object.assign(Object.assign({}, params), {
4336
+ resizeWidth,
4337
+ resizeColumn
4338
+ });
4339
+ if (resizableOpts.dragMode === 'fixed') {
4340
+ visibleColumn.forEach(item => {
4341
+ if (item.id !== resizeColumn.id) {
4342
+ if (!item.resizeWidth) {
4343
+ item.resizeWidth = item.renderWidth;
4344
+ }
4345
+ }
4346
+ });
4347
+ }
4348
+ if ($xeTable.handleColResizeCellAreaEvent) {
4349
+ $xeTable.handleColResizeCellAreaEvent(evnt, resizeParams);
4350
+ } else {
4351
+ resizeColumn.resizeWidth = resizeWidth;
4352
+ handleUpdateColResize($xeTable, evnt, resizeParams);
4353
+ }
4354
+ (0, _dom.removeClass)(tableEl, 'col-drag--resize');
4355
+ };
4356
+ updateEvent(evnt);
4357
+ if ($xeTable.closeMenu) {
4358
+ $xeTable.closeMenu();
4359
+ }
4360
+ },
4361
+ handleColResizeDblclickEvent(evnt, params) {
4362
+ const $xeTable = this;
4363
+ const reactData = $xeTable;
4364
+ const internalData = $xeTable;
4365
+ const resizableOpts = $xeTable.computeResizableOpts;
4366
+ const {
4367
+ isDblclickAutoWidth
4368
+ } = resizableOpts;
4369
+ const el = $xeTable.$refs.refElem;
4370
+ if (isDblclickAutoWidth && el) {
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 || 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
+ };
4502
+ reactData.isDragResize = true;
4503
+ (0, _dom.addClass)(tableEl, 'row-drag--resize');
4504
+ resizeBarElem.style.display = 'block';
4505
+ document.onmousemove = updateEvent;
4506
+ document.onmouseup = function (evnt) {
4507
+ document.onmousemove = null;
4508
+ document.onmouseup = null;
4509
+ resizeBarElem.style.display = 'none';
4510
+ reactData.isDragResize = false;
4511
+ internalData._lastResizeTime = Date.now();
4512
+ if (resizeHeight !== currCellHeight) {
4513
+ const resizeParams = Object.assign(Object.assign({}, params), {
4514
+ resizeHeight,
4515
+ resizeRow: row
4516
+ });
4517
+ internalData.isResizeCellHeight = true;
4518
+ if ($xeTable.handleRowResizeCellAreaEvent) {
4519
+ $xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams);
3981
4520
  } else {
3982
- remainList.push(column);
4521
+ rowRest.resizeHeight = resizeHeight;
4522
+ handleUpdateRowResize($xeTable, evnt, resizeParams);
3983
4523
  }
3984
4524
  }
3985
- });
3986
- Object.assign(this.columnStore, {
3987
- resizeList,
3988
- pxList,
3989
- pxMinList,
3990
- autoMinList,
3991
- scaleList,
3992
- scaleMinList,
3993
- autoList,
3994
- remainList
3995
- });
4525
+ (0, _dom.removeClass)(tableEl, 'row-drag--resize');
4526
+ };
4527
+ updateEvent(evnt);
3996
4528
  },
3997
- handleResizeDblclickEvent(evnt, params) {
4529
+ handleRowResizeDblclickEvent(evnt, params) {
3998
4530
  const $xeTable = this;
3999
4531
  const reactData = $xeTable;
4000
4532
  const internalData = $xeTable;
4001
4533
  const resizableOpts = $xeTable.computeResizableOpts;
4002
4534
  const {
4003
- isDblclickAutoWidth
4535
+ isDblclickAutoHeight
4004
4536
  } = resizableOpts;
4005
4537
  const el = $xeTable.$refs.refElem;
4006
- if (isDblclickAutoWidth && el) {
4538
+ if (isDblclickAutoHeight && el) {
4007
4539
  const {
4008
- fullColumnIdData
4540
+ fullAllDataRowIdData
4009
4541
  } = internalData;
4010
4542
  const {
4011
- column
4543
+ row
4012
4544
  } = params;
4013
- const colid = column.id;
4014
- const colRest = fullColumnIdData[colid];
4015
- const dragBtnElem = evnt.target;
4016
- const cell = dragBtnElem.parentNode;
4017
- const cellParams = Object.assign(params, {
4018
- cell
4019
- });
4020
- const colMinWidth = (0, _util.getColReMinWidth)(cellParams);
4021
- let resizeWidth = calcColumnAutoWidth(column, el);
4022
- if (colRest) {
4023
- resizeWidth = Math.max(resizeWidth, colRest.width);
4545
+ const rowid = (0, _util.getRowid)($xeTable, row);
4546
+ const rowRest = fullAllDataRowIdData[rowid];
4547
+ if (!rowRest) {
4548
+ return;
4024
4549
  }
4025
- column.resizeWidth = Math.max(colMinWidth, resizeWidth);
4026
- reactData._isResize = false;
4550
+ const resizeHeight = calcCellAutoHeight(rowRest, el);
4551
+ const resizeParams = Object.assign(Object.assign({}, params), {
4552
+ resizeHeight,
4553
+ resizeRow: row
4554
+ });
4555
+ reactData.isDragResize = false;
4027
4556
  internalData._lastResizeTime = Date.now();
4028
- $xeTable.analyColumnWidth();
4029
- $xeTable.recalculate(true).then(() => {
4030
- $xeTable.saveCustomStore('update:visible');
4031
- $xeTable.updateCellAreas();
4032
- $xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), {
4033
- resizeWidth
4034
- }), evnt);
4035
- setTimeout(() => $xeTable.recalculate(true), 300);
4557
+ if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
4558
+ $xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams);
4559
+ } else {
4560
+ rowRest.resizeHeight = resizeHeight;
4561
+ handleUpdateRowResize($xeTable, evnt, resizeParams);
4562
+ }
4563
+ }
4564
+ },
4565
+ setRowHeightConf(heightConf) {
4566
+ const $xeTable = this;
4567
+ const reactData = $xeTable;
4568
+ const internalData = $xeTable;
4569
+ const {
4570
+ fullAllDataRowIdData
4571
+ } = internalData;
4572
+ let status = false;
4573
+ if (heightConf) {
4574
+ _xeUtils.default.each(heightConf, (height, rowid) => {
4575
+ const rowRest = fullAllDataRowIdData[rowid];
4576
+ if (rowRest) {
4577
+ const rHeight = _xeUtils.default.toInteger(height);
4578
+ if (rHeight) {
4579
+ rowRest.resizeHeight = rHeight;
4580
+ if (!status) {
4581
+ status = true;
4582
+ }
4583
+ }
4584
+ }
4585
+ });
4586
+ if (status) {
4587
+ internalData.isResizeCellHeight = true;
4588
+ reactData.resizeHeightFlag++;
4589
+ }
4590
+ }
4591
+ return $xeTable.$nextTick().then(() => {
4592
+ return {
4593
+ status
4594
+ };
4595
+ });
4596
+ },
4597
+ getRowHeightConf(isFull) {
4598
+ const $xeTable = this;
4599
+ const internalData = $xeTable;
4600
+ const {
4601
+ fullAllDataRowIdData,
4602
+ afterFullData
4603
+ } = internalData;
4604
+ const rowOpts = $xeTable.computeRowOpts;
4605
+ const cellOpts = $xeTable.computeCellOpts;
4606
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
4607
+ const rest = {};
4608
+ afterFullData.forEach(row => {
4609
+ const rowid = (0, _util.getRowid)($xeTable, row);
4610
+ const rowRest = fullAllDataRowIdData[rowid];
4611
+ if (rowRest) {
4612
+ const resizeHeight = rowRest.resizeHeight;
4613
+ if (resizeHeight || isFull) {
4614
+ const currCellHeight = resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight;
4615
+ rest[rowid] = currCellHeight;
4616
+ }
4617
+ }
4618
+ });
4619
+ return rest;
4620
+ },
4621
+ setRowHeight(rowOrId, height) {
4622
+ const $xeTable = this;
4623
+ const reactData = $xeTable;
4624
+ const internalData = $xeTable;
4625
+ const {
4626
+ fullAllDataRowIdData
4627
+ } = internalData;
4628
+ let status = false;
4629
+ const rows = _xeUtils.default.isArray(rowOrId) ? rowOrId : [rowOrId];
4630
+ let rHeight = _xeUtils.default.toInteger(height);
4631
+ if ((0, _dom.isScale)(height)) {
4632
+ const tableBody = $xeTable.$refs.refTableBody;
4633
+ const bodyElem = tableBody ? tableBody.$el : null;
4634
+ const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0;
4635
+ rHeight = Math.floor(rHeight * bodyHeight);
4636
+ }
4637
+ if (rHeight) {
4638
+ rows.forEach(row => {
4639
+ const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : (0, _util.getRowid)($xeTable, row);
4640
+ const rowRest = fullAllDataRowIdData[rowid];
4641
+ if (rowRest) {
4642
+ rowRest.resizeHeight = rHeight;
4643
+ if (!status) {
4644
+ status = true;
4645
+ }
4646
+ }
4036
4647
  });
4648
+ if (status) {
4649
+ internalData.isResizeCellHeight = true;
4650
+ reactData.resizeHeightFlag++;
4651
+ }
4037
4652
  }
4653
+ return $xeTable.$nextTick();
4654
+ },
4655
+ getRowHeight(rowOrId) {
4656
+ const $xeTable = this;
4657
+ const internalData = $xeTable;
4658
+ const {
4659
+ fullAllDataRowIdData
4660
+ } = internalData;
4661
+ const rowOpts = $xeTable.computeRowOpts;
4662
+ const cellOpts = $xeTable.computeCellOpts;
4663
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
4664
+ const rowid = _xeUtils.default.isString(rowOrId) || _xeUtils.default.isNumber(rowOrId) ? rowOrId : (0, _util.getRowid)($xeTable, rowOrId);
4665
+ const rowRest = fullAllDataRowIdData[rowid];
4666
+ const currCellHeight = rowRest ? rowRest.resizeHeight : cellOpts.height || rowOpts.height || defaultRowHeight;
4667
+ return currCellHeight;
4038
4668
  },
4039
4669
  /**
4040
4670
  * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
@@ -4470,10 +5100,10 @@ const Methods = {
4470
5100
  }
4471
5101
  } else if (isContextMenu) {
4472
5102
  // 如果按下上下文键
4473
- this._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
5103
+ internalData._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
4474
5104
  clearTimeout(internalData.keyCtxTimeout);
4475
5105
  internalData.keyCtxTimeout = setTimeout(() => {
4476
- this._keyCtx = false;
5106
+ internalData._keyCtx = false;
4477
5107
  }, 1000);
4478
5108
  } else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
4479
5109
  const {
@@ -4753,17 +5383,6 @@ const Methods = {
4753
5383
  this.updateCellAreas();
4754
5384
  this.recalculate(true);
4755
5385
  },
4756
- handleTargetEnterEvent(isClear) {
4757
- const $tooltip = this.$refs.tooltip;
4758
- clearTimeout(this.tooltipTimeout);
4759
- if (isClear) {
4760
- this.closeTooltip();
4761
- } else {
4762
- if ($tooltip) {
4763
- $tooltip.setActived(true);
4764
- }
4765
- }
4766
- },
4767
5386
  handleTargetLeaveEvent() {
4768
5387
  const tooltipOpts = this.tooltipOpts;
4769
5388
  let $tooltip = this.$refs.tooltip;
@@ -4782,24 +5401,25 @@ const Methods = {
4782
5401
  }
4783
5402
  },
4784
5403
  triggerHeaderTitleEvent(evnt, iconParams, params) {
5404
+ const $xeTable = this;
5405
+ const reactData = $xeTable;
4785
5406
  const tipContent = iconParams.content || iconParams.message;
4786
5407
  if (tipContent) {
4787
5408
  const {
4788
- $refs,
4789
5409
  tooltipStore
4790
- } = this;
5410
+ } = reactData;
4791
5411
  const {
4792
5412
  column
4793
5413
  } = params;
4794
5414
  const content = (0, _utils.getFuncText)(tipContent);
4795
- this.handleTargetEnterEvent(true);
5415
+ handleTargetEnterEvent($xeTable, true);
4796
5416
  tooltipStore.row = null;
4797
5417
  tooltipStore.column = column;
4798
5418
  tooltipStore.visible = true;
4799
5419
  tooltipStore.currOpts = iconParams;
4800
- this.$nextTick(() => {
4801
- const $tooltip = $refs.tooltip;
4802
- if ($tooltip) {
5420
+ $xeTable.$nextTick(() => {
5421
+ const $tooltip = $xeTable.$refs.refTooltip;
5422
+ if ($tooltip && $tooltip.open) {
4803
5423
  $tooltip.open(evnt.currentTarget, content);
4804
5424
  }
4805
5425
  });
@@ -4809,28 +5429,48 @@ const Methods = {
4809
5429
  * 触发表头 tooltip 事件
4810
5430
  */
4811
5431
  triggerHeaderTooltipEvent(evnt, params) {
5432
+ const $xeTable = this;
5433
+ const reactData = $xeTable;
4812
5434
  const {
4813
5435
  tooltipStore
4814
- } = this;
5436
+ } = reactData;
4815
5437
  const {
4816
5438
  column
4817
5439
  } = params;
5440
+ handleTargetEnterEvent($xeTable, true);
4818
5441
  const titleElem = evnt.currentTarget;
4819
- this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row);
5442
+ if (!titleElem) {
5443
+ return;
5444
+ }
5445
+ const cellEl = titleElem.parentElement;
5446
+ if (!cellEl) {
5447
+ return;
5448
+ }
5449
+ const thEl = cellEl.parentElement;
5450
+ if (!thEl) {
5451
+ return;
5452
+ }
4820
5453
  if (tooltipStore.column !== column || !tooltipStore.visible) {
4821
- this.handleTooltip(evnt, titleElem, titleElem, null, params);
5454
+ handleTooltip($xeTable, evnt, thEl, cellEl, null, params);
4822
5455
  }
4823
5456
  },
4824
5457
  /**
4825
5458
  * 触发单元格 tooltip 事件
4826
5459
  */
4827
5460
  triggerBodyTooltipEvent(evnt, params) {
5461
+ const $xeTable = this;
5462
+ const props = $xeTable;
5463
+ const reactData = $xeTable;
5464
+ const {
5465
+ editConfig
5466
+ } = props;
5467
+ const {
5468
+ editStore
5469
+ } = reactData;
4828
5470
  const {
4829
- editConfig,
4830
- editOpts,
4831
- editStore,
4832
5471
  tooltipStore
4833
- } = this;
5472
+ } = reactData;
5473
+ const editOpts = $xeTable.computeEditOpts;
4834
5474
  const {
4835
5475
  actived
4836
5476
  } = editStore;
@@ -4838,8 +5478,8 @@ const Methods = {
4838
5478
  row,
4839
5479
  column
4840
5480
  } = params;
4841
- const cell = evnt.currentTarget;
4842
- this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row);
5481
+ const tdEl = evnt.currentTarget;
5482
+ handleTargetEnterEvent($xeTable, tooltipStore.column !== column || tooltipStore.row !== row);
4843
5483
  // 单元格处于编辑状态时不触发提示框
4844
5484
  if (column.editRender && (0, _utils.isEnableConf)(editConfig)) {
4845
5485
  // 如果是行编辑模式
@@ -4852,80 +5492,26 @@ const Methods = {
4852
5492
  }
4853
5493
  }
4854
5494
  if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
4855
- let overflowElem;
4856
- let tipElem;
4857
- if (column.treeNode) {
4858
- overflowElem = cell.querySelector('.vxe-tree-cell');
4859
- if (column.type === 'html') {
4860
- tipElem = cell.querySelector('.vxe-cell--html');
4861
- }
4862
- } else {
4863
- tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
4864
- }
4865
- this.handleTooltip(evnt, cell, overflowElem || cell.children[0], tipElem, params);
5495
+ handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), null, params);
4866
5496
  }
4867
5497
  },
4868
5498
  /**
4869
5499
  * 触发表尾 tooltip 事件
4870
5500
  */
4871
5501
  triggerFooterTooltipEvent(evnt, params) {
5502
+ const $xeTable = this;
5503
+ const reactData = $xeTable;
4872
5504
  const {
4873
5505
  column
4874
5506
  } = params;
4875
5507
  const {
4876
5508
  tooltipStore
4877
- } = this;
5509
+ } = reactData;
4878
5510
  const cell = evnt.currentTarget;
4879
- this.handleTargetEnterEvent(true);
5511
+ handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
4880
5512
  if (tooltipStore.column !== column || !tooltipStore.visible) {
4881
- this.handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--item') || cell.children[0], null, params);
4882
- }
4883
- },
4884
- /**
4885
- * 处理显示 tooltip
4886
- * @param {Event} evnt 事件
4887
- * @param {ColumnInfo} column 列配置
4888
- * @param {Row} row 行对象
4889
- */
4890
- handleTooltip(evnt, cell, overflowElem, tipElem, params) {
4891
- const $xeTable = this;
4892
- if (!overflowElem) {
4893
- return $xeTable.$nextTick();
4894
- }
4895
- params.cell = cell;
4896
- const {
4897
- $refs,
4898
- tooltipOpts,
4899
- tooltipStore
4900
- } = this;
4901
- const {
4902
- column,
4903
- row
4904
- } = params;
4905
- const {
4906
- showAll,
4907
- enabled,
4908
- contentMethod
4909
- } = tooltipOpts;
4910
- const customContent = contentMethod ? contentMethod(params) : null;
4911
- const useCustom = contentMethod && !_xeUtils.default.eqNull(customContent);
4912
- const content = useCustom ? customContent : (column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
4913
- const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
4914
- if (content && (showAll || enabled || useCustom || isCellOverflow)) {
4915
- Object.assign(tooltipStore, {
4916
- row,
4917
- column,
4918
- visible: true,
4919
- currOpts: {}
4920
- });
4921
- this.$nextTick(() => {
4922
- const $tooltip = $refs.tooltip;
4923
- if ($tooltip) {
4924
- $tooltip.open(isCellOverflow ? overflowElem : tipElem || overflowElem, (0, _utils.formatText)(content));
4925
- }
4926
- });
5513
+ handleTooltip($xeTable, evnt, cell, cell.querySelector('.vxe-cell--wrapper') || cell.children[0], null, params);
4927
5514
  }
4928
- return this.$nextTick();
4929
5515
  },
4930
5516
  openTooltip(target, content) {
4931
5517
  const {
@@ -5659,7 +6245,7 @@ const Methods = {
5659
6245
  }
5660
6246
  vLen++;
5661
6247
  });
5662
- const isSelected = rootList.length > 0 && sLen >= vLen;
6248
+ const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length;
5663
6249
  const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
5664
6250
  reactData.isAllSelected = isSelected;
5665
6251
  reactData.isIndeterminate = halfSelect;
@@ -6729,10 +7315,10 @@ const Methods = {
6729
7315
  }
6730
7316
  reactData.isDragRowMove = true;
6731
7317
  $xeTable.handleTableData(treeConfig && transform);
6732
- $xeTable.cacheRowMap();
7318
+ $xeTable.cacheRowMap(false);
6733
7319
  updateScrollYStatus($xeTable);
6734
7320
  if (!(treeConfig && transform)) {
6735
- $xeTable.updateAfterDataIndex();
7321
+ updateAfterDataIndex($xeTable);
6736
7322
  }
6737
7323
  $xeTable.checkSelectionStatus();
6738
7324
  if (reactData.scrollYLoad) {
@@ -6782,18 +7368,16 @@ const Methods = {
6782
7368
  prevDragRow,
6783
7369
  prevDragPos
6784
7370
  } = internalData;
6785
- if (treeConfig && prevDragToChild) {
7371
+ if (treeConfig && lazy && prevDragToChild) {
6786
7372
  // 懒加载
6787
- if (lazy) {
6788
- const newRowid = (0, _util.getRowid)($xeTable, prevDragRow);
6789
- const rowRest = fullAllDataRowIdData[newRowid];
6790
- if (prevDragRow[hasChildField]) {
6791
- if (rowRest && rowRest.treeLoaded) {
6792
- $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6793
- }
6794
- } else {
7373
+ const newRowid = (0, _util.getRowid)($xeTable, prevDragRow);
7374
+ const rowRest = fullAllDataRowIdData[newRowid];
7375
+ if (prevDragRow[hasChildField]) {
7376
+ if (rowRest && rowRest.treeLoaded) {
6795
7377
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6796
7378
  }
7379
+ } else {
7380
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6797
7381
  }
6798
7382
  } else {
6799
7383
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
@@ -8089,7 +8673,7 @@ const Methods = {
8089
8673
  return this.$nextTick().then(() => {
8090
8674
  if (transform) {
8091
8675
  this.handleTableData();
8092
- this.updateAfterDataIndex();
8676
+ updateAfterDataIndex($xeTable);
8093
8677
  return this.$nextTick();
8094
8678
  }
8095
8679
  });
@@ -8231,7 +8815,7 @@ const Methods = {
8231
8815
  return this.handleBaseTreeExpand(rows, expanded).then(() => {
8232
8816
  handleVirtualTreeToList($xeTable);
8233
8817
  this.handleTableData();
8234
- this.updateAfterDataIndex();
8818
+ updateAfterDataIndex($xeTable);
8235
8819
  }).then(() => {
8236
8820
  return this.recalculate();
8237
8821
  }).then(() => {
@@ -8333,17 +8917,22 @@ const Methods = {
8333
8917
  * 获取表格的滚动状态
8334
8918
  */
8335
8919
  getScroll() {
8920
+ const $xeTable = this;
8921
+ const reactData = $xeTable;
8922
+ const internalData = $xeTable;
8336
8923
  const {
8337
- $refs,
8338
8924
  scrollXLoad,
8339
8925
  scrollYLoad
8340
- } = this;
8341
- const bodyElem = $refs.refTableBody.$el;
8926
+ } = reactData;
8927
+ const {
8928
+ elemStore
8929
+ } = internalData;
8930
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
8342
8931
  return {
8343
8932
  virtualX: scrollXLoad,
8344
8933
  virtualY: scrollYLoad,
8345
- scrollTop: bodyElem.scrollTop,
8346
- scrollLeft: bodyElem.scrollLeft
8934
+ scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
8935
+ scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
8347
8936
  };
8348
8937
  },
8349
8938
  handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
@@ -8451,60 +9040,6 @@ const Methods = {
8451
9040
  }
8452
9041
  $xeTable.dispatchEvent('scroll', evntParams, evnt);
8453
9042
  },
8454
- lazyScrollXData() {
8455
- const $xeTable = this;
8456
- const internalData = $xeTable;
8457
- const {
8458
- lxTimeout,
8459
- lxRunTime,
8460
- scrollXStore
8461
- } = internalData;
8462
- const {
8463
- visibleSize
8464
- } = scrollXStore;
8465
- const fpsTime = Math.max(5, Math.min(80, Math.floor(visibleSize * 3)));
8466
- if (lxTimeout) {
8467
- clearTimeout(lxTimeout);
8468
- }
8469
- if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
8470
- internalData.lxRunTime = Date.now();
8471
- loadScrollXData($xeTable);
8472
- }
8473
- internalData.lxTimeout = setTimeout(() => {
8474
- internalData.lxTimeout = undefined;
8475
- internalData.lxRunTime = undefined;
8476
- loadScrollXData($xeTable);
8477
- }, fpsTime);
8478
- },
8479
- lazyScrollYData() {
8480
- const $xeTable = this;
8481
- const props = $xeTable;
8482
- const internalData = $xeTable;
8483
- const {
8484
- showOverflow
8485
- } = props;
8486
- const {
8487
- lyTimeout,
8488
- lyRunTime,
8489
- scrollYStore
8490
- } = internalData;
8491
- const {
8492
- visibleSize
8493
- } = scrollYStore;
8494
- const fpsTime = showOverflow ? 5 : Math.max(5, Math.min(80, Math.floor(visibleSize / 2)));
8495
- if (lyTimeout) {
8496
- clearTimeout(lyTimeout);
8497
- }
8498
- if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
8499
- internalData.lyRunTime = Date.now();
8500
- loadScrollYData($xeTable);
8501
- }
8502
- internalData.lyTimeout = setTimeout(() => {
8503
- internalData.lyTimeout = undefined;
8504
- internalData.lyRunTime = undefined;
8505
- loadScrollYData($xeTable);
8506
- }, fpsTime);
8507
- },
8508
9043
  /**
8509
9044
  * 横向 X 可视渲染事件处理
8510
9045
  */
@@ -8514,7 +9049,7 @@ const Methods = {
8514
9049
  if (sXOpts.immediate) {
8515
9050
  loadScrollXData($xeTable);
8516
9051
  } else {
8517
- $xeTable.lazyScrollXData();
9052
+ lazyScrollXData($xeTable);
8518
9053
  }
8519
9054
  },
8520
9055
  /**
@@ -8526,7 +9061,7 @@ const Methods = {
8526
9061
  if (sYOpts.immediate) {
8527
9062
  loadScrollYData($xeTable);
8528
9063
  } else {
8529
- $xeTable.lazyScrollYData();
9064
+ lazyScrollYData($xeTable);
8530
9065
  }
8531
9066
  },
8532
9067
  triggerBodyScrollEvent(evnt, fixedType) {
@@ -8534,6 +9069,7 @@ const Methods = {
8534
9069
  const internalData = $xeTable;
8535
9070
  const {
8536
9071
  elemStore,
9072
+ intoRunScroll,
8537
9073
  lastScrollTop,
8538
9074
  lastScrollLeft,
8539
9075
  inWheelScroll,
@@ -8553,6 +9089,9 @@ const Methods = {
8553
9089
  if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
8554
9090
  return;
8555
9091
  }
9092
+ if (intoRunScroll) {
9093
+ return;
9094
+ }
8556
9095
  if (!bodyScrollElem) {
8557
9096
  return;
8558
9097
  }
@@ -8611,6 +9150,7 @@ const Methods = {
8611
9150
  const internalData = $xeTable;
8612
9151
  const {
8613
9152
  elemStore,
9153
+ intoRunScroll,
8614
9154
  inWheelScroll,
8615
9155
  inVirtualScroll,
8616
9156
  inBodyScroll,
@@ -8621,16 +9161,10 @@ const Methods = {
8621
9161
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
8622
9162
  const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
8623
9163
  const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
8624
- if (inWheelScroll) {
8625
- return;
8626
- }
8627
- if (inVirtualScroll) {
9164
+ if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
8628
9165
  return;
8629
9166
  }
8630
- if (inBodyScroll) {
8631
- return;
8632
- }
8633
- if (inFooterScroll) {
9167
+ if (intoRunScroll) {
8634
9168
  return;
8635
9169
  }
8636
9170
  if (!headerScrollElem) {
@@ -8661,6 +9195,7 @@ const Methods = {
8661
9195
  const internalData = $xeTable;
8662
9196
  const {
8663
9197
  elemStore,
9198
+ intoRunScroll,
8664
9199
  inWheelScroll,
8665
9200
  inVirtualScroll,
8666
9201
  inHeaderScroll,
@@ -8671,16 +9206,10 @@ const Methods = {
8671
9206
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
8672
9207
  const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
8673
9208
  const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
8674
- if (inWheelScroll) {
8675
- return;
8676
- }
8677
- if (inVirtualScroll) {
8678
- return;
8679
- }
8680
- if (inHeaderScroll) {
9209
+ if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
8681
9210
  return;
8682
9211
  }
8683
- if (inBodyScroll) {
9212
+ if (intoRunScroll) {
8684
9213
  return;
8685
9214
  }
8686
9215
  if (!footerScrollElem) {
@@ -8738,26 +9267,13 @@ const Methods = {
8738
9267
  if (!bodyScrollElem) {
8739
9268
  return;
8740
9269
  }
8741
- let multiple = 1;
8742
- if (reactData.lastScrollTime + 25 > Date.now()) {
8743
- multiple = 1.18;
8744
- } else if (reactData.lastScrollTime + 30 > Date.now()) {
8745
- multiple = 1.15;
8746
- } else if (reactData.lastScrollTime + 40 > Date.now()) {
8747
- multiple = 1.12;
8748
- } else if (reactData.lastScrollTime + 55 > Date.now()) {
8749
- multiple = 1.09;
8750
- } else if (reactData.lastScrollTime + 75 > Date.now()) {
8751
- multiple = 1.06;
8752
- } else if (reactData.lastScrollTime + 100 > Date.now()) {
8753
- multiple = 1.03;
8754
- }
8755
- const deltaTop = deltaY * multiple;
8756
- const deltaLeft = deltaX * multiple;
9270
+ const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
9271
+ const deltaTop = deltaY * wheelSpeed;
9272
+ const deltaLeft = deltaX * wheelSpeed;
8757
9273
  const isTopWheel = deltaTop < 0;
8758
- const currScrollTop = yHandleEl.scrollTop;
9274
+ const currScrollTop = bodyScrollElem.scrollTop;
8759
9275
  // 如果滚动位置已经是顶部或底部,则不需要触发
8760
- if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= yHandleEl.scrollHeight - yHandleEl.clientHeight) {
9276
+ if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
8761
9277
  return;
8762
9278
  }
8763
9279
  const scrollTop = bodyScrollElem.scrollTop + deltaTop;
@@ -8770,19 +9286,32 @@ const Methods = {
8770
9286
  if (rowOpts.isHover || highlightHoverRow) {
8771
9287
  $xeTable.clearHoverRow();
8772
9288
  }
8773
- internalData.inWheelScroll = true;
8774
- (0, _dom.setScrollTop)(yHandleEl, scrollTop);
8775
- (0, _dom.setScrollTop)(bodyScrollElem, scrollTop);
8776
- (0, _dom.setScrollTop)(leftScrollElem, scrollTop);
8777
- (0, _dom.setScrollTop)(rightScrollElem, scrollTop);
8778
- $xeTable.triggerScrollYEvent(evnt);
8779
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
8780
- type: 'footer',
8781
- fixed: ''
9289
+ wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, offsetTop => {
9290
+ const currTopNum = bodyScrollElem.scrollTop + offsetTop;
9291
+ internalData.inWheelScroll = true;
9292
+ (0, _dom.setScrollTop)(yHandleEl, currTopNum);
9293
+ (0, _dom.setScrollTop)(bodyScrollElem, currTopNum);
9294
+ (0, _dom.setScrollTop)(leftScrollElem, currTopNum);
9295
+ (0, _dom.setScrollTop)(rightScrollElem, currTopNum);
9296
+ $xeTable.triggerScrollYEvent(evnt);
9297
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
9298
+ type: 'table',
9299
+ fixed: ''
9300
+ });
8782
9301
  });
8783
- }
8784
- },
8785
- scrollXEvent(evnt) {
9302
+ // internalData.inWheelScroll = true
9303
+ // setScrollTop(yHandleEl, scrollTop)
9304
+ // setScrollTop(bodyScrollElem, scrollTop)
9305
+ // setScrollTop(leftScrollElem, scrollTop)
9306
+ // setScrollTop(rightScrollElem, scrollTop)
9307
+ // loadScrollYData($xeTable, scrollTop)
9308
+ // $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
9309
+ // type: 'footer',
9310
+ // fixed: ''
9311
+ // })
9312
+ }
9313
+ },
9314
+ triggerVirtualScrollXEvent(evnt) {
8786
9315
  const $xeTable = this;
8787
9316
  const internalData = $xeTable;
8788
9317
  const {
@@ -8824,7 +9353,7 @@ const Methods = {
8824
9353
  fixed: ''
8825
9354
  });
8826
9355
  },
8827
- scrollYEvent(evnt) {
9356
+ triggerVirtualScrollYEvent(evnt) {
8828
9357
  const $xeTable = this;
8829
9358
  const internalData = $xeTable;
8830
9359
  const {
@@ -8873,9 +9402,7 @@ const Methods = {
8873
9402
  showOverflow
8874
9403
  } = props;
8875
9404
  handleTableColumn($xeTable);
8876
- // calcCellHeight()
8877
9405
  return $xeTable.$nextTick().then(() => {
8878
- // calcCellHeight()
8879
9406
  handleTableColumn($xeTable);
8880
9407
  $xeTable.updateScrollXSpace();
8881
9408
  if (!showOverflow) {
@@ -8942,9 +9469,7 @@ const Methods = {
8942
9469
  updateScrollYData() {
8943
9470
  const $xeTable = this;
8944
9471
  $xeTable.handleTableData();
8945
- // calcCellHeight()
8946
9472
  return $xeTable.$nextTick().then(() => {
8947
- // calcCellHeight()
8948
9473
  $xeTable.handleTableData();
8949
9474
  $xeTable.updateScrollYSpace();
8950
9475
  });
@@ -8959,42 +9484,42 @@ const Methods = {
8959
9484
  showOverflow
8960
9485
  } = props;
8961
9486
  const {
8962
- scrollYLoad,
8963
- rowHeight
9487
+ scrollYLoad
8964
9488
  } = reactData;
8965
9489
  const {
8966
9490
  scrollYStore,
8967
9491
  elemStore,
9492
+ isResizeCellHeight,
8968
9493
  afterFullData,
8969
9494
  fullAllDataRowIdData
8970
9495
  } = internalData;
8971
9496
  const {
8972
9497
  startIndex
8973
9498
  } = scrollYStore;
9499
+ const rowOpts = $xeTable.computeRowOpts;
9500
+ const cellOpts = $xeTable.computeCellOpts;
9501
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
8974
9502
  const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
8975
9503
  const containerList = ['main', 'left', 'right'];
8976
9504
  let topSpaceHeight = 0;
8977
9505
  let ySpaceHeight = 0;
8978
9506
  if (scrollYLoad) {
8979
- if (showOverflow) {
8980
- ySpaceHeight = afterFullData.length * rowHeight;
8981
- topSpaceHeight = Math.max(0, startIndex * rowHeight);
9507
+ const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
9508
+ if (!isCustomCellHeight && showOverflow) {
9509
+ ySpaceHeight = afterFullData.length * defaultRowHeight;
9510
+ topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
8982
9511
  } else {
8983
9512
  for (let i = 0; i < afterFullData.length; i++) {
8984
9513
  const row = afterFullData[i];
8985
9514
  const rowid = (0, _util.getRowid)($xeTable, row);
8986
9515
  const rowRest = fullAllDataRowIdData[rowid];
8987
- if (rowRest) {
8988
- ySpaceHeight += rowRest.height || rowHeight;
8989
- }
9516
+ ySpaceHeight += rowRest ? rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight : defaultRowHeight;
8990
9517
  }
8991
9518
  for (let i = 0; i < startIndex; i++) {
8992
9519
  const row = afterFullData[i];
8993
9520
  const rowid = (0, _util.getRowid)($xeTable, row);
8994
9521
  const rowRest = fullAllDataRowIdData[rowid];
8995
- if (rowRest) {
8996
- topSpaceHeight += rowRest.height || rowHeight;
8997
- }
9522
+ topSpaceHeight += rowRest ? rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight : defaultRowHeight;
8998
9523
  }
8999
9524
  }
9000
9525
  } else {
@@ -9019,7 +9544,7 @@ const Methods = {
9019
9544
  if (scrollYSpaceEl) {
9020
9545
  scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
9021
9546
  }
9022
- $xeTable.$nextTick(() => {
9547
+ return $xeTable.$nextTick().then(() => {
9023
9548
  updateStyle($xeTable);
9024
9549
  });
9025
9550
  },