vxe-table 4.15.0-beta.9 → 4.15.1

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 +29 -14
  4. package/es/table/module/custom/panel.js +1 -1
  5. package/es/table/module/edit/hook.js +5 -5
  6. package/es/table/src/body.js +7 -6
  7. package/es/table/src/columnInfo.js +2 -0
  8. package/es/table/src/table.js +235 -90
  9. package/es/table/src/util.js +9 -0
  10. package/es/ui/index.js +3 -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 +156 -57
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/table/module/custom/hook.js +34 -13
  18. package/lib/table/module/custom/hook.min.js +1 -1
  19. package/lib/table/module/custom/panel.js +1 -1
  20. package/lib/table/module/custom/panel.min.js +1 -1
  21. package/lib/table/module/edit/hook.js +5 -0
  22. package/lib/table/module/edit/hook.min.js +1 -1
  23. package/lib/table/src/body.js +7 -6
  24. package/lib/table/src/body.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 +26 -26
  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 +3 -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 +28 -13
  38. package/packages/table/module/custom/panel.ts +1 -1
  39. package/packages/table/module/edit/hook.ts +5 -5
  40. package/packages/table/src/body.ts +7 -6
  41. package/packages/table/src/columnInfo.ts +3 -0
  42. package/packages/table/src/table.ts +248 -90
  43. package/packages/table/src/util.ts +10 -0
  44. package/packages/ui/index.ts +2 -0
  45. /package/es/{iconfont.1753497319436.ttf → iconfont.1754358078563.ttf} +0 -0
  46. /package/es/{iconfont.1753497319436.woff → iconfont.1754358078563.woff} +0 -0
  47. /package/es/{iconfont.1753497319436.woff2 → iconfont.1754358078563.woff2} +0 -0
  48. /package/lib/{iconfont.1753497319436.ttf → iconfont.1754358078563.ttf} +0 -0
  49. /package/lib/{iconfont.1753497319436.woff → iconfont.1754358078563.woff} +0 -0
  50. /package/lib/{iconfont.1753497319436.woff2 → iconfont.1754358078563.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,25 @@ 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
+ if (allowSort) {
121
+ internalData.collectColumn = customColumnList;
122
+ }
123
+ return $xeTable.saveCustomStore('confirm');
121
124
  };
122
125
  const cancelCustom = () => {
123
126
  const { customColumnList, customStore } = reactData;
@@ -185,6 +188,10 @@ VxeUI.hooks.add('tableCustomModule', {
185
188
  return nextTick();
186
189
  };
187
190
  const customMethods = {
191
+ getCustomVisible() {
192
+ const { customStore } = reactData;
193
+ return customStore.visible;
194
+ },
188
195
  openCustom,
189
196
  closeCustom,
190
197
  toggleCustom,
@@ -202,6 +209,7 @@ VxeUI.hooks.add('tableCustomModule', {
202
209
  sort: options === true,
203
210
  aggFunc: options === true
204
211
  }, options);
212
+ const allCols = [];
205
213
  XEUtils.eachTree(collectColumn, (column) => {
206
214
  if (opts.resizable) {
207
215
  column.resizeWidth = 0;
@@ -211,6 +219,7 @@ VxeUI.hooks.add('tableCustomModule', {
211
219
  }
212
220
  if (opts.sort) {
213
221
  column.renderSortNumber = column.sortNumber;
222
+ column.parentId = column.defaultParentId;
214
223
  }
215
224
  if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
216
225
  column.visible = column.defaultVisible;
@@ -220,9 +229,14 @@ VxeUI.hooks.add('tableCustomModule', {
220
229
  column.renderAggFn = column.defaultAggFunc;
221
230
  }
222
231
  column.renderResizeWidth = column.renderWidth;
232
+ allCols.push(column);
223
233
  });
234
+ if (opts.sort) {
235
+ const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
236
+ internalData.collectColumn = newCollectCols;
237
+ internalData.tableFullColumn = getColumnList(newCollectCols);
238
+ }
224
239
  reactData.isCustomStatus = false;
225
- $xeTable.saveCustomStore('reset');
226
240
  return $xeTable.handleCustom().then(() => {
227
241
  if (opts.aggFunc && $xeTable.handlePivotTableAggregateData) {
228
242
  const rowGroupFields = computeRowGroupFields.value;
@@ -238,6 +252,7 @@ VxeUI.hooks.add('tableCustomModule', {
238
252
  $xeTable.handleUpdateAggData();
239
253
  }
240
254
  }
255
+ $xeTable.saveCustomStore('reset');
241
256
  });
242
257
  },
243
258
  toggleCustomAllCheckbox() {
@@ -188,7 +188,7 @@ export default defineVxeComponent({
188
188
  }
189
189
  }
190
190
  }
191
- if (!targetFixed !== null) {
191
+ if (targetFixed !== null) {
192
192
  $xeTable.dispatchEvent('custom-fixed-change', { column, fixed: targetFixed }, evnt);
193
193
  }
194
194
  };
@@ -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
  // 行是否被展开
@@ -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,