vxe-table 3.12.1-beta.2 → 3.12.1-beta.4

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 (127) hide show
  1. package/es/locale/lang/ar-EG.js +2 -1
  2. package/es/locale/lang/de-DE.js +2 -1
  3. package/es/locale/lang/en-US.js +2 -1
  4. package/es/locale/lang/es-ES.js +2 -1
  5. package/es/locale/lang/fr-FR.js +2 -1
  6. package/es/locale/lang/hu-HU.js +2 -1
  7. package/es/locale/lang/hy-AM.js +2 -1
  8. package/es/locale/lang/it-IT.js +2 -1
  9. package/es/locale/lang/ja-JP.js +2 -1
  10. package/es/locale/lang/ko-KR.js +2 -1
  11. package/es/locale/lang/nb-NO.js +2 -1
  12. package/es/locale/lang/pt-BR.js +2 -1
  13. package/es/locale/lang/ru-RU.js +2 -1
  14. package/es/locale/lang/th-TH.js +2 -1
  15. package/es/locale/lang/ug-CN.js +2 -1
  16. package/es/locale/lang/uk-UA.js +2 -1
  17. package/es/locale/lang/vi-VN.js +2 -1
  18. package/es/locale/lang/zh-CHT.js +2 -1
  19. package/es/locale/lang/zh-CN.js +2 -1
  20. package/es/style.css +1 -1
  21. package/es/table/module/edit/mixin.js +5 -5
  22. package/es/table/src/body.js +4 -3
  23. package/es/table/src/cell.js +73 -50
  24. package/es/table/src/header.js +10 -7
  25. package/es/table/src/methods.js +503 -450
  26. package/es/table/src/table.js +2 -1
  27. package/es/ui/index.js +1 -1
  28. package/es/ui/src/log.js +1 -1
  29. package/lib/index.umd.js +704 -597
  30. package/lib/index.umd.min.js +1 -1
  31. package/lib/locale/lang/ar-EG.js +2 -1
  32. package/lib/locale/lang/ar-EG.min.js +1 -1
  33. package/lib/locale/lang/de-DE.js +2 -1
  34. package/lib/locale/lang/de-DE.min.js +1 -1
  35. package/lib/locale/lang/en-US.js +2 -1
  36. package/lib/locale/lang/en-US.min.js +1 -1
  37. package/lib/locale/lang/en-US.umd.js +2 -1
  38. package/lib/locale/lang/es-ES.js +2 -1
  39. package/lib/locale/lang/es-ES.min.js +1 -1
  40. package/lib/locale/lang/es-ES.umd.js +2 -1
  41. package/lib/locale/lang/fr-FR.js +2 -1
  42. package/lib/locale/lang/fr-FR.min.js +1 -1
  43. package/lib/locale/lang/hu-HU.js +2 -1
  44. package/lib/locale/lang/hu-HU.min.js +1 -1
  45. package/lib/locale/lang/hu-HU.umd.js +2 -1
  46. package/lib/locale/lang/hy-AM.js +2 -1
  47. package/lib/locale/lang/hy-AM.min.js +1 -1
  48. package/lib/locale/lang/it-IT.js +2 -1
  49. package/lib/locale/lang/it-IT.min.js +1 -1
  50. package/lib/locale/lang/ja-JP.js +2 -1
  51. package/lib/locale/lang/ja-JP.min.js +1 -1
  52. package/lib/locale/lang/ja-JP.umd.js +2 -1
  53. package/lib/locale/lang/ko-KR.js +2 -1
  54. package/lib/locale/lang/ko-KR.min.js +1 -1
  55. package/lib/locale/lang/ko-KR.umd.js +2 -1
  56. package/lib/locale/lang/nb-NO.js +2 -1
  57. package/lib/locale/lang/nb-NO.min.js +1 -1
  58. package/lib/locale/lang/pt-BR.js +2 -1
  59. package/lib/locale/lang/pt-BR.min.js +1 -1
  60. package/lib/locale/lang/pt-BR.umd.js +2 -1
  61. package/lib/locale/lang/ru-RU.js +2 -1
  62. package/lib/locale/lang/ru-RU.min.js +1 -1
  63. package/lib/locale/lang/ru-RU.umd.js +2 -1
  64. package/lib/locale/lang/th-TH.js +2 -1
  65. package/lib/locale/lang/th-TH.min.js +1 -1
  66. package/lib/locale/lang/ug-CN.js +2 -1
  67. package/lib/locale/lang/ug-CN.min.js +1 -1
  68. package/lib/locale/lang/uk-UA.js +2 -1
  69. package/lib/locale/lang/uk-UA.min.js +1 -1
  70. package/lib/locale/lang/uk-UA.umd.js +2 -1
  71. package/lib/locale/lang/vi-VN.js +2 -1
  72. package/lib/locale/lang/vi-VN.min.js +1 -1
  73. package/lib/locale/lang/zh-CHT.js +2 -1
  74. package/lib/locale/lang/zh-CHT.min.js +1 -1
  75. package/lib/locale/lang/zh-CHT.umd.js +2 -1
  76. package/lib/locale/lang/zh-CN.js +2 -1
  77. package/lib/locale/lang/zh-CN.min.js +1 -1
  78. package/lib/locale/lang/zh-CN.umd.js +2 -1
  79. package/lib/style.css +1 -1
  80. package/lib/table/module/edit/mixin.js +10 -5
  81. package/lib/table/module/edit/mixin.min.js +1 -1
  82. package/lib/table/src/body.js +4 -2
  83. package/lib/table/src/body.min.js +1 -1
  84. package/lib/table/src/cell.js +87 -54
  85. package/lib/table/src/cell.min.js +1 -1
  86. package/lib/table/src/header.js +11 -6
  87. package/lib/table/src/header.min.js +1 -1
  88. package/lib/table/src/methods.js +585 -526
  89. package/lib/table/src/methods.min.js +1 -1
  90. package/lib/table/src/table.js +2 -1
  91. package/lib/table/src/table.min.js +1 -1
  92. package/lib/ui/index.js +1 -1
  93. package/lib/ui/index.min.js +1 -1
  94. package/lib/ui/src/log.js +1 -1
  95. package/lib/ui/src/log.min.js +1 -1
  96. package/package.json +2 -2
  97. package/packages/locale/lang/ar-EG.ts +2 -1
  98. package/packages/locale/lang/de-DE.ts +2 -1
  99. package/packages/locale/lang/en-US.ts +2 -1
  100. package/packages/locale/lang/es-ES.ts +2 -1
  101. package/packages/locale/lang/fr-FR.ts +2 -1
  102. package/packages/locale/lang/hu-HU.ts +2 -1
  103. package/packages/locale/lang/hy-AM.ts +2 -1
  104. package/packages/locale/lang/it-IT.ts +2 -1
  105. package/packages/locale/lang/ja-JP.ts +2 -1
  106. package/packages/locale/lang/ko-KR.ts +2 -1
  107. package/packages/locale/lang/nb-NO.ts +2 -1
  108. package/packages/locale/lang/pt-BR.ts +2 -1
  109. package/packages/locale/lang/ru-RU.ts +2 -1
  110. package/packages/locale/lang/th-TH.ts +2 -1
  111. package/packages/locale/lang/ug-CN.ts +2 -1
  112. package/packages/locale/lang/uk-UA.ts +2 -1
  113. package/packages/locale/lang/vi-VN.ts +2 -1
  114. package/packages/locale/lang/zh-CHT.ts +2 -1
  115. package/packages/locale/lang/zh-CN.ts +2 -1
  116. package/packages/table/module/edit/mixin.ts +5 -5
  117. package/packages/table/src/body.ts +4 -2
  118. package/packages/table/src/cell.ts +78 -46
  119. package/packages/table/src/header.ts +13 -10
  120. package/packages/table/src/methods.ts +523 -459
  121. package/packages/table/src/table.ts +3 -1
  122. /package/es/{iconfont.1735881990049.ttf → iconfont.1735908447074.ttf} +0 -0
  123. /package/es/{iconfont.1735881990049.woff → iconfont.1735908447074.woff} +0 -0
  124. /package/es/{iconfont.1735881990049.woff2 → iconfont.1735908447074.woff2} +0 -0
  125. /package/lib/{iconfont.1735881990049.ttf → iconfont.1735908447074.ttf} +0 -0
  126. /package/lib/{iconfont.1735881990049.woff → iconfont.1735908447074.woff} +0 -0
  127. /package/lib/{iconfont.1735881990049.woff2 → iconfont.1735908447074.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.12.1-beta.2";
2223
+ const version = "3.12.1-beta.4";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2814,7 +2814,7 @@ function isNodeElement(elem) {
2814
2814
  const {
2815
2815
  log: log_log
2816
2816
  } = core_.VxeUI;
2817
- const log_version = `table v${"3.12.1-beta.2"}`;
2817
+ const log_version = `table v${"3.12.1-beta.4"}`;
2818
2818
  const warnLog = log_log.create('warn', log_version);
2819
2819
  const errLog = log_log.create('error', log_version);
2820
2820
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -3819,66 +3819,99 @@ function getDefaultCellLabel(params) {
3819
3819
  } = params;
3820
3820
  return formatText($table.getCellLabel(row, column), 1);
3821
3821
  }
3822
+ function renderCellHandle(h, params) {
3823
+ const {
3824
+ column,
3825
+ $table
3826
+ } = params;
3827
+ const tableProps = $table;
3828
+ const {
3829
+ editConfig
3830
+ } = tableProps;
3831
+ const {
3832
+ type,
3833
+ treeNode,
3834
+ editRender
3835
+ } = column;
3836
+ const checkboxOpts = $table.computeCheckboxOpts;
3837
+ const editOpts = $table.computeEditOpts;
3838
+ switch (type) {
3839
+ case 'seq':
3840
+ return treeNode ? Cell.renderTreeIndexCell(h, params) : Cell.renderSeqCell(h, params);
3841
+ case 'radio':
3842
+ return treeNode ? Cell.renderTreeRadioCell(h, params) : Cell.renderRadioCell(h, params);
3843
+ case 'checkbox':
3844
+ return checkboxOpts.checkField ? treeNode ? Cell.renderTreeSelectionCellByProp(h, params) : Cell.renderCheckboxCellByProp(h, params) : treeNode ? Cell.renderTreeSelectionCell(h, params) : Cell.renderCheckboxCell(h, params);
3845
+ case 'expand':
3846
+ return Cell.renderExpandCell(h, params);
3847
+ case 'html':
3848
+ return treeNode ? Cell.renderTreeHTMLCell(h, params) : Cell.renderHTMLCell(h, params);
3849
+ }
3850
+ if (editConfig && editRender) {
3851
+ return editOpts.mode === 'cell' ? treeNode ? Cell.renderTreeCellEdit(h, params) : Cell.renderCellEdit(h, params) : treeNode ? Cell.renderTreeRowEdit(h, params) : Cell.renderRowEdit(h, params);
3852
+ }
3853
+ return treeNode ? Cell.renderTreeCell(h, params) : Cell.renderDefaultCell(h, params);
3854
+ }
3855
+ function renderHeaderHandle(h, params) {
3856
+ const {
3857
+ column,
3858
+ $table
3859
+ } = params;
3860
+ const tableProps = $table;
3861
+ const {
3862
+ editConfig
3863
+ } = tableProps;
3864
+ const {
3865
+ type,
3866
+ filters,
3867
+ sortable,
3868
+ editRender
3869
+ } = column;
3870
+ switch (type) {
3871
+ case 'seq':
3872
+ return Cell.renderSeqHeader(h, params);
3873
+ case 'radio':
3874
+ return Cell.renderRadioHeader(h, params);
3875
+ case 'checkbox':
3876
+ return Cell.renderCheckboxHeader(h, params);
3877
+ case 'html':
3878
+ if (filters && sortable) {
3879
+ return Cell.renderSortAndFilterHeader(h, params);
3880
+ } else if (sortable) {
3881
+ return Cell.renderSortHeader(h, params);
3882
+ } else if (filters) {
3883
+ return Cell.renderFilterHeader(h, params);
3884
+ }
3885
+ break;
3886
+ }
3887
+ if (editConfig && editRender) {
3888
+ return Cell.renderEditHeader(h, params);
3889
+ } else if (filters && sortable) {
3890
+ return Cell.renderSortAndFilterHeader(h, params);
3891
+ } else if (sortable) {
3892
+ return Cell.renderSortHeader(h, params);
3893
+ } else if (filters) {
3894
+ return Cell.renderFilterHeader(h, params);
3895
+ }
3896
+ return Cell.renderDefaultHeader(h, params);
3897
+ }
3898
+ function renderFooterHandle(h, params) {
3899
+ return Cell.renderDefaultFooter(h, params);
3900
+ }
3822
3901
  const Cell = {
3823
3902
  createColumn($xetable, _vm) {
3824
3903
  const {
3825
- type,
3826
- sortable,
3827
- remoteSort,
3828
- filters,
3829
- editRender,
3830
- treeNode
3904
+ type
3831
3905
  } = _vm;
3832
- const {
3833
- editConfig,
3834
- editOpts,
3835
- checkboxOpts
3836
- } = $xetable;
3837
- const renMaps = {
3838
- renderHeader: this.renderDefaultHeader,
3839
- renderCell: treeNode ? this.renderTreeCell : this.renderDefaultCell,
3840
- renderFooter: this.renderDefaultFooter
3906
+ const renConfs = {
3907
+ renderHeader: renderHeaderHandle,
3908
+ renderCell: renderCellHandle,
3909
+ renderFooter: renderFooterHandle
3841
3910
  };
3842
- switch (type) {
3843
- case 'seq':
3844
- renMaps.renderHeader = this.renderSeqHeader;
3845
- renMaps.renderCell = treeNode ? this.renderTreeIndexCell : this.renderSeqCell;
3846
- break;
3847
- case 'radio':
3848
- renMaps.renderHeader = this.renderRadioHeader;
3849
- renMaps.renderCell = treeNode ? this.renderTreeRadioCell : this.renderRadioCell;
3850
- break;
3851
- case 'checkbox':
3852
- renMaps.renderHeader = this.renderCheckboxHeader;
3853
- renMaps.renderCell = checkboxOpts.checkField ? treeNode ? this.renderTreeSelectionCellByProp : this.renderCheckboxCellByProp : treeNode ? this.renderTreeSelectionCell : this.renderCheckboxCell;
3854
- break;
3855
- case 'expand':
3856
- renMaps.renderCell = this.renderExpandCell;
3857
- renMaps.renderData = this.renderExpandData;
3858
- break;
3859
- case 'html':
3860
- renMaps.renderCell = treeNode ? this.renderTreeHTMLCell : this.renderHTMLCell;
3861
- if (filters && (sortable || remoteSort)) {
3862
- renMaps.renderHeader = this.renderSortAndFilterHeader;
3863
- } else if (sortable || remoteSort) {
3864
- renMaps.renderHeader = this.renderSortHeader;
3865
- } else if (filters) {
3866
- renMaps.renderHeader = this.renderFilterHeader;
3867
- }
3868
- break;
3869
- default:
3870
- if (editConfig && editRender) {
3871
- renMaps.renderHeader = this.renderEditHeader;
3872
- renMaps.renderCell = editOpts.mode === 'cell' ? treeNode ? this.renderTreeCellEdit : this.renderCellEdit : treeNode ? this.renderTreeRowEdit : this.renderRowEdit;
3873
- } else if (filters && (sortable || remoteSort)) {
3874
- renMaps.renderHeader = this.renderSortAndFilterHeader;
3875
- } else if (sortable || remoteSort) {
3876
- renMaps.renderHeader = this.renderSortHeader;
3877
- } else if (filters) {
3878
- renMaps.renderHeader = this.renderFilterHeader;
3879
- }
3911
+ if (type === 'expand') {
3912
+ renConfs.renderData = Cell.renderExpandData;
3880
3913
  }
3881
- return createColumn($xetable, _vm, renMaps);
3914
+ return createColumn($xetable, _vm, renConfs);
3882
3915
  },
3883
3916
  /**
3884
3917
  * 列头标题
@@ -5074,7 +5107,143 @@ function handleVirtualXVisible($xeTable) {
5074
5107
  visibleSize: 6
5075
5108
  };
5076
5109
  }
5077
- const computeRowHeight = $xeTable => {
5110
+ /**
5111
+ * 更新数据列的 Map
5112
+ * 牺牲数据组装的耗时,用来换取使用过程中的流畅
5113
+ */
5114
+ function cacheColumnMap($xeTable) {
5115
+ const props = $xeTable;
5116
+ const reactData = $xeTable;
5117
+ const internalData = $xeTable;
5118
+ const {
5119
+ tableFullColumn,
5120
+ collectColumn
5121
+ } = internalData;
5122
+ const fullColumnIdData = internalData.fullColumnIdData = {};
5123
+ const fullColumnFieldData = internalData.fullColumnFieldData = {};
5124
+ const mouseOpts = $xeTable.computeMouseOpts;
5125
+ const columnOpts = $xeTable.computeColumnOpts;
5126
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
5127
+ const {
5128
+ isCrossDrag,
5129
+ isSelfToChildDrag
5130
+ } = columnDragOpts;
5131
+ const rowOpts = $xeTable.computeRowOpts;
5132
+ const isGroup = collectColumn.some(hasChildrenList);
5133
+ let isAllOverflow = !!props.showOverflow;
5134
+ let expandColumn;
5135
+ let treeNodeColumn;
5136
+ let checkboxColumn;
5137
+ let radioColumn;
5138
+ let htmlColumn;
5139
+ let hasFixed;
5140
+ const handleFunc = (column, index, items, path, parentColumn) => {
5141
+ const {
5142
+ id: colid,
5143
+ field,
5144
+ fixed,
5145
+ type,
5146
+ treeNode
5147
+ } = column;
5148
+ const rest = {
5149
+ $index: -1,
5150
+ _index: -1,
5151
+ column,
5152
+ colid,
5153
+ index,
5154
+ items,
5155
+ parent: parentColumn || null,
5156
+ width: 0
5157
+ };
5158
+ if (field) {
5159
+ if (fullColumnFieldData[field]) {
5160
+ errLog('vxe.error.colRepet', ['field', field]);
5161
+ }
5162
+ fullColumnFieldData[field] = rest;
5163
+ } else {
5164
+ if (isCrossDrag || isSelfToChildDrag) {
5165
+ errLog('vxe.error.emptyProp', ['column.field']);
5166
+ }
5167
+ }
5168
+ if (!hasFixed && fixed) {
5169
+ hasFixed = fixed;
5170
+ }
5171
+ if (!htmlColumn && type === 'html') {
5172
+ htmlColumn = column;
5173
+ }
5174
+ if (treeNode) {
5175
+ if (true) {
5176
+ if (treeNodeColumn) {
5177
+ warnLog('vxe.error.colRepet', ['tree-node', treeNode]);
5178
+ }
5179
+ }
5180
+ if (!treeNodeColumn) {
5181
+ treeNodeColumn = column;
5182
+ }
5183
+ } else if (type === 'expand') {
5184
+ if (true) {
5185
+ if (expandColumn) {
5186
+ warnLog('vxe.error.colRepet', ['type', type]);
5187
+ }
5188
+ }
5189
+ if (!expandColumn) {
5190
+ expandColumn = column;
5191
+ }
5192
+ }
5193
+ if (true) {
5194
+ if (type === 'checkbox') {
5195
+ if (checkboxColumn) {
5196
+ warnLog('vxe.error.colRepet', ['type', type]);
5197
+ }
5198
+ if (!checkboxColumn) {
5199
+ checkboxColumn = column;
5200
+ }
5201
+ } else if (type === 'radio') {
5202
+ if (radioColumn) {
5203
+ warnLog('vxe.error.colRepet', ['type', type]);
5204
+ }
5205
+ if (!radioColumn) {
5206
+ radioColumn = column;
5207
+ }
5208
+ }
5209
+ }
5210
+ if (isAllOverflow && column.showOverflow === false) {
5211
+ isAllOverflow = false;
5212
+ }
5213
+ if (fullColumnIdData[colid]) {
5214
+ errLog('vxe.error.colRepet', ['colId', colid]);
5215
+ }
5216
+ fullColumnIdData[colid] = rest;
5217
+ };
5218
+ if (isGroup) {
5219
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
5220
+ column.level = nodes.length;
5221
+ handleFunc(column, index, items, path, parentColumn);
5222
+ });
5223
+ } else {
5224
+ tableFullColumn.forEach(handleFunc);
5225
+ }
5226
+ if (true) {
5227
+ if (expandColumn && mouseOpts.area) {
5228
+ errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
5229
+ }
5230
+ }
5231
+ if (true) {
5232
+ if (htmlColumn) {
5233
+ if (!columnOpts.useKey) {
5234
+ errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
5235
+ }
5236
+ if (!rowOpts.useKey) {
5237
+ errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
5238
+ }
5239
+ }
5240
+ }
5241
+ reactData.isGroup = isGroup;
5242
+ reactData.treeNodeColumn = treeNodeColumn;
5243
+ reactData.expandColumn = expandColumn;
5244
+ reactData.isAllOverflow = isAllOverflow;
5245
+ }
5246
+ function computeRowHeight($xeTable) {
5078
5247
  const tableHeader = $xeTable.$refs.tableHeader;
5079
5248
  const tableBody = $xeTable.$refs.tableBody;
5080
5249
  const tableBodyElem = tableBody ? tableBody.$el : null;
@@ -5097,7 +5266,7 @@ const computeRowHeight = $xeTable => {
5097
5266
  }
5098
5267
  // 最低支持 18px 行高
5099
5268
  return Math.max(18, rowHeight);
5100
- };
5269
+ }
5101
5270
  function handleVirtualYVisible($xeTable) {
5102
5271
  const internalData = $xeTable;
5103
5272
  const {
@@ -5261,17 +5430,19 @@ function clearAllSort(_vm) {
5261
5430
  column.order = null;
5262
5431
  });
5263
5432
  }
5264
- function calcTableHeight(_vm, key) {
5433
+ function calcTableHeight($xeTable, key) {
5434
+ const props = $xeTable;
5435
+ const reactData = $xeTable;
5265
5436
  const {
5266
5437
  parentHeight
5267
- } = _vm;
5268
- const val = _vm[key];
5438
+ } = reactData;
5439
+ const val = props[key];
5269
5440
  let num = 0;
5270
5441
  if (val) {
5271
5442
  if (val === '100%' || val === 'auto') {
5272
5443
  num = parentHeight;
5273
5444
  } else {
5274
- const excludeHeight = _vm.getExcludeHeight();
5445
+ const excludeHeight = $xeTable.getExcludeHeight();
5275
5446
  if (isScale(val)) {
5276
5447
  num = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(val) || 1) / 100 * parentHeight);
5277
5448
  } else {
@@ -5282,6 +5453,166 @@ function calcTableHeight(_vm, key) {
5282
5453
  }
5283
5454
  return num;
5284
5455
  }
5456
+ /**
5457
+ * 列宽算法,计算单元格列宽,动态分配可用剩余空间
5458
+ * 支持 px、%、固定 混合分配
5459
+ * 支持动态列表调整分配
5460
+ * 支持自动分配偏移量
5461
+ * 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
5462
+ */
5463
+ function autoCellWidth($xeTable) {
5464
+ const props = $xeTable;
5465
+ const reactData = $xeTable;
5466
+ const internalData = $xeTable;
5467
+ const tableHeader = $xeTable.$refs.tableHeader;
5468
+ const tableBody = $xeTable.$refs.tableBody;
5469
+ const tableFooter = $xeTable.$refs.tableFooter;
5470
+ const bodyElem = tableBody ? tableBody.$el : null;
5471
+ const headerElem = tableHeader ? tableHeader.$el : null;
5472
+ const footerElem = tableFooter ? tableFooter.$el : null;
5473
+ if (!bodyElem) {
5474
+ return;
5475
+ }
5476
+ let tableWidth = 0;
5477
+ const minCellWidth = 40; // 列宽最少限制 40px
5478
+ const bodyWidth = bodyElem.clientWidth - 1;
5479
+ let remainWidth = bodyWidth;
5480
+ let meanWidth = remainWidth / 100;
5481
+ const {
5482
+ fit
5483
+ } = props;
5484
+ const {
5485
+ columnStore
5486
+ } = reactData;
5487
+ const {
5488
+ resizeList,
5489
+ pxMinList,
5490
+ autoMinList,
5491
+ pxList,
5492
+ scaleList,
5493
+ scaleMinList,
5494
+ autoList,
5495
+ remainList
5496
+ } = columnStore;
5497
+ // 最小宽
5498
+ pxMinList.forEach(column => {
5499
+ const minWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth);
5500
+ tableWidth += minWidth;
5501
+ column.renderWidth = minWidth;
5502
+ });
5503
+ // 最小自适应
5504
+ autoMinList.forEach(column => {
5505
+ const scaleWidth = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
5506
+ tableWidth += scaleWidth;
5507
+ column.renderWidth = scaleWidth;
5508
+ });
5509
+ // 最小百分比
5510
+ scaleMinList.forEach(column => {
5511
+ const scaleWidth = Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth) * meanWidth);
5512
+ tableWidth += scaleWidth;
5513
+ column.renderWidth = scaleWidth;
5514
+ });
5515
+ // 固定百分比
5516
+ scaleList.forEach(column => {
5517
+ const scaleWidth = Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width) * meanWidth);
5518
+ tableWidth += scaleWidth;
5519
+ column.renderWidth = scaleWidth;
5520
+ });
5521
+ // 固定宽
5522
+ pxList.forEach(column => {
5523
+ const width = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width);
5524
+ tableWidth += width;
5525
+ column.renderWidth = width;
5526
+ });
5527
+ // 自适应宽
5528
+ autoList.forEach(column => {
5529
+ const width = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
5530
+ tableWidth += width;
5531
+ column.renderWidth = width;
5532
+ });
5533
+ // 调整了列宽
5534
+ resizeList.forEach(column => {
5535
+ const width = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);
5536
+ tableWidth += width;
5537
+ column.renderWidth = width;
5538
+ });
5539
+ remainWidth -= tableWidth;
5540
+ meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
5541
+ if (fit) {
5542
+ if (remainWidth > 0) {
5543
+ scaleMinList.concat(pxMinList).concat(autoMinList).forEach(column => {
5544
+ tableWidth += meanWidth;
5545
+ column.renderWidth += meanWidth;
5546
+ });
5547
+ }
5548
+ } else {
5549
+ meanWidth = minCellWidth;
5550
+ }
5551
+ // 剩余均分
5552
+ remainList.forEach(column => {
5553
+ const width = Math.max(meanWidth, minCellWidth);
5554
+ column.renderWidth = width;
5555
+ tableWidth += width;
5556
+ });
5557
+ if (fit) {
5558
+ /**
5559
+ * 偏移量算法
5560
+ * 如果所有列足够放的情况下,从最后动态列开始分配
5561
+ */
5562
+ const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
5563
+ let dynamicSize = dynamicList.length - 1;
5564
+ if (dynamicSize > 0) {
5565
+ let odiffer = bodyWidth - tableWidth;
5566
+ if (odiffer > 0) {
5567
+ while (odiffer > 0 && dynamicSize >= 0) {
5568
+ odiffer--;
5569
+ dynamicList[dynamicSize--].renderWidth++;
5570
+ }
5571
+ tableWidth = bodyWidth;
5572
+ }
5573
+ }
5574
+ }
5575
+ const tableHeight = bodyElem.offsetHeight;
5576
+ const overflowY = bodyElem.scrollHeight > bodyElem.clientHeight;
5577
+ let scrollbarWidth = 0;
5578
+ if (overflowY) {
5579
+ scrollbarWidth = Math.max(bodyElem.offsetWidth - bodyElem.clientWidth, 0);
5580
+ }
5581
+ reactData.scrollbarWidth = scrollbarWidth;
5582
+ reactData.overflowY = overflowY;
5583
+ internalData.tableWidth = tableWidth;
5584
+ internalData.tableHeight = tableHeight;
5585
+ let headerHeight = 0;
5586
+ if (headerElem) {
5587
+ headerHeight = headerElem.clientHeight;
5588
+ $xeTable.$nextTick(() => {
5589
+ // 检测是否同步滚动
5590
+ if (headerElem && bodyElem && headerElem.scrollLeft !== bodyElem.scrollLeft) {
5591
+ headerElem.scrollLeft = bodyElem.scrollLeft;
5592
+ }
5593
+ });
5594
+ }
5595
+ internalData.headerHeight = headerHeight;
5596
+ let overflowX = false;
5597
+ let footerHeight = 0;
5598
+ let scrollbarHeight = 0;
5599
+ if (footerElem) {
5600
+ footerHeight = footerElem.offsetHeight;
5601
+ overflowX = tableWidth > footerElem.clientWidth;
5602
+ scrollbarHeight = Math.max(footerHeight - footerElem.clientHeight, 0);
5603
+ } else {
5604
+ overflowX = tableWidth > bodyWidth;
5605
+ scrollbarHeight = Math.max(tableHeight - bodyElem.clientHeight, 0);
5606
+ }
5607
+ internalData.footerHeight = footerHeight;
5608
+ reactData.overflowX = overflowX;
5609
+ reactData.scrollbarHeight = scrollbarHeight;
5610
+ updateHeight($xeTable);
5611
+ reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
5612
+ if (overflowX) {
5613
+ $xeTable.checkScrolling();
5614
+ }
5615
+ }
5285
5616
  // const updateCellOffset = ($xeTable: VxeTableConstructor) => {
5286
5617
  // const internalData = $xeTable as unknown as TableInternalData
5287
5618
  // const { chTimeout, chRunTime } = internalData
@@ -5405,7 +5736,7 @@ function updateRowDropOrigin($xeTable, row) {
5405
5736
  });
5406
5737
  }
5407
5738
  }
5408
- const updateRowDropTipContent = ($xeTable, tdEl) => {
5739
+ function updateRowDropTipContent($xeTable, tdEl) {
5409
5740
  const reactData = $xeTable;
5410
5741
  const props = $xeTable;
5411
5742
  const {
@@ -5428,8 +5759,8 @@ const updateRowDropTipContent = ($xeTable, tdEl) => {
5428
5759
  tipContent = methods_getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
5429
5760
  }
5430
5761
  reactData.dragTipText = tipContent;
5431
- };
5432
- const updateColDropOrigin = ($xeTable, column) => {
5762
+ }
5763
+ function updateColDropOrigin($xeTable, column) {
5433
5764
  const el = $xeTable.$el;
5434
5765
  if (el) {
5435
5766
  const colQuerys = [];
@@ -5441,8 +5772,8 @@ const updateColDropOrigin = ($xeTable, column) => {
5441
5772
  addClass(elem, clss);
5442
5773
  });
5443
5774
  }
5444
- };
5445
- const clearColDropOrigin = $xeTable => {
5775
+ }
5776
+ function clearColDropOrigin($xeTable) {
5446
5777
  const el = $xeTable.$el;
5447
5778
  if (el) {
5448
5779
  const clss = 'col--drag-origin';
@@ -5451,8 +5782,8 @@ const clearColDropOrigin = $xeTable => {
5451
5782
  removeClass(elem, clss);
5452
5783
  });
5453
5784
  }
5454
- };
5455
- const updateColDropTipContent = ($xeTable, tdEl) => {
5785
+ }
5786
+ function updateColDropTipContent($xeTable, tdEl) {
5456
5787
  const reactData = $xeTable;
5457
5788
  const {
5458
5789
  dragCol
@@ -5470,7 +5801,7 @@ const updateColDropTipContent = ($xeTable, tdEl) => {
5470
5801
  tipContent = methods_getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
5471
5802
  }
5472
5803
  reactData.dragTipText = tipContent;
5473
- };
5804
+ }
5474
5805
  function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
5475
5806
  const reactData = $xeTable;
5476
5807
  const internalData = $xeTable;
@@ -5553,7 +5884,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
5553
5884
  rdTipEl.setAttribute('drag-status', showLine ? prevDragToChild ? 'sub' : 'normal' : 'disabled');
5554
5885
  }
5555
5886
  }
5556
- const hideDropTip = $xeTable => {
5887
+ function hideDropTip($xeTable) {
5557
5888
  const rdTipEl = $xeTable.$refs.refDragTipElem;
5558
5889
  const rdLineEl = $xeTable.$refs.refDragRowLineElem;
5559
5890
  const cdLineEl = $xeTable.$refs.refDragColLineElem;
@@ -5566,8 +5897,8 @@ const hideDropTip = $xeTable => {
5566
5897
  if (cdLineEl) {
5567
5898
  cdLineEl.style.display = '';
5568
5899
  }
5569
- };
5570
- const handleScrollToRowColumn = ($xeTable, fieldOrColumn, row) => {
5900
+ }
5901
+ function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
5571
5902
  const internalData = $xeTable;
5572
5903
  const {
5573
5904
  fullColumnIdData
@@ -5577,7 +5908,61 @@ const handleScrollToRowColumn = ($xeTable, fieldOrColumn, row) => {
5577
5908
  return colToVisible($xeTable, column, row);
5578
5909
  }
5579
5910
  return $xeTable.$nextTick();
5580
- };
5911
+ }
5912
+ // 计算可视渲染相关数据
5913
+ function computeScrollLoad($xeTable) {
5914
+ const reactData = $xeTable;
5915
+ const internalData = $xeTable;
5916
+ return $xeTable.$nextTick().then(() => {
5917
+ const {
5918
+ scrollXLoad,
5919
+ scrollYLoad
5920
+ } = reactData;
5921
+ const {
5922
+ scrollXStore,
5923
+ scrollYStore
5924
+ } = internalData;
5925
+ const sYOpts = $xeTable.computeSYOpts;
5926
+ const sXOpts = $xeTable.computeSXOpts;
5927
+ // 计算 X 逻辑
5928
+ if (scrollXLoad) {
5929
+ const {
5930
+ visibleSize: visibleXSize
5931
+ } = handleVirtualXVisible($xeTable);
5932
+ const offsetXSize = Math.max(0, sXOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(sXOpts.oSize) : browse.edge ? 5 : 0);
5933
+ scrollXStore.offsetSize = offsetXSize;
5934
+ scrollXStore.visibleSize = visibleXSize;
5935
+ scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
5936
+ $xeTable.updateScrollXData().then(() => {
5937
+ loadScrollXData($xeTable);
5938
+ });
5939
+ } else {
5940
+ $xeTable.updateScrollXSpace();
5941
+ }
5942
+ calcCellHeight($xeTable);
5943
+ // 计算 Y 逻辑
5944
+ const rowHeight = computeRowHeight($xeTable);
5945
+ scrollYStore.rowHeight = rowHeight;
5946
+ reactData.rowHeight = rowHeight;
5947
+ const {
5948
+ visibleSize: visibleYSize
5949
+ } = handleVirtualYVisible($xeTable);
5950
+ if (scrollYLoad) {
5951
+ const offsetYSize = Math.max(0, sYOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(sYOpts.oSize) : browse.edge ? 10 : 0);
5952
+ scrollYStore.offsetSize = offsetYSize;
5953
+ scrollYStore.visibleSize = visibleYSize;
5954
+ scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
5955
+ $xeTable.updateScrollYData().then(() => {
5956
+ loadScrollYData($xeTable);
5957
+ });
5958
+ } else {
5959
+ $xeTable.updateScrollYSpace();
5960
+ }
5961
+ $xeTable.$nextTick(() => {
5962
+ $xeTable.updateStyle();
5963
+ });
5964
+ });
5965
+ }
5581
5966
  function handleRecalculateLayout($xeTable, reFull) {
5582
5967
  const internalData = $xeTable;
5583
5968
  const el = $xeTable.$refs.refElem;
@@ -5585,18 +5970,99 @@ function handleRecalculateLayout($xeTable, reFull) {
5585
5970
  if (!el || !el.clientWidth) {
5586
5971
  return $xeTable.$nextTick();
5587
5972
  }
5588
- $xeTable.calcCellWidth();
5589
- $xeTable.autoCellWidth();
5590
- return $xeTable.computeScrollLoad().then(() => {
5973
+ calcCellWidth($xeTable);
5974
+ autoCellWidth($xeTable);
5975
+ return computeScrollLoad($xeTable).then(() => {
5591
5976
  if (reFull === true) {
5592
5977
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
5593
5978
  calcCellHeight($xeTable);
5594
- $xeTable.calcCellWidth();
5595
- $xeTable.autoCellWidth();
5596
- return $xeTable.computeScrollLoad();
5979
+ calcCellWidth($xeTable);
5980
+ autoCellWidth($xeTable);
5981
+ return computeScrollLoad($xeTable);
5597
5982
  }
5598
5983
  });
5599
5984
  }
5985
+ function loadScrollXData($xeTable) {
5986
+ const reactData = $xeTable;
5987
+ const internalData = $xeTable;
5988
+ const {
5989
+ mergeList,
5990
+ mergeFooterList
5991
+ } = reactData;
5992
+ const {
5993
+ scrollXStore
5994
+ } = internalData;
5995
+ const {
5996
+ startIndex,
5997
+ endIndex,
5998
+ offsetSize
5999
+ } = scrollXStore;
6000
+ const {
6001
+ toVisibleIndex,
6002
+ visibleSize
6003
+ } = handleVirtualXVisible($xeTable);
6004
+ const offsetItem = {
6005
+ startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
6006
+ endIndex: toVisibleIndex + visibleSize + offsetSize
6007
+ };
6008
+ calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
6009
+ const {
6010
+ startIndex: offsetStartIndex,
6011
+ endIndex: offsetEndIndex
6012
+ } = offsetItem;
6013
+ if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
6014
+ if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
6015
+ scrollXStore.startIndex = offsetStartIndex;
6016
+ scrollXStore.endIndex = offsetEndIndex;
6017
+ $xeTable.updateScrollXData();
6018
+ }
6019
+ }
6020
+ $xeTable.closeTooltip();
6021
+ }
6022
+ /**
6023
+ * 纵向 Y 可视渲染处理
6024
+ */
6025
+ function loadScrollYData($xeTable) {
6026
+ const props = $xeTable;
6027
+ const reactData = $xeTable;
6028
+ const internalData = $xeTable;
6029
+ const {
6030
+ showOverflow
6031
+ } = props;
6032
+ const {
6033
+ mergeList
6034
+ } = reactData;
6035
+ const {
6036
+ tableHeight,
6037
+ scrollYStore
6038
+ } = internalData;
6039
+ const {
6040
+ startIndex,
6041
+ endIndex,
6042
+ offsetSize
6043
+ } = scrollYStore;
6044
+ const offsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200));
6045
+ const {
6046
+ toVisibleIndex,
6047
+ visibleSize
6048
+ } = handleVirtualYVisible($xeTable);
6049
+ const offsetItem = {
6050
+ startIndex: Math.max(0, toVisibleIndex - 1 - offsetYSize),
6051
+ endIndex: toVisibleIndex + visibleSize + offsetYSize
6052
+ };
6053
+ calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
6054
+ const {
6055
+ startIndex: offsetStartIndex,
6056
+ endIndex: offsetEndIndex
6057
+ } = offsetItem;
6058
+ if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
6059
+ if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
6060
+ scrollYStore.startIndex = offsetStartIndex;
6061
+ scrollYStore.endIndex = offsetEndIndex;
6062
+ $xeTable.updateScrollYData();
6063
+ }
6064
+ }
6065
+ }
5600
6066
  function checkLastSyncScroll($xeTable, isRollX, isRollY) {
5601
6067
  const reactData = $xeTable;
5602
6068
  const internalData = $xeTable;
@@ -5618,17 +6084,77 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
5618
6084
  internalData.inFooterScroll = false;
5619
6085
  if (isRollX && scrollXLoad) {
5620
6086
  $xeTable.updateScrollXData().then(() => {
5621
- $xeTable.loadScrollXData();
6087
+ loadScrollXData($xeTable);
5622
6088
  });
5623
6089
  }
5624
6090
  if (isRollY && scrollYLoad) {
5625
6091
  $xeTable.updateScrollYData().then(() => {
5626
- $xeTable.loadScrollYData();
6092
+ loadScrollYData($xeTable);
5627
6093
  });
5628
6094
  }
5629
6095
  $xeTable.updateCellAreas();
5630
6096
  }, 200);
5631
6097
  }
6098
+ function updateHeight($xeTable) {
6099
+ const internalData = $xeTable;
6100
+ internalData.customHeight = calcTableHeight($xeTable, 'height');
6101
+ internalData.customMinHeight = calcTableHeight($xeTable, 'minHeight');
6102
+ internalData.customMaxHeight = calcTableHeight($xeTable, 'maxHeight');
6103
+ }
6104
+ function calcColumnAutoWidth(column, wrapperEl) {
6105
+ const cellElList = wrapperEl.querySelectorAll(`.vxe-header--column.${column.id}>.vxe-cell,.vxe-body--column.${column.id}>.vxe-cell,.vxe-footer--column.${column.id}>.vxe-cell`);
6106
+ const firstCellEl = cellElList[0];
6107
+ let paddingSize = 0;
6108
+ if (firstCellEl) {
6109
+ const cellStyle = getComputedStyle(firstCellEl);
6110
+ 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;
6111
+ }
6112
+ let colWidth = column.renderAutoWidth - paddingSize;
6113
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellElList, itemEl => {
6114
+ const cellEl = itemEl;
6115
+ const thElem = cellEl.parentElement;
6116
+ let titleWidth = 0;
6117
+ if (`${thElem.tagName}`.toLowerCase() === 'th') {
6118
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellEl.children, btnEl => {
6119
+ titleWidth += btnEl.offsetWidth + 1;
6120
+ });
6121
+ } else {
6122
+ const labelEl = cellEl.firstElementChild;
6123
+ if (labelEl) {
6124
+ titleWidth = labelEl.offsetWidth;
6125
+ }
6126
+ }
6127
+ if (titleWidth) {
6128
+ colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
6129
+ }
6130
+ });
6131
+ return colWidth + paddingSize;
6132
+ }
6133
+ function calcCellWidth($xeTable) {
6134
+ const reactData = $xeTable;
6135
+ const internalData = $xeTable;
6136
+ const autoWidthColumnList = $xeTable.computeAutoWidthColumnList;
6137
+ reactData.isCalcColumn = true;
6138
+ return $xeTable.$nextTick().then(() => {
6139
+ const {
6140
+ fullColumnIdData
6141
+ } = internalData;
6142
+ const el = $xeTable.$refs.refElem;
6143
+ if (el) {
6144
+ autoWidthColumnList.forEach(column => {
6145
+ const colid = column.id;
6146
+ const colRest = fullColumnIdData[colid];
6147
+ const colWidth = calcColumnAutoWidth(column, el);
6148
+ if (colRest) {
6149
+ colRest.width = Math.max(colWidth, colRest.width);
6150
+ }
6151
+ column.renderAutoWidth = colWidth;
6152
+ });
6153
+ $xeTable.analyColumnWidth();
6154
+ }
6155
+ reactData.isCalcColumn = false;
6156
+ });
6157
+ }
5632
6158
  const Methods = {
5633
6159
  callSlot(slotFunc, params, h, vNodes) {
5634
6160
  if (slotFunc) {
@@ -5875,10 +6401,10 @@ const Methods = {
5875
6401
  this.handleTableData(true);
5876
6402
  this.updateFooter();
5877
6403
  return this.$nextTick().then(() => {
5878
- this.updateHeight();
6404
+ updateHeight($xeTable);
5879
6405
  this.updateStyle();
5880
6406
  }).then(() => {
5881
- this.computeScrollLoad();
6407
+ computeScrollLoad($xeTable);
5882
6408
  }).then(() => {
5883
6409
  // 是否启用了虚拟滚动
5884
6410
  if (sYLoad) {
@@ -6028,10 +6554,10 @@ const Methods = {
6028
6554
  this.initColumnSort();
6029
6555
  return Promise.resolve(this.restoreCustomStorage()).then(() => {
6030
6556
  this._isLoading = false;
6031
- this.cacheColumnMap();
6557
+ cacheColumnMap($xeTable);
6032
6558
  this.parseColumns(true).then(() => {
6033
6559
  if (this.scrollXLoad) {
6034
- this.loadScrollXData(true);
6560
+ loadScrollXData($xeTable);
6035
6561
  }
6036
6562
  });
6037
6563
  this.clearMergeCells();
@@ -6097,7 +6623,8 @@ const Methods = {
6097
6623
  items,
6098
6624
  parent: parentRow,
6099
6625
  level,
6100
- height: 0
6626
+ height: 0,
6627
+ oTop: 0
6101
6628
  };
6102
6629
  }
6103
6630
  cacheItem.row = row;
@@ -6200,7 +6727,8 @@ const Methods = {
6200
6727
  items,
6201
6728
  parent: parentRow,
6202
6729
  level: parentLevel + nodes.length,
6203
- height: 0
6730
+ height: 0,
6731
+ oTop: 0
6204
6732
  };
6205
6733
  fullDataRowIdData[rowid] = rest;
6206
6734
  fullAllDataRowIdData[rowid] = rest;
@@ -6215,143 +6743,6 @@ const Methods = {
6215
6743
  return rows;
6216
6744
  });
6217
6745
  },
6218
- /**
6219
- * 更新数据列的 Map
6220
- * 牺牲数据组装的耗时,用来换取使用过程中的流畅
6221
- */
6222
- cacheColumnMap() {
6223
- const $xeTable = this;
6224
- const props = $xeTable;
6225
- const reactData = $xeTable;
6226
- const internalData = $xeTable;
6227
- const {
6228
- tableFullColumn,
6229
- collectColumn
6230
- } = internalData;
6231
- const fullColumnIdData = internalData.fullColumnIdData = {};
6232
- const fullColumnFieldData = internalData.fullColumnFieldData = {};
6233
- const mouseOpts = $xeTable.computeMouseOpts;
6234
- const columnOpts = $xeTable.computeColumnOpts;
6235
- const columnDragOpts = $xeTable.computeColumnDragOpts;
6236
- const {
6237
- isCrossDrag,
6238
- isSelfToChildDrag
6239
- } = columnDragOpts;
6240
- const rowOpts = $xeTable.computeRowOpts;
6241
- const isGroup = collectColumn.some(hasChildrenList);
6242
- let isAllOverflow = !!props.showOverflow;
6243
- let expandColumn;
6244
- let treeNodeColumn;
6245
- let checkboxColumn;
6246
- let radioColumn;
6247
- let htmlColumn;
6248
- let hasFixed;
6249
- const handleFunc = (column, index, items, path, parentColumn) => {
6250
- const {
6251
- id: colid,
6252
- field,
6253
- fixed,
6254
- type,
6255
- treeNode
6256
- } = column;
6257
- const rest = {
6258
- $index: -1,
6259
- _index: -1,
6260
- column,
6261
- colid,
6262
- index,
6263
- items,
6264
- parent: parentColumn || null,
6265
- width: 0
6266
- };
6267
- if (field) {
6268
- if (fullColumnFieldData[field]) {
6269
- errLog('vxe.error.colRepet', ['field', field]);
6270
- }
6271
- fullColumnFieldData[field] = rest;
6272
- } else {
6273
- if (isCrossDrag || isSelfToChildDrag) {
6274
- errLog('vxe.error.emptyProp', ['column.field']);
6275
- }
6276
- }
6277
- if (!hasFixed && fixed) {
6278
- hasFixed = fixed;
6279
- }
6280
- if (!htmlColumn && type === 'html') {
6281
- htmlColumn = column;
6282
- }
6283
- if (treeNode) {
6284
- if (true) {
6285
- if (treeNodeColumn) {
6286
- warnLog('vxe.error.colRepet', ['tree-node', treeNode]);
6287
- }
6288
- }
6289
- if (!treeNodeColumn) {
6290
- treeNodeColumn = column;
6291
- }
6292
- } else if (type === 'expand') {
6293
- if (true) {
6294
- if (expandColumn) {
6295
- warnLog('vxe.error.colRepet', ['type', type]);
6296
- }
6297
- }
6298
- if (!expandColumn) {
6299
- expandColumn = column;
6300
- }
6301
- }
6302
- if (true) {
6303
- if (type === 'checkbox') {
6304
- if (checkboxColumn) {
6305
- warnLog('vxe.error.colRepet', ['type', type]);
6306
- }
6307
- if (!checkboxColumn) {
6308
- checkboxColumn = column;
6309
- }
6310
- } else if (type === 'radio') {
6311
- if (radioColumn) {
6312
- warnLog('vxe.error.colRepet', ['type', type]);
6313
- }
6314
- if (!radioColumn) {
6315
- radioColumn = column;
6316
- }
6317
- }
6318
- }
6319
- if (isAllOverflow && column.showOverflow === false) {
6320
- isAllOverflow = false;
6321
- }
6322
- if (fullColumnIdData[colid]) {
6323
- errLog('vxe.error.colRepet', ['colId', colid]);
6324
- }
6325
- fullColumnIdData[colid] = rest;
6326
- };
6327
- if (isGroup) {
6328
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
6329
- column.level = nodes.length;
6330
- handleFunc(column, index, items, path, parentColumn);
6331
- });
6332
- } else {
6333
- tableFullColumn.forEach(handleFunc);
6334
- }
6335
- if (true) {
6336
- if (expandColumn && mouseOpts.area) {
6337
- errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
6338
- }
6339
- }
6340
- if (true) {
6341
- if (htmlColumn) {
6342
- if (!columnOpts.useKey) {
6343
- errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
6344
- }
6345
- if (!rowOpts.useKey) {
6346
- errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
6347
- }
6348
- }
6349
- }
6350
- reactData.isGroup = isGroup;
6351
- reactData.treeNodeColumn = treeNodeColumn;
6352
- reactData.expandColumn = expandColumn;
6353
- reactData.isAllOverflow = isAllOverflow;
6354
- },
6355
6746
  /**
6356
6747
  * 根据 tr 元素获取对应的 row 信息
6357
6748
  * @param {Element} tr 元素
@@ -7259,7 +7650,8 @@ const Methods = {
7259
7650
  items: [],
7260
7651
  parent: null,
7261
7652
  level: 0,
7262
- height: 0
7653
+ height: 0,
7654
+ oTop: 0
7263
7655
  };
7264
7656
  fullAllDataRowIdData[rowid] = rest;
7265
7657
  fullDataRowIdData[rowid] = rest;
@@ -7307,7 +7699,8 @@ const Methods = {
7307
7699
  items: [],
7308
7700
  parent: null,
7309
7701
  level: 0,
7310
- height: 0
7702
+ height: 0,
7703
+ oTop: 0
7311
7704
  };
7312
7705
  fullAllDataRowIdData[rowid] = rest;
7313
7706
  fullDataRowIdData[rowid] = rest;
@@ -7336,7 +7729,8 @@ const Methods = {
7336
7729
  items: [],
7337
7730
  parent: null,
7338
7731
  level: 0,
7339
- height: 0
7732
+ height: 0,
7733
+ oTop: 0
7340
7734
  };
7341
7735
  fullAllDataRowIdData[rowid] = rest;
7342
7736
  fullDataRowIdData[rowid] = rest;
@@ -8115,6 +8509,43 @@ const Methods = {
8115
8509
  remainList
8116
8510
  });
8117
8511
  },
8512
+ handleResizeDblclickEvent(evnt, params) {
8513
+ const $xeTable = this;
8514
+ const reactData = $xeTable;
8515
+ const internalData = $xeTable;
8516
+ const resizableOpts = $xeTable.computeResizableOpts;
8517
+ const {
8518
+ isDblclickAutoWidth
8519
+ } = resizableOpts;
8520
+ const el = $xeTable.$refs.refElem;
8521
+ if (isDblclickAutoWidth && el) {
8522
+ const {
8523
+ fullColumnIdData
8524
+ } = internalData;
8525
+ const {
8526
+ column
8527
+ } = params;
8528
+ const colid = column.id;
8529
+ const colRest = fullColumnIdData[colid];
8530
+ let resizeWidth = calcColumnAutoWidth(column, el);
8531
+ if (colRest) {
8532
+ resizeWidth = Math.max(resizeWidth, colRest.width);
8533
+ }
8534
+ column.resizeWidth = resizeWidth;
8535
+ reactData._isResize = false;
8536
+ internalData._lastResizeTime = Date.now();
8537
+ $xeTable.analyColumnWidth();
8538
+ $xeTable.recalculate(true).then(() => {
8539
+ $xeTable.saveCustomStore('update:visible');
8540
+ $xeTable.updateCellAreas();
8541
+ $xeTable.dispatchEvent('resizable-change', {
8542
+ ...params,
8543
+ resizeWidth
8544
+ }, evnt);
8545
+ setTimeout(() => $xeTable.recalculate(true), 300);
8546
+ });
8547
+ }
8548
+ },
8118
8549
  /**
8119
8550
  * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
8120
8551
  */
@@ -8169,7 +8600,7 @@ const Methods = {
8169
8600
  const refreshDelay = resizeOpts.refreshDelay || 20;
8170
8601
  const el = $xeTable.$refs.refElem;
8171
8602
  if (el && el.clientWidth) {
8172
- $xeTable.autoCellWidth();
8603
+ autoCellWidth($xeTable);
8173
8604
  }
8174
8605
  if (rceTimeout) {
8175
8606
  clearTimeout(rceTimeout);
@@ -8189,216 +8620,6 @@ const Methods = {
8189
8620
  }, refreshDelay);
8190
8621
  });
8191
8622
  },
8192
- calcCellWidth() {
8193
- const $xeTable = this;
8194
- const {
8195
- autoWidthColumnList
8196
- } = this;
8197
- this.isCalcColumn = true;
8198
- return this.$nextTick().then(() => {
8199
- const internalData = $xeTable;
8200
- const {
8201
- fullColumnIdData
8202
- } = internalData;
8203
- const el = this.$el;
8204
- if (el) {
8205
- autoWidthColumnList.forEach(column => {
8206
- const colid = column.id;
8207
- const colRest = fullColumnIdData[colid];
8208
- 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`);
8209
- const firstCellEl = cellElList[0];
8210
- let paddingSize = 0;
8211
- if (firstCellEl) {
8212
- const cellStyle = getComputedStyle(firstCellEl);
8213
- 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;
8214
- }
8215
- let colWidth = column.renderAutoWidth - paddingSize;
8216
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellElList, itemEl => {
8217
- const cellEl = itemEl;
8218
- const thElem = cellEl.parentElement;
8219
- let titleWidth = 0;
8220
- if (`${thElem.tagName}`.toLowerCase() === 'th') {
8221
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellEl.children, btnEl => {
8222
- titleWidth += btnEl.offsetWidth + 1;
8223
- });
8224
- } else {
8225
- const labelEl = cellEl.firstElementChild;
8226
- if (labelEl) {
8227
- titleWidth = labelEl.offsetWidth;
8228
- }
8229
- }
8230
- if (titleWidth) {
8231
- colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
8232
- }
8233
- });
8234
- if (colRest) {
8235
- colRest.width = Math.max(colWidth, colRest.width);
8236
- }
8237
- column.renderAutoWidth = colWidth + paddingSize;
8238
- });
8239
- this.analyColumnWidth();
8240
- }
8241
- this.isCalcColumn = false;
8242
- });
8243
- },
8244
- /**
8245
- * 列宽算法,计算单元格列宽,动态分配可用剩余空间
8246
- * 支持 px、%、固定 混合分配
8247
- * 支持动态列表调整分配
8248
- * 支持自动分配偏移量
8249
- * 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
8250
- */
8251
- autoCellWidth() {
8252
- const {
8253
- $refs
8254
- } = this;
8255
- const {
8256
- tableBody,
8257
- tableHeader,
8258
- tableFooter
8259
- } = $refs;
8260
- const bodyElem = tableBody ? tableBody.$el : null;
8261
- const headerElem = tableHeader ? tableHeader.$el : null;
8262
- const footerElem = tableFooter ? tableFooter.$el : null;
8263
- let tableWidth = 0;
8264
- const minCellWidth = 40; // 列宽最少限制 40px
8265
- const bodyWidth = bodyElem.clientWidth - 1;
8266
- let remainWidth = bodyWidth;
8267
- let meanWidth = remainWidth / 100;
8268
- const {
8269
- fit,
8270
- columnStore
8271
- } = this;
8272
- const {
8273
- resizeList,
8274
- pxMinList,
8275
- pxList,
8276
- autoMinList,
8277
- scaleList,
8278
- scaleMinList,
8279
- autoList,
8280
- remainList
8281
- } = columnStore;
8282
- // 最小宽
8283
- pxMinList.forEach(column => {
8284
- const minWidth = parseInt(column.minWidth);
8285
- tableWidth += minWidth;
8286
- column.renderWidth = minWidth;
8287
- });
8288
- // 最小自适应
8289
- autoMinList.forEach(column => {
8290
- const scaleWidth = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
8291
- tableWidth += scaleWidth;
8292
- column.renderWidth = scaleWidth;
8293
- });
8294
- // 最小百分比
8295
- scaleMinList.forEach(column => {
8296
- const scaleWidth = Math.floor(parseInt(column.minWidth) * meanWidth);
8297
- tableWidth += scaleWidth;
8298
- column.renderWidth = scaleWidth;
8299
- });
8300
- // 固定百分比
8301
- scaleList.forEach(column => {
8302
- const scaleWidth = Math.floor(parseInt(column.width) * meanWidth);
8303
- tableWidth += scaleWidth;
8304
- column.renderWidth = scaleWidth;
8305
- });
8306
- // 固定宽
8307
- pxList.forEach(column => {
8308
- const width = parseInt(column.width);
8309
- tableWidth += width;
8310
- column.renderWidth = width;
8311
- });
8312
- // 自适应宽
8313
- autoList.forEach(column => {
8314
- const width = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
8315
- tableWidth += width;
8316
- column.renderWidth = width;
8317
- });
8318
- // 调整了列宽
8319
- resizeList.forEach(column => {
8320
- const width = parseInt(column.resizeWidth);
8321
- tableWidth += width;
8322
- column.renderWidth = width;
8323
- });
8324
- remainWidth -= tableWidth;
8325
- meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
8326
- if (fit) {
8327
- if (remainWidth > 0) {
8328
- scaleMinList.concat(pxMinList).concat(autoMinList).forEach(column => {
8329
- tableWidth += meanWidth;
8330
- column.renderWidth += meanWidth;
8331
- });
8332
- }
8333
- } else {
8334
- meanWidth = minCellWidth;
8335
- }
8336
- // 剩余均分
8337
- remainList.forEach(column => {
8338
- const width = Math.max(meanWidth, minCellWidth);
8339
- column.renderWidth = width;
8340
- tableWidth += width;
8341
- });
8342
- if (fit) {
8343
- /**
8344
- * 偏移量算法
8345
- * 如果所有列足够放的情况下,从最后动态列开始分配
8346
- */
8347
- const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
8348
- let dynamicSize = dynamicList.length - 1;
8349
- if (dynamicSize > 0) {
8350
- let odiffer = bodyWidth - tableWidth;
8351
- if (odiffer > 0) {
8352
- while (odiffer > 0 && dynamicSize >= 0) {
8353
- odiffer--;
8354
- dynamicList[dynamicSize--].renderWidth++;
8355
- }
8356
- tableWidth = bodyWidth;
8357
- }
8358
- }
8359
- }
8360
- const tableHeight = bodyElem.offsetHeight;
8361
- const overflowY = bodyElem.scrollHeight > bodyElem.clientHeight;
8362
- this.scrollbarWidth = overflowY ? bodyElem.offsetWidth - bodyElem.clientWidth : 0;
8363
- this.overflowY = overflowY;
8364
- this.tableWidth = tableWidth;
8365
- this.tableHeight = tableHeight;
8366
- if (headerElem) {
8367
- this.headerHeight = headerElem.clientHeight;
8368
- this.$nextTick(() => {
8369
- // 检测是否同步滚动
8370
- if (headerElem && bodyElem && headerElem.scrollLeft !== bodyElem.scrollLeft) {
8371
- headerElem.scrollLeft = bodyElem.scrollLeft;
8372
- }
8373
- });
8374
- } else {
8375
- this.headerHeight = 0;
8376
- }
8377
- let overflowX = false;
8378
- let footerHeight = 0;
8379
- let scrollbarHeight = 0;
8380
- if (footerElem) {
8381
- footerHeight = footerElem.offsetHeight;
8382
- overflowX = tableWidth > footerElem.clientWidth;
8383
- scrollbarHeight = Math.max(footerHeight - footerElem.clientHeight, 0);
8384
- } else {
8385
- overflowX = tableWidth > bodyWidth;
8386
- scrollbarHeight = Math.max(tableHeight - bodyElem.clientHeight, 0);
8387
- }
8388
- this.footerHeight = footerHeight;
8389
- this.overflowX = tableWidth > bodyWidth;
8390
- this.scrollbarHeight = scrollbarHeight;
8391
- this.updateHeight();
8392
- this.parentHeight = Math.max(this.headerHeight + this.footerHeight + 20, this.getParentHeight());
8393
- if (overflowX) {
8394
- this.checkScrolling();
8395
- }
8396
- },
8397
- updateHeight() {
8398
- this.customHeight = calcTableHeight(this, 'height');
8399
- this.customMinHeight = calcTableHeight(this, 'minHeight');
8400
- this.customMaxHeight = calcTableHeight(this, 'maxHeight');
8401
- },
8402
8623
  updateStyle() {
8403
8624
  const $xeTable = this;
8404
8625
  let {
@@ -11329,6 +11550,7 @@ const Methods = {
11329
11550
  oldRow: dragRow,
11330
11551
  newRow: prevDragRow,
11331
11552
  dragPos: prevDragPos,
11553
+ dragToChild: isSelfToChildDrag,
11332
11554
  offsetIndex: dragOffsetIndex,
11333
11555
  _index: {
11334
11556
  newIndex: nafIndex,
@@ -11616,6 +11838,7 @@ const Methods = {
11616
11838
  oldColumn,
11617
11839
  newColumn,
11618
11840
  dragPos: prevDragPos,
11841
+ dragToChild: isSelfToChildDrag,
11619
11842
  offsetIndex: dragOffsetIndex,
11620
11843
  _index: {
11621
11844
  newIndex: nafIndex,
@@ -11651,7 +11874,7 @@ const Methods = {
11651
11874
  setTimeout(() => {
11652
11875
  reactData.isDragColMove = false;
11653
11876
  $xeTable.recalculate().then(() => {
11654
- $xeTable.loadScrollXData();
11877
+ loadScrollXData($xeTable);
11655
11878
  });
11656
11879
  }, 500);
11657
11880
  },
@@ -12876,44 +13099,6 @@ const Methods = {
12876
13099
  scrollLeft: bodyElem.scrollLeft
12877
13100
  };
12878
13101
  },
12879
- loadScrollXData() {
12880
- const $xeTable = this;
12881
- const reactData = $xeTable;
12882
- const internalData = $xeTable;
12883
- const {
12884
- mergeList,
12885
- mergeFooterList
12886
- } = reactData;
12887
- const {
12888
- scrollXStore
12889
- } = internalData;
12890
- const {
12891
- startIndex,
12892
- endIndex,
12893
- offsetSize
12894
- } = scrollXStore;
12895
- const {
12896
- toVisibleIndex,
12897
- visibleSize
12898
- } = handleVirtualXVisible($xeTable);
12899
- const offsetItem = {
12900
- startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
12901
- endIndex: toVisibleIndex + visibleSize + offsetSize
12902
- };
12903
- calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
12904
- const {
12905
- startIndex: offsetStartIndex,
12906
- endIndex: offsetEndIndex
12907
- } = offsetItem;
12908
- if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
12909
- if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
12910
- scrollXStore.startIndex = offsetStartIndex;
12911
- scrollXStore.endIndex = offsetEndIndex;
12912
- $xeTable.updateScrollXData();
12913
- }
12914
- }
12915
- $xeTable.closeTooltip();
12916
- },
12917
13102
  handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
12918
13103
  const $xeTable = this;
12919
13104
  const props = $xeTable;
@@ -13034,12 +13219,12 @@ const Methods = {
13034
13219
  }
13035
13220
  if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
13036
13221
  internalData.lxRunTime = Date.now();
13037
- $xeTable.loadScrollXData();
13222
+ loadScrollXData($xeTable);
13038
13223
  }
13039
13224
  internalData.lxTimeout = setTimeout(() => {
13225
+ internalData.lxTimeout = undefined;
13040
13226
  internalData.lxRunTime = undefined;
13041
- internalData.lxRunTime = undefined;
13042
- $xeTable.loadScrollXData();
13227
+ loadScrollXData($xeTable);
13043
13228
  }, fpsTime);
13044
13229
  },
13045
13230
  lazyScrollYData() {
@@ -13059,12 +13244,12 @@ const Methods = {
13059
13244
  }
13060
13245
  if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
13061
13246
  internalData.lyRunTime = Date.now();
13062
- $xeTable.loadScrollYData();
13247
+ loadScrollYData($xeTable);
13063
13248
  }
13064
13249
  internalData.lyTimeout = setTimeout(() => {
13065
13250
  internalData.lyTimeout = undefined;
13066
13251
  internalData.lyRunTime = undefined;
13067
- $xeTable.loadScrollYData();
13252
+ loadScrollYData($xeTable);
13068
13253
  }, fpsTime);
13069
13254
  },
13070
13255
  /**
@@ -13074,7 +13259,7 @@ const Methods = {
13074
13259
  const $xeTable = this;
13075
13260
  const sXOpts = $xeTable.computeSXOpts;
13076
13261
  if (sXOpts.immediate) {
13077
- $xeTable.loadScrollXData();
13262
+ loadScrollXData($xeTable);
13078
13263
  } else {
13079
13264
  $xeTable.lazyScrollXData();
13080
13265
  }
@@ -13086,7 +13271,7 @@ const Methods = {
13086
13271
  const $xeTable = this;
13087
13272
  const sYOpts = $xeTable.computeSYOpts;
13088
13273
  if (sYOpts.immediate) {
13089
- $xeTable.loadScrollYData();
13274
+ loadScrollYData($xeTable);
13090
13275
  } else {
13091
13276
  $xeTable.lazyScrollYData();
13092
13277
  }
@@ -13181,100 +13366,6 @@ const Methods = {
13181
13366
  fixed: ''
13182
13367
  });
13183
13368
  },
13184
- /**
13185
- * 纵向 Y 可视渲染处理
13186
- */
13187
- loadScrollYData() {
13188
- const $xeTable = this;
13189
- const props = $xeTable;
13190
- const reactData = $xeTable;
13191
- const internalData = $xeTable;
13192
- const {
13193
- showOverflow
13194
- } = props;
13195
- const {
13196
- mergeList
13197
- } = reactData;
13198
- const {
13199
- tableHeight,
13200
- scrollYStore
13201
- } = internalData;
13202
- const {
13203
- startIndex,
13204
- endIndex,
13205
- offsetSize
13206
- } = scrollYStore;
13207
- const offsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200));
13208
- const {
13209
- toVisibleIndex,
13210
- visibleSize
13211
- } = handleVirtualYVisible($xeTable);
13212
- const offsetItem = {
13213
- startIndex: Math.max(0, toVisibleIndex - 1 - offsetYSize),
13214
- endIndex: toVisibleIndex + visibleSize + offsetYSize
13215
- };
13216
- calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
13217
- const {
13218
- startIndex: offsetStartIndex,
13219
- endIndex: offsetEndIndex
13220
- } = offsetItem;
13221
- if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
13222
- if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
13223
- scrollYStore.startIndex = offsetStartIndex;
13224
- scrollYStore.endIndex = offsetEndIndex;
13225
- $xeTable.updateScrollYData();
13226
- }
13227
- }
13228
- },
13229
- // 计算可视渲染相关数据
13230
- computeScrollLoad() {
13231
- const $xeTable = this;
13232
- return this.$nextTick().then(() => {
13233
- const {
13234
- sYOpts,
13235
- sXOpts,
13236
- scrollXLoad,
13237
- scrollYLoad,
13238
- scrollXStore,
13239
- scrollYStore
13240
- } = this;
13241
- // 计算 X 逻辑
13242
- if (scrollXLoad) {
13243
- const {
13244
- visibleSize: visibleXSize
13245
- } = handleVirtualXVisible($xeTable);
13246
- const offsetXSize = Math.max(0, sXOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(sXOpts.oSize) : browse.edge ? 5 : 0);
13247
- scrollXStore.offsetSize = offsetXSize;
13248
- scrollXStore.visibleSize = visibleXSize;
13249
- scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
13250
- $xeTable.updateScrollXData().then(() => {
13251
- $xeTable.loadScrollXData();
13252
- });
13253
- } else {
13254
- $xeTable.updateScrollXSpace();
13255
- }
13256
- calcCellHeight(this);
13257
- // 计算 Y 逻辑
13258
- const rowHeight = computeRowHeight(this);
13259
- scrollYStore.rowHeight = rowHeight;
13260
- this.rowHeight = rowHeight;
13261
- const {
13262
- visibleSize: visibleYSize
13263
- } = handleVirtualYVisible($xeTable);
13264
- if (scrollYLoad) {
13265
- const offsetYSize = Math.max(0, sYOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(sYOpts.oSize) : browse.edge ? 10 : 0);
13266
- scrollYStore.offsetSize = offsetYSize;
13267
- scrollYStore.visibleSize = visibleYSize;
13268
- scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
13269
- $xeTable.updateScrollYData().then(() => {
13270
- $xeTable.loadScrollYData();
13271
- });
13272
- } else {
13273
- $xeTable.updateScrollYSpace();
13274
- }
13275
- $xeTable.$nextTick(this.updateStyle);
13276
- });
13277
- },
13278
13369
  handleTableColumn() {
13279
13370
  const {
13280
13371
  scrollXLoad,
@@ -13299,7 +13390,7 @@ const Methods = {
13299
13390
  internalData.collectColumn = columnList;
13300
13391
  const tableFullColumn = getColumnList(columnList);
13301
13392
  internalData.tableFullColumn = tableFullColumn;
13302
- $xeTable.cacheColumnMap();
13393
+ cacheColumnMap($xeTable);
13303
13394
  },
13304
13395
  updateScrollXData() {
13305
13396
  const $xeTable = this;
@@ -13307,8 +13398,9 @@ const Methods = {
13307
13398
  const {
13308
13399
  showOverflow
13309
13400
  } = props;
13401
+ $xeTable.handleTableColumn();
13402
+ calcCellHeight($xeTable);
13310
13403
  return $xeTable.$nextTick().then(() => {
13311
- $xeTable.handleTableColumn();
13312
13404
  calcCellHeight($xeTable);
13313
13405
  $xeTable.updateScrollXSpace();
13314
13406
  if (!showOverflow) {
@@ -13372,8 +13464,9 @@ const Methods = {
13372
13464
  },
13373
13465
  updateScrollYData() {
13374
13466
  const $xeTable = this;
13467
+ $xeTable.handleTableData();
13468
+ calcCellHeight($xeTable);
13375
13469
  return $xeTable.$nextTick().then(() => {
13376
- $xeTable.handleTableData();
13377
13470
  calcCellHeight($xeTable);
13378
13471
  $xeTable.updateScrollYSpace();
13379
13472
  });
@@ -13937,6 +14030,7 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
13937
14030
  sYOpts,
13938
14031
  scrollXLoad,
13939
14032
  scrollYLoad,
14033
+ isCalcCellHeight,
13940
14034
  highlightCurrentRow,
13941
14035
  showOverflow: allColumnOverflow,
13942
14036
  isAllOverflow,
@@ -14200,14 +14294,15 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
14200
14294
  }
14201
14295
  }
14202
14296
  let cellHeight = '';
14297
+ const vnHeight = isCalcCellHeight ? rest.height : 0;
14203
14298
  if (hasEllipsis) {
14204
14299
  if (scrollYRHeight || rowHeight) {
14205
14300
  cellHeight = `${scrollYRHeight || rowHeight}px`;
14206
14301
  } else if (!isAllOverflow) {
14207
- cellHeight = `${rest.height || 18}px`;
14302
+ cellHeight = `${vnHeight || rowHeight || 18}px`;
14208
14303
  }
14209
14304
  } else {
14210
- cellHeight = `${rest.height || 18}px`;
14305
+ cellHeight = `${vnHeight || rowHeight || 18}px`;
14211
14306
  }
14212
14307
  if (mouseConfig && mouseOpts.area && selectCellToRow) {
14213
14308
  if (!$columnIndex && selectCellToRow === true || selectCellToRow === column.field) {
@@ -14914,6 +15009,7 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
14914
15009
 
14915
15010
 
14916
15011
  const {
15012
+ getI18n: header_getI18n,
14917
15013
  renderer: header_renderer,
14918
15014
  renderEmptyElement: header_renderEmptyElement
14919
15015
  } = core_.VxeUI;
@@ -15051,7 +15147,8 @@ const header_renderRows = (h, _vm, cols, $rowIndex) => {
15051
15147
  'is--line': !border || border === 'none'
15052
15148
  }],
15053
15149
  on: {
15054
- mousedown: evnt => _vm.resizeMousedown(evnt, params)
15150
+ mousedown: evnt => _vm.resizeMousedownEvent(evnt, params),
15151
+ dblclick: evnt => $xeTable.handleResizeDblclickEvent(evnt, params)
15055
15152
  }
15056
15153
  }) : null]);
15057
15154
  }).concat(scrollbarWidth ? [h('th', {
@@ -15293,7 +15390,7 @@ function renderHeads(h, _vm, headerGroups) {
15293
15390
  } = this;
15294
15391
  this.headerColumn = $xetable.isGroup ? convertHeaderColumnToRows(this.tableGroupColumn) : [];
15295
15392
  },
15296
- resizeMousedown(evnt, params) {
15393
+ resizeMousedownEvent(evnt, params) {
15297
15394
  const $xeTable = this.$parent;
15298
15395
  const tableInternalData = $xeTable;
15299
15396
  const {
@@ -15316,17 +15413,20 @@ function renderHeads(h, _vm, headerGroups) {
15316
15413
  const resizeTipElem = $xetable.$refs.refCellResizeTip;
15317
15414
  const wrapperElem = this.$el;
15318
15415
  const {
15319
- target: dragBtnElem,
15320
15416
  clientX: dragClientX
15321
15417
  } = evnt;
15322
- const cell = params.cell = dragBtnElem.parentNode;
15418
+ const dragBtnElem = evnt.target;
15419
+ const cell = dragBtnElem.parentNode;
15420
+ const cellParams = Object.assign(params, {
15421
+ cell
15422
+ });
15323
15423
  const resizableOpts = $xeTable.computeResizableOpts;
15324
15424
  let dragLeft = 0;
15325
15425
  const tableBodyElem = tableBody.$el;
15326
15426
  const pos = getOffsetPos(dragBtnElem, tableEl);
15327
15427
  const dragBtnWidth = dragBtnElem.clientWidth;
15328
15428
  const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
15329
- const minInterval = getColReMinWidth(params) - dragBtnOffsetWidth; // 列之间的最小间距
15429
+ const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
15330
15430
  let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
15331
15431
  let dragPosLeft = pos.left + dragBtnOffsetWidth;
15332
15432
  const domMousemove = document.onmousemove;
@@ -15385,7 +15485,7 @@ function renderHeads(h, _vm, headerGroups) {
15385
15485
  }
15386
15486
  resizeTipElem.style.left = `${resizeTipLeft}px`;
15387
15487
  resizeTipElem.style.top = `${Math.min(tableEl.clientHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
15388
- resizeTipElem.textContent = `${column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)}px`;
15488
+ resizeTipElem.textContent = header_getI18n('vxe.table.resizeColTip', [column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
15389
15489
  }
15390
15490
  };
15391
15491
  $xetable._isResize = true;
@@ -19178,7 +19278,8 @@ function insertTreeRow(_vm, newRecords, isAppend) {
19178
19278
  items: parentChilds,
19179
19279
  parent: parentRow,
19180
19280
  level: parentLevel + 1,
19181
- height: 0
19281
+ height: 0,
19282
+ oTop: 0
19182
19283
  };
19183
19284
  fullDataRowIdData[rowid] = rest;
19184
19285
  fullAllDataRowIdData[rowid] = rest;
@@ -19200,7 +19301,8 @@ function insertTreeRow(_vm, newRecords, isAppend) {
19200
19301
  items: tableFullTreeData,
19201
19302
  parent: null,
19202
19303
  level: 0,
19203
- height: 0
19304
+ height: 0,
19305
+ oTop: 0
19204
19306
  };
19205
19307
  fullDataRowIdData[rowid] = rest;
19206
19308
  fullAllDataRowIdData[rowid] = rest;
@@ -19256,7 +19358,8 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
19256
19358
  items: afterFullData,
19257
19359
  parent: null,
19258
19360
  level: 0,
19259
- height: 0
19361
+ height: 0,
19362
+ oTop: 0
19260
19363
  };
19261
19364
  fullDataRowIdData[rowid] = rest;
19262
19365
  fullAllDataRowIdData[rowid] = rest;
@@ -19291,7 +19394,8 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
19291
19394
  items: afterFullData,
19292
19395
  parent: null,
19293
19396
  level: 0,
19294
- height: 0
19397
+ height: 0,
19398
+ oTop: 0
19295
19399
  };
19296
19400
  fullDataRowIdData[rowid] = rest;
19297
19401
  fullAllDataRowIdData[rowid] = rest;
@@ -19349,7 +19453,8 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
19349
19453
  items: parentMapChilds,
19350
19454
  parent: parentRow,
19351
19455
  level: parentLevel + 1,
19352
- height: 0
19456
+ height: 0,
19457
+ oTop: 0
19353
19458
  };
19354
19459
  fullDataRowIdData[rowid] = rest;
19355
19460
  fullAllDataRowIdData[rowid] = rest;
@@ -23879,6 +23984,7 @@ function handleUupdateResize(_vm) {
23879
23984
  isFooter: false
23880
23985
  },
23881
23986
  scrollVMLoading: false,
23987
+ isCalcCellHeight: 0,
23882
23988
  isCustomStatus: false,
23883
23989
  isDragRowMove: false,
23884
23990
  dragRow: null,
@@ -24161,7 +24267,7 @@ function handleUupdateResize(_vm) {
24161
24267
  computeCustomOpts() {
24162
24268
  return Object.assign({}, table_getConfig().table.customConfig, this.customConfig);
24163
24269
  },
24164
- autoWidthColumnList() {
24270
+ computeAutoWidthColumnList() {
24165
24271
  const {
24166
24272
  tableColumn,
24167
24273
  visibleColumn
@@ -28608,7 +28714,8 @@ const Toolbar = VxeToolbar;
28608
28714
  customCancel: '取消',
28609
28715
  customRestore: '恢复默认',
28610
28716
  maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
28611
- dragTip: '移动:{0}'
28717
+ dragTip: '移动:{0}',
28718
+ resizeColTip: '{0} 像素'
28612
28719
  },
28613
28720
  grid: {
28614
28721
  selectOneRecord: '请至少选择一条记录!',