vxe-table 3.15.5 → 3.15.6

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