vxe-table 3.19.6 → 3.19.8

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 (42) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/src/body.js +9 -19
  3. package/es/table/src/cell.js +47 -40
  4. package/es/table/src/footer.js +2 -12
  5. package/es/table/src/header.js +3 -11
  6. package/es/table/src/methods.js +51 -56
  7. package/es/table/src/table.js +89 -6
  8. package/es/ui/index.js +2 -2
  9. package/es/ui/src/log.js +1 -1
  10. package/lib/index.umd.js +201 -121
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/style.css +1 -1
  13. package/lib/table/src/body.js +7 -20
  14. package/lib/table/src/body.min.js +1 -1
  15. package/lib/table/src/cell.js +12 -5
  16. package/lib/table/src/cell.min.js +1 -1
  17. package/lib/table/src/footer.js +2 -15
  18. package/lib/table/src/footer.min.js +1 -1
  19. package/lib/table/src/header.js +3 -13
  20. package/lib/table/src/header.min.js +1 -1
  21. package/lib/table/src/methods.js +56 -59
  22. package/lib/table/src/methods.min.js +1 -1
  23. package/lib/table/src/table.js +118 -6
  24. package/lib/table/src/table.min.js +1 -1
  25. package/lib/ui/index.js +2 -2
  26. package/lib/ui/index.min.js +1 -1
  27. package/lib/ui/src/log.js +1 -1
  28. package/lib/ui/src/log.min.js +1 -1
  29. package/package.json +1 -1
  30. package/packages/table/src/body.ts +9 -19
  31. package/packages/table/src/cell.ts +49 -42
  32. package/packages/table/src/footer.ts +2 -11
  33. package/packages/table/src/header.ts +3 -11
  34. package/packages/table/src/methods.ts +52 -55
  35. package/packages/table/src/table.ts +89 -6
  36. package/packages/ui/index.ts +1 -1
  37. /package/es/{iconfont.1761877353318.ttf → iconfont.1762324067655.ttf} +0 -0
  38. /package/es/{iconfont.1761877353318.woff → iconfont.1762324067655.woff} +0 -0
  39. /package/es/{iconfont.1761877353318.woff2 → iconfont.1762324067655.woff2} +0 -0
  40. /package/lib/{iconfont.1761877353318.ttf → iconfont.1762324067655.ttf} +0 -0
  41. /package/lib/{iconfont.1761877353318.woff → iconfont.1762324067655.woff} +0 -0
  42. /package/lib/{iconfont.1761877353318.woff2 → iconfont.1762324067655.woff2} +0 -0
@@ -617,8 +617,7 @@ function handleVirtualTreeExpand($xeTable, rows, expanded) {
617
617
  updateAfterDataIndex($xeTable);
618
618
  return $xeTable.$nextTick();
619
619
  }).then(() => {
620
- updateTreeLineStyle($xeTable);
621
- return handleLazyRecalculate($xeTable, true, true, true);
620
+ return handleRecalculateStyle($xeTable, true, true, true);
622
621
  }).then(() => {
623
622
  updateTreeLineStyle($xeTable);
624
623
  setTimeout(() => {
@@ -1240,18 +1239,12 @@ function updateStyle($xeTable) {
1240
1239
  const reactData = $xeTable;
1241
1240
  const internalData = $xeTable;
1242
1241
  const {
1243
- showHeaderOverflow: allColumnHeaderOverflow,
1244
- showFooterOverflow: allColumnFooterOverflow,
1245
- mouseConfig,
1246
- spanMethod,
1247
- footerSpanMethod
1242
+ mouseConfig
1248
1243
  } = props;
1249
1244
  const {
1250
1245
  isGroup,
1251
1246
  currentRow,
1252
1247
  tableColumn,
1253
- scrollXLoad,
1254
- scrollYLoad,
1255
1248
  overflowX,
1256
1249
  scrollbarWidth,
1257
1250
  overflowY,
@@ -1259,8 +1252,6 @@ function updateStyle($xeTable) {
1259
1252
  scrollXWidth,
1260
1253
  columnStore,
1261
1254
  editStore,
1262
- isAllOverflow,
1263
- expandColumn,
1264
1255
  isColLoading
1265
1256
  } = reactData;
1266
1257
  const {
@@ -1279,12 +1270,18 @@ function updateStyle($xeTable) {
1279
1270
  return;
1280
1271
  }
1281
1272
  const containerList = ['main', 'left', 'right'];
1273
+ const {
1274
+ leftList,
1275
+ rightList
1276
+ } = columnStore;
1282
1277
  let osbWidth = overflowY ? scrollbarWidth : 0;
1283
1278
  let osbHeight = overflowX ? scrollbarHeight : 0;
1284
1279
  const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
1280
+ const isHeaderRenderOptimize = $xeTable.computeIsHeaderRenderOptimize;
1281
+ const isBodyRenderOptimize = $xeTable.computeIsBodyRenderOptimize;
1282
+ const isFooterRenderOptimize = $xeTable.computeIsFooterRenderOptimize;
1285
1283
  const scrollbarOpts = $xeTable.computeScrollbarOpts;
1286
1284
  const mouseOpts = $xeTable.computeMouseOpts;
1287
- const expandOpts = $xeTable.computeExpandOpts;
1288
1285
  const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
1289
1286
  const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
1290
1287
  if (emptyPlaceholderElem) {
@@ -1397,7 +1394,7 @@ function updateStyle($xeTable) {
1397
1394
  let fixedColumn = [];
1398
1395
  let fixedWrapperElem;
1399
1396
  if (fixedType) {
1400
- fixedColumn = isFixedLeft ? columnStore.leftList : columnStore.rightList;
1397
+ fixedColumn = isFixedLeft ? leftList : rightList;
1401
1398
  fixedWrapperElem = isFixedLeft ? $xeTable.$refs.refLeftContainer : $xeTable.$refs.refRightContainer;
1402
1399
  }
1403
1400
  layoutList.forEach(layout => {
@@ -1408,18 +1405,10 @@ function updateStyle($xeTable) {
1408
1405
  // 表头体样式处理
1409
1406
  // 横向滚动渲染
1410
1407
  let renderColumnList = tableColumn;
1411
- let isOptimizeMode = false;
1408
+ const isOptimizeMode = isHeaderRenderOptimize;
1412
1409
  if (isGroup) {
1413
1410
  renderColumnList = visibleColumn;
1414
1411
  } else {
1415
- // 如果是使用优化模式
1416
- if (scrollXLoad && allColumnHeaderOverflow) {
1417
- if (spanMethod || footerSpanMethod) {
1418
- // 如果不支持优化模式
1419
- } else {
1420
- isOptimizeMode = true;
1421
- }
1422
- }
1423
1412
  if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
1424
1413
  renderColumnList = visibleColumn;
1425
1414
  }
@@ -1469,15 +1458,7 @@ function updateStyle($xeTable) {
1469
1458
  fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
1470
1459
  }
1471
1460
  let renderColumnList = tableColumn;
1472
- let isOptimizeMode = false;
1473
- // 如果是使用优化模式
1474
- if (scrollXLoad || scrollYLoad || isAllOverflow) {
1475
- if (expandColumn && expandOpts.mode !== 'fixed' || spanMethod || footerSpanMethod) {
1476
- // 如果不支持优化模式
1477
- } else {
1478
- isOptimizeMode = true;
1479
- }
1480
- }
1461
+ const isOptimizeMode = isBodyRenderOptimize;
1481
1462
  if (fixedType) {
1482
1463
  renderColumnList = visibleColumn;
1483
1464
  if (isOptimizeMode) {
@@ -1507,15 +1488,7 @@ function updateStyle($xeTable) {
1507
1488
  }
1508
1489
  } else if (layout === 'footer') {
1509
1490
  let renderColumnList = tableColumn;
1510
- let isOptimizeMode = false;
1511
- // 如果是使用优化模式
1512
- if (scrollXLoad && allColumnFooterOverflow) {
1513
- if (spanMethod || footerSpanMethod) {
1514
- // 如果不支持优化模式
1515
- } else {
1516
- isOptimizeMode = true;
1517
- }
1518
- }
1491
+ const isOptimizeMode = isFooterRenderOptimize;
1519
1492
  if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
1520
1493
  renderColumnList = visibleColumn;
1521
1494
  }
@@ -2948,20 +2921,32 @@ function autoCellWidth($xeTable) {
2948
2921
  /**
2949
2922
  * 计算自适应行高
2950
2923
  */
2951
- const calcCellAutoHeight = (rowRest, wrapperEl) => {
2952
- const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
2924
+ const calcCellAutoHeight = ($xeTable, rowRest, wrapperEl) => {
2925
+ const reactData = $xeTable;
2926
+ const {
2927
+ scrollXLoad
2928
+ } = reactData;
2929
+ const wrapperElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
2953
2930
  let colHeight = rowRest.height;
2954
2931
  let firstCellStyle = null;
2955
2932
  let topBottomPadding = 0;
2956
- for (let i = 0; i < cellElemList.length; i++) {
2957
- const wrapperElem = cellElemList[i];
2933
+ for (let i = 0; i < wrapperElemList.length; i++) {
2934
+ const wrapperElem = wrapperElemList[i];
2958
2935
  const cellElem = wrapperElem.parentElement;
2959
2936
  if (!firstCellStyle) {
2937
+ const cellStyle = cellElem.style;
2938
+ const orHeight = cellStyle.height;
2939
+ if (!scrollXLoad) {
2940
+ cellStyle.height = '';
2941
+ }
2960
2942
  firstCellStyle = getComputedStyle(cellElem);
2961
2943
  topBottomPadding = firstCellStyle ? Math.ceil(_xeUtils.default.toNumber(firstCellStyle.paddingTop) + _xeUtils.default.toNumber(firstCellStyle.paddingBottom)) : 0;
2944
+ if (!scrollXLoad) {
2945
+ cellStyle.height = orHeight;
2946
+ }
2962
2947
  }
2963
2948
  const cellHeight = wrapperElem ? wrapperElem.clientHeight : 0;
2964
- colHeight = Math.max(colHeight, Math.ceil(cellHeight + topBottomPadding));
2949
+ colHeight = scrollXLoad ? Math.max(colHeight, Math.ceil(cellHeight + topBottomPadding)) : Math.ceil(cellHeight + topBottomPadding);
2965
2950
  }
2966
2951
  return colHeight;
2967
2952
  };
@@ -2991,13 +2976,15 @@ const calcCellHeight = $xeTable => {
2991
2976
  const {
2992
2977
  handleGetRowId
2993
2978
  } = (0, _util.createHandleGetRowId)($xeTable);
2979
+ el.setAttribute('data-calc-row', 'Y');
2994
2980
  tableData.forEach(row => {
2995
2981
  const rowid = handleGetRowId(row);
2996
2982
  const rowRest = fullAllDataRowIdData[rowid];
2997
2983
  if (rowRest) {
2998
- const height = calcCellAutoHeight(rowRest, el);
2984
+ const height = calcCellAutoHeight($xeTable, rowRest, el);
2999
2985
  rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, height) : height);
3000
2986
  }
2987
+ el.removeAttribute('data-calc-row');
3001
2988
  });
3002
2989
  reactData.calcCellHeightFlag++;
3003
2990
  }
@@ -7182,7 +7169,9 @@ const Methods = {
7182
7169
  return;
7183
7170
  }
7184
7171
  const handleRsHeight = () => {
7185
- const resizeHeight = calcCellAutoHeight(rowRest, el);
7172
+ el.setAttribute('data-calc-row', 'Y');
7173
+ const resizeHeight = calcCellAutoHeight($xeTable, rowRest, el);
7174
+ el.removeAttribute('data-calc-row');
7186
7175
  const resizeParams = Object.assign(Object.assign({}, params), {
7187
7176
  resizeHeight,
7188
7177
  resizeRow: row
@@ -7281,7 +7270,7 @@ const Methods = {
7281
7270
  const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : handleGetRowId(row);
7282
7271
  const rowRest = fullAllDataRowIdData[rowid];
7283
7272
  if (rowRest) {
7284
- rowRest.resizeHeight = calcCellAutoHeight(rowRest, el);
7273
+ rowRest.resizeHeight = calcCellAutoHeight($xeTable, rowRest, el);
7285
7274
  }
7286
7275
  el.removeAttribute('data-calc-row');
7287
7276
  });
@@ -13157,7 +13146,9 @@ const Methods = {
13157
13146
  const internalData = $xeTable;
13158
13147
  const {
13159
13148
  isAllOverflow,
13149
+ overflowY,
13160
13150
  scrollYLoad,
13151
+ scrollYHeight,
13161
13152
  expandColumn
13162
13153
  } = reactData;
13163
13154
  const {
@@ -13183,13 +13174,13 @@ const Methods = {
13183
13174
  const rightbodyTableElem = (0, _util.getRefElem)(elemStore['right-body-table']);
13184
13175
  const containerList = ['main', 'left', 'right'];
13185
13176
  let ySpaceTop = 0;
13186
- let scrollYHeight = 0;
13177
+ let sYHeight = scrollYHeight;
13187
13178
  let isScrollYBig = false;
13188
13179
  if (scrollYLoad) {
13189
13180
  const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
13190
13181
  if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
13191
- scrollYHeight = afterFullData.length * defaultRowHeight;
13192
- if (scrollYHeight > maxYHeight) {
13182
+ sYHeight = afterFullData.length * defaultRowHeight;
13183
+ if (sYHeight > maxYHeight) {
13193
13184
  isScrollYBig = true;
13194
13185
  }
13195
13186
  ySpaceTop = Math.max(0, startIndex * defaultRowHeight);
@@ -13201,18 +13192,21 @@ const Methods = {
13201
13192
  const lastRow = afterFullData[afterFullData.length - 1];
13202
13193
  rowid = (0, _util.getRowid)($xeTable, lastRow);
13203
13194
  rowRest = fullAllDataRowIdData[rowid] || {};
13204
- scrollYHeight = (rowRest.oTop || 0) + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
13205
- // 是否展开行
13206
- if (expandColumn && rowExpandedMaps[rowid]) {
13207
- scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;
13195
+ // 如果为空时还没计算完数据,保持原高度不变
13196
+ if (rowRest.oTop) {
13197
+ sYHeight = (rowRest.oTop || 0) + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
13198
+ // 是否展开行
13199
+ if (expandColumn && rowExpandedMaps[rowid]) {
13200
+ sYHeight += rowRest.expandHeight || expandOpts.height || 0;
13201
+ }
13208
13202
  }
13209
- if (scrollYHeight > maxYHeight) {
13203
+ if (sYHeight > maxYHeight) {
13210
13204
  isScrollYBig = true;
13211
13205
  }
13212
13206
  }
13213
13207
  } else {
13214
13208
  if (bodyTableElem) {
13215
- scrollYHeight = bodyTableElem.clientHeight;
13209
+ sYHeight = bodyTableElem.clientHeight;
13216
13210
  }
13217
13211
  }
13218
13212
  let clientHeight = 0;
@@ -13220,7 +13214,7 @@ const Methods = {
13220
13214
  clientHeight = bodyScrollElem.clientHeight;
13221
13215
  }
13222
13216
  // 虚拟渲染
13223
- let ySpaceHeight = scrollYHeight;
13217
+ let ySpaceHeight = sYHeight;
13224
13218
  let scrollYTop = ySpaceTop;
13225
13219
  if (isScrollYBig) {
13226
13220
  // 触底
@@ -13231,6 +13225,9 @@ const Methods = {
13231
13225
  }
13232
13226
  ySpaceHeight = maxYHeight;
13233
13227
  }
13228
+ if (!(scrollYLoad && overflowY)) {
13229
+ scrollYTop = 0;
13230
+ }
13234
13231
  if (leftBodyTableElem) {
13235
13232
  leftBodyTableElem.style.transform = `translate(0px, ${scrollYTop}px)`;
13236
13233
  }
@@ -13258,7 +13255,7 @@ const Methods = {
13258
13255
  rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
13259
13256
  }
13260
13257
  reactData.scrollYTop = scrollYTop;
13261
- reactData.scrollYHeight = scrollYHeight;
13258
+ reactData.scrollYHeight = ySpaceHeight;
13262
13259
  reactData.isScrollYBig = isScrollYBig;
13263
13260
  calcScrollbar($xeTable);
13264
13261
  if (isScrollYBig && mouseOpts.area) {