vxe-table 3.12.2 → 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/es/style.css +1 -1
- package/es/table/src/methods.js +92 -68
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +117 -98
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +105 -94
- package/lib/table/src/methods.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/table/src/methods.ts +104 -71
- /package/es/{iconfont.1736124502269.ttf → iconfont.1736136510879.ttf} +0 -0
- /package/es/{iconfont.1736124502269.woff → iconfont.1736136510879.woff} +0 -0
- /package/es/{iconfont.1736124502269.woff2 → iconfont.1736136510879.woff2} +0 -0
- /package/lib/{iconfont.1736124502269.ttf → iconfont.1736136510879.ttf} +0 -0
- /package/lib/{iconfont.1736124502269.woff → iconfont.1736136510879.woff} +0 -0
- /package/lib/{iconfont.1736124502269.woff2 → iconfont.1736136510879.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -260,6 +260,66 @@ function cacheColumnMap($xeTable) {
|
|
|
260
260
|
reactData.expandColumn = expandColumn;
|
|
261
261
|
reactData.isAllOverflow = isAllOverflow;
|
|
262
262
|
}
|
|
263
|
+
const updateScrollYStatus = ($xeTable, fullData) => {
|
|
264
|
+
const props = $xeTable;
|
|
265
|
+
const reactData = $xeTable;
|
|
266
|
+
const internalData = $xeTable;
|
|
267
|
+
const {
|
|
268
|
+
treeConfig
|
|
269
|
+
} = props;
|
|
270
|
+
const sYOpts = $xeTable.computeSYOpts;
|
|
271
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
272
|
+
const {
|
|
273
|
+
transform
|
|
274
|
+
} = treeOpts;
|
|
275
|
+
const allList = fullData || internalData.tableFullData;
|
|
276
|
+
// 如果gt为0,则总是启用
|
|
277
|
+
const scrollYLoad = (transform || !treeConfig) && !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt < allList.length);
|
|
278
|
+
reactData.scrollYLoad = scrollYLoad;
|
|
279
|
+
return scrollYLoad;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* 如果为虚拟树,将树结构拍平
|
|
283
|
+
* @returns
|
|
284
|
+
*/
|
|
285
|
+
function handleVirtualTreeToList($xeTable) {
|
|
286
|
+
const props = $xeTable;
|
|
287
|
+
const reactData = $xeTable;
|
|
288
|
+
const internalData = $xeTable;
|
|
289
|
+
const {
|
|
290
|
+
treeConfig
|
|
291
|
+
} = props;
|
|
292
|
+
const {
|
|
293
|
+
treeExpandedMaps
|
|
294
|
+
} = reactData;
|
|
295
|
+
const {
|
|
296
|
+
fullAllDataRowIdData
|
|
297
|
+
} = internalData;
|
|
298
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
299
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
300
|
+
if (treeConfig && treeOpts.transform) {
|
|
301
|
+
const fullData = [];
|
|
302
|
+
const expandMaps = {};
|
|
303
|
+
_xeUtils.default.eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
|
|
304
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
305
|
+
const parentRowid = (0, _util.getRowid)($xeTable, parentRow);
|
|
306
|
+
if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
|
|
307
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
308
|
+
if (rowRest) {
|
|
309
|
+
rowRest._index = fullData.length;
|
|
310
|
+
}
|
|
311
|
+
expandMaps[rowid] = 1;
|
|
312
|
+
fullData.push(row);
|
|
313
|
+
}
|
|
314
|
+
}, {
|
|
315
|
+
children: childrenField
|
|
316
|
+
});
|
|
317
|
+
internalData.afterFullData = fullData;
|
|
318
|
+
updateScrollYStatus($xeTable, fullData);
|
|
319
|
+
return fullData;
|
|
320
|
+
}
|
|
321
|
+
return internalData.afterFullData;
|
|
322
|
+
}
|
|
263
323
|
function computeRowHeight($xeTable) {
|
|
264
324
|
const tableHeader = $xeTable.$refs.tableHeader;
|
|
265
325
|
const tableBody = $xeTable.$refs.tableBody;
|
|
@@ -1277,6 +1337,7 @@ const Methods = {
|
|
|
1277
1337
|
});
|
|
1278
1338
|
},
|
|
1279
1339
|
handleTableData(force) {
|
|
1340
|
+
const $xeTable = this;
|
|
1280
1341
|
const {
|
|
1281
1342
|
scrollYLoad,
|
|
1282
1343
|
scrollYStore,
|
|
@@ -1289,7 +1350,7 @@ const Methods = {
|
|
|
1289
1350
|
// 更新数据,处理筛选和排序
|
|
1290
1351
|
this.updateAfterFullData();
|
|
1291
1352
|
// 如果为虚拟树,将树结构拍平
|
|
1292
|
-
fullList =
|
|
1353
|
+
fullList = handleVirtualTreeToList($xeTable);
|
|
1293
1354
|
}
|
|
1294
1355
|
const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
|
|
1295
1356
|
tableData.forEach((row, $index) => {
|
|
@@ -1302,21 +1363,6 @@ const Methods = {
|
|
|
1302
1363
|
this.tableData = tableData;
|
|
1303
1364
|
return this.$nextTick();
|
|
1304
1365
|
},
|
|
1305
|
-
updateScrollYStatus(fullData) {
|
|
1306
|
-
const {
|
|
1307
|
-
treeConfig,
|
|
1308
|
-
treeOpts,
|
|
1309
|
-
sYOpts
|
|
1310
|
-
} = this;
|
|
1311
|
-
const {
|
|
1312
|
-
transform
|
|
1313
|
-
} = treeOpts;
|
|
1314
|
-
const allList = fullData || this.tableFullData;
|
|
1315
|
-
// 如果gt为0,则总是启用
|
|
1316
|
-
const scrollYLoad = (transform || !treeConfig) && !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= allList.length);
|
|
1317
|
-
this.scrollYLoad = scrollYLoad;
|
|
1318
|
-
return scrollYLoad;
|
|
1319
|
-
},
|
|
1320
1366
|
/**
|
|
1321
1367
|
* 加载表格数据
|
|
1322
1368
|
* @param {Array} datas 数据
|
|
@@ -1384,7 +1430,7 @@ const Methods = {
|
|
|
1384
1430
|
editStore.insertMaps = {};
|
|
1385
1431
|
editStore.removeList = [];
|
|
1386
1432
|
editStore.removeMaps = {};
|
|
1387
|
-
const sYLoad =
|
|
1433
|
+
const sYLoad = updateScrollYStatus($xeTable, fullData);
|
|
1388
1434
|
this.isDragRowMove = false;
|
|
1389
1435
|
// 全量数据
|
|
1390
1436
|
this.tableFullData = fullData;
|
|
@@ -2391,47 +2437,6 @@ const Methods = {
|
|
|
2391
2437
|
}
|
|
2392
2438
|
return rowList;
|
|
2393
2439
|
},
|
|
2394
|
-
/**
|
|
2395
|
-
* 如果为虚拟树,将树结构拍平
|
|
2396
|
-
* @returns
|
|
2397
|
-
*/
|
|
2398
|
-
handleVirtualTreeToList() {
|
|
2399
|
-
const $xeTable = this;
|
|
2400
|
-
const internalData = $xeTable;
|
|
2401
|
-
const {
|
|
2402
|
-
fullAllDataRowIdData
|
|
2403
|
-
} = internalData;
|
|
2404
|
-
const {
|
|
2405
|
-
treeOpts,
|
|
2406
|
-
treeConfig,
|
|
2407
|
-
treeExpandedMaps,
|
|
2408
|
-
afterTreeFullData,
|
|
2409
|
-
afterFullData
|
|
2410
|
-
} = this;
|
|
2411
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2412
|
-
if (treeConfig && treeOpts.transform) {
|
|
2413
|
-
const fullData = [];
|
|
2414
|
-
const expandMaps = {};
|
|
2415
|
-
_xeUtils.default.eachTree(afterTreeFullData, (row, index, items, path, parentRow) => {
|
|
2416
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
2417
|
-
const parentRowid = (0, _util.getRowid)(this, parentRow);
|
|
2418
|
-
if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
|
|
2419
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
2420
|
-
if (rowRest) {
|
|
2421
|
-
rowRest._index = fullData.length;
|
|
2422
|
-
}
|
|
2423
|
-
expandMaps[rowid] = 1;
|
|
2424
|
-
fullData.push(row);
|
|
2425
|
-
}
|
|
2426
|
-
}, {
|
|
2427
|
-
children: childrenField
|
|
2428
|
-
});
|
|
2429
|
-
this.afterFullData = fullData;
|
|
2430
|
-
this.updateScrollYStatus(fullData);
|
|
2431
|
-
return fullData;
|
|
2432
|
-
}
|
|
2433
|
-
return afterFullData;
|
|
2434
|
-
},
|
|
2435
2440
|
/**
|
|
2436
2441
|
* 获取处理后全量的表格数据
|
|
2437
2442
|
* 如果存在筛选条件,继续处理
|
|
@@ -6566,7 +6571,7 @@ const Methods = {
|
|
|
6566
6571
|
reactData.isDragRowMove = true;
|
|
6567
6572
|
$xeTable.handleTableData(treeConfig && transform);
|
|
6568
6573
|
$xeTable.cacheRowMap();
|
|
6569
|
-
$xeTable
|
|
6574
|
+
updateScrollYStatus($xeTable);
|
|
6570
6575
|
if (!(treeConfig && transform)) {
|
|
6571
6576
|
$xeTable.updateAfterDataIndex();
|
|
6572
6577
|
}
|
|
@@ -7328,11 +7333,13 @@ const Methods = {
|
|
|
7328
7333
|
},
|
|
7329
7334
|
clearRowExpandLoaded(row) {
|
|
7330
7335
|
const $xeTable = this;
|
|
7336
|
+
const reactData = $xeTable;
|
|
7337
|
+
const internalData = $xeTable;
|
|
7338
|
+
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
7331
7339
|
const {
|
|
7332
|
-
expandOpts,
|
|
7333
|
-
rowExpandLazyLoadedMaps,
|
|
7334
7340
|
fullAllDataRowIdData
|
|
7335
|
-
} =
|
|
7341
|
+
} = internalData;
|
|
7342
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
7336
7343
|
const {
|
|
7337
7344
|
lazy
|
|
7338
7345
|
} = expandOpts;
|
|
@@ -7340,13 +7347,10 @@ const Methods = {
|
|
|
7340
7347
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
7341
7348
|
if (lazy && rowRest) {
|
|
7342
7349
|
rowRest.expandLoaded = false;
|
|
7343
|
-
|
|
7344
|
-
if (rowTempExpandLazyLoadedMaps[rowid]) {
|
|
7345
|
-
delete rowTempExpandLazyLoadedMaps[rowid];
|
|
7346
|
-
}
|
|
7347
|
-
this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
|
|
7350
|
+
delete rExpandLazyLoadedMaps[rowid];
|
|
7348
7351
|
}
|
|
7349
|
-
|
|
7352
|
+
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
|
|
7353
|
+
return $xeTable.$nextTick();
|
|
7350
7354
|
},
|
|
7351
7355
|
/**
|
|
7352
7356
|
* 重新懒加载展开行,并展开内容
|
|
@@ -7466,6 +7470,8 @@ const Methods = {
|
|
|
7466
7470
|
},
|
|
7467
7471
|
handleAsyncRowExpand(row) {
|
|
7468
7472
|
const $xeTable = this;
|
|
7473
|
+
const reactData = $xeTable;
|
|
7474
|
+
const internalData = $xeTable;
|
|
7469
7475
|
return new Promise(resolve => {
|
|
7470
7476
|
const {
|
|
7471
7477
|
expandOpts
|
|
@@ -7475,37 +7481,36 @@ const Methods = {
|
|
|
7475
7481
|
} = expandOpts;
|
|
7476
7482
|
if (loadMethod) {
|
|
7477
7483
|
const {
|
|
7478
|
-
rowExpandLazyLoadedMaps,
|
|
7479
7484
|
fullAllDataRowIdData
|
|
7480
|
-
} =
|
|
7485
|
+
} = internalData;
|
|
7486
|
+
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
7481
7487
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
7482
7488
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
7483
|
-
|
|
7489
|
+
rExpandLazyLoadedMaps[rowid] = row;
|
|
7490
|
+
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
|
|
7484
7491
|
loadMethod({
|
|
7485
7492
|
$table: $xeTable,
|
|
7486
7493
|
row,
|
|
7487
|
-
rowIndex:
|
|
7488
|
-
$rowIndex:
|
|
7494
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
7495
|
+
$rowIndex: $xeTable.getVMRowIndex(row)
|
|
7489
7496
|
}).then(() => {
|
|
7490
|
-
const {
|
|
7491
|
-
rowExpandedMaps
|
|
7492
|
-
} = this;
|
|
7497
|
+
const rExpandedMaps = Object.assign({}, reactData.rowExpandedMaps);
|
|
7493
7498
|
if (rowRest) {
|
|
7494
7499
|
rowRest.expandLoaded = true;
|
|
7495
7500
|
}
|
|
7496
|
-
|
|
7501
|
+
rExpandedMaps[rowid] = row;
|
|
7502
|
+
reactData.rowExpandedMaps = rExpandedMaps;
|
|
7497
7503
|
}).catch(() => {
|
|
7498
7504
|
if (rowRest) {
|
|
7499
7505
|
rowRest.expandLoaded = false;
|
|
7500
7506
|
}
|
|
7501
7507
|
}).finally(() => {
|
|
7502
|
-
const {
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
if (rowExpandLazyLoadedMaps[rowid]) {
|
|
7506
|
-
delete rowExpandLazyLoadedMaps[rowid];
|
|
7508
|
+
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
7509
|
+
if (rExpandLazyLoadedMaps[rowid]) {
|
|
7510
|
+
delete rExpandLazyLoadedMaps[rowid];
|
|
7507
7511
|
}
|
|
7508
|
-
|
|
7512
|
+
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
|
|
7513
|
+
$xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => resolve());
|
|
7509
7514
|
});
|
|
7510
7515
|
} else {
|
|
7511
7516
|
resolve();
|
|
@@ -7685,11 +7690,13 @@ const Methods = {
|
|
|
7685
7690
|
},
|
|
7686
7691
|
clearTreeExpandLoaded(rows) {
|
|
7687
7692
|
const $xeTable = this;
|
|
7693
|
+
const reactData = $xeTable;
|
|
7694
|
+
const internalData = $xeTable;
|
|
7695
|
+
const tExpandedMaps = Object.assign({}, reactData.treeExpandedMaps);
|
|
7688
7696
|
const {
|
|
7689
|
-
treeOpts,
|
|
7690
|
-
treeExpandedMaps,
|
|
7691
7697
|
fullAllDataRowIdData
|
|
7692
|
-
} =
|
|
7698
|
+
} = internalData;
|
|
7699
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
7693
7700
|
const {
|
|
7694
7701
|
transform
|
|
7695
7702
|
} = treeOpts;
|
|
@@ -7702,23 +7709,25 @@ const Methods = {
|
|
|
7702
7709
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
7703
7710
|
if (rowRest) {
|
|
7704
7711
|
rowRest.treeLoaded = false;
|
|
7705
|
-
if (
|
|
7706
|
-
delete
|
|
7712
|
+
if (tExpandedMaps[rowid]) {
|
|
7713
|
+
delete tExpandedMaps[rowid];
|
|
7707
7714
|
}
|
|
7708
7715
|
}
|
|
7709
7716
|
});
|
|
7710
7717
|
}
|
|
7718
|
+
reactData.treeExpandedMaps = tExpandedMaps;
|
|
7711
7719
|
if (transform) {
|
|
7712
|
-
|
|
7713
|
-
return
|
|
7720
|
+
handleVirtualTreeToList($xeTable);
|
|
7721
|
+
return $xeTable.handleTableData();
|
|
7714
7722
|
}
|
|
7715
|
-
return
|
|
7723
|
+
return $xeTable.$nextTick();
|
|
7716
7724
|
},
|
|
7717
7725
|
/**
|
|
7718
7726
|
* 重新懒加载树节点,并展开该节点
|
|
7719
7727
|
* @param {Row} row 行对象
|
|
7720
7728
|
*/
|
|
7721
7729
|
reloadTreeExpand(row) {
|
|
7730
|
+
const $xeTable = this;
|
|
7722
7731
|
const {
|
|
7723
7732
|
treeOpts,
|
|
7724
7733
|
treeExpandLazyLoadedMaps
|
|
@@ -7734,7 +7743,7 @@ const Methods = {
|
|
|
7734
7743
|
return this.handleAsyncTreeExpandChilds(row);
|
|
7735
7744
|
}).then(() => {
|
|
7736
7745
|
if (transform) {
|
|
7737
|
-
|
|
7746
|
+
handleVirtualTreeToList($xeTable);
|
|
7738
7747
|
return this.handleTableData();
|
|
7739
7748
|
}
|
|
7740
7749
|
}).then(() => {
|
|
@@ -8011,8 +8020,9 @@ const Methods = {
|
|
|
8011
8020
|
* @returns
|
|
8012
8021
|
*/
|
|
8013
8022
|
handleVirtualTreeExpand(rows, expanded) {
|
|
8023
|
+
const $xeTable = this;
|
|
8014
8024
|
return this.handleBaseTreeExpand(rows, expanded).then(() => {
|
|
8015
|
-
|
|
8025
|
+
handleVirtualTreeToList($xeTable);
|
|
8016
8026
|
this.handleTableData();
|
|
8017
8027
|
this.updateTreeDataIndex();
|
|
8018
8028
|
}).then(() => {
|
|
@@ -8066,6 +8076,7 @@ const Methods = {
|
|
|
8066
8076
|
* 手动清空树形节点的展开状态,数据会恢复成未展开的状态
|
|
8067
8077
|
*/
|
|
8068
8078
|
clearTreeExpand() {
|
|
8079
|
+
const $xeTable = this;
|
|
8069
8080
|
const {
|
|
8070
8081
|
treeOpts,
|
|
8071
8082
|
tableFullData
|
|
@@ -8084,7 +8095,7 @@ const Methods = {
|
|
|
8084
8095
|
}
|
|
8085
8096
|
return this.handleTableData().then(() => {
|
|
8086
8097
|
if (transform) {
|
|
8087
|
-
|
|
8098
|
+
handleVirtualTreeToList($xeTable);
|
|
8088
8099
|
return this.handleTableData();
|
|
8089
8100
|
}
|
|
8090
8101
|
}).then(() => {
|