vxe-table 4.7.48 → 4.7.49

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 (44) hide show
  1. package/es/grid/src/grid.js +3 -3
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/table/src/cell.js +12 -7
  5. package/es/table/src/columnInfo.js +1 -0
  6. package/es/table/src/table.js +63 -13
  7. package/es/table/style.css +8 -6
  8. package/es/table/style.min.css +1 -1
  9. package/es/ui/index.js +2 -2
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-table/style.css +8 -6
  12. package/es/vxe-table/style.min.css +1 -1
  13. package/lib/grid/src/grid.js +3 -3
  14. package/lib/grid/src/grid.min.js +1 -1
  15. package/lib/index.umd.js +91 -26
  16. package/lib/index.umd.min.js +1 -1
  17. package/lib/style.css +1 -1
  18. package/lib/style.min.css +1 -1
  19. package/lib/table/src/cell.js +15 -7
  20. package/lib/table/src/cell.min.js +1 -1
  21. package/lib/table/src/columnInfo.js +1 -0
  22. package/lib/table/src/columnInfo.min.js +1 -1
  23. package/lib/table/src/table.js +69 -13
  24. package/lib/table/src/table.min.js +1 -1
  25. package/lib/table/style/style.css +8 -6
  26. package/lib/table/style/style.min.css +1 -1
  27. package/lib/ui/index.js +2 -2
  28. package/lib/ui/index.min.js +1 -1
  29. package/lib/ui/src/log.js +1 -1
  30. package/lib/ui/src/log.min.js +1 -1
  31. package/lib/vxe-table/style/style.css +8 -6
  32. package/lib/vxe-table/style/style.min.css +1 -1
  33. package/package.json +2 -2
  34. package/packages/grid/src/grid.ts +3 -3
  35. package/packages/table/src/cell.ts +12 -7
  36. package/packages/table/src/columnInfo.ts +1 -0
  37. package/packages/table/src/table.ts +72 -19
  38. package/styles/components/table.scss +14 -6
  39. /package/es/{iconfont.1720698597734.ttf → iconfont.1720780228287.ttf} +0 -0
  40. /package/es/{iconfont.1720698597734.woff → iconfont.1720780228287.woff} +0 -0
  41. /package/es/{iconfont.1720698597734.woff2 → iconfont.1720780228287.woff2} +0 -0
  42. /package/lib/{iconfont.1720698597734.ttf → iconfont.1720780228287.ttf} +0 -0
  43. /package/lib/{iconfont.1720698597734.woff → iconfont.1720780228287.woff} +0 -0
  44. /package/lib/{iconfont.1720698597734.woff2 → iconfont.1720780228287.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -1951,9 +1951,9 @@ function eqEmptyValue(cellValue) {
1951
1951
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
1952
1952
 
1953
1953
 
1954
- const version = "4.7.48";
1954
+ const version = "4.7.49";
1955
1955
  core_.VxeUI.version = version;
1956
- core_.VxeUI.tableVersion = "4.7.48";
1956
+ core_.VxeUI.tableVersion = "4.7.49";
1957
1957
  core_.VxeUI.setConfig({
1958
1958
  emptyCell: ' ',
1959
1959
  table: {
@@ -2331,7 +2331,7 @@ var es_array_push = __webpack_require__(4114);
2331
2331
  const {
2332
2332
  log: log_log
2333
2333
  } = core_.VxeUI;
2334
- const log_version = `table v${"4.7.48"}`;
2334
+ const log_version = `table v${"4.7.49"}`;
2335
2335
  const warnLog = log_log.create('warn', log_version);
2336
2336
  const errLog = log_log.create('error', log_version);
2337
2337
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -2469,6 +2469,7 @@ class ColumnInfo {
2469
2469
  renderWidth: 0,
2470
2470
  renderHeight: 0,
2471
2471
  renderResizeWidth: 0,
2472
+ renderAutoWidth: 0,
2472
2473
  resizeWidth: 0,
2473
2474
  renderLeft: 0,
2474
2475
  renderArgs: [],
@@ -3466,7 +3467,8 @@ const Cell = {
3466
3467
  isHidden
3467
3468
  } = params;
3468
3469
  const {
3469
- reactData
3470
+ reactData,
3471
+ internalData
3470
3472
  } = $table;
3471
3473
  const {
3472
3474
  computeTreeOpts
@@ -3475,6 +3477,9 @@ const Cell = {
3475
3477
  treeExpandedMaps,
3476
3478
  treeExpandLazyLoadedMaps
3477
3479
  } = reactData;
3480
+ const {
3481
+ fullAllDataRowIdData
3482
+ } = internalData;
3478
3483
  const treeOpts = computeTreeOpts.value;
3479
3484
  const {
3480
3485
  row,
@@ -3496,9 +3501,11 @@ const Cell = {
3496
3501
  const childrenField = treeOpts.children || treeOpts.childrenField;
3497
3502
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
3498
3503
  const rowChilds = row[childrenField];
3504
+ const hasChild = rowChilds && rowChilds.length;
3499
3505
  const iconSlot = slots ? slots.icon : null;
3500
3506
  let hasLazyChilds = false;
3501
3507
  let isAceived = false;
3508
+ let isLazyLoading = false;
3502
3509
  let isLazyLoaded = false;
3503
3510
  const ons = {};
3504
3511
  if (iconSlot) {
@@ -3508,8 +3515,10 @@ const Cell = {
3508
3515
  const rowid = getRowid($table, row);
3509
3516
  isAceived = !!treeExpandedMaps[rowid];
3510
3517
  if (lazy) {
3511
- isLazyLoaded = !!treeExpandLazyLoadedMaps[rowid];
3518
+ const rest = fullAllDataRowIdData[rowid];
3519
+ isLazyLoading = !!treeExpandLazyLoadedMaps[rowid];
3512
3520
  hasLazyChilds = row[hasChildField];
3521
+ isLazyLoaded = !!rest.treeLoaded;
3513
3522
  }
3514
3523
  }
3515
3524
  if (!trigger || trigger === 'default') {
@@ -3524,11 +3533,11 @@ const Cell = {
3524
3533
  style: {
3525
3534
  paddingLeft: `${level * indent}px`
3526
3535
  }
3527
- }, [showIcon && (rowChilds && rowChilds.length || hasLazyChilds) ? [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
3536
+ }, [showIcon && (lazy ? isLazyLoaded ? hasChild : hasLazyChilds : hasChild) ? [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
3528
3537
  class: 'vxe-tree--btn-wrapper',
3529
3538
  ...ons
3530
3539
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('i', {
3531
- class: ['vxe-tree--node-btn', isLazyLoaded ? iconLoaded || cell_getIcon().TABLE_TREE_LOADED : isAceived ? iconOpen || cell_getIcon().TABLE_TREE_OPEN : iconClose || cell_getIcon().TABLE_TREE_CLOSE]
3540
+ class: ['vxe-tree--node-btn', isLazyLoading ? iconLoaded || cell_getIcon().TABLE_TREE_LOADED : isAceived ? iconOpen || cell_getIcon().TABLE_TREE_OPEN : iconClose || cell_getIcon().TABLE_TREE_CLOSE]
3532
3541
  })])] : null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
3533
3542
  class: 'vxe-tree-cell'
3534
3543
  }, cellVNodes)])];
@@ -3962,7 +3971,7 @@ const Cell = {
3962
3971
  const defaultSlot = slots ? slots.default : null;
3963
3972
  const iconSlot = slots ? slots.icon : null;
3964
3973
  let isAceived = false;
3965
- let isLazyLoaded = false;
3974
+ let isLazyLoading = false;
3966
3975
  if (iconSlot) {
3967
3976
  return $table.callSlot(iconSlot, params);
3968
3977
  }
@@ -3970,7 +3979,7 @@ const Cell = {
3970
3979
  const rowid = getRowid($table, row);
3971
3980
  isAceived = !!rowExpandedMaps[rowid];
3972
3981
  if (lazy) {
3973
- isLazyLoaded = !!rowExpandLazyLoadedMaps[rowid];
3982
+ isLazyLoading = !!rowExpandLazyLoadedMaps[rowid];
3974
3983
  }
3975
3984
  }
3976
3985
  return [showIcon && (!visibleMethod || visibleMethod(params)) ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('span', {
@@ -3981,7 +3990,7 @@ const Cell = {
3981
3990
  $table.triggerRowExpandEvent(evnt, params);
3982
3991
  }
3983
3992
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('i', {
3984
- class: ['vxe-table--expand-btn', isLazyLoaded ? iconLoaded || cell_getIcon().TABLE_EXPAND_LOADED : isAceived ? iconOpen || cell_getIcon().TABLE_EXPAND_OPEN : iconClose || cell_getIcon().TABLE_EXPAND_CLOSE]
3993
+ class: ['vxe-table--expand-btn', isLazyLoading ? iconLoaded || cell_getIcon().TABLE_EXPAND_LOADED : isAceived ? iconOpen || cell_getIcon().TABLE_EXPAND_OPEN : iconClose || cell_getIcon().TABLE_EXPAND_CLOSE]
3985
3994
  })]) : null, defaultSlot || labelField ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('span', {
3986
3995
  class: 'vxe-table--expand-label'
3987
3996
  }, defaultSlot ? $table.callSlot(defaultSlot, params) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)) : null];
@@ -8215,6 +8224,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
8215
8224
  computeSize
8216
8225
  } = useFns.useSize(props);
8217
8226
  const reactData = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)({
8227
+ isCalcColumn: false,
8218
8228
  // 低性能的静态列
8219
8229
  staticColumns: [],
8220
8230
  // 渲染的列分组
@@ -8327,7 +8337,8 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
8327
8337
  pxMinList: [],
8328
8338
  scaleList: [],
8329
8339
  scaleMinList: [],
8330
- autoList: []
8340
+ autoList: [],
8341
+ remainList: []
8331
8342
  },
8332
8343
  // 存放快捷菜单的信息
8333
8344
  ctxMenuStore: {
@@ -8672,6 +8683,12 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
8672
8683
  const computeCustomOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
8673
8684
  return Object.assign({}, table_getConfig().table.customConfig, props.customConfig);
8674
8685
  });
8686
+ const computeAutoWidthColumnList = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
8687
+ const {
8688
+ visibleColumn
8689
+ } = internalData;
8690
+ return visibleColumn.filter(column => column.width === 'auto');
8691
+ });
8675
8692
  const computeFixedColumnSize = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
8676
8693
  const {
8677
8694
  collectColumn
@@ -9063,7 +9080,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
9063
9080
  const val = props[key];
9064
9081
  let num = 0;
9065
9082
  if (val) {
9066
- if (val === 'auto') {
9083
+ if (val === 'fill' || val === 'auto') {
9067
9084
  num = parentHeight;
9068
9085
  } else {
9069
9086
  const excludeHeight = $xeTable.getExcludeHeight();
@@ -9286,6 +9303,41 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
9286
9303
  internalData.customMinHeight = calcHeight('minHeight');
9287
9304
  internalData.customMaxHeight = calcHeight('maxHeight');
9288
9305
  };
9306
+ const calcCellWidth = () => {
9307
+ const {
9308
+ tableData
9309
+ } = reactData;
9310
+ const autoWidthColumnList = computeAutoWidthColumnList.value;
9311
+ if (!tableData.length || !autoWidthColumnList.length) {
9312
+ reactData.isCalcColumn = false;
9313
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
9314
+ }
9315
+ reactData.isCalcColumn = true;
9316
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
9317
+ const el = refElem.value;
9318
+ if (el) {
9319
+ autoWidthColumnList.forEach(column => {
9320
+ const cellElList = el.querySelectorAll(`.vxe-body--column.${column.id}>.vxe-cell`);
9321
+ const firstCellEl = cellElList[0];
9322
+ let paddingSize = 0;
9323
+ if (firstCellEl) {
9324
+ const cellStyle = getComputedStyle(firstCellEl);
9325
+ paddingSize = Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingLeft) + external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingRight)) + 2;
9326
+ }
9327
+ let colWidth = column.renderAutoWidth - paddingSize + 2;
9328
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellElList, cellEl => {
9329
+ const labelEl = cellEl.firstChild;
9330
+ if (labelEl) {
9331
+ colWidth = Math.max(colWidth, labelEl.offsetWidth);
9332
+ }
9333
+ });
9334
+ column.renderAutoWidth = colWidth + paddingSize;
9335
+ });
9336
+ tablePrivateMethods.analyColumnWidth();
9337
+ }
9338
+ reactData.isCalcColumn = false;
9339
+ });
9340
+ };
9289
9341
  /**
9290
9342
  * 列宽算法
9291
9343
  * 支持 px、%、固定 混合分配
@@ -9319,7 +9371,8 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
9319
9371
  pxList,
9320
9372
  scaleList,
9321
9373
  scaleMinList,
9322
- autoList
9374
+ autoList,
9375
+ remainList
9323
9376
  } = columnStore;
9324
9377
  // 最小宽
9325
9378
  pxMinList.forEach(column => {
@@ -9345,6 +9398,12 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
9345
9398
  tableWidth += width;
9346
9399
  column.renderWidth = width;
9347
9400
  });
9401
+ // 自适应宽
9402
+ autoList.forEach(column => {
9403
+ const width = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
9404
+ tableWidth += width;
9405
+ column.renderWidth = width;
9406
+ });
9348
9407
  // 调整了列宽
9349
9408
  resizeList.forEach(column => {
9350
9409
  const width = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);
@@ -9352,7 +9411,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
9352
9411
  column.renderWidth = width;
9353
9412
  });
9354
9413
  remainWidth -= tableWidth;
9355
- meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoList.length)) : 0;
9414
+ meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + remainList.length)) : 0;
9356
9415
  if (fit) {
9357
9416
  if (remainWidth > 0) {
9358
9417
  scaleMinList.concat(pxMinList).forEach(column => {
@@ -9363,8 +9422,8 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
9363
9422
  } else {
9364
9423
  meanWidth = minCellWidth;
9365
9424
  }
9366
- // 自适应
9367
- autoList.forEach(column => {
9425
+ // 剩余均分
9426
+ remainList.forEach(column => {
9368
9427
  const width = Math.max(meanWidth, minCellWidth);
9369
9428
  column.renderWidth = width;
9370
9429
  tableWidth += width;
@@ -9374,7 +9433,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
9374
9433
  * 偏移量算法
9375
9434
  * 如果所有列足够放的情况下,从最后动态列开始分配
9376
9435
  */
9377
- const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoList);
9436
+ const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(remainList);
9378
9437
  let dynamicSize = dynamicList.length - 1;
9379
9438
  if (dynamicSize > 0) {
9380
9439
  let odiffer = bodyWidth - tableWidth;
@@ -10490,10 +10549,10 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
10490
10549
  const rowid = getRowid($xeTable, row);
10491
10550
  const rest = fullAllDataRowIdData[rowid];
10492
10551
  treeExpandLazyLoadedMaps[rowid] = row;
10493
- loadMethod({
10552
+ Promise.resolve(loadMethod({
10494
10553
  $table: $xeTable,
10495
10554
  row
10496
- }).then(childRecords => {
10555
+ })).then(childRecords => {
10497
10556
  rest.treeLoaded = true;
10498
10557
  if (treeExpandLazyLoadedMaps[rowid]) {
10499
10558
  delete treeExpandLazyLoadedMaps[rowid];
@@ -12162,6 +12221,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
12162
12221
  * 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
12163
12222
  */
12164
12223
  recalculate(refull) {
12224
+ calcCellWidth();
12165
12225
  autoCellWidth();
12166
12226
  if (refull === true) {
12167
12227
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
@@ -14152,7 +14212,6 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14152
14212
  /**
14153
14213
  * 处理显示 tooltip
14154
14214
  * @param {Event} evnt 事件
14155
- * @param {ColumnInfo} column 列配置
14156
14215
  * @param {Row} row 行对象
14157
14216
  */
14158
14217
  const handleTooltip = (evnt, cell, overflowElem, tipElem, params) => {
@@ -14229,7 +14288,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14229
14288
  const el = refElem.value;
14230
14289
  if (el) {
14231
14290
  const parentElem = el.parentNode;
14232
- const parentPaddingSize = height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
14291
+ const parentPaddingSize = height === 'fill' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
14233
14292
  return Math.floor($xeGrid ? $xeGrid.getParentHeight() : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(parentElem).height) - parentPaddingSize);
14234
14293
  }
14235
14294
  return 0;
@@ -14431,6 +14490,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14431
14490
  const scaleList = [];
14432
14491
  const scaleMinList = [];
14433
14492
  const autoList = [];
14493
+ const remainList = [];
14434
14494
  tableFullColumn.forEach(column => {
14435
14495
  if (defaultWidth && !column.width) {
14436
14496
  column.width = defaultWidth;
@@ -14441,6 +14501,8 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14441
14501
  if (column.visible) {
14442
14502
  if (column.resizeWidth) {
14443
14503
  resizeList.push(column);
14504
+ } else if (column.width === 'auto') {
14505
+ autoList.push(column);
14444
14506
  } else if (isPx(column.width)) {
14445
14507
  pxList.push(column);
14446
14508
  } else if (isScale(column.width)) {
@@ -14450,7 +14512,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14450
14512
  } else if (isScale(column.minWidth)) {
14451
14513
  scaleMinList.push(column);
14452
14514
  } else {
14453
- autoList.push(column);
14515
+ remainList.push(column);
14454
14516
  }
14455
14517
  }
14456
14518
  });
@@ -14460,7 +14522,8 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14460
14522
  pxMinList,
14461
14523
  scaleList,
14462
14524
  scaleMinList,
14463
- autoList
14525
+ autoList,
14526
+ remainList
14464
14527
  });
14465
14528
  },
14466
14529
  saveCustomStore(type) {
@@ -16108,6 +16171,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16108
16171
  editRules
16109
16172
  } = props;
16110
16173
  const {
16174
+ isCalcColumn,
16111
16175
  isGroup,
16112
16176
  overflowX,
16113
16177
  overflowY,
@@ -16155,6 +16219,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16155
16219
  'row--highlight': rowOpts.isHover || highlightHoverRow,
16156
16220
  'column--highlight': columnOpts.isHover || highlightHoverColumn,
16157
16221
  'checkbox--range': checkboxOpts.range,
16222
+ 'column--calc': isCalcColumn,
16158
16223
  'is--header': showHeader,
16159
16224
  'is--footer': showFooter,
16160
16225
  'is--group': isGroup,
@@ -22684,9 +22749,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
22684
22749
  const tableProps = Object.assign({}, tableExtendProps);
22685
22750
  if (isZMax) {
22686
22751
  if (tableExtendProps.maxHeight) {
22687
- tableProps.maxHeight = 'auto';
22752
+ tableProps.maxHeight = 'fill';
22688
22753
  } else {
22689
- tableProps.height = 'auto';
22754
+ tableProps.height = 'fill';
22690
22755
  }
22691
22756
  }
22692
22757
  if (proxyConfig && isEnableConf(proxyOpts)) {
@@ -23793,7 +23858,7 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
23793
23858
  const topWrapper = refTopWrapper.value;
23794
23859
  const bottomWrapper = refBottomWrapper.value;
23795
23860
  const pagerWrapper = refPagerWrapper.value;
23796
- const parentPaddingSize = isZMax || height !== 'auto' ? 0 : getPaddingTopBottomSize(el.parentNode);
23861
+ const parentPaddingSize = isZMax || !(height === 'auto' || height === 'fill') ? 0 : getPaddingTopBottomSize(el.parentNode);
23797
23862
  return parentPaddingSize + getPaddingTopBottomSize(el) + getOffsetHeight(formWrapper) + getOffsetHeight(toolbarWrapper) + getOffsetHeight(topWrapper) + getOffsetHeight(bottomWrapper) + getOffsetHeight(pagerWrapper);
23798
23863
  },
23799
23864
  getParentHeight() {