vxe-table 3.15.46 → 3.15.48

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 (171) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/ar-EG.js +16 -2
  4. package/es/locale/lang/de-DE.js +16 -2
  5. package/es/locale/lang/en-US.js +16 -2
  6. package/es/locale/lang/es-ES.js +16 -2
  7. package/es/locale/lang/fr-FR.js +16 -2
  8. package/es/locale/lang/hu-HU.js +16 -2
  9. package/es/locale/lang/hy-AM.js +16 -2
  10. package/es/locale/lang/id-ID.js +16 -2
  11. package/es/locale/lang/it-IT.js +16 -2
  12. package/es/locale/lang/ja-JP.js +16 -2
  13. package/es/locale/lang/ko-KR.js +16 -2
  14. package/es/locale/lang/ms-MY.js +16 -2
  15. package/es/locale/lang/nb-NO.js +16 -2
  16. package/es/locale/lang/pt-BR.js +16 -2
  17. package/es/locale/lang/ru-RU.js +16 -2
  18. package/es/locale/lang/th-TH.js +16 -2
  19. package/es/locale/lang/ug-CN.js +16 -2
  20. package/es/locale/lang/uk-UA.js +16 -2
  21. package/es/locale/lang/uz-UZ.js +16 -2
  22. package/es/locale/lang/vi-VN.js +16 -2
  23. package/es/locale/lang/zh-CHT.js +17 -3
  24. package/es/locale/lang/zh-CN.js +16 -2
  25. package/es/style.css +1 -1
  26. package/es/style.min.css +1 -1
  27. package/es/table/module/custom/mixin.js +20 -5
  28. package/es/table/module/custom/panel.js +36 -15
  29. package/es/table/src/body.js +8 -5
  30. package/es/table/src/cell.js +21 -13
  31. package/es/table/src/columnInfo.js +1 -0
  32. package/es/table/src/methods.js +62 -17
  33. package/es/table/src/table.js +14 -3
  34. package/es/table/style.css +5 -1
  35. package/es/table/style.min.css +1 -1
  36. package/es/ui/index.js +9 -5
  37. package/es/ui/src/log.js +1 -1
  38. package/es/vxe-table/style.css +5 -1
  39. package/es/vxe-table/style.min.css +1 -1
  40. package/lib/index.css +1 -1
  41. package/lib/index.min.css +1 -1
  42. package/lib/index.umd.js +190 -66
  43. package/lib/index.umd.min.js +1 -1
  44. package/lib/locale/lang/ar-EG.js +16 -2
  45. package/lib/locale/lang/ar-EG.min.js +1 -1
  46. package/lib/locale/lang/ar-EG.umd.js +16 -2
  47. package/lib/locale/lang/de-DE.js +16 -2
  48. package/lib/locale/lang/de-DE.min.js +1 -1
  49. package/lib/locale/lang/de-DE.umd.js +16 -2
  50. package/lib/locale/lang/en-US.js +16 -2
  51. package/lib/locale/lang/en-US.min.js +1 -1
  52. package/lib/locale/lang/en-US.umd.js +16 -2
  53. package/lib/locale/lang/es-ES.js +16 -2
  54. package/lib/locale/lang/es-ES.min.js +1 -1
  55. package/lib/locale/lang/es-ES.umd.js +16 -2
  56. package/lib/locale/lang/fr-FR.js +16 -2
  57. package/lib/locale/lang/fr-FR.min.js +1 -1
  58. package/lib/locale/lang/fr-FR.umd.js +16 -2
  59. package/lib/locale/lang/hu-HU.js +16 -2
  60. package/lib/locale/lang/hu-HU.min.js +1 -1
  61. package/lib/locale/lang/hu-HU.umd.js +16 -2
  62. package/lib/locale/lang/hy-AM.js +16 -2
  63. package/lib/locale/lang/hy-AM.min.js +1 -1
  64. package/lib/locale/lang/hy-AM.umd.js +16 -2
  65. package/lib/locale/lang/id-ID.js +16 -2
  66. package/lib/locale/lang/id-ID.min.js +1 -1
  67. package/lib/locale/lang/id-ID.umd.js +16 -2
  68. package/lib/locale/lang/it-IT.js +16 -2
  69. package/lib/locale/lang/it-IT.min.js +1 -1
  70. package/lib/locale/lang/it-IT.umd.js +16 -2
  71. package/lib/locale/lang/ja-JP.js +16 -2
  72. package/lib/locale/lang/ja-JP.min.js +1 -1
  73. package/lib/locale/lang/ja-JP.umd.js +16 -2
  74. package/lib/locale/lang/ko-KR.js +16 -2
  75. package/lib/locale/lang/ko-KR.min.js +1 -1
  76. package/lib/locale/lang/ko-KR.umd.js +16 -2
  77. package/lib/locale/lang/ms-MY.js +16 -2
  78. package/lib/locale/lang/ms-MY.min.js +1 -1
  79. package/lib/locale/lang/ms-MY.umd.js +16 -2
  80. package/lib/locale/lang/nb-NO.js +16 -2
  81. package/lib/locale/lang/nb-NO.min.js +1 -1
  82. package/lib/locale/lang/nb-NO.umd.js +16 -2
  83. package/lib/locale/lang/pt-BR.js +16 -2
  84. package/lib/locale/lang/pt-BR.min.js +1 -1
  85. package/lib/locale/lang/pt-BR.umd.js +16 -2
  86. package/lib/locale/lang/ru-RU.js +16 -2
  87. package/lib/locale/lang/ru-RU.min.js +1 -1
  88. package/lib/locale/lang/ru-RU.umd.js +16 -2
  89. package/lib/locale/lang/th-TH.js +16 -2
  90. package/lib/locale/lang/th-TH.min.js +1 -1
  91. package/lib/locale/lang/th-TH.umd.js +16 -2
  92. package/lib/locale/lang/ug-CN.js +16 -2
  93. package/lib/locale/lang/ug-CN.min.js +1 -1
  94. package/lib/locale/lang/ug-CN.umd.js +16 -2
  95. package/lib/locale/lang/uk-UA.js +16 -2
  96. package/lib/locale/lang/uk-UA.min.js +1 -1
  97. package/lib/locale/lang/uk-UA.umd.js +16 -2
  98. package/lib/locale/lang/uz-UZ.js +16 -2
  99. package/lib/locale/lang/uz-UZ.min.js +1 -1
  100. package/lib/locale/lang/uz-UZ.umd.js +16 -2
  101. package/lib/locale/lang/vi-VN.js +16 -2
  102. package/lib/locale/lang/vi-VN.min.js +1 -1
  103. package/lib/locale/lang/vi-VN.umd.js +16 -2
  104. package/lib/locale/lang/zh-CHT.js +17 -3
  105. package/lib/locale/lang/zh-CHT.min.js +1 -1
  106. package/lib/locale/lang/zh-CHT.umd.js +17 -3
  107. package/lib/locale/lang/zh-CN.js +16 -2
  108. package/lib/locale/lang/zh-CN.min.js +1 -1
  109. package/lib/locale/lang/zh-CN.umd.js +16 -2
  110. package/lib/style.css +1 -1
  111. package/lib/style.min.css +1 -1
  112. package/lib/table/module/custom/mixin.js +20 -5
  113. package/lib/table/module/custom/mixin.min.js +1 -1
  114. package/lib/table/module/custom/panel.js +34 -15
  115. package/lib/table/module/custom/panel.min.js +1 -1
  116. package/lib/table/src/body.js +8 -5
  117. package/lib/table/src/body.min.js +1 -1
  118. package/lib/table/src/cell.js +20 -11
  119. package/lib/table/src/cell.min.js +1 -1
  120. package/lib/table/src/columnInfo.js +1 -0
  121. package/lib/table/src/columnInfo.min.js +1 -1
  122. package/lib/table/src/methods.js +67 -20
  123. package/lib/table/src/methods.min.js +1 -1
  124. package/lib/table/src/table.js +14 -3
  125. package/lib/table/src/table.min.js +1 -1
  126. package/lib/table/style/style.css +5 -1
  127. package/lib/table/style/style.min.css +1 -1
  128. package/lib/ui/index.js +9 -5
  129. package/lib/ui/index.min.js +1 -1
  130. package/lib/ui/src/log.js +1 -1
  131. package/lib/ui/src/log.min.js +1 -1
  132. package/lib/vxe-table/style/style.css +5 -1
  133. package/lib/vxe-table/style/style.min.css +1 -1
  134. package/package.json +1 -1
  135. package/packages/locale/lang/ar-EG.ts +16 -2
  136. package/packages/locale/lang/de-DE.ts +16 -2
  137. package/packages/locale/lang/en-US.ts +16 -2
  138. package/packages/locale/lang/es-ES.ts +16 -2
  139. package/packages/locale/lang/fr-FR.ts +16 -2
  140. package/packages/locale/lang/hu-HU.ts +16 -2
  141. package/packages/locale/lang/hy-AM.ts +16 -2
  142. package/packages/locale/lang/id-ID.ts +16 -2
  143. package/packages/locale/lang/it-IT.ts +16 -2
  144. package/packages/locale/lang/ja-JP.ts +16 -2
  145. package/packages/locale/lang/ko-KR.ts +16 -2
  146. package/packages/locale/lang/ms-MY.ts +16 -2
  147. package/packages/locale/lang/nb-NO.ts +16 -2
  148. package/packages/locale/lang/pt-BR.ts +16 -2
  149. package/packages/locale/lang/ru-RU.ts +16 -2
  150. package/packages/locale/lang/th-TH.ts +16 -2
  151. package/packages/locale/lang/ug-CN.ts +16 -2
  152. package/packages/locale/lang/uk-UA.ts +16 -2
  153. package/packages/locale/lang/uz-UZ.ts +16 -2
  154. package/packages/locale/lang/vi-VN.ts +16 -2
  155. package/packages/locale/lang/zh-CHT.ts +17 -3
  156. package/packages/locale/lang/zh-CN.ts +16 -2
  157. package/packages/table/module/custom/mixin.ts +18 -5
  158. package/packages/table/module/custom/panel.ts +34 -14
  159. package/packages/table/src/body.ts +8 -5
  160. package/packages/table/src/cell.ts +25 -13
  161. package/packages/table/src/columnInfo.ts +1 -0
  162. package/packages/table/src/methods.ts +64 -16
  163. package/packages/table/src/table.ts +14 -3
  164. package/packages/ui/index.ts +8 -4
  165. package/styles/components/table-module/custom.scss +5 -1
  166. /package/es/{iconfont.1750651550655.ttf → iconfont.1750813664386.ttf} +0 -0
  167. /package/es/{iconfont.1750651550655.woff → iconfont.1750813664386.woff} +0 -0
  168. /package/es/{iconfont.1750651550655.woff2 → iconfont.1750813664386.woff2} +0 -0
  169. /package/lib/{iconfont.1750651550655.ttf → iconfont.1750813664386.ttf} +0 -0
  170. /package/lib/{iconfont.1750651550655.woff → iconfont.1750813664386.woff} +0 -0
  171. /package/lib/{iconfont.1750651550655.woff2 → iconfont.1750813664386.woff2} +0 -0
@@ -55,7 +55,7 @@ export default {
55
55
  const reactData = $xeTable;
56
56
  const { customColumnList, aggHandleFields, rowGroupList } = reactData;
57
57
  const customOpts = $xeTable.computeCustomOpts;
58
- const { allowVisible, allowSort, allowFixed, allowResizable } = customOpts;
58
+ const { allowVisible, allowSort, allowFixed, allowResizable, allowGroup, allowValues } = customOpts;
59
59
  XEUtils.eachTree(customColumnList, (column, index, items, path, parentColumn) => {
60
60
  if (parentColumn) {
61
61
  // 更新子列信息
@@ -81,6 +81,9 @@ export default {
81
81
  if (allowVisible) {
82
82
  column.visible = column.renderVisible;
83
83
  }
84
+ if (allowGroup && allowValues) {
85
+ column.aggFunc = column.renderAggFn;
86
+ }
84
87
  });
85
88
  reactData.isCustomStatus = true;
86
89
  reactData.isDragColMove = true;
@@ -88,9 +91,9 @@ export default {
88
91
  reactData.isDragColMove = false;
89
92
  }, 1000);
90
93
  return $xeTable.saveCustomStore('confirm').then(() => {
91
- if ($xeTable.handlePivotTableAggregateData) {
94
+ if (allowGroup && allowValues && $xeTable.handlePivotTableAggregateData) {
92
95
  if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
93
- // 改动聚合分组
96
+ // 更新数据分组
94
97
  if (aggHandleFields.length) {
95
98
  $xeTable.setRowGroups(aggHandleFields);
96
99
  }
@@ -98,6 +101,10 @@ export default {
98
101
  $xeTable.clearRowGroups();
99
102
  }
100
103
  }
104
+ else {
105
+ // 更新聚合函数
106
+ $xeTable.handleUpdateAggData();
107
+ }
101
108
  }
102
109
  });
103
110
  },
@@ -141,7 +148,8 @@ export default {
141
148
  visible: true,
142
149
  resizable: options === true,
143
150
  fixed: options === true,
144
- sort: options === true
151
+ sort: options === true,
152
+ aggFunc: options === true
145
153
  }, options);
146
154
  XEUtils.eachTree(collectColumn, (column) => {
147
155
  if (opts.resizable) {
@@ -156,12 +164,16 @@ export default {
156
164
  if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
157
165
  column.visible = column.defaultVisible;
158
166
  }
167
+ if (opts.aggFunc) {
168
+ column.aggFunc = column.defaultAggFunc;
169
+ column.renderAggFn = column.defaultAggFunc;
170
+ }
159
171
  column.renderResizeWidth = column.renderWidth;
160
172
  });
161
173
  reactData.isCustomStatus = false;
162
174
  $xeTable.saveCustomStore('reset');
163
175
  return $xeTable.handleCustom().then(() => {
164
- if ($xeTable.handlePivotTableAggregateData) {
176
+ if (opts.aggFunc && $xeTable.handlePivotTableAggregateData) {
165
177
  const rowGroupFields = $xeTable.computeRowGroupFields;
166
178
  if (rowGroupFields ? rowGroupFields.length : rowGroupList.length) {
167
179
  if (rowGroupFields && rowGroupFields.length) {
@@ -171,6 +183,9 @@ export default {
171
183
  $xeTable.clearRowGroups();
172
184
  }
173
185
  }
186
+ else {
187
+ $xeTable.handleUpdateAggData();
188
+ }
174
189
  }
175
190
  });
176
191
  },
@@ -17,8 +17,8 @@ function showDropTip($xeTableCustomPanel, evnt, optEl, showLine, dragPos) {
17
17
  const { prevDragToChild } = customPanelInternalData;
18
18
  const bodyWrapperRect = bodyWrapperElem.getBoundingClientRect();
19
19
  const customBodyRect = customBodyElem.getBoundingClientRect();
20
+ const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem;
20
21
  if (optEl) {
21
- const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem;
22
22
  if (dragLineEl) {
23
23
  if (showLine) {
24
24
  const optRect = optEl.getBoundingClientRect();
@@ -35,6 +35,11 @@ function showDropTip($xeTableCustomPanel, evnt, optEl, showLine, dragPos) {
35
35
  }
36
36
  }
37
37
  }
38
+ else {
39
+ if (dragLineEl) {
40
+ dragLineEl.style.display = 'node';
41
+ }
42
+ }
38
43
  const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem;
39
44
  if (dragTipEl) {
40
45
  dragTipEl.style.display = 'block';
@@ -279,7 +284,7 @@ const renderSimplePanel = (h, _vm) => {
279
284
  ? [
280
285
  h('div', {
281
286
  ref: 'refBodyWrapperElem',
282
- class: 'vxe-table-custom-body-wrapper'
287
+ class: 'vxe-table-custom-simple--body-wrapper'
283
288
  }, [
284
289
  !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregateSimplePanel
285
290
  ? h($xeTable.getPivotTableAggregateSimplePanel(), {
@@ -426,7 +431,7 @@ const renderPopupPanel = (h, $xeTableCustomPanel) => {
426
431
  const tableReactData = $xeTable;
427
432
  const $xeGrid = $xeTable.$xeGrid;
428
433
  const { customStore } = props;
429
- const { resizable: allResizable } = tableProps;
434
+ const { treeConfig, rowGroupConfig, aggregateConfig, resizable: allResizable } = tableProps;
430
435
  const { isCustomStatus, customColumnList } = tableReactData;
431
436
  const customOpts = $xeTable.computeCustomOpts;
432
437
  const { immediate } = customOpts;
@@ -720,7 +725,14 @@ const renderPopupPanel = (h, $xeTableCustomPanel) => {
720
725
  }, $xeTable.callSlot(bottomSlot, params, h))
721
726
  : renderEmptyElement($xeTable),
722
727
  renderDragTip(h, _vm)
723
- ])
728
+ ]),
729
+ !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregatePopupPanel
730
+ ? h($xeTable.getPivotTableAggregatePopupPanel(), {
731
+ props: {
732
+ customStore
733
+ }
734
+ })
735
+ : renderEmptyElement($xeTable)
724
736
  ]);
725
737
  },
726
738
  footer: () => {
@@ -851,12 +863,14 @@ export default {
851
863
  data() {
852
864
  const reactData = {
853
865
  dragCol: null,
866
+ dragGroupField: null,
867
+ dragAggFnCol: null,
854
868
  dragTipText: ''
855
869
  };
856
870
  const internalData = {
857
871
  // prevDragCol: undefined,
858
- // prevDragGroup: undefined,
859
- // prevDragValues: undefined,
872
+ // prevDragGroupField: undefined,
873
+ // prevDragAggFnColid: undefined,
860
874
  // prevDragToChild: false,
861
875
  // prevDragPos: null
862
876
  };
@@ -1116,6 +1130,8 @@ export default {
1116
1130
  const column = $xeTable.getColumnById(colid);
1117
1131
  trEl.draggable = true;
1118
1132
  customPanelReactData.dragCol = column;
1133
+ customPanelReactData.dragGroupField = null;
1134
+ customPanelReactData.dragAggFnCol = null;
1119
1135
  this.updateColDropTipContent();
1120
1136
  addClass(trEl, 'active--drag-origin');
1121
1137
  },
@@ -1129,6 +1145,8 @@ export default {
1129
1145
  hideDropTip($xeTableCustomPanel);
1130
1146
  trEl.draggable = false;
1131
1147
  customPanelReactData.dragCol = null;
1148
+ customPanelReactData.dragGroupField = null;
1149
+ customPanelReactData.dragAggFnCol = null;
1132
1150
  removeClass(trEl, 'active--drag-origin');
1133
1151
  },
1134
1152
  sortDragstartEvent(evnt) {
@@ -1137,8 +1155,8 @@ export default {
1137
1155
  if (evnt.dataTransfer) {
1138
1156
  evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
1139
1157
  }
1140
- customPanelInternalData.prevDragGroup = null;
1141
- customPanelInternalData.prevDragValues = null;
1158
+ customPanelInternalData.prevDragGroupField = null;
1159
+ customPanelInternalData.prevDragAggFnColid = null;
1142
1160
  },
1143
1161
  sortDragendEvent(evnt) {
1144
1162
  const $xeTableCustomPanel = this;
@@ -1157,9 +1175,9 @@ export default {
1157
1175
  const columnDragOpts = $xeTable.computeColumnDragOpts;
1158
1176
  const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
1159
1177
  const { dragCol } = customPanelReactData;
1160
- const { prevDragCol, prevDragGroup, prevDragValues, prevDragPos, prevDragToChild } = customPanelInternalData;
1178
+ const { prevDragCol, prevDragGroupField, prevDragAggFnColid, prevDragPos, prevDragToChild } = customPanelInternalData;
1161
1179
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
1162
- if (prevDragGroup || prevDragValues) {
1180
+ if (prevDragGroupField || prevDragAggFnColid) {
1163
1181
  if ($xeTable.handlePivotTableAggregatePanelDragendEvent) {
1164
1182
  $xeTable.handlePivotTableAggregatePanelDragendEvent(evnt);
1165
1183
  }
@@ -1318,8 +1336,10 @@ export default {
1318
1336
  }
1319
1337
  hideDropTip($xeTableCustomPanel);
1320
1338
  customPanelReactData.dragCol = null;
1321
- customPanelInternalData.prevDragGroup = null;
1322
- customPanelInternalData.prevDragValues = null;
1339
+ customPanelReactData.dragGroupField = null;
1340
+ customPanelReactData.dragAggFnCol = null;
1341
+ customPanelInternalData.prevDragGroupField = null;
1342
+ customPanelInternalData.prevDragAggFnColid = null;
1323
1343
  trEl.draggable = false;
1324
1344
  trEl.removeAttribute('drag-pos');
1325
1345
  removeClass(trEl, 'active--drag-target');
@@ -1339,14 +1359,15 @@ export default {
1339
1359
  const isControlKey = hasControlKey(evnt);
1340
1360
  const colid = optEl.getAttribute('colid');
1341
1361
  const column = $xeTable.getColumnById(colid);
1342
- customPanelInternalData.prevDragGroup = null;
1343
- customPanelInternalData.prevDragValues = null;
1362
+ customPanelInternalData.prevDragGroupField = null;
1363
+ customPanelInternalData.prevDragAggFnColid = null;
1344
1364
  // 是否移入有效列
1345
1365
  if (column && (isCrossDrag || column.level === 1)) {
1346
1366
  evnt.preventDefault();
1347
1367
  const offsetY = evnt.clientY - optEl.getBoundingClientRect().y;
1348
1368
  const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom';
1349
- if ((dragCol && dragCol.id === column.id) ||
1369
+ if (!dragCol ||
1370
+ (dragCol && dragCol.id === column.id) ||
1350
1371
  (!isCrossDrag && column.level > 1) ||
1351
1372
  (!immediate && column.level > 1) ||
1352
1373
  column.renderFixed) {
@@ -190,6 +190,7 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
190
190
  $xeTable.triggerCellDblclickEvent(evnt, cellParams);
191
191
  };
192
192
  let isMergeCell = false;
193
+ let mergeColspan = 1;
193
194
  let mergeRowspan = 1;
194
195
  // 合并行或列
195
196
  if (mergeBodyFlag && mergeBodyList.length) {
@@ -206,6 +207,7 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
206
207
  }
207
208
  if (colspan > 1) {
208
209
  isMergeCell = true;
210
+ mergeColspan = colspan;
209
211
  tdAttrs.colspan = colspan;
210
212
  }
211
213
  }
@@ -223,6 +225,7 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
223
225
  }
224
226
  if (colspan > 1) {
225
227
  isMergeCell = true;
228
+ mergeColspan = colspan;
226
229
  tdAttrs.colspan = colspan;
227
230
  }
228
231
  }
@@ -262,16 +265,16 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
262
265
  }
263
266
  const tcStyle = {};
264
267
  if (hasEllipsis && resizeWidthFlag) {
265
- let tsColspan = tdAttrs.colspan || 0;
266
- if (tsColspan > 1) {
267
- for (let index = 1; index < tsColspan; index++) {
268
+ let mergeColWidth = 0;
269
+ if (mergeColspan > 1) {
270
+ for (let index = 1; index < mergeColspan; index++) {
268
271
  const nextColumn = visibleColumn[columnIndex + index];
269
272
  if (nextColumn) {
270
- tsColspan += nextColumn.renderWidth;
273
+ mergeColWidth += nextColumn.renderWidth;
271
274
  }
272
275
  }
273
276
  }
274
- tcStyle.width = `${column.renderWidth - (cellOffsetWidth * tsColspan)}px`;
277
+ tcStyle.width = `${column.renderWidth + mergeColWidth - cellOffsetWidth}px`;
275
278
  }
276
279
  if (scrollYLoad || hasEllipsis || isCsHeight || isRsHeight) {
277
280
  tcStyle.height = `${cellHeight}px`;
@@ -151,12 +151,26 @@ function renderHeaderCellBaseVNs(h, params, content) {
151
151
  ];
152
152
  return vns;
153
153
  }
154
+ function getRenderDefaultColumnTitle(h, column, content) {
155
+ if (column.type === 'html' && XEUtils.isString(content)) {
156
+ return h('span', {
157
+ key: 'ch',
158
+ domProps: {
159
+ innerHTML: content
160
+ }
161
+ });
162
+ }
163
+ return h('span', {
164
+ key: 'ct'
165
+ }, getSlotVNs(content));
166
+ }
154
167
  function renderTitleContent(h, params, content) {
155
168
  const { $table, column } = params;
156
- const { type, showHeaderOverflow } = column;
169
+ const { showHeaderOverflow } = column;
157
170
  const tableProps = $table;
158
171
  const tableReactData = $table;
159
172
  const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps;
173
+ const { isRowGroupStatus } = tableReactData;
160
174
  const tooltipOpts = $table.computeTooltipOpts;
161
175
  const showAllTip = tooltipOpts.showAll;
162
176
  const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
@@ -186,19 +200,13 @@ function renderTitleContent(h, params, content) {
186
200
  }
187
201
  };
188
202
  }
203
+ const titleVN = getRenderDefaultColumnTitle(h, column, content);
189
204
  return [
190
- type === 'html' && XEUtils.isString(content)
191
- ? h('span', {
192
- class: 'vxe-cell--title',
193
- domProps: {
194
- innerHTML: content
195
- },
196
- on: ons
197
- })
198
- : h('span', {
199
- class: 'vxe-cell--title',
200
- on: ons
201
- }, getSlotVNs(content))
205
+ h('span', Object.assign({ class: 'vxe-cell--title' }, ons), isRowGroupStatus && column.aggFunc && $table.getPivotTableAggregateRenderColTitles
206
+ ? $table.getPivotTableAggregateRenderColTitles(h, column, titleVN)
207
+ : [
208
+ titleVN
209
+ ])
202
210
  ];
203
211
  }
204
212
  function getFooterContent(h, params) {
@@ -108,6 +108,7 @@ export class ColumnInfo {
108
108
  halfVisible: false,
109
109
  defaultVisible: visible,
110
110
  defaultFixed: _vm.fixed,
111
+ defaultAggFunc: _vm.aggFunc,
111
112
  checked: false,
112
113
  halfChecked: false,
113
114
  disabled: false,
@@ -167,7 +167,8 @@ function restoreCustomStorage($xeTable) {
167
167
  const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
168
168
  const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
169
169
  const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
170
- if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
170
+ const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
171
+ if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
171
172
  if (!tableId) {
172
173
  errLog('vxe.error.reqProp', ['id']);
173
174
  return;
@@ -2611,7 +2612,19 @@ function handleRecalculateLayout($xeTable, reFull) {
2611
2612
  }
2612
2613
  });
2613
2614
  }
2614
- const handleUpdateRowGroup = ($xeTable, groupFields) => {
2615
+ function handleUpdateAggValues($xeTable) {
2616
+ const reactData = $xeTable;
2617
+ const internalData = $xeTable;
2618
+ const { visibleColumn } = internalData;
2619
+ const aggCols = [];
2620
+ visibleColumn.forEach(column => {
2621
+ if (column.aggFunc) {
2622
+ aggCols.push(column);
2623
+ }
2624
+ });
2625
+ reactData.aggHandleAggColumns = aggCols;
2626
+ }
2627
+ function handleUpdateRowGroup($xeTable, groupFields) {
2615
2628
  const reactData = $xeTable;
2616
2629
  const aggFields = [];
2617
2630
  const aggConfs = [];
@@ -2625,7 +2638,8 @@ const handleUpdateRowGroup = ($xeTable, groupFields) => {
2625
2638
  }
2626
2639
  reactData.rowGroupList = aggConfs;
2627
2640
  reactData.aggHandleFields = aggFields;
2628
- };
2641
+ handleUpdateAggValues($xeTable);
2642
+ }
2629
2643
  function handleeGroupSummary($xeTable, aggList) {
2630
2644
  const aggregateOpts = $xeTable.computeAggregateOpts;
2631
2645
  const { mapChildrenField } = aggregateOpts;
@@ -3121,6 +3135,7 @@ function parseColumns($xeTable, isReset) {
3121
3135
  }
3122
3136
  });
3123
3137
  handleTableColumn($xeTable);
3138
+ handleUpdateAggValues($xeTable);
3124
3139
  if (isReset) {
3125
3140
  return $xeTable.updateFooter().then(() => {
3126
3141
  return $xeTable.recalculate();
@@ -4954,15 +4969,18 @@ const Methods = {
4954
4969
  const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
4955
4970
  const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
4956
4971
  const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
4972
+ const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
4957
4973
  const resizableData = {};
4958
4974
  const sortData = {};
4959
4975
  const visibleData = {};
4960
4976
  const fixedData = {};
4977
+ const aggFuncData = {};
4961
4978
  const storeData = {
4962
4979
  resizableData: undefined,
4963
4980
  sortData: undefined,
4964
4981
  visibleData: undefined,
4965
- fixedData: undefined
4982
+ fixedData: undefined,
4983
+ aggFuncData: undefined
4966
4984
  };
4967
4985
  if (!id) {
4968
4986
  if (storage) {
@@ -4974,6 +4992,7 @@ const Methods = {
4974
4992
  let hasSort = 0;
4975
4993
  let hasFixed = 0;
4976
4994
  let hasVisible = 0;
4995
+ let hasAggFunc = 0;
4977
4996
  XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
4978
4997
  const colKey = column.getKey();
4979
4998
  if (!colKey) {
@@ -5005,6 +5024,10 @@ const Methods = {
5005
5024
  visibleData[colKey] = true;
5006
5025
  }
5007
5026
  }
5027
+ if (isCustomAggFunc && column.aggFunc !== column.defaultAggFunc) {
5028
+ hasAggFunc = 1;
5029
+ aggFuncData[colKey] = column.aggFunc;
5030
+ }
5008
5031
  });
5009
5032
  if (hasResizable) {
5010
5033
  storeData.resizableData = resizableData;
@@ -5018,6 +5041,9 @@ const Methods = {
5018
5041
  if (hasVisible) {
5019
5042
  storeData.visibleData = visibleData;
5020
5043
  }
5044
+ if (hasAggFunc) {
5045
+ storeData.aggFuncData = aggFuncData;
5046
+ }
5021
5047
  return storeData;
5022
5048
  },
5023
5049
  saveCustomStore(type) {
@@ -5027,17 +5053,18 @@ const Methods = {
5027
5053
  const { customConfig } = props;
5028
5054
  const tableId = $xeTable.computeTableId;
5029
5055
  const customOpts = $xeTable.computeCustomOpts;
5030
- const { updateStore, storage } = customOpts;
5056
+ const { updateStore, storage, storeOptions } = customOpts;
5031
5057
  const isAllCustom = storage === true;
5032
- const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
5033
- const isCustomResizable = isAllCustom || storageOpts.resizable;
5034
- const isCustomVisible = isAllCustom || storageOpts.visible;
5035
- const isCustomFixed = isAllCustom || storageOpts.fixed;
5036
- const isCustomSort = isAllCustom || storageOpts.sort;
5058
+ const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
5059
+ const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
5060
+ const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
5061
+ const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
5062
+ const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
5063
+ const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
5037
5064
  if (type !== 'reset') {
5038
5065
  reactData.isCustomStatus = true;
5039
5066
  }
5040
- if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
5067
+ if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
5041
5068
  if (!tableId) {
5042
5069
  errLog('vxe.error.reqProp', ['id']);
5043
5070
  return this.$nextTick();
@@ -5722,9 +5749,10 @@ const Methods = {
5722
5749
  const $xeGrid = $xeTable.$xeGrid;
5723
5750
  const { $el, $refs, $toolbar, mouseConfig, editStore, ctxMenuStore, editRules, editOpts, validOpts, areaOpts, filterStore, customStore, getRowNode } = this;
5724
5751
  const { actived } = editStore;
5725
- const { customWrapper, refValidTooltip } = $refs;
5726
5752
  const tableFilter = $refs.refTableFilter;
5727
5753
  const tableMenu = $refs.refTableMenu;
5754
+ const tableCustom = $refs.refTableCustom;
5755
+ const validTooltip = $refs.refValidTooltip;
5728
5756
  // 筛选
5729
5757
  if (tableFilter) {
5730
5758
  if (getEventTargetNode(evnt, $el, 'vxe-cell--filter').flag) {
@@ -5740,11 +5768,11 @@ const Methods = {
5740
5768
  }
5741
5769
  }
5742
5770
  // 自定义列
5743
- if (customWrapper) {
5771
+ if (tableCustom) {
5744
5772
  if (customStore.btnEl === evnt.target || getEventTargetNode(evnt, document.body, 'vxe-toolbar-custom-target').flag) {
5745
5773
  // 如果点击了自定义列按钮
5746
5774
  }
5747
- else if (getEventTargetNode(evnt, customWrapper.$el).flag) {
5775
+ else if (getEventTargetNode(evnt, tableCustom.$el).flag) {
5748
5776
  // 如果点击自定义列容器
5749
5777
  }
5750
5778
  else {
@@ -5759,7 +5787,7 @@ const Methods = {
5759
5787
  // 如果是激活状态,点击了单元格之外
5760
5788
  const cell = actived.args.cell;
5761
5789
  if ((!cell || !getEventTargetNode(evnt, cell).flag)) {
5762
- if (refValidTooltip && getEventTargetNode(evnt, refValidTooltip.$el).flag) {
5790
+ if (validTooltip && getEventTargetNode(evnt, validTooltip.$el).flag) {
5763
5791
  // 如果是激活状态,且点击了校验提示框
5764
5792
  }
5765
5793
  else if (!this.lastCallTime || this.lastCallTime + 50 < Date.now()) {
@@ -8860,12 +8888,24 @@ const Methods = {
8860
8888
  const props = $xeTable;
8861
8889
  const internalData = $xeTable;
8862
8890
  const { aggregateConfig, rowGroupConfig } = props;
8891
+ const aggregateOpts = $xeTable.computeAggregateOpts;
8892
+ const { maxGroupSize } = aggregateOpts;
8863
8893
  if (!(aggregateConfig || rowGroupConfig)) {
8864
8894
  errLog('vxe.error.reqProp', ['aggregate-config']);
8865
8895
  return $xeTable.$nextTick();
8866
8896
  }
8867
- if (fieldOrColumns) {
8868
- handleUpdateRowGroup($xeTable, (XEUtils.isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns]).map(fieldOrColumn => {
8897
+ const confList = fieldOrColumns ? (XEUtils.isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns]) : [];
8898
+ if (maxGroupSize && confList.length > maxGroupSize) {
8899
+ if (VxeUI.modal) {
8900
+ VxeUI.modal.message({
8901
+ status: 'error',
8902
+ content: getI18n('vxe.table.maxGroupCol', [maxGroupSize])
8903
+ });
8904
+ }
8905
+ return $xeTable.$nextTick();
8906
+ }
8907
+ if (confList.length) {
8908
+ handleUpdateRowGroup($xeTable, confList.map(fieldOrColumn => {
8869
8909
  return XEUtils.isString(fieldOrColumn) ? fieldOrColumn : fieldOrColumn.field;
8870
8910
  }));
8871
8911
  return loadTableData($xeTable, internalData.tableSynchData, true);
@@ -10243,6 +10283,11 @@ const Methods = {
10243
10283
  return updateStyle($xeTable);
10244
10284
  });
10245
10285
  },
10286
+ handleUpdateAggData() {
10287
+ const $xeTable = this;
10288
+ const internalData = $xeTable;
10289
+ return loadTableData($xeTable, internalData.tableSynchData, true);
10290
+ },
10246
10291
  updateZindex() {
10247
10292
  if (this.zIndex) {
10248
10293
  this.tZindex = this.zIndex;
@@ -647,6 +647,7 @@ export default {
647
647
  isRowGroupStatus: false,
648
648
  rowGroupList: [],
649
649
  aggHandleFields: [],
650
+ aggHandleAggColumns: [],
650
651
  rowGroupExpandedFlag: 1,
651
652
  rowExpandedFlag: 1,
652
653
  treeExpandedFlag: 1,
@@ -1571,6 +1572,16 @@ export default {
1571
1572
  return;
1572
1573
  }
1573
1574
  }
1575
+ if (!$xeTable.handlePivotTableAggregateData) {
1576
+ if (customOpts.allowGroup) {
1577
+ errLog('vxe.error.notProp', ['custom-config.allowGroup']);
1578
+ return;
1579
+ }
1580
+ if (customOpts.allowValues) {
1581
+ errLog('vxe.error.notProp', ['custom-config.allowValues']);
1582
+ return;
1583
+ }
1584
+ }
1574
1585
  if (treeConfig && rowOpts.drag && !treeOpts.transform) {
1575
1586
  warnLog('vxe.error.notSupportProp', ['column-config.drag', 'tree-config.transform=false', 'tree-config.transform=true']);
1576
1587
  }
@@ -1583,8 +1594,8 @@ export default {
1583
1594
  if (aggregateOpts.countFields) {
1584
1595
  warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func']);
1585
1596
  }
1586
- if (aggregateOpts.countMethod) {
1587
- warnLog('vxe.error.delProp', ['row-group-config.countMethod', 'aggregate-config.aggregateMethod']);
1597
+ if (aggregateOpts.aggregateMethod) {
1598
+ warnLog('vxe.error.delProp', ['row-group-config.aggregateMethod', 'aggregate-config.countMethod']);
1588
1599
  }
1589
1600
  if (props.treeConfig && treeOpts.children) {
1590
1601
  warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField']);
@@ -1986,7 +1997,7 @@ export default {
1986
1997
  initStore.custom
1987
1998
  ? h(TableCustomPanelComponent, {
1988
1999
  key: 'cs',
1989
- ref: 'customWrapper',
2000
+ ref: 'refTableCustom',
1990
2001
  props: {
1991
2002
  customStore
1992
2003
  }
@@ -999,13 +999,17 @@
999
999
 
1000
1000
  .vxe-table-custom-popup--body-wrapper {
1001
1001
  position: relative;
1002
- overflow: auto;
1002
+ display: flex;
1003
+ flex-direction: column;
1004
+ overflow: hidden;
1003
1005
  height: 100%;
1004
1006
  outline: 0;
1005
1007
  }
1006
1008
 
1007
1009
  .vxe-table-custom-popup--handle-wrapper {
1010
+ flex-grow: 1;
1008
1011
  outline: 0;
1012
+ overflow: auto;
1009
1013
  }
1010
1014
 
1011
1015
  .vxe-table-custom-popup--table-wrapper {