vxe-table 3.12.1 → 3.12.3

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.
package/lib/index.umd.js CHANGED
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.12.1";
2223
+ const version = "3.12.3";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2814,7 +2814,7 @@ function isNodeElement(elem) {
2814
2814
  const {
2815
2815
  log: log_log
2816
2816
  } = core_.VxeUI;
2817
- const log_version = `table v${"3.12.1"}`;
2817
+ const log_version = `table v${"3.12.3"}`;
2818
2818
  const warnLog = log_log.create('warn', log_version);
2819
2819
  const errLog = log_log.create('error', log_version);
2820
2820
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5252,6 +5252,66 @@ function cacheColumnMap($xeTable) {
5252
5252
  reactData.expandColumn = expandColumn;
5253
5253
  reactData.isAllOverflow = isAllOverflow;
5254
5254
  }
5255
+ const updateScrollYStatus = ($xeTable, fullData) => {
5256
+ const props = $xeTable;
5257
+ const reactData = $xeTable;
5258
+ const internalData = $xeTable;
5259
+ const {
5260
+ treeConfig
5261
+ } = props;
5262
+ const sYOpts = $xeTable.computeSYOpts;
5263
+ const treeOpts = $xeTable.computeTreeOpts;
5264
+ const {
5265
+ transform
5266
+ } = treeOpts;
5267
+ const allList = fullData || internalData.tableFullData;
5268
+ // 如果gt为0,则总是启用
5269
+ const scrollYLoad = (transform || !treeConfig) && !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt < allList.length);
5270
+ reactData.scrollYLoad = scrollYLoad;
5271
+ return scrollYLoad;
5272
+ };
5273
+ /**
5274
+ * 如果为虚拟树,将树结构拍平
5275
+ * @returns
5276
+ */
5277
+ function handleVirtualTreeToList($xeTable) {
5278
+ const props = $xeTable;
5279
+ const reactData = $xeTable;
5280
+ const internalData = $xeTable;
5281
+ const {
5282
+ treeConfig
5283
+ } = props;
5284
+ const {
5285
+ treeExpandedMaps
5286
+ } = reactData;
5287
+ const {
5288
+ fullAllDataRowIdData
5289
+ } = internalData;
5290
+ const treeOpts = $xeTable.computeTreeOpts;
5291
+ const childrenField = treeOpts.children || treeOpts.childrenField;
5292
+ if (treeConfig && treeOpts.transform) {
5293
+ const fullData = [];
5294
+ const expandMaps = {};
5295
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
5296
+ const rowid = getRowid($xeTable, row);
5297
+ const parentRowid = getRowid($xeTable, parentRow);
5298
+ if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
5299
+ const rowRest = fullAllDataRowIdData[rowid];
5300
+ if (rowRest) {
5301
+ rowRest._index = fullData.length;
5302
+ }
5303
+ expandMaps[rowid] = 1;
5304
+ fullData.push(row);
5305
+ }
5306
+ }, {
5307
+ children: childrenField
5308
+ });
5309
+ internalData.afterFullData = fullData;
5310
+ updateScrollYStatus($xeTable, fullData);
5311
+ return fullData;
5312
+ }
5313
+ return internalData.afterFullData;
5314
+ }
5255
5315
  function computeRowHeight($xeTable) {
5256
5316
  const tableHeader = $xeTable.$refs.tableHeader;
5257
5317
  const tableBody = $xeTable.$refs.tableBody;
@@ -6269,6 +6329,7 @@ const Methods = {
6269
6329
  });
6270
6330
  },
6271
6331
  handleTableData(force) {
6332
+ const $xeTable = this;
6272
6333
  const {
6273
6334
  scrollYLoad,
6274
6335
  scrollYStore,
@@ -6281,7 +6342,7 @@ const Methods = {
6281
6342
  // 更新数据,处理筛选和排序
6282
6343
  this.updateAfterFullData();
6283
6344
  // 如果为虚拟树,将树结构拍平
6284
- fullList = this.handleVirtualTreeToList();
6345
+ fullList = handleVirtualTreeToList($xeTable);
6285
6346
  }
6286
6347
  const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
6287
6348
  tableData.forEach((row, $index) => {
@@ -6294,21 +6355,6 @@ const Methods = {
6294
6355
  this.tableData = tableData;
6295
6356
  return this.$nextTick();
6296
6357
  },
6297
- updateScrollYStatus(fullData) {
6298
- const {
6299
- treeConfig,
6300
- treeOpts,
6301
- sYOpts
6302
- } = this;
6303
- const {
6304
- transform
6305
- } = treeOpts;
6306
- const allList = fullData || this.tableFullData;
6307
- // 如果gt为0,则总是启用
6308
- const scrollYLoad = (transform || !treeConfig) && !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= allList.length);
6309
- this.scrollYLoad = scrollYLoad;
6310
- return scrollYLoad;
6311
- },
6312
6358
  /**
6313
6359
  * 加载表格数据
6314
6360
  * @param {Array} datas 数据
@@ -6376,7 +6422,7 @@ const Methods = {
6376
6422
  editStore.insertMaps = {};
6377
6423
  editStore.removeList = [];
6378
6424
  editStore.removeMaps = {};
6379
- const sYLoad = this.updateScrollYStatus(fullData);
6425
+ const sYLoad = updateScrollYStatus($xeTable, fullData);
6380
6426
  this.isDragRowMove = false;
6381
6427
  // 全量数据
6382
6428
  this.tableFullData = fullData;
@@ -7385,47 +7431,6 @@ const Methods = {
7385
7431
  }
7386
7432
  return rowList;
7387
7433
  },
7388
- /**
7389
- * 如果为虚拟树,将树结构拍平
7390
- * @returns
7391
- */
7392
- handleVirtualTreeToList() {
7393
- const $xeTable = this;
7394
- const internalData = $xeTable;
7395
- const {
7396
- fullAllDataRowIdData
7397
- } = internalData;
7398
- const {
7399
- treeOpts,
7400
- treeConfig,
7401
- treeExpandedMaps,
7402
- afterTreeFullData,
7403
- afterFullData
7404
- } = this;
7405
- const childrenField = treeOpts.children || treeOpts.childrenField;
7406
- if (treeConfig && treeOpts.transform) {
7407
- const fullData = [];
7408
- const expandMaps = {};
7409
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, (row, index, items, path, parentRow) => {
7410
- const rowid = getRowid(this, row);
7411
- const parentRowid = getRowid(this, parentRow);
7412
- if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
7413
- const rowRest = fullAllDataRowIdData[rowid];
7414
- if (rowRest) {
7415
- rowRest._index = fullData.length;
7416
- }
7417
- expandMaps[rowid] = 1;
7418
- fullData.push(row);
7419
- }
7420
- }, {
7421
- children: childrenField
7422
- });
7423
- this.afterFullData = fullData;
7424
- this.updateScrollYStatus(fullData);
7425
- return fullData;
7426
- }
7427
- return afterFullData;
7428
- },
7429
7434
  /**
7430
7435
  * 获取处理后全量的表格数据
7431
7436
  * 如果存在筛选条件,继续处理
@@ -11564,7 +11569,7 @@ const Methods = {
11564
11569
  reactData.isDragRowMove = true;
11565
11570
  $xeTable.handleTableData(treeConfig && transform);
11566
11571
  $xeTable.cacheRowMap();
11567
- $xeTable.updateScrollYStatus();
11572
+ updateScrollYStatus($xeTable);
11568
11573
  if (!(treeConfig && transform)) {
11569
11574
  $xeTable.updateAfterDataIndex();
11570
11575
  }
@@ -12324,11 +12329,15 @@ const Methods = {
12324
12329
  },
12325
12330
  clearRowExpandLoaded(row) {
12326
12331
  const $xeTable = this;
12332
+ const reactData = $xeTable;
12333
+ const internalData = $xeTable;
12334
+ const rExpandLazyLoadedMaps = {
12335
+ ...reactData.rowExpandLazyLoadedMaps
12336
+ };
12327
12337
  const {
12328
- expandOpts,
12329
- rowExpandLazyLoadedMaps,
12330
12338
  fullAllDataRowIdData
12331
- } = this;
12339
+ } = internalData;
12340
+ const expandOpts = $xeTable.computeExpandOpts;
12332
12341
  const {
12333
12342
  lazy
12334
12343
  } = expandOpts;
@@ -12336,15 +12345,10 @@ const Methods = {
12336
12345
  const rowRest = fullAllDataRowIdData[rowid];
12337
12346
  if (lazy && rowRest) {
12338
12347
  rowRest.expandLoaded = false;
12339
- const rowTempExpandLazyLoadedMaps = {
12340
- ...rowExpandLazyLoadedMaps
12341
- };
12342
- if (rowTempExpandLazyLoadedMaps[rowid]) {
12343
- delete rowTempExpandLazyLoadedMaps[rowid];
12344
- }
12345
- this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
12348
+ delete rExpandLazyLoadedMaps[rowid];
12346
12349
  }
12347
- return this.$nextTick();
12350
+ reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
12351
+ return $xeTable.$nextTick();
12348
12352
  },
12349
12353
  /**
12350
12354
  * 重新懒加载展开行,并展开内容
@@ -12464,6 +12468,8 @@ const Methods = {
12464
12468
  },
12465
12469
  handleAsyncRowExpand(row) {
12466
12470
  const $xeTable = this;
12471
+ const reactData = $xeTable;
12472
+ const internalData = $xeTable;
12467
12473
  return new Promise(resolve => {
12468
12474
  const {
12469
12475
  expandOpts
@@ -12473,37 +12479,42 @@ const Methods = {
12473
12479
  } = expandOpts;
12474
12480
  if (loadMethod) {
12475
12481
  const {
12476
- rowExpandLazyLoadedMaps,
12477
12482
  fullAllDataRowIdData
12478
- } = this;
12483
+ } = internalData;
12484
+ const rExpandLazyLoadedMaps = {
12485
+ ...reactData.rowExpandLazyLoadedMaps
12486
+ };
12479
12487
  const rowid = getRowid($xeTable, row);
12480
12488
  const rowRest = fullAllDataRowIdData[rowid];
12481
- rowExpandLazyLoadedMaps[rowid] = row;
12489
+ rExpandLazyLoadedMaps[rowid] = row;
12490
+ reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
12482
12491
  loadMethod({
12483
12492
  $table: $xeTable,
12484
12493
  row,
12485
- rowIndex: this.getRowIndex(row),
12486
- $rowIndex: this.getVMRowIndex(row)
12494
+ rowIndex: $xeTable.getRowIndex(row),
12495
+ $rowIndex: $xeTable.getVMRowIndex(row)
12487
12496
  }).then(() => {
12488
- const {
12489
- rowExpandedMaps
12490
- } = this;
12497
+ const rExpandedMaps = {
12498
+ ...reactData.rowExpandedMaps
12499
+ };
12491
12500
  if (rowRest) {
12492
12501
  rowRest.expandLoaded = true;
12493
12502
  }
12494
- rowExpandedMaps[rowid] = row;
12503
+ rExpandedMaps[rowid] = row;
12504
+ reactData.rowExpandedMaps = rExpandedMaps;
12495
12505
  }).catch(() => {
12496
12506
  if (rowRest) {
12497
12507
  rowRest.expandLoaded = false;
12498
12508
  }
12499
12509
  }).finally(() => {
12500
- const {
12501
- rowExpandLazyLoadedMaps
12502
- } = this;
12503
- if (rowExpandLazyLoadedMaps[rowid]) {
12504
- delete rowExpandLazyLoadedMaps[rowid];
12510
+ const rExpandLazyLoadedMaps = {
12511
+ ...reactData.rowExpandLazyLoadedMaps
12512
+ };
12513
+ if (rExpandLazyLoadedMaps[rowid]) {
12514
+ delete rExpandLazyLoadedMaps[rowid];
12505
12515
  }
12506
- this.$nextTick().then(() => this.recalculate()).then(() => resolve());
12516
+ reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
12517
+ $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => resolve());
12507
12518
  });
12508
12519
  } else {
12509
12520
  resolve();
@@ -12685,11 +12696,15 @@ const Methods = {
12685
12696
  },
12686
12697
  clearTreeExpandLoaded(rows) {
12687
12698
  const $xeTable = this;
12699
+ const reactData = $xeTable;
12700
+ const internalData = $xeTable;
12701
+ const tExpandedMaps = {
12702
+ ...reactData.treeExpandedMaps
12703
+ };
12688
12704
  const {
12689
- treeOpts,
12690
- treeExpandedMaps,
12691
12705
  fullAllDataRowIdData
12692
- } = this;
12706
+ } = internalData;
12707
+ const treeOpts = $xeTable.computeTreeOpts;
12693
12708
  const {
12694
12709
  transform
12695
12710
  } = treeOpts;
@@ -12702,23 +12717,25 @@ const Methods = {
12702
12717
  const rowRest = fullAllDataRowIdData[rowid];
12703
12718
  if (rowRest) {
12704
12719
  rowRest.treeLoaded = false;
12705
- if (treeExpandedMaps[rowid]) {
12706
- delete treeExpandedMaps[rowid];
12720
+ if (tExpandedMaps[rowid]) {
12721
+ delete tExpandedMaps[rowid];
12707
12722
  }
12708
12723
  }
12709
12724
  });
12710
12725
  }
12726
+ reactData.treeExpandedMaps = tExpandedMaps;
12711
12727
  if (transform) {
12712
- this.handleVirtualTreeToList();
12713
- return this.handleTableData();
12728
+ handleVirtualTreeToList($xeTable);
12729
+ return $xeTable.handleTableData();
12714
12730
  }
12715
- return this.$nextTick();
12731
+ return $xeTable.$nextTick();
12716
12732
  },
12717
12733
  /**
12718
12734
  * 重新懒加载树节点,并展开该节点
12719
12735
  * @param {Row} row 行对象
12720
12736
  */
12721
12737
  reloadTreeExpand(row) {
12738
+ const $xeTable = this;
12722
12739
  const {
12723
12740
  treeOpts,
12724
12741
  treeExpandLazyLoadedMaps
@@ -12734,7 +12751,7 @@ const Methods = {
12734
12751
  return this.handleAsyncTreeExpandChilds(row);
12735
12752
  }).then(() => {
12736
12753
  if (transform) {
12737
- this.handleVirtualTreeToList();
12754
+ handleVirtualTreeToList($xeTable);
12738
12755
  return this.handleTableData();
12739
12756
  }
12740
12757
  }).then(() => {
@@ -13013,8 +13030,9 @@ const Methods = {
13013
13030
  * @returns
13014
13031
  */
13015
13032
  handleVirtualTreeExpand(rows, expanded) {
13033
+ const $xeTable = this;
13016
13034
  return this.handleBaseTreeExpand(rows, expanded).then(() => {
13017
- this.handleVirtualTreeToList();
13035
+ handleVirtualTreeToList($xeTable);
13018
13036
  this.handleTableData();
13019
13037
  this.updateTreeDataIndex();
13020
13038
  }).then(() => {
@@ -13068,6 +13086,7 @@ const Methods = {
13068
13086
  * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
13069
13087
  */
13070
13088
  clearTreeExpand() {
13089
+ const $xeTable = this;
13071
13090
  const {
13072
13091
  treeOpts,
13073
13092
  tableFullData
@@ -13086,7 +13105,7 @@ const Methods = {
13086
13105
  }
13087
13106
  return this.handleTableData().then(() => {
13088
13107
  if (transform) {
13089
- this.handleVirtualTreeToList();
13108
+ handleVirtualTreeToList($xeTable);
13090
13109
  return this.handleTableData();
13091
13110
  }
13092
13111
  }).then(() => {