vxe-table 4.13.0-beta.3 → 4.13.0-beta.5

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 (41) 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/src/emits.js +4 -0
  6. package/es/table/src/table.js +83 -47
  7. package/es/table/style.css +12 -0
  8. package/es/table/style.min.css +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-table/style.css +12 -0
  12. package/es/vxe-table/style.min.css +1 -1
  13. package/lib/index.css +1 -1
  14. package/lib/index.min.css +1 -1
  15. package/lib/index.umd.js +15 -13
  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/emits.js +1 -1
  20. package/lib/table/src/emits.min.js +1 -1
  21. package/lib/table/src/table.js +98 -53
  22. package/lib/table/src/table.min.js +1 -1
  23. package/lib/table/style/style.css +12 -0
  24. package/lib/table/style/style.min.css +1 -1
  25. package/lib/ui/index.js +1 -1
  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/lib/vxe-table/style/style.css +12 -0
  30. package/lib/vxe-table/style/style.min.css +1 -1
  31. package/package.json +2 -2
  32. package/packages/grid/src/grid.ts +1 -1
  33. package/packages/table/src/emits.ts +7 -1
  34. package/packages/table/src/table.ts +87 -48
  35. package/styles/components/table.scss +19 -0
  36. /package/es/{iconfont.1744078815150.ttf → iconfont.1744249431265.ttf} +0 -0
  37. /package/es/{iconfont.1744078815150.woff → iconfont.1744249431265.woff} +0 -0
  38. /package/es/{iconfont.1744078815150.woff2 → iconfont.1744249431265.woff2} +0 -0
  39. /package/lib/{iconfont.1744078815150.ttf → iconfont.1744249431265.ttf} +0 -0
  40. /package/lib/{iconfont.1744078815150.woff → iconfont.1744249431265.woff} +0 -0
  41. /package/lib/{iconfont.1744078815150.woff2 → iconfont.1744249431265.woff2} +0 -0
@@ -1655,10 +1655,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
1655
1655
  const {
1656
1656
  elemStore
1657
1657
  } = internalData;
1658
- const scrollbarOpts = computeScrollbarOpts.value;
1659
- const tableBody = refTableBody.value;
1660
- const bodyElem = tableBody ? tableBody.$el : null;
1661
- if (!bodyElem) {
1658
+ const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
1659
+ if (!bodyWrapperElem) {
1662
1660
  return;
1663
1661
  }
1664
1662
  const yHandleEl = refScrollYHandleElem.value;
@@ -1671,7 +1669,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1671
1669
  }
1672
1670
  let tWidth = 0;
1673
1671
  const minCellWidth = 40; // 列宽最少限制 40px
1674
- const bodyWidth = bodyElem.clientWidth;
1672
+ const bodyWidth = bodyWrapperElem.clientWidth;
1675
1673
  let remainWidth = bodyWidth;
1676
1674
  let meanWidth = remainWidth / 100;
1677
1675
  const {
@@ -1768,28 +1766,10 @@ var _default = exports.default = (0, _vue.defineComponent)({
1768
1766
  }
1769
1767
  }
1770
1768
  }
1771
- const tableHeight = bodyElem.offsetHeight;
1772
- const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
1773
- reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
1774
- reactData.overflowY = overflowY;
1775
1769
  reactData.scrollXWidth = tWidth;
1776
- internalData.tableHeight = tableHeight;
1777
- const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
1778
- const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
1779
- const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
1780
- const overflowX = tWidth > bodyWidth;
1781
- const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
1782
- reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
1783
- internalData.headerHeight = headerHeight;
1784
- internalData.footerHeight = footerHeight;
1785
- reactData.overflowX = overflowX;
1786
1770
  reactData.resizeWidthFlag++;
1787
1771
  updateColumnOffsetLeft();
1788
1772
  updateHeight();
1789
- reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
1790
- if (overflowX) {
1791
- $xeTable.checkScrolling();
1792
- }
1793
1773
  };
1794
1774
  const calcCellAutoHeight = (rowRest, wrapperEl) => {
1795
1775
  const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
@@ -3123,7 +3103,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
3123
3103
  }
3124
3104
  // 计算 Y 逻辑
3125
3105
  const rowHeight = computeRowHeight();
3126
- scrollYStore.rowHeight = rowHeight;
3106
+ scrollYStore.rowHeight = rowHeight; // 已废弃
3127
3107
  reactData.rowHeight = rowHeight;
3128
3108
  const {
3129
3109
  toVisibleIndex: toYVisibleIndex,
@@ -3143,11 +3123,46 @@ var _default = exports.default = (0, _vue.defineComponent)({
3143
3123
  } else {
3144
3124
  $xeTable.updateScrollYSpace();
3145
3125
  }
3146
- (0, _vue.nextTick)(() => {
3147
- updateStyle();
3148
- });
3149
3126
  });
3150
3127
  };
3128
+ const calcScrollbar = () => {
3129
+ const {
3130
+ scrollXWidth,
3131
+ scrollYHeight
3132
+ } = reactData;
3133
+ const {
3134
+ elemStore
3135
+ } = internalData;
3136
+ const scrollbarOpts = computeScrollbarOpts.value;
3137
+ const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
3138
+ const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
3139
+ const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
3140
+ const xHandleEl = refScrollXHandleElem.value;
3141
+ const yHandleEl = refScrollYHandleElem.value;
3142
+ let overflowY = false;
3143
+ let overflowX = false;
3144
+ if (bodyWrapperElem) {
3145
+ overflowY = scrollYHeight > bodyWrapperElem.clientHeight;
3146
+ if (yHandleEl) {
3147
+ reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
3148
+ }
3149
+ reactData.overflowY = overflowY;
3150
+ overflowX = scrollXWidth > bodyWrapperElem.clientWidth;
3151
+ if (xHandleEl) {
3152
+ reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
3153
+ }
3154
+ const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
3155
+ const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
3156
+ internalData.tableHeight = bodyWrapperElem.offsetHeight;
3157
+ internalData.headerHeight = headerHeight;
3158
+ internalData.footerHeight = footerHeight;
3159
+ reactData.overflowX = overflowX;
3160
+ reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
3161
+ }
3162
+ if (overflowX) {
3163
+ $xeTable.checkScrolling();
3164
+ }
3165
+ };
3151
3166
  const handleRecalculateLayout = reFull => {
3152
3167
  const el = refElem.value;
3153
3168
  internalData.rceRunTime = Date.now();
@@ -3164,18 +3179,22 @@ var _default = exports.default = (0, _vue.defineComponent)({
3164
3179
  }
3165
3180
  calcCellWidth();
3166
3181
  autoCellWidth();
3182
+ calcScrollbar();
3167
3183
  updateStyle();
3168
3184
  updateRowExpandStyle();
3169
3185
  return computeScrollLoad().then(() => {
3170
- if (reFull === true) {
3171
- // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
3172
- calcCellWidth();
3186
+ // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
3187
+ calcCellWidth();
3188
+ if (reFull) {
3173
3189
  autoCellWidth();
3174
- updateStyle();
3175
- if (reFull) {
3176
- updateRowOffsetTop();
3177
- }
3178
- updateRowExpandStyle();
3190
+ }
3191
+ calcScrollbar();
3192
+ updateStyle();
3193
+ if (reFull) {
3194
+ updateRowOffsetTop();
3195
+ }
3196
+ updateRowExpandStyle();
3197
+ if (reFull) {
3179
3198
  return computeScrollLoad();
3180
3199
  }
3181
3200
  });
@@ -9405,7 +9424,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
9405
9424
  isChange = oldValue === newValue;
9406
9425
  if (isChange) {
9407
9426
  newValue = null;
9408
- tableMethods.clearRadioRow();
9427
+ $xeTable.clearRadioRow();
9409
9428
  }
9410
9429
  }
9411
9430
  if (isChange) {
@@ -9416,17 +9435,29 @@ var _default = exports.default = (0, _vue.defineComponent)({
9416
9435
  }
9417
9436
  },
9418
9437
  triggerCurrentColumnEvent(evnt, params) {
9419
- const columnOpts = computeColumnOpts.value;
9420
9438
  const {
9421
- currentMethod
9422
- } = columnOpts;
9439
+ currentColumn: oldValue
9440
+ } = reactData;
9441
+ const columnOpts = computeColumnOpts.value;
9442
+ const currentColumnOpts = computeCurrentColumnOpts.value;
9443
+ const beforeRowMethod = currentColumnOpts.beforeSelectMethod || columnOpts.currentMethod;
9423
9444
  const {
9424
- column
9445
+ column: newValue
9425
9446
  } = params;
9426
- if (!currentMethod || currentMethod({
9427
- column
9447
+ const isChange = oldValue !== newValue;
9448
+ if (!beforeRowMethod || beforeRowMethod({
9449
+ column: newValue,
9450
+ $table: $xeTable
9428
9451
  })) {
9429
- tableMethods.setCurrentColumn(column);
9452
+ $xeTable.setCurrentColumn(newValue);
9453
+ if (isChange) {
9454
+ dispatchEvent('current-column-change', Object.assign({
9455
+ oldValue,
9456
+ newValue
9457
+ }, params), evnt);
9458
+ }
9459
+ } else {
9460
+ dispatchEvent('current-column-disabled', params, evnt);
9430
9461
  }
9431
9462
  },
9432
9463
  triggerCurrentRowEvent(evnt, params) {
@@ -9434,23 +9465,30 @@ var _default = exports.default = (0, _vue.defineComponent)({
9434
9465
  currentRow: oldValue
9435
9466
  } = reactData;
9436
9467
  const rowOpts = computeRowOpts.value;
9437
- const {
9438
- currentMethod
9439
- } = rowOpts;
9468
+ const currentRowOpts = computeCurrentRowOpts.value;
9469
+ const beforeRowMethod = currentRowOpts.beforeSelectMethod || rowOpts.currentMethod;
9440
9470
  const {
9441
9471
  row: newValue
9442
9472
  } = params;
9443
9473
  const isChange = oldValue !== newValue;
9444
- if (!currentMethod || currentMethod({
9445
- row: newValue
9474
+ if (!beforeRowMethod || beforeRowMethod({
9475
+ row: newValue,
9476
+ $table: $xeTable
9446
9477
  })) {
9447
- tableMethods.setCurrentRow(newValue);
9478
+ $xeTable.setCurrentRow(newValue);
9448
9479
  if (isChange) {
9480
+ dispatchEvent('current-row-change', Object.assign({
9481
+ oldValue,
9482
+ newValue
9483
+ }, params), evnt);
9484
+ // 已废弃
9449
9485
  dispatchEvent('current-change', Object.assign({
9450
9486
  oldValue,
9451
9487
  newValue
9452
9488
  }, params), evnt);
9453
9489
  }
9490
+ } else {
9491
+ dispatchEvent('current-row-disabled', params, evnt);
9454
9492
  }
9455
9493
  },
9456
9494
  /**
@@ -11039,11 +11077,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
11039
11077
  const firstRow = afterFullData[startIndex];
11040
11078
  let rowid = (0, _util.getRowid)($xeTable, firstRow);
11041
11079
  let rowRest = fullAllDataRowIdData[rowid] || {};
11042
- ySpaceTop = rowRest.oTop;
11080
+ ySpaceTop = rowRest.oTop || 0;
11043
11081
  const lastRow = afterFullData[afterFullData.length - 1];
11044
11082
  rowid = (0, _util.getRowid)($xeTable, lastRow);
11045
11083
  rowRest = fullAllDataRowIdData[rowid] || {};
11046
- scrollYHeight = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
11084
+ scrollYHeight = (rowRest.oTop || 0) + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
11047
11085
  // 是否展开行
11048
11086
  if (expandColumn && rowExpandedMaps[rowid]) {
11049
11087
  scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;
@@ -11109,7 +11147,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
11109
11147
  isAllOverflow
11110
11148
  } = reactData;
11111
11149
  handleTableColumn();
11112
- $xeTable.updateScrollYSpace();
11150
+ $xeTable.updateScrollXSpace();
11113
11151
  return (0, _vue.nextTick)().then(() => {
11114
11152
  handleTableColumn();
11115
11153
  $xeTable.updateScrollXSpace();
@@ -11771,7 +11809,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
11771
11809
  theme: tableTipConfig.theme,
11772
11810
  enterable: tableTipConfig.enterable,
11773
11811
  enterDelay: tableTipConfig.enterDelay,
11774
- leaveDelay: tableTipConfig.leaveDelay
11812
+ leaveDelay: tableTipConfig.leaveDelay,
11813
+ useHTML: tableTipConfig.useHTML
11775
11814
  }),
11776
11815
  /**
11777
11816
  * 校验提示
@@ -12120,6 +12159,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
12120
12159
  if (checkboxOpts.halfField) {
12121
12160
  (0, _log.warnLog)('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
12122
12161
  }
12162
+ if (rowOpts.currentMethod) {
12163
+ (0, _log.warnLog)('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod']);
12164
+ }
12165
+ if (columnOpts.currentMethod) {
12166
+ (0, _log.warnLog)('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod']);
12167
+ }
12123
12168
  if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !_xeUtils.default.isBoolean(currentRowOpts.isFollowSelected)) {
12124
12169
  (0, _log.warnLog)('vxe.error.notConflictProp', ['row-config.isCurrent', 'current-row-config.isFollowSelected']);
12125
12170
  }