vxe-table 3.12.1-beta.3 → 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 (119) 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/src/cell.js +73 -50
  22. package/es/table/src/header.js +10 -7
  23. package/es/table/src/methods.js +493 -442
  24. package/es/table/src/table.js +1 -1
  25. package/es/ui/index.js +1 -1
  26. package/es/ui/src/log.js +1 -1
  27. package/lib/index.umd.js +674 -582
  28. package/lib/index.umd.min.js +1 -1
  29. package/lib/locale/lang/ar-EG.js +2 -1
  30. package/lib/locale/lang/ar-EG.min.js +1 -1
  31. package/lib/locale/lang/de-DE.js +2 -1
  32. package/lib/locale/lang/de-DE.min.js +1 -1
  33. package/lib/locale/lang/en-US.js +2 -1
  34. package/lib/locale/lang/en-US.min.js +1 -1
  35. package/lib/locale/lang/en-US.umd.js +2 -1
  36. package/lib/locale/lang/es-ES.js +2 -1
  37. package/lib/locale/lang/es-ES.min.js +1 -1
  38. package/lib/locale/lang/es-ES.umd.js +2 -1
  39. package/lib/locale/lang/fr-FR.js +2 -1
  40. package/lib/locale/lang/fr-FR.min.js +1 -1
  41. package/lib/locale/lang/hu-HU.js +2 -1
  42. package/lib/locale/lang/hu-HU.min.js +1 -1
  43. package/lib/locale/lang/hu-HU.umd.js +2 -1
  44. package/lib/locale/lang/hy-AM.js +2 -1
  45. package/lib/locale/lang/hy-AM.min.js +1 -1
  46. package/lib/locale/lang/it-IT.js +2 -1
  47. package/lib/locale/lang/it-IT.min.js +1 -1
  48. package/lib/locale/lang/ja-JP.js +2 -1
  49. package/lib/locale/lang/ja-JP.min.js +1 -1
  50. package/lib/locale/lang/ja-JP.umd.js +2 -1
  51. package/lib/locale/lang/ko-KR.js +2 -1
  52. package/lib/locale/lang/ko-KR.min.js +1 -1
  53. package/lib/locale/lang/ko-KR.umd.js +2 -1
  54. package/lib/locale/lang/nb-NO.js +2 -1
  55. package/lib/locale/lang/nb-NO.min.js +1 -1
  56. package/lib/locale/lang/pt-BR.js +2 -1
  57. package/lib/locale/lang/pt-BR.min.js +1 -1
  58. package/lib/locale/lang/pt-BR.umd.js +2 -1
  59. package/lib/locale/lang/ru-RU.js +2 -1
  60. package/lib/locale/lang/ru-RU.min.js +1 -1
  61. package/lib/locale/lang/ru-RU.umd.js +2 -1
  62. package/lib/locale/lang/th-TH.js +2 -1
  63. package/lib/locale/lang/th-TH.min.js +1 -1
  64. package/lib/locale/lang/ug-CN.js +2 -1
  65. package/lib/locale/lang/ug-CN.min.js +1 -1
  66. package/lib/locale/lang/uk-UA.js +2 -1
  67. package/lib/locale/lang/uk-UA.min.js +1 -1
  68. package/lib/locale/lang/uk-UA.umd.js +2 -1
  69. package/lib/locale/lang/vi-VN.js +2 -1
  70. package/lib/locale/lang/vi-VN.min.js +1 -1
  71. package/lib/locale/lang/zh-CHT.js +2 -1
  72. package/lib/locale/lang/zh-CHT.min.js +1 -1
  73. package/lib/locale/lang/zh-CHT.umd.js +2 -1
  74. package/lib/locale/lang/zh-CN.js +2 -1
  75. package/lib/locale/lang/zh-CN.min.js +1 -1
  76. package/lib/locale/lang/zh-CN.umd.js +2 -1
  77. package/lib/style.css +1 -1
  78. package/lib/table/src/cell.js +87 -54
  79. package/lib/table/src/cell.min.js +1 -1
  80. package/lib/table/src/header.js +11 -6
  81. package/lib/table/src/header.min.js +1 -1
  82. package/lib/table/src/methods.js +570 -518
  83. package/lib/table/src/methods.min.js +1 -1
  84. package/lib/table/src/table.js +1 -1
  85. package/lib/table/src/table.min.js +1 -1
  86. package/lib/ui/index.js +1 -1
  87. package/lib/ui/index.min.js +1 -1
  88. package/lib/ui/src/log.js +1 -1
  89. package/lib/ui/src/log.min.js +1 -1
  90. package/package.json +2 -2
  91. package/packages/locale/lang/ar-EG.ts +2 -1
  92. package/packages/locale/lang/de-DE.ts +2 -1
  93. package/packages/locale/lang/en-US.ts +2 -1
  94. package/packages/locale/lang/es-ES.ts +2 -1
  95. package/packages/locale/lang/fr-FR.ts +2 -1
  96. package/packages/locale/lang/hu-HU.ts +2 -1
  97. package/packages/locale/lang/hy-AM.ts +2 -1
  98. package/packages/locale/lang/it-IT.ts +2 -1
  99. package/packages/locale/lang/ja-JP.ts +2 -1
  100. package/packages/locale/lang/ko-KR.ts +2 -1
  101. package/packages/locale/lang/nb-NO.ts +2 -1
  102. package/packages/locale/lang/pt-BR.ts +2 -1
  103. package/packages/locale/lang/ru-RU.ts +2 -1
  104. package/packages/locale/lang/th-TH.ts +2 -1
  105. package/packages/locale/lang/ug-CN.ts +2 -1
  106. package/packages/locale/lang/uk-UA.ts +2 -1
  107. package/packages/locale/lang/vi-VN.ts +2 -1
  108. package/packages/locale/lang/zh-CHT.ts +2 -1
  109. package/packages/locale/lang/zh-CN.ts +2 -1
  110. package/packages/table/src/cell.ts +78 -46
  111. package/packages/table/src/header.ts +13 -10
  112. package/packages/table/src/methods.ts +513 -451
  113. package/packages/table/src/table.ts +1 -1
  114. /package/es/{iconfont.1735888162273.ttf → iconfont.1735908447074.ttf} +0 -0
  115. /package/es/{iconfont.1735888162273.woff → iconfont.1735908447074.woff} +0 -0
  116. /package/es/{iconfont.1735888162273.woff2 → iconfont.1735908447074.woff2} +0 -0
  117. /package/lib/{iconfont.1735888162273.ttf → iconfont.1735908447074.ttf} +0 -0
  118. /package/lib/{iconfont.1735888162273.woff → iconfont.1735908447074.woff} +0 -0
  119. /package/lib/{iconfont.1735888162273.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();
@@ -6217,143 +6743,6 @@ const Methods = {
6217
6743
  return rows;
6218
6744
  });
6219
6745
  },
6220
- /**
6221
- * 更新数据列的 Map
6222
- * 牺牲数据组装的耗时,用来换取使用过程中的流畅
6223
- */
6224
- cacheColumnMap() {
6225
- const $xeTable = this;
6226
- const props = $xeTable;
6227
- const reactData = $xeTable;
6228
- const internalData = $xeTable;
6229
- const {
6230
- tableFullColumn,
6231
- collectColumn
6232
- } = internalData;
6233
- const fullColumnIdData = internalData.fullColumnIdData = {};
6234
- const fullColumnFieldData = internalData.fullColumnFieldData = {};
6235
- const mouseOpts = $xeTable.computeMouseOpts;
6236
- const columnOpts = $xeTable.computeColumnOpts;
6237
- const columnDragOpts = $xeTable.computeColumnDragOpts;
6238
- const {
6239
- isCrossDrag,
6240
- isSelfToChildDrag
6241
- } = columnDragOpts;
6242
- const rowOpts = $xeTable.computeRowOpts;
6243
- const isGroup = collectColumn.some(hasChildrenList);
6244
- let isAllOverflow = !!props.showOverflow;
6245
- let expandColumn;
6246
- let treeNodeColumn;
6247
- let checkboxColumn;
6248
- let radioColumn;
6249
- let htmlColumn;
6250
- let hasFixed;
6251
- const handleFunc = (column, index, items, path, parentColumn) => {
6252
- const {
6253
- id: colid,
6254
- field,
6255
- fixed,
6256
- type,
6257
- treeNode
6258
- } = column;
6259
- const rest = {
6260
- $index: -1,
6261
- _index: -1,
6262
- column,
6263
- colid,
6264
- index,
6265
- items,
6266
- parent: parentColumn || null,
6267
- width: 0
6268
- };
6269
- if (field) {
6270
- if (fullColumnFieldData[field]) {
6271
- errLog('vxe.error.colRepet', ['field', field]);
6272
- }
6273
- fullColumnFieldData[field] = rest;
6274
- } else {
6275
- if (isCrossDrag || isSelfToChildDrag) {
6276
- errLog('vxe.error.emptyProp', ['column.field']);
6277
- }
6278
- }
6279
- if (!hasFixed && fixed) {
6280
- hasFixed = fixed;
6281
- }
6282
- if (!htmlColumn && type === 'html') {
6283
- htmlColumn = column;
6284
- }
6285
- if (treeNode) {
6286
- if (true) {
6287
- if (treeNodeColumn) {
6288
- warnLog('vxe.error.colRepet', ['tree-node', treeNode]);
6289
- }
6290
- }
6291
- if (!treeNodeColumn) {
6292
- treeNodeColumn = column;
6293
- }
6294
- } else if (type === 'expand') {
6295
- if (true) {
6296
- if (expandColumn) {
6297
- warnLog('vxe.error.colRepet', ['type', type]);
6298
- }
6299
- }
6300
- if (!expandColumn) {
6301
- expandColumn = column;
6302
- }
6303
- }
6304
- if (true) {
6305
- if (type === 'checkbox') {
6306
- if (checkboxColumn) {
6307
- warnLog('vxe.error.colRepet', ['type', type]);
6308
- }
6309
- if (!checkboxColumn) {
6310
- checkboxColumn = column;
6311
- }
6312
- } else if (type === 'radio') {
6313
- if (radioColumn) {
6314
- warnLog('vxe.error.colRepet', ['type', type]);
6315
- }
6316
- if (!radioColumn) {
6317
- radioColumn = column;
6318
- }
6319
- }
6320
- }
6321
- if (isAllOverflow && column.showOverflow === false) {
6322
- isAllOverflow = false;
6323
- }
6324
- if (fullColumnIdData[colid]) {
6325
- errLog('vxe.error.colRepet', ['colId', colid]);
6326
- }
6327
- fullColumnIdData[colid] = rest;
6328
- };
6329
- if (isGroup) {
6330
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
6331
- column.level = nodes.length;
6332
- handleFunc(column, index, items, path, parentColumn);
6333
- });
6334
- } else {
6335
- tableFullColumn.forEach(handleFunc);
6336
- }
6337
- if (true) {
6338
- if (expandColumn && mouseOpts.area) {
6339
- errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
6340
- }
6341
- }
6342
- if (true) {
6343
- if (htmlColumn) {
6344
- if (!columnOpts.useKey) {
6345
- errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
6346
- }
6347
- if (!rowOpts.useKey) {
6348
- errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
6349
- }
6350
- }
6351
- }
6352
- reactData.isGroup = isGroup;
6353
- reactData.treeNodeColumn = treeNodeColumn;
6354
- reactData.expandColumn = expandColumn;
6355
- reactData.isAllOverflow = isAllOverflow;
6356
- },
6357
6746
  /**
6358
6747
  * 根据 tr 元素获取对应的 row 信息
6359
6748
  * @param {Element} tr 元素
@@ -8120,6 +8509,43 @@ const Methods = {
8120
8509
  remainList
8121
8510
  });
8122
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
+ },
8123
8549
  /**
8124
8550
  * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
8125
8551
  */
@@ -8174,7 +8600,7 @@ const Methods = {
8174
8600
  const refreshDelay = resizeOpts.refreshDelay || 20;
8175
8601
  const el = $xeTable.$refs.refElem;
8176
8602
  if (el && el.clientWidth) {
8177
- $xeTable.autoCellWidth();
8603
+ autoCellWidth($xeTable);
8178
8604
  }
8179
8605
  if (rceTimeout) {
8180
8606
  clearTimeout(rceTimeout);
@@ -8194,216 +8620,6 @@ const Methods = {
8194
8620
  }, refreshDelay);
8195
8621
  });
8196
8622
  },
8197
- calcCellWidth() {
8198
- const $xeTable = this;
8199
- const {
8200
- autoWidthColumnList
8201
- } = this;
8202
- this.isCalcColumn = true;
8203
- return this.$nextTick().then(() => {
8204
- const internalData = $xeTable;
8205
- const {
8206
- fullColumnIdData
8207
- } = internalData;
8208
- const el = this.$el;
8209
- if (el) {
8210
- autoWidthColumnList.forEach(column => {
8211
- const colid = column.id;
8212
- const colRest = fullColumnIdData[colid];
8213
- 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`);
8214
- const firstCellEl = cellElList[0];
8215
- let paddingSize = 0;
8216
- if (firstCellEl) {
8217
- const cellStyle = getComputedStyle(firstCellEl);
8218
- 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;
8219
- }
8220
- let colWidth = column.renderAutoWidth - paddingSize;
8221
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellElList, itemEl => {
8222
- const cellEl = itemEl;
8223
- const thElem = cellEl.parentElement;
8224
- let titleWidth = 0;
8225
- if (`${thElem.tagName}`.toLowerCase() === 'th') {
8226
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellEl.children, btnEl => {
8227
- titleWidth += btnEl.offsetWidth + 1;
8228
- });
8229
- } else {
8230
- const labelEl = cellEl.firstElementChild;
8231
- if (labelEl) {
8232
- titleWidth = labelEl.offsetWidth;
8233
- }
8234
- }
8235
- if (titleWidth) {
8236
- colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
8237
- }
8238
- });
8239
- if (colRest) {
8240
- colRest.width = Math.max(colWidth, colRest.width);
8241
- }
8242
- column.renderAutoWidth = colWidth + paddingSize;
8243
- });
8244
- this.analyColumnWidth();
8245
- }
8246
- this.isCalcColumn = false;
8247
- });
8248
- },
8249
- /**
8250
- * 列宽算法,计算单元格列宽,动态分配可用剩余空间
8251
- * 支持 px、%、固定 混合分配
8252
- * 支持动态列表调整分配
8253
- * 支持自动分配偏移量
8254
- * 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
8255
- */
8256
- autoCellWidth() {
8257
- const {
8258
- $refs
8259
- } = this;
8260
- const {
8261
- tableBody,
8262
- tableHeader,
8263
- tableFooter
8264
- } = $refs;
8265
- const bodyElem = tableBody ? tableBody.$el : null;
8266
- const headerElem = tableHeader ? tableHeader.$el : null;
8267
- const footerElem = tableFooter ? tableFooter.$el : null;
8268
- let tableWidth = 0;
8269
- const minCellWidth = 40; // 列宽最少限制 40px
8270
- const bodyWidth = bodyElem.clientWidth - 1;
8271
- let remainWidth = bodyWidth;
8272
- let meanWidth = remainWidth / 100;
8273
- const {
8274
- fit,
8275
- columnStore
8276
- } = this;
8277
- const {
8278
- resizeList,
8279
- pxMinList,
8280
- pxList,
8281
- autoMinList,
8282
- scaleList,
8283
- scaleMinList,
8284
- autoList,
8285
- remainList
8286
- } = columnStore;
8287
- // 最小宽
8288
- pxMinList.forEach(column => {
8289
- const minWidth = parseInt(column.minWidth);
8290
- tableWidth += minWidth;
8291
- column.renderWidth = minWidth;
8292
- });
8293
- // 最小自适应
8294
- autoMinList.forEach(column => {
8295
- const scaleWidth = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
8296
- tableWidth += scaleWidth;
8297
- column.renderWidth = scaleWidth;
8298
- });
8299
- // 最小百分比
8300
- scaleMinList.forEach(column => {
8301
- const scaleWidth = Math.floor(parseInt(column.minWidth) * meanWidth);
8302
- tableWidth += scaleWidth;
8303
- column.renderWidth = scaleWidth;
8304
- });
8305
- // 固定百分比
8306
- scaleList.forEach(column => {
8307
- const scaleWidth = Math.floor(parseInt(column.width) * meanWidth);
8308
- tableWidth += scaleWidth;
8309
- column.renderWidth = scaleWidth;
8310
- });
8311
- // 固定宽
8312
- pxList.forEach(column => {
8313
- const width = parseInt(column.width);
8314
- tableWidth += width;
8315
- column.renderWidth = width;
8316
- });
8317
- // 自适应宽
8318
- autoList.forEach(column => {
8319
- const width = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
8320
- tableWidth += width;
8321
- column.renderWidth = width;
8322
- });
8323
- // 调整了列宽
8324
- resizeList.forEach(column => {
8325
- const width = parseInt(column.resizeWidth);
8326
- tableWidth += width;
8327
- column.renderWidth = width;
8328
- });
8329
- remainWidth -= tableWidth;
8330
- meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
8331
- if (fit) {
8332
- if (remainWidth > 0) {
8333
- scaleMinList.concat(pxMinList).concat(autoMinList).forEach(column => {
8334
- tableWidth += meanWidth;
8335
- column.renderWidth += meanWidth;
8336
- });
8337
- }
8338
- } else {
8339
- meanWidth = minCellWidth;
8340
- }
8341
- // 剩余均分
8342
- remainList.forEach(column => {
8343
- const width = Math.max(meanWidth, minCellWidth);
8344
- column.renderWidth = width;
8345
- tableWidth += width;
8346
- });
8347
- if (fit) {
8348
- /**
8349
- * 偏移量算法
8350
- * 如果所有列足够放的情况下,从最后动态列开始分配
8351
- */
8352
- const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
8353
- let dynamicSize = dynamicList.length - 1;
8354
- if (dynamicSize > 0) {
8355
- let odiffer = bodyWidth - tableWidth;
8356
- if (odiffer > 0) {
8357
- while (odiffer > 0 && dynamicSize >= 0) {
8358
- odiffer--;
8359
- dynamicList[dynamicSize--].renderWidth++;
8360
- }
8361
- tableWidth = bodyWidth;
8362
- }
8363
- }
8364
- }
8365
- const tableHeight = bodyElem.offsetHeight;
8366
- const overflowY = bodyElem.scrollHeight > bodyElem.clientHeight;
8367
- this.scrollbarWidth = overflowY ? bodyElem.offsetWidth - bodyElem.clientWidth : 0;
8368
- this.overflowY = overflowY;
8369
- this.tableWidth = tableWidth;
8370
- this.tableHeight = tableHeight;
8371
- if (headerElem) {
8372
- this.headerHeight = headerElem.clientHeight;
8373
- this.$nextTick(() => {
8374
- // 检测是否同步滚动
8375
- if (headerElem && bodyElem && headerElem.scrollLeft !== bodyElem.scrollLeft) {
8376
- headerElem.scrollLeft = bodyElem.scrollLeft;
8377
- }
8378
- });
8379
- } else {
8380
- this.headerHeight = 0;
8381
- }
8382
- let overflowX = false;
8383
- let footerHeight = 0;
8384
- let scrollbarHeight = 0;
8385
- if (footerElem) {
8386
- footerHeight = footerElem.offsetHeight;
8387
- overflowX = tableWidth > footerElem.clientWidth;
8388
- scrollbarHeight = Math.max(footerHeight - footerElem.clientHeight, 0);
8389
- } else {
8390
- overflowX = tableWidth > bodyWidth;
8391
- scrollbarHeight = Math.max(tableHeight - bodyElem.clientHeight, 0);
8392
- }
8393
- this.footerHeight = footerHeight;
8394
- this.overflowX = tableWidth > bodyWidth;
8395
- this.scrollbarHeight = scrollbarHeight;
8396
- this.updateHeight();
8397
- this.parentHeight = Math.max(this.headerHeight + this.footerHeight + 20, this.getParentHeight());
8398
- if (overflowX) {
8399
- this.checkScrolling();
8400
- }
8401
- },
8402
- updateHeight() {
8403
- this.customHeight = calcTableHeight(this, 'height');
8404
- this.customMinHeight = calcTableHeight(this, 'minHeight');
8405
- this.customMaxHeight = calcTableHeight(this, 'maxHeight');
8406
- },
8407
8623
  updateStyle() {
8408
8624
  const $xeTable = this;
8409
8625
  let {
@@ -11334,6 +11550,7 @@ const Methods = {
11334
11550
  oldRow: dragRow,
11335
11551
  newRow: prevDragRow,
11336
11552
  dragPos: prevDragPos,
11553
+ dragToChild: isSelfToChildDrag,
11337
11554
  offsetIndex: dragOffsetIndex,
11338
11555
  _index: {
11339
11556
  newIndex: nafIndex,
@@ -11621,6 +11838,7 @@ const Methods = {
11621
11838
  oldColumn,
11622
11839
  newColumn,
11623
11840
  dragPos: prevDragPos,
11841
+ dragToChild: isSelfToChildDrag,
11624
11842
  offsetIndex: dragOffsetIndex,
11625
11843
  _index: {
11626
11844
  newIndex: nafIndex,
@@ -11656,7 +11874,7 @@ const Methods = {
11656
11874
  setTimeout(() => {
11657
11875
  reactData.isDragColMove = false;
11658
11876
  $xeTable.recalculate().then(() => {
11659
- $xeTable.loadScrollXData();
11877
+ loadScrollXData($xeTable);
11660
11878
  });
11661
11879
  }, 500);
11662
11880
  },
@@ -12881,44 +13099,6 @@ const Methods = {
12881
13099
  scrollLeft: bodyElem.scrollLeft
12882
13100
  };
12883
13101
  },
12884
- loadScrollXData() {
12885
- const $xeTable = this;
12886
- const reactData = $xeTable;
12887
- const internalData = $xeTable;
12888
- const {
12889
- mergeList,
12890
- mergeFooterList
12891
- } = reactData;
12892
- const {
12893
- scrollXStore
12894
- } = internalData;
12895
- const {
12896
- startIndex,
12897
- endIndex,
12898
- offsetSize
12899
- } = scrollXStore;
12900
- const {
12901
- toVisibleIndex,
12902
- visibleSize
12903
- } = handleVirtualXVisible($xeTable);
12904
- const offsetItem = {
12905
- startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
12906
- endIndex: toVisibleIndex + visibleSize + offsetSize
12907
- };
12908
- calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
12909
- const {
12910
- startIndex: offsetStartIndex,
12911
- endIndex: offsetEndIndex
12912
- } = offsetItem;
12913
- if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
12914
- if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
12915
- scrollXStore.startIndex = offsetStartIndex;
12916
- scrollXStore.endIndex = offsetEndIndex;
12917
- $xeTable.updateScrollXData();
12918
- }
12919
- }
12920
- $xeTable.closeTooltip();
12921
- },
12922
13102
  handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
12923
13103
  const $xeTable = this;
12924
13104
  const props = $xeTable;
@@ -13039,12 +13219,12 @@ const Methods = {
13039
13219
  }
13040
13220
  if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
13041
13221
  internalData.lxRunTime = Date.now();
13042
- $xeTable.loadScrollXData();
13222
+ loadScrollXData($xeTable);
13043
13223
  }
13044
13224
  internalData.lxTimeout = setTimeout(() => {
13045
13225
  internalData.lxTimeout = undefined;
13046
13226
  internalData.lxRunTime = undefined;
13047
- $xeTable.loadScrollXData();
13227
+ loadScrollXData($xeTable);
13048
13228
  }, fpsTime);
13049
13229
  },
13050
13230
  lazyScrollYData() {
@@ -13064,12 +13244,12 @@ const Methods = {
13064
13244
  }
13065
13245
  if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
13066
13246
  internalData.lyRunTime = Date.now();
13067
- $xeTable.loadScrollYData();
13247
+ loadScrollYData($xeTable);
13068
13248
  }
13069
13249
  internalData.lyTimeout = setTimeout(() => {
13070
13250
  internalData.lyTimeout = undefined;
13071
13251
  internalData.lyRunTime = undefined;
13072
- $xeTable.loadScrollYData();
13252
+ loadScrollYData($xeTable);
13073
13253
  }, fpsTime);
13074
13254
  },
13075
13255
  /**
@@ -13079,7 +13259,7 @@ const Methods = {
13079
13259
  const $xeTable = this;
13080
13260
  const sXOpts = $xeTable.computeSXOpts;
13081
13261
  if (sXOpts.immediate) {
13082
- $xeTable.loadScrollXData();
13262
+ loadScrollXData($xeTable);
13083
13263
  } else {
13084
13264
  $xeTable.lazyScrollXData();
13085
13265
  }
@@ -13091,7 +13271,7 @@ const Methods = {
13091
13271
  const $xeTable = this;
13092
13272
  const sYOpts = $xeTable.computeSYOpts;
13093
13273
  if (sYOpts.immediate) {
13094
- $xeTable.loadScrollYData();
13274
+ loadScrollYData($xeTable);
13095
13275
  } else {
13096
13276
  $xeTable.lazyScrollYData();
13097
13277
  }
@@ -13186,100 +13366,6 @@ const Methods = {
13186
13366
  fixed: ''
13187
13367
  });
13188
13368
  },
13189
- /**
13190
- * 纵向 Y 可视渲染处理
13191
- */
13192
- loadScrollYData() {
13193
- const $xeTable = this;
13194
- const props = $xeTable;
13195
- const reactData = $xeTable;
13196
- const internalData = $xeTable;
13197
- const {
13198
- showOverflow
13199
- } = props;
13200
- const {
13201
- mergeList
13202
- } = reactData;
13203
- const {
13204
- tableHeight,
13205
- scrollYStore
13206
- } = internalData;
13207
- const {
13208
- startIndex,
13209
- endIndex,
13210
- offsetSize
13211
- } = scrollYStore;
13212
- const offsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200));
13213
- const {
13214
- toVisibleIndex,
13215
- visibleSize
13216
- } = handleVirtualYVisible($xeTable);
13217
- const offsetItem = {
13218
- startIndex: Math.max(0, toVisibleIndex - 1 - offsetYSize),
13219
- endIndex: toVisibleIndex + visibleSize + offsetYSize
13220
- };
13221
- calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
13222
- const {
13223
- startIndex: offsetStartIndex,
13224
- endIndex: offsetEndIndex
13225
- } = offsetItem;
13226
- if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
13227
- if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
13228
- scrollYStore.startIndex = offsetStartIndex;
13229
- scrollYStore.endIndex = offsetEndIndex;
13230
- $xeTable.updateScrollYData();
13231
- }
13232
- }
13233
- },
13234
- // 计算可视渲染相关数据
13235
- computeScrollLoad() {
13236
- const $xeTable = this;
13237
- return this.$nextTick().then(() => {
13238
- const {
13239
- sYOpts,
13240
- sXOpts,
13241
- scrollXLoad,
13242
- scrollYLoad,
13243
- scrollXStore,
13244
- scrollYStore
13245
- } = this;
13246
- // 计算 X 逻辑
13247
- if (scrollXLoad) {
13248
- const {
13249
- visibleSize: visibleXSize
13250
- } = handleVirtualXVisible($xeTable);
13251
- 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);
13252
- scrollXStore.offsetSize = offsetXSize;
13253
- scrollXStore.visibleSize = visibleXSize;
13254
- scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
13255
- $xeTable.updateScrollXData().then(() => {
13256
- $xeTable.loadScrollXData();
13257
- });
13258
- } else {
13259
- $xeTable.updateScrollXSpace();
13260
- }
13261
- calcCellHeight(this);
13262
- // 计算 Y 逻辑
13263
- const rowHeight = computeRowHeight(this);
13264
- scrollYStore.rowHeight = rowHeight;
13265
- this.rowHeight = rowHeight;
13266
- const {
13267
- visibleSize: visibleYSize
13268
- } = handleVirtualYVisible($xeTable);
13269
- if (scrollYLoad) {
13270
- 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);
13271
- scrollYStore.offsetSize = offsetYSize;
13272
- scrollYStore.visibleSize = visibleYSize;
13273
- scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
13274
- $xeTable.updateScrollYData().then(() => {
13275
- $xeTable.loadScrollYData();
13276
- });
13277
- } else {
13278
- $xeTable.updateScrollYSpace();
13279
- }
13280
- $xeTable.$nextTick(this.updateStyle);
13281
- });
13282
- },
13283
13369
  handleTableColumn() {
13284
13370
  const {
13285
13371
  scrollXLoad,
@@ -13304,7 +13390,7 @@ const Methods = {
13304
13390
  internalData.collectColumn = columnList;
13305
13391
  const tableFullColumn = getColumnList(columnList);
13306
13392
  internalData.tableFullColumn = tableFullColumn;
13307
- $xeTable.cacheColumnMap();
13393
+ cacheColumnMap($xeTable);
13308
13394
  },
13309
13395
  updateScrollXData() {
13310
13396
  const $xeTable = this;
@@ -14923,6 +15009,7 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
14923
15009
 
14924
15010
 
14925
15011
  const {
15012
+ getI18n: header_getI18n,
14926
15013
  renderer: header_renderer,
14927
15014
  renderEmptyElement: header_renderEmptyElement
14928
15015
  } = core_.VxeUI;
@@ -15060,7 +15147,8 @@ const header_renderRows = (h, _vm, cols, $rowIndex) => {
15060
15147
  'is--line': !border || border === 'none'
15061
15148
  }],
15062
15149
  on: {
15063
- mousedown: evnt => _vm.resizeMousedown(evnt, params)
15150
+ mousedown: evnt => _vm.resizeMousedownEvent(evnt, params),
15151
+ dblclick: evnt => $xeTable.handleResizeDblclickEvent(evnt, params)
15064
15152
  }
15065
15153
  }) : null]);
15066
15154
  }).concat(scrollbarWidth ? [h('th', {
@@ -15302,7 +15390,7 @@ function renderHeads(h, _vm, headerGroups) {
15302
15390
  } = this;
15303
15391
  this.headerColumn = $xetable.isGroup ? convertHeaderColumnToRows(this.tableGroupColumn) : [];
15304
15392
  },
15305
- resizeMousedown(evnt, params) {
15393
+ resizeMousedownEvent(evnt, params) {
15306
15394
  const $xeTable = this.$parent;
15307
15395
  const tableInternalData = $xeTable;
15308
15396
  const {
@@ -15325,17 +15413,20 @@ function renderHeads(h, _vm, headerGroups) {
15325
15413
  const resizeTipElem = $xetable.$refs.refCellResizeTip;
15326
15414
  const wrapperElem = this.$el;
15327
15415
  const {
15328
- target: dragBtnElem,
15329
15416
  clientX: dragClientX
15330
15417
  } = evnt;
15331
- 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
+ });
15332
15423
  const resizableOpts = $xeTable.computeResizableOpts;
15333
15424
  let dragLeft = 0;
15334
15425
  const tableBodyElem = tableBody.$el;
15335
15426
  const pos = getOffsetPos(dragBtnElem, tableEl);
15336
15427
  const dragBtnWidth = dragBtnElem.clientWidth;
15337
15428
  const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
15338
- const minInterval = getColReMinWidth(params) - dragBtnOffsetWidth; // 列之间的最小间距
15429
+ const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
15339
15430
  let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
15340
15431
  let dragPosLeft = pos.left + dragBtnOffsetWidth;
15341
15432
  const domMousemove = document.onmousemove;
@@ -15394,7 +15485,7 @@ function renderHeads(h, _vm, headerGroups) {
15394
15485
  }
15395
15486
  resizeTipElem.style.left = `${resizeTipLeft}px`;
15396
15487
  resizeTipElem.style.top = `${Math.min(tableEl.clientHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
15397
- 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)]);
15398
15489
  }
15399
15490
  };
15400
15491
  $xetable._isResize = true;
@@ -24176,7 +24267,7 @@ function handleUupdateResize(_vm) {
24176
24267
  computeCustomOpts() {
24177
24268
  return Object.assign({}, table_getConfig().table.customConfig, this.customConfig);
24178
24269
  },
24179
- autoWidthColumnList() {
24270
+ computeAutoWidthColumnList() {
24180
24271
  const {
24181
24272
  tableColumn,
24182
24273
  visibleColumn
@@ -28623,7 +28714,8 @@ const Toolbar = VxeToolbar;
28623
28714
  customCancel: '取消',
28624
28715
  customRestore: '恢复默认',
28625
28716
  maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
28626
- dragTip: '移动:{0}'
28717
+ dragTip: '移动:{0}',
28718
+ resizeColTip: '{0} 像素'
28627
28719
  },
28628
28720
  grid: {
28629
28721
  selectOneRecord: '请至少选择一条记录!',