vxe-table 4.15.0-beta.8 → 4.15.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 (50) hide show
  1. package/es/grid/src/grid.js +57 -9
  2. package/es/style.css +1 -1
  3. package/es/table/module/custom/hook.js +22 -14
  4. package/es/table/module/edit/hook.js +5 -5
  5. package/es/table/src/body.js +7 -6
  6. package/es/table/src/cell.js +5 -5
  7. package/es/table/src/columnInfo.js +2 -0
  8. package/es/table/src/table.js +204 -80
  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 +67 -9
  13. package/lib/grid/src/grid.min.js +1 -1
  14. package/lib/index.umd.js +148 -58
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/table/module/custom/hook.js +25 -13
  18. package/lib/table/module/custom/hook.min.js +1 -1
  19. package/lib/table/module/edit/hook.js +5 -0
  20. package/lib/table/module/edit/hook.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/cell.js +5 -4
  24. package/lib/table/src/cell.min.js +1 -1
  25. package/lib/table/src/columnInfo.js +2 -0
  26. package/lib/table/src/columnInfo.min.js +1 -1
  27. package/lib/table/src/table.js +24 -24
  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 +62 -9
  37. package/packages/table/module/custom/hook.ts +21 -13
  38. package/packages/table/module/edit/hook.ts +5 -5
  39. package/packages/table/src/body.ts +7 -6
  40. package/packages/table/src/cell.ts +5 -5
  41. package/packages/table/src/columnInfo.ts +3 -0
  42. package/packages/table/src/table.ts +217 -80
  43. package/packages/table/src/util.ts +10 -0
  44. package/packages/ui/index.ts +1 -0
  45. /package/es/{iconfont.1753445535983.ttf → iconfont.1753928735749.ttf} +0 -0
  46. /package/es/{iconfont.1753445535983.woff → iconfont.1753928735749.woff} +0 -0
  47. /package/es/{iconfont.1753445535983.woff2 → iconfont.1753928735749.woff2} +0 -0
  48. /package/lib/{iconfont.1753445535983.ttf → iconfont.1753928735749.ttf} +0 -0
  49. /package/lib/{iconfont.1753445535983.woff → iconfont.1753928735749.woff} +0 -0
  50. /package/lib/{iconfont.1753445535983.woff2 → iconfont.1753928735749.woff2} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { nextTick } from 'vue';
2
2
  import { VxeUI } from '../../../ui';
3
3
  import XEUtils from 'xe-utils';
4
+ import { getColumnList } from '../../src/util';
4
5
  const tableCustomMethodKeys = ['openCustom', 'closeCustom', 'toggleCustom', 'saveCustom', 'cancelCustom', 'resetCustom', 'toggleCustomAllCheckbox', 'setCustomAllCheckbox'];
5
6
  VxeUI.hooks.add('tableCustomModule', {
6
7
  setupTable($xeTable) {
@@ -101,23 +102,22 @@ VxeUI.hooks.add('tableCustomModule', {
101
102
  }
102
103
  });
103
104
  reactData.isCustomStatus = true;
104
- return $xeTable.saveCustomStore('confirm').then(() => {
105
- if (allowGroup && allowValues && $xeTable.handlePivotTableAggregateData) {
106
- if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
107
- // 更新数据分组
108
- if (aggHandleFields.length) {
109
- $xeTable.setRowGroups(aggHandleFields);
110
- }
111
- else {
112
- $xeTable.clearRowGroups();
113
- }
105
+ if (allowGroup && !!$xeTable.handlePivotTableAggregateData) {
106
+ if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
107
+ // 更新数据分组
108
+ if (aggHandleFields.length) {
109
+ $xeTable.setRowGroups(aggHandleFields);
114
110
  }
115
111
  else {
116
- // 更新聚合函数
117
- $xeTable.handleUpdateAggData();
112
+ $xeTable.clearRowGroups();
118
113
  }
119
114
  }
120
- });
115
+ else if (allowValues) {
116
+ // 更新聚合函数
117
+ $xeTable.handleUpdateAggData();
118
+ }
119
+ }
120
+ return $xeTable.saveCustomStore('confirm');
121
121
  };
122
122
  const cancelCustom = () => {
123
123
  const { customColumnList, customStore } = reactData;
@@ -202,6 +202,7 @@ VxeUI.hooks.add('tableCustomModule', {
202
202
  sort: options === true,
203
203
  aggFunc: options === true
204
204
  }, options);
205
+ const allCols = [];
205
206
  XEUtils.eachTree(collectColumn, (column) => {
206
207
  if (opts.resizable) {
207
208
  column.resizeWidth = 0;
@@ -211,6 +212,7 @@ VxeUI.hooks.add('tableCustomModule', {
211
212
  }
212
213
  if (opts.sort) {
213
214
  column.renderSortNumber = column.sortNumber;
215
+ column.parentId = column.defaultParentId;
214
216
  }
215
217
  if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
216
218
  column.visible = column.defaultVisible;
@@ -220,9 +222,14 @@ VxeUI.hooks.add('tableCustomModule', {
220
222
  column.renderAggFn = column.defaultAggFunc;
221
223
  }
222
224
  column.renderResizeWidth = column.renderWidth;
225
+ allCols.push(column);
223
226
  });
227
+ if (opts.sort) {
228
+ const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
229
+ internalData.collectColumn = newCollectCols;
230
+ internalData.tableFullColumn = getColumnList(newCollectCols);
231
+ }
224
232
  reactData.isCustomStatus = false;
225
- $xeTable.saveCustomStore('reset');
226
233
  return $xeTable.handleCustom().then(() => {
227
234
  if (opts.aggFunc && $xeTable.handlePivotTableAggregateData) {
228
235
  const rowGroupFields = computeRowGroupFields.value;
@@ -238,6 +245,7 @@ VxeUI.hooks.add('tableCustomModule', {
238
245
  $xeTable.handleUpdateAggData();
239
246
  }
240
247
  }
248
+ $xeTable.saveCustomStore('reset');
241
249
  });
242
250
  },
243
251
  toggleCustomAllCheckbox() {
@@ -77,7 +77,7 @@ hooks.add('tableEditModule', {
77
77
  }
78
78
  parentChilds[funcName](item);
79
79
  mapChilds[funcName](item);
80
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
80
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
81
81
  fullDataRowIdData[rowid] = rest;
82
82
  fullAllDataRowIdData[rowid] = rest;
83
83
  }
@@ -87,7 +87,7 @@ hooks.add('tableEditModule', {
87
87
  }
88
88
  afterFullData[funcName](item);
89
89
  tableFullTreeData[funcName](item);
90
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
90
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
91
91
  fullDataRowIdData[rowid] = rest;
92
92
  fullAllDataRowIdData[rowid] = rest;
93
93
  }
@@ -122,7 +122,7 @@ hooks.add('tableEditModule', {
122
122
  else {
123
123
  newRecords.forEach(item => {
124
124
  const rowid = getRowid($xeTable, item);
125
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
125
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
126
126
  fullDataRowIdData[rowid] = rest;
127
127
  fullAllDataRowIdData[rowid] = rest;
128
128
  afterFullData.unshift(item);
@@ -154,7 +154,7 @@ hooks.add('tableEditModule', {
154
154
  else {
155
155
  newRecords.forEach(item => {
156
156
  const rowid = getRowid($xeTable, item);
157
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, treeIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
157
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, treeIndex: -1, _tIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
158
158
  fullDataRowIdData[rowid] = rest;
159
159
  fullAllDataRowIdData[rowid] = rest;
160
160
  afterFullData.push(item);
@@ -186,7 +186,7 @@ hooks.add('tableEditModule', {
186
186
  targetIndex = targetIndex + 1;
187
187
  }
188
188
  parentMapChilds.splice(targetIndex, 0, item);
189
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
189
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
190
190
  fullDataRowIdData[rowid] = rest;
191
191
  fullAllDataRowIdData[rowid] = rest;
192
192
  });
@@ -258,7 +258,7 @@ export default defineVxeComponent({
258
258
  if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
259
259
  isDirty = $xeTable.isUpdateByRow(row, column.field);
260
260
  }
261
- const isVNAutoHeight = scrollYLoad && !hasEllipsis;
261
+ const isVNAutoHeight = !hasEllipsis && (scrollYLoad || scrollXLoad);
262
262
  let cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
263
263
  const isLastColumn = $columnIndex === columns.length - 1;
264
264
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
@@ -295,7 +295,7 @@ export default defineVxeComponent({
295
295
  }
296
296
  tcStyle.width = `${column.renderWidth + mergeColWidth - cellOffsetWidth}px`;
297
297
  }
298
- if (scrollYLoad || hasEllipsis || isCsHeight || isRsHeight) {
298
+ if (scrollYLoad || scrollXLoad || hasEllipsis || isCsHeight || isRsHeight) {
299
299
  tcStyle.height = `${cellHeight}px`;
300
300
  }
301
301
  else {
@@ -458,15 +458,16 @@ export default defineVxeComponent({
458
458
  };
459
459
  }
460
460
  if (rowRest) {
461
+ rowIndex = rowRest.index;
462
+ _rowIndex = rowRest._index;
461
463
  rowLevel = rowRest.level;
464
+ seq = rowRest.seq;
462
465
  if (hasRowGroupAggregate || (treeConfig && transform && seqMode === 'increasing')) {
463
466
  seq = rowRest._index + 1;
464
467
  }
465
- else {
466
- seq = rowRest.seq;
468
+ else if ((treeConfig && seqMode === 'fixed')) {
469
+ seq = rowRest._tIndex + 1;
467
470
  }
468
- rowIndex = rowRest.index;
469
- _rowIndex = rowRest._index;
470
471
  }
471
472
  const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
472
473
  // 行是否被展开
@@ -389,7 +389,7 @@ export const Cell = {
389
389
  const { computeAggregateOpts } = $table.getComputeMaps();
390
390
  const aggregateOpts = computeAggregateOpts.value;
391
391
  const { mode, showTotal, totalMethod, countFields, contentMethod, mapChildrenField } = aggregateOpts;
392
- const aggMethod = aggregateOpts.calcValuesMethod || aggregateOpts.countMethod || aggregateOpts.aggregateMethod;
392
+ const aggCalcMethod = aggregateOpts.calcValuesMethod || aggregateOpts.countMethod || aggregateOpts.aggregateMethod;
393
393
  const groupField = aggRow.groupField;
394
394
  const groupContent = aggRow.groupContent;
395
395
  const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
@@ -423,9 +423,9 @@ export const Cell = {
423
423
  cellValue = $table.getPivotTableAggregateCellAggValue(params);
424
424
  }
425
425
  else if (aggFunc === true || (countFields && countFields.includes(field))) {
426
- if (aggMethod) {
426
+ if (aggCalcMethod) {
427
427
  ctParams.aggValue = childCount;
428
- cellValue = `${aggMethod(ctParams)}`;
428
+ cellValue = `${aggCalcMethod(ctParams)}`;
429
429
  }
430
430
  }
431
431
  }
@@ -478,14 +478,14 @@ export const Cell = {
478
478
  const { rowGroupExpandedFlag } = tableReactData;
479
479
  const { rowGroupExpandedMaps } = tableInternalData;
480
480
  const aggregateOpts = computeAggregateOpts.value;
481
- const { padding, indent } = aggregateOpts;
481
+ const { mode, padding, indent } = aggregateOpts;
482
482
  const rowid = getRowid($table, row);
483
483
  const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
484
484
  return h('div', {
485
485
  class: ['vxe-row-group--tree-node', {
486
486
  'is--expanded': isExpand
487
487
  }],
488
- style: padding && indent
488
+ style: mode !== 'column' && padding && indent
489
489
  ? {
490
490
  paddingLeft: `${level * indent}px`
491
491
  }
@@ -112,9 +112,11 @@ export class ColumnInfo {
112
112
  parentId: null,
113
113
  visible,
114
114
  // 内部属性(一旦被使用,将导致不可升级版本)
115
+ defaultParentId: null,
115
116
  halfVisible: false,
116
117
  defaultVisible: visible,
117
118
  defaultFixed: _vm.fixed,
119
+ defaultAggGroup: _vm.aggGroup,
118
120
  defaultAggFunc: _vm.aggFunc,
119
121
  checked: false,
120
122
  halfChecked: false,