vxe-table 3.17.0-beta.9 → 3.17.0

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 (51) hide show
  1. package/es/grid/src/grid.js +88 -23
  2. package/es/style.css +1 -1
  3. package/es/table/module/custom/mixin.js +22 -14
  4. package/es/table/module/edit/mixin.js +5 -5
  5. package/es/table/src/body.js +7 -6
  6. package/es/table/src/columnInfo.js +5 -0
  7. package/es/table/src/methods.js +201 -76
  8. package/es/table/src/table.js +7 -6
  9. package/es/table/src/util.js +9 -0
  10. package/es/ui/index.js +2 -1
  11. package/es/ui/src/log.js +1 -1
  12. package/lib/grid/src/grid.js +104 -29
  13. package/lib/grid/src/grid.min.js +1 -1
  14. package/lib/index.umd.js +402 -127
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/table/module/custom/mixin.js +25 -13
  18. package/lib/table/module/custom/mixin.min.js +1 -1
  19. package/lib/table/module/edit/mixin.js +5 -0
  20. package/lib/table/module/edit/mixin.min.js +1 -1
  21. package/lib/table/src/body.js +7 -6
  22. package/lib/table/src/body.min.js +1 -1
  23. package/lib/table/src/columnInfo.js +5 -0
  24. package/lib/table/src/columnInfo.min.js +1 -1
  25. package/lib/table/src/methods.js +238 -73
  26. package/lib/table/src/methods.min.js +1 -1
  27. package/lib/table/src/table.js +7 -6
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/src/util.js +10 -0
  30. package/lib/table/src/util.min.js +1 -1
  31. package/lib/ui/index.js +2 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/package.json +2 -2
  36. package/packages/grid/src/grid.ts +101 -25
  37. package/packages/table/module/custom/mixin.ts +21 -13
  38. package/packages/table/module/edit/mixin.ts +5 -5
  39. package/packages/table/src/body.ts +7 -6
  40. package/packages/table/src/columnInfo.ts +7 -0
  41. package/packages/table/src/methods.ts +215 -76
  42. package/packages/table/src/props.ts +1 -1
  43. package/packages/table/src/table.ts +7 -6
  44. package/packages/table/src/util.ts +10 -0
  45. package/packages/ui/index.ts +1 -0
  46. /package/es/{iconfont.1753497303145.ttf → iconfont.1753928711953.ttf} +0 -0
  47. /package/es/{iconfont.1753497303145.woff → iconfont.1753928711953.woff} +0 -0
  48. /package/es/{iconfont.1753497303145.woff2 → iconfont.1753928711953.woff2} +0 -0
  49. /package/lib/{iconfont.1753497303145.ttf → iconfont.1753928711953.ttf} +0 -0
  50. /package/lib/{iconfont.1753497303145.woff → iconfont.1753928711953.woff} +0 -0
  51. /package/lib/{iconfont.1753497303145.woff2 → iconfont.1753928711953.woff2} +0 -0
@@ -149,44 +149,122 @@ function handleVirtualXVisible($xeTable) {
149
149
  };
150
150
  }
151
151
  function handleCustomRestore($xeTable, storeData) {
152
+ const props = $xeTable;
152
153
  const reactData = $xeTable;
153
154
  const internalData = $xeTable;
154
- let {
155
+ const {
156
+ aggregateConfig,
157
+ rowGroupConfig
158
+ } = props;
159
+ const {
155
160
  collectColumn
156
161
  } = internalData;
162
+ const customOpts = $xeTable.computeCustomOpts;
157
163
  const {
164
+ storage,
165
+ storeOptions
166
+ } = customOpts;
167
+ const isAllCustom = storage === true;
168
+ const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
169
+ const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
170
+ const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
171
+ const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
172
+ const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
173
+ const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
174
+ const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
175
+ let {
158
176
  resizableData,
159
177
  sortData,
160
178
  visibleData,
161
- fixedData
179
+ fixedData,
180
+ aggGroupData,
181
+ aggFuncData
162
182
  } = storeData;
163
- let hasCustomSort = false;
164
183
  // 处理还原
165
- if (resizableData || sortData || visibleData || fixedData) {
184
+ if (isCustomResizable && resizableData || isCustomSort && sortData || isCustomVisible && visibleData || isCustomFixed && fixedData || isCustomAggGroup && aggGroupData || isCustomAggFunc && aggFuncData) {
185
+ const sortColMaps = {};
186
+ if (isCustomSort && sortData) {
187
+ // 转换兼容老版本数据,即将废弃兼容
188
+ if (!_xeUtils.default.isArray(sortData)) {
189
+ const sortRests = [];
190
+ _xeUtils.default.each(sortData, (index, colKey) => {
191
+ sortRests.push({
192
+ key: colKey,
193
+ index
194
+ });
195
+ });
196
+ sortData = _xeUtils.default.orderBy(sortRests, {
197
+ field: 'index',
198
+ order: 'asc'
199
+ }).map(item => ({
200
+ k: item.key
201
+ }));
202
+ }
203
+ let colNum = 1;
204
+ _xeUtils.default.eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
205
+ sortColMaps[sObj.k] = {
206
+ key: sObj.k,
207
+ sNum: colNum++,
208
+ pKey: pSObj ? pSObj.k : null
209
+ };
210
+ }, {
211
+ children: 'c'
212
+ });
213
+ }
214
+ const colKeyMaps = {};
215
+ const allCols = [];
216
+ const aggGroupConfs = [];
166
217
  _xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
167
218
  const colKey = column.getKey();
168
219
  // 支持一级
169
220
  if (!parentColumn) {
170
- if (fixedData && fixedData[colKey] !== undefined) {
221
+ if (isCustomFixed && fixedData && fixedData[colKey] !== undefined) {
171
222
  column.fixed = fixedData[colKey];
172
223
  }
173
- if (sortData && _xeUtils.default.isNumber(sortData[colKey])) {
174
- hasCustomSort = true;
175
- column.renderSortNumber = sortData[colKey];
176
- }
177
224
  }
178
- if (resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
225
+ if (isCustomResizable && resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
179
226
  column.resizeWidth = resizableData[colKey];
180
227
  }
181
- if (visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
228
+ if (isCustomVisible && visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
182
229
  column.visible = visibleData[colKey];
183
230
  }
231
+ if (isCustomAggFunc && aggFuncData && (aggregateConfig || rowGroupConfig) && aggFuncData[colKey]) {
232
+ column.aggFunc = aggFuncData[colKey];
233
+ }
234
+ if (isCustomAggGroup && aggGroupData && aggGroupData[colKey]) {
235
+ aggGroupConfs.push({
236
+ field: column.field
237
+ });
238
+ }
239
+ colKeyMaps[colKey] = column;
240
+ allCols.push(column);
184
241
  });
242
+ if ((aggregateConfig || rowGroupConfig) && aggGroupConfs.length) {
243
+ const groupRest = handleGroupData($xeTable, internalData.tableFullData, aggGroupConfs);
244
+ internalData.tableFullTreeData = [];
245
+ internalData.tableFullGroupData = groupRest.treeData;
246
+ reactData.isRowGroupStatus = true;
247
+ reactData.rowGroupList = aggGroupConfs;
248
+ $xeTable.cacheRowMap(false);
249
+ }
185
250
  // 如果自定义了顺序
186
- if (hasCustomSort) {
187
- collectColumn = _xeUtils.default.orderBy(collectColumn, 'renderSortNumber');
188
- internalData.collectColumn = collectColumn;
189
- internalData.tableFullColumn = getColumnList(collectColumn);
251
+ if (isCustomSort && sortData) {
252
+ allCols.forEach(column => {
253
+ const colKey = column.getKey();
254
+ const scItem = sortColMaps[colKey];
255
+ if (scItem) {
256
+ const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
257
+ column.parentId = parentColumn ? parentColumn.id : null;
258
+ column.renderSortNumber = scItem.sNum;
259
+ }
260
+ });
261
+ const newCollectCols = _xeUtils.default.toArrayTree(_xeUtils.default.orderBy(allCols, 'renderSortNumber'), {
262
+ key: 'id',
263
+ parentKey: 'parentId',
264
+ children: 'children'
265
+ });
266
+ internalData.collectColumn = newCollectCols;
267
+ internalData.tableFullColumn = (0, _util.getColumnList)(newCollectCols);
190
268
  }
191
269
  reactData.isCustomStatus = true;
192
270
  } else {
@@ -661,6 +739,7 @@ function updateAfterListIndex($xeTable) {
661
739
  $index: -1,
662
740
  _index: index,
663
741
  treeIndex: -1,
742
+ _tIndex: -1,
664
743
  items: [],
665
744
  parent: null,
666
745
  level: 0,
@@ -699,6 +778,7 @@ function updateAfterDataIndex($xeTable) {
699
778
  const childrenField = treeOpts.children || treeOpts.childrenField;
700
779
  const fullMaps = {};
701
780
  if (treeConfig) {
781
+ let _treeIndex = 0;
702
782
  const {
703
783
  handleGetRowId
704
784
  } = (0, _util.createHandleGetRowId)($xeTable);
@@ -709,6 +789,7 @@ function updateAfterDataIndex($xeTable) {
709
789
  if (rowRest) {
710
790
  rowRest.seq = seq;
711
791
  rowRest.treeIndex = index;
792
+ rowRest._tIndex = _treeIndex;
712
793
  } else {
713
794
  const rest = {
714
795
  row,
@@ -718,6 +799,7 @@ function updateAfterDataIndex($xeTable) {
718
799
  $index: -1,
719
800
  _index: -1,
720
801
  treeIndex: -1,
802
+ _tIndex: _treeIndex,
721
803
  items: [],
722
804
  parent: null,
723
805
  level: 0,
@@ -729,6 +811,7 @@ function updateAfterDataIndex($xeTable) {
729
811
  fullAllDataRowIdData[rowid] = rest;
730
812
  fullDataRowIdData[rowid] = rest;
731
813
  }
814
+ _treeIndex++;
732
815
  fullMaps[rowid] = row;
733
816
  }, {
734
817
  children: transform ? treeOpts.mapChildrenField : childrenField
@@ -2432,6 +2515,10 @@ function removeFooterMerges($xeTable, merges) {
2432
2515
  return rest;
2433
2516
  }
2434
2517
  function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
2518
+ const internalData = $xeTable;
2519
+ const {
2520
+ tableFullColumn
2521
+ } = internalData;
2435
2522
  const sortOpts = $xeTable.computeSortOpts;
2436
2523
  const {
2437
2524
  multiple,
@@ -2442,10 +2529,16 @@ function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
2442
2529
  sortConfs = [sortConfs];
2443
2530
  }
2444
2531
  if (sortConfs && sortConfs.length) {
2532
+ const orderActiveMaps = {};
2445
2533
  if (!multiple) {
2446
2534
  sortConfs = [sortConfs[0]];
2447
- clearAllSort($xeTable);
2535
+ tableFullColumn.forEach(column => {
2536
+ if (column.order) {
2537
+ orderActiveMaps[column.id] = column;
2538
+ }
2539
+ });
2448
2540
  }
2541
+ const sortColMpps = {};
2449
2542
  let firstColumn = null;
2450
2543
  sortConfs.forEach((confs, index) => {
2451
2544
  let {
@@ -2467,8 +2560,16 @@ function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
2467
2560
  column.order = order;
2468
2561
  }
2469
2562
  column.sortTime = Date.now() + index;
2563
+ sortColMpps[column.id] = column;
2470
2564
  }
2471
2565
  });
2566
+ if (!multiple) {
2567
+ _xeUtils.default.each(orderActiveMaps, (oaCol, oaId) => {
2568
+ if (!sortColMpps[oaId]) {
2569
+ oaCol.order = null;
2570
+ }
2571
+ });
2572
+ }
2472
2573
  if (isUpdate) {
2473
2574
  if (!remote) {
2474
2575
  $xeTable.handleTableData(true);
@@ -2673,7 +2774,7 @@ const calcCellHeight = $xeTable => {
2673
2774
  } = internalData;
2674
2775
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
2675
2776
  const el = $xeTable.$refs.refElem;
2676
- if (!isAllOverflow && scrollYLoad && el) {
2777
+ if (!isAllOverflow && (scrollYLoad || scrollXLoad) && el) {
2677
2778
  const {
2678
2779
  handleGetRowId
2679
2780
  } = (0, _util.createHandleGetRowId)($xeTable);
@@ -3212,18 +3313,18 @@ function handleUpdateAggValues($xeTable) {
3212
3313
  }
3213
3314
  function handleUpdateRowGroup($xeTable, groupFields) {
3214
3315
  const reactData = $xeTable;
3215
- const aggFields = [];
3216
- const aggConfs = [];
3316
+ const aggGroupFields = [];
3317
+ const aggGroupConfs = [];
3217
3318
  if (groupFields) {
3218
3319
  (_xeUtils.default.isArray(groupFields) ? groupFields : [groupFields]).forEach(field => {
3219
- aggFields.push(field);
3220
- aggConfs.push({
3320
+ aggGroupFields.push(field);
3321
+ aggGroupConfs.push({
3221
3322
  field
3222
3323
  });
3223
3324
  });
3224
3325
  }
3225
- reactData.rowGroupList = aggConfs;
3226
- reactData.aggHandleFields = aggFields;
3326
+ reactData.rowGroupList = aggGroupConfs;
3327
+ reactData.aggHandleFields = aggGroupFields;
3227
3328
  handleUpdateAggValues($xeTable);
3228
3329
  }
3229
3330
  function handleeGroupSummary($xeTable, aggList) {
@@ -3604,7 +3705,7 @@ function handleUpdateColumn($xeTable) {
3604
3705
  const internalData = $xeTable;
3605
3706
  const columnList = _xeUtils.default.orderBy(internalData.collectColumn, 'renderSortNumber');
3606
3707
  internalData.collectColumn = columnList;
3607
- const tableFullColumn = getColumnList(columnList);
3708
+ const tableFullColumn = (0, _util.getColumnList)(columnList);
3608
3709
  internalData.tableFullColumn = tableFullColumn;
3609
3710
  cacheColumnMap($xeTable);
3610
3711
  }
@@ -3649,14 +3750,6 @@ function loadScrollXData($xeTable) {
3649
3750
  }
3650
3751
  $xeTable.closeTooltip();
3651
3752
  }
3652
- // 获取所有的列,排除分组
3653
- function getColumnList(columns) {
3654
- const result = [];
3655
- columns.forEach(column => {
3656
- result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
3657
- });
3658
- return result;
3659
- }
3660
3753
  function parseColumns($xeTable, isReset) {
3661
3754
  const props = $xeTable;
3662
3755
  const reactData = $xeTable;
@@ -3687,7 +3780,7 @@ function parseColumns($xeTable, isReset) {
3687
3780
  if (parentColumn && parentColumn.fixed) {
3688
3781
  column.fixed = parentColumn.fixed;
3689
3782
  }
3690
- if (parentColumn && column.fixed !== parentColumn.fixed) {
3783
+ if (parentColumn && (column.fixed || '') !== (parentColumn.fixed || '')) {
3691
3784
  (0, _log.errLog)('vxe.error.groupFixed');
3692
3785
  }
3693
3786
  if (isColGroup) {
@@ -3795,27 +3888,31 @@ function parseColumns($xeTable, isReset) {
3795
3888
  }
3796
3889
  return $xeTable.updateFooter();
3797
3890
  }
3798
- function initColumnSort($xeTable) {
3891
+ function initColumnHierarchy($xeTable) {
3799
3892
  const internalData = $xeTable;
3800
3893
  const {
3801
3894
  collectColumn
3802
3895
  } = internalData;
3803
- collectColumn.forEach((column, index) => {
3804
- const sortIndex = index + 1;
3896
+ let sortIndex = 1;
3897
+ _xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
3898
+ const parentId = parentColumn ? parentColumn.id : null;
3899
+ column.parentId = parentId;
3900
+ column.defaultParentId = parentId;
3805
3901
  column.sortNumber = sortIndex;
3806
3902
  column.renderSortNumber = sortIndex;
3903
+ sortIndex++;
3807
3904
  });
3808
3905
  }
3809
- function handleColumn($xeTable, collectColumn) {
3906
+ function handleInitColumn($xeTable, collectColumn) {
3810
3907
  const $xeToolbar = $xeTable.$refs.$xeToolbar;
3811
3908
  const reactData = $xeTable;
3812
3909
  const internalData = $xeTable;
3813
3910
  const expandOpts = $xeTable.computeExpandOpts;
3814
3911
  internalData.collectColumn = collectColumn;
3815
- const tableFullColumn = getColumnList(collectColumn);
3912
+ const tableFullColumn = (0, _util.getColumnList)(collectColumn);
3816
3913
  internalData.tableFullColumn = tableFullColumn;
3817
3914
  reactData.isColLoading = true;
3818
- initColumnSort($xeTable);
3915
+ initColumnHierarchy($xeTable);
3819
3916
  return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
3820
3917
  const {
3821
3918
  scrollXLoad,
@@ -4542,7 +4639,7 @@ const Methods = {
4542
4639
  const collectColumn = _xeUtils.default.mapTree(columns, column => _cell.default.createColumn($xeTable, column), {
4543
4640
  children: 'children'
4544
4641
  });
4545
- return handleColumn($xeTable, collectColumn).then(() => {
4642
+ return handleInitColumn($xeTable, collectColumn).then(() => {
4546
4643
  let targetScrollLeft = lastScrollLeft;
4547
4644
  let targetScrollTop = lastScrollTop;
4548
4645
  const virtualXOpts = $xeTable.computeVirtualXOpts;
@@ -4567,9 +4664,9 @@ const Methods = {
4567
4664
  return this.loadColumn(columns);
4568
4665
  });
4569
4666
  },
4570
- handleColumn(collectColumn) {
4667
+ handleInitColumn(collectColumn) {
4571
4668
  const $xeTable = this;
4572
- return handleColumn($xeTable, collectColumn);
4669
+ return handleInitColumn($xeTable, collectColumn);
4573
4670
  },
4574
4671
  /**
4575
4672
  * 更新数据行的 Map
@@ -4608,6 +4705,7 @@ const Methods = {
4608
4705
  _index: -1,
4609
4706
  $index: -1,
4610
4707
  treeIndex: index,
4708
+ _tIndex: -1,
4611
4709
  items,
4612
4710
  parent: parentRow,
4613
4711
  level,
@@ -4751,6 +4849,7 @@ const Methods = {
4751
4849
  _index: -1,
4752
4850
  $index: -1,
4753
4851
  treeIndex: -1,
4852
+ _tIndex: -1,
4754
4853
  items,
4755
4854
  parent: parentRow,
4756
4855
  level: parentLevel + nodes.length,
@@ -5876,8 +5975,9 @@ const Methods = {
5876
5975
  const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
5877
5976
  const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
5878
5977
  const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
5978
+ const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
5879
5979
  const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
5880
- if (storage && (customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
5980
+ if (storage && (customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomAggGroup || isCustomSort)) {
5881
5981
  if (!tableId) {
5882
5982
  (0, _log.errLog)('vxe.error.reqProp', ['id']);
5883
5983
  return;
@@ -5903,12 +6003,18 @@ const Methods = {
5903
6003
  getCustomStoreData() {
5904
6004
  const $xeTable = this;
5905
6005
  const props = $xeTable;
6006
+ const reactData = $xeTable;
5906
6007
  const internalData = $xeTable;
5907
6008
  const {
5908
6009
  id
5909
6010
  } = props;
5910
6011
  const customOpts = $xeTable.computeCustomOpts;
5911
6012
  const {
6013
+ isRowGroupStatus,
6014
+ rowGroupList
6015
+ } = reactData;
6016
+ const {
6017
+ fullColumnFieldData,
5912
6018
  collectColumn
5913
6019
  } = internalData;
5914
6020
  const {
@@ -5922,17 +6028,20 @@ const Methods = {
5922
6028
  const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
5923
6029
  const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
5924
6030
  const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
6031
+ const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
5925
6032
  const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
5926
6033
  const resizableData = {};
5927
- const sortData = {};
6034
+ const sortData = [];
5928
6035
  const visibleData = {};
5929
6036
  const fixedData = {};
6037
+ const aggGroupData = {};
5930
6038
  const aggFuncData = {};
5931
6039
  const storeData = {
5932
6040
  resizableData: undefined,
5933
6041
  sortData: undefined,
5934
6042
  visibleData: undefined,
5935
6043
  fixedData: undefined,
6044
+ aggGroupData: undefined,
5936
6045
  aggFuncData: undefined
5937
6046
  };
5938
6047
  if (!id) {
@@ -5946,19 +6055,40 @@ const Methods = {
5946
6055
  let hasFixed = 0;
5947
6056
  let hasVisible = 0;
5948
6057
  let hasAggFunc = 0;
6058
+ const sortMaps = {};
5949
6059
  _xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
5950
6060
  const colKey = column.getKey();
5951
6061
  if (!colKey) {
5952
6062
  (0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
5953
6063
  return;
5954
6064
  }
5955
- // 只支持一级
5956
- if (!parentColumn) {
6065
+ if (parentColumn) {
6066
+ if (isCustomSort) {
6067
+ const pColKey = parentColumn.getKey();
6068
+ const psObj = sortMaps[pColKey];
6069
+ hasSort = 1;
6070
+ if (psObj) {
6071
+ const sObj = {
6072
+ k: colKey
6073
+ };
6074
+ sortMaps[colKey] = sObj;
6075
+ if (!psObj.c) {
6076
+ psObj.c = [];
6077
+ }
6078
+ psObj.c.push(sObj);
6079
+ }
6080
+ }
6081
+ } else {
5957
6082
  if (isCustomSort) {
5958
6083
  hasSort = 1;
5959
- sortData[colKey] = column.renderSortNumber;
6084
+ const sObj = {
6085
+ k: colKey
6086
+ };
6087
+ sortMaps[colKey] = sObj;
6088
+ sortData.push(sObj);
5960
6089
  }
5961
- if (isCustomFixed && column.fixed !== column.defaultFixed) {
6090
+ // 只支持一级
6091
+ if (isCustomFixed && (column.fixed || '') !== (column.defaultFixed || '')) {
5962
6092
  hasFixed = 1;
5963
6093
  fixedData[colKey] = column.fixed;
5964
6094
  }
@@ -5979,7 +6109,7 @@ const Methods = {
5979
6109
  visibleData[colKey] = true;
5980
6110
  }
5981
6111
  }
5982
- if (isCustomAggFunc && column.aggFunc !== column.defaultAggFunc) {
6112
+ if (isCustomAggFunc && (column.aggFunc || '') !== (column.defaultAggFunc || '')) {
5983
6113
  hasAggFunc = 1;
5984
6114
  aggFuncData[colKey] = column.aggFunc;
5985
6115
  }
@@ -5996,6 +6126,15 @@ const Methods = {
5996
6126
  if (hasVisible) {
5997
6127
  storeData.visibleData = visibleData;
5998
6128
  }
6129
+ if (isCustomAggGroup && isRowGroupStatus) {
6130
+ rowGroupList.forEach(aggConf => {
6131
+ const colRest = fullColumnFieldData[aggConf.field];
6132
+ if (colRest) {
6133
+ aggGroupData[colRest.column.getKey()] = true;
6134
+ }
6135
+ });
6136
+ storeData.aggGroupData = aggGroupData;
6137
+ }
5999
6138
  if (hasAggFunc) {
6000
6139
  storeData.aggFuncData = aggFuncData;
6001
6140
  }
@@ -6021,11 +6160,12 @@ const Methods = {
6021
6160
  const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
6022
6161
  const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
6023
6162
  const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
6163
+ const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
6024
6164
  const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
6025
6165
  if (type !== 'reset') {
6026
6166
  reactData.isCustomStatus = true;
6027
6167
  }
6028
- if (storage && (customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
6168
+ if (storage && (customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggGroup || isCustomAggFunc)) {
6029
6169
  if (!tableId) {
6030
6170
  (0, _log.errLog)('vxe.error.reqProp', ['id']);
6031
6171
  return this.$nextTick();
@@ -6034,7 +6174,9 @@ const Methods = {
6034
6174
  resizableData: {},
6035
6175
  sortData: {},
6036
6176
  visibleData: {},
6037
- fixedData: {}
6177
+ fixedData: {},
6178
+ aggGroupData: {},
6179
+ aggFuncData: {}
6038
6180
  } : this.getCustomStoreData();
6039
6181
  if (updateStore) {
6040
6182
  return updateStore({
@@ -10181,9 +10323,9 @@ const Methods = {
10181
10323
  const $xeTable = this;
10182
10324
  return handleSortEvent($xeTable, null, sortConfs, isUpdate);
10183
10325
  },
10184
- setSortByEvent(evnt, sortConfs, isUpdate) {
10326
+ setSortByEvent(evnt, sortConfs) {
10185
10327
  const $xeTable = this;
10186
- return handleSortEvent($xeTable, evnt, sortConfs, isUpdate);
10328
+ return handleSortEvent($xeTable, evnt, sortConfs, true);
10187
10329
  },
10188
10330
  /**
10189
10331
  * 清空指定列的排序条件
@@ -10216,6 +10358,9 @@ const Methods = {
10216
10358
  tableFullColumn
10217
10359
  } = internalData;
10218
10360
  const sortOpts = $xeTable.computeSortOpts;
10361
+ const {
10362
+ multiple
10363
+ } = sortOpts;
10219
10364
  const sortCols = [];
10220
10365
  let column = null;
10221
10366
  if (evnt) {
@@ -10235,7 +10380,13 @@ const Methods = {
10235
10380
  if (!sortOpts.remote) {
10236
10381
  $xeTable.handleTableData(true);
10237
10382
  }
10238
- if (sortCols.length) {
10383
+ if (!multiple) {
10384
+ column = sortCols[0];
10385
+ }
10386
+ if (column) {
10387
+ $xeTable.handleColumnSortEvent(evnt, column);
10388
+ }
10389
+ if (multiple && sortCols.length) {
10239
10390
  const params = {
10240
10391
  $table: $xeTable,
10241
10392
  $event: evnt,
@@ -10243,8 +10394,6 @@ const Methods = {
10243
10394
  sortList: []
10244
10395
  };
10245
10396
  $xeTable.dispatchEvent('clear-all-sort', params, evnt);
10246
- } else if (column) {
10247
- $xeTable.handleColumnSortEvent(evnt, column);
10248
10397
  }
10249
10398
  }
10250
10399
  return $xeTable.$nextTick().then(() => {
@@ -10290,22 +10439,12 @@ const Methods = {
10290
10439
  }
10291
10440
  return sortList;
10292
10441
  },
10293
- setFilterByEvent(evnt, fieldOrColumn, options, isUpdate) {
10442
+ setFilterByEvent(evnt, fieldOrColumn, options) {
10294
10443
  const $xeTable = this;
10295
- const reactData = $xeTable;
10296
- const {
10297
- filterStore
10298
- } = reactData;
10299
10444
  const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
10300
10445
  if (column && column.filters) {
10301
10446
  column.filters = (0, _util.toFilters)(options || []);
10302
- if (isUpdate) {
10303
- return $xeTable.handleColumnConfirmFilter(column, evnt);
10304
- } else {
10305
- if (filterStore.visible) {
10306
- $xeTable.handleFilterOptions(column);
10307
- }
10308
- }
10447
+ return $xeTable.handleColumnConfirmFilter(column, evnt);
10309
10448
  }
10310
10449
  return $xeTable.$nextTick();
10311
10450
  },
@@ -10364,6 +10503,9 @@ const Methods = {
10364
10503
  tableFullColumn
10365
10504
  } = internalData;
10366
10505
  const filterOpts = $xeTable.computeFilterOpts;
10506
+ const {
10507
+ multiple
10508
+ } = filterOpts;
10367
10509
  const filterCols = [];
10368
10510
  let column = null;
10369
10511
  if (fieldOrColumn) {
@@ -10393,7 +10535,34 @@ const Methods = {
10393
10535
  if (!filterOpts.remote) {
10394
10536
  $xeTable.updateData();
10395
10537
  }
10396
- if (filterCols.length) {
10538
+ if (!multiple) {
10539
+ column = filterCols[0];
10540
+ }
10541
+ if (column) {
10542
+ const filterList = () => $xeTable.getCheckedFilters();
10543
+ const values = [];
10544
+ const datas = [];
10545
+ column.filters.forEach(item => {
10546
+ if (item.checked) {
10547
+ values.push(item.value);
10548
+ datas.push(item.data);
10549
+ }
10550
+ });
10551
+ const params = {
10552
+ $table: $xeTable,
10553
+ $event: evnt,
10554
+ column,
10555
+ field: column.field,
10556
+ property: column.field,
10557
+ values,
10558
+ datas,
10559
+ filters: filterList,
10560
+ filterList
10561
+ };
10562
+ $xeTable.dispatchEvent('filter-change', params, evnt);
10563
+ $xeTable.dispatchEvent('clear-filter', params, evnt);
10564
+ }
10565
+ if (multiple && filterCols.length) {
10397
10566
  const params = {
10398
10567
  $table: $xeTable,
10399
10568
  $event: evnt,
@@ -10401,10 +10570,6 @@ const Methods = {
10401
10570
  filterList: []
10402
10571
  };
10403
10572
  $xeTable.dispatchEvent('clear-all-filter', params, evnt);
10404
- } else if (column) {
10405
- $xeTable.dispatchEvent('clear-filter', {
10406
- filterList: () => $xeTable.getCheckedFilters()
10407
- }, evnt);
10408
10573
  }
10409
10574
  return $xeTable.$nextTick();
10410
10575
  },