vxe-table 3.12.2 → 3.12.4

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.2";
2223
+ const version = "3.12.4";
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.2"}`;
2817
+ const log_version = `table v${"3.12.4"}`;
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
@@ -5237,21 +5237,72 @@ function cacheColumnMap($xeTable) {
5237
5237
  errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
5238
5238
  }
5239
5239
  }
5240
- if (true) {
5241
- if (htmlColumn) {
5242
- if (!columnOpts.useKey) {
5243
- errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
5244
- }
5245
- if (!rowOpts.useKey) {
5246
- errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
5247
- }
5248
- }
5249
- }
5240
+ if (false) {}
5250
5241
  reactData.isGroup = isGroup;
5251
5242
  reactData.treeNodeColumn = treeNodeColumn;
5252
5243
  reactData.expandColumn = expandColumn;
5253
5244
  reactData.isAllOverflow = isAllOverflow;
5254
5245
  }
5246
+ const updateScrollYStatus = ($xeTable, fullData) => {
5247
+ const props = $xeTable;
5248
+ const reactData = $xeTable;
5249
+ const internalData = $xeTable;
5250
+ const {
5251
+ treeConfig
5252
+ } = props;
5253
+ const sYOpts = $xeTable.computeSYOpts;
5254
+ const treeOpts = $xeTable.computeTreeOpts;
5255
+ const {
5256
+ transform
5257
+ } = treeOpts;
5258
+ const allList = fullData || internalData.tableFullData;
5259
+ // 如果gt为0,则总是启用
5260
+ const scrollYLoad = (transform || !treeConfig) && !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt < allList.length);
5261
+ reactData.scrollYLoad = scrollYLoad;
5262
+ return scrollYLoad;
5263
+ };
5264
+ /**
5265
+ * 如果为虚拟树,将树结构拍平
5266
+ * @returns
5267
+ */
5268
+ function handleVirtualTreeToList($xeTable) {
5269
+ const props = $xeTable;
5270
+ const reactData = $xeTable;
5271
+ const internalData = $xeTable;
5272
+ const {
5273
+ treeConfig
5274
+ } = props;
5275
+ const {
5276
+ treeExpandedMaps
5277
+ } = reactData;
5278
+ const {
5279
+ fullAllDataRowIdData
5280
+ } = internalData;
5281
+ const treeOpts = $xeTable.computeTreeOpts;
5282
+ const childrenField = treeOpts.children || treeOpts.childrenField;
5283
+ if (treeConfig && treeOpts.transform) {
5284
+ const fullData = [];
5285
+ const expandMaps = {};
5286
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
5287
+ const rowid = getRowid($xeTable, row);
5288
+ const parentRowid = getRowid($xeTable, parentRow);
5289
+ if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
5290
+ const rowRest = fullAllDataRowIdData[rowid];
5291
+ if (rowRest) {
5292
+ rowRest._index = fullData.length;
5293
+ }
5294
+ expandMaps[rowid] = 1;
5295
+ fullData.push(row);
5296
+ }
5297
+ }, {
5298
+ children: childrenField
5299
+ });
5300
+ internalData.afterFullData = fullData;
5301
+ updateScrollYStatus($xeTable, fullData);
5302
+ return fullData;
5303
+ }
5304
+ return internalData.afterFullData;
5305
+ }
5255
5306
  function computeRowHeight($xeTable) {
5256
5307
  const tableHeader = $xeTable.$refs.tableHeader;
5257
5308
  const tableBody = $xeTable.$refs.tableBody;
@@ -6269,6 +6320,7 @@ const Methods = {
6269
6320
  });
6270
6321
  },
6271
6322
  handleTableData(force) {
6323
+ const $xeTable = this;
6272
6324
  const {
6273
6325
  scrollYLoad,
6274
6326
  scrollYStore,
@@ -6281,7 +6333,7 @@ const Methods = {
6281
6333
  // 更新数据,处理筛选和排序
6282
6334
  this.updateAfterFullData();
6283
6335
  // 如果为虚拟树,将树结构拍平
6284
- fullList = this.handleVirtualTreeToList();
6336
+ fullList = handleVirtualTreeToList($xeTable);
6285
6337
  }
6286
6338
  const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
6287
6339
  tableData.forEach((row, $index) => {
@@ -6294,21 +6346,6 @@ const Methods = {
6294
6346
  this.tableData = tableData;
6295
6347
  return this.$nextTick();
6296
6348
  },
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
6349
  /**
6313
6350
  * 加载表格数据
6314
6351
  * @param {Array} datas 数据
@@ -6376,7 +6413,7 @@ const Methods = {
6376
6413
  editStore.insertMaps = {};
6377
6414
  editStore.removeList = [];
6378
6415
  editStore.removeMaps = {};
6379
- const sYLoad = this.updateScrollYStatus(fullData);
6416
+ const sYLoad = updateScrollYStatus($xeTable, fullData);
6380
6417
  this.isDragRowMove = false;
6381
6418
  // 全量数据
6382
6419
  this.tableFullData = fullData;
@@ -7385,47 +7422,6 @@ const Methods = {
7385
7422
  }
7386
7423
  return rowList;
7387
7424
  },
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
7425
  /**
7430
7426
  * 获取处理后全量的表格数据
7431
7427
  * 如果存在筛选条件,继续处理
@@ -11564,7 +11560,7 @@ const Methods = {
11564
11560
  reactData.isDragRowMove = true;
11565
11561
  $xeTable.handleTableData(treeConfig && transform);
11566
11562
  $xeTable.cacheRowMap();
11567
- $xeTable.updateScrollYStatus();
11563
+ updateScrollYStatus($xeTable);
11568
11564
  if (!(treeConfig && transform)) {
11569
11565
  $xeTable.updateAfterDataIndex();
11570
11566
  }
@@ -12324,11 +12320,15 @@ const Methods = {
12324
12320
  },
12325
12321
  clearRowExpandLoaded(row) {
12326
12322
  const $xeTable = this;
12323
+ const reactData = $xeTable;
12324
+ const internalData = $xeTable;
12325
+ const rExpandLazyLoadedMaps = {
12326
+ ...reactData.rowExpandLazyLoadedMaps
12327
+ };
12327
12328
  const {
12328
- expandOpts,
12329
- rowExpandLazyLoadedMaps,
12330
12329
  fullAllDataRowIdData
12331
- } = this;
12330
+ } = internalData;
12331
+ const expandOpts = $xeTable.computeExpandOpts;
12332
12332
  const {
12333
12333
  lazy
12334
12334
  } = expandOpts;
@@ -12336,15 +12336,10 @@ const Methods = {
12336
12336
  const rowRest = fullAllDataRowIdData[rowid];
12337
12337
  if (lazy && rowRest) {
12338
12338
  rowRest.expandLoaded = false;
12339
- const rowTempExpandLazyLoadedMaps = {
12340
- ...rowExpandLazyLoadedMaps
12341
- };
12342
- if (rowTempExpandLazyLoadedMaps[rowid]) {
12343
- delete rowTempExpandLazyLoadedMaps[rowid];
12344
- }
12345
- this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
12339
+ delete rExpandLazyLoadedMaps[rowid];
12346
12340
  }
12347
- return this.$nextTick();
12341
+ reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
12342
+ return $xeTable.$nextTick();
12348
12343
  },
12349
12344
  /**
12350
12345
  * 重新懒加载展开行,并展开内容
@@ -12464,6 +12459,8 @@ const Methods = {
12464
12459
  },
12465
12460
  handleAsyncRowExpand(row) {
12466
12461
  const $xeTable = this;
12462
+ const reactData = $xeTable;
12463
+ const internalData = $xeTable;
12467
12464
  return new Promise(resolve => {
12468
12465
  const {
12469
12466
  expandOpts
@@ -12473,37 +12470,42 @@ const Methods = {
12473
12470
  } = expandOpts;
12474
12471
  if (loadMethod) {
12475
12472
  const {
12476
- rowExpandLazyLoadedMaps,
12477
12473
  fullAllDataRowIdData
12478
- } = this;
12474
+ } = internalData;
12475
+ const rExpandLazyLoadedMaps = {
12476
+ ...reactData.rowExpandLazyLoadedMaps
12477
+ };
12479
12478
  const rowid = getRowid($xeTable, row);
12480
12479
  const rowRest = fullAllDataRowIdData[rowid];
12481
- rowExpandLazyLoadedMaps[rowid] = row;
12480
+ rExpandLazyLoadedMaps[rowid] = row;
12481
+ reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
12482
12482
  loadMethod({
12483
12483
  $table: $xeTable,
12484
12484
  row,
12485
- rowIndex: this.getRowIndex(row),
12486
- $rowIndex: this.getVMRowIndex(row)
12485
+ rowIndex: $xeTable.getRowIndex(row),
12486
+ $rowIndex: $xeTable.getVMRowIndex(row)
12487
12487
  }).then(() => {
12488
- const {
12489
- rowExpandedMaps
12490
- } = this;
12488
+ const rExpandedMaps = {
12489
+ ...reactData.rowExpandedMaps
12490
+ };
12491
12491
  if (rowRest) {
12492
12492
  rowRest.expandLoaded = true;
12493
12493
  }
12494
- rowExpandedMaps[rowid] = row;
12494
+ rExpandedMaps[rowid] = row;
12495
+ reactData.rowExpandedMaps = rExpandedMaps;
12495
12496
  }).catch(() => {
12496
12497
  if (rowRest) {
12497
12498
  rowRest.expandLoaded = false;
12498
12499
  }
12499
12500
  }).finally(() => {
12500
- const {
12501
- rowExpandLazyLoadedMaps
12502
- } = this;
12503
- if (rowExpandLazyLoadedMaps[rowid]) {
12504
- delete rowExpandLazyLoadedMaps[rowid];
12501
+ const rExpandLazyLoadedMaps = {
12502
+ ...reactData.rowExpandLazyLoadedMaps
12503
+ };
12504
+ if (rExpandLazyLoadedMaps[rowid]) {
12505
+ delete rExpandLazyLoadedMaps[rowid];
12505
12506
  }
12506
- this.$nextTick().then(() => this.recalculate()).then(() => resolve());
12507
+ reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
12508
+ $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => resolve());
12507
12509
  });
12508
12510
  } else {
12509
12511
  resolve();
@@ -12685,11 +12687,15 @@ const Methods = {
12685
12687
  },
12686
12688
  clearTreeExpandLoaded(rows) {
12687
12689
  const $xeTable = this;
12690
+ const reactData = $xeTable;
12691
+ const internalData = $xeTable;
12692
+ const tExpandedMaps = {
12693
+ ...reactData.treeExpandedMaps
12694
+ };
12688
12695
  const {
12689
- treeOpts,
12690
- treeExpandedMaps,
12691
12696
  fullAllDataRowIdData
12692
- } = this;
12697
+ } = internalData;
12698
+ const treeOpts = $xeTable.computeTreeOpts;
12693
12699
  const {
12694
12700
  transform
12695
12701
  } = treeOpts;
@@ -12702,23 +12708,25 @@ const Methods = {
12702
12708
  const rowRest = fullAllDataRowIdData[rowid];
12703
12709
  if (rowRest) {
12704
12710
  rowRest.treeLoaded = false;
12705
- if (treeExpandedMaps[rowid]) {
12706
- delete treeExpandedMaps[rowid];
12711
+ if (tExpandedMaps[rowid]) {
12712
+ delete tExpandedMaps[rowid];
12707
12713
  }
12708
12714
  }
12709
12715
  });
12710
12716
  }
12717
+ reactData.treeExpandedMaps = tExpandedMaps;
12711
12718
  if (transform) {
12712
- this.handleVirtualTreeToList();
12713
- return this.handleTableData();
12719
+ handleVirtualTreeToList($xeTable);
12720
+ return $xeTable.handleTableData();
12714
12721
  }
12715
- return this.$nextTick();
12722
+ return $xeTable.$nextTick();
12716
12723
  },
12717
12724
  /**
12718
12725
  * 重新懒加载树节点,并展开该节点
12719
12726
  * @param {Row} row 行对象
12720
12727
  */
12721
12728
  reloadTreeExpand(row) {
12729
+ const $xeTable = this;
12722
12730
  const {
12723
12731
  treeOpts,
12724
12732
  treeExpandLazyLoadedMaps
@@ -12734,7 +12742,7 @@ const Methods = {
12734
12742
  return this.handleAsyncTreeExpandChilds(row);
12735
12743
  }).then(() => {
12736
12744
  if (transform) {
12737
- this.handleVirtualTreeToList();
12745
+ handleVirtualTreeToList($xeTable);
12738
12746
  return this.handleTableData();
12739
12747
  }
12740
12748
  }).then(() => {
@@ -13013,8 +13021,9 @@ const Methods = {
13013
13021
  * @returns
13014
13022
  */
13015
13023
  handleVirtualTreeExpand(rows, expanded) {
13024
+ const $xeTable = this;
13016
13025
  return this.handleBaseTreeExpand(rows, expanded).then(() => {
13017
- this.handleVirtualTreeToList();
13026
+ handleVirtualTreeToList($xeTable);
13018
13027
  this.handleTableData();
13019
13028
  this.updateTreeDataIndex();
13020
13029
  }).then(() => {
@@ -13068,6 +13077,7 @@ const Methods = {
13068
13077
  * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
13069
13078
  */
13070
13079
  clearTreeExpand() {
13080
+ const $xeTable = this;
13071
13081
  const {
13072
13082
  treeOpts,
13073
13083
  tableFullData
@@ -13086,7 +13096,7 @@ const Methods = {
13086
13096
  }
13087
13097
  return this.handleTableData().then(() => {
13088
13098
  if (transform) {
13089
- this.handleVirtualTreeToList();
13099
+ handleVirtualTreeToList($xeTable);
13090
13100
  return this.handleTableData();
13091
13101
  }
13092
13102
  }).then(() => {
@@ -13568,6 +13578,10 @@ const Methods = {
13568
13578
  }
13569
13579
  this.$nextTick(this.updateStyle);
13570
13580
  },
13581
+ updateScrollYStatus() {
13582
+ const $xeTable = this;
13583
+ return updateScrollYStatus($xeTable);
13584
+ },
13571
13585
  /**
13572
13586
  * 如果有滚动条,则滚动到对应的位置
13573
13587
  * @param {Number} scrollLeft 左距离