vxe-table 3.15.36 → 3.15.37

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.
@@ -305,7 +305,17 @@ function cacheColumnMap($xeTable) {
305
305
  reactData.expandColumn = expandColumn;
306
306
  reactData.isAllOverflow = isAllOverflow;
307
307
  }
308
- const updateScrollYStatus = ($xeTable, fullData) => {
308
+ function updateScrollXStatus($xeTable, fullColumn) {
309
+ const reactData = $xeTable;
310
+ const internalData = $xeTable;
311
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
312
+ const allCols = fullColumn || internalData.tableFullColumn;
313
+ // 如果gt为0,则总是启用
314
+ const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < allCols.length);
315
+ reactData.scrollXLoad = scrollXLoad;
316
+ return scrollXLoad;
317
+ }
318
+ function updateScrollYStatus($xeTable, fullData) {
309
319
  const props = $xeTable;
310
320
  const reactData = $xeTable;
311
321
  const internalData = $xeTable;
@@ -318,7 +328,7 @@ const updateScrollYStatus = ($xeTable, fullData) => {
318
328
  const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
319
329
  reactData.scrollYLoad = scrollYLoad;
320
330
  return scrollYLoad;
321
- };
331
+ }
322
332
  /**
323
333
  * 展开与收起树节点
324
334
  * @param rows
@@ -2992,7 +3002,6 @@ function parseColumns($xeTable, isReset) {
2992
3002
  const centerList = [];
2993
3003
  const rightList = [];
2994
3004
  const { isGroup, columnStore } = reactData;
2995
- const virtualXOpts = $xeTable.computeVirtualXOpts;
2996
3005
  const { collectColumn, tableFullColumn, scrollXStore, fullColumnIdData } = internalData;
2997
3006
  // 如果是分组表头,如果子列全部被隐藏,则根列也隐藏
2998
3007
  if (isGroup) {
@@ -3055,11 +3064,12 @@ function parseColumns($xeTable, isReset) {
3055
3064
  });
3056
3065
  }
3057
3066
  const visibleColumn = leftList.concat(centerList).concat(rightList);
3058
- // 如果gt为0,则总是启用
3059
- const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < tableFullColumn.length);
3067
+ internalData.visibleColumn = visibleColumn;
3068
+ updateColumnOffsetLeft($xeTable);
3069
+ const sXLoad = updateScrollXStatus($xeTable);
3060
3070
  reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
3061
3071
  Object.assign(columnStore, { leftList, centerList, rightList });
3062
- if (scrollXLoad) {
3072
+ if (sXLoad) {
3063
3073
  // if (showOverflow) {
3064
3074
  // if (!rowOpts.height) {
3065
3075
  // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
@@ -3095,7 +3105,6 @@ function parseColumns($xeTable, isReset) {
3095
3105
  $xeTable.clearMergeCells();
3096
3106
  $xeTable.clearMergeFooterItems();
3097
3107
  }
3098
- reactData.scrollXLoad = scrollXLoad;
3099
3108
  visibleColumn.forEach((column, index) => {
3100
3109
  const colid = column.id;
3101
3110
  const colRest = fullColumnIdData[colid];
@@ -3103,7 +3112,6 @@ function parseColumns($xeTable, isReset) {
3103
3112
  colRest._index = index;
3104
3113
  }
3105
3114
  });
3106
- internalData.visibleColumn = visibleColumn;
3107
3115
  handleTableColumn($xeTable);
3108
3116
  if (isReset) {
3109
3117
  return $xeTable.updateFooter().then(() => {
@@ -3758,8 +3766,23 @@ const Methods = {
3758
3766
  */
3759
3767
  loadColumn(columns) {
3760
3768
  const $xeTable = this;
3769
+ const internalData = $xeTable;
3770
+ const { lastScrollLeft, lastScrollTop } = internalData;
3761
3771
  const collectColumn = XEUtils.mapTree(columns, column => Cell.createColumn($xeTable, column), { children: 'children' });
3762
- return handleColumn($xeTable, collectColumn);
3772
+ return handleColumn($xeTable, collectColumn).then(() => {
3773
+ let targetScrollLeft = lastScrollLeft;
3774
+ let targetScrollTop = lastScrollTop;
3775
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
3776
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
3777
+ // 是否在更新数据之后自动滚动重置滚动条
3778
+ if (virtualXOpts.scrollToLeftOnChange) {
3779
+ targetScrollLeft = 0;
3780
+ }
3781
+ if (virtualYOpts.scrollToTopOnChange) {
3782
+ targetScrollTop = 0;
3783
+ }
3784
+ restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop);
3785
+ });
3763
3786
  },
3764
3787
  /**
3765
3788
  * 加载列配置并恢复到初始状态
@@ -5551,7 +5574,7 @@ const Methods = {
5551
5574
  return new Promise(resolve => {
5552
5575
  // 还原滚动条位置
5553
5576
  if (lastScrollLeft || lastScrollTop) {
5554
- return restoreScrollLocation($xeTable, lastScrollLeft, lastScrollTop).then().then(() => {
5577
+ return restoreScrollLocation($xeTable, lastScrollLeft, lastScrollTop).then(() => {
5555
5578
  // 存在滚动行为未结束情况
5556
5579
  setTimeout(resolve, 10);
5557
5580
  });
@@ -10265,19 +10288,19 @@ funcs.forEach(name => {
10265
10288
  Methods[name] = function (...args) {
10266
10289
  if (!this[`_${name}`]) {
10267
10290
  if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
10268
- errLog('vxe.error.reqModule', ['VxeTableExportModule']);
10291
+ errLog('vxe.error.reqModule', ['Export']);
10269
10292
  }
10270
10293
  else if ('fullValidate,validate'.split(',').includes(name)) {
10271
- errLog('vxe.error.reqModule', ['VxeTableValidatorModule']);
10294
+ errLog('vxe.error.reqModule', ['Validator']);
10272
10295
  }
10273
10296
  else if ('setFilter,openFilter,clearFilter,getCheckedFilters'.split(',').includes(name)) {
10274
- errLog('vxe.error.reqModule', ['VxeTableFilterModule']);
10297
+ errLog('vxe.error.reqModule', ['Filter']);
10275
10298
  }
10276
10299
  else if ('insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell'.split(',').includes(name)) {
10277
- errLog('vxe.error.reqModule', ['VxeTableEditModule']);
10300
+ errLog('vxe.error.reqModule', ['Edit']);
10278
10301
  }
10279
10302
  else if ('openCustom'.split(',').includes(name)) {
10280
- errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
10303
+ errLog('vxe.error.reqModule', ['Custom']);
10281
10304
  }
10282
10305
  }
10283
10306
  return this[`_${name}`] ? this[`_${name}`](...args) : null;
@@ -144,9 +144,6 @@ export default {
144
144
  if ($table.triggerCustomEvent) {
145
145
  $table.triggerCustomEvent($event);
146
146
  }
147
- else {
148
- errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
149
- }
150
147
  }
151
148
  },
152
149
  handleMouseenterSettingEvent({ $event }) {
@@ -157,9 +154,6 @@ export default {
157
154
  if ($table) {
158
155
  $table.customOpenEvent($event);
159
156
  }
160
- else {
161
- errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
162
- }
163
157
  },
164
158
  handleMouseleaveSettingEvent({ $event }) {
165
159
  const $xeToolbar = this;
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.15.36";
3
+ export const version = "3.15.37";
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.15.36"}`;
3
+ const version = `table v${"3.15.37"}`;
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.15.36";
2005
+ const version = "3.15.37";
2006
2006
  core_.VxeUI.version = version;
2007
2007
  core_.VxeUI.tableVersion = version;
2008
2008
  core_.VxeUI.setConfig({
@@ -2646,7 +2646,7 @@ function isNodeElement(elem) {
2646
2646
  const {
2647
2647
  log: log_log
2648
2648
  } = core_.VxeUI;
2649
- const log_version = `table v${"3.15.36"}`;
2649
+ const log_version = `table v${"3.15.37"}`;
2650
2650
  const warnLog = log_log.create('warn', log_version);
2651
2651
  const errLog = log_log.create('error', log_version);
2652
2652
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5497,7 +5497,17 @@ function cacheColumnMap($xeTable) {
5497
5497
  reactData.expandColumn = expandColumn;
5498
5498
  reactData.isAllOverflow = isAllOverflow;
5499
5499
  }
5500
- const updateScrollYStatus = ($xeTable, fullData) => {
5500
+ function updateScrollXStatus($xeTable, fullColumn) {
5501
+ const reactData = $xeTable;
5502
+ const internalData = $xeTable;
5503
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
5504
+ const allCols = fullColumn || internalData.tableFullColumn;
5505
+ // 如果gt为0,则总是启用
5506
+ const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < allCols.length);
5507
+ reactData.scrollXLoad = scrollXLoad;
5508
+ return scrollXLoad;
5509
+ }
5510
+ function updateScrollYStatus($xeTable, fullData) {
5501
5511
  const props = $xeTable;
5502
5512
  const reactData = $xeTable;
5503
5513
  const internalData = $xeTable;
@@ -5514,7 +5524,7 @@ const updateScrollYStatus = ($xeTable, fullData) => {
5514
5524
  const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
5515
5525
  reactData.scrollYLoad = scrollYLoad;
5516
5526
  return scrollYLoad;
5517
- };
5527
+ }
5518
5528
  /**
5519
5529
  * 展开与收起树节点
5520
5530
  * @param rows
@@ -8692,7 +8702,6 @@ function parseColumns($xeTable, isReset) {
8692
8702
  isGroup,
8693
8703
  columnStore
8694
8704
  } = reactData;
8695
- const virtualXOpts = $xeTable.computeVirtualXOpts;
8696
8705
  const {
8697
8706
  collectColumn,
8698
8707
  tableFullColumn,
@@ -8752,15 +8761,16 @@ function parseColumns($xeTable, isReset) {
8752
8761
  });
8753
8762
  }
8754
8763
  const visibleColumn = leftList.concat(centerList).concat(rightList);
8755
- // 如果gt为0,则总是启用
8756
- const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < tableFullColumn.length);
8764
+ internalData.visibleColumn = visibleColumn;
8765
+ updateColumnOffsetLeft($xeTable);
8766
+ const sXLoad = updateScrollXStatus($xeTable);
8757
8767
  reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
8758
8768
  Object.assign(columnStore, {
8759
8769
  leftList,
8760
8770
  centerList,
8761
8771
  rightList
8762
8772
  });
8763
- if (scrollXLoad) {
8773
+ if (sXLoad) {
8764
8774
  // if (showOverflow) {
8765
8775
  // if (!rowOpts.height) {
8766
8776
  // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
@@ -8798,7 +8808,6 @@ function parseColumns($xeTable, isReset) {
8798
8808
  $xeTable.clearMergeCells();
8799
8809
  $xeTable.clearMergeFooterItems();
8800
8810
  }
8801
- reactData.scrollXLoad = scrollXLoad;
8802
8811
  visibleColumn.forEach((column, index) => {
8803
8812
  const colid = column.id;
8804
8813
  const colRest = fullColumnIdData[colid];
@@ -8806,7 +8815,6 @@ function parseColumns($xeTable, isReset) {
8806
8815
  colRest._index = index;
8807
8816
  }
8808
8817
  });
8809
- internalData.visibleColumn = visibleColumn;
8810
8818
  handleTableColumn($xeTable);
8811
8819
  if (isReset) {
8812
8820
  return $xeTable.updateFooter().then(() => {
@@ -9539,10 +9547,28 @@ const Methods = {
9539
9547
  */
9540
9548
  loadColumn(columns) {
9541
9549
  const $xeTable = this;
9550
+ const internalData = $xeTable;
9551
+ const {
9552
+ lastScrollLeft,
9553
+ lastScrollTop
9554
+ } = internalData;
9542
9555
  const collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(columns, column => cell.createColumn($xeTable, column), {
9543
9556
  children: 'children'
9544
9557
  });
9545
- return handleColumn($xeTable, collectColumn);
9558
+ return handleColumn($xeTable, collectColumn).then(() => {
9559
+ let targetScrollLeft = lastScrollLeft;
9560
+ let targetScrollTop = lastScrollTop;
9561
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
9562
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
9563
+ // 是否在更新数据之后自动滚动重置滚动条
9564
+ if (virtualXOpts.scrollToLeftOnChange) {
9565
+ targetScrollLeft = 0;
9566
+ }
9567
+ if (virtualYOpts.scrollToTopOnChange) {
9568
+ targetScrollTop = 0;
9569
+ }
9570
+ restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop);
9571
+ });
9546
9572
  },
9547
9573
  /**
9548
9574
  * 加载列配置并恢复到初始状态
@@ -11620,7 +11646,7 @@ const Methods = {
11620
11646
  return new Promise(resolve => {
11621
11647
  // 还原滚动条位置
11622
11648
  if (lastScrollLeft || lastScrollTop) {
11623
- return restoreScrollLocation($xeTable, lastScrollLeft, lastScrollTop).then().then(() => {
11649
+ return restoreScrollLocation($xeTable, lastScrollLeft, lastScrollTop).then(() => {
11624
11650
  // 存在滚动行为未结束情况
11625
11651
  setTimeout(resolve, 10);
11626
11652
  });
@@ -17120,15 +17146,15 @@ funcs.forEach(name => {
17120
17146
  Methods[name] = function (...args) {
17121
17147
  if (!this[`_${name}`]) {
17122
17148
  if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
17123
- errLog('vxe.error.reqModule', ['VxeTableExportModule']);
17149
+ errLog('vxe.error.reqModule', ['Export']);
17124
17150
  } else if ('fullValidate,validate'.split(',').includes(name)) {
17125
- errLog('vxe.error.reqModule', ['VxeTableValidatorModule']);
17151
+ errLog('vxe.error.reqModule', ['Validator']);
17126
17152
  } else if ('setFilter,openFilter,clearFilter,getCheckedFilters'.split(',').includes(name)) {
17127
- errLog('vxe.error.reqModule', ['VxeTableFilterModule']);
17153
+ errLog('vxe.error.reqModule', ['Filter']);
17128
17154
  } else if ('insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell'.split(',').includes(name)) {
17129
- errLog('vxe.error.reqModule', ['VxeTableEditModule']);
17155
+ errLog('vxe.error.reqModule', ['Edit']);
17130
17156
  } else if ('openCustom'.split(',').includes(name)) {
17131
- errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
17157
+ errLog('vxe.error.reqModule', ['Custom']);
17132
17158
  }
17133
17159
  }
17134
17160
  return this[`_${name}`] ? this[`_${name}`](...args) : null;
@@ -25951,8 +25977,8 @@ function handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRigh
25951
25977
  let mouseScrollSpaceSize = 1;
25952
25978
  const triggerEvent = (type, evnt) => {
25953
25979
  this.emitEvent(`checkbox-range-${type}`, {
25954
- records: this.getCheckboxRecords(),
25955
- reserves: this.getCheckboxReserveRecords()
25980
+ records: () => this.getCheckboxRecords(),
25981
+ reserves: () => this.getCheckboxReserveRecords()
25956
25982
  }, evnt);
25957
25983
  };
25958
25984
  const handleChecked = evnt => {
@@ -29461,8 +29487,6 @@ const {
29461
29487
  if ($table) {
29462
29488
  if ($table.triggerCustomEvent) {
29463
29489
  $table.triggerCustomEvent($event);
29464
- } else {
29465
- errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
29466
29490
  }
29467
29491
  }
29468
29492
  },
@@ -29477,8 +29501,6 @@ const {
29477
29501
  const $table = connectTable;
29478
29502
  if ($table) {
29479
29503
  $table.customOpenEvent($event);
29480
- } else {
29481
- errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
29482
29504
  }
29483
29505
  },
29484
29506
  handleMouseleaveSettingEvent({