vxe-table 3.12.15 → 3.12.17

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 (48) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/edit/mixin.js +224 -158
  6. package/es/table/src/body.js +60 -47
  7. package/es/table/src/methods.js +166 -36
  8. package/es/table/src/table.js +101 -23
  9. package/es/table/style.css +26 -0
  10. package/es/table/style.min.css +1 -1
  11. package/es/ui/index.js +1 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-table/style.css +26 -0
  14. package/es/vxe-table/style.min.css +1 -1
  15. package/lib/index.css +1 -1
  16. package/lib/index.min.css +1 -1
  17. package/lib/index.umd.js +730 -391
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/style.css +1 -1
  20. package/lib/style.min.css +1 -1
  21. package/lib/table/module/edit/mixin.js +278 -215
  22. package/lib/table/module/edit/mixin.min.js +1 -1
  23. package/lib/table/src/body.js +71 -59
  24. package/lib/table/src/body.min.js +1 -1
  25. package/lib/table/src/methods.js +199 -37
  26. package/lib/table/src/methods.min.js +1 -1
  27. package/lib/table/src/table.js +126 -24
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/style/style.css +26 -0
  30. package/lib/table/style/style.min.css +1 -1
  31. package/lib/ui/index.js +1 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/lib/vxe-table/style/style.css +26 -0
  36. package/lib/vxe-table/style/style.min.css +1 -1
  37. package/package.json +1 -1
  38. package/packages/table/module/edit/mixin.ts +242 -159
  39. package/packages/table/src/body.ts +62 -48
  40. package/packages/table/src/methods.ts +170 -36
  41. package/packages/table/src/table.ts +108 -24
  42. package/styles/components/table.scss +26 -0
  43. /package/es/{iconfont.1739257460253.ttf → iconfont.1739428244406.ttf} +0 -0
  44. /package/es/{iconfont.1739257460253.woff → iconfont.1739428244406.woff} +0 -0
  45. /package/es/{iconfont.1739257460253.woff2 → iconfont.1739428244406.woff2} +0 -0
  46. /package/lib/{iconfont.1739257460253.ttf → iconfont.1739428244406.ttf} +0 -0
  47. /package/lib/{iconfont.1739257460253.woff → iconfont.1739428244406.woff} +0 -0
  48. /package/lib/{iconfont.1739257460253.woff2 → iconfont.1739428244406.woff2} +0 -0
@@ -1,5 +1,5 @@
1
1
  import XEUtils from 'xe-utils';
2
- import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft } from '../../ui/src/dom';
2
+ import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft, toCssUnit } from '../../ui/src/dom';
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';
@@ -308,7 +308,7 @@ function updateAfterListIndex($xeTable) {
308
308
  rowRest._index = index;
309
309
  }
310
310
  else {
311
- const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
311
+ const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
312
312
  fullAllDataRowIdData[rowid] = rest;
313
313
  fullDataRowIdData[rowid] = rest;
314
314
  }
@@ -339,7 +339,7 @@ function updateAfterDataIndex($xeTable) {
339
339
  rowRest.treeIndex = index;
340
340
  }
341
341
  else {
342
- const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
342
+ const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
343
343
  fullAllDataRowIdData[rowid] = rest;
344
344
  fullDataRowIdData[rowid] = rest;
345
345
  }
@@ -403,6 +403,7 @@ function updateStyle($xeTable) {
403
403
  const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
404
404
  const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
405
405
  const mouseOpts = $xeTable.computeMouseOpts;
406
+ const expandOpts = $xeTable.computeExpandOpts;
406
407
  const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
407
408
  const bodyTableElem = getRefElem(elemStore['main-body-table']);
408
409
  if (emptyPlaceholderElem) {
@@ -472,6 +473,11 @@ function updateStyle($xeTable) {
472
473
  yBottomCornerEl.style.top = `${headerHeight + bodyHeight}px`;
473
474
  yBottomCornerEl.style.display = footerHeight ? 'block' : '';
474
475
  }
476
+ const rowExpandEl = $xeTable.$refs.refRowExpandElem;
477
+ if (rowExpandEl) {
478
+ rowExpandEl.style.height = `${bodyHeight}px`;
479
+ rowExpandEl.style.top = `${headerHeight}px`;
480
+ }
475
481
  containerList.forEach((name, index) => {
476
482
  const fixedType = index > 0 ? name : '';
477
483
  const layoutList = ['header', 'body', 'footer'];
@@ -580,7 +586,7 @@ function updateStyle($xeTable) {
580
586
  let isOptimizeMode = false;
581
587
  // 如果是使用优化模式
582
588
  if (scrollXLoad || scrollYLoad || isAllOverflow) {
583
- if (expandColumn || spanMethod || footerSpanMethod) {
589
+ if ((expandColumn && expandOpts.mode !== 'fixed') || spanMethod || footerSpanMethod) {
584
590
  // 如果不支持优化模式
585
591
  }
586
592
  else {
@@ -707,6 +713,13 @@ function updateStyle($xeTable) {
707
713
  }
708
714
  return $xeTable.$nextTick();
709
715
  }
716
+ function calcVarRowHeightConfig($xeTable, sizeKey, sizeEl) {
717
+ const reactData = $xeTable;
718
+ const { rowHeightStore } = reactData;
719
+ if (sizeEl && sizeEl.clientHeight) {
720
+ rowHeightStore[sizeKey] = sizeEl.clientHeight;
721
+ }
722
+ }
710
723
  function computeRowHeight($xeTable) {
711
724
  const reactData = $xeTable;
712
725
  const { isAllOverflow } = reactData;
@@ -740,8 +753,9 @@ function computeRowHeight($xeTable) {
740
753
  function handleVirtualYVisible($xeTable, currScrollTop) {
741
754
  const reactData = $xeTable;
742
755
  const internalData = $xeTable;
743
- const { isAllOverflow } = reactData;
756
+ const { isAllOverflow, expandColumn, rowExpandedMaps } = reactData;
744
757
  const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
758
+ const expandOpts = $xeTable.computeExpandOpts;
745
759
  const rowOpts = $xeTable.computeRowOpts;
746
760
  const cellOpts = $xeTable.computeCellOpts;
747
761
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
@@ -754,7 +768,7 @@ function handleVirtualYVisible($xeTable, currScrollTop) {
754
768
  let offsetTop = 0;
755
769
  let visibleSize = 0;
756
770
  const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
757
- if (!isCustomCellHeight && isAllOverflow) {
771
+ if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
758
772
  toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
759
773
  visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
760
774
  }
@@ -773,6 +787,10 @@ function handleVirtualYVisible($xeTable, currScrollTop) {
773
787
  break;
774
788
  }
775
789
  }
790
+ // 是否展开行
791
+ if (expandColumn && rowExpandedMaps[rowid]) {
792
+ offsetTop += rowRest.expandHeight || expandOpts.height || 0;
793
+ }
776
794
  }
777
795
  }
778
796
  return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(6, visibleSize) };
@@ -1393,9 +1411,18 @@ function handleRecalculateLayout($xeTable, reFull) {
1393
1411
  if (!el || !el.clientWidth) {
1394
1412
  return $xeTable.$nextTick();
1395
1413
  }
1414
+ const varEl = $xeTable.$refs.refVarElem;
1415
+ if (varEl) {
1416
+ const [defEl, mediumEl, smallEl, miniEl] = varEl.children;
1417
+ calcVarRowHeightConfig($xeTable, 'default', defEl);
1418
+ calcVarRowHeightConfig($xeTable, 'medium', mediumEl);
1419
+ calcVarRowHeightConfig($xeTable, 'small', smallEl);
1420
+ calcVarRowHeightConfig($xeTable, 'mini', miniEl);
1421
+ }
1396
1422
  calcCellWidth($xeTable);
1397
1423
  autoCellWidth($xeTable);
1398
1424
  updateStyle($xeTable);
1425
+ updateRowExpandStyle($xeTable);
1399
1426
  return computeScrollLoad($xeTable).then(() => {
1400
1427
  if (reFull === true) {
1401
1428
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
@@ -1403,6 +1430,7 @@ function handleRecalculateLayout($xeTable, reFull) {
1403
1430
  calcCellWidth($xeTable);
1404
1431
  autoCellWidth($xeTable);
1405
1432
  updateStyle($xeTable);
1433
+ updateRowExpandStyle($xeTable);
1406
1434
  return computeScrollLoad($xeTable);
1407
1435
  }
1408
1436
  });
@@ -1823,7 +1851,7 @@ function calcCellWidth($xeTable) {
1823
1851
  el.removeAttribute('data-calc-col');
1824
1852
  }
1825
1853
  }
1826
- const handleUpdateColResize = ($xeTable, evnt, params) => {
1854
+ function handleUpdateColResize($xeTable, evnt, params) {
1827
1855
  $xeTable.analyColumnWidth();
1828
1856
  $xeTable.recalculate(true).then(() => {
1829
1857
  $xeTable.saveCustomStore('update:width');
@@ -1833,8 +1861,8 @@ const handleUpdateColResize = ($xeTable, evnt, params) => {
1833
1861
  $xeTable.dispatchEvent('resizable-change', params, evnt);
1834
1862
  setTimeout(() => $xeTable.recalculate(true), 300);
1835
1863
  });
1836
- };
1837
- const handleUpdateRowResize = ($xeTable, evnt, params) => {
1864
+ }
1865
+ function handleUpdateRowResize($xeTable, evnt, params) {
1838
1866
  const reactData = $xeTable;
1839
1867
  reactData.resizeHeightFlag++;
1840
1868
  $xeTable.recalculate(true).then(() => {
@@ -1842,7 +1870,65 @@ const handleUpdateRowResize = ($xeTable, evnt, params) => {
1842
1870
  $xeTable.dispatchEvent('row-resizable-change', params, evnt);
1843
1871
  setTimeout(() => $xeTable.recalculate(true), 300);
1844
1872
  });
1845
- };
1873
+ }
1874
+ function updateRowExpandStyle($xeTable) {
1875
+ const reactData = $xeTable;
1876
+ const internalData = $xeTable;
1877
+ const { expandColumn, scrollYLoad, rowExpandedMaps } = reactData;
1878
+ const expandOpts = $xeTable.computeExpandOpts;
1879
+ const rowOpts = $xeTable.computeRowOpts;
1880
+ const cellOpts = $xeTable.computeCellOpts;
1881
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
1882
+ const { mode } = expandOpts;
1883
+ if (expandColumn && mode === 'fixed') {
1884
+ const { elemStore, afterFullData, fullAllDataRowIdData } = internalData;
1885
+ const rowExpandEl = $xeTable.$refs.refRowExpandElem;
1886
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
1887
+ if (rowExpandEl && bodyScrollElem) {
1888
+ let isUpdateHeight = false;
1889
+ if (scrollYLoad) {
1890
+ let offsetTop = 0;
1891
+ for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1892
+ const row = afterFullData[rIndex];
1893
+ const rowid = getRowid($xeTable, row);
1894
+ const rowRest = fullAllDataRowIdData[rowid] || {};
1895
+ rowRest.oTop = offsetTop;
1896
+ offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
1897
+ // 是否展开行
1898
+ if (expandColumn && rowExpandedMaps[rowid]) {
1899
+ offsetTop += rowRest.expandHeight || expandOpts.height || 0;
1900
+ }
1901
+ }
1902
+ }
1903
+ XEUtils.arrayEach(rowExpandEl.children, reEl => {
1904
+ const expandEl = reEl;
1905
+ const rowid = expandEl.getAttribute('rowid') || '';
1906
+ const rowRest = fullAllDataRowIdData[rowid];
1907
+ if (rowRest) {
1908
+ const expandHeight = expandEl.offsetHeight + 1;
1909
+ if (scrollYLoad) {
1910
+ expandEl.style.top = toCssUnit(rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight));
1911
+ }
1912
+ else {
1913
+ const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
1914
+ if (trEl) {
1915
+ expandEl.style.top = toCssUnit(trEl.offsetTop + trEl.offsetHeight);
1916
+ }
1917
+ }
1918
+ if (!isUpdateHeight) {
1919
+ if (rowRest.expandHeight !== expandHeight) {
1920
+ isUpdateHeight = true;
1921
+ }
1922
+ }
1923
+ rowRest.expandHeight = expandHeight;
1924
+ }
1925
+ });
1926
+ if (isUpdateHeight) {
1927
+ reactData.rowExpandHeightFlag++;
1928
+ }
1929
+ }
1930
+ }
1931
+ }
1846
1932
  const Methods = {
1847
1933
  callSlot(slotFunc, params, h, vNodes) {
1848
1934
  if (slotFunc) {
@@ -2223,7 +2309,7 @@ const Methods = {
2223
2309
  }
2224
2310
  let cacheItem = fullAllDataRowIdData[rowid];
2225
2311
  if (isReset || !cacheItem) {
2226
- cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0 };
2312
+ cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
2227
2313
  }
2228
2314
  cacheItem.row = row;
2229
2315
  cacheItem.items = items;
@@ -2297,7 +2383,7 @@ const Methods = {
2297
2383
  XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
2298
2384
  const rowid = getRowid($xeTable, childRow);
2299
2385
  const parentRow = parentItem || parentRest.row;
2300
- const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0 };
2386
+ const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
2301
2387
  fullDataRowIdData[rowid] = rest;
2302
2388
  fullAllDataRowIdData[rowid] = rest;
2303
2389
  }, { children: childrenField });
@@ -4121,6 +4207,7 @@ const Methods = {
4121
4207
  const el = $xeTable.$refs.refElem;
4122
4208
  if (el && el.clientWidth) {
4123
4209
  autoCellWidth($xeTable);
4210
+ updateRowExpandStyle($xeTable);
4124
4211
  }
4125
4212
  if (rceTimeout) {
4126
4213
  clearTimeout(rceTimeout);
@@ -6839,6 +6926,17 @@ const Methods = {
6839
6926
  reactData.pendingRowMaps = pendingMaps;
6840
6927
  return $xeTable.$nextTick();
6841
6928
  },
6929
+ hasPendingByRow(row) {
6930
+ const $xeTable = this;
6931
+ return $xeTable.isPendingByRow(row);
6932
+ },
6933
+ isPendingByRow(row) {
6934
+ const $xeTable = this;
6935
+ const reactData = $xeTable;
6936
+ const { pendingRowMaps } = reactData;
6937
+ const rowid = getRowid($xeTable, row);
6938
+ return !!pendingRowMaps[rowid];
6939
+ },
6842
6940
  getPendingRecords() {
6843
6941
  const $xeTable = this;
6844
6942
  const reactData = $xeTable;
@@ -6853,11 +6951,6 @@ const Methods = {
6853
6951
  });
6854
6952
  return insertRecords;
6855
6953
  },
6856
- hasPendingByRow(row) {
6857
- const { pendingRowMaps } = this;
6858
- const rowid = getRowid(this, row);
6859
- return !!pendingRowMaps[rowid];
6860
- },
6861
6954
  clearPendingRow() {
6862
6955
  this.pendingRowMaps = {};
6863
6956
  return this.$nextTick();
@@ -7775,6 +7868,7 @@ const Methods = {
7775
7868
  isLeft,
7776
7869
  isRight,
7777
7870
  direction }, params);
7871
+ updateRowExpandStyle($xeTable);
7778
7872
  checkLastSyncScroll($xeTable, isRollX, isRollY);
7779
7873
  if (rowOpts.isHover || highlightHoverRow) {
7780
7874
  $xeTable.clearHoverRow();
@@ -7818,7 +7912,9 @@ const Methods = {
7818
7912
  },
7819
7913
  triggerBodyScrollEvent(evnt, fixedType) {
7820
7914
  const $xeTable = this;
7915
+ const reactData = $xeTable;
7821
7916
  const internalData = $xeTable;
7917
+ const { scrollYLoad, scrollXLoad } = reactData;
7822
7918
  const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
7823
7919
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
7824
7920
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
@@ -7827,6 +7923,7 @@ const Methods = {
7827
7923
  const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
7828
7924
  const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
7829
7925
  const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
7926
+ const rowExpandEl = $xeTable.$refs.refRowExpandElem;
7830
7927
  if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
7831
7928
  return;
7832
7929
  }
@@ -7877,13 +7974,18 @@ const Methods = {
7877
7974
  setScrollTop(rightScrollElem, scrollTop);
7878
7975
  }
7879
7976
  setScrollTop(yHandleEl, scrollTop);
7880
- $xeTable.triggerScrollYEvent(evnt);
7977
+ setScrollTop(rowExpandEl, scrollTop);
7978
+ if (scrollYLoad) {
7979
+ $xeTable.triggerScrollYEvent(evnt);
7980
+ }
7881
7981
  }
7882
7982
  if (isRollX) {
7883
7983
  setScrollLeft(xHandleEl, scrollLeft);
7884
7984
  setScrollLeft(headerScrollElem, scrollLeft);
7885
7985
  setScrollLeft(footerScrollElem, scrollLeft);
7886
- $xeTable.triggerScrollXEvent(evnt);
7986
+ if (scrollXLoad) {
7987
+ $xeTable.triggerScrollXEvent(evnt);
7988
+ }
7887
7989
  }
7888
7990
  $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
7889
7991
  type: 'body',
@@ -7892,7 +7994,9 @@ const Methods = {
7892
7994
  },
7893
7995
  triggerHeaderScrollEvent(evnt, fixedType) {
7894
7996
  const $xeTable = this;
7997
+ const reactData = $xeTable;
7895
7998
  const internalData = $xeTable;
7999
+ const { scrollXLoad } = reactData;
7896
8000
  const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
7897
8001
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
7898
8002
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
@@ -7922,7 +8026,9 @@ const Methods = {
7922
8026
  setScrollLeft(xHandleEl, scrollLeft);
7923
8027
  setScrollLeft(footerScrollElem, scrollLeft);
7924
8028
  setScrollLeft(bodyScrollElem, scrollLeft);
7925
- $xeTable.triggerScrollXEvent(evnt);
8029
+ if (scrollXLoad) {
8030
+ $xeTable.triggerScrollXEvent(evnt);
8031
+ }
7926
8032
  $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
7927
8033
  type: 'header',
7928
8034
  fixed: fixedType
@@ -7930,7 +8036,9 @@ const Methods = {
7930
8036
  },
7931
8037
  triggerFooterScrollEvent(evnt, fixedType) {
7932
8038
  const $xeTable = this;
8039
+ const reactData = $xeTable;
7933
8040
  const internalData = $xeTable;
8041
+ const { scrollXLoad } = reactData;
7934
8042
  const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
7935
8043
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
7936
8044
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
@@ -7960,7 +8068,9 @@ const Methods = {
7960
8068
  setScrollLeft(xHandleEl, scrollLeft);
7961
8069
  setScrollLeft(headerScrollElem, scrollLeft);
7962
8070
  setScrollLeft(bodyScrollElem, scrollLeft);
7963
- $xeTable.triggerScrollXEvent(evnt);
8071
+ if (scrollXLoad) {
8072
+ $xeTable.triggerScrollXEvent(evnt);
8073
+ }
7964
8074
  $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
7965
8075
  type: 'footer',
7966
8076
  fixed: fixedType
@@ -7976,6 +8086,7 @@ const Methods = {
7976
8086
  return;
7977
8087
  }
7978
8088
  const { highlightHoverRow } = tableProps;
8089
+ const { scrollYLoad } = reactData;
7979
8090
  const { elemStore, lastScrollTop, lastScrollLeft } = internalData;
7980
8091
  const rowOpts = $xeTable.computeRowOpts;
7981
8092
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
@@ -7983,6 +8094,7 @@ const Methods = {
7983
8094
  const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
7984
8095
  const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
7985
8096
  const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
8097
+ const rowExpandEl = $xeTable.$refs.refRowExpandElem;
7986
8098
  if (!xHandleEl) {
7987
8099
  return;
7988
8100
  }
@@ -8018,27 +8130,22 @@ const Methods = {
8018
8130
  setScrollTop(bodyScrollElem, currTopNum);
8019
8131
  setScrollTop(leftScrollElem, currTopNum);
8020
8132
  setScrollTop(rightScrollElem, currTopNum);
8021
- $xeTable.triggerScrollYEvent(evnt);
8133
+ setScrollTop(rowExpandEl, currTopNum);
8134
+ if (scrollYLoad) {
8135
+ $xeTable.triggerScrollYEvent(evnt);
8136
+ }
8022
8137
  $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
8023
8138
  type: 'table',
8024
8139
  fixed: ''
8025
8140
  });
8026
8141
  });
8027
- // internalData.inWheelScroll = true
8028
- // setScrollTop(yHandleEl, scrollTop)
8029
- // setScrollTop(bodyScrollElem, scrollTop)
8030
- // setScrollTop(leftScrollElem, scrollTop)
8031
- // setScrollTop(rightScrollElem, scrollTop)
8032
- // loadScrollYData($xeTable, scrollTop)
8033
- // $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
8034
- // type: 'footer',
8035
- // fixed: ''
8036
- // })
8037
8142
  }
8038
8143
  },
8039
8144
  triggerVirtualScrollXEvent(evnt) {
8040
8145
  const $xeTable = this;
8146
+ const reactData = $xeTable;
8041
8147
  const internalData = $xeTable;
8148
+ const { scrollXLoad } = reactData;
8042
8149
  const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
8043
8150
  if (inHeaderScroll || inBodyScroll || inFooterScroll) {
8044
8151
  return;
@@ -8063,7 +8170,9 @@ const Methods = {
8063
8170
  setScrollLeft(bodyScrollElem, scrollLeft);
8064
8171
  setScrollLeft(headerScrollElem, scrollLeft);
8065
8172
  setScrollLeft(footerScrollElem, scrollLeft);
8066
- $xeTable.triggerScrollXEvent(evnt);
8173
+ if (scrollXLoad) {
8174
+ $xeTable.triggerScrollXEvent(evnt);
8175
+ }
8067
8176
  $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
8068
8177
  type: 'table',
8069
8178
  fixed: ''
@@ -8071,7 +8180,9 @@ const Methods = {
8071
8180
  },
8072
8181
  triggerVirtualScrollYEvent(evnt) {
8073
8182
  const $xeTable = this;
8183
+ const reactData = $xeTable;
8074
8184
  const internalData = $xeTable;
8185
+ const { scrollYLoad } = reactData;
8075
8186
  const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
8076
8187
  if (inHeaderScroll || inBodyScroll || inFooterScroll) {
8077
8188
  return;
@@ -8082,6 +8193,7 @@ const Methods = {
8082
8193
  const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
8083
8194
  const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
8084
8195
  const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
8196
+ const rowExpandEl = $xeTable.$refs.refRowExpandElem;
8085
8197
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
8086
8198
  const wrapperEl = evnt.currentTarget;
8087
8199
  const { scrollTop } = wrapperEl;
@@ -8096,7 +8208,10 @@ const Methods = {
8096
8208
  setScrollTop(bodyScrollElem, scrollTop);
8097
8209
  setScrollTop(leftScrollElem, scrollTop);
8098
8210
  setScrollTop(rightScrollElem, scrollTop);
8099
- $xeTable.triggerScrollYEvent(evnt);
8211
+ setScrollTop(rowExpandEl, scrollTop);
8212
+ if (scrollYLoad) {
8213
+ $xeTable.triggerScrollYEvent(evnt);
8214
+ }
8100
8215
  $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
8101
8216
  type: 'table',
8102
8217
  fixed: ''
@@ -8107,6 +8222,7 @@ const Methods = {
8107
8222
  const reactData = $xeTable;
8108
8223
  const { isAllOverflow } = reactData;
8109
8224
  handleTableColumn($xeTable);
8225
+ $xeTable.updateScrollXSpace();
8110
8226
  return $xeTable.$nextTick().then(() => {
8111
8227
  handleTableColumn($xeTable);
8112
8228
  $xeTable.updateScrollXSpace();
@@ -8166,6 +8282,7 @@ const Methods = {
8166
8282
  updateScrollYData() {
8167
8283
  const $xeTable = this;
8168
8284
  $xeTable.handleTableData();
8285
+ $xeTable.updateScrollYSpace();
8169
8286
  return $xeTable.$nextTick().then(() => {
8170
8287
  $xeTable.handleTableData();
8171
8288
  $xeTable.updateScrollYSpace();
@@ -8176,9 +8293,10 @@ const Methods = {
8176
8293
  const $xeTable = this;
8177
8294
  const reactData = $xeTable;
8178
8295
  const internalData = $xeTable;
8179
- const { isAllOverflow, scrollYLoad } = reactData;
8296
+ const { isAllOverflow, scrollYLoad, expandColumn, rowExpandedMaps } = reactData;
8180
8297
  const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
8181
8298
  const { startIndex } = scrollYStore;
8299
+ const expandOpts = $xeTable.computeExpandOpts;
8182
8300
  const rowOpts = $xeTable.computeRowOpts;
8183
8301
  const cellOpts = $xeTable.computeCellOpts;
8184
8302
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
@@ -8188,7 +8306,7 @@ const Methods = {
8188
8306
  let ySpaceHeight = 0;
8189
8307
  if (scrollYLoad) {
8190
8308
  const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
8191
- if (!isCustomCellHeight && isAllOverflow) {
8309
+ if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
8192
8310
  ySpaceHeight = afterFullData.length * defaultRowHeight;
8193
8311
  topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
8194
8312
  }
@@ -8198,12 +8316,20 @@ const Methods = {
8198
8316
  const rowid = getRowid($xeTable, row);
8199
8317
  const rowRest = fullAllDataRowIdData[rowid] || {};
8200
8318
  ySpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
8319
+ // 是否展开行
8320
+ if (expandColumn && rowExpandedMaps[rowid]) {
8321
+ ySpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
8322
+ }
8201
8323
  }
8202
8324
  for (let i = 0; i < startIndex; i++) {
8203
8325
  const row = afterFullData[i];
8204
8326
  const rowid = getRowid($xeTable, row);
8205
8327
  const rowRest = fullAllDataRowIdData[rowid] || {};
8206
8328
  topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
8329
+ // 是否展开行
8330
+ if (expandColumn && rowExpandedMaps[rowid]) {
8331
+ topSpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
8332
+ }
8207
8333
  }
8208
8334
  }
8209
8335
  }
@@ -8229,6 +8355,10 @@ const Methods = {
8229
8355
  if (scrollYSpaceEl) {
8230
8356
  scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
8231
8357
  }
8358
+ const rowExpandYSpaceEl = $xeTable.$refs.refRowExpandYSpaceElem;
8359
+ if (rowExpandYSpaceEl) {
8360
+ rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
8361
+ }
8232
8362
  return $xeTable.$nextTick().then(() => {
8233
8363
  updateStyle($xeTable);
8234
8364
  });
@@ -1,6 +1,7 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { getFuncText, isEnableConf } from '../../ui/src/utils';
3
3
  import { initTpImg } from '../../ui/src/dom';
4
+ import { getRowid } from './util';
4
5
  import { VxeUI } from '../../ui';
5
6
  import methods from './methods';
6
7
  import TableBodyComponent from './body';
@@ -173,6 +174,74 @@ function handleUpdateResize(_vm) {
173
174
  _vm.recalculate();
174
175
  }
175
176
  }
177
+ function renderRowExpandedVNs(h, $xeTable) {
178
+ const props = $xeTable;
179
+ const reactData = $xeTable;
180
+ const internalData = $xeTable;
181
+ const { treeConfig } = props;
182
+ const { expandColumn } = reactData;
183
+ const tableRowExpandedList = $xeTable.computeTableRowExpandedList;
184
+ const expandOpts = $xeTable.computeExpandOpts;
185
+ const { mode } = expandOpts;
186
+ if (mode !== 'fixed') {
187
+ return renderEmptyElement($xeTable);
188
+ }
189
+ const expandVNs = [
190
+ h('div', {
191
+ key: 'repY',
192
+ ref: 'refRowExpandYSpaceElem'
193
+ })
194
+ ];
195
+ if (expandColumn) {
196
+ tableRowExpandedList.forEach((row) => {
197
+ const expandOpts = $xeTable.computeExpandOpts;
198
+ const { height: expandHeight, padding } = expandOpts;
199
+ const { fullAllDataRowIdData } = internalData;
200
+ const treeOpts = $xeTable.computeTreeOpts;
201
+ const { transform, seqMode } = treeOpts;
202
+ const cellStyle = {};
203
+ const rowid = getRowid($xeTable, row);
204
+ const rest = fullAllDataRowIdData[rowid];
205
+ let rowLevel = 0;
206
+ let seq = -1;
207
+ let _rowIndex = 0;
208
+ const rowIndex = $xeTable.getRowIndex(row);
209
+ const $rowIndex = $xeTable.getVMRowIndex(row);
210
+ if (rest) {
211
+ rowLevel = rest.level;
212
+ if (treeConfig && transform && seqMode === 'increasing') {
213
+ seq = rest._index + 1;
214
+ }
215
+ else {
216
+ seq = rest.seq;
217
+ }
218
+ _rowIndex = rest._index;
219
+ }
220
+ if (expandHeight) {
221
+ cellStyle.height = `${expandHeight}px`;
222
+ }
223
+ if (treeConfig) {
224
+ cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`;
225
+ }
226
+ const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: '', type: 'body', level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
227
+ expandVNs.push(h('div', {
228
+ key: rowid,
229
+ class: ['vxe-body--row-expanded-cell', {
230
+ 'is--padding': padding,
231
+ 'is--ellipsis': expandHeight
232
+ }],
233
+ attrs: {
234
+ rowid
235
+ },
236
+ style: cellStyle
237
+ }, expandColumn.renderData(h, expandParams)));
238
+ });
239
+ }
240
+ return h('div', {
241
+ ref: 'refRowExpandElem',
242
+ class: 'vxe-table--row-expanded-wrapper'
243
+ }, expandVNs);
244
+ }
176
245
  function renderScrollX(h, $xeTable) {
177
246
  return h('div', {
178
247
  key: 'vsx',
@@ -242,11 +311,18 @@ function renderViewport(h, $xeTable) {
242
311
  const props = $xeTable;
243
312
  const reactData = $xeTable;
244
313
  const { showHeader, showFooter } = props;
245
- const { overflowX, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData;
314
+ const { overflowX, scrollYLoad, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData;
246
315
  const { leftList, rightList } = columnStore;
316
+ const leftFixedWidth = $xeTable.computeLeftFixedWidth;
317
+ const rightFixedWidth = $xeTable.computeRightFixedWidth;
318
+ const ons = {};
319
+ if (scrollYLoad || leftFixedWidth || rightFixedWidth) {
320
+ ons.onWheel = $xeTable.triggerBodyWheelEvent;
321
+ }
247
322
  return h('div', {
248
323
  ref: 'refTableViewportElem',
249
- class: 'vxe-table--viewport-wrapper'
324
+ class: 'vxe-table--viewport-wrapper',
325
+ on: ons
250
326
  }, [
251
327
  h('div', {
252
328
  class: 'vxe-table--main-wrapper'
@@ -292,7 +368,8 @@ function renderViewport(h, $xeTable) {
292
368
  }, [
293
369
  leftList && leftList.length && overflowX ? renderFixed(h, $xeTable, 'left') : renderEmptyElement($xeTable),
294
370
  rightList && rightList.length && overflowX ? renderFixed(h, $xeTable, 'right') : renderEmptyElement($xeTable)
295
- ])
371
+ ]),
372
+ renderRowExpandedVNs(h, $xeTable)
296
373
  ]);
297
374
  }
298
375
  function renderBody(h, $xeTable) {
@@ -560,8 +637,9 @@ export default {
560
637
  mini: 36
561
638
  },
562
639
  scrollVMLoading: false,
563
- calcCellHeightFlag: 0,
564
- resizeHeightFlag: 0,
640
+ rowExpandHeightFlag: 1,
641
+ calcCellHeightFlag: 1,
642
+ resizeHeightFlag: 1,
565
643
  isCustomStatus: false,
566
644
  isDragRowMove: false,
567
645
  dragRow: null,
@@ -934,6 +1012,24 @@ export default {
934
1012
  computeCustomOpts() {
935
1013
  return Object.assign({}, getConfig().table.customConfig, this.customConfig);
936
1014
  },
1015
+ computeTableRowExpandedList() {
1016
+ const $xeTable = this;
1017
+ const reactData = $xeTable;
1018
+ const { rowExpandedMaps, tableData, expandColumn } = reactData;
1019
+ const expandList = [];
1020
+ if (expandColumn) {
1021
+ const rowKeys = {};
1022
+ tableData.forEach(row => {
1023
+ rowKeys[getRowid($xeTable, row)] = true;
1024
+ });
1025
+ XEUtils.each(rowExpandedMaps, (row, rowid) => {
1026
+ if (rowKeys[rowid]) {
1027
+ expandList.push(row);
1028
+ }
1029
+ });
1030
+ }
1031
+ return expandList;
1032
+ },
937
1033
  computeAutoWidthColumnList() {
938
1034
  const { tableColumn, visibleColumn } = this;
939
1035
  return tableColumn.length || visibleColumn.length ? visibleColumn.filter((column) => column.width === 'auto' || column.minWidth === 'auto') : [];
@@ -1367,27 +1463,9 @@ export default {
1367
1463
  mounted() {
1368
1464
  const $xeTable = this;
1369
1465
  const props = $xeTable;
1370
- const reactData = $xeTable;
1371
- const { rowHeightStore } = reactData;
1372
- const varEl = $xeTable.$refs.refVarElem;
1373
1466
  const columnOpts = $xeTable.computeColumnOpts;
1374
1467
  const rowOpts = $xeTable.computeRowOpts;
1375
1468
  const customOpts = $xeTable.computeCustomOpts;
1376
- if (varEl) {
1377
- const [defEl, mediumEl, smallEl, miniEl] = varEl.children;
1378
- if (defEl) {
1379
- rowHeightStore.default = defEl.clientHeight;
1380
- }
1381
- if (mediumEl) {
1382
- rowHeightStore.medium = mediumEl.clientHeight;
1383
- }
1384
- if (smallEl) {
1385
- rowHeightStore.small = smallEl.clientHeight;
1386
- }
1387
- if (miniEl) {
1388
- rowHeightStore.mini = miniEl.clientHeight;
1389
- }
1390
- }
1391
1469
  if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
1392
1470
  initTpImg();
1393
1471
  }