vxe-table 3.17.0-beta.13 → 3.17.0-beta.15

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 (37) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/custom/mixin.js +11 -2
  3. package/es/table/src/columnInfo.js +4 -0
  4. package/es/table/src/methods.js +73 -32
  5. package/es/table/src/table.js +1 -1
  6. package/es/table/src/util.js +9 -0
  7. package/es/ui/index.js +1 -1
  8. package/es/ui/src/log.js +1 -1
  9. package/lib/index.umd.js +121 -36
  10. package/lib/index.umd.min.js +1 -1
  11. package/lib/style.css +1 -1
  12. package/lib/table/module/custom/mixin.js +15 -2
  13. package/lib/table/module/custom/mixin.min.js +1 -1
  14. package/lib/table/src/columnInfo.js +4 -0
  15. package/lib/table/src/columnInfo.min.js +1 -1
  16. package/lib/table/src/methods.js +91 -33
  17. package/lib/table/src/methods.min.js +1 -1
  18. package/lib/table/src/table.js +1 -1
  19. package/lib/table/src/table.min.js +1 -1
  20. package/lib/table/src/util.js +10 -0
  21. package/lib/table/src/util.min.js +1 -1
  22. package/lib/ui/index.js +1 -1
  23. package/lib/ui/index.min.js +1 -1
  24. package/lib/ui/src/log.js +1 -1
  25. package/lib/ui/src/log.min.js +1 -1
  26. package/package.json +1 -1
  27. package/packages/table/module/custom/mixin.ts +11 -2
  28. package/packages/table/src/columnInfo.ts +5 -0
  29. package/packages/table/src/methods.ts +76 -33
  30. package/packages/table/src/table.ts +1 -1
  31. package/packages/table/src/util.ts +10 -0
  32. /package/es/{iconfont.1753775808744.ttf → iconfont.1753843895290.ttf} +0 -0
  33. /package/es/{iconfont.1753775808744.woff → iconfont.1753843895290.woff} +0 -0
  34. /package/es/{iconfont.1753775808744.woff2 → iconfont.1753843895290.woff2} +0 -0
  35. /package/lib/{iconfont.1753775808744.ttf → iconfont.1753843895290.ttf} +0 -0
  36. /package/lib/{iconfont.1753775808744.woff → iconfont.1753843895290.woff} +0 -0
  37. /package/lib/{iconfont.1753775808744.woff2 → iconfont.1753843895290.woff2} +0 -0
@@ -1,4 +1,5 @@
1
1
  import XEUtils from 'xe-utils';
2
+ import { getColumnList } from '../../src/util';
2
3
  function calcMaxHeight($xeTable) {
3
4
  const reactData = $xeTable;
4
5
  const { customStore } = reactData;
@@ -87,7 +88,7 @@ export default {
87
88
  });
88
89
  reactData.isCustomStatus = true;
89
90
  return $xeTable.saveCustomStore('confirm').then(() => {
90
- if (allowGroup && allowValues && $xeTable.handlePivotTableAggregateData) {
91
+ if (allowGroup && allowValues && !!$xeTable.handlePivotTableAggregateData) {
91
92
  if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
92
93
  // 更新数据分组
93
94
  if (aggHandleFields.length) {
@@ -97,7 +98,7 @@ export default {
97
98
  $xeTable.clearRowGroups();
98
99
  }
99
100
  }
100
- else {
101
+ else if (allowValues) {
101
102
  // 更新聚合函数
102
103
  $xeTable.handleUpdateAggData();
103
104
  }
@@ -147,6 +148,7 @@ export default {
147
148
  sort: options === true,
148
149
  aggFunc: options === true
149
150
  }, options);
151
+ const allCols = [];
150
152
  XEUtils.eachTree(collectColumn, (column) => {
151
153
  if (opts.resizable) {
152
154
  column.resizeWidth = 0;
@@ -156,6 +158,7 @@ export default {
156
158
  }
157
159
  if (opts.sort) {
158
160
  column.renderSortNumber = column.sortNumber;
161
+ column.parentId = column.defaultParentId;
159
162
  }
160
163
  if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
161
164
  column.visible = column.defaultVisible;
@@ -165,7 +168,13 @@ export default {
165
168
  column.renderAggFn = column.defaultAggFunc;
166
169
  }
167
170
  column.renderResizeWidth = column.renderWidth;
171
+ allCols.push(column);
168
172
  });
173
+ if (opts.sort) {
174
+ const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
175
+ internalData.collectColumn = newCollectCols;
176
+ internalData.tableFullColumn = getColumnList(newCollectCols);
177
+ }
169
178
  reactData.isCustomStatus = false;
170
179
  $xeTable.saveCustomStore('reset');
171
180
  return $xeTable.handleCustom().then(() => {
@@ -119,6 +119,7 @@ export class ColumnInfo {
119
119
  parentId: null,
120
120
  visible,
121
121
  // 内部属性(一旦被使用,将导致不可升级版本)
122
+ defaultParentId: null,
122
123
  halfVisible: false,
123
124
  defaultVisible: visible,
124
125
  defaultFixed: _vm.fixed,
@@ -126,8 +127,11 @@ export class ColumnInfo {
126
127
  checked: false,
127
128
  halfChecked: false,
128
129
  disabled: false,
130
+ // 分组层级
129
131
  level: 1,
132
+ // 跨行
130
133
  rowSpan: 1,
134
+ // 跨列
131
135
  colSpan: 1,
132
136
  // 数据排序
133
137
  order: null,
@@ -3,7 +3,7 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTarge
3
3
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
4
4
  import { VxeUI } from '../../ui';
5
5
  import Cell from './cell';
6
- import { getRowUniqueId, clearTableAllStatus, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight } from './util';
6
+ import { getRowUniqueId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight } from './util';
7
7
  import { getSlotVNs } from '../../ui/src/vn';
8
8
  import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from './anime';
9
9
  import { warnLog, errLog } from '../../ui/src/log';
@@ -117,11 +117,31 @@ function handleVirtualXVisible($xeTable) {
117
117
  function handleCustomRestore($xeTable, storeData) {
118
118
  const reactData = $xeTable;
119
119
  const internalData = $xeTable;
120
- let { collectColumn } = internalData;
121
- const { resizableData, sortData, visibleData, fixedData } = storeData;
122
- let hasCustomSort = false;
120
+ const { collectColumn } = internalData;
121
+ let { resizableData, sortData, visibleData, fixedData } = storeData;
123
122
  // 处理还原
124
123
  if (resizableData || sortData || visibleData || fixedData) {
124
+ const sortColMaps = {};
125
+ // 转换兼容老版本数据
126
+ if (sortData) {
127
+ if (!XEUtils.isArray(sortData)) {
128
+ const sortRests = [];
129
+ XEUtils.each(sortData, (index, colKey) => {
130
+ sortRests.push({ key: colKey, index });
131
+ });
132
+ sortData = XEUtils.orderBy(sortRests, { field: 'index', order: 'asc' }).map(item => ({ k: item.key }));
133
+ }
134
+ let colNum = 1;
135
+ XEUtils.eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
136
+ sortColMaps[sObj.k] = {
137
+ key: sObj.k,
138
+ sNum: colNum++,
139
+ pKey: pSObj ? pSObj.k : null
140
+ };
141
+ }, { children: 'c' });
142
+ }
143
+ const colKeyMaps = {};
144
+ const allCols = [];
125
145
  XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
126
146
  const colKey = column.getKey();
127
147
  // 支持一级
@@ -129,10 +149,6 @@ function handleCustomRestore($xeTable, storeData) {
129
149
  if (fixedData && fixedData[colKey] !== undefined) {
130
150
  column.fixed = fixedData[colKey];
131
151
  }
132
- if (sortData && XEUtils.isNumber(sortData[colKey])) {
133
- hasCustomSort = true;
134
- column.renderSortNumber = sortData[colKey];
135
- }
136
152
  }
137
153
  if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
138
154
  column.resizeWidth = resizableData[colKey];
@@ -140,12 +156,23 @@ function handleCustomRestore($xeTable, storeData) {
140
156
  if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
141
157
  column.visible = visibleData[colKey];
142
158
  }
159
+ colKeyMaps[colKey] = column;
160
+ allCols.push(column);
143
161
  });
144
162
  // 如果自定义了顺序
145
- if (hasCustomSort) {
146
- collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
147
- internalData.collectColumn = collectColumn;
148
- internalData.tableFullColumn = getColumnList(collectColumn);
163
+ if (sortData) {
164
+ allCols.forEach(column => {
165
+ const colKey = column.getKey();
166
+ const scItem = sortColMaps[colKey];
167
+ if (scItem) {
168
+ const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
169
+ column.parentId = parentColumn ? parentColumn.id : null;
170
+ column.renderSortNumber = scItem.sNum;
171
+ }
172
+ });
173
+ const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
174
+ internalData.collectColumn = newCollectCols;
175
+ internalData.tableFullColumn = getColumnList(newCollectCols);
149
176
  }
150
177
  reactData.isCustomStatus = true;
151
178
  }
@@ -3084,14 +3111,6 @@ function loadScrollXData($xeTable) {
3084
3111
  }
3085
3112
  $xeTable.closeTooltip();
3086
3113
  }
3087
- // 获取所有的列,排除分组
3088
- function getColumnList(columns) {
3089
- const result = [];
3090
- columns.forEach((column) => {
3091
- result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
3092
- });
3093
- return result;
3094
- }
3095
3114
  function parseColumns($xeTable, isReset) {
3096
3115
  const props = $xeTable;
3097
3116
  const reactData = $xeTable;
@@ -3224,16 +3243,20 @@ function parseColumns($xeTable, isReset) {
3224
3243
  }
3225
3244
  return $xeTable.updateFooter();
3226
3245
  }
3227
- function initColumnSort($xeTable) {
3246
+ function initColumnHierarchy($xeTable) {
3228
3247
  const internalData = $xeTable;
3229
3248
  const { collectColumn } = internalData;
3230
- collectColumn.forEach((column, index) => {
3231
- const sortIndex = index + 1;
3249
+ let sortIndex = 1;
3250
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
3251
+ const parentId = parentColumn ? parentColumn.id : null;
3252
+ column.parentId = parentId;
3253
+ column.defaultParentId = parentId;
3232
3254
  column.sortNumber = sortIndex;
3233
3255
  column.renderSortNumber = sortIndex;
3256
+ sortIndex++;
3234
3257
  });
3235
3258
  }
3236
- function handleColumn($xeTable, collectColumn) {
3259
+ function handleInitColumn($xeTable, collectColumn) {
3237
3260
  const $xeToolbar = $xeTable.$refs.$xeToolbar;
3238
3261
  const reactData = $xeTable;
3239
3262
  const internalData = $xeTable;
@@ -3242,7 +3265,7 @@ function handleColumn($xeTable, collectColumn) {
3242
3265
  const tableFullColumn = getColumnList(collectColumn);
3243
3266
  internalData.tableFullColumn = tableFullColumn;
3244
3267
  reactData.isColLoading = true;
3245
- initColumnSort($xeTable);
3268
+ initColumnHierarchy($xeTable);
3246
3269
  return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
3247
3270
  const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
3248
3271
  cacheColumnMap($xeTable);
@@ -3882,7 +3905,7 @@ const Methods = {
3882
3905
  const internalData = $xeTable;
3883
3906
  const { lastScrollLeft, lastScrollTop } = internalData;
3884
3907
  const collectColumn = XEUtils.mapTree(columns, column => Cell.createColumn($xeTable, column), { children: 'children' });
3885
- return handleColumn($xeTable, collectColumn).then(() => {
3908
+ return handleInitColumn($xeTable, collectColumn).then(() => {
3886
3909
  let targetScrollLeft = lastScrollLeft;
3887
3910
  let targetScrollTop = lastScrollTop;
3888
3911
  const virtualXOpts = $xeTable.computeVirtualXOpts;
@@ -3907,9 +3930,9 @@ const Methods = {
3907
3930
  return this.loadColumn(columns);
3908
3931
  });
3909
3932
  },
3910
- handleColumn(collectColumn) {
3933
+ handleInitColumn(collectColumn) {
3911
3934
  const $xeTable = this;
3912
- return handleColumn($xeTable, collectColumn);
3935
+ return handleInitColumn($xeTable, collectColumn);
3913
3936
  },
3914
3937
  /**
3915
3938
  * 更新数据行的 Map
@@ -5061,7 +5084,7 @@ const Methods = {
5061
5084
  const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
5062
5085
  const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
5063
5086
  const resizableData = {};
5064
- const sortData = {};
5087
+ const sortData = [];
5065
5088
  const visibleData = {};
5066
5089
  const fixedData = {};
5067
5090
  const aggFuncData = {};
@@ -5083,18 +5106,36 @@ const Methods = {
5083
5106
  let hasFixed = 0;
5084
5107
  let hasVisible = 0;
5085
5108
  let hasAggFunc = 0;
5109
+ const sortMaps = {};
5086
5110
  XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
5087
5111
  const colKey = column.getKey();
5088
5112
  if (!colKey) {
5089
5113
  errLog('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
5090
5114
  return;
5091
5115
  }
5092
- // 只支持一级
5093
- if (!parentColumn) {
5116
+ if (parentColumn) {
5117
+ if (isCustomSort) {
5118
+ const pColKey = parentColumn.getKey();
5119
+ const psObj = sortMaps[pColKey];
5120
+ hasSort = 1;
5121
+ if (psObj) {
5122
+ const sObj = { k: colKey };
5123
+ sortMaps[colKey] = sObj;
5124
+ if (!psObj.c) {
5125
+ psObj.c = [];
5126
+ }
5127
+ psObj.c.push(sObj);
5128
+ }
5129
+ }
5130
+ }
5131
+ else {
5094
5132
  if (isCustomSort) {
5095
5133
  hasSort = 1;
5096
- sortData[colKey] = column.renderSortNumber;
5134
+ const sObj = { k: colKey };
5135
+ sortMaps[colKey] = sObj;
5136
+ sortData.push(sObj);
5097
5137
  }
5138
+ // 只支持一级
5098
5139
  if (isCustomFixed && column.fixed !== column.defaultFixed) {
5099
5140
  hasFixed = 1;
5100
5141
  fixedData[colKey] = column.fixed;
@@ -1273,7 +1273,7 @@ export default {
1273
1273
  });
1274
1274
  },
1275
1275
  staticColumns(value) {
1276
- this.handleColumn(XEUtils.clone(value));
1276
+ this.handleInitColumn(XEUtils.clone(value));
1277
1277
  },
1278
1278
  tableColumn() {
1279
1279
  this.analyColumnWidth();
@@ -206,6 +206,7 @@ export function assembleColumn(_vm) {
206
206
  if (!groupConfig.children) {
207
207
  groupConfig.children = [];
208
208
  }
209
+ columnConfig.defaultParentId = groupConfig.id;
209
210
  groupConfig.children.splice(XEUtils.arrayIndexOf($xeColumn.$el.children, $el), 0, columnConfig);
210
211
  }
211
212
  else {
@@ -403,6 +404,14 @@ export function clearTableAllStatus(_vm) {
403
404
  export function isColumnInfo(column) {
404
405
  return column instanceof ColumnInfo;
405
406
  }
407
+ // 获取所有的列,排除分组
408
+ export function getColumnList(columns) {
409
+ const result = [];
410
+ columns.forEach((column) => {
411
+ result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
412
+ });
413
+ return result;
414
+ }
406
415
  export function createColumn($xeTable, options, renderOptions) {
407
416
  return isColumnInfo(options) ? options : new ColumnInfo($xeTable, options, renderOptions);
408
417
  }
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "3.17.0-beta.13";
3
+ export const version = "3.17.0-beta.15";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"3.17.0-beta.13"}`;
3
+ const version = `table v${"3.17.0-beta.15"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -2002,7 +2002,7 @@ function getClass(property, params) {
2002
2002
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2003
2003
 
2004
2004
 
2005
- const version = "3.17.0-beta.13";
2005
+ const version = "3.17.0-beta.15";
2006
2006
  core_.VxeUI.version = version;
2007
2007
  core_.VxeUI.tableVersion = version;
2008
2008
  core_.VxeUI.setConfig({
@@ -2668,7 +2668,7 @@ function isNodeElement(elem) {
2668
2668
  const {
2669
2669
  log: log_log
2670
2670
  } = core_.VxeUI;
2671
- const log_version = `table v${"3.17.0-beta.13"}`;
2671
+ const log_version = `table v${"3.17.0-beta.15"}`;
2672
2672
  const warnLog = log_log.create('warn', log_version);
2673
2673
  const errLog = log_log.create('error', log_version);
2674
2674
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -2805,6 +2805,7 @@ class ColumnInfo {
2805
2805
  parentId: null,
2806
2806
  visible,
2807
2807
  // 内部属性(一旦被使用,将导致不可升级版本)
2808
+ defaultParentId: null,
2808
2809
  halfVisible: false,
2809
2810
  defaultVisible: visible,
2810
2811
  defaultFixed: _vm.fixed,
@@ -2812,8 +2813,11 @@ class ColumnInfo {
2812
2813
  checked: false,
2813
2814
  halfChecked: false,
2814
2815
  disabled: false,
2816
+ // 分组层级
2815
2817
  level: 1,
2818
+ // 跨行
2816
2819
  rowSpan: 1,
2820
+ // 跨列
2817
2821
  colSpan: 1,
2818
2822
  // 数据排序
2819
2823
  order: null,
@@ -3089,6 +3093,7 @@ function assembleColumn(_vm) {
3089
3093
  if (!groupConfig.children) {
3090
3094
  groupConfig.children = [];
3091
3095
  }
3096
+ columnConfig.defaultParentId = groupConfig.id;
3092
3097
  groupConfig.children.splice(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayIndexOf($xeColumn.$el.children, $el), 0, columnConfig);
3093
3098
  } else {
3094
3099
  staticColumns.splice(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayIndexOf($xeTable.$refs.hideColumn.children, $el), 0, columnConfig);
@@ -3335,6 +3340,14 @@ function clearTableAllStatus(_vm) {
3335
3340
  function isColumnInfo(column) {
3336
3341
  return column instanceof ColumnInfo;
3337
3342
  }
3343
+ // 获取所有的列,排除分组
3344
+ function getColumnList(columns) {
3345
+ const result = [];
3346
+ columns.forEach(column => {
3347
+ result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
3348
+ });
3349
+ return result;
3350
+ }
3338
3351
  function createColumn($xeTable, options, renderOptions) {
3339
3352
  return isColumnInfo(options) ? options : new ColumnInfo($xeTable, options, renderOptions);
3340
3353
  }
@@ -5378,18 +5391,48 @@ function handleVirtualXVisible($xeTable) {
5378
5391
  function handleCustomRestore($xeTable, storeData) {
5379
5392
  const reactData = $xeTable;
5380
5393
  const internalData = $xeTable;
5381
- let {
5394
+ const {
5382
5395
  collectColumn
5383
5396
  } = internalData;
5384
- const {
5397
+ let {
5385
5398
  resizableData,
5386
5399
  sortData,
5387
5400
  visibleData,
5388
5401
  fixedData
5389
5402
  } = storeData;
5390
- let hasCustomSort = false;
5391
5403
  // 处理还原
5392
5404
  if (resizableData || sortData || visibleData || fixedData) {
5405
+ const sortColMaps = {};
5406
+ // 转换兼容老版本数据
5407
+ if (sortData) {
5408
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortData)) {
5409
+ const sortRests = [];
5410
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(sortData, (index, colKey) => {
5411
+ sortRests.push({
5412
+ key: colKey,
5413
+ index
5414
+ });
5415
+ });
5416
+ sortData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(sortRests, {
5417
+ field: 'index',
5418
+ order: 'asc'
5419
+ }).map(item => ({
5420
+ k: item.key
5421
+ }));
5422
+ }
5423
+ let colNum = 1;
5424
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
5425
+ sortColMaps[sObj.k] = {
5426
+ key: sObj.k,
5427
+ sNum: colNum++,
5428
+ pKey: pSObj ? pSObj.k : null
5429
+ };
5430
+ }, {
5431
+ children: 'c'
5432
+ });
5433
+ }
5434
+ const colKeyMaps = {};
5435
+ const allCols = [];
5393
5436
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
5394
5437
  const colKey = column.getKey();
5395
5438
  // 支持一级
@@ -5397,10 +5440,6 @@ function handleCustomRestore($xeTable, storeData) {
5397
5440
  if (fixedData && fixedData[colKey] !== undefined) {
5398
5441
  column.fixed = fixedData[colKey];
5399
5442
  }
5400
- if (sortData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(sortData[colKey])) {
5401
- hasCustomSort = true;
5402
- column.renderSortNumber = sortData[colKey];
5403
- }
5404
5443
  }
5405
5444
  if (resizableData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(resizableData[colKey])) {
5406
5445
  column.resizeWidth = resizableData[colKey];
@@ -5408,12 +5447,27 @@ function handleCustomRestore($xeTable, storeData) {
5408
5447
  if (visibleData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visibleData[colKey])) {
5409
5448
  column.visible = visibleData[colKey];
5410
5449
  }
5450
+ colKeyMaps[colKey] = column;
5451
+ allCols.push(column);
5411
5452
  });
5412
5453
  // 如果自定义了顺序
5413
- if (hasCustomSort) {
5414
- collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(collectColumn, 'renderSortNumber');
5415
- internalData.collectColumn = collectColumn;
5416
- internalData.tableFullColumn = getColumnList(collectColumn);
5454
+ if (sortData) {
5455
+ allCols.forEach(column => {
5456
+ const colKey = column.getKey();
5457
+ const scItem = sortColMaps[colKey];
5458
+ if (scItem) {
5459
+ const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
5460
+ column.parentId = parentColumn ? parentColumn.id : null;
5461
+ column.renderSortNumber = scItem.sNum;
5462
+ }
5463
+ });
5464
+ const newCollectCols = 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(allCols, 'renderSortNumber'), {
5465
+ key: 'id',
5466
+ parentKey: 'parentId',
5467
+ children: 'children'
5468
+ });
5469
+ internalData.collectColumn = newCollectCols;
5470
+ internalData.tableFullColumn = getColumnList(newCollectCols);
5417
5471
  }
5418
5472
  reactData.isCustomStatus = true;
5419
5473
  } else {
@@ -8899,14 +8953,6 @@ function loadScrollXData($xeTable) {
8899
8953
  }
8900
8954
  $xeTable.closeTooltip();
8901
8955
  }
8902
- // 获取所有的列,排除分组
8903
- function getColumnList(columns) {
8904
- const result = [];
8905
- columns.forEach(column => {
8906
- result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
8907
- });
8908
- return result;
8909
- }
8910
8956
  function parseColumns($xeTable, isReset) {
8911
8957
  const props = $xeTable;
8912
8958
  const reactData = $xeTable;
@@ -9045,18 +9091,22 @@ function parseColumns($xeTable, isReset) {
9045
9091
  }
9046
9092
  return $xeTable.updateFooter();
9047
9093
  }
9048
- function initColumnSort($xeTable) {
9094
+ function initColumnHierarchy($xeTable) {
9049
9095
  const internalData = $xeTable;
9050
9096
  const {
9051
9097
  collectColumn
9052
9098
  } = internalData;
9053
- collectColumn.forEach((column, index) => {
9054
- const sortIndex = index + 1;
9099
+ let sortIndex = 1;
9100
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
9101
+ const parentId = parentColumn ? parentColumn.id : null;
9102
+ column.parentId = parentId;
9103
+ column.defaultParentId = parentId;
9055
9104
  column.sortNumber = sortIndex;
9056
9105
  column.renderSortNumber = sortIndex;
9106
+ sortIndex++;
9057
9107
  });
9058
9108
  }
9059
- function handleColumn($xeTable, collectColumn) {
9109
+ function handleInitColumn($xeTable, collectColumn) {
9060
9110
  const $xeToolbar = $xeTable.$refs.$xeToolbar;
9061
9111
  const reactData = $xeTable;
9062
9112
  const internalData = $xeTable;
@@ -9065,7 +9115,7 @@ function handleColumn($xeTable, collectColumn) {
9065
9115
  const tableFullColumn = getColumnList(collectColumn);
9066
9116
  internalData.tableFullColumn = tableFullColumn;
9067
9117
  reactData.isColLoading = true;
9068
- initColumnSort($xeTable);
9118
+ initColumnHierarchy($xeTable);
9069
9119
  return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
9070
9120
  const {
9071
9121
  scrollXLoad,
@@ -9792,7 +9842,7 @@ const Methods = {
9792
9842
  const collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(columns, column => cell.createColumn($xeTable, column), {
9793
9843
  children: 'children'
9794
9844
  });
9795
- return handleColumn($xeTable, collectColumn).then(() => {
9845
+ return handleInitColumn($xeTable, collectColumn).then(() => {
9796
9846
  let targetScrollLeft = lastScrollLeft;
9797
9847
  let targetScrollTop = lastScrollTop;
9798
9848
  const virtualXOpts = $xeTable.computeVirtualXOpts;
@@ -9817,9 +9867,9 @@ const Methods = {
9817
9867
  return this.loadColumn(columns);
9818
9868
  });
9819
9869
  },
9820
- handleColumn(collectColumn) {
9870
+ handleInitColumn(collectColumn) {
9821
9871
  const $xeTable = this;
9822
- return handleColumn($xeTable, collectColumn);
9872
+ return handleInitColumn($xeTable, collectColumn);
9823
9873
  },
9824
9874
  /**
9825
9875
  * 更新数据行的 Map
@@ -11178,7 +11228,7 @@ const Methods = {
11178
11228
  const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
11179
11229
  const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
11180
11230
  const resizableData = {};
11181
- const sortData = {};
11231
+ const sortData = [];
11182
11232
  const visibleData = {};
11183
11233
  const fixedData = {};
11184
11234
  const aggFuncData = {};
@@ -11200,18 +11250,39 @@ const Methods = {
11200
11250
  let hasFixed = 0;
11201
11251
  let hasVisible = 0;
11202
11252
  let hasAggFunc = 0;
11253
+ const sortMaps = {};
11203
11254
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
11204
11255
  const colKey = column.getKey();
11205
11256
  if (!colKey) {
11206
11257
  errLog('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
11207
11258
  return;
11208
11259
  }
11209
- // 只支持一级
11210
- if (!parentColumn) {
11260
+ if (parentColumn) {
11211
11261
  if (isCustomSort) {
11262
+ const pColKey = parentColumn.getKey();
11263
+ const psObj = sortMaps[pColKey];
11212
11264
  hasSort = 1;
11213
- sortData[colKey] = column.renderSortNumber;
11265
+ if (psObj) {
11266
+ const sObj = {
11267
+ k: colKey
11268
+ };
11269
+ sortMaps[colKey] = sObj;
11270
+ if (!psObj.c) {
11271
+ psObj.c = [];
11272
+ }
11273
+ psObj.c.push(sObj);
11274
+ }
11275
+ }
11276
+ } else {
11277
+ if (isCustomSort) {
11278
+ hasSort = 1;
11279
+ const sObj = {
11280
+ k: colKey
11281
+ };
11282
+ sortMaps[colKey] = sObj;
11283
+ sortData.push(sObj);
11214
11284
  }
11285
+ // 只支持一级
11215
11286
  if (isCustomFixed && column.fixed !== column.defaultFixed) {
11216
11287
  hasFixed = 1;
11217
11288
  fixedData[colKey] = column.fixed;
@@ -27565,6 +27636,8 @@ function checkRuleStatus(rule, val) {
27565
27636
  });
27566
27637
  ;// CONCATENATED MODULE: ./packages/table/module/custom/mixin.ts
27567
27638
 
27639
+
27640
+
27568
27641
  function calcMaxHeight($xeTable) {
27569
27642
  const reactData = $xeTable;
27570
27643
  const {
@@ -27674,7 +27747,7 @@ function emitCustomEvent($xeTable, type, evnt) {
27674
27747
  });
27675
27748
  reactData.isCustomStatus = true;
27676
27749
  return $xeTable.saveCustomStore('confirm').then(() => {
27677
- if (allowGroup && allowValues && $xeTable.handlePivotTableAggregateData) {
27750
+ if (allowGroup && allowValues && !!$xeTable.handlePivotTableAggregateData) {
27678
27751
  if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
27679
27752
  // 更新数据分组
27680
27753
  if (aggHandleFields.length) {
@@ -27682,7 +27755,7 @@ function emitCustomEvent($xeTable, type, evnt) {
27682
27755
  } else {
27683
27756
  $xeTable.clearRowGroups();
27684
27757
  }
27685
- } else {
27758
+ } else if (allowValues) {
27686
27759
  // 更新聚合函数
27687
27760
  $xeTable.handleUpdateAggData();
27688
27761
  }
@@ -27752,6 +27825,7 @@ function emitCustomEvent($xeTable, type, evnt) {
27752
27825
  sort: options === true,
27753
27826
  aggFunc: options === true
27754
27827
  }, options);
27828
+ const allCols = [];
27755
27829
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
27756
27830
  if (opts.resizable) {
27757
27831
  column.resizeWidth = 0;
@@ -27761,6 +27835,7 @@ function emitCustomEvent($xeTable, type, evnt) {
27761
27835
  }
27762
27836
  if (opts.sort) {
27763
27837
  column.renderSortNumber = column.sortNumber;
27838
+ column.parentId = column.defaultParentId;
27764
27839
  }
27765
27840
  if (!checkMethod || checkMethod({
27766
27841
  $table: $xeTable,
@@ -27773,7 +27848,17 @@ function emitCustomEvent($xeTable, type, evnt) {
27773
27848
  column.renderAggFn = column.defaultAggFunc;
27774
27849
  }
27775
27850
  column.renderResizeWidth = column.renderWidth;
27851
+ allCols.push(column);
27776
27852
  });
27853
+ if (opts.sort) {
27854
+ const newCollectCols = 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(allCols, 'renderSortNumber'), {
27855
+ key: 'id',
27856
+ parentKey: 'parentId',
27857
+ children: 'children'
27858
+ });
27859
+ internalData.collectColumn = newCollectCols;
27860
+ internalData.tableFullColumn = getColumnList(newCollectCols);
27861
+ }
27777
27862
  reactData.isCustomStatus = false;
27778
27863
  $xeTable.saveCustomStore('reset');
27779
27864
  return $xeTable.handleCustom().then(() => {
@@ -29305,7 +29390,7 @@ function renderBody(h, $xeTable) {
29305
29390
  });
29306
29391
  },
29307
29392
  staticColumns(value) {
29308
- this.handleColumn(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(value));
29393
+ this.handleInitColumn(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(value));
29309
29394
  },
29310
29395
  tableColumn() {
29311
29396
  this.analyColumnWidth();