vxe-table 3.15.5 → 3.15.7

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 +983 -495
  34. package/es/table/src/props.js +9 -7
  35. package/es/table/src/table.js +108 -35
  36. package/es/table/style.css +70 -40
  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 +70 -40
  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 +1735 -858
  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 +1164 -562
  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 +70 -40
  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 +70 -40
  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 +1016 -512
  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 +131 -92
  166. /package/es/{iconfont.1744880837792.ttf → iconfont.1745290222894.ttf} +0 -0
  167. /package/es/{iconfont.1744880837792.woff → iconfont.1745290222894.woff} +0 -0
  168. /package/es/{iconfont.1744880837792.woff2 → iconfont.1745290222894.woff2} +0 -0
  169. /package/lib/{iconfont.1744880837792.ttf → iconfont.1745290222894.ttf} +0 -0
  170. /package/lib/{iconfont.1744880837792.woff → iconfont.1745290222894.woff} +0 -0
  171. /package/lib/{iconfont.1744880837792.woff2 → iconfont.1745290222894.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.5";
2223
+ const version = "3.15.7";
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.5"}`;
2861
+ const log_version = `table v${"3.15.7"}`;
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 => {
6310
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 => {
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,286 @@ 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.treeExpandedMaps = {};
8415
+ reactData.treeExpandedFlag++;
8416
+ internalData.rowExpandedMaps = {};
8417
+ reactData.rowExpandedFlag++;
8418
+ internalData.insertRowMaps = {};
8419
+ reactData.insertRowFlag++;
8420
+ internalData.removeRowMaps = {};
8421
+ reactData.removeRowFlag++;
8422
+ const sYLoad = updateScrollYStatus($xeTable, fullData);
8423
+ reactData.isDragColMove = false;
8424
+ reactData.isDragRowMove = false;
8425
+ // 全量数据
8426
+ internalData.tableFullData = fullData;
8427
+ internalData.tableFullTreeData = isRGroup ? [] : treeData;
8428
+ internalData.tableFullGroupData = isRGroup ? treeData : [];
8429
+ // 缓存数据
8430
+ $xeTable.cacheRowMap(isReset);
8431
+ // 原始数据
8432
+ internalData.tableSynchData = datas;
8433
+ if (isReset) {
8434
+ internalData.isResizeCellHeight = false;
8435
+ }
8436
+ // 克隆原数据,用于显示编辑状态,与编辑值做对比
8437
+ if (keepSource) {
8438
+ $xeTable.cacheSourceMap(fullData);
8439
+ }
8440
+ if ($xeTable.clearCellAreas && props.mouseConfig) {
8441
+ $xeTable.clearCellAreas();
8442
+ $xeTable.clearCopyCellArea();
8443
+ }
8444
+ $xeTable.clearMergeCells();
8445
+ $xeTable.clearMergeFooterItems();
8446
+ $xeTable.handleTableData(true);
8447
+ $xeTable.updateFooter();
8448
+ $xeTable.handleUpdateBodyMerge();
8449
+ return $xeTable.$nextTick().then(() => {
8450
+ updateHeight($xeTable);
8451
+ updateStyle($xeTable);
8452
+ }).then(() => {
8453
+ computeScrollLoad($xeTable);
8454
+ }).then(() => {
8455
+ // 是否启用了虚拟滚动
8456
+ if (sYLoad) {
8457
+ scrollYStore.endIndex = scrollYStore.visibleSize;
8458
+ }
8459
+ if (sYLoad) {
8460
+ if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
8461
+ errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"']);
8462
+ }
8463
+ // if (showOverflow) {
8464
+ // if (!rowOpts.height) {
8465
+ // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
8466
+ // if (errColumn) {
8467
+ // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
8468
+ // }
8469
+ // }
8470
+ // }
8471
+ if (!(props.height || props.maxHeight)) {
8472
+ errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
8473
+ }
8474
+ // if (!props.showOverflow) {
8475
+ // warnLog('vxe.error.reqProp', ['table.show-overflow'])
8476
+ // }
8477
+ if (props.spanMethod) {
8478
+ errLog('vxe.error.scrollErrProp', ['table.span-method']);
8479
+ }
7618
8480
  }
8481
+ handleReserveStatus($xeTable);
8482
+ $xeTable.checkSelectionStatus();
8483
+ return new Promise(resolve => {
8484
+ $xeTable.$nextTick().then(() => handleRecalculateLayout($xeTable, false)).then(() => {
8485
+ calcCellHeight($xeTable);
8486
+ updateRowOffsetTop($xeTable);
8487
+ return handleRecalculateLayout($xeTable, false);
8488
+ }).then(() => {
8489
+ let targetScrollLeft = lastScrollLeft;
8490
+ let targetScrollTop = lastScrollTop;
8491
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
8492
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
8493
+ // 是否在更新数据之后自动滚动重置滚动条
8494
+ if (virtualXOpts.scrollToLeftOnChange) {
8495
+ targetScrollLeft = 0;
8496
+ }
8497
+ if (virtualYOpts.scrollToTopOnChange) {
8498
+ targetScrollTop = 0;
8499
+ }
8500
+ reactData.isRowLoading = false;
8501
+ handleRecalculateLayout($xeTable, false);
8502
+ // 是否变更虚拟滚动
8503
+ if (oldScrollYLoad === sYLoad) {
8504
+ restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
8505
+ resolve();
8506
+ });
8507
+ } else {
8508
+ setTimeout(() => {
8509
+ restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
8510
+ resolve();
8511
+ });
8512
+ });
8513
+ }
8514
+ });
8515
+ });
7619
8516
  });
7620
8517
  }
7621
8518
  /**
@@ -8375,16 +9272,23 @@ const Methods = {
8375
9272
  clearAll() {
8376
9273
  return clearTableAllStatus(this);
8377
9274
  },
9275
+ handleUpdateRowGroup(groupFields) {
9276
+ const $xeTable = this;
9277
+ handleUpdateRowGroup($xeTable, groupFields);
9278
+ },
8378
9279
  /**
8379
9280
  * 同步 data 数据(即将废弃)
8380
9281
  * 如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
8381
9282
  * 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
8382
9283
  */
8383
9284
  syncData() {
9285
+ const $xeTable = this;
9286
+ const reactData = $xeTable;
9287
+ const internalData = $xeTable;
8384
9288
  errLog('vxe.error.delFunc', ['syncData', 'getData']);
8385
- return this.$nextTick().then(() => {
8386
- this.tableData = [];
8387
- return this.$nextTick().then(() => this.loadTableData(this.tableFullData, true));
9289
+ return $xeTable.$nextTick().then(() => {
9290
+ reactData.tableData = [];
9291
+ return $xeTable.$nextTick().then(() => loadTableData($xeTable, internalData.tableFullData, true));
8388
9292
  });
8389
9293
  },
8390
9294
  /**
@@ -8432,23 +9336,23 @@ const Methods = {
8432
9336
  // 是否进行数据处理
8433
9337
  if (force) {
8434
9338
  // 更新数据,处理筛选和排序
8435
- this.updateAfterFullData();
9339
+ updateAfterFullData($xeTable);
8436
9340
  // 如果为虚拟树,将树结构拍平
8437
9341
  fullList = handleVirtualTreeToList($xeTable);
8438
9342
  }
8439
9343
  const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
8440
9344
  const visibleDataRowIdMaps = {};
8441
9345
  tableData.forEach((row, $index) => {
8442
- const rowid = getRowid(this, row);
9346
+ const rowid = getRowid($xeTable, row);
8443
9347
  const rest = fullDataRowIdData[rowid];
8444
9348
  if (rest) {
8445
9349
  rest.$index = $index;
8446
9350
  }
8447
9351
  visibleDataRowIdMaps[rowid] = row;
8448
9352
  });
8449
- this.tableData = tableData;
9353
+ reactData.tableData = tableData;
8450
9354
  internalData.visibleDataRowIdData = visibleDataRowIdMaps;
8451
- return this.$nextTick();
9355
+ return $xeTable.$nextTick();
8452
9356
  },
8453
9357
  /**
8454
9358
  * 加载表格数据
@@ -8456,169 +9360,7 @@ const Methods = {
8456
9360
  */
8457
9361
  loadTableData(datas, isReset) {
8458
9362
  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
- });
9363
+ return loadTableData($xeTable, datas, isReset);
8622
9364
  },
8623
9365
  /**
8624
9366
  * 重新加载数据,不会清空表格状态
@@ -8629,7 +9371,7 @@ const Methods = {
8629
9371
  const {
8630
9372
  initStatus
8631
9373
  } = this;
8632
- return this.loadTableData(datas, false).then(() => {
9374
+ return loadTableData($xeTable, datas, false).then(() => {
8633
9375
  this.inited = true;
8634
9376
  this.initStatus = true;
8635
9377
  if (!initStatus) {
@@ -8647,7 +9389,7 @@ const Methods = {
8647
9389
  return this.clearAll().then(() => {
8648
9390
  this.inited = true;
8649
9391
  this.initStatus = true;
8650
- return this.loadTableData(datas, true);
9392
+ return loadTableData($xeTable, datas, true);
8651
9393
  }).then(() => {
8652
9394
  handleLoadDefaults($xeTable);
8653
9395
  return this.recalculate();
@@ -8739,18 +9481,16 @@ const Methods = {
8739
9481
  const {
8740
9482
  treeConfig
8741
9483
  } = props;
9484
+ const {
9485
+ isRowGroupStatus
9486
+ } = reactData;
8742
9487
  const {
8743
9488
  fullAllDataRowIdData,
8744
9489
  tableFullData,
8745
9490
  tableFullTreeData,
9491
+ tableFullGroupData,
8746
9492
  treeExpandedMaps
8747
9493
  } = 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
9494
  const fullAllDataRowIdMaps = isReset ? {} : {
8755
9495
  ...fullAllDataRowIdData
8756
9496
  }; // 存在已删除数据
@@ -8790,6 +9530,12 @@ const Methods = {
8790
9530
  fullAllDataRowIdMaps[rowid] = rowRest;
8791
9531
  };
8792
9532
  if (treeConfig) {
9533
+ const treeOpts = $xeTable.computeTreeOpts;
9534
+ const {
9535
+ lazy
9536
+ } = treeOpts;
9537
+ const childrenField = treeOpts.children || treeOpts.childrenField;
9538
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
8793
9539
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
8794
9540
  const rowid = handleUpdateRowId(row);
8795
9541
  if (treeConfig && lazy) {
@@ -8806,6 +9552,17 @@ const Methods = {
8806
9552
  }, {
8807
9553
  children: childrenField
8808
9554
  });
9555
+ } else if (isRowGroupStatus) {
9556
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
9557
+ const {
9558
+ mapChildrenField
9559
+ } = rowGroupOpts;
9560
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
9561
+ const rowid = handleUpdateRowId(row);
9562
+ handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
9563
+ }, {
9564
+ children: mapChildrenField
9565
+ });
8809
9566
  } else {
8810
9567
  tableFullData.forEach((row, index, items) => {
8811
9568
  handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1);
@@ -9612,299 +10369,54 @@ const Methods = {
9612
10369
  const {
9613
10370
  treeConfig
9614
10371
  } = props;
9615
- const {
9616
- updateCheckboxFlag
9617
- } = reactData;
9618
- const {
9619
- tableFullData,
9620
- afterFullData,
9621
- tableFullTreeData,
9622
- fullDataRowIdData,
9623
- afterFullRowMaps,
9624
- selectCheckboxMaps
9625
- } = internalData;
9626
- const treeOpts = $xeTable.computeTreeOpts;
9627
- const checkboxOpts = $xeTable.computeCheckboxOpts;
9628
- const {
9629
- transform,
9630
- mapChildrenField
9631
- } = treeOpts;
9632
- const {
9633
- checkField
9634
- } = checkboxOpts;
9635
- const childrenField = treeOpts.children || treeOpts.childrenField;
9636
- let rowList = [];
9637
- if (updateCheckboxFlag) {
9638
- if (checkField) {
9639
- if (treeConfig) {
9640
- const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? tableFullTreeData : afterFullData;
9641
- 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), {
9642
- children: transform ? mapChildrenField : childrenField
9643
- });
9644
- } else {
9645
- const currTableData = isFull ? tableFullData : afterFullData;
9646
- rowList = currTableData.filter(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
9647
- }
9648
- } else {
9649
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectCheckboxMaps, (row, rowid) => {
9650
- if (isFull) {
9651
- if (fullDataRowIdData[rowid]) {
9652
- rowList.push(fullDataRowIdData[rowid].row);
9653
- }
9654
- } else {
9655
- if (afterFullRowMaps[rowid]) {
9656
- rowList.push(afterFullRowMaps[rowid]);
9657
- }
9658
- }
9659
- });
9660
- }
9661
- }
9662
- return rowList;
9663
- },
9664
- /**
9665
- * 获取处理后全量的表格数据
9666
- * 如果存在筛选条件,继续处理
9667
- */
9668
- updateAfterFullData() {
9669
- const $xeTable = this;
9670
- const props = $xeTable;
9671
- const internalData = $xeTable;
9672
- const {
9673
- treeConfig
9674
- } = props;
9675
- const {
9676
- tableFullColumn,
9677
- tableFullData,
9678
- tableFullTreeData
9679
- } = internalData;
9680
- const filterOpts = $xeTable.computeFilterOpts;
9681
- const sortOpts = $xeTable.computeSortOpts;
9682
- const treeOpts = $xeTable.computeTreeOpts;
9683
- const childrenField = treeOpts.children || treeOpts.childrenField;
9684
- const {
9685
- transform,
9686
- rowField,
9687
- parentField,
9688
- mapChildrenField
9689
- } = treeOpts;
9690
- const {
9691
- isEvery,
9692
- remote: allRemoteFilter,
9693
- filterMethod: allFilterMethod
9694
- } = filterOpts;
9695
- const {
9696
- remote: allRemoteSort,
9697
- sortMethod: allSortMethod,
9698
- multiple: sortMultiple,
9699
- chronological
9700
- } = sortOpts;
9701
- let tableData = [];
9702
- let tableTree = [];
9703
- // 处理数据
9704
- if (!allRemoteFilter || !allRemoteSort) {
9705
- const filterColumns = [];
9706
- let orderColumns = [];
9707
- tableFullColumn.forEach(column => {
9708
- const {
9709
- field,
9710
- sortable,
9711
- order,
9712
- filters
9713
- } = column;
9714
- if (!allRemoteFilter && filters && filters.length) {
9715
- const valueList = [];
9716
- const itemList = [];
9717
- filters.forEach(item => {
9718
- if (item.checked) {
9719
- itemList.push(item);
9720
- valueList.push(item.value);
9721
- }
9722
- });
9723
- if (itemList.length) {
9724
- filterColumns.push({
9725
- column,
9726
- valueList,
9727
- itemList
9728
- });
9729
- }
9730
- }
9731
- if (!allRemoteSort && sortable && order) {
9732
- orderColumns.push({
9733
- column,
9734
- field,
9735
- property: field,
9736
- order: order,
9737
- sortTime: column.sortTime
9738
- });
9739
- }
9740
- });
9741
- if (sortMultiple && chronological && orderColumns.length > 1) {
9742
- orderColumns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(orderColumns, 'sortTime');
9743
- }
9744
- // 处理筛选
9745
- // 支持单列、多列、组合筛选
9746
- if (!allRemoteFilter && filterColumns.length) {
9747
- const handleFilter = row => {
9748
- return filterColumns.every(({
9749
- column,
9750
- valueList,
9751
- itemList
9752
- }) => {
9753
- const {
9754
- filterMethod,
9755
- filterRender
9756
- } = column;
9757
- const compConf = isEnableConf(filterRender) ? methods_renderer.get(filterRender.name) : null;
9758
- const compFilterMethod = compConf ? compConf.tableFilterMethod || compConf.filterMethod : null;
9759
- const tdFilterMethod = compConf ? compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod : null;
9760
- const cellValue = getCellValue(row, column);
9761
- if (filterMethod) {
9762
- return itemList.some(item => filterMethod({
9763
- value: item.value,
9764
- option: item,
9765
- cellValue,
9766
- row,
9767
- column,
9768
- $table: $xeTable
9769
- }));
9770
- } else if (compFilterMethod) {
9771
- return itemList.some(item => compFilterMethod({
9772
- value: item.value,
9773
- option: item,
9774
- cellValue,
9775
- row,
9776
- column,
9777
- $table: $xeTable
9778
- }));
9779
- } else if (allFilterMethod) {
9780
- return allFilterMethod({
9781
- options: itemList,
9782
- values: valueList,
9783
- cellValue,
9784
- row,
9785
- column
9786
- });
9787
- } else if (tdFilterMethod) {
9788
- return itemList.some(item => tdFilterMethod({
9789
- value: item.value,
9790
- option: item,
9791
- cellValue,
9792
- row,
9793
- column,
9794
- $table: $xeTable
9795
- }));
9796
- }
9797
- return valueList.indexOf(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field)) > -1;
9798
- });
9799
- };
9800
- if (treeConfig && transform) {
9801
- // 筛选虚拟树
9802
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, handleFilter, {
9803
- original: true,
9804
- isEvery,
9805
- children: mapChildrenField,
9806
- mapChildren: childrenField
10372
+ const {
10373
+ updateCheckboxFlag
10374
+ } = reactData;
10375
+ const {
10376
+ tableFullData,
10377
+ afterFullData,
10378
+ tableFullTreeData,
10379
+ fullDataRowIdData,
10380
+ afterFullRowMaps,
10381
+ selectCheckboxMaps
10382
+ } = internalData;
10383
+ const treeOpts = $xeTable.computeTreeOpts;
10384
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
10385
+ const {
10386
+ transform,
10387
+ mapChildrenField
10388
+ } = treeOpts;
10389
+ const {
10390
+ checkField
10391
+ } = checkboxOpts;
10392
+ const childrenField = treeOpts.children || treeOpts.childrenField;
10393
+ let rowList = [];
10394
+ if (updateCheckboxFlag) {
10395
+ if (checkField) {
10396
+ if (treeConfig) {
10397
+ const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? tableFullTreeData : afterFullData;
10398
+ 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), {
10399
+ children: transform ? mapChildrenField : childrenField
9807
10400
  });
9808
- tableData = tableTree;
9809
10401
  } else {
9810
- tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
9811
- tableTree = tableData;
10402
+ const currTableData = isFull ? tableFullData : afterFullData;
10403
+ rowList = currTableData.filter(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
9812
10404
  }
9813
10405
  } else {
9814
- if (treeConfig && transform) {
9815
- // 还原虚拟树
9816
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
9817
- original: true,
9818
- isEvery,
9819
- children: mapChildrenField,
9820
- mapChildren: childrenField
9821
- });
9822
- tableData = tableTree;
9823
- } else {
9824
- tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
9825
- tableTree = tableData;
9826
- }
9827
- }
9828
- // 处理排序(不能用于树形结构)
9829
- // 支持单列、多列、组合排序
9830
- if (!allRemoteSort && orderColumns.length) {
9831
- if (treeConfig && transform) {
9832
- // 虚拟树和列表一样,只能排序根级节点
9833
- if (allSortMethod) {
9834
- const sortRests = allSortMethod({
9835
- data: tableTree,
9836
- sortList: orderColumns,
9837
- $table: $xeTable
9838
- });
9839
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableTree;
9840
- } else {
9841
- const treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableTree, {
9842
- children: mapChildrenField
9843
- });
9844
- 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(({
9845
- column,
9846
- order
9847
- }) => [getOrderField($xeTable, column), order])), {
9848
- key: rowField,
9849
- parentKey: parentField,
9850
- children: childrenField,
9851
- mapChildren: mapChildrenField
9852
- });
9853
- }
9854
- tableData = tableTree;
9855
- } else {
9856
- if (allSortMethod) {
9857
- const sortRests = allSortMethod({
9858
- data: tableData,
9859
- sortList: orderColumns,
9860
- $table: $xeTable
9861
- });
9862
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableData;
10406
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectCheckboxMaps, (row, rowid) => {
10407
+ if (isFull) {
10408
+ if (fullDataRowIdData[rowid]) {
10409
+ rowList.push(fullDataRowIdData[rowid].row);
10410
+ }
9863
10411
  } else {
9864
- // 兼容 v4
9865
- if (sortMultiple) {
9866
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
9867
- column,
9868
- order
9869
- }) => [getOrderField(this, column), order]));
9870
- } else {
9871
- const firstOrderColumn = orderColumns[0];
9872
- let sortByConfs;
9873
- // 已废弃,兼容 v2,在 v4 中废弃, sortBy 不能为数组
9874
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(firstOrderColumn.sortBy)) {
9875
- sortByConfs = firstOrderColumn.sortBy.map(item => [item, firstOrderColumn.order]);
9876
- }
9877
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, sortByConfs || [firstOrderColumn].map(({
9878
- column,
9879
- order
9880
- }) => [getOrderField(this, column), order]));
10412
+ if (afterFullRowMaps[rowid]) {
10413
+ rowList.push(afterFullRowMaps[rowid]);
9881
10414
  }
9882
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
9883
- column,
9884
- order
9885
- }) => [getOrderField($xeTable, column), order]));
9886
10415
  }
9887
- tableTree = tableData;
9888
- }
9889
- }
9890
- } else {
9891
- if (treeConfig && transform) {
9892
- // 还原虚拟树
9893
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
9894
- original: true,
9895
- isEvery,
9896
- children: treeOpts.mapChildrenField,
9897
- mapChildren: childrenField
9898
10416
  });
9899
- tableData = tableTree;
9900
- } else {
9901
- tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
9902
- tableTree = tableData;
9903
10417
  }
9904
10418
  }
9905
- internalData.afterFullData = tableData;
9906
- internalData.afterTreeFullData = tableTree;
9907
- updateAfterDataIndex($xeTable);
10419
+ return rowList;
9908
10420
  },
9909
10421
  /**
9910
10422
  * 预编译
@@ -10288,6 +10800,7 @@ const Methods = {
10288
10800
  const storeData = getCustomStorageMap(tableId);
10289
10801
  if (restoreStore) {
10290
10802
  return Promise.resolve(restoreStore({
10803
+ $table: $xeTable,
10291
10804
  id: tableId,
10292
10805
  type: 'restore',
10293
10806
  storeData
@@ -10363,6 +10876,7 @@ const Methods = {
10363
10876
  resizableData[colKey] = column.renderWidth;
10364
10877
  }
10365
10878
  if (isCustomVisible && (!checkMethod || checkMethod({
10879
+ $table: $xeTable,
10366
10880
  column
10367
10881
  }))) {
10368
10882
  if (!column.visible && column.defaultVisible) {
@@ -10423,6 +10937,7 @@ const Methods = {
10423
10937
  } : this.getCustomStoreData();
10424
10938
  if (updateStore) {
10425
10939
  return updateStore({
10940
+ $table: $xeTable,
10426
10941
  id: tableId,
10427
10942
  type,
10428
10943
  storeData
@@ -11420,8 +11935,7 @@ const Methods = {
11420
11935
  const hasDeleteKey = keyCode === 46;
11421
11936
  const isF2 = keyCode === 113;
11422
11937
  const isContextMenu = keyCode === 93;
11423
- const hasMetaKey = evnt.metaKey;
11424
- const hasCtrlKey = evnt.ctrlKey;
11938
+ const isControlKey = hasControlKey(evnt);
11425
11939
  const hasShiftKey = evnt.shiftKey;
11426
11940
  const hasAltKey = evnt.altKey;
11427
11941
  const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
@@ -11487,7 +12001,7 @@ const Methods = {
11487
12001
  enterMethod
11488
12002
  } = keyboardOpts;
11489
12003
  // 退出选中
11490
- if (hasCtrlKey) {
12004
+ if (isControlKey) {
11491
12005
  // 如果是激活编辑状态,则取消编辑
11492
12006
  if (actived.row) {
11493
12007
  const params = actived.args;
@@ -11663,7 +12177,7 @@ const Methods = {
11663
12177
  };
11664
12178
  $xeTable.setTreeExpand(parentRow, false).then(() => $xeTable.scrollToRow(parentRow)).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
11665
12179
  }
11666
- } 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)) {
12180
+ } 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)) {
11667
12181
  const {
11668
12182
  editMethod
11669
12183
  } = keyboardOpts;
@@ -12113,9 +12627,13 @@ const Methods = {
12113
12627
  const {
12114
12628
  treeConfig
12115
12629
  } = props;
12630
+ const {
12631
+ isRowGroupStatus
12632
+ } = reactData;
12116
12633
  const {
12117
12634
  selectCheckboxMaps
12118
12635
  } = internalData;
12636
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
12119
12637
  const treeOpts = $xeTable.computeTreeOpts;
12120
12638
  const {
12121
12639
  transform,
@@ -12135,10 +12653,11 @@ const Methods = {
12135
12653
  const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
12136
12654
  if (checkField) {
12137
12655
  // 树结构
12138
- if (treeConfig && !checkStrictly) {
12656
+ if ((treeConfig || isRowGroupStatus) && !checkStrictly) {
12139
12657
  // 更新子节点状态
12140
12658
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
12141
12659
  if (isForce || !checkMethod || checkMethod({
12660
+ $table: $xeTable,
12142
12661
  row
12143
12662
  })) {
12144
12663
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
@@ -12156,6 +12675,7 @@ const Methods = {
12156
12675
  // 列表
12157
12676
  rows.forEach(row => {
12158
12677
  if (isForce || !checkMethod || checkMethod({
12678
+ $table: $xeTable,
12159
12679
  row
12160
12680
  })) {
12161
12681
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
@@ -12166,32 +12686,58 @@ const Methods = {
12166
12686
  return;
12167
12687
  }
12168
12688
  // 树结构
12169
- if (treeConfig && !checkStrictly) {
12170
- // 更新子节点状态
12171
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
12172
- const rowid = handleGetRowId(row);
12173
- if (isForce || !checkMethod || checkMethod({
12174
- row
12175
- })) {
12176
- if (checked) {
12177
- selectCheckboxMaps[rowid] = row;
12178
- } else {
12179
- if (selectCheckboxMaps[rowid]) {
12180
- delete selectCheckboxMaps[rowid];
12689
+ if (!checkStrictly) {
12690
+ if (isRowGroupStatus) {
12691
+ // 更新行分组节点状态
12692
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
12693
+ const rowid = handleGetRowId(row);
12694
+ if (isForce || !checkMethod || checkMethod({
12695
+ $table: $xeTable,
12696
+ row
12697
+ })) {
12698
+ if (checked) {
12699
+ selectCheckboxMaps[rowid] = row;
12700
+ } else {
12701
+ if (selectCheckboxMaps[rowid]) {
12702
+ delete selectCheckboxMaps[rowid];
12703
+ }
12181
12704
  }
12705
+ handleCheckboxReserveRow($xeTable, row, checked);
12182
12706
  }
12183
- handleCheckboxReserveRow($xeTable, row, checked);
12184
- }
12185
- }, {
12186
- children: transform ? mapChildrenField : childrenField
12187
- });
12188
- reactData.updateCheckboxFlag++;
12189
- return;
12707
+ }, {
12708
+ children: rowGroupOpts.mapChildrenField
12709
+ });
12710
+ reactData.updateCheckboxFlag++;
12711
+ return;
12712
+ } else if (treeConfig) {
12713
+ // 更新子节点状态
12714
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
12715
+ const rowid = handleGetRowId(row);
12716
+ if (isForce || !checkMethod || checkMethod({
12717
+ $table: $xeTable,
12718
+ row
12719
+ })) {
12720
+ if (checked) {
12721
+ selectCheckboxMaps[rowid] = row;
12722
+ } else {
12723
+ if (selectCheckboxMaps[rowid]) {
12724
+ delete selectCheckboxMaps[rowid];
12725
+ }
12726
+ }
12727
+ handleCheckboxReserveRow($xeTable, row, checked);
12728
+ }
12729
+ }, {
12730
+ children: transform ? mapChildrenField : childrenField
12731
+ });
12732
+ reactData.updateCheckboxFlag++;
12733
+ return;
12734
+ }
12190
12735
  }
12191
12736
  // 列表
12192
12737
  rows.forEach(row => {
12193
12738
  const rowid = handleGetRowId(row);
12194
12739
  if (isForce || !checkMethod || checkMethod({
12740
+ $table: $xeTable,
12195
12741
  row
12196
12742
  })) {
12197
12743
  if (checked) {
@@ -12251,10 +12797,17 @@ const Methods = {
12251
12797
  triggerCheckRowEvent(evnt, params, checked) {
12252
12798
  const $xeTable = this;
12253
12799
  const props = $xeTable;
12800
+ const reactData = $xeTable;
12254
12801
  const internalData = $xeTable;
12802
+ const {
12803
+ treeConfig
12804
+ } = props;
12255
12805
  const {
12256
12806
  row
12257
12807
  } = params;
12808
+ const {
12809
+ isRowGroupStatus
12810
+ } = reactData;
12258
12811
  const {
12259
12812
  afterFullData
12260
12813
  } = internalData;
@@ -12267,7 +12820,7 @@ const Methods = {
12267
12820
  return;
12268
12821
  }
12269
12822
  evnt.stopPropagation();
12270
- if (checkboxOpts.isShiftKey && evnt.shiftKey && !props.treeConfig) {
12823
+ if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
12271
12824
  const checkboxRecords = $xeTable.getCheckboxRecords();
12272
12825
  if (checkboxRecords.length) {
12273
12826
  const firstRow = checkboxRecords[0];
@@ -12287,6 +12840,7 @@ const Methods = {
12287
12840
  }
12288
12841
  }
12289
12842
  if (!checkMethod || checkMethod({
12843
+ $table: $xeTable,
12290
12844
  row
12291
12845
  })) {
12292
12846
  $xeTable.handleBatchSelectRows([row], checked);
@@ -12334,14 +12888,16 @@ const Methods = {
12334
12888
  treeConfig
12335
12889
  } = props;
12336
12890
  const {
12891
+ isRowGroupStatus
12892
+ } = reactData;
12893
+ const {
12894
+ afterTreeFullData,
12895
+ afterGroupFullData,
12337
12896
  selectCheckboxMaps,
12338
12897
  treeIndeterminateRowMaps
12339
12898
  } = internalData;
12899
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
12340
12900
  const treeOpts = $xeTable.computeTreeOpts;
12341
- const {
12342
- transform,
12343
- mapChildrenField
12344
- } = treeOpts;
12345
12901
  const childrenField = treeOpts.children || treeOpts.childrenField;
12346
12902
  const checkboxOpts = $xeTable.computeCheckboxOpts;
12347
12903
  const {
@@ -12349,29 +12905,47 @@ const Methods = {
12349
12905
  checkStrictly,
12350
12906
  checkMethod
12351
12907
  } = checkboxOpts;
12352
- const {
12353
- afterTreeFullData
12354
- } = internalData;
12355
12908
  if (checkStrictly) {
12356
12909
  return;
12357
12910
  }
12358
- // 树结构
12359
- if (treeConfig) {
12911
+ if (isRowGroupStatus || treeConfig) {
12360
12912
  const {
12361
12913
  handleGetRowId
12362
12914
  } = createHandleGetRowId($xeTable);
12363
12915
  const childRowMaps = {};
12364
12916
  const childRowList = [];
12365
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
12366
- const rowid = handleGetRowId(row);
12367
- const childList = row[transform ? mapChildrenField : childrenField];
12368
- if (childList && childList.length && !childRowMaps[rowid]) {
12369
- childRowMaps[rowid] = 1;
12370
- childRowList.unshift([row, rowid, childList]);
12917
+ if (isRowGroupStatus) {
12918
+ // 行分组
12919
+ const mapChildrenField = rowGroupOpts.mapChildrenField;
12920
+ if (mapChildrenField) {
12921
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
12922
+ const rowid = handleGetRowId(row);
12923
+ const childList = row[mapChildrenField];
12924
+ if (childList && childList.length && !childRowMaps[rowid]) {
12925
+ childRowMaps[rowid] = 1;
12926
+ childRowList.unshift([row, rowid, childList]);
12927
+ }
12928
+ }, {
12929
+ children: mapChildrenField
12930
+ });
12371
12931
  }
12372
- }, {
12373
- children: transform ? mapChildrenField : childrenField
12374
- });
12932
+ } else if (treeConfig) {
12933
+ // 树结构
12934
+ const {
12935
+ transform,
12936
+ mapChildrenField
12937
+ } = treeOpts;
12938
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
12939
+ const rowid = handleGetRowId(row);
12940
+ const childList = row[transform ? mapChildrenField : childrenField];
12941
+ if (childList && childList.length && !childRowMaps[rowid]) {
12942
+ childRowMaps[rowid] = 1;
12943
+ childRowList.unshift([row, rowid, childList]);
12944
+ }
12945
+ }, {
12946
+ children: transform ? mapChildrenField : childrenField
12947
+ });
12948
+ }
12375
12949
  childRowList.forEach(vals => {
12376
12950
  const row = vals[0];
12377
12951
  const rowid = vals[1];
@@ -12383,6 +12957,7 @@ const Methods = {
12383
12957
  const childRowid = handleGetRowId(item);
12384
12958
  const isSelect = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField) : selectCheckboxMaps[childRowid];
12385
12959
  if (checkMethod({
12960
+ $table: $xeTable,
12386
12961
  row: item
12387
12962
  })) {
12388
12963
  if (isSelect) {
@@ -12446,9 +13021,13 @@ const Methods = {
12446
13021
  const {
12447
13022
  treeConfig
12448
13023
  } = props;
13024
+ const {
13025
+ isRowGroupStatus
13026
+ } = reactData;
12449
13027
  const {
12450
13028
  afterFullData,
12451
13029
  afterTreeFullData,
13030
+ afterGroupFullData,
12452
13031
  checkboxReserveRowMap,
12453
13032
  selectCheckboxMaps,
12454
13033
  treeIndeterminateRowMaps
@@ -12465,11 +13044,12 @@ const Methods = {
12465
13044
  let sLen = 0; // 已选
12466
13045
  let hLen = 0; // 半选
12467
13046
  let vLen = 0; // 有效行
12468
- const rootList = treeConfig ? afterTreeFullData : afterFullData;
13047
+ const rootList = treeConfig ? afterTreeFullData : isRowGroupStatus ? afterGroupFullData : afterFullData;
12469
13048
  rootList.forEach(checkMethod ? row => {
12470
13049
  const childRowid = handleGetRowId(row);
12471
13050
  const selected = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : selectCheckboxMaps[childRowid];
12472
13051
  if (checkMethod({
13052
+ $table: $xeTable,
12473
13053
  row
12474
13054
  })) {
12475
13055
  if (selected) {
@@ -13062,6 +13642,7 @@ const Methods = {
13062
13642
  const radioOpts = $xeTable.computeRadioOpts;
13063
13643
  const checkboxOpts = $xeTable.computeCheckboxOpts;
13064
13644
  const keyboardOpts = $xeTable.computeKeyboardOpts;
13645
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
13065
13646
  const rowOpts = $xeTable.computeRowOpts;
13066
13647
  const columnOpts = $xeTable.computeColumnOpts;
13067
13648
  const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
@@ -13075,7 +13656,8 @@ const Methods = {
13075
13656
  } = params;
13076
13657
  const {
13077
13658
  type,
13078
- treeNode
13659
+ treeNode,
13660
+ rowGroupNode
13079
13661
  } = column;
13080
13662
  const isRadioType = type === 'radio';
13081
13663
  const isCheckboxType = type === 'checkbox';
@@ -13083,8 +13665,9 @@ const Methods = {
13083
13665
  const cell = evnt.currentTarget;
13084
13666
  const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
13085
13667
  const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
13086
- const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree--btn-wrapper').flag;
13668
+ const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
13087
13669
  const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
13670
+ const triggerRowGroupNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-row-group--node-btn').flag;
13088
13671
  params = Object.assign({
13089
13672
  cell,
13090
13673
  triggerRadio,
@@ -13101,11 +13684,15 @@ const Methods = {
13101
13684
  if (treeOpts.trigger === 'row' || treeNode && treeOpts.trigger === 'cell') {
13102
13685
  $xeTable.triggerTreeExpandEvent(evnt, params);
13103
13686
  }
13687
+ // 如果是行分组
13688
+ if (rowGroupOpts.trigger === 'row' || rowGroupNode && rowGroupOpts.trigger === 'cell') {
13689
+ $xeTable.triggerRowGroupExpandEvent(evnt, params);
13690
+ }
13104
13691
  }
13105
13692
  // 如果点击了树节点
13106
13693
  if (!triggerTreeNode) {
13107
- if (!triggerExpandNode) {
13108
- // 如果是高亮行
13694
+ if (!triggerExpandNode && !triggerRowGroupNode) {
13695
+ // 如果是当前行
13109
13696
  if (rowOpts.isCurrent || highlightCurrentRow) {
13110
13697
  if (!triggerCheckbox && !triggerRadio) {
13111
13698
  $xeTable.triggerCurrentRowEvent(evnt, params);
@@ -13371,7 +13958,7 @@ const Methods = {
13371
13958
  const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
13372
13959
  const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
13373
13960
  const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
13374
- const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree--btn-wrapper').flag;
13961
+ const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
13375
13962
  const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
13376
13963
  let isColDragCell = false;
13377
13964
  if (rowOpts.drag) {
@@ -13688,7 +14275,7 @@ const Methods = {
13688
14275
  evnt.preventDefault();
13689
14276
  return;
13690
14277
  }
13691
- const hasCtrlKey = evnt.ctrlKey;
14278
+ const isControlKey = hasControlKey(evnt);
13692
14279
  const trEl = evnt.currentTarget;
13693
14280
  const rowid = trEl.getAttribute('rowid') || '';
13694
14281
  const rest = fullAllDataRowIdData[rowid];
@@ -13702,10 +14289,10 @@ const Methods = {
13702
14289
  } = reactData;
13703
14290
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
13704
14291
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
13705
- internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
14292
+ internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && isControlKey);
13706
14293
  internalData.prevDragRow = row;
13707
14294
  internalData.prevDragPos = dragPos;
13708
- if ($xeTable.eqRow(dragRow, row) || hasCtrlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
14295
+ if ($xeTable.eqRow(dragRow, row) || isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
13709
14296
  showDropTip($xeTable, evnt, trEl, null, false, dragPos);
13710
14297
  return;
13711
14298
  }
@@ -14003,7 +14590,7 @@ const Methods = {
14003
14590
  evnt.preventDefault();
14004
14591
  return;
14005
14592
  }
14006
- const hasCtrlKey = evnt.ctrlKey;
14593
+ const isControlKey = hasControlKey(evnt);
14007
14594
  const thEl = evnt.currentTarget;
14008
14595
  const colid = thEl.getAttribute('colid');
14009
14596
  const column = $xeTable.getColumnById(colid);
@@ -14014,7 +14601,7 @@ const Methods = {
14014
14601
  } = evnt;
14015
14602
  const offsetX = clientX - thEl.getBoundingClientRect().x;
14016
14603
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
14017
- internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
14604
+ internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey);
14018
14605
  internalData.prevDragCol = column;
14019
14606
  internalData.prevDragPos = dragPos;
14020
14607
  if (column.fixed || dragCol && dragCol.id === column.id || !isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId)) {
@@ -14476,7 +15063,7 @@ const Methods = {
14476
15063
  const reactData = $xeTable;
14477
15064
  const internalData = $xeTable;
14478
15065
  const {
14479
- expandColumn: column
15066
+ expandColumn
14480
15067
  } = reactData;
14481
15068
  const {
14482
15069
  rowExpandLazyLoadedMaps
@@ -14496,12 +15083,12 @@ const Methods = {
14496
15083
  const rowid = getRowid($xeTable, row);
14497
15084
  if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
14498
15085
  const expanded = !$xeTable.isRowExpandByRow(row);
14499
- const columnIndex = $xeTable.getColumnIndex(column);
14500
- const $columnIndex = $xeTable.getVMColumnIndex(column);
15086
+ const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
15087
+ const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
14501
15088
  $xeTable.setRowExpand(row, expanded);
14502
15089
  $xeTable.dispatchEvent('toggle-row-expand', {
14503
15090
  expanded,
14504
- column,
15091
+ column: expandColumn,
14505
15092
  columnIndex,
14506
15093
  $columnIndex,
14507
15094
  row,
@@ -14570,8 +15157,8 @@ const Methods = {
14570
15157
  toggleMethod
14571
15158
  } = expandOpts;
14572
15159
  const lazyRests = [];
14573
- const columnIndex = $xeTable.getColumnIndex(expandColumn);
14574
- const $columnIndex = $xeTable.getVMColumnIndex(expandColumn);
15160
+ const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
15161
+ const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
14575
15162
  if (rows) {
14576
15163
  if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
14577
15164
  rows = [rows];
@@ -14657,43 +15244,141 @@ const Methods = {
14657
15244
  const reactData = $xeTable;
14658
15245
  const internalData = $xeTable;
14659
15246
  const {
14660
- tableFullData
15247
+ tableFullData
15248
+ } = internalData;
15249
+ const expandOpts = $xeTable.computeExpandOpts;
15250
+ const {
15251
+ reserve
15252
+ } = expandOpts;
15253
+ const expList = $xeTable.getRowExpandRecords();
15254
+ internalData.rowExpandedMaps = {};
15255
+ reactData.rowExpandedFlag++;
15256
+ if (reserve) {
15257
+ tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
15258
+ }
15259
+ return $xeTable.$nextTick().then(() => {
15260
+ if (expList.length) {
15261
+ return $xeTable.recalculate(true);
15262
+ }
15263
+ }).then(() => {
15264
+ updateRowOffsetTop($xeTable);
15265
+ updateRowExpandStyle($xeTable);
15266
+ handleRowExpandScroll($xeTable);
15267
+ return $xeTable.updateCellAreas();
15268
+ });
15269
+ },
15270
+ clearRowExpandReserve() {
15271
+ this.rowExpandedReserveRowMap = {};
15272
+ return this.$nextTick();
15273
+ },
15274
+ getRowExpandRecords() {
15275
+ const $xeTable = this;
15276
+ const internalData = $xeTable;
15277
+ const rest = [];
15278
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.rowExpandedMaps, item => {
15279
+ if (item) {
15280
+ rest.push(item);
15281
+ }
15282
+ });
15283
+ return rest;
15284
+ },
15285
+ setRowGroups(fieldOrColumns) {
15286
+ const $xeTable = this;
15287
+ const props = $xeTable;
15288
+ const internalData = $xeTable;
15289
+ const {
15290
+ rowGroupConfig
15291
+ } = props;
15292
+ if (!rowGroupConfig) {
15293
+ errLog('vxe.error.reqProp', ['row-group-config']);
15294
+ return $xeTable.$nextTick();
15295
+ }
15296
+ if (fieldOrColumns) {
15297
+ handleUpdateRowGroup($xeTable, (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns]).map(fieldOrColumn => {
15298
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? fieldOrColumn : fieldOrColumn.field;
15299
+ }));
15300
+ return loadTableData($xeTable, internalData.tableSynchData, true);
15301
+ }
15302
+ return $xeTable.$nextTick();
15303
+ },
15304
+ clearRowGroups() {
15305
+ const $xeTable = this;
15306
+ const props = $xeTable;
15307
+ const internalData = $xeTable;
15308
+ const {
15309
+ rowGroupConfig
15310
+ } = props;
15311
+ if (!rowGroupConfig) {
15312
+ errLog('vxe.error.reqProp', ['row-group-config']);
15313
+ return $xeTable.$nextTick();
15314
+ }
15315
+ handleUpdateRowGroup($xeTable, []);
15316
+ return loadTableData($xeTable, internalData.tableSynchData, true);
15317
+ },
15318
+ isRowGroupRecord(row) {
15319
+ const $xeTable = this;
15320
+ const reactData = $xeTable;
15321
+ const {
15322
+ isRowGroupStatus
15323
+ } = reactData;
15324
+ return isRowGroupStatus && row.isAggregate;
15325
+ },
15326
+ isRowGroupExpandByRow(row) {
15327
+ const $xeTable = this;
15328
+ const reactData = $xeTable;
15329
+ const internalData = $xeTable;
15330
+ const {
15331
+ rowGroupExpandedFlag
15332
+ } = reactData;
15333
+ const {
15334
+ rowGroupExpandedMaps
15335
+ } = internalData;
15336
+ return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)];
15337
+ },
15338
+ setRowGroupExpand(rows, expanded) {
15339
+ const $xeTable = this;
15340
+ if (rows) {
15341
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
15342
+ rows = [rows];
15343
+ }
15344
+ return handleRowGroupVirtualExpand($xeTable, rows, expanded);
15345
+ }
15346
+ return $xeTable.$nextTick();
15347
+ },
15348
+ setAllRowGroupExpand(expanded) {
15349
+ const $xeTable = this;
15350
+ const reactData = $xeTable;
15351
+ const internalData = $xeTable;
15352
+ const {
15353
+ tableFullGroupData
14661
15354
  } = internalData;
14662
- const expandOpts = $xeTable.computeExpandOpts;
15355
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
14663
15356
  const {
14664
- reserve
14665
- } = expandOpts;
14666
- const expList = $xeTable.getRowExpandRecords();
14667
- internalData.rowExpandedMaps = {};
14668
- reactData.rowExpandedFlag++;
14669
- if (reserve) {
14670
- tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
15357
+ mapChildrenField
15358
+ } = rowGroupOpts;
15359
+ const rgExpandedMaps = {};
15360
+ if (expanded && mapChildrenField) {
15361
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, row => {
15362
+ if (row[mapChildrenField] && row[mapChildrenField].length) {
15363
+ rgExpandedMaps[getRowid($xeTable, row)] = row;
15364
+ }
15365
+ }, {
15366
+ children: mapChildrenField
15367
+ });
14671
15368
  }
14672
- return $xeTable.$nextTick().then(() => {
14673
- if (expList.length) {
14674
- return $xeTable.recalculate(true);
14675
- }
14676
- }).then(() => {
14677
- updateRowOffsetTop($xeTable);
14678
- updateRowExpandStyle($xeTable);
14679
- handleRowExpandScroll($xeTable);
14680
- return $xeTable.updateCellAreas();
14681
- });
14682
- },
14683
- clearRowExpandReserve() {
14684
- this.rowExpandedReserveRowMap = {};
14685
- return this.$nextTick();
15369
+ internalData.rowGroupExpandedMaps = rgExpandedMaps;
15370
+ handleVirtualTreeToList($xeTable);
15371
+ reactData.rowGroupExpandedFlag++;
15372
+ return $xeTable.handleTableData();
14686
15373
  },
14687
- getRowExpandRecords() {
15374
+ clearRowGroupExpand() {
14688
15375
  const $xeTable = this;
15376
+ const reactData = $xeTable;
14689
15377
  const internalData = $xeTable;
14690
- const rest = [];
14691
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.rowExpandedMaps, item => {
14692
- if (item) {
14693
- rest.push(item);
14694
- }
14695
- });
14696
- return rest;
15378
+ internalData.rowGroupExpandedMaps = {};
15379
+ handleVirtualTreeToList($xeTable);
15380
+ reactData.rowGroupExpandedFlag++;
15381
+ return $xeTable.handleTableData();
14697
15382
  },
14698
15383
  getTreeExpandRecords() {
14699
15384
  const $xeTable = this;
@@ -14762,11 +15447,11 @@ const Methods = {
14762
15447
  });
14763
15448
  }
14764
15449
  internalData.treeExpandedMaps = {};
14765
- reactData.treeExpandedFlag++;
14766
15450
  if (transform) {
14767
15451
  handleVirtualTreeToList($xeTable);
14768
- return $xeTable.handleTableData();
15452
+ $xeTable.handleTableData();
14769
15453
  }
15454
+ reactData.treeExpandedFlag++;
14770
15455
  return $xeTable.$nextTick();
14771
15456
  },
14772
15457
  /**
@@ -14775,6 +15460,7 @@ const Methods = {
14775
15460
  */
14776
15461
  reloadTreeExpand(row) {
14777
15462
  const $xeTable = this;
15463
+ const reactData = $xeTable;
14778
15464
  const internalData = $xeTable;
14779
15465
  const {
14780
15466
  treeExpandLazyLoadedMaps
@@ -14792,8 +15478,9 @@ const Methods = {
14792
15478
  }).then(() => {
14793
15479
  if (transform) {
14794
15480
  handleVirtualTreeToList($xeTable);
14795
- return $xeTable.handleTableData();
15481
+ $xeTable.handleTableData();
14796
15482
  }
15483
+ reactData.treeExpandedFlag++;
14797
15484
  }).then(() => {
14798
15485
  return $xeTable.recalculate();
14799
15486
  });
@@ -14808,6 +15495,40 @@ const Methods = {
14808
15495
  // 即将废弃
14809
15496
  return $xeTable.reloadTreeExpand(row);
14810
15497
  },
15498
+ /**
15499
+ * 行分组事件
15500
+ */
15501
+ triggerRowGroupExpandEvent(evnt, params) {
15502
+ const $xeTable = this;
15503
+ const internalData = $xeTable;
15504
+ const {
15505
+ rowGroupExpandedMaps
15506
+ } = internalData;
15507
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
15508
+ const {
15509
+ row,
15510
+ column
15511
+ } = params;
15512
+ const {
15513
+ trigger
15514
+ } = rowGroupOpts;
15515
+ if (trigger === 'manual') {
15516
+ return;
15517
+ }
15518
+ evnt.stopPropagation();
15519
+ const rowid = getRowid($xeTable, row);
15520
+ const expanded = !rowGroupExpandedMaps[rowid];
15521
+ const columnIndex = $xeTable.getColumnIndex(column);
15522
+ const $columnIndex = $xeTable.getVMColumnIndex(column);
15523
+ $xeTable.setRowGroupExpand(row, expanded);
15524
+ $xeTable.dispatchEvent('toggle-row-group-expand', {
15525
+ expanded,
15526
+ column,
15527
+ columnIndex,
15528
+ $columnIndex,
15529
+ row
15530
+ }, evnt);
15531
+ },
14811
15532
  /**
14812
15533
  * 展开树节点事件
14813
15534
  */
@@ -14868,11 +15589,15 @@ const Methods = {
14868
15589
  * @param {Boolean} expanded 是否展开
14869
15590
  */
14870
15591
  setAllTreeExpand(expanded) {
15592
+ const $xeTable = this;
15593
+ const reactData = $xeTable;
15594
+ const internalData = $xeTable;
14871
15595
  const {
14872
- tableFullData,
14873
- treeOpts
14874
- } = this;
15596
+ tableFullData
15597
+ } = internalData;
15598
+ const treeOpts = $xeTable.computeTreeOpts;
14875
15599
  const {
15600
+ transform,
14876
15601
  lazy
14877
15602
  } = treeOpts;
14878
15603
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -14885,7 +15610,13 @@ const Methods = {
14885
15610
  }, {
14886
15611
  children: childrenField
14887
15612
  });
14888
- return this.setTreeExpand(expandeds, expanded);
15613
+ return $xeTable.setTreeExpand(expandeds, expanded).then(() => {
15614
+ if (transform) {
15615
+ handleVirtualTreeToList($xeTable);
15616
+ reactData.treeExpandedFlag++;
15617
+ return $xeTable.recalculate();
15618
+ }
15619
+ });
14889
15620
  },
14890
15621
  /**
14891
15622
  * 设置展开树形节点,二个参数设置这一行展开与否
@@ -14951,7 +15682,6 @@ const Methods = {
14951
15682
  } = treeOpts;
14952
15683
  const expList = $xeTable.getTreeExpandRecords();
14953
15684
  internalData.treeExpandedMaps = {};
14954
- reactData.treeExpandedFlag++;
14955
15685
  if (reserve) {
14956
15686
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), {
14957
15687
  children: childrenField
@@ -14960,8 +15690,9 @@ const Methods = {
14960
15690
  return $xeTable.handleTableData().then(() => {
14961
15691
  if (transform) {
14962
15692
  handleVirtualTreeToList($xeTable);
14963
- return $xeTable.handleTableData();
15693
+ $xeTable.handleTableData();
14964
15694
  }
15695
+ reactData.treeExpandedFlag++;
14965
15696
  }).then(() => {
14966
15697
  if (expList.length) {
14967
15698
  $xeTable.recalculate();
@@ -15853,27 +16584,37 @@ const Methods = {
15853
16584
  * @param {Row} row 行对象
15854
16585
  */
15855
16586
  scrollToTreeRow(row) {
16587
+ const $xeTable = this;
16588
+ const props = $xeTable;
16589
+ const reactData = $xeTable;
16590
+ const internalData = $xeTable;
15856
16591
  const {
15857
- tableFullData,
15858
- treeConfig,
15859
- treeOpts
15860
- } = this;
15861
- const childrenField = treeOpts.children || treeOpts.childrenField;
16592
+ treeConfig
16593
+ } = props;
16594
+ const {
16595
+ isRowGroupStatus
16596
+ } = reactData;
16597
+ const {
16598
+ tableFullData
16599
+ } = internalData;
15862
16600
  const rests = [];
15863
- if (treeConfig) {
15864
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullData, item => item === row, {
15865
- children: childrenField
16601
+ if (treeConfig || isRowGroupStatus) {
16602
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
16603
+ const treeOpts = $xeTable.computeTreeOpts;
16604
+ const childrenField = treeOpts.children || treeOpts.childrenField;
16605
+ const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullData, item => $xeTable.eqRow(item, row), {
16606
+ children: isRowGroupStatus ? rowGroupOpts.mapChildrenField : childrenField
15866
16607
  });
15867
16608
  if (matchObj) {
15868
16609
  const nodes = matchObj.nodes;
15869
16610
  nodes.forEach((row, index) => {
15870
- if (index < nodes.length - 1 && !this.isTreeExpandByRow(row)) {
15871
- rests.push(this.setTreeExpand(row, true));
16611
+ if (index < nodes.length - 1 && !$xeTable.isTreeExpandByRow(row)) {
16612
+ rests.push($xeTable.setTreeExpand(row, true));
15872
16613
  }
15873
16614
  });
15874
16615
  }
15875
16616
  }
15876
- return Promise.all(rests).then(() => rowToVisible(this, row));
16617
+ return Promise.all(rests).then(() => rowToVisible($xeTable, row));
15877
16618
  },
15878
16619
  /**
15879
16620
  * 手动清除滚动相关信息,还原到初始状态
@@ -16203,8 +16944,7 @@ const isVMScrollProcess = $xeTable => {
16203
16944
  } = tableReactData;
16204
16945
  return !!(isDragResize || lastScrollTime && Date.now() < lastScrollTime + delayHover);
16205
16946
  };
16206
- function renderLine(h, _vm, rowid, params, cellHeight) {
16207
- const $xeTable = _vm.$parent;
16947
+ function renderLine(h, $xeTable, rowid, params, cellHeight) {
16208
16948
  const tableProps = $xeTable;
16209
16949
  const tableInternalData = $xeTable;
16210
16950
  const {
@@ -16253,8 +16993,7 @@ function renderLine(h, _vm, rowid, params, cellHeight) {
16253
16993
  /**
16254
16994
  * 渲染列
16255
16995
  */
16256
- function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
16257
- const $xeTable = _vm.$parent;
16996
+ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
16258
16997
  const tableProps = $xeTable;
16259
16998
  const tableReactData = $xeTable;
16260
16999
  const tableInternalData = $xeTable;
@@ -16549,7 +17288,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
16549
17288
  }));
16550
17289
  } else {
16551
17290
  // 渲染单元格
16552
- tdVNs.push(...renderLine(h, _vm, rowid, cellParams, cellHeight), h('div', {
17291
+ tdVNs.push(...renderLine(h, $xeTable, rowid, cellParams, cellHeight), h('div', {
16553
17292
  key: 'tc',
16554
17293
  class: ['vxe-cell', {
16555
17294
  'c--title': showTitle,
@@ -16648,6 +17387,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16648
17387
  const tableProps = $xeTable;
16649
17388
  const tableReactData = $xeTable;
16650
17389
  const tableInternalData = $xeTable;
17390
+ const $xeGrid = $xeTable.$xeGrid;
16651
17391
  const {
16652
17392
  stripe,
16653
17393
  rowKey,
@@ -16669,10 +17409,12 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16669
17409
  selectRadioRow,
16670
17410
  pendingRowFlag,
16671
17411
  isDragColMove,
16672
- rowExpandHeightFlag
17412
+ rowExpandHeightFlag,
17413
+ isRowGroupStatus
16673
17414
  } = tableReactData;
16674
17415
  const {
16675
17416
  fullAllDataRowIdData,
17417
+ fullColumnIdData,
16676
17418
  treeExpandedMaps,
16677
17419
  pendingRowMaps,
16678
17420
  rowExpandedMaps
@@ -16693,6 +17435,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16693
17435
  const {
16694
17436
  handleGetRowId
16695
17437
  } = createHandleGetRowId($xeTable);
17438
+ const isDeepRow = treeConfig || isRowGroupStatus;
16696
17439
  tableData.forEach((row, $rowIndex) => {
16697
17440
  const trOn = {};
16698
17441
  const rowid = handleGetRowId(row);
@@ -16701,6 +17444,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16701
17444
  let rowLevel = 0;
16702
17445
  let seq = -1;
16703
17446
  let _rowIndex = -1;
17447
+ const hasRowGroupAggregate = isRowGroupStatus && row.isAggregate;
16704
17448
  // 当前行事件
16705
17449
  if (rowOpts.isHover || highlightHoverRow) {
16706
17450
  trOn.mouseenter = evnt => {
@@ -16721,7 +17465,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16721
17465
  }
16722
17466
  if (rowRest) {
16723
17467
  rowLevel = rowRest.level;
16724
- if (treeConfig && transform && seqMode === 'increasing') {
17468
+ if (hasRowGroupAggregate || treeConfig && transform && seqMode === 'increasing') {
16725
17469
  seq = rowRest._index + 1;
16726
17470
  } else {
16727
17471
  seq = rowRest.seq;
@@ -16756,12 +17500,12 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16756
17500
  isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
16757
17501
  }
16758
17502
  // 拖拽行事件
16759
- if (rowOpts.drag && (!treeConfig || transform)) {
17503
+ if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
16760
17504
  trOn.dragstart = $xeTable.handleRowDragDragstartEvent;
16761
17505
  trOn.dragend = $xeTable.handleRowDragDragendEvent;
16762
17506
  trOn.dragover = $xeTable.handleRowDragDragoverEvent;
16763
17507
  }
16764
- const trClass = ['vxe-body--row', treeConfig ? `row--level-${rowLevel}` : '', {
17508
+ const trClass = ['vxe-body--row', isDeepRow ? `row--level-${rowLevel}` : '', {
16765
17509
  'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
16766
17510
  'is--new': isNewRow,
16767
17511
  'is--expand-row': isExpandRow,
@@ -16769,10 +17513,11 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16769
17513
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
16770
17514
  'row--radio': radioOpts.highlight && selectRadioRow === row,
16771
17515
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
16772
- 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
17516
+ 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid],
17517
+ 'row--group': hasRowGroupAggregate
16773
17518
  }, rowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowClassName) ? rowClassName(params) : rowClassName : ''];
16774
17519
  const tdVNs = tableColumn.map((column, $columnIndex) => {
16775
- return renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
17520
+ return renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
16776
17521
  });
16777
17522
  rows.push(!isColLoading && columnOpts.drag && columnDragOpts.animation ? h('transition-group', {
16778
17523
  props: {
@@ -16784,7 +17529,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16784
17529
  rowid
16785
17530
  },
16786
17531
  style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(params) : rowStyle : undefined,
16787
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
17532
+ key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
16788
17533
  nativeOn: trOn
16789
17534
  }, tdVNs) : h('tr', {
16790
17535
  class: trClass,
@@ -16792,7 +17537,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16792
17537
  rowid
16793
17538
  },
16794
17539
  style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(params) : rowStyle : undefined,
16795
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
17540
+ key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
16796
17541
  on: trOn
16797
17542
  }, tdVNs));
16798
17543
  // 如果行被展开了
@@ -16829,19 +17574,39 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
16829
17574
  }
16830
17575
  const {
16831
17576
  showOverflow
16832
- } = expandColumn;
17577
+ } = expandColumn || {};
17578
+ const colid = expandColumn.id;
17579
+ const colRest = fullColumnIdData[colid] || {};
16833
17580
  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;
17581
+ let columnIndex = -1;
17582
+ let $columnIndex = -1;
17583
+ let _columnIndex = -1;
17584
+ if (colRest) {
17585
+ columnIndex = colRest.index;
17586
+ $columnIndex = colRest.$index;
17587
+ _columnIndex = colRest._index;
17588
+ }
16834
17589
  const expandParams = {
17590
+ $grid: $xeGrid,
16835
17591
  $table: $xeTable,
16836
17592
  seq,
16837
17593
  column: expandColumn,
17594
+ columnIndex,
17595
+ $columnIndex,
17596
+ _columnIndex,
16838
17597
  fixed: fixedType,
16839
17598
  type: renderType,
16840
17599
  level: rowLevel,
16841
17600
  row,
17601
+ rowid,
16842
17602
  rowIndex,
16843
17603
  $rowIndex,
16844
- _rowIndex
17604
+ _rowIndex,
17605
+ isHidden: false,
17606
+ isEdit: false,
17607
+ visibleData: [],
17608
+ data: [],
17609
+ items: []
16845
17610
  };
16846
17611
  rows.push(h('tr', {
16847
17612
  class: ['vxe-body--expanded-row', {
@@ -18249,19 +19014,21 @@ const {
18249
19014
  syncResize: [Boolean, String, Number],
18250
19015
  // 响应式布局配置项
18251
19016
  resizeConfig: Object,
18252
- // 列配置信息
19017
+ // 列配置项
18253
19018
  columnConfig: Object,
18254
- // 当前列配置信息
19019
+ // 当前列配置项
18255
19020
  currentColumnConfig: Object,
18256
- // 单元格配置信息
19021
+ // 单元格配置项
18257
19022
  cellConfig: Object,
18258
- // 表头单元格配置信息
19023
+ // 表头单元格配置项
18259
19024
  headerCellConfig: Object,
18260
- // 表尾单元格配置信息
19025
+ // 表尾单元格配置项
18261
19026
  footerCellConfig: Object,
18262
- // 行配置信息
19027
+ // 行配置项
18263
19028
  rowConfig: Object,
18264
- // 当前行配置信息
19029
+ // 行分组配置项
19030
+ rowGroupConfig: Object,
19031
+ // 当前行配置项
18265
19032
  currentRowConfig: Object,
18266
19033
  // 已废弃,被 rowDragConfig 替换
18267
19034
  dragConfig: Object,
@@ -18482,6 +19249,7 @@ const renderSimplePanel = (h, _vm) => {
18482
19249
  };
18483
19250
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
18484
19251
  const isVisible = visibleMethod ? visibleMethod({
19252
+ $table: $xeTable,
18485
19253
  column
18486
19254
  }) : true;
18487
19255
  if (isVisible) {
@@ -18490,6 +19258,7 @@ const renderSimplePanel = (h, _vm) => {
18490
19258
  const isColGroup = column.children && column.children.length;
18491
19259
  const colTitle = formatText(column.getTitle(), 1);
18492
19260
  const isDisabled = checkMethod ? !checkMethod({
19261
+ $table: $xeTable,
18493
19262
  column
18494
19263
  }) : false;
18495
19264
  const isHidden = !isChecked;
@@ -18743,6 +19512,7 @@ const renderPopupPanel = (h, _vm) => {
18743
19512
  };
18744
19513
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
18745
19514
  const isVisible = visibleMethod ? visibleMethod({
19515
+ $table: $xeTable,
18746
19516
  column
18747
19517
  }) : true;
18748
19518
  if (isVisible) {
@@ -18769,6 +19539,7 @@ const renderPopupPanel = (h, _vm) => {
18769
19539
  const colTitle = formatText(column.getTitle(), 1);
18770
19540
  const isColGroup = column.children && column.children.length;
18771
19541
  const isDisabled = checkMethod ? !checkMethod({
19542
+ $table: $xeTable,
18772
19543
  column
18773
19544
  }) : false;
18774
19545
  const isHidden = !isChecked;
@@ -19500,7 +20271,7 @@ const renderPopupPanel = (h, _vm) => {
19500
20271
  isToChildDrag
19501
20272
  } = columnDragOpts;
19502
20273
  const optEl = evnt.currentTarget;
19503
- const hasCtrlKey = evnt.ctrlKey;
20274
+ const isControlKey = hasControlKey(evnt);
19504
20275
  const colid = optEl.getAttribute('colid');
19505
20276
  const column = $xeTable.getColumnById(colid);
19506
20277
  // 是否移入有效列
@@ -19512,7 +20283,7 @@ const renderPopupPanel = (h, _vm) => {
19512
20283
  panel_showDropTip(this, evnt, optEl, false, dragPos);
19513
20284
  return;
19514
20285
  }
19515
- this.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey && immediate);
20286
+ this.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey && immediate);
19516
20287
  this.prevDragCol = column;
19517
20288
  this.prevDragPos = dragPos;
19518
20289
  panel_showDropTip(this, evnt, optEl, true, dragPos);
@@ -22694,6 +23465,7 @@ function getSeq($xeTable, cellValue, row, $rowIndex, column, $columnIndex) {
22694
23465
  const seqMethod = seqOpts.seqMethod || column.seqMethod;
22695
23466
  if (seqMethod) {
22696
23467
  return seqMethod({
23468
+ $table: $xeTable,
22697
23469
  row,
22698
23470
  rowIndex: $xeTable.getRowIndex(row),
22699
23471
  $rowIndex,
@@ -22786,6 +23558,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
22786
23558
  cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
22787
23559
  item._checkboxLabel = checkboxOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkboxOpts.labelField) : '';
22788
23560
  item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
23561
+ $table: $xeTable,
22789
23562
  row
22790
23563
  });
22791
23564
  break;
@@ -22793,6 +23566,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
22793
23566
  cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
22794
23567
  item._radioLabel = radioOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, radioOpts.labelField) : '';
22795
23568
  item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
23569
+ $table: $xeTable,
22796
23570
  row
22797
23571
  });
22798
23572
  break;
@@ -22856,6 +23630,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
22856
23630
  cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
22857
23631
  item._checkboxLabel = checkboxOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkboxOpts.labelField) : '';
22858
23632
  item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
23633
+ $table: $xeTable,
22859
23634
  row
22860
23635
  });
22861
23636
  break;
@@ -22863,6 +23638,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
22863
23638
  cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
22864
23639
  item._radioLabel = radioOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, radioOpts.labelField) : '';
22865
23640
  item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
23641
+ $table: $xeTable,
22866
23642
  row
22867
23643
  });
22868
23644
  break;
@@ -22896,6 +23672,7 @@ function getExportData($xeTable, opts) {
22896
23672
  let datas = opts.data;
22897
23673
  if (dataFilterMethod) {
22898
23674
  datas = datas.filter((row, index) => dataFilterMethod({
23675
+ $table: $xeTable,
22899
23676
  row,
22900
23677
  $rowIndex: index
22901
23678
  }));
@@ -22945,11 +23722,12 @@ function getFooterCellValue($xeTable, opts, row, column) {
22945
23722
  }
22946
23723
  return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
22947
23724
  }
22948
- function getFooterData(opts, footerTableData) {
23725
+ function getFooterData($xeTable, opts, footerTableData) {
22949
23726
  const {
22950
23727
  footerFilterMethod
22951
23728
  } = opts;
22952
23729
  return footerFilterMethod ? footerTableData.filter((items, index) => footerFilterMethod({
23730
+ $table: $xeTable,
22953
23731
  items,
22954
23732
  $rowIndex: index
22955
23733
  })) : footerTableData;
@@ -22995,7 +23773,7 @@ function toCsv($xeTable, opts, columns, datas) {
22995
23773
  const {
22996
23774
  footerTableData
22997
23775
  } = reactData;
22998
- const footers = getFooterData(opts, footerTableData);
23776
+ const footers = getFooterData($xeTable, opts, footerTableData);
22999
23777
  footers.forEach(row => {
23000
23778
  content += columns.map(column => toTxtCellLabel(getFooterCellValue($xeTable, opts, row, column))).join(',') + enterSymbol;
23001
23779
  });
@@ -23015,7 +23793,7 @@ function toTxt($xeTable, opts, columns, datas) {
23015
23793
  const {
23016
23794
  footerTableData
23017
23795
  } = reactData;
23018
- const footers = getFooterData(opts, footerTableData);
23796
+ const footers = getFooterData($xeTable, opts, footerTableData);
23019
23797
  footers.forEach(row => {
23020
23798
  content += columns.map(column => toTxtCellLabel(getFooterCellValue($xeTable, opts, row, column))).join('\t') + enterSymbol;
23021
23799
  });
@@ -23197,7 +23975,7 @@ function toHtml($xeTable, opts, columns, datas) {
23197
23975
  const {
23198
23976
  footerTableData
23199
23977
  } = reactData;
23200
- const footers = getFooterData(opts, footerTableData);
23978
+ const footers = getFooterData($xeTable, opts, footerTableData);
23201
23979
  if (footers.length) {
23202
23980
  tables.push('<tfoot>');
23203
23981
  footers.forEach(row => {
@@ -23232,7 +24010,7 @@ function toXML($xeTable, opts, columns, datas) {
23232
24010
  const {
23233
24011
  footerTableData
23234
24012
  } = reactData;
23235
- const footers = getFooterData(opts, footerTableData);
24013
+ const footers = getFooterData($xeTable, opts, footerTableData);
23236
24014
  footers.forEach(row => {
23237
24015
  xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($xeTable, opts, row, column)}</Data></Cell>`).join('')}</Row>`;
23238
24016
  });
@@ -23932,6 +24710,7 @@ function handleExportAndPrint($xeTable, options, isPrint) {
23932
24710
  column.checked = isChecked;
23933
24711
  column.halfChecked = false;
23934
24712
  column.disabled = parent && parent.disabled || (checkMethod ? !checkMethod({
24713
+ $table: $xeTable,
23935
24714
  column
23936
24715
  }) : false);
23937
24716
  });
@@ -25061,8 +25840,9 @@ function handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRigh
25061
25840
  const rangeRows = getCheckboxRangeRows(this, evnt, params, trElem, trRect, offsetClientTop, offsetTop < marginSize ? -rangeHeight : rangeHeight);
25062
25841
  // 至少滑动 10px 才能有效匹配
25063
25842
  if (rangeHeight > 10 && rangeRows.length !== lastRangeRows.length) {
25843
+ const isControlKey = hasControlKey(evnt);
25064
25844
  lastRangeRows = rangeRows;
25065
- if (evnt.ctrlKey) {
25845
+ if (isControlKey) {
25066
25846
  rangeRows.forEach(row => {
25067
25847
  $xeTable.handleBatchSelectRows([row], selectRecords.indexOf(row) === -1);
25068
25848
  });
@@ -25779,6 +26559,26 @@ function validErrorRuleValue(rule, val) {
25779
26559
  });
25780
26560
  ;// CONCATENATED MODULE: ./packages/table/module/custom/mixin.ts
25781
26561
 
26562
+ function calcMaxHeight($xeTable) {
26563
+ const reactData = $xeTable;
26564
+ const {
26565
+ customStore
26566
+ } = reactData;
26567
+ const el = $xeTable.$refs.refElem;
26568
+ // 判断面板不能大于表格高度
26569
+ let tableHeight = 0;
26570
+ if (el) {
26571
+ tableHeight = el.clientHeight - 28;
26572
+ }
26573
+ customStore.maxHeight = Math.max(88, tableHeight);
26574
+ }
26575
+ function emitCustomEvent($xeTable, type, evnt) {
26576
+ const $xeGrid = $xeTable.$xeGrid;
26577
+ const comp = $xeGrid || $xeTable;
26578
+ comp.dispatchEvent('custom', {
26579
+ type
26580
+ }, evnt);
26581
+ }
25782
26582
  /* harmony default export */ var custom_mixin = ({
25783
26583
  methods: {
25784
26584
  _openCustom() {
@@ -25792,21 +26592,23 @@ function validErrorRuleValue(rule, val) {
25792
26592
  initStore.custom = true;
25793
26593
  $xeTable.handleUpdateCustomColumn();
25794
26594
  $xeTable.checkCustomStatus();
25795
- $xeTable.calcMaxHeight();
25796
- return this.$nextTick().then(() => this.calcMaxHeight());
26595
+ calcMaxHeight($xeTable);
26596
+ return $xeTable.$nextTick().then(() => calcMaxHeight($xeTable));
25797
26597
  },
25798
26598
  _closeCustom() {
26599
+ const $xeTable = this;
26600
+ const reactData = $xeTable;
25799
26601
  const {
25800
- customStore,
25801
- customOpts
25802
- } = this;
26602
+ customStore
26603
+ } = reactData;
26604
+ const customOpts = $xeTable.computeCustomOpts;
25803
26605
  if (customStore.visible) {
25804
26606
  customStore.visible = false;
25805
26607
  if (!customOpts.immediate) {
25806
- this.handleCustom();
26608
+ $xeTable.handleCustom();
25807
26609
  }
25808
26610
  }
25809
- return this.$nextTick();
26611
+ return $xeTable.$nextTick();
25810
26612
  },
25811
26613
  _saveCustom() {
25812
26614
  const $xeTable = this;
@@ -25855,16 +26657,17 @@ function validErrorRuleValue(rule, val) {
25855
26657
  },
25856
26658
  _cancelCustom() {
25857
26659
  const $xeTable = this;
26660
+ const reactData = $xeTable;
25858
26661
  const {
25859
- customStore,
25860
- customOpts,
25861
- customColumnList
25862
- } = $xeTable;
26662
+ customColumnList,
26663
+ customStore
26664
+ } = reactData;
25863
26665
  const {
25864
26666
  oldSortMaps,
25865
26667
  oldFixedMaps,
25866
26668
  oldVisibleMaps
25867
26669
  } = customStore;
26670
+ const customOpts = $xeTable.computeCustomOpts;
25868
26671
  const {
25869
26672
  allowVisible,
25870
26673
  allowSort,
@@ -25899,9 +26702,9 @@ function validErrorRuleValue(rule, val) {
25899
26702
  const reactData = $xeTable;
25900
26703
  const internalData = $xeTable;
25901
26704
  const {
25902
- collectColumn,
25903
- customOpts
26705
+ collectColumn
25904
26706
  } = internalData;
26707
+ const customOpts = $xeTable.computeCustomOpts;
25905
26708
  const {
25906
26709
  checkMethod
25907
26710
  } = customOpts;
@@ -25922,6 +26725,7 @@ function validErrorRuleValue(rule, val) {
25922
26725
  column.renderSortNumber = column.sortNumber;
25923
26726
  }
25924
26727
  if (!checkMethod || checkMethod({
26728
+ $table: $xeTable,
25925
26729
  column
25926
26730
  })) {
25927
26731
  column.visible = column.defaultVisible;
@@ -25944,11 +26748,11 @@ function validErrorRuleValue(rule, val) {
25944
26748
  const reactData = $xeTable;
25945
26749
  const {
25946
26750
  customStore
25947
- } = this;
26751
+ } = reactData;
25948
26752
  const {
25949
- customColumnList,
25950
- customOpts
25951
- } = this;
26753
+ customColumnList
26754
+ } = reactData;
26755
+ const customOpts = $xeTable.computeCustomOpts;
25952
26756
  const {
25953
26757
  checkMethod,
25954
26758
  visibleMethod
@@ -25957,11 +26761,13 @@ function validErrorRuleValue(rule, val) {
25957
26761
  if (customOpts.immediate) {
25958
26762
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
25959
26763
  if (visibleMethod && !visibleMethod({
26764
+ $table: $xeTable,
25960
26765
  column
25961
26766
  })) {
25962
26767
  return;
25963
26768
  }
25964
26769
  if (checkMethod && !checkMethod({
26770
+ $table: $xeTable,
25965
26771
  column
25966
26772
  })) {
25967
26773
  return;
@@ -25977,11 +26783,13 @@ function validErrorRuleValue(rule, val) {
25977
26783
  } else {
25978
26784
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
25979
26785
  if (visibleMethod && !visibleMethod({
26786
+ $table: $xeTable,
25980
26787
  column
25981
26788
  })) {
25982
26789
  return;
25983
26790
  }
25984
26791
  if (checkMethod && !checkMethod({
26792
+ $table: $xeTable,
25985
26793
  column
25986
26794
  })) {
25987
26795
  return;
@@ -25993,31 +26801,26 @@ function validErrorRuleValue(rule, val) {
25993
26801
  }
25994
26802
  $xeTable.checkCustomStatus();
25995
26803
  },
25996
- calcMaxHeight() {
26804
+ checkCustomStatus() {
26805
+ const $xeTable = this;
26806
+ const reactData = $xeTable;
26807
+ const internalData = $xeTable;
25997
26808
  const {
25998
- $el,
25999
26809
  customStore
26000
- } = this;
26001
- // 判断面板不能大于表格高度
26002
- let tableHeight = 0;
26003
- if ($el) {
26004
- tableHeight = $el.clientHeight - 28;
26005
- }
26006
- customStore.maxHeight = Math.max(88, tableHeight);
26007
- },
26008
- checkCustomStatus() {
26810
+ } = reactData;
26009
26811
  const {
26010
- customStore,
26011
- collectColumn,
26012
- customOpts
26013
- } = this;
26812
+ collectColumn
26813
+ } = internalData;
26814
+ const customOpts = $xeTable.computeCustomOpts;
26014
26815
  const {
26015
26816
  checkMethod
26016
26817
  } = customOpts;
26017
26818
  customStore.isAll = collectColumn.every(column => (checkMethod ? !checkMethod({
26819
+ $table: $xeTable,
26018
26820
  column
26019
26821
  }) : false) || column.renderVisible);
26020
26822
  customStore.isIndeterminate = !customStore.isAll && collectColumn.some(column => (!checkMethod || checkMethod({
26823
+ $table: $xeTable,
26021
26824
  column
26022
26825
  })) && (column.renderVisible || column.halfVisible));
26023
26826
  },
@@ -26025,45 +26828,48 @@ function validErrorRuleValue(rule, val) {
26025
26828
  const $xeTable = this;
26026
26829
  const $xeGrid = $xeTable.$xeGrid;
26027
26830
  const comp = $xeGrid || $xeTable;
26028
- comp.$emit('custom', {
26029
- type,
26030
- $table: $xeTable,
26031
- $grid: $xeGrid,
26032
- $event: evnt
26033
- });
26831
+ comp.dispatchEvent('custom', {
26832
+ type
26833
+ }, evnt);
26034
26834
  },
26035
26835
  triggerCustomEvent(evnt) {
26836
+ const $xeTable = this;
26837
+ const reactData = $xeTable;
26036
26838
  const {
26037
26839
  customStore
26038
- } = this;
26840
+ } = reactData;
26039
26841
  if (customStore.visible) {
26040
26842
  this.closeCustom();
26041
- this.emitCustomEvent('close', evnt);
26843
+ emitCustomEvent($xeTable, 'close', evnt);
26042
26844
  } else {
26043
26845
  customStore.btnEl = evnt.target;
26044
26846
  this.openCustom();
26045
- this.emitCustomEvent('open', evnt);
26847
+ emitCustomEvent($xeTable, 'open', evnt);
26046
26848
  }
26047
26849
  },
26048
26850
  customOpenEvent(evnt) {
26851
+ const $xeTable = this;
26852
+ const reactData = $xeTable;
26049
26853
  const {
26050
26854
  customStore
26051
- } = this;
26052
- if (!customStore.visible) {
26855
+ } = reactData;
26856
+ if (customStore.visible) {
26053
26857
  customStore.activeBtn = true;
26054
26858
  customStore.btnEl = evnt.target;
26055
- this.openCustom();
26056
- this.emitCustomEvent('open', evnt);
26859
+ $xeTable.openCustom();
26860
+ emitCustomEvent($xeTable, 'open', evnt);
26057
26861
  }
26058
26862
  },
26059
26863
  customCloseEvent(evnt) {
26864
+ const $xeTable = this;
26865
+ const reactData = $xeTable;
26060
26866
  const {
26061
26867
  customStore
26062
- } = this;
26868
+ } = reactData;
26063
26869
  if (customStore.visible) {
26064
26870
  customStore.activeBtn = false;
26065
- this.closeCustom();
26066
- this.emitCustomEvent('close', evnt);
26871
+ $xeTable.closeCustom();
26872
+ emitCustomEvent($xeTable, 'close', evnt);
26067
26873
  }
26068
26874
  },
26069
26875
  handleUpdateCustomColumn() {
@@ -26289,11 +27095,13 @@ function renderRowExpandedVNs(h, $xeTable) {
26289
27095
  const props = $xeTable;
26290
27096
  const reactData = $xeTable;
26291
27097
  const internalData = $xeTable;
27098
+ const $xeGrid = $xeTable.$xeGrid;
26292
27099
  const {
26293
27100
  treeConfig
26294
27101
  } = props;
26295
27102
  const {
26296
- expandColumn
27103
+ expandColumn,
27104
+ isRowGroupStatus
26297
27105
  } = reactData;
26298
27106
  const tableRowExpandedList = $xeTable.computeTableRowExpandedList;
26299
27107
  const expandOpts = $xeTable.computeExpandOpts;
@@ -26315,10 +27123,12 @@ function renderRowExpandedVNs(h, $xeTable) {
26315
27123
  const expandOpts = $xeTable.computeExpandOpts;
26316
27124
  const {
26317
27125
  height: expandHeight,
26318
- padding
27126
+ padding,
27127
+ indent
26319
27128
  } = expandOpts;
26320
27129
  const {
26321
- fullAllDataRowIdData
27130
+ fullAllDataRowIdData,
27131
+ fullColumnIdData
26322
27132
  } = internalData;
26323
27133
  const treeOpts = $xeTable.computeTreeOpts;
26324
27134
  const {
@@ -26328,6 +27138,8 @@ function renderRowExpandedVNs(h, $xeTable) {
26328
27138
  const cellStyle = {};
26329
27139
  const rowid = handleGetRowId(row);
26330
27140
  const rowRest = fullAllDataRowIdData[rowid];
27141
+ const colid = expandColumn.id;
27142
+ const colRest = fullColumnIdData[colid] || {};
26331
27143
  let rowLevel = 0;
26332
27144
  let seq = -1;
26333
27145
  let _rowIndex = -1;
@@ -26335,7 +27147,7 @@ function renderRowExpandedVNs(h, $xeTable) {
26335
27147
  let $rowIndex = -1;
26336
27148
  if (rowRest) {
26337
27149
  rowLevel = rowRest.level;
26338
- if (treeConfig && transform && seqMode === 'increasing') {
27150
+ if (isRowGroupStatus || treeConfig && transform && seqMode === 'increasing') {
26339
27151
  seq = rowRest._index + 1;
26340
27152
  } else {
26341
27153
  seq = rowRest.seq;
@@ -26347,20 +27159,38 @@ function renderRowExpandedVNs(h, $xeTable) {
26347
27159
  if (expandHeight) {
26348
27160
  cellStyle.height = `${expandHeight}px`;
26349
27161
  }
26350
- if (treeConfig) {
26351
- cellStyle.paddingLeft = `${rowLevel * treeOpts.indent + 30}px`;
27162
+ if (isRowGroupStatus || treeConfig) {
27163
+ cellStyle.paddingLeft = `${rowLevel * (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(indent) ? indent : treeOpts.indent) + 30}px`;
27164
+ }
27165
+ let columnIndex = -1;
27166
+ let $columnIndex = -1;
27167
+ let _columnIndex = -1;
27168
+ if (colRest) {
27169
+ columnIndex = colRest.index;
27170
+ $columnIndex = colRest.$index;
27171
+ _columnIndex = colRest._index;
26352
27172
  }
26353
27173
  const expandParams = {
27174
+ $grid: $xeGrid,
26354
27175
  $table: $xeTable,
26355
27176
  seq,
26356
27177
  column: expandColumn,
27178
+ columnIndex,
27179
+ $columnIndex,
27180
+ _columnIndex,
26357
27181
  fixed: '',
26358
27182
  type: 'body',
26359
27183
  level: rowLevel,
27184
+ rowid,
26360
27185
  row,
26361
27186
  rowIndex,
26362
27187
  $rowIndex,
26363
- _rowIndex
27188
+ _rowIndex,
27189
+ isHidden: false,
27190
+ isEdit: false,
27191
+ visibleData: [],
27192
+ data: [],
27193
+ items: []
26364
27194
  };
26365
27195
  expandVNs.push(h('div', {
26366
27196
  key: rowid,
@@ -26556,6 +27386,8 @@ function renderBody(h, $xeTable) {
26556
27386
  selectRadioRow: null,
26557
27387
  // 表尾合计数据
26558
27388
  footerTableData: [],
27389
+ // 行分组列信息
27390
+ rowGroupColumn: null,
26559
27391
  // 展开列信息
26560
27392
  expandColumn: null,
26561
27393
  hasFixedColumn: false,
@@ -26706,6 +27538,9 @@ function renderBody(h, $xeTable) {
26706
27538
  isTitle: false,
26707
27539
  isFooter: false
26708
27540
  },
27541
+ visiblwRowsFlag: 1,
27542
+ isRowGroupStatus: false,
27543
+ rowGroupExpandedFlag: 1,
26709
27544
  rowExpandedFlag: 1,
26710
27545
  treeExpandedFlag: 1,
26711
27546
  updateCheckboxFlag: 1,
@@ -26894,28 +27729,41 @@ function renderBody(h, $xeTable) {
26894
27729
  const props = $xeTable;
26895
27730
  return Object.assign({}, table_getConfig().table.rowConfig, props.rowConfig);
26896
27731
  },
27732
+ computeRowGroupOpts() {
27733
+ const $xeTable = this;
27734
+ const props = $xeTable;
27735
+ return Object.assign({}, table_getConfig().table.rowGroupConfig, props.rowGroupConfig);
27736
+ },
26897
27737
  computeCurrentRowOpts() {
26898
27738
  const $xeTable = this;
26899
27739
  const props = $xeTable;
26900
27740
  return Object.assign({}, table_getConfig().table.currentRowConfig, props.currentRowConfig);
26901
27741
  },
26902
27742
  computeRowDragOpts() {
26903
- return Object.assign({}, table_getConfig().table.rowDragConfig, this.rowDragConfig);
27743
+ const $xeTable = this;
27744
+ const props = $xeTable;
27745
+ return Object.assign({}, table_getConfig().table.rowDragConfig, props.rowDragConfig);
26904
27746
  },
26905
27747
  computeColumnDragOpts() {
26906
- return Object.assign({}, table_getConfig().table.columnDragConfig, this.columnDragConfig);
27748
+ const $xeTable = this;
27749
+ const props = $xeTable;
27750
+ return Object.assign({}, table_getConfig().table.columnDragConfig, props.columnDragConfig);
26907
27751
  },
26908
27752
  resizeOpts() {
26909
27753
  return this.computeResizeOpts;
26910
27754
  },
26911
27755
  computeResizeOpts() {
26912
- return Object.assign({}, table_getConfig().table.resizeConfig, this.resizeConfig);
27756
+ const $xeTable = this;
27757
+ const props = $xeTable;
27758
+ return Object.assign({}, table_getConfig().table.resizeConfig, props.resizeConfig);
26913
27759
  },
26914
27760
  resizableOpts() {
26915
27761
  return this.computeResizableOpts;
26916
27762
  },
26917
27763
  computeResizableOpts() {
26918
- return Object.assign({}, table_getConfig().table.resizableConfig, this.resizableConfig);
27764
+ const $xeTable = this;
27765
+ const props = $xeTable;
27766
+ return Object.assign({}, table_getConfig().table.resizableConfig, props.resizableConfig);
26919
27767
  },
26920
27768
  seqOpts() {
26921
27769
  return this.computeSeqOpts;
@@ -27180,7 +28028,10 @@ function renderBody(h, $xeTable) {
27180
28028
  } = props;
27181
28029
  const {
27182
28030
  rowExpandedFlag,
27183
- expandColumn
28031
+ expandColumn,
28032
+ rowGroupExpandedFlag,
28033
+ treeExpandedFlag,
28034
+ isRowGroupStatus
27184
28035
  } = reactData;
27185
28036
  const {
27186
28037
  visibleDataRowIdData,
@@ -27191,15 +28042,16 @@ function renderBody(h, $xeTable) {
27191
28042
  transform
27192
28043
  } = treeOpts;
27193
28044
  const expandList = [];
27194
- if (expandColumn && rowExpandedFlag) {
27195
- if (treeConfig && !transform) {
28045
+ if (expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
28046
+ if (isRowGroupStatus || treeConfig && transform) {
28047
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(rowExpandedMaps, (row, rowid) => {
28048
+ if (visibleDataRowIdData[rowid]) {
28049
+ expandList.push(row);
28050
+ }
28051
+ });
28052
+ } else {
27196
28053
  return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().values(rowExpandedMaps);
27197
28054
  }
27198
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(rowExpandedMaps, (row, rowid) => {
27199
- if (visibleDataRowIdData[rowid]) {
27200
- expandList.push(row);
27201
- }
27202
- });
27203
28055
  }
27204
28056
  return expandList;
27205
28057
  },
@@ -27306,6 +28158,11 @@ function renderBody(h, $xeTable) {
27306
28158
  y: overflowY && scrollYLoad
27307
28159
  };
27308
28160
  },
28161
+ computeRowGroupFields() {
28162
+ const $xeTable = this;
28163
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
28164
+ return rowGroupOpts.groupFields;
28165
+ },
27309
28166
  tabsResizeFlag() {
27310
28167
  const $xeTable = this;
27311
28168
  const $xeTabs = $xeTable.$xeTabs;
@@ -27425,6 +28282,10 @@ function renderBody(h, $xeTable) {
27425
28282
  mergeFooterItems(value) {
27426
28283
  this.clearMergeFooterItems();
27427
28284
  this.$nextTick(() => this.setMergeFooterItems(value));
28285
+ },
28286
+ computeRowGroupFields(val) {
28287
+ const $xeTable = this;
28288
+ $xeTable.handleUpdateRowGroup(val);
27428
28289
  }
27429
28290
  },
27430
28291
  created() {
@@ -27480,8 +28341,16 @@ function renderBody(h, $xeTable) {
27480
28341
  // 列表完整数据、条件处理后
27481
28342
  tableFullData: [],
27482
28343
  afterFullData: [],
28344
+ afterTreeFullData: [],
28345
+ afterGroupFullData: [],
27483
28346
  // 列表条件处理后数据集合
27484
28347
  afterFullRowMaps: {},
28348
+ // 树结构完整数据、条件处理后
28349
+ tableFullTreeData: [],
28350
+ // 行分组全量数据、条件处理后
28351
+ tableFullGroupData: [],
28352
+ tableSynchData: [],
28353
+ tableSourceData: [],
27485
28354
  // 收集的列配置(带分组)
27486
28355
  collectColumn: [],
27487
28356
  // 完整所有列(不带分组)
@@ -27512,6 +28381,8 @@ function renderBody(h, $xeTable) {
27512
28381
  rowExpandedMaps: {},
27513
28382
  // 懒加载中的展开行的集合
27514
28383
  rowExpandLazyLoadedMaps: {},
28384
+ // 已展开的分组行
28385
+ rowGroupExpandedMaps: {},
27515
28386
  // 已展开树节点集合
27516
28387
  treeExpandedMaps: {},
27517
28388
  // 懒加载中的树节点的集合
@@ -27554,9 +28425,11 @@ function renderBody(h, $xeTable) {
27554
28425
  const importOpts = $xeTable.computeImportOpts;
27555
28426
  const currentRowOpts = $xeTable.computeCurrentRowOpts;
27556
28427
  const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
27557
- const virtualXOpts = $xeTable.computeVirtualXOpts;
27558
- const virtualYOpts = $xeTable.computeVirtualYOpts;
27559
28428
  const keyboardOpts = $xeTable.computeKeyboardOpts;
28429
+ const rowGroupOpts = $xeTable.computeRowGroupOpts;
28430
+ const {
28431
+ groupFields
28432
+ } = rowGroupOpts;
27560
28433
  if (props.rowId) {
27561
28434
  warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField']);
27562
28435
  }
@@ -27712,19 +28585,19 @@ function renderBody(h, $xeTable) {
27712
28585
  warnLog('vxe.error.notConflictProp', ['column-config.isCurrent', 'current-column-config.isFollowSelected']);
27713
28586
  }
27714
28587
  // 如果不支持虚拟滚动
27715
- if (props.spanMethod) {
27716
- if (virtualXOpts.enabled) {
27717
- warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false']);
27718
- }
27719
- if (virtualYOpts.enabled) {
27720
- warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false']);
27721
- }
27722
- }
27723
- if (props.footerSpanMethod) {
27724
- if (virtualXOpts.enabled) {
27725
- warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false']);
27726
- }
27727
- }
28588
+ // if (props.spanMethod) {
28589
+ // if (virtualXOpts.enabled) {
28590
+ // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false'])
28591
+ // }
28592
+ // if (virtualYOpts.enabled) {
28593
+ // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false'])
28594
+ // }
28595
+ // }
28596
+ // if (props.footerSpanMethod) {
28597
+ // if (virtualXOpts.enabled) {
28598
+ // warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false'])
28599
+ // }
28600
+ // }
27728
28601
  // 检查是否有安装需要的模块
27729
28602
  if (props.editConfig && !$xeTable.insert) {
27730
28603
  errLog('vxe.error.reqModule', ['Edit']);
@@ -27748,6 +28621,7 @@ function renderBody(h, $xeTable) {
27748
28621
  endIndex: 1,
27749
28622
  visibleSize: 0
27750
28623
  });
28624
+ this.handleUpdateRowGroup(groupFields);
27751
28625
  this.loadTableData(data, true).then(() => {
27752
28626
  if (data && data.length) {
27753
28627
  this.inited = true;
@@ -27888,6 +28762,7 @@ function renderBody(h, $xeTable) {
27888
28762
  scrollYLoad,
27889
28763
  tableData,
27890
28764
  initStore,
28765
+ isRowGroupStatus,
27891
28766
  columnStore,
27892
28767
  filterStore,
27893
28768
  customStore
@@ -27935,6 +28810,7 @@ function renderBody(h, $xeTable) {
27935
28810
  'is--header': showHeader,
27936
28811
  'is--footer': showFooter,
27937
28812
  'is--group': isGroup,
28813
+ 'is-row-group': isRowGroupStatus,
27938
28814
  'is--tree-line': treeConfig && (treeOpts.showLine || treeOpts.line),
27939
28815
  'is--fixed-left': leftList.length,
27940
28816
  'is--fixed-right': rightList.length,
@@ -31919,7 +32795,8 @@ const Toolbar = VxeToolbar;
31919
32795
  maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
31920
32796
  dragTip: '移动:{0}',
31921
32797
  resizeColTip: '宽:{0} 像素',
31922
- resizeRowTip: '高:{0} 像素'
32798
+ resizeRowTip: '高:{0} 像素',
32799
+ rowGroupContentTotal: '{0}({1})'
31923
32800
  },
31924
32801
  grid: {
31925
32802
  selectOneRecord: '请至少选择一条记录!',