vxe-table 3.15.4 → 3.15.6

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 +3 -2
  4. package/es/locale/lang/de-DE.js +3 -2
  5. package/es/locale/lang/en-US.js +2 -1
  6. package/es/locale/lang/es-ES.js +3 -2
  7. package/es/locale/lang/fr-FR.js +2 -1
  8. package/es/locale/lang/hu-HU.js +2 -1
  9. package/es/locale/lang/hy-AM.js +2 -1
  10. package/es/locale/lang/id-ID.js +2 -1
  11. package/es/locale/lang/it-IT.js +2 -1
  12. package/es/locale/lang/ja-JP.js +2 -1
  13. package/es/locale/lang/ko-KR.js +2 -1
  14. package/es/locale/lang/nb-NO.js +2 -1
  15. package/es/locale/lang/pt-BR.js +2 -1
  16. package/es/locale/lang/ru-RU.js +2 -1
  17. package/es/locale/lang/th-TH.js +2 -1
  18. package/es/locale/lang/ug-CN.js +2 -1
  19. package/es/locale/lang/uk-UA.js +2 -1
  20. package/es/locale/lang/vi-VN.js +2 -1
  21. package/es/locale/lang/zh-CHT.js +2 -1
  22. package/es/locale/lang/zh-CN.js +2 -1
  23. package/es/style.css +1 -1
  24. package/es/style.min.css +1 -1
  25. package/es/table/module/custom/mixin.js +62 -37
  26. package/es/table/module/custom/panel.js +7 -7
  27. package/es/table/module/export/mixin.js +13 -12
  28. package/es/table/module/keyboard/mixin.js +3 -2
  29. package/es/table/src/body.js +49 -16
  30. package/es/table/src/cell.js +137 -45
  31. package/es/table/src/column.js +2 -0
  32. package/es/table/src/columnInfo.js +1 -0
  33. package/es/table/src/methods.js +979 -497
  34. package/es/table/src/props.js +9 -7
  35. package/es/table/src/table.js +108 -35
  36. package/es/table/style.css +71 -41
  37. package/es/table/style.min.css +1 -1
  38. package/es/ui/index.js +13 -1
  39. package/es/ui/src/dom.js +3 -0
  40. package/es/ui/src/log.js +1 -1
  41. package/es/vxe-table/style.css +71 -41
  42. package/es/vxe-table/style.min.css +1 -1
  43. package/lib/index.css +1 -1
  44. package/lib/index.min.css +1 -1
  45. package/lib/index.umd.js +1730 -860
  46. package/lib/index.umd.min.js +1 -1
  47. package/lib/locale/lang/ar-EG.js +3 -2
  48. package/lib/locale/lang/ar-EG.min.js +1 -1
  49. package/lib/locale/lang/de-DE.js +3 -2
  50. package/lib/locale/lang/de-DE.min.js +1 -1
  51. package/lib/locale/lang/en-US.js +2 -1
  52. package/lib/locale/lang/en-US.min.js +1 -1
  53. package/lib/locale/lang/en-US.umd.js +2 -1
  54. package/lib/locale/lang/es-ES.js +3 -2
  55. package/lib/locale/lang/es-ES.min.js +1 -1
  56. package/lib/locale/lang/es-ES.umd.js +3 -2
  57. package/lib/locale/lang/fr-FR.js +2 -1
  58. package/lib/locale/lang/fr-FR.min.js +1 -1
  59. package/lib/locale/lang/hu-HU.js +2 -1
  60. package/lib/locale/lang/hu-HU.min.js +1 -1
  61. package/lib/locale/lang/hu-HU.umd.js +2 -1
  62. package/lib/locale/lang/hy-AM.js +2 -1
  63. package/lib/locale/lang/hy-AM.min.js +1 -1
  64. package/lib/locale/lang/id-ID.js +2 -1
  65. package/lib/locale/lang/id-ID.min.js +1 -1
  66. package/lib/locale/lang/it-IT.js +2 -1
  67. package/lib/locale/lang/it-IT.min.js +1 -1
  68. package/lib/locale/lang/ja-JP.js +2 -1
  69. package/lib/locale/lang/ja-JP.min.js +1 -1
  70. package/lib/locale/lang/ja-JP.umd.js +2 -1
  71. package/lib/locale/lang/ko-KR.js +2 -1
  72. package/lib/locale/lang/ko-KR.min.js +1 -1
  73. package/lib/locale/lang/ko-KR.umd.js +2 -1
  74. package/lib/locale/lang/nb-NO.js +2 -1
  75. package/lib/locale/lang/nb-NO.min.js +1 -1
  76. package/lib/locale/lang/pt-BR.js +2 -1
  77. package/lib/locale/lang/pt-BR.min.js +1 -1
  78. package/lib/locale/lang/pt-BR.umd.js +2 -1
  79. package/lib/locale/lang/ru-RU.js +2 -1
  80. package/lib/locale/lang/ru-RU.min.js +1 -1
  81. package/lib/locale/lang/ru-RU.umd.js +2 -1
  82. package/lib/locale/lang/th-TH.js +2 -1
  83. package/lib/locale/lang/th-TH.min.js +1 -1
  84. package/lib/locale/lang/ug-CN.js +2 -1
  85. package/lib/locale/lang/ug-CN.min.js +1 -1
  86. package/lib/locale/lang/uk-UA.js +2 -1
  87. package/lib/locale/lang/uk-UA.min.js +1 -1
  88. package/lib/locale/lang/uk-UA.umd.js +2 -1
  89. package/lib/locale/lang/vi-VN.js +2 -1
  90. package/lib/locale/lang/vi-VN.min.js +1 -1
  91. package/lib/locale/lang/zh-CHT.js +2 -1
  92. package/lib/locale/lang/zh-CHT.min.js +1 -1
  93. package/lib/locale/lang/zh-CHT.umd.js +2 -1
  94. package/lib/locale/lang/zh-CN.js +2 -1
  95. package/lib/locale/lang/zh-CN.min.js +1 -1
  96. package/lib/locale/lang/zh-CN.umd.js +2 -1
  97. package/lib/style.css +1 -1
  98. package/lib/style.min.css +1 -1
  99. package/lib/table/module/custom/mixin.js +74 -48
  100. package/lib/table/module/custom/mixin.min.js +1 -1
  101. package/lib/table/module/custom/panel.js +6 -2
  102. package/lib/table/module/custom/panel.min.js +1 -1
  103. package/lib/table/module/export/mixin.js +13 -5
  104. package/lib/table/module/export/mixin.min.js +1 -1
  105. package/lib/table/module/keyboard/mixin.js +2 -1
  106. package/lib/table/module/keyboard/mixin.min.js +1 -1
  107. package/lib/table/src/body.js +39 -15
  108. package/lib/table/src/body.min.js +1 -1
  109. package/lib/table/src/cell.js +157 -36
  110. package/lib/table/src/cell.min.js +1 -1
  111. package/lib/table/src/column.js +2 -0
  112. package/lib/table/src/column.min.js +1 -1
  113. package/lib/table/src/columnInfo.js +1 -0
  114. package/lib/table/src/columnInfo.min.js +1 -1
  115. package/lib/table/src/methods.js +1159 -564
  116. package/lib/table/src/methods.min.js +1 -1
  117. package/lib/table/src/props.js +9 -7
  118. package/lib/table/src/props.min.js +1 -1
  119. package/lib/table/src/table.js +104 -34
  120. package/lib/table/src/table.min.js +1 -1
  121. package/lib/table/style/style.css +71 -41
  122. package/lib/table/style/style.min.css +1 -1
  123. package/lib/ui/index.js +13 -1
  124. package/lib/ui/index.min.js +1 -1
  125. package/lib/ui/src/dom.js +4 -0
  126. package/lib/ui/src/dom.min.js +1 -1
  127. package/lib/ui/src/log.js +1 -1
  128. package/lib/ui/src/log.min.js +1 -1
  129. package/lib/vxe-table/style/style.css +71 -41
  130. package/lib/vxe-table/style/style.min.css +1 -1
  131. package/package.json +2 -2
  132. package/packages/locale/lang/ar-EG.ts +3 -2
  133. package/packages/locale/lang/de-DE.ts +3 -2
  134. package/packages/locale/lang/en-US.ts +2 -1
  135. package/packages/locale/lang/es-ES.ts +3 -2
  136. package/packages/locale/lang/fr-FR.ts +2 -1
  137. package/packages/locale/lang/hu-HU.ts +2 -1
  138. package/packages/locale/lang/hy-AM.ts +2 -1
  139. package/packages/locale/lang/id-ID.ts +2 -1
  140. package/packages/locale/lang/it-IT.ts +2 -1
  141. package/packages/locale/lang/ja-JP.ts +2 -1
  142. package/packages/locale/lang/ko-KR.ts +2 -1
  143. package/packages/locale/lang/nb-NO.ts +2 -1
  144. package/packages/locale/lang/pt-BR.ts +2 -1
  145. package/packages/locale/lang/ru-RU.ts +2 -1
  146. package/packages/locale/lang/th-TH.ts +2 -1
  147. package/packages/locale/lang/ug-CN.ts +2 -1
  148. package/packages/locale/lang/uk-UA.ts +2 -1
  149. package/packages/locale/lang/vi-VN.ts +2 -1
  150. package/packages/locale/lang/zh-CHT.ts +2 -1
  151. package/packages/locale/lang/zh-CN.ts +2 -1
  152. package/packages/table/module/custom/mixin.ts +85 -51
  153. package/packages/table/module/custom/panel.ts +8 -8
  154. package/packages/table/module/export/mixin.ts +19 -18
  155. package/packages/table/module/keyboard/mixin.ts +3 -2
  156. package/packages/table/src/body.ts +50 -17
  157. package/packages/table/src/cell.ts +136 -45
  158. package/packages/table/src/column.ts +2 -0
  159. package/packages/table/src/columnInfo.ts +1 -0
  160. package/packages/table/src/methods.ts +1012 -514
  161. package/packages/table/src/props.ts +9 -7
  162. package/packages/table/src/table.ts +122 -38
  163. package/packages/ui/index.ts +12 -0
  164. package/packages/ui/src/dom.ts +4 -0
  165. package/styles/components/table.scss +133 -93
  166. /package/es/{iconfont.1744768256934.ttf → iconfont.1745197894601.ttf} +0 -0
  167. /package/es/{iconfont.1744768256934.woff → iconfont.1745197894601.woff} +0 -0
  168. /package/es/{iconfont.1744768256934.woff2 → iconfont.1745197894601.woff2} +0 -0
  169. /package/lib/{iconfont.1744768256934.ttf → iconfont.1745197894601.ttf} +0 -0
  170. /package/lib/{iconfont.1744768256934.woff → iconfont.1745197894601.woff} +0 -0
  171. /package/lib/{iconfont.1744768256934.woff2 → iconfont.1745197894601.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.15.4";
2223
+ const version = "3.15.6";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2347,7 +2347,17 @@ core_.VxeUI.setConfig({
2347
2347
  // isEvery: false,
2348
2348
  showIcon: true
2349
2349
  },
2350
+ rowGroupConfig: {
2351
+ padding: true,
2352
+ rowField: 'id',
2353
+ parentField: '_X_ROW_PARENT_KEY',
2354
+ childrenField: '_X_ROW_CHILDREN',
2355
+ mapChildrenField: '_X_ROW_CHILD_LIST',
2356
+ indent: 20,
2357
+ showIcon: true
2358
+ },
2350
2359
  treeConfig: {
2360
+ padding: true,
2351
2361
  rowField: 'id',
2352
2362
  parentField: 'parentId',
2353
2363
  childrenField: 'children',
@@ -2507,6 +2517,8 @@ core_.VxeUI.setIcon({
2507
2517
  TABLE_DRAG_STATUS_SUB_ROW: iconPrefix + 'add-sub',
2508
2518
  TABLE_DRAG_STATUS_COLUMN: iconPrefix + 'swap',
2509
2519
  TABLE_DRAG_DISABLED: iconPrefix + 'no-drop',
2520
+ TABLE_ROW_GROUP_OPEN: iconPrefix + 'arrow-right rotate90',
2521
+ TABLE_ROW_GROUP_CLOSE: iconPrefix + 'arrow-right',
2510
2522
  // toolbar
2511
2523
  TOOLBAR_TOOLS_REFRESH: iconPrefix + 'repeat',
2512
2524
  TOOLBAR_TOOLS_REFRESH_LOADING: iconPrefix + 'repeat roll',
@@ -2719,6 +2731,9 @@ function addClass(elem, cls) {
2719
2731
  elem.className = `${elem.className} ${cls}`;
2720
2732
  }
2721
2733
  }
2734
+ function hasControlKey(evnt) {
2735
+ return evnt.ctrlKey || evnt.metaKey;
2736
+ }
2722
2737
  function toCssUnit(val, unit = 'px') {
2723
2738
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(val) || /^\d+$/.test(`${val}`)) {
2724
2739
  return `${val}${unit}`;
@@ -2843,7 +2858,7 @@ function isNodeElement(elem) {
2843
2858
  const {
2844
2859
  log: log_log
2845
2860
  } = core_.VxeUI;
2846
- const log_version = `table v${"3.15.4"}`;
2861
+ const log_version = `table v${"3.15.6"}`;
2847
2862
  const warnLog = log_log.create('warn', log_version);
2848
2863
  const errLog = log_log.create('error', log_version);
2849
2864
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -2941,6 +2956,7 @@ class ColumnInfo {
2941
2956
  filterResetMethod: _vm.filterResetMethod,
2942
2957
  filterRecoverMethod: _vm.filterRecoverMethod,
2943
2958
  filterRender: _vm.filterRender,
2959
+ rowGroupNode: _vm.rowGroupNode,
2944
2960
  treeNode: _vm.treeNode,
2945
2961
  dragSort: _vm.dragSort,
2946
2962
  rowResize: _vm.rowResize,
@@ -3751,7 +3767,7 @@ function renderCellBaseVNs(h, params, content) {
3751
3767
  visibleMethod
3752
3768
  } = rowDragOpts;
3753
3769
  const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null);
3754
- const vns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(content) ? content : [content];
3770
+ const vns = [];
3755
3771
  if (dragSort && rowOpts.drag && (showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params))) {
3756
3772
  if (treeConfig) {
3757
3773
  if (treeOpts.transform && (isPeerDrag || isCrossDrag || !level)) {
@@ -3761,7 +3777,7 @@ function renderCellBaseVNs(h, params, content) {
3761
3777
  vns.unshift(renderCellDragIcon(h, params));
3762
3778
  }
3763
3779
  }
3764
- return vns;
3780
+ return vns.concat(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(content) ? content : [content]);
3765
3781
  }
3766
3782
  function renderHeaderCellDragIcon(h, params) {
3767
3783
  const {
@@ -3935,26 +3951,28 @@ function renderCellHandle(h, params) {
3935
3951
  const {
3936
3952
  type,
3937
3953
  treeNode,
3954
+ rowGroupNode,
3938
3955
  editRender
3939
3956
  } = column;
3940
3957
  const checkboxOpts = $table.computeCheckboxOpts;
3941
3958
  const editOpts = $table.computeEditOpts;
3959
+ const isDeepCell = treeNode || rowGroupNode;
3942
3960
  switch (type) {
3943
3961
  case 'seq':
3944
- return treeNode ? Cell.renderTreeIndexCell(h, params) : Cell.renderSeqCell(h, params);
3962
+ return isDeepCell ? Cell.renderDeepIndexCell(h, params) : Cell.renderSeqCell(h, params);
3945
3963
  case 'radio':
3946
- return treeNode ? Cell.renderTreeRadioCell(h, params) : Cell.renderRadioCell(h, params);
3964
+ return isDeepCell ? Cell.renderDeepRadioCell(h, params) : Cell.renderRadioCell(h, params);
3947
3965
  case 'checkbox':
3948
- return checkboxOpts.checkField ? treeNode ? Cell.renderTreeSelectionCellByProp(h, params) : Cell.renderCheckboxCellByProp(h, params) : treeNode ? Cell.renderTreeSelectionCell(h, params) : Cell.renderCheckboxCell(h, params);
3966
+ return checkboxOpts.checkField ? isDeepCell ? Cell.renderDeepSelectionCellByProp(h, params) : Cell.renderCheckboxCellByProp(h, params) : isDeepCell ? Cell.renderDeepSelectionCell(h, params) : Cell.renderCheckboxCell(h, params);
3949
3967
  case 'expand':
3950
3968
  return Cell.renderExpandCell(h, params);
3951
3969
  case 'html':
3952
- return treeNode ? Cell.renderTreeHTMLCell(h, params) : Cell.renderHTMLCell(h, params);
3970
+ return isDeepCell ? Cell.renderDeepHTMLCell(h, params) : Cell.renderHTMLCell(h, params);
3953
3971
  }
3954
3972
  if (isEnableConf(editConfig) && editRender) {
3955
- return editOpts.mode === 'cell' ? treeNode ? Cell.renderTreeCellEdit(h, params) : Cell.renderCellEdit(h, params) : treeNode ? Cell.renderTreeRowEdit(h, params) : Cell.renderRowEdit(h, params);
3973
+ return editOpts.mode === 'cell' ? isDeepCell ? Cell.renderDeepCellEdit(h, params) : Cell.renderCellEdit(h, params) : isDeepCell ? Cell.renderDeepRowEdit(h, params) : Cell.renderRowEdit(h, params);
3956
3974
  }
3957
- return treeNode ? Cell.renderTreeCell(h, params) : Cell.renderDefaultCell(h, params);
3975
+ return isDeepCell ? Cell.renderDeepCell(h, params) : Cell.renderDefaultCell(h, params);
3958
3976
  }
3959
3977
  function renderHeaderHandle(h, params) {
3960
3978
  const {
@@ -4052,10 +4070,16 @@ const Cell = {
4052
4070
  row,
4053
4071
  column
4054
4072
  } = params;
4073
+ const tableReactData = $table;
4074
+ const tableInternalData = $table;
4075
+ const {
4076
+ isRowGroupStatus
4077
+ } = tableReactData;
4055
4078
  const {
4056
4079
  slots,
4057
4080
  editRender,
4058
- cellRender
4081
+ cellRender,
4082
+ rowGroupNode
4059
4083
  } = column;
4060
4084
  const renderOpts = editRender || cellRender;
4061
4085
  if (slots && slots.default) {
@@ -4072,7 +4096,41 @@ const Cell = {
4072
4096
  }, params))));
4073
4097
  }
4074
4098
  }
4075
- const cellValue = $table.getCellLabel(row, column);
4099
+ let cellValue = '';
4100
+ if (isRowGroupStatus && rowGroupNode && row.isAggregate) {
4101
+ const {
4102
+ fullColumnFieldData
4103
+ } = tableInternalData;
4104
+ const rowGroupOpts = $table.computeRowGroupOpts;
4105
+ const {
4106
+ showTotal,
4107
+ totalMethod,
4108
+ contentMethod,
4109
+ mapChildrenField
4110
+ } = rowGroupOpts;
4111
+ const groupField = row.groupField;
4112
+ cellValue = row.groupContent;
4113
+ const childList = mapChildrenField ? row[mapChildrenField] || [] : [];
4114
+ const totalValue = childList.length;
4115
+ const colRest = fullColumnFieldData[groupField] || {};
4116
+ const params = {
4117
+ $table,
4118
+ groupField,
4119
+ groupColumn: colRest ? colRest.column : null,
4120
+ column,
4121
+ groupValue: cellValue,
4122
+ children: childList,
4123
+ totalValue: totalValue
4124
+ };
4125
+ if (contentMethod) {
4126
+ cellValue = `${contentMethod(params)}`;
4127
+ }
4128
+ if (showTotal) {
4129
+ cellValue = cell_getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(params) : totalValue, totalValue]);
4130
+ }
4131
+ } else if (!(isRowGroupStatus && row.isAggregate)) {
4132
+ cellValue = $table.getCellLabel(row, column);
4133
+ }
4076
4134
  const cellPlaceholder = editRender ? editRender.placeholder : '';
4077
4135
  return renderCellBaseVNs(h, params, [h('span', {
4078
4136
  class: 'vxe-cell--label'
@@ -4082,16 +4140,62 @@ const Cell = {
4082
4140
  class: 'vxe-cell--placeholder'
4083
4141
  }, formatText(getFuncText(cellPlaceholder), 1)) : h('span', formatText(cellValue, 1))])]);
4084
4142
  },
4085
- renderTreeCell(h, params) {
4086
- return Cell.renderTreeIcon(h, params, Cell.renderDefaultCell.call(this, h, params));
4143
+ renderDeepCell(h, params) {
4144
+ return Cell.renderDeepNodeBtn(h, params, Cell.renderDefaultCell.call(this, h, params));
4087
4145
  },
4088
4146
  renderDefaultFooter(h, params) {
4089
4147
  return getFooterContent(h, params);
4090
4148
  },
4091
4149
  /**
4092
- * 树节点
4150
+ * 行分组
4151
+ */
4152
+ renderRowGroupBtn(h, params, cellVNodes) {
4153
+ const {
4154
+ $table
4155
+ } = params;
4156
+ const tableReactData = $table;
4157
+ const tableInternalData = $table;
4158
+ const {
4159
+ row,
4160
+ level
4161
+ } = params;
4162
+ const {
4163
+ rowGroupExpandedFlag
4164
+ } = tableReactData;
4165
+ const {
4166
+ rowGroupExpandedMaps
4167
+ } = tableInternalData;
4168
+ const rowGroupOpts = $table.computeRowGroupOpts;
4169
+ const {
4170
+ padding,
4171
+ indent
4172
+ } = rowGroupOpts;
4173
+ const rowid = getRowid($table, row);
4174
+ const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
4175
+ return h('div', {
4176
+ class: ['vxe-row-group--tree-node', {
4177
+ 'is--expanded': isExpand
4178
+ }],
4179
+ style: padding && indent ? {
4180
+ paddingLeft: `${level * indent}px`
4181
+ } : undefined
4182
+ }, [h('span', {
4183
+ class: 'vxe-row-group--node-btn',
4184
+ on: {
4185
+ click(evnt) {
4186
+ $table.triggerRowGroupExpandEvent(evnt, params);
4187
+ }
4188
+ }
4189
+ }, [h('i', {
4190
+ class: isExpand ? cell_getIcon().TABLE_ROW_GROUP_OPEN : cell_getIcon().TABLE_ROW_GROUP_CLOSE
4191
+ })]), h('div', {
4192
+ class: 'vxe-row-group-cell'
4193
+ }, cellVNodes)]);
4194
+ },
4195
+ /**
4196
+ * 树
4093
4197
  */
4094
- renderTreeIcon(h, params, cellVNodes) {
4198
+ renderTreeNodeBtn(h, params, cellVNodes) {
4095
4199
  const {
4096
4200
  $table,
4097
4201
  isHidden
@@ -4116,6 +4220,7 @@ const Cell = {
4116
4220
  slots
4117
4221
  } = column;
4118
4222
  const {
4223
+ padding,
4119
4224
  indent,
4120
4225
  lazy,
4121
4226
  trigger,
@@ -4156,18 +4261,35 @@ const Cell = {
4156
4261
  class: ['vxe-cell--tree-node', {
4157
4262
  'is--active': isActive
4158
4263
  }],
4159
- style: {
4264
+ style: padding && indent ? {
4160
4265
  paddingLeft: `${level * indent}px`
4161
- }
4266
+ } : undefined
4162
4267
  }, [showIcon && (lazy ? isLazyLoaded ? hasChild : hasChild || hasLazyChilds : hasChild) ? [h('div', {
4163
- class: 'vxe-tree--btn-wrapper',
4268
+ class: 'vxe-cell--tree-btn',
4164
4269
  on: ons
4165
4270
  }, [h('i', {
4166
- class: ['vxe-tree--node-btn', isLazyLoading ? iconLoaded || cell_getIcon().TABLE_TREE_LOADED : isActive ? iconOpen || cell_getIcon().TABLE_TREE_OPEN : iconClose || cell_getIcon().TABLE_TREE_CLOSE]
4271
+ class: isLazyLoading ? iconLoaded || cell_getIcon().TABLE_TREE_LOADED : isActive ? iconOpen || cell_getIcon().TABLE_TREE_OPEN : iconClose || cell_getIcon().TABLE_TREE_CLOSE
4167
4272
  })])] : null, h('div', {
4168
4273
  class: 'vxe-tree-cell'
4169
4274
  }, cellVNodes)])];
4170
4275
  },
4276
+ /**
4277
+ * 层级节点。
4278
+ * 行分组、树结构
4279
+ */
4280
+ renderDeepNodeBtn(h, params, cellVNodes) {
4281
+ const {
4282
+ row,
4283
+ column
4284
+ } = params;
4285
+ const {
4286
+ rowGroupNode
4287
+ } = column;
4288
+ if (rowGroupNode && row.isAggregate) {
4289
+ return [Cell.renderRowGroupBtn(h, params, cellVNodes)];
4290
+ }
4291
+ return [Cell.renderTreeNodeBtn(h, params, cellVNodes)];
4292
+ },
4171
4293
  /**
4172
4294
  * 序号
4173
4295
  */
@@ -4203,8 +4325,8 @@ const Cell = {
4203
4325
  const seqMethod = seqOpts.seqMethod;
4204
4326
  return renderCellBaseVNs(h, params, [h('span', `${formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)}`)]);
4205
4327
  },
4206
- renderTreeIndexCell(h, params) {
4207
- return Cell.renderTreeIcon(h, params, Cell.renderSeqCell(h, params));
4328
+ renderDeepIndexCell(h, params) {
4329
+ return Cell.renderDeepNodeBtn(h, params, Cell.renderSeqCell(h, params));
4208
4330
  },
4209
4331
  /**
4210
4332
  * 单选
@@ -4249,6 +4371,7 @@ const Cell = {
4249
4371
  const radioSlot = slots ? slots.radio : null;
4250
4372
  const isChecked = row === selectRadioRow;
4251
4373
  const isVisible = !visibleMethod || visibleMethod({
4374
+ $table,
4252
4375
  row
4253
4376
  });
4254
4377
  let isDisabled = !!checkMethod;
@@ -4263,6 +4386,7 @@ const Cell = {
4263
4386
  };
4264
4387
  if (checkMethod) {
4265
4388
  isDisabled = !checkMethod({
4389
+ $table,
4266
4390
  row
4267
4391
  });
4268
4392
  }
@@ -4295,8 +4419,8 @@ const Cell = {
4295
4419
  on
4296
4420
  }, radioVNs)]);
4297
4421
  },
4298
- renderTreeRadioCell(h, params) {
4299
- return Cell.renderTreeIcon(h, params, Cell.renderRadioCell(h, params));
4422
+ renderDeepRadioCell(h, params) {
4423
+ return Cell.renderDeepNodeBtn(h, params, Cell.renderRadioCell(h, params));
4300
4424
  },
4301
4425
  /**
4302
4426
  * 多选
@@ -4377,7 +4501,8 @@ const Cell = {
4377
4501
  treeConfig
4378
4502
  } = tableProps;
4379
4503
  const {
4380
- updateCheckboxFlag
4504
+ updateCheckboxFlag,
4505
+ isRowGroupStatus
4381
4506
  } = tableReactData;
4382
4507
  const {
4383
4508
  selectCheckboxMaps,
@@ -4397,6 +4522,7 @@ const Cell = {
4397
4522
  let indeterminate = false;
4398
4523
  let isChecked = false;
4399
4524
  const isVisible = !visibleMethod || visibleMethod({
4525
+ $table,
4400
4526
  row
4401
4527
  });
4402
4528
  let isDisabled = !!checkMethod;
@@ -4411,10 +4537,11 @@ const Cell = {
4411
4537
  };
4412
4538
  if (checkMethod) {
4413
4539
  isDisabled = !checkMethod({
4540
+ $table,
4414
4541
  row
4415
4542
  });
4416
4543
  }
4417
- if (treeConfig) {
4544
+ if (treeConfig || isRowGroupStatus) {
4418
4545
  indeterminate = !!treeIndeterminateRowMaps[rowid];
4419
4546
  }
4420
4547
  }
@@ -4449,8 +4576,8 @@ const Cell = {
4449
4576
  on: ons
4450
4577
  }, checkVNs)]);
4451
4578
  },
4452
- renderTreeSelectionCell(h, params) {
4453
- return Cell.renderTreeIcon(h, params, Cell.renderCheckboxCell(h, params));
4579
+ renderDeepSelectionCell(h, params) {
4580
+ return Cell.renderDeepNodeBtn(h, params, Cell.renderCheckboxCell(h, params));
4454
4581
  },
4455
4582
  renderCheckboxCellByProp(h, params) {
4456
4583
  const {
@@ -4466,7 +4593,8 @@ const Cell = {
4466
4593
  treeConfig
4467
4594
  } = tableProps;
4468
4595
  const {
4469
- updateCheckboxFlag
4596
+ updateCheckboxFlag,
4597
+ isRowGroupStatus
4470
4598
  } = tableReactData;
4471
4599
  const {
4472
4600
  treeIndeterminateRowMaps
@@ -4487,6 +4615,7 @@ const Cell = {
4487
4615
  let isIndeterminate = false;
4488
4616
  let isChecked = false;
4489
4617
  const isVisible = !visibleMethod || visibleMethod({
4618
+ $table,
4490
4619
  row
4491
4620
  });
4492
4621
  let isDisabled = !!checkMethod;
@@ -4501,10 +4630,11 @@ const Cell = {
4501
4630
  };
4502
4631
  if (checkMethod) {
4503
4632
  isDisabled = !checkMethod({
4633
+ $table,
4504
4634
  row
4505
4635
  });
4506
4636
  }
4507
- if (treeConfig) {
4637
+ if (treeConfig || isRowGroupStatus) {
4508
4638
  isIndeterminate = !!treeIndeterminateRowMaps[rowid];
4509
4639
  }
4510
4640
  }
@@ -4539,8 +4669,8 @@ const Cell = {
4539
4669
  on: ons
4540
4670
  }, checkVNs)]);
4541
4671
  },
4542
- renderTreeSelectionCellByProp(h, params) {
4543
- return Cell.renderTreeIcon(h, params, Cell.renderCheckboxCellByProp(h, params));
4672
+ renderDeepSelectionCellByProp(h, params) {
4673
+ return Cell.renderDeepNodeBtn(h, params, Cell.renderCheckboxCellByProp(h, params));
4544
4674
  },
4545
4675
  /**
4546
4676
  * 展开行
@@ -4552,7 +4682,11 @@ const Cell = {
4552
4682
  row,
4553
4683
  column
4554
4684
  } = params;
4685
+ const tableReactData = $table;
4555
4686
  const tableInternalData = $table;
4687
+ const {
4688
+ isRowGroupStatus
4689
+ } = tableReactData;
4556
4690
  const {
4557
4691
  rowExpandedMaps,
4558
4692
  rowExpandLazyLoadedMaps
@@ -4574,6 +4708,9 @@ const Cell = {
4574
4708
  const iconSlot = slots ? slots.icon : null;
4575
4709
  let isActive = false;
4576
4710
  let isLazyLoading = false;
4711
+ if (isRowGroupStatus && row.isAggregate) {
4712
+ return renderCellBaseVNs(h, params, []);
4713
+ }
4577
4714
  if (iconSlot) {
4578
4715
  return renderCellBaseVNs(h, params, $table.callSlot(iconSlot, params, h));
4579
4716
  }
@@ -4644,8 +4781,8 @@ const Cell = {
4644
4781
  }
4645
4782
  })]);
4646
4783
  },
4647
- renderTreeHTMLCell(h, params) {
4648
- return Cell.renderTreeIcon(h, params, Cell.renderHTMLCell(h, params));
4784
+ renderDeepHTMLCell(h, params) {
4785
+ return Cell.renderDeepNodeBtn(h, params, Cell.renderHTMLCell(h, params));
4649
4786
  },
4650
4787
  /**
4651
4788
  * 排序和筛选
@@ -4806,8 +4943,8 @@ const Cell = {
4806
4943
  } = column;
4807
4944
  return Cell.runRenderer(h, params, this, isEnableConf(editRender) && actived && actived.row === params.row);
4808
4945
  },
4809
- renderTreeRowEdit(h, params) {
4810
- return Cell.renderTreeIcon(h, params, Cell.renderRowEdit(h, params));
4946
+ renderDeepRowEdit(h, params) {
4947
+ return Cell.renderDeepNodeBtn(h, params, Cell.renderRowEdit(h, params));
4811
4948
  },
4812
4949
  // 单元格编辑模式
4813
4950
  renderCellEdit(h, params) {
@@ -4827,8 +4964,8 @@ const Cell = {
4827
4964
  } = column;
4828
4965
  return Cell.runRenderer(h, params, this, isEnableConf(editRender) && actived && actived.row === params.row && actived.column === params.column);
4829
4966
  },
4830
- renderTreeCellEdit(h, params) {
4831
- return Cell.renderTreeIcon(h, params, Cell.renderCellEdit(h, params));
4967
+ renderDeepCellEdit(h, params) {
4968
+ return Cell.renderDeepNodeBtn(h, params, Cell.renderCellEdit(h, params));
4832
4969
  },
4833
4970
  runRenderer(h, params, _vm, isEdit) {
4834
4971
  const {
@@ -4967,6 +5104,8 @@ const columnProps = {
4967
5104
  filterRecoverMethod: Function,
4968
5105
  // 筛选模板配置项
4969
5106
  filterRender: Object,
5107
+ // 设置为分组节点
5108
+ rowGroupNode: Boolean,
4970
5109
  // 设置为树节点
4971
5110
  treeNode: Boolean,
4972
5111
  // 设置为拖拽排序
@@ -5343,6 +5482,7 @@ function restoreCustomStorage($xeTable) {
5343
5482
  const storeData = getCustomStorageMap(tableId);
5344
5483
  if (restoreStore) {
5345
5484
  return Promise.resolve(restoreStore({
5485
+ $table: $xeTable,
5346
5486
  id: tableId,
5347
5487
  type: 'restore',
5348
5488
  storeData
@@ -5386,6 +5526,7 @@ function cacheColumnMap($xeTable) {
5386
5526
  const rowOpts = $xeTable.computeRowOpts;
5387
5527
  const isGroup = collectColumn.some(hasChildrenList);
5388
5528
  let isAllOverflow = !!props.showOverflow;
5529
+ let rowGroupColumn;
5389
5530
  let expandColumn;
5390
5531
  let treeNodeColumn;
5391
5532
  let checkboxColumn;
@@ -5398,7 +5539,8 @@ function cacheColumnMap($xeTable) {
5398
5539
  field,
5399
5540
  fixed,
5400
5541
  type,
5401
- treeNode
5542
+ treeNode,
5543
+ rowGroupNode
5402
5544
  } = column;
5403
5545
  const rest = {
5404
5546
  $index: -1,
@@ -5434,7 +5576,16 @@ function cacheColumnMap($xeTable) {
5434
5576
  if (!treeNodeColumn) {
5435
5577
  treeNodeColumn = column;
5436
5578
  }
5437
- } else if (type === 'expand') {
5579
+ }
5580
+ if (rowGroupNode) {
5581
+ if (treeNodeColumn) {
5582
+ warnLog('vxe.error.colRepet', ['row-group-node', rowGroupNode]);
5583
+ }
5584
+ if (!rowGroupColumn) {
5585
+ rowGroupColumn = column;
5586
+ }
5587
+ }
5588
+ if (type === 'expand') {
5438
5589
  if (expandColumn) {
5439
5590
  warnLog('vxe.error.colRepet', ['type', type]);
5440
5591
  }
@@ -5485,6 +5636,7 @@ function cacheColumnMap($xeTable) {
5485
5636
  }
5486
5637
  }
5487
5638
  reactData.isGroup = isGroup;
5639
+ reactData.rowGroupColumn = rowGroupColumn;
5488
5640
  reactData.treeNodeColumn = treeNodeColumn;
5489
5641
  reactData.expandColumn = expandColumn;
5490
5642
  reactData.isAllOverflow = isAllOverflow;
@@ -5521,7 +5673,7 @@ function handleBaseTreeExpand($xeTable, rows, expanded) {
5521
5673
  } = reactData;
5522
5674
  const {
5523
5675
  fullAllDataRowIdData,
5524
- tableFullData,
5676
+ tableFullTreeData,
5525
5677
  treeExpandedMaps,
5526
5678
  treeExpandLazyLoadedMaps
5527
5679
  } = internalData;
@@ -5551,7 +5703,7 @@ function handleBaseTreeExpand($xeTable, rows, expanded) {
5551
5703
  if (accordion) {
5552
5704
  validRows = validRows.length ? [validRows[validRows.length - 1]] : [];
5553
5705
  // 同一级只能展开一个
5554
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullData, item => item === validRows[0], {
5706
+ const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => item === validRows[0], {
5555
5707
  children: childrenField
5556
5708
  });
5557
5709
  if (matchObj) {
@@ -5604,9 +5756,96 @@ function handleBaseTreeExpand($xeTable, rows, expanded) {
5604
5756
  * @returns
5605
5757
  */
5606
5758
  function handleVirtualTreeExpand($xeTable, rows, expanded) {
5759
+ const reactData = $xeTable;
5607
5760
  return handleBaseTreeExpand($xeTable, rows, expanded).then(() => {
5608
5761
  handleVirtualTreeToList($xeTable);
5609
5762
  $xeTable.handleTableData();
5763
+ reactData.treeExpandedFlag++;
5764
+ updateAfterDataIndex($xeTable);
5765
+ return $xeTable.$nextTick();
5766
+ }).then(() => {
5767
+ return $xeTable.recalculate(true);
5768
+ }).then(() => {
5769
+ setTimeout(() => {
5770
+ $xeTable.updateCellAreas();
5771
+ }, 30);
5772
+ });
5773
+ }
5774
+ /**
5775
+ * 展开与收起行分组节点
5776
+ * @param rows
5777
+ * @param expanded
5778
+ * @returns
5779
+ */
5780
+ function handleRowGroupBaseExpand($xeTable, rows, expanded) {
5781
+ const reactData = $xeTable;
5782
+ const internalData = $xeTable;
5783
+ const {
5784
+ fullAllDataRowIdData,
5785
+ tableFullGroupData,
5786
+ rowGroupExpandedMaps
5787
+ } = internalData;
5788
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
5789
+ const {
5790
+ mapChildrenField,
5791
+ accordion
5792
+ } = rowGroupOpts;
5793
+ const {
5794
+ handleGetRowId
5795
+ } = createHandleGetRowId($xeTable);
5796
+ let validRows = rows;
5797
+ if (mapChildrenField) {
5798
+ if (accordion) {
5799
+ validRows = validRows.length ? [validRows[validRows.length - 1]] : [];
5800
+ // 同一级只能展开一个
5801
+ const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullGroupData, item => getRowid($xeTable, item) === getRowid($xeTable, validRows[0]), {
5802
+ children: mapChildrenField
5803
+ });
5804
+ if (matchObj) {
5805
+ matchObj.items.forEach(item => {
5806
+ const rowid = handleGetRowId(item);
5807
+ if (rowGroupExpandedMaps[rowid]) {
5808
+ delete rowGroupExpandedMaps[rowid];
5809
+ }
5810
+ });
5811
+ }
5812
+ }
5813
+ if (expanded) {
5814
+ validRows.forEach(row => {
5815
+ const rowid = handleGetRowId(row);
5816
+ if (!rowGroupExpandedMaps[rowid]) {
5817
+ const rowRest = fullAllDataRowIdData[rowid];
5818
+ if (rowRest) {
5819
+ if (row[mapChildrenField] && row[mapChildrenField].length) {
5820
+ rowGroupExpandedMaps[rowid] = row;
5821
+ }
5822
+ }
5823
+ }
5824
+ });
5825
+ } else {
5826
+ validRows.forEach(item => {
5827
+ const rowid = handleGetRowId(item);
5828
+ if (rowGroupExpandedMaps[rowid]) {
5829
+ delete rowGroupExpandedMaps[rowid];
5830
+ }
5831
+ });
5832
+ }
5833
+ }
5834
+ reactData.rowGroupExpandedFlag++;
5835
+ return $xeTable.recalculate();
5836
+ }
5837
+ /**
5838
+ * 行分组的展开与收起
5839
+ * @param rows
5840
+ * @param expanded
5841
+ * @returns
5842
+ */
5843
+ function handleRowGroupVirtualExpand($xeTable, rows, expanded) {
5844
+ const reactData = $xeTable;
5845
+ return handleRowGroupBaseExpand($xeTable, rows, expanded).then(() => {
5846
+ handleVirtualTreeToList($xeTable);
5847
+ $xeTable.handleTableData();
5848
+ reactData.rowGroupExpandedFlag++;
5610
5849
  updateAfterDataIndex($xeTable);
5611
5850
  return $xeTable.$nextTick();
5612
5851
  }).then(() => {
@@ -5728,27 +5967,33 @@ function updateAfterDataIndex($xeTable) {
5728
5967
  }
5729
5968
  }
5730
5969
  /**
5731
- * 如果为虚拟树,将树结构拍平
5970
+ * 如果为虚拟树、行分组、则将树结构拍平
5732
5971
  * @returns
5733
5972
  */
5734
5973
  function handleVirtualTreeToList($xeTable) {
5735
5974
  const props = $xeTable;
5975
+ const reactData = $xeTable;
5736
5976
  const internalData = $xeTable;
5737
5977
  const {
5738
5978
  treeConfig
5739
5979
  } = props;
5980
+ const {
5981
+ isRowGroupStatus
5982
+ } = reactData;
5740
5983
  const {
5741
5984
  fullAllDataRowIdData,
5742
- treeExpandedMaps
5985
+ treeExpandedMaps,
5986
+ rowGroupExpandedMaps
5743
5987
  } = internalData;
5988
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
5744
5989
  const treeOpts = $xeTable.computeTreeOpts;
5745
- const childrenField = treeOpts.children || treeOpts.childrenField;
5990
+ const {
5991
+ handleGetRowId
5992
+ } = createHandleGetRowId($xeTable);
5993
+ const fullData = [];
5994
+ const expandMaps = {};
5746
5995
  if (treeConfig && treeOpts.transform) {
5747
- const {
5748
- handleGetRowId
5749
- } = createHandleGetRowId($xeTable);
5750
- const fullData = [];
5751
- const expandMaps = {};
5996
+ const childrenField = treeOpts.children || treeOpts.childrenField;
5752
5997
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
5753
5998
  const rowid = handleGetRowId(row);
5754
5999
  const parentRowid = handleGetRowId(parentRow);
@@ -5766,106 +6011,433 @@ function handleVirtualTreeToList($xeTable) {
5766
6011
  internalData.afterFullData = fullData;
5767
6012
  updateScrollYStatus($xeTable, fullData);
5768
6013
  return fullData;
6014
+ } else if (isRowGroupStatus) {
6015
+ const {
6016
+ childrenField
6017
+ } = rowGroupOpts;
6018
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterGroupFullData, (row, index, items, path, parentRow) => {
6019
+ const rowid = handleGetRowId(row);
6020
+ const parentRowid = handleGetRowId(parentRow);
6021
+ if (!parentRow || expandMaps[parentRowid] && rowGroupExpandedMaps[parentRowid]) {
6022
+ const rowRest = fullAllDataRowIdData[rowid];
6023
+ if (rowRest) {
6024
+ rowRest._index = fullData.length;
6025
+ }
6026
+ expandMaps[rowid] = 1;
6027
+ fullData.push(row);
6028
+ }
6029
+ }, {
6030
+ children: childrenField
6031
+ });
6032
+ internalData.afterFullData = fullData;
6033
+ updateScrollYStatus($xeTable, fullData);
6034
+ return fullData;
5769
6035
  }
5770
6036
  return internalData.afterFullData;
5771
6037
  }
5772
- function updateStyle($xeTable) {
6038
+ /**
6039
+ * 编译处理后全量的表格数据
6040
+ * 如果存在筛选条件,继续处理
6041
+ */
6042
+ function updateAfterFullData($xeTable) {
5773
6043
  const props = $xeTable;
5774
6044
  const reactData = $xeTable;
5775
6045
  const internalData = $xeTable;
5776
6046
  const {
5777
- showHeaderOverflow: allColumnHeaderOverflow,
5778
- showFooterOverflow: allColumnFooterOverflow,
5779
- mouseConfig,
5780
- spanMethod,
5781
- footerSpanMethod
6047
+ treeConfig
5782
6048
  } = props;
5783
6049
  const {
5784
- isGroup,
5785
- currentRow,
5786
- tableColumn,
5787
- scrollXLoad,
5788
- scrollYLoad,
5789
- overflowX,
5790
- scrollbarWidth,
5791
- overflowY,
5792
- scrollbarHeight,
5793
- scrollXWidth,
5794
- columnStore,
5795
- editStore,
5796
- isAllOverflow,
5797
- expandColumn
6050
+ isRowGroupStatus
5798
6051
  } = reactData;
5799
6052
  const {
5800
- visibleColumn,
5801
- tableHeight,
5802
- headerHeight,
5803
- footerHeight,
5804
- elemStore,
5805
- customHeight,
5806
- customMinHeight,
5807
- customMaxHeight
6053
+ tableFullColumn,
6054
+ tableFullData,
6055
+ tableFullTreeData,
6056
+ tableFullGroupData
5808
6057
  } = internalData;
5809
- const el = $xeTable.$refs.refElem;
5810
- if (!el) {
5811
- return;
5812
- }
5813
- const containerList = ['main', 'left', 'right'];
5814
- const osbWidth = overflowY ? scrollbarWidth : 0;
5815
- const osbHeight = overflowX ? scrollbarHeight : 0;
5816
- const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
5817
- const mouseOpts = $xeTable.computeMouseOpts;
5818
- const expandOpts = $xeTable.computeExpandOpts;
5819
- const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
5820
- const bodyTableElem = getRefElem(elemStore['main-body-table']);
5821
- if (emptyPlaceholderElem) {
5822
- emptyPlaceholderElem.style.top = `${headerHeight}px`;
5823
- emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
5824
- }
5825
- let bodyHeight = 0;
5826
- let bodyMaxHeight = 0;
5827
- const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
5828
- if (customMaxHeight) {
5829
- bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
5830
- }
5831
- if (customHeight) {
5832
- bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
5833
- }
5834
- if (!bodyHeight) {
5835
- if (bodyTableElem) {
5836
- bodyHeight = bodyTableElem.clientHeight;
5837
- }
5838
- }
5839
- if (bodyHeight) {
5840
- if (bodyMaxHeight) {
5841
- bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
5842
- }
5843
- bodyHeight = Math.max(bodyMinHeight, bodyHeight);
5844
- }
5845
- const scrollbarXToTop = $xeTable.$refs.computeScrollbarXToTop;
5846
- const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
5847
- const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
5848
- const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
5849
- if (scrollXVirtualEl) {
5850
- scrollXVirtualEl.style.height = `${osbHeight}px`;
5851
- scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
5852
- }
5853
- const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
5854
- if (xWrapperEl) {
5855
- xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
5856
- xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
5857
- }
5858
- if (xLeftCornerEl) {
5859
- xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
5860
- xLeftCornerEl.style.display = scrollbarXToTop ? overflowX && osbHeight ? 'block' : '' : '';
5861
- }
5862
- if (xRightCornerEl) {
5863
- xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
5864
- xRightCornerEl.style.display = scrollbarXToTop ? '' : overflowX && osbHeight ? 'block' : '';
5865
- }
5866
- const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
5867
- if (scrollYVirtualEl) {
5868
- scrollYVirtualEl.style.width = `${osbWidth}px`;
6058
+ const filterOpts = $xeTable.computeFilterOpts;
6059
+ const sortOpts = $xeTable.computeSortOpts;
6060
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
6061
+ const treeOpts = $xeTable.computeTreeOpts;
6062
+ const childrenField = treeOpts.children || treeOpts.childrenField;
6063
+ const {
6064
+ transform,
6065
+ rowField,
6066
+ parentField,
6067
+ mapChildrenField
6068
+ } = treeOpts;
6069
+ const {
6070
+ isEvery,
6071
+ remote: allRemoteFilter,
6072
+ filterMethod: allFilterMethod
6073
+ } = filterOpts;
6074
+ const {
6075
+ remote: allRemoteSort,
6076
+ sortMethod: allSortMethod,
6077
+ multiple: sortMultiple,
6078
+ chronological
6079
+ } = sortOpts;
6080
+ let tableData = [];
6081
+ let tableTree = [];
6082
+ // 处理数据
6083
+ if (!allRemoteFilter || !allRemoteSort) {
6084
+ const filterColumns = [];
6085
+ let orderColumns = [];
6086
+ tableFullColumn.forEach(column => {
6087
+ const {
6088
+ field,
6089
+ sortable,
6090
+ order,
6091
+ filters
6092
+ } = column;
6093
+ if (!allRemoteFilter && filters && filters.length) {
6094
+ const valueList = [];
6095
+ const itemList = [];
6096
+ filters.forEach(item => {
6097
+ if (item.checked) {
6098
+ itemList.push(item);
6099
+ valueList.push(item.value);
6100
+ }
6101
+ });
6102
+ if (itemList.length) {
6103
+ filterColumns.push({
6104
+ column,
6105
+ valueList,
6106
+ itemList
6107
+ });
6108
+ }
6109
+ }
6110
+ if (!allRemoteSort && sortable && order) {
6111
+ orderColumns.push({
6112
+ column,
6113
+ field,
6114
+ property: field,
6115
+ order: order,
6116
+ sortTime: column.sortTime
6117
+ });
6118
+ }
6119
+ });
6120
+ if (sortMultiple && chronological && orderColumns.length > 1) {
6121
+ orderColumns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(orderColumns, 'sortTime');
6122
+ }
6123
+ // 处理筛选
6124
+ // 支持单列、多列、组合筛选
6125
+ if (!allRemoteFilter && filterColumns.length) {
6126
+ const handleFilter = row => {
6127
+ return filterColumns.every(({
6128
+ column,
6129
+ valueList,
6130
+ itemList
6131
+ }) => {
6132
+ const {
6133
+ filterMethod,
6134
+ filterRender
6135
+ } = column;
6136
+ const compConf = isEnableConf(filterRender) ? methods_renderer.get(filterRender.name) : null;
6137
+ const compFilterMethod = compConf ? compConf.tableFilterMethod || compConf.filterMethod : null;
6138
+ const tdFilterMethod = compConf ? compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod : null;
6139
+ const cellValue = getCellValue(row, column);
6140
+ if (filterMethod) {
6141
+ return itemList.some(item => filterMethod({
6142
+ value: item.value,
6143
+ option: item,
6144
+ cellValue,
6145
+ row,
6146
+ column,
6147
+ $table: $xeTable
6148
+ }));
6149
+ } else if (compFilterMethod) {
6150
+ return itemList.some(item => compFilterMethod({
6151
+ value: item.value,
6152
+ option: item,
6153
+ cellValue,
6154
+ row,
6155
+ column,
6156
+ $table: $xeTable
6157
+ }));
6158
+ } else if (allFilterMethod) {
6159
+ return allFilterMethod({
6160
+ $table: $xeTable,
6161
+ options: itemList,
6162
+ values: valueList,
6163
+ cellValue,
6164
+ row,
6165
+ column
6166
+ });
6167
+ } else if (tdFilterMethod) {
6168
+ return itemList.some(item => tdFilterMethod({
6169
+ value: item.value,
6170
+ option: item,
6171
+ cellValue,
6172
+ row,
6173
+ column,
6174
+ $table: $xeTable
6175
+ }));
6176
+ }
6177
+ return valueList.indexOf(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field)) > -1;
6178
+ });
6179
+ };
6180
+ if (isRowGroupStatus) {
6181
+ // 行分组
6182
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, handleFilter, {
6183
+ original: true,
6184
+ isEvery: true,
6185
+ children: rowGroupOpts.mapChildrenField,
6186
+ mapChildren: rowGroupOpts.childrenField
6187
+ });
6188
+ tableData = tableTree;
6189
+ } else if (treeConfig && transform) {
6190
+ // 筛选虚拟树
6191
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, handleFilter, {
6192
+ original: true,
6193
+ isEvery,
6194
+ children: mapChildrenField,
6195
+ mapChildren: childrenField
6196
+ });
6197
+ tableData = tableTree;
6198
+ } else {
6199
+ tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
6200
+ tableTree = tableData;
6201
+ }
6202
+ } else {
6203
+ if (isRowGroupStatus) {
6204
+ // 还原行分组
6205
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, () => true, {
6206
+ original: true,
6207
+ isEvery: true,
6208
+ children: rowGroupOpts.mapChildrenField,
6209
+ mapChildren: rowGroupOpts.childrenField
6210
+ });
6211
+ tableData = tableTree;
6212
+ } else if (treeConfig && transform) {
6213
+ // 还原虚拟树
6214
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
6215
+ original: true,
6216
+ isEvery,
6217
+ children: mapChildrenField,
6218
+ mapChildren: childrenField
6219
+ });
6220
+ tableData = tableTree;
6221
+ } else {
6222
+ tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
6223
+ tableTree = tableData;
6224
+ }
6225
+ }
6226
+ // 处理排序
6227
+ // 支持单列、多列、组合排序
6228
+ if (!allRemoteSort && orderColumns.length) {
6229
+ if (isRowGroupStatus) {
6230
+ // 行分组的排序
6231
+ if (allSortMethod) {
6232
+ const sortRests = allSortMethod({
6233
+ data: tableTree,
6234
+ sortList: orderColumns,
6235
+ $table: $xeTable
6236
+ });
6237
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableTree;
6238
+ } else {
6239
+ const treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableTree, {
6240
+ key: rowGroupOpts.rowField,
6241
+ parentKey: rowGroupOpts.parentField,
6242
+ children: rowGroupOpts.mapChildrenField
6243
+ });
6244
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(treeList, orderColumns.map(({
6245
+ column,
6246
+ order
6247
+ }) => [getOrderField($xeTable, column), order])), {
6248
+ key: rowGroupOpts.rowField,
6249
+ parentKey: rowGroupOpts.parentField,
6250
+ children: rowGroupOpts.childrenField,
6251
+ mapChildren: rowGroupOpts.mapChildrenField
6252
+ });
6253
+ }
6254
+ tableData = tableTree;
6255
+ } else if (treeConfig && transform) {
6256
+ // 虚拟树的排序
6257
+ if (allSortMethod) {
6258
+ const sortRests = allSortMethod({
6259
+ data: tableTree,
6260
+ sortList: orderColumns,
6261
+ $table: $xeTable
6262
+ });
6263
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableTree;
6264
+ } else {
6265
+ const treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableTree, {
6266
+ children: mapChildrenField
6267
+ });
6268
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(treeList, orderColumns.map(({
6269
+ column,
6270
+ order
6271
+ }) => [getOrderField($xeTable, column), order])), {
6272
+ key: rowField,
6273
+ parentKey: parentField,
6274
+ children: childrenField,
6275
+ mapChildren: mapChildrenField
6276
+ });
6277
+ }
6278
+ tableData = tableTree;
6279
+ } else {
6280
+ if (allSortMethod) {
6281
+ const sortRests = allSortMethod({
6282
+ data: tableData,
6283
+ sortList: orderColumns,
6284
+ $table: $xeTable
6285
+ });
6286
+ tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableData;
6287
+ } else {
6288
+ // 兼容 v4
6289
+ if (sortMultiple) {
6290
+ tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
6291
+ column,
6292
+ order
6293
+ }) => [getOrderField($xeTable, column), order]));
6294
+ } else {
6295
+ const firstOrderColumn = orderColumns[0];
6296
+ let sortByConfs;
6297
+ // 已废弃,兼容 v2,在 v4 中废弃, sortBy 不能为数组
6298
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(firstOrderColumn.sortBy)) {
6299
+ sortByConfs = firstOrderColumn.sortBy.map(item => [item, firstOrderColumn.order]);
6300
+ }
6301
+ tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, sortByConfs || [firstOrderColumn].map(({
6302
+ column,
6303
+ order
6304
+ }) => [getOrderField($xeTable, column), order]));
6305
+ }
6306
+ tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
6307
+ column,
6308
+ order
6309
+ }) => [getOrderField($xeTable, column), order]));
6310
+ }
6311
+ tableTree = tableData;
6312
+ }
6313
+ }
6314
+ } else {
6315
+ if (isRowGroupStatus) {
6316
+ // 还原行分组
6317
+ // 还原虚拟树
6318
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, () => true, {
6319
+ original: true,
6320
+ isEvery: true,
6321
+ children: rowGroupOpts.mapChildrenField,
6322
+ mapChildren: rowGroupOpts.childrenField
6323
+ });
6324
+ tableData = tableTree;
6325
+ } else if (treeConfig && transform) {
6326
+ // 还原虚拟树
6327
+ tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
6328
+ original: true,
6329
+ isEvery,
6330
+ children: mapChildrenField,
6331
+ mapChildren: childrenField
6332
+ });
6333
+ tableData = tableTree;
6334
+ } else {
6335
+ tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
6336
+ tableTree = tableData;
6337
+ }
6338
+ }
6339
+ internalData.afterFullData = tableData;
6340
+ internalData.afterTreeFullData = tableTree;
6341
+ internalData.afterGroupFullData = tableTree;
6342
+ updateAfterDataIndex($xeTable);
6343
+ }
6344
+ function updateStyle($xeTable) {
6345
+ const props = $xeTable;
6346
+ const reactData = $xeTable;
6347
+ const internalData = $xeTable;
6348
+ const {
6349
+ showHeaderOverflow: allColumnHeaderOverflow,
6350
+ showFooterOverflow: allColumnFooterOverflow,
6351
+ mouseConfig,
6352
+ spanMethod,
6353
+ footerSpanMethod
6354
+ } = props;
6355
+ const {
6356
+ isGroup,
6357
+ currentRow,
6358
+ tableColumn,
6359
+ scrollXLoad,
6360
+ scrollYLoad,
6361
+ overflowX,
6362
+ scrollbarWidth,
6363
+ overflowY,
6364
+ scrollbarHeight,
6365
+ scrollXWidth,
6366
+ columnStore,
6367
+ editStore,
6368
+ isAllOverflow,
6369
+ expandColumn
6370
+ } = reactData;
6371
+ const {
6372
+ visibleColumn,
6373
+ tableHeight,
6374
+ headerHeight,
6375
+ footerHeight,
6376
+ elemStore,
6377
+ customHeight,
6378
+ customMinHeight,
6379
+ customMaxHeight
6380
+ } = internalData;
6381
+ const el = $xeTable.$refs.refElem;
6382
+ if (!el) {
6383
+ return;
6384
+ }
6385
+ const containerList = ['main', 'left', 'right'];
6386
+ const osbWidth = overflowY ? scrollbarWidth : 0;
6387
+ const osbHeight = overflowX ? scrollbarHeight : 0;
6388
+ const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
6389
+ const mouseOpts = $xeTable.computeMouseOpts;
6390
+ const expandOpts = $xeTable.computeExpandOpts;
6391
+ const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
6392
+ const bodyTableElem = getRefElem(elemStore['main-body-table']);
6393
+ if (emptyPlaceholderElem) {
6394
+ emptyPlaceholderElem.style.top = `${headerHeight}px`;
6395
+ emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
6396
+ }
6397
+ let bodyHeight = 0;
6398
+ let bodyMaxHeight = 0;
6399
+ const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
6400
+ if (customMaxHeight) {
6401
+ bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
6402
+ }
6403
+ if (customHeight) {
6404
+ bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
6405
+ }
6406
+ if (!bodyHeight) {
6407
+ if (bodyTableElem) {
6408
+ bodyHeight = bodyTableElem.clientHeight;
6409
+ }
6410
+ }
6411
+ if (bodyHeight) {
6412
+ if (bodyMaxHeight) {
6413
+ bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
6414
+ }
6415
+ bodyHeight = Math.max(bodyMinHeight, bodyHeight);
6416
+ }
6417
+ const scrollbarXToTop = $xeTable.$refs.computeScrollbarXToTop;
6418
+ const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
6419
+ const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
6420
+ const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
6421
+ if (scrollXVirtualEl) {
6422
+ scrollXVirtualEl.style.height = `${osbHeight}px`;
6423
+ scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
6424
+ }
6425
+ const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
6426
+ if (xWrapperEl) {
6427
+ xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
6428
+ xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
6429
+ }
6430
+ if (xLeftCornerEl) {
6431
+ xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
6432
+ xLeftCornerEl.style.display = scrollbarXToTop ? overflowX && osbHeight ? 'block' : '' : '';
6433
+ }
6434
+ if (xRightCornerEl) {
6435
+ xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
6436
+ xRightCornerEl.style.display = scrollbarXToTop ? '' : overflowX && osbHeight ? 'block' : '';
6437
+ }
6438
+ const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
6439
+ if (scrollYVirtualEl) {
6440
+ scrollYVirtualEl.style.width = `${osbWidth}px`;
5869
6441
  scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
5870
6442
  scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden';
5871
6443
  }
@@ -6227,6 +6799,7 @@ function handleCheckedRadioRow($xeTable, row, isForce) {
6227
6799
  checkMethod
6228
6800
  } = radioOpts;
6229
6801
  if (row && (isForce || !checkMethod || checkMethod({
6802
+ $table: $xeTable,
6230
6803
  row
6231
6804
  }))) {
6232
6805
  reactData.selectRadioRow = row;
@@ -6249,12 +6822,18 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
6249
6822
  const {
6250
6823
  treeConfig
6251
6824
  } = props;
6825
+ const {
6826
+ isRowGroupStatus
6827
+ } = reactData;
6252
6828
  const {
6253
6829
  afterFullData,
6830
+ afterTreeFullData,
6831
+ afterGroupFullData,
6254
6832
  checkboxReserveRowMap,
6255
6833
  selectCheckboxMaps
6256
6834
  } = internalData;
6257
6835
  const treeOpts = $xeTable.computeTreeOpts;
6836
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
6258
6837
  const childrenField = treeOpts.children || treeOpts.childrenField;
6259
6838
  const checkboxOpts = $xeTable.computeCheckboxOpts;
6260
6839
  const {
@@ -6269,12 +6848,13 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
6269
6848
  const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
6270
6849
  const selectRowMaps = {};
6271
6850
  /**
6272
- * 绑定属性方式(高性能,有污染)
6851
+ * 绑定属性方式(有污染)
6273
6852
  * 必须在行数据存在对应的属性,否则将不响应
6274
6853
  */
6275
6854
  if (checkField) {
6276
6855
  const checkValFn = row => {
6277
6856
  if (isForce || !checkMethod || checkMethod({
6857
+ $table: $xeTable,
6278
6858
  row
6279
6859
  })) {
6280
6860
  if (checked) {
@@ -6282,13 +6862,13 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
6282
6862
  }
6283
6863
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
6284
6864
  }
6285
- if (treeConfig && indeterminateField) {
6865
+ if ((treeConfig || isRowGroupStatus) && indeterminateField) {
6286
6866
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
6287
6867
  }
6288
6868
  };
6289
6869
  // 如果存在选中方法
6290
6870
  // 如果方法成立,则更新值,否则忽略该数据
6291
- if (treeConfig) {
6871
+ if (treeConfig || isRowGroupStatus) {
6292
6872
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, checkValFn, {
6293
6873
  children: childrenField
6294
6874
  });
@@ -6297,17 +6877,54 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
6297
6877
  }
6298
6878
  } else {
6299
6879
  /**
6300
- * 默认方式(低性能,无污染)
6301
- * 无需任何属性,直接绑定
6302
- */
6303
- if (treeConfig) {
6880
+ * 默认方式(无污染)
6881
+ * 无需任何属性,直接绑定
6882
+ */
6883
+ if (isRowGroupStatus) {
6304
6884
  if (checked) {
6305
6885
  /**
6306
- * 如果是树勾选
6307
- * 如果方法成立,则添加到临时集合中
6308
- */
6309
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, row => {
6886
+ * 如果是行分组勾选
6887
+ * 如果方法成立,则添加到临时集合中
6888
+ */
6889
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
6890
+ if (isForce || !checkMethod || checkMethod({
6891
+ $table: $xeTable,
6892
+ row
6893
+ })) {
6894
+ const rowid = handleGetRowId(row);
6895
+ selectRowMaps[rowid] = row;
6896
+ }
6897
+ }, {
6898
+ children: rowGroupOpts.mapChildrenField
6899
+ });
6900
+ } else {
6901
+ /**
6902
+ * 如果是树取消
6903
+ * 如果方法成立,则不添加到临时集合中
6904
+ */
6905
+ if (!isForce && checkMethod) {
6906
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
6907
+ const rowid = handleGetRowId(row);
6908
+ if (checkMethod({
6909
+ $table: $xeTable,
6910
+ row
6911
+ }) ? false : selectCheckboxMaps[rowid]) {
6912
+ selectRowMaps[rowid] = row;
6913
+ }
6914
+ }, {
6915
+ children: rowGroupOpts.mapChildrenField
6916
+ });
6917
+ }
6918
+ }
6919
+ } else if (treeConfig) {
6920
+ if (checked) {
6921
+ /**
6922
+ * 如果是树勾选
6923
+ * 如果方法成立,则添加到临时集合中
6924
+ */
6925
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
6310
6926
  if (isForce || !checkMethod || checkMethod({
6927
+ $table: $xeTable,
6311
6928
  row
6312
6929
  })) {
6313
6930
  const rowid = handleGetRowId(row);
@@ -6318,15 +6935,16 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
6318
6935
  });
6319
6936
  } else {
6320
6937
  /**
6321
- * 如果是树取消
6322
- * 如果方法成立,则不添加到临时集合中
6323
- */
6938
+ * 如果是树取消
6939
+ * 如果方法成立,则不添加到临时集合中
6940
+ */
6324
6941
  if (!isForce && checkMethod) {
6325
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, row => {
6942
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
6326
6943
  const rowid = handleGetRowId(row);
6327
6944
  if (checkMethod({
6945
+ $table: $xeTable,
6328
6946
  row
6329
- }) ? 0 : selectCheckboxMaps[rowid]) {
6947
+ }) ? false : selectCheckboxMaps[rowid]) {
6330
6948
  selectRowMaps[rowid] = row;
6331
6949
  }
6332
6950
  }, {
@@ -6337,14 +6955,15 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
6337
6955
  } else {
6338
6956
  if (checked) {
6339
6957
  /**
6340
- * 如果是行勾选
6341
- * 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
6342
- * 如果不存在选中方法,则添加所有数据到临时集合中
6343
- */
6958
+ * 如果是行勾选
6959
+ * 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
6960
+ * 如果不存在选中方法,则添加所有数据到临时集合中
6961
+ */
6344
6962
  if (!isForce && checkMethod) {
6345
6963
  afterFullData.forEach(row => {
6346
6964
  const rowid = handleGetRowId(row);
6347
6965
  if (selectCheckboxMaps[rowid] || checkMethod({
6966
+ $table: $xeTable,
6348
6967
  row
6349
6968
  })) {
6350
6969
  selectRowMaps[rowid] = row;
@@ -6358,16 +6977,17 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
6358
6977
  }
6359
6978
  } else {
6360
6979
  /**
6361
- * 如果是行取消
6362
- * 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
6363
- * 如果不存在选中方法,无需处理,临时集合默认为空
6364
- */
6980
+ * 如果是行取消
6981
+ * 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
6982
+ * 如果不存在选中方法,无需处理,临时集合默认为空
6983
+ */
6365
6984
  if (!isForce && checkMethod) {
6366
6985
  afterFullData.forEach(row => {
6367
6986
  const rowid = handleGetRowId(row);
6368
6987
  if (checkMethod({
6988
+ $table: $xeTable,
6369
6989
  row
6370
- }) ? 0 : selectCheckboxMaps[rowid]) {
6990
+ }) ? false : selectCheckboxMaps[rowid]) {
6371
6991
  selectRowMaps[rowid] = row;
6372
6992
  }
6373
6993
  });
@@ -7242,9 +7862,11 @@ function updateRowDropTipContent($xeTable, tdEl) {
7242
7862
  const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null);
7243
7863
  let tipContent = '';
7244
7864
  if (rTooltipMethod) {
7245
- tipContent = `${rTooltipMethod({
7865
+ const rtParams = {
7866
+ $table: $xeTable,
7246
7867
  row: dragRow
7247
- }) || ''}`;
7868
+ };
7869
+ tipContent = `${rTooltipMethod(rtParams) || ''}`;
7248
7870
  } else {
7249
7871
  tipContent = methods_getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
7250
7872
  }
@@ -7284,9 +7906,11 @@ function updateColDropTipContent($xeTable, tdEl) {
7284
7906
  } = columnDragOpts;
7285
7907
  let tipContent = '';
7286
7908
  if (tooltipMethod) {
7287
- tipContent = `${tooltipMethod({
7909
+ const dtParams = {
7910
+ $table: $xeTable,
7288
7911
  column: dragCol
7289
- }) || ''}`;
7912
+ };
7913
+ tipContent = `${tooltipMethod(dtParams) || ''}`;
7290
7914
  } else {
7291
7915
  tipContent = methods_getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
7292
7916
  }
@@ -7609,13 +8233,280 @@ function handleRecalculateLayout($xeTable, reFull) {
7609
8233
  }
7610
8234
  calcScrollbar($xeTable);
7611
8235
  updateStyle($xeTable);
7612
- if (reFull) {
7613
- updateRowOffsetTop($xeTable);
7614
- }
7615
- updateRowExpandStyle($xeTable);
7616
- if (reFull) {
7617
- return computeScrollLoad($xeTable);
8236
+ if (reFull) {
8237
+ updateRowOffsetTop($xeTable);
8238
+ }
8239
+ updateRowExpandStyle($xeTable);
8240
+ if (reFull) {
8241
+ return computeScrollLoad($xeTable);
8242
+ }
8243
+ });
8244
+ }
8245
+ const handleUpdateRowGroup = ($xeTable, groupFields) => {
8246
+ const reactData = $xeTable;
8247
+ reactData.rowGroupList = groupFields ? (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(groupFields) ? groupFields : [groupFields]).map(field => {
8248
+ return {
8249
+ field
8250
+ };
8251
+ }) : [];
8252
+ };
8253
+ function handleGroupData($xeTable, list, rowGroups) {
8254
+ let fullData = list;
8255
+ let treeData = list;
8256
+ if (rowGroups) {
8257
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
8258
+ const {
8259
+ rowField,
8260
+ parentField,
8261
+ childrenField,
8262
+ mapChildrenField
8263
+ } = rowGroupOpts;
8264
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
8265
+ const {
8266
+ checkField
8267
+ } = checkboxOpts;
8268
+ const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
8269
+ const rgItem = rowGroups[0];
8270
+ if (rgItem && rowField && parentField && childrenField && mapChildrenField) {
8271
+ fullData = [];
8272
+ treeData = [];
8273
+ const groupField = rgItem.field;
8274
+ const groupColumn = $xeTable.getColumnByField(groupField);
8275
+ const groupMaps = {};
8276
+ const rowkey = getRowkey($xeTable);
8277
+ list.forEach(row => {
8278
+ const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, groupField);
8279
+ const groupValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(cellValue) ? '' : cellValue;
8280
+ let childList = groupMaps[groupValue];
8281
+ if (!childList) {
8282
+ childList = [];
8283
+ groupMaps[groupValue] = childList;
8284
+ }
8285
+ if (row.isAggregate) {
8286
+ row.isAggregate = undefined;
8287
+ }
8288
+ childList.push(row);
8289
+ });
8290
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(groupMaps, (childList, groupValue) => {
8291
+ const {
8292
+ fullData: childFullData,
8293
+ treeData: childTreeData
8294
+ } = handleGroupData($xeTable, childList, rowGroups.slice(1));
8295
+ const groupRow = {
8296
+ isAggregate: true,
8297
+ groupContent: groupValue,
8298
+ groupField,
8299
+ [rowField]: getRowUniqueId(),
8300
+ [parentField]: null,
8301
+ [rowkey]: getRowUniqueId(),
8302
+ [childrenField]: childTreeData,
8303
+ [mapChildrenField]: childTreeData
8304
+ };
8305
+ if (checkField) {
8306
+ groupRow[checkField] = false;
8307
+ }
8308
+ if (indeterminateField) {
8309
+ groupRow[indeterminateField] = false;
8310
+ }
8311
+ treeData.push(groupRow);
8312
+ fullData.push(groupRow);
8313
+ if (childFullData.length) {
8314
+ fullData.push(...childFullData);
8315
+ }
8316
+ });
8317
+ }
8318
+ }
8319
+ return {
8320
+ treeData,
8321
+ fullData
8322
+ };
8323
+ }
8324
+ /**
8325
+ * 加载表格数据
8326
+ * @param {Array} datas 数据
8327
+ */
8328
+ function loadTableData($xeTable, datas, isReset) {
8329
+ const props = $xeTable;
8330
+ const reactData = $xeTable;
8331
+ const internalData = $xeTable;
8332
+ const {
8333
+ keepSource,
8334
+ treeConfig,
8335
+ rowGroupConfig
8336
+ } = props;
8337
+ const {
8338
+ rowGroupList,
8339
+ scrollYLoad: oldScrollYLoad
8340
+ } = reactData;
8341
+ const {
8342
+ scrollYStore,
8343
+ scrollXStore,
8344
+ lastScrollLeft,
8345
+ lastScrollTop
8346
+ } = internalData;
8347
+ const rowOpts = $xeTable.computeRowOpts;
8348
+ const treeOpts = $xeTable.computeTreeOpts;
8349
+ const expandOpts = $xeTable.computeExpandOpts;
8350
+ const {
8351
+ transform
8352
+ } = treeOpts;
8353
+ const childrenField = treeOpts.children || treeOpts.childrenField;
8354
+ let treeData = [];
8355
+ let fullData = datas ? datas.slice(0) : []; // 转为响应式数据
8356
+ if (fullData.length > supportMaxRow) {
8357
+ errLog('vxe.error.errMaxRow', [supportMaxRow]);
8358
+ }
8359
+ if (treeConfig && rowGroupList.length) {
8360
+ errLog('vxe.error.noTree', ['row-group-config']);
8361
+ return $xeTable.$nextTick();
8362
+ }
8363
+ if (rowOpts.drag && rowGroupList.length) {
8364
+ errLog('vxe.error.errConflicts', ['row-config.drag', 'row-group-config']);
8365
+ return $xeTable.$nextTick();
8366
+ }
8367
+ let isRGroup = false;
8368
+ if (treeConfig) {
8369
+ if (transform) {
8370
+ // 树结构自动转换
8371
+ if (!treeOpts.rowField) {
8372
+ errLog('vxe.error.reqProp', ['tree-config.rowField']);
8373
+ }
8374
+ if (!treeOpts.parentField) {
8375
+ errLog('vxe.error.reqProp', ['tree-config.parentField']);
8376
+ }
8377
+ if (!childrenField) {
8378
+ errLog('vxe.error.reqProp', ['tree-config.childrenField']);
8379
+ }
8380
+ if (!treeOpts.mapChildrenField) {
8381
+ errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
8382
+ }
8383
+ if (childrenField === treeOpts.mapChildrenField) {
8384
+ errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
8385
+ }
8386
+ // fullData.forEach(row => {
8387
+ // if (row[treeOpts.children] && row[treeOpts.children].length) {
8388
+ // warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
8389
+ // }
8390
+ // })
8391
+ treeData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(fullData, {
8392
+ key: treeOpts.rowField,
8393
+ parentKey: treeOpts.parentField,
8394
+ children: childrenField,
8395
+ mapChildren: treeOpts.mapChildrenField
8396
+ });
8397
+ fullData = treeData.slice(0);
8398
+ } else {
8399
+ treeData = fullData.slice(0);
8400
+ }
8401
+ } else if (rowGroupConfig && rowGroupList.length) {
8402
+ const groupRest = handleGroupData($xeTable, fullData, rowGroupList);
8403
+ treeData = groupRest.treeData;
8404
+ fullData = groupRest.fullData;
8405
+ isRGroup = true;
8406
+ }
8407
+ reactData.isRowGroupStatus = isRGroup;
8408
+ scrollYStore.startIndex = 0;
8409
+ scrollYStore.endIndex = 1;
8410
+ scrollXStore.startIndex = 0;
8411
+ scrollXStore.endIndex = 1;
8412
+ reactData.isRowLoading = true;
8413
+ reactData.scrollVMLoading = false;
8414
+ internalData.insertRowMaps = {};
8415
+ internalData.removeRowMaps = {};
8416
+ const sYLoad = updateScrollYStatus($xeTable, fullData);
8417
+ reactData.isDragColMove = false;
8418
+ reactData.isDragRowMove = false;
8419
+ // 全量数据
8420
+ internalData.tableFullData = fullData;
8421
+ internalData.tableFullTreeData = isRGroup ? [] : treeData;
8422
+ internalData.tableFullGroupData = isRGroup ? treeData : [];
8423
+ // 缓存数据
8424
+ $xeTable.cacheRowMap(isReset);
8425
+ // 原始数据
8426
+ internalData.tableSynchData = datas;
8427
+ if (isReset) {
8428
+ internalData.isResizeCellHeight = false;
8429
+ }
8430
+ // 克隆原数据,用于显示编辑状态,与编辑值做对比
8431
+ if (keepSource) {
8432
+ $xeTable.cacheSourceMap(fullData);
8433
+ }
8434
+ if ($xeTable.clearCellAreas && props.mouseConfig) {
8435
+ $xeTable.clearCellAreas();
8436
+ $xeTable.clearCopyCellArea();
8437
+ }
8438
+ $xeTable.clearMergeCells();
8439
+ $xeTable.clearMergeFooterItems();
8440
+ $xeTable.handleTableData(true);
8441
+ $xeTable.updateFooter();
8442
+ $xeTable.handleUpdateBodyMerge();
8443
+ return $xeTable.$nextTick().then(() => {
8444
+ updateHeight($xeTable);
8445
+ updateStyle($xeTable);
8446
+ }).then(() => {
8447
+ computeScrollLoad($xeTable);
8448
+ }).then(() => {
8449
+ // 是否启用了虚拟滚动
8450
+ if (sYLoad) {
8451
+ scrollYStore.endIndex = scrollYStore.visibleSize;
8452
+ }
8453
+ if (sYLoad) {
8454
+ if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
8455
+ errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"']);
8456
+ }
8457
+ // if (showOverflow) {
8458
+ // if (!rowOpts.height) {
8459
+ // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
8460
+ // if (errColumn) {
8461
+ // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
8462
+ // }
8463
+ // }
8464
+ // }
8465
+ if (!(props.height || props.maxHeight)) {
8466
+ errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
8467
+ }
8468
+ // if (!props.showOverflow) {
8469
+ // warnLog('vxe.error.reqProp', ['table.show-overflow'])
8470
+ // }
8471
+ if (props.spanMethod) {
8472
+ errLog('vxe.error.scrollErrProp', ['table.span-method']);
8473
+ }
7618
8474
  }
8475
+ handleReserveStatus($xeTable);
8476
+ $xeTable.checkSelectionStatus();
8477
+ return new Promise(resolve => {
8478
+ $xeTable.$nextTick().then(() => handleRecalculateLayout($xeTable, false)).then(() => {
8479
+ calcCellHeight($xeTable);
8480
+ updateRowOffsetTop($xeTable);
8481
+ return handleRecalculateLayout($xeTable, false);
8482
+ }).then(() => {
8483
+ let targetScrollLeft = lastScrollLeft;
8484
+ let targetScrollTop = lastScrollTop;
8485
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
8486
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
8487
+ // 是否在更新数据之后自动滚动重置滚动条
8488
+ if (virtualXOpts.scrollToLeftOnChange) {
8489
+ targetScrollLeft = 0;
8490
+ }
8491
+ if (virtualYOpts.scrollToTopOnChange) {
8492
+ targetScrollTop = 0;
8493
+ }
8494
+ reactData.isRowLoading = false;
8495
+ handleRecalculateLayout($xeTable, false);
8496
+ // 是否变更虚拟滚动
8497
+ if (oldScrollYLoad === sYLoad) {
8498
+ restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
8499
+ resolve();
8500
+ });
8501
+ } else {
8502
+ setTimeout(() => {
8503
+ restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
8504
+ resolve();
8505
+ });
8506
+ });
8507
+ }
8508
+ });
8509
+ });
7619
8510
  });
7620
8511
  }
7621
8512
  /**
@@ -8375,16 +9266,23 @@ const Methods = {
8375
9266
  clearAll() {
8376
9267
  return clearTableAllStatus(this);
8377
9268
  },
9269
+ handleUpdateRowGroup(groupFields) {
9270
+ const $xeTable = this;
9271
+ handleUpdateRowGroup($xeTable, groupFields);
9272
+ },
8378
9273
  /**
8379
9274
  * 同步 data 数据(即将废弃)
8380
9275
  * 如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
8381
9276
  * 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
8382
9277
  */
8383
9278
  syncData() {
9279
+ const $xeTable = this;
9280
+ const reactData = $xeTable;
9281
+ const internalData = $xeTable;
8384
9282
  errLog('vxe.error.delFunc', ['syncData', 'getData']);
8385
- return this.$nextTick().then(() => {
8386
- this.tableData = [];
8387
- return this.$nextTick().then(() => this.loadTableData(this.tableFullData, true));
9283
+ return $xeTable.$nextTick().then(() => {
9284
+ reactData.tableData = [];
9285
+ return $xeTable.$nextTick().then(() => loadTableData($xeTable, internalData.tableFullData, true));
8388
9286
  });
8389
9287
  },
8390
9288
  /**
@@ -8432,23 +9330,23 @@ const Methods = {
8432
9330
  // 是否进行数据处理
8433
9331
  if (force) {
8434
9332
  // 更新数据,处理筛选和排序
8435
- this.updateAfterFullData();
9333
+ updateAfterFullData($xeTable);
8436
9334
  // 如果为虚拟树,将树结构拍平
8437
9335
  fullList = handleVirtualTreeToList($xeTable);
8438
9336
  }
8439
9337
  const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
8440
9338
  const visibleDataRowIdMaps = {};
8441
9339
  tableData.forEach((row, $index) => {
8442
- const rowid = getRowid(this, row);
9340
+ const rowid = getRowid($xeTable, row);
8443
9341
  const rest = fullDataRowIdData[rowid];
8444
9342
  if (rest) {
8445
9343
  rest.$index = $index;
8446
9344
  }
8447
9345
  visibleDataRowIdMaps[rowid] = row;
8448
9346
  });
8449
- this.tableData = tableData;
9347
+ reactData.tableData = tableData;
8450
9348
  internalData.visibleDataRowIdData = visibleDataRowIdMaps;
8451
- return this.$nextTick();
9349
+ return $xeTable.$nextTick();
8452
9350
  },
8453
9351
  /**
8454
9352
  * 加载表格数据
@@ -8456,169 +9354,7 @@ const Methods = {
8456
9354
  */
8457
9355
  loadTableData(datas, isReset) {
8458
9356
  const $xeTable = this;
8459
- const props = $xeTable;
8460
- const reactData = $xeTable;
8461
- const internalData = $xeTable;
8462
- const {
8463
- keepSource,
8464
- treeConfig
8465
- } = props;
8466
- const {
8467
- scrollYLoad: oldScrollYLoad
8468
- } = reactData;
8469
- const {
8470
- scrollYStore,
8471
- scrollXStore,
8472
- lastScrollLeft,
8473
- lastScrollTop
8474
- } = internalData;
8475
- const treeOpts = $xeTable.computeTreeOpts;
8476
- const expandOpts = $xeTable.computeExpandOpts;
8477
- const {
8478
- transform
8479
- } = treeOpts;
8480
- const childrenField = treeOpts.children || treeOpts.childrenField;
8481
- let treeData = [];
8482
- let fullData = datas ? datas.slice(0) : [];
8483
- if (fullData.length > supportMaxRow) {
8484
- errLog('vxe.error.errMaxRow', [supportMaxRow]);
8485
- }
8486
- if (treeConfig) {
8487
- // 树结构自动转换
8488
- if (transform) {
8489
- if (!treeOpts.rowField) {
8490
- errLog('vxe.error.reqProp', ['table.tree-config.rowField']);
8491
- }
8492
- if (!treeOpts.parentField) {
8493
- errLog('vxe.error.reqProp', ['table.tree-config.parentField']);
8494
- }
8495
- if (!childrenField) {
8496
- errLog('vxe.error.reqProp', ['tree-config.childrenField']);
8497
- }
8498
- if (!treeOpts.mapChildrenField) {
8499
- errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
8500
- }
8501
- if (childrenField === treeOpts.mapChildrenField) {
8502
- errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
8503
- }
8504
- // fullData.forEach(row => {
8505
- // if (row[childrenField] && row[childrenField].length) {
8506
- // warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
8507
- // }
8508
- // })
8509
- treeData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(fullData, {
8510
- key: treeOpts.rowField,
8511
- parentKey: treeOpts.parentField,
8512
- children: childrenField,
8513
- mapChildren: treeOpts.mapChildrenField
8514
- });
8515
- fullData = treeData.slice(0);
8516
- } else {
8517
- treeData = fullData.slice(0);
8518
- }
8519
- }
8520
- scrollYStore.startIndex = 0;
8521
- scrollYStore.endIndex = 1;
8522
- scrollXStore.startIndex = 0;
8523
- scrollXStore.endIndex = 1;
8524
- reactData.isRowLoading = true;
8525
- reactData.scrollVMLoading = false;
8526
- internalData.insertRowMaps = {};
8527
- internalData.removeRowMaps = {};
8528
- const sYLoad = updateScrollYStatus($xeTable, fullData);
8529
- reactData.isDragColMove = false;
8530
- reactData.isDragRowMove = false;
8531
- // 全量数据
8532
- internalData.tableFullData = fullData;
8533
- internalData.tableFullTreeData = treeData;
8534
- // 缓存数据
8535
- $xeTable.cacheRowMap(isReset);
8536
- // 原始数据
8537
- internalData.tableSynchData = datas;
8538
- if (isReset) {
8539
- internalData.isResizeCellHeight = false;
8540
- }
8541
- // 克隆原数据,用于显示编辑状态,与编辑值做对比
8542
- if (keepSource) {
8543
- $xeTable.cacheSourceMap(fullData);
8544
- }
8545
- if ($xeTable.clearCellAreas && props.mouseConfig) {
8546
- $xeTable.clearCellAreas();
8547
- $xeTable.clearCopyCellArea();
8548
- }
8549
- $xeTable.clearMergeCells();
8550
- $xeTable.clearMergeFooterItems();
8551
- $xeTable.handleTableData(true);
8552
- $xeTable.updateFooter();
8553
- $xeTable.handleUpdateBodyMerge();
8554
- return $xeTable.$nextTick().then(() => {
8555
- updateHeight($xeTable);
8556
- updateStyle($xeTable);
8557
- }).then(() => {
8558
- computeScrollLoad($xeTable);
8559
- }).then(() => {
8560
- // 是否启用了虚拟滚动
8561
- if (sYLoad) {
8562
- scrollYStore.endIndex = scrollYStore.visibleSize;
8563
- }
8564
- if (sYLoad) {
8565
- if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
8566
- errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"']);
8567
- }
8568
- // if (showOverflow) {
8569
- // if (!rowOpts.height) {
8570
- // const errColumn = internalData.tableFullColumn.find((column: any) => column.showOverflow === false)
8571
- // if (errColumn) {
8572
- // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
8573
- // }
8574
- // }
8575
- // }
8576
- if (!(props.height || props.maxHeight)) {
8577
- errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
8578
- }
8579
- // if (!props.showOverflow) {
8580
- // warnLog('vxe.error.reqProp', ['table.show-overflow'])
8581
- // }
8582
- if (props.spanMethod) {
8583
- errLog('vxe.error.scrollErrProp', ['table.span-method']);
8584
- }
8585
- }
8586
- handleReserveStatus($xeTable);
8587
- $xeTable.checkSelectionStatus();
8588
- return new Promise(resolve => {
8589
- this.$nextTick().then(() => handleRecalculateLayout($xeTable, false)).then(() => {
8590
- calcCellHeight($xeTable);
8591
- updateRowOffsetTop($xeTable);
8592
- return handleRecalculateLayout($xeTable, false);
8593
- }).then(() => {
8594
- let targetScrollLeft = lastScrollLeft;
8595
- let targetScrollTop = lastScrollTop;
8596
- const virtualXOpts = $xeTable.computeVirtualXOpts;
8597
- const virtualYOpts = $xeTable.computeVirtualYOpts;
8598
- // 是否在更新数据之后自动滚动重置滚动条
8599
- if (virtualXOpts.scrollToLeftOnChange) {
8600
- targetScrollLeft = 0;
8601
- }
8602
- if (virtualYOpts.scrollToTopOnChange) {
8603
- targetScrollTop = 0;
8604
- }
8605
- reactData.isRowLoading = false;
8606
- handleRecalculateLayout($xeTable, false);
8607
- // 是否变更虚拟滚动
8608
- if (oldScrollYLoad === sYLoad) {
8609
- restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
8610
- resolve();
8611
- });
8612
- } else {
8613
- setTimeout(() => {
8614
- restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
8615
- resolve();
8616
- });
8617
- });
8618
- }
8619
- });
8620
- });
8621
- });
9357
+ return loadTableData($xeTable, datas, isReset);
8622
9358
  },
8623
9359
  /**
8624
9360
  * 重新加载数据,不会清空表格状态
@@ -8629,7 +9365,7 @@ const Methods = {
8629
9365
  const {
8630
9366
  initStatus
8631
9367
  } = this;
8632
- return this.loadTableData(datas, false).then(() => {
9368
+ return loadTableData($xeTable, datas, false).then(() => {
8633
9369
  this.inited = true;
8634
9370
  this.initStatus = true;
8635
9371
  if (!initStatus) {
@@ -8647,7 +9383,7 @@ const Methods = {
8647
9383
  return this.clearAll().then(() => {
8648
9384
  this.inited = true;
8649
9385
  this.initStatus = true;
8650
- return this.loadTableData(datas, true);
9386
+ return loadTableData($xeTable, datas, true);
8651
9387
  }).then(() => {
8652
9388
  handleLoadDefaults($xeTable);
8653
9389
  return this.recalculate();
@@ -8739,18 +9475,16 @@ const Methods = {
8739
9475
  const {
8740
9476
  treeConfig
8741
9477
  } = props;
9478
+ const {
9479
+ isRowGroupStatus
9480
+ } = reactData;
8742
9481
  const {
8743
9482
  fullAllDataRowIdData,
8744
9483
  tableFullData,
8745
9484
  tableFullTreeData,
9485
+ tableFullGroupData,
8746
9486
  treeExpandedMaps
8747
9487
  } = internalData;
8748
- const treeOpts = $xeTable.computeTreeOpts;
8749
- const childrenField = treeOpts.children || treeOpts.childrenField;
8750
- const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
8751
- const {
8752
- lazy
8753
- } = treeOpts;
8754
9488
  const fullAllDataRowIdMaps = isReset ? {} : {
8755
9489
  ...fullAllDataRowIdData
8756
9490
  }; // 存在已删除数据
@@ -8790,6 +9524,12 @@ const Methods = {
8790
9524
  fullAllDataRowIdMaps[rowid] = rowRest;
8791
9525
  };
8792
9526
  if (treeConfig) {
9527
+ const treeOpts = $xeTable.computeTreeOpts;
9528
+ const {
9529
+ lazy
9530
+ } = treeOpts;
9531
+ const childrenField = treeOpts.children || treeOpts.childrenField;
9532
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
8793
9533
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
8794
9534
  const rowid = handleUpdateRowId(row);
8795
9535
  if (treeConfig && lazy) {
@@ -8806,6 +9546,17 @@ const Methods = {
8806
9546
  }, {
8807
9547
  children: childrenField
8808
9548
  });
9549
+ } else if (isRowGroupStatus) {
9550
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
9551
+ const {
9552
+ mapChildrenField
9553
+ } = rowGroupOpts;
9554
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
9555
+ const rowid = handleUpdateRowId(row);
9556
+ handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
9557
+ }, {
9558
+ children: mapChildrenField
9559
+ });
8809
9560
  } else {
8810
9561
  tableFullData.forEach((row, index, items) => {
8811
9562
  handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1);
@@ -9611,301 +10362,55 @@ const Methods = {
9611
10362
  const internalData = $xeTable;
9612
10363
  const {
9613
10364
  treeConfig
9614
- } = props;
9615
- const {
9616
- updateCheckboxFlag
9617
- } = reactData;
9618
- const {
9619
- tableFullData,
9620
- afterFullData,
9621
- afterTreeFullData,
9622
- tableFullTreeData,
9623
- fullDataRowIdData,
9624
- afterFullRowMaps,
9625
- selectCheckboxMaps
9626
- } = internalData;
9627
- const treeOpts = $xeTable.computeTreeOpts;
9628
- const checkboxOpts = $xeTable.computeCheckboxOpts;
9629
- const {
9630
- transform,
9631
- mapChildrenField
9632
- } = treeOpts;
9633
- const {
9634
- checkField
9635
- } = checkboxOpts;
9636
- const childrenField = treeOpts.children || treeOpts.childrenField;
9637
- let rowList = [];
9638
- if (updateCheckboxFlag) {
9639
- if (checkField) {
9640
- if (treeConfig) {
9641
- const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? afterTreeFullData : afterFullData;
9642
- rowList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().filterTree(currTableData, row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField), {
9643
- children: transform ? mapChildrenField : childrenField
9644
- });
9645
- } else {
9646
- const currTableData = isFull ? tableFullData : afterFullData;
9647
- rowList = currTableData.filter(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
9648
- }
9649
- } else {
9650
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectCheckboxMaps, (row, rowid) => {
9651
- if (isFull) {
9652
- if (fullDataRowIdData[rowid]) {
9653
- rowList.push(fullDataRowIdData[rowid].row);
9654
- }
9655
- } else {
9656
- if (afterFullRowMaps[rowid]) {
9657
- rowList.push(afterFullRowMaps[rowid]);
9658
- }
9659
- }
9660
- });
9661
- }
9662
- }
9663
- return rowList;
9664
- },
9665
- /**
9666
- * 获取处理后全量的表格数据
9667
- * 如果存在筛选条件,继续处理
9668
- */
9669
- updateAfterFullData() {
9670
- const $xeTable = this;
9671
- const props = $xeTable;
9672
- const internalData = $xeTable;
9673
- const {
9674
- treeConfig
9675
- } = props;
9676
- const {
9677
- tableFullColumn,
9678
- tableFullData,
9679
- tableFullTreeData
9680
- } = internalData;
9681
- const filterOpts = $xeTable.computeFilterOpts;
9682
- const sortOpts = $xeTable.computeSortOpts;
9683
- const treeOpts = $xeTable.computeTreeOpts;
9684
- const childrenField = treeOpts.children || treeOpts.childrenField;
9685
- const {
9686
- transform,
9687
- rowField,
9688
- parentField,
9689
- mapChildrenField
9690
- } = treeOpts;
9691
- const {
9692
- isEvery,
9693
- remote: allRemoteFilter,
9694
- filterMethod: allFilterMethod
9695
- } = filterOpts;
9696
- const {
9697
- remote: allRemoteSort,
9698
- sortMethod: allSortMethod,
9699
- multiple: sortMultiple,
9700
- chronological
9701
- } = sortOpts;
9702
- let tableData = [];
9703
- let tableTree = [];
9704
- // 处理数据
9705
- if (!allRemoteFilter || !allRemoteSort) {
9706
- const filterColumns = [];
9707
- let orderColumns = [];
9708
- tableFullColumn.forEach(column => {
9709
- const {
9710
- field,
9711
- sortable,
9712
- order,
9713
- filters
9714
- } = column;
9715
- if (!allRemoteFilter && filters && filters.length) {
9716
- const valueList = [];
9717
- const itemList = [];
9718
- filters.forEach(item => {
9719
- if (item.checked) {
9720
- itemList.push(item);
9721
- valueList.push(item.value);
9722
- }
9723
- });
9724
- if (itemList.length) {
9725
- filterColumns.push({
9726
- column,
9727
- valueList,
9728
- itemList
9729
- });
9730
- }
9731
- }
9732
- if (!allRemoteSort && sortable && order) {
9733
- orderColumns.push({
9734
- column,
9735
- field,
9736
- property: field,
9737
- order: order,
9738
- sortTime: column.sortTime
9739
- });
9740
- }
9741
- });
9742
- if (sortMultiple && chronological && orderColumns.length > 1) {
9743
- orderColumns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(orderColumns, 'sortTime');
9744
- }
9745
- // 处理筛选
9746
- // 支持单列、多列、组合筛选
9747
- if (!allRemoteFilter && filterColumns.length) {
9748
- const handleFilter = row => {
9749
- return filterColumns.every(({
9750
- column,
9751
- valueList,
9752
- itemList
9753
- }) => {
9754
- const {
9755
- filterMethod,
9756
- filterRender
9757
- } = column;
9758
- const compConf = isEnableConf(filterRender) ? methods_renderer.get(filterRender.name) : null;
9759
- const compFilterMethod = compConf ? compConf.tableFilterMethod || compConf.filterMethod : null;
9760
- const tdFilterMethod = compConf ? compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod : null;
9761
- const cellValue = getCellValue(row, column);
9762
- if (filterMethod) {
9763
- return itemList.some(item => filterMethod({
9764
- value: item.value,
9765
- option: item,
9766
- cellValue,
9767
- row,
9768
- column,
9769
- $table: $xeTable
9770
- }));
9771
- } else if (compFilterMethod) {
9772
- return itemList.some(item => compFilterMethod({
9773
- value: item.value,
9774
- option: item,
9775
- cellValue,
9776
- row,
9777
- column,
9778
- $table: $xeTable
9779
- }));
9780
- } else if (allFilterMethod) {
9781
- return allFilterMethod({
9782
- options: itemList,
9783
- values: valueList,
9784
- cellValue,
9785
- row,
9786
- column
9787
- });
9788
- } else if (tdFilterMethod) {
9789
- return itemList.some(item => tdFilterMethod({
9790
- value: item.value,
9791
- option: item,
9792
- cellValue,
9793
- row,
9794
- column,
9795
- $table: $xeTable
9796
- }));
9797
- }
9798
- return valueList.indexOf(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field)) > -1;
9799
- });
9800
- };
9801
- if (treeConfig && transform) {
9802
- // 筛选虚拟树
9803
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, handleFilter, {
9804
- original: true,
9805
- isEvery,
9806
- children: mapChildrenField,
9807
- mapChildren: childrenField
10365
+ } = props;
10366
+ const {
10367
+ updateCheckboxFlag
10368
+ } = reactData;
10369
+ const {
10370
+ tableFullData,
10371
+ afterFullData,
10372
+ tableFullTreeData,
10373
+ fullDataRowIdData,
10374
+ afterFullRowMaps,
10375
+ selectCheckboxMaps
10376
+ } = internalData;
10377
+ const treeOpts = $xeTable.computeTreeOpts;
10378
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
10379
+ const {
10380
+ transform,
10381
+ mapChildrenField
10382
+ } = treeOpts;
10383
+ const {
10384
+ checkField
10385
+ } = checkboxOpts;
10386
+ const childrenField = treeOpts.children || treeOpts.childrenField;
10387
+ let rowList = [];
10388
+ if (updateCheckboxFlag) {
10389
+ if (checkField) {
10390
+ if (treeConfig) {
10391
+ const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? tableFullTreeData : afterFullData;
10392
+ rowList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().filterTree(currTableData, row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField), {
10393
+ children: transform ? mapChildrenField : childrenField
9808
10394
  });
9809
- tableData = tableTree;
9810
10395
  } else {
9811
- tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
9812
- tableTree = tableData;
10396
+ const currTableData = isFull ? tableFullData : afterFullData;
10397
+ rowList = currTableData.filter(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
9813
10398
  }
9814
10399
  } else {
9815
- if (treeConfig && transform) {
9816
- // 还原虚拟树
9817
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
9818
- original: true,
9819
- isEvery,
9820
- children: mapChildrenField,
9821
- mapChildren: childrenField
9822
- });
9823
- tableData = tableTree;
9824
- } else {
9825
- tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
9826
- tableTree = tableData;
9827
- }
9828
- }
9829
- // 处理排序(不能用于树形结构)
9830
- // 支持单列、多列、组合排序
9831
- if (!allRemoteSort && orderColumns.length) {
9832
- if (treeConfig && transform) {
9833
- // 虚拟树和列表一样,只能排序根级节点
9834
- if (allSortMethod) {
9835
- const sortRests = allSortMethod({
9836
- data: tableTree,
9837
- sortList: orderColumns,
9838
- $table: $xeTable
9839
- });
9840
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableTree;
9841
- } else {
9842
- const treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableTree, {
9843
- children: mapChildrenField
9844
- });
9845
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(treeList, orderColumns.map(({
9846
- column,
9847
- order
9848
- }) => [getOrderField($xeTable, column), order])), {
9849
- key: rowField,
9850
- parentKey: parentField,
9851
- children: childrenField,
9852
- mapChildren: mapChildrenField
9853
- });
9854
- }
9855
- tableData = tableTree;
9856
- } else {
9857
- if (allSortMethod) {
9858
- const sortRests = allSortMethod({
9859
- data: tableData,
9860
- sortList: orderColumns,
9861
- $table: $xeTable
9862
- });
9863
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableData;
10400
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectCheckboxMaps, (row, rowid) => {
10401
+ if (isFull) {
10402
+ if (fullDataRowIdData[rowid]) {
10403
+ rowList.push(fullDataRowIdData[rowid].row);
10404
+ }
9864
10405
  } else {
9865
- // 兼容 v4
9866
- if (sortMultiple) {
9867
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
9868
- column,
9869
- order
9870
- }) => [getOrderField(this, column), order]));
9871
- } else {
9872
- const firstOrderColumn = orderColumns[0];
9873
- let sortByConfs;
9874
- // 已废弃,兼容 v2,在 v4 中废弃, sortBy 不能为数组
9875
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(firstOrderColumn.sortBy)) {
9876
- sortByConfs = firstOrderColumn.sortBy.map(item => [item, firstOrderColumn.order]);
9877
- }
9878
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, sortByConfs || [firstOrderColumn].map(({
9879
- column,
9880
- order
9881
- }) => [getOrderField(this, column), order]));
10406
+ if (afterFullRowMaps[rowid]) {
10407
+ rowList.push(afterFullRowMaps[rowid]);
9882
10408
  }
9883
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
9884
- column,
9885
- order
9886
- }) => [getOrderField($xeTable, column), order]));
9887
10409
  }
9888
- tableTree = tableData;
9889
- }
9890
- }
9891
- } else {
9892
- if (treeConfig && transform) {
9893
- // 还原虚拟树
9894
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
9895
- original: true,
9896
- isEvery,
9897
- children: treeOpts.mapChildrenField,
9898
- mapChildren: childrenField
9899
10410
  });
9900
- tableData = tableTree;
9901
- } else {
9902
- tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
9903
- tableTree = tableData;
9904
10411
  }
9905
10412
  }
9906
- internalData.afterFullData = tableData;
9907
- internalData.afterTreeFullData = tableTree;
9908
- updateAfterDataIndex($xeTable);
10413
+ return rowList;
9909
10414
  },
9910
10415
  /**
9911
10416
  * 预编译
@@ -10289,6 +10794,7 @@ const Methods = {
10289
10794
  const storeData = getCustomStorageMap(tableId);
10290
10795
  if (restoreStore) {
10291
10796
  return Promise.resolve(restoreStore({
10797
+ $table: $xeTable,
10292
10798
  id: tableId,
10293
10799
  type: 'restore',
10294
10800
  storeData
@@ -10364,6 +10870,7 @@ const Methods = {
10364
10870
  resizableData[colKey] = column.renderWidth;
10365
10871
  }
10366
10872
  if (isCustomVisible && (!checkMethod || checkMethod({
10873
+ $table: $xeTable,
10367
10874
  column
10368
10875
  }))) {
10369
10876
  if (!column.visible && column.defaultVisible) {
@@ -10424,6 +10931,7 @@ const Methods = {
10424
10931
  } : this.getCustomStoreData();
10425
10932
  if (updateStore) {
10426
10933
  return updateStore({
10934
+ $table: $xeTable,
10427
10935
  id: tableId,
10428
10936
  type,
10429
10937
  storeData
@@ -11421,8 +11929,7 @@ const Methods = {
11421
11929
  const hasDeleteKey = keyCode === 46;
11422
11930
  const isF2 = keyCode === 113;
11423
11931
  const isContextMenu = keyCode === 93;
11424
- const hasMetaKey = evnt.metaKey;
11425
- const hasCtrlKey = evnt.ctrlKey;
11932
+ const isControlKey = hasControlKey(evnt);
11426
11933
  const hasShiftKey = evnt.shiftKey;
11427
11934
  const hasAltKey = evnt.altKey;
11428
11935
  const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
@@ -11488,7 +11995,7 @@ const Methods = {
11488
11995
  enterMethod
11489
11996
  } = keyboardOpts;
11490
11997
  // 退出选中
11491
- if (hasCtrlKey) {
11998
+ if (isControlKey) {
11492
11999
  // 如果是激活编辑状态,则取消编辑
11493
12000
  if (actived.row) {
11494
12001
  const params = actived.args;
@@ -11664,7 +12171,7 @@ const Methods = {
11664
12171
  };
11665
12172
  $xeTable.setTreeExpand(parentRow, false).then(() => $xeTable.scrollToRow(parentRow)).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
11666
12173
  }
11667
- } else if (keyboardConfig && keyboardOpts.isEdit && !hasCtrlKey && !hasMetaKey && (isSpacebar || keyCode >= 48 && keyCode <= 57 || keyCode >= 65 && keyCode <= 90 || keyCode >= 96 && keyCode <= 111 || keyCode >= 186 && keyCode <= 192 || keyCode >= 219 && keyCode <= 222)) {
12174
+ } else if (keyboardConfig && keyboardOpts.isEdit && !isControlKey && (isSpacebar || keyCode >= 48 && keyCode <= 57 || keyCode >= 65 && keyCode <= 90 || keyCode >= 96 && keyCode <= 111 || keyCode >= 186 && keyCode <= 192 || keyCode >= 219 && keyCode <= 222)) {
11668
12175
  const {
11669
12176
  editMethod
11670
12177
  } = keyboardOpts;
@@ -12114,9 +12621,13 @@ const Methods = {
12114
12621
  const {
12115
12622
  treeConfig
12116
12623
  } = props;
12624
+ const {
12625
+ isRowGroupStatus
12626
+ } = reactData;
12117
12627
  const {
12118
12628
  selectCheckboxMaps
12119
12629
  } = internalData;
12630
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
12120
12631
  const treeOpts = $xeTable.computeTreeOpts;
12121
12632
  const {
12122
12633
  transform,
@@ -12136,10 +12647,11 @@ const Methods = {
12136
12647
  const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
12137
12648
  if (checkField) {
12138
12649
  // 树结构
12139
- if (treeConfig && !checkStrictly) {
12650
+ if ((treeConfig || isRowGroupStatus) && !checkStrictly) {
12140
12651
  // 更新子节点状态
12141
12652
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
12142
12653
  if (isForce || !checkMethod || checkMethod({
12654
+ $table: $xeTable,
12143
12655
  row
12144
12656
  })) {
12145
12657
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
@@ -12157,6 +12669,7 @@ const Methods = {
12157
12669
  // 列表
12158
12670
  rows.forEach(row => {
12159
12671
  if (isForce || !checkMethod || checkMethod({
12672
+ $table: $xeTable,
12160
12673
  row
12161
12674
  })) {
12162
12675
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
@@ -12167,32 +12680,58 @@ const Methods = {
12167
12680
  return;
12168
12681
  }
12169
12682
  // 树结构
12170
- if (treeConfig && !checkStrictly) {
12171
- // 更新子节点状态
12172
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
12173
- const rowid = handleGetRowId(row);
12174
- if (isForce || !checkMethod || checkMethod({
12175
- row
12176
- })) {
12177
- if (checked) {
12178
- selectCheckboxMaps[rowid] = row;
12179
- } else {
12180
- if (selectCheckboxMaps[rowid]) {
12181
- delete selectCheckboxMaps[rowid];
12683
+ if (!checkStrictly) {
12684
+ if (isRowGroupStatus) {
12685
+ // 更新行分组节点状态
12686
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
12687
+ const rowid = handleGetRowId(row);
12688
+ if (isForce || !checkMethod || checkMethod({
12689
+ $table: $xeTable,
12690
+ row
12691
+ })) {
12692
+ if (checked) {
12693
+ selectCheckboxMaps[rowid] = row;
12694
+ } else {
12695
+ if (selectCheckboxMaps[rowid]) {
12696
+ delete selectCheckboxMaps[rowid];
12697
+ }
12182
12698
  }
12699
+ handleCheckboxReserveRow($xeTable, row, checked);
12183
12700
  }
12184
- handleCheckboxReserveRow($xeTable, row, checked);
12185
- }
12186
- }, {
12187
- children: transform ? mapChildrenField : childrenField
12188
- });
12189
- reactData.updateCheckboxFlag++;
12190
- return;
12701
+ }, {
12702
+ children: rowGroupOpts.mapChildrenField
12703
+ });
12704
+ reactData.updateCheckboxFlag++;
12705
+ return;
12706
+ } else if (treeConfig) {
12707
+ // 更新子节点状态
12708
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
12709
+ const rowid = handleGetRowId(row);
12710
+ if (isForce || !checkMethod || checkMethod({
12711
+ $table: $xeTable,
12712
+ row
12713
+ })) {
12714
+ if (checked) {
12715
+ selectCheckboxMaps[rowid] = row;
12716
+ } else {
12717
+ if (selectCheckboxMaps[rowid]) {
12718
+ delete selectCheckboxMaps[rowid];
12719
+ }
12720
+ }
12721
+ handleCheckboxReserveRow($xeTable, row, checked);
12722
+ }
12723
+ }, {
12724
+ children: transform ? mapChildrenField : childrenField
12725
+ });
12726
+ reactData.updateCheckboxFlag++;
12727
+ return;
12728
+ }
12191
12729
  }
12192
12730
  // 列表
12193
12731
  rows.forEach(row => {
12194
12732
  const rowid = handleGetRowId(row);
12195
12733
  if (isForce || !checkMethod || checkMethod({
12734
+ $table: $xeTable,
12196
12735
  row
12197
12736
  })) {
12198
12737
  if (checked) {
@@ -12252,10 +12791,17 @@ const Methods = {
12252
12791
  triggerCheckRowEvent(evnt, params, checked) {
12253
12792
  const $xeTable = this;
12254
12793
  const props = $xeTable;
12794
+ const reactData = $xeTable;
12255
12795
  const internalData = $xeTable;
12796
+ const {
12797
+ treeConfig
12798
+ } = props;
12256
12799
  const {
12257
12800
  row
12258
12801
  } = params;
12802
+ const {
12803
+ isRowGroupStatus
12804
+ } = reactData;
12259
12805
  const {
12260
12806
  afterFullData
12261
12807
  } = internalData;
@@ -12268,7 +12814,7 @@ const Methods = {
12268
12814
  return;
12269
12815
  }
12270
12816
  evnt.stopPropagation();
12271
- if (checkboxOpts.isShiftKey && evnt.shiftKey && !props.treeConfig) {
12817
+ if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
12272
12818
  const checkboxRecords = $xeTable.getCheckboxRecords();
12273
12819
  if (checkboxRecords.length) {
12274
12820
  const firstRow = checkboxRecords[0];
@@ -12288,6 +12834,7 @@ const Methods = {
12288
12834
  }
12289
12835
  }
12290
12836
  if (!checkMethod || checkMethod({
12837
+ $table: $xeTable,
12291
12838
  row
12292
12839
  })) {
12293
12840
  $xeTable.handleBatchSelectRows([row], checked);
@@ -12335,14 +12882,16 @@ const Methods = {
12335
12882
  treeConfig
12336
12883
  } = props;
12337
12884
  const {
12885
+ isRowGroupStatus
12886
+ } = reactData;
12887
+ const {
12888
+ afterTreeFullData,
12889
+ afterGroupFullData,
12338
12890
  selectCheckboxMaps,
12339
12891
  treeIndeterminateRowMaps
12340
12892
  } = internalData;
12893
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
12341
12894
  const treeOpts = $xeTable.computeTreeOpts;
12342
- const {
12343
- transform,
12344
- mapChildrenField
12345
- } = treeOpts;
12346
12895
  const childrenField = treeOpts.children || treeOpts.childrenField;
12347
12896
  const checkboxOpts = $xeTable.computeCheckboxOpts;
12348
12897
  const {
@@ -12350,29 +12899,47 @@ const Methods = {
12350
12899
  checkStrictly,
12351
12900
  checkMethod
12352
12901
  } = checkboxOpts;
12353
- const {
12354
- afterTreeFullData
12355
- } = internalData;
12356
12902
  if (checkStrictly) {
12357
12903
  return;
12358
12904
  }
12359
- // 树结构
12360
- if (treeConfig) {
12905
+ if (isRowGroupStatus || treeConfig) {
12361
12906
  const {
12362
12907
  handleGetRowId
12363
12908
  } = createHandleGetRowId($xeTable);
12364
12909
  const childRowMaps = {};
12365
12910
  const childRowList = [];
12366
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
12367
- const rowid = handleGetRowId(row);
12368
- const childList = row[transform ? mapChildrenField : childrenField];
12369
- if (childList && childList.length && !childRowMaps[rowid]) {
12370
- childRowMaps[rowid] = 1;
12371
- childRowList.unshift([row, rowid, childList]);
12911
+ if (isRowGroupStatus) {
12912
+ // 行分组
12913
+ const mapChildrenField = rowGroupOpts.mapChildrenField;
12914
+ if (mapChildrenField) {
12915
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
12916
+ const rowid = handleGetRowId(row);
12917
+ const childList = row[mapChildrenField];
12918
+ if (childList && childList.length && !childRowMaps[rowid]) {
12919
+ childRowMaps[rowid] = 1;
12920
+ childRowList.unshift([row, rowid, childList]);
12921
+ }
12922
+ }, {
12923
+ children: mapChildrenField
12924
+ });
12372
12925
  }
12373
- }, {
12374
- children: transform ? mapChildrenField : childrenField
12375
- });
12926
+ } else if (treeConfig) {
12927
+ // 树结构
12928
+ const {
12929
+ transform,
12930
+ mapChildrenField
12931
+ } = treeOpts;
12932
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
12933
+ const rowid = handleGetRowId(row);
12934
+ const childList = row[transform ? mapChildrenField : childrenField];
12935
+ if (childList && childList.length && !childRowMaps[rowid]) {
12936
+ childRowMaps[rowid] = 1;
12937
+ childRowList.unshift([row, rowid, childList]);
12938
+ }
12939
+ }, {
12940
+ children: transform ? mapChildrenField : childrenField
12941
+ });
12942
+ }
12376
12943
  childRowList.forEach(vals => {
12377
12944
  const row = vals[0];
12378
12945
  const rowid = vals[1];
@@ -12384,6 +12951,7 @@ const Methods = {
12384
12951
  const childRowid = handleGetRowId(item);
12385
12952
  const isSelect = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField) : selectCheckboxMaps[childRowid];
12386
12953
  if (checkMethod({
12954
+ $table: $xeTable,
12387
12955
  row: item
12388
12956
  })) {
12389
12957
  if (isSelect) {
@@ -12447,9 +13015,13 @@ const Methods = {
12447
13015
  const {
12448
13016
  treeConfig
12449
13017
  } = props;
13018
+ const {
13019
+ isRowGroupStatus
13020
+ } = reactData;
12450
13021
  const {
12451
13022
  afterFullData,
12452
13023
  afterTreeFullData,
13024
+ afterGroupFullData,
12453
13025
  checkboxReserveRowMap,
12454
13026
  selectCheckboxMaps,
12455
13027
  treeIndeterminateRowMaps
@@ -12466,11 +13038,12 @@ const Methods = {
12466
13038
  let sLen = 0; // 已选
12467
13039
  let hLen = 0; // 半选
12468
13040
  let vLen = 0; // 有效行
12469
- const rootList = treeConfig ? afterTreeFullData : afterFullData;
13041
+ const rootList = treeConfig ? afterTreeFullData : isRowGroupStatus ? afterGroupFullData : afterFullData;
12470
13042
  rootList.forEach(checkMethod ? row => {
12471
13043
  const childRowid = handleGetRowId(row);
12472
13044
  const selected = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : selectCheckboxMaps[childRowid];
12473
13045
  if (checkMethod({
13046
+ $table: $xeTable,
12474
13047
  row
12475
13048
  })) {
12476
13049
  if (selected) {
@@ -13063,6 +13636,7 @@ const Methods = {
13063
13636
  const radioOpts = $xeTable.computeRadioOpts;
13064
13637
  const checkboxOpts = $xeTable.computeCheckboxOpts;
13065
13638
  const keyboardOpts = $xeTable.computeKeyboardOpts;
13639
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
13066
13640
  const rowOpts = $xeTable.computeRowOpts;
13067
13641
  const columnOpts = $xeTable.computeColumnOpts;
13068
13642
  const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
@@ -13076,7 +13650,8 @@ const Methods = {
13076
13650
  } = params;
13077
13651
  const {
13078
13652
  type,
13079
- treeNode
13653
+ treeNode,
13654
+ rowGroupNode
13080
13655
  } = column;
13081
13656
  const isRadioType = type === 'radio';
13082
13657
  const isCheckboxType = type === 'checkbox';
@@ -13084,8 +13659,9 @@ const Methods = {
13084
13659
  const cell = evnt.currentTarget;
13085
13660
  const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
13086
13661
  const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
13087
- const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree--btn-wrapper').flag;
13662
+ const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
13088
13663
  const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
13664
+ const triggerRowGroupNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-row-group--node-btn').flag;
13089
13665
  params = Object.assign({
13090
13666
  cell,
13091
13667
  triggerRadio,
@@ -13102,11 +13678,15 @@ const Methods = {
13102
13678
  if (treeOpts.trigger === 'row' || treeNode && treeOpts.trigger === 'cell') {
13103
13679
  $xeTable.triggerTreeExpandEvent(evnt, params);
13104
13680
  }
13681
+ // 如果是行分组
13682
+ if (rowGroupOpts.trigger === 'row' || rowGroupNode && rowGroupOpts.trigger === 'cell') {
13683
+ $xeTable.triggerRowGroupExpandEvent(evnt, params);
13684
+ }
13105
13685
  }
13106
13686
  // 如果点击了树节点
13107
13687
  if (!triggerTreeNode) {
13108
- if (!triggerExpandNode) {
13109
- // 如果是高亮行
13688
+ if (!triggerExpandNode && !triggerRowGroupNode) {
13689
+ // 如果是当前行
13110
13690
  if (rowOpts.isCurrent || highlightCurrentRow) {
13111
13691
  if (!triggerCheckbox && !triggerRadio) {
13112
13692
  $xeTable.triggerCurrentRowEvent(evnt, params);
@@ -13372,7 +13952,7 @@ const Methods = {
13372
13952
  const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
13373
13953
  const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
13374
13954
  const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
13375
- const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree--btn-wrapper').flag;
13955
+ const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
13376
13956
  const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
13377
13957
  let isColDragCell = false;
13378
13958
  if (rowOpts.drag) {
@@ -13689,7 +14269,7 @@ const Methods = {
13689
14269
  evnt.preventDefault();
13690
14270
  return;
13691
14271
  }
13692
- const hasCtrlKey = evnt.ctrlKey;
14272
+ const isControlKey = hasControlKey(evnt);
13693
14273
  const trEl = evnt.currentTarget;
13694
14274
  const rowid = trEl.getAttribute('rowid') || '';
13695
14275
  const rest = fullAllDataRowIdData[rowid];
@@ -13703,10 +14283,10 @@ const Methods = {
13703
14283
  } = reactData;
13704
14284
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
13705
14285
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
13706
- internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
14286
+ internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && isControlKey);
13707
14287
  internalData.prevDragRow = row;
13708
14288
  internalData.prevDragPos = dragPos;
13709
- if ($xeTable.eqRow(dragRow, row) || hasCtrlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
14289
+ if ($xeTable.eqRow(dragRow, row) || isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
13710
14290
  showDropTip($xeTable, evnt, trEl, null, false, dragPos);
13711
14291
  return;
13712
14292
  }
@@ -14004,7 +14584,7 @@ const Methods = {
14004
14584
  evnt.preventDefault();
14005
14585
  return;
14006
14586
  }
14007
- const hasCtrlKey = evnt.ctrlKey;
14587
+ const isControlKey = hasControlKey(evnt);
14008
14588
  const thEl = evnt.currentTarget;
14009
14589
  const colid = thEl.getAttribute('colid');
14010
14590
  const column = $xeTable.getColumnById(colid);
@@ -14015,7 +14595,7 @@ const Methods = {
14015
14595
  } = evnt;
14016
14596
  const offsetX = clientX - thEl.getBoundingClientRect().x;
14017
14597
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
14018
- internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
14598
+ internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey);
14019
14599
  internalData.prevDragCol = column;
14020
14600
  internalData.prevDragPos = dragPos;
14021
14601
  if (column.fixed || dragCol && dragCol.id === column.id || !isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId)) {
@@ -14477,7 +15057,7 @@ const Methods = {
14477
15057
  const reactData = $xeTable;
14478
15058
  const internalData = $xeTable;
14479
15059
  const {
14480
- expandColumn: column
15060
+ expandColumn
14481
15061
  } = reactData;
14482
15062
  const {
14483
15063
  rowExpandLazyLoadedMaps
@@ -14497,12 +15077,12 @@ const Methods = {
14497
15077
  const rowid = getRowid($xeTable, row);
14498
15078
  if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
14499
15079
  const expanded = !$xeTable.isRowExpandByRow(row);
14500
- const columnIndex = $xeTable.getColumnIndex(column);
14501
- const $columnIndex = $xeTable.getVMColumnIndex(column);
15080
+ const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
15081
+ const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
14502
15082
  $xeTable.setRowExpand(row, expanded);
14503
15083
  $xeTable.dispatchEvent('toggle-row-expand', {
14504
15084
  expanded,
14505
- column,
15085
+ column: expandColumn,
14506
15086
  columnIndex,
14507
15087
  $columnIndex,
14508
15088
  row,
@@ -14571,8 +15151,8 @@ const Methods = {
14571
15151
  toggleMethod
14572
15152
  } = expandOpts;
14573
15153
  const lazyRests = [];
14574
- const columnIndex = $xeTable.getColumnIndex(expandColumn);
14575
- const $columnIndex = $xeTable.getVMColumnIndex(expandColumn);
15154
+ const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
15155
+ const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
14576
15156
  if (rows) {
14577
15157
  if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
14578
15158
  rows = [rows];
@@ -14658,43 +15238,141 @@ const Methods = {
14658
15238
  const reactData = $xeTable;
14659
15239
  const internalData = $xeTable;
14660
15240
  const {
14661
- tableFullData
15241
+ tableFullData
15242
+ } = internalData;
15243
+ const expandOpts = $xeTable.computeExpandOpts;
15244
+ const {
15245
+ reserve
15246
+ } = expandOpts;
15247
+ const expList = $xeTable.getRowExpandRecords();
15248
+ internalData.rowExpandedMaps = {};
15249
+ reactData.rowExpandedFlag++;
15250
+ if (reserve) {
15251
+ tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
15252
+ }
15253
+ return $xeTable.$nextTick().then(() => {
15254
+ if (expList.length) {
15255
+ return $xeTable.recalculate(true);
15256
+ }
15257
+ }).then(() => {
15258
+ updateRowOffsetTop($xeTable);
15259
+ updateRowExpandStyle($xeTable);
15260
+ handleRowExpandScroll($xeTable);
15261
+ return $xeTable.updateCellAreas();
15262
+ });
15263
+ },
15264
+ clearRowExpandReserve() {
15265
+ this.rowExpandedReserveRowMap = {};
15266
+ return this.$nextTick();
15267
+ },
15268
+ getRowExpandRecords() {
15269
+ const $xeTable = this;
15270
+ const internalData = $xeTable;
15271
+ const rest = [];
15272
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.rowExpandedMaps, item => {
15273
+ if (item) {
15274
+ rest.push(item);
15275
+ }
15276
+ });
15277
+ return rest;
15278
+ },
15279
+ setRowGroups(fieldOrColumns) {
15280
+ const $xeTable = this;
15281
+ const props = $xeTable;
15282
+ const internalData = $xeTable;
15283
+ const {
15284
+ rowGroupConfig
15285
+ } = props;
15286
+ if (!rowGroupConfig) {
15287
+ errLog('vxe.error.reqProp', ['row-group-config']);
15288
+ return $xeTable.$nextTick();
15289
+ }
15290
+ if (fieldOrColumns) {
15291
+ handleUpdateRowGroup($xeTable, (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns]).map(fieldOrColumn => {
15292
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? fieldOrColumn : fieldOrColumn.field;
15293
+ }));
15294
+ return loadTableData($xeTable, internalData.tableSynchData, true);
15295
+ }
15296
+ return $xeTable.$nextTick();
15297
+ },
15298
+ clearRowGroups() {
15299
+ const $xeTable = this;
15300
+ const props = $xeTable;
15301
+ const internalData = $xeTable;
15302
+ const {
15303
+ rowGroupConfig
15304
+ } = props;
15305
+ if (!rowGroupConfig) {
15306
+ errLog('vxe.error.reqProp', ['row-group-config']);
15307
+ return $xeTable.$nextTick();
15308
+ }
15309
+ handleUpdateRowGroup($xeTable, []);
15310
+ return loadTableData($xeTable, internalData.tableSynchData, true);
15311
+ },
15312
+ isRowGroupRecord(row) {
15313
+ const $xeTable = this;
15314
+ const reactData = $xeTable;
15315
+ const {
15316
+ isRowGroupStatus
15317
+ } = reactData;
15318
+ return isRowGroupStatus && row.isAggregate;
15319
+ },
15320
+ isRowGroupExpandByRow(row) {
15321
+ const $xeTable = this;
15322
+ const reactData = $xeTable;
15323
+ const internalData = $xeTable;
15324
+ const {
15325
+ rowGroupExpandedFlag
15326
+ } = reactData;
15327
+ const {
15328
+ rowGroupExpandedMaps
15329
+ } = internalData;
15330
+ return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)];
15331
+ },
15332
+ setRowGroupExpand(rows, expanded) {
15333
+ const $xeTable = this;
15334
+ if (rows) {
15335
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
15336
+ rows = [rows];
15337
+ }
15338
+ return handleRowGroupVirtualExpand($xeTable, rows, expanded);
15339
+ }
15340
+ return $xeTable.$nextTick();
15341
+ },
15342
+ setAllRowGroupExpand(expanded) {
15343
+ const $xeTable = this;
15344
+ const reactData = $xeTable;
15345
+ const internalData = $xeTable;
15346
+ const {
15347
+ tableFullGroupData
14662
15348
  } = internalData;
14663
- const expandOpts = $xeTable.computeExpandOpts;
15349
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
14664
15350
  const {
14665
- reserve
14666
- } = expandOpts;
14667
- const expList = $xeTable.getRowExpandRecords();
14668
- internalData.rowExpandedMaps = {};
14669
- reactData.rowExpandedFlag++;
14670
- if (reserve) {
14671
- tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
15351
+ mapChildrenField
15352
+ } = rowGroupOpts;
15353
+ const rgExpandedMaps = {};
15354
+ if (expanded && mapChildrenField) {
15355
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, row => {
15356
+ if (row[mapChildrenField] && row[mapChildrenField].length) {
15357
+ rgExpandedMaps[getRowid($xeTable, row)] = row;
15358
+ }
15359
+ }, {
15360
+ children: mapChildrenField
15361
+ });
14672
15362
  }
14673
- return $xeTable.$nextTick().then(() => {
14674
- if (expList.length) {
14675
- return $xeTable.recalculate(true);
14676
- }
14677
- }).then(() => {
14678
- updateRowOffsetTop($xeTable);
14679
- updateRowExpandStyle($xeTable);
14680
- handleRowExpandScroll($xeTable);
14681
- return $xeTable.updateCellAreas();
14682
- });
14683
- },
14684
- clearRowExpandReserve() {
14685
- this.rowExpandedReserveRowMap = {};
14686
- return this.$nextTick();
15363
+ internalData.rowGroupExpandedMaps = rgExpandedMaps;
15364
+ handleVirtualTreeToList($xeTable);
15365
+ reactData.rowGroupExpandedFlag++;
15366
+ return $xeTable.handleTableData();
14687
15367
  },
14688
- getRowExpandRecords() {
15368
+ clearRowGroupExpand() {
14689
15369
  const $xeTable = this;
15370
+ const reactData = $xeTable;
14690
15371
  const internalData = $xeTable;
14691
- const rest = [];
14692
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.rowExpandedMaps, item => {
14693
- if (item) {
14694
- rest.push(item);
14695
- }
14696
- });
14697
- return rest;
15372
+ internalData.rowGroupExpandedMaps = {};
15373
+ handleVirtualTreeToList($xeTable);
15374
+ reactData.rowGroupExpandedFlag++;
15375
+ return $xeTable.handleTableData();
14698
15376
  },
14699
15377
  getTreeExpandRecords() {
14700
15378
  const $xeTable = this;
@@ -14763,11 +15441,11 @@ const Methods = {
14763
15441
  });
14764
15442
  }
14765
15443
  internalData.treeExpandedMaps = {};
14766
- reactData.treeExpandedFlag++;
14767
15444
  if (transform) {
14768
15445
  handleVirtualTreeToList($xeTable);
14769
- return $xeTable.handleTableData();
15446
+ $xeTable.handleTableData();
14770
15447
  }
15448
+ reactData.treeExpandedFlag++;
14771
15449
  return $xeTable.$nextTick();
14772
15450
  },
14773
15451
  /**
@@ -14776,6 +15454,7 @@ const Methods = {
14776
15454
  */
14777
15455
  reloadTreeExpand(row) {
14778
15456
  const $xeTable = this;
15457
+ const reactData = $xeTable;
14779
15458
  const internalData = $xeTable;
14780
15459
  const {
14781
15460
  treeExpandLazyLoadedMaps
@@ -14793,8 +15472,9 @@ const Methods = {
14793
15472
  }).then(() => {
14794
15473
  if (transform) {
14795
15474
  handleVirtualTreeToList($xeTable);
14796
- return $xeTable.handleTableData();
15475
+ $xeTable.handleTableData();
14797
15476
  }
15477
+ reactData.treeExpandedFlag++;
14798
15478
  }).then(() => {
14799
15479
  return $xeTable.recalculate();
14800
15480
  });
@@ -14809,6 +15489,40 @@ const Methods = {
14809
15489
  // 即将废弃
14810
15490
  return $xeTable.reloadTreeExpand(row);
14811
15491
  },
15492
+ /**
15493
+ * 行分组事件
15494
+ */
15495
+ triggerRowGroupExpandEvent(evnt, params) {
15496
+ const $xeTable = this;
15497
+ const internalData = $xeTable;
15498
+ const {
15499
+ rowGroupExpandedMaps
15500
+ } = internalData;
15501
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
15502
+ const {
15503
+ row,
15504
+ column
15505
+ } = params;
15506
+ const {
15507
+ trigger
15508
+ } = rowGroupOpts;
15509
+ if (trigger === 'manual') {
15510
+ return;
15511
+ }
15512
+ evnt.stopPropagation();
15513
+ const rowid = getRowid($xeTable, row);
15514
+ const expanded = !rowGroupExpandedMaps[rowid];
15515
+ const columnIndex = $xeTable.getColumnIndex(column);
15516
+ const $columnIndex = $xeTable.getVMColumnIndex(column);
15517
+ $xeTable.setRowGroupExpand(row, expanded);
15518
+ $xeTable.dispatchEvent('toggle-row-group-expand', {
15519
+ expanded,
15520
+ column,
15521
+ columnIndex,
15522
+ $columnIndex,
15523
+ row
15524
+ }, evnt);
15525
+ },
14812
15526
  /**
14813
15527
  * 展开树节点事件
14814
15528
  */
@@ -14869,11 +15583,15 @@ const Methods = {
14869
15583
  * @param {Boolean} expanded 是否展开
14870
15584
  */
14871
15585
  setAllTreeExpand(expanded) {
15586
+ const $xeTable = this;
15587
+ const reactData = $xeTable;
15588
+ const internalData = $xeTable;
14872
15589
  const {
14873
- tableFullData,
14874
- treeOpts
14875
- } = this;
15590
+ tableFullData
15591
+ } = internalData;
15592
+ const treeOpts = $xeTable.computeTreeOpts;
14876
15593
  const {
15594
+ transform,
14877
15595
  lazy
14878
15596
  } = treeOpts;
14879
15597
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -14886,7 +15604,13 @@ const Methods = {
14886
15604
  }, {
14887
15605
  children: childrenField
14888
15606
  });
14889
- return this.setTreeExpand(expandeds, expanded);
15607
+ return $xeTable.setTreeExpand(expandeds, expanded).then(() => {
15608
+ if (transform) {
15609
+ handleVirtualTreeToList($xeTable);
15610
+ reactData.treeExpandedFlag++;
15611
+ return $xeTable.recalculate();
15612
+ }
15613
+ });
14890
15614
  },
14891
15615
  /**
14892
15616
  * 设置展开树形节点,二个参数设置这一行展开与否
@@ -14952,7 +15676,6 @@ const Methods = {
14952
15676
  } = treeOpts;
14953
15677
  const expList = $xeTable.getTreeExpandRecords();
14954
15678
  internalData.treeExpandedMaps = {};
14955
- reactData.treeExpandedFlag++;
14956
15679
  if (reserve) {
14957
15680
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), {
14958
15681
  children: childrenField
@@ -14961,8 +15684,9 @@ const Methods = {
14961
15684
  return $xeTable.handleTableData().then(() => {
14962
15685
  if (transform) {
14963
15686
  handleVirtualTreeToList($xeTable);
14964
- return $xeTable.handleTableData();
15687
+ $xeTable.handleTableData();
14965
15688
  }
15689
+ reactData.treeExpandedFlag++;
14966
15690
  }).then(() => {
14967
15691
  if (expList.length) {
14968
15692
  $xeTable.recalculate();
@@ -15854,27 +16578,37 @@ const Methods = {
15854
16578
  * @param {Row} row 行对象
15855
16579
  */
15856
16580
  scrollToTreeRow(row) {
16581
+ const $xeTable = this;
16582
+ const props = $xeTable;
16583
+ const reactData = $xeTable;
16584
+ const internalData = $xeTable;
15857
16585
  const {
15858
- tableFullData,
15859
- treeConfig,
15860
- treeOpts
15861
- } = this;
15862
- const childrenField = treeOpts.children || treeOpts.childrenField;
16586
+ treeConfig
16587
+ } = props;
16588
+ const {
16589
+ isRowGroupStatus
16590
+ } = reactData;
16591
+ const {
16592
+ tableFullData
16593
+ } = internalData;
15863
16594
  const rests = [];
15864
- if (treeConfig) {
15865
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullData, item => item === row, {
15866
- children: childrenField
16595
+ if (treeConfig || isRowGroupStatus) {
16596
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
16597
+ const treeOpts = $xeTable.computeTreeOpts;
16598
+ const childrenField = treeOpts.children || treeOpts.childrenField;
16599
+ const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullData, item => $xeTable.eqRow(item, row), {
16600
+ children: isRowGroupStatus ? rowGroupOpts.mapChildrenField : childrenField
15867
16601
  });
15868
16602
  if (matchObj) {
15869
16603
  const nodes = matchObj.nodes;
15870
16604
  nodes.forEach((row, index) => {
15871
- if (index < nodes.length - 1 && !this.isTreeExpandByRow(row)) {
15872
- rests.push(this.setTreeExpand(row, true));
16605
+ if (index < nodes.length - 1 && !$xeTable.isTreeExpandByRow(row)) {
16606
+ rests.push($xeTable.setTreeExpand(row, true));
15873
16607
  }
15874
16608
  });
15875
16609
  }
15876
16610
  }
15877
- return Promise.all(rests).then(() => rowToVisible(this, row));
16611
+ return Promise.all(rests).then(() => rowToVisible($xeTable, row));
15878
16612
  },
15879
16613
  /**
15880
16614
  * 手动清除滚动相关信息,还原到初始状态
@@ -16204,8 +16938,7 @@ const isVMScrollProcess = $xeTable => {
16204
16938
  } = tableReactData;
16205
16939
  return !!(isDragResize || lastScrollTime && Date.now() < lastScrollTime + delayHover);
16206
16940
  };
16207
- function renderLine(h, _vm, rowid, params, cellHeight) {
16208
- const $xeTable = _vm.$parent;
16941
+ function renderLine(h, $xeTable, rowid, params, cellHeight) {
16209
16942
  const tableProps = $xeTable;
16210
16943
  const tableInternalData = $xeTable;
16211
16944
  const {
@@ -16254,8 +16987,7 @@ function renderLine(h, _vm, rowid, params, cellHeight) {
16254
16987
  /**
16255
16988
  * 渲染列
16256
16989
  */
16257
- function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
16258
- const $xeTable = _vm.$parent;
16990
+ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
16259
16991
  const tableProps = $xeTable;
16260
16992
  const tableReactData = $xeTable;
16261
16993
  const tableInternalData = $xeTable;
@@ -16550,7 +17282,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
16550
17282
  }));
16551
17283
  } else {
16552
17284
  // 渲染单元格
16553
- tdVNs.push(...renderLine(h, _vm, rowid, cellParams, cellHeight), h('div', {
17285
+ tdVNs.push(...renderLine(h, $xeTable, rowid, cellParams, cellHeight), h('div', {
16554
17286
  key: 'tc',
16555
17287
  class: ['vxe-cell', {
16556
17288
  'c--title': showTitle,
@@ -16649,6 +17381,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16649
17381
  const tableProps = $xeTable;
16650
17382
  const tableReactData = $xeTable;
16651
17383
  const tableInternalData = $xeTable;
17384
+ const $xeGrid = $xeTable.$xeGrid;
16652
17385
  const {
16653
17386
  stripe,
16654
17387
  rowKey,
@@ -16670,10 +17403,12 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16670
17403
  selectRadioRow,
16671
17404
  pendingRowFlag,
16672
17405
  isDragColMove,
16673
- rowExpandHeightFlag
17406
+ rowExpandHeightFlag,
17407
+ isRowGroupStatus
16674
17408
  } = tableReactData;
16675
17409
  const {
16676
17410
  fullAllDataRowIdData,
17411
+ fullColumnIdData,
16677
17412
  treeExpandedMaps,
16678
17413
  pendingRowMaps,
16679
17414
  rowExpandedMaps
@@ -16694,6 +17429,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16694
17429
  const {
16695
17430
  handleGetRowId
16696
17431
  } = createHandleGetRowId($xeTable);
17432
+ const isDeepRow = treeConfig || isRowGroupStatus;
16697
17433
  tableData.forEach((row, $rowIndex) => {
16698
17434
  const trOn = {};
16699
17435
  const rowid = handleGetRowId(row);
@@ -16702,6 +17438,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16702
17438
  let rowLevel = 0;
16703
17439
  let seq = -1;
16704
17440
  let _rowIndex = -1;
17441
+ const hasRowGroupAggregate = isRowGroupStatus && row.isAggregate;
16705
17442
  // 当前行事件
16706
17443
  if (rowOpts.isHover || highlightHoverRow) {
16707
17444
  trOn.mouseenter = evnt => {
@@ -16722,7 +17459,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16722
17459
  }
16723
17460
  if (rowRest) {
16724
17461
  rowLevel = rowRest.level;
16725
- if (treeConfig && transform && seqMode === 'increasing') {
17462
+ if (hasRowGroupAggregate || treeConfig && transform && seqMode === 'increasing') {
16726
17463
  seq = rowRest._index + 1;
16727
17464
  } else {
16728
17465
  seq = rowRest.seq;
@@ -16757,12 +17494,12 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16757
17494
  isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
16758
17495
  }
16759
17496
  // 拖拽行事件
16760
- if (rowOpts.drag && (!treeConfig || transform)) {
17497
+ if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
16761
17498
  trOn.dragstart = $xeTable.handleRowDragDragstartEvent;
16762
17499
  trOn.dragend = $xeTable.handleRowDragDragendEvent;
16763
17500
  trOn.dragover = $xeTable.handleRowDragDragoverEvent;
16764
17501
  }
16765
- const trClass = ['vxe-body--row', treeConfig ? `row--level-${rowLevel}` : '', {
17502
+ const trClass = ['vxe-body--row', isDeepRow ? `row--level-${rowLevel}` : '', {
16766
17503
  'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
16767
17504
  'is--new': isNewRow,
16768
17505
  'is--expand-row': isExpandRow,
@@ -16770,10 +17507,11 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16770
17507
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
16771
17508
  'row--radio': radioOpts.highlight && selectRadioRow === row,
16772
17509
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
16773
- 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
17510
+ 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid],
17511
+ 'row--group': hasRowGroupAggregate
16774
17512
  }, rowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowClassName) ? rowClassName(params) : rowClassName : ''];
16775
17513
  const tdVNs = tableColumn.map((column, $columnIndex) => {
16776
- return renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
17514
+ return renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
16777
17515
  });
16778
17516
  rows.push(!isColLoading && columnOpts.drag && columnDragOpts.animation ? h('transition-group', {
16779
17517
  props: {
@@ -16785,7 +17523,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16785
17523
  rowid
16786
17524
  },
16787
17525
  style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(params) : rowStyle : undefined,
16788
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
17526
+ key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
16789
17527
  nativeOn: trOn
16790
17528
  }, tdVNs) : h('tr', {
16791
17529
  class: trClass,
@@ -16793,7 +17531,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16793
17531
  rowid
16794
17532
  },
16795
17533
  style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(params) : rowStyle : undefined,
16796
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
17534
+ key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
16797
17535
  on: trOn
16798
17536
  }, tdVNs));
16799
17537
  // 如果行被展开了
@@ -16830,19 +17568,39 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16830
17568
  }
16831
17569
  const {
16832
17570
  showOverflow
16833
- } = expandColumn;
17571
+ } = expandColumn || {};
17572
+ const colid = expandColumn.id;
17573
+ const colRest = fullColumnIdData[colid] || {};
16834
17574
  const hasEllipsis = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(showOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNull(showOverflow) ? isAllOverflow : showOverflow;
17575
+ let columnIndex = -1;
17576
+ let $columnIndex = -1;
17577
+ let _columnIndex = -1;
17578
+ if (colRest) {
17579
+ columnIndex = colRest.index;
17580
+ $columnIndex = colRest.$index;
17581
+ _columnIndex = colRest._index;
17582
+ }
16835
17583
  const expandParams = {
17584
+ $grid: $xeGrid,
16836
17585
  $table: $xeTable,
16837
17586
  seq,
16838
17587
  column: expandColumn,
17588
+ columnIndex,
17589
+ $columnIndex,
17590
+ _columnIndex,
16839
17591
  fixed: fixedType,
16840
17592
  type: renderType,
16841
17593
  level: rowLevel,
16842
17594
  row,
17595
+ rowid,
16843
17596
  rowIndex,
16844
17597
  $rowIndex,
16845
- _rowIndex
17598
+ _rowIndex,
17599
+ isHidden: false,
17600
+ isEdit: false,
17601
+ visibleData: [],
17602
+ data: [],
17603
+ items: []
16846
17604
  };
16847
17605
  rows.push(h('tr', {
16848
17606
  class: ['vxe-body--expanded-row', {
@@ -18250,19 +19008,21 @@ const {
18250
19008
  syncResize: [Boolean, String, Number],
18251
19009
  // 响应式布局配置项
18252
19010
  resizeConfig: Object,
18253
- // 列配置信息
19011
+ // 列配置项
18254
19012
  columnConfig: Object,
18255
- // 当前列配置信息
19013
+ // 当前列配置项
18256
19014
  currentColumnConfig: Object,
18257
- // 单元格配置信息
19015
+ // 单元格配置项
18258
19016
  cellConfig: Object,
18259
- // 表头单元格配置信息
19017
+ // 表头单元格配置项
18260
19018
  headerCellConfig: Object,
18261
- // 表尾单元格配置信息
19019
+ // 表尾单元格配置项
18262
19020
  footerCellConfig: Object,
18263
- // 行配置信息
19021
+ // 行配置项
18264
19022
  rowConfig: Object,
18265
- // 当前行配置信息
19023
+ // 行分组配置项
19024
+ rowGroupConfig: Object,
19025
+ // 当前行配置项
18266
19026
  currentRowConfig: Object,
18267
19027
  // 已废弃,被 rowDragConfig 替换
18268
19028
  dragConfig: Object,
@@ -18483,6 +19243,7 @@ const renderSimplePanel = (h, _vm) => {
18483
19243
  };
18484
19244
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
18485
19245
  const isVisible = visibleMethod ? visibleMethod({
19246
+ $table: $xeTable,
18486
19247
  column
18487
19248
  }) : true;
18488
19249
  if (isVisible) {
@@ -18491,6 +19252,7 @@ const renderSimplePanel = (h, _vm) => {
18491
19252
  const isColGroup = column.children && column.children.length;
18492
19253
  const colTitle = formatText(column.getTitle(), 1);
18493
19254
  const isDisabled = checkMethod ? !checkMethod({
19255
+ $table: $xeTable,
18494
19256
  column
18495
19257
  }) : false;
18496
19258
  const isHidden = !isChecked;
@@ -18744,6 +19506,7 @@ const renderPopupPanel = (h, _vm) => {
18744
19506
  };
18745
19507
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
18746
19508
  const isVisible = visibleMethod ? visibleMethod({
19509
+ $table: $xeTable,
18747
19510
  column
18748
19511
  }) : true;
18749
19512
  if (isVisible) {
@@ -18770,6 +19533,7 @@ const renderPopupPanel = (h, _vm) => {
18770
19533
  const colTitle = formatText(column.getTitle(), 1);
18771
19534
  const isColGroup = column.children && column.children.length;
18772
19535
  const isDisabled = checkMethod ? !checkMethod({
19536
+ $table: $xeTable,
18773
19537
  column
18774
19538
  }) : false;
18775
19539
  const isHidden = !isChecked;
@@ -19501,7 +20265,7 @@ const renderPopupPanel = (h, _vm) => {
19501
20265
  isToChildDrag
19502
20266
  } = columnDragOpts;
19503
20267
  const optEl = evnt.currentTarget;
19504
- const hasCtrlKey = evnt.ctrlKey;
20268
+ const isControlKey = hasControlKey(evnt);
19505
20269
  const colid = optEl.getAttribute('colid');
19506
20270
  const column = $xeTable.getColumnById(colid);
19507
20271
  // 是否移入有效列
@@ -19513,7 +20277,7 @@ const renderPopupPanel = (h, _vm) => {
19513
20277
  panel_showDropTip(this, evnt, optEl, false, dragPos);
19514
20278
  return;
19515
20279
  }
19516
- this.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey && immediate);
20280
+ this.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey && immediate);
19517
20281
  this.prevDragCol = column;
19518
20282
  this.prevDragPos = dragPos;
19519
20283
  panel_showDropTip(this, evnt, optEl, true, dragPos);
@@ -22695,6 +23459,7 @@ function getSeq($xeTable, cellValue, row, $rowIndex, column, $columnIndex) {
22695
23459
  const seqMethod = seqOpts.seqMethod || column.seqMethod;
22696
23460
  if (seqMethod) {
22697
23461
  return seqMethod({
23462
+ $table: $xeTable,
22698
23463
  row,
22699
23464
  rowIndex: $xeTable.getRowIndex(row),
22700
23465
  $rowIndex,
@@ -22787,6 +23552,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
22787
23552
  cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
22788
23553
  item._checkboxLabel = checkboxOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkboxOpts.labelField) : '';
22789
23554
  item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
23555
+ $table: $xeTable,
22790
23556
  row
22791
23557
  });
22792
23558
  break;
@@ -22794,6 +23560,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
22794
23560
  cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
22795
23561
  item._radioLabel = radioOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, radioOpts.labelField) : '';
22796
23562
  item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
23563
+ $table: $xeTable,
22797
23564
  row
22798
23565
  });
22799
23566
  break;
@@ -22857,6 +23624,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
22857
23624
  cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
22858
23625
  item._checkboxLabel = checkboxOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkboxOpts.labelField) : '';
22859
23626
  item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
23627
+ $table: $xeTable,
22860
23628
  row
22861
23629
  });
22862
23630
  break;
@@ -22864,6 +23632,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
22864
23632
  cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
22865
23633
  item._radioLabel = radioOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, radioOpts.labelField) : '';
22866
23634
  item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
23635
+ $table: $xeTable,
22867
23636
  row
22868
23637
  });
22869
23638
  break;
@@ -22897,6 +23666,7 @@ function getExportData($xeTable, opts) {
22897
23666
  let datas = opts.data;
22898
23667
  if (dataFilterMethod) {
22899
23668
  datas = datas.filter((row, index) => dataFilterMethod({
23669
+ $table: $xeTable,
22900
23670
  row,
22901
23671
  $rowIndex: index
22902
23672
  }));
@@ -22946,11 +23716,12 @@ function getFooterCellValue($xeTable, opts, row, column) {
22946
23716
  }
22947
23717
  return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
22948
23718
  }
22949
- function getFooterData(opts, footerTableData) {
23719
+ function getFooterData($xeTable, opts, footerTableData) {
22950
23720
  const {
22951
23721
  footerFilterMethod
22952
23722
  } = opts;
22953
23723
  return footerFilterMethod ? footerTableData.filter((items, index) => footerFilterMethod({
23724
+ $table: $xeTable,
22954
23725
  items,
22955
23726
  $rowIndex: index
22956
23727
  })) : footerTableData;
@@ -22996,7 +23767,7 @@ function toCsv($xeTable, opts, columns, datas) {
22996
23767
  const {
22997
23768
  footerTableData
22998
23769
  } = reactData;
22999
- const footers = getFooterData(opts, footerTableData);
23770
+ const footers = getFooterData($xeTable, opts, footerTableData);
23000
23771
  footers.forEach(row => {
23001
23772
  content += columns.map(column => toTxtCellLabel(getFooterCellValue($xeTable, opts, row, column))).join(',') + enterSymbol;
23002
23773
  });
@@ -23016,7 +23787,7 @@ function toTxt($xeTable, opts, columns, datas) {
23016
23787
  const {
23017
23788
  footerTableData
23018
23789
  } = reactData;
23019
- const footers = getFooterData(opts, footerTableData);
23790
+ const footers = getFooterData($xeTable, opts, footerTableData);
23020
23791
  footers.forEach(row => {
23021
23792
  content += columns.map(column => toTxtCellLabel(getFooterCellValue($xeTable, opts, row, column))).join('\t') + enterSymbol;
23022
23793
  });
@@ -23198,7 +23969,7 @@ function toHtml($xeTable, opts, columns, datas) {
23198
23969
  const {
23199
23970
  footerTableData
23200
23971
  } = reactData;
23201
- const footers = getFooterData(opts, footerTableData);
23972
+ const footers = getFooterData($xeTable, opts, footerTableData);
23202
23973
  if (footers.length) {
23203
23974
  tables.push('<tfoot>');
23204
23975
  footers.forEach(row => {
@@ -23233,7 +24004,7 @@ function toXML($xeTable, opts, columns, datas) {
23233
24004
  const {
23234
24005
  footerTableData
23235
24006
  } = reactData;
23236
- const footers = getFooterData(opts, footerTableData);
24007
+ const footers = getFooterData($xeTable, opts, footerTableData);
23237
24008
  footers.forEach(row => {
23238
24009
  xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($xeTable, opts, row, column)}</Data></Cell>`).join('')}</Row>`;
23239
24010
  });
@@ -23933,6 +24704,7 @@ function handleExportAndPrint($xeTable, options, isPrint) {
23933
24704
  column.checked = isChecked;
23934
24705
  column.halfChecked = false;
23935
24706
  column.disabled = parent && parent.disabled || (checkMethod ? !checkMethod({
24707
+ $table: $xeTable,
23936
24708
  column
23937
24709
  }) : false);
23938
24710
  });
@@ -25062,8 +25834,9 @@ function handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRigh
25062
25834
  const rangeRows = getCheckboxRangeRows(this, evnt, params, trElem, trRect, offsetClientTop, offsetTop < marginSize ? -rangeHeight : rangeHeight);
25063
25835
  // 至少滑动 10px 才能有效匹配
25064
25836
  if (rangeHeight > 10 && rangeRows.length !== lastRangeRows.length) {
25837
+ const isControlKey = hasControlKey(evnt);
25065
25838
  lastRangeRows = rangeRows;
25066
- if (evnt.ctrlKey) {
25839
+ if (isControlKey) {
25067
25840
  rangeRows.forEach(row => {
25068
25841
  $xeTable.handleBatchSelectRows([row], selectRecords.indexOf(row) === -1);
25069
25842
  });
@@ -25780,6 +26553,26 @@ function validErrorRuleValue(rule, val) {
25780
26553
  });
25781
26554
  ;// CONCATENATED MODULE: ./packages/table/module/custom/mixin.ts
25782
26555
 
26556
+ function calcMaxHeight($xeTable) {
26557
+ const reactData = $xeTable;
26558
+ const {
26559
+ customStore
26560
+ } = reactData;
26561
+ const el = $xeTable.$refs.refElem;
26562
+ // 判断面板不能大于表格高度
26563
+ let tableHeight = 0;
26564
+ if (el) {
26565
+ tableHeight = el.clientHeight - 28;
26566
+ }
26567
+ customStore.maxHeight = Math.max(88, tableHeight);
26568
+ }
26569
+ function emitCustomEvent($xeTable, type, evnt) {
26570
+ const $xeGrid = $xeTable.$xeGrid;
26571
+ const comp = $xeGrid || $xeTable;
26572
+ comp.dispatchEvent('custom', {
26573
+ type
26574
+ }, evnt);
26575
+ }
25783
26576
  /* harmony default export */ var custom_mixin = ({
25784
26577
  methods: {
25785
26578
  _openCustom() {
@@ -25793,21 +26586,23 @@ function validErrorRuleValue(rule, val) {
25793
26586
  initStore.custom = true;
25794
26587
  $xeTable.handleUpdateCustomColumn();
25795
26588
  $xeTable.checkCustomStatus();
25796
- $xeTable.calcMaxHeight();
25797
- return this.$nextTick().then(() => this.calcMaxHeight());
26589
+ calcMaxHeight($xeTable);
26590
+ return $xeTable.$nextTick().then(() => calcMaxHeight($xeTable));
25798
26591
  },
25799
26592
  _closeCustom() {
26593
+ const $xeTable = this;
26594
+ const reactData = $xeTable;
25800
26595
  const {
25801
- customStore,
25802
- customOpts
25803
- } = this;
26596
+ customStore
26597
+ } = reactData;
26598
+ const customOpts = $xeTable.computeCustomOpts;
25804
26599
  if (customStore.visible) {
25805
26600
  customStore.visible = false;
25806
26601
  if (!customOpts.immediate) {
25807
- this.handleCustom();
26602
+ $xeTable.handleCustom();
25808
26603
  }
25809
26604
  }
25810
- return this.$nextTick();
26605
+ return $xeTable.$nextTick();
25811
26606
  },
25812
26607
  _saveCustom() {
25813
26608
  const $xeTable = this;
@@ -25856,16 +26651,17 @@ function validErrorRuleValue(rule, val) {
25856
26651
  },
25857
26652
  _cancelCustom() {
25858
26653
  const $xeTable = this;
26654
+ const reactData = $xeTable;
25859
26655
  const {
25860
- customStore,
25861
- customOpts,
25862
- customColumnList
25863
- } = $xeTable;
26656
+ customColumnList,
26657
+ customStore
26658
+ } = reactData;
25864
26659
  const {
25865
26660
  oldSortMaps,
25866
26661
  oldFixedMaps,
25867
26662
  oldVisibleMaps
25868
26663
  } = customStore;
26664
+ const customOpts = $xeTable.computeCustomOpts;
25869
26665
  const {
25870
26666
  allowVisible,
25871
26667
  allowSort,
@@ -25900,9 +26696,9 @@ function validErrorRuleValue(rule, val) {
25900
26696
  const reactData = $xeTable;
25901
26697
  const internalData = $xeTable;
25902
26698
  const {
25903
- collectColumn,
25904
- customOpts
26699
+ collectColumn
25905
26700
  } = internalData;
26701
+ const customOpts = $xeTable.computeCustomOpts;
25906
26702
  const {
25907
26703
  checkMethod
25908
26704
  } = customOpts;
@@ -25923,6 +26719,7 @@ function validErrorRuleValue(rule, val) {
25923
26719
  column.renderSortNumber = column.sortNumber;
25924
26720
  }
25925
26721
  if (!checkMethod || checkMethod({
26722
+ $table: $xeTable,
25926
26723
  column
25927
26724
  })) {
25928
26725
  column.visible = column.defaultVisible;
@@ -25945,11 +26742,11 @@ function validErrorRuleValue(rule, val) {
25945
26742
  const reactData = $xeTable;
25946
26743
  const {
25947
26744
  customStore
25948
- } = this;
26745
+ } = reactData;
25949
26746
  const {
25950
- customColumnList,
25951
- customOpts
25952
- } = this;
26747
+ customColumnList
26748
+ } = reactData;
26749
+ const customOpts = $xeTable.computeCustomOpts;
25953
26750
  const {
25954
26751
  checkMethod,
25955
26752
  visibleMethod
@@ -25958,11 +26755,13 @@ function validErrorRuleValue(rule, val) {
25958
26755
  if (customOpts.immediate) {
25959
26756
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
25960
26757
  if (visibleMethod && !visibleMethod({
26758
+ $table: $xeTable,
25961
26759
  column
25962
26760
  })) {
25963
26761
  return;
25964
26762
  }
25965
26763
  if (checkMethod && !checkMethod({
26764
+ $table: $xeTable,
25966
26765
  column
25967
26766
  })) {
25968
26767
  return;
@@ -25978,11 +26777,13 @@ function validErrorRuleValue(rule, val) {
25978
26777
  } else {
25979
26778
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
25980
26779
  if (visibleMethod && !visibleMethod({
26780
+ $table: $xeTable,
25981
26781
  column
25982
26782
  })) {
25983
26783
  return;
25984
26784
  }
25985
26785
  if (checkMethod && !checkMethod({
26786
+ $table: $xeTable,
25986
26787
  column
25987
26788
  })) {
25988
26789
  return;
@@ -25994,31 +26795,26 @@ function validErrorRuleValue(rule, val) {
25994
26795
  }
25995
26796
  $xeTable.checkCustomStatus();
25996
26797
  },
25997
- calcMaxHeight() {
26798
+ checkCustomStatus() {
26799
+ const $xeTable = this;
26800
+ const reactData = $xeTable;
26801
+ const internalData = $xeTable;
25998
26802
  const {
25999
- $el,
26000
26803
  customStore
26001
- } = this;
26002
- // 判断面板不能大于表格高度
26003
- let tableHeight = 0;
26004
- if ($el) {
26005
- tableHeight = $el.clientHeight - 28;
26006
- }
26007
- customStore.maxHeight = Math.max(88, tableHeight);
26008
- },
26009
- checkCustomStatus() {
26804
+ } = reactData;
26010
26805
  const {
26011
- customStore,
26012
- collectColumn,
26013
- customOpts
26014
- } = this;
26806
+ collectColumn
26807
+ } = internalData;
26808
+ const customOpts = $xeTable.computeCustomOpts;
26015
26809
  const {
26016
26810
  checkMethod
26017
26811
  } = customOpts;
26018
26812
  customStore.isAll = collectColumn.every(column => (checkMethod ? !checkMethod({
26813
+ $table: $xeTable,
26019
26814
  column
26020
26815
  }) : false) || column.renderVisible);
26021
26816
  customStore.isIndeterminate = !customStore.isAll && collectColumn.some(column => (!checkMethod || checkMethod({
26817
+ $table: $xeTable,
26022
26818
  column
26023
26819
  })) && (column.renderVisible || column.halfVisible));
26024
26820
  },
@@ -26026,45 +26822,48 @@ function validErrorRuleValue(rule, val) {
26026
26822
  const $xeTable = this;
26027
26823
  const $xeGrid = $xeTable.$xeGrid;
26028
26824
  const comp = $xeGrid || $xeTable;
26029
- comp.$emit('custom', {
26030
- type,
26031
- $table: $xeTable,
26032
- $grid: $xeGrid,
26033
- $event: evnt
26034
- });
26825
+ comp.dispatchEvent('custom', {
26826
+ type
26827
+ }, evnt);
26035
26828
  },
26036
26829
  triggerCustomEvent(evnt) {
26830
+ const $xeTable = this;
26831
+ const reactData = $xeTable;
26037
26832
  const {
26038
26833
  customStore
26039
- } = this;
26834
+ } = reactData;
26040
26835
  if (customStore.visible) {
26041
26836
  this.closeCustom();
26042
- this.emitCustomEvent('close', evnt);
26837
+ emitCustomEvent($xeTable, 'close', evnt);
26043
26838
  } else {
26044
26839
  customStore.btnEl = evnt.target;
26045
26840
  this.openCustom();
26046
- this.emitCustomEvent('open', evnt);
26841
+ emitCustomEvent($xeTable, 'open', evnt);
26047
26842
  }
26048
26843
  },
26049
26844
  customOpenEvent(evnt) {
26845
+ const $xeTable = this;
26846
+ const reactData = $xeTable;
26050
26847
  const {
26051
26848
  customStore
26052
- } = this;
26053
- if (!customStore.visible) {
26849
+ } = reactData;
26850
+ if (customStore.visible) {
26054
26851
  customStore.activeBtn = true;
26055
26852
  customStore.btnEl = evnt.target;
26056
- this.openCustom();
26057
- this.emitCustomEvent('open', evnt);
26853
+ $xeTable.openCustom();
26854
+ emitCustomEvent($xeTable, 'open', evnt);
26058
26855
  }
26059
26856
  },
26060
26857
  customCloseEvent(evnt) {
26858
+ const $xeTable = this;
26859
+ const reactData = $xeTable;
26061
26860
  const {
26062
26861
  customStore
26063
- } = this;
26862
+ } = reactData;
26064
26863
  if (customStore.visible) {
26065
26864
  customStore.activeBtn = false;
26066
- this.closeCustom();
26067
- this.emitCustomEvent('close', evnt);
26865
+ $xeTable.closeCustom();
26866
+ emitCustomEvent($xeTable, 'close', evnt);
26068
26867
  }
26069
26868
  },
26070
26869
  handleUpdateCustomColumn() {
@@ -26290,11 +27089,13 @@ function renderRowExpandedVNs(h, $xeTable) {
26290
27089
  const props = $xeTable;
26291
27090
  const reactData = $xeTable;
26292
27091
  const internalData = $xeTable;
27092
+ const $xeGrid = $xeTable.$xeGrid;
26293
27093
  const {
26294
27094
  treeConfig
26295
27095
  } = props;
26296
27096
  const {
26297
- expandColumn
27097
+ expandColumn,
27098
+ isRowGroupStatus
26298
27099
  } = reactData;
26299
27100
  const tableRowExpandedList = $xeTable.computeTableRowExpandedList;
26300
27101
  const expandOpts = $xeTable.computeExpandOpts;
@@ -26316,10 +27117,12 @@ function renderRowExpandedVNs(h, $xeTable) {
26316
27117
  const expandOpts = $xeTable.computeExpandOpts;
26317
27118
  const {
26318
27119
  height: expandHeight,
26319
- padding
27120
+ padding,
27121
+ indent
26320
27122
  } = expandOpts;
26321
27123
  const {
26322
- fullAllDataRowIdData
27124
+ fullAllDataRowIdData,
27125
+ fullColumnIdData
26323
27126
  } = internalData;
26324
27127
  const treeOpts = $xeTable.computeTreeOpts;
26325
27128
  const {
@@ -26329,6 +27132,8 @@ function renderRowExpandedVNs(h, $xeTable) {
26329
27132
  const cellStyle = {};
26330
27133
  const rowid = handleGetRowId(row);
26331
27134
  const rowRest = fullAllDataRowIdData[rowid];
27135
+ const colid = expandColumn.id;
27136
+ const colRest = fullColumnIdData[colid] || {};
26332
27137
  let rowLevel = 0;
26333
27138
  let seq = -1;
26334
27139
  let _rowIndex = -1;
@@ -26336,7 +27141,7 @@ function renderRowExpandedVNs(h, $xeTable) {
26336
27141
  let $rowIndex = -1;
26337
27142
  if (rowRest) {
26338
27143
  rowLevel = rowRest.level;
26339
- if (treeConfig && transform && seqMode === 'increasing') {
27144
+ if (isRowGroupStatus || treeConfig && transform && seqMode === 'increasing') {
26340
27145
  seq = rowRest._index + 1;
26341
27146
  } else {
26342
27147
  seq = rowRest.seq;
@@ -26348,20 +27153,38 @@ function renderRowExpandedVNs(h, $xeTable) {
26348
27153
  if (expandHeight) {
26349
27154
  cellStyle.height = `${expandHeight}px`;
26350
27155
  }
26351
- if (treeConfig) {
26352
- cellStyle.paddingLeft = `${rowLevel * treeOpts.indent + 30}px`;
27156
+ if (isRowGroupStatus || treeConfig) {
27157
+ cellStyle.paddingLeft = `${rowLevel * (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(indent) ? indent : treeOpts.indent) + 30}px`;
27158
+ }
27159
+ let columnIndex = -1;
27160
+ let $columnIndex = -1;
27161
+ let _columnIndex = -1;
27162
+ if (colRest) {
27163
+ columnIndex = colRest.index;
27164
+ $columnIndex = colRest.$index;
27165
+ _columnIndex = colRest._index;
26353
27166
  }
26354
27167
  const expandParams = {
27168
+ $grid: $xeGrid,
26355
27169
  $table: $xeTable,
26356
27170
  seq,
26357
27171
  column: expandColumn,
27172
+ columnIndex,
27173
+ $columnIndex,
27174
+ _columnIndex,
26358
27175
  fixed: '',
26359
27176
  type: 'body',
26360
27177
  level: rowLevel,
27178
+ rowid,
26361
27179
  row,
26362
27180
  rowIndex,
26363
27181
  $rowIndex,
26364
- _rowIndex
27182
+ _rowIndex,
27183
+ isHidden: false,
27184
+ isEdit: false,
27185
+ visibleData: [],
27186
+ data: [],
27187
+ items: []
26365
27188
  };
26366
27189
  expandVNs.push(h('div', {
26367
27190
  key: rowid,
@@ -26557,6 +27380,8 @@ function renderBody(h, $xeTable) {
26557
27380
  selectRadioRow: null,
26558
27381
  // 表尾合计数据
26559
27382
  footerTableData: [],
27383
+ // 行分组列信息
27384
+ rowGroupColumn: null,
26560
27385
  // 展开列信息
26561
27386
  expandColumn: null,
26562
27387
  hasFixedColumn: false,
@@ -26707,6 +27532,9 @@ function renderBody(h, $xeTable) {
26707
27532
  isTitle: false,
26708
27533
  isFooter: false
26709
27534
  },
27535
+ visiblwRowsFlag: 1,
27536
+ isRowGroupStatus: false,
27537
+ rowGroupExpandedFlag: 1,
26710
27538
  rowExpandedFlag: 1,
26711
27539
  treeExpandedFlag: 1,
26712
27540
  updateCheckboxFlag: 1,
@@ -26895,28 +27723,41 @@ function renderBody(h, $xeTable) {
26895
27723
  const props = $xeTable;
26896
27724
  return Object.assign({}, table_getConfig().table.rowConfig, props.rowConfig);
26897
27725
  },
27726
+ computeRowGroupOpts() {
27727
+ const $xeTable = this;
27728
+ const props = $xeTable;
27729
+ return Object.assign({}, table_getConfig().table.rowGroupConfig, props.rowGroupConfig);
27730
+ },
26898
27731
  computeCurrentRowOpts() {
26899
27732
  const $xeTable = this;
26900
27733
  const props = $xeTable;
26901
27734
  return Object.assign({}, table_getConfig().table.currentRowConfig, props.currentRowConfig);
26902
27735
  },
26903
27736
  computeRowDragOpts() {
26904
- return Object.assign({}, table_getConfig().table.rowDragConfig, this.rowDragConfig);
27737
+ const $xeTable = this;
27738
+ const props = $xeTable;
27739
+ return Object.assign({}, table_getConfig().table.rowDragConfig, props.rowDragConfig);
26905
27740
  },
26906
27741
  computeColumnDragOpts() {
26907
- return Object.assign({}, table_getConfig().table.columnDragConfig, this.columnDragConfig);
27742
+ const $xeTable = this;
27743
+ const props = $xeTable;
27744
+ return Object.assign({}, table_getConfig().table.columnDragConfig, props.columnDragConfig);
26908
27745
  },
26909
27746
  resizeOpts() {
26910
27747
  return this.computeResizeOpts;
26911
27748
  },
26912
27749
  computeResizeOpts() {
26913
- return Object.assign({}, table_getConfig().table.resizeConfig, this.resizeConfig);
27750
+ const $xeTable = this;
27751
+ const props = $xeTable;
27752
+ return Object.assign({}, table_getConfig().table.resizeConfig, props.resizeConfig);
26914
27753
  },
26915
27754
  resizableOpts() {
26916
27755
  return this.computeResizableOpts;
26917
27756
  },
26918
27757
  computeResizableOpts() {
26919
- return Object.assign({}, table_getConfig().table.resizableConfig, this.resizableConfig);
27758
+ const $xeTable = this;
27759
+ const props = $xeTable;
27760
+ return Object.assign({}, table_getConfig().table.resizableConfig, props.resizableConfig);
26920
27761
  },
26921
27762
  seqOpts() {
26922
27763
  return this.computeSeqOpts;
@@ -27181,7 +28022,10 @@ function renderBody(h, $xeTable) {
27181
28022
  } = props;
27182
28023
  const {
27183
28024
  rowExpandedFlag,
27184
- expandColumn
28025
+ expandColumn,
28026
+ rowGroupExpandedFlag,
28027
+ treeExpandedFlag,
28028
+ isRowGroupStatus
27185
28029
  } = reactData;
27186
28030
  const {
27187
28031
  visibleDataRowIdData,
@@ -27192,15 +28036,16 @@ function renderBody(h, $xeTable) {
27192
28036
  transform
27193
28037
  } = treeOpts;
27194
28038
  const expandList = [];
27195
- if (expandColumn && rowExpandedFlag) {
27196
- if (treeConfig && !transform) {
28039
+ if (expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
28040
+ if (isRowGroupStatus || treeConfig && transform) {
28041
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(rowExpandedMaps, (row, rowid) => {
28042
+ if (visibleDataRowIdData[rowid]) {
28043
+ expandList.push(row);
28044
+ }
28045
+ });
28046
+ } else {
27197
28047
  return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().values(rowExpandedMaps);
27198
28048
  }
27199
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(rowExpandedMaps, (row, rowid) => {
27200
- if (visibleDataRowIdData[rowid]) {
27201
- expandList.push(row);
27202
- }
27203
- });
27204
28049
  }
27205
28050
  return expandList;
27206
28051
  },
@@ -27307,6 +28152,11 @@ function renderBody(h, $xeTable) {
27307
28152
  y: overflowY && scrollYLoad
27308
28153
  };
27309
28154
  },
28155
+ computeRowGroupFields() {
28156
+ const $xeTable = this;
28157
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
28158
+ return rowGroupOpts.groupFields;
28159
+ },
27310
28160
  tabsResizeFlag() {
27311
28161
  const $xeTable = this;
27312
28162
  const $xeTabs = $xeTable.$xeTabs;
@@ -27426,6 +28276,10 @@ function renderBody(h, $xeTable) {
27426
28276
  mergeFooterItems(value) {
27427
28277
  this.clearMergeFooterItems();
27428
28278
  this.$nextTick(() => this.setMergeFooterItems(value));
28279
+ },
28280
+ computeRowGroupFields(val) {
28281
+ const $xeTable = this;
28282
+ $xeTable.handleUpdateRowGroup(val);
27429
28283
  }
27430
28284
  },
27431
28285
  created() {
@@ -27481,8 +28335,16 @@ function renderBody(h, $xeTable) {
27481
28335
  // 列表完整数据、条件处理后
27482
28336
  tableFullData: [],
27483
28337
  afterFullData: [],
28338
+ afterTreeFullData: [],
28339
+ afterGroupFullData: [],
27484
28340
  // 列表条件处理后数据集合
27485
28341
  afterFullRowMaps: {},
28342
+ // 树结构完整数据、条件处理后
28343
+ tableFullTreeData: [],
28344
+ // 行分组全量数据、条件处理后
28345
+ tableFullGroupData: [],
28346
+ tableSynchData: [],
28347
+ tableSourceData: [],
27486
28348
  // 收集的列配置(带分组)
27487
28349
  collectColumn: [],
27488
28350
  // 完整所有列(不带分组)
@@ -27513,6 +28375,8 @@ function renderBody(h, $xeTable) {
27513
28375
  rowExpandedMaps: {},
27514
28376
  // 懒加载中的展开行的集合
27515
28377
  rowExpandLazyLoadedMaps: {},
28378
+ // 已展开的分组行
28379
+ rowGroupExpandedMaps: {},
27516
28380
  // 已展开树节点集合
27517
28381
  treeExpandedMaps: {},
27518
28382
  // 懒加载中的树节点的集合
@@ -27555,9 +28419,11 @@ function renderBody(h, $xeTable) {
27555
28419
  const importOpts = $xeTable.computeImportOpts;
27556
28420
  const currentRowOpts = $xeTable.computeCurrentRowOpts;
27557
28421
  const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
27558
- const virtualXOpts = $xeTable.computeVirtualXOpts;
27559
- const virtualYOpts = $xeTable.computeVirtualYOpts;
27560
28422
  const keyboardOpts = $xeTable.computeKeyboardOpts;
28423
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
28424
+ const {
28425
+ groupFields
28426
+ } = rowGroupOpts;
27561
28427
  if (props.rowId) {
27562
28428
  warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField']);
27563
28429
  }
@@ -27713,19 +28579,19 @@ function renderBody(h, $xeTable) {
27713
28579
  warnLog('vxe.error.notConflictProp', ['column-config.isCurrent', 'current-column-config.isFollowSelected']);
27714
28580
  }
27715
28581
  // 如果不支持虚拟滚动
27716
- if (props.spanMethod) {
27717
- if (virtualXOpts.enabled) {
27718
- warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false']);
27719
- }
27720
- if (virtualYOpts.enabled) {
27721
- warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false']);
27722
- }
27723
- }
27724
- if (props.footerSpanMethod) {
27725
- if (virtualXOpts.enabled) {
27726
- warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false']);
27727
- }
27728
- }
28582
+ // if (props.spanMethod) {
28583
+ // if (virtualXOpts.enabled) {
28584
+ // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false'])
28585
+ // }
28586
+ // if (virtualYOpts.enabled) {
28587
+ // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false'])
28588
+ // }
28589
+ // }
28590
+ // if (props.footerSpanMethod) {
28591
+ // if (virtualXOpts.enabled) {
28592
+ // warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false'])
28593
+ // }
28594
+ // }
27729
28595
  // 检查是否有安装需要的模块
27730
28596
  if (props.editConfig && !$xeTable.insert) {
27731
28597
  errLog('vxe.error.reqModule', ['Edit']);
@@ -27749,6 +28615,7 @@ function renderBody(h, $xeTable) {
27749
28615
  endIndex: 1,
27750
28616
  visibleSize: 0
27751
28617
  });
28618
+ this.handleUpdateRowGroup(groupFields);
27752
28619
  this.loadTableData(data, true).then(() => {
27753
28620
  if (data && data.length) {
27754
28621
  this.inited = true;
@@ -27889,6 +28756,7 @@ function renderBody(h, $xeTable) {
27889
28756
  scrollYLoad,
27890
28757
  tableData,
27891
28758
  initStore,
28759
+ isRowGroupStatus,
27892
28760
  columnStore,
27893
28761
  filterStore,
27894
28762
  customStore
@@ -27936,6 +28804,7 @@ function renderBody(h, $xeTable) {
27936
28804
  'is--header': showHeader,
27937
28805
  'is--footer': showFooter,
27938
28806
  'is--group': isGroup,
28807
+ 'is-row-group': isRowGroupStatus,
27939
28808
  'is--tree-line': treeConfig && (treeOpts.showLine || treeOpts.line),
27940
28809
  'is--fixed-left': leftList.length,
27941
28810
  'is--fixed-right': rightList.length,
@@ -31920,7 +32789,8 @@ const Toolbar = VxeToolbar;
31920
32789
  maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
31921
32790
  dragTip: '移动:{0}',
31922
32791
  resizeColTip: '宽:{0} 像素',
31923
- resizeRowTip: '高:{0} 像素'
32792
+ resizeRowTip: '高:{0} 像素',
32793
+ rowGroupContentTotal: '{0}({1})'
31924
32794
  },
31925
32795
  grid: {
31926
32796
  selectOneRecord: '请至少选择一条记录!',