vxe-table 3.9.21 → 3.10.0-beta.0

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 (88) hide show
  1. package/es/locale/lang/ja-JP.js +5 -5
  2. package/es/locale/lang/ko-KR.js +5 -5
  3. package/es/locale/lang/uk-UA.js +5 -5
  4. package/es/locale/lang/vi-VN.js +5 -5
  5. package/es/locale/lang/zh-CHT.js +5 -5
  6. package/es/locale/lang/zh-CN.js +5 -5
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/table/module/edit/mixin.js +3 -3
  10. package/es/table/src/body.js +50 -115
  11. package/es/table/src/footer.js +24 -21
  12. package/es/table/src/methods.js +392 -123
  13. package/es/table/src/table.js +68 -10
  14. package/es/table/src/util.js +58 -33
  15. package/es/table/style.css +46 -3
  16. package/es/table/style.min.css +1 -1
  17. package/es/ui/index.js +2 -2
  18. package/es/ui/src/log.js +1 -1
  19. package/es/vxe-table/style.css +46 -3
  20. package/es/vxe-table/style.min.css +1 -1
  21. package/lib/index.umd.js +672 -361
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/locale/lang/ja-JP.js +5 -5
  24. package/lib/locale/lang/ja-JP.min.js +1 -1
  25. package/lib/locale/lang/ja-JP.umd.js +5 -5
  26. package/lib/locale/lang/ko-KR.js +5 -5
  27. package/lib/locale/lang/ko-KR.min.js +1 -1
  28. package/lib/locale/lang/ko-KR.umd.js +5 -5
  29. package/lib/locale/lang/uk-UA.js +5 -5
  30. package/lib/locale/lang/uk-UA.min.js +1 -1
  31. package/lib/locale/lang/uk-UA.umd.js +5 -5
  32. package/lib/locale/lang/vi-VN.js +5 -5
  33. package/lib/locale/lang/vi-VN.min.js +1 -1
  34. package/lib/locale/lang/zh-CHT.js +5 -5
  35. package/lib/locale/lang/zh-CHT.min.js +1 -1
  36. package/lib/locale/lang/zh-CHT.umd.js +5 -5
  37. package/lib/locale/lang/zh-CN.js +5 -5
  38. package/lib/locale/lang/zh-CN.min.js +1 -1
  39. package/lib/locale/lang/zh-CN.umd.js +5 -5
  40. package/lib/style.css +1 -1
  41. package/lib/style.min.css +1 -1
  42. package/lib/table/module/edit/mixin.js +6 -3
  43. package/lib/table/module/edit/mixin.min.js +1 -1
  44. package/lib/table/src/body.js +49 -118
  45. package/lib/table/src/body.min.js +1 -1
  46. package/lib/table/src/footer.js +24 -33
  47. package/lib/table/src/footer.min.js +1 -1
  48. package/lib/table/src/methods.js +449 -148
  49. package/lib/table/src/methods.min.js +1 -1
  50. package/lib/table/src/table.js +61 -13
  51. package/lib/table/src/table.min.js +1 -1
  52. package/lib/table/src/util.js +72 -38
  53. package/lib/table/src/util.min.js +1 -1
  54. package/lib/table/style/style.css +46 -3
  55. package/lib/table/style/style.min.css +1 -1
  56. package/lib/ui/index.js +2 -2
  57. package/lib/ui/index.min.js +1 -1
  58. package/lib/ui/src/log.js +1 -1
  59. package/lib/ui/src/log.min.js +1 -1
  60. package/lib/vxe-table/style/style.css +46 -3
  61. package/lib/vxe-table/style/style.min.css +1 -1
  62. package/package.json +2 -2
  63. package/packages/locale/lang/ja-JP.ts +5 -5
  64. package/packages/locale/lang/ko-KR.ts +5 -5
  65. package/packages/locale/lang/uk-UA.ts +5 -5
  66. package/packages/locale/lang/vi-VN.ts +5 -5
  67. package/packages/locale/lang/zh-CHT.ts +5 -5
  68. package/packages/locale/lang/zh-CN.ts +5 -5
  69. package/packages/table/module/edit/mixin.ts +3 -3
  70. package/packages/table/src/body.ts +50 -118
  71. package/packages/table/src/footer.ts +24 -22
  72. package/packages/table/src/methods.ts +418 -127
  73. package/packages/table/src/props.ts +8 -8
  74. package/packages/table/src/table.ts +70 -10
  75. package/packages/table/src/util.ts +61 -36
  76. package/packages/ui/index.ts +1 -1
  77. package/styles/components/table-module/filter.scss +1 -1
  78. package/styles/components/table.scss +45 -6
  79. package/styles/modules.scss +0 -2
  80. package/styles/theme/base.scss +1 -1
  81. package/styles/theme/dark.scss +7 -4
  82. package/styles/variable.scss +5 -1
  83. /package/es/{iconfont.1729992873866.ttf → iconfont.1730347297462.ttf} +0 -0
  84. /package/es/{iconfont.1729992873866.woff → iconfont.1730347297462.woff} +0 -0
  85. /package/es/{iconfont.1729992873866.woff2 → iconfont.1730347297462.woff2} +0 -0
  86. /package/lib/{iconfont.1729992873866.ttf → iconfont.1730347297462.ttf} +0 -0
  87. /package/lib/{iconfont.1729992873866.woff → iconfont.1730347297462.woff} +0 -0
  88. /package/lib/{iconfont.1729992873866.woff2 → iconfont.1730347297462.woff2} +0 -0
@@ -3,10 +3,10 @@ import { browse, isPx, isScale, hasClass, addClass, removeClass, getEventTargetN
3
3
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
4
4
  import { VxeUI } from '../../ui';
5
5
  import Cell from './cell';
6
- import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, restoreScrollListener, getRootColumn } from './util';
6
+ import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn } from './util';
7
7
  import { getSlotVNs } from '../../ui/src/vn';
8
8
  import { warnLog, errLog } from '../../ui/src/log';
9
- const { getConfig, getI18n, renderer, formats, interceptor } = VxeUI;
9
+ const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI;
10
10
  const isWebkit = browse['-webkit'] && !browse.edge;
11
11
  const debounceScrollYDuration = browse.msie ? 80 : 20;
12
12
  const customStorageKey = 'VXE_CUSTOM_STORE';
@@ -68,7 +68,7 @@ function handleReserveRow(_vm, reserveRowMap) {
68
68
  });
69
69
  return reserveList;
70
70
  }
71
- function computeVirtualX(_vm) {
71
+ function handleVirtualXVisible(_vm) {
72
72
  const { $refs, visibleColumn } = _vm;
73
73
  const { tableBody } = $refs;
74
74
  const tableBodyElem = tableBody ? tableBody.$el : null;
@@ -94,14 +94,16 @@ function computeVirtualX(_vm) {
94
94
  }
95
95
  return { toVisibleIndex: 0, visibleSize: 6 };
96
96
  }
97
- function computeVirtualY(_vm) {
98
- const { $refs, computeSize, rowHeightMaps } = _vm;
99
- const { tableHeader, tableBody } = $refs;
97
+ const computeRowHeight = ($xeTable) => {
98
+ const { $refs, computeSize } = $xeTable;
99
+ const tableHeader = $refs.tableHeader;
100
+ const tableBody = $refs.tableBody;
100
101
  const tableBodyElem = tableBody ? tableBody.$el : null;
101
102
  const vSize = computeSize;
103
+ const rowHeightMaps = $xeTable.rowHeightMaps;
104
+ let rowHeight = 0;
102
105
  if (tableBodyElem) {
103
106
  const tableHeaderElem = tableHeader ? tableHeader.$el : null;
104
- let rowHeight = 0;
105
107
  let firstTrElem;
106
108
  firstTrElem = tableBodyElem.querySelector('tr');
107
109
  if (!firstTrElem && tableHeaderElem) {
@@ -113,10 +115,41 @@ function computeVirtualY(_vm) {
113
115
  if (!rowHeight) {
114
116
  rowHeight = rowHeightMaps[vSize || 'default'];
115
117
  }
116
- const visibleSize = Math.max(8, Math.ceil(tableBodyElem.clientHeight / rowHeight) + 2);
117
- return { rowHeight, visibleSize };
118
118
  }
119
- return { rowHeight: 0, visibleSize: 8 };
119
+ return rowHeight;
120
+ };
121
+ function handleVirtualYVisible($xeTable) {
122
+ const { $refs, scrollYStore, afterFullData, fullAllDataRowIdData } = $xeTable;
123
+ const tableBody = $refs.tableBody;
124
+ const tableBodyElem = tableBody ? tableBody.$el : null;
125
+ const { rowHeight } = scrollYStore;
126
+ if (tableBodyElem) {
127
+ const { scrollTop, clientHeight } = tableBodyElem;
128
+ const endHeight = scrollTop + clientHeight;
129
+ let toVisibleIndex = -1;
130
+ let offsetTop = 0;
131
+ let visibleSize = 0;
132
+ for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
133
+ const row = afterFullData[rIndex];
134
+ const rowid = getRowid($xeTable, row);
135
+ const rest = fullAllDataRowIdData[rowid];
136
+ if (!rest) {
137
+ break;
138
+ }
139
+ offsetTop += rest.height || rowHeight;
140
+ if (toVisibleIndex === -1 && scrollTop < offsetTop) {
141
+ toVisibleIndex = rIndex;
142
+ }
143
+ if (toVisibleIndex >= 0) {
144
+ visibleSize++;
145
+ if (offsetTop > endHeight) {
146
+ break;
147
+ }
148
+ }
149
+ }
150
+ return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(8, visibleSize) };
151
+ }
152
+ return { toVisibleIndex: 0, visibleSize: 8 };
120
153
  }
121
154
  function calculateMergerOffsetIndex(list, offsetItem, type) {
122
155
  for (let mcIndex = 0, len = list.length; mcIndex < len; mcIndex++) {
@@ -216,7 +249,7 @@ function clearAllSort(_vm) {
216
249
  column.order = null;
217
250
  });
218
251
  }
219
- function calcHeight(_vm, key) {
252
+ function calcTableHeight(_vm, key) {
220
253
  const { parentHeight } = _vm;
221
254
  const val = _vm[key];
222
255
  let num = 0;
@@ -237,6 +270,25 @@ function calcHeight(_vm, key) {
237
270
  }
238
271
  return num;
239
272
  }
273
+ const calcCellHeight = ($xeTable) => {
274
+ const { tableData, scrollYLoad, fullAllDataRowIdData } = $xeTable;
275
+ const el = $xeTable.$el;
276
+ if (scrollYLoad && el) {
277
+ tableData.forEach((row) => {
278
+ const rowid = getRowid($xeTable, row);
279
+ const rest = fullAllDataRowIdData[rowid];
280
+ const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
281
+ if (rest && trList.length) {
282
+ let height = 0;
283
+ for (let i = 0; i < trList.length; i++) {
284
+ const trEl = trList[i];
285
+ height = Math.max(height, trEl.offsetHeight);
286
+ }
287
+ rest.height = height;
288
+ }
289
+ });
290
+ }
291
+ };
240
292
  function getOrderField(_vm, column) {
241
293
  const { sortBy, sortType } = column;
242
294
  return (row) => {
@@ -442,9 +494,9 @@ const Methods = {
442
494
  if (!(this.height || this.maxHeight)) {
443
495
  errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
444
496
  }
445
- if (!this.showOverflow) {
446
- warnLog('vxe.error.reqProp', ['table.show-overflow']);
447
- }
497
+ // if (!this.showOverflow) {
498
+ // warnLog('vxe.error.reqProp', ['table.show-overflow'])
499
+ // }
448
500
  if (this.spanMethod) {
449
501
  warnLog('vxe.error.scrollErrProp', ['table.span-method']);
450
502
  }
@@ -659,7 +711,7 @@ const Methods = {
659
711
  }
660
712
  let cacheItem = fullAllDataRowIdData[rowid];
661
713
  if (!cacheItem) {
662
- cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent, level };
714
+ cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent, level, height: 0 };
663
715
  }
664
716
  if (isSource) {
665
717
  cacheItem.index = treeConfig && parent ? -1 : index;
@@ -729,7 +781,7 @@ const Methods = {
729
781
  XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
730
782
  const rowid = getRowid($xeTable, childRow);
731
783
  const parentRow = parent || parentRest.row;
732
- const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length };
784
+ const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0 };
733
785
  fullDataRowIdData[rowid] = rest;
734
786
  fullAllDataRowIdData[rowid] = rest;
735
787
  }, { children: childrenField });
@@ -759,7 +811,7 @@ const Methods = {
759
811
  let hasFixed;
760
812
  const handleFunc = (column, index, items, path, parent) => {
761
813
  const { id: colid, field, fixed, type, treeNode } = column;
762
- const rest = { column, colid, index, items, parent };
814
+ const rest = { column, colid, index, items, parent: parent || null, width: 0 };
763
815
  if (field) {
764
816
  if (process.env.NODE_ENV === 'development') {
765
817
  if (fullColumnFieldData[field]) {
@@ -870,9 +922,15 @@ const Methods = {
870
922
  if (tr) {
871
923
  const { fullAllDataRowIdData } = this;
872
924
  const rowid = tr.getAttribute('rowid');
873
- const rest = fullAllDataRowIdData[rowid];
874
- if (rest) {
875
- return { rowid: rest.rowid, item: rest.row, index: rest.index, items: rest.items, parent: rest.parent };
925
+ const rowRest = fullAllDataRowIdData[rowid];
926
+ if (rowRest) {
927
+ return {
928
+ rowid: rowRest.rowid,
929
+ item: rowRest.row,
930
+ index: rowRest.index,
931
+ items: rowRest.items,
932
+ parent: rowRest.parent
933
+ };
876
934
  }
877
935
  }
878
936
  return null;
@@ -885,9 +943,17 @@ const Methods = {
885
943
  if (cell) {
886
944
  const { fullColumnIdData } = this;
887
945
  const colid = cell.getAttribute('colid');
888
- const rest = fullColumnIdData[colid];
889
- if (rest) {
890
- return { colid: rest.colid, item: rest.column, index: rest.index, items: rest.items, parent: rest.parent };
946
+ if (colid) {
947
+ const colRest = fullColumnIdData[colid];
948
+ if (colRest) {
949
+ return {
950
+ colid: colRest.colid,
951
+ item: colRest.column,
952
+ index: colRest.index,
953
+ items: colRest.items,
954
+ parent: colRest.parent
955
+ };
956
+ }
891
957
  }
892
958
  }
893
959
  return null;
@@ -1204,13 +1270,13 @@ const Methods = {
1204
1270
  const { fullAllDataRowIdData } = $xeTable;
1205
1271
  const rowid = getRowid($xeTable, row);
1206
1272
  const colid = column.id;
1207
- const rest = fullAllDataRowIdData[rowid];
1208
- if (rest) {
1209
- formatData = rest.formatData;
1273
+ const rowRest = fullAllDataRowIdData[rowid];
1274
+ if (rowRest) {
1275
+ formatData = rowRest.formatData;
1210
1276
  if (!formatData) {
1211
1277
  formatData = fullAllDataRowIdData[rowid].formatData = {};
1212
1278
  }
1213
- if (rest && formatData[colid]) {
1279
+ if (rowRest && formatData[colid]) {
1214
1280
  if (formatData[colid].value === cellValue) {
1215
1281
  return formatData[colid].label;
1216
1282
  }
@@ -1538,14 +1604,14 @@ const Methods = {
1538
1604
  if (treeConfig) {
1539
1605
  XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
1540
1606
  const rowid = getRowid(this, row);
1541
- const allrest = fullAllDataRowIdData[rowid];
1607
+ const rowRest = fullAllDataRowIdData[rowid];
1542
1608
  const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
1543
- if (allrest) {
1544
- allrest.seq = seq;
1545
- allrest._index = index;
1609
+ if (rowRest) {
1610
+ rowRest.seq = seq;
1611
+ rowRest._index = index;
1546
1612
  }
1547
1613
  else {
1548
- const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0 };
1614
+ const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0 };
1549
1615
  fullAllDataRowIdData[rowid] = rest;
1550
1616
  fullDataRowIdData[rowid] = rest;
1551
1617
  }
@@ -1555,14 +1621,14 @@ const Methods = {
1555
1621
  else {
1556
1622
  afterFullData.forEach((row, index) => {
1557
1623
  const rowid = getRowid(this, row);
1558
- const allrest = fullAllDataRowIdData[rowid];
1624
+ const rowRest = fullAllDataRowIdData[rowid];
1559
1625
  const seq = index + 1;
1560
- if (allrest) {
1561
- allrest.seq = seq;
1562
- allrest._index = index;
1626
+ if (rowRest) {
1627
+ rowRest.seq = seq;
1628
+ rowRest._index = index;
1563
1629
  }
1564
1630
  else {
1565
- const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0 };
1631
+ const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0 };
1566
1632
  fullAllDataRowIdData[rowid] = rest;
1567
1633
  fullDataRowIdData[rowid] = rest;
1568
1634
  }
@@ -2078,7 +2144,7 @@ const Methods = {
2078
2144
  warnLog('vxe.error.scrollErrProp', ['footer-span-method']);
2079
2145
  }
2080
2146
  }
2081
- const { visibleSize } = computeVirtualX(this);
2147
+ const { visibleSize } = handleVirtualXVisible(this);
2082
2148
  scrollXStore.startIndex = 0;
2083
2149
  scrollXStore.endIndex = visibleSize;
2084
2150
  scrollXStore.visibleSize = visibleSize;
@@ -2092,9 +2158,9 @@ const Methods = {
2092
2158
  this.scrollXLoad = scrollXLoad;
2093
2159
  visibleColumn.forEach((column, index) => {
2094
2160
  const colid = column.id;
2095
- const rest = fullColumnIdData[colid];
2096
- if (rest) {
2097
- rest._index = index;
2161
+ const colRest = fullColumnIdData[colid];
2162
+ if (colRest) {
2163
+ colRest._index = index;
2098
2164
  }
2099
2165
  });
2100
2166
  this.visibleColumn = visibleColumn;
@@ -2188,30 +2254,26 @@ const Methods = {
2188
2254
  * 计算单元格列宽,动态分配可用剩余空间
2189
2255
  * 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
2190
2256
  */
2191
- recalculate(refull) {
2192
- const { $refs } = this;
2193
- const { tableBody, tableHeader, tableFooter } = $refs;
2194
- const bodyElem = tableBody ? tableBody.$el : null;
2195
- const headerElem = tableHeader ? tableHeader.$el : null;
2196
- const footerElem = tableFooter ? tableFooter.$el : null;
2257
+ recalculate(reFull) {
2197
2258
  const el = this.$el;
2198
2259
  if (!el || !el.clientWidth) {
2199
2260
  return this.$nextTick();
2200
2261
  }
2201
- if (bodyElem) {
2202
- this.calcCellWidth();
2203
- this.autoCellWidth(headerElem, bodyElem, footerElem);
2204
- if (refull === true) {
2205
- // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2206
- return this.computeScrollLoad().then(() => {
2207
- this.autoCellWidth(headerElem, bodyElem, footerElem);
2208
- return this.computeScrollLoad();
2209
- });
2210
- }
2262
+ calcCellHeight(this);
2263
+ this.calcCellWidth();
2264
+ this.autoCellWidth();
2265
+ if (reFull === true) {
2266
+ // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2267
+ return this.computeScrollLoad().then(() => {
2268
+ calcCellHeight(this);
2269
+ this.autoCellWidth();
2270
+ return this.computeScrollLoad();
2271
+ });
2211
2272
  }
2212
2273
  return this.computeScrollLoad();
2213
2274
  },
2214
2275
  calcCellWidth() {
2276
+ const $xeTable = this;
2215
2277
  const { autoWidthColumnList, tableData } = this;
2216
2278
  if (!tableData.length || !autoWidthColumnList.length) {
2217
2279
  this.isCalcColumn = false;
@@ -2219,9 +2281,13 @@ const Methods = {
2219
2281
  }
2220
2282
  this.isCalcColumn = true;
2221
2283
  return this.$nextTick().then(() => {
2284
+ const internalData = $xeTable;
2285
+ const { fullColumnIdData } = internalData;
2222
2286
  const el = this.$el;
2223
2287
  if (el) {
2224
2288
  autoWidthColumnList.forEach((column) => {
2289
+ const colid = column.id;
2290
+ const colRest = fullColumnIdData[colid];
2225
2291
  const cellElList = el.querySelectorAll(`.vxe-header--column.${column.id}>.vxe-cell,.vxe-body--column.${column.id}>.vxe-cell,.vxe-footer--column.${column.id}>.vxe-cell`);
2226
2292
  const firstCellEl = cellElList[0];
2227
2293
  let paddingSize = 0;
@@ -2249,6 +2315,9 @@ const Methods = {
2249
2315
  colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
2250
2316
  }
2251
2317
  });
2318
+ if (colRest) {
2319
+ colRest.width = Math.max(colWidth, colRest.width);
2320
+ }
2252
2321
  column.renderAutoWidth = colWidth + paddingSize;
2253
2322
  });
2254
2323
  this.analyColumnWidth();
@@ -2261,12 +2330,13 @@ const Methods = {
2261
2330
  * 支持 px、%、固定 混合分配
2262
2331
  * 支持动态列表调整分配
2263
2332
  * 支持自动分配偏移量
2264
- * @param {Element} headerElem
2265
- * @param {Element} bodyElem
2266
- * @param {Element} footerElem
2267
- * @param {Number} bodyWidth
2268
2333
  */
2269
- autoCellWidth(headerElem, bodyElem, footerElem) {
2334
+ autoCellWidth() {
2335
+ const { $refs } = this;
2336
+ const { tableBody, tableHeader, tableFooter } = $refs;
2337
+ const bodyElem = tableBody ? tableBody.$el : null;
2338
+ const headerElem = tableHeader ? tableHeader.$el : null;
2339
+ const footerElem = tableFooter ? tableFooter.$el : null;
2270
2340
  let tableWidth = 0;
2271
2341
  const minCellWidth = 40; // 列宽最少限制 40px
2272
2342
  const bodyWidth = bodyElem.clientWidth - 1;
@@ -2392,13 +2462,37 @@ const Methods = {
2392
2462
  this.checkScrolling();
2393
2463
  }
2394
2464
  },
2465
+ calcCellHeight() {
2466
+ const $xeTable = this;
2467
+ const reactData = $xeTable;
2468
+ const internalData = $xeTable;
2469
+ const { tableData, scrollYLoad } = reactData;
2470
+ const { fullAllDataRowIdData } = internalData;
2471
+ const el = $xeTable.$el;
2472
+ if (scrollYLoad && el) {
2473
+ tableData.forEach((row) => {
2474
+ const rowid = getRowid($xeTable, row);
2475
+ const rowRest = fullAllDataRowIdData[rowid];
2476
+ const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
2477
+ if (rowRest && trList.length) {
2478
+ let height = 0;
2479
+ for (let i = 0; i < trList.length; i++) {
2480
+ const trEl = trList[i];
2481
+ height = Math.max(height, trEl.offsetHeight);
2482
+ }
2483
+ rowRest.height = height;
2484
+ }
2485
+ });
2486
+ }
2487
+ },
2395
2488
  updateHeight() {
2396
- this.customHeight = calcHeight(this, 'height');
2397
- this.customMinHeight = calcHeight(this, 'minHeight');
2398
- this.customMaxHeight = calcHeight(this, 'maxHeight');
2489
+ this.customHeight = calcTableHeight(this, 'height');
2490
+ this.customMinHeight = calcTableHeight(this, 'minHeight');
2491
+ this.customMaxHeight = calcTableHeight(this, 'maxHeight');
2399
2492
  },
2400
2493
  updateStyle() {
2401
- let { $refs, isGroup, fullColumnIdData, tableColumn, customHeight, customMinHeight, customMaxHeight, border, headerHeight, showFooter, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, footerHeight, tableHeight, tableWidth, scrollbarHeight, scrollbarWidth, scrollXLoad, scrollYLoad, cellOffsetWidth, columnStore, elemStore, editStore, currentRow, mouseConfig, keyboardConfig, keyboardOpts, spanMethod, mergeList, mergeFooterList, footerSpanMethod, isAllOverflow, visibleColumn } = this;
2494
+ const $xeTable = this;
2495
+ let { $refs, isGroup, fullColumnIdData, tableColumn, customHeight, customMinHeight, customMaxHeight, border, headerHeight, showFooter, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, footerHeight, tableHeight, tableWidth, scrollbarHeight, scrollbarWidth, scrollXLoad, scrollYLoad, overflowX, cellOffsetWidth, columnStore, elemStore, editStore, currentRow, mouseConfig, keyboardConfig, keyboardOpts, spanMethod, mergeList, mergeFooterList, footerSpanMethod, isAllOverflow, visibleColumn } = $xeTable;
2402
2496
  const containerList = ['main', 'left', 'right'];
2403
2497
  const emptyPlaceholderElem = $refs.emptyPlaceholder;
2404
2498
  const bodyWrapperElem = elemStore['main-body-wrapper'];
@@ -2411,6 +2505,30 @@ const Methods = {
2411
2505
  customHeight += scrollbarHeight;
2412
2506
  }
2413
2507
  }
2508
+ const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
2509
+ if (scrollXVirtualEl) {
2510
+ scrollXVirtualEl.style.height = `${scrollbarHeight}px`;
2511
+ }
2512
+ const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
2513
+ if (scrollYVirtualEl) {
2514
+ let bodyHeight = 0;
2515
+ let bodyMaxHeight = 0;
2516
+ const bodyMinHeight = customMinHeight - headerHeight - footerHeight;
2517
+ if (customMaxHeight) {
2518
+ bodyMaxHeight = customMaxHeight - headerHeight - footerHeight;
2519
+ bodyMaxHeight = Math.max(bodyMinHeight, bodyMaxHeight);
2520
+ }
2521
+ if (customHeight) {
2522
+ bodyHeight = customHeight - headerHeight - footerHeight;
2523
+ if (bodyMaxHeight) {
2524
+ bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
2525
+ }
2526
+ bodyHeight = Math.max(bodyMinHeight, bodyHeight);
2527
+ }
2528
+ scrollYVirtualEl.style.top = `${headerHeight}px`;
2529
+ scrollYVirtualEl.style.width = `${scrollbarWidth}px`;
2530
+ scrollYVirtualEl.style.height = `${bodyHeight + (overflowX ? -Math.max(1, scrollbarHeight) : 0)}px`;
2531
+ }
2414
2532
  containerList.forEach((name, index) => {
2415
2533
  const fixedType = index > 0 ? name : '';
2416
2534
  const layoutList = ['header', 'body', 'footer'];
@@ -2581,7 +2699,8 @@ const Methods = {
2581
2699
  colElem.style.width = `${scrollbarWidth}px`;
2582
2700
  }
2583
2701
  if (fullColumnIdData[colid]) {
2584
- const column = fullColumnIdData[colid].column;
2702
+ const colRest = fullColumnIdData[colid];
2703
+ const column = colRest.column;
2585
2704
  const { showHeaderOverflow, showFooterOverflow, showOverflow } = column;
2586
2705
  let cellOverflow;
2587
2706
  colElem.style.width = `${column.renderWidth}px`;
@@ -2646,11 +2765,14 @@ const Methods = {
2646
2765
  * 处理固定列的显示状态
2647
2766
  */
2648
2767
  checkScrolling() {
2649
- const { tableBody, leftContainer, rightContainer } = this.$refs;
2768
+ const $xeTable = this;
2769
+ const { tableBody, leftContainer, rightContainer } = $xeTable.$refs;
2650
2770
  const bodyElem = tableBody ? tableBody.$el : null;
2651
- if (bodyElem) {
2771
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
2772
+ const bodtTargetEl = xHandleEl || bodyElem;
2773
+ if (bodtTargetEl) {
2652
2774
  if (leftContainer) {
2653
- if (bodyElem.scrollLeft > 0) {
2775
+ if (bodtTargetEl.scrollLeft > 0) {
2654
2776
  addClass(leftContainer, 'scrolling--middle');
2655
2777
  }
2656
2778
  else {
@@ -2658,7 +2780,7 @@ const Methods = {
2658
2780
  }
2659
2781
  }
2660
2782
  if (rightContainer) {
2661
- if (bodyElem.clientWidth < bodyElem.scrollWidth - Math.ceil(bodyElem.scrollLeft)) {
2783
+ if (bodtTargetEl.clientWidth < bodtTargetEl.scrollWidth - Math.ceil(bodtTargetEl.scrollLeft)) {
2662
2784
  addClass(rightContainer, 'scrolling--middle');
2663
2785
  }
2664
2786
  else {
@@ -4662,17 +4784,17 @@ const Methods = {
4662
4784
  isRowExpandLoaded(row) {
4663
4785
  const $xeTable = this;
4664
4786
  const { fullAllDataRowIdData } = this;
4665
- const rest = fullAllDataRowIdData[getRowid($xeTable, row)];
4666
- return rest && !!rest.expandLoaded;
4787
+ const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)];
4788
+ return rowRest && !!rowRest.expandLoaded;
4667
4789
  },
4668
4790
  clearRowExpandLoaded(row) {
4669
4791
  const $xeTable = this;
4670
4792
  const { expandOpts, rowExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
4671
4793
  const { lazy } = expandOpts;
4672
4794
  const rowid = getRowid($xeTable, row);
4673
- const rest = fullAllDataRowIdData[rowid];
4674
- if (lazy && rest) {
4675
- rest.expandLoaded = false;
4795
+ const rowRest = fullAllDataRowIdData[rowid];
4796
+ if (lazy && rowRest) {
4797
+ rowRest.expandLoaded = false;
4676
4798
  const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
4677
4799
  if (rowTempExpandLazyLoadedMaps[rowid]) {
4678
4800
  delete rowTempExpandLazyLoadedMaps[rowid];
@@ -4773,14 +4895,14 @@ const Methods = {
4773
4895
  if (loadMethod) {
4774
4896
  const { rowExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
4775
4897
  const rowid = getRowid($xeTable, row);
4776
- const rest = fullAllDataRowIdData[rowid];
4898
+ const rowRest = fullAllDataRowIdData[rowid];
4777
4899
  rowExpandLazyLoadedMaps[rowid] = row;
4778
4900
  loadMethod({ $table: $xeTable, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }).then(() => {
4779
4901
  const { rowExpandedMaps } = this;
4780
- rest.expandLoaded = true;
4902
+ rowRest.expandLoaded = true;
4781
4903
  rowExpandedMaps[rowid] = row;
4782
4904
  }).catch(() => {
4783
- rest.expandLoaded = false;
4905
+ rowRest.expandLoaded = false;
4784
4906
  }).finally(() => {
4785
4907
  const { rowExpandLazyLoadedMaps } = this;
4786
4908
  if (rowExpandLazyLoadedMaps[rowid]) {
@@ -4822,8 +4944,8 @@ const Methods = {
4822
4944
  validRows.forEach((row) => {
4823
4945
  const rowid = getRowid(this, row);
4824
4946
  if (!rExpandedMaps[rowid]) {
4825
- const rest = fullAllDataRowIdData[rowid];
4826
- const isLoad = lazy && !rest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
4947
+ const rowRest = fullAllDataRowIdData[rowid];
4948
+ const isLoad = lazy && !rowRest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
4827
4949
  if (isLoad) {
4828
4950
  lazyRests.push(this.handleAsyncRowExpand(row));
4829
4951
  }
@@ -4934,17 +5056,17 @@ const Methods = {
4934
5056
  isTreeExpandLoaded(row) {
4935
5057
  const $xeTable = this;
4936
5058
  const { fullAllDataRowIdData } = this;
4937
- const rest = fullAllDataRowIdData[getRowid($xeTable, row)];
4938
- return rest && !!rest.treeLoaded;
5059
+ const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)];
5060
+ return rowRest && !!rowRest.treeLoaded;
4939
5061
  },
4940
5062
  clearTreeExpandLoaded(row) {
4941
5063
  const $xeTable = this;
4942
5064
  const { treeOpts, treeExpandedMaps, fullAllDataRowIdData } = this;
4943
5065
  const { transform, lazy } = treeOpts;
4944
5066
  const rowid = getRowid($xeTable, row);
4945
- const rest = fullAllDataRowIdData[rowid];
4946
- if (lazy && rest) {
4947
- rest.treeLoaded = false;
5067
+ const rowRest = fullAllDataRowIdData[rowid];
5068
+ if (lazy && rowRest) {
5069
+ rowRest.treeLoaded = false;
4948
5070
  if (treeExpandedMaps[rowid]) {
4949
5071
  delete treeExpandedMaps[rowid];
4950
5072
  }
@@ -5044,10 +5166,10 @@ const Methods = {
5044
5166
  if (loadMethod) {
5045
5167
  const { treeExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
5046
5168
  const rowid = getRowid($xeTable, row);
5047
- const rest = fullAllDataRowIdData[rowid];
5169
+ const rowRest = fullAllDataRowIdData[rowid];
5048
5170
  treeExpandLazyLoadedMaps[rowid] = row;
5049
5171
  Promise.resolve(loadMethod({ $table: $xeTable, row })).then((childRecords) => {
5050
- rest.treeLoaded = true;
5172
+ rowRest.treeLoaded = true;
5051
5173
  if (treeExpandLazyLoadedMaps[rowid]) {
5052
5174
  delete treeExpandLazyLoadedMaps[rowid];
5053
5175
  }
@@ -5073,7 +5195,7 @@ const Methods = {
5073
5195
  }
5074
5196
  }).catch(() => {
5075
5197
  const { treeExpandLazyLoadedMaps } = this;
5076
- rest.treeLoaded = false;
5198
+ rowRest.treeLoaded = false;
5077
5199
  if (treeExpandLazyLoadedMaps[rowid]) {
5078
5200
  delete treeExpandLazyLoadedMaps[rowid];
5079
5201
  }
@@ -5136,8 +5258,8 @@ const Methods = {
5136
5258
  validRows.forEach((row) => {
5137
5259
  const rowid = getRowid(this, row);
5138
5260
  if (!treeTempExpandedMaps[rowid]) {
5139
- const rest = fullAllDataRowIdData[rowid];
5140
- const isLoad = lazy && row[hasChildField] && !rest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
5261
+ const rowRest = fullAllDataRowIdData[rowid];
5262
+ const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
5141
5263
  // 是否使用懒加载
5142
5264
  if (isLoad) {
5143
5265
  result.push(this.handleAsyncTreeExpandChilds(row));
@@ -5273,7 +5395,7 @@ const Methods = {
5273
5395
  loadScrollXData() {
5274
5396
  const { mergeList, mergeFooterList, scrollXStore } = this;
5275
5397
  const { startIndex, endIndex, offsetSize } = scrollXStore;
5276
- const { toVisibleIndex, visibleSize } = computeVirtualX(this);
5398
+ const { toVisibleIndex, visibleSize } = handleVirtualXVisible(this);
5277
5399
  const offsetItem = {
5278
5400
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
5279
5401
  endIndex: toVisibleIndex + visibleSize + offsetSize
@@ -5289,32 +5411,114 @@ const Methods = {
5289
5411
  }
5290
5412
  this.closeTooltip();
5291
5413
  },
5414
+ handleScrollEvent(evnt, isRollY, isRollX, params) {
5415
+ const $xeTable = this;
5416
+ const props = $xeTable;
5417
+ const { highlightHoverRow } = props;
5418
+ const tableBody = $xeTable.$refs.tableBody;
5419
+ const bodyElem = tableBody ? tableBody.$el : null;
5420
+ const rowOpts = $xeTable.computeRowOpts;
5421
+ const validTip = $xeTable.$refs.validTip;
5422
+ const tooltip = $xeTable.$refs.tooltip;
5423
+ if (rowOpts.isHover || highlightHoverRow) {
5424
+ $xeTable.clearHoverRow();
5425
+ }
5426
+ if (validTip && validTip.visible) {
5427
+ validTip.close();
5428
+ }
5429
+ if (tooltip && tooltip.visible) {
5430
+ tooltip.close();
5431
+ }
5432
+ if (isRollX) {
5433
+ $xeTable.checkScrolling();
5434
+ }
5435
+ const bodyHeight = bodyElem ? bodyElem.clientHeight : 0;
5436
+ const bodyWidth = bodyElem ? bodyElem.clientWidth : 0;
5437
+ const scrollHeight = bodyElem ? bodyElem.scrollHeight : 0;
5438
+ const scrollWidth = bodyElem ? bodyElem.scrollWidth : 0;
5439
+ $xeTable.dispatchEvent('scroll', Object.assign({ bodyHeight,
5440
+ bodyWidth,
5441
+ scrollHeight,
5442
+ scrollWidth, isX: isRollX, isY: isRollY }, params), evnt);
5443
+ },
5292
5444
  /**
5293
5445
  * 纵向 Y 可视渲染事件处理
5294
5446
  */
5295
- triggerScrollYEvent(evnt) {
5447
+ triggerScrollYEvent() {
5296
5448
  const { scrollYStore } = this;
5297
5449
  const { adaptive, offsetSize, visibleSize } = scrollYStore;
5298
5450
  // webkit 浏览器使用最佳的渲染方式,且最高渲染量不能大于 40 条
5299
5451
  if (isWebkit && adaptive && (offsetSize * 2 + visibleSize) <= 40) {
5300
- this.loadScrollYData(evnt);
5452
+ this.loadScrollYData();
5301
5453
  }
5302
5454
  else {
5303
- this.debounceScrollY(evnt);
5455
+ this.debounceScrollYData();
5304
5456
  }
5457
+ this.debounceScrollYCalculate();
5305
5458
  },
5306
- debounceScrollY: XEUtils.debounce(function (evnt) {
5307
- this.loadScrollYData(evnt);
5459
+ debounceScrollYData: XEUtils.debounce(function () {
5460
+ this.loadScrollYData();
5308
5461
  }, debounceScrollYDuration, { leading: false, trailing: true }),
5462
+ scrollXEvent(evnt) {
5463
+ const $xeTable = this;
5464
+ const wrapperEl = evnt.currentTarget;
5465
+ const tableHeader = $xeTable.$refs.tableHeader;
5466
+ const tableBody = $xeTable.$refs.tableBody;
5467
+ const tableFooter = $xeTable.$refs.tableFooter;
5468
+ const bodyElem = tableBody.$el;
5469
+ const headerElem = tableHeader ? tableHeader.$el : null;
5470
+ const footerElem = tableFooter ? tableFooter.$el : null;
5471
+ const { scrollTop, scrollLeft } = wrapperEl;
5472
+ const isRollX = true;
5473
+ const isRollY = false;
5474
+ $xeTable.lastScrollLeft = scrollLeft;
5475
+ $xeTable.lastScrollTime = Date.now();
5476
+ setScrollLeft(bodyElem, scrollLeft);
5477
+ setScrollLeft(headerElem, scrollLeft);
5478
+ setScrollLeft(footerElem, scrollLeft);
5479
+ $xeTable.triggerScrollXEvent(evnt);
5480
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
5481
+ type: 'table',
5482
+ fixed: '',
5483
+ scrollTop,
5484
+ scrollLeft
5485
+ });
5486
+ },
5487
+ debounceScrollYCalculate: XEUtils.debounce(function () {
5488
+ this.updateScrollYSpace();
5489
+ }, 1000, { leading: false, trailing: true }),
5490
+ scrollYEvent(evnt) {
5491
+ const $xeTable = this;
5492
+ const wrapperEl = evnt.currentTarget;
5493
+ const tableBody = $xeTable.$refs.tableBody;
5494
+ const leftBody = $xeTable.$refs.leftBody;
5495
+ const rightBody = $xeTable.$refs.rightBody;
5496
+ const bodyElem = tableBody.$el;
5497
+ const leftElem = leftBody ? leftBody.$el : null;
5498
+ const rightElem = rightBody ? rightBody.$el : null;
5499
+ const { scrollTop, scrollLeft } = wrapperEl;
5500
+ const isRollX = false;
5501
+ const isRollY = true;
5502
+ $xeTable.lastScrollTop = scrollTop;
5503
+ $xeTable.lastScrollTime = Date.now();
5504
+ setScrollTop(bodyElem, scrollTop);
5505
+ setScrollTop(leftElem, scrollTop);
5506
+ setScrollTop(rightElem, scrollTop);
5507
+ $xeTable.triggerScrollYEvent(evnt);
5508
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
5509
+ type: 'table',
5510
+ fixed: '',
5511
+ scrollTop,
5512
+ scrollLeft
5513
+ });
5514
+ },
5309
5515
  /**
5310
5516
  * 纵向 Y 可视渲染处理
5311
5517
  */
5312
- loadScrollYData(evnt) {
5518
+ loadScrollYData() {
5313
5519
  const { mergeList, scrollYStore } = this;
5314
- const { startIndex, endIndex, visibleSize, offsetSize, rowHeight } = scrollYStore;
5315
- const scrollBodyElem = evnt.currentTarget || evnt.target;
5316
- const scrollTop = scrollBodyElem.scrollTop;
5317
- const toVisibleIndex = Math.floor(scrollTop / rowHeight);
5520
+ const { startIndex, endIndex, offsetSize } = scrollYStore;
5521
+ const { toVisibleIndex, visibleSize } = handleVirtualYVisible(this);
5318
5522
  const offsetItem = {
5319
5523
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
5320
5524
  endIndex: toVisibleIndex + visibleSize + offsetSize
@@ -5335,7 +5539,7 @@ const Methods = {
5335
5539
  const { sYOpts, sXOpts, scrollXLoad, scrollYLoad, scrollXStore, scrollYStore } = this;
5336
5540
  // 计算 X 逻辑
5337
5541
  if (scrollXLoad) {
5338
- const { visibleSize: visibleXSize } = computeVirtualX(this);
5542
+ const { visibleSize: visibleXSize } = handleVirtualXVisible(this);
5339
5543
  const offsetXSize = sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : browse.msie ? 10 : (browse.edge ? 5 : 0);
5340
5544
  scrollXStore.offsetSize = offsetXSize;
5341
5545
  scrollXStore.visibleSize = visibleXSize;
@@ -5345,9 +5549,12 @@ const Methods = {
5345
5549
  else {
5346
5550
  this.updateScrollXSpace();
5347
5551
  }
5552
+ calcCellHeight(this);
5348
5553
  // 计算 Y 逻辑
5349
- const { rowHeight, visibleSize: visibleYSize } = computeVirtualY(this);
5554
+ const rowHeight = computeRowHeight(this);
5350
5555
  scrollYStore.rowHeight = rowHeight;
5556
+ this.rowHeight = rowHeight;
5557
+ const { visibleSize: visibleYSize } = handleVirtualYVisible(this);
5351
5558
  if (scrollYLoad) {
5352
5559
  const offsetYSize = sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : browse.msie ? 20 : (browse.edge ? 10 : 0);
5353
5560
  scrollYStore.offsetSize = offsetYSize;
@@ -5358,13 +5565,20 @@ const Methods = {
5358
5565
  else {
5359
5566
  this.updateScrollYSpace();
5360
5567
  }
5361
- this.rowHeight = rowHeight;
5362
5568
  this.$nextTick(this.updateStyle);
5363
5569
  });
5364
5570
  },
5365
5571
  handleTableColumn() {
5366
- const { scrollXLoad, visibleColumn, scrollXStore } = this;
5367
- this.tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
5572
+ const { scrollXLoad, visibleColumn, scrollXStore, fullColumnIdData } = this;
5573
+ const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
5574
+ tableColumn.forEach((column, $index) => {
5575
+ const colid = column.id;
5576
+ const colRest = fullColumnIdData[colid];
5577
+ if (colRest) {
5578
+ colRest.$index = $index;
5579
+ }
5580
+ });
5581
+ this.tableColumn = tableColumn;
5368
5582
  },
5369
5583
  updateScrollXData() {
5370
5584
  // this.tableColumn = []
@@ -5375,7 +5589,8 @@ const Methods = {
5375
5589
  },
5376
5590
  // 更新横向 X 可视渲染上下剩余空间大小
5377
5591
  updateScrollXSpace() {
5378
- const { $refs, isGroup, elemStore, visibleColumn, scrollXStore, scrollXLoad, tableWidth, scrollbarWidth } = this;
5592
+ const $xeTable = this;
5593
+ const { $refs, isGroup, elemStore, visibleColumn, scrollXStore, scrollXLoad, tableWidth, scrollbarWidth } = $xeTable;
5379
5594
  const { tableHeader, tableBody, tableFooter } = $refs;
5380
5595
  const tableBodyElem = tableBody ? tableBody.$el : null;
5381
5596
  if (tableBodyElem) {
@@ -5406,26 +5621,55 @@ const Methods = {
5406
5621
  }
5407
5622
  });
5408
5623
  });
5624
+ const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
5625
+ if (scrollXSpaceEl) {
5626
+ scrollXSpaceEl.style.width = `${tableWidth + scrollbarWidth}px`;
5627
+ }
5409
5628
  this.$nextTick(this.updateStyle);
5410
5629
  }
5411
5630
  },
5412
5631
  updateScrollYData() {
5632
+ const $xeTable = this;
5413
5633
  // this.tableData = []
5414
5634
  this.$nextTick(() => {
5415
5635
  this.handleTableData();
5636
+ calcCellHeight($xeTable);
5416
5637
  this.updateScrollYSpace();
5417
5638
  });
5418
5639
  },
5419
5640
  // 更新纵向 Y 可视渲染上下剩余空间大小
5420
5641
  updateScrollYSpace() {
5421
- const { elemStore, scrollYStore, scrollYLoad, afterFullData } = this;
5642
+ const $xeTable = this;
5643
+ const { showOverflow, elemStore, scrollYStore, scrollYLoad, afterFullData, fullAllDataRowIdData } = this;
5422
5644
  const { startIndex, rowHeight } = scrollYStore;
5423
- const bodyHeight = afterFullData.length * rowHeight;
5424
- const topSpaceHeight = Math.max(0, startIndex * rowHeight);
5645
+ let bodyHeight = 0;
5646
+ let topSpaceHeight = 0;
5425
5647
  const containerList = ['main', 'left', 'right'];
5426
5648
  let marginTop = '';
5427
5649
  let ySpaceHeight = '';
5428
5650
  if (scrollYLoad) {
5651
+ if (showOverflow) {
5652
+ bodyHeight = afterFullData.length * rowHeight;
5653
+ topSpaceHeight = Math.max(0, startIndex * rowHeight);
5654
+ }
5655
+ else {
5656
+ for (let i = 0; i < afterFullData.length; i++) {
5657
+ const row = afterFullData[i];
5658
+ const rowid = getRowid($xeTable, row);
5659
+ const rowRest = fullAllDataRowIdData[rowid];
5660
+ if (rowRest) {
5661
+ bodyHeight += rowRest.height || rowHeight;
5662
+ }
5663
+ }
5664
+ for (let i = 0; i < startIndex; i++) {
5665
+ const row = afterFullData[i];
5666
+ const rowid = getRowid($xeTable, row);
5667
+ const rowRest = fullAllDataRowIdData[rowid];
5668
+ if (rowRest) {
5669
+ topSpaceHeight += rowRest.height || rowHeight;
5670
+ }
5671
+ }
5672
+ }
5429
5673
  marginTop = `${topSpaceHeight}px`;
5430
5674
  ySpaceHeight = `${bodyHeight}px`;
5431
5675
  }
@@ -5442,6 +5686,10 @@ const Methods = {
5442
5686
  }
5443
5687
  });
5444
5688
  });
5689
+ const scrollYSpaceEl = $xeTable.$refs.refScrollYSpaceElem;
5690
+ if (scrollYSpaceEl) {
5691
+ scrollYSpaceEl.style.height = ySpaceHeight;
5692
+ }
5445
5693
  this.$nextTick(this.updateStyle);
5446
5694
  },
5447
5695
  /**
@@ -5523,28 +5771,44 @@ const Methods = {
5523
5771
  * 手动清除滚动相关信息,还原到初始状态
5524
5772
  */
5525
5773
  clearScroll() {
5526
- const { $refs, scrollXStore, scrollYStore } = this;
5527
- const { tableBody, rightBody, tableFooter } = $refs;
5774
+ const $xeTable = this;
5775
+ const { $refs, scrollXStore, scrollYStore } = $xeTable;
5776
+ const { tableBody, tableHeader, leftBody, rightBody, tableFooter } = $refs;
5528
5777
  const tableBodyElem = tableBody ? tableBody.$el : null;
5778
+ const leftBodyElem = leftBody ? leftBody.$el : null;
5529
5779
  const rightBodyElem = rightBody ? rightBody.$el : null;
5780
+ const tableHeaderElem = tableHeader ? tableHeader.$el : null;
5530
5781
  const tableFooterElem = tableFooter ? tableFooter.$el : null;
5531
- if (rightBodyElem) {
5532
- restoreScrollListener(rightBodyElem);
5533
- rightBodyElem.scrollTop = 0;
5782
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
5783
+ if (xHandleEl) {
5784
+ setScrollLeft(xHandleEl, 0);
5534
5785
  }
5535
- if (tableFooterElem) {
5536
- tableFooterElem.scrollLeft = 0;
5786
+ else {
5787
+ setScrollLeft(tableBodyElem, 0);
5788
+ setScrollLeft(tableHeaderElem, 0);
5789
+ setScrollLeft(tableFooterElem, 0);
5537
5790
  }
5538
- if (tableBodyElem) {
5539
- restoreScrollListener(tableBodyElem);
5540
- tableBodyElem.scrollTop = 0;
5541
- tableBodyElem.scrollLeft = 0;
5791
+ const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
5792
+ if (yHandleEl) {
5793
+ setScrollTop(yHandleEl, 0);
5794
+ }
5795
+ else {
5796
+ setScrollTop(tableBodyElem, 0);
5797
+ setScrollTop(leftBodyElem, 0);
5798
+ setScrollTop(rightBodyElem, 0);
5542
5799
  }
5543
5800
  scrollXStore.startIndex = 0;
5544
5801
  scrollXStore.endIndex = scrollXStore.visibleSize;
5545
5802
  scrollYStore.startIndex = 0;
5546
5803
  scrollYStore.endIndex = scrollYStore.visibleSize;
5547
- return this.$nextTick();
5804
+ return $xeTable.$nextTick().then(() => {
5805
+ setScrollLeft(tableBodyElem, 0);
5806
+ setScrollLeft(tableHeaderElem, 0);
5807
+ setScrollLeft(tableFooterElem, 0);
5808
+ setScrollTop(tableBodyElem, 0);
5809
+ setScrollTop(leftBodyElem, 0);
5810
+ setScrollTop(rightBodyElem, 0);
5811
+ });
5548
5812
  },
5549
5813
  /**
5550
5814
  * 更新表尾合计
@@ -5697,6 +5961,11 @@ const Methods = {
5697
5961
  }
5698
5962
  return this.$nextTick();
5699
5963
  },
5964
+ dispatchEvent(type, params, evnt) {
5965
+ const $xeTable = this;
5966
+ $xeTable.$emit(type, createEvent(evnt, { $table: $xeTable, $grid: $xeTable.$xegrid }, params));
5967
+ },
5968
+ // 已废弃,使用 dispatchEvent
5700
5969
  emitEvent(type, params, evnt) {
5701
5970
  this.$emit(type, Object.assign({ $table: this, $grid: this.$xegrid, $event: evnt }, params));
5702
5971
  },